- allow the use of enter key to accept user changes
This commit is contained in:
Heng Sin Low 2009-11-24 08:02:59 +00:00
parent 99f97f488c
commit d541bb4b49
10 changed files with 20 additions and 20 deletions

View File

@ -39,7 +39,7 @@ import org.zkoss.zk.ui.event.Events;
*/ */
public class WAccountEditor extends WEditor implements ContextMenuListener public class WAccountEditor extends WEditor implements ContextMenuListener
{ {
private static final String[] LISTENER_EVENTS = {Events.ON_CLICK, Events.ON_CHANGE}; private static final String[] LISTENER_EVENTS = {Events.ON_CLICK, Events.ON_CHANGE, Events.ON_OK};
private MAccountLookup m_mAccount; private MAccountLookup m_mAccount;
@ -183,7 +183,7 @@ public class WAccountEditor extends WEditor implements ContextMenuListener
public void onEvent(Event event) public void onEvent(Event event)
{ {
if (Events.ON_CHANGE.equals(event.getName())) if (Events.ON_CHANGE.equals(event.getName()) || Events.ON_OK.equals(event.getName()))
{ {
cmd_text(); cmd_text();
} }

View File

@ -41,7 +41,7 @@ import org.zkoss.zk.ui.event.Events;
*/ */
public class WDateEditor extends WEditor implements ContextMenuListener public class WDateEditor extends WEditor implements ContextMenuListener
{ {
private static final String[] LISTENER_EVENTS = {Events.ON_CHANGE}; private static final String[] LISTENER_EVENTS = {Events.ON_CHANGE, Events.ON_OK};
@SuppressWarnings("unused") @SuppressWarnings("unused")
private static final CLogger logger; private static final CLogger logger;
@ -118,7 +118,7 @@ public class WDateEditor extends WEditor implements ContextMenuListener
public void onEvent(Event event) public void onEvent(Event event)
{ {
if (Events.ON_CHANGE.equalsIgnoreCase(event.getName())) if (Events.ON_CHANGE.equalsIgnoreCase(event.getName()) || Events.ON_OK.equalsIgnoreCase(event.getName()))
{ {
Date date = getComponent().getValue(); Date date = getComponent().getValue();
Timestamp newValue = null; Timestamp newValue = null;

View File

@ -32,7 +32,7 @@ import org.zkoss.zk.ui.event.Events;
*/ */
public class WDatetimeEditor extends WEditor implements ContextMenuListener public class WDatetimeEditor extends WEditor implements ContextMenuListener
{ {
private static final String[] LISTENER_EVENTS = {Events.ON_CHANGE}; private static final String[] LISTENER_EVENTS = {Events.ON_CHANGE, Events.ON_OK};
@SuppressWarnings("unused") @SuppressWarnings("unused")
private static final CLogger logger; private static final CLogger logger;
@ -110,7 +110,7 @@ public class WDatetimeEditor extends WEditor implements ContextMenuListener
public void onEvent(Event event) public void onEvent(Event event)
{ {
if (Events.ON_CHANGE.equalsIgnoreCase(event.getName())) if (Events.ON_CHANGE.equalsIgnoreCase(event.getName()) || Events.ON_OK.equalsIgnoreCase(event.getName()))
{ {
Date date = getComponent().getValue(); Date date = getComponent().getValue();
Timestamp newValue = null; Timestamp newValue = null;

View File

@ -29,7 +29,7 @@ import org.zkoss.zk.ui.event.Events;
*/ */
public class WFileDirectoryEditor extends WEditor public class WFileDirectoryEditor extends WEditor
{ {
private static final String[] LISTENER_EVENTS = {Events.ON_CLICK, Events.ON_CHANGE}; private static final String[] LISTENER_EVENTS = {Events.ON_CLICK, Events.ON_CHANGE, Events.ON_OK};
private static final CLogger log = CLogger.getCLogger(WFileDirectoryEditor.class); private static final CLogger log = CLogger.getCLogger(WFileDirectoryEditor.class);
@ -87,7 +87,7 @@ public class WFileDirectoryEditor extends WEditor
public void onEvent(Event event) public void onEvent(Event event)
{ {
if (Events.ON_CHANGE.equals(event.getName())) if (Events.ON_CHANGE.equals(event.getName()) || Events.ON_OK.equals(event.getName()))
{ {
String newValue = getComponent().getText(); String newValue = getComponent().getText();
if (oldValue != null && newValue != null && oldValue.equals(newValue)) { if (oldValue != null && newValue != null && oldValue.equals(newValue)) {

View File

@ -37,7 +37,7 @@ import org.zkoss.zul.Fileupload;
*/ */
public class WFilenameEditor extends WEditor public class WFilenameEditor extends WEditor
{ {
private static final String[] LISTENER_EVENTS = {Events.ON_CLICK, Events.ON_CHANGE}; private static final String[] LISTENER_EVENTS = {Events.ON_CLICK, Events.ON_CHANGE, Events.ON_OK};
private static final CLogger log = CLogger.getCLogger(WFilenameEditor.class); private static final CLogger log = CLogger.getCLogger(WFilenameEditor.class);
@ -95,7 +95,7 @@ public class WFilenameEditor extends WEditor
public void onEvent(Event event) public void onEvent(Event event)
{ {
if (Events.ON_CHANGE.equals(event.getName())) if (Events.ON_CHANGE.equals(event.getName()) || Events.ON_OK.equals(event.getName()))
{ {
String newValue = getComponent().getText(); String newValue = getComponent().getText();
if (oldValue != null && newValue != null && oldValue.equals(newValue)) { if (oldValue != null && newValue != null && oldValue.equals(newValue)) {

View File

@ -44,7 +44,7 @@ import org.zkoss.zk.ui.event.Events;
*/ */
public class WNumberEditor extends WEditor implements ContextMenuListener public class WNumberEditor extends WEditor implements ContextMenuListener
{ {
public static final String[] LISTENER_EVENTS = {Events.ON_CHANGE}; public static final String[] LISTENER_EVENTS = {Events.ON_CHANGE, Events.ON_OK};
public static final int MAX_DISPLAY_LENGTH = 20; public static final int MAX_DISPLAY_LENGTH = 20;
@ -129,7 +129,7 @@ public class WNumberEditor extends WEditor implements ContextMenuListener
*/ */
public void onEvent(Event event) public void onEvent(Event event)
{ {
if (Events.ON_CHANGE.equalsIgnoreCase(event.getName())) if (Events.ON_CHANGE.equalsIgnoreCase(event.getName()) || Events.ON_OK.equalsIgnoreCase(event.getName()))
{ {
BigDecimal newValue = getComponent().getValue(); BigDecimal newValue = getComponent().getValue();
if (oldValue != null && newValue != null && oldValue.equals(newValue)) { if (oldValue != null && newValue != null && oldValue.equals(newValue)) {

View File

@ -39,7 +39,7 @@ import org.zkoss.zk.ui.event.Events;
*/ */
public class WPAttributeEditor extends WEditor implements ContextMenuListener public class WPAttributeEditor extends WEditor implements ContextMenuListener
{ {
private static final String[] LISTENER_EVENTS = {Events.ON_CLICK, Events.ON_CHANGE}; private static final String[] LISTENER_EVENTS = {Events.ON_CLICK, Events.ON_CHANGE, Events.ON_OK};
private static final CLogger log = CLogger.getCLogger(WPAttributeEditor.class); private static final CLogger log = CLogger.getCLogger(WPAttributeEditor.class);
@ -126,7 +126,7 @@ public class WPAttributeEditor extends WEditor implements ContextMenuListener
public void onEvent(Event event) public void onEvent(Event event)
{ {
if (Events.ON_CHANGE.equals(event.getName())) if (Events.ON_CHANGE.equals(event.getName()) || Events.ON_OK.equals(event.getName()))
{ {
String newText = getComponent().getText(); String newText = getComponent().getText();
String oldText = null; String oldText = null;

View File

@ -48,7 +48,7 @@ public class WStringEditor extends WEditor implements ContextMenuListener
{ {
private static final String EDITOR_EVENT = "EDITOR"; private static final String EDITOR_EVENT = "EDITOR";
private static final String[] LISTENER_EVENTS = {Events.ON_CHANGE}; private static final String[] LISTENER_EVENTS = {Events.ON_CHANGE, Events.ON_OK};
private String oldValue; private String oldValue;
@ -168,7 +168,7 @@ public class WStringEditor extends WEditor implements ContextMenuListener
public void onEvent(Event event) public void onEvent(Event event)
{ {
if (Events.ON_CHANGE.equals(event.getName())) if (Events.ON_CHANGE.equals(event.getName()) || Events.ON_OK.equals(event.getName()))
{ {
String newValue = getComponent().getValue(); String newValue = getComponent().getValue();
if (oldValue != null && newValue != null && oldValue.equals(newValue)) { if (oldValue != null && newValue != null && oldValue.equals(newValue)) {

View File

@ -33,7 +33,7 @@ import org.zkoss.zul.Timebox;
*/ */
public class WTimeEditor extends WEditor implements ContextMenuListener public class WTimeEditor extends WEditor implements ContextMenuListener
{ {
private static final String[] LISTENER_EVENTS = {Events.ON_CHANGE}; private static final String[] LISTENER_EVENTS = {Events.ON_CHANGE, Events.ON_OK};
private static final CLogger logger; private static final CLogger logger;
static static
@ -109,7 +109,7 @@ public class WTimeEditor extends WEditor implements ContextMenuListener
public void onEvent(Event event) public void onEvent(Event event)
{ {
if (Events.ON_CHANGE.equalsIgnoreCase(event.getName())) if (Events.ON_CHANGE.equalsIgnoreCase(event.getName()) || Events.ON_OK.equalsIgnoreCase(event.getName()))
{ {
Date date = getComponent().getValue(); Date date = getComponent().getValue();
Timestamp newValue = null; Timestamp newValue = null;

View File

@ -30,7 +30,7 @@ import org.zkoss.zk.ui.event.Events;
public class WUrlEditor extends WEditor implements ContextMenuListener public class WUrlEditor extends WEditor implements ContextMenuListener
{ {
private static final String[] LISTENER_EVENTS = {Events.ON_CLICK, Events.ON_CHANGE}; private static final String[] LISTENER_EVENTS = {Events.ON_CLICK, Events.ON_CHANGE, Events.ON_OK};
private String oldValue; private String oldValue;
private WEditorPopupMenu popupMenu; private WEditorPopupMenu popupMenu;
@ -96,7 +96,7 @@ public class WUrlEditor extends WEditor implements ContextMenuListener
public void onEvent(Event event) public void onEvent(Event event)
{ {
if (Events.ON_CHANGE.equals(event.getName())) if (Events.ON_CHANGE.equals(event.getName()) || Events.ON_OK.equals(event.getName()))
{ {
String newValue = getComponent().getText(); String newValue = getComponent().getText();
if (oldValue != null && newValue != null && oldValue.equals(newValue)) { if (oldValue != null && newValue != null && oldValue.equals(newValue)) {