Search in sources :

Example 1 with Textbox

use of org.adempiere.webui.component.Textbox in project adempiere by adempiere.

the class WPaySelect method onEvent.

//	dispose
/**************************************************************************
	 *  ActionListener
	 *  @param e event
	 */
public void onEvent(Event e) {
    boolean triggerRefresh = false;
    if (!m_loadedOK)
        return;
    if (e != null) {
        Component component = e.getTarget();
        if (component != null) {
            //  Generic components in the criteria fields
            if (component instanceof Textbox) {
                Textbox tb = ((Textbox) component);
                if (tb.hasChanged()) {
                    triggerRefresh = true;
                } else {
                    //else
                    return;
                }
            } else if (component instanceof Checkbox) {
                //  Check box changes generally always cause a refresh
                //  Capture changes that don't in a specific event handler
                triggerRefresh = true;
                Checkbox cb = (Checkbox) component;
                if (cb.getName() != null && cb.getName().equals("AutoQuery")) {
                    //  Only trigger a refresh if the check box is selected
                    if (!cb.isSelected()) {
                        return;
                    }
                }
            } else {
                //  Assume another type of component
                if (e.getName().equals("onChange") || e.getName().equals("onSelect")) {
                    triggerRefresh = true;
                }
            }
            String fieldName = "";
            if (component.getAttribute("fieldName") != null) {
                fieldName = (String) component.getAttribute("fieldName");
            }
            if (triggerRefresh && fieldName.equals("fieldBankAccount")) {
                loadBankInfo();
            }
            //  Generate PaySelection
            if (component.equals(bGenerate)) {
                generatePaySelect();
                dispose();
            } else if (component.equals(bCancel))
                dispose();
            // Refresh if the autoquery feature is selected or the refresh button is clicked.
            if (component.equals(bRefresh) || (checkAutoQuery.isSelected() && triggerRefresh)) {
                setFieldOldValues();
                loadTableInfo();
            }
        }
    }
}
Also used : Checkbox(org.adempiere.webui.component.Checkbox) Textbox(org.adempiere.webui.component.Textbox) Component(org.zkoss.zk.ui.Component)

Example 2 with Textbox

use of org.adempiere.webui.component.Textbox in project adempiere by adempiere.

the class WBrowserListItemRenderer method onEvent.

@Override
public void onEvent(Event event) throws Exception {
    int col = -1;
    int row = -1;
    Object value = null;
    TableValueChangeEvent vcEvent = null;
    WTableColumn tableColumn;
    Component source = event.getTarget();
    if (isWithinListCell(source)) {
        row = getRowPosition(source);
        col = getColumnPosition(source);
        tableColumn = m_tableColumns.get(col);
        if (source instanceof Checkbox) {
            value = Boolean.valueOf(((Checkbox) source).isChecked());
        } else if (source instanceof Decimalbox) {
            value = ((Decimalbox) source).getValue();
        } else if (source instanceof Datebox) {
            value = ((Datebox) source).getValue();
        } else if (source instanceof Textbox) {
            value = ((Textbox) source).getValue();
        }
        if (value != null) {
            vcEvent = new TableValueChangeEvent(source, tableColumn.getHeaderValue().toString(), row, col, value, value);
            fireTableValueChange(vcEvent);
        }
    } else if (event.getTarget() instanceof WBrowserTable && Events.ON_SELECT.equals(event.getName())) {
        WBrowserTable table = (WBrowserTable) event.getTarget();
        if (table.isCheckmark()) {
            int cnt = table.getRowCount();
            if (cnt == 0 || !(table.getValueAt(0, 0) instanceof IDColumn))
                return;
            //update IDColumn
            tableColumn = m_tableColumns.get(0);
            for (int i = 0; i < cnt; i++) {
                IDColumn idcolumn = (IDColumn) table.getValueAt(i, 0);
                if (idcolumn != null) {
                    Listitem item = table.getItemAtIndex(i);
                    value = item.isSelected();
                    Boolean old = idcolumn.isSelected();
                    if (!old.equals(value)) {
                        vcEvent = new TableValueChangeEvent(source, tableColumn.getHeaderValue().toString(), i, 0, old, value);
                        fireTableValueChange(vcEvent);
                    }
                }
            }
        }
    }
    return;
}
Also used : Datebox(org.adempiere.webui.component.Datebox) WTableColumn(org.adempiere.webui.component.WTableColumn) Textbox(org.adempiere.webui.component.Textbox) Listitem(org.zkoss.zul.Listitem) IDColumn(org.compiere.minigrid.IDColumn) Decimalbox(org.zkoss.zul.Decimalbox) Checkbox(org.adempiere.webui.component.Checkbox) Component(org.zkoss.zk.ui.Component) TableValueChangeEvent(org.adempiere.webui.event.TableValueChangeEvent)

