Revision 9e0f8df5
Added by Patrick Plitzner over 8 years ago
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/AbstractCdmDetailSection.java | ||
---|---|---|
42 | 42 |
|
43 | 43 |
protected ICdmDetailElement<ENTITY> detailElement; |
44 | 44 |
|
45 |
/** |
|
46 |
* <p> |
|
47 |
* Constructor for AbstractCdmDetailSection. |
|
48 |
* </p> |
|
49 |
* |
|
50 |
* @param formFactory |
|
51 |
* a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} |
|
52 |
* object. |
|
53 |
* @param conversation |
|
54 |
* a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} |
|
55 |
* object. |
|
56 |
* @param parentElement |
|
57 |
* a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} |
|
58 |
* object. |
|
59 |
* @param selectionProvider |
|
60 |
* a {@link org.eclipse.jface.viewers.ISelectionProvider} object. |
|
61 |
* @param style |
|
62 |
* a int. |
|
63 |
* @param <ENTITY> |
|
64 |
* a ENTITY object. |
|
65 |
*/ |
|
66 | 45 |
public AbstractCdmDetailSection(CdmFormFactory formFactory, |
67 | 46 |
ConversationHolder conversation, ICdmFormElement parentElement, |
68 | 47 |
ISelectionProvider selectionProvider, int style) { |
... | ... | |
88 | 67 |
} |
89 | 68 |
} |
90 | 69 |
|
91 |
/** |
|
92 |
* @param abstractCdmDetailSection |
|
93 |
* @param definedTermClass |
|
94 |
* @param null1 |
|
95 |
*/ |
|
96 | 70 |
protected void createControlsByType(AbstractCdmDetailSection<ENTITY> formElement, Class<ENTITY> entityClass, int style) { |
97 | 71 |
TableWrapLayout layout = (TableWrapLayout) getLayoutComposite().getLayout(); |
98 | 72 |
layout.topMargin = 10; |
... | ... | |
107 | 81 |
} |
108 | 82 |
} |
109 | 83 |
|
110 |
|
|
111 |
/** |
|
112 |
* <p> |
|
113 |
* createControls |
|
114 |
* </p> |
|
115 |
* |
|
116 |
* @param formElement |
|
117 |
* a |
|
118 |
* {@link eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection} |
|
119 |
* object. |
|
120 |
* @param style |
|
121 |
* a int. |
|
122 |
*/ |
|
123 | 84 |
protected void createControls(AbstractCdmDetailSection<ENTITY> formElement, int style) { |
124 | 85 |
createControlsByType(formElement, null, style); |
125 | 86 |
} |
... | ... | |
130 | 91 |
return createCdmDetailElement(parentElement, style); |
131 | 92 |
} |
132 | 93 |
|
133 |
/** |
|
134 |
* <p> |
|
135 |
* getHeading |
|
136 |
* </p> |
|
137 |
* |
|
138 |
* @return the heading for this section |
|
139 |
*/ |
|
140 | 94 |
public abstract String getHeading(); |
141 | 95 |
|
142 | 96 |
/** {@inheritDoc} */ |
... | ... | |
152 | 106 |
super.dispose(); |
153 | 107 |
} |
154 | 108 |
|
155 |
/* |
|
156 |
* (non-Javadoc) |
|
157 |
* |
|
158 |
* @see |
|
159 |
* eu.etaxonomy.taxeditor.forms.section.AbstractEditorFormSection#setBackground |
|
160 |
* (org.eclipse.swt.graphics.Color) |
|
161 |
*/ |
|
162 | 109 |
/** {@inheritDoc} */ |
163 | 110 |
@Override |
164 | 111 |
public void setBackground(Color color) { |
... | ... | |
168 | 115 |
super.setBackground(color); |
169 | 116 |
} |
170 | 117 |
|
171 |
/** |
|
172 |
* <p> |
|
173 |
* setEntity |
|
174 |
* </p> |
|
175 |
* |
|
176 |
* @param entity |
|
177 |
* a ENTITY object. |
|
178 |
*/ |
|
179 | 118 |
@Override |
180 | 119 |
public void setEntity(ENTITY entity) { |
181 | 120 |
if (detailElement != null) { |
... | ... | |
186 | 125 |
layout(); |
187 | 126 |
} |
188 | 127 |
|
189 |
/** |
|
190 |
* <p> |
|
191 |
* setSectionTitle |
|
192 |
* </p> |
|
193 |
*/ |
|
194 | 128 |
protected void setSectionTitle() { |
195 | 129 |
String title = ""; |
196 | 130 |
if (getEntity() != null && (getEntity() instanceof IdentifiableEntity) && !(getEntity() instanceof SpecimenOrObservationBase)) { |
197 | 131 |
title = ": " + ((IdentifiableEntity) getEntity()).getTitleCache(); |
132 |
// we have to duplicate ampersands otherwise they are treated as |
|
133 |
// mnenomic (see Label.setText() documentation) |
|
134 |
// see also #4302 |
|
135 |
title = title.replace("&", "&&"); |
|
198 | 136 |
} |
199 | 137 |
this.setText(String.format("%s%s", getHeading(), title)); |
200 | 138 |
setTextClient(createToolbar()); |
201 | 139 |
} |
202 | 140 |
|
203 |
/** |
|
204 |
* @return |
|
205 |
*/ |
|
206 | 141 |
protected Control createToolbar() { |
207 | 142 |
ToolBarManager toolBarManager = new ToolBarManager(SWT.FLAT); |
208 | 143 |
return toolBarManager.createControl(this); |
209 | 144 |
} |
210 | 145 |
|
211 |
/** |
|
212 |
* <p> |
|
213 |
* updateTitle |
|
214 |
* </p> |
|
215 |
*/ |
|
216 | 146 |
public void updateTitle() { |
217 | 147 |
if (!isDisposed()) { |
218 | 148 |
setSectionTitle(); |
Also available in: Unified diff
Handle ampersand correctly in section titles (#5142)