com.google.gwt.event.dom.client.KeyUpHandler Java Examples

The following examples show how to use com.google.gwt.event.dom.client.KeyUpHandler. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AriaStatus.java    From unitime with Apache License 2.0 6 votes vote down vote up
public static AriaStatus getInstance() {
	if (sStatus == null) {
		RootPanel statusPanel = RootPanel.get("UniTimeGWT:AriaStatus");
		if (statusPanel != null && "1".equals(Window.Location.getParameter("aria"))) {
			sStatus = new AriaStatus(statusPanel.getElement(), false);
			sStatus.setStyleName("unitime-VisibleAriaStatus");
		} else {
			sStatus  = new AriaStatus(false);
			RootPanel.get().add(sStatus);
		}
		
		RootPanel.get().addDomHandler(new KeyUpHandler() {
			@Override
			public void onKeyUp(KeyUpEvent event) {
   				if (event.getNativeEvent().getKeyCode() == 191 && (event.isControlKeyDown() || event.isAltKeyDown())) {
   					sStatus.setHTML(sStatus.getHTML());
   				}
   			}
   		}, KeyUpEvent.getType());
	}
	return sStatus;
}
 
Example #2
Source File: ToggleTool.java    From geowe-core with GNU General Public License v3.0 6 votes vote down vote up
private KeyUpHandler setRedoHandler() {
	final KeyUpHandler handler = new KeyUpHandler() {
		@Override
		public void onKeyUp(final KeyUpEvent event) {
			if (KeyCodes.KEY_R == event.getNativeEvent().getKeyCode()) {
				for (final Control control : controls) {
					try {
						((DrawFeature) control).redo();
					} catch (Exception e) {
						LOGGER.error("ACTION REDO: "
								+ control.getControlId());
					}
				}
			}
		}
	};
	return handler;
}
 
Example #3
Source File: AutoCompleteTextFieldConnector.java    From hawkbit with Eclipse Public License 1.0 6 votes vote down vote up
@Override
protected void extend(final ServerConnector target) {
    textFieldWidget = (VTextField) ((ComponentConnector) target).getWidget();
    textFieldWidget.setImmediate(true);
    textFieldWidget.textChangeEventMode = "EAGER";
    panel.setWidget(select);
    panel.setStyleName("suggestion-popup");
    panel.setOwner(textFieldWidget);

    textFieldWidget.addKeyUpHandler(new KeyUpHandler() {
        @Override
        public void onKeyUp(final KeyUpEvent event) {
            if (panel.isAttached()) {
                handlePanelEventDelegation(event);
            } else if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) {
                rpc.executeQuery(textFieldWidget.getValue(), textFieldWidget.getCursorPos());
            } else {
                doAskForSuggestion();
            }
        }
    });
}
 
Example #4
Source File: ToggleTool.java    From geowe-core with GNU General Public License v3.0 6 votes vote down vote up
private KeyUpHandler setEscapeHandler() {
	KeyUpHandler handler = new KeyUpHandler() {
		@Override
		public void onKeyUp(final KeyUpEvent event) {
			if (KeyCodes.KEY_ESCAPE == event.getNativeEvent().getKeyCode()) {
				for (Control control : controls) {
					try {
						((DrawFeature) control).cancel();
					} catch (Exception e) {
						LOGGER.error("ACTION CANCELED: "
								+ control.getControlId());
					}
				}
			}
		}
	};
	return handler;
}
 
Example #5
Source File: ToggleTool.java    From geowe-core with GNU General Public License v3.0 6 votes vote down vote up
private KeyUpHandler setUndoHandler() {
	final KeyUpHandler handler = new KeyUpHandler() {
		@Override
		public void onKeyUp(final KeyUpEvent event) {
			if (KeyCodes.KEY_U == event.getNativeEvent().getKeyCode()) {
				for (final Control control : controls) {
					try {
						((DrawFeature) control).undo();
					} catch (Exception e) {
						LOGGER.error(
								"ACTION UNDO: " + control.getControlId(), e);
					}
				}
			}
		}
	};
	return handler;
}
 
Example #6
Source File: ZoomOutTool.java    From geowe-core with GNU General Public License v3.0 5 votes vote down vote up
private KeyUpHandler createKeyHandler() {
	return new KeyUpHandler() {
		@Override
		public void onKeyUp(final KeyUpEvent event) {
			if (KeyCodes.KEY_PAGEUP == event.getNativeEvent().getKeyCode()) {
				onRelease();
			}
		}
	};
}
 
