Revision 58bf9462
Added by Katja Luther about 3 years ago
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/feature/FeatureNodeDetailElement.java | ||
---|---|---|
1 |
/** |
|
2 |
* Copyright (C) 2009 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 |
*/ |
|
9 |
package eu.etaxonomy.taxeditor.ui.section.feature; |
|
10 |
|
|
11 |
import eu.etaxonomy.cdm.persistence.dto.TermNodeDto; |
|
12 |
import eu.etaxonomy.taxeditor.event.EventUtility; |
|
13 |
import eu.etaxonomy.taxeditor.event.WorkbenchEventConstants; |
|
14 |
import eu.etaxonomy.taxeditor.store.StoreUtil; |
|
15 |
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory; |
|
16 |
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement; |
|
17 |
import eu.etaxonomy.taxeditor.ui.element.LayoutConstants; |
|
18 |
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement; |
|
19 |
|
|
20 |
/** |
|
21 |
* |
|
22 |
* @author pplitzner |
|
23 |
* @since Dec 21, 2017 |
|
24 |
* |
|
25 |
*/ |
|
26 |
public class FeatureNodeDetailElement extends AbstractCdmDetailElement<TermNodeDto> { |
|
27 |
|
|
28 |
private InapplicableIfEntityCollectionSection sectionInapplicableIf; |
|
29 |
private OnlyApplicableIfEntityCollectionSection sectionOnlyApplicableIf; |
|
30 |
|
|
31 |
public FeatureNodeDetailElement(CdmFormFactory formFactory, |
|
32 |
ICdmFormElement formElement) { |
|
33 |
super(formFactory, formElement); |
|
34 |
} |
|
35 |
|
|
36 |
@Override |
|
37 |
protected void createControls(ICdmFormElement formElement, TermNodeDto entity, int style) { |
|
38 |
sectionInapplicableIf = formFactory.createInapplicableIfEntityCollectionSection(getConversationHolder(), |
|
39 |
formElement, StoreUtil.getSectionStyle(InapplicableIfEntityCollectionSection.class, getEntity().getClass().getCanonicalName())); |
|
40 |
sectionInapplicableIf.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1)); |
|
41 |
sectionInapplicableIf.setEntity(getEntity()); |
|
42 |
sectionOnlyApplicableIf = formFactory.createOnlyApplicableIfEntityCollectionSection(getConversationHolder(), |
|
43 |
formElement, StoreUtil.getSectionStyle(OnlyApplicableIfEntityCollectionSection.class, getEntity().getClass().getCanonicalName())); |
|
44 |
sectionOnlyApplicableIf.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1)); |
|
45 |
sectionOnlyApplicableIf.setEntity(getEntity()); |
|
46 |
} |
|
47 |
|
|
48 |
@Override |
|
49 |
public void handleEvent(Object eventSource) { |
|
50 |
EventUtility.postEvent(WorkbenchEventConstants.ADD_SAVE_CANDIDATE, getEntity().getUuid()); |
|
51 |
} |
|
52 |
|
|
53 |
} |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/feature/FeatureTreeDetailElementForNode.java | ||
---|---|---|
1 |
/** |
|
2 |
* Copyright (C) 2009 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 |
*/ |
|
9 |
package eu.etaxonomy.taxeditor.ui.section.feature; |
|
10 |
|
|
11 |
import org.eclipse.swt.widgets.Label; |
|
12 |
|
|
13 |
import eu.etaxonomy.cdm.model.term.TermTree; |
|
14 |
import eu.etaxonomy.taxeditor.model.ColorResources; |
|
15 |
import eu.etaxonomy.taxeditor.preference.Resources; |
|
16 |
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory; |
|
17 |
import eu.etaxonomy.taxeditor.ui.element.CheckboxElement; |
|
18 |
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement; |
|
19 |
import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement; |
|
20 |
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement; |
|
21 |
|
|
22 |
/** |
|
23 |
* @author pplitzner |
|
24 |
* @since Dec 21, 2017 |
|
25 |
*/ |
|
26 |
public class FeatureTreeDetailElementForNode extends AbstractCdmDetailElement<TermTree> { |
|
27 |
|
|
28 |
private CheckboxElement allowDuplicates; |
|
29 |
private CheckboxElement orderRelevant; |
|
30 |
private CheckboxElement isFlat; |
|
31 |
|
|
32 |
private TextWithLabelElement titleCacheText; |
|
33 |
|
|
34 |
public FeatureTreeDetailElementForNode(CdmFormFactory formFactory, |
|
35 |
ICdmFormElement formElement) { |
|
36 |
super(formFactory, formElement); |
|
37 |
} |
|
38 |
|
|
39 |
|
|
40 |
@Override |
|
41 |
protected void createControls(ICdmFormElement formElement, TermTree entity, int style) { |
|
42 |
Label lblTermType = new Label(formElement.getLayoutComposite(), style); |
|
43 |
lblTermType.setText("Term Type"); |
|
44 |
Label lblStructureText = new Label(formElement.getLayoutComposite(), style); |
|
45 |
lblStructureText.setText(entity.getTermType().getLabel()); |
|
46 |
lblStructureText.setForeground(ColorResources.getColor(Resources.BLACK)); |
|
47 |
|
|
48 |
titleCacheText = formFactory.createTextWithLabelElement( |
|
49 |
formElement, "Title Cache", entity.getTitleCache(), style); |
|
50 |
|
|
51 |
allowDuplicates = formFactory.createCheckbox(formElement, "Allow duplicates", entity.isAllowDuplicates(), style); |
|
52 |
orderRelevant = formFactory.createCheckbox(formElement, "Order relevant", entity.isOrderRelevant(), style); |
|
53 |
isFlat = formFactory.createCheckbox(formElement, "Is flat", entity.isFlat(), style); |
|
54 |
} |
|
55 |
|
|
56 |
@Override |
|
57 |
protected void updateControlStates() { |
|
58 |
super.updateControlStates(); |
|
59 |
// toggleable_cache.setEnabled(getEntity().isProtectedTitleCache()); |
|
60 |
} |
|
61 |
|
|
62 |
@Override |
|
63 |
public void handleEvent(Object eventSource) { |
|
64 |
// if (eventSource == titleCacheText) { |
|
65 |
// handleToggleableCacheField(); |
|
66 |
// } |
|
67 |
// else |
|
68 |
if (eventSource == allowDuplicates) { |
|
69 |
getEntity().setAllowDuplicates(allowDuplicates.getSelection()); |
|
70 |
} |
|
71 |
else if (eventSource == orderRelevant) { |
|
72 |
getEntity().setOrderRelevant(orderRelevant.getSelection()); |
|
73 |
} |
|
74 |
else if (eventSource == isFlat) { |
|
75 |
getEntity().setFlat(isFlat.getSelection()); |
|
76 |
} |
|
77 |
} |
|
78 |
|
|
79 |
} |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/feature/TermNodeDetailElement.java | ||
---|---|---|
1 |
/** |
|
2 |
* Copyright (C) 2009 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 |
*/ |
|
9 |
package eu.etaxonomy.taxeditor.ui.section.feature; |
|
10 |
|
|
11 |
import eu.etaxonomy.cdm.persistence.dto.TermNodeDto; |
|
12 |
import eu.etaxonomy.taxeditor.event.EventUtility; |
|
13 |
import eu.etaxonomy.taxeditor.event.WorkbenchEventConstants; |
|
14 |
import eu.etaxonomy.taxeditor.store.StoreUtil; |
|
15 |
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory; |
|
16 |
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement; |
|
17 |
import eu.etaxonomy.taxeditor.ui.element.LayoutConstants; |
|
18 |
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement; |
|
19 |
|
|
20 |
/** |
|
21 |
* |
|
22 |
* @author pplitzner |
|
23 |
* @since Dec 21, 2017 |
|
24 |
* |
|
25 |
*/ |
|
26 |
public class TermNodeDetailElement extends AbstractCdmDetailElement<TermNodeDto> { |
|
27 |
|
|
28 |
private InapplicableIfEntityCollectionSection sectionInapplicableIf; |
|
29 |
private OnlyApplicableIfEntityCollectionSection sectionOnlyApplicableIf; |
|
30 |
|
|
31 |
public TermNodeDetailElement(CdmFormFactory formFactory, |
|
32 |
ICdmFormElement formElement) { |
|
33 |
super(formFactory, formElement); |
|
34 |
} |
|
35 |
|
|
36 |
@Override |
|
37 |
protected void createControls(ICdmFormElement formElement, TermNodeDto entity, int style) { |
|
38 |
sectionInapplicableIf = formFactory.createInapplicableIfEntityCollectionSection(getConversationHolder(), |
|
39 |
formElement, StoreUtil.getSectionStyle(InapplicableIfEntityCollectionSection.class, getEntity().getClass().getCanonicalName())); |
|
40 |
sectionInapplicableIf.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1)); |
|
41 |
sectionInapplicableIf.setEntity(getEntity()); |
|
42 |
sectionOnlyApplicableIf = formFactory.createOnlyApplicableIfEntityCollectionSection(getConversationHolder(), |
|
43 |
formElement, StoreUtil.getSectionStyle(OnlyApplicableIfEntityCollectionSection.class, getEntity().getClass().getCanonicalName())); |
|
44 |
sectionOnlyApplicableIf.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1)); |
|
45 |
sectionOnlyApplicableIf.setEntity(getEntity()); |
|
46 |
} |
|
47 |
|
|
48 |
@Override |
|
49 |
public void handleEvent(Object eventSource) { |
|
50 |
EventUtility.postEvent(WorkbenchEventConstants.ADD_SAVE_CANDIDATE, getEntity().getUuid()); |
|
51 |
} |
|
52 |
|
|
53 |
} |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/feature/TermTreeDetailElementForNode.java | ||
---|---|---|
1 |
/** |
|
2 |
* Copyright (C) 2009 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 |
*/ |
|
9 |
package eu.etaxonomy.taxeditor.ui.section.feature; |
|
10 |
|
|
11 |
import org.eclipse.swt.widgets.Label; |
|
12 |
|
|
13 |
import eu.etaxonomy.cdm.model.term.TermTree; |
|
14 |
import eu.etaxonomy.taxeditor.model.ColorResources; |
|
15 |
import eu.etaxonomy.taxeditor.preference.Resources; |
|
16 |
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory; |
|
17 |
import eu.etaxonomy.taxeditor.ui.element.CheckboxElement; |
|
18 |
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement; |
|
19 |
import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement; |
|
20 |
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement; |
|
21 |
|
|
22 |
/** |
|
23 |
* @author pplitzner |
|
24 |
* @since Dec 21, 2017 |
|
25 |
*/ |
|
26 |
public class TermTreeDetailElementForNode extends AbstractCdmDetailElement<TermTree> { |
|
27 |
|
|
28 |
private CheckboxElement allowDuplicates; |
|
29 |
private CheckboxElement orderRelevant; |
|
30 |
private CheckboxElement isFlat; |
|
31 |
|
|
32 |
private TextWithLabelElement titleCacheText; |
|
33 |
|
|
34 |
public TermTreeDetailElementForNode(CdmFormFactory formFactory, |
|
35 |
ICdmFormElement formElement) { |
|
36 |
super(formFactory, formElement); |
|
37 |
} |
|
38 |
|
|
39 |
|
|
40 |
@Override |
|
41 |
protected void createControls(ICdmFormElement formElement, TermTree entity, int style) { |
|
42 |
Label lblTermType = new Label(formElement.getLayoutComposite(), style); |
|
43 |
lblTermType.setText("Term Type"); |
|
44 |
Label lblStructureText = new Label(formElement.getLayoutComposite(), style); |
|
45 |
lblStructureText.setText(entity.getTermType().getLabel()); |
|
46 |
lblStructureText.setForeground(ColorResources.getColor(Resources.BLACK)); |
|
47 |
|
|
48 |
titleCacheText = formFactory.createTextWithLabelElement( |
|
49 |
formElement, "Title Cache", entity.getTitleCache(), style); |
|
50 |
|
|
51 |
allowDuplicates = formFactory.createCheckbox(formElement, "Allow duplicates", entity.isAllowDuplicates(), style); |
|
52 |
orderRelevant = formFactory.createCheckbox(formElement, "Order relevant", entity.isOrderRelevant(), style); |
|
53 |
isFlat = formFactory.createCheckbox(formElement, "Is flat", entity.isFlat(), style); |
|
54 |
} |
|
55 |
|
|
56 |
@Override |
|
57 |
protected void updateControlStates() { |
|
58 |
super.updateControlStates(); |
|
59 |
// toggleable_cache.setEnabled(getEntity().isProtectedTitleCache()); |
|
60 |
} |
|
61 |
|
|
62 |
@Override |
|
63 |
public void handleEvent(Object eventSource) { |
|
64 |
if (eventSource == titleCacheText) { |
|
65 |
getEntity().setTitleCache(titleCacheText.getText());; |
|
66 |
} |
|
67 |
else |
|
68 |
if (eventSource == allowDuplicates) { |
|
69 |
getEntity().setAllowDuplicates(allowDuplicates.getSelection()); |
|
70 |
} |
|
71 |
else if (eventSource == orderRelevant) { |
|
72 |
getEntity().setOrderRelevant(orderRelevant.getSelection()); |
|
73 |
} |
|
74 |
else if (eventSource == isFlat) { |
|
75 |
getEntity().setFlat(isFlat.getSelection()); |
|
76 |
} |
|
77 |
} |
|
78 |
|
|
79 |
} |
Also available in: Unified diff
ref #9504: handle changes of title