Example 3 with Textbox

use of org.adempiere.webui.component.Textbox in project adempiere by adempiere.

the class FindWindow method initSimple.

/**
     * initialise lookup record tab
     * @throws IOException 
     *
    **/
private void initSimple() throws IOException {
    lblDocumentNo = new Label();
    lblDocumentNo.setValue(Msg.translate(Env.getCtx(), "DocumentNo").replaceAll("&", ""));
    lblDescription = new Label();
    lblDescription.setValue(Msg.translate(Env.getCtx(), "Description").replaceAll("&", ""));
    lblName = new Label();
    lblName.setValue(Msg.translate(Env.getCtx(), "Name").replaceAll("&", ""));
    lblValue = new Label();
    lblValue.setValue(Msg.translate(Env.getCtx(), "Value").replaceAll("&", ""));
    fieldDocumentNo = new Textbox();
    fieldDocumentNo.setId("fieldDocumentNo");
    fieldDocumentNo.setMaxlength(40);
    fieldDescription = new Textbox();
    fieldDescription.setId("fieldDescription");
    fieldDescription.setMaxlength(40);
    fieldName = new Textbox();
    fieldName.setMaxlength(40);
    fieldValue = new Textbox();
    fieldValue.setMaxlength(40);
    //	Get button from Action
    WAppsAction action = new WAppsAction(ConfirmPanel.A_NEW, null, ConfirmPanel.A_NEW);
    Button btnNew = action.getButton();
    btnNew.setName("btnNew");
    btnNew.addEventListener(Events.ON_CLICK, this);
    //	Get button from Action
    action = new WAppsAction(ConfirmPanel.A_OK, null, ConfirmPanel.A_OK);
    Button btnOk = action.getButton();
    btnOk.setName("btnOkSimple");
    btnOk.addEventListener(Events.ON_CLICK, this);
    //	Get from action
    action = new WAppsAction(ConfirmPanel.A_CANCEL, null, ConfirmPanel.A_CANCEL);
    Button btnCancel = action.getButton();
    btnCancel.setName("btnCancel");
    btnCancel.addEventListener(Events.ON_CLICK, this);
    Panel pnlButtonRight = new Panel();
    //	Change to Standard button order
    pnlButtonRight.appendChild(btnCancel);
    pnlButtonRight.appendChild(btnOk);
    pnlButtonRight.setAlign("right");
    pnlButtonRight.setWidth("100%");
    Panel pnlButtonLeft = new Panel();
    pnlButtonLeft.appendChild(btnNew);
    Hbox hboxButton = new Hbox();
    hboxButton.appendChild(pnlButtonLeft);
    hboxButton.appendChild(pnlButtonRight);
    hboxButton.setWidth("100%");
    pnlDocument = new Row();
    pnlDocument.setId("pnlDocument");
    pnlDocument.appendChild(LayoutUtils.makeRightAlign(lblDocumentNo));
    pnlDocument.appendChild(fieldDocumentNo);
    pnlDescription = new Row();
    pnlDescription.appendChild(LayoutUtils.makeRightAlign(lblDescription));
    pnlDescription.appendChild(fieldDescription);
    pnlValue = new Row();
    pnlValue.appendChild(LayoutUtils.makeRightAlign(lblValue));
    pnlValue.appendChild(fieldValue);
    pnlName = new Row();
    pnlName.appendChild(LayoutUtils.makeRightAlign(lblName));
    pnlName.appendChild(fieldName);
    contentSimple = new Grid();
    contentSimple.setId("contentSimple");
    contentSimple.setWidth("100%");
    contentSimple.makeNoStrip();
    contentSimpleRows = new Rows();
    contentSimple.appendChild(contentSimpleRows);
    contentSimpleRows.appendChild(pnlValue);
    contentSimpleRows.appendChild(pnlName);
    contentSimpleRows.appendChild(pnlDocument);
    contentSimpleRows.appendChild(pnlDescription);
    contentSimple.setVflex(true);
    Borderlayout layout = new Borderlayout();
    layout.setStyle("height: 100%; width: 99%; position: relative");
    winLookupRecord.appendChild(layout);
    Center center = new Center();
    layout.appendChild(center);
    center.appendChild(contentSimple);
    center.setFlex(true);
    South south = new South();
    layout.appendChild(south);
    south.appendChild(hboxButton);
    winLookupRecord.setWidth("100%");
    winLookupRecord.setHeight("100%");
    winLookupRecord.addEventListener(Events.ON_OK, this);
}
Also used : Panel(org.adempiere.webui.component.Panel) ConfirmPanel(org.adempiere.webui.component.ConfirmPanel) Hbox(org.zkoss.zul.Hbox) Center(org.zkoss.zkex.zul.Center) Button(org.adempiere.webui.component.Button) ToolBarButton(org.adempiere.webui.component.ToolBarButton) Grid(org.adempiere.webui.component.Grid) Label(org.adempiere.webui.component.Label) Textbox(org.adempiere.webui.component.Textbox) South(org.zkoss.zkex.zul.South) Row(org.adempiere.webui.component.Row) Borderlayout(org.zkoss.zkex.zul.Borderlayout) WAppsAction(org.adempiere.webui.component.WAppsAction) Rows(org.adempiere.webui.component.Rows)

