Search in sources :

Example 1 with BrokerEnvStatusColumn

use of com.cubrid.cubridmanager.ui.broker.editor.internal.BrokerEnvStatusColumn in project cubrid-manager by CUBRID.

the class BrokerEnvStatusView method createTable.

/**
	 * This method initializes table
	 *
	 */
private void createTable() {
    tableViewer = new TableViewer(composite, SWT.FULL_SELECTION);
    tableViewer.getTable().setHeaderVisible(true);
    tableViewer.getTable().setLinesVisible(true);
    BrokerTblColumnSetHelp bcsh = BrokerTblColumnSetHelp.getInstance();
    bcsh.loadSetting(BrokerTblColumnSetHelp.StatusColumn.BrokerEnvStatusColumn, BrokerEnvStatusColumn.values());
    TableLayout tlayout = new TableLayout();
    for (BrokerEnvStatusColumn column : BrokerEnvStatusColumn.values()) {
        if (column.getValue() == -1) {
            tlayout.addColumnData(new ColumnWeightData(0, 0, false));
        } else {
            tlayout.addColumnData(new ColumnWeightData(10, 40, true));
        }
    }
    tableViewer.getTable().setLayout(tlayout);
    tableViewer.getTable().addMouseListener(new MouseAdapter() {

        public void mouseDoubleClick(MouseEvent event) {
            int index = -1;
            if ((index = tableViewer.getTable().getSelectionIndex()) >= 0) {
                TableItem tableItem = tableViewer.getTable().getItem(index);
                String brokename = tableItem.getText(0).trim();
                ICubridNode input = null;
                for (ICubridNode node : cubridNode.getChildren()) {
                    if (node.getLabel().equalsIgnoreCase(brokename)) {
                        input = node;
                        break;
                    }
                }
                LayoutManager.getInstance().setCurrentSelectedNode(input);
                IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
                if (null == window) {
                    return;
                }
                IWorkbenchPage activePage = window.getActivePage();
                IViewPart viewPart = window.getActivePage().findView(BrokerStatusView.ID);
                if (null != viewPart) {
                    activePage.hideView(viewPart);
                }
                try {
                    activePage.showView(BrokerStatusView.ID);
                } catch (PartInitException e1) {
                    LOGGER.error(e1.getMessage(), e1);
                }
            }
        }
    });
    makeTableColumn();
    tableViewer.setContentProvider(new BrokersStatusContentProvider());
    ServerInfo serverInfo = cubridNode.getServer().getServerInfo();
    BrokersStatusLabelProvider brokersStatusLabelProvider = new BrokersStatusLabelProvider();
    brokersStatusLabelProvider.setServerInfo(serverInfo);
    tableViewer.setLabelProvider(brokersStatusLabelProvider);
}
Also used : ColumnWeightData(org.eclipse.jface.viewers.ColumnWeightData) IWorkbenchWindow(org.eclipse.ui.IWorkbenchWindow) IViewPart(org.eclipse.ui.IViewPart) MouseEvent(org.eclipse.swt.events.MouseEvent) ServerInfo(com.cubrid.cubridmanager.core.common.model.ServerInfo) TableItem(org.eclipse.swt.widgets.TableItem) MouseAdapter(org.eclipse.swt.events.MouseAdapter) ICubridNode(com.cubrid.common.ui.spi.model.ICubridNode) BrokerEnvStatusColumn(com.cubrid.cubridmanager.ui.broker.editor.internal.BrokerEnvStatusColumn) BrokerTblColumnSetHelp(com.cubrid.cubridmanager.ui.broker.editor.internal.BrokerTblColumnSetHelp) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) PartInitException(org.eclipse.ui.PartInitException) TableViewer(org.eclipse.jface.viewers.TableViewer) TableLayout(org.eclipse.jface.viewers.TableLayout)

Example 2 with BrokerEnvStatusColumn

use of com.cubrid.cubridmanager.ui.broker.editor.internal.BrokerEnvStatusColumn in project cubrid-manager by CUBRID.

the class BrokerEnvStatusView method updateTableLayout.

/**
	 * Update table layout
	 */
private void updateTableLayout() {
    TableLayout tlayout = new TableLayout();
    for (BrokerEnvStatusColumn column : BrokerEnvStatusColumn.values()) {
        if (column.getValue() == -1) {
            tlayout.addColumnData(new ColumnWeightData(0, 0, false));
        } else {
            tlayout.addColumnData(new ColumnWeightData(10, 40, true));
        }
    }
    tableViewer.getTable().setLayout(tlayout);
    tableViewer.getTable().layout(true);
}
Also used : ColumnWeightData(org.eclipse.jface.viewers.ColumnWeightData) TableLayout(org.eclipse.jface.viewers.TableLayout) BrokerEnvStatusColumn(com.cubrid.cubridmanager.ui.broker.editor.internal.BrokerEnvStatusColumn)