Example #7
Source File: DataProviderFilter.java    From core with GNU Lesser General Public License v2.1 5 votes vote down vote up
public Widget asWidget() {


        filter.setMaxLength(30);
        filter.setVisibleLength(20);
        filter.getElement().setAttribute("style", "width:120px;");

        filter.addKeyUpHandler(new KeyUpHandler() {
            @Override
            public void onKeyUp(KeyUpEvent keyUpEvent) {

                Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() {

                    @Override
                    public void execute() {
                        String prefix = filter.getText();

                        if (prefix != null && !prefix.equals("")) {
                            // filter by prefix
                            filterByPrefix(prefix);
                        } else {
                            clearFilter();
                        }
                    }

                });
            }
        });
        HorizontalPanel panel = new HorizontalPanel();
        Label label = new Label(Console.CONSTANTS.common_label_filter() + ": ");
        panel.add(label);
        panel.add(filter);

        label.getElement().setAttribute("style", "padding-top:8px;margin-right:8px");
        return panel;
    }
 
Example #8
Source File: ZoomInTool.java    From geowe-core with GNU General Public License v3.0 5 votes vote down vote up
private KeyUpHandler createKeyHandler() {
	KeyUpHandler handler=  new KeyUpHandler() {
		@Override
		public void onKeyUp(final KeyUpEvent event) {
			if (KeyCodes.KEY_PAGEDOWN == event.getNativeEvent().getKeyCode()) {
				onRelease();
			}
		}
	};
	
	return handler;
}
 
Example #9
Source File: DiagramController.java    From EasyML with Apache License 2.0 5 votes vote down vote up
/**
 * Add key handler to diagram canvas.
 *  
 * @param panel
 */
protected  void addKeyHandler(DiagramCanvas panel){
	panel.addDomHandler(new KeyUpHandler() {
		@Override
		public void onKeyUp(KeyUpEvent event) {
			DiagramController.this.onKeyUp(event);
		}
	}, KeyUpEvent.getType());
}
 
Example #10
Source File: FileTextBox.java    From document-management-system with GNU General Public License v2.0 5 votes vote down vote up
/**
 * File textBox
 */
public FileTextBox() {
	textBox = new TextBox();
	textBox.addKeyUpHandler(new KeyUpHandler() {
		@Override
		public void onKeyUp(KeyUpEvent event) {
			switch (event.getNativeKeyCode()) {
				case (char) KeyCodes.KEY_ENTER:
					switch (action) {
						case ACTION_RENAME:
							if (textBox.getText().length() > 0) {
								Main.get().mainPanel.desktop.browser.fileBrowser.rename(textBox.getText());
							} else {
								Main.get().mainPanel.desktop.browser.fileBrowser.hideRename();
							}
							break;
					}
					Main.get().mainPanel.enableKeyShorcuts(); // Enables general keys applications
					break;

				case (char) KeyCodes.KEY_ESCAPE:
					switch (action) {
						case ACTION_RENAME:
							Main.get().mainPanel.desktop.browser.fileBrowser.hideRename();
							break;
					}
					Main.get().mainPanel.enableKeyShorcuts(); // Enables general keys applications
					break;
			}
		}
	});
	textBox.setVisibleLength(20);
	textBox.setStyleName("okm-FileBrowser-TextBox");
	initWidget(textBox);
}
 
Example #11
Source File: InputTemplateUrlWizard.java    From appinventor-extensions with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a new YoungAndroid project wizard.
 */
public InputTemplateUrlWizard(final NewUrlDialogCallback callback) {
  super(MESSAGES.inputNewUrlCaption(), true, true);

  // Initialize the UI.
  setStylePrimaryName("ode-DialogBox");
  HorizontalPanel panel = new HorizontalPanel();

  urlTextBox = new LabeledTextBox(MESSAGES.newUrlLabel());
  urlTextBox.getTextBox().setWidth("250px");
  urlTextBox.getTextBox().addKeyUpHandler(new KeyUpHandler() {
    @Override
    public void onKeyUp(KeyUpEvent event) {
      int keyCode = event.getNativeKeyCode();
      if (keyCode == KeyCodes.KEY_ENTER) {
        handleOkClick();
      } else if (keyCode == KeyCodes.KEY_ESCAPE) {
        handleCancelClick();
      }
    }
  });

  VerticalPanel page = new VerticalPanel();
  panel.add(urlTextBox);
  page.add(panel);
  addPage(page);

  // Create finish command (create a new Young Android project).
  initFinishCommand(new Command() {
    @Override
    public void execute() {
      String hostUrl = urlTextBox.getText();
      if (TemplateUploadWizard.hasUrl(hostUrl)) {
        Window.alert("The Url " + hostUrl + " already exists.");
      } else {
        callback.updateTemplateOptions(hostUrl);
      }
    }
  });
}
 
