Search in sources :

Example 86 with Table

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

the class QueryPlanCompositeWithHistory method initialize.

/**
	 * Initializing a Plan Tab
	 */
private void initialize() {
    createPlanToolbar();
    //create the plan tab folder and history sash
    plansHistorySash = new SashForm(this, SWT.HORIZONTAL);
    plansHistorySash.setLayout(new GridLayout(2, true));
    plansHistorySash.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    //create left plan tab folder
    plansTabFolder = new CTabFolder(plansHistorySash, SWT.BOTTOM | SWT.CLOSE);
    plansTabFolder.setSimple(false);
    plansTabFolder.setUnselectedImageVisible(true);
    plansTabFolder.setUnselectedCloseVisible(true);
    plansTabFolder.setSelectionBackground(CombinedQueryEditorComposite.BACK_COLOR);
    plansTabFolder.setSelectionForeground(ResourceManager.getColor(SWT.COLOR_BLACK));
    plansTabFolder.setLayout(new GridLayout(1, true));
    plansTabFolder.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    TabContextMenuManager tabContextMenuManager = new TabContextMenuManager(plansTabFolder);
    tabContextMenuManager.createContextMenu();
    //create the right plan history table
    planHistoryTable = new Table(plansHistorySash, SWT.MULTI | SWT.FULL_SELECTION | SWT.BORDER);
    planHistoryTable.setLayout(new GridLayout(1, true));
    planHistoryTable.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    planHistoryTable.setHeaderVisible(true);
    planHistoryTable.setLinesVisible(true);
    planHistoryTable.addMouseListener(new MouseListener() {

        public void mouseDoubleClick(MouseEvent event) {
            int selectionIndex = planHistoryTable.getSelectionIndex();
            if (selectionIndex < 0) {
                return;
            }
            TableItem tableItem = planHistoryTable.getItem(planHistoryTable.getSelectionIndex());
            if (tableItem == null) {
                return;
            }
            int uid = Integer.valueOf(tableItem.getText(0));
            StructQueryPlan sq = planHistoryList.get(uid - 1);
            PlanTabItem tabItem = findPlanTab(uid);
            if (tabItem == null) {
                tabItem = newPlanTab(uid);
            }
            plansTabFolder.setSelection(tabItem);
            printPlan(tabItem, sq);
        }

        public void mouseDown(MouseEvent event) {
        }

        public void mouseUp(MouseEvent event) {
        }
    });
    int i = 0;
    planHistoryTblCols[i] = new TableColumn(planHistoryTable, SWT.RIGHT);
    // No
    planHistoryTblCols[i].setText(Messages.qedit_plan_history_col1);
    planHistoryTblCols[i].setMoveable(true);
    planHistoryTblCols[i].setWidth(20);
    addNumberSorter(planHistoryTable, planHistoryTblCols[i]);
    sortType.put(planHistoryTblCols[i], "NUMBER");
    planHistoryTblCols[++i] = new TableColumn(planHistoryTable, SWT.LEFT);
    // Date
    planHistoryTblCols[i].setText(Messages.qedit_plan_history_col2);
    planHistoryTblCols[i].setMoveable(true);
    planHistoryTblCols[i].setWidth(100);
    addStringSorter(planHistoryTable, planHistoryTblCols[i]);
    sortType.put(planHistoryTblCols[i], "STRING");
    planHistoryTblCols[++i] = new TableColumn(planHistoryTable, SWT.RIGHT);
    // Cost
    planHistoryTblCols[i].setText(Messages.qedit_plan_history_col4);
    planHistoryTblCols[i].setMoveable(true);
    planHistoryTblCols[i].setWidth(90);
    addNumberSorter(planHistoryTable, planHistoryTblCols[i]);
    sortType.put(planHistoryTblCols[i], "NUMBER");
    planHistoryTblCols[++i] = new TableColumn(planHistoryTable, SWT.LEFT);
    // Cost
    planHistoryTblCols[i].setText(Messages.qedit_plan_history_col3);
    planHistoryTblCols[i].setMoveable(false);
    planHistoryTblCols[i].setWidth(90);
    addStringSorter(planHistoryTable, planHistoryTblCols[i]);
    sortType.put(planHistoryTblCols[i], "STRING");
    sashPlanWeight = new int[] { 80, 20 };
    plansHistorySash.setWeights(sashPlanWeight);
    newPlanTab(1);
    plansTabFolder.setSelection(0);
    hideHistoryPane();
    refreshToolbarStatus(QueryOptions.getQueryPlanDisplayType());
}
Also used : CTabFolder(org.eclipse.swt.custom.CTabFolder) Table(org.eclipse.swt.widgets.Table) MouseEvent(org.eclipse.swt.events.MouseEvent) TableItem(org.eclipse.swt.widgets.TableItem) TableColumn(org.eclipse.swt.widgets.TableColumn) SashForm(org.eclipse.swt.custom.SashForm) GridLayout(org.eclipse.swt.layout.GridLayout) MouseListener(org.eclipse.swt.events.MouseListener) GridData(org.eclipse.swt.layout.GridData) StructQueryPlan(com.cubrid.common.core.queryplan.StructQueryPlan) TabContextMenuManager(com.cubrid.common.ui.spi.util.TabContextMenuManager)

Example 87 with Table

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

the class QueryResultComposite method makeEmptyResult.

/**
	 * Make empty result contents.
	 * 
	 */
