Search in sources :

Example 21 with TableViewerColumn

use of org.eclipse.jface.viewers.TableViewerColumn in project cubrid-manager by CUBRID.

the class DBAuthComparator method createAuthTable.

private void createAuthTable(Composite parent) {
    authTableViewer = new TableViewer(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.BORDER);
    authTableViewer.getTable().setHeaderVisible(true);
    authTableViewer.getTable().setLinesVisible(true);
    final TableViewerColumn tableColumn = new TableViewerColumn(authTableViewer, SWT.LEFT);
    tableColumn.getColumn().setWidth(120);
    tableColumn.getColumn().setText(Messages.tblColAuthTable);
    final TableViewerColumn ownerColumn = new TableViewerColumn(authTableViewer, SWT.LEFT);
    ownerColumn.getColumn().setWidth(70);
    ownerColumn.getColumn().setText(Messages.lblOWner);
    final TableViewerColumn authSelectColumn = new TableViewerColumn(authTableViewer, SWT.LEFT);
    authSelectColumn.getColumn().setWidth(70);
    authSelectColumn.getColumn().setText(Messages.tblColAuthSelect);
    final TableViewerColumn authInsertColumn = new TableViewerColumn(authTableViewer, SWT.LEFT);
    authInsertColumn.getColumn().setWidth(70);
    authInsertColumn.getColumn().setText(Messages.tblColAuthInsert);
    final TableViewerColumn authUpdateColumn = new TableViewerColumn(authTableViewer, SWT.LEFT);
    authUpdateColumn.getColumn().setWidth(70);
    authUpdateColumn.getColumn().setText(Messages.tblColAuthUpdate);
    final TableViewerColumn authDeleteColumn = new TableViewerColumn(authTableViewer, SWT.LEFT);
    authDeleteColumn.getColumn().setWidth(70);
    authDeleteColumn.getColumn().setText(Messages.tblColAuthDelete);
    final TableViewerColumn authAlterColumn = new TableViewerColumn(authTableViewer, SWT.LEFT);
    authAlterColumn.getColumn().setWidth(70);
    authAlterColumn.getColumn().setText(Messages.tblColAuthAlter);
    final TableViewerColumn authIndexColumn = new TableViewerColumn(authTableViewer, SWT.LEFT);
    authIndexColumn.getColumn().setWidth(70);
    authIndexColumn.getColumn().setText(Messages.tblColAuthIndex);
    final TableViewerColumn authExecuteColumn = new TableViewerColumn(authTableViewer, SWT.LEFT);
    authExecuteColumn.getColumn().setWidth(70);
    authExecuteColumn.getColumn().setText(Messages.tblColAuthExecute);
    final TableViewerColumn authGrantSelectColumn = new TableViewerColumn(authTableViewer, SWT.LEFT);
    authGrantSelectColumn.getColumn().setWidth(90);
    authGrantSelectColumn.getColumn().setText(Messages.tblColAuthGrantselect);
    final TableViewerColumn authGrantInsertColumn = new TableViewerColumn(authTableViewer, SWT.LEFT);
    authGrantInsertColumn.getColumn().setWidth(90);
    authGrantInsertColumn.getColumn().setText(Messages.tblColAuthGrantinsert);
    final TableViewerColumn authGrantUpdateColumn = new TableViewerColumn(authTableViewer, SWT.LEFT);
    authGrantUpdateColumn.getColumn().setWidth(90);
    authGrantUpdateColumn.getColumn().setText(Messages.tblColAuthGrantupdate);
    final TableViewerColumn authGrantDeleteColumn = new TableViewerColumn(authTableViewer, SWT.LEFT);
    authGrantDeleteColumn.getColumn().setWidth(90);
    authGrantDeleteColumn.getColumn().setText(Messages.tblColAuthGrantdelete);
    final TableViewerColumn authGrantAlterColumn = new TableViewerColumn(authTableViewer, SWT.LEFT);
    authGrantAlterColumn.getColumn().setWidth(90);
    authGrantAlterColumn.getColumn().setText(Messages.tblColAuthGrantalter);
    final TableViewerColumn authGrantIndexColumn = new TableViewerColumn(authTableViewer, SWT.LEFT);
    authGrantIndexColumn.getColumn().setWidth(90);
    authGrantIndexColumn.getColumn().setText(Messages.tblColAuthGrantindex);
    final TableViewerColumn authGrantExecuteColumn = new TableViewerColumn(authTableViewer, SWT.LEFT);
    authGrantExecuteColumn.getColumn().setWidth(90);
    authGrantExecuteColumn.getColumn().setText(Messages.tblColAuthGrantexecute);
    authTableViewer.setLabelProvider(new AuthLabelProvider());
    authTableViewer.setContentProvider(new AuthContentProvider());
}
Also used : TableViewer(org.eclipse.jface.viewers.TableViewer) TableViewerColumn(org.eclipse.jface.viewers.TableViewerColumn)

