Search in sources :

Example 31 with TableColumn

use of org.eclipse.swt.widgets.TableColumn in project tdi-studio-se by Talend.

the class MultiSchemasShadowProcessPreview method checkSelectedIndex.

private void checkSelectedIndex(int... selectedColumnIndex) {
    if (selectedColumnIndex == null) {
        selectedColumnIndex = new int[] { 0 };
    }
    table.setRedraw(false);
    for (int i = 0; i < table.getColumnCount(); i++) {
        final TableColumn tc = table.getColumn(i);
        if (i == selectedColumnIndex[0]) {
            // default selected column is from
            tc.setImage(ImageProvider.getImage(EImage.CHECKED_ICON));
        // component
        } else {
            tc.setImage(ImageProvider.getImage(EImage.UNCHECKED_ICON));
        }
    }
    table.setHeaderVisible(true);
}
Also used : TableColumn(org.eclipse.swt.widgets.TableColumn)

Example 32 with TableColumn

use of org.eclipse.swt.widgets.TableColumn in project tdi-studio-se by Talend.

the class HL7OutputUI method addSchemaViewer.

private void addSchemaViewer(final Composite mainComposite, final int width, final int height) {
    // Group Schema Viewer
    final Group group = Form.createGroup(mainComposite, 1, "Linker Source", height);
    // add by wzhang. add a combo for tFileOutputMSXML.
    createCombo(group);
    schemaViewer = new TableViewer(group);
    // schemaViewer.set
    // schemaViewer.getTable().setBackground(schemaViewer.getTable().getDisplay().getSystemColor(SWT.COLOR_WHITE));
    HL7OutputTableViewerProvider provider = new HL7OutputTableViewerProvider();
    schemaViewer.setContentProvider(provider);
    schemaViewer.setLabelProvider(provider);
    GridData data2 = new GridData(GridData.FILL_BOTH);
    Table table = schemaViewer.getTable();
    // see bug 7087
    if (canModify || isRespo) {
        table.setEnabled(false);
    }
    // table.setLinesVisible(true);
    table.setHeaderVisible(true);
    TableColumn column1 = new TableColumn(table, SWT.LEFT);
    column1.setText("Schema List");
    column1.setWidth(100);
    table.setLayoutData(data2);
}
Also used : Group(org.eclipse.swt.widgets.Group) Table(org.eclipse.swt.widgets.Table) IMetadataTable(org.talend.core.model.metadata.IMetadataTable) HL7OutputTableViewerProvider(org.talend.designer.hl7.ui.edit.HL7OutputTableViewerProvider) GridData(org.eclipse.swt.layout.GridData) TableViewer(org.eclipse.jface.viewers.TableViewer) TableColumn(org.eclipse.swt.widgets.TableColumn)

Example 33 with TableColumn

use of org.eclipse.swt.widgets.TableColumn in project tdi-studio-se by Talend.

the class StatusEditor method createTable.

@Override
protected Table createTable(Composite parent) {
    Table contextTable = new Table(parent, SWT.BORDER | SWT.SINGLE);
    contextTable.setLinesVisible(true);
    contextTable.setHeaderVisible(true);
    TableColumn colName = new TableColumn(contextTable, SWT.NONE);
    //$NON-NLS-1$
    colName.setText(Messages.getString("StatusEditor.codeColumnTitle"));
    colName.setWidth(60);
    TableColumn colValue = new TableColumn(contextTable, SWT.NONE);
    //$NON-NLS-1$
    colValue.setText(Messages.getString("StatusEditor.labelColumnTitle"));
    colValue.setWidth(150);
    IProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
    if (factory.isUserReadOnlyOnCurrentProject()) {
        parent.setEnabled(false);
    }
    return contextTable;
}
Also used : Table(org.eclipse.swt.widgets.Table) TableColumn(org.eclipse.swt.widgets.TableColumn) IProxyRepositoryFactory(org.talend.repository.model.IProxyRepositoryFactory)

