org.eclipse.jface.viewers.TableLayout Java Examples

The following examples show how to use org.eclipse.jface.viewers.TableLayout. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SvnFoldersExistWarningPage.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
protected TableViewer createTable(Composite parent, int span) {
	Table table = new Table(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
	GridData data = new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL);
	data.horizontalSpan = span;
	data.heightHint = 125;
	table.setLayoutData(data);
	TableLayout layout = new TableLayout();
	layout.addColumnData(new ColumnWeightData(100, true));
	table.setLayout(layout);
	TableColumn col = new TableColumn(table, SWT.NONE);
	col.setResizable(true);
	col.setText(Policy.bind("SVNFoldersExistWarningPage.folders")); //$NON-NLS-1$
	table.setHeaderVisible(true);

	return new TableViewer(table);
}
 
Example #2
Source File: WizardUtils.java    From XPagesExtensionLibrary with Apache License 2.0 6 votes vote down vote up
public static TableViewer createCheckboxTableViewer(Composite parent, int cols) {
    TableViewer table = new TableViewer(parent, SWT.CHECK | SWT.FULL_SELECTION | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION);

    GridData gd = new GridData(SWT.DEFAULT);
    gd.horizontalSpan = 1;
    gd.verticalAlignment = GridData.FILL;
    gd.grabExcessVerticalSpace = true;
    gd.horizontalAlignment = GridData.FILL;
    gd.grabExcessHorizontalSpace = true;
    table.getTable().setLayoutData(gd);
    
    table.getTable().setHeaderVisible(true);
    table.getTable().setLinesVisible(true);
    TableLayout tl = new TableLayout();
    for (int i=0; i<cols; i++) {
        tl.addColumnData(new ColumnWeightData(100, false));
    }
    table.getTable().setLayout(tl);
            
    return table;
}
 
Example #3
Source File: WizardUtils.java    From XPagesExtensionLibrary with Apache License 2.0 6 votes vote down vote up
public static TableViewer createTableViewer(Composite parent, int span, int cols, int[] weights, int options, int indent) {
    TableViewer table = new TableViewer(parent, options);

    GridData gd = new GridData(SWT.DEFAULT);
    gd.horizontalSpan = span;
    gd.verticalAlignment = GridData.FILL;
    gd.grabExcessVerticalSpace = true;
    gd.horizontalAlignment = GridData.FILL;
    gd.grabExcessHorizontalSpace = true;
    gd.horizontalIndent = indent;       
    table.getTable().setLayoutData(gd);
    
    table.getTable().setHeaderVisible(true);
    table.getTable().setLinesVisible(true);
    TableLayout tl = new TableLayout();
    for (int i=0; i<cols; i++) {
        if (weights != null) {
            tl.addColumnData(new ColumnWeightData(weights[i], false));                
        } else {
            tl.addColumnData(new ColumnWeightData(100, false));
        }
    }
    table.getTable().setLayout(tl);
            
    return table;
}
 
Example #4
Source File: AdditionalResourcesConfigurationWizardPage.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
private void createViewer(Composite parent) {
    viewer = new TableViewer(parent, SWT.FULL_SELECTION | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL | SWT.SINGLE);
    viewer.getTable().setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
    ColumnViewerToolTipSupport.enableFor(viewer);
    viewer.setUseHashlookup(true);
    viewer.getTable().setHeaderVisible(true);
    viewer.getTable().setLinesVisible(true);

    TableLayout layout = new TableLayout();
    layout.addColumnData(new ColumnWeightData(1, true));
    layout.addColumnData(new ColumnWeightData(1, true));
    viewer.getTable().setLayout(layout);

    createNameColumn();
    createFileColumn();

    viewer.setContentProvider(new ArrayContentProvider());
}
 
