Search in sources :

Example 61 with Table

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

the class ObjectInfoComposite method initIndexTabItem.

/**
	 * Initial index tab index
	 * 
	 */
private void initIndexTabItem() {
    CubridDatabase database = schemaNode.getDatabase();
    CTabItem indexTabItem = new CTabItem(objInfoFolder, SWT.NONE);
    indexTabItem.setText(Messages.titleIndex);
    indexTabItem.setShowClose(false);
    Composite composite = new Composite(objInfoFolder, SWT.None);
    indexTabItem.setControl(composite);
    composite.setLayout(new FillLayout());
    final SashForm sashForm = new SashForm(composite, SWT.VERTICAL);
    sashForm.setBackground(CombinedQueryEditorComposite.BACK_COLOR);
    /*Index table composite*/
    Composite indexComposite = new Composite(sashForm, SWT.None);
    indexComposite.setLayout(new GridLayout());
    /*FK table composite*/
    Composite fkComposite = new Composite(sashForm, SWT.None);
    fkComposite.setLayout(new GridLayout());
    /*Set the sashform*/
    sashForm.setWeights(new int[] { 1, 1 });
    // create index table view
    final Label indexLabel = new Label(indexComposite, SWT.NONE);
    indexLabel.setText(Messages.lblIndexes);
    indexTableViewer = new TableViewer(indexComposite, SWT.FULL_SELECTION | SWT.MULTI | SWT.BORDER);
    Table indexTable = indexTableViewer.getTable();
    indexTable.setLinesVisible(true);
    indexTable.setHeaderVisible(true);
    indexTable.setLayoutData(CommonUITool.createGridData(GridData.FILL_BOTH, 1, 1, -1, -1));
    TableColumn tblCol = new TableColumn(indexTable, SWT.NONE);
    tblCol.setWidth(150);
    tblCol.setText(Messages.tblColumnIndexName);
    TableColumn indexNameColumn = new TableColumn(indexTable, SWT.NONE);
    indexNameColumn.setWidth(78);
    indexNameColumn.setText(Messages.tblColumnIndexType);
    TableColumn indexTypeColumn = new TableColumn(indexTable, SWT.NONE);
    indexTypeColumn.setWidth(218);
    indexTypeColumn.setText(Messages.tblColumnOnColumns);
    TableColumn ruleColumn = new TableColumn(indexTable, SWT.NONE);
    ruleColumn.setWidth(282);
    ruleColumn.setText(Messages.tblColumnIndexRule);
    IndexTableViewerContentProvider indexContentProvider = new IndexTableViewerContentProvider();
    IndexTableViewerLabelProvider indexLabelProvider = new IndexTableViewerLabelProvider();
    indexTableViewer.setContentProvider(indexContentProvider);
    indexTableViewer.setLabelProvider(indexLabelProvider);
    // create the fk table viewer
    final Label fkLabel = new Label(fkComposite, SWT.NONE);
    fkLabel.setText(Messages.lblFK);
    fkTableViewer = new TableViewer(fkComposite, SWT.FULL_SELECTION | SWT.MULTI | SWT.BORDER);
    Table fkTable = fkTableViewer.getTable();
    fkTable.setLayoutData(CommonUITool.createGridData(GridData.FILL_BOTH, 1, 1, -1, -1));
    fkTable.setLinesVisible(true);
    fkTable.setHeaderVisible(true);
    TableColumn fkNameColumn = new TableColumn(fkTable, SWT.NONE);
    fkNameColumn.setWidth(100);
    fkNameColumn.setText(Messages.tblColumnFK);
    TableColumn fkColumnName = new TableColumn(fkTable, SWT.NONE);
    fkColumnName.setWidth(119);
    fkColumnName.setText(Messages.tblColumnColumnName);
    TableColumn fTableColumn = new TableColumn(fkTable, SWT.NONE);
    fTableColumn.setWidth(93);
    fTableColumn.setText(Messages.tblColumnForeignTable);
    TableColumn fkColumnNameColumn = new TableColumn(fkTable, SWT.NONE);
    fkColumnNameColumn.setWidth(143);
    fkColumnNameColumn.setText(Messages.tblColumnForeignColumnName);
    TableColumn updateRuletblColumn = new TableColumn(fkTable, SWT.NONE);
    updateRuletblColumn.setWidth(84);
    updateRuletblColumn.setText(Messages.tblColumnUpdateRule);
    TableColumn deleteRuleColumn = new TableColumn(fkTable, SWT.NONE);
    deleteRuleColumn.setWidth(86);
    deleteRuleColumn.setText(Messages.tblColumnDeleteRule);
    TableColumn cacheColumn = new TableColumn(fkTable, SWT.NONE);
    cacheColumn.setWidth(100);
    cacheColumn.setText(Messages.tblColumnCacheColumn);
    fkTableViewer.setContentProvider(new FKTableViewerContentProvider());
    fkTableViewer.setLabelProvider(new FKTableViewerLabelProvider(database.getDatabaseInfo()));
}
Also used : Table(org.eclipse.swt.widgets.Table) Composite(org.eclipse.swt.widgets.Composite) Label(org.eclipse.swt.widgets.Label) IndexTableViewerContentProvider(com.cubrid.common.ui.cubrid.table.control.IndexTableViewerContentProvider) FillLayout(org.eclipse.swt.layout.FillLayout) FKTableViewerLabelProvider(com.cubrid.common.ui.cubrid.table.control.FKTableViewerLabelProvider) CTabItem(org.eclipse.swt.custom.CTabItem) TableColumn(org.eclipse.swt.widgets.TableColumn) IndexTableViewerLabelProvider(com.cubrid.common.ui.cubrid.table.control.IndexTableViewerLabelProvider) SashForm(org.eclipse.swt.custom.SashForm) FKTableViewerContentProvider(com.cubrid.common.ui.cubrid.table.control.FKTableViewerContentProvider) GridLayout(org.eclipse.swt.layout.GridLayout) CubridDatabase(com.cubrid.common.ui.spi.model.CubridDatabase) TableViewer(org.eclipse.jface.viewers.TableViewer)

