Revision 3be6ef3e
Added by Niels Hoffmann over 13 years ago
taxeditor-editor/src/main/java/eu/etaxonomy/taxeditor/forms/AbstractFormSection.java | ||
---|---|---|
33 | 33 |
import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap; |
34 | 34 |
|
35 | 35 |
/** |
36 |
* |
|
36 |
* <p>Abstract AbstractFormSection class.</p> |
|
37 |
* |
|
37 | 38 |
* @author n.hoffmann |
38 | 39 |
* @created Feb 22, 2010 |
39 | 40 |
* @version 1.0 |
... | ... | |
56 | 57 |
private ConversationHolder conversation; |
57 | 58 |
|
58 | 59 |
/** |
60 |
* <p>Constructor for AbstractFormSection.</p> |
|
61 |
* |
|
59 | 62 |
* @param conversation TODO |
60 |
* @param style |
|
61 |
* @param parent |
|
63 |
* @param style a int. |
|
64 |
* @param formFactory a {@link eu.etaxonomy.taxeditor.forms.CdmFormFactory} object. |
|
65 |
* @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object. |
|
66 |
* @param <ENTITY> a ENTITY object. |
|
62 | 67 |
*/ |
63 | 68 |
protected AbstractFormSection(CdmFormFactory formFactory, ConversationHolder conversation, ICdmFormElement parentElement, int style) { |
64 | 69 |
super(parentElement.getLayoutComposite(), style); |
... | ... | |
83 | 88 |
this.setClient(client); |
84 | 89 |
} |
85 | 90 |
|
91 |
/** |
|
92 |
* <p>Constructor for AbstractFormSection.</p> |
|
93 |
* |
|
94 |
* @param formFactory a {@link eu.etaxonomy.taxeditor.forms.CdmFormFactory} object. |
|
95 |
* @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object. |
|
96 |
* @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object. |
|
97 |
* @param selectionProvider a {@link org.eclipse.jface.viewers.ISelectionProvider} object. |
|
98 |
* @param style a int. |
|
99 |
*/ |
|
86 | 100 |
protected AbstractFormSection(CdmFormFactory formFactory, ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){ |
87 | 101 |
this(formFactory, conversation, parentElement, style); |
88 | 102 |
this.selectionProvider = selectionProvider; |
89 | 103 |
} |
90 | 104 |
|
105 |
/** |
|
106 |
* <p>Getter for the field <code>propertyChangeListeners</code>.</p> |
|
107 |
* |
|
108 |
* @return a {@link java.util.Set} object. |
|
109 |
*/ |
|
91 | 110 |
public Set<IPropertyChangeListener> getPropertyChangeListeners() { |
92 | 111 |
return propertyChangeListeners; |
93 | 112 |
} |
94 | 113 |
|
114 |
/** {@inheritDoc} */ |
|
95 | 115 |
public void setPropertyChangeListeners( |
96 | 116 |
Set<IPropertyChangeListener> propertyChangeListeners) { |
97 | 117 |
this.propertyChangeListeners = propertyChangeListeners; |
98 | 118 |
} |
99 | 119 |
|
100 | 120 |
/** |
101 |
* |
|
102 |
* @param entity |
|
121 |
* <p>Setter for the field <code>entity</code>.</p> |
|
122 |
* |
|
123 |
* @param entity a ENTITY object. |
|
103 | 124 |
*/ |
104 | 125 |
public void setEntity(ENTITY entity){ |
105 | 126 |
this.entity = entity; |
... | ... | |
109 | 130 |
* (non-Javadoc) |
110 | 131 |
* @see eu.etaxonomy.taxeditor.forms.IEntityElement#getEntity() |
111 | 132 |
*/ |
133 |
/** |
|
134 |
* <p>Getter for the field <code>entity</code>.</p> |
|
135 |
* |
|
136 |
* @return a ENTITY object. |
|
137 |
*/ |
|
112 | 138 |
public ENTITY getEntity() { |
113 | 139 |
return entity; |
114 | 140 |
} |
115 | 141 |
|
142 |
/** |
|
143 |
* <p>getToggle</p> |
|
144 |
* |
|
145 |
* @return a {@link org.eclipse.ui.forms.widgets.ToggleHyperlink} object. |
|
146 |
*/ |
|
116 | 147 |
public ToggleHyperlink getToggle(){ |
117 | 148 |
return this.toggle; |
118 | 149 |
} |
119 | 150 |
|
151 |
/** |
|
152 |
* <p>getSection</p> |
|
153 |
* |
|
154 |
* @return a {@link eu.etaxonomy.taxeditor.forms.AbstractFormSection} object. |
|
155 |
*/ |
|
120 | 156 |
public AbstractFormSection getSection(){ |
121 | 157 |
return this; |
122 | 158 |
} |
... | ... | |
124 | 160 |
/* (non-Javadoc) |
125 | 161 |
* @see eu.etaxonomy.taxeditor.forms.IPropertyChangeEmitter#firePropertyChangeEvent() |
126 | 162 |
*/ |
163 |
/** {@inheritDoc} */ |
|
127 | 164 |
public void firePropertyChangeEvent(CdmPropertyChangeEvent event) { |
128 | 165 |
Assert.isNotNull(propertyChangeListeners, "No property change listeners."); |
129 | 166 |
for(Object listener : propertyChangeListeners){ |
... | ... | |
134 | 171 |
/* (non-Javadoc) |
135 | 172 |
* @see org.eclipse.swt.widgets.Composite#setFocus() |
136 | 173 |
*/ |
174 |
/** {@inheritDoc} */ |
|
137 | 175 |
@Override |
138 | 176 |
public boolean setFocus() { |
139 | 177 |
return getClient().setFocus(); |
... | ... | |
142 | 180 |
/* (non-Javadoc) |
143 | 181 |
* @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent) |
144 | 182 |
*/ |
183 |
/** {@inheritDoc} */ |
|
145 | 184 |
public void propertyChange(PropertyChangeEvent event) { |
146 | 185 |
firePropertyChangeEvent(new CdmPropertyChangeEvent(this, event)); |
147 | 186 |
} |
... | ... | |
149 | 188 |
/* (non-Javadoc) |
150 | 189 |
* @see org.eclipse.swt.widgets.Control#setBackground(org.eclipse.swt.graphics.Color) |
151 | 190 |
*/ |
191 |
/** {@inheritDoc} */ |
|
152 | 192 |
@Override |
153 | 193 |
public void setBackground(Color color) { |
154 | 194 |
for(ICdmFormElement element : getElements()){ |
... | ... | |
158 | 198 |
super.setBackground(color); |
159 | 199 |
} |
160 | 200 |
|
201 |
/** |
|
202 |
* <p>widgetSelected</p> |
|
203 |
* |
|
204 |
* @param e a {@link org.eclipse.swt.events.SelectionEvent} object. |
|
205 |
*/ |
|
161 | 206 |
public void widgetSelected(SelectionEvent e) { |
162 | 207 |
Widget widget = e.widget; |
163 | 208 |
|
... | ... | |
187 | 232 |
} |
188 | 233 |
} |
189 | 234 |
|
190 |
/** |
|
191 |
* @param b |
|
192 |
*/ |
|
235 |
/** {@inheritDoc} */ |
|
193 | 236 |
public void setSelected(boolean selected) { |
194 | 237 |
if(selected){ |
195 | 238 |
setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_LIST_SELECTION)); |
... | ... | |
199 | 242 |
} |
200 | 243 |
|
201 | 244 |
|
245 |
/** {@inheritDoc} */ |
|
202 | 246 |
public void selectionChanged(SelectionChangedEvent event) { |
203 | 247 |
if(event.getSelection() == formFactory.EMPTY_SELECTION){ |
204 | 248 |
return; |
... | ... | |
215 | 259 |
} |
216 | 260 |
|
217 | 261 |
/** |
218 |
* |
|
219 |
* @param listener |
|
262 |
* <p>addSelectionListener</p> |
|
263 |
* |
|
264 |
* @param listener a {@link org.eclipse.swt.events.SelectionListener} object. |
|
220 | 265 |
*/ |
221 | 266 |
public void addSelectionListener(SelectionListener listener) { |
222 | 267 |
addListener(SWT.Selection, new TypedListener(listener)); |
223 | 268 |
} |
224 | 269 |
|
225 | 270 |
/** |
226 |
* |
|
227 |
* @param listener |
|
271 |
* <p>removeSelectionListener</p> |
|
272 |
* |
|
273 |
* @param listener a {@link org.eclipse.swt.events.SelectionListener} object. |
|
228 | 274 |
*/ |
229 | 275 |
public void removeSelectionListener(SelectionListener listener) { |
230 | 276 |
removeListener(SWT.Selection, listener); |
231 | 277 |
} |
232 | 278 |
|
279 |
/** {@inheritDoc} */ |
|
233 | 280 |
public Color getColor(boolean selected) { |
234 | 281 |
return selected ? SELECTED : NOT_SELECTED; |
235 | 282 |
} |
236 | 283 |
|
284 |
/** {@inheritDoc} */ |
|
237 | 285 |
public void addElement(ICdmFormElement element){ |
238 | 286 |
elements.add(element); |
239 | 287 |
} |
240 | 288 |
|
289 |
/** |
|
290 |
* <p>removeElement</p> |
|
291 |
* |
|
292 |
* @param element a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object. |
|
293 |
*/ |
|
241 | 294 |
protected void removeElement(ICdmFormElement element){ |
242 | 295 |
elements.remove(element); |
243 | 296 |
} |
244 | 297 |
|
298 |
/** |
|
299 |
* <p>removeElements</p> |
|
300 |
*/ |
|
245 | 301 |
public void removeElements() { |
246 | 302 |
for(ICdmFormElement childElement : getElements()){ |
247 | 303 |
// recursion |
... | ... | |
274 | 330 |
elements.clear(); |
275 | 331 |
} |
276 | 332 |
|
333 |
/** |
|
334 |
* <p>Getter for the field <code>parentElement</code>.</p> |
|
335 |
* |
|
336 |
* @return a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object. |
|
337 |
*/ |
|
277 | 338 |
public ICdmFormElement getParentElement() { |
278 | 339 |
return parentElement; |
279 | 340 |
} |
280 | 341 |
|
342 |
/** |
|
343 |
* <p>Getter for the field <code>elements</code>.</p> |
|
344 |
* |
|
345 |
* @return a {@link java.util.Set} object. |
|
346 |
*/ |
|
281 | 347 |
public Set<ICdmFormElement> getElements() { |
282 | 348 |
return elements; |
283 | 349 |
} |
284 | 350 |
|
351 |
/** |
|
352 |
* <p>getControls</p> |
|
353 |
* |
|
354 |
* @return a {@link java.util.Set} object. |
|
355 |
*/ |
|
285 | 356 |
public Set<Control> getControls() { |
286 | 357 |
Set<Control> controls = new HashSet<Control>(); |
287 | 358 |
|
... | ... | |
292 | 363 |
return controls; |
293 | 364 |
} |
294 | 365 |
|
366 |
/** {@inheritDoc} */ |
|
295 | 367 |
@Override |
296 | 368 |
public void dispose() { |
297 | 369 |
removeElements(); |
298 | 370 |
super.dispose(); |
299 | 371 |
} |
300 | 372 |
|
373 |
/** |
|
374 |
* <p>getLayoutComposite</p> |
|
375 |
* |
|
376 |
* @return a {@link org.eclipse.swt.widgets.Composite} object. |
|
377 |
*/ |
|
301 | 378 |
public Composite getLayoutComposite() { |
302 | 379 |
return (Composite) getClient(); |
303 | 380 |
} |
304 | 381 |
|
382 |
/** {@inheritDoc} */ |
|
305 | 383 |
public boolean containsFormElement(ICdmFormElement formElement){ |
306 | 384 |
if(formElement == this){ |
307 | 385 |
return true; |
... | ... | |
317 | 395 |
} |
318 | 396 |
|
319 | 397 |
|
398 |
/** |
|
399 |
* <p>Getter for the field <code>formFactory</code>.</p> |
|
400 |
* |
|
401 |
* @return a {@link eu.etaxonomy.taxeditor.forms.CdmFormFactory} object. |
|
402 |
*/ |
|
320 | 403 |
public CdmFormFactory getFormFactory() { |
321 | 404 |
return formFactory; |
322 | 405 |
} |
... | ... | |
325 | 408 |
* (non-Javadoc) |
326 | 409 |
* @see eu.etaxonomy.taxeditor.forms.ICdmFormElement#refresh() |
327 | 410 |
*/ |
411 |
/** |
|
412 |
* <p>refresh</p> |
|
413 |
*/ |
|
328 | 414 |
public void refresh() { |
329 | 415 |
// empty default implementation |
330 | 416 |
|
331 | 417 |
} |
332 | 418 |
|
419 |
/** |
|
420 |
* <p>getConversationHolder</p> |
|
421 |
* |
|
422 |
* @return a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object. |
|
423 |
*/ |
|
333 | 424 |
public ConversationHolder getConversationHolder() { |
334 | 425 |
return conversation; |
335 | 426 |
} |
336 | 427 |
|
428 |
/** {@inheritDoc} */ |
|
337 | 429 |
public void update(CdmDataChangeMap changeEvents) {} |
338 | 430 |
} |
Also available in: Unified diff
performed javacscript:fix and worked on documentation