Java Code Examples for com.google.gwt.event.dom.client.KeyUpEvent

The following are top voted examples for showing how to use com.google.gwt.event.dom.client.KeyUpEvent. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: ephesoft   File: DocumentTree.java   View source code 7 votes vote down vote up
/**
 * @param eventBus
 */
private void addRVKeyUpEvent(HandlerManager eventBus) {
	eventBus.addHandler(RVKeyUpEvent.type, new RVKeyUpEventHandler() {

		@Override
		public void onKeyUp(RVKeyUpEvent event) {
			KeyUpEvent keyEvent = event.getEvent();
			if (keyEvent.isControlKeyDown()) {
				int keyCode = keyEvent.getNativeEvent().getKeyCode();
				switch (keyCode) {
					case 'n':
					case 'N':
						keyNUpEvent(keyEvent);
						break;
					case 'p':
					case 'P':
						keyPUpEvent(keyEvent);
						break;
					default:
						break;
				}
			}
		}

	});
}
 
Example 2
Project: teiid-webui   File: DataServicesLibraryScreen.java   View source code 7 votes vote down vote up
/**
 * 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"));
}
 
Example 3
Project: unitimes   File: AriaStatus.java   View source code 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 4
Project: sig-seguimiento-vehiculos   File: ToggleTool.java   View source code 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
Project: sig-seguimiento-vehiculos   File: ToggleTool.java   View source code 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
Project: sig-seguimiento-vehiculos   File: ToggleTool.java   View source code 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 7
Project: Wiab.pro   File: FocusManager.java   View source code 6 votes vote down vote up
/**
 * Installs a key handler for key events on this window.
 *
 * @param handler handler to receive key events.
 */
static void install(KeySignalHandler handler) {
  //
  // NOTE: There are three potential candidate elements for sinking keyboard
  // events: the window, the document, and the document body. IE7 does not
  // fire events on the window element, and GWT's RootPanel is already a
  // listener on the body, leaving the document as the only cross-browser
  // whole-window event-sinking 'element'.
  //
  DocumentPanel panel = new DocumentPanel(handler);
  panel.setElement(Document.get().<Element>cast());
  panel.addDomHandler(panel, KeyDownEvent.getType());
  panel.addDomHandler(panel, KeyPressEvent.getType());
  panel.addDomHandler(panel, KeyUpEvent.getType());
  RootPanel.detachOnWindowClose(panel);
  panel.onAttach();
}
 
Example 8
Project: vaadin-combobox-multiselect   File: VComboBoxMultiselect.java   View source code 6 votes vote down vote up
/**
 * Triggered when a key was depressed.
 *
 * @param event
 *            The KeyUpEvent of the key depressed
 */
@Override
public void onKeyUp(KeyUpEvent event) {
	debug("VComboBoxMultiselect: onKeyUp(" + event.getNativeKeyCode() + ")");

	if (this.enabled && !this.readonly) {
		switch (event.getNativeKeyCode()) {
		case KeyCodes.KEY_ENTER:
		case KeyCodes.KEY_TAB:
		case KeyCodes.KEY_SHIFT:
		case KeyCodes.KEY_CTRL:
		case KeyCodes.KEY_ALT:
		case KeyCodes.KEY_DOWN:
		case KeyCodes.KEY_UP:
		case KeyCodes.KEY_PAGEDOWN:
		case KeyCodes.KEY_PAGEUP:
		case KeyCodes.KEY_ESCAPE:
			// NOP
			break;
		default:
			if (this.textInputEnabled) {
				// when filtering, we always want to see the results on the
				// first page first.
				filterOptions(0);
			}
			break;
		}
	}
}
 
Example 9
Project: hawkbit   File: AutoCompleteTextFieldConnector.java   View source code 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 10
Project: hawkbit   File: AutoCompleteTextFieldConnector.java   View source code 6 votes vote down vote up
private void handlePanelEventDelegation(final KeyUpEvent event) {
    switch (event.getNativeKeyCode()) {
    case KeyCodes.KEY_DOWN:
        arrowKeyDown(event);
        break;
    case KeyCodes.KEY_UP:
        arrorKeyUp(event);
        break;
    case KeyCodes.KEY_ESCAPE:
        escapeKey();
        break;
    case KeyCodes.KEY_ENTER:
        enterKey();
        break;
    default:
        doAskForSuggestion();
    }
}
 