Example 34 with TableColumn

use of org.eclipse.swt.widgets.TableColumn in project tdi-studio-se by Talend.

the class StatusManagerSettingPage method addItemTableViewer.

private void addItemTableViewer(Composite rightComposite) {
    Composite composite = new Composite(rightComposite, SWT.NONE);
    composite.setLayout(new GridLayout());
    GridDataFactory.fillDefaults().grab(true, true).applyTo(composite);
    addItemsOption(composite);
    itemTable = new Table(composite, SWT.MULTI | SWT.BORDER);
    GridDataFactory.fillDefaults().grab(true, true).applyTo(itemTable);
    itemTable.setHeaderVisible(true);
    itemTable.setLinesVisible(true);
    //
    TableColumn itemColumn = new TableColumn(itemTable, SWT.CENTER);
    //$NON-NLS-1$
    itemColumn.setText(Messages.getString("VersionManagementDialog.Items"));
    itemColumn.setWidth(110);
    TableColumn oldVersionColumn = new TableColumn(itemTable, SWT.CENTER);
    //$NON-NLS-1$
    oldVersionColumn.setText(Messages.getString("StatusManagementDialog.Status"));
    oldVersionColumn.setWidth(90);
    TableColumn versionColumn = new TableColumn(itemTable, SWT.CENTER);
    //$NON-NLS-1$
    versionColumn.setText(Messages.getString("StatusManagementDialog.NewStatus"));
    versionColumn.setWidth(92);
    final TableColumn delColumn = new TableColumn(itemTable, SWT.CENTER);
    //$NON-NLS-1$
    delColumn.setText("");
    delColumn.setWidth(26);
    delColumn.setResizable(false);
    versionColumn.addControlListener(new ControlListener() {

        @Override
        public void controlMoved(ControlEvent e) {
        //
        }

        @Override
        public void controlResized(ControlEvent e) {
            if (!isFixedstatus()) {
                refreshTableItems();
            }
        }
    });
    itemTable.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            checkButtonsState();
        }
    });
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) Table(org.eclipse.swt.widgets.Table) Composite(org.eclipse.swt.widgets.Composite) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) SelectionEvent(org.eclipse.swt.events.SelectionEvent) ControlListener(org.eclipse.swt.events.ControlListener) ControlEvent(org.eclipse.swt.events.ControlEvent) TableColumn(org.eclipse.swt.widgets.TableColumn)

Example 35 with TableColumn

use of org.eclipse.swt.widgets.TableColumn in project tdi-studio-se by Talend.

the class ProcessVersionComposite method addSortListener.

/**
     * DOC Administrator Comment method "addSortListener".
     * 
     * @param table
     * @param column1
     * @param column2
     * @param column3
     */
