private LayoutContainer createContentContainer() { LayoutContainer contentContainer = new LayoutContainer(); contentContainer.setBorders(false); contentContainer.setSize(340, 170); HBoxLayout tabbarContainerLayout = new HBoxLayout(); tabbarContainerLayout.setHBoxLayoutAlign(HBoxLayoutAlign.TOP); contentContainer.setLayout(tabbarContainerLayout); LayoutContainer contentItemsContainer = new LayoutContainer(); contentItemsContainer.setBorders(true); contentItemsContainer.setWidth(230); contentItemsContainer.setHeight(160); contentItemsContainer.setLayout(new FitLayout()); contentItemsContainer.setStyleAttribute("backgroundColor", "white"); // overflow-auto style is for IE hack. contentItemsContainer.addStyleName("overflow-auto"); TreeStore<BeanModel> deviceContentTreeStore = new TreeStore<BeanModel>(); deviceContentTree = TreePanelBuilder.buildDeviceContentTree(deviceContentTreeStore); contentItemsContainer.add(deviceContentTree); LayoutContainer buttonsContainer = new LayoutContainer(); buttonsContainer.setSize(110, 160); buttonsContainer.setBorders(false); buttonsContainer.setLayout(new RowLayout(Orientation.VERTICAL)); Button addCommandBtn = new Button("Add command"); addCommandBtn.addSelectionListener(new AddCommandListener()); Button addSensorBtn = new Button("Add sensor"); addSensorBtn.addSelectionListener(new AddSensorListener()); Button addSwitchBtn = new Button("Add switch"); addSwitchBtn.addSelectionListener(new AddSwitchListener()); Button addSliderBtn = new Button("Add slider"); addSliderBtn.addSelectionListener(new AddSliderListener()); Button deleteBtn = new Button("Delete"); deleteBtn.addSelectionListener(new DeleteContentListener()); buttonsContainer.add(addCommandBtn, new RowData(110, -1, new Margins(5))); buttonsContainer.add(addSensorBtn, new RowData(110, -1, new Margins(5))); buttonsContainer.add(addSwitchBtn, new RowData(110, -1, new Margins(5))); buttonsContainer.add(addSliderBtn, new RowData(110, -1, new Margins(5))); buttonsContainer.add(deleteBtn, new RowData(110, -1, new Margins(5))); contentContainer.add(contentItemsContainer); contentContainer.add(buttonsContainer); return contentContainer; }
public void load() { currentNode = TaxonomyCache.impl.getCurrentNode(); BorderLayout layout = new BorderLayout(); // layout.setMargin(5); // layout.setSpacing(5); LayoutContainer full = new LayoutContainer(); full.setLayout(layout); full.setLayoutOnChange(true); TaxonomyBrowserPanel tp = getTaxonomyBrowserPanel(); if (currentNode != null) { tp.update(currentNode.getId() + ""); } else { tp.update(); } int size = PANEL_WIDTH / 2; LayoutContainer left = new LayoutContainer(); left.setLayout(new FillLayout()); left.setSize(size, PANEL_HEIGHT); left.add(tp); full.add( new HTML("<b> Instructions:</b> " + getDescription()), new BorderLayoutData(LayoutRegion.NORTH, HEADER_HEIGHT)); full.add(left, new BorderLayoutData(LayoutRegion.WEST, size)); full.add(getRightSide(), new BorderLayoutData(LayoutRegion.CENTER, size)); full.setSize(PANEL_WIDTH, PANEL_HEIGHT); add(full); }
private LayoutContainer getLeftSide() { // BorderLayout layout = new BorderLayout(); RowLayout layout = new RowLayout(Orientation.VERTICAL); // layout.setMargin(0); // layout.setSpacing(0); LayoutContainer container = new LayoutContainer(); container.setLayout(layout); container.setLayoutOnChange(true); container.setSize(PANEL_WIDTH / 2, PANEL_HEIGHT); children = new DataList(); children.setSelectionMode(SelectionMode.MULTI); TaxonomyCache.impl.getTaxonChildren( currentNode.getId() + "", new GenericCallback<List<Taxon>>() { public void onFailure(Throwable caught) { WindowUtils.errorAlert("Error", "Could not fetch children, please try again later."); } public void onSuccess(List<Taxon> result) { for (Taxon taxon : result) { DataListItem li = new DataListItem(taxon.getFullName()); li.setData("nodeID", "" + taxon.getId()); li.setData("node", taxon); children.add(li); } } }); container.add( new HTML("Children currently in " + currentNode.getFullName() + ":"), new RowData(1d, 25)); container.add(children, new RowData(1d, 1d)); return container; }