Search in sources :

Example 1 with ExportDashboardDialog

use of com.cubrid.cubridmanager.ui.cubrid.database.dialog.ExportDashboardDialog in project cubrid-manager by CUBRID.

the class DatabaseDashboardEditor method createButtonComposite.

/**
	 * create button composite
	 *
	 * @param parent
	 */
public void createButtonComposite(Composite parent) {
    GridLayout layout = new GridLayout(2, false);
    layout.marginHeight = 0;
    parent.setLayout(layout);
    Composite composite = new Composite(parent, SWT.None);
    layout.marginHeight = 0;
    composite.setLayout(new GridLayout(3, false));
    composite.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 1, 1, -1, -1));
    infoLable = new Label(composite, SWT.None);
    infoLable.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
    infoLable.setText(getPartName());
    new Label(composite, SWT.None).setText("    ");
    errMsgLable = new Label(composite, SWT.None);
    errMsgLable.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 1, 1, -1, -1));
    ToolBar toolbar = new ToolBar(parent, SWT.RIGHT_TO_LEFT | SWT.WRAP | SWT.FLAT);
    toolbar.setLayoutData(CommonUITool.createGridData(GridData.HORIZONTAL_ALIGN_END, 1, 1, -1, -1));
    settingItem = new ToolItem(toolbar, SWT.PUSH);
    settingItem.setImage(CommonUIPlugin.getImage("/icons/action/settings.png"));
    settingItem.setToolTipText(Messages.databaseDashboardSettingTooltip);
    settingItem.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            boolean useOrNot = GeneralPreference.isUseDatabaseDashboard();
            ShowDashboardDialog dialog = new ShowDashboardDialog(getSite().getShell(), ShowDashboardDialog.TYPE_DB, useOrNot, autoRefreshTime);
            if (dialog.open() == IDialogConstants.OK_ID) {
                autoRefreshTime = dialog.getAutoRefreshSecond();
                useOrNot = dialog.isUseAutoShow();
                GeneralPreference.setUseDatabaseDashboard(useOrNot);
            }
        }
    });
    exportItem = new ToolItem(toolbar, SWT.PUSH);
    exportItem.setImage(CubridManagerUIPlugin.getImage("icons/action/conf_export.png"));
    exportItem.setToolTipText(Messages.databaseDashboardSettingTooltip);
    exportItem.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            List<Table> exportTableList = new ArrayList<Table>();
            if (CompatibleUtil.isSupportGetCPUAndMemoryInfo(database.getDatabaseInfo())) {
                exportTableList.add(dbInfoTableViewer.getTable());
            }
            exportTableList.add(volumnInfoTableViewer.getTable());
            exportTableList.add(brokerInfoTableViewer.getTable());
            exportTableList.add(lockAndTransactionTable);
            String[] excelSheetNames = { Messages.exportDashboardDBTableTitle, Messages.exportDashboardVolumnTableTitle, Messages.exportDashboardBrokerTableTitle, Messages.exportDashboardLockTableTitle };
            new ExportDashboardDialog(Display.getCurrent().getActiveShell(), exportTableList, database.getDatabaseInfo().getDbName(), excelSheetNames).open();
        }
    });
    new ToolItem(toolbar, SWT.SEPARATOR | SWT.VERTICAL);
    autoRefreshItem = new ToolItem(toolbar, SWT.PUSH);
    autoRefreshItem.setImage(CubridManagerUIPlugin.getImage("icons/action/refresh_disabled.png"));
    autoRefreshItem.setToolTipText(Messages.databaseDashboardStartAutoRefreshTooltip);
    autoRefreshItem.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            if (autoRefreshData) {
                autoRefreshItem.setImage(CubridManagerUIPlugin.getImage("icons/action/refresh_disabled.png"));
                autoRefreshItem.setToolTipText(Messages.databaseDashboardStartAutoRefreshTooltip);
                stopAutoRefreshData();
            } else {
                autoRefreshItem.setImage(CubridManagerUIPlugin.getImage("icons/action/refresh.png"));
                autoRefreshItem.setToolTipText(Messages.databaseDashboardStopAutoRefreshTooltip);
                startAutoRefreshData();
            }
            autoRefreshData = !autoRefreshData;
        }
    });
}
Also used : Table(org.eclipse.swt.widgets.Table) Composite(org.eclipse.swt.widgets.Composite) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Label(org.eclipse.swt.widgets.Label) ShowDashboardDialog(com.cubrid.common.ui.common.preference.ShowDashboardDialog) GridLayout(org.eclipse.swt.layout.GridLayout) ExportDashboardDialog(com.cubrid.cubridmanager.ui.cubrid.database.dialog.ExportDashboardDialog) GridData(org.eclipse.swt.layout.GridData) ToolBar(org.eclipse.swt.widgets.ToolBar) SelectionEvent(org.eclipse.swt.events.SelectionEvent) BrokerInfoList(com.cubrid.cubridmanager.core.broker.model.BrokerInfoList) ArrayList(java.util.ArrayList) DbSpaceInfoList(com.cubrid.cubridmanager.core.cubrid.dbspace.model.DbSpaceInfoList) List(java.util.List) DbTransactionList(com.cubrid.cubridmanager.core.cubrid.database.model.transaction.DbTransactionList) ToolItem(org.eclipse.swt.widgets.ToolItem)

Aggregations

ShowDashboardDialog (com.cubrid.common.ui.common.preference.ShowDashboardDialog)1 BrokerInfoList (com.cubrid.cubridmanager.core.broker.model.BrokerInfoList)1 DbTransactionList (com.cubrid.cubridmanager.core.cubrid.database.model.transaction.DbTransactionList)1 DbSpaceInfoList (com.cubrid.cubridmanager.core.cubrid.dbspace.model.DbSpaceInfoList)1 ExportDashboardDialog (com.cubrid.cubridmanager.ui.cubrid.database.dialog.ExportDashboardDialog)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)1 SelectionEvent (org.eclipse.swt.events.SelectionEvent)1 GridData (org.eclipse.swt.layout.GridData)1 GridLayout (org.eclipse.swt.layout.GridLayout)1 Composite (org.eclipse.swt.widgets.Composite)1 Label (org.eclipse.swt.widgets.Label)1 Table (org.eclipse.swt.widgets.Table)1 ToolBar (org.eclipse.swt.widgets.ToolBar)1 ToolItem (org.eclipse.swt.widgets.ToolItem)1