@Override protected TableViewer createViewer(final Composite parent, final AbstractColumnLayout columnLayout, final int style) { final TableViewer viewer = new TableViewer(parent, style); final Table table = viewer.getTable(); table.setLinesVisible(linesVisible); table.setHeaderVisible(headerVisible); int columnIndex = 0; for (final String columnLabel : columnLabels) { final TableViewerColumn viewerColumn = new TableViewerColumn(viewer, NONE); final TableColumn column = viewerColumn.getColumn(); columnLayout.setColumnData(column, createColumnLayoutData(columnIndex)); column.setText(columnLabel); column.setMoveable(moveable); columnIndex++; } return viewer; }
protected Section createTableSection(ScrolledForm form, Composite client, FormToolkit toolkit, String title, Image image, int sectionStyle, int tableStyle, String[] columnTitles, int[] columnAlignments) { Section section = createSection(form, client, toolkit, title, image, sectionStyle); Table table = toolkit.createTable(section, tableStyle); for (int i = 0; i < columnTitles.length; i++) { TableColumn column = new TableColumn(table, SWT.NONE); column.setText(columnTitles[i]); column.setAlignment(columnAlignments[i]); } table.setHeaderVisible(true); table.setLinesVisible(true); section.setClient(table); return section; }
protected void packTable(Table table, int[] columnWidths) { if (table == null) { return; } table.pack(); TableColumn[] columns = table.getColumns(); for (int i = 0; i < columns.length; i++) { int columnWidth = columnWidths[i]; if (columnWidth == SWT.DEFAULT) { columns[i].pack(); } else { columns[i].setWidth(columnWidth); } } }
@Override public void packTable(Table table) { table.pack(); TableColumn[] columns = table.getColumns(); int[] columnWidths = getColumnWidths(); for (int i = 0; i < columns.length; i++) { int columnWidth = columnWidths[i]; if (columnWidth == SWT.DEFAULT) { columns[i].pack(); } else { columns[i].setWidth(columnWidth); } } }
private void fixLayout() { Table table = getTable(); // HACK to get the removed item to disappear. table.pack(); layout(true); int[] columnWidths = TABLE_COLUMN_WIDTHS; TableColumn[] columns = table.getColumns(); for (int i = 0; i < columns.length; i++) { if (columnWidths == null) { columns[i].pack(); } else { int columnWidth = columnWidths[i]; if (columnWidth == SWT.DEFAULT) { columns[i].pack(); } else { columns[i].setWidth(columnWidth); } } } }
protected void createTableColumns() { Table table = getTable(); if (table == null) { return; } String[] titles = getTableColumnTitles(); if (titles != null && titles.length > 0) { int[] columnAlignments = getTableColumnAlignments(); for (int i = 0; i < titles.length; i++) { TableColumn column = new TableColumn(table, SWT.NONE); column.setText(titles[i]); if (columnAlignments != null) { column.setAlignment(columnAlignments[i]); } } table.setHeaderVisible(true); } }
@Override public void widgetSelected ( final SelectionEvent e ) { final Table table = this.tableViewer.getTable (); final TableColumn newColumn = (TableColumn)e.widget; final TableColumn currentColumn = table.getSortColumn (); final int currentDir = table.getSortDirection (); int newDir = SWT.UP; if ( newColumn == currentColumn ) { newDir = currentDir == SWT.UP ? SWT.DOWN : SWT.UP; } else { table.setSortColumn ( newColumn ); } table.setSortDirection ( newDir ); this.tableViewer.setSorter ( new Sorter ( (Columns)newColumn.getData ( COLUMN_KEY ), newDir ) ); }
@Override public void widgetSelected ( final SelectionEvent e ) { final Table table = this.tableViewer.getTable (); final TableColumn newColumn = (TableColumn)e.widget; final TableColumn currentColumn = table.getSortColumn (); final EventTableColumn column = (EventTableColumn)newColumn.getData ( COLUMN_KEY ); if ( column == EventTableColumn.reservedColumnSourceTimestamp || column == EventTableColumn.reservedColumnEntryTimestamp ) { final int currentDir = table.getSortDirection (); int newDir = SWT.UP; if ( newColumn == currentColumn ) { newDir = currentDir == SWT.UP ? SWT.DOWN : SWT.UP; } else { table.setSortColumn ( newColumn ); } table.setSortDirection ( newDir ); this.tableViewer.setSorter ( new EventTableSorter ( column, newDir ) ); } }
@Override public void createPartControl ( final Composite parent ) { addListener (); parent.setLayout ( new FillLayout () ); this.table = new Table ( parent, SWT.FULL_SELECTION ); this.table.setHeaderVisible ( true ); this.indexCol = new TableColumn ( this.table, SWT.NONE ); this.indexCol.setText ( Messages.QueryDataView_ColIndex ); this.indexCol.setWidth ( 50 ); this.qualityCol = new TableColumn ( this.table, SWT.NONE ); this.qualityCol.setText ( Messages.QueryDataView_ColQuality ); this.qualityCol.setWidth ( 75 ); this.manualCol = new TableColumn ( this.table, SWT.NONE ); this.manualCol.setText ( Messages.QueryDataView_ColManual ); this.manualCol.setWidth ( 75 ); this.invalidColor = JFaceColors.getErrorBackground ( getDisplay () ); }
private void clearDataSize () { this.table.clearAll (); for ( final TableColumn col : this.columns.values () ) { col.dispose (); } this.columns.clear (); if ( this.countCol != null ) { this.countCol.dispose (); this.countCol = null; } if ( this.infoCol != null ) { this.infoCol.dispose (); this.infoCol = null; } }
protected void createColumns ( final Table table ) { final TableColumn typeFilterColumn = new TableColumn ( table, SWT.NONE ); typeFilterColumn.setText ( getString ( "_UI_TypeFilterColumn_label" ) ); //$NON-NLS-1$ typeFilterColumn.setResizable ( true ); typeFilterColumn.setWidth ( 200 ); final TableColumn idFilterColumn = new TableColumn ( table, SWT.NONE ); idFilterColumn.setText ( getString ( "_UI_IdFilterColumn_label" ) ); //$NON-NLS-1$ idFilterColumn.setResizable ( true ); idFilterColumn.setWidth ( 200 ); final TableColumn actionFilterColumn = new TableColumn ( table, SWT.NONE ); actionFilterColumn.setText ( getString ( "_UI_ActionFilterColumn_label" ) ); //$NON-NLS-1$ actionFilterColumn.setResizable ( true ); actionFilterColumn.setWidth ( 200 ); }
public static void handleEvent(Event event) { Table table = (Table) event.widget; int columnCount = table.getColumnCount(); if (columnCount == 0) return; Rectangle area = table.getClientArea(); int totalAreaWdith = area.width; int lineWidth = table.getGridLineWidth(); int totalGridLineWidth = (columnCount - 1) * lineWidth; int totalColumnWidth = 0; for (TableColumn column : table.getColumns()) { totalColumnWidth = totalColumnWidth + column.getWidth(); } int diff = totalAreaWdith - (totalColumnWidth + totalGridLineWidth); TableColumn lastCol = table.getColumns()[columnCount - 1]; lastCol.setWidth(diff + lastCol.getWidth()); }
private void createSourceTable(SashForm sashForm) { avaliableFieldTableViewer = new TableViewer(sashForm, SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION); table_1 = avaliableFieldTableViewer.getTable(); table_1.setLinesVisible(true); table_1.setHeaderVisible(true); avaliableFieldTableViewer.setContentProvider(new IStructuredContentProvider() { @Override public Object[] getElements(Object inputElement) { return ((List) inputElement).toArray(); } }); avaliableFieldTableViewer.setInput(schemaFields); TableViewerColumn tableViewerColumn_2 = new TableViewerColumn(avaliableFieldTableViewer, SWT.NONE); TableColumn tblclmnNewColumn_2 = tableViewerColumn_2.getColumn(); tblclmnNewColumn_2.setWidth(196); tblclmnNewColumn_2.setText(Messages.AVAILABLE_FIELDS_HEADER); tableViewerColumn_2.setLabelProvider(new ColumnLabelProvider()); attachDragListener(); }
private TableViewer createTableColumns(Composite tableComposite) { TableViewer tableViewer = new TableViewer(tableComposite, SWT.BORDER | SWT.FULL_SELECTION); excelFormatterTable = tableViewer.getTable(); excelFormatterTable.setHeaderVisible(true); excelFormatterTable.setLinesVisible(true); excelFormatterTable.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); TableViewerColumn tableViewerColumn = new TableViewerColumn(tableViewer, SWT.NONE); TableColumn parameterNameColumn = tableViewerColumn.getColumn(); parameterNameColumn.setWidth(254); parameterNameColumn.setText(Messages.PARAMETER_NAME); tableViewerColumn.setLabelProvider(new ParameterNameLabelProvider()); TableViewerColumn tableViewerColumn_1 = new TableViewerColumn(tableViewer, SWT.NONE); TableColumn parameterValueColumn = tableViewerColumn_1.getColumn(); parameterValueColumn.setWidth(251); parameterValueColumn.setText(Messages.PARAMETER_VALUE); tableViewerColumn_1.setLabelProvider(new ParameterValueLabelProvider()); return tableViewer; }
/** * Arrange the columns size in equal ratio */ private void arrangeTableViewerColumns() { tableViewerComposite.addControlListener(new ControlAdapter() { @Override public void controlResized(ControlEvent e) { int totalWidth = tableViewer.getTable().getColumnCount() * COLUMN_WIDTH; int widthDifference = tableViewerComposite.getSize().x - totalWidth; if (widthDifference > 0) { widthDifference = widthDifference / tableViewer.getTable().getColumnCount(); for (TableColumn tableColumn : tableViewer.getTable().getColumns()) { tableColumn.setWidth(COLUMN_WIDTH+widthDifference); } } } }); }
@Override public void run() { ViewDataPreferencesVO viewDataPreferencesVO = debugDataViewer.getViewDataPreferences(); delimiter = viewDataPreferencesVO.getDelimiter(); quoteCharactor = viewDataPreferencesVO.getQuoteCharactor(); headerEnabled = viewDataPreferencesVO.getIncludeHeaders(); TableViewer tableViewer = debugDataViewer.getTableViewer(); List<RowData> eachRowData = getListOfRowData(tableViewer); List<String[]> exportedfileDataList = new ArrayList<String[]>(); TableColumn[] columns = tableViewer.getTable().getColumns(); if (headerEnabled != null) { addHeadersInList(tableViewer, exportedfileDataList, columns); } addRowsDataInList(tableViewer, eachRowData, exportedfileDataList); FileDialog fileDialog = new FileDialog(Display.getDefault().getActiveShell(), SWT.SAVE); String filePath = getPathOfFileDialog(fileDialog); writeDataInFile(exportedfileDataList, filePath); }
/** * Create contents of the wizard. * * @param parent */ public void createControl(Composite parent) { Composite container = new Composite(parent, SWT.NULL); setControl(container); container.setLayout(new GridLayout(1, false)); TableViewer tableViewer = new TableViewer(container, SWT.BORDER | SWT.FULL_SELECTION); table = tableViewer.getTable(); table.setLinesVisible(true); table.setHeaderVisible(true); table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); tableViewer.setContentProvider(ArrayContentProvider.getInstance()); tableViewer.setInput(candidateList); tableViewer.setLabelProvider(new MarkerColumn()); // auto size columns TableColumn[] columns = tableViewer.getTable().getColumns(); for (int i = 0; i < columns.length; i++) { columns[i].pack(); } }
private void createColumns(final TableViewer tableViewer) { final String[] titles = { "Icon", "Name", "Small", "Medium", "Large", "Source", "Class" }; final int[] bounds = { 40, 200, 60, 60, 60, 200, 200 }; for (int i = 0; i < titles.length; i++) { final TableViewerColumn viewerColumn = new TableViewerColumn(tableViewer, SWT.NONE); tableViewer.setSorter(new TableViewerSorter(titles)); viewerColumn.setLabelProvider(new TableCellLabelProvider()); final TableColumn column = viewerColumn.getColumn(); column.addSelectionListener(new ColumnSelectionListener(column, tableViewer)); column.setText(titles[i]); column.setWidth(bounds[i]); column.setResizable(true); column.setMoveable(false); } final Table table = tableViewer.getTable(); table.setHeaderVisible(true); table.setLinesVisible(true); ColumnViewerToolTipSupport.enableFor(tableViewer, ToolTip.RECREATE); }
@Override public void widgetSelected(final SelectionEvent e) { final Table table = this.column.getParent(); final TableColumn sortColumn = table.getSortColumn(); if (sortColumn == null || !sortColumn.equals(this.column)) { table.setSortColumn(this.column); table.setSortDirection(SWT.NONE); } switch (table.getSortDirection()) { case SWT.NONE: { table.setSortDirection(SWT.DOWN); break; } case SWT.DOWN: { table.setSortDirection(SWT.UP); break; } case SWT.UP: { table.setSortDirection(SWT.NONE); break; } } this.viewer.refresh(); }
private void createColumns(final TableViewer tableViewer) { final String[] titles = { "Relation", "Type", "Name" }; final int[] bounds = { 120, 100, 200 }; for (int i = 0; i < titles.length; i++) { final TableViewerColumn viewerColumn = new TableViewerColumn(tableViewer, SWT.NONE); tableViewer.setSorter(new TableViewerSorter(titles)); viewerColumn.setLabelProvider(new TableCellLabelProvider()); final TableColumn column = viewerColumn.getColumn(); column.addSelectionListener(new ColumnSelectionListener(column, tableViewer)); column.setText(titles[i]); column.setWidth(bounds[i]); column.setResizable(true); column.setMoveable(false); } final Table table = tableViewer.getTable(); table.setHeaderVisible(true); table.setLinesVisible(true); ColumnViewerToolTipSupport.enableFor(tableViewer, ToolTip.RECREATE); // Object[] projectsToSelect = openProjects.toArray(); // IViewPart view = window.getActivePage().showView( "org.eclipse.jdt.ui.PackageExplorer" ); // view.getSite().getSelectionProvider().setSelection( new StructuredSelection( projectsToSelect ) ); }
@Override public String getColumnText(Object element, int columnIndex) { //logger.trace("get column text: "+element+" id: "+columnIndex); if (element instanceof TrpHtr) { TrpHtr htr = (TrpHtr) element; TableColumn column = table.getColumn(columnIndex); String ct = column.getText(); if (ct.equals(HtrTableWidget.HTR_NAME_COL)) { return htr.getName(); } else if (ct.equals(HtrTableWidget.HTR_LANG_COL)) { return htr.getLanguage(); } else if (ct.equals(HtrTableWidget.HTR_ID_COL)) { return ""+htr.getHtrId(); } else if (ct.equals(HtrTableWidget.HTR_CREATOR_COL)) { return htr.getUserName() == null ? "Unknown" : htr.getUserName(); } } return "i am error"; }
private void createColumns(final TableViewer tableViewer) { final String[] titles = { "Class" }; final int[] bounds = { 120, 100, 200 }; for (int i = 0; i < titles.length; i++) { final TableViewerColumn viewerColumn = new TableViewerColumn(tableViewer, SWT.NONE); tableViewer.setSorter(new TableViewerSorter(titles)); viewerColumn.setLabelProvider(new TableCellLabelProvider()); final TableColumn column = viewerColumn.getColumn(); column.addSelectionListener(new ColumnSelectionListener(column, tableViewer)); column.setText(titles[i]); column.setWidth(bounds[i]); column.setResizable(true); column.setMoveable(false); } final Table table = tableViewer.getTable(); table.setHeaderVisible(true); table.setLinesVisible(true); ColumnViewerToolTipSupport.enableFor(tableViewer, ToolTip.RECREATE); }
@Override public String getColumnText(Object element, int columnIndex) { //logger.trace("get column text: "+element+" id: "+columnIndex); if (element instanceof TrpKwsHit) { TrpKwsHit hit = (TrpKwsHit) element; TableColumn column = table.getColumn(columnIndex); String ct = column.getText(); if (ct.equals(KwsHitTableWidget.KWS_CONF_COL)) { return DF.format(hit.getConfidence()); } else if (ct.equals(KwsHitTableWidget.KWS_PAGE_COL)) { return ""+hit.getPageNr(); } else if (ct.equals(KwsHitTableWidget.KWS_TEXT_COL)) { return hit.getTranscription(); } else if (ct.equals(KwsHitTableWidget.KWS_PREVIEW_COL)) { if(!icons.containsKey(hit)) { return "Loading..."; } else { return ""; } } } return "i am error"; }
private void addColumns() { // Columns final TableLayout mergeTableLayout = new TableLayout(); table.setLayout(mergeTableLayout); mergeTableLayout.addColumnData(new ColumnWeightData(15, 10, true)); final TableColumn changesetTableColumn = new TableColumn(table, SWT.NONE); changesetTableColumn.setText(Messages.getString("SelectChangesetsWizardPage.ColumnNameChangeset")); //$NON-NLS-1$ mergeTableLayout.addColumnData(new ColumnWeightData(25, 10, true)); final TableColumn changeTableColumn = new TableColumn(table, SWT.NONE); changeTableColumn.setText(Messages.getString("SelectChangesetsWizardPage.ColumnNameDate")); //$NON-NLS-1$ mergeTableLayout.addColumnData(new ColumnWeightData(15, 10, true)); final TableColumn userTableColumn = new TableColumn(table, SWT.NONE); userTableColumn.setText(Messages.getString("SelectChangesetsWizardPage.ColumnNameUser")); //$NON-NLS-1$ mergeTableLayout.addColumnData(new ColumnWeightData(35, 10, true)); final TableColumn commentTableColumn = new TableColumn(table, SWT.FILL); commentTableColumn.setText(Messages.getString("SelectChangesetsWizardPage.ColumnNameComment")); //$NON-NLS-1$ }
private void createTableColumns(final Table table) { final TableColumn column1 = new TableColumn(table, SWT.NONE); column1.setText(Messages.getString("WorkItemList.ColumnNameType")); //$NON-NLS-1$ column1.setResizable(true); final TableColumn column2 = new TableColumn(table, SWT.NONE); column2.setText(Messages.getString("WorkItemList.ColumnNameId")); //$NON-NLS-1$ column2.setResizable(true); final TableColumn column3 = new TableColumn(table, SWT.NONE); column3.setText(Messages.getString("WorkItemList.ColumnNameTitle")); //$NON-NLS-1$ column3.setResizable(true); final TableColumn column4 = new TableColumn(table, SWT.NONE); column4.setText(Messages.getString("WorkItemList.ColumnNameState")); //$NON-NLS-1$ column4.setResizable(true); if (forHistoryDetails == false) { final TableColumn column5 = new TableColumn(table, SWT.NONE); column5.setText(Messages.getString("WorkItemList.ColumnNameAction")); //$NON-NLS-1$ column5.setResizable(true); } }
private void createTableColumns(final Table table) { final TableLayout tableLayout = new TableLayout(); table.setLayout(tableLayout); tableLayout.addColumnData(new ColumnWeightData(5, true)); final TableColumn column1 = new TableColumn(table, SWT.NONE); column1.setText(Messages.getString("BranchesPropertiesControl.ColumNameFileName")); //$NON-NLS-1$ column1.setResizable(true); tableLayout.addColumnData(new ColumnWeightData(3, true)); final TableColumn column2 = new TableColumn(table, SWT.NONE); column2.setText(Messages.getString("BranchesPropertiesControl.ColumnNameChange")); //$NON-NLS-1$ column2.setResizable(true); tableLayout.addColumnData(new ColumnWeightData(1, true)); final TableColumn column3 = new TableColumn(table, SWT.NONE); column3.setText(Messages.getString("BranchesPropertiesControl.ColumnNameBranchedFrom")); //$NON-NLS-1$ column3.setResizable(true); }
private void createTableColumns(final Table table) { final TableLayout tableLayout = new TableLayout(); table.setLayout(tableLayout); tableLayout.addColumnData(new ColumnWeightData(1, true)); final TableColumn column1 = new TableColumn(table, SWT.NONE); column1.setText(Messages.getString("StatusPropertiesTab.ColumNameUser")); //$NON-NLS-1$ column1.setResizable(true); tableLayout.addColumnData(new ColumnWeightData(1, true)); final TableColumn column2 = new TableColumn(table, SWT.NONE); column2.setText(Messages.getString("StatusPropertiesTab.ChangeNameChangeType")); //$NON-NLS-1$ column2.setResizable(true); tableLayout.addColumnData(new ColumnWeightData(1, true)); final TableColumn column3 = new TableColumn(table, SWT.NONE); column3.setText(Messages.getString("StatusPropertiesTab.ColumnNameWorkspace")); //$NON-NLS-1$ column3.setResizable(true); }
/** * Defines what columns the drop down table will have. * * @param columnHeaders * @param columnBounds */ private void defineColumnsInternal(String[] columnHeaders, int[] columnBounds, int totalColumnsToBeCreated) { checkWidget(); int totalColumnHeaders = columnHeaders == null ? 0 : columnHeaders.length; int totalColBounds = columnBounds == null ? 0 : columnBounds.length; if (totalColumnsToBeCreated > 0) { for (int index = 0; index < totalColumnsToBeCreated; index++) { TableColumn column = new TableColumn(table, SWT.NONE); if (index < totalColumnHeaders) { column.setText(columnHeaders[index]); } if (index < totalColBounds) { column.setWidth(columnBounds[index]); } column.setResizable(true); column.setMoveable(true); } } }
@Override public Color getForeground(Object element, int columnIndex) { if (element instanceof TrpJobStatus) { TrpJobStatus job = (TrpJobStatus) element; TableColumn column = table.getColumn(columnIndex); String ct = column.getText(); if (ct.equals(JobOverviewWidget.STATE_COL)) { if (job.getState().equals(TrpJobStatus.FINISHED)) { return Colors.getSystemColor(SWT.COLOR_DARK_GREEN); } else if (job.getState().equals(TrpJobStatus.FAILED)) { return Colors.getSystemColor(SWT.COLOR_RED); } else { return Colors.getSystemColor(SWT.COLOR_DARK_YELLOW); } } } return null; }
/** * Called to set the column and direction decorations on the specified * {@link Table}. Subclasses may override. The base class implementation * uses reflection to attempt to call the <code>setSortColumn</code> and * <code>setSortDirection</code> methods that were added in Eclipse 3.2. * * @param table * the {@link Table} to decorate * @param sortColumn * the column that should be marked as the sort column * @param direction * the direction ({@link SWT#UP} or {@link SWT#DOWN}) to use in the * decoration */ protected void setSortColumnAndDirection(final Table table, final TableColumn sortColumn, final int direction) { try { final Class tableClass = table.getClass(); final Method setSortColumn = tableClass.getMethod("setSortColumn", new Class[] //$NON-NLS-1$ { TableColumn.class }); final Method setSortDirection = tableClass.getMethod("setSortDirection", new Class[] //$NON-NLS-1$ { Integer.TYPE }); setSortColumn.invoke(table, new Object[] { sortColumn }); setSortDirection.invoke(table, new Object[] { new Integer(direction) }); } catch (final Exception e) { } }
/** * Restores table column widths. Users of this class should have already * added some mappings before calling this method. Any persisted widths * whose keys do not correspond to indices into the {@link Table}'s columns * will be ignored. */ public void restore() { final Preferences node = getPreferencesNode(key); for (final Iterator it = mappings.keySet().iterator(); it.hasNext();) { final String columnKey = (String) it.next(); final int ix = getIndexForKey(columnKey); if (ix == -1) { continue; } final TableColumn tableColumn = table.getColumn(ix); final int persistedWidth = node.getInt(columnKey, -1); if (persistedWidth != -1) { tableColumn.setWidth(persistedWidth); } } }
@Override public String getColumnText(Object element, int columnIndex) { //logger.trace("get column text: "+element+" id: "+columnIndex); if (element instanceof TrpKwsResultTableEntry) { TrpKwsResultTableEntry res = (TrpKwsResultTableEntry) element; TableColumn column = table.getColumn(columnIndex); String ct = column.getText(); if (ct.equals(KwsResultTableWidget.KWS_CREATED_COL)) { return CoreUtils.DATE_FORMAT_USER_FRIENDLY.format(res.getCreated()); } else if (ct.equals(KwsResultTableWidget.KWS_STATUS_COL)) { return res.getStatus(); } else if (ct.equals(KwsResultTableWidget.KWS_SCOPE_COL)) { return res.getScope(); } else if (ct.equals(KwsResultTableWidget.KWS_DURATION_COL)) { return res.getDuration(); } else if (ct.equals(KwsResultTableWidget.KWS_QUERY_COL)) { return res.getQuery(); } } return "i am error"; }
@Override public String getColumnText(Object element, int columnIndex) { if (element instanceof EdFeature) { EdFeature feat = (EdFeature) element; TableColumn column = table.getColumn(columnIndex); String ct = column.getText(); if (ct.equals(EditDeclManagerDialog.FEAT_TITLE_COL)) { return feat.getTitle(); } else if (ct.equals(EditDeclManagerDialog.FEAT_DESC_COL)) { return feat.getDescription(); } else if (ct.equals(EditDeclManagerDialog.FEAT_ID_COL)) { return ""+feat.getFeatureId(); } else if (ct.equals(EditDeclManagerDialog.FEAT_COL_ID_COL)) { final Integer colId = feat.getColId(); if(colId != null){ return ""+feat.getColId(); } else { return "preset"; } } } return "i am error"; }
private void initTable(Composite parent) { GridData gridData = new GridData(); gridData.horizontalSpan = 3; gridData.grabExcessHorizontalSpace = true; gridData.horizontalAlignment = GridData.FILL; gridData.heightHint = 200; this.indexTable = new Table(parent, SWT.BORDER | SWT.HIDE_SELECTION); this.indexTable.setHeaderVisible(true); this.indexTable.setLayoutData(gridData); this.indexTable.setLinesVisible(true); CompositeFactory.createTableColumn(this.indexTable, "label.column.name", -1); TableColumn separatorColumn = CompositeFactory.createTableColumn( this.indexTable, "", 3); separatorColumn.setResizable(false); }
private void createComparisonTable(final Composite composite) { final GridData tableGridData = new GridData(); tableGridData.horizontalSpan = 2; tableGridData.heightHint = 100; tableGridData.horizontalAlignment = GridData.FILL; tableGridData.grabExcessHorizontalSpace = true; comparisonTable = new Table(composite, SWT.SINGLE | SWT.BORDER | SWT.FULL_SELECTION); comparisonTable.setLayoutData(tableGridData); comparisonTable.setHeaderVisible(true); comparisonTable.setLinesVisible(true); composite.pack(); final int width = comparisonTable.getBounds().width; final TableColumn referencedColumn = new TableColumn(comparisonTable, SWT.NONE); referencedColumn.setWidth(width / 2); referencedColumn.setText(ResourceString.getResourceString("label.reference.column")); final TableColumn foreignKeyColumn = new TableColumn(comparisonTable, SWT.NONE); foreignKeyColumn.setWidth(width / 2); foreignKeyColumn.setText(ResourceString.getResourceString("label.foreign.key")); }
private void initTable(final Composite parent) { final GridData gridData = new GridData(); gridData.horizontalSpan = 3; gridData.grabExcessHorizontalSpace = true; gridData.horizontalAlignment = GridData.FILL; gridData.heightHint = 200; indexTable = new Table(parent, SWT.BORDER | SWT.HIDE_SELECTION); indexTable.setHeaderVisible(true); indexTable.setLayoutData(gridData); indexTable.setLinesVisible(true); CompositeFactory.createTableColumn(indexTable, "label.column.name", -1); final TableColumn separatorColumn = CompositeFactory.createTableColumn(indexTable, "", 3); separatorColumn.setResizable(false); }
@Override public String getColumnText(Object element, int columnIndex) { if (element instanceof EdFeature) { EdFeature feat = (EdFeature) element; TableColumn column = table.getColumn(columnIndex); String ct = column.getText(); if (ct.equals(EditDeclManagerDialog.EDT_DECL_TITLE_COL)) { return feat.getTitle(); } else if (ct.equals(EditDeclManagerDialog.EDT_DECL_DESC_COL)) { return feat.getDescription(); } else if (ct.equals(EditDeclManagerDialog.EDT_DECL_ID_COL)) { return ""+feat.getFeatureId(); } else if (ct.equals(EditDeclManagerDialog.EDT_DECL_OPT_COL)) { List<EdOption> opts = feat.getOptions(); for(EdOption o : opts){ // logger.debug(o.getText()); if(o.isSelected()) return o.getText(); } } } return "i am error"; }
private void createTable(final Composite parent) { final GridData gridData = new GridData(); gridData.heightHint = 150; gridData.horizontalSpan = 2; gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; dictionaryTable = new Table(parent, SWT.FULL_SELECTION | SWT.BORDER | SWT.MULTI); dictionaryTable.setHeaderVisible(true); dictionaryTable.setLinesVisible(true); dictionaryTable.setLayoutData(gridData); parent.pack(); final int width = dictionaryTable.getBounds().width; final TableColumn physicalNameTableColumn = new TableColumn(dictionaryTable, SWT.LEFT); physicalNameTableColumn.setText(ResourceString.getResourceString("label.physical.name")); physicalNameTableColumn.setWidth(width / 2 - 5); final TableColumn logicalNameTableColumn = new TableColumn(dictionaryTable, SWT.LEFT); logicalNameTableColumn.setText(ResourceString.getResourceString("label.logical.name")); logicalNameTableColumn.setWidth(width / 2 - 5); }
private void createMenuItem(Menu parent, final TableColumn column) { final MenuItem itemName = new MenuItem(parent, SWT.CHECK); itemName.setText(column.getText()); itemName.setSelection(column.getResizable()); itemName.addListener(SWT.Selection, new Listener() { public void handleEvent(Event event) { if (itemName.getSelection()) { column.setWidth(150); column.setResizable(true); } else { column.setWidth(0); column.setResizable(false); } } }); }