org.eclipse.jface.viewers.ColumnWeightData Java Examples

The following examples show how to use org.eclipse.jface.viewers.ColumnWeightData. 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: 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 #2
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 #3
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 #4
Source File: MedicationViewerHelper.java    From elexis-3-core with Eclipse Public License 1.0 6 votes vote down vote up
public static TableViewerColumn createMandantColumn(TableViewer viewer,
	TableColumnLayout layout, int columnIndex){
	TableViewerColumn ret = new TableViewerColumn(viewer, SWT.LEFT);
	TableColumn tblclmnMandant = ret.getColumn();
	ColumnWeightData mandantColumnWeightData =
		new ColumnWeightData(0, 50, true);
	layout.setColumnData(tblclmnMandant, mandantColumnWeightData);
	tblclmnMandant.setText(Messages.MedicationComposite_column_mandant);
	tblclmnMandant.setToolTipText(Messages.MedicationComposite_column_mandant);
	ret.setLabelProvider(new MedicationCellLabelProvider() {
		@Override
		public String getText(Object element){
			return ((MedicationTableViewerItem) element).getPrescriptorLabel();
		}
	});
	return ret;
}
 
Example #5
Source File: MedicationViewerHelper.java    From elexis-3-core with Eclipse Public License 1.0 6 votes vote down vote up
public static TableViewerColumn createIntakeCommentColumn(TableViewer viewer,
	TableColumnLayout layout, int columnIndex){
	TableViewerColumn ret = new TableViewerColumn(viewer, SWT.NONE);
	TableColumn tblclmnComment = ret.getColumn();
	layout.setColumnData(tblclmnComment,
		new ColumnWeightData(1, ColumnWeightData.MINIMUM_WIDTH, true));
	tblclmnComment.setText(Messages.TherapieplanComposite_tblclmnComment_text);
	tblclmnComment.setToolTipText(Messages.MedicationComposite_column_sortBy + " "
		+ Messages.TherapieplanComposite_tblclmnComment_text);
	tblclmnComment
		.addSelectionListener(getSelectionAdapter(viewer, tblclmnComment, columnIndex));
	tblclmnComment.setToolTipText(Messages.MedicationComposite_column_sortBy + " "
		+ Messages.TherapieplanComposite_tblclmnComment_text);
	ret.setLabelProvider(new MedicationCellLabelProvider() {
		
		@Override
		public String getText(Object element){
			MedicationTableViewerItem pres = (MedicationTableViewerItem) element;
			return pres.getRemark();
		}
	});
	return ret;
}
 
Example #6
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 #7
Source File: CharacterPairsTableWidget.java    From tm4e with Eclipse Public License 1.0 6 votes vote down vote up
public CharacterPairsTableWidget(Table table) {
	super(table);
	setContentProvider(new CharacterPairContentProvider());
	setLabelProvider(new CharacterPairLabelProvider());

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

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

	TableColumn column2 = new TableColumn(table, SWT.NONE);
	column2.setText(LanguageConfigurationMessages.CharacterPairsTableWidget_end);
	minWidth = computeMinimumColumnWidth(gc, LanguageConfigurationMessages.CharacterPairsTableWidget_end);
	columnLayout.setColumnData(column2, new ColumnWeightData(2, minWidth, true));
}
 
Example #8
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 #9
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 #10
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 #11
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 #12
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 #13
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 #14
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 #15
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 #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: RenamingView.java    From MergeProcessor with Apache License 2.0 6 votes vote down vote up
/**
 * @param parent a widget which will be the parent of the new instance (cannot
 *               be null)
 * @param style  the style of widget to construct
 */
public RenamingView(Composite parent, int style) {
	super(parent, style);

	final TableColumnLayout layout = new TableColumnLayout();
	setLayout(layout);

	viewer = new TableViewer(this, SWT.FULL_SELECTION);
	viewer.getTable().setHeaderVisible(true);
	viewer.getTable().setLinesVisible(true);

	viewerColumnFrom = new TableViewerColumn(viewer, SWT.NONE);
	viewerColumnFrom.getColumn().setText("From");
	layout.setColumnData(viewerColumnFrom.getColumn(), new ColumnWeightData(1));

	viewerColumnTo = new TableViewerColumn(viewer, SWT.NONE);
	viewerColumnTo.getColumn().setText("To");
	layout.setColumnData(viewerColumnTo.getColumn(), new ColumnWeightData(1));

}
 
Example #18
Source File: InvoiceCorrectionWizard.java    From elexis-3-core with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void createControl(Composite parent){
	container = new Composite(parent, SWT.NONE);
	container.setLayout(new GridLayout(1, false));
	
	TableViewer viewer =
		new TableViewer(container,
			SWT.SINGLE | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL
				| SWT.READ_ONLY);
	viewer.getTable().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
	viewer.setContentProvider(new ArrayContentProvider());
	viewer.getTable().setLinesVisible(true);
	viewer.setInput(invoiceCorrectionDTO.getHistory());
	viewer.setLabelProvider(new LabelProvider() {
		@Override
		public String getText(Object element){
			int i = invoiceCorrectionDTO.getHistory().indexOf(element);
			return String.valueOf(++i) + ".   "
				+ ((InvoiceHistoryEntryDTO) element).getText();
		}
	});
	
	TableColumn singleColumn = new TableColumn(viewer.getTable(), SWT.NONE);
	TableColumnLayout tableColumnLayout = new TableColumnLayout();
	tableColumnLayout.setColumnData(singleColumn, new ColumnWeightData(100));
	container.setLayout(tableColumnLayout);
	
	setControl(container);
	setPageComplete(!invoiceCorrectionDTO.getHistory().isEmpty());
}
 