Example 4 with Textbox

use of org.adempiere.webui.component.Textbox in project adempiere by adempiere.

the class POSNumberBox method getCalculatorPopup.

private Popup getCalculatorPopup() {
    Popup popup = new Popup();
    Vbox vbox = new Vbox();
    char separatorChar = DisplayType.getNumberFormat(DisplayType.Number, Env.getLanguage(Env.getCtx())).getDecimalFormatSymbols().getDecimalSeparator();
    String separator = Character.toString(separatorChar);
    txtCalc = new Textbox();
    txtCalc.setAction("onKeyPress : return calc.validate('" + decimalBox.getId() + "','" + txtCalc.getId() + "'," + integral + "," + (int) separatorChar + ", event);");
    txtCalc.setMaxlength(250);
    txtCalc.setCols(30);
    txtCalc.setWidth("98%");
    txtCalc.setHeight("30px");
    txtCalc.setStyle(FONT_SIZE);
    String txtCalcId = txtCalc.getId();
    vbox.appendChild(txtCalc);
    Hbox row1 = new Hbox();
    Button btnAC = new Button();
    btnAC.setWidth("60px");
    btnAC.setHeight("60px");
    btnAC.setStyle(FONT_SIZE);
    btnAC.setLabel("AC");
    btnAC.setAction("onClick : calc.clearAll('" + txtCalcId + "')");
    Button btn7 = new Button();
    btn7.setWidth("60px");
    btn7.setHeight("60px");
    btn7.setStyle(FONT_SIZE);
    btn7.setLabel("7");
    btn7.setAction("onClick : calc.append('" + txtCalcId + "', '7')");
    Button btn8 = new Button();
    btn8.setWidth("60px");
    btn8.setHeight("60px");
    btn8.setStyle(FONT_SIZE);
    btn8.setLabel("8");
    btn8.setAction("onClick : calc.append('" + txtCalcId + "', '8')");
    Button btn9 = new Button();
    btn9.setWidth("60px");
    btn9.setHeight("60px");
    btn9.setStyle(FONT_SIZE);
    btn9.setLabel("9");
    btn9.setAction("onClick : calc.append('" + txtCalcId + "', '9')");
    Button btnMultiply = new Button();
    btnMultiply.setWidth("60px");
    btnMultiply.setHeight("60px");
    btnMultiply.setStyle(FONT_SIZE);
    btnMultiply.setLabel("*");
    btnMultiply.setAction("onClick : calc.append('" + txtCalcId + "', ' * ')");
    row1.appendChild(btnAC);
    row1.appendChild(btn7);
    row1.appendChild(btn8);
    row1.appendChild(btn9);
    row1.appendChild(btnMultiply);
    Hbox row2 = new Hbox();
    Button btnC = new Button();
    btnC.setWidth("60px");
    btnC.setHeight("60px");
    btnC.setStyle(FONT_SIZE);
    btnC.setLabel("C");
    btnC.setAction("onClick : calc.clear('" + txtCalcId + "')");
    Button btn4 = new Button();
    btn4.setWidth("60px");
    btn4.setHeight("60px");
    btn4.setStyle(FONT_SIZE);
    btn4.setLabel("4");
    btn4.setAction("onClick : calc.append('" + txtCalcId + "', '4')");
    Button btn5 = new Button();
    btn5.setWidth("60px");
    btn5.setHeight("60px");
    btn5.setStyle(FONT_SIZE);
    btn5.setLabel("5");
    btn5.setAction("onClick : calc.append('" + txtCalcId + "', '5')");
    Button btn6 = new Button();
    btn6.setWidth("60px");
    btn6.setHeight("60px");
    btn6.setStyle(FONT_SIZE);
    btn6.setLabel("6");
    btn6.setAction("onClick : calc.append('" + txtCalcId + "', '6')");
    Button btnDivide = new Button();
    btnDivide.setWidth("60px");
    btnDivide.setHeight("60px");
    btnDivide.setStyle(FONT_SIZE);
    btnDivide.setLabel("/");
    btnDivide.setAction("onClick : calc.append('" + txtCalcId + "', ' / ')");
    row2.appendChild(btnC);
    row2.appendChild(btn4);
    row2.appendChild(btn5);
    row2.appendChild(btn6);
    row2.appendChild(btnDivide);
    Hbox row3 = new Hbox();
    Button btnModulo = new Button();
    btnModulo.setWidth("60px");
    btnModulo.setHeight("60px");
    btnModulo.setStyle(FONT_SIZE);
    btnModulo.setLabel("%");
    btnModulo.setAction("onClick : calc.percentage('" + decimalBox.getId() + "','" + txtCalcId + "','" + separator + "')");
    Button btn1 = new Button();
    btn1.setWidth("60px");
    btn1.setHeight("60px");
    btn1.setStyle(FONT_SIZE);
    btn1.setLabel("1");
    btn1.setAction("onClick : calc.append('" + txtCalcId + "', '1')");
    Button btn2 = new Button();
    btn2.setWidth("60px");
    btn2.setHeight("60px");
    btn2.setLabel("2");
    btn2.setStyle(FONT_SIZE);
    btn2.setAction("onClick : calc.append('" + txtCalcId + "', '2')");
    Button btn3 = new Button();
    btn3.setWidth("60px");
    btn3.setHeight("60px");
    btn3.setStyle(FONT_SIZE);
    btn3.setLabel("3");
    btn3.setAction("onClick : calc.append('" + txtCalcId + "', '3')");
    Button btnSubstract = new Button();
    btnSubstract.setWidth("60px");
    btnSubstract.setHeight("60px");
    btnSubstract.setStyle(FONT_SIZE);
    btnSubstract.setLabel("-");
    btnSubstract.setAction("onClick : calc.append('" + txtCalcId + "', ' - ')");
    row3.appendChild(btnModulo);
    row3.appendChild(btn1);
    row3.appendChild(btn2);
    row3.appendChild(btn3);
    row3.appendChild(btnSubstract);
    Hbox row4 = new Hbox();
    Button btnCurrency = new Button();
    btnCurrency.setWidth("60px");
    btnCurrency.setHeight("60px");
    btnCurrency.setStyle(FONT_SIZE);
    btnCurrency.setLabel("$");
    btnCurrency.setDisabled(true);
    Button btn0 = new Button();
    btn0.setWidth("60px");
    btn0.setHeight("60px");
    btn0.setStyle(FONT_SIZE);
    btn0.setLabel("0");
    btn0.setAction("onClick : calc.append('" + txtCalcId + "', '0')");
    Button btnDot = new Button();
    btnDot.setWidth("60px");
    btnDot.setHeight("60px");
    btnDot.setStyle(FONT_SIZE);
    btnDot.setLabel(separator);
    btnDot.setDisabled(integral);
    btnDot.setAction("onClick : calc.append('" + txtCalcId + "', '" + separator + "')");
    Button btnEqual = new Button();
    btnEqual.setWidth("60px");
    btnEqual.setHeight("60px");
    btnEqual.setStyle(FONT_SIZE);
    btnEqual.setLabel("=");
    btnEqual.setAction("onClick : calc.evaluate('" + decimalBox.getId() + "','" + txtCalcId + "','" + separator + "')");
    Button btnAdd = new Button();
    btnAdd.setWidth("60px");
    btnAdd.setHeight("60px");
    btnAdd.setStyle(FONT_SIZE);
    btnAdd.setLabel("+");
    btnAdd.setAction("onClick : calc.append('" + txtCalcId + "', ' + ')");
    row4.appendChild(btnCurrency);
    row4.appendChild(btnDot);
    row4.appendChild(btn0);
    row4.appendChild(btnEqual);
    row4.appendChild(btnAdd);
    vbox.appendChild(row1);
    vbox.appendChild(row2);
    vbox.appendChild(row3);
    vbox.appendChild(row4);
    row1.setHeight("60px");
    row2.setHeight("60px");
    row3.setHeight("60px");
    row4.setHeight("60px");
    popup.appendChild(vbox);
    return popup;
}
Also used : Hbox(org.zkoss.zul.Hbox) Button(org.adempiere.webui.component.Button) Popup(org.zkoss.zul.Popup) Textbox(org.adempiere.webui.component.Textbox) Vbox(org.zkoss.zul.Vbox)

