List of usage examples for org.eclipse.jface.viewers TableViewer getTable
public Table getTable()
From source file:no.javatime.inplace.ui.views.BundleListLabelProvider.java
License:Open Source License
public void createColumns(final TableViewer viewer) { this.viewer = viewer; final Table table = viewer.getTable(); table.removeAll();// w w w. j ava2s . com createBundleColumn(); // Uncomment to show in list page // createModeColumn(); createStatusColumn(); createStateColumn(); // Uncomment to show in list page createTransitionColumn(); table.setHeaderVisible(true); table.setLinesVisible(true); }
From source file:oic.simulator.clientcontroller.view.MetaPropertiesView.java
License:Open Source License
private void updateViewer(TableViewer tblViewer, List<MetaProperty> metaPropertyList) { if (null != tblViewer) { Table tbl = tblViewer.getTable(); if (null != metaPropertyList) { tblViewer.setInput(metaPropertyList.toArray()); if (!tbl.isDisposed()) { tbl.setLinesVisible(true); }/* w ww . j a v a2s .c o m*/ } else { if (!tbl.isDisposed()) { tbl.removeAll(); tbl.setLinesVisible(false); } } } }
From source file:oic.simulator.serviceprovider.view.DevicePlatformInfoView.java
License:Open Source License
private void updateViewer(TableViewer tableViewer, List<MetaProperty> metaPropertyList) { if (null != tableViewer) { Table tbl = tableViewer.getTable(); if (null != metaPropertyList) { tableViewer.setInput(metaPropertyList.toArray()); if (!tbl.isDisposed()) { tbl.setLinesVisible(true); }/*from ww w . ja v a2s. co m*/ } else { if (!tbl.isDisposed()) { tbl.removeAll(); tbl.setLinesVisible(false); } } } }
From source file:oida.model.integration.ui.editors.LayoutTester.java
License:Open Source License
/** * Create contents of the editor part./*from w ww . j ava 2 s . c o m*/ * * @param parent */ @Override public void createPartControl(Composite parent) { parent.setLayout(new GridLayout(1, true)); SashForm sashForm = new SashForm(parent, SWT.NONE); sashForm.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); Composite composite = new Composite(sashForm, SWT.NONE); composite.setLayout(new FillLayout(SWT.HORIZONTAL)); TableViewer tableViewer = new TableViewer(composite, SWT.BORDER | SWT.FULL_SELECTION); table = tableViewer.getTable(); Composite composite_1 = new Composite(sashForm, SWT.NONE); composite_1.setLayout(new FillLayout(SWT.HORIZONTAL)); TreeViewer treeViewer = new TreeViewer(composite_1, SWT.BORDER); Tree tree = treeViewer.getTree(); sashForm.setWeights(new int[] { 1, 1 }); }
From source file:optm.bettingschedule.view.BettingScheduleView.java
License:Apache License
@PostConstruct public void createControls(final Composite parent) { levels = new ArrayList<>(); levels.add(new Level("1", 5, 10, 0, 20)); //$NON-NLS-1$ levels.add(new Level("2", 10, 20, 0, 20)); //$NON-NLS-1$ levels.add(new Level("3", 15, 30, 0, 20)); //$NON-NLS-1$ levels.add(new Level("4", 20, 40, 0, 20)); //$NON-NLS-1$ levels.add(new Level("5", 25, 50, 0, 20)); //$NON-NLS-1$ parent.setLayout(new FormLayout()); Composite composite = new Composite(parent, SWT.NONE); FormData fd_composite = new FormData(); fd_composite.bottom = new FormAttachment(0, 298); fd_composite.right = new FormAttachment(0, 600); fd_composite.top = new FormAttachment(0); fd_composite.left = new FormAttachment(0); composite.setLayoutData(fd_composite); composite.setLayout(new GridLayout(1, false)); ToolBar toolBar = new ToolBar(composite, SWT.FLAT | SWT.RIGHT); ToolItem tltmNewItem = new ToolItem(toolBar, SWT.NONE); tltmNewItem.setImage(ResourceManager.getPluginImage("optm", "icons/add.png")); tltmNewItem.setToolTipText(Messages.BettingScheduleView_tltmNewItem_toolTipText); final TableViewer tableViewer = new TableViewer(composite, SWT.BORDER | SWT.FULL_SELECTION); table = tableViewer.getTable(); tltmNewItem.addListener(SWT.Selection, new Listener() { @Override/*from ww w . j a v a 2 s. c om*/ public void handleEvent(final Event event) { System.out.println("add new level"); //$NON-NLS-1$ levels.add(new Level(Integer.toString(levels.size() + 1), 0, 0, 0, 0)); tableViewer.refresh(true, true); } }); GridData gd_table = new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1); gd_table.heightHint = 400; // gd_table.widthHint = 390; table.setLayoutData(gd_table); table.setHeaderVisible(true); table.setLinesVisible(true); TableViewerColumn colName = new TableViewerColumn(tableViewer, SWT.NONE); TableColumn column = colName.getColumn(); column.setText(Messages.BettingScheduleView_level); column.setAlignment(SWT.RIGHT); column.setWidth(50); colName.setLabelProvider(new ColumnLabelProvider() { @Override public String getText(final Object element) { Level p = (Level) element; return p.getName(); } }); colName.setEditingSupport(new LevelEditingSupport(tableViewer)); TableViewerColumn colSmall = new TableViewerColumn(tableViewer, SWT.NONE); TableColumn column2 = colSmall.getColumn(); column2.setText(Messages.BettingScheduleView_small_blind); column2.setAlignment(SWT.RIGHT); column2.setWidth(100); colSmall.setLabelProvider(new ColumnLabelProvider() { @Override public String getText(final Object element) { Level p = (Level) element; return Integer.toString(p.getSmallBlind()); } }); TableViewerColumn colBig = new TableViewerColumn(tableViewer, SWT.NONE); TableColumn column3 = colBig.getColumn(); column3.setText(Messages.BettingScheduleView_big_blind); column3.setAlignment(SWT.RIGHT); column3.setWidth(100); colBig.setLabelProvider(new ColumnLabelProvider() { @Override public String getText(final Object element) { Level p = (Level) element; return Integer.toString(p.getBigBlind()); } }); TableViewerColumn colAnte = new TableViewerColumn(tableViewer, SWT.NONE); TableColumn column4 = colAnte.getColumn(); column4.setText(Messages.BettingScheduleView_ante); column4.setAlignment(SWT.RIGHT); column4.setWidth(100); colAnte.setLabelProvider(new ColumnLabelProvider() { @Override public String getText(final Object element) { Level p = (Level) element; return Integer.toString(p.getBigBlind()); } }); TableViewerColumn colDuration = new TableViewerColumn(tableViewer, SWT.NONE); TableColumn column5 = colDuration.getColumn(); column5.setText(Messages.BettingScheduleView_duration); column5.setAlignment(SWT.RIGHT); column5.setWidth(100); colDuration.setLabelProvider(new ColumnLabelProvider() { @Override public String getText(final Object element) { Level p = (Level) element; return Integer.toString(p.getBigBlind()); } }); tableViewer.setContentProvider(ArrayContentProvider.getInstance()); tableViewer.setInput(levels); int operations = DND.DROP_COPY | DND.DROP_MOVE; Transfer[] transferTypes = new Transfer[] { TextTransfer.getInstance() }; tableViewer.addDragSupport(operations, transferTypes, new MyDragListener(tableViewer)); tableViewer.addDropSupport(operations, transferTypes, new MyDropListener(tableViewer)); repositoryService.addLabelProvider(new BettingScheduleLabelProvider()); }
From source file:optm.bettingschedule.view.LevelEditingSupport.java
License:Apache License
/** * @param viewer// w w w . j a v a 2 s .c o m */ public LevelEditingSupport(final TableViewer viewer) { super(viewer); this.viewer = viewer; this.editor = new TextCellEditor(viewer.getTable()); this.editor.setValidator(new ICellEditorValidator() { @Override public String isValid(final Object value) { if (value instanceof String) { try { Integer valueOf = Integer.valueOf((String) value); if (valueOf.compareTo(Integer.valueOf(0)) <= 0) { return Messages.LevelEditingSupport_0; } } catch (NumberFormatException e) { return Messages.LevelEditingSupport_1; } } return null; } }); editor.addListener(new ICellEditorListener() { @Override public void editorValueChanged(final boolean oldValidState, final boolean newValidState) { } @Override public void cancelEditor() { } @Override public void applyEditorValue() { if (!editor.isValueValid()) { MessageDialog.openError(viewer.getControl().getShell(), "No did not work", //$NON-NLS-1$ editor.getErrorMessage()); } } }); }
From source file:org.akrogen.tkui.css.swt.engine.table.CSSSWTTableViewerEngineTest.java
License:Open Source License
public static void main(String[] args) { try {//w w w .j av a2 s . c o m Display display = new Display(); CSSEngine engine = new CSSSWTEngineImpl(display); engine.parseStyleSheet(new StringReader( "TableItem:odd {font:Roman 12 italic normal; background-color: #2BAFFA; color:white; background-image: url(./images/icons/type/class.gif);}" + "TableItem:even {background-color:#edb5f4, 100%; color:black;}")); Shell shell = new Shell(display, SWT.SHELL_TRIM); FillLayout layout = new FillLayout(); shell.setLayout(layout); Composite panel1 = new Composite(shell, SWT.NONE); panel1.setLayout(new FillLayout()); final List datas = new ArrayList(); for (int i = 0; i < 20; i++) { datas.add("Item" + i); } final TableViewer tableViewer = new TableViewer(panel1); tableViewer.setContentProvider(new IStructuredContentProvider() { public void dispose() { // TODO Auto-generated method stub } public Object[] getElements(Object inputElement) { return datas.toArray(); } public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { } }); tableViewer.setLabelProvider(new MyCSSLabelProvider(engine, tableViewer)); Table table = tableViewer.getTable(); table.setHeaderVisible(true); TableColumn tableColumn = new TableColumn(table, SWT.LEFT, 0); tableColumn.setText("Name"); tableColumn.setWidth(200); table.setLinesVisible(true); tableViewer.setInput(datas); shell.pack(); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); } catch (Exception ex) { ex.printStackTrace(); } }
From source file:org.akrogen.tkui.css.swt.engine.table.CSSSWTTableViewerEngineTest2.java
License:Open Source License
public static void main(String[] args) { try {// w w w .ja va2 s.co m Display display = new Display(); CSSEngine engine = new CSSSWTEngineImpl(display); engine.parseStyleSheet(new StringReader( "TableItem:odd {font:Roman 12 italic normal; background-color: #2BAFFA; color:white; background-image: url(./images/icons/type/class.gif);}" + "TableItem:even {background-color:#edb5f4, 100%; color:black;}")); Shell shell = new Shell(display, SWT.SHELL_TRIM); FillLayout layout = new FillLayout(); shell.setLayout(layout); Composite panel1 = new Composite(shell, SWT.NONE); panel1.setLayout(new FillLayout()); final List datas = new ArrayList(); for (int i = 0; i < 20; i++) { datas.add(new Item("Item" + i + "_0", "Item" + i + "_1")); } final TableViewer tableViewer = new TableViewer(panel1); tableViewer.setContentProvider(new IStructuredContentProvider() { public void dispose() { // TODO Auto-generated method stub } public Object[] getElements(Object inputElement) { return datas.toArray(); } public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { } }); tableViewer.setLabelProvider(new MyCSSTableLabelProvider(engine, tableViewer)); Table table = tableViewer.getTable(); table.setHeaderVisible(true); TableColumn tableColumn1 = new TableColumn(table, SWT.LEFT, 0); tableColumn1.setText("Name"); tableColumn1.setWidth(200); TableColumn tableColumn2 = new TableColumn(table, SWT.LEFT, 0); tableColumn2.setText("Lastname"); tableColumn2.setWidth(200); table.setLinesVisible(true); tableViewer.setInput(datas); shell.pack(); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); } catch (Exception ex) { ex.printStackTrace(); } }
From source file:org.amanzi.awe.statistics.ui.table.filters.dialog.FilteringDialog.java
License:Open Source License
public FilteringDialog(final TableViewer tableViewer, final TableColumn column, final Set<String> groups) { Table table = tableViewer.getTable(); shell = new Shell(table.getShell(), SWT.SHELL_TRIM & (~SWT.RESIZE)); shell.setText("Aggregation filters setting"); // locate dialog Point location = table.getDisplay().getCursorLocation(); Rectangle clientArea = table.getDisplay().getClientArea(); int shellWidth = Math.min(MIN_SHELL_WIDTH, clientArea.width - location.x); int shellHeight = MIN_SHWLL_HEIGHT; shell.setSize(shellWidth, shellHeight); shell.setLocation(location);//from www .ja va 2 s.c om shell.setLayout(ONE_COLUMN_LAYOUT); // instantiate required variables filters = new ArrayList<ViewerFilter>(Arrays.asList(tableViewer.getFilters())); this.groups = groups; this.tableViewer = tableViewer; this.column = column; // create shell components createWidgets(); }
From source file:org.apache.directory.studio.ldapbrowser.ui.editors.searchresult.SearchResultEditorConfiguration.java
License:Apache License
/** * Gets the value editor manager./* ww w.java 2 s .c om*/ * * @param viewer the viewer * * @return the value editor manager */ public ValueEditorManager getValueEditorManager(TableViewer viewer) { if (valueEditorManager == null) { valueEditorManager = new ValueEditorManager(viewer.getTable(), true, true); } return valueEditorManager; }