Skip to content
Snippets Groups Projects

Issue #19: Dropdown Menu by Table

Closed Issue #19: Dropdown Menu by Table
5 unresolved threads
Closed Ngoc Quang Truong requested to merge ntruongg36/set:issue#19 into main
5 unresolved threads

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
404 408 // gridlayer
405 409 final GridLayer gridLayer = new GridLayer(bodyLayerStack,
406 410 columnGroup4HeaderLayer, rowHeaderLayer, cornerLayer);
407 natTable = new NatTable(parent, gridLayer);
411 natTable = new NatTable(parent, gridLayer, false);
408 412 GridDataFactory.fillDefaults().grab(true, true).minSize(-1, 500)
409 413 .applyTo(natTable);
414 tableMenuService.createDefaultMenuItems(this, table, bodyDataProvider,
415 selectionLayer);
416 natTable.addConfiguration(tableMenuService
417 .createMenuConfiguration(natTable, selectionLayer));
  • 78 @Override
    79 public String getObjectGuid() {
    80 final Collection<ILayerCell> selectedCells = selectionLayer
    81 .getSelectedCells();
    82 if (selectedCells.isEmpty()) {
    83 return null;
    84 }
    85 final int rowPosition = selectedCells.iterator().next()
    86 .getRowPosition();
    87 final List<TableRow> tableRows = TableExtensions
    88 .getTableRows(table);
    89 return TableRowExtensions.getLeadingObjectGuid(
    90 tableRows.get(rowPosition));
    91 }
    92
    93 });
  • 63 return popupMenu;
    64 }
    65
    66 @Override
    67 public void configureUiBindings(final UiBindingRegistry uiBindingRegistry) {
    68 uiBindingRegistry.registerMouseDownBinding(
    69 new MouseEventMatcher(SWT.NONE, GridRegion.BODY,
    70 MouseEventMatcher.RIGHT_BUTTON),
    71 new PopupMenuAction(bodyMenu) {
    72
    73 @Override
    74 public void run(final NatTable natTable,
    75 final MouseEvent event) {
    76 if (selectionLayer.getSelectedCells().isEmpty()) {
    77 return;
    78 }
  • 55 this.selectionLayer = selectionLayer;
    56 this.bodyMenu = createBodyMenu(natTable, menuItems).build();
    57 }
    58
    59 protected static PopupMenuBuilder createBodyMenu(final NatTable natTable,
    60 final Set<IMenuItemProvider> menuItems) {
    61 final PopupMenuBuilder popupMenu = new PopupMenuBuilder(natTable);
    62 menuItems.forEach(popupMenu::withMenuItemProvider);
    63 return popupMenu;
    64 }
    65
    66 @Override
    67 public void configureUiBindings(final UiBindingRegistry uiBindingRegistry) {
    68 uiBindingRegistry.registerMouseDownBinding(
    69 new MouseEventMatcher(SWT.NONE, GridRegion.BODY,
    70 MouseEventMatcher.RIGHT_BUTTON),
  • 55
    56 protected void createShowInTextViewItem(final String label,
    57 final ToolboxEvent toolboxEvent) {
    58 this.menuItems.add(createMenuItem(label, new SelectionAdapter() {
    59 @Override
    60 public void widgetSelected(final SelectionEvent e) {
    61
    62 if (tableBodyMenuConfiguration.selectionLayer.getSelectedCells()
    63 .isEmpty()) {
    64 return;
    65 }
    66 toolboxPartService.showPart(SOURCE_TEXT_VIEWER_PART_ID);
    67 ToolboxEvents.send(broker, toolboxEvent);
    68 }
    69 }));
    70 }
  • Ngoc Quang Truong changed title from Issue #19 (closed) to Issue #19 (closed): Dropdown Menu by Table

    changed title from Issue #19 (closed) to Issue #19 (closed): Dropdown Menu by Table

  • Ngoc Quang Truong added 10 commits

    added 10 commits

    Compare with previous version

  • Please register or sign in to reply
    Loading