Package org.eclipse.jface.viewers

Examples of org.eclipse.jface.viewers.TableLayout


          };
        viewerPane.createControl(getContainer());
        tableViewer = (TableViewer)viewerPane.getViewer();

        Table table = tableViewer.getTable();
        TableLayout layout = new TableLayout();
        table.setLayout(layout);
        table.setHeaderVisible(true);
        table.setLinesVisible(true);

        TableColumn objectColumn = new TableColumn(table, SWT.NONE);
        layout.addColumnData(new ColumnWeightData(3, 100, true));
        objectColumn.setText(getString("_UI_ObjectColumn_label"));
        objectColumn.setResizable(true);

        TableColumn selfColumn = new TableColumn(table, SWT.NONE);
        layout.addColumnData(new ColumnWeightData(2, 100, true));
        selfColumn.setText(getString("_UI_SelfColumn_label"));
        selfColumn.setResizable(true);

        tableViewer.setColumnProperties(new String [] {"a", "b"});
        tableViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory));
View Full Code Here


        table.setHeaderVisible(true);

        // Sub-class the TableLayout in order to pad the 1st column so that its
        // width and the 2nd column's width == the table clientarea width.
        // This is a workaround for Windows which doesn't do this by default.
        TableLayout tableLayout = new TableLayout() {
            public void layout(Composite c, boolean flush) {
                super.layout(c, flush);

                // Ensure we are laying out a table.
                if (c instanceof Table) {
                    int tableWidth = c.getClientArea().width;
                    int orderWidth = orderColumn.getWidth();
                    if ((sequenceColumn.getWidth() + orderWidth) < tableWidth) {
                        // Adjust the sequence columns width.
                        sequenceColumn.setWidth(tableWidth - orderWidth);
                    }
                }
            }
        };
        tableLayout.addColumnData(new ColumnWeightData(600, 700, true));
        tableLayout.addColumnData(new ColumnWeightData(50, 50, true));
        table.setLayout(tableLayout);

        ruleTable = new TableViewer(table);
        ruleTable.setContentProvider(CONTENT_PROVIDER);
        final ILabelDecorator decorator = new ProxyLabelDecorator();
