Revision bcc1d18a
Added by Patrick Plitzner over 5 years ago
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/e4/BulkEditorE4Composite.java | ||
---|---|---|
91 | 91 |
|
92 | 92 |
public static final String TYPE_PROPERTY = Messages.BulkEditorE4_TYPE; |
93 | 93 |
|
94 |
public static final String ID_PROPERTY = "Id"; |
|
94 |
public static final String ID_PROPERTY = "Id"; //$NON-NLS-1$
|
|
95 | 95 |
|
96 |
public static final String UUID_PROPERTY = "Uuid"; |
|
96 |
public static final String UUID_PROPERTY = "Uuid"; //$NON-NLS-1$
|
|
97 | 97 |
|
98 |
public static final String CANDIDATE_LABEL = "candidate"; |
|
98 |
public static final String CANDIDATE_LABEL = "candidate"; //$NON-NLS-1$
|
|
99 | 99 |
|
100 |
public static final String TARGET_LABEL = "target"; |
|
100 |
public static final String TARGET_LABEL = "target"; //$NON-NLS-1$
|
|
101 | 101 |
|
102 |
public static final List<String> columnList = new ArrayList<>();
|
|
102 |
private final List<String> columnList = new ArrayList<>();
|
|
103 | 103 |
|
104 | 104 |
private Composite topComposite; |
105 | 105 |
|
... | ... | |
183 | 183 |
//sorted list |
184 | 184 |
SortedList<CdmBase> sortedList = new SortedList<>(bulkEditor.getEditorInput().getModel(), bulkEditor.getEditorInput().getTitleComparator()); |
185 | 185 |
//data provider |
186 |
BulkEditorPropertyAccessor columnPropertyAccessor = new BulkEditorPropertyAccessor(bulkEditor.getEditorInput()); |
|
186 |
BulkEditorPropertyAccessor columnPropertyAccessor = new BulkEditorPropertyAccessor(this, bulkEditor.getEditorInput());
|
|
187 | 187 |
bodyDataProvider = new ListDataProvider<CdmBase>(sortedList, |
188 | 188 |
columnPropertyAccessor); |
189 | 189 |
DefaultColumnHeaderDataProvider colHeaderDataProvider = new DefaultColumnHeaderDataProvider( |
... | ... | |
295 | 295 |
public void configureUiBindings( |
296 | 296 |
UiBindingRegistry uiBindingRegistry) { |
297 | 297 |
// add e4 menu to NatTable |
298 |
new PopupMenuBuilder(natTable, e4Menu) |
|
299 |
.build(); |
|
298 |
new PopupMenuBuilder(natTable, e4Menu) |
|
299 |
.withHideColumnMenuItem() |
|
300 |
.withShowAllColumnsMenuItem() |
|
301 |
.build(); |
|
300 | 302 |
|
301 | 303 |
// register the UI binding for header, corner and body region |
302 | 304 |
uiBindingRegistry.registerMouseDownBinding( |
... | ... | |
352 | 354 |
natTable.doCommand(new VisualRefreshCommand()); |
353 | 355 |
} |
354 | 356 |
|
357 |
public List<String> getColumnList() { |
|
358 |
return columnList; |
|
359 |
} |
|
360 |
|
|
355 | 361 |
public IStructuredSelection getSelection(){ |
356 | 362 |
List<CdmBase> selection = new ArrayList<>(); |
357 | 363 |
int[] fullySelectedRowPositions = bodyLayer.getSelectionLayer().getFullySelectedRowPositions(); |
... | ... | |
378 | 384 |
} |
379 | 385 |
|
380 | 386 |
public void copyDataToClipboard() { |
381 |
String textData = ""; |
|
387 |
String textData = ""; //$NON-NLS-1$
|
|
382 | 388 |
IStructuredSelection selection = getSelection(); |
383 | 389 |
Object[] objects = selection.toArray(); |
384 | 390 |
for (Object object : objects) { |
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/e4/BulkEditorPropertyAccessor.java | ||
---|---|---|
21 | 21 |
public class BulkEditorPropertyAccessor implements IColumnPropertyAccessor<CdmBase> { |
22 | 22 |
|
23 | 23 |
private AbstractBulkEditorInput input; |
24 |
BulkEditorE4Composite bulkEditorComposite; |
|
24 | 25 |
|
25 |
public BulkEditorPropertyAccessor(AbstractBulkEditorInput<CdmBase> input) { |
|
26 |
public BulkEditorPropertyAccessor(BulkEditorE4Composite bulkEditorComposite, AbstractBulkEditorInput<CdmBase> input) {
|
|
26 | 27 |
super(); |
27 | 28 |
this.input = input; |
29 |
this.bulkEditorComposite = bulkEditorComposite; |
|
28 | 30 |
} |
29 | 31 |
|
30 | 32 |
@Override |
31 | 33 |
public Object getDataValue(CdmBase rowObject, int columnIndex) { |
32 |
String property = BulkEditorE4Composite.columnList.get(columnIndex);
|
|
34 |
String property = bulkEditorComposite.getColumnList().get(columnIndex);
|
|
33 | 35 |
if(property.equals(input.getName())){ |
34 | 36 |
return input.getText(rowObject); |
35 | 37 |
}if(property.equals(BulkEditorE4Composite.TYPE_PROPERTY)){ |
... | ... | |
49 | 51 |
|
50 | 52 |
@Override |
51 | 53 |
public int getColumnCount() { |
52 |
return BulkEditorE4Composite.columnList.size();
|
|
54 |
return bulkEditorComposite.getColumnList().size();
|
|
53 | 55 |
} |
54 | 56 |
|
55 | 57 |
@Override |
56 | 58 |
public String getColumnProperty(int columnIndex) { |
57 |
return BulkEditorE4Composite.columnList.get(columnIndex);
|
|
59 |
return bulkEditorComposite.getColumnList().get(columnIndex);
|
|
58 | 60 |
} |
59 | 61 |
|
60 | 62 |
@Override |
61 | 63 |
public int getColumnIndex(String propertyName) { |
62 |
return BulkEditorE4Composite.columnList.indexOf(propertyName);
|
|
64 |
return bulkEditorComposite.getColumnList().indexOf(propertyName);
|
|
63 | 65 |
} |
64 | 66 |
} |
Also available in: Unified diff
ref #7502 Add option to hide and show columns