use of de.jaret.util.ui.datechooser.IFieldIdentifier in project translationstudio8 by heartsome.
the class DateCellEditor method createControl.
/**
* Create the chooser control.
*
* @param table parent table.
*/
private void createControl(JaretTable table) {
_table = table;
if (_chooser == null) {
_chooser = new DateChooser(table, SWT.NULL);
// TODO locale dependent
IFieldIdentifier fi = new SimpleFieldIdentifier(".", new int[] { Calendar.DAY_OF_MONTH, Calendar.MONTH, Calendar.YEAR });
_chooser.setFieldIdentifier(fi);
_chooser.setSelectAllOnFocusGained(false);
_chooser.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
_chooser.addFocusListener(this);
_chooser.addDateChooserListener(this);
_chooser.getTextField().addKeyListener(new KeyListener() {
public void keyPressed(KeyEvent event) {
if (event.keyCode == SWT.TAB) {
_chooser.validateInput();
stopEditing(true);
// do not further process
event.doit = false;
_table.forceFocus();
_table.focusRight();
} else if (event.keyCode == SWT.CR) {
_chooser.validateInput();
stopEditing(true);
// do not further process
event.doit = false;
_table.forceFocus();
_table.focusDown();
} else if (event.keyCode == SWT.ESC) {
stopEditing(false);
restoreOldVal();
// do not further process
event.doit = false;
_table.forceFocus();
}
}
public void keyReleased(KeyEvent e) {
}
});
// add a traverse listener so the TAB-key won't traverse the focus out of the table
_chooser.getTextField().addTraverseListener(new TraverseListener() {
public void keyTraversed(TraverseEvent e) {
e.doit = false;
}
});
}
}
Aggregations