Search in sources :

Example 31 with TableViewerColumn

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

the class DatabaseDashboardEditor method createVolumnComposite.

/**
	 * create volumn information composite
	 *
	 * @param bar ExpandBar
	 * @param bar index
	 *
	 */
public void createVolumnComposite(ExpandBar bar, int index) {
    ExpandItem volumnItem = new ExpandItem(bar, SWT.NONE, index);
    volumnItem.setText(Messages.exportDashboardVolumnTableTitle);
    Composite volumnComposite = new Composite(bar, SWT.NONE);
    volumnComposite.setLayout(new FillLayout());
    volumnInfoTableViewer = new TableViewer(volumnComposite, SWT.BORDER | SWT.FULL_SELECTION);
    volumnInfoTableViewer.getTable().setHeaderVisible(true);
    volumnInfoTableViewer.getTable().setLinesVisible(true);
    final TableViewerColumn columnVolumn = new TableViewerColumn(volumnInfoTableViewer, SWT.CENTER);
    columnVolumn.getColumn().setWidth(140);
    columnVolumn.getColumn().setText(Messages.volumnTableVolumnNameColumnLabel);
    columnVolumn.getColumn().setToolTipText(Messages.volumnTableVolumnNameColumnLabel);
    final TableViewerColumn columnType = new TableViewerColumn(volumnInfoTableViewer, SWT.CENTER);
    columnType.getColumn().setWidth(90);
    columnType.getColumn().setText(Messages.volumnTableVolumnTypeColumnLabel);
    columnType.getColumn().setToolTipText(Messages.volumnTableVolumnTypeColumnLabel);
    final TableViewerColumn columnFreeSize = new TableViewerColumn(volumnInfoTableViewer, SWT.RIGHT);
    columnFreeSize.getColumn().setWidth(90);
    columnFreeSize.getColumn().setText(Messages.volumnTableFreesizeColumnLabel);
    columnFreeSize.getColumn().setToolTipText(Messages.volumnTableFreesizeColumnLabel);
    final TableViewerColumn columnTotalSize = new TableViewerColumn(volumnInfoTableViewer, SWT.RIGHT);
    columnTotalSize.getColumn().setWidth(90);
    columnTotalSize.getColumn().setText(Messages.volumnTableTotalsizeColumnLabel);
    columnTotalSize.getColumn().setToolTipText(Messages.volumnTableTotalsizeColumnLabel);
    final TableViewerColumn lastModifyDate = new TableViewerColumn(volumnInfoTableViewer, SWT.CENTER);
    lastModifyDate.getColumn().setWidth(90);
    lastModifyDate.getColumn().setText(Messages.volumnTableLastModifyTimeColumnLabel);
    lastModifyDate.getColumn().setToolTipText(Messages.volumnTableLastModifyTimeColumnLabel);
    final TableViewerColumn columnLocation = new TableViewerColumn(volumnInfoTableViewer, SWT.LEFT);
    columnLocation.getColumn().setWidth(300);
    columnLocation.getColumn().setText(Messages.tblColumnVolPath);
    columnLocation.getColumn().setToolTipText(Messages.tblColumnVolPath);
    volumnInfoTableViewer.setContentProvider(new TableContentProvider());
    volumnInfoTableViewer.setLabelProvider(new TableLabelProvider());
    Table table = volumnInfoTableViewer.getTable();
    table.setLinesVisible(true);
    table.setHeaderVisible(true);
    volumnInfoTableViewer.setInput(volumnInfoListData);
    volumnItem.setControl(volumnComposite);
    volumnItem.setHeight(130);
    volumnItem.setExpanded(true);
    Menu menu = new Menu(this.getSite().getShell(), SWT.POP_UP);
    final MenuItem itemAddVolumn = new MenuItem(menu, SWT.PUSH);
    itemAddVolumn.setText(com.cubrid.cubridmanager.ui.spi.Messages.setAddVolumeActionName);
    itemAddVolumn.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            DefaultSchemaNode node = null;
            for (ICubridNode cubridNode : database.getChildren()) {
                if (cubridNode.getType().equals(CubridNodeType.DBSPACE_FOLDER)) {
                    node = (DefaultSchemaNode) cubridNode;
                }
            }
            if (node == null) {
                return;
            }
            // Gets the status of adding volume
            GetAddVolumeStatusInfo getAddVolumeStatusInfo = new GetAddVolumeStatusInfo();
            final CommonQueryTask<GetAddVolumeStatusInfo> statusTask = new CommonQueryTask<GetAddVolumeStatusInfo>(database.getServer().getServerInfo(), CommonSendMsg.getCommonDatabaseSendMsg(), getAddVolumeStatusInfo);
            statusTask.setDbName(database.getLabel());
            TaskExecutor taskExecutor = new CommonTaskExec(com.cubrid.cubridmanager.ui.cubrid.dbspace.Messages.getVolumeInfoTaskName);
            taskExecutor.addTask(statusTask);
            CommonQueryTask<DbSpaceInfoList> spaceInfoTask = null;
            DatabaseInfo databaseInfo = database.getDatabaseInfo();
            DbSpaceInfoList dbSpaceInfoList = databaseInfo.getDbSpaceInfoList();
            int pageSize = 0;
            if (null == dbSpaceInfoList) {
                dbSpaceInfoList = new DbSpaceInfoList();
                spaceInfoTask = new CommonQueryTask<DbSpaceInfoList>(database.getServer().getServerInfo(), CommonSendMsg.getCommonDatabaseSendMsg(), dbSpaceInfoList);
                spaceInfoTask.setDbName(database.getLabel());
                taskExecutor.addTask(spaceInfoTask);
            }
            new ExecTaskWithProgress(taskExecutor).busyCursorWhile();
            if (spaceInfoTask == null) {
                pageSize = dbSpaceInfoList.getPagesize();
            } else {
                final DbSpaceInfoList model = ((CommonQueryTask<DbSpaceInfoList>) spaceInfoTask).getResultModel();
                pageSize = model.getPagesize();
            }
            getAddVolumeStatusInfo = statusTask.getResultModel();
            //open add volumn dialog
            AddVolumeDialog addVolumeDialog = new AddVolumeDialog(getSite().getShell());
            addVolumeDialog.setGetAddVolumeStatusInfo(getAddVolumeStatusInfo);
            addVolumeDialog.initPara(node);
            addVolumeDialog.setTreeViewer(CubridNavigatorView.getNavigatorView("com.cubrid.cubridmanager.host.navigator").getViewer());
            addVolumeDialog.setPageSize(pageSize);
            int returnCode = addVolumeDialog.open();
            //if add volumn refresh table
            if (returnCode == IDialogConstants.OK_ID) {
                volumnInfoListData.clear();
                loadVolumnsInfo();
                volumnInfoTableViewer.refresh();
            }
        }
    });
    volumnInfoTableViewer.getTable().setMenu(menu);
    tableViewOnBarIndexMap.put(volumnInfoTableViewer, index);
}
Also used : CommonTaskExec(com.cubrid.common.ui.spi.progress.CommonTaskExec) Table(org.eclipse.swt.widgets.Table) Composite(org.eclipse.swt.widgets.Composite) DatabaseInfo(com.cubrid.cubridmanager.core.cubrid.database.model.DatabaseInfo) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) MenuItem(org.eclipse.swt.widgets.MenuItem) FillLayout(org.eclipse.swt.layout.FillLayout) TableLabelProvider(com.cubrid.common.ui.spi.TableLabelProvider) ICubridNode(com.cubrid.common.ui.spi.model.ICubridNode) DefaultSchemaNode(com.cubrid.common.ui.spi.model.DefaultSchemaNode) GetAddVolumeStatusInfo(com.cubrid.cubridmanager.core.cubrid.dbspace.model.GetAddVolumeStatusInfo) TaskExecutor(com.cubrid.common.ui.spi.progress.TaskExecutor) ExpandItem(org.eclipse.swt.widgets.ExpandItem) AddVolumeDialog(com.cubrid.cubridmanager.ui.cubrid.dbspace.dialog.AddVolumeDialog) DbSpaceInfoList(com.cubrid.cubridmanager.core.cubrid.dbspace.model.DbSpaceInfoList) TableContentProvider(com.cubrid.common.ui.spi.TableContentProvider) SelectionEvent(org.eclipse.swt.events.SelectionEvent) ExecTaskWithProgress(com.cubrid.common.ui.spi.progress.ExecTaskWithProgress) CommonQueryTask(com.cubrid.cubridmanager.core.common.task.CommonQueryTask) Menu(org.eclipse.swt.widgets.Menu) TableViewer(org.eclipse.jface.viewers.TableViewer) TableViewerColumn(org.eclipse.jface.viewers.TableViewerColumn)

