Revision 764269a1
Added by Andreas Kohlbecker over 4 years ago
src/main/java/eu/etaxonomy/cdm/vaadin/component/common/AbstractTimePeriodField.java | ||
---|---|---|
54 | 54 |
|
55 | 55 |
Label toLabel = null; |
56 | 56 |
|
57 |
GridLayout grid = new GridLayout(3, 4);
|
|
57 |
GridLayout detailsViewGrid = new GridLayout(3, 4);
|
|
58 | 58 |
|
59 | 59 |
CssLayout detailsView = new CssLayout(); |
60 | 60 |
|
... | ... | |
97 | 97 |
initSimpleView(); |
98 | 98 |
initDetailsView(); |
99 | 99 |
|
100 |
|
|
101 |
detailsView.setWidth(100, Unit.PERCENTAGE); |
|
102 |
simpleView.setWidth(100, Unit.PERCENTAGE); |
|
100 | 103 |
root.addComponent(simpleView); |
101 | 104 |
root.addComponent(detailsView); |
102 | 105 |
|
... | ... | |
104 | 107 |
|
105 | 108 |
showSimple(); |
106 | 109 |
|
110 |
root.setWidth(100, Unit.PERCENTAGE); |
|
111 |
|
|
112 |
// fixed size to avoid layout and component expansion problems in the nested grid layouts |
|
113 |
this.setWidth(300, Unit.PIXELS); |
|
114 |
|
|
107 | 115 |
return root; |
108 | 116 |
} |
109 | 117 |
|
... | ... | |
114 | 122 |
|
115 | 123 |
Button showDetailsButton = new Button(FontAwesome.CALENDAR); |
116 | 124 |
showDetailsButton.addClickListener(e -> showDetails()); |
117 |
cacheField.setWidth(353, Unit.PIXELS); // FIXME 100% does not work |
|
125 |
cacheField.setWidth(100, Unit.PERCENTAGE); |
|
126 |
// showDetailsButton.setWidth(100, Unit.PERCENTAGE); |
|
118 | 127 |
|
119 | 128 |
simpleView.addStyleName(ValoTheme.LAYOUT_COMPONENT_GROUP); |
120 |
simpleView.setWidth(100, Unit.PERCENTAGE); |
|
121 | 129 |
simpleView.addComponent(showDetailsButton, 0, 0); |
122 | 130 |
simpleView.addComponent(cacheField, 1, 0); |
123 | 131 |
simpleView.setColumnExpandRatio(1, 0.9f); |
... | ... | |
164 | 172 |
fieldGroup.bind(freeText, "freeText"); |
165 | 173 |
|
166 | 174 |
toLabel = new Label("\u2014"); // EM DASH : 0x2014 |
175 |
startDate.setWidth(100, Unit.PERCENTAGE); |
|
176 |
endDate.setWidth(100, Unit.PERCENTAGE); |
|
177 |
toLabel.setWidthUndefined(); |
|
167 | 178 |
|
168 | 179 |
int row = 0; |
169 |
grid.addComponent(buttonTextField, 0, row, 2, row);
|
|
180 |
detailsViewGrid.addComponent(buttonTextField, 0, row, 2, row);
|
|
170 | 181 |
row++; |
171 |
grid.addComponent(startDate, 0, row);
|
|
172 |
grid.addComponent(toLabel, 1, row);
|
|
173 |
grid.setComponentAlignment(toLabel, Alignment.BOTTOM_CENTER);
|
|
174 |
grid.addComponent(endDate, 2, row);
|
|
182 |
detailsViewGrid.addComponent(startDate, 0, row, 0, row);
|
|
183 |
detailsViewGrid.addComponent(toLabel, 1, row);
|
|
184 |
detailsViewGrid.setComponentAlignment(toLabel, Alignment.BOTTOM_CENTER);
|
|
185 |
detailsViewGrid.addComponent(endDate, 2, row, 2, row);
|
|
175 | 186 |
row++; |
176 |
grid.addComponent(freeText, 0, row, 2, row); |
|
187 |
detailsViewGrid.addComponent(freeText, 0, row, 2, row); |
|
188 |
detailsViewGrid.setWidth(100, Unit.PERCENTAGE); |
|
189 |
detailsViewGrid.setColumnExpandRatio(0, 5); |
|
190 |
detailsViewGrid.setColumnExpandRatio(1, 1); |
|
191 |
detailsViewGrid.setColumnExpandRatio(2, 5); |
|
192 |
|
|
177 | 193 |
|
178 | 194 |
// apply the style of the container to all child components. E.g. make all tiny |
179 | 195 |
addStyleName((getStyleName())); |
180 | 196 |
|
181 | 197 |
detailsView.setStyleName("margin-wrapper"); |
182 |
detailsView.addComponent(grid);
|
|
198 |
detailsView.addComponent(detailsViewGrid);
|
|
183 | 199 |
|
184 | 200 |
} |
185 | 201 |
|
... | ... | |
251 | 267 |
@Override |
252 | 268 |
public void setStyleName(String style) { |
253 | 269 |
super.setStyleName(style); |
254 |
grid.iterator().forEachRemaining(c -> c.setStyleName(style));
|
|
270 |
detailsViewGrid.iterator().forEachRemaining(c -> c.setStyleName(style));
|
|
255 | 271 |
buttonTextField.iterator().forEachRemaining(c -> c.setStyleName(style)); |
256 | 272 |
simpleView.iterator().forEachRemaining(c -> c.setStyleName(style)); |
257 | 273 |
applyDefaultStyles(); |
... | ... | |
260 | 276 |
@Override |
261 | 277 |
public void addStyleName(String style) { |
262 | 278 |
super.addStyleName(style); |
263 |
grid.iterator().forEachRemaining(c -> c.addStyleName(style));
|
|
279 |
detailsViewGrid.iterator().forEachRemaining(c -> c.addStyleName(style));
|
|
264 | 280 |
simpleView.iterator().forEachRemaining(c -> { |
265 | 281 |
c.addStyleName(style); |
266 | 282 |
}); |
src/main/java/eu/etaxonomy/cdm/vaadin/view/name/SpecimenTypeDesignationWorkingsetPopupEditor.java | ||
---|---|---|
115 | 115 |
grid.setMargin(true); |
116 | 116 |
grid.setColumns(3); |
117 | 117 |
grid.setRows(10); |
118 |
int endColumnIndex = 2; |
|
118 | 119 |
|
119 | 120 |
//TODO typifyingAuthors |
120 | 121 |
|
... | ... | |
122 | 123 |
|
123 | 124 |
int row = 0; |
124 | 125 |
countrySelectField = new NativeSelect("Country"); |
125 |
addField(countrySelectField, "country", 1, row , 2, row);
|
|
126 |
addField(countrySelectField, "country", 1, row , endColumnIndex, row);
|
|
126 | 127 |
countrySelectField.setWidth("100%"); |
127 | 128 |
countrySelectField.setItemCaptionMode(ItemCaptionMode.PROPERTY); |
128 | 129 |
countrySelectField.setItemCaptionPropertyId("label"); |
... | ... | |
130 | 131 |
row++; |
131 | 132 |
TextArea localityField = new TextArea("Locality"); |
132 | 133 |
localityField.setNullRepresentation(""); |
133 |
addField(localityField, "locality", 0, row , 2, row);
|
|
134 |
addField(localityField, "locality", 0, row , endColumnIndex, row);
|
|
134 | 135 |
localityField.setWidth("100%"); |
135 | 136 |
// NOTE: setRows and SetCold breaks he width setting, |
136 | 137 |
// see https://github.com/vaadin/framework/issues/3617 |
137 | 138 |
|
138 | 139 |
row++; |
139 | 140 |
exactLocationField = new GeoLocationField("Geo location"); |
140 |
addField(exactLocationField, "exactLocation", 0, row, 2, row);
|
|
141 |
addField(exactLocationField, "exactLocation", 0, row, endColumnIndex, row);
|
|
141 | 142 |
exactLocationField.setWidth("100%"); |
142 | 143 |
|
143 | 144 |
row++; |
144 | 145 |
MinMaxTextField absElevationMinMax = new MinMaxTextField("Altitude", "m"); |
145 | 146 |
absElevationMinMax.setWidth("100%"); |
146 | 147 |
absElevationMinMax.addSubComponentsStyleName(getDefaultComponentStyles()); |
147 |
grid.addComponent(absElevationMinMax, 0, row, 2, row);
|
|
148 |
grid.addComponent(absElevationMinMax, 0, row, endColumnIndex, row);
|
|
148 | 149 |
|
149 | 150 |
bindField(absElevationMinMax.getMinField(), "absoluteElevation"); |
150 | 151 |
bindField(absElevationMinMax.getMaxField(), "absoluteElevationMax"); |
... | ... | |
157 | 158 |
MinMaxTextField distanceToWaterSurfaceMinMax = new MinMaxTextField("Distance to water surface", "m"); |
158 | 159 |
distanceToWaterSurfaceMinMax.setWidth("100%"); |
159 | 160 |
distanceToWaterSurfaceMinMax.addSubComponentsStyleName(getDefaultComponentStyles()); |
160 |
grid.addComponent(distanceToWaterSurfaceMinMax, 0, row, 2, row);
|
|
161 |
grid.addComponent(distanceToWaterSurfaceMinMax, 0, row, endColumnIndex, row);
|
|
161 | 162 |
|
162 | 163 |
bindField(distanceToWaterSurfaceMinMax.getMinField(), "distanceToWaterSurface"); |
163 | 164 |
bindField(distanceToWaterSurfaceMinMax.getMaxField(), "distanceToWaterSurfaceMax"); |
... | ... | |
171 | 172 |
MinMaxTextField distanceToGroundMinMax = new MinMaxTextField("Distance to substrate", "m"); |
172 | 173 |
distanceToGroundMinMax.setWidth("100%"); |
173 | 174 |
distanceToGroundMinMax.addSubComponentsStyleName(getDefaultComponentStyles()); |
174 |
grid.addComponent(distanceToGroundMinMax, 0, row, 2, row);
|
|
175 |
grid.addComponent(distanceToGroundMinMax, 0, row, endColumnIndex, row);
|
|
175 | 176 |
|
176 | 177 |
bindField(distanceToGroundMinMax.getMinField(), "distanceToGround"); |
177 | 178 |
bindField(distanceToGroundMinMax.getMaxField(), "distanceToGroundMax"); |
... | ... | |
181 | 182 |
|
182 | 183 |
row++; |
183 | 184 |
collectorField = new TeamOrPersonField("Collector", TeamOrPersonBaseCaptionGenerator.CacheType.COLLECTOR_TITLE); |
184 |
addField(collectorField, "collector", 0, row, 2, row);
|
|
185 |
addField(collectorField, "collector", 0, row, endColumnIndex, row);
|
|
185 | 186 |
|
186 | 187 |
row++; |
187 | 188 |
|
188 | 189 |
TimePeriodField collectionDateField = new TimePeriodField("Collection date"); |
189 | 190 |
// collectionDateField.setInputPrompt("dd.mm.yyyy"); |
190 | 191 |
addField(collectionDateField, "gatheringDate", 0, row, 1, row); |
191 |
addTextField("Field number", "fieldNumber", 2, row);
|
|
192 |
addTextField("Field number", "fieldNumber", endColumnIndex, row);
|
|
192 | 193 |
|
193 | 194 |
|
194 | 195 |
row++; |
... | ... | |
240 | 241 |
typeDesignationsScrollPanel.setWidth(800, Unit.PIXELS); |
241 | 242 |
|
242 | 243 |
bindField(typeDesignationsCollectionField, "specimenTypeDesignationDTOs"); |
243 |
addComponent(typeDesignationsScrollPanel, 0, row, 2, row);
|
|
244 |
addComponent(typeDesignationsScrollPanel, 0, row, endColumnIndex, row);
|
|
244 | 245 |
|
245 | 246 |
row++; |
246 | 247 |
annotationsListField = new FilterableAnnotationsField("Editorial notes"); |
... | ... | |
252 | 253 |
} else { |
253 | 254 |
annotationsListField.setAnnotationTypesVisible(editableAnotationTypes); |
254 | 255 |
} |
255 |
addField(annotationsListField, "annotations", 0, row, 2, row);
|
|
256 |
addField(annotationsListField, "annotations", 0, row, endColumnIndex, row);
|
|
256 | 257 |
|
257 | 258 |
} |
258 | 259 |
|
src/main/java/eu/etaxonomy/cdm/vaadin/view/reference/ReferencePopupEditor.java | ||
---|---|---|
70 | 70 |
|
71 | 71 |
private TextField titleField; |
72 | 72 |
|
73 |
private final static int GRID_COLS = 4; // 12 would fits for 2,3, and 4 Components per row
|
|
73 |
private final static int GRID_COLS = 4; // 12 would fit for 2,3, and 4 Components per row |
|
74 | 74 |
|
75 | 75 |
private final static int GRID_ROWS = 14; |
76 | 76 |
|
Also available in: Unified diff
fix #8342 solving layout problems of the AbstractTimePeriodField