Example 22 with TableViewerColumn

use of org.eclipse.jface.viewers.TableViewerColumn in project cubrid-manager by CUBRID.

the class ExportDataViewPart method createPartControl.

/**
	 * Create part controls
	 * 
	 * @param parent of the controls
	 * 
	 */
public void createPartControl(Composite parent) {
    Composite backPanel = new Composite(parent, SWT.NONE);
    backPanel.setLayout(new GridLayout(1, false));
    backPanel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
    Composite progressPanel = new Composite(backPanel, SWT.NONE);
    progressPanel.setLayout(new GridLayout(2, false));
    progressPanel.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
    progressIndicator = new ProgressIndicator(progressPanel, SWT.NONE);
    progressIndicator.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true));
    btnStop = new Button(progressPanel, SWT.NONE);
    btnStop.setText(com.cubrid.common.ui.common.Messages.btnStop);
    btnStop.setImage(CommonUIPlugin.getImage("icons/queryeditor/query_run_stop.png"));
    btnStop.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            processStop();
        }
    });
    tvProgress = new TableViewer(backPanel, SWT.BORDER | SWT.FULL_SELECTION);
    tvProgress.getTable().setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, true));
    tvProgress.getTable().setLinesVisible(true);
    tvProgress.getTable().setHeaderVisible(true);
    final TableViewerColumn tableName = new TableViewerColumn(tvProgress, SWT.NONE);
    final TableViewerColumn totalCount = new TableViewerColumn(tvProgress, SWT.NONE);
    final TableViewerColumn parseCount = new TableViewerColumn(tvProgress, SWT.NONE);
    final TableViewerColumn status = new TableViewerColumn(tvProgress, SWT.NONE);
    final TableViewerColumn elapsedTime = new TableViewerColumn(tvProgress, SWT.NONE);
    tableName.getColumn().setWidth(250);
    tableName.getColumn().setText(Messages.exportMonitorPartColumnFileName);
    totalCount.getColumn().setWidth(100);
    totalCount.getColumn().setText(Messages.exportMonitorPartColumnTotalcount);
    parseCount.getColumn().setWidth(100);
    parseCount.getColumn().setText(Messages.exportMonitorPartColumnParsecount);
    status.getColumn().setWidth(100);
    status.getColumn().setText(com.cubrid.common.ui.common.Messages.columnStatus);
    elapsedTime.getColumn().setWidth(130);
    elapsedTime.getColumn().setText(com.cubrid.common.ui.common.Messages.columnElapsedTime);
    tvProgress.setContentProvider(new TableContentProvider());
    tvProgress.setLabelProvider(new TableLabelProvider());
    Composite historyComposite = new Composite(backPanel, SWT.NONE);
    historyComposite.setLayout(new GridLayout(4, false));
    historyComposite.setLayoutData(new GridData(SWT.FILL, SWT.TOP, false, false));
    historyLabel = new Label(historyComposite, SWT.NONE);
    historyLabel.setText(Messages.exportMonitorPartSaveLabel);
    historyText = new Text(historyComposite, SWT.BORDER);
    historyText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    saveButton = new Button(historyComposite, SWT.NONE);
    saveButton.setText(Messages.exportMonitorPartSaveButton);
    saveButton.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            if (StringUtil.isEmpty(historyText.getText())) {
                CommonUITool.openErrorBox(Messages.exportMonitorPartSaveErrMsg1);
                return;
            }
            if (ExportConfigManager.getInstance().getConfig(historyText.getText()) != null) {
                CommonUITool.openErrorBox(Messages.exportMonitorPartSaveErrMsg2);
                return;
            }
            exportConfig.setName(historyText.getText().trim());
            ExportConfigManager.getInstance().addConfig(exportConfig);
            close();
        }
    });
    closeButton = new Button(historyComposite, SWT.NONE);
    closeButton.setText(Messages.closeButtonName);
    closeButton.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            close();
        }
    });
    setHistroyWidgetStatus(false);
    init();
}
Also used : Composite(org.eclipse.swt.widgets.Composite) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Label(org.eclipse.swt.widgets.Label) Text(org.eclipse.swt.widgets.Text) GridLayout(org.eclipse.swt.layout.GridLayout) Button(org.eclipse.swt.widgets.Button) ProgressIndicator(org.eclipse.jface.dialogs.ProgressIndicator) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) TableViewer(org.eclipse.jface.viewers.TableViewer) TableViewerColumn(org.eclipse.jface.viewers.TableViewerColumn)

