Search in sources :

Example 16 with BrokerInfoList

use of com.cubrid.cubridmanager.core.broker.model.BrokerInfoList in project cubrid-manager by CUBRID.

the class DatabaseConnectionPropertyPage method createContents.

protected Control createContents(Composite parent) {
    Composite top = new Composite(parent, SWT.NONE);
    top.setLayout(new GridLayout());
    top.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    final Group group = new Group(top, SWT.NONE);
    group.setLayoutData(CommonUITool.createGridData(GridData.FILL_BOTH, 1, 1, -1, -1));
    GridLayout layout = new GridLayout();
    layout.numColumns = 2;
    layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    group.setLayout(layout);
    final Label labelBrokerIp = new Label(group, SWT.NONE);
    labelBrokerIp.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
    labelBrokerIp.setText(Messages.brokerIP);
    brokerIpText = new Text(group, SWT.BORDER);
    brokerIpText.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 1, 1, -1, -1));
    final Label labelBrokerPort = new Label(group, SWT.NONE);
    labelBrokerPort.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
    labelBrokerPort.setText(Messages.brokerPort);
    brokerPortCombo = new Combo(group, SWT.NONE);
    brokerPortCombo.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 1, 1, -1, -1));
    BrokerInfos brokerInfos = database.getServer().getServerInfo().getBrokerInfos();
    BrokerInfoList bis = brokerInfos == null ? null : brokerInfos.getBorkerInfoList();
    if (bis != null) {
        List<BrokerInfo> brokerInfoList = bis.getBrokerInfoList();
        for (BrokerInfo brokerInfo : brokerInfoList) {
            if (StringUtil.isEmpty(brokerInfo.getPort())) {
                continue;
            }
            String status = "";
            if (!StringUtil.isEqualIgnoreCase(brokerInfos.getBrokerstatus(), "ON")) {
                status = "OFF";
            } else {
                status = !StringUtil.isEqualIgnoreCase(brokerInfo.getState(), "ON") ? "OFF" : "ON";
            }
            String text = brokerInfo.getName() + "[" + brokerInfo.getPort() + "/" + status + "]";
            brokerPortCombo.add(text);
            brokerPortCombo.setData(brokerInfo.getPort(), text);
            brokerPortCombo.setData(text, brokerInfo);
        }
    }
    Label charSetLbl = new Label(group, SWT.CHECK);
    charSetLbl.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
    charSetLbl.setText(Messages.lblCharSet);
    charsetCombo = new Combo(group, SWT.BORDER);
    charsetCombo.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 1, 1, -1, -1));
    loadPreference();
    return top;
}
Also used : Group(org.eclipse.swt.widgets.Group) GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) BrokerInfos(com.cubrid.cubridmanager.core.broker.model.BrokerInfos) GridData(org.eclipse.swt.layout.GridData) Label(org.eclipse.swt.widgets.Label) Text(org.eclipse.swt.widgets.Text) Combo(org.eclipse.swt.widgets.Combo) BrokerInfoList(com.cubrid.cubridmanager.core.broker.model.BrokerInfoList) BrokerInfo(com.cubrid.cubridmanager.core.broker.model.BrokerInfo)

Aggregations

BrokerInfoList (com.cubrid.cubridmanager.core.broker.model.BrokerInfoList)16 BrokerInfos (com.cubrid.cubridmanager.core.broker.model.BrokerInfos)13 BrokerInfo (com.cubrid.cubridmanager.core.broker.model.BrokerInfo)11 ArrayList (java.util.ArrayList)7 BrokerStatusInfos (com.cubrid.cubridmanager.core.broker.model.BrokerStatusInfos)5 GetBrokerStatusInfosTask (com.cubrid.cubridmanager.core.broker.task.GetBrokerStatusInfosTask)4 ServerInfo (com.cubrid.cubridmanager.core.common.model.ServerInfo)4 ApplyServerInfo (com.cubrid.cubridmanager.core.broker.model.ApplyServerInfo)3 CommonQueryTask (com.cubrid.cubridmanager.core.common.task.CommonQueryTask)3 List (java.util.List)3 ExecTaskWithProgress (com.cubrid.common.ui.spi.progress.ExecTaskWithProgress)2 TaskExecutor (com.cubrid.common.ui.spi.progress.TaskExecutor)2 HashMap (java.util.HashMap)2 GridData (org.eclipse.swt.layout.GridData)2 GridLayout (org.eclipse.swt.layout.GridLayout)2 Combo (org.eclipse.swt.widgets.Combo)2 Composite (org.eclipse.swt.widgets.Composite)2 Group (org.eclipse.swt.widgets.Group)2 Label (org.eclipse.swt.widgets.Label)2 Text (org.eclipse.swt.widgets.Text)2