Search in sources :

Example 96 with TableColumn

use of org.eclipse.swt.widgets.TableColumn in project ow by vtst.

the class ValidatorPageHelper method createContents.

// **************************************************************************
// User interface
public Control createContents(Composite parent) {
    Composite composite = SWTFactory.createComposite(parent, 1, 1, GridData.FILL_BOTH);
    checkbox = SWTFactory.createCheckButton(composite, "Customize errors and warnings:", null, false, 1);
    checkbox.addSelectionListener(new SelectionListener() {

        @Override
        public void widgetDefaultSelected(SelectionEvent _) {
        }

        @Override
        public void widgetSelected(SelectionEvent _) {
            updateListStatus();
        }
    });
    list = new Table(composite, SWT.V_SCROLL | SWT.CHECK | SWT.BORDER);
    GridData gd = new GridData(GridData.FILL_BOTH);
    gd.horizontalSpan = 1;
    list.setLayoutData(gd);
    TableColumn column1 = new TableColumn(list, SWT.NONE);
    try {
        fillList();
    } catch (CoreException e) {
        showErrorMessage("Cannot read properties from the current project", e);
    }
    column1.pack();
    return composite;
}
Also used : Table(org.eclipse.swt.widgets.Table) Composite(org.eclipse.swt.widgets.Composite) CoreException(org.eclipse.core.runtime.CoreException) SelectionEvent(org.eclipse.swt.events.SelectionEvent) GridData(org.eclipse.swt.layout.GridData) TableColumn(org.eclipse.swt.widgets.TableColumn) SelectionListener(org.eclipse.swt.events.SelectionListener)

Example 97 with TableColumn

use of org.eclipse.swt.widgets.TableColumn in project cubrid-manager by CUBRID.

the class DiagStatusMonitorTemplateDialog method createTableSelectedItem.

/**
	 * This method initializes tableSelectedItem
	 * 
	 */
private void createTableSelectedItem() {
    TableLayout tlayout = new TableLayout();
    tlayout.addColumnData(new ColumnWeightData(150, 150, true));
    tlayout.addColumnData(new ColumnWeightData(150, 150, true));
    tagetTbl.setLayout(tlayout);
    TableColumn categoryColumn = new TableColumn(tagetTbl, SWT.CENTER);
    categoryColumn.setText(DIAG_CATEGORY);
    TableColumn nameColumn = new TableColumn(tagetTbl, SWT.CENTER);
    nameColumn.setText(DIAG_NAME);
}
Also used : ColumnWeightData(org.eclipse.jface.viewers.ColumnWeightData) TableLayout(org.eclipse.jface.viewers.TableLayout) TableColumn(org.eclipse.swt.widgets.TableColumn)

Example 98 with TableColumn

use of org.eclipse.swt.widgets.TableColumn in project cubrid-manager by CUBRID.

the class ChartCompositePart method createSeriesTable.

/**
	 * Create basic info table
	 *
	 * @param parent the parent composite
	 *
	 */