Example 23 with TableViewerColumn

use of org.eclipse.jface.viewers.TableViewerColumn in project cubrid-manager by CUBRID.

the class BrokerConfigEditComposite method addBrokerConfColumn.

public void addBrokerConfColumn() {
    int columnCount = confTableViewer.getTable().getColumnCount();
    String brokerName = "broker" + (columnCount - 1);
    String brokerTitle = Messages.cubridBrokerConfEditorBrokerTitle + (columnCount - 1);
    final TableViewerColumn column = new TableViewerColumn(confTableViewer, SWT.LEFT);
    column.getColumn().setWidth(150);
    column.getColumn().setText(brokerTitle);
    column.setEditingSupport(new PropValueEditingSupport(confTableViewer, columnCount));
    confTableViewer.setLabelProvider(confTableLabelProvider);
    if (confListData.size() > 0) {
        Map<String, String> valueMap = confListData.get(0);
        String columnCountStr = String.valueOf(columnCount);
        valueMap.put(columnCountStr, "[%" + brokerName + "]");
        // add a empty new line annotation
        valueMap.put(columnCountStr + ANNOTATION, NEWLINE);
    }
    confTableViewer.getTable().showColumn(column.getColumn());
    confTableViewer.refresh();
}
Also used : StringUtils.defaultString(org.apache.commons.lang.StringUtils.defaultString) Point(org.eclipse.swt.graphics.Point) TableViewerColumn(org.eclipse.jface.viewers.TableViewerColumn)

Example 24 with TableViewerColumn

use of org.eclipse.jface.viewers.TableViewerColumn in project cubrid-manager by CUBRID.

the class DataCompareDetailEditorPart method initTableViewer.

private void initTableViewer() {
    TableViewerColumn col = null;
    for (int i = 0, len = columnList.size(); i < len; i++) {
        String columnName = columnList.get(i);
        col = new TableViewerColumn(compareTableViewer, SWT.NONE);
        col.getColumn().setWidth(100);
        col.getColumn().setText(columnName);
    }
    if (dataList == null) {
        dataList = new ArrayList<CompareViewData>();
    }
    compareTableViewer.setContentProvider(new DataCompareViewContentProvider());
    compareTableViewer.setLabelProvider(new DataCompareViewLabelProvider());
    compareTableViewer.setInput(dataList);
}
Also used : CompareViewData(com.cubrid.common.ui.compare.data.model.CompareViewData) TableViewerColumn(org.eclipse.jface.viewers.TableViewerColumn)

Example 25 with TableViewerColumn

use of org.eclipse.jface.viewers.TableViewerColumn in project cubrid-manager by CUBRID.

the class DataCompareEditorPart method createContent.

