Revision b50ab815
Added by Patrick Plitzner over 10 years ago
- converted Browse, Edit, Delete functionality of EntitySelection
- adapted layout of detail elements to fill up the horizontal space
.gitattributes | ||
---|---|---|
1336 | 1336 |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/campanula/TextFieldController.java -text |
1337 | 1337 |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/campanula/ToggleableTextField.java -text |
1338 | 1338 |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/campanula/ToggleableTextFieldController.java -text |
1339 |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/campanula/compatibility/IEntitySelectionElement.java -text |
|
1339 | 1340 |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/classification/ClassificationDetailElement.java -text |
1340 | 1341 |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/classification/ClassificationDetailSection.java -text |
1341 | 1342 |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/classification/ClassificationWizardPage.java -text |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/AbstractCdmFormElement.java | ||
---|---|---|
63 | 63 |
// addControl(layoutComposite); |
64 | 64 |
} |
65 | 65 |
|
66 |
/** |
|
67 |
* <p>Getter for the field <code>formFactory</code>.</p> |
|
68 |
* |
|
69 |
* @return a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object. |
|
70 |
*/ |
|
71 |
public CdmFormFactory getFormFactory() { |
|
66 |
@Override |
|
67 |
public CdmFormFactory getFormFactory() { |
|
72 | 68 |
return formFactory; |
73 | 69 |
} |
74 | 70 |
|
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/CdmFormFactory.java | ||
---|---|---|
1563 | 1563 |
return section; |
1564 | 1564 |
} |
1565 | 1565 |
|
1566 |
public GeneralDetailSection createFOSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){ |
|
1567 |
GeneralDetailSection section = new GeneralDetailSection(this, conversation, parentElement, selectionProvider, style); |
|
1568 |
addAndAdaptSection(parentElement, section); |
|
1569 |
return section; |
|
1570 |
} |
|
1571 |
|
|
1572 |
public GatheringEventDetailSection createGatheringSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){ |
|
1573 |
GatheringEventDetailSection section = new GatheringEventDetailSection(this, conversation, parentElement, selectionProvider, style); |
|
1574 |
addAndAdaptSection(parentElement, section); |
|
1575 |
return section; |
|
1576 |
} |
|
1577 |
|
|
1578 |
public FieldObservationDetailSection createFODetailsSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){ |
|
1579 |
FieldObservationDetailSection section = new FieldObservationDetailSection(this, conversation, parentElement, selectionProvider, style); |
|
1580 |
addAndAdaptSection(parentElement, section); |
|
1581 |
return section; |
|
1582 |
} |
|
1583 |
|
|
1584 | 1566 |
private void addAndAdaptSection(ICdmFormElement parentElement, AbstractFormSection<?> section) { |
1585 | 1567 |
parentElement.addElement(section); |
1586 | 1568 |
adapt(section); |
... | ... | |
1770 | 1752 |
} |
1771 | 1753 |
|
1772 | 1754 |
public FieldObservationGeneralElementController createFieldObservationGeneralElement(ICdmFormElement parentElement){ |
1773 |
FieldObservationGeneralElementController element = new FieldObservationGeneralElementController(new FieldObservationGeneralElement(parentElement.getLayoutComposite(), SWT.NONE), this, parentElement); |
|
1755 |
FieldObservationGeneralElement fieldObservationGeneralElement = new FieldObservationGeneralElement(parentElement.getLayoutComposite(), SWT.NONE); |
|
1756 |
fieldObservationGeneralElement.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2,1)); |
|
1757 |
FieldObservationGeneralElementController element = new FieldObservationGeneralElementController(fieldObservationGeneralElement, this, parentElement); |
|
1774 | 1758 |
addAndAdaptElement(parentElement, element); |
1775 | 1759 |
return element; |
1776 | 1760 |
} |
... | ... | |
1782 | 1766 |
} |
1783 | 1767 |
|
1784 | 1768 |
public GatheringEventDetailsElementController createGatheringEventDetailsElementController(ICdmFormElement parentElement) { |
1785 |
GatheringEventDetailsElementController element = new GatheringEventDetailsElementController(new GatheringEventDetailsElement(parentElement.getLayoutComposite(), SWT.NONE), this, parentElement); |
|
1769 |
GatheringEventDetailsElement gatheringEventDetailsElement = new GatheringEventDetailsElement(parentElement.getLayoutComposite(), SWT.NONE); |
|
1770 |
gatheringEventDetailsElement.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2,1)); |
|
1771 |
GatheringEventDetailsElementController element = new GatheringEventDetailsElementController(gatheringEventDetailsElement, this, parentElement); |
|
1786 | 1772 |
adapt(element); |
1787 | 1773 |
parentElement.addElement(element); |
1788 | 1774 |
return element; |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/ICdmFormElement.java | ||
---|---|---|
31 | 31 |
*/ |
32 | 32 |
public abstract void setPropertyChangeListeners( |
33 | 33 |
List<IPropertyChangeListener> propertyChangeListeners); |
34 |
|
|
34 |
|
|
35 | 35 |
/** |
36 | 36 |
* <p>getControls</p> |
37 | 37 |
* |
38 | 38 |
* @return a {@link java.util.Set} object. |
39 | 39 |
*/ |
40 | 40 |
public abstract Set<Control> getControls(); |
41 |
|
|
41 |
|
|
42 | 42 |
/** |
43 | 43 |
* <p>getElements</p> |
44 | 44 |
* |
45 | 45 |
* @return a {@link java.util.Set} object. |
46 | 46 |
*/ |
47 | 47 |
public abstract Set<ICdmFormElement> getElements(); |
48 |
|
|
48 |
|
|
49 | 49 |
/** |
50 | 50 |
* <p>addElement</p> |
51 | 51 |
* |
52 | 52 |
* @param element a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object. |
53 | 53 |
*/ |
54 | 54 |
public abstract void addElement(ICdmFormElement element); |
55 |
|
|
55 |
|
|
56 | 56 |
/** |
57 | 57 |
* <p>getParentElement</p> |
58 | 58 |
* |
59 | 59 |
* @return a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object. |
60 | 60 |
*/ |
61 | 61 |
public abstract ICdmFormElement getParentElement(); |
62 |
|
|
62 |
|
|
63 | 63 |
/** |
64 | 64 |
* <p>removeElements</p> |
65 | 65 |
*/ |
66 | 66 |
public abstract void removeElements(); |
67 |
|
|
67 |
|
|
68 | 68 |
/** |
69 | 69 |
* <p>getLayoutComposite</p> |
70 | 70 |
* |
71 | 71 |
* @return a {@link org.eclipse.swt.widgets.Composite} object. |
72 | 72 |
*/ |
73 | 73 |
public abstract Composite getLayoutComposite(); |
74 |
|
|
74 |
|
|
75 | 75 |
/** |
76 | 76 |
* <p>containsFormElement</p> |
77 | 77 |
* |
... | ... | |
79 | 79 |
* @return a boolean. |
80 | 80 |
*/ |
81 | 81 |
public boolean containsFormElement(ICdmFormElement formElement); |
82 |
|
|
82 |
|
|
83 | 83 |
/** |
84 | 84 |
* <p>setBackground</p> |
85 | 85 |
* |
86 | 86 |
* @param color a {@link org.eclipse.swt.graphics.Color} object. |
87 | 87 |
*/ |
88 | 88 |
public void setBackground(Color color); |
89 |
|
|
89 |
|
|
90 | 90 |
/** |
91 | 91 |
* Sets a background color for this element and stores this background color |
92 | 92 |
* for future reference |
93 |
*
|
|
93 |
* |
|
94 | 94 |
* @param color |
95 | 95 |
*/ |
96 | 96 |
public void setPersistentBackground(Color color); |
97 |
|
|
97 |
|
|
98 | 98 |
/** |
99 | 99 |
* Get the background color that is associated with this element. |
100 |
*
|
|
100 |
* |
|
101 | 101 |
* @return |
102 | 102 |
*/ |
103 | 103 |
public Color getPersistentBackground(); |
104 |
|
|
104 |
|
|
105 | 105 |
/** |
106 | 106 |
* Refreshes the layout of this form element. |
107 | 107 |
* |
... | ... | |
109 | 109 |
* changes and the current element needs to display that changes |
110 | 110 |
*/ |
111 | 111 |
public void refresh(); |
112 |
|
|
113 |
/** |
|
114 |
* <p>Getter for the field <code>formFactory</code>.</p> |
|
115 |
* |
|
116 |
* @return a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object. |
|
117 |
*/ |
|
118 |
public CdmFormFactory getFormFactory(); |
|
112 | 119 |
} |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/campanula/EntitySelectionField.java | ||
---|---|---|
50 | 50 |
setLayout(tableWrapLayout); |
51 | 51 |
} |
52 | 52 |
|
53 |
text = formToolkit.createLabel(this, "", SWT.NONE); |
|
54 |
text.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1)); |
|
53 |
text = formToolkit.createLabel(this, "", SWT.WRAP); |
|
54 |
TableWrapData twd_text = new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1); |
|
55 |
twd_text.align = TableWrapData.LEFT; |
|
56 |
text.setLayoutData(twd_text); |
|
55 | 57 |
|
56 | 58 |
button_selection = formToolkit.createButton(this, "", SWT.NONE); |
59 |
button_selection.setToolTipText("Browse existing"); |
|
57 | 60 |
button_selection.setImage(ResourceManager.getPluginImage("eu.etaxonomy.taxeditor.store", "icons/prj_obj.gif")); |
58 | 61 |
|
59 | 62 |
button_edit = formToolkit.createButton(this, "", SWT.NONE); |
63 |
button_edit.setToolTipText("Edit"); |
|
60 | 64 |
button_edit.setImage(ResourceManager.getPluginImage("eu.etaxonomy.taxeditor.store", "icons/text.gif")); |
61 | 65 |
|
62 | 66 |
button_remove = formToolkit.createButton(this, "", SWT.NONE); |
67 |
button_remove.setToolTipText("Remove"); |
|
63 | 68 |
button_remove.setImage(ResourceManager.getPluginImage("eu.etaxonomy.taxeditor.store", "icons/trash.gif")); |
64 | 69 |
} |
65 | 70 |
|
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/campanula/EntitySelectionFieldController.java | ||
---|---|---|
9 | 9 |
*/ |
10 | 10 |
package eu.etaxonomy.taxeditor.ui.section.campanula; |
11 | 11 |
|
12 |
import org.eclipse.swt.SWT; |
|
12 |
import org.eclipse.core.runtime.IStatus; |
|
13 |
import org.eclipse.jface.wizard.WizardDialog; |
|
13 | 14 |
import org.eclipse.swt.events.SelectionAdapter; |
14 | 15 |
import org.eclipse.swt.events.SelectionEvent; |
15 |
import org.eclipse.swt.events.SelectionListener; |
|
16 | 16 |
import org.eclipse.swt.graphics.Color; |
17 | 17 |
import org.eclipse.swt.widgets.Button; |
18 | 18 |
import org.eclipse.swt.widgets.Composite; |
... | ... | |
21 | 21 |
import org.springframework.security.core.GrantedAuthority; |
22 | 22 |
|
23 | 23 |
import eu.etaxonomy.cdm.api.conversation.ConversationHolder; |
24 |
import eu.etaxonomy.cdm.api.conversation.IConversationEnabled; |
|
25 | 24 |
import eu.etaxonomy.cdm.common.CdmUtils; |
26 | 25 |
import eu.etaxonomy.cdm.model.common.Group; |
27 | 26 |
import eu.etaxonomy.cdm.model.common.ICdmBase; |
... | ... | |
35 | 34 |
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory; |
36 | 35 |
import eu.etaxonomy.taxeditor.ui.element.CdmPropertyChangeEvent; |
37 | 36 |
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement; |
38 |
import eu.etaxonomy.taxeditor.ui.element.IEnableableFormElement; |
|
39 |
import eu.etaxonomy.taxeditor.ui.element.IEntityElement; |
|
40 |
import eu.etaxonomy.taxeditor.ui.element.ILabeledElement; |
|
41 |
import eu.etaxonomy.taxeditor.ui.element.ISelectableElement; |
|
42 | 37 |
import eu.etaxonomy.taxeditor.ui.element.LayoutConstants; |
43 | 38 |
import eu.etaxonomy.taxeditor.ui.element.SelectionArbitrator; |
44 |
import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement; |
|
39 |
import eu.etaxonomy.taxeditor.ui.section.campanula.compatibility.IEntitySelectionElement; |
|
40 |
import eu.etaxonomy.taxeditor.ui.selection.EditFromSelectionWizard; |
|
45 | 41 |
|
46 | 42 |
/** |
47 | 43 |
* @author pplitzner |
48 | 44 |
* @date 13.08.2013 |
49 | 45 |
* |
50 | 46 |
*/ |
51 |
public class EntitySelectionFieldController<T extends ICdmBase> extends AbstractCdmFormElement implements SelectionListener, IEnableableFormElement, ISelectableElement, IEntityElement<T>, ILabeledElement, IConversationEnabled {
|
|
47 |
public class EntitySelectionFieldController<T extends ICdmBase> extends AbstractCdmFormElement implements IEntitySelectionElement<T>{
|
|
52 | 48 |
|
53 | 49 |
/** |
54 | 50 |
* Bitmask for configuring functionality of selection element |
... | ... | |
129 | 125 |
selectionArbitrator = formFactory.createSelectionArbitrator(this); |
130 | 126 |
} |
131 | 127 |
|
132 |
createControls(getLayoutComposite(), entitySelectionField, SWT.NULL);
|
|
128 |
createControls(entitySelectionField);
|
|
133 | 129 |
|
134 | 130 |
setEntity(entity); |
135 | 131 |
} |
... | ... | |
139 | 135 |
this.clazz = clazz; |
140 | 136 |
} |
141 | 137 |
|
142 |
private void createControls(Composite parent, EntitySelectionField entitySelectionField, int style) {
|
|
138 |
private void createControls(EntitySelectionField entitySelectionField) {
|
|
143 | 139 |
|
144 | 140 |
// label = formFactory.createLabel(getLayoutComposite(), labelString, SWT.NULL); |
145 | 141 |
// |
146 | 142 |
// addControl(label); |
147 | 143 |
|
148 |
selectableComposite = entitySelectionField;//formFactory.createComposite(getLayoutComposite());
|
|
144 |
selectableComposite = entitySelectionField; |
|
149 | 145 |
|
150 | 146 |
int columns = 2; |
151 | 147 |
if (isEditable) { |
... | ... | |
160 | 156 |
|
161 | 157 |
addControl(selectableComposite); |
162 | 158 |
|
163 |
text = entitySelectionField.getText();//formFactory.createLabel(selectableComposite, null, SWT.WRAP);
|
|
159 |
text = entitySelectionField.getText(); |
|
164 | 160 |
addControl(text); |
165 | 161 |
|
166 | 162 |
text.setLayoutData(LayoutConstants.FILL_HORIZONTALLY()); |
167 | 163 |
text.setBackground(AbstractUtility.getColor(Resources.COLOR_TEXT_DISABLED_BACKGROUND)); |
168 | 164 |
|
169 |
button_selection = entitySelectionField.getButton_selection();//formFactory.createButton(selectableComposite, null, SWT.PUSH);
|
|
165 |
button_selection = entitySelectionField.getButton_selection(); |
|
170 | 166 |
button_selection.setImage(ImageResources.getImage(ImageResources.BROWSE_ICON)); |
171 | 167 |
button_selection.setToolTipText("Browse existing"); |
172 | 168 |
|
173 | 169 |
addControl(button_selection); |
174 | 170 |
button_selection.addSelectionListener(this); |
175 | 171 |
|
172 |
button_edit = entitySelectionField.getButton_edit(); |
|
176 | 173 |
if (isEditable) { |
177 |
button_edit = entitySelectionField.getButton_edit();//formFactory.createButton(selectableComposite, null, SWT.PUSH); |
|
178 |
button_edit.setImage(ImageResources.getImage(ImageResources.EDIT_ICON)); |
|
179 |
button_edit.setToolTipText("Edit"); |
|
180 | 174 |
addControl(button_edit); |
181 |
// button_edit.addSelectionListener(new EditListener(this)); |
|
175 |
button_edit.addSelectionListener(new EditListener(this)); |
|
176 |
} |
|
177 |
else{ |
|
178 |
button_edit.setVisible(false); |
|
182 | 179 |
} |
183 | 180 |
|
181 |
button_remove = entitySelectionField.getButton_remove(); |
|
184 | 182 |
if (isDeletable) { |
185 |
button_remove = entitySelectionField.getButton_remove();//formFactory.createButton(selectableComposite, null, SWT.PUSH); |
|
186 |
button_remove.setImage(ImageResources.getImage(ImageResources.TRASH_ICON)); |
|
187 |
button_remove.setToolTipText("Remove"); |
|
188 | 183 |
addControl(button_remove); |
189 |
// button_remove.addSelectionListener(new DeleteListener(this)); |
|
184 |
button_remove.addSelectionListener(new DeleteListener(this)); |
|
185 |
} |
|
186 |
else{ |
|
187 |
button_remove.setVisible(false); |
|
190 | 188 |
} |
191 | 189 |
} |
192 | 190 |
|
... | ... | |
262 | 260 |
} |
263 | 261 |
} |
264 | 262 |
|
265 |
/** |
|
266 |
* <p> |
|
267 |
* updateFromWizard |
|
268 |
* </p> |
|
269 |
*/ |
|
270 |
protected void updateFromWizard() { |
|
263 |
@Override |
|
264 |
public void updateFromWizard() { |
|
271 | 265 |
updateElement(); |
272 | 266 |
firePropertyChangeEvent(new CdmPropertyChangeEvent(this, null)); |
273 | 267 |
} |
... | ... | |
334 | 328 |
return selectionArbitrator; |
335 | 329 |
} |
336 | 330 |
|
337 |
/** |
|
338 |
* Convenient access to current shell |
|
339 |
* |
|
340 |
* @return a {@link org.eclipse.swt.widgets.Shell} object. |
|
341 |
*/ |
|
342 |
protected Shell getShell() { |
|
331 |
@Override |
|
332 |
public Shell getShell() { |
|
343 | 333 |
return getLayoutComposite().getShell(); |
344 | 334 |
} |
345 | 335 |
|
... | ... | |
354 | 344 |
|
355 | 345 |
private class DeleteListener extends SelectionAdapter { |
356 | 346 |
|
357 |
private final EntitySelectionElement<T> selectionElement;
|
|
347 |
private final EntitySelectionFieldController<T> selectionElement;
|
|
358 | 348 |
|
359 |
public DeleteListener(EntitySelectionElement<T> selectionElement) {
|
|
349 |
public DeleteListener(EntitySelectionFieldController<T> selectionElement) {
|
|
360 | 350 |
this.selectionElement = selectionElement; |
361 | 351 |
} |
362 | 352 |
|
... | ... | |
369 | 359 |
|
370 | 360 |
private class EditListener extends SelectionAdapter { |
371 | 361 |
|
372 |
private final EntitySelectionElement<T> selectionElement; |
|
362 |
private final IEntitySelectionElement<T> selectionElement;
|
|
373 | 363 |
|
374 |
public EditListener(EntitySelectionElement<T> selectionElement) { |
|
364 |
public EditListener(IEntitySelectionElement<T> selectionElement) {
|
|
375 | 365 |
this.selectionElement = selectionElement; |
376 | 366 |
} |
377 | 367 |
|
378 | 368 |
/** {@inheritDoc} */ |
379 | 369 |
@Override |
380 | 370 |
public void widgetSelected(SelectionEvent e) { |
381 |
// WizardDialog dialog = new WizardDialog(selectionElement.getShell(), new EditFromSelectionWizard(selectionElement));
|
|
382 |
// if (dialog.open() == IStatus.OK) {
|
|
383 |
// selectionElement.updateFromWizard();
|
|
384 |
// }
|
|
371 |
WizardDialog dialog = new WizardDialog(selectionElement.getShell(), new EditFromSelectionWizard(selectionElement)); |
|
372 |
if (dialog.open() == IStatus.OK) { |
|
373 |
selectionElement.updateFromWizard(); |
|
374 |
} |
|
385 | 375 |
} |
386 | 376 |
} |
387 | 377 |
|
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/campanula/compatibility/IEntitySelectionElement.java | ||
---|---|---|
1 |
// $Id$ |
|
2 |
/** |
|
3 |
* Copyright (C) 2013 EDIT |
|
4 |
* European Distributed Institute of Taxonomy |
|
5 |
* http://www.e-taxonomy.eu |
|
6 |
* |
|
7 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
|
8 |
* See LICENSE.TXT at the top of this package for the full license terms. |
|
9 |
*/ |
|
10 |
package eu.etaxonomy.taxeditor.ui.section.campanula.compatibility; |
|
11 |
|
|
12 |
import org.eclipse.swt.events.SelectionListener; |
|
13 |
import org.eclipse.swt.widgets.Shell; |
|
14 |
|
|
15 |
import eu.etaxonomy.cdm.api.conversation.IConversationEnabled; |
|
16 |
import eu.etaxonomy.cdm.model.common.ICdmBase; |
|
17 |
import eu.etaxonomy.taxeditor.ui.element.IEnableableFormElement; |
|
18 |
import eu.etaxonomy.taxeditor.ui.element.IEntityElement; |
|
19 |
import eu.etaxonomy.taxeditor.ui.element.ILabeledElement; |
|
20 |
import eu.etaxonomy.taxeditor.ui.element.ISelectableElement; |
|
21 |
|
|
22 |
/** |
|
23 |
* @author pplitzner |
|
24 |
* @date 15.08.2013 |
|
25 |
* |
|
26 |
*/ |
|
27 |
public interface IEntitySelectionElement<T extends ICdmBase> extends SelectionListener, IEnableableFormElement, ISelectableElement, IEntityElement<T>, ILabeledElement, IConversationEnabled { |
|
28 |
/** |
|
29 |
* Convenient access to current shell |
|
30 |
* |
|
31 |
* @return a {@link org.eclipse.swt.widgets.Shell} object. |
|
32 |
*/ |
|
33 |
public abstract Shell getShell(); |
|
34 |
|
|
35 |
/** |
|
36 |
* <p> |
|
37 |
* updateFromWizard |
|
38 |
* </p> |
|
39 |
*/ |
|
40 |
public abstract void updateFromWizard(); |
|
41 |
|
|
42 |
} |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/selection/EditFromSelectionWizard.java | ||
---|---|---|
1 | 1 |
// $Id$ |
2 | 2 |
/** |
3 | 3 |
* Copyright (C) 2007 EDIT |
4 |
* European Distributed Institute of Taxonomy
|
|
4 |
* European Distributed Institute of Taxonomy |
|
5 | 5 |
* http://www.e-taxonomy.eu |
6 |
*
|
|
6 |
* |
|
7 | 7 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
8 | 8 |
* See LICENSE.TXT at the top of this package for the full license terms. |
9 | 9 |
*/ |
... | ... | |
35 | 35 |
import eu.etaxonomy.taxeditor.ui.section.agent.InstitutionWizardPage; |
36 | 36 |
import eu.etaxonomy.taxeditor.ui.section.agent.PersonWizardPage; |
37 | 37 |
import eu.etaxonomy.taxeditor.ui.section.agent.TeamWizardPage; |
38 |
import eu.etaxonomy.taxeditor.ui.section.campanula.compatibility.IEntitySelectionElement; |
|
38 | 39 |
import eu.etaxonomy.taxeditor.ui.section.name.NonViralNameWizardPage; |
39 | 40 |
import eu.etaxonomy.taxeditor.ui.section.occurrence.CollectionWizardPage; |
40 | 41 |
import eu.etaxonomy.taxeditor.ui.section.occurrence.DerivedUnitBaseWizardPage; |
... | ... | |
48 | 49 |
* <p> |
49 | 50 |
* EditFromSelectionWizard class. |
50 | 51 |
* </p> |
51 |
*
|
|
52 |
* |
|
52 | 53 |
* @author n.hoffmann |
53 | 54 |
* @created Jun 1, 2010 |
54 | 55 |
* @version 1.0 |
... | ... | |
56 | 57 |
public class EditFromSelectionWizard extends Wizard implements |
57 | 58 |
SelectionListener { |
58 | 59 |
|
59 |
private final EntitySelectionElement selectionElement; |
|
60 |
private final IEntitySelectionElement selectionElement;
|
|
60 | 61 |
|
61 | 62 |
/** |
62 | 63 |
* <p> |
63 | 64 |
* Constructor for EditFromSelectionWizard. |
64 | 65 |
* </p> |
65 |
*
|
|
66 |
* |
|
66 | 67 |
* @param selectionElement |
67 | 68 |
* a |
68 | 69 |
* {@link eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement} |
69 | 70 |
* object. |
70 | 71 |
*/ |
71 |
public EditFromSelectionWizard(EntitySelectionElement selectionElement) { |
|
72 |
public EditFromSelectionWizard(IEntitySelectionElement selectionElement) {
|
|
72 | 73 |
this.selectionElement = selectionElement; |
73 | 74 |
this.setWindowTitle(String.format("Edit %s", TextHelper.deproxyClassName(selectionElement.getEntity().getClass()))); |
74 | 75 |
} |
... | ... | |
124 | 125 |
selectionElement.getConversationHolder(), |
125 | 126 |
(Institution) entity)); |
126 | 127 |
} else if (entity instanceof User) { |
127 |
addPage(new UserDetailWizardPage(formFactory,
|
|
128 |
selectionElement.getConversationHolder(),
|
|
128 |
addPage(new UserDetailWizardPage(formFactory, |
|
129 |
selectionElement.getConversationHolder(), |
|
129 | 130 |
(User) entity)); |
130 | 131 |
} else { |
131 | 132 |
StoreUtil.warningDialog("Missing interface", this, |
132 | 133 |
"No detail element for current selection"); |
133 |
}
|
|
134 |
} |
|
134 | 135 |
|
135 | 136 |
} |
136 | 137 |
|
137 | 138 |
/* |
138 | 139 |
* (non-Javadoc) |
139 |
*
|
|
140 |
* |
|
140 | 141 |
* @see org.eclipse.jface.wizard.Wizard#performFinish() |
141 | 142 |
*/ |
142 | 143 |
/** {@inheritDoc} */ |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/selection/EntitySelectionElement.java | ||
---|---|---|
1 | 1 |
/** |
2 |
*
|
|
2 |
* |
|
3 | 3 |
*/ |
4 | 4 |
package eu.etaxonomy.taxeditor.ui.selection; |
5 | 5 |
|
... | ... | |
8 | 8 |
import org.eclipse.swt.SWT; |
9 | 9 |
import org.eclipse.swt.events.SelectionAdapter; |
10 | 10 |
import org.eclipse.swt.events.SelectionEvent; |
11 |
import org.eclipse.swt.events.SelectionListener; |
|
12 | 11 |
import org.eclipse.swt.graphics.Color; |
13 | 12 |
import org.eclipse.swt.widgets.Button; |
14 | 13 |
import org.eclipse.swt.widgets.Composite; |
... | ... | |
17 | 16 |
import org.springframework.security.core.GrantedAuthority; |
18 | 17 |
|
19 | 18 |
import eu.etaxonomy.cdm.api.conversation.ConversationHolder; |
20 |
import eu.etaxonomy.cdm.api.conversation.IConversationEnabled; |
|
21 | 19 |
import eu.etaxonomy.cdm.common.CdmUtils; |
22 | 20 |
import eu.etaxonomy.cdm.model.common.Group; |
23 | 21 |
import eu.etaxonomy.cdm.model.common.ICdmBase; |
... | ... | |
31 | 29 |
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory; |
32 | 30 |
import eu.etaxonomy.taxeditor.ui.element.CdmPropertyChangeEvent; |
33 | 31 |
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement; |
34 |
import eu.etaxonomy.taxeditor.ui.element.IEnableableFormElement; |
|
35 |
import eu.etaxonomy.taxeditor.ui.element.IEntityElement; |
|
36 |
import eu.etaxonomy.taxeditor.ui.element.ILabeledElement; |
|
37 |
import eu.etaxonomy.taxeditor.ui.element.ISelectable; |
|
38 |
import eu.etaxonomy.taxeditor.ui.element.ISelectableElement; |
|
39 | 32 |
import eu.etaxonomy.taxeditor.ui.element.LayoutConstants; |
40 | 33 |
import eu.etaxonomy.taxeditor.ui.element.SelectionArbitrator; |
34 |
import eu.etaxonomy.taxeditor.ui.section.campanula.compatibility.IEntitySelectionElement; |
|
41 | 35 |
|
42 | 36 |
/** |
43 | 37 |
* <p> |
44 | 38 |
* Abstract AbstractSelectionElement class. |
45 | 39 |
* </p> |
46 |
*
|
|
40 |
* |
|
47 | 41 |
* @author n.hoffmann |
48 | 42 |
* @created Nov 17, 2009 |
49 | 43 |
* @version 1.0 |
50 | 44 |
* @param <T> |
51 | 45 |
*/ |
52 | 46 |
public class EntitySelectionElement<T extends ICdmBase> extends |
53 |
AbstractCdmFormElement implements SelectionListener, |
|
54 |
IEnableableFormElement, ISelectableElement, IEntityElement<T>, |
|
55 |
ILabeledElement, IConversationEnabled, ISelectable { |
|
47 |
AbstractCdmFormElement implements IEntitySelectionElement<T>{ |
|
56 | 48 |
|
57 | 49 |
/** |
58 | 50 |
* Bitmask for configuring functionality of selection element |
... | ... | |
90 | 82 |
* <p> |
91 | 83 |
* Constructor for AbstractSelectionElement. |
92 | 84 |
* </p> |
93 |
*
|
|
85 |
* |
|
94 | 86 |
* @param formFactory |
95 | 87 |
* a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} |
96 | 88 |
* object. |
... | ... | |
122 | 114 |
this.isEditable = (mode & EDITABLE) == EDITABLE; |
123 | 115 |
this.isDeletable = (mode & DELETABLE) == DELETABLE; |
124 | 116 |
boolean isSelectable = (mode & SELECTABLE) == SELECTABLE; |
125 |
|
|
117 |
|
|
126 | 118 |
this.labelString = labelString; |
127 | 119 |
|
128 | 120 |
this.conversation = conversation; |
... | ... | |
135 | 127 |
|
136 | 128 |
setEntity(entity); |
137 | 129 |
} |
138 |
|
|
130 |
|
|
139 | 131 |
public EntitySelectionElement(CdmFormFactory formFactory, |
140 | 132 |
ConversationHolder conversation, ICdmFormElement parentElement, Class<T> clazz, |
141 | 133 |
String labelString, T entity, int mode, int style) { |
... | ... | |
177 | 169 |
button_selection.setImage(ImageResources |
178 | 170 |
.getImage(ImageResources.BROWSE_ICON)); |
179 | 171 |
button_selection.setToolTipText("Browse existing"); |
180 |
|
|
172 |
|
|
181 | 173 |
addControl(button_selection); |
182 | 174 |
button_selection.addSelectionListener(this); |
183 | 175 |
|
... | ... | |
202 | 194 |
} |
203 | 195 |
} |
204 | 196 |
|
205 |
public void widgetSelected(SelectionEvent e) { |
|
197 |
@Override |
|
198 |
public void widgetSelected(SelectionEvent e) { |
|
206 | 199 |
T selection = SelectionDialogFactory.getSelectionFromDialog(clazz, getShell(), getConversationHolder(), getEntity()); |
207 | 200 |
setSelectionInternal(selection); |
208 | 201 |
} |
209 |
|
|
202 |
|
|
210 | 203 |
/** |
211 | 204 |
* Return the selected object |
212 |
*
|
|
205 |
* |
|
213 | 206 |
* @return a T object. |
214 | 207 |
*/ |
215 | 208 |
public T getSelection() { |
... | ... | |
218 | 211 |
|
219 | 212 |
/* |
220 | 213 |
* (non-Javadoc) |
221 |
*
|
|
214 |
* |
|
222 | 215 |
* @see |
223 | 216 |
* eu.etaxonomy.taxeditor.forms.IEnableableFormElement#setEnabled(boolean) |
224 | 217 |
*/ |
... | ... | |
235 | 228 |
* <p> |
236 | 229 |
* setSelectionInternal |
237 | 230 |
* </p> |
238 |
*
|
|
231 |
* |
|
239 | 232 |
* @param selection |
240 | 233 |
* a T object. |
241 | 234 |
*/ |
... | ... | |
250 | 243 |
* <p> |
251 | 244 |
* Setter for the field <code>entity</code>. |
252 | 245 |
* </p> |
253 |
*
|
|
246 |
* |
|
254 | 247 |
* @param selection |
255 | 248 |
* a T object. |
256 | 249 |
*/ |
... | ... | |
273 | 266 |
} |
274 | 267 |
} |
275 | 268 |
|
276 |
/** |
|
277 |
* <p> |
|
278 |
* updateFromWizard |
|
279 |
* </p> |
|
280 |
*/ |
|
281 |
protected void updateFromWizard() { |
|
269 |
@Override |
|
270 |
public void updateFromWizard() { |
|
282 | 271 |
updateElement(); |
283 | 272 |
firePropertyChangeEvent(new CdmPropertyChangeEvent(this, null)); |
284 | 273 |
} |
... | ... | |
287 | 276 |
* <p> |
288 | 277 |
* getTitle |
289 | 278 |
* </p> |
290 |
*
|
|
279 |
* |
|
291 | 280 |
* @return a {@link java.lang.String} object. |
292 | 281 |
*/ |
293 | 282 |
protected String getTitle() { |
... | ... | |
311 | 300 |
|
312 | 301 |
/* |
313 | 302 |
* (non-Javadoc) |
314 |
*
|
|
303 |
* |
|
315 | 304 |
* @see eu.etaxonomy.taxeditor.forms.IEntityElement#getEntity() |
316 | 305 |
*/ |
317 | 306 |
/** |
318 | 307 |
* <p> |
319 | 308 |
* Getter for the field <code>entity</code>. |
320 | 309 |
* </p> |
321 |
*
|
|
310 |
* |
|
322 | 311 |
* @return a T object. |
323 | 312 |
*/ |
324 | 313 |
@Override |
... | ... | |
328 | 317 |
|
329 | 318 |
/* |
330 | 319 |
* (non-Javadoc) |
331 |
*
|
|
320 |
* |
|
332 | 321 |
* @see eu.etaxonomy.taxeditor.forms.section.cdmdetail.ISelectableElement# |
333 | 322 |
* getSelectionArbitrator() |
334 | 323 |
*/ |
... | ... | |
336 | 325 |
* <p> |
337 | 326 |
* Getter for the field <code>selectionArbitrator</code>. |
338 | 327 |
* </p> |
339 |
*
|
|
328 |
* |
|
340 | 329 |
* @return a {@link eu.etaxonomy.taxeditor.ui.element.SelectionArbitrator} |
341 | 330 |
* object. |
342 | 331 |
*/ |
... | ... | |
347 | 336 |
|
348 | 337 |
/** |
349 | 338 |
* Convenient access to current shell |
350 |
*
|
|
339 |
* |
|
351 | 340 |
* @return a {@link org.eclipse.swt.widgets.Shell} object. |
352 | 341 |
*/ |
353 |
protected Shell getShell() { |
|
342 |
@Override |
|
343 |
public Shell getShell() { |
|
354 | 344 |
return getLayoutComposite().getShell(); |
355 | 345 |
} |
356 | 346 |
|
... | ... | |
409 | 399 |
* <p> |
410 | 400 |
* getConversationHolder |
411 | 401 |
* </p> |
412 |
*
|
|
402 |
* |
|
413 | 403 |
* @return a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} |
414 | 404 |
* object. |
415 | 405 |
*/ |
... | ... | |
436 | 426 |
* <p> |
437 | 427 |
* Getter for the field <code>label</code>. |
438 | 428 |
* </p> |
439 |
*
|
|
429 |
* |
|
440 | 430 |
* @return a {@link java.lang.String} object. |
441 | 431 |
*/ |
442 | 432 |
@Override |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/detail/DetailsViewer.java | ||
---|---|---|
669 | 669 |
AbstractFormSection definedTermDetailSection = formFactory.createDefinedTermDetailSection(getInput().getClass(), getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED); |
670 | 670 |
addPart(definedTermDetailSection); |
671 | 671 |
} |
672 |
|
|
673 |
private void createFODetailsView(RootElement parent) { |
|
674 |
destroySections(); |
|
675 |
|
|
676 |
GeneralDetailSection generalDetailSection = formFactory.createFOSection(getConversationHolder(), parent, this,ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED); |
|
677 |
|
|
678 |
formFactory.createHorizontalSeparator(parent, SWT.BORDER); |
|
679 |
|
|
680 |
GatheringEventDetailSection gatheringEventDetailSection = formFactory.createGatheringSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE); |
|
681 |
|
|
682 |
formFactory.createHorizontalSeparator(parent, SWT.BORDER); |
|
683 |
|
|
684 |
FieldObservationDetailSection fieldObservationDetailSection = formFactory.createFODetailsSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE); |
|
685 |
|
|
686 |
addPart(generalDetailSection); |
|
687 |
addPart(gatheringEventDetailSection); |
|
688 |
addPart(fieldObservationDetailSection); |
|
689 |
} |
|
690 | 672 |
} |
Also available in: Unified diff