Example usage for com.google.common.base Ascii ESC

List of usage examples for com.google.common.base Ascii ESC

Introduction

In this page you can find the example usage for com.google.common.base Ascii ESC.

Prototype

byte ESC

To view the source code for com.google.common.base Ascii ESC.

Click Source Link

Document

Escape: A control character intended to provide code extension (supplementary characters) in general information interchange.

Usage

From source file:de.ks.selection.CustomAutoCompletionBinding.java

protected void procesTextFieldInput(KeyEvent event) {
    String character = event.getCharacter();
    if (Ascii.ESC == character.charAt(0)) {
        hidePopup();
    }
}

From source file:de.ks.selection.NamedPersistentObjectSelection.java

@Override
public void initialize(URL location, ResourceBundle resources) {
    super.initialize(location, resources);
    tableView = new TableView<>();
    TableColumn<T, String> column = new TableColumn<>(Localized.get("name"));
    column.setCellValueFactory(param -> {
        T value = param.getValue();/*from  w ww .j  a  v a 2s .c om*/
        return new SimpleStringProperty(value.getName());
    });
    column.prefWidthProperty().bind(tableView.widthProperty());
    tableView.getColumns().add(column);
    tableView.setItems(FXCollections.observableArrayList());

    tableView.setOnMouseClicked((event) -> {
        if (hideOnSingleClick || event.getClickCount() > 1) {
            hidePopup();
        }
    });
    tableView.setOnKeyTyped((event) -> {
        String character = event.getCharacter();
        KeyCode code = event.getCode();
        String esc = String.valueOf((char) Ascii.ESC);
        if (code == KeyCode.ENTER || code == KeyCode.ESCAPE || character.equals("\n") || character.equals("\r")
                || character.equals(esc)) {
            hidePopup();
        }
    });

    tableView.getSelectionModel().selectedItemProperty().addListener((p, o, n) -> {
        if (n != null) {
            selectedValue.set(n);
        }
    });
}