private void createContent(Composite parent) {
    compareTableViewer = new TableViewer(parent, SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION);
    compareTableViewer.setUseHashlookup(true);
    compareTableViewer.setColumnProperties(columnNames);
    CommonUITool.createGridLayout(compareTableViewer.getTable(), 1, 0, 10, 0, 10, 0, 0, 0, 0);
    compareTableViewer.getTable().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    compareTableViewer.getTable().setLinesVisible(true);
    compareTableViewer.getTable().setHeaderVisible(true);
    sorter = new DataCompareSchemaListViewSorter();
    sorter.setSortType(DataCompareSchemaListViewSorter.SORT_TABLE);
    compareTableViewer.setSorter(sorter);
    makeContextMenu(compareTableViewer);
    final TableViewerColumn firstCol = new TableViewerColumn(compareTableViewer, SWT.NONE);
    firstCol.getColumn().setWidth(30);
    firstCol.getColumn().setResizable(false);
    firstCol.getColumn().setAlignment(SWT.CENTER);
    firstCol.getColumn().setImage(CommonUIPlugin.getImage("icons/unchecked.gif"));
    firstCol.getColumn().addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            TableItem[] items = compareTableViewer.getTable().getItems();
            if (items == null) {
                return;
            }
            for (TableItem item : items) {
                DataCompare dataCompare = (DataCompare) item.getData();
                dataCompare.setUse(isSelectAll);
            }
            compareTableViewer.refresh();
            Image image = null;
            if (isSelectAll) {
                image = CommonUIPlugin.getImage("icons/checked.gif");
            } else {
                image = CommonUIPlugin.getImage("icons/unchecked.gif");
            }
            firstCol.getColumn().setImage(image);
            isSelectAll = !isSelectAll;
        }
    });
    TableViewerColumn col = new TableViewerColumn(compareTableViewer, SWT.NONE);
    col.getColumn().setWidth(200);
    col.getColumn().setText(Messages.lblDataCompareTable);
    makeSortTableColumn(col, DataCompareSchemaListViewSorter.SORT_TABLE);
    col = new TableViewerColumn(compareTableViewer, SWT.LEFT);
    col.getColumn().setWidth(100);
    col.getColumn().setText(Messages.lblDataCompareRecordSource);
    makeSortTableColumn(col, DataCompareSchemaListViewSorter.SORT_SOURCE_RECORDS);
    col = new TableViewerColumn(compareTableViewer, SWT.LEFT);
    col.getColumn().setWidth(100);
    col.getColumn().setText(Messages.lblDataCompareRecordTarget);
    makeSortTableColumn(col, DataCompareSchemaListViewSorter.SORT_TARGET_RECORDS);
    col = new TableViewerColumn(compareTableViewer, SWT.LEFT);
    col.getColumn().setWidth(100);
    col.getColumn().setText(Messages.lblDataCompareRecordProgress);
    makeSortTableColumn(col, DataCompareSchemaListViewSorter.SORT_PROGRESS);
    col = new TableViewerColumn(compareTableViewer, SWT.LEFT);
    col.getColumn().setWidth(100);
    col.getColumn().setText(Messages.lblDataCompareRecordMatch);
    makeSortTableColumn(col, DataCompareSchemaListViewSorter.SORT_MATCHES);
    col = new TableViewerColumn(compareTableViewer, SWT.LEFT);
    col.getColumn().setWidth(100);
    col.getColumn().setText(Messages.lblDataCompareRecordNoMatch);
    makeSortTableColumn(col, DataCompareSchemaListViewSorter.SORT_NOT_MATCHES);
    col = new TableViewerColumn(compareTableViewer, SWT.LEFT);
    col.getColumn().setWidth(100);
    col.getColumn().setText(Messages.lblDataCompareRecordNotExist);
    makeSortTableColumn(col, DataCompareSchemaListViewSorter.SORT_NOT_EXISTS);
    col = new TableViewerColumn(compareTableViewer, SWT.LEFT);
    col.getColumn().setWidth(300);
    col.getColumn().setText(Messages.lblDataCompareRecordError);
    makeSortTableColumn(col, DataCompareSchemaListViewSorter.SORT_ERROR);
    CellEditor[] cellEditor = new CellEditor[1];
    cellEditor[0] = new CheckboxCellEditor(compareTableViewer.getTable());
    compareTableViewer.setCellEditors(cellEditor);
    compareTableViewer.setCellModifier(new DataCompareCellModifier(this));
    compareTableViewer.setContentProvider(new DataCompareSchemaListContentProvider());
    compareTableViewer.setLabelProvider(new DataCompareSchemaListLabelProvider());
    compareList = new ArrayList<DataCompare>();
    compareTableViewer.setInput(compareList);
    txtProgress = new StyledText(parent, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL);
    txtProgress.setEditable(false);
    txtProgress.setWordWrap(true);
    txtProgress.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 1, 1, -1, 100));
    txtProgress.setBackground(txtProgress.getDisplay().getSystemColor(SWT.COLOR_BLACK));
    txtProgress.setForeground(txtProgress.getDisplay().getSystemColor(SWT.COLOR_GREEN));
    compareTableViewer.getTable().setToolTipText(Messages.msgYouCanSeeDetailDblclick);
    compareTableViewer.getTable().addKeyListener(new KeyAdapter() {

        public void keyReleased(KeyEvent e) {
            if (e.character == ' ') {
                TableItem[] items = compareTableViewer.getTable().getSelection();
                if (items == null) {
                    return;
                }
                for (TableItem item : items) {
                    DataCompare dataCompare = (DataCompare) item.getData();
                    dataCompare.setUse(!dataCompare.isUse());
                }
                compareTableViewer.refresh();
            }
        }
    });
    compareTableViewer.addDoubleClickListener(new IDoubleClickListener() {

        public void doubleClick(DoubleClickEvent event) {
            if (!refreshedRecordCounts) {
                CommonUITool.openWarningBox(Messages.msgClickRefreshToEsimateDiff);
                return;
            }
            IStructuredSelection selection = (IStructuredSelection) event.getSelection();
            DataCompare model = (DataCompare) selection.getFirstElement();
            if (!model.isSameSchema()) {
                CommonUITool.openWarningBox(Messages.msgTheSchemaDiff);
                return;
            }
            if (model.getRecordsTarget() == -1) {
                CommonUITool.openWarningBox(Messages.msgTargetNotFound);
                return;
            }
            if (model.getRecordsSource() == 0 && model.getRecordsTarget() > 0) {
                CommonUITool.openWarningBox(Messages.msgTargetNoData);
                return;
            }
            if (model.getRecordsSource() == 0) {
                CommonUITool.openWarningBox(Messages.msgNoDataToCompare);
                return;
            }
            if (model.getProgressPosition() == 0) {
                CommonUITool.openWarningBox(Messages.msgNotYetCompared);
                return;
            }
            if (model.getNotMatches() == 0 && model.getNotExists() == 0) {
                CommonUITool.openWarningBox(Messages.msgSameData);
                return;
            }
            showDataCompareDetailEditor(model.getSchemaInfo());
        }
    });
}
Also used : StyledText(org.eclipse.swt.custom.StyledText) CheckboxCellEditor(org.eclipse.jface.viewers.CheckboxCellEditor) CellEditor(org.eclipse.jface.viewers.CellEditor) CheckboxCellEditor(org.eclipse.jface.viewers.CheckboxCellEditor) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) TableItem(org.eclipse.swt.widgets.TableItem) KeyAdapter(org.eclipse.swt.events.KeyAdapter) DoubleClickEvent(org.eclipse.jface.viewers.DoubleClickEvent) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) Image(org.eclipse.swt.graphics.Image) KeyEvent(org.eclipse.swt.events.KeyEvent) IDoubleClickListener(org.eclipse.jface.viewers.IDoubleClickListener) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) DataCompare(com.cubrid.common.ui.compare.data.model.DataCompare) TableViewer(org.eclipse.jface.viewers.TableViewer) TableViewerColumn(org.eclipse.jface.viewers.TableViewerColumn)

