Search in sources :

Example 1 with Keylistener

use of org.zkforge.keylistener.Keylistener in project adempiere by adempiere.

the class WPOSActionPanel method init.

@Override
public void init() {
    Grid LayoutButton = GridFactory.newGridLayout();
    Row row = null;
    Rows rows = null;
    isKeyboard = false;
    LayoutButton.setStyle("border: none; width:400px; height:95%;");
    appendChild(LayoutButton);
    rows = LayoutButton.newRows();
    LayoutButton.setStyle("border:none");
    row = rows.newRow();
    row.setHeight("55px");
    // NEW
    buttonNew = createButtonAction(ACTION_NEW, "F2");
    buttonNew.addActionListener(this);
    row.appendChild(buttonNew);
    // PRINT
    buttonPrint = createButtonAction(ACTION_PRINT, "F12");
    buttonPrint.addActionListener(this);
    row.appendChild(buttonPrint);
    // DocType 
    buttonDocType = createButtonAction(ACTION_DOCTYPE, "F10");
    buttonDocType.addActionListener(this);
    buttonDocType.setTooltiptext("F10-" + Msg.translate(ctx, "C_DocType_ID"));
    row.appendChild(buttonDocType);
    // PRODUCT
    buttonProduct = createButtonAction(ACTION_PRODUCT, "Alt+I");
    buttonProduct.addActionListener(this);
    buttonProduct.setTooltiptext("Alt+I-" + Msg.translate(ctx, "InfoProduct"));
    row.appendChild(buttonProduct);
    // BPartner Search
    buttonBPartner = createButtonAction(ACTION_BPARTNER, "Alt+B");
    buttonBPartner.addActionListener(this);
    buttonBPartner.setTooltiptext("Alt+B-" + Msg.translate(ctx, "IsCustomer"));
    row.appendChild(buttonBPartner);
    buttonProcess = createButtonAction(ACTION_PROCESS, "Alt+P");
    buttonProcess.addActionListener(this);
    buttonProcess.setTooltiptext("ALT+P-" + Msg.translate(ctx, "Process"));
    row.appendChild(buttonProcess);
    // HISTORY
    buttonHistory = createButtonAction(ACTION_HISTORY, "F9");
    buttonHistory.addActionListener(this);
    row.appendChild(buttonHistory);
    buttonBack = createButtonAction(ACTION_BACK, "Alt+Left");
    buttonBack.setTooltiptext("Alt+Left-" + Msg.translate(ctx, "Previous"));
    row.appendChild(buttonBack);
    buttonNext = createButtonAction(ACTION_NEXT, "Alt+Right");
    buttonNext.setTooltiptext("Alt+Right" + Msg.translate(ctx, "Next"));
    row.appendChild(buttonNext);
    // PAYMENT
    buttonCollect = createButtonAction(ACTION_PAYMENT, "F4");
    buttonCollect.addActionListener(this);
    row.appendChild(buttonCollect);
    buttonCollect.setEnabled(false);
    // Cancel
    buttonCancel = createButtonAction(ACTION_CANCEL, "F3");
    buttonCancel.addActionListener(this);
    buttonCancel.setTooltiptext("F3-" + Msg.translate(ctx, "POS.IsCancel"));
    row.appendChild(buttonCancel);
    buttonCancel.setEnabled(false);
    // LOGOUT
    buttonLogout = createButtonAction(ACTION_LOGOUT, "Alt+L");
    buttonLogout.addActionListener(this);
    buttonLogout.setTooltiptext("Alt+L-" + Msg.translate(ctx, "End"));
    row.appendChild(buttonLogout);
    row.setHeight("55px");
    fieldProductName = new WPOSTextField(Msg.translate(Env.getCtx(), "M_Product_ID"), posPanel.getKeyboard());
    fieldProductName.setWidth("98%");
    fieldProductName.setHeight("35px");
    Keylistener keyListener = new Keylistener();
    keyListener.setCtrlKeys("#f2#f3#f4#f9#f10@b@#left@#right^l@i@p");
    keyListener.addEventListener(Events.ON_CTRL_KEY, posPanel);
    keyListener.addEventListener(Events.ON_CTRL_KEY, this);
    keyListener.setAutoBlur(false);
    fieldProductName.setStyle("Font-size:medium; font-weight:bold");
    fieldProductName.setValue(Msg.translate(Env.getCtx(), "M_Product_ID"));
    fieldProductName.addEventListener(this);
    row = rows.newRow();
    row.setSpans("12");
    if (posPanel.isEnableProductLookup() && !posPanel.isVirtualKeyboard()) {
        lookupProduct = new WPOSLookupProduct(this, fieldProductName, new Long("1"));
        lookupProduct.setPriceListId(posPanel.getM_PriceList_ID());
        lookupProduct.setPartnerId(posPanel.getC_BPartner_ID());
        lookupProduct.setWarehouseId(posPanel.getM_Warehouse_ID());
        // , lookupProduct);
        findProductTimer = new Timer(500);
        lookupProduct.setWidth("100%");
        lookupProduct.setStyle(WPOS.FONTSTYLE + WPOS.FONTSIZELARGE);
        fieldProductName.appendChild(keyListener);
        fieldProductName.setVisible(false);
        fieldProductName.setWidth("0%");
        findProductTimer.start();
        lookupProduct.addEventListener(Events.ON_CHANGE, this);
        row.appendChild(lookupProduct);
        row.appendChild(fieldProductName);
    } else {
        row.appendChild(fieldProductName);
        fieldProductName.appendChild(keyListener);
        fieldProductName.setWidth("100%");
    }
    enableButton();
    actionProcessMenu = new WPOSActionMenu(posPanel);
    //	List Orders
    posPanel.listOrder();
    getMainFocus();
}
Also used : Timer(org.zkoss.zul.Timer) Grid(org.adempiere.webui.component.Grid) Row(org.adempiere.webui.component.Row) Keylistener(org.zkforge.keylistener.Keylistener) Rows(org.adempiere.webui.component.Rows)

