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;
}
Aggregations