Aggregations

TableViewerColumn (org.eclipse.jface.viewers.TableViewerColumn)134 TableViewer (org.eclipse.jface.viewers.TableViewer)72 Composite (org.eclipse.swt.widgets.Composite)53 GridData (org.eclipse.swt.layout.GridData)52 SelectionEvent (org.eclipse.swt.events.SelectionEvent)45 TableColumn (org.eclipse.swt.widgets.TableColumn)41 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)36 GridLayout (org.eclipse.swt.layout.GridLayout)32 ColumnLabelProvider (org.eclipse.jface.viewers.ColumnLabelProvider)28 Table (org.eclipse.swt.widgets.Table)25 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)19 DoubleClickEvent (org.eclipse.jface.viewers.DoubleClickEvent)16 IDoubleClickListener (org.eclipse.jface.viewers.IDoubleClickListener)16 Point (org.eclipse.swt.graphics.Point)15 TableColumnLayout (org.eclipse.jface.layout.TableColumnLayout)14 ColumnWeightData (org.eclipse.jface.viewers.ColumnWeightData)14 FillLayout (org.eclipse.swt.layout.FillLayout)14 Button (org.eclipse.swt.widgets.Button)14 Image (org.eclipse.swt.graphics.Image)13 Text (org.eclipse.swt.widgets.Text)11