Package org.eclipse.jface.layout

Examples of org.eclipse.jface.layout.TableColumnLayout


        Composite tableParent = new Composite(composite, SWT.NONE);
        final GridData layoutData = new GridData(GridData.FILL_BOTH);
        layoutData.heightHint = 150;
        tableParent.setLayoutData(layoutData);
        TableColumnLayout tableLayout = new TableColumnLayout();
        tableParent.setLayout(tableLayout);
        viewer = new TableViewer(tableParent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER );
        viewer.getTable().setLinesVisible(true);
        viewer.getTable().setHeaderVisible(true);
       
        // accessing property here directly, instead of going via (JcrProperty)inputElement;
        String[] rawLines = property.getValuesAsString();
        // convert raw lines to Line objects for easier editing management
        for (int i = 0; i < rawLines.length; i++) {
            lines.add(new Line(rawLines[i]));
        }
       
        viewer.setContentProvider(new IStructuredContentProvider() {
           
            @Override
            public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
            }
           
            @Override
            public void dispose() {
            }

            @Override
            public Object[] getElements(Object inputElement) {
                return lines.toArray();
            }
        });
       
        TableViewerColumn column0 = new TableViewerColumn(viewer, SWT.NONE);
        column0.getColumn().setText("Type");
        column0.getColumn().setResizable(true);
        column0.getColumn().setWidth(100);
        tableLayout.setColumnData(column0.getColumn(), new ColumnWeightData(20, 100));
        column0.setLabelProvider(new CellLabelProvider() {
           
            @Override
            public void update(ViewerCell cell) {
                try{
                    cell.setText(property.getTypeAsString());
                    cell.setForeground(greyColor);
                } catch(Exception e) {
                    cell.setText("n/a");
                    cell.setForeground(greyColor);
                }
            }
        });

        TableViewerColumn column1 = new TableViewerColumn(viewer, SWT.NONE);
        column1.getColumn().setText("Value");
        column1.getColumn().setResizable(true);
        column1.getColumn().setWidth(200);
        tableLayout.setColumnData(column1.getColumn(), new ColumnWeightData(80, 200));

        column1.setLabelProvider(new CellLabelProvider() {
           
            @Override
            public void update(ViewerCell cell) {
View Full Code Here


        GridData data= new GridData(GridData.FILL_BOTH);
        data.widthHint= 360;
        data.heightHint= convertHeightInCharsToPixels(10);
        tableComposite.setLayoutData(data);
       
        TableColumnLayout columnLayout = new TableColumnLayout();
        tableComposite.setLayout(columnLayout);
    Table table= new Table(tableComposite, SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL);

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

    GC gc= new GC(getShell());
    gc.setFont(JFaceResources.getDialogFont());

    TableColumn column1= new TableColumn(table, SWT.NONE);
    column1.setText(columnName);
    int minWidth= computeMinimumColumnWidth(gc, columnName);
    columnLayout.setColumnData(column1, new ColumnWeightData(1, minWidth, true));

    TableColumn column2= new TableColumn(table, SWT.NONE);
    column2.setText(columnValue);
    minWidth= computeMinimumColumnWidth(gc, columnValue);
    columnLayout.setColumnData(column2, new ColumnWeightData(3, minWidth, true));
   
    gc.dispose();

    fTableViewer= new TableViewer(table);
    fTableViewer.setLabelProvider(new TemplateLabelProvider());
View Full Code Here

  }

  private TableViewer createTableViewer(Composite parent, String[] columnNames, int[] columnWeights) {
    Composite container = new Composite(parent, SWT.NONE);
    GridDataFactory.fillDefaults().grab(true, true).hint(600, 200).applyTo(container);
    TableColumnLayout layout = new TableColumnLayout();
    container.setLayout(layout);

    Table table = new Table(container, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI);
    table.setHeaderVisible(true);

    for (int i = 0; i < columnNames.length; i++) {
      TableColumn column = new TableColumn(table, SWT.NONE);
      column.setText(columnNames[i]);
      layout.setColumnData(column, new ColumnWeightData(columnWeights[i]));
    }

    TableViewer tableViewer = new TableViewer(table);
    tableViewer.setColumnProperties(columnNames);
    return tableViewer;
View Full Code Here

//        tableParent.setBackground(new Color(Display.getDefault(), 100,20,180));
        GridData tableLayoutData = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1);
        tableLayoutData.widthHint = 1; // shrink to min - table settings will resize to correct ratios
        tableLayoutData.heightHint = SWT.DEFAULT;
        tableParent.setLayoutData(tableLayoutData);
        TableColumnLayout tableLayout = new TableColumnLayout() {
            @Override
            protected Point computeSize(Composite composite, int wHint,
                    int hHint, boolean flushCache) {
                Point p = super.computeSize(composite, wHint, hHint, flushCache);
                return new Point(p.x, p.y);
            }
        };
        tableParent.setLayout(tableLayout);
       
        viewer = new TableViewer(tableParent, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER | SWT.HIDE_SELECTION | SWT.FULL_SELECTION);
        TableViewerFocusCellManager focusCellManager = new TableViewerFocusCellManager(
                viewer, new FocusCellOwnerDrawHighlighter(viewer), new CellNavigationStrategy());
        ColumnViewerEditorActivationStrategy actSupport = new ColumnViewerEditorActivationStrategy(
                viewer){

            @Override
            protected boolean isEditorActivationEvent(
                    ColumnViewerEditorActivationEvent event) {
                resetLastValueEdited();
                return event.eventType == ColumnViewerEditorActivationEvent.TRAVERSAL
                        || event.eventType == ColumnViewerEditorActivationEvent.MOUSE_DOUBLE_CLICK_SELECTION
                        || (event.eventType == ColumnViewerEditorActivationEvent.KEY_PRESSED && event.keyCode == SWT.CR)
                        || event.eventType == ColumnViewerEditorActivationEvent.PROGRAMMATIC;
            }
        };
        int features = ColumnViewerEditor.TABBING_HORIZONTAL
                | ColumnViewerEditor.TABBING_MOVE_TO_ROW_NEIGHBOR
                | ColumnViewerEditor.TABBING_VERTICAL
                | ColumnViewerEditor.KEYBOARD_ACTIVATION
                | ColumnViewerEditor.KEEP_EDITOR_ON_DOUBLE_CLICK;
        TableViewerEditor.create(viewer, focusCellManager, actSupport, features);
        viewer.getTable().setLinesVisible(true);
        viewer.getTable().setHeaderVisible(true);
        viewer.setContentProvider(new ViewContentProvider());
    viewer.addSelectionChangedListener(new ISelectionChangedListener() {
           
            @Override
            public void selectionChanged(SelectionChangedEvent event) {
                final ISelection selection = event.getSelection();
                if (selection instanceof IStructuredSelection) {
                    IStructuredSelection iss = (IStructuredSelection)selection;
                    if (iss.isEmpty()) {
                        deleteAction.setEnabled(false);
                    } else {
                        deleteAction.setEnabled(true);
                    }
                } else {
                    deleteAction.setEnabled(false);
                }
            }
        });
   
    CellLabelProvider clp = new JcrCellLabelProvider(viewer);

    TableViewerColumn column0 = new TableViewerColumn(viewer, SWT.NONE);
    column0.getColumn().setText("Name");
    column0.getColumn().setResizable(true);
    column0.getColumn().setWidth(200);
        tableLayout.setColumnData(column0.getColumn(), new ColumnWeightData(30, 140));

        final TableViewerColumn column1 = new TableViewerColumn(viewer, SWT.NONE);
        column1.getColumn().setText("Type");
        column1.getColumn().setResizable(true);
        column1.getColumn().setWidth(300);
        column1.setLabelProvider(clp);
        tableLayout.setColumnData(column1.getColumn(), new ColumnWeightData(10, 80));
       
        final TableViewerColumn column2 = new TableViewerColumn(viewer, SWT.NONE);
        column2.getColumn().setText("Value");
        column2.getColumn().setResizable(true);
        column2.getColumn().setWidth(300);
        tableLayout.setColumnData(column2.getColumn(), new ColumnWeightData(70, 220));
       
        final TableViewerColumn column3 = new TableViewerColumn(viewer, SWT.NONE);
        column3.getColumn().setText("Protected");
        column3.getColumn().setResizable(true);
        column3.getColumn().setWidth(300);
        column3.setLabelProvider(clp);
        tableLayout.setColumnData(column3.getColumn(), new ColumnWeightData(5, 57));

        final TableViewerColumn column4 = new TableViewerColumn(viewer, SWT.NONE);
        column4.getColumn().setText("Mandatory");
        column4.getColumn().setResizable(true);
        column4.getColumn().setWidth(300);
        column4.setLabelProvider(clp);
        tableLayout.setColumnData(column4.getColumn(), new ColumnWeightData(5, 62));

        final TableViewerColumn column5 = new TableViewerColumn(viewer, SWT.NONE);
        column5.getColumn().setText("Multiple");
        column5.getColumn().setResizable(true);
        column5.getColumn().setWidth(300);
        column5.setLabelProvider(clp);
        tableLayout.setColumnData(column5.getColumn(), new ColumnWeightData(5, 82));

        final TableViewerColumn column6 = new TableViewerColumn(viewer, SWT.NONE);
        column6.getColumn().setText("Auto Created");
        column6.getColumn().setResizable(true);
        column6.getColumn().setWidth(300);
        column6.setLabelProvider(clp);
        tableLayout.setColumnData(column6.getColumn(), new ColumnWeightData(5, 77));

        column0.setLabelProvider(clp);
        column0.setEditingSupport(new JcrEditingSupport(this, viewer, ColumnId.NAME));

        column1.setLabelProvider(clp);
View Full Code Here

        Composite composite = new Composite(parent, SWT.NONE);
        composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

        // Add TableColumnLayout
        TableColumnLayout layout = new TableColumnLayout();
        composite.setLayout(layout);

        // Instantiate TableViewer
        projects = new Table(composite, SWT.CHECK | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION);
        projects.setHeaderVisible(true);
        projects.setLinesVisible(true);
        projects.addSelectionListener(new SelectionListener() {
            public void widgetSelected(SelectionEvent e) {
                selectionListener.widgetSelected(e);
            }

            public void widgetDefaultSelected(SelectionEvent e) {
                selectionListener.widgetDefaultSelected(e);
            }
        });
        tableViewer = new CheckboxTableViewer(projects);
        tableViewer.setUseHashlookup(true);

        // Project
        TableViewerColumn tableViewerColumn = new TableViewerColumn(tableViewer, SWT.LEFT);
        TableColumn tableCol = tableViewerColumn.getColumn();
        layout.setColumnData(tableCol, new ColumnWeightData(60, 100, true));
        tableCol.setText(Messages.project1);

        // Repository
        tableViewerColumn = new TableViewerColumn(tableViewer, SWT.LEFT);
        tableCol = tableViewerColumn.getColumn();
        layout.setColumnData(tableCol, new ColumnWeightData(26, 80, true));
        tableCol.setText(Messages.repository);
        tableViewerColumn.setEditingSupport(new InlineComboEditingSupport(tableViewer));

        // Bundles
        tableViewerColumn = new TableViewerColumn(tableViewer, SWT.CENTER);
        tableCol = tableViewerColumn.getColumn();
        layout.setColumnData(tableCol, new ColumnWeightData(14, 35, true));
        tableCol.setText(Messages.bundles);

        contentProvider = new ContentProvider();
        tableViewer.setContentProvider(contentProvider);
        tableViewer.setLabelProvider(new TableLabelProvider());
View Full Code Here

        Composite composite = new Composite(parent, SWT.NONE);
        composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

        // Add TableColumnLayout
        TableColumnLayout layout = new TableColumnLayout();
        composite.setLayout(layout);

        // Instantiate TableViewer
        projects = new Table(composite, SWT.CHECK | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION);
        projects.setHeaderVisible(true);
        projects.setLinesVisible(true);
        projects.addSelectionListener(new SelectionListener() {
            public void widgetSelected(SelectionEvent e) {
                selectionListener.widgetSelected(e);
            }
            public void widgetDefaultSelected(SelectionEvent e) {
                selectionListener.widgetDefaultSelected(e);
            }
        });
        tableViewer = new CheckboxTableViewer(projects);
        tableViewer.setUseHashlookup(true);

        // Project
        TableViewerColumn tableViewerColumn = new TableViewerColumn(tableViewer, SWT.LEFT);
        TableColumn tableCol = tableViewerColumn.getColumn();
        layout.setColumnData(tableCol, new ColumnWeightData(20, 100, true));
        tableCol.setText(Messages.project1);

        // Repository
        tableViewerColumn = new TableViewerColumn(tableViewer, SWT.LEFT);
        tableCol = tableViewerColumn.getColumn();
        layout.setColumnData(tableCol, new ColumnWeightData(15, 80, true));
        tableCol.setText(Messages.repository);
        tableViewerColumn.setEditingSupport(new InlineComboEditingSupport(tableViewer));

        // Bundles
        tableViewerColumn = new TableViewerColumn(tableViewer, SWT.CENTER);
        tableCol = tableViewerColumn.getColumn();
        layout.setColumnData(tableCol, new ColumnPixelData(35, true, true));
        tableCol.setText(Messages.bundles);

        contentProvider = new ContentProvider();
        tableViewer.setContentProvider(contentProvider);
        tableViewer.setLabelProvider(new TableLabelProvider());
View Full Code Here

        TableColumn value = new TableColumn(table, SWT.NONE);
        value.setText(valueString);
        TableColumn type = new TableColumn(table, SWT.NONE);
        type.setText(typeString);
        // layout
        TableColumnLayout layout = new TableColumnLayout();
        layout.setColumnData(name, new ColumnWeightData(40, true));
        layout.setColumnData(value, new ColumnWeightData(40, true));
        layout.setColumnData(type, new ColumnWeightData(20, true));
        comp.setLayout(layout);

        // activate editing
        tableViewer.setColumnProperties(new String[]{nameString, valueString, typeString});
        tableViewer.setCellModifier(new ICellModifier(){
View Full Code Here

    }
   
    private void createHotlinksTable(Composite parent) {
       
        final Composite tableComposite = new Composite(parent, SWT.NONE);
        final TableColumnLayout columnLayout = new TableColumnLayout();
        tableComposite.setLayout(columnLayout);
        tableComposite.setLayoutData("pushy, grow, wmax 85%"); //$NON-NLS-1$
       
        hotlinkViewer = new TableViewer(tableComposite, SWT.SINGLE | SWT.BORDER | SWT.V_SCROLL
                | SWT.H_SCROLL | SWT.FULL_SELECTION);
        hotlinkViewer.setContentProvider(ArrayContentProvider.getInstance());
       
        TableViewerColumn column = new TableViewerColumn(hotlinkViewer, SWT.NONE);
        column.getColumn().setText(""); //$NON-NLS-1$
        column.setLabelProvider(new ColumnLabelProvider() {
            @Override
            public String getText(Object element) {
                return ""; //$NON-NLS-1$
            }
            @Override
            public Image getImage(Object element) {
                final HotlinkDescriptor descriptor = (HotlinkDescriptor) element;
                switch (descriptor.getType()) {
                case FILE:
                    return PlatformUI.getWorkbench().getSharedImages()
                            .getImage(ISharedImages.IMG_OBJ_FILE);
                case WEB:
                    return InfoPlugin.getDefault().getImageRegistry()
                            .get(InfoPlugin.IMG_OBJ_LINK);
                case ACTION:
                    return InfoPlugin.getDefault().getImageRegistry()
                            .get(InfoPlugin.IMG_OBJ_ACTION);
                default:
                    break;
                }
                return PlatformUI.getWorkbench().getSharedImages()
                        .getImage(ISharedImages.IMG_OBJ_ELEMENT);
            }
        });
        columnLayout.setColumnData(column.getColumn(), new ColumnWeightData(8, 0, false));
       
        column = new TableViewerColumn(hotlinkViewer, SWT.NONE);
        column.getColumn().setText(Messages.Document_Label_Column);
        column.setLabelProvider(new ColumnLabelProvider() {
            @Override
            public String getText(Object element) {
                final HotlinkDescriptor descriptor = (HotlinkDescriptor) element;
                return descriptor.getLabel();
            }
        });
        columnLayout.setColumnData(column.getColumn(), new ColumnWeightData(25, 0, true));
       
        column = new TableViewerColumn(hotlinkViewer, SWT.NONE);
        column.getColumn().setText(Messages.Document_Attribute_Column);
        column.setLabelProvider(new ColumnLabelProvider() {
            @Override
            public String getText(Object element) {
                HotlinkDescriptor descriptor = (HotlinkDescriptor) element;
                return descriptor.getAttributeName();
            }
        });
        columnLayout.setColumnData( column.getColumn(), new ColumnWeightData( 25, 0, true ));
       
        column = new TableViewerColumn(hotlinkViewer, SWT.NONE);
        column.getColumn().setText(Messages.Document_Hotlink_Column);
        column.getColumn().setAlignment(SWT.CENTER);
        column.setLabelProvider(new ColumnLabelProvider() {
            @Override
            public String getText(Object element) {
                HotlinkDescriptor descriptor = (HotlinkDescriptor) element;
                return DocUtils.toCamelCase(descriptor.getType().toString());
            }
        });
        columnLayout.setColumnData( column.getColumn(), new ColumnWeightData( 15, 0, true ));
       
        column = new TableViewerColumn(hotlinkViewer, SWT.NONE);
        column.getColumn().setText(Messages.Document_Action_Column);
        column.setLabelProvider(new ColumnLabelProvider() {
            @Override
            public String getText(Object element) {
                HotlinkDescriptor descriptor = (HotlinkDescriptor) element;
                if( descriptor.getConfig() == null ){
                    return Messages.DocumentPropertyPage_Open;
                }
                return descriptor.getConfig();
            }
        });
        columnLayout.setColumnData( column.getColumn(), new ColumnWeightData( 30, 0, true ));
       
        hotlinkViewer.getTable().setHeaderVisible(true);
        hotlinkViewer.getTable().setLinesVisible(true);
        hotlinkViewer.addSelectionChangedListener(new ISelectionChangedListener() {
            @Override
View Full Code Here

        gd= new GridData(SWT.FILL, SWT.TOP, true, false);
   
    gd.horizontalSpan= 2;
    gd.horizontalIndent= 20;
    editorComposite.setLayoutData(gd);
    TableColumnLayout tableColumnlayout= new TableColumnLayout();
    editorComposite.setLayout(tableColumnlayout);
   
    // Hyperlink detector table
    Table hyperlinkDetectorTable= new Table(editorComposite, SWT.H_SCROLL | SWT.V_SCROLL | SWT.SINGLE | SWT.BORDER | SWT.FULL_SELECTION | SWT.CHECK);
    hyperlinkDetectorTable.setHeaderVisible(true);
    hyperlinkDetectorTable.setLinesVisible(true);
    hyperlinkDetectorTable.setFont(parent.getFont());
   
    hyperlinkDetectorTable.addSelectionListener(new SelectionListener() {
      public void widgetSelected(SelectionEvent e) {
        handleListSelection();
      }
      public void widgetDefaultSelected(SelectionEvent e) {
      }
    });
   
    ColumnLayoutData columnLayoutData= new ColumnWeightData(1);
   
    TableColumn nameColumn= new TableColumn(hyperlinkDetectorTable, SWT.NONE, 0);
    nameColumn.setText(TextEditorMessages.HyperlinkDetectorTable_nameColumn);
    tableColumnlayout.setColumnData(nameColumn, columnLayoutData);
   
    TableColumn modifierKeysColumn= new TableColumn(hyperlinkDetectorTable, SWT.NONE, 1);
    modifierKeysColumn.setText(TextEditorMessages.HyperlinkDetectorTable_modifierKeysColumn);
    tableColumnlayout.setColumnData(modifierKeysColumn, columnLayoutData);
   
    TableColumn targetNameColumn= new TableColumn(hyperlinkDetectorTable, SWT.NONE, 2);
    targetNameColumn.setText(TextEditorMessages.HyperlinkDetectorTable_targetNameColumn);
    tableColumnlayout.setColumnData(targetNameColumn, columnLayoutData);

    fHyperlinkDetectorsViewer= new CheckboxTableViewer(hyperlinkDetectorTable);
    fHyperlinkDetectorsViewer.setUseHashlookup(true);
   
    fHyperlinkDetectorsViewer.addCheckStateListener(new ICheckStateListener() {
View Full Code Here

            participantToolsManager = new ToolBarManager(participantTools);

            // viewer
            Composite viewerComp = new Composite(participantsGroup, SWT.NONE);
            viewerComp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1));
            TableColumnLayout participantsColLayout = new TableColumnLayout();
            viewerComp.setLayout(participantsColLayout);
            {

                TableViewerColumn viewerColumn;
                TableColumn tableColumn;
                EditingSupport editSupport;

                participantsViewer = new TableViewer(viewerComp, SWT.MULTI | SWT.FULL_SELECTION | SWT.BORDER);
                selectionProvider.addSelectionProvider(participantsViewer);

                final Table table = participantsViewer.getTable();

                viewerColumn = new TableViewerColumn(participantsViewer, SWT.LEFT);
                tableColumn = viewerColumn.getColumn();
                tableColumn.setText("");
                tableColumn
                        .setToolTipText(Messages
                                .getString("encounter.builder.ui.editor.encounter.participants.table.column.selection.tooltip"));
                tableColumn.setResizable(false);
                tableColumn.setMoveable(false);
                viewerColumn.setLabelProvider(new ColumnLabelProvider() {
                    @Override
                    public Image getImage(Object element) {
                        return null;
                    }

                    @Override
                    public String getText(Object element) {
                        if(element instanceof EncounterParticipant) {
                            return ((EncounterParticipant)element).getLabel();
                        }

                        return null;
                    }
                });
                participantsColLayout.setColumnData(tableColumn, new ColumnWeightData(100));

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

                participantsViewer.setContentProvider(new EncounterBuilderParticipantsViewerContentProvider(this));

                participantsViewer.setInput(this);

                // setup drop target
                Transfer[] types = new Transfer[] { LocalSelectionTransfer.getTransfer() };
                DropTarget target = new DropTarget(table, DND.DROP_COPY);
                target.setTransfer(types);
                target.addDropListener(new DropTargetAdapter() {
                    @Override
                    public void dragEnter(DropTargetEvent event) {
                        logger.debug("drag enter: " + event);
                        event.operations = DND.DROP_COPY;
                        event.feedback = DND.FEEDBACK_INSERT_BEFORE;
                    };

                    @Override
                    public void drop(DropTargetEvent event) {
                        logger.debug("drop: " + event);
                        // A drop has occurred, copy over the data
                        // if(event.data == null) { // no data to copy, indicate failure in event.detail
                        // event.detail = DND.DROP_NONE;
                        // return;
                        // }
                        // label.setText ((String) event.data); // data copied to label text
                    }
                });
            }
        }

        // selection list
        Group selectionGroup = new Group(comp, SWT.NONE);
        selectionGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1));
        selectionGroup.setLayout(new GridLayout(2, true));
        selectionGroup.setText(Messages.getString("encounter.builder.ui.editor.encounter.selection.group.label"));
        {
            // toolbar
            selectionTools = new ToolBar(selectionGroup, SWT.FLAT);
            selectionTools.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
            selectionToolsManager = new ToolBarManager(selectionTools);

            // selection search box
            selectionSearchText = new Text(selectionGroup, SWT.SINGLE | SWT.BORDER | SWT.SEARCH | SWT.CANCEL);
            selectionSearchText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
            selectionSearchText.addModifyListener(new ModifyListener() {
                public void modifyText(ModifyEvent event) {
                    selectableSearchValue = ((Text)event.widget).getText();

                    selectionViewer.refresh();
                }
            });

            // viewer
            Composite viewerComp = new Composite(selectionGroup, SWT.NONE);
            viewerComp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1));
            TableColumnLayout selectionColLayout = new TableColumnLayout();
            viewerComp.setLayout(selectionColLayout);

            TableViewerColumn viewerColumn;
            TableColumn tableColumn;
            EditingSupport editSupport;

            selectionViewer = new TableViewer(viewerComp, SWT.MULTI | SWT.FULL_SELECTION | SWT.BORDER);
            selectionProvider.addSelectionProvider(selectionViewer);

            final Table table = selectionViewer.getTable();

            viewerColumn = new TableViewerColumn(selectionViewer, SWT.LEFT);
            tableColumn = viewerColumn.getColumn();
            tableColumn.setText("");
            tableColumn.setToolTipText(Messages
                    .getString("encounter.builder.ui.editor.encounter.selection.table.column.selection.tooltip"));
            tableColumn.setResizable(false);
            tableColumn.setMoveable(false);
            viewerColumn.setLabelProvider(new ColumnLabelProvider() {
                @Override
                public Image getImage(Object element) {
                    // TODO: check if the template has an icon

                    return DomainObjectImageMapper.getImage(element.getClass());
                }

                @Override
                public String getText(Object element) {
                    if(element instanceof BasicModelObject) {
                        return ((BasicModelObject)element).getLabel();
                    }

                    return null;
                }
            });
            selectionColLayout.setColumnData(tableColumn, new ColumnWeightData(100));

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

            selectionViewer.setContentProvider(new EncounterBuilderSelectionViewerContentProvider(this));
View Full Code Here

TOP

Related Classes of org.eclipse.jface.layout.TableColumnLayout

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.