Example 32 with TableViewerColumn

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

the class DatabaseDashboardEditor method createDatabaseComposite.

/**
	 * create database information composite
	 *
	 * @param bar ExpandBar
	 * @param bar index
	 */
public void createDatabaseComposite(ExpandBar bar, int index) {
    ExpandItem dbInfoItem = new ExpandItem(bar, SWT.NONE, index);
    dbInfoItem.setText(Messages.exportDashboardDBTableTitle);
    Composite dbComposite = new Composite(bar, SWT.None);
    dbComposite.setLayout(new FillLayout());
    dbInfoTableViewer = new TableViewer(dbComposite, SWT.BORDER | SWT.FULL_SELECTION);
    GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
    gridData.heightHint = 16;
    dbInfoTableViewer.getTable().setLayoutData(gridData);
    dbInfoTableViewer.getTable().setHeaderVisible(true);
    dbInfoTableViewer.getTable().setLinesVisible(false);
    final TableViewerColumn columnCPU = new TableViewerColumn(dbInfoTableViewer, SWT.CENTER);
    columnCPU.getColumn().setWidth(60);
    columnCPU.getColumn().setText("CPU");
    columnCPU.getColumn().setToolTipText("CPU");
    final TableViewerColumn columnMemory = new TableViewerColumn(dbInfoTableViewer, SWT.CENTER);
    columnMemory.getColumn().setWidth(120);
    columnMemory.getColumn().setText(com.cubrid.cubridmanager.ui.monitoring.Messages.dbSysMemInfoGroupName);
    columnMemory.getColumn().setToolTipText(com.cubrid.cubridmanager.ui.monitoring.Messages.dbSysMemInfoGroupName);
    final TableViewerColumn columnQPS = new TableViewerColumn(dbInfoTableViewer, SWT.CENTER);
    columnQPS.getColumn().setWidth(80);
    columnQPS.getColumn().setText("QPS");
    columnQPS.getColumn().setToolTipText(com.cubrid.cubridmanager.ui.host.Messages.tipQps);
    final TableViewerColumn columnHitRatio = new TableViewerColumn(dbInfoTableViewer, SWT.CENTER);
    columnHitRatio.getColumn().setWidth(80);
    columnHitRatio.getColumn().setText("Hit Ratio");
    columnHitRatio.getColumn().setToolTipText(Messages.databaseTableHitRatioColumnLabel);
    final TableViewerColumn columnIo1 = new TableViewerColumn(dbInfoTableViewer, SWT.CENTER);
    columnIo1.getColumn().setWidth(100);
    columnIo1.getColumn().setText("Fetch pages");
    columnIo1.getColumn().setToolTipText("num_data_page_fetches");
    final TableViewerColumn columnIo2 = new TableViewerColumn(dbInfoTableViewer, SWT.CENTER);
    columnIo2.getColumn().setWidth(100);
    columnIo2.getColumn().setText("Dirty pages");
    columnIo2.getColumn().setToolTipText("num_data_page_dirties");
    final TableViewerColumn columnIo3 = new TableViewerColumn(dbInfoTableViewer, SWT.CENTER);
    columnIo3.getColumn().setWidth(100);
    columnIo3.getColumn().setText("I/O Reads");
    columnIo3.getColumn().setToolTipText("num_data_page_ioreads");
    final TableViewerColumn columnIo4 = new TableViewerColumn(dbInfoTableViewer, SWT.CENTER);
    columnIo4.getColumn().setWidth(100);
    columnIo4.getColumn().setText("I/O Writes");
    columnIo4.getColumn().setToolTipText("num_data_page_iowrites");
    dbInfoTableViewer.setContentProvider(new TableContentProvider());
    dbInfoTableViewer.setLabelProvider(new TableLabelProvider());
    dbInfoTableViewer.setInput(dbInfoListData);
    dbInfoItem.setControl(dbComposite);
    dbInfoItem.setHeight(80);
    dbInfoItem.setExpanded(true);
    tableViewOnBarIndexMap.put(dbInfoTableViewer, index);
}
Also used : Composite(org.eclipse.swt.widgets.Composite) ExpandItem(org.eclipse.swt.widgets.ExpandItem) GridData(org.eclipse.swt.layout.GridData) TableContentProvider(com.cubrid.common.ui.spi.TableContentProvider) FillLayout(org.eclipse.swt.layout.FillLayout) TableLabelProvider(com.cubrid.common.ui.spi.TableLabelProvider) TableViewer(org.eclipse.jface.viewers.TableViewer) TableViewerColumn(org.eclipse.jface.viewers.TableViewerColumn)