Example 5 with Textbox

use of org.adempiere.webui.component.Textbox in project adempiere by adempiere.

the class InfoPanel method onEvent.

//	getAD_Window_ID
public void onEvent(Event event) {
    if (!p_loadedOK)
        //  We aren't ready
        return;
    if (m_busy)
        //  We're busy.  Ignore events.
        return;
    if (event != null) {
        if (event.getName().equals("onOK")) {
            //  The enter key was pressed in a criteria field.  Ignore it.  The key click will trigger
            //  other events that will be trapped.
            event.stopPropagation();
            return;
        }
        Component component = event.getTarget();
        if (component != null) {
            //  Generic components in the criteria fields
            if (component instanceof Textbox) {
                Textbox tb = ((Textbox) component);
                if (tb.hasChanged()) {
                    p_triggerRefresh = true;
                } else {
                    // if the dialog was opened from a menu.
                    if (isModal())
                        //  Save the selection and close;
                        dispose(true);
                    else
                        return;
                }
            } else if (component instanceof Checkbox) {
                //  Check box changes generally always cause a refresh
                //  Capture changes that don't in a specific event handler
                p_triggerRefresh = true;
                Checkbox cb = (Checkbox) component;
                if (cb.getName() != null && cb.getName().equals("AutoQuery")) {
                    //  Only trigger a refresh if the check box is selected
                    if (!cb.isSelected()) {
                        return;
                    }
                }
            } else {
                //  Assume another type of component
                if (event.getName().equals("onChange")) {
                    if (component instanceof Combobox) {
                        if (//  Test for meaningful changes. Null == " ".
                        hasOutstandingChanges())
                            p_triggerRefresh = true;
                    } else
                        p_triggerRefresh = true;
                }
            }
            //  Buttons
            if (component.equals(confirmPanel.getButton(ConfirmPanel.A_OK))) {
                //  VLookup fields in the criteria
                if (hasOutstandingChanges()) {
                    return;
                } else {
                    // We might close
                    p_triggerRefresh = false;
                }
                onOk();
            } else if (component == p_table && event.getName().equals(Events.ON_DOUBLE_CLICK)) {
                onDoubleClick();
            } else if (component.equals(confirmPanel.getButton(ConfirmPanel.A_RESET))) {
                //  Created by the reset button, if used, to reset the criteria panel.
                //  Go back to the defaults
                // Prevent other actions
                m_busy = true;
                // Should be overridden in the subordinate class
                initInfo();
                m_busy = false;
                p_triggerRefresh = true;
                // Ignore the autoQuery value and refresh now.
                p_refreshNow = true;
            } else if (component.equals(confirmPanel.getButton(ConfirmPanel.A_REFRESH))) {
                //  Refresh always causes a requery in case there are
                //  changes to the underlying tables - even if the 
                //  criteria haven't changed.
                p_resetColumns = true;
                p_triggerRefresh = true;
                p_refreshNow = true;
            } else if (component.equals(confirmPanel.getButton(ConfirmPanel.A_CANCEL))) {
                m_cancel = true;
                // close
                dispose(false);
            } else // Elaine 2008/12/16
            if (component.equals(confirmPanel.getButton(ConfirmPanel.A_HISTORY))) {
                if (!p_table.getChildren().isEmpty() && p_table.getSelectedRowKey() != null) {
                    showHistory();
                }
                return;
            } else if (component.equals(confirmPanel.getButton(ConfirmPanel.A_CUSTOMIZE))) {
                if (!p_table.getChildren().isEmpty() && p_table.getSelectedRowKey() != null) {
                    customize();
                }
                return;
            } else //
            if (component.equals(confirmPanel.getButton(ConfirmPanel.A_ZOOM))) {
                if (!p_table.getChildren().isEmpty() && p_table.getSelectedRowKey() != null) {
                    zoom();
                    if (isModal())
                        this.detach();
                }
                return;
            } else if (component == paging) {
                int pgNo = paging.getActivePage();
                if (pageNo != pgNo) {
                    p_table.clearSelection();
                    pageNo = pgNo;
                    int start = pageNo * PAGE_SIZE;
                    int end = start + PAGE_SIZE;
                    List<Object> subList = readLine(start, end);
                    model = new ListModelTable(subList);
                    model.setSorter(this);
                    model.addTableModelListener(this);
                    p_table.setData(model, null);
                    p_table.setSelectedIndex(0);
                }
            }
        }
        //  All events, unless trapped above, will get here.
        //  Check if we need to reset the table.  The flag is reset when
        //  the table is reset.  The first change triggers the reset.
        p_resetColumns = p_resetColumns || columnIsDynamic(component);
        // Refresh if the autoquery feature is selected or the refresh button is clicked.
        if ((p_triggerRefresh && autoQuery()) || p_refreshNow) {
            prepareAndExecuteQuery();
            p_refreshNow = false;
        }
    }
}
Also used : Checkbox(org.adempiere.webui.component.Checkbox) Combobox(org.adempiere.webui.component.Combobox) Textbox(org.adempiere.webui.component.Textbox) ListModelTable(org.adempiere.webui.component.ListModelTable) HtmlNativeComponent(org.zkoss.zk.ui.HtmlNativeComponent) Component(org.zkoss.zk.ui.Component)

Aggregations

Textbox (org.adempiere.webui.component.Textbox)21 Label (org.adempiere.webui.component.Label)11 Checkbox (org.adempiere.webui.component.Checkbox)8 NumberBox (org.adempiere.webui.component.NumberBox)6 Datebox (org.adempiere.webui.component.Datebox)5 DecimalFormat (java.text.DecimalFormat)4 SimpleDateFormat (java.text.SimpleDateFormat)4 Button (org.adempiere.webui.component.Button)4 Component (org.zkoss.zk.ui.Component)4 Hbox (org.zkoss.zul.Hbox)4 Combobox (org.adempiere.webui.component.Combobox)3 ConfirmPanel (org.adempiere.webui.component.ConfirmPanel)3 ListItem (org.adempiere.webui.component.ListItem)3 Listbox (org.adempiere.webui.component.Listbox)3 Row (org.adempiere.webui.component.Row)3 WSearchEditor (org.adempiere.webui.editor.WSearchEditor)3 BigDecimal (java.math.BigDecimal)2 WPOSKeyboard (org.adempiere.pos.WPOSKeyboard)2 Rows (org.adempiere.webui.component.Rows)2 IDColumn (org.compiere.minigrid.IDColumn)2