Example 11
Project: che   File: CategoriesPageViewImpl.java   View source code 6 votes vote down vote up
@UiHandler("projectName")
void onProjectNameChanged(KeyUpEvent event) {
  if (projectName.getValue() != null && projectName.getValue().contains(" ")) {
    String tmp = projectName.getValue();
    while (tmp.contains(" ")) {
      tmp = tmp.replaceAll(" ", "-");
    }
    projectName.setValue(tmp);
  }

  if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) {
    return;
  }

  delegate.projectNameChanged(projectName.getText());
}
 
Example 12
Project: che   File: CommandsPaletteViewImpl.java   View source code 6 votes vote down vote up
@UiHandler({"filterField"})
void onFilterChanged(KeyUpEvent event) {
  switch (event.getNativeKeyCode()) {
    case KEY_UP:
      tree.getSelectionModel().selectPrevious();
      break;
    case KEY_DOWN:
      tree.getSelectionModel().selectNext();
      break;
    case KEY_ENTER:
      final List<Node> selectedNodes = tree.getSelectionModel().getSelectedNodes();

      if (!selectedNodes.isEmpty()) {
        final Node node = selectedNodes.get(0);

        if (node instanceof ExecutableCommandNode) {
          delegate.onCommandExecute(((ExecutableCommandNode) node).getData());
        } else if (node instanceof CommandGoalNode) {
          tree.setExpanded(node, !tree.isExpanded(node));
        }
      }
      break;
    default:
      delegate.onFilterChanged(filterField.getValue());
  }
}
 
Example 13
Project: che   File: GithubImporterPageViewImpl.java   View source code 6 votes vote down vote up
@UiHandler("projectDescription")
void onProjectDescriptionChanged(KeyUpEvent event) {
  if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) {
    return;
  }
  delegate.onProjectDescriptionChanged(projectDescription.getValue());
}
 
Example 14
Project: geowe-core   File: ToggleTool.java   View source code 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 15
Project: geowe-core   File: ToggleTool.java   View source code 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 16
Project: geowe-core   File: ToggleTool.java   View source code 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 17
Project: umlet   File: OwnTextArea.java   View source code 6 votes vote down vote up
public OwnTextArea() {
	super();
	sinkEvents(Event.ONPASTE);
	addKeyUpHandler(new KeyUpHandler() {
		@Override
		public void onKeyUp(KeyUpEvent event) {
			fireHandler();
		}
	});
}
 
Example 18
Project: empiria.player   File: VideoFullScreenHelper.java   View source code 5 votes vote down vote up
private VideoFullScreenView getFullScreenView() {
    if (view == null) {
        view = fullScreenViewProvider.get();
        controlsHideTimer = mediaFactory.getVideoControlHideTimer(view);
        RootPanel.get().addDomHandler(this, KeyUpEvent.getType());
    }
    return view;
}
 
Example 19
Project: empiria.player   File: VideoFullScreenHelper.java   View source code 5 votes vote down vote up
@Override
public void onKeyUp(KeyUpEvent event) {
    if (event.getNativeKeyCode() == KeyCodes.KEY_ESCAPE) {
        event.preventDefault();
        closeFullScreen();
    }

}
 
Example 20
Project: EasyML   File: DiagramController.java   View source code 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 21
Project: EasyML   File: DiagramController.java   View source code 5 votes vote down vote up
/**
 * Trigger action when key up event fired
 * 
 * @param event
 */
protected  void onKeyUp(KeyUpEvent event){
	logger.info("key" +event.getNativeKeyCode() );
	if(event.getNativeKeyCode()== 46){
		logger.info("delete widget");
		deleteWidget();
	}
}
 
Example 22
Project: unitimes   File: CourseFinderCourses.java   View source code 5 votes vote down vote up
@Override
public void onKeyUp(KeyUpEvent event) {
	if (iCourses.getRowCount() < 2 || iCourses.getData(1) == null) return;
	int row = iCourses.getSelectedRow();
	if (event.getNativeKeyCode() == KeyCodes.KEY_DOWN) {
		if (row < 0 || iCourses.getSelectedRow() + 1 >= iCourses.getRowCount())
			iCourses.setSelected(1, true);
		else
			iCourses.setSelected(row + 1, true);
           scrollToSelectedRow();
           updateCourseDetails();
	} else if (event.getNativeKeyCode()==KeyCodes.KEY_UP) {
		if (row - 1 < 1)
			iCourses.setSelected(iCourses.getRowCount() - 1, true);
		else
			iCourses.setSelected(row - 1, true);
		scrollToSelectedRow();
		updateCourseDetails();
	} else if (event.isControlKeyDown() || event.isAltKeyDown()) {
		for (Map.Entry<Character, Integer> entry: iTabAccessKeys.entrySet())
			if (event.getNativeKeyCode() == Character.toLowerCase(entry.getKey()) || event.getNativeKeyCode() == Character.toUpperCase(entry.getKey())) {
				iCourseDetailsTabBar.selectTab(entry.getValue(), true);
				event.preventDefault();
				event.stopPropagation();
			}
	}
}
 
