use of org.eclipse.swt.widgets.Combo in project cubrid-manager by CUBRID.
the class SettingHostPage method createControl.
/* (non-Javadoc)
* @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
*/
public void createControl(Composite parent) {
Composite container = new Composite(parent, SWT.NONE);
container.setLayout(new FormLayout());
setControl(container);
setDescription(Messages.descSettingHostPage);
setPageComplete(false);
Composite leftComposite = new Composite(container, SWT.NONE);
leftComposite.setLayout(new GridLayout(2, false));
FormData leftData = new FormData();
leftData.top = new FormAttachment(0, 5);
leftData.bottom = new FormAttachment(100, 0);
leftData.left = new FormAttachment(0, 5);
leftData.right = new FormAttachment(50, -5);
leftComposite.setLayoutData(leftData);
Label separator = new Label(container, SWT.SEPARATOR);
FormData separatorData = new FormData();
separatorData.top = new FormAttachment(0, 5);
separatorData.bottom = new FormAttachment(100, -5);
separatorData.left = new FormAttachment(50, -5);
separatorData.right = new FormAttachment(50, 5);
separator.setLayoutData(separatorData);
Composite rightComposite = new Composite(container, SWT.NONE);
rightComposite.setLayout(new GridLayout(3, false));
FormData rightData = new FormData();
rightData.top = new FormAttachment(0, 5);
rightData.bottom = new FormAttachment(100, 0);
rightData.left = new FormAttachment(50, 5);
rightData.right = new FormAttachment(100, -5);
rightComposite.setLayoutData(rightData);
/*Create left widget*/
Label hostALabel = new Label(leftComposite, SWT.None);
hostALabel.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
hostALabel.setText(Messages.lblMaster);
masterHostText = new Text(leftComposite, SWT.BORDER);
masterHostText.setEnabled(false);
masterHostText.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 1, 1, -1, -1));
Label masterNameLabel = new Label(leftComposite, SWT.None);
masterNameLabel.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
masterNameLabel.setText(Messages.lblMasterHost);
masterHostName = new Text(leftComposite, SWT.BORDER);
masterHostName.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 1, 1, -1, -1));
masterHostName.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
validate();
}
});
masterDBList = new org.eclipse.swt.widgets.List(leftComposite, SWT.BORDER);
masterDBList.setLayoutData(CommonUITool.createGridData(GridData.FILL_BOTH, 2, 1, -1, -1));
masterDBList.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
widgetDefaultSelected(e);
}
public void widgetDefaultSelected(SelectionEvent e) {
validate();
}
});
/*Create right widget*/
Label hostBLabel = new Label(rightComposite, SWT.None);
hostBLabel.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
hostBLabel.setText(Messages.lblSlave);
slaveHostCombo = new Combo(rightComposite, SWT.READ_ONLY);
slaveHostCombo.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 2, 1, -1, -1));
slaveHostCombo.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
widgetDefaultSelected(e);
}
public void widgetDefaultSelected(SelectionEvent e) {
selectedSlaveServer = null;
String serverName = slaveHostCombo.getText();
List<CubridServer> serverList = CMHostNodePersistManager.getInstance().getAllServers();
for (CubridServer server : serverList) {
if (serverName.equals(server.getName())) {
selectedSlaveServer = server;
break;
}
}
initSlaveDBList(selectedSlaveServer);
validate();
}
});
Label slaveNameLabel = new Label(rightComposite, SWT.None);
slaveNameLabel.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
slaveNameLabel.setText(Messages.lblSlaveHost);
slaveHostName = new Text(rightComposite, SWT.BORDER);
slaveHostName.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 2, 1, -1, -1));
slaveHostName.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
validate();
}
});
slaveDBList = new org.eclipse.swt.widgets.List(rightComposite, SWT.BORDER);
slaveDBList.setLayoutData(CommonUITool.createGridData(GridData.FILL_BOTH, 3, 1, -1, -1));
slaveDBList.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
widgetDefaultSelected(e);
}
public void widgetDefaultSelected(SelectionEvent e) {
validate();
}
});
init();
}
use of org.eclipse.swt.widgets.Combo in project cubrid-manager by CUBRID.
the class UserPasswordInputDialog method createDialogArea.
protected Control createDialogArea(Composite parent) {
Composite composite = (Composite) super.createDialogArea(parent);
Composite newComposite = new Composite(composite, SWT.NONE);
newComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
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);
newComposite.setLayout(layout);
setTitle(Messages.titleUserPassword);
setMessage(Messages.msgInputNamePassword, IMessageProvider.INFORMATION);
Label lblUserName = new Label(newComposite, SWT.NONE);
lblUserName.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, true, 1, 1));
lblUserName.setText(Messages.lblUserName);
userName = new Text(newComposite, SWT.BORDER);
userName.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true, 1, 1));
userName.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
validateInput();
}
});
Label lblPassword = new Label(newComposite, SWT.NONE);
lblPassword.setText(Messages.lblPassword);
lblPassword.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, true, 1, 1));
userPassword = new Text(newComposite, SWT.BORDER | SWT.PASSWORD);
userPassword.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true, 1, 1));
userPassword.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
validateInput();
}
});
Label lblJdbcDriver = new Label(newComposite, SWT.NONE);
lblJdbcDriver.setText(Messages.lblJdbcVersion);
lblJdbcDriver.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, true, 1, 1));
jdbcDriver = new Combo(newComposite, SWT.BORDER);
jdbcDriver.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false, 1, 1));
jdbcDriver.add("Auto Detect", 0);
initJdbcDriver();
jdbcDriver.select(0);
applyDialogFont(newComposite);
return composite;
}
use of org.eclipse.swt.widgets.Combo in project cubrid-manager by CUBRID.
the class SelectDbPage method createControl.
/**
* Create the control for this page
*
* @param parent Composite
*/
public void createControl(Composite parent) {
Composite composite = new Composite(parent, SWT.NONE);
GridLayout layout = new GridLayout();
layout.marginHeight = 10;
layout.marginWidth = 10;
composite.setLayout(layout);
GridData gridData = new GridData(GridData.FILL_BOTH);
composite.setLayoutData(gridData);
Group dbInfoGroup = new Group(composite, SWT.NONE);
dbInfoGroup.setText(Messages.grpSelectDb);
gridData = new GridData(GridData.FILL_HORIZONTAL);
dbInfoGroup.setLayoutData(gridData);
layout = new GridLayout();
layout.numColumns = 2;
dbInfoGroup.setLayout(layout);
Label dbNameLabel = new Label(dbInfoGroup, SWT.LEFT);
dbNameLabel.setText(Messages.lblDbName);
dbNameLabel.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
dbNameCombo = new Combo(dbInfoGroup, SWT.LEFT | SWT.BORDER | SWT.READ_ONLY);
dbNameCombo.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 1, 1, 100, -1));
dbNameCombo.addModifyListener(this);
Label nickNameLable = new Label(dbInfoGroup, SWT.LEFT);
nickNameLable.setText(Messages.lblNickName);
nickNameLable.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
nickNameText = new Text(dbInfoGroup, SWT.LEFT | SWT.BORDER);
nickNameText.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 1, 1, -1, -1));
Label dbaPasswordLabel = new Label(dbInfoGroup, SWT.LEFT);
dbaPasswordLabel.setText(Messages.lblDbaPassword);
dbaPasswordLabel.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
dbaPasswordText = new Text(dbInfoGroup, SWT.LEFT | SWT.BORDER | SWT.PASSWORD);
dbaPasswordText.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 1, 1, 100, -1));
Composite btnComposite = new Composite(composite, SWT.NONE);
RowLayout rowLayout = new RowLayout();
rowLayout.spacing = 5;
btnComposite.setLayout(rowLayout);
gridData = new GridData(GridData.FILL_HORIZONTAL);
gridData.horizontalAlignment = GridData.END;
btnComposite.setLayoutData(gridData);
addButton = new Button(btnComposite, SWT.NONE);
addButton.setText(Messages.btnAddDb);
addButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
String dbName = dbNameCombo.getText();
String dbaPassword = dbaPasswordText.getText();
String nickName = nickNameText.getText();
if (nickName.trim().length() == 0) {
nickName = dbName;
}
//check whether this database already be added
if (isExist(dbName, hostNode)) {
CommonUITool.openErrorBox(Messages.bind(Messages.errDbExist, dbName));
return;
}
DatabaseInfo dbInfo = serverInfo.getLoginedUserInfo().getDatabaseInfo(dbName);
TaskExecutor executor = new CommonTaskExec(null);
VerifyDbUserPasswordTask verifyDbUserPasswordTask = null;
if (dbInfo.isLogined() && dbInfo.getAuthLoginedDbUserInfo().getName().equalsIgnoreCase("dba")) {
String password = dbInfo.getAuthLoginedDbUserInfo().getNoEncryptPassword();
if (!dbaPassword.equals(password)) {
CommonUITool.openErrorBox(Messages.errDbaPassowrd);
return;
}
} else {
verifyDbUserPasswordTask = new VerifyDbUserPasswordTask(serverInfo);
verifyDbUserPasswordTask.setDbName(dbName);
verifyDbUserPasswordTask.setDbUser("dba");
verifyDbUserPasswordTask.setDbPassword(dbaPassword);
executor.addTask(verifyDbUserPasswordTask);
}
GetHeartbeatNodeInfoTask getHeartbeatNodeInfoTask = new GetHeartbeatNodeInfoTask(serverInfo);
getHeartbeatNodeInfoTask.setAllDb(false);
List<String> dbList = new ArrayList<String>();
dbList.add(dbName);
getHeartbeatNodeInfoTask.setDbList(dbList);
executor.addTask(getHeartbeatNodeInfoTask);
new ExecTaskWithProgress(executor).exec(true, true);
if (!executor.isSuccess()) {
if (verifyDbUserPasswordTask != null && !verifyDbUserPasswordTask.isSuccess()) {
dbaPasswordText.selectAll();
dbaPasswordText.setFocus();
}
return;
}
List<HAHostStatusInfo> haHostStatusInfoList = getHeartbeatNodeInfoTask.getHAHostStatusList();
HADatabaseStatusInfo haDbStatusInfo = getHeartbeatNodeInfoTask.getDatabaseStatusInfo(dbName);
HAHostStatusInfo haHostStatusInfo = getHeartbeatNodeInfoTask.getHostStatusInfo(serverInfo.getHostAddress());
//if this database is HA Mode,will get it's active database or standby database
List<DatabaseNode> haDbNodeList = getHADatabaseList(haDbStatusInfo, haHostStatusInfoList, true);
if (haHostStatusInfo == null) {
haHostStatusInfo = HAUtil.getHAHostStatusInfo(serverInfo);
if (haDbStatusInfo != null) {
haHostStatusInfo.addHADatabaseStatus(haDbStatusInfo);
}
}
if (haDbStatusInfo == null) {
haDbStatusInfo = HAUtil.getHADatabaseStatusInfo(dbName, haHostStatusInfo, serverInfo);
}
DatabaseNode dbNode = new DatabaseNode();
hostNode.setHostStatusInfo(haHostStatusInfo);
dbNode.setParent(hostNode);
dbNode.setDbName(dbName);
dbNode.setDbUser("dba");
dbNode.setDbPassword(dbaPassword);
dbNode.setName(nickName);
dbNode.setHaDatabaseStatus(haDbStatusInfo);
dbNode.setConnected(true);
if (haDbNodeList == null) {
haDbNodeList = new ArrayList<DatabaseNode>();
}
if (dbNode.getDbStatusType() == DBStatusType.ACTIVE || dbNode.getDbStatusType() == DBStatusType.TO_BE_ACTIVE) {
haDbNodeList.add(0, dbNode);
} else {
haDbNodeList.add(dbNode);
}
addDbNodeToTable(haDbNodeList, haHostStatusInfoList);
}
});
haModeBtn = new Button(dbInfoGroup, SWT.LEFT | SWT.CHECK);
haModeBtn.setText(Messages.btnHAMode);
haModeBtn.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 2, 1, 100, -1));
haModeBtn.setEnabled(false);
createTable(composite);
dbNameCombo.setFocus();
setTitle(Messages.titleSelectDbPage);
setMessage(Messages.msgSelectDbPage);
setControl(composite);
}
use of org.eclipse.swt.widgets.Combo in project cubrid-manager by CUBRID.
the class DiagStatusMonitorTemplateDialog method createTemplateGroup.
/**
* Creates template group
*
* @param composite The composite to contains the template group
*/
private void createTemplateGroup(Composite composite) {
final Group group = new Group(composite, SWT.RESIZE);
group.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
group.setLayout(new GridLayout(4, false));
group.setText(TEMPLATE_GROUP);
final Label nameLabel = new Label(group, SWT.NONE);
final GridData gdNameLabel = new GridData(SWT.CENTER, SWT.CENTER, false, false);
gdNameLabel.widthHint = 90;
nameLabel.setLayoutData(gdNameLabel);
nameLabel.setText(TEMPLATE_NAME);
nameText = new Text(group, SWT.BORDER);
final GridData gdNameText = new GridData(SWT.FILL, SWT.CENTER, true, false);
gdNameText.widthHint = 60;
nameText.setLayoutData(gdNameText);
final Label samplingTermsLbl = new Label(group, SWT.NONE);
final GridData gdSamplingTermsLbl = new GridData(SWT.CENTER, SWT.CENTER, false, false);
gdSamplingTermsLbl.widthHint = 130;
samplingTermsLbl.setLayoutData(gdSamplingTermsLbl);
samplingTermsLbl.setText(SAMPLE_TERM);
samplingTermscombo = new Combo(group, SWT.NONE);
final GridData gdSamplingTermscombo = new GridData(SWT.FILL, SWT.CENTER, true, false);
gdSamplingTermscombo.widthHint = 60;
samplingTermscombo.setLayoutData(gdSamplingTermscombo);
samplingTermscombo.setItems(samplingTermsItems);
samplingTermscombo.setText(samplingTermsItems[0]);
final Label descriptionLabel = new Label(group, SWT.NONE);
final GridData gdDescriptionLabel = new GridData(SWT.CENTER, SWT.CENTER, false, false);
gdDescriptionLabel.widthHint = 90;
descriptionLabel.setLayoutData(gdDescriptionLabel);
descriptionLabel.setText(TEMPLATE_DESC);
discriptionText = new Text(group, SWT.BORDER);
final GridData gdDiscriptionText = new GridData(SWT.FILL, SWT.CENTER, true, false);
gdDiscriptionText.widthHint = 60;
discriptionText.setLayoutData(gdDiscriptionText);
ServerType serverType = serverInfo.getServerType();
if (serverType == ServerType.BOTH || serverType == ServerType.DATABASE) {
final Label targetDbNameLbl = new Label(group, SWT.NONE);
final GridData gdTargetDbNameLbl = new GridData(SWT.CENTER, SWT.CENTER, false, false);
gdTargetDbNameLbl.widthHint = 130;
targetDbNameLbl.setLayoutData(gdTargetDbNameLbl);
targetDbNameLbl.setText(TARGET_DB);
targetDbNameCombo = new Combo(group, SWT.NULL);
final GridData gdTargetDbNameCombo = new GridData(SWT.FILL, SWT.CENTER, true, false);
gdTargetDbNameCombo.widthHint = 60;
targetDbNameCombo.setLayoutData(gdTargetDbNameCombo);
}
}
use of org.eclipse.swt.widgets.Combo in project cubrid-manager by CUBRID.
the class ChartCompositePart method createSeriesList.
/**
* Create the sub composite of Series selection combo and its related
* properties such as check and color
*
* @param composite the parent composite
*/
private void createSeriesList(Composite composite) {
Composite comp = new Composite(composite, SWT.NONE);
GridLayout layout = new GridLayout(3, false);
comp.setLayout(layout);
comp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
combo = new Combo(comp, SWT.DROP_DOWN);
for (Map.Entry<String, String> entry : valueMap.entrySet()) {
combo.add(entry.getKey());
}
combo.setLayout(new GridLayout());
combo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
combo.addSelectionListener(new SelectionAdapter() {
/**
* Sent when selection occurs in the control.
*
* @param event an event containing information about the selection
*/
public void widgetSelected(SelectionEvent event) {
widgetDefaultSelected(event);
}
/**
* Sent when default selection occurs in the control.
*
* @param event an event containing information about the default
* selection
*/
public void widgetDefaultSelected(SelectionEvent event) {
String selectedItem = combo.getItem(combo.getSelectionIndex());
boolean checked = settingMap.get(selectedItem).isChecked();
RGB rgb = settingMap.get(selectedItem).getSeriesRgb();
checkBtn.setSelection(checked);
colorField.getColorSelector().setColorValue(rgb);
}
});
checkBtn = new Button(comp, SWT.CHECK);
checkBtn.setText(Messages.seriesSelectCheckBtn);
checkBtn.addSelectionListener(new SelectionAdapter() {
/**
* Sent when selection occurs in the control.
*
* @param event an event containing information about the selection
*/
public void widgetSelected(SelectionEvent event) {
widgetDefaultSelected(event);
}
/**
* Sent when default selection occurs in the control.
*
* @param event an event containing information about the default
* selection
*/
public void widgetDefaultSelected(SelectionEvent event) {
handleUpdateSettingChange();
}
});
Composite selComp = new Composite(comp, SWT.NONE);
colorField = new ColorFieldEditor(Messages.seriesSelectColorBtnName, Messages.seriesSelectColorBtnLbl, selComp);
colorField.getColorSelector().addListener(new IPropertyChangeListener() {
/**
* Notification that a property has changed.
*
* @param event the property change event object describing which
* property changed and how
*/
public void propertyChange(PropertyChangeEvent event) {
handleUpdateSettingChange();
}
});
}
Aggregations