Search in sources :

Example 31 with TableLayout

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

the class BrokerStatusView method createAsTable.

/**
	 * Create app server table
	 * 
	 * @param comp the parent composite
	 * 
	 */
private void createAsTable(Composite comp) {
    Composite asComposite = new Composite(comp, SWT.NONE);
    GridData gdAs = new GridData(SWT.FILL, SWT.FILL, true, true);
    asComposite.setLayoutData(gdAs);
    asComposite.setLayout(new GridLayout());
    asTableViewer = new TableViewer(asComposite, SWT.FULL_SELECTION | SWT.NO_SCROLL | SWT.V_SCROLL | SWT.BORDER);
    Table asTable = asTableViewer.getTable();
    asTable.setHeaderVisible(true);
    asTable.setLinesVisible(true);
    asTable.setLayoutData(gdAs);
    TableLayout asLayout = new TableLayout();
    setAsLayout(asLayout);
    asTable.setLayout(asLayout);
    TableColumn tblColumn = new TableColumn(asTable, SWT.CENTER);
    tblColumn.setText(Messages.tblAsId);
    tblColumn.setToolTipText(Messages.tblAsId);
    tblColumn = new TableColumn(asTable, SWT.CENTER);
    tblColumn.setText(Messages.tblAsProcess);
    tblColumn.setToolTipText(Messages.tblAsProcess);
    tblColumn = new TableColumn(asTable, SWT.CENTER);
    tblColumn.setText(Messages.tblAsQps);
    tblColumn.setToolTipText(Messages.tblAsQps);
    tblColumn = new TableColumn(asTable, SWT.CENTER);
    tblColumn.setText(Messages.tblAsLqs);
    tblColumn.setToolTipText(Messages.tblAsLqs);
    tblColumn = new TableColumn(asTable, SWT.CENTER);
    tblColumn.setText(Messages.tblAsPort);
    tblColumn.setToolTipText(Messages.tblAsPort);
    tblColumn = new TableColumn(asTable, SWT.CENTER);
    tblColumn.setText(Messages.tblAsSize);
    tblColumn.setToolTipText(Messages.tblAsSize);
    tblColumn = new TableColumn(asTable, SWT.CENTER);
    tblColumn.setText(Messages.tblAsStatus);
    tblColumn.setToolTipText(Messages.tblAsStatus);
    tblColumn = new TableColumn(asTable, SWT.CENTER);
    tblColumn.setText(Messages.tblAsDb);
    tblColumn.setToolTipText(Messages.tblAsDb);
    tblColumn = new TableColumn(asTable, SWT.CENTER);
    tblColumn.setText(Messages.tblAsHost);
    tblColumn.setToolTipText(Messages.tblAsHost);
    tblColumn = new TableColumn(asTable, SWT.CENTER);
    tblColumn.setText(Messages.tblAsLastAccess);
    tblColumn.setToolTipText(Messages.tblAsLastAccess);
    tblColumn = new TableColumn(asTable, SWT.CENTER);
    tblColumn.setText(Messages.tblAsLct);
    tblColumn.setToolTipText(Messages.tblAsLct);
    tblColumn = new TableColumn(asTable, SWT.CENTER);
    tblColumn.setText(Messages.tblAsClientIp);
    tblColumn.setToolTipText(Messages.tblAsClientIp);
    tblColumn = new TableColumn(asTable, SWT.CENTER);
    tblColumn.setText(Messages.tblAsCur);
    tblColumn.setToolTipText(Messages.tblAsCur);
    asTableViewer.setContentProvider(new ApplyServerContentProvider());
    asTableViewer.setLabelProvider(new ApplyServerLabelProvider());
    asTableViewer.setInput(asinfoLst);
    MenuManager menuManager = new MenuManager();
    menuManager.setRemoveAllWhenShown(true);
    menuManager.addMenuListener(new IMenuListener() {

        public void menuAboutToShow(IMenuManager manager) {
            IStructuredSelection selection = (IStructuredSelection) asTableViewer.getSelection();
            ApplyServerInfo as = (ApplyServerInfo) (selection.toArray()[0]);
            RestartAction restartAcion = new RestartAction(as.getAs_id());
            manager.add(restartAcion);
        }
    });
    Menu contextMenu = menuManager.createContextMenu(asTableViewer.getControl());
    asTableViewer.getControl().setMenu(contextMenu);
}
Also used : Table(org.eclipse.swt.widgets.Table) Composite(org.eclipse.swt.widgets.Composite) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) TableColumn(org.eclipse.swt.widgets.TableColumn) ApplyServerInfo(com.cubrid.cubridmanager.core.broker.model.ApplyServerInfo) IMenuListener(org.eclipse.jface.action.IMenuListener) GridLayout(org.eclipse.swt.layout.GridLayout) GridData(org.eclipse.swt.layout.GridData) MenuManager(org.eclipse.jface.action.MenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) Menu(org.eclipse.swt.widgets.Menu) TableViewer(org.eclipse.jface.viewers.TableViewer) TableLayout(org.eclipse.jface.viewers.TableLayout)

