Revision 321b9521
Added by Katja Luther over 5 years ago
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/databaseAdmin/preferencePage/ChecklistEditorGeneralPreference.java | ||
---|---|---|
9 | 9 |
package eu.etaxonomy.taxeditor.databaseAdmin.preferencePage; |
10 | 10 |
|
11 | 11 |
import org.eclipse.swt.SWT; |
12 |
import org.eclipse.swt.custom.CLabel; |
|
12 | 13 |
import org.eclipse.swt.events.SelectionAdapter; |
13 | 14 |
import org.eclipse.swt.events.SelectionEvent; |
14 | 15 |
import org.eclipse.swt.layout.GridLayout; |
15 | 16 |
import org.eclipse.swt.widgets.Button; |
16 | 17 |
import org.eclipse.swt.widgets.Composite; |
17 | 18 |
import org.eclipse.swt.widgets.Control; |
19 |
import org.eclipse.swt.widgets.Label; |
|
18 | 20 |
|
19 | 21 |
import eu.etaxonomy.cdm.api.application.ICdmRepository; |
20 | 22 |
import eu.etaxonomy.cdm.api.service.IPreferenceService; |
... | ... | |
39 | 41 |
boolean isSortByVocabularyOrder; |
40 | 42 |
boolean isShowSymbol; |
41 | 43 |
boolean isShowIdInVocabulary; |
44 |
boolean isShowSymbol1; |
|
45 |
boolean isShowSymbol2; |
|
46 |
boolean isShowTitle; |
|
47 |
String displayString; |
|
42 | 48 |
Composite child ; |
43 | 49 |
|
44 | 50 |
@Override |
... | ... | |
99 | 105 |
// button_openWizard.setText(Messages.ChecklistEditorGeneralPreference_open_distribution_selection); |
100 | 106 |
|
101 | 107 |
// Table table = new Table |
108 |
final CLabel description = new CLabel(child, SWT.NULL); |
|
109 |
description.setText(Messages.ChecklistEditorGeneralPreference_Configure_display_of_Areas); |
|
102 | 110 |
|
103 |
final Button showIdInVocabulary = new Button(child, SWT.CHECK);
|
|
111 |
final Button showIdInVocabulary = new Button(child, SWT.RADIO);
|
|
104 | 112 |
pref = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.ShowIdInVocabulary); |
105 | 113 |
if (pref != null){ |
106 | 114 |
isShowIdInVocabulary = Boolean.valueOf(pref.getValue()); |
... | ... | |
116 | 124 |
|
117 | 125 |
} |
118 | 126 |
}); |
127 |
final Button showSymbol1 = new Button(child, SWT.RADIO); |
|
128 |
pref = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.ShowSymbol1); |
|
129 |
if (pref != null){ |
|
130 |
isShowSymbol1 = Boolean.valueOf(pref.getValue()); |
|
131 |
}else{ |
|
132 |
isShowSymbol1 = false; |
|
133 |
} |
|
134 |
showSymbol1.setText(Messages.ChecklistEditorGeneralPreference_show_symbol1); |
|
135 |
showSymbol1.setSelection(isShowSymbol1); |
|
136 |
showSymbol1.addSelectionListener(new SelectionAdapter(){ |
|
137 |
@Override |
|
138 |
public void widgetSelected(SelectionEvent e) { |
|
139 |
isShowSymbol1 = showSymbol1.getSelection(); |
|
140 |
|
|
141 |
} |
|
142 |
}); |
|
143 |
final Button showSymbol2 = new Button(child, SWT.RADIO); |
|
144 |
pref = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.ShowSymbol2); |
|
145 |
if (pref != null){ |
|
146 |
isShowSymbol2 = Boolean.valueOf(pref.getValue()); |
|
147 |
}else{ |
|
148 |
isShowSymbol2 = false; |
|
149 |
} |
|
150 |
showSymbol2.setText(Messages.ChecklistEditorGeneralPreference_show_symbol2); |
|
151 |
showSymbol2.setSelection(isShowSymbol2); |
|
152 |
showSymbol2.addSelectionListener(new SelectionAdapter(){ |
|
153 |
@Override |
|
154 |
public void widgetSelected(SelectionEvent e) { |
|
155 |
isShowSymbol2 = showSymbol2.getSelection(); |
|
156 |
|
|
157 |
} |
|
158 |
}); |
|
159 |
final Button showTitle = new Button(child, SWT.RADIO); |
|
160 |
isShowTitle = !(isShowIdInVocabulary || isShowSymbol1 || isShowSymbol2); |
|
161 |
|
|
162 |
showTitle.setText(Messages.ChecklistEditorGeneralPreference_show_title); |
|
163 |
showTitle.setSelection(isShowTitle); |
|
164 |
showTitle.addSelectionListener(new SelectionAdapter(){ |
|
165 |
@Override |
|
166 |
public void widgetSelected(SelectionEvent e) { |
|
167 |
isShowTitle = showTitle.getSelection(); |
|
168 |
|
|
169 |
} |
|
170 |
}); |
|
119 | 171 |
|
172 |
final Label seperator1 = new Label(child, SWT.HORIZONTAL | SWT.SEPARATOR); |
|
173 |
final Button sortNamedAreaByVocabularyOrder = new Button(child, SWT.CHECK); |
|
174 |
|
|
175 |
pref = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.AreasSortedByIdInVocabulary); |
|
176 |
if (pref != null){ |
|
177 |
isSortByVocabularyOrder = Boolean.valueOf(pref.getValue()); |
|
178 |
}else{ |
|
179 |
isSortByVocabularyOrder = false; |
|
180 |
} |
|
181 |
|
|
182 |
sortNamedAreaByVocabularyOrder.setText(Messages.ChecklistEditorGeneralPreference_sort_areas); |
|
183 |
sortNamedAreaByVocabularyOrder.setSelection(isSortByVocabularyOrder); |
|
184 |
sortNamedAreaByVocabularyOrder.addSelectionListener(new SelectionAdapter(){ |
|
185 |
@Override |
|
186 |
public void widgetSelected(SelectionEvent e) { |
|
187 |
isSortByVocabularyOrder = sortNamedAreaByVocabularyOrder.getSelection(); |
|
188 |
} |
|
189 |
}); |
|
190 |
final Label seperator2 = new Label(child, SWT.HORIZONTAL | SWT.SEPARATOR); |
|
191 |
final CLabel descriptionStatus = new CLabel(child, SWT.NULL); |
|
192 |
descriptionStatus.setText("Configure how the status should be displayed"); |
|
120 | 193 |
final Button showSymbol = new Button(child, SWT.CHECK); |
121 |
pref = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.ShowSymbol); |
|
194 |
pref = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.ShowSymbolForStatus);
|
|
122 | 195 |
if (pref != null){ |
123 | 196 |
isShowSymbol = Boolean.valueOf(pref.getValue()); |
124 | 197 |
}else{ |
... | ... | |
150 | 223 |
isShowRank = activateRankButton.getSelection(); |
151 | 224 |
} |
152 | 225 |
}); |
153 |
final Button sortNamedAreaByVocabularyOrder = new Button(child, SWT.CHECK); |
|
154 | 226 |
|
155 |
pref = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.AreasSortedByIdInVocabulary); |
|
156 |
if (pref != null){ |
|
157 |
isSortByVocabularyOrder = Boolean.valueOf(pref.getValue()); |
|
158 |
}else{ |
|
159 |
isSortByVocabularyOrder = false; |
|
160 |
} |
|
161 |
|
|
162 |
sortNamedAreaByVocabularyOrder.setText(Messages.ChecklistEditorGeneralPreference_sort_areas); |
|
163 |
sortNamedAreaByVocabularyOrder.setSelection(isSortByVocabularyOrder); |
|
164 |
sortNamedAreaByVocabularyOrder.addSelectionListener(new SelectionAdapter(){ |
|
165 |
@Override |
|
166 |
public void widgetSelected(SelectionEvent e) { |
|
167 |
isSortByVocabularyOrder = sortNamedAreaByVocabularyOrder.getSelection(); |
|
168 |
} |
|
169 |
}); |
|
170 | 227 |
|
171 | 228 |
if(isEditorActivated){ |
172 | 229 |
child.setEnabled(true); |
... | ... | |
195 | 252 |
pref.setAllowOverride(true); |
196 | 253 |
service.set(pref); |
197 | 254 |
|
198 |
pref = CdmPreference.NewDatabaseInstance( PreferencePredicate.ShowSymbol, Boolean.toString(isShowSymbol)); |
|
255 |
pref = CdmPreference.NewDatabaseInstance( PreferencePredicate.ShowSymbol1, Boolean.toString(isShowSymbol1)); |
|
256 |
//ToDo |
|
257 |
pref.setAllowOverride(true); |
|
258 |
service.set(pref); |
|
259 |
pref = CdmPreference.NewDatabaseInstance( PreferencePredicate.ShowSymbol2, Boolean.toString(isShowSymbol2)); |
|
260 |
//ToDo |
|
261 |
pref.setAllowOverride(true); |
|
262 |
service.set(pref); |
|
263 |
|
|
264 |
|
|
265 |
pref = CdmPreference.NewDatabaseInstance( PreferencePredicate.ShowSymbolForStatus, Boolean.toString(isShowSymbol)); |
|
199 | 266 |
//ToDo |
200 | 267 |
pref.setAllowOverride(true); |
201 | 268 |
service.set(pref); |
... | ... | |
213 | 280 |
PreferencesUtil.setSortNamedAreasByOrderInVocabulary(isSortByVocabularyOrder); |
214 | 281 |
PreferencesUtil.setShowRankInChecklistEditor(isShowRank); |
215 | 282 |
PreferencesUtil.setShowSymbolInChecklistEditor(isShowSymbol); |
216 |
PreferencesUtil.setShowIdInVocabularyInChecklistEditor(isShowIdInVocabulary); |
|
283 |
|
|
284 |
if (isShowIdInVocabulary){ |
|
285 |
displayString = IPreferenceKeys.CHECKLIST_AREA_DISPLAY_TITLE; |
|
286 |
}else if (isShowSymbol1){ |
|
287 |
displayString = IPreferenceKeys.CHECKLIST_AREA_DISPLAY_SYMBOL1; |
|
288 |
}else if (isShowSymbol2){ |
|
289 |
displayString = IPreferenceKeys.CHECKLIST_AREA_DISPLAY_SYMBOL2; |
|
290 |
}else{ |
|
291 |
displayString = IPreferenceKeys.CHECKLIST_AREA_DISPLAY_TITLE; |
|
292 |
} |
|
293 |
PreferencesUtil.setShowIdInVocabularyInChecklistEditor(displayString); |
|
294 |
|
|
217 | 295 |
return true; |
218 | 296 |
} |
219 | 297 |
|
Also available in: Unified diff
ref #7793: fix problem with details view after save in distribution editor