Search in sources :

Example 61 with TableColumn

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

the class CubridColumnNavigatorView method createPartControl.

public void createPartControl(Composite parent) {
    Composite comp = new Composite(parent, SWT.NONE);
    {
        GridLayout gl = new GridLayout(1, false);
        comp.setLayout(gl);
        GridData gd = new GridData(GridData.FILL_HORIZONTAL);
        comp.setLayoutData(gd);
    }
    lblSchemaName = new Label(comp, SWT.NONE);
    lblSchemaName.setText(com.cubrid.common.ui.common.Messages.lblQuickViewColInfo);
    {
        GridData gd = new GridData(GridData.FILL_HORIZONTAL);
        lblSchemaName.setLayoutData(gd);
    }
    tableColTableViewer = new TableViewer(comp, SWT.FULL_SELECTION | SWT.MULTI | SWT.BORDER);
    {
        GridData gd = new GridData(GridData.FILL_BOTH);
        tableColTableViewer.getTable().setLayoutData(gd);
        tableColTableViewer.getTable().setToolTipText(com.cubrid.common.ui.common.Messages.miniSchemaCopyColumnTooltip);
        final MenuManager menuManager = new MenuManager();
        menuManager.setRemoveAllWhenShown(true);
        final Menu contextMenu = menuManager.createContextMenu(tableColTableViewer.getTable());
        tableColTableViewer.getTable().setMenu(contextMenu);
        final Menu copyMenu = new Menu(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), SWT.POP_UP);
        tableColTableViewer.getTable().setMenu(copyMenu);
        tableColTableViewer.getTable().addKeyListener(new org.eclipse.swt.events.KeyAdapter() {

            public void keyPressed(org.eclipse.swt.events.KeyEvent event) {
                if ((event.stateMask & SWT.CTRL) != 0 && (event.stateMask & SWT.SHIFT) == 0 && event.keyCode == 'c') {
                    copyColumnListToClipboard(",");
                }
            }
        });
        final MenuItem copyMenuItem = new MenuItem(copyMenu, SWT.PUSH);
        copyMenuItem.setText(com.cubrid.common.ui.common.Messages.miniSchemaCopyColumnWithComma);
        copyMenuItem.setAccelerator(SWT.CTRL + 'C');
        copyMenuItem.addSelectionListener(new SelectionAdapter() {

            public void widgetSelected(SelectionEvent event) {
                copyColumnListToClipboard(",");
            }
        });
        final MenuItem copyMenuItem2 = new MenuItem(copyMenu, SWT.PUSH);
        copyMenuItem2.setText(com.cubrid.common.ui.common.Messages.miniSchemaCopyColumnWithNewline);
        copyMenuItem2.addSelectionListener(new SelectionAdapter() {

            public void widgetSelected(SelectionEvent event) {
                copyColumnListToClipboard(StringUtil.NEWLINE);
            }
        });
        new MenuItem(copyMenu, SWT.SEPARATOR);
        final MenuItem copyMenuItem3 = new MenuItem(copyMenu, SWT.PUSH);
        copyMenuItem3.setText(com.cubrid.common.ui.common.Messages.miniSchemaCopySelectQuery);
        copyMenuItem3.addSelectionListener(new SelectionAdapter() {

            public void widgetSelected(SelectionEvent event) {
                copySelectSQLToClipboard();
            }
        });
        final MenuItem copyMenuItem4 = new MenuItem(copyMenu, SWT.PUSH);
        copyMenuItem4.setText(com.cubrid.common.ui.common.Messages.miniSchemaCopyInsertQuery);
        copyMenuItem4.addSelectionListener(new SelectionAdapter() {

            public void widgetSelected(SelectionEvent event) {
                copyInsertSQLToClipboard();
            }
        });
        final MenuItem copyMenuItem5 = new MenuItem(copyMenu, SWT.PUSH);
        copyMenuItem5.setText(com.cubrid.common.ui.common.Messages.miniSchemaCopyUpdateQuery);
        copyMenuItem5.addSelectionListener(new SelectionAdapter() {

            public void widgetSelected(SelectionEvent event) {
                copyUpdateSQLToClipboard();
            }
        });
    }
    Table columnsTable = tableColTableViewer.getTable();
    columnsTable.setLinesVisible(true);
    columnsTable.setHeaderVisible(true);
    final TableColumn pkColumn = new TableColumn(columnsTable, SWT.NONE);
    pkColumn.setAlignment(SWT.CENTER);
    pkColumn.setWidth(30);
    pkColumn.setText(Messages.tblColumnPK);
    final TableColumn nameColumn = new TableColumn(columnsTable, SWT.NONE);
    nameColumn.setWidth(90);
    nameColumn.setText(Messages.tblColumnName);
    final TableColumn dataTypeColumn = new TableColumn(columnsTable, SWT.NONE);
    dataTypeColumn.setWidth(120);
    dataTypeColumn.setText(Messages.tblColumnDataType);
    final TableColumn defaultColumn = new TableColumn(columnsTable, SWT.NONE);
    defaultColumn.setWidth(98);
    defaultColumn.setText(Messages.tblColumnDefault);
    final TableColumn autoIncrTableColumn = new TableColumn(columnsTable, SWT.NONE);
    autoIncrTableColumn.setAlignment(SWT.CENTER);
    autoIncrTableColumn.setWidth(100);
    autoIncrTableColumn.setText(Messages.tblColumnAutoIncr);
    final TableColumn notNullColumn = new TableColumn(columnsTable, SWT.NONE);
    notNullColumn.setWidth(70);
    notNullColumn.setText(Messages.tblColumnNotNull);
    notNullColumn.setAlignment(SWT.CENTER);
    final TableColumn uniqueColumn = new TableColumn(columnsTable, SWT.NONE);
    uniqueColumn.setWidth(70);
    uniqueColumn.setText(Messages.tblColumnUnique);
    uniqueColumn.setAlignment(SWT.CENTER);
    final TableColumn sharedColumn = new TableColumn(columnsTable, SWT.NONE);
    sharedColumn.setWidth(60);
    sharedColumn.setResizable(false);
    sharedColumn.setText(Messages.tblColumnShared);
    sharedColumn.setAlignment(SWT.CENTER);
    final TableColumn inheritColumn = new TableColumn(columnsTable, SWT.NONE);
    inheritColumn.setAlignment(SWT.CENTER);
    inheritColumn.setWidth(90);
    inheritColumn.setResizable(false);
    inheritColumn.setText(Messages.tblColumnInherit);
    final TableColumn classColumn = new TableColumn(columnsTable, SWT.NONE);
    classColumn.setWidth(90);
    classColumn.setResizable(false);
    classColumn.setText(Messages.tblColumnClass);
    classColumn.setAlignment(SWT.CENTER);
}
Also used : Table(org.eclipse.swt.widgets.Table) Composite(org.eclipse.swt.widgets.Composite) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Label(org.eclipse.swt.widgets.Label) MenuItem(org.eclipse.swt.widgets.MenuItem) TableColumn(org.eclipse.swt.widgets.TableColumn) GridLayout(org.eclipse.swt.layout.GridLayout) GridData(org.eclipse.swt.layout.GridData) MenuManager(org.eclipse.jface.action.MenuManager) SelectionEvent(org.eclipse.swt.events.SelectionEvent) Menu(org.eclipse.swt.widgets.Menu) TableViewer(org.eclipse.jface.viewers.TableViewer)