Example 32 with TableLayout

use of org.eclipse.jface.viewers.TableLayout 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 33 with TableLayout

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

the class BrokerSatusTablePart method createBasicTable.

/**
	 * Create basic info table
	 * 
	 * @param comp the parent composite
	 * @return TableViewer
	 * 
	 */
public TableViewer createBasicTable(Composite comp) {
    final Composite basicComposite = new Composite(comp, SWT.NONE);
    GridData gdBasic = new GridData(SWT.FILL, SWT.NONE, false, false);
    basicComposite.setLayoutData(gdBasic);
    basicComposite.setLayout(new GridLayout());
    TableViewer basicTableViewer = new TableViewer(basicComposite, SWT.NO_SCROLL | SWT.BORDER);
    Table basicTable = basicTableViewer.getTable();
    basicTable.setHeaderVisible(true);
    basicTable.setLinesVisible(true);
    GridData tblBasic = new GridData(SWT.FILL, SWT.TOP, true, false);
    tblBasic.heightHint = CommonUITool.getHeightHintOfTable(basicTable);
    basicTable.setLayoutData(tblBasic);
    TableLayout basicLayout = new TableLayout();
    setBasicLayout(basicLayout);
    basicTable.setLayout(basicLayout);
    basicTable.setBackground(basicComposite.getBackground());
    TableColumn tblColumn = new TableColumn(basicTable, SWT.CENTER);
    tblColumn.setText(Messages.tblBscPid);
    tblColumn.setToolTipText(Messages.tblBscPid);
    tblColumn = new TableColumn(basicTable, SWT.CENTER);
    tblColumn.setText(Messages.tblBscPort);
    tblColumn.setToolTipText(Messages.tblBscPort);
    tblColumn = new TableColumn(basicTable, SWT.CENTER);
    tblColumn.setText(Messages.tblBscJobQueue);
    tblColumn.setToolTipText(Messages.tblBscJobQueue);
    tblColumn = new TableColumn(basicTable, SWT.CENTER);
    tblColumn.setText(Messages.tblBscAutoAddAs);
    tblColumn.setToolTipText(Messages.tblBscAutoAddAs);
    tblColumn = new TableColumn(basicTable, SWT.CENTER);
    tblColumn.setText(Messages.tblBscSqlLogMode);
    tblColumn.setToolTipText(Messages.tblBscSqlLogMode);
    tblColumn = new TableColumn(basicTable, SWT.CENTER);
    tblColumn.setText(Messages.tblBscLongTranTime);
    tblColumn.setToolTipText(Messages.tblBscLongTranTime);
    tblColumn = new TableColumn(basicTable, SWT.CENTER);
    tblColumn.setText(Messages.tblBscLongQueryTime);
    tblColumn.setToolTipText(Messages.tblBscLongQueryTime);
    tblColumn = new TableColumn(basicTable, SWT.CENTER);
    tblColumn.setText(Messages.tblBscSessionTimeout);
    tblColumn.setToolTipText(Messages.tblBscSessionTimeout);
    tblColumn = new TableColumn(basicTable, SWT.CENTER);
    tblColumn.setText(Messages.tblBscKeepConn);
    tblColumn.setToolTipText(Messages.tblBscKeepConn);
    tblColumn = new TableColumn(basicTable, SWT.CENTER);
    tblColumn.setText(Messages.tblBscAccessMode);
    tblColumn.setToolTipText(Messages.tblBscAccessMode);
    if (isAppendDiag) {
        tblColumn = new TableColumn(basicTable, SWT.CENTER);
        tblColumn.setText(Messages.tblBscActiveSession);
        tblColumn.setToolTipText(Messages.tblBscActiveSession);
        tblColumn = new TableColumn(basicTable, SWT.CENTER);
        tblColumn.setText(Messages.tblBscSession);
        tblColumn.setToolTipText(Messages.tblBscSession);
        tblColumn = new TableColumn(basicTable, SWT.CENTER);
        tblColumn.setText(Messages.tblBscTps);
        tblColumn.setToolTipText(Messages.tblBscTps);
    }
    basicTableViewer.setContentProvider(new BrokerBasicInfoContentProvider());
    BrokerBasicInfoLabelProvider basicInfoLabelProvider = new BrokerBasicInfoLabelProvider();
    basicTableViewer.setLabelProvider(basicInfoLabelProvider);
    List<String> basicInfoLst = new ArrayList<String>();
    basicTableViewer.setInput(basicInfoLst);
    return basicTableViewer;
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) Table(org.eclipse.swt.widgets.Table) Composite(org.eclipse.swt.widgets.Composite) BrokerBasicInfoContentProvider(com.cubrid.cubridmanager.ui.mondashboard.editor.BrokerBasicInfoContentProvider) GridData(org.eclipse.swt.layout.GridData) ArrayList(java.util.ArrayList) BrokerBasicInfoLabelProvider(com.cubrid.cubridmanager.ui.mondashboard.editor.BrokerBasicInfoLabelProvider) TableViewer(org.eclipse.jface.viewers.TableViewer) TableLayout(org.eclipse.jface.viewers.TableLayout) TableColumn(org.eclipse.swt.widgets.TableColumn)