private void createSeriesTable(Composite parent) {
    final Composite comp = new Composite(parent, SWT.NONE);
    GridData gdBasic = new GridData(SWT.FILL, SWT.NONE, false, false);
    comp.setLayoutData(gdBasic);
    GridLayout layout = new GridLayout();
    layout.verticalSpacing = 0;
    layout.horizontalSpacing = 0;
    layout.marginLeft = 0;
    layout.marginRight = 0;
    layout.marginTop = 0;
    layout.marginBottom = 0;
    comp.setLayout(layout);
    final Label label = new Label(comp, SWT.CENTER);
    label.setText(Messages.tblSeriesTtl);
    seriesTableViewer = new TableViewer(comp, SWT.NO_SCROLL | SWT.BORDER);
    Table seriesTable = seriesTableViewer.getTable();
    seriesTable.setHeaderVisible(true);
    seriesTable.setLinesVisible(true);
    GridData tblSeries = new GridData(SWT.FILL, SWT.TOP, true, false);
    tblSeries.heightHint = CommonUITool.getHeightHintOfTable(seriesTable);
    seriesTable.setLayoutData(tblSeries);
    TableLayout seriesLayout = new TableLayout();
    setSeriesTableLayout(seriesLayout);
    seriesTable.setLayout(seriesLayout);
    TableColumn tblColumn = new TableColumn(seriesTable, SWT.CENTER);
    tblColumn.setText("");
    tblColumn.setResizable(false);
    for (Map.Entry<String, ShowSetting> entry : settingMap.entrySet()) {
        tblColumn = new TableColumn(seriesTable, SWT.CENTER);
        tblColumn.setText(entry.getKey());
        tblColumn.setToolTipText(entry.getKey());
        tblColumn.setResizable(false);
    }
    List<String[]> chartTblLst = new ArrayList<String[]>();
    String[] arrays = valueMap.values().toArray(new String[valueMap.size()]);
    String[] arrays2 = new String[arrays.length + 1];
    arrays2[0] = "";
    System.arraycopy(arrays, 0, arrays2, 1, arrays.length);
    chartTblLst.add(arrays2);
    ChartTableContentProvider chartTableContentProvider = new ChartTableContentProvider();
    seriesTableViewer.setContentProvider(chartTableContentProvider);
    seriesTableViewer.setLabelProvider(new ChartTableLabelProvider());
    seriesTableViewer.setInput(chartTblLst);
    int index = 0;
    for (Map.Entry<String, ShowSetting> entry : settingMap.entrySet()) {
        org.eclipse.swt.graphics.Color color = new org.eclipse.swt.graphics.Color(comp.getDisplay(), entry.getValue().getSeriesRgb());
        seriesTableViewer.getTable().getItem(0).setBackground(index + 1, color);
        index++;
    }
    seriesTable.addControlListener(new ControlAdapter() {

        public void controlResized(ControlEvent event) {
            updateTableLayout();
        }
    });
}
Also used : ControlAdapter(org.eclipse.swt.events.ControlAdapter) Label(org.eclipse.swt.widgets.Label) ArrayList(java.util.ArrayList) GridLayout(org.eclipse.swt.layout.GridLayout) TableLayout(org.eclipse.jface.viewers.TableLayout) Table(org.eclipse.swt.widgets.Table) Composite(org.eclipse.swt.widgets.Composite) ChartComposite(org.jfree.experimental.chart.swt.ChartComposite) Color(java.awt.Color) CommonUITool.trimPaintColor(com.cubrid.common.ui.spi.util.CommonUITool.trimPaintColor) TableColumn(org.eclipse.swt.widgets.TableColumn) GridData(org.eclipse.swt.layout.GridData) ControlEvent(org.eclipse.swt.events.ControlEvent) TableViewer(org.eclipse.jface.viewers.TableViewer) Map(java.util.Map) TreeMap(java.util.TreeMap)

Example 99 with TableColumn

use of org.eclipse.swt.widgets.TableColumn in project sling by apache.

the class ArchetypeParametersWizardPage method createControl.

/**
	 * @see IDialogPage#createControl(Composite)
	 */
