List of usage examples for com.vaadin.ui GridLayout setVisible
@Override public void setVisible(boolean visible)
From source file:de.catma.ui.tagmanager.TagsetTree.java
License:Open Source License
private void initComponents() { setSizeFull();//from www. j a v a2s.com tagTree = new EndorsedTreeTable(); tagTree.setImmediate(true); tagTree.setSizeFull(); tagTree.setSelectable(true); tagTree.setMultiSelect(false); tagTree.setContainerDataSource(new HierarchicalContainer()); tagTree.addContainerProperty(TagTreePropertyName.caption, String.class, null); tagTree.setColumnHeader(TagTreePropertyName.caption, "Tagsets"); tagTree.addContainerProperty(TagTreePropertyName.icon, Resource.class, null); tagTree.setItemCaptionPropertyId(TagTreePropertyName.caption); tagTree.setItemIconPropertyId(TagTreePropertyName.icon); tagTree.setItemCaptionMode(Tree.ITEM_CAPTION_MODE_PROPERTY); tagTree.setVisibleColumns(new Object[] { TagTreePropertyName.caption }); if (colorButtonListener != null) { tagTree.addGeneratedColumn(TagTreePropertyName.color, new ColorButtonColumnGenerator(colorButtonListener)); tagTree.setColumnReorderingAllowed(true); } else { tagTree.addGeneratedColumn(TagTreePropertyName.color, new ColorLabelColumnGenerator()); } tagTree.setColumnHeader(TagTreePropertyName.color, "Tag Color"); addComponent(tagTree); setExpandRatio(tagTree, 2); GridLayout buttonGrid = new GridLayout(1, 19); buttonGrid.setMargin(true); buttonGrid.setSpacing(true); buttonGrid.addStyleName("taglibrary-action-grid"); int buttonGridRowCount = 0; if (withTagsetButtons) { btReload = new Button(""); btReload.setIcon(new ClassResource("ui/resources/icon-reload.gif", getApplication())); btReload.addStyleName("icon-button"); buttonGrid.addComponent(btReload); buttonGrid.setComponentAlignment(btReload, Alignment.MIDDLE_RIGHT); buttonGridRowCount++; Label tagsetLabel = new Label(); tagsetLabel.setIcon(new ClassResource("ui/tagmanager/resources/grndiamd.gif", application)); tagsetLabel.setCaption("Tagset"); buttonGrid.addComponent(tagsetLabel); buttonGridRowCount++; btInsertTagset = new Button("Create Tagset"); btInsertTagset.setEnabled(true); btInsertTagset.setWidth("100%"); buttonGrid.addComponent(btInsertTagset); buttonGridRowCount++; btRemoveTagset = new Button("Remove Tagset"); btRemoveTagset.setWidth("100%"); buttonGrid.addComponent(btRemoveTagset); buttonGridRowCount++; btEditTagset = new Button("Edit Tagset"); btEditTagset.setWidth("100%"); buttonGrid.addComponent(btEditTagset); buttonGridRowCount++; } Label tagLabel = new Label(); tagLabel.setIcon(new ClassResource("ui/tagmanager/resources/reddiamd.gif", application)); tagLabel.setCaption("Tag"); buttonGrid.addComponent(tagLabel, 0, buttonGridRowCount, 0, buttonGridRowCount + 4); buttonGridRowCount += 5; buttonGrid.setComponentAlignment(tagLabel, Alignment.BOTTOM_LEFT); btInsertTag = new Button("Create Tag"); btInsertTag.setWidth("100%"); if (withTagsetButtons) { btInsertTag.setEnabled(true); } buttonGrid.addComponent(btInsertTag); buttonGridRowCount++; btRemoveTag = new Button("Remove Tag"); btRemoveTag.setWidth("100%"); buttonGrid.addComponent(btRemoveTag); buttonGridRowCount++; btEditTag = new Button("Edit Tag"); btEditTag.setWidth("100%"); buttonGrid.addComponent(btEditTag); buttonGridRowCount++; Label propertyLabel = new Label(); propertyLabel.setIcon(new ClassResource("ui/tagmanager/resources/ylwdiamd.gif", application)); propertyLabel.setCaption("Property"); buttonGrid.addComponent(propertyLabel, 0, buttonGridRowCount, 0, buttonGridRowCount + 4); buttonGridRowCount += 5; buttonGrid.setComponentAlignment(propertyLabel, Alignment.BOTTOM_LEFT); btInsertProperty = new Button("Create Property"); btInsertProperty.setWidth("100%"); buttonGrid.addComponent(btInsertProperty); buttonGridRowCount++; btRemoveProperty = new Button("Remove Property"); // commented out on purpose: somehow this forces all the other buttons to // show up in natural size... // btRemoveProperty.setWidth("100%"); buttonGrid.addComponent(btRemoveProperty); buttonGridRowCount++; btEditProperty = new Button("Edit Property"); btEditProperty.setWidth("100%"); buttonGrid.addComponent(btEditProperty); buttonGridRowCount++; addComponent(buttonGrid); setExpandRatio(buttonGrid, 0); if (!withButtonPanel) { buttonGrid.setVisible(false); } }