Search in sources :

Example 6 with MinSizeTableColumnLayout

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);
}
Also used : FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) MinSizeTableColumnLayout(org.csstudio.ui.util.MinSizeTableColumnLayout) FormulaItem(org.csstudio.trends.databrowser3.model.FormulaItem) Table(org.eclipse.swt.widgets.Table) MouseEvent(org.eclipse.swt.events.MouseEvent) Composite(org.eclipse.swt.widgets.Composite) Label(org.eclipse.swt.widgets.Label) Text(org.eclipse.swt.widgets.Text) GridLayout(org.eclipse.swt.layout.GridLayout) MouseListener(org.eclipse.swt.events.MouseListener) MinSizeTableColumnLayout(org.csstudio.ui.util.MinSizeTableColumnLayout) TableColumnLayout(org.eclipse.jface.layout.TableColumnLayout) GridData(org.eclipse.swt.layout.GridData) TableViewer(org.eclipse.jface.viewers.TableViewer) FormAttachment(org.eclipse.swt.layout.FormAttachment)

Aggregations

MinSizeTableColumnLayout (org.csstudio.ui.util.MinSizeTableColumnLayout)6 TableColumnLayout (org.eclipse.jface.layout.TableColumnLayout)6 Composite (org.eclipse.swt.widgets.Composite)6 TableViewer (org.eclipse.jface.viewers.TableViewer)5 GridData (org.eclipse.swt.layout.GridData)5 GridLayout (org.eclipse.swt.layout.GridLayout)5 Label (org.eclipse.swt.widgets.Label)5 Table (org.eclipse.swt.widgets.Table)5 Button (org.eclipse.swt.widgets.Button)4 CellLabelProvider (org.eclipse.jface.viewers.CellLabelProvider)3 TableViewerColumn (org.eclipse.jface.viewers.TableViewerColumn)3 ViewerCell (org.eclipse.jface.viewers.ViewerCell)3 SelectionEvent (org.eclipse.swt.events.SelectionEvent)3 TableColumnSortHelper (org.csstudio.apputil.ui.swt.TableColumnSortHelper)2 ModelItem (org.csstudio.trends.databrowser3.model.ModelItem)2 ArrayContentProvider (org.eclipse.jface.viewers.ArrayContentProvider)2 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)2 Combo (org.eclipse.swt.widgets.Combo)2 AutoCompleteWidget (org.csstudio.autocomplete.ui.AutoCompleteWidget)1 ArchiveDataSource (org.csstudio.trends.databrowser3.model.ArchiveDataSource)1