Revision dbee9b8f
Added by Patrick Plitzner about 6 years ago
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/workingSet/matrix/CharacterMatrix.java | ||
---|---|---|
90 | 90 |
import org.eclipse.nebula.widgets.nattable.sort.config.SingleClickSortConfiguration; |
91 | 91 |
import org.eclipse.nebula.widgets.nattable.style.DisplayMode; |
92 | 92 |
import org.eclipse.nebula.widgets.nattable.summaryrow.FixedSummaryRowLayer; |
93 |
import org.eclipse.nebula.widgets.nattable.summaryrow.ISummaryProvider; |
|
94 |
import org.eclipse.nebula.widgets.nattable.summaryrow.SummaryRowConfigAttributes; |
|
93 | 95 |
import org.eclipse.nebula.widgets.nattable.summaryrow.SummaryRowLayer; |
94 | 96 |
import org.eclipse.nebula.widgets.nattable.tree.ITreeRowModel; |
95 | 97 |
import org.eclipse.nebula.widgets.nattable.tree.TreeLayer; |
98 |
import org.eclipse.nebula.widgets.nattable.tree.command.TreeCollapseAllCommand; |
|
99 |
import org.eclipse.nebula.widgets.nattable.tree.command.TreeExpandAllCommand; |
|
96 | 100 |
import org.eclipse.nebula.widgets.nattable.ui.menu.AbstractHeaderMenuConfiguration; |
97 | 101 |
import org.eclipse.nebula.widgets.nattable.ui.menu.PopupMenuBuilder; |
98 | 102 |
import org.eclipse.nebula.widgets.nattable.viewport.ViewportLayer; |
... | ... | |
101 | 105 |
import org.eclipse.swt.events.SelectionEvent; |
102 | 106 |
import org.eclipse.swt.layout.GridData; |
103 | 107 |
import org.eclipse.swt.layout.GridLayout; |
108 |
import org.eclipse.swt.layout.RowLayout; |
|
104 | 109 |
import org.eclipse.swt.widgets.Button; |
105 | 110 |
import org.eclipse.swt.widgets.Composite; |
106 | 111 |
import org.eclipse.swt.widgets.Label; |
... | ... | |
220 | 225 |
|
221 | 226 |
Composite toolbarComposite = new Composite(parent, SWT.NONE); |
222 | 227 |
toolbarComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); |
223 |
toolbarComposite.setLayout(new GridLayout(4, false));
|
|
228 |
toolbarComposite.setLayout(new GridLayout(6, false));
|
|
224 | 229 |
|
225 | 230 |
//get features/columns stored in working set |
226 | 231 |
FeatureTree tree = workingSet.getDescriptiveSystem(); |
... | ... | |
306 | 311 |
TreeLayer treeLayer = new TreeLayer(selectionLayer, treeRowModel); |
307 | 312 |
ViewportLayer viewportLayer = new ViewportLayer(treeLayer); |
308 | 313 |
|
314 |
configRegistry.registerConfigAttribute( |
|
315 |
SummaryRowConfigAttributes.SUMMARY_PROVIDER, |
|
316 |
new ISummaryProvider() { |
|
317 |
|
|
318 |
@Override |
|
319 |
public Object summarize(int columnIndex) { |
|
320 |
// TODO Auto-generated method stub |
|
321 |
return null; |
|
322 |
} |
|
323 |
}, |
|
324 |
DisplayMode.NORMAL, |
|
325 |
COUNTRY_COLUMN); |
|
309 | 326 |
|
310 | 327 |
|
311 | 328 |
// create a standalone FixedSummaryRowLayer |
... | ... | |
314 | 331 |
// is the ViewportLayer |
315 | 332 |
FixedSummaryRowLayer summaryRowLayer = |
316 | 333 |
new FixedSummaryRowLayer(bodyDataLayer, viewportLayer, configRegistry, false); |
317 |
//regoster labels with summary prefix for summary layer
|
|
334 |
//register labels with summary prefix for summary layer
|
|
318 | 335 |
ColumnOverrideLabelAccumulator summaryColumnLabelAccumulator =new ColumnOverrideLabelAccumulator(bodyDataLayer); |
319 | 336 |
summaryRowLayer.setConfigLabelAccumulator(summaryColumnLabelAccumulator); |
320 | 337 |
for(int i=0;i<features.size();i++){ |
... | ... | |
493 | 510 |
wsLabel.setText(workingSet.getLabel()); |
494 | 511 |
wsLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); |
495 | 512 |
|
513 |
|
|
514 |
/** |
|
515 |
* Expand/Collapse button |
|
516 |
*/ |
|
517 |
Button collapseAllButton = new Button(toolbarComposite, SWT.PUSH); |
|
518 |
collapseAllButton.setImage(ImageResources.getImage(ImageResources.COLLAPSE_ALL)); |
|
519 |
collapseAllButton.setToolTipText("Collapse all"); |
|
520 |
collapseAllButton.addSelectionListener(new SelectionAdapter() { |
|
521 |
@Override |
|
522 |
public void widgetSelected(SelectionEvent e) { |
|
523 |
natTable.doCommand(new TreeCollapseAllCommand()); |
|
524 |
} |
|
525 |
}); |
|
526 |
Button expandAllButton = new Button(toolbarComposite, SWT.PUSH); |
|
527 |
expandAllButton.setImage(ImageResources.getImage(ImageResources.EXPAND_ALL)); |
|
528 |
expandAllButton.setToolTipText("Expand all"); |
|
529 |
expandAllButton.addSelectionListener(new SelectionAdapter() { |
|
530 |
@Override |
|
531 |
public void widgetSelected(SelectionEvent e) { |
|
532 |
natTable.doCommand(new TreeExpandAllCommand()); |
|
533 |
} |
|
534 |
}); |
|
535 |
|
|
496 | 536 |
/** |
497 | 537 |
* Table state persistence |
498 | 538 |
*/ |
... | ... | |
550 | 590 |
// add button to show dialog |
551 | 591 |
Button btnManageState = new Button(toolbarComposite, SWT.PUSH); |
552 | 592 |
btnManageState.setImage(ImageResources.getImage(ImageResources.SETTINGS)); |
593 |
btnManageState.setToolTipText("View configuration"); |
|
553 | 594 |
btnManageState.addSelectionListener(new SelectionAdapter() { |
554 | 595 |
@Override |
555 | 596 |
public void widgetSelected(SelectionEvent e) { |
... | ... | |
574 | 615 |
} |
575 | 616 |
}); |
576 | 617 |
|
618 |
/** |
|
619 |
* bottom button toolbar |
|
620 |
*/ |
|
621 |
Composite buttonPanel = new Composite(parent, SWT.NONE); |
|
622 |
buttonPanel.setLayout(new RowLayout()); |
|
623 |
GridDataFactory.fillDefaults().grab(true, false).applyTo(buttonPanel); |
|
624 |
|
|
577 | 625 |
/** |
578 | 626 |
* Add description button |
579 | 627 |
*/ |
580 |
Button btnAddDescription = new Button(parent, SWT.PUSH);
|
|
628 |
Button btnAddDescription = new Button(buttonPanel, SWT.PUSH);
|
|
581 | 629 |
btnAddDescription.setImage(ImageResources.getImage(ImageResources.ADD_ICON)); |
582 | 630 |
btnAddDescription.addSelectionListener(new SelectionAdapter() { |
583 | 631 |
@Override |
... | ... | |
600 | 648 |
} |
601 | 649 |
} |
602 | 650 |
}); |
651 |
|
|
603 | 652 |
parent.layout(); |
604 | 653 |
} |
605 | 654 |
|
Also available in: Unified diff
ref #7095 Add expand/collapse button