Search in sources :

Example 1 with KeyCodeCombination

use of javafx.scene.input.KeyCodeCombination in project jphp by jphp-compiler.

the class KeyboardManager method trigger.

protected void trigger(boolean down) {
    List<KeyCombination.Modifier> modifiers = new ArrayList<>();
    if (shiftDown) {
        modifiers.add(SHIFT_DOWN);
    }
    if (controlDown) {
        modifiers.add(KeyCombination.CONTROL_DOWN);
    }
    if (altDown) {
        modifiers.add(KeyCombination.ALT_DOWN);
    }
    KeyCombination.Modifier[] modifiersArray = modifiers.toArray(new KeyCombination.Modifier[modifiers.size()]);
    for (Map.Entry<KeyCode, KeyEvent> entry : keys.entrySet()) {
        KeyCode code;
        try {
            code = entry.getKey();
        } catch (IllegalStateException e) {
            continue;
        }
        if (code == null || code == KeyCode.UNDEFINED) {
            continue;
        }
        KeyCodeCombination keyCombination;
        try {
            keyCombination = new KeyCodeCombination(code, modifiersArray);
        } catch (IllegalArgumentException e) {
            continue;
        }
        trigger(keyCombination, down);
        if (modifiersArray.length > 0) {
            keyCombination = new KeyCodeCombination(code);
            trigger(keyCombination, down);
        }
    }
}
Also used : KeyEvent(javafx.scene.input.KeyEvent) KeyCode(javafx.scene.input.KeyCode) KeyCodeCombination(javafx.scene.input.KeyCodeCombination) KeyCombination(javafx.scene.input.KeyCombination)

Example 2 with KeyCodeCombination

use of javafx.scene.input.KeyCodeCombination in project Gargoyle by callakrsos.

the class SqlPane method createTreeContextMenu.

/**
	 * 컨텍스트 메뉴 생성 및 기능 적용
	 *
	 *
	 * 2016-10-27 키 이벤트를 setAccelerator를 사용하지않고 이벤트 방식으로 변경 이유 : 도킹기능을 적용하하면
	 * setAccelerator에 등록된 이벤트가 호출안됨
	 *
	 * @param schemaTree2
	 */
private void createTreeContextMenu(TreeView<K> schemaTree) {
    MenuItem menuSelectScript = new MenuItem("Select Script");
    menuSelectScript.setOnAction(this::applySelectScript);
    MenuItem menuUpdateScript = new MenuItem("Update Script");
    menuUpdateScript.setOnAction(this::applyUpdateScript);
    MenuItem menuDeleteScript = new MenuItem("Delete Script");
    menuDeleteScript.setOnAction(this::applyDeleteSelectScript);
    MenuItem menuInsertScript = new MenuItem("Insert Script");
    menuInsertScript.setOnAction(this::applyInsertScript);
    Menu menu = new Menu("Script", null, menuSelectScript, menuUpdateScript, menuDeleteScript, menuInsertScript);
    // MenuItem menuPrimaryKeys = new MenuItem("Primary Keys");
    MenuItem menuShowData = new MenuItem("Show 100 rows [F1]");
    menuShowData.setOnAction(this::show100RowAction);
    MenuItem menuEditShowData = new MenuItem("Show Editable View  [CTRL + F1]");
    menuEditShowData.setOnAction(this::menuEditShowDataAction);
    MenuItem menuFindTable = new MenuItem("Find Table [CTRL + SHIFT + R]");
    // menuFindTable.setAccelerator(new KeyCodeCombination(KeyCode.R,
    // KeyCombination.CONTROL_DOWN));
    menuFindTable.setOnAction(this::showFileTableOnAction);
    MenuItem menuProperties = new MenuItem("Properties");
    menuProperties.setOnAction(this::showProperties);
    MenuItem menuReflesh = new MenuItem("Reflesh [F5]");
    // menuReflesh.setOnAction(this::menuRefleshOnAction);
    menuReflesh.setAccelerator(new KeyCodeCombination(KeyCode.F5));
    ContextMenu contextMenu = new ContextMenu(menu, menuShowData, menuEditShowData, menuFindTable, menuProperties, new SeparatorMenuItem(), menuReflesh);
    schemaTree.setContextMenu(contextMenu);
}
Also used : MenuItem(javafx.scene.control.MenuItem) SeparatorMenuItem(javafx.scene.control.SeparatorMenuItem) KeyCodeCombination(javafx.scene.input.KeyCodeCombination) ContextMenu(javafx.scene.control.ContextMenu) Menu(javafx.scene.control.Menu) ContextMenu(javafx.scene.control.ContextMenu) SeparatorMenuItem(javafx.scene.control.SeparatorMenuItem)

Example 3 with KeyCodeCombination

use of javafx.scene.input.KeyCodeCombination in project bitsquare by bitsquare.

the class PeerInfoWithTagEditor method addContent.

protected void addContent() {
    FormBuilder.addLabelTextField(gridPane, ++rowIndex, "Onion address:", hostName).second.setMouseTransparent(false);
    FormBuilder.addLabelTextField(gridPane, ++rowIndex, "Number of completed trades:", String.valueOf(numTrades));
    inputTextField = FormBuilder.addLabelInputTextField(gridPane, ++rowIndex, "Set tag for that peer:").second;
    Map<String, String> peerTagMap = Preferences.INSTANCE.getPeerTagMap();
    String tag = peerTagMap.containsKey(hostName) ? peerTagMap.get(hostName) : "";
    inputTextField.setText(tag);
    keyEventEventHandler = event -> {
        if (new KeyCodeCombination(KeyCode.R, KeyCombination.ALT_DOWN).match(event)) {
            new SendPrivateNotificationWindow(offer.getPubKeyRing(), offer.getOffererNodeAddress()).onAddAlertMessage(privateNotificationManager::sendPrivateNotificationMessageIfKeyIsValid).show();
        }
    };
}
Also used : SendPrivateNotificationWindow(io.bitsquare.gui.main.overlays.windows.SendPrivateNotificationWindow) KeyCodeCombination(javafx.scene.input.KeyCodeCombination)

