use of org.eclipse.swt.events.ModifyEvent in project cubrid-manager by CUBRID.
the class AddQueryRecordDialog 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.lblQueryName);
label1.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
String queryPlanName = Messages.lblQueryTuningName + " ";
if (newFlag) {
queryPlanName += QueryRecord.DATE_FORMAT.format(new Date());
} else {
queryPlanName += queryRecord.getTimeStamp();
}
newText = new Text(composite, SWT.BORDER);
newText.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 1, 1, -1, -1));
newText.setText(queryPlanName);
newText.selectAll();
newText.setFocus();
newText.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent event) {
validate();
}
});
newText.addListener(SWT.KeyDown, new Listener() {
public void handleEvent(Event e) {
if (e.type == SWT.KeyDown && e.character == SWT.CR) {
buttonPressed(IDialogConstants.OK_ID);
}
}
});
if (newFlag) {
setTitle(Messages.subTitleAddQueryRecord);
} else {
String msg = Messages.bind(Messages.subTitleRenameQueryRecord, queryRecord.getName());
setTitle(msg);
}
return parent;
}
use of org.eclipse.swt.events.ModifyEvent in project cubrid-manager by CUBRID.
the class BrokerParameterDialog method createDialogArea.
/**
* Create the dialog area content
*
* @param parent the parent composite
* @return the composite
*/
protected Control createDialogArea(Composite parent) {
Composite parentComp = (Composite) super.createDialogArea(parent);
Composite composite = new Composite(parentComp, SWT.NONE);
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);
GridData gdComposite = new GridData(SWT.FILL, SWT.FILL, true, true);
gdComposite.heightHint = 440;
composite.setLayoutData(gdComposite);
Composite nameComp = new Composite(composite, SWT.NONE);
nameComp.setLayout(new GridLayout(2, false));
nameComp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
final Label brokerNameLabel = new Label(nameComp, SWT.NONE);
brokerNameLabel.setText(Messages.brokerNameLbl);
nameTxt = new Text(nameComp, SWT.BORDER);
final GridData gdNameTxt = new GridData(SWT.FILL, SWT.CENTER, true, false);
nameTxt.setLayoutData(gdNameTxt);
TabFolder tabFolder = new TabFolder(composite, SWT.NONE);
final GridData gdTabFolder = new GridData(SWT.FILL, SWT.FILL, true, true);
tabFolder.setLayoutData(gdTabFolder);
tabFolder.setLayout(new GridLayout());
TabItem item = new TabItem(tabFolder, SWT.NONE);
item.setText(Messages.paraParameterNameOfTap);
item.setControl(createParamComp(tabFolder));
item = new TabItem(tabFolder, SWT.NONE);
item.setText(Messages.paraRefreshNameOfTap);
item.setControl(createRefreshComp(tabFolder));
initialize();
if (operation == AddEditType.ADD) {
setTitle(Messages.addTitle);
setMessage(Messages.addMsg);
nameTxt.setEnabled(true);
getShell().setText(Messages.shellAddTitle);
brokerMap = new HashMap<String, String>();
isOkenable[0] = false;
isOkenable[1] = false;
isOkenable[2] = false;
} else {
editTitle = Messages.bind(Messages.editTitle, brokerMap.get("0"));
editMsg = Messages.bind(Messages.editMsg, brokerMap.get("0"));
setTitle(editTitle);
setMessage(editMsg);
getShell().setText(Messages.shellEditTitle);
nameTxt.setEnabled(false);
isOkenable[0] = true;
isOkenable[1] = true;
isOkenable[2] = true;
}
nameTxt.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent event) {
String content = ((Text) event.widget).getText().trim();
if (content.length() == 0) {
isOkenable[0] = false;
} else if (content.equalsIgnoreCase("broker")) {
setErrorMessage(Messages.errBrokerName);
isOkenable[0] = false;
} else {
boolean hasName = false;
if (brokerLst != null) {
for (Map<String, String> brokerInfo : brokerLst) {
if (content.equalsIgnoreCase(brokerInfo.get("0"))) {
hasName = true;
break;
}
}
}
if (hasName) {
isOkenable[0] = false;
setErrorMessage(Messages.errReduplicateName);
} else {
isOkenable[0] = true;
setErrorMessage(null);
}
}
enableOk();
}
});
return parentComp;
}
use of org.eclipse.swt.events.ModifyEvent in project cubrid-manager by CUBRID.
the class BrokersParameterPropertyPage method initial.
/**
* Initializes the parameters of this dialog
*/
private void initial() {
oldConfParaMap = node.getServer().getServerInfo().getBrokerConfParaMap();
Map<String, String> map = null;
if (oldConfParaMap != null) {
map = oldConfParaMap.get(ConfConstants.BROKER_SECTION_NAME);
}
if (map != null) {
Iterator<Map.Entry<String, String>> it = map.entrySet().iterator();
Map<String, String> defaultMap = new HashMap<String, String>();
defaultValueMap.put(ConfConstants.BROKER_SECTION_NAME, defaultMap);
while (it.hasNext()) {
Map.Entry<String, String> entry = it.next();
defaultMap.put(entry.getKey(), entry.getValue());
}
if (null == defaultMap.get(ConfConstants.MASTER_SHM_ID)) {
masterShmIdTxt.setText("");
} else {
masterShmIdTxt.setText(defaultMap.get(ConfConstants.MASTER_SHM_ID));
}
if (null == defaultMap.get(ConfConstants.ADMIN_LOG_FILE)) {
adminlogTxt.setText("");
} else {
adminlogTxt.setText(defaultMap.get(ConfConstants.ADMIN_LOG_FILE));
}
if (isSupportEnableAccessControl) {
if (null == defaultMap.get(ConfConstants.ENABLE_ACCESS_CONTROL)) {
enableAccessControlCombo.select(1);
} else {
enableAccessControlCombo.setText(defaultMap.get(ConfConstants.ENABLE_ACCESS_CONTROL));
}
if (null == defaultMap.get(ConfConstants.ACCESS_CONTROL_FILE)) {
accessControlFileTxt.setText("");
} else {
accessControlFileTxt.setText(defaultMap.get(ConfConstants.ACCESS_CONTROL_FILE));
}
}
}
brokerList = new ArrayList<Map<String, String>>();
if (oldConfParaMap == null) {
return;
}
// set the broker list
String[][] supportedBrokerParams = ConfConstants.getBrokerParameters(serverInfo);
for (Map.Entry<String, Map<String, String>> brokerPara : oldConfParaMap.entrySet()) {
if (brokerPara.getKey().equals(ConfConstants.BROKER_SECTION_NAME)) {
continue;
}
String name = brokerPara.getKey();
Map<String, String> pair = brokerPara.getValue();
String port = pair.get(ConfConstants.BROKER_PORT);
Map<String, String> dataMap = new HashMap<String, String>();
dataMap.put("0", name);
dataMap.put("1", port);
for (int i = 0; i < supportedBrokerParams.length; i++) {
String paramKey = supportedBrokerParams[i][0];
String value = pair.get(paramKey);
dataMap.put(paramKey, value);
}
brokerList.add(dataMap);
}
brokersTableViewer.setInput(brokerList);
// initialize refresh
BrokerIntervalSettingManager manager = BrokerIntervalSettingManager.getInstance();
serverName = node.getServer().getLabel();
brokerEnvName = node.getLabel();
BrokerIntervalSetting setting = manager.getBrokerIntervalSetting(serverName, brokerEnvName);
oldIntervalSettingMap = new HashMap<String, BrokerIntervalSetting>();
newIntervalSettingMap = new HashMap<String, BrokerIntervalSetting>();
if (null != setting) {
boolean isOn = setting.isOn();
refreshBtn.setSelection(isOn);
intervalTxt.setText(setting.getInterval());
intervalTxt.setEnabled(isOn);
oldIntervalSettingMap.put(serverName + "_" + brokerEnvName, setting);
}
for (Map<String, String> dataMap : brokerList) {
String brokername = dataMap.get("0");
setting = manager.getBrokerIntervalSetting(serverName, brokername);
if (null != setting) {
oldIntervalSettingMap.put(serverName + "_" + brokername, setting);
}
}
for (Map.Entry<String, BrokerIntervalSetting> entry : oldIntervalSettingMap.entrySet()) {
String aSettingName = entry.getKey();
BrokerIntervalSetting aSetting = new BrokerIntervalSetting();
String aBrokerName = entry.getValue().getBrokerName();
String aServerName = entry.getValue().getServerName();
String aInterval = entry.getValue().getInterval();
boolean aOn = entry.getValue().isOn();
aSetting.setBrokerName(aBrokerName);
aSetting.setServerName(aServerName);
aSetting.setInterval(aInterval);
aSetting.setOn(aOn);
newIntervalSettingMap.put(aSettingName, aSetting);
}
// add Listener
refreshBtn.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
BrokerIntervalSetting brokerEnvSetting = newIntervalSettingMap.get(serverName + "_" + brokerEnvName);
if (refreshBtn.getSelection()) {
intervalTxt.setEnabled(true);
brokerEnvSetting.setOn(true);
} else {
intervalTxt.setEnabled(false);
brokerEnvSetting.setOn(false);
}
}
});
intervalTxt.addVerifyListener(new VerifyListener() {
public void verifyText(VerifyEvent event) {
if (!"".equals(event.text) && !ValidateUtil.isNumber(event.text)) {
event.doit = false;
return;
}
}
});
intervalTxt.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent event) {
String newInterval = intervalTxt.getText().trim();
BrokerIntervalSetting brokerEnvSetting = newIntervalSettingMap.get(serverName + "_" + brokerEnvName);
brokerEnvSetting.setInterval(newInterval);
}
});
}
use of org.eclipse.swt.events.ModifyEvent in project cubrid-manager by CUBRID.
the class BrokerLogTopMergeDialog method createDialogArea.
protected Control createDialogArea(Composite parent) {
getShell().setText(Messages.brokerLogTopMergeDialogTitle);
setTitle(Messages.brokerLogTopMergeDialogTitle);
setMessage(Messages.brokerLogTopMergeDialogMessages);
Composite comp = new Composite(parent, SWT.BORDER);
comp.setLayoutData(new GridData(GridData.FILL_BOTH));
comp.setLayout(new GridLayout(3, false));
Label qLabel = new Label(comp, SWT.NONE);
qLabel.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
qLabel.setText(Messages.brokerLogTopMergeQLabel);
qText = new Text(comp, SWT.BORDER | SWT.READ_ONLY);
GridData text1Gd = new GridData(SWT.FILL, SWT.CENTER, true, false);
text1Gd.grabExcessHorizontalSpace = true;
qText.setLayoutData(text1Gd);
Button qButton = new Button(comp, SWT.NONE);
qButton.setText(Messages.brokerLogTopMergeOpenBtn);
qButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(final SelectionEvent event) {
final FileDialog fileDialog = new FileDialog(PlatformUI.getWorkbench().getDisplay().getActiveShell(), SWT.SINGLE);
fileDialog.setFilterPath(qText.getText());
fileDialog.setFilterExtensions(new String[] { "*.q" });
fileDialog.setFilterNames(new String[] { "*.q" });
final String fileTmp = fileDialog.open();
if (fileTmp == null) {
return;
}
qText.setText(fileTmp);
validate();
}
});
Label resLabel = new Label(comp, SWT.NONE);
resLabel.setText(Messages.brokerLogTopMergeResLabel);
resLabel.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
resText = new Text(comp, SWT.BORDER | SWT.READ_ONLY);
GridData resTextGd = new GridData(SWT.FILL, SWT.CENTER, true, false);
resTextGd.grabExcessHorizontalSpace = true;
resText.setLayoutData(resTextGd);
Button resButton = new Button(comp, SWT.NONE);
resButton.setText(Messages.brokerLogTopMergeOpenBtn);
resButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(final SelectionEvent event) {
final FileDialog fileDialog = new FileDialog(PlatformUI.getWorkbench().getDisplay().getActiveShell(), SWT.SINGLE);
fileDialog.setFilterPath(resText.getText());
fileDialog.setFilterExtensions(new String[] { "*.res" });
fileDialog.setFilterNames(new String[] { "*.res" });
final String fileTmp = fileDialog.open();
if (fileTmp == null) {
return;
}
resText.setText(fileTmp);
validate();
}
});
Label exlPathLabel = new Label(comp, SWT.NONE);
exlPathLabel.setText(Messages.brokerLogTopMergeExcelPathLabel);
exlPathLabel.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
exlPathText = new Text(comp, SWT.BORDER | SWT.READ_ONLY);
GridData exlTextGd = new GridData(SWT.FILL, SWT.CENTER, true, false);
exlTextGd.grabExcessHorizontalSpace = true;
exlPathText.setLayoutData(exlTextGd);
Button exlButton = new Button(comp, SWT.NONE);
exlButton.setText(Messages.brokerLogTopMergeOpenBtn);
exlButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(final SelectionEvent event) {
DirectoryDialog dialog = new DirectoryDialog(PlatformUI.getWorkbench().getDisplay().getActiveShell());
dialog.setFilterPath(exlPathText.getText());
String dir = dialog.open();
if (dir != null) {
if (!dir.endsWith(File.separator)) {
dir += File.separator;
}
exlPathText.setText(dir);
excelFullPathText.setText(dir + exlNameText.getText() + ".xls");
}
validate();
}
});
new Label(comp, SWT.NONE).setText(Messages.brokerLogTopMergeExcelNameLabel);
exlNameText = new Text(comp, SWT.BORDER);
exlNameText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
exlNameText.setText("log_top_merge");
exlNameText.addModifyListener(new ModifyListener() {
public void modifyText(final ModifyEvent event) {
excelFullPathText.setText(exlPathText.getText() + exlNameText.getText() + ".xls");
validate();
}
});
new Label(comp, SWT.NONE);
new Label(comp, SWT.NONE).setText(Messages.brokerLogTopMergeExcelFullNameLabel);
excelFullPathText = new Text(comp, SWT.READ_ONLY | SWT.BORDER);
excelFullPathText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
excelFullPathText.setText(exlPathText.getText() + exlNameText.getText() + ".xls");
new Label(comp, SWT.NONE);
new Label(comp, SWT.NONE).setText(com.cubrid.common.ui.cubrid.table.Messages.lblFileCharset);
Composite paramComp = new Composite(comp, SWT.NONE);
GridData paramCompGd = new GridData(GridData.FILL_HORIZONTAL);
paramCompGd.horizontalSpan = 2;
paramComp.setLayoutData(paramCompGd);
paramComp.setLayout(new GridLayout(3, false));
fileCharsetCombo = new Combo(paramComp, SWT.NONE);
{
GridData gridData = new GridData(GridData.BEGINNING);
fileCharsetCombo.setLayoutData(gridData);
fileCharsetCombo.setItems(QueryOptions.getAllCharset(null));
fileCharsetCombo.select(0);
}
new Label(paramComp, SWT.NONE).setText(Messages.brokerLogTopMergePartionLineLabel);
lineCountspinner = new Spinner(paramComp, SWT.BORDER | SWT.LEFT);
lineCountspinner.setValues(3000, 1000, 10000, 0, 1000, 1000);
lineCountspinner.setToolTipText(Messages.brokerLogTopMergePartionLineDescription);
return parent;
}
use of org.eclipse.swt.events.ModifyEvent in project cubrid-manager by CUBRID.
the class GroupEditDialog method createGroupList.
/**
* Create group list composite.
*
* @param parentComp parent composite.
*/
private void createGroupList(Composite parentComp) {
Composite groupName = new Composite(parentComp, SWT.NONE);
{
groupName.setLayout(new GridLayout());
groupName.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
Label btnSort = new Label(groupName, SWT.LEFT);
btnSort.setText(Messages.labelGroupName);
txtGroupName = new Text(groupName, SWT.LEFT | SWT.BORDER);
txtGroupName.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
txtGroupName.setText("");
txtGroupName.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent event) {
setButtonStatus();
}
});
}
Composite group1 = new Composite(parentComp, SWT.NONE);
{
group1.setLayout(new GridLayout(3, false));
group1.setLayoutData(new GridData(GridData.FILL_BOTH));
allItemList = new List(group1, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL);
{
allItemList.setLayoutData(new GridData(GridData.FILL_BOTH));
allItemList.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
setButtonStatus();
}
});
}
createManagerButtons(group1);
groupItemList = new List(group1, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL);
{
groupItemList.setLayoutData(new GridData(GridData.FILL_BOTH));
groupItemList.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
setButtonStatus();
}
});
}
}
}
Aggregations