Example #5
Source File: BusinessObjectList.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
protected void createViewer(Composite parent, AbstractBdmFormPage formPage) {
    viewer = new TreeViewer(parent, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER | SWT.FULL_SELECTION);
    viewer.getTree().setLayoutData(GridDataFactory.fillDefaults().span(2, 1).grab(true, true).create());
    formPage.getToolkit().adapt(viewer.getTree());
    viewer.getTree().setData(SWTBotConstants.SWTBOT_WIDGET_ID_KEY, BUSINESS_OBJECT_LIST_VIEWER_ID);
    viewer.addFilter(createSearchFilter());
    viewer.addDoubleClickListener(e -> {
        viewer.setExpandedState(selectionObservable.getValue(),
                !viewer.getExpandedState(selectionObservable.getValue()));
    });

    ColumnViewerToolTipSupport.enableFor(viewer);
    TableLayout layout = new TableLayout();
    layout.addColumnData(new ColumnWeightData(1, true));
    viewer.getTree().setLayout(layout);
    viewer.setUseHashlookup(true);
    createBusinessObjectColumn(viewer, formPage);
    viewer.setContentProvider(new BusinessObjectTreeContentProvider());
    viewer.setComparator(new BusinessObjectViewerComparator());
    viewer.setInput(input);
    addDNDSupport(formPage);
    selectionObservable = ViewerProperties.singleSelection(Object.class).observe(viewer);
}
 
Example #6
Source File: DatabaseConnectorDriversWizardPage.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
private Composite createDriverManager(Composite parent) {
    final Composite driverManagerComposite = new Composite(parent, SWT.NONE);
    driverManagerComposite.setLayout(GridLayoutFactory.fillDefaults().numColumns(2).create());
    driverManagerComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());

    driverManagerViewer = new TableViewer(driverManagerComposite, SWT.BORDER | SWT.FULL_SELECTION);
    TableLayout tableLayout = new TableLayout();
    tableLayout.addColumnData(new ColumnWeightData(1));
    driverManagerViewer.getTable().setLayout(tableLayout);
    driverManagerViewer.getTable().setLinesVisible(true);
    driverManagerViewer.getTable().setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
    driverManagerViewer.setContentProvider(new DatabaseDriversContentProvider());
    TableViewerColumn column = new TableViewerColumn(driverManagerViewer, SWT.FILL);
    column.setLabelProvider(driversLabelProvider);
    driverManagerViewer.setInput(connectorId);
    createButtonsPart(driverManagerComposite);
    createAutomaticallyAddDriverButton(driverManagerComposite);

    return driverManagerComposite;
}
 
Example #7
Source File: DBConnectorsPreferencePage.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
private void createDriverManager(Composite parent) {

        final Composite driverManagerComposite = new Composite(parent, SWT.NONE);
        driverManagerComposite.setLayout(GridLayoutFactory.fillDefaults().numColumns(2).create());
        driverManagerComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());

        driverManagerViewer = new TableViewer(driverManagerComposite, SWT.BORDER | SWT.FULL_SELECTION);
        TableLayout tableLayout = new TableLayout();
        tableLayout.addColumnData(new ColumnWeightData(1));
        driverManagerViewer.getTable().setLayout(tableLayout);
        driverManagerViewer.getTable().setLinesVisible(true);
        driverManagerViewer.getTable().setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
        driverManagerViewer.setContentProvider(new DatabaseDriversContentProvider());
        TableViewerColumn column = new TableViewerColumn(driverManagerViewer, SWT.FILL);
        column.setLabelProvider(driversLabelProvider);
        createButtonsPart(driverManagerComposite);
        createAutomaticallyAddDriverButton(driverManagerComposite);
    }
 
Example #8
Source File: SvnPropertiesView.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
private TableViewer createTable(Composite parent) {
	Table table =	new Table(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.MULTI);
	table.setHeaderVisible(true);
	table.setLinesVisible(true);

	GridData gridData = new GridData(GridData.FILL_BOTH);
	table.setLayoutData(gridData);
	TableLayout layout = new TableLayout();
	table.setLayout(layout);
       
	tableViewer = new TableViewer(table);
	createColumns(table, layout);

	tableViewer.setContentProvider(new ArrayContentProvider());
	tableViewer.setLabelProvider(new PropertiesLabelProvider());
	return tableViewer;
}
 
