Package org.zanata.webtrans.client.events

Examples of org.zanata.webtrans.client.events.KeyShortcutEventHandler


        glossaryDetailsPresenter.onBind();
        keyShortcutPresenter.register(KeyShortcut.Builder.builder()
                .addKey(new Keys(Keys.NO_MODIFIER, KeyCodes.KEY_ENTER))
                .setContext(ShortcutContext.Glossary)
                .setDescription(messages.searchGlossary())
                .setHandler(new KeyShortcutEventHandler() {
                    @Override
                    public void onKeyShortcut(KeyShortcutEvent event) {
                        fireSearchEvent();
                    }
                }).build());
View Full Code Here


    private void registerKeyShortcut() {
        KeyShortcut confirmShortcut =
                KeyShortcut.Builder.builder()
                        .addKey(new Keys(Keys.CTRL_KEY, KeyCodes.KEY_ENTER))
                        .setContext(ShortcutContext.TransHistoryPopup)
                        .setHandler(new KeyShortcutEventHandler() {
                            @Override
                            public void onKeyShortcut(KeyShortcutEvent event) {
                                addComment(display.getComment());
                            }
                        }).build();
View Full Code Here

        keyShortcutPresenter.register(KeyShortcut.Builder.builder()
                .addKey(new Keys(Keys.SHIFT_ALT_KEYS, 'A'))
                .setContext(ShortcutContext.ProjectWideSearch)
                .setDescription(messages.selectAllTextFlowsKeyShortcut())
                .setHandler(new KeyShortcutEventHandler() {
                    @Override
                    public void onKeyShortcut(KeyShortcutEvent event) {
                        display.getSelectAllChk().setValue(
                                !display.getSelectAllChk().getValue(), true);
                    }
                }).build());

        keyShortcutPresenter.register(KeyShortcut.Builder.builder()
                .addKey(new Keys(Keys.ALT_KEY, 'P'))
                .setContext(ShortcutContext.ProjectWideSearch)
                .setDescription(messages.focusSearchPhraseKeyShortcut())
                .setHandler(new KeyShortcutEventHandler() {
                    @Override
                    public void onKeyShortcut(KeyShortcutEvent event) {
                        display.focusFilterTextBox();
                    }
                }).build());

        keyShortcutPresenter.register(KeyShortcut.Builder.builder()
                .addKey(new Keys(Keys.ALT_KEY, 'C'))
                .setContext(ShortcutContext.ProjectWideSearch)
                .setDescription(messages.focusReplacementPhraseKeyShortcut())
                .setHandler(new KeyShortcutEventHandler() {
                    @Override
                    public void onKeyShortcut(KeyShortcutEvent event) {
                        display.focusReplacementTextBox();
                    }
                }).build());

        keyShortcutPresenter.register(KeyShortcut.Builder.builder()
                .addKey(new Keys(Keys.ALT_KEY, 'R'))
                .setContext(ShortcutContext.ProjectWideSearch)
                .setDescription(messages.replaceSelectedKeyShortcut())
                .setHandler(new KeyShortcutEventHandler() {
                    @Override
                    public void onKeyShortcut(KeyShortcutEvent event) {
                        replaceSelected();
                    }
                }).build());

        keyShortcutPresenter.register(KeyShortcut.Builder.builder()
                .addKey(new Keys(Keys.ALT_KEY, 'W'))
                .setContext(ShortcutContext.ProjectWideSearch)
                .setDescription(messages.toggleRowActionButtons())
                .setHandler(new KeyShortcutEventHandler() {
                    @Override
                    public void onKeyShortcut(KeyShortcutEvent event) {
                        showRowActionButtons = !showRowActionButtons;
                    }
                }).build());
View Full Code Here

        keyShortcutPresenter.register(KeyShortcut.Builder.builder()
                .addKey(new Keys(Keys.NO_MODIFIER, KeyCodes.KEY_ENTER))
                .setContext(ShortcutContext.TM)
                .setDescription(messages.searchTM())
                .setHandler(new KeyShortcutEventHandler() {
                    @Override
                    public void onKeyShortcut(KeyShortcutEvent event) {
                        fireSearchEvent();
                    }
                }).build());
View Full Code Here

                WorkspaceContextUpdateEvent.getType(), this));
        registerHandler(eventBus.addHandler(DisplaySouthPanelEvent.TYPE, this));
        setSouthPanelReadOnly(userWorkspaceContext.hasReadOnlyAccess());

        // navigate to previous row shortcut
        KeyShortcutEventHandler gotoPreRowHandler =
                new KeyShortcutEventHandler() {
                    @Override
                    public void onKeyShortcut(KeyShortcutEvent event) {
                        targetContentsPresenter
                                .savePendingChangesIfApplicable();
                        eventBus.fireEvent(NavTransUnitEvent.PREV_ENTRY_EVENT);
                    }
                };
        KeyShortcut movePreviousShortcut =
                KeyShortcut.Builder.builder()
                        .addKey(new Keys(Keys.ALT_KEY, KeyCodes.KEY_UP))
                        .addKey(new Keys(Keys.ALT_KEY, 'J'))
                        .setContext(ShortcutContext.Navigation)
                        .setDescription(messages.navigateToPreviousRow())
                        .setPreventDefault(true).setStopPropagation(true)
                        .setHandler(gotoPreRowHandler).build();
        keyShortcutPresenter.register(movePreviousShortcut);

        // navigate to next row shortcut
        KeyShortcutEventHandler gotoNextRowHandler =
                new KeyShortcutEventHandler() {
                    @Override
                    public void onKeyShortcut(KeyShortcutEvent event) {
                        targetContentsPresenter
                                .savePendingChangesIfApplicable();
                        eventBus.fireEvent(NavTransUnitEvent.NEXT_ENTRY_EVENT);
                    }
                };
        KeyShortcut moveNextShortcut =
                KeyShortcut.Builder.builder()
                        .addKey(new Keys(Keys.ALT_KEY, KeyCodes.KEY_DOWN))
                        .addKey(new Keys(Keys.ALT_KEY, 'K'))
                        .setContext(ShortcutContext.Navigation)
                        .setDescription(messages.navigateToNextRow())
                        .setPreventDefault(true).setStopPropagation(true)
                        .setHandler(gotoNextRowHandler).build();
        keyShortcutPresenter.register(moveNextShortcut);

        // Register shortcut Enter to open editor in selected row - if no other
        // input field is in focus
        KeyShortcut startEditingShortcut =
                KeyShortcut.Builder.builder()
                        .addKey(new Keys(Keys.NO_MODIFIER, KeyCodes.KEY_ENTER))
                        .setContext(ShortcutContext.Navigation)
                        .setDescription(messages.openEditorInSelectedRow())
                        .setKeyEvent(KeyEvent.KEY_UP)
                        .setHandler(new KeyShortcutEventHandler() {
                            @Override
                            public void onKeyShortcut(KeyShortcutEvent event) {
                                if (!isOtherInputFieldFocused()
                                        && userWorkspaceContext
                                                .getWorkspaceRestrictions()
View Full Code Here

    private void registerKeyShortcuts() {
        keyShortcutPresenter.register(KeyShortcut.Builder.builder()
                .addKey(new Keys(Keys.ALT_KEY, 'L'))
                .setContext(ShortcutContext.Application)
                .setDescription(messages.showDocumentListKeyShortcut())
                .setHandler(new KeyShortcutEventHandler() {
                    @Override
                    public void onKeyShortcut(KeyShortcutEvent event) {
                        HistoryToken token = history.getHistoryToken();
                        token.setView(MainView.Documents);
                        history.newItem(token.toTokenString());
                    }
                }).build());

        keyShortcutPresenter.register(KeyShortcut.Builder.builder()
                .addKey(new Keys(Keys.ALT_KEY, 'O'))
                .setContext(ShortcutContext.Application)
                .setDescription(messages.showEditorKeyShortcut())
                .setHandler(new KeyShortcutEventHandler() {
                    @Override
                    public void onKeyShortcut(KeyShortcutEvent event) {
                        if (selectedDocument == null) {
                            eventBus.fireEvent(new NotificationEvent(
                                    Severity.Warning, messages
                                            .noDocumentSelected()));
                        } else {
                            HistoryToken token = history.getHistoryToken();
                            token.setView(MainView.Editor);
                            history.newItem(token.toTokenString());
                        }
                    }
                }).build());

        keyShortcutPresenter.register(KeyShortcut.Builder.builder()
                .addKey(new Keys(Keys.ALT_KEY, 'P'))
                .setContext(ShortcutContext.Application)
                .setDescription(messages.showProjectWideSearch())
                .setHandler(new KeyShortcutEventHandler() {
                    @Override
                    public void onKeyShortcut(KeyShortcutEvent event) {
                        HistoryToken token = history.getHistoryToken();
                        token.setView(MainView.Search);
                        history.newItem(token.toTokenString());
View Full Code Here

    protected void onBind() {
        keyShortcutPresenter.register(KeyShortcut.Builder.builder()
                .addKey(new Keys(Keys.NO_MODIFIER, KeyCodes.KEY_ENTER))
                .setContext(ShortcutContext.Chat)
                .setDescription(messages.publishChatContent())
                .setHandler(new KeyShortcutEventHandler() {
                    @Override
                    public void onKeyShortcut(KeyShortcutEvent event) {
                        dispatchChatAction(identity.getPerson().getId()
                                .toString(), display.getChatInputText(),
                                MESSAGE_TYPE.USER_MSG);
View Full Code Here

                        .addKey(new Keys(Keys.ALT_KEY, 'K'))
                        .setContext(ShortcutContext.Edit)
                        .setDescription(messages.moveToNextRow())
                        .setPreventDefault(true).setStopPropagation(true)
                        .setPreventDefault(true)
                        .setHandler(new KeyShortcutEventHandler() {
                            @Override
                            public void onKeyShortcut(KeyShortcutEvent event) {
                                targetContentsPresenter.moveToNextEntry();
                            }
                        }).build();
        keyShortcutPresenter.register(moveNextShortcut);

        KeyShortcut movePreviousShortcut =
                KeyShortcut.Builder.builder()
                        .addKey(new Keys(Keys.ALT_KEY, KeyCodes.KEY_UP))
                        .addKey(new Keys(Keys.ALT_KEY, 'J'))
                        .setContext(ShortcutContext.Edit)
                        .setDescription(messages.moveToPreviousRow())
                        .setPreventDefault(true).setStopPropagation(true)
                        .setHandler(new KeyShortcutEventHandler() {
                            @Override
                            public void onKeyShortcut(KeyShortcutEvent event) {
                                targetContentsPresenter.moveToPreviousEntry();
                            }
                        }).build();
        keyShortcutPresenter.register(movePreviousShortcut);

        nextStateShortcut =
                KeyShortcut.Builder.builder()
                        .addKey(new Keys(Keys.ALT_KEY, KeyCodes.KEY_PAGEDOWN))
                        .setContext(ShortcutContext.Edit)
                        .setDescription(messages.nextIncomplete())
                        .setPreventDefault(true).setStopPropagation(true)
                        .setHandler(new KeyShortcutEventHandler() {
                            @Override
                            public void onKeyShortcut(KeyShortcutEvent event) {
                                targetContentsPresenter
                                    .savePendingChangesIfApplicable();
                                eventBus.fireEvent(new NavTransUnitEvent(
                                    NextState));
                            }
                        }).build();
        keyShortcutPresenter.register(nextStateShortcut);

        prevStateShortcut =
                KeyShortcut.Builder.builder()
                        .addKey(new Keys(Keys.ALT_KEY, KeyCodes.KEY_PAGEUP))
                        .setContext(ShortcutContext.Edit)
                        .setDescription(messages.prevIncomplete())
                        .setPreventDefault(true).setStopPropagation(true)
                        .setHandler(new KeyShortcutEventHandler() {
                            @Override
                            public void onKeyShortcut(KeyShortcutEvent event) {
                                targetContentsPresenter
                                    .savePendingChangesIfApplicable();
                                eventBus.fireEvent(new NavTransUnitEvent(
View Full Code Here

                KeyShortcut.Builder.builder()
                        .addKey(new Keys(Keys.CTRL_KEY, 'S'))
                        .setContext(ShortcutContext.Edit)
                        .setDescription(messages.saveAsFuzzy())
                        .setPreventDefault(true).setStopPropagation(true)
                        .setHandler(new KeyShortcutEventHandler() {
                            @Override
                            public void onKeyShortcut(KeyShortcutEvent event) {
                                targetContentsPresenter
                                        .saveAsFuzzy(targetContentsPresenter
                                                .getCurrentTransUnitIdOrNull());
                            }
                        }).build();
        keyShortcutPresenter.register(saveFuzzyShortcut);

        KeyShortcutEventHandler saveAsApprovedKeyShortcutHandler =
                new KeyShortcutEventHandler() {
                    @Override
                    public void onKeyShortcut(KeyShortcutEvent event) {
                        targetContentsPresenter.checkConfirmationBeforeSave();
                    }
                };

        KeyShortcut ctrlEnterShortcut =
                KeyShortcut.Builder.builder()
                        .addKey(new Keys(Keys.CTRL_KEY, KeyCodes.KEY_ENTER))
                        .setContext(ShortcutContext.Edit)
                        .setDescription(messages.saveAsTranslated())
                        .setPreventDefault(true).setStopPropagation(true)
                        .setHandler(saveAsApprovedKeyShortcutHandler).build();
        keyShortcutPresenter.register(ctrlEnterShortcut);
        enterSavesApprovedShortcut =
                KeyShortcut.Builder.builder()
                        .addKey(new Keys(Keys.NO_MODIFIER, KeyCodes.KEY_ENTER))
                        .setContext(ShortcutContext.Edit)
                        .setDescription(messages.saveAsTranslated())
                        .setPreventDefault(true).setStopPropagation(true)
                        .setHandler(saveAsApprovedKeyShortcutHandler).build();
        if (configHolder.getState().isEnterSavesApproved()) {
            enterSavesApprovedHandlerRegistration =
                    keyShortcutPresenter.register(enterSavesApprovedShortcut);
        }

        KeyShortcut copySourceShortcut =
                KeyShortcut.Builder.builder()
                        .addKey(new Keys(Keys.ALT_KEY, 'G'))
                        .addAttentionKey(new Keys('G'))
                        .setContext(ShortcutContext.Edit)
                        .setDescription(messages.copyFromSource())
                        .setStopPropagation(true).setPreventDefault(true)
                        .setHandler(new KeyShortcutEventHandler() {
                            @Override
                            public void onKeyShortcut(KeyShortcutEvent event) {
                                targetContentsPresenter
                                        .copySourceForActiveRow();
                            }
                        }).build();
        keyShortcutPresenter.register(copySourceShortcut);

        KeyShortcut switchEditorShortcut =
                KeyShortcut.Builder.builder()
                        .addKey(new Keys(Keys.CTRL_ALT_KEYS, 'H'))
                        .addAttentionKey(new Keys('H'))
                        .setContext(ShortcutContext.Edit)
                        .setDescription(messages.switchBetweenEditor())
                        .setStopPropagation(true).setPreventDefault(true)
                        .setHandler(new KeyShortcutEventHandler() {
                            @Override
                            public void onKeyShortcut(KeyShortcutEvent event) {
                                targetContentsPresenter.toggleSyntaxHighlighting();
                            }
                        }).build();
View Full Code Here

    private void registerKeyShortcut() {
        KeyShortcut confirmShortcut =
                KeyShortcut.Builder.builder()
                        .addKey(new Keys(Keys.CTRL_KEY, KeyCodes.KEY_ENTER))
                        .setContext(ShortcutContext.RejectConfirmationPopup)
                        .setHandler(new KeyShortcutEventHandler() {
                            @Override
                            public void onKeyShortcut(KeyShortcutEvent event) {
                                addComment(display.getComment());
                            }
                        }).build();
View Full Code Here

TOP

Related Classes of org.zanata.webtrans.client.events.KeyShortcutEventHandler

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.