Search in sources :

Example 1 with ExpandItem

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

the class DatabaseDashboardEditor method createBrokerComposite.

/**
	 * craete broker composite
	 *
	 * @param bar
	 * @param bar index
	 *
	 */
public void createBrokerComposite(ExpandBar bar, int index) {
    ExpandItem brokerItem = new ExpandItem(bar, SWT.NONE, index);
    brokerItem.setText(Messages.exportDashboardBrokerTableTitle);
    Composite brokerComposite = new Composite(bar, SWT.None);
    brokerComposite.setLayout(new FillLayout());
    brokerInfoTableViewer = new TableViewer(brokerComposite, SWT.BORDER | SWT.FULL_SELECTION);
    brokerInfoTable = brokerInfoTableViewer.getTable();
    brokerInfoTable.setHeaderVisible(true);
    brokerInfoTable.setLinesVisible(true);
    final TableViewerColumn columnVolumn = new TableViewerColumn(brokerInfoTableViewer, SWT.CENTER);
    columnVolumn.getColumn().setWidth(100);
    columnVolumn.getColumn().setText("Broker");
    columnVolumn.getColumn().setToolTipText(com.cubrid.cubridmanager.ui.host.Messages.tipBrokerName);
    final TableViewerColumn columnType = new TableViewerColumn(brokerInfoTableViewer, SWT.CENTER);
    columnType.getColumn().setWidth(80);
    columnType.getColumn().setText("ID");
    columnType.getColumn().setToolTipText(Messages.brokerTableIDColumnTip);
    final TableViewerColumn columnSize = new TableViewerColumn(brokerInfoTableViewer, SWT.CENTER);
    columnSize.getColumn().setWidth(100);
    columnSize.getColumn().setText("PID");
    columnSize.getColumn().setToolTipText(Messages.brokerTablePIDColumnTip);
    final TableViewerColumn columnQPS = new TableViewerColumn(brokerInfoTableViewer, SWT.CENTER);
    columnQPS.getColumn().setWidth(100);
    columnQPS.getColumn().setText("QPS");
    columnQPS.getColumn().setToolTipText(com.cubrid.cubridmanager.ui.host.Messages.tipQps);
    final TableViewerColumn columnFreeSize = new TableViewerColumn(brokerInfoTableViewer, SWT.CENTER);
    columnFreeSize.getColumn().setWidth(100);
    columnFreeSize.getColumn().setText("LQS");
    columnFreeSize.getColumn().setToolTipText(Messages.brokerTableLQSColumnTip);
    final TableViewerColumn columnTotalSize = new TableViewerColumn(brokerInfoTableViewer, SWT.CENTER);
    columnTotalSize.getColumn().setWidth(80);
    columnTotalSize.getColumn().setText(Messages.multiDatabaseLoginDialogColumnStatus);
    columnTotalSize.getColumn().setToolTipText(Messages.multiDatabaseLoginDialogColumnStatus);
    final TableViewerColumn columnLocation = new TableViewerColumn(brokerInfoTableViewer, SWT.CENTER);
    columnLocation.getColumn().setWidth(140);
    columnLocation.getColumn().setText(Messages.brokerTableLastConnectTimeColumnLabel);
    columnLocation.getColumn().setToolTipText(Messages.brokerTableLastConnectTimeColumnLabel);
    brokerInfoTableViewer.setContentProvider(new TableContentProvider());
    brokerInfoTableViewer.setLabelProvider(new TableLabelProvider());
    brokerInfoTableViewer.setInput(brokerInfoListData);
    brokerItem.setControl(brokerComposite);
    brokerItem.setHeight(140);
    brokerItem.setExpanded(true);
    Menu menu = new Menu(this.getSite().getShell(), SWT.POP_UP);
    final MenuItem itemRestartCAS = new MenuItem(menu, SWT.PUSH);
    itemRestartCAS.setText(Messages.exportDashboardMenuRestartServer);
    itemRestartCAS.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            int i = brokerInfoTable.getSelectionIndex();
            if (i < 0) {
                return;
            }
            String brokerName = brokerInfoTable.getItem(i).getText(0);
            String serverId = brokerInfoTable.getItem(i).getText(1);
            if (!CommonUITool.openConfirmBox(Messages.bind(com.cubrid.cubridmanager.ui.broker.Messages.restartBrokerServerMsg, serverId))) {
                return;
            }
            ServerInfo serverInfo = database.getServer().getServerInfo();
            RestartBrokerTask restartTask = new RestartBrokerTask(serverInfo);
            restartTask.setBrokerName(brokerName);
            restartTask.setApplyServerNum(serverId);
            TaskExecutor taskExecutor = new CommonTaskExec(Messages.bind(com.cubrid.cubridmanager.ui.broker.Messages.restartBrokerServerTaskName, serverId));
            taskExecutor.addTask(restartTask);
            new ExecTaskWithProgress(taskExecutor).exec();
            if (taskExecutor.isSuccess()) {
                // refresh
                brokerInfoListData.clear();
                asinfoLst.clear();
                brokerInfoTable.remove(i);
                loadBrokerInfo();
                //recompute database's qps
                long qps = 0;
                for (HashMap<String, ApplyServerInfo> brokerValueMap : asinfoLst) {
                    for (Entry<String, ApplyServerInfo> entry : brokerValueMap.entrySet()) {
                        ApplyServerInfo applyServerInfo = entry.getValue();
                        qps += Long.valueOf(applyServerInfo.getAs_num_query());
                    }
                }
                Map<String, String> dbInfoMap = brokerInfoListData.get(0);
                dbInfoMap.put("2", Long.toString(qps));
                if (CompatibleUtil.isSupportGetCPUAndMemoryInfo(database.getDatabaseInfo())) {
                    dbInfoTableViewer.refresh();
                }
                brokerInfoTableViewer.refresh();
            }
        }
    });
    final MenuItem itemShowSqlLog = new MenuItem(menu, SWT.PUSH);
    itemShowSqlLog.setText(Messages.exportDashboardMenuShowSQLLog);
    itemShowSqlLog.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            showLogView("sql");
        }
    });
    final MenuItem itemShowSlowQueryLog = new MenuItem(menu, SWT.PUSH);
    itemShowSlowQueryLog.setText(Messages.exportDashboardMenuShowSlowQueryLog);
    itemShowSlowQueryLog.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            showLogView("slow");
        }
    });
    menu.addMenuListener(new MenuListener() {

        public void menuHidden(MenuEvent e) {
        }

        public void menuShown(MenuEvent e) {
            int i = brokerInfoTable.getSelectionIndex();
            if (i < 0) {
                Menu menu = (Menu) e.getSource();
                menu.setVisible(false);
            }
        }
    });
    brokerInfoTable.setMenu(menu);
    tableViewOnBarIndexMap.put(brokerInfoTableViewer, index);
}
Also used : CommonTaskExec(com.cubrid.common.ui.spi.progress.CommonTaskExec) Composite(org.eclipse.swt.widgets.Composite) HashMap(java.util.HashMap) ApplyServerInfo(com.cubrid.cubridmanager.core.broker.model.ApplyServerInfo) ServerInfo(com.cubrid.cubridmanager.core.common.model.ServerInfo) MenuListener(org.eclipse.swt.events.MenuListener) 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) ApplyServerInfo(com.cubrid.cubridmanager.core.broker.model.ApplyServerInfo) TaskExecutor(com.cubrid.common.ui.spi.progress.TaskExecutor) DbLotEntry(com.cubrid.cubridmanager.core.cubrid.database.model.lock.DbLotEntry) Entry(java.util.Map.Entry) ExpandItem(org.eclipse.swt.widgets.ExpandItem) TableContentProvider(com.cubrid.common.ui.spi.TableContentProvider) SelectionEvent(org.eclipse.swt.events.SelectionEvent) RestartBrokerTask(com.cubrid.cubridmanager.core.broker.task.RestartBrokerTask) ExecTaskWithProgress(com.cubrid.common.ui.spi.progress.ExecTaskWithProgress) Menu(org.eclipse.swt.widgets.Menu) TableViewer(org.eclipse.jface.viewers.TableViewer) Map(java.util.Map) TreeMap(java.util.TreeMap) HashMap(java.util.HashMap) TableViewerColumn(org.eclipse.jface.viewers.TableViewerColumn) MenuEvent(org.eclipse.swt.events.MenuEvent)

