List of usage examples for com.google.gwt.user.client.ui KeyboardListener KEY_ENTER
int KEY_ENTER
To view the source code for com.google.gwt.user.client.ui KeyboardListener KEY_ENTER.
Click Source Link
From source file:ca.upei.ic.timetable.client.FindCourseView.java
License:Apache License
public FindCourseView(FindCourseViewController controller) { controller_ = controller;// w w w . jav a 2 s . c o m // set up the dialog box dialogBox_ = new DialogBox(false, true); // autohide = false, modal = true dialogBox_.setAnimationEnabled(true); dialogBox_.setText("Find Courses..."); // i have a horizontal panel HorizontalPanel filterPanel = new HorizontalPanel(); // i have a level flex table levelTable_ = controller_.getLevelModel().getWidget(); departmentTable_ = controller_.getDepartmentModel().getWidget(); semesterTable_ = controller_.getSemesterModel().getWidget(); startTimeWidget_ = controller_.getStartTimeModel().getWidget(); // button panel HorizontalPanel buttonPanel = new HorizontalPanel(); buttonPanel.setHorizontalAlignment(HasAlignment.ALIGN_RIGHT); // i have an OK button final Button okButton = new Button("Search"); okButton.addClickListener(new ClickListener() { public void onClick(Widget sender) { // search and close the dialog controller_.search(); hide(); } }); okButton.addKeyboardListener(new KeyboardListener() { public void onKeyDown(Widget sender, char keyCode, int modifiers) { } public void onKeyPress(Widget sender, char keyCode, int modifiers) { } public void onKeyUp(Widget sender, char keyCode, int modifiers) { if (keyCode == KeyboardListener.KEY_ENTER) { okButton.click(); } } }); final Button cancelButton = new Button("Cancel"); cancelButton.addClickListener(new ClickListener() { public void onClick(Widget sender) { hide(); } }); cancelButton.addKeyboardListener(new KeyboardListener() { public void onKeyDown(Widget sender, char keyCode, int modifiers) { } public void onKeyPress(Widget sender, char keyCode, int modifiers) { } public void onKeyUp(Widget sender, char keyCode, int modifiers) { if (keyCode == KeyboardListener.KEY_ESCAPE) cancelButton.click(); } }); SimplePanel empty = new SimplePanel(); empty.setWidth("230px"); buttonPanel.add(empty); buttonPanel.add(cancelButton); buttonPanel.add(okButton); buttonPanel.setSpacing(5); buttonPanel.setWidth("485px"); // add the panel to the dialog box dialogBox_.add(PanelUtils.verticalPanel(PanelUtils.horizontalPanel( PanelUtils.verticalPanel(PanelUtils.scrollPanel(levelTable_, 250, 180), PanelUtils.scrollPanel(semesterTable_, 250, 120), PanelUtils.scrollPanel(startTimeWidget_, 250, 30)), PanelUtils.scrollPanel(departmentTable_, 250, 320)), buttonPanel)); dialogBox_.setPopupPosition(240, 0); }
From source file:cc.alcina.framework.gwt.client.gwittir.widget.PasswordTextBox.java
License:Apache License
/** Creates a new instance of TextBox */ @SuppressWarnings("unchecked") public PasswordTextBox(final boolean updateOnKeypress) { final PasswordTextBox instance = this; old = base.getText();//from w ww . j a v a 2s .c om this.setComparator(SimpleComparator.INSTANCE); if (updateOnKeypress) { this.addKeyboardListener(new KeyboardListener() { public void onKeyDown(Widget sender, char keyCode, int modifiers) { } public void onKeyPress(Widget sender, char keyCode, int modifiers) { changes.firePropertyChange("value", old, getValue()); old = (String) getValue(); } public void onKeyUp(Widget sender, char keyCode, int modifiers) { } }); } else { this.addKeyboardListener(new KeyboardListener() { public void onKeyDown(Widget sender, char keyCode, int modifiers) { } public void onKeyPress(Widget sender, char keyCode, int modifiers) { if (keyCode == KeyboardListener.KEY_ENTER) { setFocus(false); setFocus(true); } } public void onKeyUp(Widget sender, char keyCode, int modifiers) { } }); } this.base.addChangeListener(new ChangeListener() { public void onChange(Widget sender) { changes.firePropertyChange("value", old, getValue()); old = (String) getValue(); changeListeners.fireChange(instance); } }); super.initWidget(this.base); }
From source file:client.template.dialog.ErrorDialog.java
License:Open Source License
@Override public boolean onKeyDownPreview(final char key, final int modifiers) { switch (key) { case KeyboardListener.KEY_ENTER: case KeyboardListener.KEY_ESCAPE: this.hide(); break;/*from w ww . jav a 2s. c o m*/ } return true; }
From source file:client.template.dialog.LoginDialog.java
License:Open Source License
@Override public boolean onKeyDownPreview(final char key, final int modifiers) { switch (key) { case KeyboardListener.KEY_ENTER: this.logIn(); break;// w w w.j a v a 2 s. co m case KeyboardListener.KEY_ESCAPE: this.hide(); break; } return true; }
From source file:com.audata.client.admin.SetPasswordDialog.java
License:Open Source License
/** * Handles users pressing ENTER to submit the form */// www . j a v a2s. c om public boolean onKeyPressPreview(char key, int modifiers) { if (key == KeyboardListener.KEY_ENTER) { onClick(this.setButton); } return true; }
From source file:com.audata.client.authentication.LoginDialog.java
License:Open Source License
/** * Handles users pressing ENTER to submit the form *//*from w w w . ja v a 2 s . com*/ public boolean onKeyPressPreview(char key, int modifiers) { if (key == KeyboardListener.KEY_ENTER) { onClick(this.loginButton); return false; } else { return true; } }
From source file:com.audata.client.feedback.SimpleDialog.java
License:Open Source License
/** * Handles users pressing ENTER to submit the form *///from w ww.j ava 2 s. co m public boolean onKeyPressPreview(char key, int modifiers) { if ((key == KeyboardListener.KEY_ENTER) && (this.type == SimpleDialog.TYPE_ERROR || this.type == SimpleDialog.TYPE_MESSAGE)) { onClick(this.close); } return true; }
From source file:com.audata.client.rapidbooking.RapidBookingDialog.java
License:Open Source License
public boolean onKeyPressPreview(char key, int modifiers) { if (key == KeyboardListener.KEY_ENTER) { onClick(this.okButton); return false; } else {// w w w .java2s. co m return true; } }
From source file:com.audata.client.record.RecNumberDialog.java
License:Open Source License
/** * Handles users pressing ENTER to submit the form *//*ww w . java 2 s . c o m*/ public boolean onKeyPressPreview(char key, int modifiers) { if (key == KeyboardListener.KEY_ENTER) { onClick(this.ok); } return true; }
From source file:com.audata.client.search.QuickSearchPanel.java
License:Open Source License
public void onKeyPress(Widget sender, char key, int modifiers) { if (key == KeyboardListener.KEY_ENTER) { this.onClick(this.search); }/* w w w .j a v a 2 s . com*/ }