Example 34 with TableLayout

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

the class BrokerSatusTablePart method createJobTable.

/**
	 * Create job table composite
	 * 
	 * @param comp the composite
	 * @return TableViewer
	 * 
	 */
public TableViewer createJobTable(Composite comp) {
    Composite jobComposite = new Composite(comp, SWT.NONE);
    GridData gdJob = new GridData(SWT.FILL, SWT.FILL, true, true);
    jobComposite.setLayoutData(gdJob);
    jobComposite.setLayout(new GridLayout());
    final Label label = new Label(jobComposite, SWT.CENTER);
    label.setText(Messages.jobTblTitle);
    TableViewer jqTableViewer = new TableViewer(jobComposite, SWT.FULL_SELECTION | SWT.NO_SCROLL | SWT.V_SCROLL | SWT.BORDER);
    jqTableViewer.getTable().setHeaderVisible(true);
    jqTableViewer.getTable().setLinesVisible(true);
    TableLayout jqLayout = new TableLayout();
    setJqLayout(jqLayout);
    jqTableViewer.getTable().setLayout(jqLayout);
    jqTableViewer.getTable().setLayoutData(gdJob);
    TableColumn tblColumn = new TableColumn(jqTableViewer.getTable(), SWT.CENTER);
    tblColumn.setText(Messages.tblJobId);
    tblColumn.setToolTipText(Messages.tblJobId);
    tblColumn = new TableColumn(jqTableViewer.getTable(), SWT.CENTER);
    tblColumn.setText(Messages.tblJobPriority);
    tblColumn.setToolTipText(Messages.tblJobPriority);
    tblColumn = new TableColumn(jqTableViewer.getTable(), SWT.CENTER);
    tblColumn.setText(Messages.tblJobAddress);
    tblColumn.setToolTipText(Messages.tblJobAddress);
    tblColumn = new TableColumn(jqTableViewer.getTable(), SWT.CENTER);
    tblColumn.setText(Messages.tblJobTime);
    tblColumn.setToolTipText(Messages.tblJobTime);
    tblColumn = new TableColumn(jqTableViewer.getTable(), SWT.CENTER);
    tblColumn.setText(Messages.tblJobRequest);
    tblColumn.setToolTipText(Messages.tblJobRequest);
    jqTableViewer.setContentProvider(new JobContentProvider());
    jqTableViewer.setLabelProvider(new JobLabelProvider());
    jqTableViewer.setInput(jobinfoLst);
    return jqTableViewer;
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) JobLabelProvider(com.cubrid.cubridmanager.ui.broker.editor.JobLabelProvider) GridData(org.eclipse.swt.layout.GridData) Label(org.eclipse.swt.widgets.Label) JobContentProvider(com.cubrid.cubridmanager.ui.broker.editor.JobContentProvider) TableViewer(org.eclipse.jface.viewers.TableViewer) TableLayout(org.eclipse.jface.viewers.TableLayout) TableColumn(org.eclipse.swt.widgets.TableColumn)

Example 35 with TableLayout

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

the class BrokerSatusTablePart method createAsTable.

/**
	 * Create app server table
	 * 
	 * @param comp the parent composite
	 * @return TableViewer
	 * 
	 */