Example #9
Source File: SvnRevPropertiesView.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
private TableViewer createTable(Composite parent) {
    Table table =   new Table(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.MULTI);
    table.setHeaderVisible(true);
    table.setLinesVisible(true);

    GridData gridData = new GridData(GridData.FILL_BOTH);
    table.setLayoutData(gridData);
    TableLayout layout = new TableLayout();
    table.setLayout(layout);
    
    tableViewer = new TableViewer(table);
    createColumns(table, layout);

    tableViewer.setContentProvider(new ArrayContentProvider());
    tableViewer.setLabelProvider(new PropertiesLabelProvider());
    return tableViewer;
}
 
Example #10
Source File: AbstractCallHierarchyViewPart.java    From xtext-eclipse with Eclipse Public License 2.0 6 votes vote down vote up
protected TableViewer createLocationViewer(Composite parent) {
	TableViewer locationViewer = new TableViewer(parent);
	locationViewer.setContentProvider(new ArrayContentProvider());
	locationViewer.setLabelProvider(createLocationLabelProvider());

	TableLayout layout = new TableLayout();
	locationViewer.getTable().setLayout(layout);
	locationViewer.getTable().setHeaderVisible(true);

	Pair<String, ColumnLayoutData>[] locationColumnDescriptions = getLocationColumnDescriptions();
	IntStream.range(0, locationColumnDescriptions.length).forEach(index -> {
		layout.addColumnData(locationColumnDescriptions[index].getValue());
		createColumn(locationViewer.getTable(), locationColumnDescriptions[index], index);
	});

	return locationViewer;
}
 
Example #11
Source File: RealTimeListViewer.java    From neoscada with Eclipse Public License 1.0 6 votes vote down vote up
protected void applyInitialColWidth ( final TableLayout tableLayout )
{
    if ( this.initialColWidth != null && !this.initialColWidth.isEmpty () && this.viewer != null && this.initialColWidth.size () != this.viewer.getTree ().getColumnCount () )
    {
        for ( final Integer w : this.initialColWidth )
        {
            tableLayout.addColumnData ( new ColumnPixelData ( w, true ) );
        }
    }
    else
    {
        tableLayout.addColumnData ( new ColumnWeightData ( 200, true ) );
        tableLayout.addColumnData ( new ColumnWeightData ( 100, true ) );
        tableLayout.addColumnData ( new ColumnWeightData ( 100, true ) );
        tableLayout.addColumnData ( new ColumnWeightData ( 200, true ) );
        tableLayout.addColumnData ( new ColumnWeightData ( 200, true ) );
    }
}
 
Example #12
Source File: IndexControl.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
private void createIndexViewer(Composite parent) {
    indexViewer = new TableViewer(parent, SWT.FULL_SELECTION | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL | SWT.SINGLE);
    indexViewer.getTable()
            .setLayoutData(GridDataFactory.fillDefaults().grab(false, true).span(2, 1).hint(350, SWT.DEFAULT).create());
    indexViewer.getTable().setData(SWTBotConstants.SWTBOT_WIDGET_ID_KEY, INDEX_LIST_VIEWER_ID);
    formPage.getToolkit().adapt(indexViewer.getTable());
    ColumnViewerToolTipSupport.enableFor(indexViewer);
    indexViewer.setUseHashlookup(true);
    indexViewer.getTable().setHeaderVisible(true);
    indexViewer.getTable().setLinesVisible(true);
    indexViewer.addFilter(createSearchFilter());

    TableLayout layout = new TableLayout();
    layout.addColumnData(new ColumnWeightData(1, true));
    layout.addColumnData(new ColumnWeightData(1, true));
    indexViewer.getTable().setLayout(layout);

    createIndexNameColumn(indexViewer);
    createAttributesColumn(indexViewer);

    indexViewer.setContentProvider(new ObservableListContentProvider());
    indexViewer.setInput(indexObservable);
    selectedIndexObservable = ViewerProperties.singleSelection(Index.class).observe(indexViewer);
}
 
Example #13
Source File: EnhancedCheckBoxTableViewer.java    From eclipse-cs with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * Creates a new table control with one column.
 *
 * @param parent
 *          the parent control
 * @param style
 *          style bits
 * @return a new table control
 */
