use of org.csstudio.ui.util.MinSizeTableColumnLayout 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);
}
Aggregations