Example 2 with Keylistener

use of org.zkforge.keylistener.Keylistener in project adempiere by adempiere.

the class ADWindowPanel method doCreatePart.

protected Component doCreatePart(Component parent) {
    layout = new Borderlayout();
    if (parent != null) {
        layout.setParent(parent);
        layout.setStyle("position:absolute");
        layout.setHeight("100%");
        layout.setWidth("100%");
    } else {
        layout.setPage(page);
    }
    if (!isEmbedded()) {
        North n = new North();
        n.setParent(layout);
        n.setCollapsible(false);
        n.setFlex(true);
        Vbox box = new Vbox();
        box.setWidth("100%");
        toolbar.setParent(box);
        box.setParent(n);
        toolbar.setWindowNo(getWindowNo());
        //	FR [ 588 ]
        South s = new South();
        layout.appendChild(s);
        s.setCollapsible(false);
        statusBar.setParent(s);
    } else {
        South s = new South();
        layout.appendChild(s);
        s.setCollapsible(false);
        statusBar.setParent(s);
    }
    LayoutUtils.addSclass("adwindow-status", statusBar);
    if (!isEmbedded() && adTab.isUseExternalSelection()) {
        String tabPlacement = SessionManager.getSessionApplication().getUserPreference().getProperty(UserPreference.P_WINDOW_TAB_PLACEMENT);
        if (tabPlacement == null || "left".equalsIgnoreCase(tabPlacement)) {
            west = new West();
            layout.appendChild(west);
            west.setSplittable(false);
            west.setAutoscroll(true);
            west.setFlex(true);
            LayoutUtils.addSclass("adwindow-nav adwindow-left-nav", west);
            adTab.setTabplacement(IADTab.LEFT);
            adTab.getTabSelectionComponent().setParent(west);
            if (SessionManager.getSessionApplication().getUserPreference().isPropertyBool(UserPreference.P_WINDOW_TAB_COLLAPSIBLE)) {
                west.setTitle(Msg.getElement(Env.getCtx(), "AD_Tab_ID"));
                west.setCollapsible(true);
            }
        } else {
            east = new East();
            layout.appendChild(east);
            east.setSplittable(false);
            east.setAutoscroll(true);
            east.setFlex(true);
            LayoutUtils.addSclass("adwindow-nav adwindow-right-nav", east);
            adTab.setTabplacement(IADTab.RIGHT);
            adTab.getTabSelectionComponent().setParent(east);
            if (SessionManager.getSessionApplication().getUserPreference().isPropertyBool(UserPreference.P_WINDOW_TAB_COLLAPSIBLE)) {
                east.setTitle(Msg.getElement(Env.getCtx(), "AD_Tab_ID"));
                east.setCollapsible(true);
            }
        }
        LayoutUtils.addSclass("adwindow-nav-content", (HtmlBasedComponent) adTab.getTabSelectionComponent());
    }
    contentArea = new Center();
    contentArea.setParent(layout);
    contentArea.setAutoscroll(true);
    contentArea.setFlex(true);
    adTab.createPart(contentArea);
    if (parent instanceof Tabpanel) {
        TabOnCloseHanlder handler = new TabOnCloseHanlder();
        ((Tabpanel) parent).setOnCloseHandler(handler);
    }
    if (!isEmbedded()) {
        if (keyListener != null)
            keyListener.detach();
        keyListener = new Keylistener();
        statusBar.appendChild(keyListener);
        keyListener.setCtrlKeys("#f1#f2#f3#f4#f5#f6#f7#f8#f9#f10#f11#f12^f^i^n^s^d@#left@#right@#up@#down@#pgup@#pgdn@p^p@z@x#enter");
        keyListener.addEventListener(Events.ON_CTRL_KEY, toolbar);
        keyListener.addEventListener(Events.ON_CTRL_KEY, this);
        keyListener.setAutoBlur(false);
    }
    layout.setAttribute(ITabOnSelectHandler.ATTRIBUTE_KEY, new ITabOnSelectHandler() {

        public void onSelect() {
            IADTab adTab = getADTab();
            if (adTab != null) {
                IADTabPanel iadTabpanel = adTab.getSelectedTabpanel();
                if (iadTabpanel != null && iadTabpanel instanceof ADTabPanel) {
                    ADTabPanel adTabpanel = (ADTabPanel) iadTabpanel;
                    if (adTabpanel.isGridView()) {
                        adTabpanel.getGridView().scrollToCurrentRow();
                    }
                }
            }
        }
    });
    return layout;
}
Also used : Center(org.zkoss.zkex.zul.Center) West(org.zkoss.zkex.zul.West) South(org.zkoss.zkex.zul.South) Borderlayout(org.zkoss.zkex.zul.Borderlayout) IADTab(org.adempiere.webui.component.IADTab) ITabOnSelectHandler(org.adempiere.webui.part.ITabOnSelectHandler) North(org.zkoss.zkex.zul.North) Keylistener(org.zkforge.keylistener.Keylistener) Vbox(org.zkoss.zul.Vbox) East(org.zkoss.zkex.zul.East) Tabpanel(org.adempiere.webui.component.Tabpanel)

