Java Code Examples for org.eclipse.swt.widgets.TableColumn#addSelectionListener()
The following examples show how to use
org.eclipse.swt.widgets.TableColumn#addSelectionListener() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MedicationViewerHelper.java From elexis-3-core with Eclipse Public License 1.0 | 6 votes |
public static TableViewerColumn createDosageColumn(TableViewer viewer, TableColumnLayout layout, int columnIndex){ TableViewerColumn ret = new TableViewerColumn(viewer, SWT.NONE); ret.setLabelProvider(new MedicationCellLabelProvider() { @Override public String getText(Object element){ MedicationTableViewerItem pres = (MedicationTableViewerItem) element; String dosis = pres.getDosis(); return (dosis.equals(StringConstants.ZERO) ? Messages.MedicationComposite_stopped : dosis); } }); TableColumn tblclmnDosage = ret.getColumn(); tblclmnDosage.setToolTipText(Messages.TherapieplanComposite_tblclmnDosage_toolTipText); tblclmnDosage.addSelectionListener(getSelectionAdapter(viewer, tblclmnDosage, columnIndex)); layout.setColumnData(tblclmnDosage, new ColumnPixelData(60, true, true)); ret.getColumn().setText(Messages.TherapieplanComposite_tblclmnDosage_text); return ret; }
Example 2
Source File: BuyOrderTableViewer.java From offspring with MIT License | 6 votes |
private void createColumns() { for (int id : BuyOrderTable.getColumns()) { TableViewerColumn viewerColumn = new TableViewerColumn(this, SWT.NONE); TableColumn column = viewerColumn.getColumn(); viewerColumn.setEditingSupport(new BuyOrderEditingSupport(this, id)); viewerColumn.setLabelProvider(BuyOrderTable.createLabelProvider(id)); column.addSelectionListener(getSelectionAdapter(column, id)); column.setText(BuyOrderTable.getColumnLabel(id)); column.setAlignment(BuyOrderTable.getColumnAlignment(id)); column.setResizable(BuyOrderTable.getColumnResizable(id)); column.setWidth(BuyOrderTable.getColumnWidth(id)); } }
Example 3
Source File: MedicationViewerHelper.java From elexis-3-core with Eclipse Public License 1.0 | 6 votes |
public static TableViewerColumn createStopColumn(TableViewer viewer, TableColumnLayout layout, int columnIndex){ TableViewerColumn ret = new TableViewerColumn(viewer, SWT.CENTER); TableColumn tblclmnStop = ret.getColumn(); ColumnPixelData stopColumnPixelData = new ColumnPixelData(60, true, true); layout.setColumnData(tblclmnStop, stopColumnPixelData); tblclmnStop.setImage(Images.resize(Images.IMG_ARROWSTOP_WO_SHADOW.getImage(), ImageSize._12x12_TableColumnIconSize)); tblclmnStop.setToolTipText(Messages.MedicationComposite_column_sortBy + " " + Messages.MedicationComposite_column_endDate); tblclmnStop.addSelectionListener(getSelectionAdapter(viewer, tblclmnStop, columnIndex)); ret.setLabelProvider(new MedicationCellLabelProvider() { @Override public String getText(Object element){ MedicationTableViewerItem pres = (MedicationTableViewerItem) element; if (pres.getEntryType() != EntryType.RECIPE && pres.getEntryType() != EntryType.SELF_DISPENSED) { return pres.getEndDate(); } return ""; } }); return ret; }
Example 4
Source File: EdgeDisplayTableControl.java From depan with Apache License 2.0 | 5 votes |
private void configSorters(Table table) { int index = 0; for (TableColumn column : table.getColumns()) { final int colIndex = index++; column.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { updateSortColumn((TableColumn) event.widget, colIndex); } }); } }
Example 5
Source File: TableSorter.java From Flashtool with GNU General Public License v3.0 | 5 votes |
private void addColumnSelectionListener(TableColumn column) { column.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { tableColumnClicked((TableColumn) e.widget); } }); }
Example 6
Source File: TableColumnSorter.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
public TableColumnSorter(TableViewer viewer) { this.viewer = viewer; Assert.isTrue(this.viewer.getComparator() == null); viewer.setComparator(this); for (TableColumn tableColumn : viewer.getTable().getColumns()) { tableColumn.addSelectionListener(selectionHandler); } }
Example 7
Source File: PopulationInspectView.java From gama with GNU General Public License v3.0 | 5 votes |
private TableViewerColumn createTableViewerColumn(final String title, final int bound, final int colNumber) { final TableViewerColumn viewerColumn = new TableViewerColumn(viewer, SWT.NONE); final TableColumn column = viewerColumn.getColumn(); column.setText(title); column.setWidth(bound); column.setResizable(true); column.setMoveable(true); column.addSelectionListener(getSelectionAdapter(column, title)); viewerColumn.setLabelProvider(getColumnLabelProvider(title)); return viewerColumn; }
Example 8
Source File: MultiPageCSVEditor.java From gama with GNU General Public License v3.0 | 5 votes |
/** * @param column * @param index */ void addMenuItemToColumn(final TableColumn column, final int index) { // Setting the right sorter column.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { int dir = tableViewer.getTable().getSortDirection(); switch (dir) { case SWT.UP: dir = SWT.DOWN; break; case SWT.DOWN: dir = SWT.NONE; break; case SWT.NONE: dir = SWT.UP; break; } tableSorter.setColumn(index, dir); tableViewer.getTable().setSortDirection(dir); if (dir == SWT.NONE) { tableViewer.getTable().setSortColumn(null); } else { tableViewer.getTable().setSortColumn(column); } tableViewer.refresh(); } }); }
Example 9
Source File: RelationSetTableControl.java From depan with Apache License 2.0 | 5 votes |
private void configSorters(Table table) { int index = 0; for (TableColumn column : table.getColumns()) { final int colIndex = index++; column.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { updateSortColumn((TableColumn) event.widget, colIndex); } }); } }
Example 10
Source File: RelationDisplayTableControl.java From depan with Apache License 2.0 | 5 votes |
private void configSorters(Table table) { int index = 0; for (TableColumn column : table.getColumns()) { final int colIndex = index++; column.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { updateSortColumn((TableColumn) event.widget, colIndex); } }); } }
Example 11
Source File: TextTemplateView.java From elexis-3-core with Eclipse Public License 1.0 | 5 votes |
private TableViewerColumn createTableViewerColumn(String title, int bound, final int colNumber){ final TableViewerColumn viewerColumn = new TableViewerColumn(tableViewer, SWT.NONE); final TableColumn column = viewerColumn.getColumn(); tableLayout.setColumnData(column, new ColumnWeightData(bound, ColumnWeightData.MINIMUM_WIDTH, true)); column.setText(title); column.setResizable(true); column.setMoveable(false); column.addSelectionListener(getSelectionAdapter(column, colNumber)); return viewerColumn; }
Example 12
Source File: NodeKindTableControl.java From depan with Apache License 2.0 | 5 votes |
private void configSorters(Table elementKindTable) { TableColumn[] columns = elementKindTable.getColumns(); int index = 0; for (TableColumn column : columns) { final int colIndex = index++; column.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { updateSortColumn((TableColumn) event.widget, colIndex); } }); } }
Example 13
Source File: DefinesViewer.java From cmake4eclipse with Eclipse Public License 2.0 | 5 votes |
/** * Creates a table viewer column for the table. */ private TableViewerColumn createTableViewerColumn(final TableViewer viewer, String title, int colWidth, final int colNumber) { final TableViewerColumn viewerColumn = new TableViewerColumn(viewer, SWT.NONE); final TableColumn column = viewerColumn.getColumn(); column.setText(title); column.setWidth(colWidth); column.setResizable(true); column.setMoveable(true); column.addSelectionListener(createSelectionAdapter(column, colNumber)); return viewerColumn; }
Example 14
Source File: TableViewerSorter.java From elexis-3-core with Eclipse Public License 1.0 | 5 votes |
private void addColumnSelectionListener(TableColumn column){ column.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e){ tableColumnClicked((TableColumn) e.widget); } }); }
Example 15
Source File: StateSpaceLabelProvider.java From tlaplus with MIT License | 5 votes |
/** * @param stateTable */ void createTableColumns(final Table stateTable, final ResultPage page, final TableColumnLayout layout) { for (int i = 0; i < COLUMN_TITLES.length; i++) { final TableColumn column = new TableColumn(stateTable, SWT.NULL); column.setWidth(COLUMN_WIDTHS[i]); column.setText(COLUMN_TITLES[i]); final int weight = (int)(100.0 * COLUMN_WIDTH_PERCENTAGES[i]); layout.setColumnData(column, new ColumnWeightData(weight, COLUMN_WIDTHS[i], true)); // The following statement attaches a listener to the column header. // See the ResultPageColumnListener comments. column.addSelectionListener(new ResultPageColumnListener(i, page)); } }
Example 16
Source File: DetectorConfigurationTab.java From spotbugs with GNU Lesser General Public License v2.1 | 5 votes |
/** * @param sorter * @param column */ private void addColumnSelectionListener(final BugPatternTableSorter sorter, final TableColumn column, final COLUMN columnId) { column.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { sorter.setSortColumnIndex(columnId); Table factoriesTable = availableFactoriesTableViewer.getTable(); factoriesTable.setSortDirection(sorter.revertOrder ? SWT.UP : SWT.DOWN); factoriesTable.setSortColumn(column); availableFactoriesTableViewer.refresh(); } }); }
Example 17
Source File: AbstractNativeHeader.java From nebula with Eclipse Public License 2.0 | 5 votes |
private void initializeColumns() { this.tableColumns = new ArrayList(); for (int i = 0; i < columnLabelStrings.length; i++) { TableColumn column = new TableColumn(headerTable, columnAlignments[i]); column.setMoveable(movable); column.setResizable(resizable); column.setText(columnLabelStrings[i]); this.tableColumns.add(column); column.addControlListener(columnControlListener); column.addSelectionListener(columnSelectionListener); } }
Example 18
Source File: SourceView.java From lapse-plus with GNU General Public License v3.0 | 5 votes |
private void createColumns() { TableLayout layout = new TableLayout(); getTable().setLayout(layout); getTable().setHeaderVisible(true); for (int i = 0; i < columnHeaders.length; i++) { layout.addColumnData(columnLayouts[i]); TableColumn tc = new TableColumn(getTable(), SWT.NONE,i); tc.setResizable(columnLayouts[i].resizable); tc.setText(columnHeaders[i]); final int j = i; tc.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { ViewerSorter oldSorter = viewer.getSorter(); if(oldSorter instanceof ColumnBasedSorter) { ColumnBasedSorter sorter = (ColumnBasedSorter) oldSorter; if(sorter.getColumn() == j) { sorter.toggle(); viewer.refresh(); // System.err.println("Resorting column " + j + " in order " + sorter.getOrientation()); return; } } viewer.setSorter(new ColumnBasedSorter(j)); // System.err.println("Sorting column " + j + " in order " + 1); viewer.refresh(); } }); } }
Example 19
Source File: SearchDialog.java From ermasterr with Apache License 2.0 | 4 votes |
private void createResultGroup(final TabFolder tabFolder) { final TabItem tabItem = new TabItem(tabFolder, SWT.NONE); tabItem.setText(ResourceString.getResourceString("label.search.result")); final GridData gridData = new GridData(); gridData.grabExcessVerticalSpace = true; gridData.verticalAlignment = SWT.FILL; gridData.grabExcessHorizontalSpace = true; gridData.horizontalAlignment = SWT.FILL; resultTable = new Table(tabFolder, SWT.NONE | SWT.FULL_SELECTION | SWT.MULTI); resultTable.setHeaderVisible(true); resultTable.setLayoutData(gridData); resultTable.setLinesVisible(true); resultTable.addSelectionListener(new SelectionAdapter() { /** * {@inheritDoc} */ @Override public void widgetSelected(final SelectionEvent e) { final int index = resultTable.getSelectionIndex(); if (index == -1) { replaceButton.setEnabled(false); replaceCombo.setEnabled(false); } else { replaceButton.setEnabled(true); replaceCombo.setEnabled(true); final SearchResultRow searchResultRow = searchResult.getRows().get(index); final Object object = searchResultRow.getTargetNode(); if (object != null) { focus(object); } } } }); final TableColumn tableColumn0 = new TableColumn(resultTable, SWT.LEFT); tableColumn0.setWidth(250); tableColumn0.setText(ResourceString.getResourceString("label.search.result.table.path")); tableColumn0.addSelectionListener(new SearchResultSortListener(SearchResult.SORT_TYPE_PATH)); final TableColumn tableColumn1 = new TableColumn(resultTable, SWT.LEFT); tableColumn1.setWidth(100); tableColumn1.setText(ResourceString.getResourceString("label.search.result.table.type")); tableColumn1.addSelectionListener(new SearchResultSortListener(SearchResult.SORT_TYPE_TYPE)); final TableColumn tableColumn2 = new TableColumn(resultTable, SWT.LEFT); tableColumn2.setWidth(200); tableColumn2.setText(ResourceString.getResourceString("label.search.result.table.name")); tableColumn2.addSelectionListener(new SearchResultSortListener(SearchResult.SORT_TYPE_NAME)); final TableColumn tableColumn3 = new TableColumn(resultTable, SWT.LEFT); tableColumn3.setWidth(200); tableColumn3.setText(ResourceString.getResourceString("label.search.result.table.value")); tableColumn3.addSelectionListener(new SearchResultSortListener(SearchResult.SORT_TYPE_VALUE)); tabItem.setControl(resultTable); }
Example 20
Source File: GenerericTableViewer.java From offspring with MIT License | 4 votes |
private void createColumns() { GC gc = new GC(getTable().getParent()); List<Integer> widths = new ArrayList<Integer>(); for (final IGenericTableColumn c : table.getColumns()) { TableViewerColumn viewerColumn = new TableViewerColumn(this, SWT.NONE); viewerColumn.setLabelProvider(new GenericLabelProvider(c .getDataProvider())); if (c.getEditable()) { viewerColumn.setEditingSupport(c.getEditingSupport(this)); } TableColumn column = viewerColumn.getColumn(); if (c.getSortable() && comparator != null) { column.addSelectionListener(getSelectionAdapter(column, c)); } column.setText(c.getLabel()); column.setAlignment(c.getAlignMent()); int width; if (c.getWidth() != -1) { width = c.getWidth(); } else if (c.getTextExtent() != null && c.getLabel().length() < c.getTextExtent().length()) { width = gc.textExtent(c.getTextExtent()).x + 2; } else { width = gc.textExtent(c.getLabel()).x + 2; } widths.add(width); column.setWidth(width); column.setResizable(c.getResizable()); } gc.dispose(); /* All columns have their prefered width set now calculate percentages */ TableColumnLayout layout = new TableColumnLayout(); for (int i = 0; i < widths.size(); i++) { layout.setColumnData(getTable().getColumns()[i], new ColumnWeightData( widths.get(i), widths.get(i), true)); } getTable().getParent().setLayout(layout); }