public void setValue(Object target, Object value) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException, SecurityException, NoSuchFieldException { TableViewerColumn tableViewerColumn = (TableViewerColumn) target; TableColumn tableColumn = tableViewerColumn.getColumn(); UserData.setLocalData(tableColumn, getPropertyKey(), value); }
@Override protected void setColumnsWidth(String[] columnProperties) { for (int i = 0; i < columnProperties.length; i++) { String fieldName = getColumnFieldNames()[i]; TableViewerColumn tvc = new TableViewerColumn(viewer, SWT.NONE); tvc.setLabelProvider(new TableLabelProviderEditable(getColumnFieldNames()[i])); TableColumn tableColumn = tvc.getColumn(); tableColumn.setText(columnProperties[i]); tableColumn.setAlignment(SWT.LEFT); if (fieldName.equals("b.pd_code")) { tableColumn.setWidth(0); } else if (fieldName.equals("b.dp_code")) { tableColumn.setWidth(0); } else if (fieldName.equals("c.name")) { tableColumn.setWidth(250); } else if (fieldName.equals("b.dp_name")) { tableColumn.setWidth(250); } else if (fieldName.equals("a.write_date")) { tableColumn.setWidth(80); } else if (fieldName.equals("a.content")) { tableColumn.setWidth(450); } else if (fieldName.equals("a.deal_date")) { tableColumn.setWidth(80); } else if (fieldName.equals("a.deal_status")) { tableColumn.setWidth(80); // tvc.setEditingSupport(new EditorSupportIntenal(viewer, // columnFieldNames[i], this.getColumnStyleMap())); } else if (fieldName.equals("a.mark")) { tableColumn.setWidth(300); } else { tableColumn.setWidth(30); } } }
/** {@inheritDoc} */ @Override protected void createTableColumns(TableViewer tableViewer) { TableViewerColumn viewerColumn = new TableViewerColumn(tableViewer, SWT.NONE); viewerColumn.getColumn().setMoveable(true); viewerColumn.getColumn().setResizable(true); viewerColumn.getColumn().setText("Application"); viewerColumn.getColumn().setWidth(150); viewerColumn.getColumn().setToolTipText("Application name."); viewerColumn = new TableViewerColumn(tableViewer, SWT.NONE); viewerColumn.getColumn().setMoveable(true); viewerColumn.getColumn().setResizable(true); viewerColumn.getColumn().setText("Business Transactions"); viewerColumn.getColumn().setWidth(150); viewerColumn .getColumn() .setToolTipText("Number of business transactions in the application."); viewerColumn = new TableViewerColumn(tableViewer, SWT.NONE); viewerColumn.getColumn().setMoveable(true); viewerColumn.getColumn().setResizable(true); viewerColumn.getColumn().setText("Description"); viewerColumn.getColumn().setWidth(200); viewerColumn.getColumn().setToolTipText("Description."); }
/** * 실제 컬럼의 헤더를 생성합니다. * * @param name * @param size */ private void createColumn(String[] name, int[] size, int[] align) { for (int i = 0; i < name.length; i++) { TableViewerColumn tableColumn = new TableViewerColumn(tvTableInform, align[i]); tableColumn.getColumn().setText(name[i]); tableColumn.getColumn().setWidth(size[i]); } }
private static void createColumns(final TableViewer viewer) { // First column is the widget name TableViewerColumn col = createTableViewerColumn(viewer, "Widget", 150); col.setLabelProvider( new ColumnLabelProvider() { @Override public String getText(Object element) { NebulaWidget w = (NebulaWidget) element; return w.getName(); } }); col.getColumn().addSelectionListener(new SortTableColumnSelectionListener("name")); // Second column is the committer col = createTableViewerColumn(viewer, "Commiter", 150); col.setLabelProvider( new ColumnLabelProvider() { @Override public String getText(Object element) { NebulaWidget w = (NebulaWidget) element; Person p = w.getCommitter(); return p.getFirstName() + " " + p.getLastName(); } }); col.getColumn() .addSelectionListener(new SortTableColumnSelectionListener("committer.firstName")); }
/** * Handle game finished. * * @param player the player */ private void handleGameFinished(IPlayer player) { TableViewerColumn column; column = this.playerColumn.get(player); column.getColumn().setImage(ProtoPlugin.getImage(ISharedImages.IMG_TICK_DECO)); // remove edition for (Text inputTxt : this.playerScoreInput.values()) { inputTxt.setEnabled(false); inputTxt.setBackground( OpenDartsFormsToolkit.getToolkit() .getColors() .getColor(OpenDartsFormsToolkit.COLOR_INACTIVE)); } for (TableViewerColumn col : this.playerColumn.values()) { col.setEditingSupport(null); } // End Game dialog if (!this.game.getParentSet().isFinished()) { String title = MessageFormat.format("{0} finished", this.game); String message = this.game.getWinningMessage(); Shell shell = this.getSite().getShell(); MessageDialog.open(MessageDialog.INFORMATION, shell, title, message, SWT.SHEET); } this.dirty = false; this.mForm.dirtyStateChanged(); }
// This will create the columns for the table private void createColumnsResults(final Composite parent, final TableViewer viewer) { String[] titles = {"Analysis type", "Result"}; int[] bounds = {100, 100}; // First column is for the first name TableViewerColumn col = createTableViewerColumn(viewer, titles[0], bounds[0], 0); col.setLabelProvider( new ColumnLabelProvider() { @Override public String getText(Object element) { String res = "unknown"; if (element instanceof ResultAnalysis) { res = ((ResultAnalysis) element).getName(); } return res; } }); // Second column is for the last name col = createTableViewerColumn(viewer, titles[1], bounds[1], 1); col.setLabelProvider( new ColumnLabelProvider() { @Override public String getText(Object element) { String res = "unknown"; if (element instanceof ResultAnalysis) { Object verdict = ((ResultAnalysis) element).getResult(); if (verdict != null) { res = verdict.toString(); } } return res; } }); }
private void createTableViewer(final Composite parent) { mainComposite = new Composite(parent, SWT.NONE); mainComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create()); gridLayout = new GridLayout(1, false); mainComposite.setLayout(gridLayout); viewer = new TableViewer(mainComposite, SWT.FULL_SELECTION | SWT.BORDER | SWT.SINGLE | SWT.V_SCROLL); final TableLayout layout = new TableLayout(); layout.addColumnData(new ColumnWeightData(100, false)); viewer.getTable().setLayout(layout); viewer.getTable().setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create()); final TableViewerColumn columnViewer = new TableViewerColumn(viewer, SWT.NONE); final TableColumn column = columnViewer.getColumn(); column.setText(Messages.name); final TableColumnSorter sorter = new TableColumnSorter(viewer); sorter.setColumn(column); viewer.getTable().setHeaderVisible(true); viewer.setContentProvider(new ArrayContentProvider()); viewer.setLabelProvider(new ParameterNameLabelProvider()); viewer.addPostSelectionChangedListener( new ISelectionChangedListener() { @Override public void selectionChanged(final SelectionChangedEvent event) { if (!event.getSelection().isEmpty()) { ParameterEditor.this.fireSelectionChanged(); } } }); }
private void createHeaderTableColumns(TableViewer viewer, TableColumnLayout layout) { final String[] titles = { "Name", "Value", }; final ColumnLayoutData[] layoutData = { new ColumnPixelData(120, true, true), new ColumnWeightData(100, 100, true), }; final EditingSupport editorList[] = { new HeaderNameEditingSupport(viewer), new HeaderValueEditingSupport(viewer), }; final ColumnLabelProvider providerList[] = { new ColumnLabelProvider() { @Override public String getText(Object element) { return ((IHttpHeaderBuilder) element).getName(); } }, new ColumnLabelProvider() { @Override public String getText(Object element) { return ((IHttpHeaderBuilder) element).getValue(); } }, }; for (int i = 0; i < titles.length; i++) { final TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); final TableColumn c = column.getColumn(); layout.setColumnData(c, layoutData[i]); c.setText(titles[i]); c.setMoveable(true); column.setEditingSupport(editorList[i]); column.setLabelProvider(providerList[i]); } }
private void createColumns() { List<Column> modelColumns = project.getTextTable().getColumns(); for (int i = 0; i < modelColumns.size(); i++) { final int columnIndex = i; TableViewerColumn col = new TableViewerColumn(tableViewer, SWT.NONE); col.getColumn().setWidth(50); col.getColumn().setText(project.getTextTable().getColumns().get(i).getName()); col.setLabelProvider( new ColumnLabelProvider() { @Override public String getText(Object element) { Line line = (Line) element; return line.getFragmentAt(columnIndex).getText(); } }); col.getColumn().setMoveable(true); col.getColumn() .addListener( SWT.Move, new Listener() { public void handleEvent(Event event) { int[] columnsOrder = table.getColumnOrder(); boolean moved = previewsColumnOrder.move(columnsOrder); if (moved) { moveDataColumn( previewsColumnOrder.getMovedFrom(), previewsColumnOrder.getMovedTo()); } } }); } }
public void setValue(Object target, Object value) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException, SecurityException, NoSuchFieldException { TableViewerColumn tableViewerColumn = (TableViewerColumn) target; TableColumn tableColumn = tableViewerColumn.getColumn(); int width = (Integer) value; tableColumn.setWidth(width); }
protected TableViewerColumn createTableViewerColumn(String header, int width, int idx) { TableViewerColumn column = new TableViewerColumn(this, SWT.LEFT, idx); column.getColumn().setText(header); column.getColumn().setWidth(width); column.getColumn().setResizable(true); column.getColumn().setMoveable(true); return column; }
private void createColumns(final TableViewer viewer) { ColumnViewerToolTipSupport.enableFor(viewer, ToolTip.NO_RECREATE); TableViewerColumn var = new TableViewerColumn(viewer, SWT.LEFT, 0); var.getColumn().setText("Name"); var.getColumn().setWidth(80); var.setLabelProvider(new VariableLabelProvider(0)); }
private void createTableColumn( TableViewer target, String title, int size, ActivityCellLabelProvider provider) { TableViewerColumn viewerNameColumn = new TableViewerColumn(target, SWT.NONE); viewerNameColumn.getColumn().setText(title); viewerNameColumn.getColumn().setWidth(size); viewerNameColumn.getColumn().setResizable(true); viewerNameColumn.getColumn().setMoveable(true); viewerNameColumn.setLabelProvider(provider); }
private TableViewerColumn createTableViewerColumn(String title, int bound, final int colNumber) { final TableViewerColumn viewerColumn = new TableViewerColumn(tableBooks, SWT.NONE); final TableColumn column = viewerColumn.getColumn(); column.setText(title); column.setWidth(bound); column.setResizable(true); column.setMoveable(true); return viewerColumn; }
private void configureColumn( TableViewerColumn viewerColumn, int columnIndex, String headerText, boolean resizable) { viewerColumn.setLabelProvider(new MedLabelProvider(columnIndex)); TableColumn column = viewerColumn.getColumn(); column.setText(headerText); column.setMoveable(false); column.setResizable(resizable); }
public DirectoryPathsEditor(Composite parent, IProject project, PluginImageHelper imageHelper) { super(parent, SWT.NONE); this.project = project; // generated by WindowBuilder setLayout(new GridLayout(2, false)); tblVwrDirectoryPaths = new TableViewer(this, SWT.BORDER | SWT.FULL_SELECTION); tblVwrDirectoryPaths.setLabelProvider(new RichLabelProvider(imageHelper)); tblVwrDirectoryPaths.setContentProvider(ArrayContentProvider.getInstance()); tblDirectoryPaths = tblVwrDirectoryPaths.getTable(); tblDirectoryPaths.setHeaderVisible(true); tblDirectoryPaths.setLinesVisible(true); tblDirectoryPaths.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); TableViewerColumn tblclmnVwrPath = new TableViewerColumn(tblVwrDirectoryPaths, SWT.NONE); TableColumn tblclmnPath = tblclmnVwrPath.getColumn(); tblclmnPath.setWidth(290); tblclmnPath.setResizable(true); tblclmnPath.setText(directories); tblclmnVwrPath.setLabelProvider( new ColumnLabelProvider() { @Override public String getText(Object element) { return element.toString(); } }); Composite composite = new Composite(this, SWT.NONE); composite.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false, 1, 1)); composite.setLayout(new GridLayout(1, false)); btnAdd = new Button(composite, SWT.NONE); btnAdd.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); btnAdd.setText(add); btnRemove = new Button(composite, SWT.NONE); btnRemove.setEnabled(false); btnRemove.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); btnRemove.setText(remove); new Label(composite, SWT.NONE); btnUp = new Button(composite, SWT.NONE); btnUp.setEnabled(false); btnUp.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); btnUp.setText(up); btnDown = new Button(composite, SWT.NONE); btnDown.setEnabled(false); btnDown.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); btnDown.setText(down); addEventListeners(); }
private static TableViewerColumn createTableViewerColumn( TableViewer viewer, String title, int bound) { 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); return viewerColumn; }
private TableViewer createPropertiesSection(Composite parent) { TableViewer viewer = new TableViewer( parent, SWT.SINGLE | SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER); Table table = viewer.getTable(); setLayout(table); table.setHeaderVisible(true); table.setLinesVisible(true); table.setFont(parent.getFont()); TableViewerColumn nameColumn = new TableViewerColumn(viewer, SWT.NONE); nameColumn.setLabelProvider(new NameLabelProvider()); nameColumn.getColumn().setText("Name"); nameColumn.getColumn().setResizable(true); nameColumn.getColumn().setMoveable(true); TableViewerColumn valueColumn = new TableViewerColumn(viewer, SWT.NONE); valueColumn.setLabelProvider(new ValueLabelProvider()); valueColumn.getColumn().setText("Value"); valueColumn.getColumn().setResizable(true); valueColumn.getColumn().setMoveable(true); valueColumn.setEditingSupport(new RedDeerEditingSupport(viewer)); viewer.setContentProvider(new ArrayContentProvider()); return viewer; }
/** index column list */ protected void createIndexColumne(final TableViewer tv) { String[] name = {"Seq", "Column", "Order"}; int[] size = {60, 300, 50}; for (int i = 0; i < name.length; i++) { TableViewerColumn indexColumn = new TableViewerColumn(tv, SWT.LEFT); indexColumn.getColumn().setText(name[i]); indexColumn.getColumn().setWidth(size[i]); indexColumn.getColumn().addSelectionListener(getSelectionAdapter(indexColumn, i)); } }
/** * ************************************************************************* * * <p>************************************************************************ */ private void createColumns() { for (int index = 0; index < RecoveryFilesTableItems.values().length; index++) { RecoveryFilesTableItems item = RecoveryFilesTableItems.index(index); TableViewerColumn col = new TableViewerColumn(this, SWT.NONE); col.getColumn().setText(item.title); if (item.width > 0) col.getColumn().setWidth(item.width); col.getColumn().setResizable(true); col.getColumn().setMoveable(false); if (item.center) col.getColumn().setAlignment(SWT.CENTER); } }
public TableViewerBuilder buildColumn() { if (cellToolTipProvider != null || cellLabelProvider instanceof IToolTipProvider) { ColumnViewerToolTipSupport.enableFor(viewer, ToolTip.NO_RECREATE); } TableViewerColumn column = new TableViewerColumn(viewer, alignement); column.getColumn().setText(name); setLabelAndTooltipProviders( columnLabelProvider, cellLabelProvider, cellToolTipProvider, column); tableLayout.setColumnData(column.getColumn(), new ColumnWeightData(weight, minWidth, true)); return TableViewerBuilder.this; }
public static TableViewerColumn createTableViewerColumn( TableViewer viewer, String title, int width) { TableViewerColumn viewerColumn = new TableViewerColumn(viewer, SWT.NONE); TableColumn column = viewerColumn.getColumn(); column.setText(title); if (width > 0) { column.setWidth(width); } column.setResizable(true); column.setMoveable(true); return viewerColumn; }
protected void createMainColumn() { TableViewerColumn c = createTableViewerColumn("Service", 200, SWT.LEFT, false); ColumnLabelProvider labelProvider = new ColumnLabelProvider() { public String getText(Object element) { if (element instanceof ServiceSummary) { return TextProxy.service.getText(((ServiceSummary) element).hash); } return null; } }; c.setLabelProvider(labelProvider); }
/** * Handle player. * * @param player the player */ private void handlePlayer(IPlayer player, IGameEntry entry) { if (player != null) { TableViewerColumn column; // mark column column = this.playerColumn.get(player); TableViewerColumn c; for (IPlayer p : this.game.getPlayers()) { c = this.playerColumn.get(p); if (c.equals(column)) { c.getColumn().setImage(ProtoPlugin.getImage(ISharedImages.IMG_ARROW_DECO)); } else { c.getColumn().setImage(null); } } // enable/disable inputs & focus Text playerInputTxt = this.playerScoreInput.get(player); for (Text inputTxt : this.playerScoreInput.values()) { if (playerInputTxt.equals(inputTxt)) { inputTxt.setEnabled(true); inputTxt.setBackground( OpenDartsFormsToolkit.getToolkit() .getColors() .getColor(OpenDartsFormsToolkit.COLOR_ACTIVE)); inputTxt.setFocus(); } else { inputTxt.setEnabled(false); inputTxt.setText(""); inputTxt.setBackground( OpenDartsFormsToolkit.getToolkit() .getColors() .getColor(OpenDartsFormsToolkit.COLOR_INACTIVE)); } } // IA playing if (player.isComputer()) { ThreeDartsComputerDialog computerThrow = new DartsComputerX01Dialog( this.getSite().getShell(), player, this.game, (GameX01Entry) entry); computerThrow.open(); IDartsThrow dartThrow = computerThrow.getComputerThrow(); if (dartThrow instanceof WinningX01DartsThrow) { this.gameService.addWinningPlayerThrow(this.game, player, dartThrow); } else { this.gameService.addPlayerThrow(this.game, player, dartThrow); } } } }
private void addColumnsExceptionTable(TableViewer viewer, TableColumnLayout layout) { TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); column.getColumn().setText(Messages.ColumnErrorMessages); column.setLabelProvider( new ColumnLabelProvider() { @Override public String getText(Object element) { Exception e = (Exception) element; String text = e.getMessage(); return text == null || text.isEmpty() ? e.getClass().getName() : text; } }); layout.setColumnData(column.getColumn(), new ColumnWeightData(100, true)); }
@Override public void createColumns(TableViewer tableViewer) { for (Column column : Column.values()) { TableViewerColumn viewerColumn = new TableViewerColumn(tableViewer, SWT.NONE); viewerColumn.getColumn().setMoveable(true); viewerColumn.getColumn().setResizable(true); viewerColumn.getColumn().setText(column.name); viewerColumn.getColumn().setWidth(column.width); if (null != column.image) { viewerColumn.getColumn().setImage(column.image); } mapTableViewerColumn(column, viewerColumn); } }
/** table의 Column을 생성한다. */ public static void createTableColumn( final TableViewer tableViewer, final ResultSetUtilDAO rsDAO, final SQLResultSorter tableSorter) { // 기존 column을 삭제한다. Table table = tableViewer.getTable(); int columnCount = table.getColumnCount(); for (int i = 0; i < columnCount; i++) { table.getColumn(0).dispose(); } if (rsDAO.getColumnName() == null) return; try { for (int i = 0; i < rsDAO.getColumnName().size(); i++) { final int index = i; final int columnAlign = RDBTypeToJavaTypeUtils.isNumberType(rsDAO.getColumnType().get(i)) ? SWT.RIGHT : SWT.LEFT; final TableViewerColumn tv = new TableViewerColumn(tableViewer, columnAlign); final TableColumn tc = tv.getColumn(); tc.setText(rsDAO.getColumnName().get(i)); tc.setResizable(true); tc.setMoveable(true); tc.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { tableSorter.setColumn(index); int dir = tableViewer.getTable().getSortDirection(); if (tableViewer.getTable().getSortColumn() == tc) { dir = dir == SWT.UP ? SWT.DOWN : SWT.UP; } else { dir = SWT.DOWN; } tableViewer.getTable().setSortDirection(dir); tableViewer.getTable().setSortColumn(tc); tableViewer.refresh(); } }); } // end for } catch (Exception e) { logger.error("SQLResult TableViewer", e); } }
private void createTableColumn( String name, int weight, int alignment, CellLabelProvider cellLabelProvider, TableViewer viewer, TableColumnLayout layout) { TableViewerColumn column = new TableViewerColumn(viewer, SWT.LEFT); column.getColumn().setText(name); column.getColumn().setAlignment(alignment); if (cellLabelProvider != null) { column.setLabelProvider(cellLabelProvider); } layout.setColumnData(column.getColumn(), new ColumnWeightData(weight, true)); }
@Override protected Control createDialogArea(Composite parent) { Composite area = new Composite(parent, SWT.NONE); area.setLayoutData(SWTHelper.getFillGridData(1, true, 1, true)); area.setLayout(new GridLayout(1, false)); Composite dateComposite = new Composite(area, SWT.NONE); dateComposite.setLayoutData(SWTHelper.getFillGridData(1, true, 1, true)); dateComposite.setLayout(new GridLayout(1, false)); dtDate = new DateTime(area, SWT.DATE | SWT.DROP_DOWN); dtDate.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { loadArticlesUsedOnSelectedDay(); tableViewer.setInput(currOrder.getEntries()); } }); Composite tableComposite = new Composite(area, SWT.NONE); tableComposite.setLayoutData(SWTHelper.getFillGridData(1, true, 1, true)); TableColumnLayout tcLayout = new TableColumnLayout(); tableComposite.setLayout(tcLayout); tableViewer = new TableViewer(tableComposite, SWT.BORDER | SWT.FULL_SELECTION); Table table = tableViewer.getTable(); table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); table.setHeaderVisible(true); table.setLinesVisible(true); TableViewerColumn tvc = new TableViewerColumn(tableViewer, SWT.NONE); TableColumn tcAmount = tvc.getColumn(); tcLayout.setColumnData(tcAmount, new ColumnPixelData(70, false, false)); tcAmount.setText(Messages.DailyOrderDialog_Amount); tvc = new TableViewerColumn(tableViewer, SWT.NONE); TableColumn tcArticle = tvc.getColumn(); tcLayout.setColumnData(tcArticle, new ColumnPixelData(300, true, true)); tcArticle.setText(Messages.DailyOrderDialog_Article); tableViewer.setContentProvider(new ArrayContentProvider()); tableViewer.setLabelProvider(new OrderLabelProvider()); loadArticlesUsedOnSelectedDay(); tableViewer.setInput(currOrder.getEntries()); return area; }