Example #19
Source File: ValidationViewPart.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
private void createTableComposite(final Composite mainComposite) {
    final Composite tableComposite = new Composite(mainComposite, SWT.NONE);
    tableComposite.setLayout(GridLayoutFactory.fillDefaults().create());
    tableComposite.setLayoutData(GridDataFactory.fillDefaults()
            .grab(true, true).create());

    tableViewer = new TableViewer(tableComposite, SWT.SINGLE | SWT.BORDER
            | SWT.FULL_SELECTION);
    final Table table = tableViewer.getTable();
    table.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).hint(400, SWT.DEFAULT).create());
    table.setHeaderVisible(true);
    table.setLinesVisible(true);

    addSeverityDescriptionColumn();
    addElementNameColumn();
    addErrorDescriptionColumn();

    final TableColumnLayout tcLayout = new TableColumnLayout();
    tcLayout.setColumnData(table.getColumn(0), new ColumnWeightData(1));
    tcLayout.setColumnData(table.getColumn(1), new ColumnWeightData(5));
    tcLayout.setColumnData(table.getColumn(2), new ColumnWeightData(11));
    table.getParent().setLayout(tcLayout);

    tableViewer.setContentProvider(new ValidationMarkerContentProvider());
    final IEditorPart activeEditor = getSite().getPage().getActiveEditor();
    tableViewer.setInput(activeEditor);

    tableViewer.addSelectionChangedListener(this);
}
 
Example #20
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 #21
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);
}
 
Example #22
Source File: DiagnosenDisplay.java    From elexis-3-core with Eclipse Public License 1.0 5 votes vote down vote up
private TableViewerColumn createTableViewerColumn(String title, int weight, int colNumber,
	int style){
	final TableViewerColumn viewerColumn = new TableViewerColumn(viewer, style);
	final TableColumn column = viewerColumn.getColumn();
	column.setText(title);
	column.setResizable(true);
	column.setMoveable(false);
	tableLayout.setColumnData(column, new ColumnWeightData(weight));
	return viewerColumn;
}
 
Example #23
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 #24
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 #25
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 #26
Source File: AbstractOrganizationWizardPage.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
protected void addTableColumLayout(final Table table) {
    final TableColumnLayout tcLayout = new TableColumnLayout();
    for (final TableColumn col : table.getColumns()) {
        tcLayout.setColumnData(col, new ColumnWeightData(1));
    }
    table.getParent().setLayout(tcLayout);
}
 
Example #27
Source File: LayoutTable.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
private static ColumnLayoutData[] createColumnWeightData( int nColumns )
{
	ColumnLayoutData[] data = new ColumnLayoutData[nColumns];
	for ( int i = 0; i < nColumns; i++ )
	{
		data[i] = new ColumnWeightData( 1 );
	}
	return data;
}
 
Example #28
Source File: GitRepositoryPreferencePageView.java    From MergeProcessor with Apache License 2.0 5 votes vote down vote up
/**
 * @param parent a widget which will be the parent of the new instance (cannot
 *               be null)
 * @param style  the style of widget to construct
 */
public GitRepositoryPreferencePageView(Composite parent, int style) {
	super(parent, style);
	final TableColumnLayout tableColumnLayout = new TableColumnLayout();
	setLayout(tableColumnLayout);

	tableViewer = new TableViewer(this, SWT.BORDER | SWT.FULL_SELECTION);
	final Table table = tableViewer.getTable();
	table.setHeaderVisible(true);
	table.setLinesVisible(true);

	columnRepository = new TableViewerColumn(tableViewer, SWT.NONE);
	TableColumn colRepository = columnRepository.getColumn();
	tableColumnLayout.setColumnData(colRepository, new ColumnWeightData(1));
	colRepository.setText("Repository");

	columnLocalPath = new TableViewerColumn(tableViewer, SWT.NONE);
	TableColumn colLocalPath = columnLocalPath.getColumn();
	tableColumnLayout.setColumnData(colLocalPath, new ColumnWeightData(1));
	colLocalPath.setText("Local Path");

	columnMemory = new TableViewerColumn(tableViewer, SWT.RIGHT);
	TableColumn colMemory = columnMemory.getColumn();
	tableColumnLayout.setColumnData(colMemory, new ColumnPixelData(80, true, true));
	colMemory.setText("Memory");

	final Menu menu = new Menu(tableViewer.getTable());
	menuItemGoToRepository = new MenuItem(menu, SWT.NONE);
	menuItemGoToRepository.setText("Go to Repository");
	tableViewer.getTable().setMenu(menu);
}
 
Example #29
Source File: TextTemplateView.java    From elexis-3-core with Eclipse Public License 1.0 5 votes vote down vote up
private TableViewerColumn createTableViewerColumn(String title, int bound, final int colNumber){
	final TableViewerColumn viewerColumn = new TableViewerColumn(tableViewer, SWT.NONE);
	final TableColumn column = viewerColumn.getColumn();
	tableLayout.setColumnData(column, new ColumnWeightData(bound,
		ColumnWeightData.MINIMUM_WIDTH, true));
	column.setText(title);
	column.setResizable(true);
	column.setMoveable(false);
	column.addSelectionListener(getSelectionAdapter(column, colNumber));
	return viewerColumn;
}
 
Example #30
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;
}