use of org.eclipse.jface.layout.TableColumnLayout in project org.csstudio.display.builder by kasemir.
the class DataBrowserPropertySheetPage method createTracesTabItemPanel.
/**
* Within SashForm of the "Traces" tab, create the Model Item table
* @param sashform
*/
private void createTracesTabItemPanel(final SashForm sashform) {
// TableColumnLayout requires the TableViewer to be in its own Composite!
final Composite model_item_top = new Composite(sashform, SWT.BORDER);
final TableColumnLayout table_layout = new MinSizeTableColumnLayout(10);
model_item_top.setLayout(table_layout);
// Would like to _not_ use FULL_SELECTION so that only the currently selected
// cell gets highlighted, allowing the 'color' to still be visible
// -> On Linux, you only get FULL_SELECTION behavior.
// -> On Windows, editing is really odd, need to select a column before anything
// can be edited, plus color still invisible
// ---> Using FULL_SELECTION
trace_table = new TableViewer(model_item_top, SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI | SWT.FULL_SELECTION);
final Table table = trace_table.getTable();
table.setHeaderVisible(true);
table.setLinesVisible(true);
final TraceTableHandler tth = new TraceTableHandler();
tth.createColumns(table_layout, operations_manager, trace_table);
trace_table.setContentProvider(tth);
trace_table.setInput(model);
new ControlSystemDragSource(trace_table.getControl()) {
@Override
public Object getSelection() {
final IStructuredSelection selection = (IStructuredSelection) trace_table.getSelection();
final Object[] objs = selection.toArray();
final ModelItem[] items = Arrays.copyOf(objs, objs.length, ModelItem[].class);
return items;
}
};
}
use of org.eclipse.jface.layout.TableColumnLayout in project org.csstudio.display.builder by kasemir.
the class DataBrowserPropertySheetPage method createValueAxesTab.
/**
* Create tab for traces (PVs, Formulas)
* @param tabs
*/
private void createValueAxesTab(final TabFolder tab_folder) {
final TabItem axes_tab = new TabItem(tab_folder, 0);
axes_tab.setText(Messages.ValueAxes);
final Composite parent = new Composite(tab_folder, 0);
parent.setLayout(new GridLayout());
// Rescale options
final Composite rescale = new Composite(parent, 0);
rescale.setLayout(new RowLayout());
rescale.setLayoutData(new GridData(SWT.FILL, 0, true, false));
final Label l = new Label(rescale, 0);
l.setText(Messages.ArchiveRescale_Label);
final ArchiveRescale[] rescale_items = ArchiveRescale.values();
rescales = new Button[rescale_items.length];
for (int i = 0; i < rescales.length; ++i) {
final ArchiveRescale item = rescale_items[i];
if (item.ordinal() != i)
// $NON-NLS-1$
throw new Error("ArchiveRescale items out of order");
rescales[i] = new Button(rescale, SWT.RADIO);
rescales[i].setText(item.toString());
if (model.getArchiveRescale() == item)
rescales[i].setSelection(true);
rescales[i].addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(final SelectionEvent e) {
// Only react to the selected button
if (model.getArchiveRescale() == item)
return;
new ChangeArchiveRescaleCommand(model, operations_manager, item);
}
});
}
// TableColumnLayout requires the TableViewer to be in its own Composite!
final Composite table_parent = new Composite(parent, 0);
table_parent.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
final TableColumnLayout table_layout = new MinSizeTableColumnLayout(10);
table_parent.setLayout(table_layout);
final AxesTableHandler ath = new AxesTableHandler(table_parent, table_layout, operations_manager);
ath.getAxesTable().setInput(model);
axes_tab.setControl(parent);
}
use of org.eclipse.jface.layout.TableColumnLayout in project org.csstudio.display.builder by kasemir.
the class DataBrowserPropertySheetPage method createTracesTabDetailPanel.
/**
* Within SashForm of the "Traces" tab, create the Item item detail panel:
* PV archive data sources, Formula
* @param sashform
* @param trace_table TableViewer for the trace table
*/
private void createTracesTabDetailPanel(final SashForm sashform) {
final Composite item_detail_top = new Composite(sashform, SWT.BORDER);
item_detail_top.setLayout(new FormLayout());
archive_panel = new Composite(item_detail_top, 0);
FormData fd = new FormData();
fd.left = new FormAttachment(0);
fd.top = new FormAttachment(0);
fd.right = new FormAttachment(100);
fd.bottom = new FormAttachment(100);
archive_panel.setLayoutData(fd);
archive_panel.setLayout(new GridLayout());
Label l = new Label(archive_panel, 0);
l.setText(Messages.ArchiveDataSources);
l.setLayoutData(new GridData());
// TableColumnLayout requires the TableViewer to be in its own Composite!
final Composite table_parent = new Composite(archive_panel, 0);
table_parent.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
final TableColumnLayout table_layout = new MinSizeTableColumnLayout(10);
table_parent.setLayout(table_layout);
archive_table = new TableViewer(table_parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI | SWT.FULL_SELECTION | SWT.VIRTUAL);
final Table table = archive_table.getTable();
table.setHeaderVisible(true);
table.setLinesVisible(true);
final ArchivesTableHandler ath = new ArchivesTableHandler();
ath.createColumns(table_layout, operations_manager, archive_table);
archive_table.setContentProvider(ath);
formula_panel = new Composite(item_detail_top, 0);
fd = new FormData();
fd.left = new FormAttachment(0);
fd.top = new FormAttachment(0);
fd.right = new FormAttachment(100);
fd.bottom = new FormAttachment(100);
formula_panel.setLayoutData(fd);
formula_panel.setLayout(new GridLayout(2, false));
l = new Label(formula_panel, 0);
l.setText(Messages.FormulaLabel);
l.setLayoutData(new GridData());
formula_txt = new Text(formula_panel, SWT.READ_ONLY | SWT.BORDER);
formula_txt.setLayoutData(new GridData(SWT.FILL, 0, true, false));
formula_txt.setToolTipText(Messages.FormulaLabelEditTT);
formula_txt.addMouseListener(new MouseListener() {
@Override
public void mouseDown(MouseEvent e) {
final Object item = ((IStructuredSelection) trace_table.getSelection()).getFirstElement();
if (!(item instanceof FormulaItem))
return;
final FormulaItem formula = (FormulaItem) item;
final EditFormulaDialog dlg = new EditFormulaDialog(operations_manager, formula_txt.getShell(), formula);
dlg.open();
}
@Override
public void mouseUp(MouseEvent e) {
/* NOP */
}
@Override
public void mouseDoubleClick(MouseEvent e) {
/* NOP */
}
});
archive_panel.setVisible(false);
formula_panel.setVisible(false);
}
use of org.eclipse.jface.layout.TableColumnLayout in project liferay-ide by liferay.
the class FindBreakingChangesPage method _createColumns.
private void _createColumns(final TableViewer problemsViewer) {
final String[] titles = { "Resolved", "Line", "Problem" };
TableViewerColumn col0 = _createTableViewerColumn(titles[0], problemsViewer);
col0.getColumn().pack();
col0.setEditingSupport(new EditingSupport(problemsViewer) {
@Override
protected boolean canEdit(Object element) {
return true;
}
@Override
protected CellEditor getCellEditor(Object element) {
return new CheckboxCellEditor(problemsViewer.getTable());
}
@Override
protected Object getValue(Object element) {
return ((Problem) element).getStatus() == Problem.STATUS_RESOLVED;
}
@Override
protected void setValue(Object element, Object value) {
if (value == Boolean.TRUE) {
new MarkDoneAction().run((Problem) element, problemsViewer);
} else {
new MarkUndoneAction().run((Problem) element, problemsViewer);
}
}
});
col0.setLabelProvider(new ColumnLabelProvider() {
@Override
public Image getImage(Object element) {
Problem p = (Problem) element;
if (p.getStatus() == Problem.STATUS_RESOLVED) {
return _imageChecked;
} else {
return _imageUnchecked;
}
}
@Override
public String getText(Object element) {
return null;
}
});
TableViewerColumn col1 = _createTableViewerColumn(titles[1], problemsViewer);
col1.getColumn().pack();
col1.setLabelProvider(new ColumnLabelProvider() {
@Override
public String getText(Object element) {
Problem p = (Problem) element;
return p.lineNumber > -1 ? (p.lineNumber + "") : "";
}
});
TableViewerColumn col2 = _createTableViewerColumn(titles[2], problemsViewer);
col2.getColumn().pack();
col2.setLabelProvider(new ColumnLabelProvider() {
@Override
public String getText(Object element) {
Problem p = (Problem) element;
return p.title;
}
@Override
public void update(ViewerCell cell) {
super.update(cell);
Table table = problemsViewer.getTable();
table.getColumn(2).pack();
}
});
TableColumnLayout tableLayout = new TableColumnLayout();
TableColumn column0 = col0.getColumn();
TableColumn column1 = col1.getColumn();
TableColumn column2 = col2.getColumn();
tableLayout.setColumnData(column0, new ColumnWeightData(50, column0.getWidth()));
tableLayout.setColumnData(column1, new ColumnWeightData(50, column1.getWidth()));
tableLayout.setColumnData(column2, new ColumnWeightData(100, column2.getWidth()));
Table table = problemsViewer.getTable();
table.getParent().setLayout(tableLayout);
}
use of org.eclipse.jface.layout.TableColumnLayout in project core by jcryptool.
the class CommonPropertyDialog method createDialogArea.
/**
* Create contents of the dialog.
*
* @param parent
*/
@Override
protected Control createDialogArea(Composite parent) {
Composite area = (Composite) super.createDialogArea(parent);
Composite composite = new Composite(area, SWT.NONE);
TableColumnLayout tclComposite = new TableColumnLayout();
composite.setLayout(tclComposite);
TableViewer tableViewer = new TableViewer(composite, SWT.BORDER | SWT.FULL_SELECTION | SWT.H_SCROLL);
tableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent event) {
StructuredSelection selection = (StructuredSelection) event.getSelectionProvider().getSelection();
TableEntry tableEntry = (TableEntry) selection.getFirstElement();
final Clipboard cb = new Clipboard(Display.getCurrent());
cb.setContents(new Object[] { tableEntry.getValue() }, new Transfer[] { TextTransfer.getInstance() });
}
});
table = tableViewer.getTable();
table.setHeaderVisible(true);
table.setLinesVisible(true);
TableViewerColumn tableViewerNameColumn = new TableViewerColumn(tableViewer, SWT.NONE);
tableViewerNameColumn.setLabelProvider(new ColumnLabelProvider() {
@Override
public Image getImage(Object element) {
return null;
}
@Override
public String getText(Object element) {
TableEntry entry = (TableEntry) element;
return entry == null ? "" : entry.getName();
}
});
TableColumn tblclmnNameColumn = tableViewerNameColumn.getColumn();
tclComposite.setColumnData(tblclmnNameColumn, new ColumnWeightData(1, 2));
// $NON-NLS-1$
tblclmnNameColumn.setText(Messages.getString("AbstractKeyDialog.tblclmnNameColumn.text"));
TableViewerColumn tableViewerValueColumn = new TableViewerColumn(tableViewer, SWT.NONE);
tableViewerValueColumn.setLabelProvider(new ColumnLabelProvider() {
@Override
public Image getImage(Object element) {
return null;
}
@Override
public String getText(Object element) {
TableEntry entry = (TableEntry) element;
return entry == null ? "" : entry.getValue();
}
});
TableColumn tblclmnValueColumn = tableViewerValueColumn.getColumn();
tclComposite.setColumnData(tblclmnValueColumn, new ColumnWeightData(2, 2));
// $NON-NLS-1$
tblclmnValueColumn.setText(Messages.getString("AbstractKeyDialog.tblclmnValueColumn.text"));
tableViewer.setContentProvider(getContentProvider());
tableViewer.setInput(treeNode);
Label lblTableLabel = new Label(area, SWT.NONE);
// $NON-NLS-1$
lblTableLabel.setText(Messages.getString("AbstractKeyDialog.lblTableLabel.text"));
GroupLayout glArea = new GroupLayout(area);
glArea.setHorizontalGroup(glArea.createParallelGroup(GroupLayout.LEADING).add(glArea.createSequentialGroup().addContainerGap().add(glArea.createParallelGroup(GroupLayout.LEADING).add(lblTableLabel).add(composite, GroupLayout.DEFAULT_SIZE, 492, Short.MAX_VALUE)).addContainerGap()));
glArea.setVerticalGroup(glArea.createParallelGroup(GroupLayout.LEADING).add(glArea.createSequentialGroup().addContainerGap().add(lblTableLabel).addPreferredGap(LayoutStyle.RELATED).add(composite, GroupLayout.DEFAULT_SIZE, 272, Short.MAX_VALUE).addContainerGap()));
area.setLayout(glArea);
return area;
}
Aggregations