protected static Table createTable(Composite parent, int style) {
  Table table = new Table(parent, SWT.CHECK | style);

  // Although this table column is not needed, and can cause resize
  // problems,
  // it can't be removed since this would be a breaking change against
  // R1.0.
  // See bug 6643 for more details.
  new TableColumn(table, SWT.NONE);
  TableLayout layout = new TableLayout();
  layout.addColumnData(new ColumnWeightData(100));
  table.setLayout(layout);

  return table;
}
 
Example #14
Source File: ConstraintEditionControl.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
private void createConstraintsDefinitionViewer(AbstractBdmFormPage formPage, Composite parent) {
    constraintViewer = new TableViewer(parent,
            SWT.FULL_SELECTION | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL | SWT.SINGLE);
    constraintViewer.getTable()
            .setLayoutData(GridDataFactory.fillDefaults().span(2, 1).grab(true, true).create());
    constraintViewer.getTable().setData(SWTBotConstants.SWTBOT_WIDGET_ID_KEY, CONSTRAINTS_LIST_VIEWER_ID);
    formPage.getToolkit().adapt(constraintViewer.getTable());
    ColumnViewerToolTipSupport.enableFor(constraintViewer);
    constraintViewer.setUseHashlookup(true);
    constraintViewer.getTable().setHeaderVisible(true);
    constraintViewer.getTable().setLinesVisible(true);
    constraintViewer.addFilter(createSearchFilter());

    TableLayout layout = new TableLayout();
    layout.addColumnData(new ColumnWeightData(1, true));
    layout.addColumnData(new ColumnWeightData(1, true));
    constraintViewer.getTable().setLayout(layout);

    createConstraintnameColumn(constraintViewer);
    createAttributesColumn(constraintViewer);

    constraintViewer.setContentProvider(new ObservableListContentProvider());
    constraintViewer.setInput(constraintsObservable);
    selectedConstraintObservable = ViewerProperties.singleSelection(UniqueConstraint.class).observe(constraintViewer);
}
 
Example #15
Source File: ContractInputTableViewer.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
public void initialize() {
    final TableLayout layout = new TableLayout();
    layout.addColumnData(new ColumnWeightData(100, false));
    getTable().setLayout(layout);
    getTable().setHeaderVisible(true);

    final TableViewerColumn columnViewer = new TableViewerColumn(this, SWT.NONE);
    final TableColumn column = columnViewer.getColumn();
    column.setText(Messages.name);
    columnViewer.setLabelProvider(new ContractInputLabelProvider());

    final TableColumnSorter sorter = new TableColumnSorter(this);
    sorter.setColumn(column);

    setContentProvider(ArrayContentProvider.getInstance());
}
 
Example #16
Source File: QueryEditionControl.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
private TreeViewer createQueryViewer(Composite parent) {
    TreeViewer queryViewer = new TreeViewer(parent,
            SWT.FULL_SELECTION | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL | SWT.SINGLE);
    queryViewer.getTree()
            .setLayoutData(GridDataFactory.fillDefaults().grab(false, true).hint(300, SWT.DEFAULT).create());
    queryViewer.getTree().setData(SWTBotConstants.SWTBOT_WIDGET_ID_KEY, QUERY_LIST_VIEWER_ID);
    formPage.getToolkit().adapt(queryViewer.getTree());
    ColumnViewerToolTipSupport.enableFor(queryViewer);
    queryViewer.setUseHashlookup(true);
    queryViewer.addFilter(createSearchFilter());
    queryViewer.addDoubleClickListener(e -> {
        queryViewer.setExpandedState(querySelectedObservable.getValue(),
                !viewer.getExpandedState(querySelectedObservable.getValue()));
    });

    TableLayout layout = new TableLayout();
    layout.addColumnData(new ColumnWeightData(1, true));
    queryViewer.getTree().setLayout(layout);

    createQueryNameColumn(queryViewer);

    provider = new QueryContentProvider();
    queryViewer.setContentProvider(provider);
    return queryViewer;
}
 
