Example usage for com.vaadin.event ShortcutAction ShortcutAction

List of usage examples for com.vaadin.event ShortcutAction ShortcutAction

Introduction

In this page you can find the example usage for com.vaadin.event ShortcutAction ShortcutAction.

Prototype

public ShortcutAction(String caption, int kc, int... m) 

Source Link

Document

Creates a shortcut that reacts to the given KeyCode and (optionally) ModifierKey s.

Usage

From source file:org.milleni.dunning.ui.dpmaster.DunningProcessSearchPanel.java

License:Apache License

protected void initKeyboardListener() {
    addActionHandler(new Handler() {
        public void handleAction(Action action, Object sender, Object target) {
            DunningProcessListLazyLoadinQuery query = new DunningProcessListLazyLoadinQuery();

            if (nextStepDateStart.getValue() != null)
                query.setNextStepDateStart((Date) nextStepDateStart.getValue());
            if (nextStepDateEnd.getValue() != null)
                query.setNextStepDateEnd((Date) nextStepDateEnd.getValue());

            if (processStartDate.getValue() != null)
                query.setProcessStartDateStart((Date) processStartDate.getValue());
            if (processStartEnd.getValue() != null)
                query.setProcessStartDateEnd((Date) processStartEnd.getValue());

            if (processStatusDateStart.getValue() != null)
                query.setStatusDateStart((Date) processStatusDateStart.getValue());
            if (processStatusDateEnd.getValue() != null)
                query.setStatusDateEnd((Date) processStatusDateEnd.getValue());

            if (invoiceDateStart.getValue() != null)
                query.setInvoiceDateStart((Date) invoiceDateStart.getValue());
            if (invoiceDateEnd.getValue() != null)
                query.setInvoiceDateEnd((Date) invoiceDateEnd.getValue());

            if (dpMaster != null) {
                query.setDpMaster(dpMaster);
            }/*  w ww.  j  av  a2 s . c o  m*/
            dunningProcessPage.setDetailComponent(query);
        }

        public Action[] getActions(Object target, Object sender) {
            return new Action[] { new ShortcutAction("enter", ShortcutAction.KeyCode.ENTER, null) };
        }
    });
}

From source file:org.processbase.ui.servlet.LoginPanel.java

License:Open Source License

public void initUI() {
    setWidth("100%");
    setHeight("100%");
    addComponent(labelLeft, 0, 0);/*www.  j  a va2 s .  co  m*/
    addComponent(labelRight, 2, 0);
    addComponent(panel, 1, 1);
    setComponentAlignment(panel, Alignment.MIDDLE_CENTER);

    panel.setWidth("285px");

    username.setCaption(((PbApplication) getApplication()).getPbMessages().getString("userName"));
    form.addComponent(username);
    username.setWidth("100%");
    username.focus();

    password.setCaption(((PbApplication) getApplication()).getPbMessages().getString("password"));
    password.setWidth("100%");
    form.addComponent(password);

    btnLogin = new Button(((PbApplication) getApplication()).getPbMessages().getString("login"), this,
            "okHandler");
    btnLogin.setStyleName(Runo.BUTTON_DEFAULT);
    action_ok = new ShortcutAction("Default key", ShortcutAction.KeyCode.ENTER, null);
    form.addComponent(btnLogin);
    form.setComponentAlignment(btnLogin, Alignment.BOTTOM_RIGHT);
    //        btnLogin.addListener(this);

    createLogo();
    vlayout.addComponent(logo);
    vlayout.setComponentAlignment(logo, Alignment.MIDDLE_CENTER);
    vlayout.addComponent(form);
    vlayout.setComponentAlignment(form, Alignment.MIDDLE_CENTER);
    vlayout.setMargin(false, true, false, true);
    vlayout.setSpacing(true);
    panel.setContent(vlayout);
    panel.addActionHandler(this);
}