use of org.eclipse.swt.events.ModifyEvent in project cubrid-manager by CUBRID.
the class AddVolumeDialog method createDialogArea.
/**
* @see org.eclipse.jface.dialogs.TitleAreaDialog#createDialogArea(org.eclipse.swt.widgets.Composite)
* @param parent The parent composite to contain the dialog area
* @return the dialog area control
*/
protected Control createDialogArea(Composite parent) {
Composite parentComp = (Composite) super.createDialogArea(parent);
setTitle(Messages.dialogTitle);
setMessage(Messages.dialogMsg);
final Composite composite = new Composite(parentComp, SWT.RESIZE);
final GridData gdComposite = new GridData(SWT.FILL, SWT.CENTER, true, false);
gdComposite.widthHint = 500;
composite.setLayoutData(gdComposite);
final GridLayout gridLayout = new GridLayout();
gridLayout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
gridLayout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
gridLayout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
gridLayout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
composite.setLayout(gridLayout);
final Group group = new Group(composite, SWT.NONE);
group.setLayoutData(new GridData(SWT.FILL, SWT.DEFAULT, true, false));
final GridLayout gdGroup = new GridLayout();
gdGroup.verticalSpacing = 0;
group.setLayout(gdGroup);
final Composite pathComp = new Composite(group, SWT.RESIZE);
final GridLayout pathLayout = new GridLayout(3, false);
pathLayout.marginBottom = 0;
final GridData gdPathComp = new GridData(SWT.FILL, SWT.CENTER, true, false);
pathComp.setLayout(pathLayout);
pathComp.setLayoutData(gdPathComp);
final GridData gdLabel = new GridData(SWT.CENTER, SWT.CENTER, false, false, 1, 1);
gdLabel.widthHint = 100;
final Label pathLbl = new Label(pathComp, SWT.NONE);
pathLbl.setText(Messages.pathLblName);
pathLbl.setLayoutData(gdLabel);
pathText = new Text(pathComp, SWT.BORDER);
final GridData gdPathText = new GridData(SWT.FILL, SWT.CENTER, true, false);
pathText.setLayoutData(gdPathText);
pathText.setToolTipText(Messages.pathToolTip);
Button selectTargetDirBtn = new Button(pathComp, SWT.NONE);
selectTargetDirBtn.setText(Messages.btnBrowse);
selectTargetDirBtn.setLayoutData(CommonUITool.createGridData(1, 1, 80, -1));
selectTargetDirBtn.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
DirectoryDialog dlg = new DirectoryDialog(getShell());
String backupDir = pathText.getText();
if (backupDir != null && backupDir.trim().length() > 0) {
dlg.setFilterPath(backupDir);
}
dlg.setText(Messages.msgSelectDir);
dlg.setMessage(Messages.msgSelectDir);
String dir = dlg.open();
if (dir != null) {
pathText.setText(dir);
}
}
});
ServerInfo serverInfo = selection.getServer().getServerInfo();
if (serverInfo != null && !serverInfo.isLocalServer()) {
selectTargetDirBtn.setEnabled(false);
}
final Composite purpComp = new Composite(group, SWT.RESIZE);
final GridLayout purpLayout = new GridLayout(2, false);
purpLayout.marginTop = 0;
purpLayout.verticalSpacing = 10;
final GridData gdPurtComp = new GridData(SWT.FILL, SWT.CENTER, true, false);
purpComp.setLayout(purpLayout);
purpComp.setLayoutData(gdPurtComp);
final Label purposeLbl = new Label(purpComp, SWT.NONE);
purposeLbl.setText(Messages.purposeLbllName);
purposeLbl.setLayoutData(gdLabel);
purposeCombo = new Combo(purpComp, SWT.BORDER | SWT.RIGHT | SWT.READ_ONLY);
if (purposeEnable) {
purposeCombo.setEnabled(true);
} else {
purposeCombo.setEnabled(false);
}
final GridData gdPurposeText = new GridData(SWT.FILL, SWT.CENTER, true, false);
purposeCombo.setLayoutData(gdPurposeText);
purposeCombo.setItems(itemsOfPurpose);
final Label volumeSizeLbl = new Label(purpComp, SWT.NONE);
volumeSizeLbl.setText(Messages.volumeSizeLblName);
volumeSizeLbl.setLayoutData(gdLabel);
volumeSizetext = new Text(purpComp, SWT.BORDER | SWT.RIGHT);
final GridData gdVolumeSizetext = new GridData(SWT.FILL, SWT.CENTER, true, false);
volumeSizetext.setLayoutData(gdVolumeSizetext);
volumeSizetext.setToolTipText(Messages.volumeSizeToolTip);
/*Initial the volume size*/
String volumeSize = ConfConstants.DEFAULT_DATA_VOLUME_SIZE;
String configVolumeSize = CompatibleUtil.getConfigGenericVolumeSize(selection.getServer().getServerInfo(), null);
if (!StringUtil.isEmpty(configVolumeSize)) {
Long bytes = StringUtil.getByteNumber(configVolumeSize);
if (bytes > -1) {
double value = StringUtil.convertToM(bytes);
NumberFormat nf = NumberFormat.getInstance();
nf.setGroupingUsed(false);
nf.setMaximumFractionDigits(3);
nf.setMinimumFractionDigits(3);
volumeSize = nf.format(value);
}
}
volumeSizetext.setText(volumeSize);
volumeSizetext.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
verify();
}
});
// Sets the initial value
pathText.setText(getAddVolumeStatusInfo.getVolpath());
purposeCombo.setText(purpose);
// Sets listener
pathText.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent event) {
verify();
}
});
return parentComp;
}
use of org.eclipse.swt.events.ModifyEvent in project cubrid-manager by CUBRID.
the class ExportConfigDialog method createFileComp.
/**
* Create the file Composite
*
* @param parent the Composite
*/
private void createFileComp(final Composite parent) {
Composite textComp = new Composite(parent, SWT.NONE);
{
textComp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
final GridLayout gridLayout = new GridLayout();
gridLayout.numColumns = 3;
textComp.setLayout(gridLayout);
}
Label lblExportFile = new Label(textComp, SWT.NONE);
lblExportFile.setText(Messages.lblExportFilePath);
filePathText = new Text(textComp, SWT.BORDER);
if (defaultFilePath == null || "".equals(defaultFilePath)) {
filePathText.setEnabled(false);
} else {
filePathText.setText(defaultFilePath);
filePathText.setEnabled(true);
}
filePathText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
filePathText.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent event) {
validate();
}
});
Button btnOpen = new Button(textComp, SWT.NONE);
{
btnOpen.setText(Messages.btnBrowse);
btnOpen.setLayoutData(CommonUITool.createGridData(1, 1, 66, -1));
btnOpen.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
File savedDirFile = getSavedDir(getShell());
if (savedDirFile != null) {
filePathText.setText(savedDirFile.getAbsolutePath());
}
}
});
}
final Label fileNameLabel = new Label(textComp, SWT.NONE);
fileNameLabel.setText(Messages.lblExportFileName);
fileNameText = new Text(textComp, SWT.BORDER);
{
fileNameText.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 2, 1, -1, -1));
if (defaultFileName != null) {
fileNameText.setText(defaultFileName);
}
fileNameText.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent event) {
validate();
}
});
}
final Label fileTypeLabel = new Label(textComp, SWT.NONE);
fileTypeLabel.setText(Messages.lblExportFileType);
fileTypeCombo = new Combo(textComp, SWT.NONE | SWT.READ_ONLY);
{
fileTypeCombo.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 2, 1, -1, -1));
fileTypeCombo.setItems(new String[] { Messages.bind(Messages.confFileType, "(*.conf)"), Messages.bind(Messages.txtFileType, "(*.txt)") });
fileTypeCombo.select(0);
fileTypeCombo.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent event) {
validate();
}
});
}
if (defaultFileExtName != null) {
if (".conf".equals(defaultFileExtName)) {
fileTypeCombo.select(0);
} else if (".txt".equals(defaultFileExtName)) {
fileTypeCombo.select(1);
} else {
fileNameText.setText(defaultFileExtName);
}
}
final Label fileCharsetLabel = new Label(textComp, SWT.NONE);
fileCharsetLabel.setText(Messages.lblFileCharset);
fileCharsetCombo = new Combo(textComp, SWT.NONE);
{
fileCharsetCombo.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 2, 1, -1, -1));
fileCharsetCombo.setItems(QueryOptions.getAllCharset(null));
if (outputFileCharset == null || "".equals(outputFileCharset)) {
String charset = StringUtil.getDefaultCharset();
if (charset != null) {
fileCharsetCombo.setText(charset);
}
} else {
fileCharsetCombo.setText(outputFileCharset);
}
fileCharsetCombo.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent event) {
validate();
}
});
}
}
use of org.eclipse.swt.events.ModifyEvent in project cubrid-manager by CUBRID.
the class RenameHostDialog method createDialogArea.
/**
* @see org.eclipse.jface.dialogs.TitleAreaDialog#createDialogArea(org.eclipse.swt.widgets.Composite)
* @param parent The parent composite to contain the dialog area
* @return the dialog area control
*/
protected Control createDialogArea(Composite parent) {
Composite parentComp = (Composite) super.createDialogArea(parent);
Composite composite = new Composite(parentComp, SWT.NONE);
composite.setLayoutData(new GridData(GridData.FILL_BOTH));
GridLayout layout = new GridLayout();
layout.numColumns = 3;
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);
Label label1 = new Label(composite, SWT.LEFT);
label1.setText(Messages.lblName);
GridData data = new GridData();
data.widthHint = 60;
data.horizontalSpan = 1;
data.verticalSpan = 1;
label1.setLayoutData(data);
newNameText = new Text(composite, SWT.BORDER);
data = new GridData();
data.horizontalSpan = 2;
data.verticalSpan = 1;
data.grabExcessHorizontalSpace = true;
data.verticalAlignment = GridData.FILL;
data.horizontalAlignment = GridData.FILL;
newNameText.setLayoutData(data);
newNameText.setText(server.getName());
newNameText.selectAll();
newNameText.setFocus();
newNameText.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent event) {
setErrorMessage(null);
getButton(IDialogConstants.OK_ID).setEnabled(false);
if (!valid()) {
return;
}
getButton(IDialogConstants.OK_ID).setEnabled(true);
}
});
newNameText.addListener(SWT.KeyDown, new Listener() {
public void handleEvent(Event e) {
if (e.type == SWT.KeyDown && e.character == SWT.CR) {
buttonPressed(IDialogConstants.OK_ID);
}
}
});
setTitle(Messages.bind(Messages.renameMSGTitle, server.getName()));
setMessage(Messages.bind(Messages.renameDialogMSG, server.getName()));
return parent;
}
use of org.eclipse.swt.events.ModifyEvent 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.events.ModifyEvent 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;
}
Aggregations