Example 62 with TableColumn

use of org.eclipse.swt.widgets.TableColumn in project azure-tools-for-java by Microsoft.

the class QueueFileEditor method createTable.

private void createTable(Composite parent) {
    queueTable = new Table(parent, SWT.BORDER | SWT.FULL_SELECTION);
    queueTable.setHeaderVisible(true);
    queueTable.setLinesVisible(true);
    GridData gridData = new GridData();
    //        gridData.heightHint = 75;
    gridData.horizontalAlignment = SWT.FILL;
    gridData.verticalAlignment = SWT.FILL;
    gridData.grabExcessVerticalSpace = true;
    gridData.grabExcessHorizontalSpace = true;
    GridLayout gridLayoutTable = new GridLayout();
    gridLayoutTable.numColumns = 6;
    gridLayoutTable.marginRight = 0;
    queueTable.setLayout(gridLayoutTable);
    queueTable.setLayoutData(gridData);
    for (int i = 0; i < 6; i++) {
        TableColumn column = new TableColumn(queueTable, SWT.FILL);
        column.setWidth(100);
    }
    queueTable.getColumn(0).setText("Id");
    queueTable.getColumn(1).setText("Message Text Preview");
    queueTable.getColumn(2).setText("Size");
    queueTable.getColumn(3).setText("Insertion Time (UTC)");
    queueTable.getColumn(4).setText("Expiration Time (UTC)");
    queueTable.getColumn(5).setText("Dequeue count");
    tableViewer = new TableViewer(queueTable);
    tableViewer.setContentProvider(new QueueContentProvider());
    tableViewer.setLabelProvider(new QueueLabelProvider());
    fillGrid();
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) Table(org.eclipse.swt.widgets.Table) GridData(org.eclipse.swt.layout.GridData) TableColumn(org.eclipse.swt.widgets.TableColumn) TableViewer(org.eclipse.jface.viewers.TableViewer)

Example 63 with TableColumn

use of org.eclipse.swt.widgets.TableColumn in project azure-tools-for-java by Microsoft.

the class BlobExplorerFileEditor method createTable.