Example 23
Project: sig-seguimiento-vehiculos   File: ZoomOutTool.java   View source code 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 24
Project: sig-seguimiento-vehiculos   File: ZoomInTool.java   View source code 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 25
Project: appinventor-extensions   File: InputTemplateUrlWizard.java   View source code 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 26
Project: vaadin-combobox-multiselect   File: VComboBoxMultiselect.java   View source code 5 votes vote down vote up
/**
 * Triggered when a key was depressed.
 *
 * @param event
 *            The KeyUpEvent of the key depressed
 */
@Override
public void onKeyUp(KeyUpEvent event) {
	debug("VComboBoxMultiselect: onKeyUp(" + event.getNativeKeyCode() + ")");

	if (this.enabled && !this.readonly) {
		switch (event.getNativeKeyCode()) {
		case KeyCodes.KEY_ENTER:
		case KeyCodes.KEY_TAB:
		case KeyCodes.KEY_SHIFT:
		case KeyCodes.KEY_CTRL:
		case KeyCodes.KEY_ALT:
		case KeyCodes.KEY_DOWN:
		case KeyCodes.KEY_UP:
		case KeyCodes.KEY_PAGEDOWN:
		case KeyCodes.KEY_PAGEUP:
		case KeyCodes.KEY_ESCAPE:
			// NOP
			break;
		default:
			if (this.textInputEnabled) {
				// when filtering, we always want to see the results on the
				// first page first.
				filterOptions(0);
			}
			break;
		}
	}
}
 
Example 27
Project: document-management-system   File: UtilComunicator.java   View source code 5 votes vote down vote up
/**
 * isSearchableKey
 *
 * @param event
 * @return
 */
public static boolean isSearchableKey(KeyUpEvent event) {
	if (event != null) {
		return Util.isSearchableKey(event);
	} else {
		return true;
	}
}
 
Example 28
Project: document-management-system   File: FileTextBox.java   View source code 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 29
Project: cuba   File: CubaSearchSelectWidget.java   View source code 5 votes vote down vote up
@Override
public void onKeyUp(KeyUpEvent event) {
    if (enabled && !readonly) {
        switch (event.getNativeKeyCode()) {
            case KeyCodes.KEY_ENTER:
                String tbText = tb.getText() == null ? "" : tb.getText();
                String currentText = currentSuggestion == null ? "" : currentSuggestion.getReplacementString();
                if (!this.preventFilterAfterSelect && !tbText.equals(currentText))
                    filterOptions(currentPage);
                else {
                    if (!event.isAnyModifierKeyDown())
                        event.stopPropagation();
                }
                this.preventFilterAfterSelect = false;
                break;
            case KeyCodes.KEY_TAB:
            case KeyCodes.KEY_SHIFT:
            case KeyCodes.KEY_CTRL:
            case KeyCodes.KEY_ALT:
            case KeyCodes.KEY_DOWN:
            case KeyCodes.KEY_UP:
            case KeyCodes.KEY_PAGEDOWN:
            case KeyCodes.KEY_PAGEUP:
                // NOP
                break;
            case KeyCodes.KEY_ESCAPE:
                reset();
                break;
        }

        updateEditState();
    }
}
 
Example 30
Project: cuba   File: CubaComboBoxWidget.java   View source code 5 votes vote down vote up
@Override
public void onKeyUp(KeyUpEvent event) {
    if (enabled && !readonly) {
        switch (event.getNativeKeyCode()) {
            case KeyCodes.KEY_ENTER:
            case KeyCodes.KEY_TAB:
            case KeyCodes.KEY_SHIFT:
            case KeyCodes.KEY_CTRL:
            case KeyCodes.KEY_ALT:
            case KeyCodes.KEY_DOWN:
            case KeyCodes.KEY_UP:
            case KeyCodes.KEY_PAGEDOWN:
            case KeyCodes.KEY_PAGEUP:
            case KeyCodes.KEY_ESCAPE:
                // NOP
                break;
            default:
                // special case for "clear" shortcut action
                if (event.isShiftKeyDown() && event.getNativeKeyCode() == KeyCodes.KEY_DELETE) {
                    suggestionPopup.hide();
                } else {
                    // do not show options popup if we handle shortcut action
                    if (!event.isControlKeyDown()
                            && !event.isAltKeyDown()) {
                        super.onKeyUp(event);
                    }
                }
                break;
        }
    }
}
 