Example 33 with TableViewerColumn

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

the class UnifyHostConfigEditor method createBrokerConfTableData.

/**
	 * create table data by CubridBrokerConf model
	 */
public void createBrokerConfTableData() {
    //remove column
    int oldCount = brokerConfTabTableViewer.getTable().getColumnCount();
    for (int i = 0; i < oldCount; i++) {
        brokerConfTabTableViewer.getTable().getColumn(0).dispose();
    }
    //create column
    TableViewerColumn column = new TableViewerColumn(brokerConfTabTableViewer, SWT.LEFT);
    column.getColumn().setWidth(150);
    column.getColumn().setText(Messages.unifyHostConfTableColumnPropName);
    column.setEditingSupport(new PropValueEditingSupport(brokerConfTabTableViewer, 0));
    int columnIndex = 0;
    for (Entry<String, BrokerConfig> entry : cubridBrokerConfigDataMap.entrySet()) {
        BrokerConfig cubridBrokerConfig = entry.getValue();
        for (int i = 0; i < cubridBrokerConfig.getPropertyList().size(); i++) {
            TableViewerColumn propColumn = new TableViewerColumn(brokerConfTabTableViewer, SWT.LEFT);
            propColumn.getColumn().setWidth(160);
            propColumn.getColumn().setText(Messages.unifyHostBrokerConfTableTitle + columnIndex);
            propColumn.setEditingSupport(new PropValueEditingSupport(brokerConfTabTableViewer, columnIndex + 1));
            propColumn.getColumn().addSelectionListener(new SelectionAdapter() {

                @SuppressWarnings("all")
                public void widgetSelected(SelectionEvent event) {
                }
            });
            //if broker name is [broker] can't edit and don't display
            //				CubridBrokerProperty brokerProperty = cubridBrokerConfig.getPropertyList().get(i);
            //				if (brokerProperty.getCubridBrokerPropKey().equals("[broker]")) {
            //					propColumn.getColumn().setWidth(0);
            //				}
            columnIndex++;
        }
    }
    brokerConfTabTableViewer.setLabelProvider(new UnifyHostCubridBrokerTableLabelProvider());
    brokerConfTabTableViewer.setInput(cubridBrokerConfListData);
    cubridBrokerConfListData.clear();
    cubridBrokerConfListData.addAll(unifyHostConfigUtil.parseCubridBrokerConfigToCommonTableValue(cubridBrokerConfigDataMap));
    brokerConfTabTableViewer.refresh();
}
Also used : BrokerConfig(com.cubrid.common.ui.spi.model.BrokerConfig) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) SelectionEvent(org.eclipse.swt.events.SelectionEvent) Point(org.eclipse.swt.graphics.Point) TableViewerColumn(org.eclipse.jface.viewers.TableViewerColumn)