Example 3 with BrokerEnvStatusColumn

use of com.cubrid.cubridmanager.ui.broker.editor.internal.BrokerEnvStatusColumn in project cubrid-manager by CUBRID.

the class BrokerEnvStatusView method makeActions.

/**
	 * This method is to create actions at tool bar
	 *
	 */
private void makeActions() {
    Action columnAction = new Action() {

        public void run() {
            BrokerEnvStatusSettingDlg settingDlg = new BrokerEnvStatusSettingDlg(null);
            if (settingDlg.open() == Dialog.OK) {
                TableLayout tlayout = new TableLayout();
                for (BrokerEnvStatusColumn column : BrokerEnvStatusColumn.values()) {
                    if (column.getValue() == -1) {
                        tlayout.addColumnData(new ColumnWeightData(0, 0, false));
                    } else {
                        tlayout.addColumnData(new ColumnWeightData(10, 40, true));
                    }
                }
                tableViewer.getTable().setLayout(tlayout);
                tableViewer.getTable().layout();
            }
        }
    };
    columnAction.setText(Messages.envColumnSettingTxt);
    columnAction.setImageDescriptor(CubridManagerUIPlugin.getImageDescriptor("icons/action/setting-small.png"));
    IActionBars bars = getViewSite().getActionBars();
    IToolBarManager manager = bars.getToolBarManager();
    manager.add(columnAction);
}
Also used : ColumnWeightData(org.eclipse.jface.viewers.ColumnWeightData) Action(org.eclipse.jface.action.Action) IToolBarManager(org.eclipse.jface.action.IToolBarManager) BrokerEnvStatusSettingDlg(com.cubrid.cubridmanager.ui.broker.editor.internal.BrokerEnvStatusSettingDlg) TableLayout(org.eclipse.jface.viewers.TableLayout) BrokerEnvStatusColumn(com.cubrid.cubridmanager.ui.broker.editor.internal.BrokerEnvStatusColumn) IActionBars(org.eclipse.ui.IActionBars)

Example 4 with BrokerEnvStatusColumn

use of com.cubrid.cubridmanager.ui.broker.editor.internal.BrokerEnvStatusColumn in project cubrid-manager by CUBRID.

the class ShardEnvStatusView method updateTableLayout.

/**
	 * Update table layout
	 */
private void updateTableLayout() {
    TableLayout tlayout = new TableLayout();
    for (BrokerEnvStatusColumn column : BrokerEnvStatusColumn.values()) {
        if (column.getValue() == -1) {
            tlayout.addColumnData(new ColumnWeightData(0, 0, false));
        } else {
            tlayout.addColumnData(new ColumnWeightData(10, 40, true));
        }
    }
    tableViewer.getTable().setLayout(tlayout);
    tableViewer.getTable().layout(true);
}
Also used : ColumnWeightData(org.eclipse.jface.viewers.ColumnWeightData) TableLayout(org.eclipse.jface.viewers.TableLayout) BrokerEnvStatusColumn(com.cubrid.cubridmanager.ui.broker.editor.internal.BrokerEnvStatusColumn)

Aggregations

BrokerEnvStatusColumn (com.cubrid.cubridmanager.ui.broker.editor.internal.BrokerEnvStatusColumn)4 ColumnWeightData (org.eclipse.jface.viewers.ColumnWeightData)4 TableLayout (org.eclipse.jface.viewers.TableLayout)4 ICubridNode (com.cubrid.common.ui.spi.model.ICubridNode)1 ServerInfo (com.cubrid.cubridmanager.core.common.model.ServerInfo)1 BrokerEnvStatusSettingDlg (com.cubrid.cubridmanager.ui.broker.editor.internal.BrokerEnvStatusSettingDlg)1 BrokerTblColumnSetHelp (com.cubrid.cubridmanager.ui.broker.editor.internal.BrokerTblColumnSetHelp)1 Action (org.eclipse.jface.action.Action)1 IToolBarManager (org.eclipse.jface.action.IToolBarManager)1 TableViewer (org.eclipse.jface.viewers.TableViewer)1 MouseAdapter (org.eclipse.swt.events.MouseAdapter)1 MouseEvent (org.eclipse.swt.events.MouseEvent)1 TableItem (org.eclipse.swt.widgets.TableItem)1 IActionBars (org.eclipse.ui.IActionBars)1 IViewPart (org.eclipse.ui.IViewPart)1 IWorkbenchPage (org.eclipse.ui.IWorkbenchPage)1 IWorkbenchWindow (org.eclipse.ui.IWorkbenchWindow)1 PartInitException (org.eclipse.ui.PartInitException)1