public void makeEmptyResult() {
    resultTabFolder.setSelection(queryResultTabItem);
    SashForm bottomSash = new SashForm(queryResultTabFolder, SWT.VERTICAL);
    bottomSash.SASH_WIDTH = SASH_WIDTH;
    bottomSash.setBackground(CombinedQueryEditorComposite.BACK_COLOR);
    Table table = new Table(bottomSash, SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.MULTI);
    setDropTraget(table);
    table.setHeaderVisible(true);
    table.setLinesVisible(true);
    TableColumn tableColumn = new TableColumn(table, SWT.NONE);
    tableColumn.setWidth(60);
    SashForm tailSash = new SashForm(bottomSash, SWT.HORIZONTAL);
    tailSash.SASH_WIDTH = SASH_WIDTH;
    tailSash.setBackground(CombinedQueryEditorComposite.BACK_COLOR);
    new StyledText(tailSash, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.READ_ONLY);
    bottomSash.setWeights(new int[] { 70, 30 });
    CTabItem tabItem = new CTabItem(queryResultTabFolder, SWT.NONE);
    tabItem.setText(Messages.qedit_result);
    tabItem.setControl(bottomSash);
    queryResultTabFolder.setSelection(tabItem);
}
Also used : SashForm(org.eclipse.swt.custom.SashForm) Table(org.eclipse.swt.widgets.Table) StyledText(org.eclipse.swt.custom.StyledText) TableColumn(org.eclipse.swt.widgets.TableColumn) CTabItem(org.eclipse.swt.custom.CTabItem)

Example 88 with Table

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

the class ServicePropertyPage method createDatabaseGroup.

/**
	 *
	 * Create database group composite
	 *
	 * @param parent the parent composite
	 */
private void createDatabaseGroup(Composite parent) {
    Group databaseInfoGroup = new Group(parent, SWT.NONE);
    databaseInfoGroup.setText(Messages.grpAutoDatabase);
    GridData gridData = new GridData(GridData.FILL_BOTH);
    databaseInfoGroup.setLayoutData(gridData);
    GridLayout layout = new GridLayout();
    databaseInfoGroup.setLayout(layout);
    databaseTable = new Table(databaseInfoGroup, SWT.CHECK | SWT.V_SCROLL | SWT.MULTI | SWT.BORDER | SWT.H_SCROLL | SWT.FULL_SELECTION);
    databaseTable.setLinesVisible(false);
    databaseTable.setHeaderVisible(false);
    databaseTable.setLayoutData(CommonUITool.createGridData(GridData.FILL_BOTH, 1, 1, -1, 100));
}
Also used : Group(org.eclipse.swt.widgets.Group) GridLayout(org.eclipse.swt.layout.GridLayout) Table(org.eclipse.swt.widgets.Table) GridData(org.eclipse.swt.layout.GridData)

Example 89 with Table

use of org.eclipse.swt.widgets.Table in project dbeaver by serge-rider.

the class DataTransferPageFinal method createControl.

@Override
public void createControl(Composite parent) {
    initializeDialogUnits(parent);
    Composite composite = new Composite(parent, SWT.NULL);
    GridLayout gl = new GridLayout();
    gl.marginHeight = 0;
    gl.marginWidth = 0;
    composite.setLayout(gl);
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));
    {
        Group tablesGroup = UIUtils.createControlGroup(composite, CoreMessages.data_transfer_wizard_final_group_tables, 3, GridData.FILL_BOTH, 0);
        resultTable = new Table(tablesGroup, SWT.BORDER | SWT.SINGLE | SWT.FULL_SELECTION);
        resultTable.setLayoutData(new GridData(GridData.FILL_BOTH));
        resultTable.setHeaderVisible(true);
        resultTable.setLinesVisible(true);
        UIUtils.createTableColumn(resultTable, SWT.LEFT, CoreMessages.data_transfer_wizard_final_column_source);
        UIUtils.createTableColumn(resultTable, SWT.LEFT, CoreMessages.data_transfer_wizard_final_column_target);
        UIUtils.packColumns(resultTable);
    }
    setControl(composite);
}
Also used : 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)

Example 90 with Table

use of org.eclipse.swt.widgets.Table in project dbeaver by serge-rider.

the class GenerateMultiSQLDialog method createObjectsSelector.

protected void createObjectsSelector(Composite parent) {
    if (selectedObjects.size() < 2) {
        // Don't need it for a single object
        return;
    }
    UIUtils.createControlLabel(parent, "Tables");
    objectsTable = new Table(parent, SWT.BORDER | SWT.CHECK);
    GridData gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.heightHint = 100;
    objectsTable.setLayoutData(gd);
    for (T table : selectedObjects) {
        TableItem item = new TableItem(objectsTable, SWT.NONE);
        item.setText(DBUtils.getObjectFullName(table, DBPEvaluationContext.UI));
        item.setImage(DBeaverIcons.getImage(DBIcon.TREE_TABLE));
        item.setChecked(true);
        item.setData(table);
    }
    objectsTable.addSelectionListener(SQL_CHANGE_LISTENER);
    objectsTable.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            boolean hasChecked = !getCheckedObjects().isEmpty();
            getButton(IDialogConstants.OK_ID).setEnabled(hasChecked);
            getButton(IDialogConstants.DETAILS_ID).setEnabled(hasChecked);
        }
    });
}
Also used : Table(org.eclipse.swt.widgets.Table) SWT(org.eclipse.swt.SWT) TableItem(org.eclipse.swt.widgets.TableItem) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent)

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