Project

General

Profile

« Previous | Next » 

Revision 3a824e7f

Added by Patrick Plitzner over 7 years ago

ref #5458 Redesign settings diaolog to support taxon tree

View differences:

src/main/java/eu/etaxonomy/cdm/vaadin/view/dbstatus/SettingsConfigWindow.java
9 9
*/
10 10
package eu.etaxonomy.cdm.vaadin.view.dbstatus;
11 11

  
12
import com.vaadin.annotations.AutoGenerated;
13 12
import com.vaadin.data.Container;
14
import com.vaadin.ui.AbsoluteLayout;
13
import com.vaadin.ui.AbstractLayout;
14
import com.vaadin.ui.Alignment;
15 15
import com.vaadin.ui.Button;
16 16
import com.vaadin.ui.ComboBox;
17 17
import com.vaadin.ui.CustomComponent;
18
import com.vaadin.ui.Label;
18
import com.vaadin.ui.HorizontalLayout;
19 19
import com.vaadin.ui.Tree;
20 20
import com.vaadin.ui.TwinColSelect;
21
import com.vaadin.ui.VerticalLayout;
21 22
import com.vaadin.ui.Window;
22 23

  
23 24
import eu.etaxonomy.cdm.model.common.TermVocabulary;
......
31 32
 */