Example #17
Source File: SmartImportBdmPage.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
private Composite createMergeViewer(Composite parent) {
    Composite composite = new Composite(parent, SWT.None);
    composite.setLayout(GridLayoutFactory.fillDefaults().spacing(LayoutConstants.getSpacing().x, 1).create());
    composite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());

    viewer = new TreeViewer(composite,
            SWT.VIRTUAL | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL | SWT.FULL_SELECTION | SWT.BORDER);
    viewer.getTree().setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
    viewer.setUseHashlookup(true);
    ColumnViewerToolTipSupport.enableFor(viewer);
    viewer.getTree().setHeaderVisible(true);
    viewer.getTree().setLinesVisible(true);
    viewer.setContentProvider(new SmartImportBdmTreeContentProvider());

    TableLayout layout = new TableLayout();
    layout.addColumnData(new ColumnWeightData(6, true));
    layout.addColumnData(new ColumnWeightData(2, true));
    viewer.getTree().setLayout(layout);

    createModelColumn();
    createActionColumn();

    IViewerObservableValue singleSelectionObservable = ViewerProperties.singleSelection().observe(viewer);
    viewer.addDoubleClickListener(e -> viewer.setExpandedState(singleSelectionObservable.getValue(),
            !viewer.getExpandedState(singleSelectionObservable.getValue())));
    return composite;
}
 
Example #18
Source File: ExternalizeWizardPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private Control createTable(Composite parent) {
	Composite c= new Composite(parent, SWT.NONE);
	GridLayout gl= new GridLayout();
	gl.numColumns= 2;
	gl.marginWidth= 0;
	gl.marginHeight= 0;
	c.setLayout(gl);


	fTable= new Table(c, SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI | SWT.FULL_SELECTION | SWT.HIDE_SELECTION | SWT.BORDER);
	fTable.setFont(parent.getFont());

	GridData tableGD= new GridData(GridData.FILL_BOTH);
	tableGD.heightHint= SWTUtil.getTableHeightHint(fTable, ROW_COUNT);
	//tableGD.widthHint= 40;
	fTable.setLayoutData(tableGD);

	fTable.setLinesVisible(true);

	TableLayout layout= new TableLayout();
	fTable.setLayout(layout);
	fTable.setHeaderVisible(true);

	ColumnLayoutData[] columnLayoutData= new ColumnLayoutData[SIZE];
	columnLayoutData[STATE_PROP]= new ColumnPixelData(18, false, true);
	columnLayoutData[KEY_PROP]= new ColumnWeightData(40, true);
	columnLayoutData[VAL_PROP]= new ColumnWeightData(40, true);

	for (int i= 0; i < fgTitles.length; i++) {
		TableColumn tc= new TableColumn(fTable, SWT.NONE, i);
		tc.setText(fgTitles[i]);
		layout.addColumnData(columnLayoutData[i]);
		tc.setResizable(columnLayoutData[i].resizable);
	}

	createButtonComposite(c);
	return c;
}
 
Example #19
Source File: XPathExpressionEditor.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Control createExpressionEditor(final Composite parent, final EMFDataBindingContext ctx) {
    mainComposite = new Composite(parent, SWT.NONE);
    mainComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
    mainComposite.setLayout(new GridLayout(2, true));

    viewer = new TableViewer(mainComposite, SWT.FULL_SELECTION | SWT.BORDER | SWT.SINGLE | SWT.V_SCROLL);

    final TableLayout layout = new TableLayout();
    layout.addColumnData(new ColumnWeightData(100, false));
    viewer.getTable().setLayout(layout);
    viewer.getTable().setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());

    final TableViewerColumn columnViewer = new TableViewerColumn(viewer, SWT.NONE);
    final TableColumn column = columnViewer.getColumn();
    column.setText(Messages.name);

    final TableColumnSorter sorter = new TableColumnSorter(viewer);
    sorter.setColumn(column);

    viewer.getTable().setHeaderVisible(true);
    viewer.setContentProvider(new ArrayContentProvider());
    viewer.setLabelProvider(new DataStyledTreeLabelProvider());
    viewer.addPostSelectionChangedListener(new ISelectionChangedListener() {

        @Override
        public void selectionChanged(final SelectionChangedEvent event) {
            if (!event.getSelection().isEmpty()) {
                xsdViewer.expandAll();
                XPathExpressionEditor.this.fireSelectionChanged();
            }
        }
    });

    createXPathChooser(mainComposite);
    createReturnTypeComposite(parent);

    return mainComposite;
}
 