public void createControl(Composite parent) {
    Composite container = new Composite(parent, SWT.NULL);
    GridLayout layout = new GridLayout();
    container.setLayout(layout);
    layout.numColumns = 2;
    layout.verticalSpacing = 9;
    Label label = new Label(container, SWT.NULL);
    label.setText("&Group Id:");
    groupId = new Text(container, SWT.BORDER | SWT.SINGLE);
    GridData gd = new GridData(GridData.FILL_HORIZONTAL);
    groupId.setLayoutData(gd);
    groupId.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            dialogChanged();
            if (!javaPackageModified) {
                if (artifactId.getText().length() == 0) {
                    javaPackage.setText(getDefaultJavaPackage(groupId.getText(), ""));
                } else {
                    javaPackage.setText(getDefaultJavaPackage(groupId.getText(), artifactId.getText()));
                }
            }
        }
    });
    label = new Label(container, SWT.NULL);
    label.setText("&Artifact Id:");
    artifactId = new Text(container, SWT.BORDER | SWT.SINGLE);
    gd = new GridData(GridData.FILL_HORIZONTAL);
    artifactId.setLayoutData(gd);
    artifactId.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            dialogChanged();
            if (javaPackageModified) {
                return;
            }
            if (groupId.getText().length() == 0) {
                javaPackage.setText(getDefaultJavaPackage("", artifactId.getText()));
            } else {
                javaPackage.setText(getDefaultJavaPackage(groupId.getText(), artifactId.getText()));
            }
        }
    });
    label = new Label(container, SWT.NULL);
    label.setText("&Version:");
    version = new Text(container, SWT.BORDER | SWT.SINGLE);
    gd = new GridData(GridData.FILL_HORIZONTAL);
    version.setLayoutData(gd);
    version.setText("0.0.1-SNAPSHOT");
    version.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            dialogChanged();
        }
    });
    label = new Label(container, SWT.NULL);
    label.setText("&Package:");
    javaPackage = new Text(container, SWT.BORDER | SWT.SINGLE);
    gd = new GridData(GridData.FILL_HORIZONTAL);
    javaPackage.setLayoutData(gd);
    javaPackageModified = false;
    javaPackage.addKeyListener(new KeyAdapter() {

        @Override
        public void keyPressed(KeyEvent e) {
            javaPackageModified = true;
        }
    });
    javaPackage.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            dialogChanged();
        }
    });
    label = new Label(container, SWT.NULL);
    gd = new GridData(SWT.LEFT, SWT.TOP, false, false);
    label.setLayoutData(gd);
    label.setText("&Parameters:");
    propertiesViewer = new TableViewer(container, SWT.BORDER | SWT.FULL_SELECTION);
    propertiesTable = propertiesViewer.getTable();
    propertiesTable.setLinesVisible(true);
    propertiesTable.setHeaderVisible(true);
    propertiesTable.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 2));
    CellNavigationStrategy strategy = new CellNavigationStrategy();
    TableViewerFocusCellManager focusCellMgr = new TableViewerFocusCellManager(propertiesViewer, new FocusCellOwnerDrawHighlighter(propertiesViewer), strategy);
    ColumnViewerEditorActivationStrategy actSupport = new ColumnViewerEditorActivationStrategy(propertiesViewer) {

        @Override
        protected boolean isEditorActivationEvent(ColumnViewerEditorActivationEvent event) {
            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(propertiesViewer, focusCellMgr, actSupport, features);
    TableColumn propertiesTableNameColumn = new TableColumn(propertiesTable, SWT.NONE);
    propertiesTableNameColumn.setWidth(130);
    propertiesTableNameColumn.setText("Name");
    TableColumn propertiesTableValueColumn = new TableColumn(propertiesTable, SWT.NONE);
    propertiesTableValueColumn.setWidth(230);
    propertiesTableValueColumn.setText("Value");
    propertiesViewer.setColumnProperties(new String[] { KEY_PROPERTY, VALUE_PROPERTY });
    propertiesViewer.setCellEditors(new CellEditor[] { new TextCellEditor(propertiesTable, SWT.NONE), new TextCellEditor(propertiesTable, SWT.NONE) });
    propertiesViewer.setCellModifier(new ICellModifier() {

        public boolean canModify(Object element, String property) {
            return true;
        }

        public void modify(Object element, String property, Object value) {
            if (element instanceof TableItem) {
                ((TableItem) element).setText(getTextIndex(property), String.valueOf(value));
                dialogChanged();
            }
        }

        public Object getValue(Object element, String property) {
            if (element instanceof TableItem) {
                return ((TableItem) element).getText(getTextIndex(property));
            }
            return null;
        }
    });
    initialize();
    setPageComplete(false);
    setControl(container);
}
Also used : Composite(org.eclipse.swt.widgets.Composite) ModifyListener(org.eclipse.swt.events.ModifyListener) KeyAdapter(org.eclipse.swt.events.KeyAdapter) TableItem(org.eclipse.swt.widgets.TableItem) Label(org.eclipse.swt.widgets.Label) Text(org.eclipse.swt.widgets.Text) CellNavigationStrategy(org.eclipse.jface.viewers.CellNavigationStrategy) ColumnViewerEditorActivationEvent(org.eclipse.jface.viewers.ColumnViewerEditorActivationEvent) TableColumn(org.eclipse.swt.widgets.TableColumn) KeyEvent(org.eclipse.swt.events.KeyEvent) GridLayout(org.eclipse.swt.layout.GridLayout) ModifyEvent(org.eclipse.swt.events.ModifyEvent) TableViewerFocusCellManager(org.eclipse.jface.viewers.TableViewerFocusCellManager) FocusCellOwnerDrawHighlighter(org.eclipse.jface.viewers.FocusCellOwnerDrawHighlighter) ColumnViewerEditorActivationStrategy(org.eclipse.jface.viewers.ColumnViewerEditorActivationStrategy) GridData(org.eclipse.swt.layout.GridData) ICellModifier(org.eclipse.jface.viewers.ICellModifier) TextCellEditor(org.eclipse.jface.viewers.TextCellEditor) TableViewer(org.eclipse.jface.viewers.TableViewer)

Example 100 with TableColumn

use of org.eclipse.swt.widgets.TableColumn in project bndtools by bndtools.

the class ImportBndWorkspaceWizardPageOne method updateWorkspaceSelection.

/**
     * Takes the selected/typed folder from the the {@link #txtFolder} and tries to obtain a valid Bnd Workspace. In any
     * case, the {@link #tableViewer} is updated.
     *
     * @return true, when a Bnd Workspace was selected and properly initialized
     */
private boolean updateWorkspaceSelection() {
    final String selectedFolder = txtFolder.getText();
    boolean result = false;
    // check if folder containing a cnf-folder for Bnd was selected
    if (null != selectedFolder && selectedFolder.trim().length() > 0) {
        File chosenDirectory = new File(txtFolder.getText());
        if (chosenDirectory.exists()) {
            final Workspace bndWorkspace;
            try {
                bndWorkspace = Workspace.getWorkspace(chosenDirectory);
                setErrorMessage(null);
                txtFolderErrorDecorator.hide();
                List<Object> tableEntries = new ArrayList<Object>(bndWorkspace.getAllProjects());
                tableEntries.add(bndWorkspace.getBuildDir());
                tableViewer.setInput(tableEntries);
                result = true;
            } catch (Exception e) {
                // not a valid Bnd Workspace folder
                setErrorMessage(e.getMessage());
                txtFolderErrorDecorator.show();
            }
        } else {
            // handle non-existing folders
            setErrorMessage("No Workspace found from: " + selectedFolder);
            txtFolderErrorDecorator.show();
        }
    }
    if (!result) {
        tableViewer.setInput(Collections.emptyList());
    }
    for (TableColumn col : tableViewer.getTable().getColumns()) {
        // make sure TableViewerColumn has enough width to display new selection
        col.pack();
    }
    tableViewer.refresh();
    return result;
}
Also used : ArrayList(java.util.ArrayList) File(java.io.File) TableColumn(org.eclipse.swt.widgets.TableColumn) Workspace(aQute.bnd.build.Workspace)

Aggregations

TableColumn (org.eclipse.swt.widgets.TableColumn)200 Table (org.eclipse.swt.widgets.Table)100 TableViewer (org.eclipse.jface.viewers.TableViewer)87 GridData (org.eclipse.swt.layout.GridData)80 SelectionEvent (org.eclipse.swt.events.SelectionEvent)72 Composite (org.eclipse.swt.widgets.Composite)71 GridLayout (org.eclipse.swt.layout.GridLayout)56 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)51 Label (org.eclipse.swt.widgets.Label)39 Button (org.eclipse.swt.widgets.Button)32 TableItem (org.eclipse.swt.widgets.TableItem)31 TableViewerColumn (org.eclipse.jface.viewers.TableViewerColumn)26 Event (org.eclipse.swt.widgets.Event)23 Listener (org.eclipse.swt.widgets.Listener)23 Point (org.eclipse.swt.graphics.Point)21 ArrayContentProvider (org.eclipse.jface.viewers.ArrayContentProvider)20 TableLayout (org.eclipse.jface.viewers.TableLayout)19 SelectionListener (org.eclipse.swt.events.SelectionListener)18 Group (org.eclipse.swt.widgets.Group)15 ColumnWeightData (org.eclipse.jface.viewers.ColumnWeightData)14