Example #12
Source File: NotifyPopup.java    From document-management-system with GNU General Public License v2.0 4 votes vote down vote up
public NotifyPopup() {
	// Establishes auto-close when click outside
	super(false, true);

	setText(Main.i18n("notify.label"));
	mails = "";
	users = "";
	roles = "";
	uuidList = new ArrayList<String>();

	vPanel = new VerticalPanel();
	hPanel = new HorizontalPanel();
	notifyPanel = new NotifyPanel();
	message = new TextArea();
	message.addKeyUpHandler(new KeyUpHandler() {
		@Override
		public void onKeyUp(KeyUpEvent event) {
			sendButton.setEnabled(message.getText().trim().length() > 0);
		}
	});

	errorNotify = new HTML(Main.i18n("fileupload.label.must.select.users"));
	errorNotify.setWidth("364px");
	errorNotify.setVisible(false);
	errorNotify.setStyleName("fancyfileupload-failed");

	commentTXT = new HTML("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" + Main.i18n("fileupload.label.notify.comment"));

	closeButton = new Button(Main.i18n("fileupload.button.close"), new ClickHandler() {
		@Override
		public void onClick(ClickEvent event) {
			hide();
			reset(NONE);
		}
	});

	sendButton = new Button(Main.i18n("button.send"), new ClickHandler() {
		@Override
		public void onClick(ClickEvent event) {
			// Only sends if there's some user selected
			mails = notifyPanel.getExternalMailAddress();
			users = notifyPanel.getUsersToNotify();
			roles = notifyPanel.getRolesToNotify();

			if (!users.equals("") || !roles.equals("") || !mails.equals("")) {
				errorNotify.setVisible(false);
				sendLinkNotification();
				hide();
				reset(NONE);
			} else {
				errorNotify.setVisible(true);
			}
		}
	});

	hPanel.add(closeButton);
	HTML space = new HTML("");
	hPanel.add(space);
	hPanel.add(sendButton);

	hPanel.setCellWidth(space, "40px");

	message.setSize("374px", "60px");
	message.setStyleName("okm-TextArea");
	// TODO This is a workaround for a Firefox 2 bug
	// http://code.google.com/p/google-web-toolkit/issues/detail?id=891
	messageScroll = new ScrollPanel(message);
	messageScroll.setAlwaysShowScrollBars(false);

	vPanel.add(new HTML("<br>"));
	vPanel.add(commentTXT);
	vPanel.add(messageScroll);
	vPanel.add(errorNotify);
	vPanel.add(new HTML("<br>"));
	vPanel.add(notifyPanel);
	vPanel.add(new HTML("<br>"));
	vPanel.add(hPanel);
	vPanel.add(new HTML("<br>"));

	vPanel.setCellHorizontalAlignment(errorNotify, VerticalPanel.ALIGN_CENTER);
	vPanel.setCellHorizontalAlignment(messageScroll, VerticalPanel.ALIGN_CENTER);
	vPanel.setCellHorizontalAlignment(notifyPanel, VerticalPanel.ALIGN_CENTER);
	vPanel.setCellHorizontalAlignment(hPanel, VerticalPanel.ALIGN_CENTER);

	vPanel.setWidth("100%");

	closeButton.setStyleName("okm-NoButton");
	sendButton.setStyleName("okm-YesButton");

	commentTXT.addStyleName("okm-DisableSelect");
	notifyPanel.addStyleName("okm-DisableSelect");

	setWidget(vPanel);
}
 
Example #13
Source File: ButtonTool.java    From geowe-core with GNU General Public License v3.0 4 votes vote down vote up
protected void addKeyHandler(KeyUpHandler handler){
	RootPanel.get().addDomHandler(handler, KeyUpEvent.getType());
}
 
Example #14
Source File: NewWikiPagePopup.java    From document-management-system with GNU General Public License v2.0 4 votes vote down vote up
/**
 * NewWikiPagePopup
 */