Example 3 with Keylistener

use of org.zkforge.keylistener.Keylistener in project adempiere by adempiere.

the class WPOSQuantityPanel method init.

@Override
protected void init() {
    Grid LayoutButton = GridFactory.newGridLayout();
    Rows rows = null;
    Row row = null;
    parameterPanel = new Panel();
    parameterPanel.appendChild(LayoutButton);
    LayoutButton.setWidth("100%");
    LayoutButton.setHeight("100%");
    rows = LayoutButton.newRows();
    row = rows.newRow();
    row.setHeight("55px");
    buttonDelete = createButtonAction("Cancel", "Ctrl+F3");
    buttonDelete.setTooltiptext("Ctrl+F3-" + Msg.translate(ctx, "DeleteLine"));
    buttonDelete.addActionListener(this);
    row.appendChild(buttonDelete);
    buttonPlus = createButtonAction("Plus", "Ctrl+1");
    buttonPlus.setTooltiptext("Ctrl+0-" + Msg.translate(ctx, "add"));
    row.appendChild(buttonPlus);
    buttonMinus = createButtonAction("Minus", "Ctrl+0");
    row.appendChild(buttonMinus);
    buttonUp = createButtonAction(ACTION_UP, "Alt+Up");
    buttonUp.setTooltiptext("Alt+Up-" + Msg.translate(ctx, "Previous"));
    row.appendChild(buttonUp);
    buttonDown = createButtonAction(ACTION_DOWN, "Alt+Down");
    buttonDown.setTooltiptext("Alt+Down-" + Msg.translate(ctx, "Next"));
    row.appendChild(buttonDown);
    if (posPanel.isPresentElectronicScales()) {
        buttonScales = createButtonAction("Calculator", "Ctrl+W");
        buttonScales.setTooltiptext("ALT+down-" + Msg.translate(ctx, "Calculator"));
        row.appendChild(buttonScales);
    //			buttonScales.addActionListener(posPanel.getScalesListener());
    }
    Label qtyLabel = new Label(Msg.translate(Env.getCtx(), "QtyOrdered"));
    row.appendChild(qtyLabel);
    fieldQuantity = new POSNumberBox(false);
    row.appendChild(fieldQuantity);
    fieldQuantity.addEventListener(Events.ON_OK, this);
    fieldQuantity.addEventListener(Events.ON_CHANGE, this);
    fieldQuantity.setStyle("display: inline;width:65px;height:30px;Font-size:medium;");
    Label priceLabel = new Label(Msg.translate(Env.getCtx(), "PriceActual"));
    row.appendChild(priceLabel);
    fieldPrice = new POSNumberBox(false);
    DecimalFormat format = DisplayType.getNumberFormat(DisplayType.Amount, AEnv.getLanguage(Env.getCtx()));
    fieldPrice.getDecimalbox().setFormat(format.toPattern());
    fieldPrice.setTooltiptext(Msg.translate(Env.getCtx(), "PriceActual"));
    row.appendChild(fieldPrice);
    if (!posPanel.isModifyPrice())
        fieldPrice.setEnabled(false);
    else {
        fieldPrice.addEventListener(Events.ON_OK, this);
        fieldPrice.addEventListener(Events.ON_CHANGE, this);
    }
    fieldPrice.setStyle("display: inline;width:70px;height:30px;Font-size:medium;");
    Label priceDiscount = new Label(Msg.translate(Env.getCtx(), "Discount"));
    row.appendChild(priceDiscount);
    fieldDiscountPercentage = new POSNumberBox(false);
    row.appendChild(fieldDiscountPercentage);
    fieldDiscountPercentage.setTooltiptext(Msg.translate(Env.getCtx(), "Discount"));
    if (!posPanel.isModifyPrice())
        fieldDiscountPercentage.setEnabled(false);
    else {
        fieldDiscountPercentage.addEventListener(Events.ON_OK, this);
        fieldDiscountPercentage.addEventListener(Events.ON_CHANGE, this);
    }
    fieldDiscountPercentage.setStyle("display: inline;width:70px;height:30px;Font-size:medium;");
    Keylistener keyListener = new Keylistener();
    fieldPrice.appendChild(keyListener);
    keyListener.setCtrlKeys("@#up@#down^#f3^1^0");
    keyListener.addEventListener(Events.ON_CTRL_KEY, posPanel);
    keyListener.addEventListener(Events.ON_CTRL_KEY, this);
    keyListener.setAutoBlur(false);
    changeStatus(false);
}
Also used : Panel(org.adempiere.webui.component.Panel) Grid(org.adempiere.webui.component.Grid) DecimalFormat(java.text.DecimalFormat) Label(org.adempiere.webui.component.Label) Row(org.adempiere.webui.component.Row) Keylistener(org.zkforge.keylistener.Keylistener) Rows(org.adempiere.webui.component.Rows)

Aggregations

Keylistener (org.zkforge.keylistener.Keylistener)3 Grid (org.adempiere.webui.component.Grid)2 Row (org.adempiere.webui.component.Row)2 Rows (org.adempiere.webui.component.Rows)2 DecimalFormat (java.text.DecimalFormat)1 IADTab (org.adempiere.webui.component.IADTab)1 Label (org.adempiere.webui.component.Label)1 Panel (org.adempiere.webui.component.Panel)1 Tabpanel (org.adempiere.webui.component.Tabpanel)1 ITabOnSelectHandler (org.adempiere.webui.part.ITabOnSelectHandler)1 Borderlayout (org.zkoss.zkex.zul.Borderlayout)1 Center (org.zkoss.zkex.zul.Center)1 East (org.zkoss.zkex.zul.East)1 North (org.zkoss.zkex.zul.North)1 South (org.zkoss.zkex.zul.South)1 West (org.zkoss.zkex.zul.West)1 Timer (org.zkoss.zul.Timer)1 Vbox (org.zkoss.zul.Vbox)1