3 * Copyright (C) 2015 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
7 * The contents of this file are subject to the Mozilla Public License Version 1.1
8 * See LICENSE.TXT at the top of this package for the full license terms.
10 package eu
.etaxonomy
.cdm
.vaadin
.component
;
12 import java
.sql
.SQLException
;
13 import java
.util
.ArrayList
;
14 import java
.util
.Arrays
;
15 import java
.util
.List
;
17 import java
.util
.UUID
;
19 import org
.apache
.log4j
.Logger
;
20 import org
.vaadin
.peter
.contextmenu
.ContextMenu
;
21 import org
.vaadin
.peter
.contextmenu
.ContextMenu
.ContextMenuItem
;
22 import org
.vaadin
.peter
.contextmenu
.ContextMenu
.ContextMenuItemClickEvent
;
23 import org
.vaadin
.peter
.contextmenu
.ContextMenu
.ContextMenuItemClickListener
;
25 import com
.vaadin
.annotations
.AutoGenerated
;
26 import com
.vaadin
.data
.Item
;
27 import com
.vaadin
.data
.Property
;
28 import com
.vaadin
.data
.Property
.ValueChangeEvent
;
29 import com
.vaadin
.data
.Property
.ValueChangeListener
;
30 import com
.vaadin
.data
.util
.IndexedContainer
;
31 import com
.vaadin
.data
.util
.sqlcontainer
.RowId
;
32 import com
.vaadin
.event
.FieldEvents
;
33 import com
.vaadin
.event
.FieldEvents
.TextChangeEvent
;
34 import com
.vaadin
.event
.ItemClickEvent
;
35 import com
.vaadin
.event
.ItemClickEvent
.ItemClickListener
;
36 import com
.vaadin
.event
.LayoutEvents
.LayoutClickEvent
;
37 import com
.vaadin
.event
.LayoutEvents
.LayoutClickListener
;
38 import com
.vaadin
.navigator
.View
;
39 import com
.vaadin
.navigator
.ViewChangeListener
.ViewChangeEvent
;
40 import com
.vaadin
.server
.FontAwesome
;
41 import com
.vaadin
.ui
.Alignment
;
42 import com
.vaadin
.ui
.Button
;
43 import com
.vaadin
.ui
.Button
.ClickEvent
;
44 import com
.vaadin
.ui
.CheckBox
;
45 import com
.vaadin
.ui
.ComboBox
;
46 import com
.vaadin
.ui
.Component
;
47 import com
.vaadin
.ui
.CustomComponent
;
48 import com
.vaadin
.ui
.GridLayout
;
49 import com
.vaadin
.ui
.HorizontalLayout
;
50 import com
.vaadin
.ui
.Label
;
51 import com
.vaadin
.ui
.Notification
;
52 import com
.vaadin
.ui
.Notification
.Type
;
53 import com
.vaadin
.ui
.Table
;
54 import com
.vaadin
.ui
.Table
.ColumnHeaderMode
;
55 import com
.vaadin
.ui
.Table
.TableDragMode
;
56 import com
.vaadin
.ui
.TextField
;
57 import com
.vaadin
.ui
.TreeTable
;
58 import com
.vaadin
.ui
.UI
;
59 import com
.vaadin
.ui
.VerticalLayout
;
60 import com
.vaadin
.ui
.Window
;
62 import eu
.etaxonomy
.cdm
.vaadin
.container
.IdUuidName
;
63 import eu
.etaxonomy
.cdm
.vaadin
.container
.LeafNodeTaxonContainer
;
64 import eu
.etaxonomy
.cdm
.vaadin
.presenter
.NewTaxonBasePresenter
;
65 import eu
.etaxonomy
.cdm
.vaadin
.presenter
.StatusPresenter
;
66 import eu
.etaxonomy
.cdm
.vaadin
.session
.CdmChangeEvent
;
67 import eu
.etaxonomy
.cdm
.vaadin
.session
.ICdmChangeListener
;
68 import eu
.etaxonomy
.cdm
.vaadin
.session
.SelectionEvent
;
69 import eu
.etaxonomy
.cdm
.vaadin
.util
.CdmVaadinSessionUtilities
;
70 import eu
.etaxonomy
.cdm
.vaadin
.util
.CdmVaadinUtilities
;
71 import eu
.etaxonomy
.cdm
.vaadin
.view
.IStatusComposite
;
78 public class StatusComposite
extends CustomComponent
implements View
, IStatusComposite
, ICdmChangeListener
{
80 /*- VaadinEditorProperties={"grid":"RegularGrid,20","showGrid":true,"snapToGrid":true,"snapToObject":true,"movingGuides":false,"snappingDistance":10} */
83 private GridLayout mainLayout
;
85 private Label inViewLabel
;
87 private TreeTable taxaTreeTable
;
89 private HorizontalLayout searchHorizontalLayout
;
91 private Button clearSearchButton
;
93 private TextField searchTextField
;
95 private VerticalLayout filterVerticalLayout
;
97 private Table filterTable
;
99 private Label filterLabel
;
101 private ComboBox classificationComboBox
;
102 private static final Logger logger
= Logger
.getLogger(StatusComposite
.class);
103 private StatusComponentListener listener
;
105 private Object currentClickedTaxonItemId
;
107 private final boolean taxaTreeTableMultiSelectMode
= true;
109 private static final String SELECT_FILTER
= "Select filter ...";
110 private static final String SELECT_CLASSIFICATION
= "Select classification ...";
112 private static final String ADD_TAXON_SYNONYM_INPUT
= "Add ...";
113 private static final String CREATE_ACC_TAXON
= "Create Accepted Taxon";
114 private static final String CREATE_SYNONYM
= "Create Synonym";
115 private static final String SET_AS_DELETED
= "Set as Deleted";
116 private static final String SET_AS_EXCLUDED
= "Set as Excluded";
117 private static final String SET_AS_OUT_OF_SCOPE
= "Set as Out Of Scope";
119 private static final String PROPERTY_FILTER_ID
= "filter";
120 private static final String PROPERTY_SELECTED_ID
= "selected";
122 private static final String FILTER_NOT_RESOLVED
= "not resolved";
123 private static final String FILTER_UNPLACED
= "unplaced";
124 private static final String FILTER_UNFINISHED
= "unfinished";
125 private static final String FILTER_UNPUBLISHED
= "unpublished";
128 private static final String FILTER_TAXA_INPUT
= "Filter Taxa ...";
129 private static final String IN_VIEW_PREFIX
= "in view : ";
131 private boolean isTaxaTableInitialised
= false;
132 private boolean isFiltertableInitialised
= false;
134 private String selectedTaxaTableMenuItem
= null;
136 ContextMenu taxaTableContextMenu
;
139 * The constructor should first build the main layout, set the
140 * composition root and then do any custom initialization.
142 * The constructor will not be automatically regenerated by the
145 public StatusComposite() {
147 setCompositionRoot(mainLayout
);
149 this.listener
= new StatusPresenter();
150 CdmVaadinSessionUtilities
.getCurrentCdmDataChangeService().register(this);
153 initSearchTextField();
154 initClearSearchButton();
155 setEnabledAll(false);
162 public void setClassification(String classification
) {
163 if(classification
== null) {
166 Object selectedClassificationId
= listener
.getClassificationId(classification
);
167 if(selectedClassificationId
== null) {
168 Notification
.show("Classification named " + classification
+ " does not exist.");
170 classificationComboBox
.setValue(selectedClassificationId
);
171 classificationComboBox
.setReadOnly(true);
176 taxaTreeTable
.setSelectable(true);
177 initClassificationComboBox();
180 public void setEnabledAll(boolean enabled
) {
181 CdmVaadinUtilities
.setEnabled(mainLayout
, enabled
, Arrays
.asList(classificationComboBox
));
185 public TreeTable
getTaxaTreeTable() {
186 return taxaTreeTable
;
189 public LeafNodeTaxonContainer
getTaxonContainer() {
190 return listener
.getCurrentLeafNodeTaxonContainer();
193 public void clearTaxaTableSelections() {
194 taxaTreeTable
.setValue(null);
197 public UUID
getSelectedClassificationUuid() {
198 if(classificationComboBox
.getValue() != null) {
199 return listener
.getClassificationContainer().getUuid(classificationComboBox
.getValue());
204 private void initTaxaTable(int classificationId
) {
205 taxaTreeTable
.setMultiSelect(taxaTreeTableMultiSelectMode
);
206 taxaTreeTable
.setImmediate(false);
207 taxaTreeTable
.setDragMode(TableDragMode
.ROW
);
208 if(listener
!= null) {
209 List
<String
> columnIds
= new ArrayList
<String
>();
210 columnIds
.add(LeafNodeTaxonContainer
.NAME_ID
);
211 taxaTreeTable
.setColumnExpandRatio(LeafNodeTaxonContainer
.NAME_ID
, 1);
212 columnIds
.add(LeafNodeTaxonContainer
.PB_ID
);
213 taxaTreeTable
.setColumnWidth(LeafNodeTaxonContainer
.PB_ID
, 25);
215 if(!isTaxaTableInitialised
) {
216 taxaTreeTable
.addGeneratedColumn(LeafNodeTaxonContainer
.PB_ID
, new TaxonTableCheckBoxGenerator());
220 taxaTreeTable
.setContainerDataSource(listener
.loadTaxa(classificationId
), columnIds
);
221 } catch (SQLException e
) {
222 //TODO : throw up warning dialog
227 taxaTreeTable
.setCellStyleGenerator(new Table
.CellStyleGenerator() {
230 public String
getStyle(Table source
, Object itemId
, Object propertyId
) {
231 if(source
.getItem(itemId
) == null) {
234 if(listener
.isSynonym(itemId
)) {
235 // this is a synonym, so we activate the corresponding css class
244 taxaTreeTable
.setSortContainerPropertyId(LeafNodeTaxonContainer
.NAME_ID
);
246 // NOTE : Not really sure why we need to refresh the container here.
247 // in the case of 'Table' this is not required
250 isTaxaTableInitialised
= true;
253 taxaTableContextMenu
= new ContextMenu();
254 taxaTableContextMenu
.setAsContextMenuOf(taxaTreeTable
);
255 addTaxaTreeContextMenuItemListener();
260 private void initClassificationComboBox() {
262 classificationComboBox
.setNewItemsAllowed(false);
263 classificationComboBox
.setNullSelectionAllowed(false);
264 classificationComboBox
.setImmediate(true);
265 classificationComboBox
.setItemCaptionPropertyId(StatusPresenter
.C_TCACHE_ID
);
266 classificationComboBox
.setInputPrompt(SELECT_CLASSIFICATION
);
267 if(listener
!= null) {
269 classificationComboBox
.setContainerDataSource(listener
.loadClassifications());
270 } catch (SQLException e
) {
271 //TODO : throw up warning dialog
279 private void initFilterTable() {
280 filterTable
.setNullSelectionAllowed(false);
281 final IndexedContainer container
= new IndexedContainer();
282 container
.addContainerProperty("filter", String
.class, "");
283 container
.addContainerProperty("selected", Boolean
.class, "");
285 // Item item = container.addItem(FILTER_NOT_RESOLVED);
286 // item.getItemProperty(PROPERTY_FILTER_ID).setValue(FILTER_NOT_RESOLVED);
287 // item.getItemProperty(PROPERTY_SELECTED_ID).setValue(false);
289 // item = container.addItem(FILTER_UNPLACED);
290 // item.getItemProperty(PROPERTY_FILTER_ID).setValue(FILTER_UNPLACED);
291 // item.getItemProperty(PROPERTY_SELECTED_ID).setValue(false);
293 Item item
= container
.addItem(FILTER_UNFINISHED
);
294 item
.getItemProperty(PROPERTY_FILTER_ID
).setValue(FILTER_UNFINISHED
);
295 item
.getItemProperty(PROPERTY_SELECTED_ID
).setValue(false);
297 item
= container
.addItem(FILTER_UNPUBLISHED
);
298 item
.getItemProperty(PROPERTY_FILTER_ID
).setValue(FILTER_UNPUBLISHED
);
299 item
.getItemProperty(PROPERTY_SELECTED_ID
).setValue(false);
302 filterTable
.setContainerDataSource(container
);
303 filterTable
.setColumnHeaderMode(ColumnHeaderMode
.HIDDEN
);
306 ValueChangeListener selectedListener
= new ValueChangeListener() {
308 private static final long serialVersionUID
= -5551250788805117454L;
311 public void valueChange(ValueChangeEvent event
) {
312 boolean value
= (Boolean
) event
.getProperty().getValue();
313 String selectedFilter
= (String
)filterTable
.getItem(((CheckBox
)event
.getProperty()).getData()).getItemProperty(PROPERTY_FILTER_ID
).getValue();
314 if(selectedFilter
!= null) {
316 if(selectedFilter
.equals(FILTER_UNPLACED
)) {
317 listener
.setUnplacedFilter();
319 if(selectedFilter
.equals(FILTER_UNPUBLISHED
)) {
320 listener
.setUnpublishedFilter();
323 if(selectedFilter
.equals(FILTER_UNPLACED
)) {
324 listener
.removeUnplacedFilter();
326 if(selectedFilter
.equals(FILTER_UNPUBLISHED
)) {
327 listener
.removeUnpublishedFilter();
335 if(!isFiltertableInitialised
) {
336 filterTable
.addGeneratedColumn(PROPERTY_SELECTED_ID
, new CheckBoxGenerator(selectedListener
));
339 isFiltertableInitialised
= true;
343 private void updateInViewLabel() {
344 inViewLabel
.setValue(IN_VIEW_PREFIX
+ String
.valueOf(listener
.getCurrentNoOfTaxa()) + " / " + String
.valueOf(listener
.getTotalNoOfTaxa()) + " taxa");
347 private void initSearchTextField() {
348 searchTextField
.setInputPrompt(FILTER_TAXA_INPUT
);
352 private void initClearSearchButton() {
353 clearSearchButton
.setIcon(FontAwesome
.REFRESH
);
354 clearSearchButton
.setCaption("");
358 private void addUIListeners() {
360 searchHorizontalLayout
.addLayoutClickListener(new LayoutClickListener() {
363 public void layoutClick(LayoutClickEvent event
) {
364 if (event
.getChildComponent() == searchTextField
&& searchTextField
.getValue().equals(FILTER_TAXA_INPUT
)) {
365 searchTextField
.setValue("");
370 addClassificationComboBoxListener();
371 addTaxaTreeTableListener();
373 addSearchTextFieldListener();
374 addClearSearchButtonListener();
377 private void addClassificationComboBoxListener() {
379 classificationComboBox
.addValueChangeListener(new Property
.ValueChangeListener() {
381 private static final long serialVersionUID
= 4196786323147791606L;
384 public void valueChange(ValueChangeEvent event
) {
385 if (classificationComboBox
.getValue() != null) {
386 Object selected
= classificationComboBox
.getValue();
387 int classificationId
= (Integer
)((RowId
)selected
).getId()[0];
388 initTaxaTable(classificationId
);
396 private void addTaxaTreeTableListener() {
398 taxaTreeTable
.addItemClickListener(new ItemClickListener() {
400 public void itemClick(ItemClickEvent event
) {
401 Object itemId
= event
.getItemId();
402 if(taxaTreeTable
.isSelectable()) {
403 boolean isSynonym
= listener
.isSynonym(itemId
);
404 if(!CdmVaadinUtilities
.isSelected(taxaTreeTable
, itemId
) && !isSynonym
) {
405 UUID taxonUuid
= listener
.getCurrentLeafNodeTaxonContainer().getUuid(itemId
);
406 String taxonName
= (String
)listener
.getCurrentLeafNodeTaxonContainer().getProperty(itemId
, LeafNodeTaxonContainer
.NAME_ID
).getValue();
407 Object idUuidName
= new IdUuidName(itemId
, taxonUuid
, taxonName
);
408 CdmVaadinSessionUtilities
.getCurrentSelectionService()
409 .fireSelectionEvent(new SelectionEvent(Arrays
.asList(idUuidName
, getSelectedClassificationUuid()), StatusComposite
.class), true);
411 taxaTreeTable
.setValue(Arrays
.asList(itemId
));
412 generateTaxaTreeTableContextMenu(!isSynonym
);
423 private void generateTaxaTreeTableContextMenu(boolean isSynonym
) {
425 taxaTableContextMenu
.removeAllItems();
427 ContextMenuItem createSynMenuItem
= taxaTableContextMenu
.addItem(CREATE_SYNONYM
);
428 createSynMenuItem
.setData(CREATE_SYNONYM
);
430 ContextMenuItem setDeletedMenuItem
= taxaTableContextMenu
.addItem(SET_AS_DELETED
);
431 setDeletedMenuItem
.setData(SET_AS_DELETED
);
433 ContextMenuItem setExcludedMenuItem
= taxaTableContextMenu
.addItem(SET_AS_EXCLUDED
);
434 setExcludedMenuItem
.setData(SET_AS_EXCLUDED
);
436 ContextMenuItem setOutOfScopeMenuItem
= taxaTableContextMenu
.addItem(SET_AS_OUT_OF_SCOPE
);
437 setOutOfScopeMenuItem
.setData(SET_AS_OUT_OF_SCOPE
);
439 setOutOfScopeMenuItem
.setSeparatorVisible(true);
441 ContextMenuItem createAccTaxonMenuItem
= taxaTableContextMenu
.addItem(CREATE_ACC_TAXON
);
442 createAccTaxonMenuItem
.setData(CREATE_ACC_TAXON
);
446 private void addTaxaTreeContextMenuItemListener() {
447 if(taxaTableContextMenu
!= null) {
448 taxaTableContextMenu
.addItemClickListener(new ContextMenuItemClickListener() {
451 public void contextMenuItemClicked(ContextMenuItemClickEvent event
) {
452 Object source
= event
.getSource();
453 if(source
instanceof ContextMenuItem
) {
454 ContextMenuItem menuItem
= (ContextMenuItem
) source
;
455 String action
= (String
)menuItem
.getData();
456 if(CREATE_ACC_TAXON
.equals(action
) || CREATE_SYNONYM
.equals(action
)) {
457 showAddTaxonBaseWindow(action
);
459 Notification
.show(action
+ " to be implemented", Type
.WARNING_MESSAGE
);
468 private void showAddTaxonBaseWindow(String action
) {
469 if (action
!= null) {
472 Object selectedItemId
= null;
473 IdUuidName accTaxonIdUuid
= null;
474 String accTaxonName
= null;
475 if(action
.equals(CREATE_SYNONYM
)) {
476 Set
<Object
> selectedIds
= (Set
<Object
>)taxaTreeTable
.getValue();
477 // if zero or more than one items (taxa / synonyms) are selected
479 if(selectedIds
.size() != 1) {
480 Notification
.show("Multiple or No selection", "Please select a single Taxon", Type
.WARNING_MESSAGE
);
483 selectedItemId
= selectedIds
.iterator().next();
484 // if a synonym is selected then throw warning
485 if(listener
.isSynonym(selectedItemId
)) {
486 Notification
.show("Synonym selected", "Please choose a Taxon", Type
.WARNING_MESSAGE
);
489 windowTitle
= "Add New Synonym";
490 accTaxonIdUuid
= new IdUuidName(selectedItemId
,
491 listener
.getCurrentLeafNodeTaxonContainer().getUuid(selectedItemId
),
492 (String
) listener
.getCurrentLeafNodeTaxonContainer().getProperty(selectedItemId
, LeafNodeTaxonContainer
.NAME_ID
).getValue());
493 accTaxonName
= (String
)listener
.getCurrentLeafNodeTaxonContainer().getProperty(selectedItemId
, LeafNodeTaxonContainer
.NAME_ID
).getValue();
495 windowTitle
= "Add New Taxon";
499 Window dialog
= new Window(windowTitle
);
500 dialog
.setModal(true);
501 dialog
.setClosable(false);
502 dialog
.setResizable(false);
503 UI
.getCurrent().addWindow(dialog
);
504 Object cId
= classificationComboBox
.getValue();
505 UUID classificationUuid
= listener
.getClassificationContainer().getUuid(cId
);
506 IdUuidName classificationIdUuid
= new IdUuidName(classificationComboBox
.getValue(),
508 (String
) listener
.getClassificationContainer().getProperty(cId
, StatusPresenter
.C_TCACHE_ID
).getValue());
509 NewTaxonBaseComposite newTaxonComponent
=
510 new NewTaxonBaseComposite(dialog
,
511 new NewTaxonBasePresenter(),
514 classificationIdUuid
);
515 dialog
.setContent(newTaxonComponent
);
516 } catch (SQLException e
) {
517 // TODO Auto-generated catch block
524 private void addSearchTextFieldListener() {
525 searchTextField
.addTextChangeListener(new FieldEvents
.TextChangeListener() {
527 private static final long serialVersionUID
= -7376538870420619534L;
530 public void textChange(TextChangeEvent event
) {
531 listener
.setNameFilter(event
.getText());
539 private void addClearSearchButtonListener() {
540 clearSearchButton
.addClickListener(new Button
.ClickListener() {
543 public void buttonClick(ClickEvent event
) {
544 clearDynamicFilters();
551 private void clearDynamicFilters() {
552 listener
.removeDynamicFilters();
553 searchTextField
.setValue(FILTER_TAXA_INPUT
);
554 for(Object itemId
: filterTable
.getItemIds()) {
555 filterTable
.getItem(itemId
).getItemProperty(PROPERTY_SELECTED_ID
).setValue(false);
563 * @see eu.etaxonomy.cdm.vaadin.view.IStatusComponent#setListener(eu.etaxonomy.cdm.vaadin.view.IStatusComponent.StatusComponentListener)
566 public void setListener(StatusComponentListener listener
) {
567 this.listener
= listener
;
571 class TaxonTableCheckBoxGenerator
implements Table
.ColumnGenerator
{
575 * Generates the cell containing an open image when boolean is true
578 public Component
generateCell(Table source
, final Object itemId
, Object columnId
) {
579 if(source
.getItem(itemId
) != null) {
580 Property prop
= source
.getItem(itemId
).getItemProperty(columnId
);
584 CheckBox cb
= new CheckBox(null, prop
);
585 ValueChangeListener pbListener
= new ValueChangeListener() {
587 public void valueChange(ValueChangeEvent event
) {
588 boolean value
= (Boolean
) event
.getProperty().getValue();
589 listener
.updatePublished(value
, itemId
);
592 cb
.addValueChangeListener(pbListener
);
602 class CheckBoxGenerator
implements Table
.ColumnGenerator
{
604 private final ValueChangeListener vcListener
;
606 public CheckBoxGenerator(ValueChangeListener vcListener
) {
607 this.vcListener
= vcListener
;
611 * Generates the cell containing an open image when boolean is true
614 public Component
generateCell(Table source
, final Object itemId
, Object columnId
) {
615 if(source
.getItem(itemId
) != null) {
616 Property prop
= source
.getItem(itemId
).getItemProperty(columnId
);
620 CheckBox cb
= new CheckBox(null, prop
);
621 cb
.addValueChangeListener(vcListener
);
632 * @see eu.etaxonomy.cdm.vaadin.session.ICdmChangeListener#onCreate(eu.etaxonomy.cdm.vaadin.session.CdmChangeEvent)
635 public void onCreate(CdmChangeEvent event
) {
636 if(event
.getSourceType().equals(NewTaxonBaseComposite
.class)) {
637 Object itemId
= event
.getChangedObjects().get(0);
639 taxaTreeTable
.setMultiSelect(false);
640 if(listener
.getCurrentLeafNodeTaxonContainer().isSynonym(itemId
)) {
641 taxaTreeTable
.setCollapsed(taxaTreeTable
.getValue(), false);
643 taxaTreeTable
.setValue(itemId
);
645 clearDynamicFilters();
646 listener
.setIdFilter(itemId
);
647 taxaTreeTable
.setValue(itemId
);
650 taxaTreeTable
.setMultiSelect(taxaTreeTableMultiSelectMode
);
656 * @see eu.etaxonomy.cdm.vaadin.session.ICdmChangeListener#onUpdate(eu.etaxonomy.cdm.vaadin.session.CdmChangeEvent)
659 public void onUpdate(CdmChangeEvent event
) {
660 // TODO Auto-generated method stub
665 * @see eu.etaxonomy.cdm.vaadin.session.ICdmChangeListener#onDelete(eu.etaxonomy.cdm.vaadin.session.CdmChangeEvent)
668 public void onDelete(CdmChangeEvent event
) {
669 // TODO Auto-generated method stub
674 * @see com.vaadin.navigator.View#enter(com.vaadin.navigator.ViewChangeListener.ViewChangeEvent)
677 public void enter(ViewChangeEvent event
) {
678 // TODO Auto-generated method stub
683 private GridLayout
buildMainLayout() {
684 // common part: create layout
685 mainLayout
= new GridLayout();
686 mainLayout
.setImmediate(false);
687 mainLayout
.setWidth("340px");
688 mainLayout
.setHeight("840px");
689 mainLayout
.setMargin(true);
690 mainLayout
.setRows(6);
692 // top-level component properties
696 // classificationComboBox
697 classificationComboBox
= new ComboBox();
698 classificationComboBox
.setImmediate(false);
699 classificationComboBox
.setWidth("100.0%");
700 classificationComboBox
.setHeight("-1px");
701 mainLayout
.addComponent(classificationComboBox
, 0, 0);
703 // filterVerticalLayout
704 filterVerticalLayout
= buildFilterVerticalLayout();
705 mainLayout
.addComponent(filterVerticalLayout
, 0, 1);
706 mainLayout
.setComponentAlignment(filterVerticalLayout
, new Alignment(20));
708 // searchHorizontalLayout
709 searchHorizontalLayout
= buildSearchHorizontalLayout();
710 mainLayout
.addComponent(searchHorizontalLayout
, 0, 3);
711 mainLayout
.setComponentAlignment(searchHorizontalLayout
, new Alignment(48));
714 taxaTreeTable
= new TreeTable();
715 taxaTreeTable
.setImmediate(false);
716 taxaTreeTable
.setWidth("100.0%");
717 taxaTreeTable
.setHeight("614px");
718 mainLayout
.addComponent(taxaTreeTable
, 0, 4);
719 mainLayout
.setComponentAlignment(taxaTreeTable
, new Alignment(20));
722 inViewLabel
= new Label();
723 inViewLabel
.setImmediate(false);
724 inViewLabel
.setWidth("100.0%");
725 inViewLabel
.setHeight("-1px");
726 inViewLabel
.setValue("in view : ");
727 mainLayout
.addComponent(inViewLabel
, 0, 5);
735 private VerticalLayout
buildFilterVerticalLayout() {
736 // common part: create layout
737 filterVerticalLayout
= new VerticalLayout();
738 filterVerticalLayout
.setImmediate(false);
739 filterVerticalLayout
.setWidth("100.0%");
740 filterVerticalLayout
.setHeight("-1px");
741 filterVerticalLayout
.setMargin(false);
744 filterLabel
= new Label();
745 filterLabel
.setImmediate(false);
746 filterLabel
.setWidth("100.0%");
747 filterLabel
.setHeight("-1px");
748 filterLabel
.setValue("Filter by :");
749 filterVerticalLayout
.addComponent(filterLabel
);
752 filterTable
= new Table();
753 filterTable
.setImmediate(false);
754 filterTable
.setWidth("100.0%");
755 filterTable
.setHeight("74px");
756 filterVerticalLayout
.addComponent(filterTable
);
757 filterVerticalLayout
.setComponentAlignment(filterTable
, new Alignment(48));
759 return filterVerticalLayout
;
765 private HorizontalLayout
buildSearchHorizontalLayout() {
766 // common part: create layout
767 searchHorizontalLayout
= new HorizontalLayout();
768 searchHorizontalLayout
.setImmediate(false);
769 searchHorizontalLayout
.setWidth("100.0%");
770 searchHorizontalLayout
.setHeight("-1px");
771 searchHorizontalLayout
.setMargin(false);
772 searchHorizontalLayout
.setSpacing(true);
775 searchTextField
= new TextField();
776 searchTextField
.setImmediate(false);
777 searchTextField
.setWidth("100.0%");
778 searchTextField
.setHeight("-1px");
779 searchHorizontalLayout
.addComponent(searchTextField
);
780 searchHorizontalLayout
.setExpandRatio(searchTextField
, 4.0f
);
781 searchHorizontalLayout
.setComponentAlignment(searchTextField
, new Alignment(48));
784 clearSearchButton
= new Button();
785 clearSearchButton
.setCaption("Button");
786 clearSearchButton
.setImmediate(true);
787 clearSearchButton
.setWidth("100.0%");
788 clearSearchButton
.setHeight("-1px");
789 searchHorizontalLayout
.addComponent(clearSearchButton
);
790 searchHorizontalLayout
.setExpandRatio(clearSearchButton
, 1.0f
);
791 searchHorizontalLayout
.setComponentAlignment(clearSearchButton
, new Alignment(48));
793 return searchHorizontalLayout
;