32 33
public class SettingsConfigWindow extends CustomComponent {
33 34

  
34
    /*- VaadinEditorProperties={"grid":"RegularGrid,20","showGrid":true,"snapToGrid":true,"snapToObject":true,"movingGuides":false,"snappingDistance":10} */
35

  
36 35
	private static final long serialVersionUID = -8220442386869594032L;
37
	@AutoGenerated
38
    private AbsoluteLayout mainLayout;
39
    @AutoGenerated
40
    private Label label_4;
41
    @AutoGenerated
36
    private VerticalLayout mainLayout;
42 37
    private TwinColSelect distStatusSelect;
43
    @AutoGenerated
44
    private Label label_3;
45
    @AutoGenerated
46
    private Label label_2;
47
    @AutoGenerated
38
    private ComboBox classificationBox;
48 39
    private ComboBox distAreaBox;
49
    @AutoGenerated
50 40
    private Tree taxonTree;
51
    @AutoGenerated
52 41
    private Button okButton;
53
    @AutoGenerated
54 42
    private Button cancelButton;
55
    @AutoGenerated
56
    private Label label_1;
57 43
    private final SettingsPresenter presenter;
44
    
58 45
    /**
59 46
     * The constructor should first build the main layout, set the
60 47
     * composition root and then do any custom initialization.
......
72 59
    private void init() {
73 60
        Container taxonNodeContainer = new TaxonNodeContainer(null);
74 61
        Container distributionContainer = presenter.getDistributionContainer();
75
        TermVocabulary chosenArea = presenter.getChosenArea();
62
        TermVocabulary<?> chosenArea = presenter.getChosenArea();
63
        classificationBox.setItemCaptionPropertyId(TaxonNodeContainer.LABEL);
64
        classificationBox.setContainerDataSource(taxonNodeContainer);
65
        classificationBox.setValue(presenter.getChosenTaxonNode().getClassification().getRootNode());
76 66
        taxonTree.setItemCaptionPropertyId(TaxonNodeContainer.LABEL);
77 67
        taxonTree.setContainerDataSource(taxonNodeContainer);
78 68
        taxonTree.setValue(presenter.getChosenTaxonNode());
......
84 74
    public Window createWindow(){
85 75
        Window window = new Window();
86 76
        window.setModal(true);
87
        window.setHeight("600px");
88
        window.setWidth("500px");
77
        window.setWidth("60%");
78
        window.setHeight("80%");
89 79
        window.setCaption("Settings");
90 80
        window.setContent(mainLayout);
91 81
        return window;
92 82
    }
93 83

  
94
    @AutoGenerated
95
    private AbsoluteLayout buildMainLayout() {
96
        // common part: create layout
97
        mainLayout = new AbsoluteLayout();
98
        mainLayout.setImmediate(false);
99
        mainLayout.setWidth("100%");
100
        mainLayout.setHeight("100%");
101

  
102
        // top-level component properties
103
        setWidth("100.0%");
104
        setHeight("100.0%");
84
    private AbstractLayout buildMainLayout() {
105 85

  
106
        // label_1
107
        label_1 = new Label();
108
        label_1.setImmediate(false);
109
        label_1.setWidth("100.0%");
110
        label_1.setHeight("40px");
111
        mainLayout.addComponent(label_1, "top:0.0px;left:0.0px;");
86
    	mainLayout = new VerticalLayout();
87
        mainLayout.setImmediate(false);
88
        mainLayout.setSizeFull();
89
        mainLayout.setMargin(true);
90
        mainLayout.setSpacing(true);
91
        
92
        HorizontalLayout topContainer = new HorizontalLayout();
93
        topContainer.setImmediate(false);
94
        topContainer.setSizeFull();
95
        topContainer.setSpacing(true);
96

  
97
        VerticalLayout verticalLayout = new VerticalLayout();
98
        verticalLayout.setImmediate(false);
99
        
100
        //classification and term
101
        classificationBox = new ComboBox("Classification");
102
        classificationBox.setImmediate(true);
103
        classificationBox.setWidth("100%");
104

  
105
        distAreaBox = new ComboBox("Distribution Area:");
106
        distAreaBox.setImmediate(false);
107
        distAreaBox.setWidth("100%");
108
        
109
        //distribution status
110
        distStatusSelect = new TwinColSelect("Distribution Status:");
111
        distStatusSelect.setImmediate(false);
112
        distStatusSelect.setWidth("100%");
112 113

  
114
        //taxonomy
115
        taxonTree = new Tree("Taxonomy");
116
        taxonTree.setImmediate(false);
117
        
118
        verticalLayout.addComponent(classificationBox);
119
        verticalLayout.addComponent(distAreaBox);
120
        verticalLayout.addComponent(distStatusSelect);
121
        verticalLayout.setExpandRatio(distStatusSelect, 1);
122
        verticalLayout.setSizeFull();
123
        
124
        topContainer.addComponent(verticalLayout);
125
        topContainer.addComponent(taxonTree);
126
        topContainer.setExpandRatio(taxonTree, 1);
127
        topContainer.setExpandRatio(verticalLayout, 1);
128

  
129
        //button toolbar
130
        HorizontalLayout buttonToolBar = new HorizontalLayout();
113 131
        // cancelButton
114 132
        cancelButton = new Button();
115 133
        cancelButton.setCaption("Cancel");
116 134
        cancelButton.setImmediate(true);
117
        cancelButton.setWidth("-1px");
118
        cancelButton.setHeight("-1px");
119
        mainLayout.addComponent(cancelButton, "top:380.0px;left:273.0px;");
135
        buttonToolBar.addComponent(cancelButton);
120 136

  
121 137
        // okButton
122 138
        okButton = new Button();
123 139
        okButton.setCaption("OK");
124 140
        okButton.setImmediate(true);
125
        okButton.setWidth("67px");
126
        okButton.setHeight("-1px");
127
        mainLayout.addComponent(okButton, "top:380.0px;left:364.0px;");
128

  
129
        // classificationBox
130
        taxonTree = new Tree();
131
        taxonTree.setImmediate(false);
132
        mainLayout.addComponent(taxonTree, "top:97.0px;left:258.0px;");
141
        buttonToolBar.addComponent(okButton);
133 142

  
134
        // distAreaBox
135
        distAreaBox = new ComboBox();
136
        distAreaBox.setImmediate(false);
137
        distAreaBox.setWidth("-1px");
138
        distAreaBox.setHeight("-1px");
139
        mainLayout.addComponent(distAreaBox, "top:141.0px;left:258.0px;");
140

  
141
        // label_2
142
        label_2 = new Label();
143
        label_2.setImmediate(false);
144
        label_2.setWidth("-1px");
145
        label_2.setHeight("-1px");
146
        label_2.setValue("Classification/Taxon: ");
147
        mainLayout.addComponent(label_2, "top:97.0px;left:24.0px;");
148

  
149
        // label_3
150
        label_3 = new Label();
151
        label_3.setImmediate(false);
152
        label_3.setWidth("-1px");
153
        label_3.setHeight("-1px");
154
        label_3.setValue("Distribution Area:");
155
        mainLayout.addComponent(label_3, "top:141.0px;left:24.0px;");
156

  
157
        // distStatusSelect
158
        distStatusSelect = new TwinColSelect();
159
        distStatusSelect.setImmediate(false);
160
        distStatusSelect.setWidth("-1px");
161
        distStatusSelect.setHeight("-1px");
162
        mainLayout.addComponent(distStatusSelect, "top:188.0px;left:152.0px;");
163

  
164
        // label_4
165
        label_4 = new Label();
166
        label_4.setImmediate(false);
167
        label_4.setWidth("-1px");
168
        label_4.setHeight("-1px");
169
        label_4.setValue("Distribution Status:");
170
        mainLayout.addComponent(label_4, "top:202.0px;left:20.0px;");
143
        mainLayout.addComponent(topContainer);
144
        mainLayout.addComponent(buttonToolBar);
145
        mainLayout.setComponentAlignment(buttonToolBar, Alignment.BOTTOM_RIGHT);
171 146

  
172 147
        return mainLayout;
173 148
    }

Also available in: Unified diff