private Table createTable(Composite parent) {
    blobListTable = new Table(parent, SWT.BORDER | SWT.FULL_SELECTION);
    blobListTable.setHeaderVisible(true);
    blobListTable.setLinesVisible(true);
    GridData gridData = new GridData();
    //        gridData.heightHint = 75;
    gridData.horizontalAlignment = SWT.FILL;
    gridData.verticalAlignment = SWT.FILL;
    gridData.grabExcessVerticalSpace = true;
    gridData.grabExcessHorizontalSpace = true;
    GridLayout gridLayoutTable = new GridLayout();
    gridLayoutTable.numColumns = 6;
    gridLayoutTable.marginRight = 0;
    blobListTable.setLayout(gridLayoutTable);
    blobListTable.setLayoutData(gridData);
    for (int i = 0; i < 6; i++) {
        new TableColumn(blobListTable, SWT.FILL);
    }
    blobListTable.getColumn(0).setText("");
    blobListTable.getColumn(1).setText("Name");
    blobListTable.getColumn(2).setText("Size");
    blobListTable.getColumn(3).setText("Last Modified (UTC)");
    blobListTable.getColumn(4).setText("Content Type");
    blobListTable.getColumn(5).setText("URL");
    blobListTable.getColumn(0).setWidth(25);
    blobListTable.getColumn(1).setWidth(280);
    blobListTable.getColumn(2).setWidth(60);
    blobListTable.getColumn(3).setWidth(110);
    blobListTable.getColumn(4).setWidth(140);
    blobListTable.getColumn(5).setWidth(250);
    tableViewer = new TableViewer(blobListTable);
    tableViewer.setUseHashlookup(true);
    tableViewer.setContentProvider(new BlobListContentProvider());
    tableViewer.setLabelProvider(new BlobListLabelProvider());
    tableViewer.addSelectionChangedListener(new ISelectionChangedListener() {

        public void selectionChanged(SelectionChangedEvent selectionChangedEvent) {
            boolean directorySelected = tableViewer.getTable().getSelectionIndex() > -1 && isDirectorySelected();
            deleteButton.setEnabled(!directorySelected);
            //                openButton.setEnabled(!directorySelected);
            saveAsButton.setEnabled(!directorySelected);
        }
    });
    tableViewer.addDoubleClickListener(new IDoubleClickListener() {

        public void doubleClick(DoubleClickEvent event) {
            tableSelection();
        }
    });
    fillGrid();
    return blobListTable;
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) Table(org.eclipse.swt.widgets.Table) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) IDoubleClickListener(org.eclipse.jface.viewers.IDoubleClickListener) GridData(org.eclipse.swt.layout.GridData) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) DoubleClickEvent(org.eclipse.jface.viewers.DoubleClickEvent) TableColumn(org.eclipse.swt.widgets.TableColumn) TableViewer(org.eclipse.jface.viewers.TableViewer)

Example 64 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 65 with TableColumn

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

the class DatabaseStatusEditor method createCommonTableViewer.

/**
	 *
	 * Create the common table viewer that can be sorted by TableViewerSorter
	 * object,this viewer's input object must be List<Map<String,Object>> and
	 * Map's key must be column index,Map's value of the column must be String.
	 *
	 * @param parent the parent composite
	 * @param sorter the sorter
	 * @param columnNameArr the column name array
	 * @param gridData the griddata
	 * @return the table viewer
	 */
public static TableViewer createCommonTableViewer(Composite parent, ViewerSorter sorter, final String[] columnNameArr, GridData gridData) {
    final TableViewer tableViewer = new TableViewer(parent, SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION | SWT.NO_SCROLL);
    tableViewer.setContentProvider(new TableContentProvider());
    tableViewer.setLabelProvider(new TableLabelProvider());
    if (sorter != null) {
        tableViewer.setSorter(sorter);
    }
    tableViewer.getTable().setLinesVisible(true);
    tableViewer.getTable().setHeaderVisible(true);
    tableViewer.getTable().setLayoutData(gridData);
    for (int i = 0; i < columnNameArr.length; i++) {
        final TableColumn tblColumn = new TableColumn(tableViewer.getTable(), SWT.LEFT);
        tblColumn.setText(columnNameArr[i]);
        if (sorter != null) {
            tblColumn.addSelectionListener(new SelectionAdapter() {

                public void widgetSelected(SelectionEvent event) {
                    TableColumn column = (TableColumn) event.widget;
                    int j = 0;
                    for (j = 0; j < columnNameArr.length; j++) {
                        if (column.getText().equals(columnNameArr[j])) {
                            break;
                        }
                    }
                    TableViewerSorter sorter = ((TableViewerSorter) tableViewer.getSorter());
                    if (sorter == null) {
                        return;
                    }
                    sorter.doSort(j);
                    tableViewer.getTable().setSortColumn(column);
                    tableViewer.getTable().setSortDirection(sorter.isAsc() ? SWT.UP : SWT.DOWN);
                    tableViewer.refresh();
                    for (int k = 0; k < tableViewer.getTable().getColumnCount(); k++) {
                        tableViewer.getTable().getColumn(k).pack();
                    }
                }
            });
        }
        tblColumn.pack();
    }
    return tableViewer;
}
Also used : TableViewerSorter(com.cubrid.common.ui.spi.TableViewerSorter) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) TableContentProvider(com.cubrid.common.ui.spi.TableContentProvider) SelectionEvent(org.eclipse.swt.events.SelectionEvent) TableLabelProvider(com.cubrid.common.ui.spi.TableLabelProvider) TableViewer(org.eclipse.jface.viewers.TableViewer) TableColumn(org.eclipse.swt.widgets.TableColumn)

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