private void addSortListener(final Table table, final TableColumn column1, final TableColumn column2, final TableColumn column3, final TableColumn column4) {
    Listener sortListener = new Listener() {

        private int direction = 1;

        @Override
        public void handleEvent(Event e) {
            final TableColumn column = (TableColumn) e.widget;
            if (column == table.getSortColumn()) {
                direction = -direction;
            }
            if (direction == 1) {
                table.setSortDirection(SWT.DOWN);
            } else {
                table.setSortDirection(SWT.UP);
            }
            table.setSortColumn(column);
            tableViewer.setSorter(new ViewerSorter() {

                int index = 0;

                @Override
                public void sort(Viewer viewer, Object[] elements) {
                    while (index < table.getColumns().length && table.getColumn(index) != column) {
                        index++;
                    }
                    super.sort(viewer, elements);
                }

                @Override
                public int compare(Viewer viewer, Object e1, Object e2) {
                    ITableLabelProvider labelProvider = (ITableLabelProvider) tableViewer.getLabelProvider();
                    String columnText = labelProvider.getColumnText(e1, index) != null ? labelProvider.getColumnText(e1, index) : //$NON-NLS-1$
                    "";
                    String columnText2 = labelProvider.getColumnText(e2, index) != null ? labelProvider.getColumnText(e2, index) : //$NON-NLS-1$
                    "";
                    return getComparator().compare(columnText, columnText2) * direction;
                }
            });
        }
    };
    tableViewer.addSelectionChangedListener(new ISelectionChangedListener() {

        /*
             * (non-Javadoc)
             * 
             * @seeorg.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.
             * SelectionChangedEvent)
             */
        @Override
        public void selectionChanged(SelectionChangedEvent event) {
            ProcessVersionComposite.this.selection = event.getSelection();
            if (getParentWizard() != null) {
                ((WizardPage) getParentWizard()).setPageComplete(true);
            }
        }
    });
    column1.addListener(SWT.Selection, sortListener);
    column2.addListener(SWT.Selection, sortListener);
    column3.addListener(SWT.Selection, sortListener);
    column4.addListener(SWT.Selection, sortListener);
    table.setSortColumn(column1);
    table.setSortDirection(SWT.DOWN);
    tableViewer.addDoubleClickListener(new IDoubleClickListener() {

        @Override
        public void doubleClick(DoubleClickEvent event) {
            if (getParentWizard() == null) {
                ITreeContextualAction editPropertiesAction = getEditPropertiesAction(EditPropertiesAction.class);
                if (editPropertiesAction != null) {
                    editPropertiesAction.run();
                }
            }
        }
    });
}
Also used : IDoubleClickListener(org.eclipse.jface.viewers.IDoubleClickListener) ILabelProviderListener(org.eclipse.jface.viewers.ILabelProviderListener) IMenuListener(org.eclipse.jface.action.IMenuListener) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) Listener(org.eclipse.swt.widgets.Listener) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) ViewerSorter(org.eclipse.jface.viewers.ViewerSorter) TableViewer(org.eclipse.jface.viewers.TableViewer) Viewer(org.eclipse.jface.viewers.Viewer) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) DoubleClickEvent(org.eclipse.jface.viewers.DoubleClickEvent) ITreeContextualAction(org.talend.commons.ui.swt.actions.ITreeContextualAction) TableColumn(org.eclipse.swt.widgets.TableColumn) ITableLabelProvider(org.eclipse.jface.viewers.ITableLabelProvider) EditPropertiesAction(org.talend.repository.ui.actions.EditPropertiesAction) IDoubleClickListener(org.eclipse.jface.viewers.IDoubleClickListener) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) Event(org.eclipse.swt.widgets.Event) DoubleClickEvent(org.eclipse.jface.viewers.DoubleClickEvent) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) IRepositoryObject(org.talend.core.model.repository.IRepositoryObject)

Aggregations

TableColumn (org.eclipse.swt.widgets.TableColumn)305 Table (org.eclipse.swt.widgets.Table)151 GridData (org.eclipse.swt.layout.GridData)105 TableViewer (org.eclipse.jface.viewers.TableViewer)94 Composite (org.eclipse.swt.widgets.Composite)92 SelectionEvent (org.eclipse.swt.events.SelectionEvent)87 GridLayout (org.eclipse.swt.layout.GridLayout)76 TableItem (org.eclipse.swt.widgets.TableItem)76 Point (org.eclipse.swt.graphics.Point)57 Label (org.eclipse.swt.widgets.Label)55 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)52 Button (org.eclipse.swt.widgets.Button)48 TableViewerColumn (org.eclipse.jface.viewers.TableViewerColumn)41 FillLayout (org.eclipse.swt.layout.FillLayout)37 Listener (org.eclipse.swt.widgets.Listener)37 Event (org.eclipse.swt.widgets.Event)35 Shell (org.eclipse.swt.widgets.Shell)35 Test (org.junit.Test)33 SelectionListener (org.eclipse.swt.events.SelectionListener)32 Text (org.eclipse.swt.widgets.Text)30