Example #20
Source File: ExpressionCollectionViewer.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
private TableLayout createTableLayout() {
    final int weight = (int) ((float) 1 / (float) viewer.getTable()
            .getColumnCount() * 100);
    final TableLayout layout = new TableLayout();
    for (int i = 0; i < viewer.getTable().getColumns().length; i++) {
        layout.addColumnData(new ColumnWeightData(weight));
    }
    return layout;
}
 
Example #21
Source File: TreeExplorer.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
public void setLeftHeader(final String title) {
    leftTree.getTree().setHeaderVisible(true);
    final TreeColumn columnName = new TreeColumn(leftTree.getTree(), SWT.NONE);
    columnName.setText(title);
    final TableLayout layout = new TableLayout();
    layout.addColumnData(new ColumnWeightData(1, 300));
    leftTree.getTree().setLayout(layout);
}
 
Example #22
Source File: AttributeEditionControl.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
private void createAttributeTableViewer(Composite parent) {
    viewer = new TableViewer(parent,
            SWT.FULL_SELECTION | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL | SWT.SINGLE);
    viewer.getTable().setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
    viewer.getTable().setData(SWTBotConstants.SWTBOT_WIDGET_ID_KEY, ATTRIBUTE_LIST_VIEWER_ID);
    formPage.getToolkit().adapt(viewer.getTable());
    ColumnViewerToolTipSupport.enableFor(viewer);
    viewer.setUseHashlookup(true);
    viewer.getTable().setHeaderVisible(true);
    viewer.getTable().setLinesVisible(true);
    viewer.addFilter(new SearchFilter<>(fieldToFilter));

    TableLayout layout = new TableLayout();
    layout.addColumnData(new ColumnWeightData(5, true));
    layout.addColumnData(new ColumnWeightData(4, true));
    layout.addColumnData(new ColumnWeightData(3, true));
    layout.addColumnData(new ColumnWeightData(3, true));
    viewer.getTable().setLayout(layout);

    createNameColumn(viewer);
    createTypeColumn(viewer);
    createMultipleColumn(viewer);
    createMandatoryColumn(viewer);

    viewer.setContentProvider(new ObservableListContentProvider());
    viewer.setInput(fieldsObservable);
    selectedFieldObservable = ViewerProperties.singleSelection(Field.class).observe(viewer);

    addDragAndDropSupport();
}
 
Example #23
Source File: SelectUserMappingWizardPage.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void createControl(final Composite parent) {
    super.createControl(parent);

    final Composite mainComposite = (Composite) getControl();
    final Composite viewersComposite = new Composite(mainComposite, SWT.NONE);
    viewersComposite.setLayoutData(GridDataFactory.fillDefaults().grab(false, true).span(2, 1).hint(SWT.DEFAULT, 250).create());
    viewersComposite.setLayout(GridLayoutFactory.fillDefaults().numColumns(1).margins(5, 5).extendedMargins(0, 0, 10, 0).create());

    availableUserViewer = CheckboxTableViewer.newCheckList(viewersComposite, SWT.BORDER | SWT.FULL_SELECTION);
    availableUserViewer.getTable().setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
    availableUserViewer.getTable().setHeaderVisible(true);
    availableUserViewer.setContentProvider(new ArrayContentProvider());
    final TableLayout layout = new TableLayout();
    layout.addColumnData(new ColumnWeightData(100));
    availableUserViewer.getTable().setLayout(layout);

    final TableViewerColumn columnViewer = new TableViewerColumn(availableUserViewer, SWT.NONE);
    final TableColumn usernameColumn = columnViewer.getColumn();
    usernameColumn.setText(Messages.userName);
    columnViewer.setLabelProvider(new ColumnLabelProvider());
    final TableColumnSorter sorter = new TableColumnSorter(availableUserViewer);
    sorter.setColumn(usernameColumn);

    availableUserViewer.setInput(availableUsers);
    availableUserViewer.setCheckedElements(selectedUsers.toArray());

}
 
