use of org.eclipse.swt.events.FocusEvent in project cubrid-manager by CUBRID.
the class SetHostInfoPage 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 cmServerInfoGroup = new Group(composite, SWT.NONE);
cmServerInfoGroup.setText(Messages.grpHostInfo);
gridData = new GridData(GridData.FILL_HORIZONTAL);
cmServerInfoGroup.setLayoutData(gridData);
layout = new GridLayout();
layout.numColumns = 2;
cmServerInfoGroup.setLayout(layout);
Label nickNameLable = new Label(cmServerInfoGroup, SWT.LEFT);
nickNameLable.setText(Messages.lblNickName);
nickNameLable.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
nickNameText = new Text(cmServerInfoGroup, SWT.LEFT | SWT.BORDER);
nickNameText.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 1, 1, -1, -1));
Label ipLabel = new Label(cmServerInfoGroup, SWT.LEFT);
ipLabel.setText(Messages.lblIPAddress);
ipLabel.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
ipText = new Text(cmServerInfoGroup, SWT.LEFT | SWT.BORDER);
ipText.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 1, 1, -1, -1));
ipText.addModifyListener(this);
Label portNameLabel = new Label(cmServerInfoGroup, SWT.LEFT);
portNameLabel.setText(Messages.lblPort);
portNameLabel.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
portText = new Text(cmServerInfoGroup, SWT.LEFT | SWT.BORDER);
portText.setTextLimit(5);
portText.setText("8001");
portText.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 1, 1, -1, -1));
portText.addFocusListener(new FocusAdapter() {
public void focusGained(FocusEvent event) {
portText.selectAll();
portText.setFocus();
}
});
portText.addModifyListener(this);
Label userNameLabel = new Label(cmServerInfoGroup, SWT.LEFT);
userNameLabel.setText(Messages.lblUserName);
userNameLabel.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
userNameText = new Text(cmServerInfoGroup, SWT.LEFT | SWT.BORDER);
userNameText.setText("admin");
userNameText.setEnabled(false);
userNameText.setTextLimit(ValidateUtil.MAX_NAME_LENGTH);
userNameText.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 1, 1, -1, -1));
Label passwordLabel = new Label(cmServerInfoGroup, SWT.LEFT);
passwordLabel.setText(Messages.lblPassword);
passwordLabel.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
passwordText = new Text(cmServerInfoGroup, SWT.LEFT | SWT.PASSWORD | SWT.BORDER);
passwordText.setTextLimit(ValidateUtil.MAX_NAME_LENGTH);
passwordText.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 1, 1, -1, -1));
passwordText.addModifyListener(this);
passwordText.addFocusListener(new FocusAdapter() {
public void focusGained(FocusEvent event) {
passwordText.selectAll();
passwordText.setFocus();
}
});
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);
connectHostButton = new Button(btnComposite, SWT.NONE);
connectHostButton.setText(Messages.btnConnect);
connectHostButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
String address = ipText.getText();
String port = portText.getText();
String userName = userNameText.getText();
String password = passwordText.getText();
String nickName = nickNameText.getText();
if (nickName.trim().length() == 0) {
nickNameText.setText(address + ":" + port);
}
ServerInfo serverInfo = CMHostNodePersistManager.getInstance().getServerInfo(address, Integer.parseInt(port), userName);
if (serverInfo == null) {
serverInfo = new ServerInfo();
serverInfo.setServerName(address);
serverInfo.setHostAddress(address);
serverInfo.setHostMonPort(Integer.parseInt(port));
serverInfo.setHostJSPort(Integer.parseInt(port) + 1);
serverInfo.setUserName(userName);
serverInfo.setUserPassword(password);
serverInfo.setJdbcDriverVersion(ServerJdbcVersionMapping.JDBC_SELF_ADAPTING_VERSION);
}
heartbeatNodeInfoTask = new GetHeartbeatNodeInfoTask(serverInfo);
heartbeatNodeInfoTask.setAllDb(false);
heartbeatNodeInfoTask.setDbList(new ArrayList<String>());
TaskExecutor executor = null;
if (serverInfo.isConnected()) {
if (CompatibleUtil.isSupportHA(serverInfo)) {
executor = new CommonTaskExec(null);
executor.addTask(heartbeatNodeInfoTask);
}
} else {
executor = new ConnectHostExecutor(getShell(), serverInfo, true);
executor.addTask(heartbeatNodeInfoTask);
}
if (executor != null) {
new ExecTaskWithProgress(executor).exec(true, true);
}
changeBtnStatus();
}
});
connectHostButton.setEnabled(false);
init();
nickNameText.setFocus();
setTitle(Messages.titileHostInfoPage);
setMessage(Messages.msgHostInfoPage);
setControl(composite);
}
use of org.eclipse.swt.events.FocusEvent in project cubrid-manager by CUBRID.
the class ConnectHostNodeDialog method createDialogArea.
/**
* Create dialog area content
*
* @param parent the parent composite
* @return the control
*/
protected Control createDialogArea(Composite parent) {
Composite parentComp = (Composite) super.createDialogArea(parent);
Composite composite = new Composite(parentComp, SWT.NONE);
composite.setLayoutData(CommonUITool.createGridData(GridData.FILL_BOTH, 1, 1, -1, -1));
GridLayout layout = new GridLayout();
layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
composite.setLayout(layout);
Group cmServerInfoGroup = new Group(composite, SWT.NONE);
cmServerInfoGroup.setText(Messages.grpHostInfo);
GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
cmServerInfoGroup.setLayoutData(gridData);
layout = new GridLayout();
layout.numColumns = 2;
cmServerInfoGroup.setLayout(layout);
Label ipLabel = new Label(cmServerInfoGroup, SWT.LEFT);
ipLabel.setText(Messages.lblIPAddress);
ipLabel.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
ipText = new Text(cmServerInfoGroup, SWT.LEFT | SWT.BORDER);
ipText.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 1, 1, -1, -1));
ipText.setEnabled(false);
Label portNameLabel = new Label(cmServerInfoGroup, SWT.LEFT);
portNameLabel.setText(Messages.lblPort);
portNameLabel.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
portText = new Text(cmServerInfoGroup, SWT.LEFT | SWT.BORDER);
portText.setText("8001");
portText.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 1, 1, -1, -1));
portText.addFocusListener(new FocusAdapter() {
public void focusGained(FocusEvent event) {
portText.selectAll();
portText.setFocus();
}
});
Label userNameLabel = new Label(cmServerInfoGroup, SWT.LEFT);
userNameLabel.setText(Messages.lblUserName);
userNameLabel.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
userNameText = new Text(cmServerInfoGroup, SWT.LEFT | SWT.BORDER);
userNameText.setText("admin");
userNameText.setEnabled(false);
userNameText.setTextLimit(ValidateUtil.MAX_NAME_LENGTH);
userNameText.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 1, 1, -1, -1));
Label passwordLabel = new Label(cmServerInfoGroup, SWT.LEFT);
passwordLabel.setText(Messages.lblPassword);
passwordLabel.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
passwordText = new Text(cmServerInfoGroup, SWT.LEFT | SWT.PASSWORD | SWT.BORDER);
passwordText.setTextLimit(ValidateUtil.MAX_NAME_LENGTH);
passwordText.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 1, 1, -1, -1));
passwordText.addFocusListener(new FocusAdapter() {
public void focusGained(FocusEvent event) {
passwordText.selectAll();
passwordText.setFocus();
}
});
setTitle(Messages.titileHostInfoPage);
setMessage(Messages.msgHostInfoPage);
init();
return composite;
}
use of org.eclipse.swt.events.FocusEvent in project cubrid-manager by CUBRID.
the class VolumeSizeValidator method createVolumeGroup.
/**
*
* Create volume group area
*
* @param parent the parent composite
*/
private void createVolumeGroup(Composite parent) {
Group volumeGroup = new Group(parent, SWT.NONE);
volumeGroup.setText(Messages.grpAddtionalVolInfo);
GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
volumeGroup.setLayoutData(gridData);
GridLayout layout = new GridLayout();
layout.numColumns = 4;
volumeGroup.setLayout(layout);
Label volumeNameLabel = new Label(volumeGroup, SWT.LEFT | SWT.WRAP);
volumeNameLabel.setText(Messages.lblVolName);
volumeNameLabel.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
volumeNameText = new Text(volumeGroup, SWT.BORDER);
gridData = new GridData(GridData.FILL_HORIZONTAL);
gridData.horizontalSpan = 3;
volumeNameText.setLayoutData(gridData);
volumeNameText.setEditable(false);
Label volumePathLabel = new Label(volumeGroup, SWT.LEFT | SWT.WRAP);
volumePathLabel.setText(Messages.lblVolPath);
volumePathLabel.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
volumePathText = new Text(volumeGroup, SWT.BORDER);
gridData = new GridData(GridData.FILL_HORIZONTAL);
gridData.horizontalSpan = 2;
volumePathText.setLayoutData(gridData);
Button selectDirectoryButton = new Button(volumeGroup, SWT.NONE);
selectDirectoryButton.setText(Messages.btnBrowse);
selectDirectoryButton.setLayoutData(CommonUITool.createGridData(1, 1, 80, -1));
selectDirectoryButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
DirectoryDialog dlg = new DirectoryDialog(getShell());
if (databasePath != null && databasePath.trim().length() > 0) {
dlg.setFilterPath(databasePath);
}
dlg.setText(Messages.msgSelectDir);
dlg.setMessage(Messages.msgSelectDir);
String dir = dlg.open();
if (dir != null) {
volumePathText.setText(dir);
}
}
});
ServerInfo serverInfo = server.getServerInfo();
if (serverInfo != null && !serverInfo.isLocalServer()) {
selectDirectoryButton.setEnabled(false);
}
Label volumeTypeLabel = new Label(volumeGroup, SWT.LEFT | SWT.WRAP);
volumeTypeLabel.setText(Messages.lblVolType);
volumeTypeLabel.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
volumeTypeCombo = new Combo(volumeGroup, SWT.DROP_DOWN | SWT.READ_ONLY);
gridData = new GridData(GridData.FILL_HORIZONTAL);
gridData.horizontalSpan = 3;
volumeTypeCombo.setLayoutData(gridData);
volumeTypeCombo.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
changeVolumeName();
}
});
Label sizeOfPageLabel = new Label(volumeGroup, SWT.LEFT | SWT.WRAP);
sizeOfPageLabel.setText(Messages.lblVolSize);
sizeOfPageLabel.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
volumeSizeText = new Text(volumeGroup, SWT.BORDER);
volumeSizeText.setTextLimit(20);
gridData = new GridData(GridData.FILL_HORIZONTAL);
gridData.horizontalSpan = 3;
volumeSizeText.setLayoutData(gridData);
volumeSizeText.addFocusListener(new FocusListener() {
public void focusGained(FocusEvent event) {
volumeSizeText.addModifyListener(VolumeInfoPage.this);
}
public void focusLost(FocusEvent event) {
volumeSizeText.removeModifyListener(VolumeInfoPage.this);
}
});
}
use of org.eclipse.swt.events.FocusEvent in project cubrid-manager by CUBRID.
the class SetAutoAddVolumeInfoPage method createDataParaGroup.
/**
* Creates dataParaGroup which is the part of Dialog area
*
* @param composite the parent composite
*/
private void createDataParaGroup(Composite composite) {
final Group dataParaGroup = new Group(composite, SWT.RESIZE);
final GridData gdDataParaGroup = new GridData(SWT.FILL, SWT.CENTER, true, false);
dataParaGroup.setLayoutData(gdDataParaGroup);
dataParaGroup.setText(Messages.grpVolPurposeData);
GridLayout groupLayout = new GridLayout(4, false);
dataParaGroup.setLayout(groupLayout);
dataUsingAutoVolButton = new Button(dataParaGroup, SWT.CHECK);
final GridData gdUsingAutoVolButton = new GridData(SWT.LEFT, SWT.CENTER, true, false, 4, 1);
dataUsingAutoVolButton.setLayoutData(gdUsingAutoVolButton);
dataUsingAutoVolButton.setText(Messages.btnUsingAuto);
final Label outOfSpaceLabel = new Label(dataParaGroup, SWT.NONE);
outOfSpaceLabel.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
outOfSpaceLabel.setText(Messages.lblOutOfSpaceWarning);
dataOutRateCombo = new Combo(dataParaGroup, SWT.BORDER);
dataOutRateCombo.setTextLimit(2);
dataOutRateCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 3, 1));
final Label volumeLabel = new Label(dataParaGroup, SWT.NONE);
volumeLabel.setText(Messages.lblVolSize);
volumeLabel.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
dataVolumeText = new Text(dataParaGroup, SWT.BORDER);
dataVolumeText.setTextLimit(20);
dataVolumeText.setText(GeneralInfoPage.getIntSizeString(initVolumeSize, 1));
final GridData gdDataVolumeText = new GridData(SWT.FILL, SWT.CENTER, true, false, 3, 1);
dataVolumeText.setLayoutData(gdDataVolumeText);
dataVolumeText.addFocusListener(new FocusListener() {
public void focusGained(FocusEvent event) {
dataVolumeText.addModifyListener(SetAutoAddVolumeInfoPage.this);
}
public void focusLost(FocusEvent event) {
dataVolumeText.removeModifyListener(SetAutoAddVolumeInfoPage.this);
}
});
}
use of org.eclipse.swt.events.FocusEvent in project cubrid-manager by CUBRID.
the class SetAutoAddVolumeInfoPage method createIndexParaGroup.
/**
* Creates indexParaGroup which is the part of Dialog area
*
* @param composite the parent composite
*/
private void createIndexParaGroup(Composite composite) {
final Group indexParaGroup = new Group(composite, SWT.RESIZE);
final GridData gdIndexParaGroup = new GridData(SWT.FILL, SWT.CENTER, true, false);
final GridLayout gridLayout = new GridLayout(4, false);
indexParaGroup.setLayout(gridLayout);
indexParaGroup.setLayoutData(gdIndexParaGroup);
indexParaGroup.setText(Messages.grpVolPurposeIndex);
indexUsingAutoVolButton = new Button(indexParaGroup, SWT.CHECK);
indexUsingAutoVolButton.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false, 4, 1));
indexUsingAutoVolButton.setText(Messages.btnUsingAuto);
final Label outOfSpaceLabel = new Label(indexParaGroup, SWT.NONE);
outOfSpaceLabel.setText(Messages.lblOutOfSpaceWarning);
outOfSpaceLabel.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
indexOutRateCombo = new Combo(indexParaGroup, SWT.BORDER);
indexOutRateCombo.setTextLimit(2);
indexOutRateCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 3, 1));
final Label volumeLabel = new Label(indexParaGroup, SWT.NONE);
volumeLabel.setText(Messages.lblVolSize);
volumeLabel.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
indexVolumeText = new Text(indexParaGroup, SWT.BORDER);
indexVolumeText.setTextLimit(20);
indexVolumeText.setText(GeneralInfoPage.getIntSizeString(initVolumeSize, 1));
final GridData gdDataVolumeText = new GridData(SWT.FILL, SWT.CENTER, true, false, 3, 1);
indexVolumeText.setLayoutData(gdDataVolumeText);
indexVolumeText.addFocusListener(new FocusListener() {
public void focusGained(FocusEvent event) {
indexVolumeText.addModifyListener(SetAutoAddVolumeInfoPage.this);
}
public void focusLost(FocusEvent event) {
indexVolumeText.removeModifyListener(SetAutoAddVolumeInfoPage.this);
}
});
}
Aggregations