Example 62 with Table

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

the class TableFocusCellManager method getFocusCell.

/**
	 * 
	 * Get the focus cell
	 * 
	 * @return ViewerCell
	 */
public ViewerCell getFocusCell() {
    ViewerCell cell = this.focusCell;
    Table t = (Table) getViewer().getControl();
    // It is possible that the selection has changed under the hood
    if (cell != null) {
        if (t.getSelection().length == 1 && t.getSelection()[0] != cell.getItem()) {
            setFocusCell(getViewer().getViewerRowByItem(t.getSelection()[0]).getCell(cell.getColumnIndex()));
        }
    }
    return this.focusCell;
}
Also used : Table(org.eclipse.swt.widgets.Table) ViewerCell(org.eclipse.jface.viewers.ViewerCell)

Example 63 with Table

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

the class TableFocusCellManager method getInitialFocusCell.

/**
	 * 
	 * Get the initial focus cell
	 * 
	 * @return ViewerCell
	 */
public ViewerCell getInitialFocusCell() {
    Table table = (Table) getViewer().getControl();
    if (!table.isDisposed() && table.getItemCount() > 0 && !table.getItem(table.getTopIndex()).isDisposed()) {
        final ViewerRow aViewerRow = getViewer().getViewerRowByItem(table.getItem(table.getTopIndex()));
        if (table.getColumnCount() == 0) {
            return aViewerRow.getCell(0);
        }
        Rectangle clientArea = table.getClientArea();
        for (int i = 0; i < table.getColumnCount(); i++) {
            if (aViewerRow.getBounds(i).width > 0 && columnInVisibleArea(clientArea, aViewerRow, i))
                return aViewerRow.getCell(i);
        }
    }
    return null;
}
Also used : Table(org.eclipse.swt.widgets.Table) Rectangle(org.eclipse.swt.graphics.Rectangle) ViewerRow(org.eclipse.jface.viewers.ViewerRow) Point(org.eclipse.swt.graphics.Point)

Example 64 with Table

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

the class BrokersParameterPropertyPage method createBrokerLstComp.

/**
	 * Creates brokers list Composite
	 * 
	 * @param parent the parent composite
	 * @return the composite
	 */
private Control createBrokerLstComp(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    composite.setLayout(layout);
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));
    createBasicGroup(composite);
    Group brokerLstGroup = new Group(composite, SWT.NONE);
    brokerLstGroup.setText(BROKER_LIST);
    brokerLstGroup.setLayout(new GridLayout(2, false));
    brokerLstGroup.setLayoutData(new GridData(GridData.FILL_BOTH));
    String[] columnNameArrs = new String[] { nameOfBrokerLst, portOfBrokerLst };
    brokersTableViewer = CommonUITool.createCommonTableViewer(brokerLstGroup, null, columnNameArrs, CommonUITool.createGridData(GridData.FILL_BOTH, 1, 1, -1, 200));
    Table brokersTable = brokersTableViewer.getTable();
    TableLayout tlayout = new TableLayout();
    tlayout.addColumnData(new ColumnWeightData(120, 100, true));
    tlayout.addColumnData(new ColumnWeightData(120, 100, true));
    brokersTable.setLayout(tlayout);
    createDealButton(brokerLstGroup);
    return composite;
}
Also used : ColumnWeightData(org.eclipse.jface.viewers.ColumnWeightData) Group(org.eclipse.swt.widgets.Group) GridLayout(org.eclipse.swt.layout.GridLayout) Table(org.eclipse.swt.widgets.Table) Composite(org.eclipse.swt.widgets.Composite) GridData(org.eclipse.swt.layout.GridData) TableLayout(org.eclipse.jface.viewers.TableLayout)

Example 65 with Table

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

the class DataCompareEditorPart method checkUncheckItems.

private void checkUncheckItems(TableViewer tableViewer, boolean check) {
    Table table = tableViewer.getTable();
    int selectionCount = table.getSelectionCount();
    if (selectionCount > 1) {
        TableItem[] items = table.getSelection();
        for (TableItem item : items) {
            DataCompare dataCompare = (DataCompare) item.getData();
            dataCompare.setUse(check);
        }
    }
    tableViewer.refresh();
}
Also used : Table(org.eclipse.swt.widgets.Table) TableItem(org.eclipse.swt.widgets.TableItem) DataCompare(com.cubrid.common.ui.compare.data.model.DataCompare) Constraint(com.cubrid.common.core.common.model.Constraint)

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