public NewWikiPagePopup() {
	// Establishes auto-close when click outside
	super(false, true);

	setText(GeneralComunicator.i18nExtension("wiki.page.add"));

	vPanel = new VerticalPanel();
	vPanel.setWidth("200px");
	vPanel.setHeight("50px");

	HorizontalPanel hPanel = new HorizontalPanel();
	titleText = new HTML(GeneralComunicator.i18nExtension("wiki.page.title"));
	title = new TextBox();
	title.addKeyUpHandler(new KeyUpHandler() {
		@Override
		public void onKeyUp(KeyUpEvent event) {
			addButton.setEnabled((title.getText().length() > 0));
		}
	});
	title.setWidth("250px");
	title.setStyleName("okm-Input");
	hPanel.add(new HTML("&nbsp;"));
	hPanel.add(titleText);
	hPanel.add(new HTML("&nbsp;&nbsp;"));
	hPanel.add(title);
	hPanel.add(new HTML("&nbsp;"));

	hPanel.setCellVerticalAlignment(titleText, HasAlignment.ALIGN_MIDDLE);
	hPanel.setCellVerticalAlignment(title, HasAlignment.ALIGN_MIDDLE);

	cancelButton = new Button(GeneralComunicator.i18n("button.close"), new ClickHandler() {
		@Override
		public void onClick(ClickEvent event) {
			hide();
		}
	});
	cancelButton.setStyleName("okm-NoButton");

	addButton = new Button(GeneralComunicator.i18n("button.add"), new ClickHandler() {
		@Override
		public void onClick(ClickEvent event) {
			if (!title.getText().equals("")) {
				Wiki.get().addWigiTag(title.getText());
			}
			hide();
		}
	});
	addButton.setStyleName("okm-AddButton");

	HorizontalPanel buttonsPanel = new HorizontalPanel();
	buttonsPanel.add(cancelButton);
	buttonsPanel.add(new HTML("&nbsp;"));
	buttonsPanel.add(addButton);

	vPanel.add(new HTML("<br>"));
	vPanel.add(hPanel);
	vPanel.add(new HTML("<br>"));
	vPanel.add(buttonsPanel);
	vPanel.add(new HTML("<br>"));

	vPanel.setCellHorizontalAlignment(hPanel, HasAlignment.ALIGN_CENTER);
	vPanel.setCellHorizontalAlignment(buttonsPanel, HasAlignment.ALIGN_CENTER);

	super.hide();
	setWidget(vPanel);
}
 
Example #15
Source File: TimeSelector.java    From unitime with Apache License 2.0 4 votes vote down vote up
@Override
public HandlerRegistration addKeyUpHandler(KeyUpHandler handler) {
	return iText.addKeyUpHandler(handler);
}
 
Example #16
Source File: FilterBox.java    From unitime with Apache License 2.0 4 votes vote down vote up
@Override
public HandlerRegistration addKeyUpHandler(KeyUpHandler handler) {
	return iFilter.addKeyUpHandler(handler);
}
 
Example #17
Source File: UniTimeFilterBox.java    From unitime with Apache License 2.0 4 votes vote down vote up
@Override
public HandlerRegistration addKeyUpHandler(KeyUpHandler handler) {
	return iFilter.getWidget().addKeyUpHandler(handler);
}
 
Example #18
Source File: AbstractInput.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public com.google.gwt.event.shared.HandlerRegistration addKeyUpHandler(KeyUpHandler handler) {
	return this.addDomHandler(handler, KeyUpEvent.getType());
}
 
Example #19
Source File: ListItem.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public HandlerRegistration addKeyUpHandler(KeyUpHandler handler) {
	return this.addDomHandler(handler, KeyUpEvent.getType());
}
 
Example #20
Source File: Anchor.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public HandlerRegistration addKeyUpHandler(KeyUpHandler handler) {
	return this.addDomHandler(handler, KeyUpEvent.getType());
}
 
Example #21
Source File: CodeInputImpl.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public HandlerRegistration addKeyUpHandler(KeyUpHandler handler) {
	return this.textArea.addKeyUpHandler(handler);
}
 
Example #22
Source File: HandlerPanel.java    From appinventor-extensions with Apache License 2.0 4 votes vote down vote up
public HandlerRegistration addKeyUpHandler(KeyUpHandler handler) {
  return addDomHandler(handler, KeyUpEvent.getType());
}