Example #24
Source File: SelectRoleMappingWizardPage.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void createControl(final Composite parent) {
    super.createControl(parent);

    final Composite mainComposite = (Composite) getControl();
    final Composite viewersComposite = new Composite(mainComposite, SWT.NONE);
    viewersComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).span(2, 1).hint(SWT.DEFAULT, 250).create());
    viewersComposite.setLayout(GridLayoutFactory.swtDefaults().numColumns(1).margins(0, 0).extendedMargins(0, 0, 10, 0).equalWidth(false).create());

    availableRoleViewer = CheckboxTableViewer.newCheckList(viewersComposite, SWT.BORDER | SWT.FULL_SELECTION | SWT.V_SCROLL);
    availableRoleViewer.getTable().setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
    availableRoleViewer.getTable().setHeaderVisible(true);
    availableRoleViewer.setContentProvider(new ArrayContentProvider());
    final TableLayout layout = new TableLayout();
    layout.addColumnData(new ColumnWeightData(100));
    availableRoleViewer.getTable().setLayout(layout);

    final TableViewerColumn columnViewer = new TableViewerColumn(availableRoleViewer, SWT.NONE);
    final TableColumn usernameColumn = columnViewer.getColumn();
    usernameColumn.setText(Messages.roleName);
    columnViewer.setLabelProvider(new ColumnLabelProvider());
    final TableColumnSorter sorter = new TableColumnSorter(availableRoleViewer);
    sorter.setColumn(usernameColumn);

    availableRoleViewer.setInput(availableRoles);
    availableRoleViewer.setCheckedElements(selectedRoles.toArray());

}
 
Example #25
Source File: TreeExplorer.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
public void setRightHeader(final String title) {
    rightTable.getTable().setHeaderVisible(true);
    final TableColumn columnName = new TableColumn(rightTable.getTable(), SWT.NONE);
    columnName.setText(title);
    final TableLayout layout = new TableLayout();
    layout.addColumnData(new ColumnWeightData(1, 300));
    rightTable.getTable().setLayout(layout);
}
 
Example #26
Source File: QueryDetailsControl.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
protected void createParametersTable(Composite parent) {
    parametersTableViewer = new TableViewer(parent,
            SWT.FULL_SELECTION | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL | SWT.MULTI);
    parametersTableViewer.getControl()
            .setLayoutData(GridDataFactory.fillDefaults().grab(true, true).span(2, 1).create());
    parametersTableViewer.getTable().setData(SWTBotConstants.SWTBOT_WIDGET_ID_KEY, QUERY_PARAMETERS_VIEWER_ID);
    ColumnViewerToolTipSupport.enableFor(parametersTableViewer);
    parametersTableViewer.getTable().setHeaderVisible(true);
    parametersTableViewer.setContentProvider(new ObservableListContentProvider());
    parametersTableViewer.addFilter(createSearchFilter());

    TableLayout tableLayout = new TableLayout();
    tableLayout.addColumnData(new ColumnWeightData(1));
    tableLayout.addColumnData(new ColumnWeightData(1));
    tableLayout.addColumnData(new ColumnWeightData(2));
    parametersTableViewer.getTable().setLayout(tableLayout);

    createNameColumn(parametersTableViewer);
    createTypeColumn(parametersTableViewer);
    createDescriptionColumn(parametersTableViewer);

    selectedQueryParameterObservableList = EMFObservables.observeDetailList(Realm.getDefault(),
            querySelectedObservable,
            BusinessDataModelPackage.Literals.QUERY__QUERY_PARAMETERS);
    parametersMultipleSelectionObservable = ViewerProperties.multipleSelection(QueryParameter.class)
            .observe(parametersTableViewer);
    parametersTableViewer.setInput(selectedQueryParameterObservableList);
}
 
