Search in sources :

Example 71 with TableColumn

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

the class NewDirectoryDialog method createDirectoryList.

/**
	 * create the directory list
	 * 
	 * @param composite the parent composite
	 */
private void createDirectoryList(Composite composite) {
    directoryList = new Table(composite, SWT.V_SCROLL | SWT.MULTI | SWT.BORDER | SWT.H_SCROLL | SWT.FULL_SELECTION);
    directoryList.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    directoryList.setLinesVisible(true);
    directoryList.setHeaderVisible(true);
    directoryList.setEnabled(false);
    TableLayout tableLayout = new TableLayout();
    tableLayout.addColumnData(new ColumnWeightData(20, true));
    directoryList.setLayout(tableLayout);
    final TableColumn currentVolumeColumn = new TableColumn(directoryList, SWT.LEFT);
    currentVolumeColumn.setText(Messages.tblColDirectoryVolume);
    currentVolumeColumn.pack();
}
Also used : ColumnWeightData(org.eclipse.jface.viewers.ColumnWeightData) Table(org.eclipse.swt.widgets.Table) GridData(org.eclipse.swt.layout.GridData) TableLayout(org.eclipse.jface.viewers.TableLayout) TableColumn(org.eclipse.swt.widgets.TableColumn)

Example 72 with TableColumn

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

the class OptimizeDialog method createDialogArea.

/**
	 * Create dialog area content
	 *
	 * @param parent the parent composite
	 * @return the control
	 */
protected Control createDialogArea(Composite parent) {
    Composite parentComp = (Composite) super.createDialogArea(parent);
    final Composite composite = new Composite(parentComp, SWT.NONE);
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));
    GridLayout layout = new GridLayout();
    layout.marginWidth = 10;
    layout.marginHeight = 10;
    composite.setLayout(layout);
    final Group dbNameGroup = new Group(composite, SWT.NONE);
    layout = new GridLayout();
    layout.numColumns = 2;
    layout.marginWidth = 10;
    layout.marginHeight = 10;
    dbNameGroup.setLayout(layout);
    final GridData gdDbNameGroup = new GridData(GridData.FILL_HORIZONTAL);
    dbNameGroup.setLayoutData(gdDbNameGroup);
    final Label dbNameLabel = new Label(dbNameGroup, SWT.LEFT | SWT.WRAP);
    dbNameLabel.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
    dbNameLabel.setText(Messages.lblOptimizeDbName);
    databaseName = new Text(dbNameGroup, SWT.BORDER);
    databaseName.setEnabled(false);
    final GridData gdDatabaseName = new GridData(SWT.FILL, SWT.FILL, true, false);
    databaseName.setLayoutData(gdDatabaseName);
    final Label optimizeLabel = new Label(dbNameGroup, SWT.WRAP);
    optimizeLabel.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
    optimizeLabel.setText(Messages.lblOptimizeClassName);
    GridData gdClassName = new org.eclipse.swt.layout.GridData(SWT.FILL, SWT.FILL, true, false);
    className = new Combo(dbNameGroup, SWT.DROP_DOWN | SWT.READ_ONLY);
    className.setLayoutData(gdClassName);
    className.setVisibleItemCount(15);
    final Group descGroup = new Group(composite, SWT.NONE);
    layout = new GridLayout();
    layout.marginWidth = 10;
    layout.marginHeight = 10;
    descGroup.setLayoutData(new GridData(GridData.FILL_BOTH));
    descGroup.setLayout(layout);
    descGroup.setText(Messages.grpOptimizeDesc);
    final Label descriptionLabel = new Label(descGroup, SWT.WRAP);
    descriptionLabel.setText(Messages.lblOptimizeDesc);
    descriptionLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    volumeTable = new Table(composite, SWT.MULTI | SWT.BORDER | SWT.H_SCROLL | SWT.FULL_SELECTION | SWT.READ_ONLY);
    volumeTable.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    volumeTable.setLinesVisible(false);
    volumeTable.setHeaderVisible(false);
    TableLayout tableLayout = new TableLayout();
    volumeTable.setLayout(tableLayout);
    final TableColumn currentVolumeColumn = new TableColumn(volumeTable, SWT.LEFT);
    currentVolumeColumn.setText("");
    currentVolumeColumn.pack();
    setMessage(Messages.msgOptimizeDbInformation);
    setTitle(Messages.titleOptimizeDbDialog);
    initial();
    return parentComp;
}
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) Label(org.eclipse.swt.widgets.Label) Text(org.eclipse.swt.widgets.Text) Combo(org.eclipse.swt.widgets.Combo) TableLayout(org.eclipse.jface.viewers.TableLayout) TableColumn(org.eclipse.swt.widgets.TableColumn)