Example 31
Project: ontobrowser   File: AddSynonymPopup.java   View source code 5 votes vote down vote up
@Override
  public void onKeyUp(KeyUpEvent event) {
if(addButton.isEnabled() && 
		(synonymField.getValue().trim().length() == 0 ||
		(sourceDropBox.getSelectedIndex() > 0 && referenceIdField.getValue().trim().length() == 0))) {
	addButton.setEnabled(false);
} else if(!addButton.isEnabled() &&
		synonymField.getValue().trim().length() > 0 && 
		(sourceDropBox.getSelectedIndex() == 0 || referenceIdField.getValue().trim().length() > 0)) {
	addButton.setEnabled(true);
}
  }
 
Example 32
Project: ephesoft   File: DocumentTree.java   View source code 5 votes vote down vote up
/**
 * @param keyEvent
 */
private void keyPUpEvent(KeyUpEvent keyEvent) {
	if (!presenter.isTableView()) {
		if (!keyEvent.isShiftKeyDown()) {
			keyEvent.getNativeEvent().preventDefault();
			openNextPage();
		} else {
			keyEvent.getNativeEvent().preventDefault();
			openPreviousPage();
		}
	}
}
 
Example 33
Project: che   File: CategoriesPageViewImpl.java   View source code 5 votes vote down vote up
@UiHandler("projectDescription")
void onProjectDescriptionChanged(KeyUpEvent event) {
  if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) {
    return;
  }

  delegate.projectDescriptionChanged(projectDescription.getValue());
}
 
Example 34
Project: che   File: ZipImporterPageViewImpl.java   View source code 5 votes vote down vote up
@UiHandler("projectName")
void onProjectNameChanged(KeyUpEvent event) {
  String projectNameValue = projectName.getValue();

  if (projectNameValue != null && projectNameValue.contains(" ")) {
    projectNameValue = projectNameValue.replace(" ", "-");
    projectName.setValue(projectNameValue);
  }

  if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) {
    return;
  }

  delegate.projectNameChanged(projectName.getValue());
}
 
Example 35
Project: che   File: ZipImporterPageViewImpl.java   View source code 5 votes vote down vote up
@UiHandler("projectDescription")
void onProjectDescriptionChanged(KeyUpEvent event) {
  if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) {
    return;
  }
  delegate.projectDescriptionChanged(projectDescription.getValue());
}
 
Example 36
Project: che   File: CreateFactoryViewImpl.java   View source code 5 votes vote down vote up
@UiHandler({"factoryName"})
public void onProjectNameChanged(KeyUpEvent event) {
  if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER && createFactoryButton.isEnabled()) {
    delegate.onCreateClicked();
  } else {
    String name = factoryName.getValue();
    if (!Strings.isNullOrEmpty(name) && FACTORY_NAME_PATTERN.test(name)) {
      name = name.replaceAll("[^A-Za-z0-9_]", "-");
      factoryName.setValue(name);
    }
    delegate.onFactoryNameChanged(name);
  }
}
 
Example 37
Project: che   File: HotKeysDialogViewImpl.java   View source code 5 votes vote down vote up
@UiHandler("filterInput")
public void onKeyUp(KeyUpEvent keyUpEvent) {
  String value = filterInput.getText();
  if (!filterInput.getText().equals(filteredValue)) {
    filteredValue = value;
    delegate.onFilterValueChanged(value);
  }
}
 
Example 38
Project: che   File: CustomPageViewImpl.java   View source code 5 votes vote down vote up
@UiHandler({"commandLine"})
void onKeyUp(KeyUpEvent event) {
  // commandLine value may not be updated immediately after keyUp
  // therefore use the timer with zero delay
  new Timer() {
    @Override
    public void run() {
      delegate.onCommandLineChanged();
    }
  }.schedule(0);
}
 
Example 39
Project: che   File: GithubImporterPageViewImpl.java   View source code 5 votes vote down vote up
@UiHandler("projectName")
void onProjectNameChanged(KeyUpEvent event) {
  String projectNameValue = projectName.getValue();

  if (projectNameValue != null && projectNameValue.contains(" ")) {
    projectNameValue = projectNameValue.replace(" ", "-");
    projectName.setValue(projectNameValue);
  }

  if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) {
    return;
  }

  delegate.onProjectNameChanged(projectName.getValue());
}
 
Example 40
Project: che   File: GithubImporterPageViewImpl.java   View source code 5 votes vote down vote up
@UiHandler("branch")
void onBranchNameChanged(KeyUpEvent event) {
  if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) {
    return;
  }
  delegate.onBranchNameChanged(branch.getValue());
}