Example 34 with TableViewerColumn

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

the class UnifyHostConfigEditor method createCubridCMConfTableData.

/**
	 * create table data by cubridCMConfConfig model
	 */
public void createCubridCMConfTableData() {
    //remove column
    int oldCount = cubridCMConfTabTableViewer.getTable().getColumnCount();
    for (int i = 0; i < oldCount; i++) {
        cubridCMConfTabTableViewer.getTable().getColumn(0).dispose();
    }
    //create column
    TableViewerColumn column = new TableViewerColumn(cubridCMConfTabTableViewer, SWT.LEFT);
    column.getColumn().setWidth(175);
    column.getColumn().setText(Messages.unifyHostConfTableColumnPropName);
    column.setEditingSupport(new PropValueEditingSupport(cubridCMConfTabTableViewer, 0));
    int columnIndex = 0;
    for (int i = 0; i < cubridConfCMConfigDataMap.size(); i++) {
        TableViewerColumn propColumn = new TableViewerColumn(cubridCMConfTabTableViewer, SWT.LEFT);
        propColumn.getColumn().setWidth(130);
        propColumn.getColumn().setText(Messages.unifyHostCubridConfTableTitle + columnIndex);
        propColumn.setEditingSupport(new PropValueEditingSupport(cubridCMConfTabTableViewer, columnIndex + 1));
        propColumn.getColumn().addSelectionListener(new SelectionAdapter() {

            @SuppressWarnings("all")
            public void widgetSelected(SelectionEvent event) {
            }
        });
        columnIndex++;
    }
    cubridCMConfTabTableViewer.setLabelProvider(new UnifyHostCubridCMConfTableLabelProvider());
    cubridCMConfTabTableViewer.setInput(cubridConfCMConfigListData);
    cubridConfCMConfigListData.clear();
    cubridConfCMConfigListData.addAll(unifyHostConfigUtil.parseCubridCMConfConfigToCommonTableValue(cubridConfCMConfigDataMap));
    cubridCMConfTabTableViewer.refresh();
}
Also used : SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) SelectionEvent(org.eclipse.swt.events.SelectionEvent) Point(org.eclipse.swt.graphics.Point) TableViewerColumn(org.eclipse.jface.viewers.TableViewerColumn)