Example 4 with KeyCodeCombination

use of javafx.scene.input.KeyCodeCombination in project bitsquare by bitsquare.

the class TransactionsView method initialize.

@Override
public void initialize() {
    tableView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
    tableView.setPlaceholder(new Label("No transactions available"));
    setDateColumnCellFactory();
    setDetailsColumnCellFactory();
    setAddressColumnCellFactory();
    setTransactionColumnCellFactory();
    setAmountColumnCellFactory();
    setConfidenceColumnCellFactory();
    setRevertTxColumnCellFactory();
    dateColumn.setComparator((o1, o2) -> o1.getDate().compareTo(o2.getDate()));
    detailsColumn.setComparator((o1, o2) -> {
        String id1 = o1.getTradable() != null ? o1.getTradable().getId() : o1.getDetails();
        String id2 = o2.getTradable() != null ? o2.getTradable().getId() : o2.getDetails();
        return id1.compareTo(id2);
    });
    addressColumn.setComparator((o1, o2) -> o1.getAddressString().compareTo(o2.getAddressString()));
    transactionColumn.setComparator((o1, o2) -> o1.getTxId().compareTo(o2.getTxId()));
    amountColumn.setComparator((o1, o2) -> o1.getAmountAsCoin().compareTo(o2.getAmountAsCoin()));
    confidenceColumn.setComparator((o1, o2) -> Double.valueOf(o1.getTxConfidenceIndicator().getProgress()).compareTo(o2.getTxConfidenceIndicator().getProgress()));
    dateColumn.setSortType(TableColumn.SortType.DESCENDING);
    tableView.getSortOrder().add(dateColumn);
    walletEventListener = new WalletEventListener() {

        @Override
        public void onCoinsReceived(Wallet wallet, Transaction tx, Coin prevBalance, Coin newBalance) {
            updateList();
        }

        @Override
        public void onCoinsSent(Wallet wallet, Transaction tx, Coin prevBalance, Coin newBalance) {
            updateList();
        }

        @Override
        public void onReorganize(Wallet wallet) {
            updateList();
        }

        @Override
        public void onTransactionConfidenceChanged(Wallet wallet, Transaction tx) {
        }

        @Override
        public void onWalletChanged(Wallet wallet) {
            updateList();
        }

        @Override
        public void onScriptsChanged(Wallet wallet, List<Script> scripts, boolean isAddingScripts) {
            updateList();
        }

        @Override
        public void onKeysAdded(List<ECKey> keys) {
            updateList();
        }
    };
    keyEventEventHandler = event -> {
        if (new KeyCodeCombination(KeyCode.R, KeyCombination.ALT_DOWN).match(event))
            revertTxColumn.setVisible(!revertTxColumn.isVisible());
        else if (new KeyCodeCombination(KeyCode.A, KeyCombination.ALT_DOWN).match(event))
            showStatisticsPopup();
    };
    exportButton.setText("Export to csv");
}
Also used : Script(org.bitcoinj.script.Script) KeyCodeCombination(javafx.scene.input.KeyCodeCombination)

Example 5 with KeyCodeCombination

use of javafx.scene.input.KeyCodeCombination in project Gargoyle by callakrsos.

the class CodeAreaFindAndReplaceHelper method createMenus.

/**
	 *  FindAndReplace에 대한 메뉴를 정의.
	 * @return
	 * @작성자 : KYJ
	 * @작성일 : 2017. 1. 13.
	 */
public Menu createMenus() {
    menuSearch = new Menu("Search");
    miFindReplace = new MenuItem("Find/Replace");
    miFindReplace.setAccelerator(new KeyCodeCombination(KeyCode.F, KeyCombination.CONTROL_DOWN));
    miFindReplace.setOnAction(this::findReplaceEvent);
    menuSearch.getItems().add(miFindReplace);
    return menuSearch;
}
Also used : MenuItem(javafx.scene.control.MenuItem) KeyCodeCombination(javafx.scene.input.KeyCodeCombination) Menu(javafx.scene.control.Menu)

Aggregations

KeyCodeCombination (javafx.scene.input.KeyCodeCombination)21 MenuItem (javafx.scene.control.MenuItem)10 Menu (javafx.scene.control.Menu)9 ContextMenu (javafx.scene.control.ContextMenu)5 Scene (javafx.scene.Scene)4 KeyCode (javafx.scene.input.KeyCode)4 KeyCombination (javafx.scene.input.KeyCombination)4 Popup (io.bitsquare.gui.main.overlays.popups.Popup)3 File (java.io.File)3 MenuBar (javafx.scene.control.MenuBar)3 SeparatorMenuItem (javafx.scene.control.SeparatorMenuItem)3 IOException (java.io.IOException)2 Optional (java.util.Optional)2 Platform (javafx.application.Platform)2 ObservableList (javafx.collections.ObservableList)2 Insets (javafx.geometry.Insets)2 TextField (javafx.scene.control.TextField)2 KeyEvent (javafx.scene.input.KeyEvent)2 VBox (javafx.scene.layout.VBox)2 FileChooser (javafx.stage.FileChooser)2