View Full Code Here

        final TableColumn column = new TableColumn(table, SWT.LEFT);

        // Sub-class the TableLayout in order to pad the 1st column (there should only be
        // one column) so that its width is the table clientarea width.
        // This is a workaround for Windows which doesn't do this by default.
        TableLayout tableLayout = new TableLayout() {
            public void layout(Composite c, boolean flush) {
                super.layout(c, flush);
                // Ensure we are laying out a table.
                if (c instanceof Table) {
                    int tableWidth = c.getClientArea().width;
View Full Code Here

        errorMarker.setAlignment(SWT.CENTER);
        important.setWidth(18);
        important.setResizable(false);
        important.setText("!");
        important.setAlignment(SWT.CENTER);
        final TableLayout tableLayout = new TableLayout() {
            // Javadoc inherited
            public void layout(Composite c, boolean flush) {
                super.layout(c, flush);

                // Ensure we are laying out a table.
                if (c instanceof Table) {
                    int tableWidth = c.getClientArea().width;
                    // The image columns are fixed at 18, leaving the rest of
                    // the space to be shared between the (resizable) property
                    // column and the (static) value column. We should try to
                    // honour the size set for the property column where we
                    // can.
                    int accountedWidth = 36 + property.getWidth();
                    // If the final column fits in the available space, trim it
                    // to fit the table. Otherwise give it a small fixed size.
                    if ((accountedWidth + 18) < tableWidth) {
                        value.setWidth(tableWidth - accountedWidth);
                    } else {
                        value.setWidth(18);
                        int propertyWidth = tableWidth - (3 * 18);
                        property.setWidth((propertyWidth > 18) ? propertyWidth : 18);
                    }
                }
            }
        };
        tableLayout.addColumnData(new ColumnWeightData(1, 18, true));
        tableLayout.addColumnData(new ColumnWeightData(1, 18, false));
        tableLayout.addColumnData(new ColumnWeightData(0, 18, false));
        tableLayout.addColumnData(new ColumnWeightData(0, 18, false));

        ControlListener columnResizeListener = new ControlAdapter() {
            // Javadoc inherited
            public void controlResized(ControlEvent event) {
                tableLayout.layout(table, true);
            }
        };

        TreeListener treeExpansionListener = new TreeListener() {
            private void treeChanged() {
                tableLayout.layout(table, true);
            }

            // Javadoc inherited
            public void treeCollapsed(TreeEvent event) {
                treeChanged();
            }

            // Javadoc inherited
            public void treeExpanded(TreeEvent event) {
                treeChanged();
            }
        };

        treeViewer = new TableTreeViewer(tree);
        treeViewer.setLabelProvider(new RuleTreeLabelProvider());
        treeViewer.setContentProvider(contentProvider);

        new DiagnosticsToolTipper(new TableItemContainer(table),
                new DiagnosticsToolTipper.ItemMapper() {
                    public Proxy dataFromItem(Item item) {
                        Proxy proxy = null;
                        if (item instanceof TableItem) {
                            Object tableTreeItem = item.getData("TableTreeItemID");
                            if (tableTreeItem instanceof Item) {
                                Object proxyObject = ((Item) tableTreeItem).getData();
                                if (proxyObject instanceof Proxy && ((Proxy) proxyObject).getModelObject() instanceof PropertyValue) {
                                    proxy = (Proxy) proxyObject;
                                }
                            }
                        }
                        return proxy;
                    }
                });

        table.setLayout(tableLayout);
        property.addControlListener(columnResizeListener);
        tree.addTreeListener(treeExpansionListener);
        tableLayout.layout(table, true);

        treeViewer.addSelectionChangedListener(new ISelectionChangedListener() {
            public void selectionChanged(SelectionChangedEvent event) {
                IStructuredSelection selection = (IStructuredSelection) event.getSelection();
                Proxy proxy = (Proxy) selection.getFirstElement();
View Full Code Here

                table.setHeaderVisible(true);

                // Sub-class the TableLayout in order to pad the 2nd column so
                // that the combined column widths fill the table. This is a
                // workaround for Windows which doesn't do this by default.
                final TableLayout tableLayout = new TableLayout() {
                    public void layout(Composite comp, boolean flush) {
                        super.layout(comp, flush);

                        // Ensure we are laying out a table.
                        if (comp instanceof Table) {
                            final int tableWidth = comp.getClientArea().width;

                            // Give the header and device column's a quarter
                            // of the width each, and the value column half of
                            // the width.
                            final int oneColWidth = tableWidth / 4;
                            int valueWidth = 2 * oneColWidth;
                            headerCol.setWidth(oneColWidth);
                            deviceCol.setWidth(oneColWidth);

                            // Check if integer division has resulted in left
                            // over pixels. If so, the Value column takes up
                            // the slack.
                            final int totalWidth = 4 * oneColWidth;

                            if (totalWidth < tableWidth) {
                                // Adjust the Value column's width.
                                valueWidth += (tableWidth - totalWidth);
                            }

                            valueCol.setWidth(valueWidth);
                        }
                    }
                };
                tableLayout.addColumnData(new ColumnWeightData(1, 100, true));
                tableLayout.addColumnData(new ColumnWeightData(2, 200, true));
                tableLayout.addColumnData(new ColumnWeightData(1, 100, true));
                table.setLayout(tableLayout);

                // Create the table's viewer.
                final TableViewer tableViewer = new TableViewer(table);

View Full Code Here

        // Use a TableLayout to enforce the width of columns - note that this
        // is required under Windows because the columns are not expanded to
        // fill the available space by default, resulting in an apparently
        // empty table.
        final TableLayout tableLayout = new TableLayout() {
            public void layout(Composite comp, boolean flush) {
                super.layout(comp, flush);

                // Ensure we are laying out a table.
                if (comp instanceof Table) {
                    final int tableWidth = comp.getClientArea().width;
                    column.setWidth(tableWidth);
                }
            }
        };
        tableLayout.addColumnData(new ColumnWeightData(1, false));
        table.setLayout(tableLayout);

        // Set column properties - note that this is not viewable text, and
        // so does not need internationalising. It is simply used as a column
        // name for internal calls
View Full Code Here

        addColumns(table);

        table.setHeaderVisible(true);

        TableLayout tableLayout = new TableLayout();
        table.setLinesVisible(true);
        table.setLayout(tableLayout);

        GridData tableData = new GridData(GridData.FILL_BOTH);
        tableData.heightHint = TABLE_HEIGHT_HINT;
View Full Code Here

            | SWT.H_SCROLL | SWT.V_SCROLL);
    table.setLinesVisible(true);
    table.setHeaderVisible(true);
    String headers[] = { Messages.DDE_EnvVariable_Table_NAME, Messages.DDE_EnvVariable_Table_VALUE };
   
    TableLayout tableLayout = new TableLayout();
    table.setLayout(tableLayout);

    for (int i = 0; i < headers.length; i++) {
      tableLayout.addColumnData(envTableColumnLayouts[i]);
      TableColumn tc = new TableColumn(table, SWT.NONE, i);
      tc.setResizable(true);
      tc.setText(headers[i]);
    }
View Full Code Here

    }

    private TableViewer multiColumnViewer(Composite parent) {
        Table table = new Table(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI | SWT.FULL_SELECTION);

        TableLayout layout = new TableLayout();
        table.setLayout(layout);

        table.setLinesVisible(true);
        table.setHeaderVisible(true);

        layout.addColumnData(new ColumnWeightData(1, 20, true));
        new TableColumn(table, SWT.LEFT);

        layout.addColumnData(new ColumnWeightData(5, 40, true));
        TableColumn tc1 = new TableColumn(table, SWT.LEFT);
        tc1.setText(COLUMN_NAMES[0]);

        layout.addColumnData(new ColumnWeightData(10, true));
        TableColumn tc2 = new TableColumn(table, SWT.LEFT);
        tc2.setText(COLUMN_NAMES[1]);

        layout.addColumnData(new ColumnWeightData(10, true));
        TableColumn tc3 = new TableColumn(table, SWT.LEFT);
        tc3.setText(COLUMN_NAMES[2]);

        return new TableViewer(table);
View Full Code Here

   
    // Create a table
      viewer = new Table(composite, SWT.FULL_SELECTION | SWT.BORDER);
      viewer.setLayoutData(new GridData(GridData.FILL_BOTH));
     
      TableLayout layout = new TableLayout();
    layout.addColumnData(new ColumnWeightData(80, 10, true));
    layout.addColumnData(new ColumnWeightData(20, 10, true));
    viewer.setLayout(layout);
     
      _fileCol = new TableColumn(viewer, SWT.LEFT);
      _fileCol.setText(Messages.getString("TagUpdateProblemDialog.ColHeaderFile")); //$NON-NLS-1$
      _errorCol = new TableColumn(viewer, SWT.LEFT);
View Full Code Here

TOP

Related Classes of org.eclipse.jface.viewers.TableLayout

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.