Example 2 with ExpandItem

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

the class DatabaseDashboardEditor method createLockAndTransactionComposite.

/**
	 * create lock and transaction composite
	 *
	 * @param bar ExpandBar
	 * @param bar index
	 *
	 */
public void createLockAndTransactionComposite(ExpandBar bar, int index) {
    ExpandItem lockAndTransactionItem = new ExpandItem(bar, SWT.NONE, index);
    lockAndTransactionItem.setText(Messages.exportDashboardLockTableTitle);
    Composite lockAndTransactionComposite = new Composite(bar, SWT.NONE);
    lockAndTransactionComposite.setLayout(new FillLayout());
    lockAndTransactionTableViewer = new TableViewer(lockAndTransactionComposite, SWT.BORDER | SWT.FULL_SELECTION);
    lockAndTransactionTable = lockAndTransactionTableViewer.getTable();
    lockAndTransactionTable.setHeaderVisible(true);
    lockAndTransactionTable.setLinesVisible(true);
    final TableViewerColumn columnTranIndex = new TableViewerColumn(lockAndTransactionTableViewer, SWT.CENTER);
    columnTranIndex.getColumn().setWidth(80);
    columnTranIndex.getColumn().setText(Messages.tblColTranInfoTranIndex);
    columnTranIndex.getColumn().setToolTipText(Messages.tblColTranInfoTranIndex);
    final TableViewerColumn columnUserName = new TableViewerColumn(lockAndTransactionTableViewer, SWT.CENTER);
    columnUserName.getColumn().setWidth(80);
    columnUserName.getColumn().setText(Messages.tblColTranInfoUserName);
    columnUserName.getColumn().setToolTipText(Messages.tblColTranInfoUserName);
    final TableViewerColumn columnHost = new TableViewerColumn(lockAndTransactionTableViewer, SWT.CENTER);
    columnHost.getColumn().setWidth(130);
    columnHost.getColumn().setText(Messages.tblColTranInfoHost);
    columnHost.getColumn().setToolTipText(Messages.tblColTranInfoHost);
    final TableViewerColumn columnPid = new TableViewerColumn(lockAndTransactionTableViewer, SWT.CENTER);
    columnPid.getColumn().setWidth(80);
    columnPid.getColumn().setText(Messages.tblColTranInfoProcessId);
    columnPid.getColumn().setToolTipText(Messages.tblColTranInfoProcessId);
    final TableViewerColumn columnType = new TableViewerColumn(lockAndTransactionTableViewer, SWT.BEGINNING);
    columnType.getColumn().setWidth(320);
    columnType.getColumn().setText(Messages.tblColLockInfoObjectType);
    columnType.getColumn().setToolTipText(Messages.tblColLockInfoObjectType);
    columnPid.getColumn().setAlignment(SWT.CENTER);
    final TableViewerColumn columnMode = new TableViewerColumn(lockAndTransactionTableViewer, SWT.CENTER);
    columnMode.getColumn().setWidth(100);
    columnMode.getColumn().setText(Messages.tblColLockInfoMode);
    columnMode.getColumn().setToolTipText(Messages.tblColLockInfoMode);
    lockAndTransactionTableViewer.setContentProvider(new TableContentProvider());
    lockAndTransactionTableViewer.setLabelProvider(new TableLabelProvider());
    lockAndTransactionTableViewer.setInput(lockAndTransactionListData);
    lockAndTransactionItem.setControl(lockAndTransactionComposite);
    lockAndTransactionItem.setHeight(140);
    lockAndTransactionItem.setExpanded(true);
    Menu menu = new Menu(this.getSite().getShell(), SWT.POP_UP);
    final MenuItem itemKillTran = new MenuItem(menu, SWT.PUSH);
    itemKillTran.setText(Messages.menuKillTransaction);
    itemKillTran.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            int i = lockAndTransactionTable.getSelectionIndex();
            if (i < 0) {
                return;
            }
            String pid = lockAndTransactionTable.getItem(i).getText(3);
            if (i >= 0 && dbTransactionList != null && dbTransactionList.getTransationInfo() != null && dbTransactionList.getTransationInfo().getTransactionList() != null) {
                KillTransactionDialog dlg = new KillTransactionDialog(Display.getCurrent().getActiveShell());
                Transaction bean = null;
                for (Transaction t : dbTransactionList.getTransationInfo().getTransactionList()) {
                    if (pid.equals(t.getPid())) {
                        bean = t;
                    }
                }
                dlg.setTransationInfo(bean);
                dlg.setDatabase(database);
                if (dlg.open() == IDialogConstants.CANCEL_ID) {
                    return;
                }
                dbTransactionList.getTransationInfo().setTransactionList(dlg.getKillTransactionList().getTransationInfo().getTransactionList());
                lockAndTransactionListData.clear();
                lockAndTransactionTableViewer.getTable().clearAll();
                loadTransactionInfo();
                lockAndTransactionTableViewer.refresh();
            }
        }
    });
    menu.addMenuListener(new MenuListener() {

        public void menuHidden(MenuEvent e) {
        }

        public void menuShown(MenuEvent e) {
            int i = lockAndTransactionTableViewer.getTable().getSelectionIndex();
            if (i < 0) {
                Menu menu = (Menu) e.getSource();
                menu.setVisible(false);
            }
        }
    });
    lockAndTransactionTable.setMenu(menu);
    tableViewOnBarIndexMap.put(lockAndTransactionTableViewer, index);
}
Also used : Composite(org.eclipse.swt.widgets.Composite) MenuListener(org.eclipse.swt.events.MenuListener) 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) KillTransactionDialog(com.cubrid.cubridmanager.ui.cubrid.database.dialog.KillTransactionDialog) DatabaseTransaction(com.cubrid.cubridmanager.core.cubrid.database.model.lock.DatabaseTransaction) Transaction(com.cubrid.cubridmanager.core.cubrid.database.model.transaction.Transaction) ExpandItem(org.eclipse.swt.widgets.ExpandItem) TableContentProvider(com.cubrid.common.ui.spi.TableContentProvider) SelectionEvent(org.eclipse.swt.events.SelectionEvent) Menu(org.eclipse.swt.widgets.Menu) TableViewer(org.eclipse.jface.viewers.TableViewer) TableViewerColumn(org.eclipse.jface.viewers.TableViewerColumn) MenuEvent(org.eclipse.swt.events.MenuEvent)

