/** * Called after construction. */ @PostConstruct protected void postConstruct() { servicesPanel.add(serviceFlowListWidget); String filterTxt = (String)stateService.get(ApplicationStateKeys.SERVICES_LIBRARY_FILTER_TEXT); filterServicesTextBox.setText(filterTxt); filterServicesTextBox.addKeyUpHandler(new KeyUpHandler() { @Override public void onKeyUp(KeyUpEvent event) { stateService.put(ApplicationStateKeys.SERVICES_LIBRARY_FILTER_TEXT, filterServicesTextBox.getText()); // Update status populateGrid(currentServices); } }); // Tooltips createServiceButton.setTitle(i18n.format("dslibrary.createServiceButton.tooltip")); manageSourcesButton.setTitle(i18n.format("dslibrary.manageSourcesButton.tooltip")); }
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; }
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; }
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; }
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; }
@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(); } } }); }
public OwnTextArea() { super(); sinkEvents(Event.ONPASTE); addKeyUpHandler(new KeyUpHandler() { @Override public void onKeyUp(KeyUpEvent event) { fireHandler(); } }); }
@Inject public UriUtilScreen(PlaceManager placeManager) { super(placeManager); final Label resultLabel = new Label(); resultLabel.getElement().setId(Debug.shortName(getClass()) + "-resultLabel"); final TextBox uriCheckerBox = new TextBox(); uriCheckerBox.getElement().setId(Debug.shortName(getClass()) + "-uriCheckerBox"); uriCheckerBox.addKeyUpHandler(new KeyUpHandler() { @Override public void onKeyUp(KeyUpEvent event) { if (URIUtil.isValid(uriCheckerBox.getText())) { resultLabel.setText("Not valid."); } else { resultLabel.setText("Valid. Encoded form is <" + URIUtil.encode(uriCheckerBox.getText()) + ">"); } } }); panel.add(new Label("Type URIs into this box to see if they're valid:")); panel.add(uriCheckerBox); panel.add(resultLabel); }
public void setKeyReleased(JavaScriptObject aValue) { if (keyReleased != aValue) { if (keyUpReg != null) { keyUpReg.removeHandler(); keyUpReg = null; } keyReleased = aValue; if (keyReleased != null && component instanceof HasKeyUpHandlers) { keyUpReg = ((HasKeyUpHandlers) component).addKeyUpHandler(new KeyUpHandler() { @Override public void onKeyUp(KeyUpEvent event) { if (keyReleased != null) { event.stopPropagation(); executeEvent(keyReleased, EventsPublisher.publish(event)); } } }); } } }
public static KeyUpHandler createSuggestionOnKeyUpHandler(final UIObject sender, final EventListenerGVO ev, final List<InputVariableGVO> input) { return new KeyUpHandler() { public void onKeyUp(KeyUpEvent event) { if (event.getSource() instanceof QSuggestBox) { QSuggestBox qSuggestBox = (QSuggestBox) event.getSource(); String expression = qSuggestBox.getText(); if (expression != null) { if (expression.length() >= qSuggestBox.getSuggestCharactersLength()) { qSuggestBox.clearSuggestions(); CallbackHandler.createCallBack(sender, QAMLConstants.EVENT_ONCHANGE, ev, input); } } } } }; }
/** * constructor. * * @param pcommitOnReturnHandler commit on return handler * @param pvalidateOnKeyUpHandler on key up handler * @param pvalidateOnVueChangeHandler on vue change handler * @param pvalueChangeHandler value change handler * @param pcheckTime enumeration which describes when to do the check * @param psubmitOnReturn submit form if return is pressed in a input field */ public BeanValidationInitializer(final KeyPressHandler pcommitOnReturnHandler, final KeyUpHandler pvalidateOnKeyUpHandler, final ValueChangeHandler<?> pvalidateOnVueChangeHandler, final ValueChangeHandler<?> pvalueChangeHandler, final CheckTimeEnum pcheckTime, final boolean psubmitOnReturn) { super(); this.commitOnReturnHandler = psubmitOnReturn ? pcommitOnReturnHandler : null; this.validateOnKeyUpHandler = pcheckTime == CheckTimeEnum.ON_KEY_UP ? pvalidateOnKeyUpHandler : null; this.validateOnVueChangeHandler = pcheckTime == CheckTimeEnum.ON_CHANGE || pcheckTime == CheckTimeEnum.ON_KEY_UP ? pvalidateOnVueChangeHandler : null; this.valueChangeHandler = pvalueChangeHandler; this.checkTime = pcheckTime; }
public Widget asWidget() { Widget layout = UI_BINDER.createAndBindUi(this); // Create the MapPresenter and add an InitializationHandler: mapPresenter = GeomajasImpl.getInstance().createMapPresenter(); mapPresenter.setSize(480, 480); // Define the whole layout: DecoratorPanel mapDecorator = new DecoratorPanel(); mapDecorator.add(mapPresenter.asWidget()); mapPanel.add(mapDecorator); // Initialize the map, and return the layout: GeomajasServerExtension.getInstance().initializeMap(mapPresenter, "gwt-app", "mapOsm"); // Make sure the text box also reacts to the "Enter" key: opacityBox.addKeyUpHandler(new KeyUpHandler() { public void onKeyUp(KeyUpEvent event) { if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) { changeOpacity(); } } }); return layout; }
private PersonEditorWorkflow(DynaTableRequestFactory requestFactory, FavoritesManager manager, PersonProxy person) { this.requestFactory = requestFactory; this.manager = manager; this.person = person; TimeSlotListWidget timeSlotEditor = new TimeSlotListWidget(requestFactory); ScheduleEditor scheduleEditor = new ScheduleEditor(timeSlotEditor); MentorSelector mentorEditor = new MentorSelector(requestFactory); personEditor = new PersonEditor(mentorEditor, scheduleEditor); Binder.BINDER.createAndBindUi(this); contents.addDomHandler(new KeyUpHandler() { public void onKeyUp(KeyUpEvent event) { if (event.getNativeKeyCode() == KeyCodes.KEY_ESCAPE) { onCancel(null); } } }, KeyUpEvent.getType()); this.favorite.setVisible(false); }
private ListBox makeChoicesListBox() { choices = GWT.create(ListBox.class); choices.setMultipleSelect(true); choices.setPixelSize(getChoicesWidth(), getChoicesHeight()); choices.addKeyUpHandler(new KeyUpHandler() { public void onKeyUp(com.google.gwt.event.dom.client.KeyUpEvent event) { if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) { selectSomething(); } } }); addDSLSentences(); if (!onlyShowDSLStatements) { addFacts(); addExistentialConditionalElements(); addFromConditionalElements(); addFreeFormDrl(); } return choices; }
private TextBox boundFormulaTextBox() { final TextBox box = new TextBox(); box.setStyleName("constraint-value-Editor"); if (this.methodParameter.getValue() == null) { box.setValue(""); } else { box.setValue(this.methodParameter.getValue()); } box.addKeyUpHandler(new KeyUpHandler() { @Override public void onKeyUp(KeyUpEvent event) { setMethodParameterValue(box.getValue()); } }); return box; }
/** * 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()); }
private KeyUpHandler createKeyHandler() { return new KeyUpHandler() { @Override public void onKeyUp(final KeyUpEvent event) { if (KeyCodes.KEY_PAGEUP == event.getNativeEvent().getKeyCode()) { onRelease(); } } }; }
private KeyUpHandler createKeyHandler() { KeyUpHandler handler= new KeyUpHandler() { @Override public void onKeyUp(final KeyUpEvent event) { if (KeyCodes.KEY_PAGEDOWN == event.getNativeEvent().getKeyCode()) { onRelease(); } } }; return handler; }
/** * 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); } } }); }
/** * 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); }
private HorizontalPanel searchFields() { HorizontalPanel h = new HorizontalPanel(); Label filterlabel = new Label("Search layers: "); filterlabel.setStyleName("bold"); h.add(filterlabel); entityFilterQuery.setWidth("120px"); entityFilterQuery.setStyleName("layerNameField"); h.add(entityFilterQuery); entityFilterQuery.addKeyUpHandler(new KeyUpHandler() { @Override public void onKeyUp(KeyUpEvent event) { if (entityFilterQuery.getText() != null){ String tmp = RiscossUtil.sanitize(entityFilterQuery.getText()); if (!tmp.equals(entityQueryString)) { entityQueryString = tmp; if (entityQueryString.equals("")) loadLayerTree(); else loadLayerList(); } } } }); return h; }
/** * Sets the KeyUp() event handler in many widgets * @param handler the handler * @param widgets the widgets */ public static void addKeyUpHandler(final KeyUpHandler handler,final HasKeyUpHandlers... widgets) { if (handler != null && widgets != null && widgets.length > 0) { for (HasKeyUpHandlers w : widgets) { if (w != null) w.addKeyUpHandler(handler); } } }
private void initPageHeader() { parseToken(); HorizontalPanel hp = new HorizontalPanel(); hp.setStyleName(Gerrit.RESOURCES.css().projectFilterPanel()); Label filterLabel = new Label(AdminConstants.I.projectFilter()); filterLabel.setStyleName(Gerrit.RESOURCES.css().projectFilterLabel()); hp.add(filterLabel); filterTxt = new NpTextBox(); filterTxt.setValue(match); filterTxt.addKeyUpHandler( new KeyUpHandler() { @Override public void onKeyUp(KeyUpEvent event) { Query q = new Query(filterTxt.getValue()); if (match.equals(q.qMatch)) { q.start(start); } else { if (query == null) { q.run(); } query = q; } } }); hp.add(filterTxt); add(hp); }
private void initPageHeader() { final HorizontalPanel hp = new HorizontalPanel(); hp.setStyleName(Gerrit.RESOURCES.css().projectFilterPanel()); final Label filterLabel = new Label(AdminConstants.I.projectFilter()); filterLabel.setStyleName(Gerrit.RESOURCES.css().projectFilterLabel()); hp.add(filterLabel); filterTxt = new NpTextBox(); filterTxt.setValue(match); filterTxt.addKeyUpHandler( new KeyUpHandler() { @Override public void onKeyUp(KeyUpEvent event) { Query q = new Query(filterTxt.getValue()) .open(event.getNativeKeyCode() == KeyCodes.KEY_ENTER); if (match.equals(q.qMatch)) { q.start(start); } if (q.open || !match.equals(q.qMatch)) { if (query == null) { q.run(); } query = q; } } }); hp.add(filterTxt); add(hp); }
/** * Initialize {@code IndicatorSelector}. */ public IndicatorSelector() { initWidget(uiBinder.createAndBindUi(this)); searchInputTimer = new Timer() { @Override public void run() { if (searchInputText != null && !searchInputText.isEmpty()) { manager.search(searchInputText); } } }; search.addKeyUpHandler(new KeyUpHandler() { @Override public void onKeyUp(KeyUpEvent event) { searchInputText = search.getText().trim(); searchInputTimer.cancel(); if (searchInputText.isEmpty()) { manager.clearSearch(); panel.clear(); map.clear(); Indicator selectedIndicator = manager.getSelectedIndicator(); if (selectedIndicator != null) { onSearch( Arrays.asList(selectedIndicator), selectedIndicator); } } else { searchInputTimer.schedule(SEARCH_INPUT_DELAY); } } }); }
/** * Initialize {@code CountrySelector}. */ public CountrySelector() { initWidget(uiBinder.createAndBindUi(this)); searchInputTimer = new Timer() { @Override public void run() { if (searchInputText != null && !searchInputText.isEmpty()) { manager.search(searchInputText); } } }; search.addKeyUpHandler(new KeyUpHandler() { @Override public void onKeyUp(KeyUpEvent event) { searchInputText = search.getText().trim(); searchInputTimer.cancel(); if (searchInputText.isEmpty()) { manager.clearSearch(); panel.clear(); map.clear(); List<Country> selectedCountries = manager.getSelectedCountries(); onSearch(selectedCountries, selectedCountries); } else { searchInputTimer.schedule(SEARCH_INPUT_DELAY); } } }); }
public static KeyUpHandler createOnKeyUpListener(final EventListenerGVO ev, final List<InputVariableGVO> input) { return new KeyUpHandler() { public void onKeyUp(KeyUpEvent event) { handleKeyInput(event.getSource(), event.getNativeEvent(), QAMLConstants.EVENT_ONKEYUP, ev, input); } }; }
private static KeyUpHandler createKeyUpHandler(final ComponentGVO componentGVO, final EventListenerGVO eventGVO, final NotifyHandler notifyHandler, final String windowId, final String context, final AbstractActivity activity) { return new KeyUpHandler() { @Override public void onKeyUp(KeyUpEvent event) { handleKeyInput(componentGVO, eventGVO, event, QAMLConstants.EVENT_ONKEYUP, notifyHandler, windowId, context, activity); } }; }
@Override public HandlerRegistration addKeyUpHandler(final KeyUpHandler pkeyUpHandler) { if (this.contents.getWidget() instanceof HasKeyUpHandlers) { return ((HasKeyUpHandlers) this.contents.getWidget()).addKeyUpHandler(pkeyUpHandler); } else { return null; } }
private void showTextArea() { final TextArea textArea=new TextArea(); textArea.setStyleName("mf-writeACommentTextArea"); textArea.setTitle(i18n.hitCtrlEnterToSubmitComment()); textArea.setFocus(true); textArea.addKeyUpHandler(new KeyUpHandler() { public void onKeyUp(KeyUpEvent event) { if(event.getNativeKeyCode()==KeyCodes.KEY_ENTER && event.isControlKeyDown()) { if(!"".equals(textArea.getText())) { ctx.getStatusLine().showProgress(i18n.savingYourComment()); ctx.getService().saveQuestionComment(questionId,textArea.getText(),new AsyncCallback<String>() { public void onFailure(Throwable caught) { ctx.getRia().handleServiceError(caught); } public void onSuccess(String result) { ctx.getStatusLine().hideStatus(); textArea.setVisible(false); CommentBean commentBean=new CommentBean( result, ctx.getState().getCurrentUser(), questionId, textArea.getText(), new Date()); // this is a new comment, therefore it is always added at the end - replacing existing one ;-) final int threadRow = questionCommentsPanel.getRowCount()-1; questionCommentsPanel.setWidget(threadRow, 0, new ViewCommentPanel(threadRow, questionCommentsPanel, commentBean, ctx)); questionCommentsPanel.addNewComment(); } }); } } } }); add(textArea); }