Revision b66bc2e5
Added by Andreas Müller about 3 years ago
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/combo/AbstractComboElement.java | ||
---|---|---|
40 | 40 |
/** |
41 | 41 |
* @author pplitzner |
42 | 42 |
* @date Aug 11, 2016 |
43 |
* |
|
44 | 43 |
*/ |
45 |
public abstract class AbstractComboElement<T> extends
|
|
46 |
AbstractCdmFormElement implements SelectionListener,
|
|
47 |
IEnableableFormElement, ISelectable,
|
|
48 |
DisposeListener { |
|
44 |
public abstract class AbstractComboElement<T> |
|
45 |
extends AbstractCdmFormElement
|
|
46 |
implements SelectionListener, IEnableableFormElement,
|
|
47 |
ISelectable, DisposeListener {
|
|
49 | 48 |
|
50 | 49 |
protected static final int DEFAULT_VISIBLE_ITEMS = 10; |
51 | 50 |
|
... | ... | |
57 | 56 |
|
58 | 57 |
public boolean hasNullValue; |
59 | 58 |
|
60 |
|
|
61 |
|
|
62 |
|
|
63 | 59 |
public AbstractComboElement(CdmFormFactory formFactory, ICdmFormElement formElement, boolean hasNullValue) { |
64 | 60 |
super(formFactory, formElement); |
65 | 61 |
|
... | ... | |
77 | 73 |
//disable mouse-wheel selection |
78 | 74 |
combo.addListener(SWT.MouseWheel, e->e.doit=false); |
79 | 75 |
this.hasNullValue = hasNullValue; |
80 |
|
|
81 |
|
|
82 | 76 |
} |
83 | 77 |
|
84 | 78 |
public AbstractComboElement(CdmFormFactory formFactory, ICdmFormElement formElement){ |
85 | 79 |
this(formFactory, formElement, false); |
86 | 80 |
} |
87 | 81 |
|
88 |
|
|
89 |
|
|
90 |
/** {@inheritDoc} */ |
|
91 | 82 |
@Override |
92 | 83 |
public void setBackground(Color color) { |
93 | 84 |
if (label != null) { |
... | ... | |
95 | 86 |
} |
96 | 87 |
} |
97 | 88 |
|
98 |
/** {@inheritDoc} */ |
|
99 | 89 |
@Override |
100 | 90 |
public void setIrrelevant(boolean irrelevant) { |
101 | 91 |
String colorId = irrelevant ? Resources.COLOR_COMPOSITE_IRRELEVANT |
... | ... | |
106 | 96 |
if (label != null) { |
107 | 97 |
label.setBackground(color); |
108 | 98 |
} |
109 |
|
|
110 | 99 |
} |
111 | 100 |
|
112 | 101 |
public void setVisibleItemCount(int count){ |
113 | 102 |
combo.setVisibleItemCount(count); |
114 | 103 |
} |
115 | 104 |
|
116 |
/** {@inheritDoc} */ |
|
117 | 105 |
@Override |
118 | 106 |
public void setSelected(boolean selected) { |
119 | 107 |
setBackground(selected ? SELECTED : getPersistentBackground()); |
... | ... | |
131 | 119 |
combo.removeSelectionListener(listener); |
132 | 120 |
} |
133 | 121 |
|
134 |
/** {@inheritDoc} */ |
|
135 | 122 |
@Override |
136 | 123 |
public void widgetDisposed(DisposeEvent e) { |
137 | 124 |
PreferencesUtil.getPreferenceStore().removePropertyChangeListener(this); |
... | ... | |
146 | 133 |
return combo.isEnabled(); |
147 | 134 |
} |
148 | 135 |
|
149 |
/** {@inheritDoc} */ |
|
150 | 136 |
@Override |
151 | 137 |
public void setEnabled(boolean enabled) { |
152 | 138 |
combo.setEnabled(enabled); |
... | ... | |
154 | 140 |
|
155 | 141 |
public abstract void setSelection(T selection); |
156 | 142 |
|
157 |
|
|
158 |
|
|
159 | 143 |
private AbstractComboElement<T> getComboElement(){ |
160 | 144 |
return this; |
161 | 145 |
} |
162 | 146 |
|
163 |
|
|
164 | 147 |
protected void addContentProposalAdapter() { |
165 | 148 |
ContentProposalAdapter adapter; |
166 | 149 |
|
... | ... | |
186 | 169 |
return new IContentProposal[0]; |
187 | 170 |
} |
188 | 171 |
StringMatcher matcher = new StringMatcher("*" + contents + "*", true, false); //$NON-NLS-1$ //$NON-NLS-2$ |
189 |
ArrayList<String> matches = new ArrayList<String>();
|
|
172 |
ArrayList<String> matches = new ArrayList<>(); |
|
190 | 173 |
for (int i = 0; i < items.length; i++) { |
191 | 174 |
if (matcher.match(items[i])) { |
192 | 175 |
matches.add(items[i]); |
... | ... | |
237 | 220 |
} |
238 | 221 |
}; |
239 | 222 |
} |
240 |
|
|
241 |
} |
|
223 |
} |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/CheckboxElement.java | ||
---|---|---|
23 | 23 |
* |
24 | 24 |
* @author n.hoffmann |
25 | 25 |
* @created Nov 5, 2009 |
26 |
* @version 1.0 |
|
27 | 26 |
*/ |
28 | 27 |
public class CheckboxElement extends AbstractCdmFormElement implements SelectionListener, IEnableableFormElement, ISelectable { |
29 | 28 |
|
... | ... | |
60 | 59 |
|
61 | 60 |
/** |
62 | 61 |
* <p>setSelection</p> |
63 |
* |
|
64 |
* @param selected a boolean. |
|
65 | 62 |
*/ |
66 | 63 |
public void setSelection(boolean selected){ |
67 | 64 |
checkbox.removeSelectionListener(this); |
68 | 65 |
checkbox.setSelection(selected); |
69 | 66 |
checkbox.addSelectionListener(this); |
70 | 67 |
} |
71 |
|
|
72 | 68 |
/** |
73 | 69 |
* <p>getSelection</p> |
74 |
* |
|
75 |
* @return a boolean. |
|
76 | 70 |
*/ |
77 | 71 |
public boolean getSelection(){ |
78 | 72 |
return checkbox.getSelection(); |
79 | 73 |
} |
80 | 74 |
|
81 |
/* (non-Javadoc) |
|
82 |
* @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent) |
|
83 |
*/ |
|
84 |
/** {@inheritDoc} */ |
|
85 | 75 |
@Override |
86 | 76 |
public void widgetSelected(SelectionEvent e) { |
87 | 77 |
firePropertyChangeEvent(new CdmPropertyChangeEvent(this, e)); |
... | ... | |
91 | 81 |
return checkbox; |
92 | 82 |
} |
93 | 83 |
|
94 |
/** {@inheritDoc} */ |
|
95 | 84 |
@Override |
96 | 85 |
public void widgetDefaultSelected(SelectionEvent e) {} |
97 | 86 |
|
98 |
/** {@inheritDoc} */ |
|
99 | 87 |
@Override |
100 | 88 |
public void setSelected(boolean selected) { |
101 | 89 |
setBackground(selected ? SELECTED : getPersistentBackground()); |
102 | 90 |
} |
103 | 91 |
|
104 |
/** {@inheritDoc} */ |
|
105 | 92 |
@Override |
106 | 93 |
public void setEnabled(boolean enabled) { |
107 | 94 |
checkbox.setEnabled(enabled); |
108 | 95 |
label.setEnabled(enabled); |
109 | 96 |
} |
110 | 97 |
|
111 |
/* (non-Javadoc) |
|
112 |
* @see eu.etaxonomy.taxeditor.ui.element.IEnableableFormElement#isEnabled() |
|
113 |
*/ |
|
114 | 98 |
@Override |
115 | 99 |
public boolean isEnabled() { |
116 | 100 |
return checkbox.isEnabled(); |
117 | 101 |
} |
118 | 102 |
|
119 |
/** {@inheritDoc} */ |
|
120 | 103 |
@Override |
121 | 104 |
public void setIrrelevant(boolean irrelevant) { |
122 | 105 |
String colorId = irrelevant ? Resources.COLOR_COMPOSITE_IRRELEVANT : Resources.COLOR_COMPOSITE_BACKGROUND; |
... | ... | |
125 | 108 |
setBackground(color); |
126 | 109 |
} |
127 | 110 |
|
128 |
/* (non-Javadoc) |
|
129 |
* @see eu.etaxonomy.taxeditor.forms.AbstractCdmFormElement#setBackground(org.eclipse.swt.graphics.Color) |
|
130 |
*/ |
|
131 |
/** {@inheritDoc} */ |
|
132 | 111 |
@Override |
133 | 112 |
public void setBackground(Color color) { |
134 | 113 |
if (checkbox.isDisposed()){ |
... | ... | |
150 | 129 |
getLayoutComposite().layout(); |
151 | 130 |
|
152 | 131 |
} |
153 |
} |
|
132 |
} |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/IEntityElement.java | ||
---|---|---|
6 | 6 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
7 | 7 |
* See LICENSE.TXT at the top of this package for the full license terms. |
8 | 8 |
*/ |
9 |
|
|
10 | 9 |
package eu.etaxonomy.taxeditor.ui.element; |
11 | 10 |
|
12 |
|
|
13 |
|
|
14 | 11 |
/** |
15 | 12 |
* Any composite that represent a cdm entity should implement |
16 | 13 |
* this interface. Selection of CdmEntity data will rely on this |
... | ... | |
18 | 15 |
* |
19 | 16 |
* @author n.hoffmann |
20 | 17 |
* @created Feb 16, 2010 |
21 |
* @version 1.0 |
|
22 | 18 |
*/ |
23 | 19 |
public interface IEntityElement<ENTITY> extends ICdmFormElement, ISelectable { |
24 | 20 |
|
... | ... | |
29 | 25 |
* @return a ENTITY object. |
30 | 26 |
*/ |
31 | 27 |
public ENTITY getEntity(); |
32 |
} |
|
28 |
} |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/IRelevantFormElement.java | ||
---|---|---|
6 | 6 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
7 | 7 |
* See LICENSE.TXT at the top of this package for the full license terms. |
8 | 8 |
*/ |
9 |
|
|
10 | 9 |
package eu.etaxonomy.taxeditor.ui.element; |
11 | 10 |
|
12 |
|
|
13 | 11 |
/** |
14 | 12 |
* <p>IRelevantFormElement interface.</p> |
15 | 13 |
* |
16 | 14 |
* @author n.hoffmann |
17 | 15 |
* @created May 10, 2010 |
18 |
* @version 1.0 |
|
19 | 16 |
*/ |
20 | 17 |
public interface IRelevantFormElement { |
21 | 18 |
|
22 | 19 |
/** |
23 |
* <p>setIrrelevant</p> |
|
24 |
* |
|
25 |
* @param irrelevant a boolean. |
|
20 |
* setIrrelevant |
|
26 | 21 |
*/ |
27 | 22 |
public void setIrrelevant(boolean irrelevant); |
28 |
|
|
29 |
} |
|
23 |
} |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/ToggleableTextElement.java | ||
---|---|---|
6 | 6 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
7 | 7 |
* See LICENSE.TXT at the top of this package for the full license terms. |
8 | 8 |
*/ |
9 |
|
|
10 | 9 |
package eu.etaxonomy.taxeditor.ui.element; |
11 | 10 |
|
12 | 11 |
import java.util.HashSet; |
... | ... | |
35 | 34 |
* |
36 | 35 |
* @author n.hoffmann |
37 | 36 |
* @created Nov 18, 2009 |
38 |
* @version 1.0 |
|
39 | 37 |
*/ |
40 | 38 |
public class ToggleableTextElement extends AbstractCdmFormElement implements SelectionListener, ModifyListener, IEnableableFormElement, ISelectable { |
41 | 39 |
|
... | ... | |
71 | 69 |
text_cache.addModifyListener(this); |
72 | 70 |
text_cache.setLayoutData(LayoutConstants.FILL()); |
73 | 71 |
|
74 |
|
|
75 | 72 |
// Don't accept carriage returns as input |
76 | 73 |
text_cache.addKeyListener( new KeyAdapter(){ |
77 | 74 |
@Override |
... | ... | |
188 | 185 |
public void setSelected(boolean selected) { |
189 | 186 |
setBackground(selected ? SELECTED : getPersistentBackground()); |
190 | 187 |
} |
191 |
} |
|
188 |
} |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/mvc/combo/EnumTermComboController.java | ||
---|---|---|
39 | 39 |
/** |
40 | 40 |
* @author pplitzner |
41 | 41 |
* @date 29.01.2014 |
42 |
* |
|
43 | 42 |
*/ |
44 |
public class EnumTermComboController<T extends IEnumTerm<T>> extends AbstractCdmFormElement implements SelectionListener, |
|
45 |
IEnableableFormElement, ISelectable, CdmCompositeController { |
|
43 |
public class EnumTermComboController<T extends IEnumTerm<T>> |
|
44 |
extends AbstractCdmFormElement |
|
45 |
implements SelectionListener, IEnableableFormElement, ISelectable, CdmCompositeController { |
|
46 | 46 |
|
47 |
private static CdmEnumDataHolder[] cdmEnumDataHolders = { |
|
47 |
private static CdmEnumDataHolder<?>[] cdmEnumDataHolders = {
|
|
48 | 48 |
new CdmEnumDataHolder<NomenclaturalCode>(){ |
49 | 49 |
|
50 | 50 |
@Override |
... | ... | |
133 | 133 |
private final Class<T> enumType; |
134 | 134 |
|
135 | 135 |
/** |
136 |
* <p> |
|
137 | 136 |
* Constructor for AbstractEnumComboElement. |
138 |
* </p> |
|
139 |
* |
|
140 |
* @param formFactory |
|
141 |
* a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} |
|
142 |
* object. |
|
143 |
* @param parentElement |
|
144 |
* a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} |
|
145 |
* object. |
|
146 |
* @param labelString |
|
147 |
* a {@link java.lang.String} object. |
|
148 |
* @param <T> |
|
149 |
* a T object. |
|
150 | 137 |
*/ |
151 | 138 |
public EnumTermComboController(Combo combo, CdmFormFactory formFactory, |
152 | 139 |
ICdmFormElement parentElement, Class<T> enumType, int style) { |
... | ... | |
160 | 147 |
populateTypes(); |
161 | 148 |
|
162 | 149 |
combo.addSelectionListener(this); |
163 |
|
|
164 |
} |
|
165 |
|
|
166 |
private String getDefaultLabelString() { |
|
167 |
if(enumType.equals(ReferenceType.class)){ |
|
168 |
return "Reference Type"; |
|
169 |
} else if (enumType.equals(NomenclaturalCode.class)){ |
|
170 |
return "Nomenclatural Code"; |
|
171 |
} else if(enumType.equals(OriginalSourceType.class)) { |
|
172 |
return "Orig. Source Type"; |
|
173 |
} else if(enumType.equals(SpecimenOrObservationType.class)) { |
|
174 |
return "Spec./Obs. Type"; |
|
175 |
} |
|
176 |
return "No Label"; |
|
177 | 150 |
} |
178 | 151 |
|
179 | 152 |
/** |
180 |
* <p> |
|
181 | 153 |
* populateTypes |
182 |
* </p> |
|
183 | 154 |
*/ |
184 | 155 |
private void populateTypes(){ |
185 | 156 |
Collection<T> elementsForClass = getElementsForClass(enumType); |
... | ... | |
200 | 171 |
} |
201 | 172 |
} |
202 | 173 |
|
203 |
/** |
|
204 |
* <p> |
|
205 |
* Setter for the field <code>selection</code>. |
|
206 |
* </p> |
|
207 |
* |
|
208 |
* @param selection |
|
209 |
* the selection to set |
|
210 |
*/ |
|
211 | 174 |
public void setSelection(T selection) { |
212 | 175 |
this.selection = selection; |
213 | 176 |
combo.select(elementTypeList.indexOf(selection)); |
214 | 177 |
} |
215 | 178 |
|
216 |
/** |
|
217 |
* <p> |
|
218 |
* addSelectionListener |
|
219 |
* </p> |
|
220 |
* |
|
221 |
* @param listener |
|
222 |
* a {@link org.eclipse.swt.events.SelectionListener} object. |
|
223 |
*/ |
|
224 | 179 |
public void addSelectionListener(SelectionListener listener) { |
225 | 180 |
combo.addSelectionListener(listener); |
226 | 181 |
} |
227 | 182 |
|
228 |
/** |
|
229 |
* <p> |
|
230 |
* removeSelectionListener |
|
231 |
* </p> |
|
232 |
* |
|
233 |
* @param listener |
|
234 |
* a {@link org.eclipse.swt.events.SelectionListener} object. |
|
235 |
*/ |
|
236 | 183 |
public void removeSelectionListener(SelectionListener listener) { |
237 | 184 |
combo.removeSelectionListener(listener); |
238 | 185 |
} |
239 | 186 |
|
240 |
/** {@inheritDoc} */ |
|
241 | 187 |
@Override |
242 | 188 |
public void setSelected(boolean selected) { |
243 | 189 |
setBackground(selected ? SELECTED : getPersistentBackground()); |
244 | 190 |
} |
245 | 191 |
|
246 |
/** |
|
247 |
* <p> |
|
248 |
* Getter for the field <code>selection</code>. |
|
249 |
* </p> |
|
250 |
* |
|
251 |
* @return the selection |
|
252 |
*/ |
|
253 | 192 |
public T getSelection() { |
254 | 193 |
return selection; |
255 | 194 |
} |
256 | 195 |
|
257 |
/** {@inheritDoc} */ |
|
258 | 196 |
@Override |
259 | 197 |
public void setEnabled(boolean enabled) { |
260 | 198 |
combo.setEnabled(enabled); |
261 | 199 |
} |
262 | 200 |
|
263 |
/* (non-Javadoc) |
|
264 |
* @see eu.etaxonomy.taxeditor.ui.element.IEnableableFormElement#isEnabled() |
|
265 |
*/ |
|
266 | 201 |
@Override |
267 | 202 |
public boolean isEnabled() { |
268 | 203 |
return combo.isEnabled(); |
269 | 204 |
} |
270 | 205 |
|
271 |
/* |
|
272 |
* (non-Javadoc) |
|
273 |
* |
|
274 |
* @see |
|
275 |
* org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt |
|
276 |
* .events.SelectionEvent) |
|
277 |
*/ |
|
278 |
/** {@inheritDoc} */ |
|
279 | 206 |
@Override |
280 | 207 |
public void widgetSelected(SelectionEvent e) { |
281 | 208 |
selection = elementTypeList.get(combo.getSelectionIndex()); |
282 | 209 |
} |
283 | 210 |
|
284 |
/** {@inheritDoc} */ |
|
285 | 211 |
@Override |
286 | 212 |
public void setIrrelevant(boolean irrelevant) { |
287 | 213 |
String colorId = irrelevant ? Resources.COLOR_COMPOSITE_IRRELEVANT |
... | ... | |
291 | 217 |
combo.setBackground(color); |
292 | 218 |
} |
293 | 219 |
|
294 |
/** {@inheritDoc} */ |
|
295 | 220 |
@Override |
296 | 221 |
public void setBackground(Color color) { |
297 | 222 |
// label.setBackground(color); |
298 | 223 |
} |
299 | 224 |
|
300 |
/** {@inheritDoc} */ |
|
301 | 225 |
@Override |
302 | 226 |
public void widgetDefaultSelected(SelectionEvent e) { |
303 | 227 |
} |
... | ... | |
315 | 239 |
} |
316 | 240 |
|
317 | 241 |
private CdmEnumDataHolder<T> getCdmEnumDataHolderForClass(Class<T> clazz){ |
318 |
for (CdmEnumDataHolder dataHolder : cdmEnumDataHolders) { |
|
242 |
for (CdmEnumDataHolder<?> dataHolder : cdmEnumDataHolders) {
|
|
319 | 243 |
if (dataHolder.getClazz().equals(clazz)){ |
320 |
return dataHolder; |
|
244 |
return (CdmEnumDataHolder<T>)dataHolder;
|
|
321 | 245 |
} |
322 | 246 |
} |
323 | 247 |
return null; |
... | ... | |
328 | 252 |
String getName(); |
329 | 253 |
Collection<T> getElements(); |
330 | 254 |
} |
331 |
} |
|
255 |
} |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/mvc/element/DateElementController.java | ||
---|---|---|
8 | 8 |
*/ |
9 | 9 |
package eu.etaxonomy.taxeditor.ui.mvc.element; |
10 | 10 |
|
11 |
|
|
12 |
import java.time.ZonedDateTime; |
|
13 |
import java.time.format.DateTimeFormatter; |
|
14 |
|
|
15 | 11 |
import org.eclipse.swt.events.ModifyEvent; |
16 | 12 |
import org.eclipse.swt.events.ModifyListener; |
17 | 13 |
import org.eclipse.swt.widgets.Text; |
18 | 14 |
import org.joda.time.DateTime; |
19 |
import org.joda.time.LocalDateTime; |
|
20 | 15 |
|
21 | 16 |
import eu.etaxonomy.taxeditor.ui.element.AbstractCdmFormElement; |
22 | 17 |
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory; |
... | ... | |
28 | 23 |
/** |
29 | 24 |
* @author pplitzner |
30 | 25 |
* @date 16.06.2014 |
31 |
* |
|
32 | 26 |
*/ |
33 | 27 |
public class DateElementController extends AbstractCdmFormElement implements IEnableableFormElement, CdmCompositeController, ModifyListener{ |
34 | 28 |
|
35 | 29 |
private final Text textDate; |
36 | 30 |
private DateTime dateTime; |
37 | 31 |
|
38 |
/** |
|
39 |
* @param dateTimeElement |
|
40 |
* @param formFactory |
|
41 |
* @param parentElement |
|
42 |
* @param initialDateTime |
|
43 |
* @param none |
|
44 |
*/ |
|
45 | 32 |
public DateElementController(DateElement dateTimeElement, CdmFormFactory formFactory, |
46 | 33 |
ICdmFormElement parentElement, DateTime initialDateTime) { |
47 | 34 |
super(formFactory, parentElement); |
... | ... | |
97 | 84 |
public boolean isEnabled() { |
98 | 85 |
return textDate.isEnabled(); |
99 | 86 |
} |
100 |
|
|
101 |
} |
|
87 |
} |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/AbstractCdmDetailElement.java | ||
---|---|---|
221 | 221 |
isRelevant &= this instanceof AbstractIdentifiableEntityDetailElement; |
222 | 222 |
|
223 | 223 |
if (isRelevant) { |
224 |
((AbstractIdentifiableEntityDetailElement) this) |
|
225 |
.updateToggleableCacheField(); |
|
224 |
((AbstractIdentifiableEntityDetailElement<?>)this).updateToggleableCacheField(); |
|
226 | 225 |
} |
227 | 226 |
} |
228 | 227 |
|
229 | 228 |
private void updateParentSection() { |
230 | 229 |
if (getParentElement() instanceof AbstractCdmDetailSection) { |
231 |
((AbstractCdmDetailSection) getParentElement()).updateTitle(); |
|
230 |
((AbstractCdmDetailSection<?>) getParentElement()).updateTitle();
|
|
232 | 231 |
} |
233 | 232 |
//NOTE: This slows down the rendering of the details view |
234 | 233 |
// StoreUtil.reflowParentScrolledForm(getLayoutComposite(), true); |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/AbstractIdentifiableEntityDetailElement.java | ||
---|---|---|
28 | 28 |
private static final EnumSet<CRUD> UPDATE = EnumSet.of(CRUD.UPDATE); |
29 | 29 |
protected ToggleableTextElement toggleable_cache; |
30 | 30 |
|
31 |
|
|
32 | 31 |
public AbstractIdentifiableEntityDetailElement(CdmFormFactory formFactory, ICdmFormElement formElement) { |
33 | 32 |
super(formFactory, formElement); |
34 | 33 |
updateToggleableCacheState(); |
... | ... | |
52 | 51 |
|
53 | 52 |
@Override |
54 | 53 |
protected void updateControlStates(){ |
55 |
|
|
56 | 54 |
updateToggleableCacheState(); |
57 | 55 |
super.updateControlStates(); |
58 | 56 |
} |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/ICdmDetailElement.java | ||
---|---|---|
17 | 17 |
* @date 30.07.2013 |
18 | 18 |
* |
19 | 19 |
*/ |
20 |
public interface ICdmDetailElement<T> extends IEntityElement<T>, IEnableableFormElement, IConversationEnabled{ |
|
20 |
public interface ICdmDetailElement<T> |
|
21 |
extends IEntityElement<T>, IEnableableFormElement, IConversationEnabled{ |
|
21 | 22 |
|
22 | 23 |
public abstract void setEntity(T entity); |
23 | 24 |
|
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/agent/PersonDetailElement.java | ||
---|---|---|
6 | 6 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
7 | 7 |
* See LICENSE.TXT at the top of this package for the full license terms. |
8 | 8 |
*/ |
9 |
|
|
10 | 9 |
package eu.etaxonomy.taxeditor.ui.section.agent; |
11 | 10 |
|
12 | 11 |
import java.util.Arrays; |
... | ... | |
25 | 24 |
import eu.etaxonomy.taxeditor.ui.section.AbstractIdentifiableEntityDetailElement; |
26 | 25 |
|
27 | 26 |
/** |
28 |
* <p> |
|
29 | 27 |
* PersonDetailElement class. |
30 |
* </p> |
|
31 | 28 |
* |
32 | 29 |
* @author n.hoffmann |
33 | 30 |
* @created Mar 8, 2010 |
... | ... | |
73 | 70 |
text_orcid = formFactory.createOrcidWithLabelElement(formElement, "ORCID", entity.getOrcid(), SWT.NULL); |
74 | 71 |
text_lsid = formFactory.createLsidWithExceptionLabelElement(formElement, "LSID", entity.getLsid(), SWT.NULL); |
75 | 72 |
getLayoutComposite().layout(); |
76 |
|
|
77 | 73 |
} |
78 | 74 |
|
79 | 75 |
@Override |
... | ... | |
92 | 88 |
public void handleEvent(Object eventSource) { |
93 | 89 |
if (eventSource == toggleable_cache) { |
94 | 90 |
handleToggleableCacheField(); |
95 |
|
|
96 | 91 |
} else if (eventSource == text_nomenclaturalTitle) { |
97 |
getEntity() |
|
98 |
.setNomenclaturalTitle(text_nomenclaturalTitle.getText()); |
|
92 |
getEntity().setNomenclaturalTitle(text_nomenclaturalTitle.getText()); |
|
99 | 93 |
} else if (eventSource == text_firstname) { |
100 | 94 |
getEntity().setGivenName(text_firstname.getText()); |
101 | 95 |
}else if (eventSource == text_initials) { |
... | ... | |
132 | 126 |
} |
133 | 127 |
setIrrelevant(pushedState, Arrays.asList(new Object[] { toggleable_cache, text_nomenclaturalTitle })); |
134 | 128 |
updateToggleableCacheField(); |
135 |
|
|
136 | 129 |
} |
137 | 130 |
} |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/agent/TeamDetailElement.java | ||
---|---|---|
6 | 6 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
7 | 7 |
* See LICENSE.TXT at the top of this package for the full license terms. |
8 | 8 |
*/ |
9 |
|
|
10 | 9 |
package eu.etaxonomy.taxeditor.ui.section.agent; |
11 | 10 |
|
12 | 11 |
import java.util.Arrays; |
... | ... | |
22 | 21 |
import eu.etaxonomy.taxeditor.ui.section.AbstractIdentifiableEntityDetailElement; |
23 | 22 |
|
24 | 23 |
/** |
25 |
* <p> |
|
26 | 24 |
* TeamDetailElement class. |
27 |
* </p> |
|
28 | 25 |
* |
29 | 26 |
* @author n.hoffmann |
30 | 27 |
* @created Apr 26, 2010 |
... | ... | |
39 | 36 |
private boolean isNomenclaturalTeam; |
40 | 37 |
|
41 | 38 |
/** |
42 |
* <p> |
|
43 | 39 |
* Constructor for TeamDetailElement. |
44 |
* </p> |
|
45 |
* |
|
46 |
* @param cdmFormFactory |
|
47 |
* a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} |
|
48 |
* object. |
|
49 |
* @param formElement |
|
50 |
* a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} |
|
51 |
* object. |
|
52 |
* @param style |
|
53 |
* a int. |
|
54 | 40 |
*/ |
55 | 41 |
public TeamDetailElement(CdmFormFactory cdmFormFactory, |
56 | 42 |
ICdmFormElement formElement, int style, boolean isNomenclatural) { |
... | ... | |
58 | 44 |
this.isNomenclaturalTeam = isNomenclatural; |
59 | 45 |
} |
60 | 46 |
|
61 |
/** {@inheritDoc} */ |
|
62 | 47 |
@Override |
63 | 48 |
protected void createControls(ICdmFormElement formElement, Team entity, int style) { |
64 | 49 |
|
... | ... | |
70 | 55 |
section_teamMembers.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1)); |
71 | 56 |
} |
72 | 57 |
|
73 |
/** {@inheritDoc} */ |
|
74 | 58 |
@Override |
75 | 59 |
protected void updateContent() { |
76 | 60 |
super.updateContent(); |
... | ... | |
93 | 77 |
} |
94 | 78 |
|
95 | 79 |
section_teamMembers.setEntity(getEntity()); |
96 |
|
|
97 | 80 |
} |
98 | 81 |
|
99 |
/** {@inheritDoc} */ |
|
100 | 82 |
@Override |
101 | 83 |
public void handleEvent(Object eventSource) { |
102 | 84 |
if (eventSource == toggleable_cache) { |
... | ... | |
132 | 114 |
} |
133 | 115 |
} |
134 | 116 |
|
135 |
/** |
|
136 |
* @return the isNomenclaturalTeam |
|
137 |
*/ |
|
138 | 117 |
public boolean isNomenclaturalTeam() { |
139 | 118 |
return isNomenclaturalTeam; |
140 | 119 |
} |
141 |
|
|
142 |
/** |
|
143 |
* @param isNomenclaturalTeam the isNomenclaturalTeam to set |
|
144 |
*/ |
|
145 | 120 |
public void setNomenclaturalTeam(boolean isNomenclaturalTeam) { |
146 | 121 |
this.isNomenclaturalTeam = isNomenclaturalTeam; |
147 | 122 |
} |
148 |
} |
|
123 |
} |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/description/DescriptionDetailElement.java | ||
---|---|---|
6 | 6 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
7 | 7 |
* See LICENSE.TXT at the top of this package for the full license terms. |
8 | 8 |
*/ |
9 |
|
|
10 | 9 |
package eu.etaxonomy.taxeditor.ui.section.description; |
11 | 10 |
|
12 | 11 |
import java.util.Arrays; |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/AuthorshipDetailElement.java | ||
---|---|---|
27 | 27 |
import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement; |
28 | 28 |
|
29 | 29 |
/** |
30 |
* <p> |
|
31 | 30 |
* AuthorshipDetailElement class. |
32 |
* </p> |
|
33 | 31 |
* |
34 | 32 |
* @author n.hoffmann |
35 | 33 |
* @created Mar 4, 2010 |
36 | 34 |
*/ |
37 |
public class AuthorshipDetailElement extends
|
|
38 |
AbstractIdentifiableEntityDetailElement<INonViralName> { |
|
35 |
public class AuthorshipDetailElement |
|
36 |
extends AbstractIdentifiableEntityDetailElement<INonViralName> {
|
|
39 | 37 |
|
40 |
private EntitySelectionElement<TeamOrPersonBase> selectionExBasionymAuthor; |
|
41 |
private EntitySelectionElement<TeamOrPersonBase> selectionBasionymAuthor; |
|
42 |
private EntitySelectionElement<TeamOrPersonBase> selectionExCombinationAuthor; |
|
43 |
private EntitySelectionElement<TeamOrPersonBase> selectionCombinationAuthor; |
|
38 |
@SuppressWarnings("rawtypes") |
|
39 |
private EntitySelectionElement<TeamOrPersonBase> selectionExBasionymAuthor; |
|
40 |
@SuppressWarnings("rawtypes") |
|
41 |
private EntitySelectionElement<TeamOrPersonBase> selectionBasionymAuthor; |
|
42 |
@SuppressWarnings("rawtypes") |
|
43 |
private EntitySelectionElement<TeamOrPersonBase> selectionExCombinationAuthor; |
|
44 |
@SuppressWarnings("rawtypes") |
|
45 |
private EntitySelectionElement<TeamOrPersonBase> selectionCombinationAuthor; |
|
44 | 46 |
|
45 | 47 |
private NumberWithLabelElement text_publicationYear; |
46 | 48 |
private NumberWithLabelElement text_originalPublicationYear; |
47 |
/** |
|
49 |
|
|
50 |
/** |
|
48 | 51 |
* <p> |
49 | 52 |
* Constructor for AuthorshipDetailElement. |
50 | 53 |
* </p> |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/NonViralNameDetailElement.java | ||
---|---|---|
70 | 70 |
} |
71 | 71 |
if (entity.getNameType().equals(NomenclaturalCode.ICNB)){ |
72 | 72 |
if (config.isNameApprobiationActivated()){ |
73 |
text_nameApprobation = formFactory.createTextWithLabelElement(formElement, "Name Approbation", entity.getNameApprobation(),style);
|
|
73 |
text_nameApprobation = formFactory.createTextWithLabelElement(formElement, "Name Approbation", entity.getNameApprobation(),style);
|
|
74 | 74 |
} |
75 | 75 |
} |
76 |
|
|
77 | 76 |
if (config.isLSIDActivated()){ |
78 | 77 |
textLsid = formFactory.createLsidWithExceptionLabelElement(formElement, "Lsid", entity.getLsid(), style); |
79 | 78 |
} |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/CollectionDetailElement.java | ||
---|---|---|
6 | 6 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
7 | 7 |
* See LICENSE.TXT at the top of this package for the full license terms. |
8 | 8 |
*/ |
9 |
|
|
10 | 9 |
package eu.etaxonomy.taxeditor.ui.section.occurrence; |
11 | 10 |
|
12 | 11 |
import eu.etaxonomy.cdm.model.agent.Institution; |
... | ... | |
40 | 39 |
private EntitySelectionElement<Collection> selection_superCollection; |
41 | 40 |
|
42 | 41 |
/** |
43 |
* <p> |
|
44 | 42 |
* Constructor for CollectionDetailElement. |
45 |
* </p> |
|
46 |
* |
|
47 |
* @param formFactory |
|
48 |
* a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} |
|
49 |
* object. |
|
50 |
* @param formElement |
|
51 |
* a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} |
|
52 |
* object. |
|
53 | 43 |
*/ |
54 | 44 |
public CollectionDetailElement(CdmFormFactory formFactory, |
55 | 45 |
ICdmFormElement formElement) { |
... | ... | |
73 | 63 |
formElement, "Town Or Location", entity.getTownOrLocation(), |
74 | 64 |
style); |
75 | 65 |
selection_institute = formFactory |
76 |
.createSelectionElement(Institution.class,//getConversationHolder(),
|
|
66 |
.createSelectionElement(Institution.class, |
|
77 | 67 |
formElement, "Institute", |
78 | 68 |
entity.getInstitute(), |
79 | 69 |
EntitySelectionElement.ALL, style); |
80 | 70 |
selection_superCollection = formFactory |
81 |
.createSelectionElement(Collection.class,//getConversationHolder(),
|
|
71 |
.createSelectionElement(Collection.class, |
|
82 | 72 |
formElement, |
83 | 73 |
"Super Collection", entity.getSuperCollection(), |
84 | 74 |
EntitySelectionElement.ALL, style); |
... | ... | |
107 | 97 |
text_titleCache.setText(getEntity().getTitleCache()); |
108 | 98 |
} |
109 | 99 |
} |
110 |
} |
|
100 |
} |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/dna/AmplificationCloningDetailElement.java | ||
---|---|---|
24 | 24 |
/** |
25 | 25 |
* @author pplitzner |
26 | 26 |
* @date 15.01.2014 |
27 |
* |
|
28 | 27 |
*/ |
29 | 28 |
public class AmplificationCloningDetailElement extends AbstractCdmDetailElement<AmplificationResult> { |
30 |
private TextWithLabelElement textCloningStrain; |
|
29 |
|
|
30 |
private TextWithLabelElement textCloningStrain; |
|
31 | 31 |
private TimePeriodElement date; |
32 | 32 |
private EntitySelectionElement<AgentBase> selectionCloningStaff; |
33 | 33 |
private TermComboElement<DefinedTerm> comboCloningMaterialOrMethod; |
34 | 34 |
|
35 |
|
|
36 |
/** |
|
37 |
* @param formFactory |
|
38 |
* @param formElement |
|
39 |
*/ |
|
40 | 35 |
public AmplificationCloningDetailElement(CdmFormFactory formFactory, ICdmFormElement formElement) { |
41 | 36 |
super(formFactory, formElement); |
42 | 37 |
} |
43 | 38 |
|
44 |
/* |
|
45 |
* (non-Javadoc) |
|
46 |
* |
|
47 |
* @see |
|
48 |
* eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#createControls |
|
49 |
* (eu.etaxonomy.taxeditor.forms.ICdmFormElement, java.lang.Object, int) |
|
50 |
*/ |
|
51 | 39 |
@Override |
52 | 40 |
protected void createControls(ICdmFormElement formElement, AmplificationResult entity, int style) { |
53 | 41 |
Cloning cloning = entity.getCloning(); |
... | ... | |
58 | 46 |
comboCloningMaterialOrMethod = formFactory.createDefinedTermComboElement(TermType.MaterialOrMethod, formElement, "Cloning Mat. & Meth.", cloning==null?null:cloning.getDefinedMaterialOrMethod(), style); |
59 | 47 |
} |
60 | 48 |
|
61 |
/* |
|
62 |
* (non-Javadoc) |
|
63 |
* |
|
64 |
* @see |
|
65 |
* eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#handleEvent(java |
|
66 |
* .lang.Object) |
|
67 |
*/ |
|
68 | 49 |
@Override |
69 | 50 |
public void handleEvent(Object eventSource) { |
70 | 51 |
if(eventSource==textCloningStrain || eventSource==date|| eventSource==selectionCloningStaff || eventSource==comboCloningMaterialOrMethod){ |
... | ... | |
87 | 68 |
} |
88 | 69 |
} |
89 | 70 |
} |
90 |
|
|
91 |
} |
|
71 |
} |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/reference/ReferenceDetailElement.java | ||
---|---|---|
38 | 38 |
import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement; |
39 | 39 |
|
40 | 40 |
/** |
41 |
* <p> |
|
42 | 41 |
* ReferenceBaseDetailElement class. |
43 |
* </p> |
|
44 | 42 |
* |
45 | 43 |
* @author n.hoffmann |
46 | 44 |
* @created Mar 2, 2010 |
... | ... | |
78 | 76 |
private boolean isWizard; |
79 | 77 |
|
80 | 78 |
/** |
81 |
* <p> |
|
82 | 79 |
* Constructor for ReferenceBaseDetailElement. |
83 |
* </p> |
|
84 | 80 |
* |
85 | 81 |
* @param cdmFormFactory |
86 | 82 |
* a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} |
... | ... | |
131 | 127 |
EntitySelectionElement.ALL, style); |
132 | 128 |
} |
133 | 129 |
|
134 |
|
|
135 |
|
|
136 | 130 |
if (referenceType != null) { |
137 | 131 |
|
138 | 132 |
createInReferenceByType(this, referenceType, entity, SWT.NULL); |
... | ... | |
160 | 154 |
if (referenceType.isSection()) { |
161 | 155 |
createSectionControls(this, entity, SWT.NULL); |
162 | 156 |
} |
163 |
|
|
164 | 157 |
} |
165 | 158 |
} |
166 | 159 |
|
... | ... | |
185 | 178 |
private void createWebPageControls(ReferenceDetailElement referenceDetailElement, Reference reference, int style) { |
186 | 179 |
DateTime accessed = reference.getAccessed(); |
187 | 180 |
|
188 |
text_accessed = formFactory.createDateElement(referenceDetailElement, "Accessed", accessed, style, false); |
|
189 |
|
|
181 |
text_accessed = formFactory.createDateElement(referenceDetailElement, "Accessed", accessed, style, false); |
|
190 | 182 |
} |
191 | 183 |
|
192 |
/* |
|
193 |
* (non-Javadoc) |
|
194 |
* |
|
195 |
* @see |
|
196 |
* eu.etaxonomy.taxeditor.forms.section.cdmdetail.AbstractCdmDetailComposite |
|
197 |
* #updateContent() |
|
198 |
*/ |
|
199 |
/** {@inheritDoc} */ |
|
200 | 184 |
@Override |
201 | 185 |
protected void updateContent() { |
202 | 186 |
if (getEntity() == null) { |
... | ... | |
216 | 200 |
|
217 | 201 |
/** |
218 | 202 |
* Creates an in reference for reference types that do hav this. |
219 |
* |
|
220 |
* @param element |
|
221 |
* @param referenceType |
|
222 |
* @param reference |
|
223 |
* @param style |
|
224 | 203 |
*/ |
225 | 204 |
private void createInReferenceByType(ICdmFormElement element, |
226 | 205 |
ReferenceType referenceType, Reference reference, int style) { |
... | ... | |
282 | 261 |
// pages |
283 | 262 |
text_pages = formFactory.createTextWithLabelElement(element, "Pages", |
284 | 263 |
reference.getPages(), style); |
285 |
|
|
286 |
|
|
287 | 264 |
} |
288 | 265 |
|
289 | 266 |
/** |
290 | 267 |
* Creates additional controls to edit a publication |
291 |
* |
|
292 |
* @param element |
|
293 |
* @param reference |
|
294 |
* @param listener |
|
295 |
* @param style |
|
296 | 268 |
*/ |
297 | 269 |
private void createPublicationControls(ICdmFormElement element, |
298 | 270 |
ReferenceType referenceType, Reference reference, int style) { |
... | ... | |
338 | 310 |
|
339 | 311 |
/** |
340 | 312 |
* Creates additional controls to edit a section |
341 |
* |
|
342 |
* @param element |
|
343 |
* @param reference |
|
344 |
* @param style |
|
345 | 313 |
*/ |
346 | 314 |
private void createSectionControls(ICdmFormElement element, |
347 | 315 |
Reference reference, int style) { |
... | ... | |
352 | 320 |
|
353 | 321 |
/** |
354 | 322 |
* Creates additional controls to edit a volume |
355 |
* |
|
356 |
* @param element |
|
357 |
* @param reference |
|
358 |
* @param style |
|
359 | 323 |
*/ |
360 | 324 |
private void createVolumeControls(ICdmFormElement element, |
361 | 325 |
Reference reference, int style) { |
... | ... | |
367 | 331 |
reference.getSeriesPart(), style); |
368 | 332 |
} |
369 | 333 |
|
370 |
/** |
|
371 |
* |
|
372 |
* @param element |
|
373 |
* @param referenceType |
|
374 |
* @param reference |
|
375 |
* @param style |
|
376 |
*/ |
|
377 | 334 |
private void createPrintedUnitControls(ICdmFormElement element, |
378 | 335 |
ReferenceType referenceType, Reference reference, int style) { |
379 | 336 |
// in series |
... | ... | |
395 | 352 |
// edition |
396 | 353 |
text_edition = formFactory.createTextWithLabelElement(element, |
397 | 354 |
"Edition", reference.getEdition(), style); |
398 |
|
|
399 | 355 |
} |
356 |
|
|
400 | 357 |
// isbn |
401 | 358 |
text_isbn = formFactory.createTextWithLabelElement(element, "ISBN", |
402 | 359 |
reference.getIsbn(), style); |
... | ... | |
414 | 371 |
Reference reference, int style) { |
415 | 372 |
text_lsid = formFactory.createLsidWithExceptionLabelElement(element, "LSID", |
416 | 373 |
reference.getLsid(), style); |
417 |
|
|
418 | 374 |
} |
419 | 375 |
|
420 | 376 |
private void createUri(ICdmFormElement element, |
... | ... | |
425 | 381 |
if (reference.getType().equals(ReferenceType.WebPage)){ |
426 | 382 |
createWebPageControls(this, reference, style); |
427 | 383 |
} |
428 |
|
|
429 | 384 |
} |
430 | 385 |
|
431 | 386 |
@Override |
... | ... | |
517 | 472 |
firePropertyChangeEvent(new CdmPropertyChangeEvent(this, null)); |
518 | 473 |
} |
519 | 474 |
|
520 |
|
|
521 | 475 |
@Override |
522 | 476 |
public void updateToggleableCacheField() { |
523 | 477 |
if (!getEntity().isProtectedTitleCache()) { |
... | ... | |
535 | 489 |
updateToggleableCacheField(); |
536 | 490 |
} |
537 | 491 |
|
538 |
/* |
|
539 |
* (non-Javadoc) |
|
540 |
* |
|
541 |
* @see |
|
542 |
* eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#handleException |
|
543 |
* (eu.etaxonomy.taxeditor.forms.CdmPropertyChangeEvent) |
|
544 |
*/ |
|
545 |
/** {@inheritDoc} */ |
|
546 | 492 |
@Override |
547 | 493 |
public void handleException(CdmPropertyChangeEvent event) { |
548 | 494 |
exceptionOccurred(event); |
549 | 495 |
} |
550 | 496 |
|
551 |
/* |
|
552 |
* (non-Javadoc) |
|
553 |
* |
|
554 |
* @see eu.etaxonomy.taxeditor.forms.IExceptionHandler#clearException() |
|
555 |
*/ |
|
556 |
/** {@inheritDoc} */ |
|
557 | 497 |
@Override |
558 | 498 |
public void clearException() { |
559 | 499 |
exceptionOccurred(null); |
... | ... | |
561 | 501 |
|
562 | 502 |
private final List<IExceptionHandler> exceptionHandlers = new ArrayList<IExceptionHandler>(); |
563 | 503 |
|
564 |
/* |
|
565 |
* (non-Javadoc) |
|
566 |
* |
|
567 |
* @see |
|
568 |
* eu.etaxonomy.taxeditor.forms.IErrorIntolerableElement#addExceptionHandler |
|
569 |
* (eu.etaxonomy.taxeditor.forms.IExceptionHandler) |
|
570 |
*/ |
|
571 |
/** {@inheritDoc} */ |
|
572 | 504 |
@Override |
573 | 505 |
public void addExceptionHandler(IExceptionHandler handler) { |
574 | 506 |
exceptionHandlers.add(handler); |
575 | 507 |
} |
576 | 508 |
|
577 |
/* |
|
578 |
* (non-Javadoc) |
|
579 |
* |
|
580 |
* @see |
|
581 |
* eu.etaxonomy.taxeditor.forms.IErrorIntolerableElement#removeExceptionHandler |
|
582 |
* (eu.etaxonomy.taxeditor.forms.IExceptionHandler) |
|
583 |
*/ |
|
584 |
/** {@inheritDoc} */ |
|
585 | 509 |
@Override |
586 | 510 |
public void removeExceptionHandler(IExceptionHandler handler) { |
587 | 511 |
exceptionHandlers.remove(handler); |
588 | 512 |
} |
589 | 513 |
|
590 |
/* |
|
591 |
* (non-Javadoc) |
|
592 |
* |
|
593 |
* @see |
|
594 |
* eu.etaxonomy.taxeditor.forms.IErrorIntolerableElement#exceptionOccurred |
|
595 |
* (eu.etaxonomy.taxeditor.forms.CdmPropertyChangeEvent) |
|
596 |
*/ |
|
597 |
/** {@inheritDoc} */ |
|
598 | 514 |
@Override |
599 | 515 |
public void exceptionOccurred(CdmPropertyChangeEvent event) { |
600 | 516 |
for (IExceptionHandler handler : exceptionHandlers) { |
... | ... | |
617 | 533 |
|
618 | 534 |
protected void setIrrelevantReferenceDetail(boolean abbrev){ |
619 | 535 |
|
620 |
List<Object> except = new ArrayList(); |
|
536 |
List<Object> except = new ArrayList<>();
|
|
621 | 537 |
|
622 | 538 |
except.addAll( Arrays.asList(new Object[] { toggleable_cache, toggleableAbbrevCache, text_editor, text_isbn, text_issn, text_organisation, text_pages, text_placePublished, text_publisher, text_referenceAbstract, text_uri, selection_institution})); |
623 |
boolean pushedState; |
|
539 |
|
|
624 | 540 |
if (abbrev){ |
625 | 541 |
except.add(text_title); |
626 | 542 |
} else{ |
627 | 543 |
except.add(text_abbrevTitle); |
628 | 544 |
} |
629 |
pushedState = toggleableAbbrevCache.getState() || toggleable_cache.getState(); |
|
630 | 545 |
|
631 | 546 |
switch( getEntity().getType()){ |
632 | 547 |
case Journal: |
... | ... | |
640 | 555 |
break; |
641 | 556 |
} |
642 | 557 |
|
558 |
boolean pushedState = toggleableAbbrevCache.getState() || toggleable_cache.getState(); |
|
643 | 559 |
setIrrelevant(pushedState, except); |
644 | 560 |
text_title.setIrrelevant(toggleable_cache.getState()); |
645 | 561 |
text_abbrevTitle.setIrrelevant(toggleableAbbrevCache.getState()); |
646 | 562 |
} |
647 |
|
|
648 |
|
|
649 |
|
|
650 |
|
|
651 |
} |
|
563 |
} |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/taxon/TaxonOfRelationshipElement.java | ||
---|---|---|
1 |
/** |
|
2 |
* Copyright (C) 2007 EDIT |
|
3 |
* European Distributed Institute of Taxonomy |
|
4 |
* http://www.e-taxonomy.eu |
|
5 |
* |
|
6 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
|
7 |
* See LICENSE.TXT at the top of this package for the full license terms. |
|
8 |
*/ |
|
1 | 9 |
package eu.etaxonomy.taxeditor.ui.section.taxon; |
2 | 10 |
|
3 | 11 |
import java.util.Arrays; |
... | ... | |
20 | 28 |
|
21 | 29 |
private SelectionArbitrator selectionArbitrator; |
22 | 30 |
|
23 |
|
|
24 |
|
|
25 |
|
|
26 | 31 |
private CheckboxElement checkbox_doubtful; |
27 | 32 |
|
28 |
|
|
29 | 33 |
public TaxonOfRelationshipElement(CdmFormFactory formFactory, ICdmFormElement formElement, int style ) { |
30 | 34 |
super(formFactory, formElement); |
31 | 35 |
} |
... | ... | |
39 | 43 |
updateToggleableCacheField(); |
40 | 44 |
} |
41 | 45 |
|
42 |
|
|
43 |
|
|
44 | 46 |
@Override |
45 | 47 |
public void updateToggleableCacheField() { |
46 |
|
|
47 |
if (toggleable_cache != null){ |
|
48 |
if (!getEntity().isProtectedTitleCache()) { |
|
49 |
toggleable_cache.setText(getEntity().generateTitle()); |
|
50 |
} |
|
51 |
} |
|
48 |
if (toggleable_cache != null){ |
|
49 |
if (!getEntity().isProtectedTitleCache()) { |
|
50 |
toggleable_cache.setText(getEntity().generateTitle()); |
|
51 |
} |
|
52 |
} |
|
52 | 53 |
} |
53 | 54 |
|
54 | 55 |
@Override |
55 | 56 |
public void refresh(){ |
56 | 57 |
updateContent(); |
57 | 58 |
updateToggleableCacheField(); |
58 |
}
|
|
59 |
} |
|
59 | 60 |
|
60 | 61 |
@Override |
61 | 62 |
protected void updateContent() { |
... | ... | |
64 | 65 |
setIrrelevant(toggleable_cache.getState(), |
65 | 66 |
Arrays.asList(new Object[] { toggleable_cache})); |
66 | 67 |
firePropertyChangeEvent(getEntity()); |
67 |
|
|
68 |
} |
|
69 |
|
|
70 |
|
|
68 |
} |
|
71 | 69 |
|
72 | 70 |
@Override |
73 | 71 |
protected void createControls(ICdmFormElement formElement, Taxon entity, int style) { |
... | ... | |
82 | 80 |
if(formFactory.getSelectionProvider() != null){ |
83 | 81 |
selectionArbitrator = formFactory.createSelectionArbitrator(this); |
84 | 82 |
} |
85 |
|
|
86 | 83 |
} |
87 | 84 |
|
88 |
|
|
89 |
|
|
90 | 85 |
@Override |
91 | 86 |
public void handleEvent(Object eventSource) { |
92 | 87 |
if (eventSource== toggleable_cache) { |
... | ... | |
94 | 89 |
} else if (eventSource == checkbox_doubtful) { |
95 | 90 |
getEntity().setDoubtful(checkbox_doubtful.getSelection()); |
96 | 91 |
} |
97 |
|
|
98 | 92 |
} |
99 | 93 |
|
100 | 94 |
@Override |
... | ... | |
114 | 108 |
getWarnForReferencedObjects().setLayout(LayoutConstants.FILL(2, 3)); |
115 | 109 |
getWarnForReferencedObjects().setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_RED)); |
116 | 110 |
formFactory.createLabel(formElement, ""); |
117 |
|
|
118 | 111 |
} |
119 | 112 |
} |
120 | 113 |
} |
121 | 114 |
} |
122 |
|
|
123 |
|
|
124 |
} |
|
115 |
} |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/user/UserDetailSection.java | ||
---|---|---|
1 | 1 |
/** |
2 |
* |
|
3 |
*/ |
|
2 |
* Copyright (C) 2013 EDIT |
|
3 |
* European Distributed Institute of Taxonomy |
|
4 |
* http://www.e-taxonomy.eu |
|
5 |
* |
|
6 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
|
7 |
* See LICENSE.TXT at the top of this package for the full license terms. |
|
8 |
*/ |
|
4 | 9 |
package eu.etaxonomy.taxeditor.ui.section.user; |
5 | 10 |
|
6 | 11 |
import java.util.List; |
... | ... | |
17 | 22 |
|
18 | 23 |
/** |
19 | 24 |
* @author n.hoffmann |
20 |
* |
|
21 | 25 |
*/ |
22 | 26 |
public class UserDetailSection extends AbstractCdmDetailSection<User> { |
23 | 27 |
|
... | ... | |
27 | 31 |
super(formFactory, conversation, parentElement, selectionProvider, style); |
28 | 32 |
} |
29 | 33 |
|
30 |
/* (non-Javadoc) |
|
31 |
* @see eu.etaxonomy.taxeditor.forms.ICdmFormElement#setPropertyChangeListeners(java.util.List) |
|
32 |
*/ |
|
33 | 34 |
@Override |
34 | 35 |
public void setPropertyChangeListeners( |
35 | 36 |
List<IPropertyChangeListener> propertyChangeListeners) { |
36 |
|
|
37 | 37 |
} |
38 | 38 |
|
39 |
/* (non-Javadoc) |
|
40 |
* @see eu.etaxonomy.taxeditor.section.AbstractCdmDetailSection#getHeading() |
|
41 |
*/ |
|
42 | 39 |
@Override |
43 | 40 |
public String getHeading() { |
44 | 41 |
return "User " + (getEntity() != null ? getEntity().getUsername() : ""); |
45 | 42 |
} |
46 | 43 |
|
47 |
/* (non-Javadoc) |
|
48 |
* @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection#createCdmDetailElement(eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection, int) |
|
49 |
*/ |
|
50 | 44 |
@Override |
51 | 45 |
protected AbstractCdmDetailElement<User> createCdmDetailElement(AbstractCdmDetailSection<User> parentElement, int style) { |
52 | 46 |
return formFactory.createUserDetailElement(parentElement); |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/selection/EntitySelectionElement.java | ||
---|---|---|
60 | 60 |
/** |
61 | 61 |
* @author n.hoffmann |
62 | 62 |
* @created Nov 17, 2009 |
63 |
* @param <T> |
|
64 | 63 |
*/ |
65 | 64 |
public class EntitySelectionElement<T extends CdmBase> extends |
66 | 65 |
AbstractCdmFormElement implements SelectionListener, IEnableableFormElement, ISelectableElement, IEntityElement<T>, ILabeledElement, //IConversationEnabled, |
... | ... | |
104 | 103 |
private final boolean isDeletable; |
105 | 104 |
private final boolean isExternal; |
106 | 105 |
|
107 |
// private final ConversationHolder conversation; |
|
108 | 106 |
private Class<T> clazz; |
109 | 107 |
|
110 | 108 |
public EntitySelectionElement(CdmFormFactory formFactory, |
111 |
// ConversationHolder conversation, |
|
112 | 109 |
ICdmFormElement parentElement, Class<T> clazz, |
113 | 110 |
String labelString, T entity, int mode, int style, boolean filterElement){ |
114 | 111 |
this(formFactory, parentElement, clazz, labelString, entity, mode, style, filterElement, null); |
115 | 112 |
} |
116 | 113 |
|
117 |
|
|
118 | 114 |
public EntitySelectionElement(CdmFormFactory formFactory, |
119 |
// ConversationHolder conversation, |
|
120 | 115 |
ICdmFormElement parentElement, Class<T> clazz, |
121 | 116 |
String labelString, T entity, int mode, int style, boolean filterElement, Integer limit) { |
122 | 117 |
super(formFactory, parentElement); |
... | ... | |
129 | 124 |
|
130 | 125 |
this.labelString = (labelString == null || labelString.equals("")) ? "" : labelString; |
131 | 126 |
|
132 |
// this.conversation = conversation; |
|
133 |
|
|
134 | 127 |
if (isSelectable && formFactory.getSelectionProvider() != null) { |
135 | 128 |
selectionArbitrator = formFactory.createSelectionArbitrator(this); |
136 | 129 |
} |
... | ... | |
145 | 138 |
|
146 | 139 |
private void setFilteredEntity(T filterEntity) { |
147 | 140 |
this.filteredEntity =filterEntity; |
148 |
|
|
149 | 141 |
} |
150 | 142 |
|
151 |
public EntitySelectionElement(CdmFormFactory formFactory,//ConversationHolder conversation,
|
|
143 |
public EntitySelectionElement(CdmFormFactory formFactory, |
|
152 | 144 |
ICdmFormElement parentElement, Class<T> clazz, |
153 | 145 |
String labelString, T entity, int mode, int style){ |
154 |
this(formFactory, //conversation,
|
|
146 |
this(formFactory, |
|
155 | 147 |
parentElement, clazz, labelString, entity, mode, style, false); |
156 | 148 |
} |
157 | 149 |
|
158 |
public EntitySelectionElement(CdmFormFactory formFactory,//ConversationHolder conversation,
|
|
150 |
public EntitySelectionElement(CdmFormFactory formFactory, |
|
159 | 151 |
ICdmFormElement parentElement, Class<T> clazz, |
160 | 152 |
String labelString, T entity, int mode, int style, Integer limit){ |
161 |
this(formFactory, //conversation,
|
|
153 |
this(formFactory, |
|
162 | 154 |
parentElement, clazz, labelString, entity, mode, style, false, limit); |
163 |
} |
|
155 |
}
|
|
164 | 156 |
|
165 | 157 |
private void createControls(Composite parent, int style, Integer limit) { |
166 | 158 |
|
... | ... | |
254 | 246 |
|
255 | 247 |
} |
256 | 248 |
|
257 |
/** |
|
258 |
* @return |
|
259 |
*/ |
|
260 | 249 |
public T getFilteredEntity() { |
261 | 250 |
|
262 | 251 |
return this.filteredEntity; |
... | ... | |
264 | 253 |
|
265 | 254 |
/** |
266 | 255 |
* Return the selected object |
267 |
* |
|
268 |
* @return a T object. |
|
269 | 256 |
*/ |
270 | 257 |
public T getSelection() { |
271 | 258 |
return entity; |
272 | 259 |
} |
273 | 260 |
|
274 |
/* |
|
275 |
* (non-Javadoc) |
|
276 |
* |
|
277 |
* @see |
|
278 |
* eu.etaxonomy.taxeditor.forms.IEnableableFormElement#setEnabled(boolean) |
|
279 |
*/ |
|
280 |
/** {@inheritDoc} */ |
|
281 | 261 |
@Override |
282 | 262 |
public void setEnabled(boolean enabled) { |
283 | 263 |
|
... | ... | |
291 | 271 |
|
292 | 272 |
} |
293 | 273 |
|
294 |
/* (non-Javadoc) |
|
295 |
* @see eu.etaxonomy.taxeditor.ui.element.IEnableableFormElement#isEnabled() |
|
296 |
*/ |
|
297 | 274 |
@Override |
298 | 275 |
public boolean isEnabled() { |
299 | 276 |
return button_selection.isEnabled(); |
300 | 277 |
} |
301 | 278 |
|
302 | 279 |
/** |
303 |
* <p> |
|
304 | 280 |
* setSelectionInternal |
305 |
* </p> |
|
306 |
* |
|
307 |
* @param selection |
|
308 |
* a T object. |
|
309 | 281 |
*/ |
310 | 282 |
protected void setSelectionInternal(T selection) { |
311 | 283 |
if (selection != null && !selection.equals(this.entity)) { |
... | ... | |
315 | 287 |
} |
316 | 288 |
|
317 | 289 |
/** |
318 |
* <p> |
|
319 | 290 |
* Setter for the field <code>entity</code>. |
320 |
* </p> |
|
321 |
* |
|
322 |
* @param selection |
|
323 |
* a T object. |
|
324 | 291 |
*/ |
325 | 292 |
public void setEntity(T selection) { |
326 | 293 |
this.entity = selection; |
... | ... | |
345 | 312 |
} |
346 | 313 |
|
347 | 314 |
/** |
348 |
* <p> |
|
349 | 315 |
* getTitle |
350 |
* </p> |
|
351 |
* |
|
352 |
* @return a {@link java.lang.String} object. |
|
353 | 316 |
*/ |
354 | 317 |
protected String getTitle() { |
355 | 318 |
if (entity != null){ |
... | ... | |
372 | 335 |
return ""; |
373 | 336 |
} |
374 | 337 |
|
375 |
/** {@inheritDoc} */ |
|
376 | 338 |
@Override |
377 | 339 |
public void setSelected(boolean selected) { |
Also available in: Unified diff
cleanup