Example 3 with ExpandItem

use of org.eclipse.swt.widgets.ExpandItem 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 4 with ExpandItem

use of org.eclipse.swt.widgets.ExpandItem 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 5 with ExpandItem

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

the class DBSpaceLabelProvider method createServerInfoItem.

private void createServerInfoItem(ExpandBar bar, int index) {
    /* Database server information */
    ExpandItem dbServerInfoItem = new ExpandItem(bar, SWT.NONE, index);
    dbServerInfoItem.setText(Messages.titleServerInfo);
    Composite dbServerComposite = new Composite(bar, SWT.None);
    dbServerComposite.setLayout(new FillLayout());
    dbServerInfoText = new StyledText(dbServerComposite, SWT.MULTI);
    dbServerInfoText.setEditable(false);
    dbServerInfoItem.setControl(dbServerComposite);
    dbServerInfoItem.setHeight(110);
    dbServerInfoItem.setExpanded(true);
}
Also used : StyledText(org.eclipse.swt.custom.StyledText) Composite(org.eclipse.swt.widgets.Composite) ExpandItem(org.eclipse.swt.widgets.ExpandItem) FillLayout(org.eclipse.swt.layout.FillLayout)

Aggregations

ExpandItem (org.eclipse.swt.widgets.ExpandItem)18 Composite (org.eclipse.swt.widgets.Composite)12 FillLayout (org.eclipse.swt.layout.FillLayout)10 TableViewer (org.eclipse.jface.viewers.TableViewer)7 TableContentProvider (com.cubrid.common.ui.spi.TableContentProvider)6 ExpandBar (org.eclipse.swt.widgets.ExpandBar)5 TableLabelProvider (com.cubrid.common.ui.spi.TableLabelProvider)4 TableViewerColumn (org.eclipse.jface.viewers.TableViewerColumn)4 Test (org.junit.Test)4 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)3 SelectionEvent (org.eclipse.swt.events.SelectionEvent)3 GridData (org.eclipse.swt.layout.GridData)3 Menu (org.eclipse.swt.widgets.Menu)3 MenuItem (org.eclipse.swt.widgets.MenuItem)3 TableColumn (org.eclipse.swt.widgets.TableColumn)3 CommonTaskExec (com.cubrid.common.ui.spi.progress.CommonTaskExec)2 ExecTaskWithProgress (com.cubrid.common.ui.spi.progress.ExecTaskWithProgress)2 TaskExecutor (com.cubrid.common.ui.spi.progress.TaskExecutor)2 MenuEvent (org.eclipse.swt.events.MenuEvent)2 MenuListener (org.eclipse.swt.events.MenuListener)2