Project

General

Profile

Revision 4bdae8e0

ID4bdae8e0df62b69d0ed30d7d25e6f96282ec1565
Parent 1a3e979c
Child 98cc9b84

Added by Alexander Oppermann over 5 years ago

  • Fixed selection view and replaced twin selection component with combobox

  • fixed display issue with deproxy method

View differences:

src/main/java/eu/etaxonomy/cdm/vaadin/component/DetailWindow.java
9 9
import com.vaadin.ui.Tree;
10 10
import com.vaadin.ui.Window;
11 11

  
12
import eu.etaxonomy.cdm.model.common.CdmBase;
12 13
import eu.etaxonomy.cdm.model.common.Language;
13 14
import eu.etaxonomy.cdm.model.description.CategoricalData;
14 15
import eu.etaxonomy.cdm.model.description.CommonTaxonName;
......
60 61
			tree.setParent(deb.getFeature(), parent);
61 62
			tree.setChildrenAllowed(deb.getFeature(), true);
62 63

  
63
			if(deb instanceof CategoricalData){
64
				CategoricalData cd = (CategoricalData) deb;
64
			if(deb.isInstanceOf(CategoricalData.class)){
65
				CategoricalData cd = CdmBase.deproxy(deb, CategoricalData.class);
65 66
				if(cd.getStatesOnly().size() <= 1){
66 67
					for(StateData st  : cd.getStateData()){
67 68
						tree.addItem(st);
......
72 73
				}else{
73 74
					//TODO: implement recursion
74 75
				}
75
			}else if(deb instanceof TextData){
76
				TextData td = (TextData) deb;
76
			}else if(deb.isInstanceOf(TextData.class)){
77
				TextData td = CdmBase.deproxy(deb,TextData.class);
77 78
				tree.addItem(td);
78 79
				tree.setItemCaption(td, td.getText(Language.GERMAN()));
79 80
				tree.setParent(td, deb.getFeature());
80 81
				tree.setChildrenAllowed(td, false);
81
			}else if(deb instanceof CommonTaxonName){
82
			    CommonTaxonName td = (CommonTaxonName) deb;
82
			}else if(deb.isInstanceOf(CommonTaxonName.class)){
83
			    CommonTaxonName td = CdmBase.deproxy(deb, CommonTaxonName.class);
83 84
			    tree.addItem(td);
84 85
			    tree.setItemCaption(td, td.getName());
85 86
			    tree.setParent(td, deb.getFeature());
86 87
			    tree.setChildrenAllowed(td, false);
87
			}else if(deb instanceof Distribution){
88
				Distribution db = (Distribution) deb;
89

  
88
			}else if(deb.isInstanceOf(Distribution.class)){
89
				Distribution db = CdmBase.deproxy(deb, Distribution.class);
90 90
				tree.addItem(db.toString());
91 91
				tree.setParent(db.toString(), deb.getFeature());
92 92
				tree.setChildrenAllowed(db.toString(), true);
93

  
94 93
				tree.addItem(db.getStatus().toString());
95 94
				tree.setParent(db.getStatus().toString(), db.toString());
96 95
				tree.setChildrenAllowed(db.getStatus().toString(), false);
src/main/java/eu/etaxonomy/cdm/vaadin/view/dbstatus/DistributionSelectionView.java
9 9
import com.vaadin.event.ShortcutAction.KeyCode;
10 10
import com.vaadin.navigator.View;
11 11
import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent;
12
import com.vaadin.ui.Accordion;
13 12
import com.vaadin.ui.Alignment;
14 13
import com.vaadin.ui.Button;
15 14
import com.vaadin.ui.Button.ClickEvent;
16 15
import com.vaadin.ui.Button.ClickListener;
16
import com.vaadin.ui.ComboBox;
17 17
import com.vaadin.ui.CustomComponent;
18 18
import com.vaadin.ui.Label;
19
import com.vaadin.ui.OptionGroup;
20 19
import com.vaadin.ui.Panel;
21 20
import com.vaadin.ui.VerticalLayout;
22 21

  
......
28 27

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

  
31
	/**
30
	@AutoGenerated
31
    private VerticalLayout mainLayout;
32
    @AutoGenerated
33
    private Panel panel_1;
34
    @AutoGenerated
35
    private VerticalLayout verticalLayout_2;
36
    @AutoGenerated
37
    private Button button_proceed;
38
    @AutoGenerated
39
    private ComboBox distributionAreaBox;
40
    @AutoGenerated
41
    private ComboBox classificationBox;
42
    @AutoGenerated
43
    private Label label_1;
44
    /**
32 45
	 *
33 46
	 */
34 47
	private static final long serialVersionUID = 1L;
35
	@AutoGenerated
36
	private VerticalLayout mainLayout;
37
	@AutoGenerated
38
	private Panel panel_1;
39
	@AutoGenerated
40
	private VerticalLayout verticalLayout_2;
41
	@AutoGenerated
42
	private Button button_proceed;
43
	@AutoGenerated
44
	private Accordion accordion;
45
	@AutoGenerated
46
	private OptionGroup distributionSelection;
47

  
48

  
49
    @AutoGenerated
50
	private OptionGroup classificationSelection;
51
	@AutoGenerated
52
	private Label label_1;
53 48
	private DistributionSelectionComponentListener distListener;
54 49
	/**
55 50
	 * The constructor should first build the main layout, set the
......
74 69

  
75 70
	@Override
76 71
	public void buttonClick(ClickEvent event) {
77
		if(classificationSelection != null && distributionSelection != null){
78
			Classification classification = (Classification) classificationSelection.getValue();
79
			TermVocabulary<DefinedTermBase> term = (TermVocabulary<DefinedTermBase>)distributionSelection.getValue();
72
		if(classificationBox != null && distributionAreaBox != null){
73
			Classification classification = (Classification) classificationBox.getValue();
74
			TermVocabulary<DefinedTermBase> term = (TermVocabulary<DefinedTermBase>)distributionAreaBox.getValue();
80 75
			try {
81 76
				distListener.buttonClick(classification, term);
82 77
			} catch (SQLException e) {
......
90 85
		List<Classification> classificationList = distListener.getClassificationList();
91 86
		List<TermVocabulary<DefinedTermBase>> namedAreaList = distListener.getNamedAreaList();
92 87
		Container c = new IndexedContainer(classificationList);
93
		classificationSelection.setContainerDataSource(c);
88
		classificationBox.setContainerDataSource(c);
89
//		classificationSelection.setContainerDataSource(c);
94 90
		Container d = new IndexedContainer(namedAreaList);
95
		distributionSelection.setContainerDataSource(d);
91
		distributionAreaBox.setContainerDataSource(d);
92
//		distributionSelection.setContainerDataSource(d);
96 93
	}
97 94

  
98 95
	@Override
......
100 97
	}
101 98

  
102 99
	@AutoGenerated
103
	private VerticalLayout buildMainLayout() {
104
		// common part: create layout
105
		mainLayout = new VerticalLayout();
106
		mainLayout.setImmediate(false);
107
		mainLayout.setWidth("100%");
108
		mainLayout.setHeight("100%");
109
		mainLayout.setMargin(false);
110

  
111
		// top-level component properties
112
		setWidth("100.0%");
113
		setHeight("100.0%");
114

  
115
		// panel_1
116
		panel_1 = buildPanel_1();
117
		mainLayout.addComponent(panel_1);
118
		mainLayout.setComponentAlignment(panel_1, new Alignment(48));
119

  
120
		return mainLayout;
121
	}
100
    private VerticalLayout buildMainLayout() {
101
        // common part: create layout
102
        mainLayout = new VerticalLayout();
103
        mainLayout.setImmediate(false);
104
        mainLayout.setWidth("100%");
105
        mainLayout.setHeight("100%");
106
        mainLayout.setMargin(false);
122 107

  
123
	@AutoGenerated
124
	private Panel buildPanel_1() {
125
		// common part: create layout
126
		panel_1 = new Panel();
127
		panel_1.setImmediate(false);
128
		panel_1.setWidth("-1px");
129
		panel_1.setHeight("-1px");
130

  
131
		// verticalLayout_2
132
		verticalLayout_2 = buildVerticalLayout_2();
133
		panel_1.setContent(verticalLayout_2);
134

  
135
		return panel_1;
136
	}
108
        // top-level component properties
109
        setWidth("100.0%");
110
        setHeight("100.0%");
137 111

  
138
	@AutoGenerated
139
	private VerticalLayout buildVerticalLayout_2() {
140
		// common part: create layout
141
		verticalLayout_2 = new VerticalLayout();
142
		verticalLayout_2.setImmediate(false);
143
		verticalLayout_2.setWidth("-1px");
144
		verticalLayout_2.setHeight("-1px");
145
		verticalLayout_2.setMargin(true);
146
		verticalLayout_2.setSpacing(true);
147

  
148
		// label_1
149
		label_1 = new Label();
150
		label_1.setImmediate(false);
151
		label_1.setWidth("213px");
152
		label_1.setHeight("-1px");
153
		label_1.setValue("Please choose a Classification and a distribution area to proceed.");
154
		verticalLayout_2.addComponent(label_1);
155

  
156
		// accordion
157
		accordion = buildAccordion();
158
		verticalLayout_2.addComponent(accordion);
159
		verticalLayout_2.setComponentAlignment(accordion, new Alignment(48));
160

  
161
		// button_1
162
		button_proceed = new Button();
163
		button_proceed.setCaption("Proceed");
164
		button_proceed.setImmediate(true);
165
		button_proceed.setWidth("-1px");
166
		button_proceed.setHeight("-1px");
167
		verticalLayout_2.addComponent(button_proceed);
168
		verticalLayout_2.setComponentAlignment(button_proceed, new Alignment(10));
169

  
170
		return verticalLayout_2;
171
	}
112
        // panel_1
113
        panel_1 = buildPanel_1();
114
        mainLayout.addComponent(panel_1);
115
        mainLayout.setComponentAlignment(panel_1, new Alignment(48));
172 116

  
173
	@AutoGenerated
174
	private Accordion buildAccordion() {
175
		// common part: create layout
176
		accordion = new Accordion();
177
		accordion.setImmediate(true);
178
		accordion.setWidth("-1px");
179
		accordion.setHeight("-1px");
180

  
181
		// classificationSelection
182
		classificationSelection = new OptionGroup();
183
		classificationSelection.setImmediate(false);
184
		classificationSelection.setWidth("-1px");
185
		classificationSelection.setHeight("-1px");
186
		accordion.addTab(classificationSelection, "Classifcation", null);
187

  
188
		// distributionSelection
189
		distributionSelection = new OptionGroup();
190
		distributionSelection.setImmediate(false);
191
		distributionSelection.setWidth("-1px");
192
		distributionSelection.setHeight("-1px");
193
		accordion.addTab(distributionSelection, "Distribution Area", null);
194

  
195
		return accordion;
196
	}
117
        return mainLayout;
118
    }
119

  
120

  
121
    @AutoGenerated
122
    private Panel buildPanel_1() {
123
        // common part: create layout
124
        panel_1 = new Panel();
125
        panel_1.setImmediate(false);
126
        panel_1.setWidth("-1px");
127
        panel_1.setHeight("-1px");
128

  
129
        // verticalLayout_2
130
        verticalLayout_2 = buildVerticalLayout_2();
131
        panel_1.setContent(verticalLayout_2);
132

  
133
        return panel_1;
134
    }
135

  
136

  
137
    @AutoGenerated
138
    private VerticalLayout buildVerticalLayout_2() {
139
        // common part: create layout
140
        verticalLayout_2 = new VerticalLayout();
141
        verticalLayout_2.setImmediate(false);
142
        verticalLayout_2.setWidth("-1px");
143
        verticalLayout_2.setHeight("-1px");
144
        verticalLayout_2.setMargin(true);
145
        verticalLayout_2.setSpacing(true);
146

  
147
        // label_1
148
        label_1 = new Label();
149
        label_1.setImmediate(false);
150
        label_1.setWidth("213px");
151
        label_1.setHeight("-1px");
152
        label_1.setValue("Please choose a Classification and a distribution area to proceed.");
153
        verticalLayout_2.addComponent(label_1);
154

  
155
        // classificationBox
156
        classificationBox = new ComboBox();
157
        classificationBox.setCaption("Classification: ");
158
        classificationBox.setImmediate(false);
159
        classificationBox.setWidth("200px");
160
        classificationBox.setHeight("-1px");
161
        verticalLayout_2.addComponent(classificationBox);
162

  
163
        // distributionAreaBox
164
        distributionAreaBox = new ComboBox();
165
        distributionAreaBox.setCaption("Distributrion Area");
166
        distributionAreaBox.setImmediate(false);
167
        distributionAreaBox.setWidth("200px");
168
        distributionAreaBox.setHeight("-1px");
169
        verticalLayout_2.addComponent(distributionAreaBox);
170

  
171
        // button_proceed
172
        button_proceed = new Button();
173
        button_proceed.setCaption("Proceed");
174
        button_proceed.setImmediate(true);
175
        button_proceed.setWidth("-1px");
176
        button_proceed.setHeight("-1px");
177
        verticalLayout_2.addComponent(button_proceed);
178
        verticalLayout_2.setComponentAlignment(button_proceed, new Alignment(10));
179

  
180
        return verticalLayout_2;
181
    }
197 182

  
198 183
}

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)