List of usage examples for com.vaadin.ui CssLayout setId
@Override public void setId(String id)
From source file:edu.nps.moves.mmowgli.modules.maps.OpenLayersMap.java
License:Open Source License
public void initGuiTL() { setSpacing(true);/*ww w. j ava 2 s . c om*/ setSizeUndefined(); setWidth("100%"); addStyleName("m-marginleft-20"); Label lab; addComponent(lab = new HtmlLabel(title)); lab.setWidth(null); setComponentAlignment(lab, Alignment.MIDDLE_CENTER); CssLayout cssLay = new CssLayout(); cssLay.addStyleName("m-greybackground"); cssLay.addStyleName("m-darkgreyborder"); cssLay.setWidth("960px"); cssLay.setHeight("600px"); cssLay.setId("mmowgliMap"); addComponent(cssLay); setComponentAlignment(cssLay, Alignment.TOP_CENTER); /* See http://wiki.openstreetmap.org/wiki/OpenLayers_Simple_Example This requires the "http://openlayers.org/api/OpenLayers.js" file to be loaded: see the annotation in Mmowgli2UI.java. */ /* One example layer: String js = "var m_map = new OpenLayers.Map('mmowgliMap');"+ "var m_wms = new OpenLayers.Layer.WMS( \"OpenLayers WMS\","+ "\"http://vmap0.tiles.osgeo.org/wms/vmap0\", {layers: 'basic'} );"+ "m_map.addLayer(m_wms);"+ "m_map.zoomToMaxExtent();"; */ String jsOSM = "mMap = new OpenLayers.Map('mmowgliMap');" + // "shadeLayer = new OpenLayers.Layer.WMS("+ // "\"Shaded Relief\"," + // "\"http://ims.cr.usgs.gov:80/servlet19/com.esri.wms.Esrimap/USGS_EDC_Elev_NED_3\","+ // "{layers: HR-NED.IMAGE, reaspect: false, transparent: true, visibility: false}); "+ "var osLay = new OpenLayers.Layer.OSM();" + "var fromProjection = new OpenLayers.Projection(\"EPSG:4326\");" + // Transform from WGS 1984 "var toProjection = new OpenLayers.Projection(\"EPSG:900913\");" + // to Spherical Mercator Projection "var position = new OpenLayers.LonLat(-121.875267, 36.599878).transform( fromProjection, toProjection);" + "var zoom = 15;" + " mMap.addLayer(osLay);" + //" mMap.addLayer(shadeLayer);"+ //" mMap.addControl(new OpenLayers.Control.LayerSwitcher());"+ " mMap.setCenter(position, zoom );"; /* String worldWind = "mMap = new OpenLayers.Map('mmowgliMap', {'maxResolution': .28125, tileSize: new OpenLayers.Size(512, 512)});"+ "var osLay = new OpenLayers.Layer.OSM();"+ "var ol_wms = new OpenLayers.Layer.WMS( \"OpenLayers WMS\", \"http://vmap0.tiles.osgeo.org/wms/vmap0?\", {layers: 'basic'} );"+ // "var ww = new OpenLayers.Layer.WorldWind( \"Bathy\",\"http://worldwind25.arc.nasa.gov/tile/tile.aspx?\", 36, 4,{T:\"bmng.topo.bathy.200406\"});"+ // "var ww2 = new OpenLayers.Layer.WorldWind( \"LANDSAT\",\"http://worldwind25.arc.nasa.gov/tile/tile.aspx\", 2.25, 4,{T:\"105\"});"+ "mMap.addLayers([osLay]); //,ol_wms]);"+ //, ww, ww2]);"+ // "mMap.addControl(new OpenLayers.Control.LayerSwitcher());"+ "var fromProjection = new OpenLayers.Projection(\"EPSG:4326\");"+ // Transform from WGS 1984 "var toProjection = new OpenLayers.Projection(\"EPSG:900913\");"+ // to Spherical Mercator Projection "var position = new OpenLayers.LonLat(-121.875267, 36.599878).transform( fromProjection, toProjection);"+ "var zoom = 15;"+ //"mMap.setCenter(new OpenLayers.LonLat(-71.4, 42.3), 6);"+ " mMap.setCenter(position, zoom );"+ ""; */ JavaScript.getCurrent().execute(jsOSM); }
From source file:org.lucidj.ui.gauss.GaussUI.java
License:Apache License
private void initToolbarArea() { hToolbarArea.setStyleName("ui-toolbar-area"); hToolbarArea.setSizeUndefined();/* www.j a v a2 s .co m*/ hToolbarArea.setWidth("100%"); CssLayout home_buttons = new CssLayout(); home_buttons.setStyleName("ui-toolbar-area-home"); home_buttons.setWidth(get_default_left_panel_width(), Sizeable.Unit.PIXELS); home_buttons.setId("_home_buttons"); final Button toggle_menu = new Button(); toggle_menu.setWidth(3, Unit.EM); toggle_menu.setIcon(FontAwesome.CHEVRON_DOWN); toggle_menu.addStyleName("tiny"); toggle_menu.addStyleName("link"); toggle_menu.addStyleName("ui-toolbar-spacer"); toggle_menu.addStyleName("ui-toggle-button"); toggle_menu.setId("_toggle_menu"); home_buttons.addComponent(toggle_menu); toggle_menu.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent clickEvent) { if (!hsMenuContents.isLocked()) { default_left_panel_width_px = (int) hsMenuContents.getSplitPosition(); acMenu.setVisible(false); hsMenuContents.setMinSplitPosition(0, Unit.PIXELS); hsMenuContents.setSplitPosition(0, Sizeable.Unit.PIXELS); toggle_menu.setIcon(FontAwesome.CHEVRON_RIGHT); hsMenuContents.setLocked(true); } else { hsMenuContents.setLocked(false); acMenu.setVisible(true); hsMenuContents.setMinSplitPosition(MIN_LEFT_PANEL_WIDTH_PX, Unit.PIXELS); hsMenuContents.setSplitPosition(get_default_left_panel_width(), Unit.PIXELS); toggle_menu.setIcon(FontAwesome.CHEVRON_DOWN); } } }); final Button home = new Button("Home"); home.setIcon(FontAwesome.HOME); home.addStyleName("tiny"); home.addStyleName("ui-toolbar-spacer"); home.addStyleName("ui-toggle-button"); home.setId("_home"); home_buttons.addComponent(home); home.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent clickEvent) { navigator.navigateTo("home"); } }); final Button new_button = new Button("New"); new_button.setIcon(FontAwesome.EDIT); new_button.addStyleName("tiny"); new_button.addStyleName("primary"); new_button.addStyleName("ui-toggle-button"); new_button.setId("_new"); home_buttons.addComponent(new_button); new_button.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent clickEvent) { navigator.navigateTo("new"); } }); hToolbarArea.addComponent(home_buttons); hToolbarPlaceholder = new CssLayout(); hToolbarPlaceholder.setSizeFull(); hToolbarArea.addComponent(hToolbarPlaceholder); hToolbarArea.setExpandRatio(hToolbarPlaceholder, 1.0f); final Button eject_view = new Button(); eject_view.setIcon(FontAwesome.EXTERNAL_LINK); eject_view.addStyleName("tiny"); eject_view.addStyleName("link"); eject_view.addStyleName("ui-toggle-button"); eject_view.setId("_eject_view"); hToolbarArea.addComponent(eject_view); eject_view.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent clickEvent) { Notification.show("Not implemented", Notification.Type.HUMANIZED_MESSAGE); } }); toggle_sidebar = new Button(); toggle_sidebar.setWidth(3, Unit.EM); toggle_sidebar.addStyleName("tiny"); toggle_sidebar.addStyleName("link"); toggle_sidebar.addStyleName("ui-toolbar-spacer"); toggle_sidebar.addStyleName("ui-toggle-button"); toggle_sidebar.setId("_toggle_sidebar"); hToolbarArea.addComponent(toggle_sidebar); toggle_sidebar.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent clickEvent) { show_sidebar(!sidebar_visible()); } }); }
From source file:org.opennms.features.vaadin.surveillanceviews.ui.SurveillanceView.java
License:Open Source License
/** * Set the view to be displayed by this component. * * @param view the view to be displayed/* ww w .ja v a2 s .com*/ */ public void setView(View view) { /** * set the field */ m_view = view; /** * check whether refreshing is enabled */ m_refreshEnabled = (m_view.getRefreshSeconds() > 0); m_countdown = m_view.getRefreshSeconds(); /** * alter the table header */ m_surveillanceViewTableHeader.setCaptionText("Surveillance view: " + m_view.getName()); m_surveillanceViewTableHeader.select(m_view.getName()); m_surveillanceViewTableHeader.getNativeSelect().setEnabled(m_enabled); /** * remove old components */ removeAllComponents(); /** * create the layout */ upperLayout = new VerticalLayout(); upperLayout.setId("surveillance-window"); upperLayout.setSpacing(false); /** * create surveillance view table... */ m_surveillanceViewTable = new SurveillanceViewTable(m_view, m_surveillanceViewService, m_dashboard, m_enabled); /** * ...and add the header and the table itself */ upperLayout.addComponent(new Label("<div id=\"surveillanceview\"/>", ContentMode.HTML)); upperLayout.addComponent(m_surveillanceViewTableHeader); upperLayout.addComponent(m_surveillanceViewTable); if (!m_dashboard) { addComponent(upperLayout); } else { /** * if dashboard should be displayed add the detail tables and components */ CssLayout leftCssLayout = new CssLayout() { @Override protected String getCss(Component c) { return "padding-bottom: 6px;"; } }; leftCssLayout.setPrimaryStyleName("col-md-11"); leftCssLayout.setId("dashboard-content"); CssLayout rightCssLayout = new CssLayout(); rightCssLayout.setPrimaryStyleName("col-md-1"); lowerLayout = new VerticalLayout(); lowerLayout.setSpacing(true); /** * create the tables and components */ SurveillanceViewAlarmTable surveillanceViewAlarmTable = new SurveillanceViewAlarmTable( m_surveillanceViewService, m_enabled); SurveillanceViewNotificationTable surveillanceViewNotificationTable = new SurveillanceViewNotificationTable( m_surveillanceViewService, m_enabled); SurveillanceViewNodeRtcTable surveillanceViewNodeRtcTable = new SurveillanceViewNodeRtcTable( m_surveillanceViewService, m_enabled); SurveillanceViewGraphComponent surveillanceViewGraphComponent = new SurveillanceViewGraphComponent( m_surveillanceViewService, m_enabled); /** * add them to the layout */ surveillanceViewAlarmTable.setId("alarms"); lowerLayout.addComponent(surveillanceViewAlarmTable); surveillanceViewNotificationTable.setId("notifications"); lowerLayout.addComponent(surveillanceViewNotificationTable); surveillanceViewNodeRtcTable.setId("outages"); lowerLayout.addComponent(surveillanceViewNodeRtcTable); surveillanceViewGraphComponent.setId("resourcegraphs"); lowerLayout.addComponent(surveillanceViewGraphComponent); /** * associate the detail tables and components with the surveillance view table */ m_surveillanceViewTable.addDetailsTable(surveillanceViewAlarmTable); m_surveillanceViewTable.addDetailsTable(surveillanceViewNotificationTable); m_surveillanceViewTable.addDetailsTable(surveillanceViewNodeRtcTable); m_surveillanceViewTable.addDetailsTable(surveillanceViewGraphComponent); /** * add the layout to this component */ addComponent(lowerLayout); leftCssLayout.addComponent(upperLayout); leftCssLayout.addComponent(lowerLayout); CssLayout resultsSidebar = new CssLayout(); resultsSidebar .setPrimaryStyleName("resource-graphs-sidebar hidden-print hidden-xs hidden-sm sidebar-fixed"); resultsSidebar.setId("results-sidebar"); resultsSidebar.addComponent(new Label("<ul class=\"nav nav-stacked\">\n" + " <li>\n" + " <a href=\"#surveillanceview\" data-target=\"#surveillanceview\">Surveillance View</a>\n" + " </li>\n" + " <li>\n" + " <a href=\"#alarms\" data-target=\"#alarms\">Alarms</a>\n" + " </li>\n" + " <li>\n" + " <a href=\"#notifications\" data-target=\"#notifications\">Notifications</a>\n" + " </li>\n" + " <li>\n" + " <a href=\"#outages\" data-target=\"#outages\">Outages</a>\n" + " </li>\n" + " <li>\n" + " <a href=\"#resourcegraphs\" data-target=\"#resourcegraphs\">Resource Graphs</a>\n" + " </li>\n" + " </ul>" + "<script type=\"text/javascript\">\n" + " $('body').scrollspy({ target: '#results-sidebar' });\n" + "</script>\n", ContentMode.HTML)); rightCssLayout.addComponent(resultsSidebar); addComponent(leftCssLayout); addComponent(rightCssLayout); } }