List of usage examples for com.vaadin.ui HorizontalLayout addComponentAsFirst
public void addComponentAsFirst(Component c)
From source file:rs.pupin.jpo.esta_ld.EstaLdComponent.java
private void refresh() { contentLayout.removeAllComponents(); // create left part where the map goes // first create a vertical layout for components geoLayout = new VerticalLayout(); geoLayout.setDebugId("l-geo"); geoLayout.setSizeUndefined();/* w ww.jav a 2s .co m*/ // geoLayout.setWidth(GEO_PART_WIDTH); // geoLayout.setHeight("100%"); geoLayout.setSizeFull(); geoLayout.setSpacing(true); contentLayout.addComponent(geoLayout); getWindow().executeJavaScript("$('div#l-geo').append('<div id=\"esta-map-popup\"><p></p></div>')"); // contentLayout.setExpandRatio(geoLayout, 0.0f); // create Level and +- controls HorizontalLayout hl = new HorizontalLayout(); hl.setSpacing(true); final Label levelLabel = new Label(LEVEL_LABEL_CONTENT, Label.CONTENT_XHTML); hl.addComponent(levelLabel); hl.setComponentAlignment(levelLabel, Alignment.MIDDLE_LEFT); btnAggregColor = new Button("Aggregated Coloring"); btnAggregColor.addStyleName("dim-name"); btnAggregColor.addStyleName("btn-aggreg-coloring"); btnAggregColor.addListener(new Button.ClickListener() { public void buttonClick(Button.ClickEvent event) { getWindow().executeJavaScript("toggleAggregatedColoring()"); } }); hl.addComponent(btnAggregColor); geoLayout.addComponent(hl); geoLayout.setExpandRatio(hl, 0.0f); // create a layout for the map // mapLayout = new VerticalLayout(); mapLayout = new VerticalLayout() { @Override public void attach() { getWindow().executeJavaScript("console.log('Attached the map')"); } }; mapLayout.addListener(new ComponentAttachListener() { public void componentAttachedToContainer(ComponentAttachEvent event) { getWindow().executeJavaScript("console.log('ComponentAttachedListener triggered')"); } }); mapLayout.setSizeUndefined(); mapLayout.setWidth("100%"); // mapLayout.setHeight("620px"); mapLayout.setHeight("100%"); mapLayout.setDebugId("map"); mapLayout.addStyleName("leaflet-container"); mapLayout.addStyleName("leaflet-fade-anim"); geoLayout.addComponent(mapLayout); geoLayout.setExpandRatio(mapLayout, 2.0f); rightLayout = new VerticalLayout(); rightLayout.setSizeUndefined(); rightLayout.setWidth("100%"); rightLayout.setSizeFull(); rightLayout.setSpacing(true); contentLayout.addComponent(rightLayout); // contentLayout.setExpandRatio(rightLayout, 2.0f); dimLayout = new GridLayout(6, 1); dimLayout.setColumnExpandRatio(0, 0.0f); dimLayout.setColumnExpandRatio(1, 0.0f); dimLayout.setColumnExpandRatio(2, 2.0f); dimLayout.setColumnExpandRatio(3, 0.0f); dimLayout.setColumnExpandRatio(4, 0.0f); dimLayout.setColumnExpandRatio(5, 2.0f); dimLayout.setDebugId("dim-layout"); // dimLayout.setSizeFull(); dimLayout.setWidth("100%"); dimLayout.setSpacing(true); // rightLayout.addComponent(dimLayout); settingsLayout.addComponent(dimLayout); dimLayout.addListener(new LayoutEvents.LayoutClickListener() { public void layoutClick(LayoutEvents.LayoutClickEvent event) { Component btnAggreg = event.getClickedComponent(); if (!(btnAggreg instanceof Label)) return; if (btnAggreg.getStyleName().contains("selected")) { btnAggreg.removeStyleName("selected"); } else { btnAggreg.addStyleName("selected"); } aggregDimensionsChanged(); } }); refreshDimensions(); HorizontalLayout chartControlsLayout = new HorizontalLayout(); chartControlsLayout.setDebugId("l-chart-controls"); chartControlsLayout.setWidth("100%"); chartControlsLayout.setSpacing(true); rightLayout.addComponent(chartControlsLayout); rightLayout.setExpandRatio(chartControlsLayout, 0.0f); btnCompare = new Button("Compare"); btnCompare.setDebugId("btn-compare"); btnCompare.addListener(new Button.ClickListener() { public void buttonClick(Button.ClickEvent event) { getWindow().executeJavaScript("toggleCompare()"); } }); chartControlsLayout.addComponent(btnCompare); btnSwap = new Button("Swap"); btnSwap.setDebugId("btn-swap"); btnSwap.addListener(new Button.ClickListener() { public void buttonClick(Button.ClickEvent event) { getWindow().executeJavaScript("toggleSwap()"); } }); chartControlsLayout.addComponent(btnSwap); btnInvert = new Button("Switch Axes"); btnInvert.setDebugId("btn-invert"); btnInvert.addListener(new Button.ClickListener() { public void buttonClick(Button.ClickEvent event) { getWindow().executeJavaScript("toggleInvert()"); } }); chartControlsLayout.addComponent(btnInvert); btnStack = new Button("Stack"); btnStack.setDebugId("btn-stack"); btnStack.addListener(new Button.ClickListener() { public void buttonClick(Button.ClickEvent event) { getWindow().executeJavaScript("toggleStacking()"); } }); chartControlsLayout.addComponent(btnStack); Label lblEmpty = new Label(" "); chartControlsLayout.addComponentAsFirst(lblEmpty); chartControlsLayout.setExpandRatio(lblEmpty, 2.0f); chartLayout = new VerticalLayout(); chartLayout.setSizeFull(); chartLayout.setDebugId("highchartsbarsingle"); // rightLayout.addComponent(chartLayout); VerticalLayout chartLayout2 = new VerticalLayout(); chartLayout2.setSizeFull(); chartLayout2.setDebugId("highchartsbarmultiple"); rightLayout.addComponent(chartLayout2); rightLayout.setExpandRatio(chartLayout2, 2.0f); inspectLayout = new VerticalLayout(); inspectLayout.setVisible(false); inspectLayout.setWidth("100%"); inspectLayout.setDebugId("l-inspect"); // mainLayout.addComponent(inspectLayout); // mainLayout.setExpandRatio(inspectLayout, 2.0f); }