Search in sources :

Example 11 with Table

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

the class FieldSection method getDragItemsAsText.

/*
     * (non-Javadoc)
     * 
     * @see org.talend.designer.scd.ui.IDragDrop#getDragItemsAsText()
     */
public String getDragItemsAsText() {
    tableViewer.cancelEditing();
    Table table = tableViewer.getTable();
    TableItem[] selection = table.getSelection();
    StringBuffer buf = new StringBuffer();
    // number of selected elements
    buf.append(selection.length);
    for (TableItem element : selection) {
        buf.append('|');
        buf.append(element.getText());
    }
    return buf.toString();
}
Also used : Table(org.eclipse.swt.widgets.Table) TableItem(org.eclipse.swt.widgets.TableItem)

Example 12 with Table

use of org.eclipse.swt.widgets.Table 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 13 with Table

use of org.eclipse.swt.widgets.Table 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 14 with Table

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

the class JsonFieldModel method addAll.

@Override
public void addAll(final Integer index, List<Map<String, Object>> beans, boolean fireBefore, boolean fireAfter) {
    super.addAll(index, beans, fireBefore, fireAfter);
    TableViewer tableViewer = getTableViewer();
    if (tableViewer != null) {
        Table table = tableViewer.getTable();
        table.pack();
        table.layout();
    }
}
Also used : Table(org.eclipse.swt.widgets.Table) TableViewer(org.eclipse.jface.viewers.TableViewer)

Example 15 with Table

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

the class TableController method estimateRowSize.

/*
     * (non-Javadoc)
     * 
     * @see
     * org.talend.designer.core.ui.editor.properties.controllers.AbstractElementPropertySectionController#estimateRowSize
     * (org.eclipse.swt.widgets.Composite, org.talend.core.model.process.IElementParameter)
     */
@Override
public int estimateRowSize(Composite subComposite, IElementParameter param) {
    PropertiesTableEditorModel<Map<String, Object>> tableEditorModel = new PropertiesTableEditorModel<Map<String, Object>>();
    updateTableValues(param);
    tableEditorModel.setData(elem, param, part.getProcess());
    PropertiesTableEditorView<Map<String, Object>> tableEditorView = new PropertiesTableEditorView<Map<String, Object>>(subComposite, SWT.NONE, tableEditorModel, !param.isBasedOnSchema(), false);
    tableEditorView.getExtendedTableViewer().setCommandStack(getCommandStack());
    tableEditorView.setReadOnly(param.isReadOnly());
    final Table table = tableEditorView.getTable();
    int toolbarSize = 0;
    if (!param.isBasedOnSchema()) {
        Point size = tableEditorView.getExtendedToolbar().getToolbar().computeSize(SWT.DEFAULT, SWT.DEFAULT);
        toolbarSize = size.y + 5;
    }
    int currentHeightEditor = table.getHeaderHeight() + ((List) param.getValue()).size() * table.getItemHeight() + table.getItemHeight() + toolbarSize;
    int minHeightEditor = table.getHeaderHeight() + getNumberLines(param) * table.getItemHeight() + table.getItemHeight() + toolbarSize;
    tableEditorView.getMainComposite().dispose();
    int ySize2 = Math.max(currentHeightEditor, minHeightEditor);
    return ySize2 + ITabbedPropertyConstants.VSPACE;
}
Also used : PropertiesTableEditorModel(org.talend.designer.core.ui.editor.properties.macrowidgets.tableeditor.PropertiesTableEditorModel) Table(org.eclipse.swt.widgets.Table) PropertiesTableEditorView(org.talend.designer.core.ui.editor.properties.macrowidgets.tableeditor.PropertiesTableEditorView) ArrayList(java.util.ArrayList) List(java.util.List) Point(org.eclipse.swt.graphics.Point) HashMap(java.util.HashMap) Map(java.util.Map) Point(org.eclipse.swt.graphics.Point)

Aggregations

Table (org.eclipse.swt.widgets.Table)770 GridData (org.eclipse.swt.layout.GridData)368 Composite (org.eclipse.swt.widgets.Composite)325 TableColumn (org.eclipse.swt.widgets.TableColumn)324 TableViewer (org.eclipse.jface.viewers.TableViewer)303 GridLayout (org.eclipse.swt.layout.GridLayout)255 TableItem (org.eclipse.swt.widgets.TableItem)210 SelectionEvent (org.eclipse.swt.events.SelectionEvent)204 Label (org.eclipse.swt.widgets.Label)179 Button (org.eclipse.swt.widgets.Button)161 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)145 Point (org.eclipse.swt.graphics.Point)138 Text (org.eclipse.swt.widgets.Text)102 ISelectionChangedListener (org.eclipse.jface.viewers.ISelectionChangedListener)96 SelectionChangedEvent (org.eclipse.jface.viewers.SelectionChangedEvent)95 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)89 FillLayout (org.eclipse.swt.layout.FillLayout)87 Shell (org.eclipse.swt.widgets.Shell)82 ArrayContentProvider (org.eclipse.jface.viewers.ArrayContentProvider)81 Event (org.eclipse.swt.widgets.Event)80