public TableViewer createAsTable(Composite comp) {
    Composite asComposite = new Composite(comp, SWT.NONE);
    GridData gdAs = new GridData(SWT.FILL, SWT.FILL, true, true);
    asComposite.setLayoutData(gdAs);
    asComposite.setLayout(new GridLayout());
    TableViewer asTableViewer = new TableViewer(asComposite, SWT.FULL_SELECTION | SWT.NO_SCROLL | SWT.V_SCROLL | SWT.BORDER);
    Table asTable = asTableViewer.getTable();
    asTable.setHeaderVisible(true);
    asTable.setLinesVisible(true);
    asTable.setLayoutData(gdAs);
    TableLayout asLayout = new TableLayout();
    setAsLayout(asLayout);
    asTable.setLayout(asLayout);
    TableColumn tblColumn = new TableColumn(asTable, SWT.CENTER);
    tblColumn.setText(Messages.tblAsId);
    tblColumn.setToolTipText(Messages.tblAsId);
    tblColumn = new TableColumn(asTable, SWT.CENTER);
    tblColumn.setText(Messages.tblAsProcess);
    tblColumn.setToolTipText(Messages.tblAsProcess);
    tblColumn = new TableColumn(asTable, SWT.CENTER);
    tblColumn.setText(Messages.tblAsQps);
    tblColumn.setToolTipText(Messages.tblAsQps);
    tblColumn = new TableColumn(asTable, SWT.CENTER);
    tblColumn.setText(Messages.tblAsLqs);
    tblColumn.setToolTipText(Messages.tblAsLqs);
    tblColumn = new TableColumn(asTable, SWT.CENTER);
    tblColumn.setText(Messages.tblAsPort);
    tblColumn.setToolTipText(Messages.tblAsPort);
    tblColumn = new TableColumn(asTable, SWT.CENTER);
    tblColumn.setText(Messages.tblAsSize);
    tblColumn.setToolTipText(Messages.tblAsSize);
    tblColumn = new TableColumn(asTable, SWT.CENTER);
    tblColumn.setText(Messages.tblAsStatus);
    tblColumn.setToolTipText(Messages.tblAsStatus);
    tblColumn = new TableColumn(asTable, SWT.CENTER);
    tblColumn.setText(Messages.tblAsDb);
    tblColumn.setToolTipText(Messages.tblAsDb);
    tblColumn = new TableColumn(asTable, SWT.CENTER);
    tblColumn.setText(Messages.tblAsHost);
    tblColumn.setToolTipText(Messages.tblAsHost);
    tblColumn = new TableColumn(asTable, SWT.CENTER);
    tblColumn.setText(Messages.tblAsLastAccess);
    tblColumn.setToolTipText(Messages.tblAsLastAccess);
    tblColumn = new TableColumn(asTable, SWT.CENTER);
    tblColumn.setText(Messages.tblAsLct);
    tblColumn.setToolTipText(Messages.tblAsLct);
    tblColumn = new TableColumn(asTable, SWT.CENTER);
    tblColumn.setText(Messages.tblAsClientIp);
    tblColumn.setToolTipText(Messages.tblAsClientIp);
    tblColumn = new TableColumn(asTable, SWT.CENTER);
    tblColumn.setText(Messages.tblAsCur);
    tblColumn.setToolTipText(Messages.tblAsCur);
    asTableViewer.setContentProvider(new ApplyServerContentProvider());
    asTableViewer.setLabelProvider(new ApplyServerLabelProvider());
    asTableViewer.setInput(asinfoLst);
    return asTableViewer;
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) Table(org.eclipse.swt.widgets.Table) Composite(org.eclipse.swt.widgets.Composite) GridData(org.eclipse.swt.layout.GridData) ApplyServerContentProvider(com.cubrid.cubridmanager.ui.broker.editor.ApplyServerContentProvider) TableViewer(org.eclipse.jface.viewers.TableViewer) TableLayout(org.eclipse.jface.viewers.TableLayout) TableColumn(org.eclipse.swt.widgets.TableColumn) ApplyServerLabelProvider(com.cubrid.cubridmanager.ui.broker.editor.ApplyServerLabelProvider)

Aggregations

TableLayout (org.eclipse.jface.viewers.TableLayout)46 ColumnWeightData (org.eclipse.jface.viewers.ColumnWeightData)23 GridData (org.eclipse.swt.layout.GridData)23 TableColumn (org.eclipse.swt.widgets.TableColumn)20 Table (org.eclipse.swt.widgets.Table)18 TableViewer (org.eclipse.jface.viewers.TableViewer)16 Composite (org.eclipse.swt.widgets.Composite)16 GridLayout (org.eclipse.swt.layout.GridLayout)15 Label (org.eclipse.swt.widgets.Label)10 ColumnPixelData (org.eclipse.jface.viewers.ColumnPixelData)8 TableItem (org.eclipse.swt.widgets.TableItem)8 SelectionEvent (org.eclipse.swt.events.SelectionEvent)6 ServerInfo (com.cubrid.cubridmanager.core.common.model.ServerInfo)4 BrokerEnvStatusColumn (com.cubrid.cubridmanager.ui.broker.editor.internal.BrokerEnvStatusColumn)4 Point (org.eclipse.swt.graphics.Point)4 Event (org.eclipse.swt.widgets.Event)4 Listener (org.eclipse.swt.widgets.Listener)4 Menu (org.eclipse.swt.widgets.Menu)4 CommonUITool.trimPaintColor (com.cubrid.common.ui.spi.util.CommonUITool.trimPaintColor)3 ApplyServerInfo (com.cubrid.cubridmanager.core.broker.model.ApplyServerInfo)3