org.eclipse.jface.layout.TableColumnLayout Java Examples
The following examples show how to use
org.eclipse.jface.layout.TableColumnLayout.
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 createMandantColumn(TableViewer viewer, TableColumnLayout layout, int columnIndex){ TableViewerColumn ret = new TableViewerColumn(viewer, SWT.LEFT); TableColumn tblclmnMandant = ret.getColumn(); ColumnWeightData mandantColumnWeightData = new ColumnWeightData(0, 50, true); layout.setColumnData(tblclmnMandant, mandantColumnWeightData); tblclmnMandant.setText(Messages.MedicationComposite_column_mandant); tblclmnMandant.setToolTipText(Messages.MedicationComposite_column_mandant); ret.setLabelProvider(new MedicationCellLabelProvider() { @Override public String getText(Object element){ return ((MedicationTableViewerItem) element).getPrescriptorLabel(); } }); return ret; }
Example #2
Source File: RenamingView.java From MergeProcessor with Apache License 2.0 | 6 votes |
/** * @param parent a widget which will be the parent of the new instance (cannot * be null) * @param style the style of widget to construct */ public RenamingView(Composite parent, int style) { super(parent, style); final TableColumnLayout layout = new TableColumnLayout(); setLayout(layout); viewer = new TableViewer(this, SWT.FULL_SELECTION); viewer.getTable().setHeaderVisible(true); viewer.getTable().setLinesVisible(true); viewerColumnFrom = new TableViewerColumn(viewer, SWT.NONE); viewerColumnFrom.getColumn().setText("From"); layout.setColumnData(viewerColumnFrom.getColumn(), new ColumnWeightData(1)); viewerColumnTo = new TableViewerColumn(viewer, SWT.NONE); viewerColumnTo.getColumn().setText("To"); layout.setColumnData(viewerColumnTo.getColumn(), new ColumnWeightData(1)); }
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: MedicationViewerHelper.java From elexis-3-core with Eclipse Public License 1.0 | 6 votes |
public static TableViewerColumn createIntakeCommentColumn(TableViewer viewer, TableColumnLayout layout, int columnIndex){ TableViewerColumn ret = new TableViewerColumn(viewer, SWT.NONE); TableColumn tblclmnComment = ret.getColumn(); layout.setColumnData(tblclmnComment, new ColumnWeightData(1, ColumnWeightData.MINIMUM_WIDTH, true)); tblclmnComment.setText(Messages.TherapieplanComposite_tblclmnComment_text); tblclmnComment.setToolTipText(Messages.MedicationComposite_column_sortBy + " " + Messages.TherapieplanComposite_tblclmnComment_text); tblclmnComment .addSelectionListener(getSelectionAdapter(viewer, tblclmnComment, columnIndex)); tblclmnComment.setToolTipText(Messages.MedicationComposite_column_sortBy + " " + Messages.TherapieplanComposite_tblclmnComment_text); ret.setLabelProvider(new MedicationCellLabelProvider() { @Override public String getText(Object element){ MedicationTableViewerItem pres = (MedicationTableViewerItem) element; return pres.getRemark(); } }); return ret; }
Example #5
Source File: CharacterPairsTableWidget.java From tm4e with Eclipse Public License 1.0 | 6 votes |
public CharacterPairsTableWidget(Table table) { super(table); setContentProvider(new CharacterPairContentProvider()); setLabelProvider(new CharacterPairLabelProvider()); GC gc = new GC(table.getShell()); gc.setFont(JFaceResources.getDialogFont()); TableColumnLayout columnLayout = new TableColumnLayout(); TableColumn column1 = new TableColumn(table, SWT.NONE); column1.setText(LanguageConfigurationMessages.CharacterPairsTableWidget_start); int minWidth = computeMinimumColumnWidth(gc, LanguageConfigurationMessages.CharacterPairsTableWidget_start); columnLayout.setColumnData(column1, new ColumnWeightData(2, minWidth, true)); TableColumn column2 = new TableColumn(table, SWT.NONE); column2.setText(LanguageConfigurationMessages.CharacterPairsTableWidget_end); minWidth = computeMinimumColumnWidth(gc, LanguageConfigurationMessages.CharacterPairsTableWidget_end); columnLayout.setColumnData(column2, new ColumnWeightData(2, minWidth, true)); }
Example #6
Source File: MedicationViewerHelper.java From elexis-3-core with Eclipse Public License 1.0 | 6 votes |
public static TableViewerColumn createBeginColumn(TableViewer viewer, TableColumnLayout layout, int columnIndex){ TableViewerColumn ret = new TableViewerColumn(viewer, SWT.CENTER); TableColumn tblclmnEnacted = ret.getColumn(); layout.setColumnData(tblclmnEnacted, new ColumnPixelData(60, true, true)); tblclmnEnacted.setImage(Images.resize(Images.IMG_NEXT_WO_SHADOW.getImage(), ImageSize._12x12_TableColumnIconSize)); tblclmnEnacted.setToolTipText(Messages.MedicationComposite_column_sortBy + " " + Messages.MedicationComposite_column_beginDate); tblclmnEnacted .addSelectionListener(getSelectionAdapter(viewer, tblclmnEnacted, columnIndex)); ret.setLabelProvider(new MedicationCellLabelProvider() { @Override public String getText(Object element){ MedicationTableViewerItem pres = (MedicationTableViewerItem) element; return pres.getBeginDate(); } }); return ret; }
Example #7
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 #8
Source File: ProjectSelector.java From google-cloud-eclipse with Apache License 2.0 | 6 votes |
public ProjectSelector(Composite parent) { super(parent, SWT.NONE); GridLayoutFactory.fillDefaults().numColumns(2).spacing(0, 0).applyTo(this); Composite tableComposite = new Composite(this, SWT.NONE); TableColumnLayout tableColumnLayout = new TableColumnLayout(); tableComposite.setLayout(tableColumnLayout); GridDataFactory.fillDefaults().grab(true, true).applyTo(tableComposite); viewer = new TableViewer(tableComposite, SWT.SINGLE | SWT.BORDER | SWT.FULL_SELECTION); createColumns(tableColumnLayout); viewer.getTable().setHeaderVisible(true); viewer.getTable().setLinesVisible(false); input = WritableList.withElementType(GcpProject.class); projectProperties = PojoProperties.values(new String[] {"name", "id"}); //$NON-NLS-1$ //$NON-NLS-2$ ViewerSupport.bind(viewer, input, projectProperties); viewer.setComparator(new ViewerComparator()); Composite linkComposite = new Composite(this, SWT.NONE); statusLink = new Link(linkComposite, SWT.WRAP); statusLink.addSelectionListener( new OpenUriSelectionListener(new ErrorDialogErrorHandler(getShell()))); statusLink.setText(""); GridDataFactory.fillDefaults().span(2, 1).applyTo(linkComposite); GridLayoutFactory.fillDefaults().generateLayout(linkComposite); }
Example #9
Source File: CoverageLabelProvider.java From tlaplus with MIT License | 5 votes |
/** * @param stateTable */ void createTableColumns(final Table stateTable, 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]); column.setToolTipText(COLUMN_TOOLTIPS[i]); column.setData(COVERAGE_COMPARATOR, COLUMN_COMP[i]); final int weight = (int)(100.0 * COLUMN_WIDTH_PERCENTAGES[i]); layout.setColumnData(column, new ColumnWeightData(weight, COLUMN_WIDTHS[i], true)); } }
Example #10
Source File: MedicationViewerHelper.java From elexis-3-core with Eclipse Public License 1.0 | 5 votes |
public static TableViewerColumn createStopReasonColumn(TableViewer viewer, TableColumnLayout layout, int columnIndex){ TableViewerColumn ret = new TableViewerColumn(viewer, SWT.LEFT); TableColumn tblclmnReason = ret.getColumn(); ColumnWeightData reasonColumnWeightData = new ColumnWeightData(1, ColumnWeightData.MINIMUM_WIDTH, true); layout.setColumnData(tblclmnReason, reasonColumnWeightData); tblclmnReason.setText(Messages.MedicationComposite_stopReason); tblclmnReason.setToolTipText(Messages.MedicationComposite_column_sortBy + " " + Messages.MedicationComposite_stopReason); tblclmnReason.addSelectionListener(getSelectionAdapter(viewer, tblclmnReason, 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) { String stopReason = pres.getStopReason(); if (stopReason != null && !stopReason.isEmpty()) { return stopReason; } } return ""; } }); return ret; }
Example #11
Source File: InvoiceCorrectionWizard.java From elexis-3-core with Eclipse Public License 1.0 | 5 votes |
@Override public void createControl(Composite parent){ container = new Composite(parent, SWT.NONE); container.setLayout(new GridLayout(1, false)); Composite tableComp = new Composite(container, SWT.NONE); tableComp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); viewer = CheckboxTableViewer.newCheckList(tableComp, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL); viewer.getTable().setLinesVisible(true); viewer.getTable().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); viewer.setContentProvider(new ArrayContentProvider()); viewer.setInput(invoiceCorrectionDTO.getHistory()); viewer.addCheckStateListener(new ICheckStateListener() { @Override public void checkStateChanged(CheckStateChangedEvent event){ viewer.setChecked(event.getElement(), !event.getChecked()); } }); viewer.setLabelProvider(new WizardLabelProvider()); TableColumn singleColumn = new TableColumn(viewer.getTable(), SWT.NONE); TableColumnLayout tableColumnLayout = new TableColumnLayout(); tableColumnLayout.setColumnData(singleColumn, new ColumnWeightData(100)); tableComp.setLayout(tableColumnLayout); Label lblOutput = new Label(container, SWT.NONE); lblOutput.setText("Ausgabe"); GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true); gd.heightHint = 100; txtOutput = new Text(container, SWT.MULTI | SWT.WRAP | SWT.BORDER | SWT.V_SCROLL | SWT.READ_ONLY); txtOutput.setLayoutData(gd); setControl(container); setPageComplete(!invoiceCorrectionDTO.getHistory().isEmpty()); }
Example #12
Source File: InvoiceCorrectionWizard.java From elexis-3-core with Eclipse Public License 1.0 | 5 votes |
@Override public void createControl(Composite parent){ container = new Composite(parent, SWT.NONE); container.setLayout(new GridLayout(1, false)); TableViewer viewer = new TableViewer(container, SWT.SINGLE | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL | SWT.READ_ONLY); viewer.getTable().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); viewer.setContentProvider(new ArrayContentProvider()); viewer.getTable().setLinesVisible(true); viewer.setInput(invoiceCorrectionDTO.getHistory()); viewer.setLabelProvider(new LabelProvider() { @Override public String getText(Object element){ int i = invoiceCorrectionDTO.getHistory().indexOf(element); return String.valueOf(++i) + ". " + ((InvoiceHistoryEntryDTO) element).getText(); } }); TableColumn singleColumn = new TableColumn(viewer.getTable(), SWT.NONE); TableColumnLayout tableColumnLayout = new TableColumnLayout(); tableColumnLayout.setColumnData(singleColumn, new ColumnWeightData(100)); container.setLayout(tableColumnLayout); setControl(container); setPageComplete(!invoiceCorrectionDTO.getHistory().isEmpty()); }
Example #13
Source File: ValidationViewPart.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
private void createTableComposite(final Composite mainComposite) { final Composite tableComposite = new Composite(mainComposite, SWT.NONE); tableComposite.setLayout(GridLayoutFactory.fillDefaults().create()); tableComposite.setLayoutData(GridDataFactory.fillDefaults() .grab(true, true).create()); tableViewer = new TableViewer(tableComposite, SWT.SINGLE | SWT.BORDER | SWT.FULL_SELECTION); final Table table = tableViewer.getTable(); table.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).hint(400, SWT.DEFAULT).create()); table.setHeaderVisible(true); table.setLinesVisible(true); addSeverityDescriptionColumn(); addElementNameColumn(); addErrorDescriptionColumn(); final TableColumnLayout tcLayout = new TableColumnLayout(); tcLayout.setColumnData(table.getColumn(0), new ColumnWeightData(1)); tcLayout.setColumnData(table.getColumn(1), new ColumnWeightData(5)); tcLayout.setColumnData(table.getColumn(2), new ColumnWeightData(11)); table.getParent().setLayout(tcLayout); tableViewer.setContentProvider(new ValidationMarkerContentProvider()); final IEditorPart activeEditor = getSite().getPage().getActiveEditor(); tableViewer.setInput(activeEditor); tableViewer.addSelectionChangedListener(this); }
Example #14
Source File: AbstractOrganizationWizardPage.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
protected void addTableColumLayout(final Table table) { final TableColumnLayout tcLayout = new TableColumnLayout(); for (final TableColumn col : table.getColumns()) { tcLayout.setColumnData(col, new ColumnWeightData(1)); } table.getParent().setLayout(tcLayout); }
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: GitRepositoryPreferencePageView.java From MergeProcessor with Apache License 2.0 | 5 votes |
/** * @param parent a widget which will be the parent of the new instance (cannot * be null) * @param style the style of widget to construct */ public GitRepositoryPreferencePageView(Composite parent, int style) { super(parent, style); final TableColumnLayout tableColumnLayout = new TableColumnLayout(); setLayout(tableColumnLayout); tableViewer = new TableViewer(this, SWT.BORDER | SWT.FULL_SELECTION); final Table table = tableViewer.getTable(); table.setHeaderVisible(true); table.setLinesVisible(true); columnRepository = new TableViewerColumn(tableViewer, SWT.NONE); TableColumn colRepository = columnRepository.getColumn(); tableColumnLayout.setColumnData(colRepository, new ColumnWeightData(1)); colRepository.setText("Repository"); columnLocalPath = new TableViewerColumn(tableViewer, SWT.NONE); TableColumn colLocalPath = columnLocalPath.getColumn(); tableColumnLayout.setColumnData(colLocalPath, new ColumnWeightData(1)); colLocalPath.setText("Local Path"); columnMemory = new TableViewerColumn(tableViewer, SWT.RIGHT); TableColumn colMemory = columnMemory.getColumn(); tableColumnLayout.setColumnData(colMemory, new ColumnPixelData(80, true, true)); colMemory.setText("Memory"); final Menu menu = new Menu(tableViewer.getTable()); menuItemGoToRepository = new MenuItem(menu, SWT.NONE); menuItemGoToRepository.setText("Go to Repository"); tableViewer.getTable().setMenu(menu); }
Example #17
Source File: EnvironmentVariablesTable.java From Eclipse-Environment-Variables with MIT License | 5 votes |
private TableColumn createColumn(final Table table, final TableColumnLayout columnLayout, final String text) { final TableColumn column = new TableColumn(table, SWT.NONE); column.setText(text); column.setMoveable(true); columnLayout.setColumnData(column, new ColumnWeightData(50, true)); return column; }
Example #18
Source File: ApplicationOverviewEditorPart.java From codewind-eclipse with Eclipse Public License 2.0 | 5 votes |
public LinkTable(Composite composite, FormToolkit toolkit, String projectColumnLabel) { // Create a composite for the table so can use TableColumnLayout tableComp = toolkit.createComposite(composite, SWT.NONE); TableColumnLayout tableColumnLayout = new TableColumnLayout(); tableComp.setLayout(tableColumnLayout); tableComp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1)); linkTable = toolkit.createTable(tableComp, SWT.BORDER | SWT.H_SCROLL | SWT.MULTI | SWT.FULL_SELECTION); GridData data = new GridData(SWT.FILL, SWT.FILL, true, true); data.heightHint = 100; linkTable.setLayoutData(data); // Columns projectColumn = new TableColumn(linkTable, SWT.NONE); projectColumn.setText(projectColumnLabel); projectColumn.setResizable(true); envVarColumn = new TableColumn(linkTable, SWT.NONE); envVarColumn.setText(Messages.LinkMgmtEnvVarColumn); envVarColumn.setResizable(true); linkTable.setHeaderVisible(true); linkTable.setLinesVisible(true); Arrays.stream(linkTable.getColumns()).forEach(TableColumn::pack); tableColumnLayout.setColumnData(projectColumn, new ColumnWeightData(10, Math.max(50, projectColumn.getWidth()), true)); tableColumnLayout.setColumnData(envVarColumn, new ColumnWeightData(10, Math.max(50, envVarColumn.getWidth()), true)); }
Example #19
Source File: OnEnterRuleTableWidget.java From tm4e with Eclipse Public License 1.0 | 5 votes |
public OnEnterRuleTableWidget(Table table) { super(table); setContentProvider(new OnEnterRuleContentProvider()); setLabelProvider(new OnEnterRuleLabelProvider()); GC gc = new GC(table.getShell()); gc.setFont(JFaceResources.getDialogFont()); TableColumnLayout columnLayout = new TableColumnLayout(); TableColumn column1 = new TableColumn(table, SWT.NONE); column1.setText(LanguageConfigurationMessages.OnEnterRuleTableWidget_beforeText); int minWidth = computeMinimumColumnWidth(gc, LanguageConfigurationMessages.OnEnterRuleTableWidget_beforeText); columnLayout.setColumnData(column1, new ColumnWeightData(2, minWidth, true)); TableColumn column2 = new TableColumn(table, SWT.NONE); column2.setText(LanguageConfigurationMessages.OnEnterRuleTableWidget_afterText); minWidth = computeMinimumColumnWidth(gc, LanguageConfigurationMessages.OnEnterRuleTableWidget_afterText); columnLayout.setColumnData(column2, new ColumnWeightData(2, minWidth, true)); TableColumn column3 = new TableColumn(table, SWT.NONE); column3.setText(LanguageConfigurationMessages.OnEnterRuleTableWidget_indentAction); minWidth = computeMinimumColumnWidth(gc, LanguageConfigurationMessages.OnEnterRuleTableWidget_indentAction); columnLayout.setColumnData(column3, new ColumnWeightData(1, minWidth, true)); TableColumn column4 = new TableColumn(table, SWT.NONE); column4.setText(LanguageConfigurationMessages.OnEnterRuleTableWidget_appendText); minWidth = computeMinimumColumnWidth(gc, LanguageConfigurationMessages.OnEnterRuleTableWidget_appendText); columnLayout.setColumnData(column4, new ColumnWeightData(1, minWidth, true)); TableColumn column5 = new TableColumn(table, SWT.NONE); column5.setText(LanguageConfigurationMessages.OnEnterRuleTableWidget_removeText); minWidth = computeMinimumColumnWidth(gc, LanguageConfigurationMessages.OnEnterRuleTableWidget_removeText); columnLayout.setColumnData(column5, new ColumnWeightData(1, minWidth, true)); }
Example #20
Source File: LanguageConfigurationInfoWidget.java From tm4e with Eclipse Public License 1.0 | 5 votes |
private Table createTable(Composite parent) { Composite tableComposite = new Composite(parent, SWT.NONE); tableComposite.setLayoutData(new GridData(GridData.FILL_BOTH)); tableComposite.setLayout(new TableColumnLayout()); Table table = new Table(tableComposite, SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL); table.setHeaderVisible(true); table.setLinesVisible(true); return table; }
Example #21
Source File: EnvironmentVariablesTable.java From Eclipse-Environment-Variables with MIT License | 5 votes |
public EnvironmentVariablesTable(final Composite parent) { super(parent, SWT.NONE); final TableColumnLayout tableColumnLayout = new TableColumnLayout(); setLayout(tableColumnLayout); labelProvider = new TableLabelProvider(); viewer = new TableViewer(this, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION); viewer.setColumnProperties(new String[] { getKeyName(), getValueName() }); table = viewer.getTable(); table.setLinesVisible(true); table.setHeaderVisible(true); viewer.setLabelProvider(labelProvider); try { viewer.setContentProvider(new TableContentProvider(vars)); } catch (final Exception e) { // noop } createColumns(tableColumnLayout, viewer.getTable()); final CellEditor[] editors = new CellEditor[] { new TextCellEditor(table), new TextCellEditor(table) }; // Assign the cell editors to the viewer viewer.setCellEditors(editors); viewer.setCellModifier(new TableCellModifier(viewer)); }
Example #22
Source File: AutoClosingPairConditionalTableWidget.java From tm4e with Eclipse Public License 1.0 | 5 votes |
public AutoClosingPairConditionalTableWidget(Table table) { super(table); setLabelProvider(new AutoClosingPairConditionalLabelProvider()); GC gc = new GC(table.getShell()); gc.setFont(JFaceResources.getDialogFont()); TableColumnLayout columnLayout = new TableColumnLayout(); TableColumn column2 = new TableColumn(table, SWT.NONE); column2.setText(LanguageConfigurationMessages.AutoClosingPairConditionalTableWidget_notIn); int minWidth = computeMinimumColumnWidth(gc, LanguageConfigurationMessages.AutoClosingPairConditionalTableWidget_notIn); columnLayout.setColumnData(column2, new ColumnWeightData(2, minWidth, true)); }
Example #23
Source File: ProjectSelector.java From google-cloud-eclipse with Apache License 2.0 | 5 votes |
private void createColumns(TableColumnLayout tableColumnLayout) { TableViewerColumn nameColumn = new TableViewerColumn(viewer, SWT.LEFT); nameColumn.getColumn().setWidth(200); nameColumn.getColumn().setText(Messages.getString("projectselector.header.name")); //$NON-NLS-1$ tableColumnLayout.setColumnData(nameColumn.getColumn(), new ColumnWeightData(1, 200)); TableViewerColumn idColumn = new TableViewerColumn(viewer, SWT.LEFT); idColumn.getColumn().setWidth(200); idColumn.getColumn().setText(Messages.getString("projectselector.header.id")); //$NON-NLS-1$ tableColumnLayout.setColumnData(idColumn.getColumn(), new ColumnWeightData(1, 200)); }
Example #24
Source File: DashboardView.java From MergeProcessor with Apache License 2.0 | 4 votes |
/** * @param parent a widget which will be the parent of the new instance (cannot * be null) * @param style the style of widget to construct */ public DashboardView(Composite parent, int style) { super(parent, style); setLayout(new GridLayout()); final Composite tableComposite = new Composite(this, SWT.NONE); final TableColumnLayout tableColumnLayout = new TableColumnLayout(); tableComposite.setLayout(tableColumnLayout); tableComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); tableViewer = new TableViewer(tableComposite, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI); final Table table = tableViewer.getTable(); table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); table.setLinesVisible(true); table.setHeaderVisible(true); statusViewerColumn = new TableViewerColumn(tableViewer, SWT.NONE); final TableColumn statusColumn = statusViewerColumn.getColumn(); tableColumnLayout.setColumnData(statusColumn, new ColumnPixelData(70)); statusColumn.setText(Messages.View_Column_Status); hostViewerColumn = new TableViewerColumn(tableViewer, SWT.NONE); final TableColumn hostColumn = hostViewerColumn.getColumn(); tableColumnLayout.setColumnData(hostColumn, new ColumnPixelData(120)); hostColumn.setText(Messages.View_Column_Host); repositoryViewerColumn = new TableViewerColumn(tableViewer, SWT.NONE); final TableColumn repositoryColumn = repositoryViewerColumn.getColumn(); tableColumnLayout.setColumnData(repositoryColumn, new ColumnPixelData(110)); repositoryColumn.setText(Messages.View_Column_Repository); dateViewerColumn = new TableViewerColumn(tableViewer, SWT.NONE); final TableColumn dateColumn = dateViewerColumn.getColumn(); tableColumnLayout.setColumnData(dateColumn, new ColumnPixelData(130)); dateColumn.setText(Messages.View_Column_Date); revisionViewerColumn = new TableViewerColumn(tableViewer, SWT.NONE); final TableColumn revisionColumn = revisionViewerColumn.getColumn(); tableColumnLayout.setColumnData(revisionColumn, new ColumnPixelData(100)); revisionColumn.setText(Messages.View_Column_Revision_Range); sourceBranchViewerColumn = new TableViewerColumn(tableViewer, SWT.NONE); final TableColumn sourceBranchColumn = sourceBranchViewerColumn.getColumn(); tableColumnLayout.setColumnData(sourceBranchColumn, new ColumnPixelData(120)); sourceBranchColumn.setText(Messages.View_Column_Source_Branch); targetBranchViewerColumn = new TableViewerColumn(tableViewer, SWT.NONE); final TableColumn targetBranchColumn = targetBranchViewerColumn.getColumn(); tableColumnLayout.setColumnData(targetBranchColumn, new ColumnPixelData(120)); targetBranchColumn.setText(Messages.View_Column_Target_Branch); mergeScriptViewerColumn = new TableViewerColumn(tableViewer, SWT.NONE); final TableColumn mergeScriptColumn = mergeScriptViewerColumn.getColumn(); tableColumnLayout.setColumnData(mergeScriptColumn, new ColumnPixelData(0)); mergeScriptColumn.setText(Messages.View_Column_Merge_Script); renameStatusViewerColumn = new TableViewerColumn(tableViewer, SWT.NONE); final TableColumn renameColumn = renameStatusViewerColumn.getColumn(); tableColumnLayout.setColumnData(renameColumn, new ColumnPixelData(23)); renameColumn.setText(Messages.View_Column_Renaming); final Composite buttonComposite = new Composite(this, SWT.NONE); buttonComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); buttonComposite.setLayout(new FillLayout()); btnMergeSelection = new Button(buttonComposite, SWT.PUSH); btnMergeSelection.setText(Messages.View_Button_Merge_Selection); btnIgnoreSelection = new Button(buttonComposite, SWT.PUSH); btnIgnoreSelection.setText(Messages.View_Button_Ignore_Selection); }
Example #25
Source File: TableViewerBuilder.java From n4js with Eclipse Public License 1.0 | 4 votes |
@Override protected AbstractColumnLayout createColumnLayout() { return new TableColumnLayout(); }
Example #26
Source File: MedicationHistoryTableComposite.java From elexis-3-core with Eclipse Public License 1.0 | 4 votes |
public MedicationHistoryTableComposite(Composite parent, int style){ super(parent, style); setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); layout = new TableColumnLayout(); setLayout(layout); viewer = new TableViewer(this, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI); viewer.getTable().setHeaderVisible(true); ColumnViewerToolTipSupport.enableFor(viewer, ToolTip.NO_RECREATE); viewer.addSelectionChangedListener(new ISelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent e){ IStructuredSelection is = (IStructuredSelection) viewer.getSelection(); MedicationTableViewerItem presc = (MedicationTableViewerItem) is.getFirstElement(); // set last disposition information Identifiable identifiable = (presc != null) ? presc.getLastDisposed() : null; medicationComposite.setLastDisposal(identifiable); // set writable databinding value medicationComposite.setSelectedMedication(presc); if (presc != null) { IPrescription selectedObj = presc.getPrescription(); ContextServiceHolder.get().getRootContext().setTyped(selectedObj); } else { ContextServiceHolder.get().getRootContext().removeTyped(IPrescription.class); } } }); MedicationViewerHelper.createTypeColumn(viewer, layout, 0); MedicationViewerHelper.createArticleColumn(viewer, layout, 1); MedicationViewerHelper.createDosageColumn(viewer, layout, 2); MedicationViewerHelper.createBeginColumn(viewer, layout, 3); MedicationViewerHelper.createIntakeCommentColumn(viewer, layout, 4); MedicationViewerHelper.createStopColumn(viewer, layout, 5); MedicationViewerHelper.createStopReasonColumn(viewer, layout, 6); MedicationViewerHelper.createMandantColumn(viewer, layout, 7); viewer.setContentProvider(new MedicationTableViewerContentProvider(viewer)); }
Example #27
Source File: EpfOutputDialog.java From workspacemechanic with Eclipse Public License 1.0 | 4 votes |
@Override protected void addChildConfiguration(Composite parent) { // Add preferences table Label savedPreferencesLabel = new Label(parent, SWT.BEGINNING); savedPreferencesLabel.setLayoutData(new GridData(SWT.BEGINNING, SWT.LEFT, true, false, 3, 1)); savedPreferencesLabel.setText("Saved Preferences:"); Composite tableContainer = new Composite(parent, SWT.NONE); GridData tableLayoutData = new GridData(SWT.FILL, SWT.FILL, true, true, 3, 1); tableContainer.setLayoutData(tableLayoutData); TableColumnLayout columnLayout = new TableColumnLayout(); tableContainer.setLayout(columnLayout); acceptedPreferences = CheckboxTableViewer.newCheckList(tableContainer, SWT.SINGLE | SWT.FULL_SELECTION); Table acceptedPreferencesTable = acceptedPreferences.getTable(); acceptedPreferencesTable.setHeaderVisible(true); acceptedPreferencesTable.setLinesVisible(true); // Setup table columns TableColumn keyColumn = new TableColumn(acceptedPreferencesTable, SWT.LEFT); keyColumn.setText("Key"); columnLayout.setColumnData(keyColumn, new ColumnWeightData(1, 300, true)); TableColumn valueColumn = new TableColumn(acceptedPreferencesTable, SWT.LEFT); valueColumn.setText("Value"); columnLayout.setColumnData(valueColumn, new ColumnWeightData(1, 100, true)); acceptedPreferences.setLabelProvider(labelProvider); acceptedPreferences.setContentProvider(new ArrayContentProvider()); acceptedPreferences.setInput(preferences.keySet().toArray()); acceptedPreferences.setAllChecked(true); acceptedPreferences.addCheckStateListener(new ICheckStateListener() { public void checkStateChanged(CheckStateChangedEvent event) { Set<String> newSelectedKeys = new HashSet<String>(); for (Object obj : acceptedPreferences.getCheckedElements()) { newSelectedKeys.add((String) obj); } selectedKeys = newSelectedKeys; validate(); } }); tableContainer.layout(); }
Example #28
Source File: SdkEnvironmentControl.java From xds-ide with Eclipse Public License 1.0 | 4 votes |
/** * Create the composite. * @param parent * @param style * @param editedSdk */ public SdkEnvironmentControl(Composite parent, int style, final Sdk editedSdk) { super(parent, style); this.editedSdk = editedSdk; selectedVar = null; setLayoutData(new GridData(GridData.FILL_BOTH)); setLayout(SwtUtils.removeMargins(new GridLayout(2, false))); Composite tableComposite = new Composite(this, SWT.NONE); tableComposite.setLayoutData(new GridData(GridData.FILL_BOTH)); tableComposite.setLayout(new GridLayout(1, false)); tableComposite.setBackground(new Color(Display.getDefault(), 255,0,0)); tableComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); TableColumnLayout tableColumnLayout = new TableColumnLayout(); tableComposite.setLayout(tableColumnLayout); tableViewer = new TableViewer(tableComposite, SWT.BORDER | SWT.FULL_SELECTION); table = tableViewer.getTable(); table.setHeaderVisible(true); table.setLinesVisible(true); columnName = new TableViewerColumn(tableViewer, SWT.NONE); tblclmnName = columnName.getColumn(); tableColumnLayout.setColumnData(tblclmnName, new ColumnPixelData(150, true, true)); tblclmnName.setText(Messages.SdkEnvironmentControl_Variable); columnLocation = new TableViewerColumn(tableViewer, SWT.NONE); tblclmnLocation = columnLocation.getColumn(); tableColumnLayout.setColumnData(tblclmnLocation, new ColumnPixelData(150, true, true)); tblclmnLocation.setText(Messages.SdkEnvironmentControl_Value); tableViewer.setContentProvider(new SdkEnvContentProvider()); tableViewer.setLabelProvider(new SdkEnvLabelProvider()); tableViewer.addSelectionChangedListener(new ISelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent event) { TableItem[] selectedItems = table.getSelection(); boolean isEnabled = selectedItems.length > 0; btnEdit.setEnabled(isEnabled); btnDelete.setEnabled(isEnabled); selectedVar = isEnabled ? (String)selectedItems[0].getData() : null; } }); Composite buttonsComposite = new Composite(this, SWT.NONE); buttonsComposite.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false, 1, 1)); buttonsComposite.setLayout(SwtUtils.removeMargins(new GridLayout(1, false))); btnNew = SWTFactory.createPushButton(buttonsComposite, Messages.SdkEnvironmentControl_New, null); btnNew.addSelectionListener(new AddVarButtonHandler()); btnEdit = SWTFactory.createPushButton(buttonsComposite, Messages.SdkEnvironmentControl_Edit, null); btnEdit.addSelectionListener(new EditValueButtonHandler()); btnEdit.setEnabled(false); btnDelete = SWTFactory.createPushButton(buttonsComposite, Messages.SdkEnvironmentControl_Delete, null); btnDelete.setEnabled(false); btnDelete.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { if (selectedVar != null) { editedSdk.removeEnvironmentVariable(selectedVar); tableViewer.setInput(editedSdk); } } }); tableViewer.setInput(editedSdk); }
Example #29
Source File: SelectionDialog.java From e4macs with Eclipse Public License 1.0 | 4 votes |
private final void createTableDialogArea(final Composite parent) { String[] inputKeys = getSelectableKeys(); int columnCount = 0; Point dimens = getColumnCount( parent, inputKeys, sizeHint.x); int count = dimens.x; GridLayout compositeLayout = new GridLayout(count,true); parent.setLayout(compositeLayout); parent.setLayoutData(new GridData(GridData.FILL_BOTH)); Table table = new Table(parent, SWT.V_SCROLL | SWT.HORIZONTAL | SWT.WRAP | SWT.FULL_SELECTION); //| SWT.MULTI); GridData gridData = new GridData(GridData.FILL_BOTH); table.setLayoutData(gridData); table.setBackground(parent.getBackground()); table.setLinesVisible(true); table.setHeaderVisible(false); int columnWidth = (sizeHint.x - getSizeAdjustment()) / count; TableColumn[] columns = new TableColumn[count]; for (int i = 0; i < count; i++) { columns[i] = new TableColumn(table, SWT.LEFT, columnCount++); columns[i].setWidth(columnWidth); } TableColumnLayout layout = new TableColumnLayout(); for (int i = 0; i < count; i++) { layout.setColumnData(columns[i], new ColumnWeightData(100/count,columnWidth,false)); } parent.setLayout(layout); int len = inputKeys.length; int rowCount = len / columnCount; if ((len - rowCount * columnCount) > 0) { rowCount++; } for (int i = 0; i < rowCount; i++) { String[] row = new String[columnCount]; for (int j = 0; j < columnCount; j++) { int sourceIndex = i * columnCount + j; row[j] = (sourceIndex < len ? (String) inputKeys[sourceIndex] : ""); //$NON-NLS-1$ } TableItem item = new TableItem(table, SWT.NULL); item.setText(row); } table.pack(); sizeHint.y = Math.min(table.getBounds().height + getSizeAdjustment(),sizeHint.y); Dialog.applyDialogFont(parent); addTableListeners(table); }
Example #30
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); }