use of org.eclipse.swt.events.VerifyListener in project cubrid-manager by CUBRID.
the class IndexTableItemEditor method init.
/**
*
* Initial the table column editor
*
*/
private void init() {
final TableEditor editor = new TableEditor(table);
editor.horizontalAlignment = SWT.LEFT;
editor.grabHorizontal = true;
if (columnEditorType == COLUMN_EDITOR_TYPE_CCOMBO) {
combo = new CCombo(table, SWT.NONE);
combo.setEditable(false);
combo.addListener(SWT.Selection, this);
combo.addListener(SWT.FocusOut, this);
combo.addListener(SWT.Traverse, this);
editor.setEditor(combo, item, column);
//$NON-NLS-1$
combo.add("ASC");
//$NON-NLS-1$
combo.add("DESC");
if (item.getText(column).equals("ASC")) {
//$NON-NLS-1$
combo.select(0);
} else {
combo.select(1);
}
combo.setFocus();
} else if (columnEditorType == COLUMN_EDITOR_TYPE_TEXT) {
text = new Text(table, SWT.MULTI | SWT.WRAP);
text.setTextLimit(10);
text.addListener(SWT.FocusOut, this);
text.addListener(SWT.Traverse, this);
editor.setEditor(text, item, column);
text.setText(item.getText(column));
text.selectAll();
text.setFocus();
text.addVerifyListener(new VerifyListener() {
public void verifyText(VerifyEvent event) {
event.doit = false;
char ch = event.character;
if (Character.isDigit(ch)) {
event.doit = true;
}
if (ch == '\b' || ch == SWT.DEL) {
event.doit = true;
}
}
});
}
}
use of org.eclipse.swt.events.VerifyListener in project cubrid-manager by CUBRID.
the class BrokerParameterDialog method createRefreshComp.
/**
* Creates the refresh composite
*
* @param parent the parent composite
* @return the composite
*/
private Control createRefreshComp(Composite parent) {
Composite refreshComp = new Composite(parent, SWT.None);
refreshComp.setLayout(new GridLayout());
final GridData gdRefreshComp = new GridData(SWT.FILL, SWT.TOP, true, false);
refreshComp.setLayoutData(gdRefreshComp);
final Label tipLbl = new Label(refreshComp, SWT.NONE);
final GridData gdTipLbl = new GridData(SWT.LEFT, SWT.TOP, true, false);
tipLbl.setText(Messages.refreshTitle);
tipLbl.setLayoutData(gdTipLbl);
final Composite radioComp = new Composite(refreshComp, SWT.None);
final GridData gdRadioComp = new GridData(SWT.FILL, SWT.TOP, true, false);
radioComp.setLayoutData(gdRadioComp);
radioComp.setLayout(new GridLayout(3, false));
refreshBtn = new Button(radioComp, SWT.CHECK);
refreshBtn.setText(Messages.refreshOnLbl);
refreshBtn.setSelection(false);
intervalTxt = new Text(radioComp, SWT.BORDER | SWT.RIGHT);
final GridData gdIntervalTxt = new GridData(SWT.FILL, SWT.CENTER, true, false);
intervalTxt.setLayoutData(gdIntervalTxt);
intervalTxt.setText("1");
intervalTxt.setEnabled(false);
final Label secLbl = new Label(radioComp, SWT.NONE);
final GridData gdSecLbl = new GridData(SWT.LEFT, SWT.TOP, true, false);
secLbl.setText(Messages.refreshUnitLbl);
tipLbl.setLayoutData(gdSecLbl);
refreshBtn.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
if (refreshBtn.getSelection()) {
intervalTxt.setEnabled(true);
} else {
intervalTxt.setEnabled(false);
}
}
});
intervalTxt.addVerifyListener(new VerifyListener() {
public void verifyText(VerifyEvent event) {
if (!"".equals(event.text) && !ValidateUtil.isNumber(event.text)) {
event.doit = false;
return;
}
}
});
return refreshComp;
}
use of org.eclipse.swt.events.VerifyListener in project cubrid-manager by CUBRID.
the class ShardGeneralInfoPanel method initial.
private void initial() {
masterShmIdText.addModifyListener(modifyListener);
masterShmIdText.addVerifyListener(new VerifyListener() {
public void verifyText(VerifyEvent event) {
if ("".equals(event.text)) {
return;
}
if (ValidateUtil.isNumber(event.text)) {
event.doit = true;
} else {
event.doit = false;
}
}
});
adminLogFileText.addModifyListener(modifyListener);
}
use of org.eclipse.swt.events.VerifyListener in project cubrid-manager by CUBRID.
the class BrokerParameterPropertyPage method createRefreshComp.
/**
* Creates the refresh Composite
*
* @param parent the parent composite
* @return the composite
*/
private Control createRefreshComp(Composite parent) {
Composite refreshComp = new Composite(parent, SWT.None);
refreshComp.setLayout(new GridLayout());
final GridData gdRefreshComp = new GridData(SWT.FILL, SWT.TOP, true, false);
refreshComp.setLayoutData(gdRefreshComp);
final Label tipLbl = new Label(refreshComp, SWT.NONE);
final GridData gdTipLbl = new GridData(SWT.LEFT, SWT.TOP, true, false);
tipLbl.setText(Messages.refreshTitle);
tipLbl.setLayoutData(gdTipLbl);
final Composite radioComp = new Composite(refreshComp, SWT.None);
final GridData gdRadioComp = new GridData(SWT.FILL, SWT.TOP, true, false);
radioComp.setLayoutData(gdRadioComp);
radioComp.setLayout(new GridLayout(3, false));
refreshBtn = new Button(radioComp, SWT.CHECK);
refreshBtn.setText(Messages.refreshOnLbl);
refreshBtn.setSelection(false);
intervalTxt = new Text(radioComp, SWT.BORDER | SWT.RIGHT);
final GridData gdIntervalTxt = new GridData(SWT.FILL, SWT.CENTER, true, false);
intervalTxt.setLayoutData(gdIntervalTxt);
intervalTxt.setText("1");
intervalTxt.setEnabled(false);
final Label secLbl = new Label(radioComp, SWT.NONE);
final GridData gdSecLbl = new GridData(SWT.LEFT, SWT.TOP, true, false);
secLbl.setText(Messages.refreshUnitLbl);
tipLbl.setLayoutData(gdSecLbl);
refreshBtn.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
if (refreshBtn.getSelection()) {
intervalTxt.setEnabled(true);
} else {
intervalTxt.setEnabled(false);
}
}
});
intervalTxt.addVerifyListener(new VerifyListener() {
public void verifyText(VerifyEvent event) {
if (!"".equals(event.text) && !ValidateUtil.isNumber(event.text)) {
event.doit = false;
return;
}
}
});
return refreshComp;
}
use of org.eclipse.swt.events.VerifyListener in project tesb-studio-se by Talend.
the class ServiceMetadataCustomPropertiesTable method createTableViewer.
private void createTableViewer() {
tableViewer = new TableViewer(table);
tableViewer.setUseHashlookup(true);
tableViewer.setColumnProperties(columnNames);
CellEditor[] editors = new CellEditor[columnNames.length];
TextCellEditor textEditor = new TextCellEditor(table) {
protected Object doGetValue() {
Object value = super.doGetValue();
return null == value || ((String) value).trim().isEmpty() ? COLUMN_PROPERTY_NAME_DEFAULT_VALUE : value;
}
};
((Text) textEditor.getControl()).setTextLimit(64);
((Text) textEditor.getControl()).addVerifyListener(new VerifyListener() {
public void verifyText(VerifyEvent e) {
//$NON-NLS-1$
e.doit = !e.text.equals("\"");
// e.doit = !e.text.trim().isEmpty();
}
});
editors[0] = textEditor;
textEditor = new TextCellEditor(table);
((Text) textEditor.getControl()).setTextLimit(64);
((Text) textEditor.getControl()).addVerifyListener(new VerifyListener() {
public void verifyText(VerifyEvent e) {
//$NON-NLS-1$
e.doit = !e.text.equals("\"");
}
});
editors[1] = textEditor;
tableViewer.setCellEditors(editors);
tableViewer.setCellModifier(new PropertyCellModifier(this));
}
Aggregations