Example #27
Source File: ChangePathsTableProvider.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
public ChangePathsTableProvider(Composite parent, IContentProvider contentProvider) {
  super(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI | SWT.FULL_SELECTION);
  
  TableLayout layout = new TableLayout();
  GridData data = new GridData(GridData.FILL_BOTH);
  
  Table table = (Table) getControl();
  table.setHeaderVisible(true);
  table.setLinesVisible(true);
  table.setLayoutData(data);    
  table.setLayout(layout);
  table.addDisposeListener(new DisposeListener() {
    public void widgetDisposed(DisposeEvent e) {
      if(currentPathFont != null) {
        currentPathFont.dispose();
      }
    }
  });
  
  createColumns(table, layout);
  
  setLabelProvider(new ChangePathLabelProvider());
  setContentProvider(contentProvider);
  
  ChangePathsSorter sorter = new ChangePathsSorter(COL_PATH);
  setSorter(sorter);
  table.setSortDirection(SWT.UP);
}
 
Example #28
Source File: SourceView.java    From lapse-plus with GNU General Public License v3.0 5 votes vote down vote up
private void createColumns() {
	        TableLayout layout = new TableLayout();
	        getTable().setLayout(layout);
	        getTable().setHeaderVisible(true);
	        for (int i = 0; i < columnHeaders.length; i++) {
	            layout.addColumnData(columnLayouts[i]);
	            TableColumn tc = new TableColumn(getTable(), SWT.NONE,i);
	            tc.setResizable(columnLayouts[i].resizable);
	            tc.setText(columnHeaders[i]);
	            final int j = i;
	            tc.addSelectionListener(new SelectionAdapter() {           	
                	public void widgetSelected(SelectionEvent e) {
                		ViewerSorter oldSorter = viewer.getSorter();
                		if(oldSorter instanceof ColumnBasedSorter) {
                			ColumnBasedSorter sorter = (ColumnBasedSorter) oldSorter;	                			 
                			if(sorter.getColumn() == j) {
                				sorter.toggle();
                				viewer.refresh();
//                				System.err.println("Resorting column " + j + " in order " + sorter.getOrientation());
                				return;
                			}
                		}
                		
                		viewer.setSorter(new ColumnBasedSorter(j));
//                		System.err.println("Sorting column " + j + " in order " + 1);	                		
                		viewer.refresh();
                    }	                
                });
	        }
	    }
 
Example #29
Source File: SinkView.java    From lapse-plus with GNU General Public License v3.0 5 votes vote down vote up
private void createColumns() {
    TableLayout layout = new TableLayout();
    getTable().setLayout(layout);
    getTable().setHeaderVisible(true);
    for (int i = 0; i < columnHeaders.length; i++) {
        layout.addColumnData(columnLayouts[i]);
        TableColumn tc = new TableColumn(getTable(), SWT.BORDER, i);
        tc.setResizable(columnLayouts[i].resizable);
        tc.setText(columnHeaders[i]);
        tc.pack();
        final int j = i;
        tc.addSelectionListener(new SelectionAdapter() {
            public void widgetSelected(SelectionEvent e) {
                ViewerSorter oldSorter = viewer.getSorter();
                if (oldSorter instanceof ColumnBasedSorter) {
                    ColumnBasedSorter sorter = (ColumnBasedSorter) oldSorter;
                    if (sorter.getColumn() == j) {
                        sorter.toggle();
                        viewer.refresh();
                        // System.err.println("Resorting column " + j +
                        // " in order "
                        // + sorter.getOrientation());
                        return;
                    }
                }
                viewer.setSorter(new ColumnBasedSorter(j));
                logError("Sorting column " + j + " in order " + 1);
                viewer.refresh();
            }
        });
    }
}
 
Example #30
Source File: ContractInputTreeViewer.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
protected void configureTableLayout() {
    final TableLayout tableLayout = new TableLayout();
    tableLayout.addColumnData(new ColumnWeightData(4));
    tableLayout.addColumnData(new ColumnWeightData(2));
    tableLayout.addColumnData(new ColumnWeightData(2));
    tableLayout.addColumnData(new ColumnWeightData(6));
    getTree().setLayout(tableLayout);
}