Example 73 with TableColumn

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

the class SettingCubridConfPage method createControl.

/* (non-Javadoc)
	 * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
	 */
public void createControl(Composite parent) {
    Composite container = new Composite(parent, SWT.NONE);
    container.setLayout(new FormLayout());
    setControl(container);
    setDescription(Messages.descSettingCubridPage);
    Composite leftComposite = new Composite(container, SWT.NONE);
    leftComposite.setLayout(new GridLayout(3, false));
    FormData leftData = new FormData();
    leftData.top = new FormAttachment(0, 5);
    leftData.bottom = new FormAttachment(100, 0);
    leftData.left = new FormAttachment(0, 5);
    leftData.right = new FormAttachment(50, -5);
    leftComposite.setLayoutData(leftData);
    Label separator = new Label(container, SWT.SEPARATOR);
    FormData separatorData = new FormData();
    separatorData.top = new FormAttachment(0, 5);
    separatorData.bottom = new FormAttachment(100, -5);
    separatorData.left = new FormAttachment(50, -5);
    separatorData.right = new FormAttachment(50, 5);
    separator.setLayoutData(separatorData);
    Composite rightComposite = new Composite(container, SWT.NONE);
    rightComposite.setLayout(new GridLayout(3, false));
    FormData rightData = new FormData();
    rightData.top = new FormAttachment(0, 5);
    rightData.bottom = new FormAttachment(100, 0);
    rightData.left = new FormAttachment(50, 5);
    rightData.right = new FormAttachment(100, -5);
    rightComposite.setLayoutData(rightData);
    /*Create left widget*/
    Label hostALabel = new Label(leftComposite, SWT.None);
    hostALabel.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
    hostALabel.setText(Messages.lblMaster);
    masterHostLabel = new Label(leftComposite, SWT.None);
    masterHostLabel.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 2, 1, -1, -1));
    masterViewer = new TableViewer(leftComposite, SWT.BORDER | SWT.FULL_SELECTION);
    masterViewer.getTable().setLayoutData(CommonUITool.createGridData(GridData.FILL_BOTH, 3, 1, -1, -1));
    masterViewer.getTable().setLinesVisible(true);
    masterViewer.getTable().setHeaderVisible(true);
    masterViewer.setContentProvider(new TableContentProvider());
    masterViewer.setLabelProvider(new CubridConfTableProvider());
    masterViewer.setColumnProperties(PROPS);
    CellEditor[] editorsA = new CellEditor[2];
    editorsA[0] = null;
    editorsA[1] = new TextCellEditor(masterViewer.getTable());
    masterViewer.setCellEditors(editorsA);
    masterViewer.setCellModifier(new ICellModifier() {

        public boolean canModify(Object element, String property) {
            if (property.equals(PROPS[1])) {
                return true;
            }
            return false;
        }

        public Object getValue(Object element, String property) {
            DataModel model = (DataModel) element;
            if (property.equals(PROPS[0])) {
                return model.getKey() == null ? "" : model.getKey();
            } else if (property.equals(PROPS[1])) {
                return model.getValue() == null ? "" : model.getValue();
            }
            return "";
        }

        public void modify(Object element, String property, Object value) {
            TableItem item = (TableItem) element;
            DataModel model = (DataModel) item.getData();
            model.setValue(value.toString());
            masterViewer.refresh(model);
            updateHAModel(masterViewer, model, false);
        }
    });
    TableColumn keyAColumn = new TableColumn(masterViewer.getTable(), SWT.LEFT);
    keyAColumn.setText(Messages.lblKey);
    keyAColumn.setWidth(160);
    TableColumn valueAColumn = new TableColumn(masterViewer.getTable(), SWT.LEFT);
    valueAColumn.setText(Messages.lblValue);
    valueAColumn.setWidth(200);
    Label masterDBLabel = new Label(leftComposite, SWT.None);
    masterDBLabel.setText(Messages.lblDatabase);
    masterDBLabel.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
    masterDBCombo = new Combo(leftComposite, SWT.BORDER | SWT.READ_ONLY);
    masterDBCombo.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
    masterDBCombo.addSelectionListener(new SelectionListener() {

        public void widgetSelected(SelectionEvent e) {
            widgetDefaultSelected(e);
        }

        public void widgetDefaultSelected(SelectionEvent e) {
            HAModel haModel = getConfigHAWizard().getHaModel();
            /*Init table data*/
            initTableData(haModel.getMasterServer(), true);
            HAServer haServer = haModel.getSlaveServer();
            initTableData(haServer, false);
        }
    });
    ToolBar toolBarA = new ToolBar(leftComposite, SWT.None);
    toolBarA.setLayoutData(CommonUITool.createGridData(GridData.HORIZONTAL_ALIGN_END, 1, 1, -1, -1));
    ToolItem addItemA = new ToolItem(toolBarA, SWT.None);
    addItemA.setToolTipText(Messages.itemAddParameter);
    addItemA.setImage(CubridManagerUIPlugin.getImage("/icons/replication/add_param.gif"));
    addItemA.addSelectionListener(new SelectionListener() {

        public void widgetSelected(SelectionEvent e) {
            widgetDefaultSelected(e);
        }

        public void widgetDefaultSelected(SelectionEvent e) {
            addParameter(masterViewer);
        }
    });
    ToolItem editItemA = new ToolItem(toolBarA, SWT.None);
    editItemA.setToolTipText(Messages.itemEditParameter);
    editItemA.setImage(CubridManagerUIPlugin.getImage("/icons/replication/edit_param.gif"));
    editItemA.addSelectionListener(new SelectionListener() {

        public void widgetSelected(SelectionEvent e) {
            widgetDefaultSelected(e);
        }

        public void widgetDefaultSelected(SelectionEvent e) {
            editParameter(masterViewer);
        }
    });
    ToolItem dropItemA = new ToolItem(toolBarA, SWT.None);
    dropItemA.setToolTipText(Messages.itemDeleteParameter);
    dropItemA.setImage(CubridManagerUIPlugin.getImage("/icons/replication/delete_param.gif"));
    dropItemA.addSelectionListener(new SelectionListener() {

        public void widgetSelected(SelectionEvent e) {
            widgetDefaultSelected(e);
        }

        public void widgetDefaultSelected(SelectionEvent e) {
            dropParameter(masterViewer);
        }
    });
    /*Create right widget*/
    Label hostBLabel = new Label(rightComposite, SWT.None);
    hostBLabel.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
    hostBLabel.setText(Messages.lblSlave);
    slaveHostLabel = new Label(rightComposite, SWT.None);
    slaveHostLabel.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 2, 1, -1, -1));
    slaveViewer = new TableViewer(rightComposite, SWT.BORDER | SWT.FULL_SELECTION);
    slaveViewer.getTable().setLayoutData(CommonUITool.createGridData(GridData.FILL_BOTH, 3, 1, -1, -1));
    slaveViewer.getTable().setLinesVisible(true);
    slaveViewer.getTable().setHeaderVisible(true);
    slaveViewer.setContentProvider(new TableContentProvider());
    slaveViewer.setLabelProvider(new CubridConfTableProvider());
    slaveViewer.setColumnProperties(PROPS);
    CellEditor[] editorsB = new CellEditor[2];
    editorsB[0] = null;
    editorsB[1] = new TextCellEditor(slaveViewer.getTable());
    slaveViewer.setCellEditors(editorsB);
    slaveViewer.setCellModifier(new ICellModifier() {

        public boolean canModify(Object element, String property) {
            if (property.equals(PROPS[1])) {
                return true;
            }
            return false;
        }

        public Object getValue(Object element, String property) {
            DataModel model = (DataModel) element;
            if (property.equals(PROPS[0])) {
                return model.getKey() == null ? "" : model.getKey();
            } else if (property.equals(PROPS[1])) {
                return model.getValue() == null ? "" : model.getValue();
            }
            return "";
        }

        public void modify(Object element, String property, Object value) {
            TableItem item = (TableItem) element;
            DataModel model = (DataModel) item.getData();
            model.setValue(value.toString());
            slaveViewer.refresh(model);
            updateHAModel(slaveViewer, model, false);
        }
    });
    TableColumn keyBColumn = new TableColumn(slaveViewer.getTable(), SWT.LEFT);
    keyBColumn.setText(Messages.lblKey);
    keyBColumn.setWidth(160);
    TableColumn valueBColumn = new TableColumn(slaveViewer.getTable(), SWT.LEFT);
    valueBColumn.setText(Messages.lblValue);
    valueBColumn.setWidth(200);
    ToolBar toolBarB = new ToolBar(rightComposite, SWT.None);
    toolBarB.setLayoutData(CommonUITool.createGridData(GridData.HORIZONTAL_ALIGN_END, 3, 1, -1, -1));
    ToolItem addItemB = new ToolItem(toolBarB, SWT.None);
    addItemB.setToolTipText(Messages.itemAddParameter);
    addItemB.setImage(CubridManagerUIPlugin.getImage("/icons/replication/add_param.gif"));
    addItemB.addSelectionListener(new SelectionListener() {

        public void widgetSelected(SelectionEvent e) {
            widgetDefaultSelected(e);
        }

        public void widgetDefaultSelected(SelectionEvent e) {
            addParameter(slaveViewer);
        }
    });
    ToolItem editItemB = new ToolItem(toolBarB, SWT.None);
    editItemB.setToolTipText(Messages.itemEditParameter);
    editItemB.setImage(CubridManagerUIPlugin.getImage("/icons/replication/edit_param.gif"));
    editItemB.addSelectionListener(new SelectionListener() {

        public void widgetSelected(SelectionEvent e) {
            widgetDefaultSelected(e);
        }

        public void widgetDefaultSelected(SelectionEvent e) {
            editParameter(slaveViewer);
        }
    });
    ToolItem dropItemB = new ToolItem(toolBarB, SWT.None);
    dropItemB.setToolTipText(Messages.itemDeleteParameter);
    dropItemB.setImage(CubridManagerUIPlugin.getImage("/icons/replication/delete_param.gif"));
    dropItemB.addSelectionListener(new SelectionListener() {

        public void widgetSelected(SelectionEvent e) {
            widgetDefaultSelected(e);
        }

        public void widgetDefaultSelected(SelectionEvent e) {
            dropParameter(slaveViewer);
        }
    });
}
Also used : CellEditor(org.eclipse.jface.viewers.CellEditor) TextCellEditor(org.eclipse.jface.viewers.TextCellEditor) TableItem(org.eclipse.swt.widgets.TableItem) Label(org.eclipse.swt.widgets.Label) Combo(org.eclipse.swt.widgets.Combo) GridLayout(org.eclipse.swt.layout.GridLayout) TableContentProvider(com.cubrid.common.ui.spi.TableContentProvider) ICellModifier(org.eclipse.jface.viewers.ICellModifier) SelectionEvent(org.eclipse.swt.events.SelectionEvent) FormAttachment(org.eclipse.swt.layout.FormAttachment) ToolItem(org.eclipse.swt.widgets.ToolItem) FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) Composite(org.eclipse.swt.widgets.Composite) TableColumn(org.eclipse.swt.widgets.TableColumn) ToolBar(org.eclipse.swt.widgets.ToolBar) TextCellEditor(org.eclipse.jface.viewers.TextCellEditor) TableViewer(org.eclipse.jface.viewers.TableViewer) SelectionListener(org.eclipse.swt.events.SelectionListener)

