Project

General

Profile

Revision f8139f49

IDf8139f49d666289b10c06aa59d09986adebfe258
Parent 5d945a6e
Child b6ebeb25

Added by Patrick Plitzner 12 months ago

fix #8511 Add line break to structure and property path in detail view

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/feature/CharacterDetailElement.java
8 8
*/
9 9
package eu.etaxonomy.taxeditor.ui.section.feature;
10 10

  
11
import org.eclipse.swt.widgets.Label;
12

  
13 11
import eu.etaxonomy.cdm.model.common.Language;
14 12
import eu.etaxonomy.cdm.model.description.Character;
15 13
import eu.etaxonomy.cdm.model.term.DefinedTerm;
16 14
import eu.etaxonomy.cdm.model.term.Representation;
17 15
import eu.etaxonomy.cdm.model.term.TermType;
18 16
import eu.etaxonomy.taxeditor.editor.definedterm.TermBasePropertyTester;
19
import eu.etaxonomy.taxeditor.model.ColorResources;
20
import eu.etaxonomy.taxeditor.preference.Resources;
21 17
import eu.etaxonomy.taxeditor.store.CdmStore;
22 18
import eu.etaxonomy.taxeditor.store.StoreUtil;
23 19
import eu.etaxonomy.taxeditor.ui.combo.term.TermComboElement;
......
67 63
	protected void createControls(ICdmFormElement formElement, Character entity, int style) {
68 64
	    this.parentFormElement = formElement;
69 65
	    element_Representation = formFactory.createTranslatableRepresentationElement(formElement,  entity.getPreferredRepresentation(CdmStore.getDefaultLanguage()),entity, 100, style, true);
70
	    Label lblStructure = new Label(formElement.getLayoutComposite(), style);
71
	    lblStructure.setText("Structure");
72
	    Label lblStructureText = new Label(formElement.getLayoutComposite(), style);
73
	    lblStructureText.setText(getStructureText(entity));
74
	    lblStructureText.setForeground(ColorResources.getColor(Resources.BLACK));
75
	    Label lblProperty = new Label(formElement.getLayoutComposite(), style);
76
	    lblProperty.setText("Property");
77
	    Label lblPropertyText = new Label(formElement.getLayoutComposite(), style);
78
	    lblPropertyText.setForeground(ColorResources.getColor(Resources.BLACK));
79
	    lblPropertyText.setText(getPropertyText(entity));
66
	    CharacterNodeDetailElement.createText(formElement, "Structure", CharacterNodeDetailElement.getStructureText(entity));
67
	    CharacterNodeDetailElement.createText(formElement, "Property", CharacterNodeDetailElement.getPropertyText(entity));
80 68

  
81 69
        comboStructuralModifier = formFactory.createDefinedTermComboElement(TermType.StructureModifier, formElement, "Structural Modifier", entity.getStructureModifier(), style);
82 70

  
......
109 97

  
110 98
    }
111 99

  
112
    private String getPropertyText(Character entity) {
113
        return entity.getProperty()!=null?StoreUtil.getPath(entity.getProperty()):"[no property]";
114
    }
115

  
116
    private String getStructureText(Character entity) {
117
        return entity.getStructure()!=null?StoreUtil.getPath(entity.getStructure()):"[no structure]";
118
    }
119 100

  
120 101
    @Override
121 102
    public void setEntity(Character entity) {
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/feature/CharacterNodeDetailElement.java
8 8
*/
9 9
package eu.etaxonomy.taxeditor.ui.section.feature;
10 10

  
11
import org.eclipse.swt.SWT;
11 12
import org.eclipse.swt.widgets.Label;
13
import org.eclipse.swt.widgets.Text;
12 14

  
13 15
import eu.etaxonomy.cdm.model.common.Language;
14 16
import eu.etaxonomy.cdm.model.description.Character;
......
71 73
	protected void createControls(ICdmFormElement formElement, TermNode<Character> entity, int style) {
72 74
	    this.parentFormElement = formElement;
73 75
	    element_Representation = formFactory.createTranslatableRepresentationElement(formElement,  entity.getTerm().getPreferredRepresentation(CdmStore.getDefaultLanguage()),entity.getTerm(), 100, style, true);
74
	    Label lblStructure = new Label(formElement.getLayoutComposite(), style);
75
	    lblStructure.setText("Structure");
76
	    Label lblStructureText = new Label(formElement.getLayoutComposite(), style);
77
	    lblStructureText.setText(getPath(entity.getTerm().getStructure()));
78
	    lblStructureText.setForeground(ColorResources.getColor(Resources.BLACK));
79
	    Label lblProperty = new Label(formElement.getLayoutComposite(), style);
80
	    lblProperty.setText("Property");
81
	    Label lblPropertyText = new Label(formElement.getLayoutComposite(), style);
82
	    lblPropertyText.setForeground(ColorResources.getColor(Resources.BLACK));
83
	    lblPropertyText.setText(getPath(entity.getTerm().getProperty()));
76

  
77
	    createText(formElement, "Structure", getStructureText(entity.getTerm()));
78
	    createText(formElement, "Property", getPropertyText(entity.getTerm()));
84 79

  
85 80
        comboStructuralModifier = formFactory.createDefinedTermComboElement(TermType.StructureModifier, formElement, "Structural Modifier", entity.getTerm().getStructureModifier(), style);
86 81

  
......
122 117
        sectionOnlyApplicableIf.setEntity(entity);
123 118
    }
124 119

  
125
	private String getPath(TermNode node){
126
	    String path = node.getTerm().getLabel();
127
	    TermNode parent = node.getParent();
128
	    while(parent != null && parent.getTerm()!=null){
129
	        path = parent.getTerm().getLabel() + "/" + path;
130
	        parent = parent.getParent();
131
	    }
132
	    return path;
133
	}
120
    public static void createText(ICdmFormElement formElement, String label, String path) {
121
        Label labelText = new Label(formElement.getLayoutComposite(), SWT.NONE);
122
        labelText.setText(label);
123
        Text text = new Text(formElement.getLayoutComposite(), SWT.WRAP);
124
	    text.setText(path);
125
	    text.setEditable(false);
126
	    text.setLayoutData(LayoutConstants.FILL());
127
	    text.setForeground(ColorResources.getColor(Resources.BLACK));
128
    }
129

  
130
    public static String getPropertyText(Character entity) {
131
        return entity.getProperty()!=null?StoreUtil.getPath(entity.getProperty()):"[no property]";
132
    }
133

  
134
    public static String getStructureText(Character entity) {
135
        return entity.getStructure()!=null?StoreUtil.getPath(entity.getStructure()):"[no structure]";
136
    }
134 137

  
135 138
    @Override
136 139
    public void setEntity(TermNode<Character> entity) {

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)