Revision 3be6ef3e
Added by Niels Hoffmann over 13 years ago
taxeditor-editor/src/main/java/eu/etaxonomy/taxeditor/forms/selection/AbstractSelectionElement.java | ||
---|---|---|
33 | 33 |
import eu.etaxonomy.taxeditor.preference.Resources; |
34 | 34 |
|
35 | 35 |
/** |
36 |
* |
|
36 |
* <p>Abstract AbstractSelectionElement class.</p> |
|
37 |
* |
|
37 | 38 |
* @author n.hoffmann |
38 | 39 |
* @created Nov 17, 2009 |
39 | 40 |
* @version 1.0 |
... | ... | |
66 | 67 |
private ConversationHolder conversation; |
67 | 68 |
|
68 | 69 |
/** |
69 |
* |
|
70 |
* @param formFactory |
|
70 |
* <p>Constructor for AbstractSelectionElement.</p> |
|
71 |
* |
|
72 |
* @param formFactory a {@link eu.etaxonomy.taxeditor.forms.CdmFormFactory} object. |
|
71 | 73 |
* @param conversation TODO |
72 |
* @param parentElement |
|
73 |
* @param labelString |
|
74 |
* @param entity |
|
75 |
* @param isEditable |
|
76 |
* @param isSelectable |
|
77 |
* @param isDeletable |
|
78 |
* @param style |
|
74 |
* @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object. |
|
75 |
* @param labelString a {@link java.lang.String} object. |
|
76 |
* @param entity a T object. |
|
77 |
* @param isEditable a boolean. |
|
78 |
* @param isSelectable a boolean. |
|
79 |
* @param isDeletable a boolean. |
|
80 |
* @param style a int. |
|
81 |
* @param <T> a T object. |
|
79 | 82 |
*/ |
80 | 83 |
public AbstractSelectionElement( |
81 | 84 |
CdmFormFactory formFactory, |
... | ... | |
151 | 154 |
|
152 | 155 |
/** |
153 | 156 |
* Return the selected object |
154 |
*
|
|
155 |
* @return |
|
157 |
* |
|
158 |
* @return a T object.
|
|
156 | 159 |
*/ |
157 | 160 |
public T getSelection(){ |
158 | 161 |
return entity; |
... | ... | |
162 | 165 |
* (non-Javadoc) |
163 | 166 |
* @see eu.etaxonomy.taxeditor.forms.IEnableableFormElement#setEnabled(boolean) |
164 | 167 |
*/ |
168 |
/** {@inheritDoc} */ |
|
165 | 169 |
public void setEnabled(boolean enabled) { |
166 | 170 |
button_selection.setEnabled(enabled); |
167 | 171 |
if(isEditable){ |
... | ... | |
170 | 174 |
} |
171 | 175 |
|
172 | 176 |
/** |
173 |
* |
|
174 |
* @param selection |
|
177 |
* <p>setSelectionInternal</p> |
|
178 |
* |
|
179 |
* @param selection a T object. |
|
175 | 180 |
*/ |
176 | 181 |
protected void setSelectionInternal(T selection){ |
177 | 182 |
if(selection != null && !selection.equals(this.entity)){ |
... | ... | |
181 | 186 |
} |
182 | 187 |
|
183 | 188 |
/** |
184 |
* |
|
185 |
* @param selection |
|
189 |
* <p>Setter for the field <code>entity</code>.</p> |
|
190 |
* |
|
191 |
* @param selection a T object. |
|
186 | 192 |
*/ |
187 | 193 |
public void setEntity(T selection){ |
188 | 194 |
this.entity = selection; |
... | ... | |
210 | 216 |
} |
211 | 217 |
} |
212 | 218 |
|
219 |
/** |
|
220 |
* <p>updateFromWizard</p> |
|
221 |
*/ |
|
213 | 222 |
protected void updateFromWizard(){ |
214 | 223 |
updateElement(); |
215 | 224 |
firePropertyChangeEvent(new CdmPropertyChangeEvent(this, null)); |
216 | 225 |
} |
217 | 226 |
|
227 |
/** |
|
228 |
* <p>getTitle</p> |
|
229 |
* |
|
230 |
* @return a {@link java.lang.String} object. |
|
231 |
*/ |
|
218 | 232 |
protected String getTitle(){ |
219 | 233 |
if (entity != null && entity instanceof IIdentifiableEntity) { |
220 | 234 |
return ((IIdentifiableEntity) entity).getTitleCache(); |
... | ... | |
222 | 236 |
return ""; |
223 | 237 |
} |
224 | 238 |
|
225 |
/** |
|
226 |
* |
|
227 |
* @param selected |
|
228 |
*/ |
|
239 |
/** {@inheritDoc} */ |
|
229 | 240 |
public void setSelected(boolean selected) { |
230 | 241 |
Color color = getColor(selected); |
231 | 242 |
getLayoutComposite().setBackground(color); |
... | ... | |
236 | 247 |
/* (non-Javadoc) |
237 | 248 |
* @see eu.etaxonomy.taxeditor.forms.IEntityElement#getEntity() |
238 | 249 |
*/ |
250 |
/** |
|
251 |
* <p>Getter for the field <code>entity</code>.</p> |
|
252 |
* |
|
253 |
* @return a T object. |
|
254 |
*/ |
|
239 | 255 |
public T getEntity() { |
240 | 256 |
return entity; |
241 | 257 |
} |
... | ... | |
243 | 259 |
/* (non-Javadoc) |
244 | 260 |
* @see eu.etaxonomy.taxeditor.forms.section.cdmdetail.ISelectableElement#getSelectionArbitrator() |
245 | 261 |
*/ |
262 |
/** |
|
263 |
* <p>Getter for the field <code>selectionArbitrator</code>.</p> |
|
264 |
* |
|
265 |
* @return a {@link eu.etaxonomy.taxeditor.forms.SelectionArbitrator} object. |
|
266 |
*/ |
|
246 | 267 |
public SelectionArbitrator getSelectionArbitrator() { |
247 | 268 |
return selectionArbitrator; |
248 | 269 |
} |
249 | 270 |
|
250 | 271 |
/** |
251 | 272 |
* Convenient access to current shell |
252 |
* @return |
|
273 |
* |
|
274 |
* @return a {@link org.eclipse.swt.widgets.Shell} object. |
|
253 | 275 |
*/ |
254 | 276 |
protected Shell getShell(){ |
255 | 277 |
return getLayoutComposite().getShell(); |
256 | 278 |
} |
257 | 279 |
|
280 |
/** {@inheritDoc} */ |
|
258 | 281 |
public void setIrrelevant(boolean irrelevant) { |
259 | 282 |
String colorId = irrelevant ? Resources.COLOR_COMPOSITE_IRRELEVANT : Resources.COLOR_TEXT_DISABLED_BACKGROUND; |
260 | 283 |
|
... | ... | |
278 | 301 |
} |
279 | 302 |
|
280 | 303 |
// not used |
304 |
/** {@inheritDoc} */ |
|
281 | 305 |
public void widgetDefaultSelected(SelectionEvent e) {} |
282 | 306 |
|
307 |
/** |
|
308 |
* <p>getConversationHolder</p> |
|
309 |
* |
|
310 |
* @return a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object. |
|
311 |
*/ |
|
283 | 312 |
public ConversationHolder getConversationHolder() { |
284 | 313 |
return conversation; |
285 | 314 |
} |
286 | 315 |
|
316 |
/** {@inheritDoc} */ |
|
287 | 317 |
@Override |
288 | 318 |
public void setBackground(Color color) { |
289 | 319 |
label.setBackground(color); |
290 | 320 |
} |
291 | 321 |
|
322 |
/** {@inheritDoc} */ |
|
292 | 323 |
public void setLabel(String labelString){ |
293 | 324 |
if(label != null){ |
294 | 325 |
label.setText(labelString); |
295 | 326 |
} |
296 | 327 |
} |
297 | 328 |
|
329 |
/** |
|
330 |
* <p>Getter for the field <code>label</code>.</p> |
|
331 |
* |
|
332 |
* @return a {@link java.lang.String} object. |
|
333 |
*/ |
|
298 | 334 |
public String getLabel(){ |
299 | 335 |
if(label != null){ |
300 | 336 |
return label.getText(); |
... | ... | |
302 | 338 |
return null; |
303 | 339 |
} |
304 | 340 |
|
341 |
/** {@inheritDoc} */ |
|
305 | 342 |
public void update(CdmDataChangeMap changeEvents) {} |
306 | 343 |
} |
Also available in: Unified diff
performed javacscript:fix and worked on documentation