Example 74 with TableColumn

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

the class CQBUserEditor method createCommonTableViewer.

/**
	 * Create common tableViewer
	 *
	 * @param parent the parent composite
	 * @param columnNameArr the column name array
	 * @param gridData the grid data
	 * @return the table viewer
	 */
public TableViewer createCommonTableViewer(Composite parent, final String[] columnNameArr, GridData gridData) {
    final TableViewer tableViewer = new TableViewer(parent, SWT.V_SCROLL | SWT.MULTI | SWT.BORDER | SWT.H_SCROLL | SWT.FULL_SELECTION);
    tableViewer.setContentProvider(new TableContentProvider());
    tableViewer.setLabelProvider(new ExTableLabelProvider());
    tableViewer.setSorter(new TableViewerSorter());
    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.CHECK);
        tblColumn.setData(false);
        tblColumn.setText(columnNameArr[i]);
        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();
                }
                return;
            }
        });
        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) TableViewer(org.eclipse.jface.viewers.TableViewer) TableColumn(org.eclipse.swt.widgets.TableColumn)

Example 75 with TableColumn

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

the class SqlLogAnalyzeResultDialog method makeErrColumn.

/**
	 * make err table column
	 *
	 * @return tableColumn
	 */
private TableColumn makeErrColumn() {
    TableColumn err = new TableColumn(table, SWT.LEFT);
    err.addSelectionListener(new DirectionAwareSelectionAdapter("err"));
    return err;
}
Also used : 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