Example 35 with TableViewerColumn

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

the class UnifyHostConfigEditor method createBrokerConfTabItem.

/**
	 * create broker conf table
	 */
public void createBrokerConfTabItem() {
    Composite comp = new Composite(confTabFolder, SWT.NONE);
    comp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    comp.setLayout(new GridLayout(1, false));
    brokerConfTableCTabItem = new CTabItem(confTabFolder, SWT.NONE);
    brokerConfTableCTabItem.setText(BROKERCONFCONFIGFILENAME);
    brokerConfTabTableViewer = new TableViewer(comp, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION);
    brokerConfTabTableViewer.getTable().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    brokerConfTabTableViewer.getTable().setHeaderVisible(true);
    brokerConfTabTableViewer.getTable().setLinesVisible(true);
    brokerConfTabTableViewer.setUseHashlookup(true);
    //create column
    TableViewerColumn column = new TableViewerColumn(brokerConfTabTableViewer, SWT.LEFT);
    column.getColumn().setWidth(0);
    column.getColumn().setText("");
    brokerConfTabTableViewer.setContentProvider(new UnifyHostCubridBrokerTableContentProvider());
    brokerConfTabTableViewer.setLabelProvider(new UnifyHostCubridBrokerTableLabelProvider());
    brokerConfTabTableViewer.setSorter(new BrokerConfTableViewerSorter());
    //use to mark click point, the right click menu use this point
    brokerConfTabTableViewer.getTable().addListener(SWT.MouseDown, new Listener() {

        public void handleEvent(Event event) {
            cubridBrokerTableClickPoint = new Point(event.x, event.y);
            cubridBrokerTableClickPointTiming = System.currentTimeMillis();
        }
    });
    registerCubridBrokerTableContextMenu();
    brokerConfTableCTabItem.setControl(comp);
    if (confTabFolder.getSelection() == null) {
        confTabFolder.setSelection(brokerConfTableCTabItem);
    }
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) ICellEditorListener(org.eclipse.jface.viewers.ICellEditorListener) Listener(org.eclipse.swt.widgets.Listener) Composite(org.eclipse.swt.widgets.Composite) GridData(org.eclipse.swt.layout.GridData) FocusEvent(org.eclipse.swt.events.FocusEvent) MenuEvent(org.eclipse.swt.events.MenuEvent) CubridNodeChangedEvent(com.cubrid.common.ui.spi.event.CubridNodeChangedEvent) Event(org.eclipse.swt.widgets.Event) SelectionEvent(org.eclipse.swt.events.SelectionEvent) Point(org.eclipse.swt.graphics.Point) CTabItem(org.eclipse.swt.custom.CTabItem) 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