Search in sources :

Example 1 with Checkbox

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

the class WQueryOrderHistory method init.

/**
	 * 	Set up Panel
	 */
protected void init() {
    setTitle(Msg.translate(Env.getCtx(), "C_Order_ID"));
    Panel panel = new Panel();
    setVisible(true);
    Panel mainPanel = new Panel();
    Grid productLayout = GridFactory.newGridLayout();
    Groupbox groupPanel = new Groupbox();
    Caption v_TitleBorder = new Caption(Msg.getMsg(ctx, QUERY));
    //	Set title window
    this.setClosable(true);
    // add listener on 'ENTER' key 
    addEventListener(Events.ON_OK, this);
    appendChild(panel);
    northPanel = new Panel();
    mainPanel.appendChild(mainLayout);
    groupPanel.appendChild(v_TitleBorder);
    mainPanel.setStyle("width: 100%; height: 100%; padding: 0; margin: 0");
    mainLayout.setHeight("100%");
    mainLayout.setWidth("100%");
    Center center = new Center();
    //
    North north = new North();
    north.setStyle("border: none");
    mainLayout.appendChild(north);
    north.appendChild(groupPanel);
    groupPanel.appendChild(productLayout);
    appendChild(mainPanel);
    productLayout.setWidth("100%");
    Rows rows = null;
    Row row = null;
    rows = productLayout.newRows();
    row = rows.newRow();
    Label labelDocumentNo = new Label(Msg.translate(ctx, DOCUMENTNO));
    labelDocumentNo.setStyle(WPOS.FONTSIZESMALL);
    row.setHeight("20px");
    row.appendChild(labelDocumentNo.rightAlign());
    fieldDocumentNo = new WPOSTextField("", posPanel.getKeyboard());
    row.appendChild(fieldDocumentNo);
    fieldDocumentNo.addEventListener(this);
    fieldDocumentNo.setWidth("120px");
    fieldDocumentNo.setStyle(WPOS.FONTSIZESMALL);
    //
    Label labelDateFrom = new Label(Msg.translate(ctx, DATEORDEREDFROM));
    labelDateFrom.setStyle(WPOS.FONTSIZESMALL);
    row.appendChild(labelDateFrom.rightAlign());
    fieldDateFrom = new Datebox();
    fieldDateFrom.setValue(Env.getContextAsDate(Env.getCtx(), "#Date"));
    fieldDateFrom.addEventListener("onBlur", this);
    fieldDateFrom.setStyle(WPOS.FONTSIZESMALL);
    row.appendChild(fieldDateFrom);
    fieldAllowDate = new Checkbox();
    fieldAllowDate.setLabel(Msg.translate(ctx, DATE));
    fieldAllowDate.setSelected(false);
    row.appendChild(fieldAllowDate);
    fieldAllowDate.addActionListener(this);
    fieldAllowDate.setStyle(WPOS.FONTSIZESMALL);
    row = rows.newRow();
    Label labelBPartner = new Label(Msg.translate(ctx, BPARTNERID));
    labelBPartner.setStyle(WPOS.FONTSIZESMALL);
    row.setHeight("60px");
    row.appendChild(labelBPartner.rightAlign());
    fieldBPartner = new WPOSTextField("", posPanel.getKeyboard());
    row.appendChild(fieldBPartner);
    fieldBPartner.addEventListener(this);
    fieldBPartner.setWidth("120px");
    fieldBPartner.setStyle(WPOS.FONTSIZESMALL);
    Label labelDateTo = new Label(Msg.translate(ctx, DATEORDEREDTO));
    labelDateTo.setStyle(WPOS.FONTSIZESMALL);
    row.appendChild(labelDateTo.rightAlign());
    fieldDateTo = new Datebox();
    fieldDateTo.setValue(Env.getContextAsDate(Env.getCtx(), "#Date"));
    fieldDateTo.addEventListener("onBlur", this);
    fieldDateTo.setStyle(WPOS.FONTSIZESMALL);
    row.appendChild(fieldDateTo);
    fieldProcessed = new Checkbox();
    fieldProcessed.setLabel(Msg.translate(ctx, PROCESSED));
    fieldProcessed.setSelected(false);
    row.appendChild(fieldProcessed);
    fieldProcessed.addActionListener(this);
    fieldProcessed.setStyle(WPOS.FONTSIZESMALL);
    //	Center
    posTable = ListboxFactory.newDataTable();
    posTable.prepareTable(columnInfos, "C_Order", "C_POS_ID = " + posPanel.getC_POS_ID(), false, "C_Order");
    enableButtons();
    center = new Center();
    center.setStyle("border: none");
    posTable.setWidth("100%");
    posTable.setHeight("99%");
    posTable.addActionListener(this);
    center.appendChild(posTable);
    mainLayout.appendChild(center);
    posTable.setClass("Table-OrderLine");
    posTable.autoSize();
    posTable.addEventListener(Events.ON_DOUBLE_CLICK, this);
    refresh();
}
Also used : Panel(org.adempiere.webui.component.Panel) Center(org.zkoss.zkex.zul.Center) WPOSTextField(org.adempiere.pos.WPOSTextField) Datebox(org.adempiere.webui.component.Datebox) Groupbox(org.zkoss.zul.Groupbox) Checkbox(org.adempiere.webui.component.Checkbox) Grid(org.adempiere.webui.component.Grid) Label(org.adempiere.webui.component.Label) North(org.zkoss.zkex.zul.North) Row(org.adempiere.webui.component.Row) Caption(org.zkoss.zul.Caption) Rows(org.adempiere.webui.component.Rows)

Example 2 with Checkbox

use of org.adempiere.webui.component.Checkbox 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 Checkbox

use of org.adempiere.webui.component.Checkbox 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)

Example 4 with Checkbox

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

the class InfoPaymentPanel method onEvent.

// initInfo
public void onEvent(Event e) {
    if (!p_loadedOK)
        return;
    Component component = e.getTarget();
    if (component != null) {
        if (component instanceof Checkbox) {
            Checkbox cb = (Checkbox) component;
            // Make the checkboxes exclusive
            if (cb.getName() == "OnlyReceipt") {
                if (fCheckReceipt.isSelected())
                    fCheckPayment.setSelected(false);
            }
            if (cb.getName() == "OnlyPayment") {
                if (fCheckPayment.isSelected())
                    fCheckReceipt.setSelected(false);
            }
        }
    }
    //
    super.onEvent(e);
}
Also used : Checkbox(org.adempiere.webui.component.Checkbox) Component(org.zkoss.zk.ui.Component)

Example 5 with Checkbox

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

the class InfoProductPanel method onEvent.

//	isUnconfirmed
public void onEvent(Event e) {
    if (!p_loadedOK)
        return;
    Component component = e.getTarget();
    if (component != null) {
        //  Handle product info specific fields here
        if (component.equals(confirmPanel.getButton(ConfirmPanel.A_PATTRIBUTE))) {
            //  Find the ASI used by the product on the lead row
            MProduct mp = MProduct.get(Env.getCtx(), m_M_Product_ID);
            //  Set title and parameters for the PattributeInstance window
            String title = "";
            int wh_id = 0;
            if (isValidVObject(fWarehouse_ID)) {
                title = mp.getName() + " - " + fWarehouse_ID.getDisplay();
                wh_id = ((Integer) (fWarehouse_ID.getValue())).intValue();
            }
            //  Get the business partner from the context - it may be different than the Vendor
            int bp_id = 0;
            String s_bp_id = Env.getContext(Env.getCtx(), p_WindowNo, p_TabNo, "C_BPartner_ID", false);
            if (s_bp_id != null && s_bp_id.length() != 0 && (new Integer(s_bp_id).intValue() > 0))
                bp_id = new Integer(s_bp_id).intValue();
            //  Display the window
            InfoPAttributeInstancePanel pai = new InfoPAttributeInstancePanel(this, title, wh_id, 0, p_table.getLeadRowKey(), bp_id);
            if (!pai.wasCancelled()) {
                //  Get the results and update the fASI criteria field
                m_M_AttributeSetInstance_ID = pai.getM_AttributeSetInstance_ID();
                m_M_Locator_ID = pai.getM_Locator_ID();
                if (m_M_AttributeSetInstance_ID > 0)
                    fASI_ID.setValue(m_M_AttributeSetInstance_ID);
                else
                    //  No instance
                    fASI_ID.setValue(0);
            }
            //  looking around.
            if (//  If the results are saved, we can save now - an ASI is product specific
            p_saveResults && m_M_AttributeSetInstance_ID != -1 && !pai.wasCancelled()) {
                dispose(p_saveResults);
                return;
            }
            return;
        } else if (component instanceof Combobox) {
            if (e.getName().equals("onChange")) {
                //  perform field-specific changes
                if (component.equals(fWarehouse_ID.getComponent())) {
                    if (!isValidVObject(fWarehouse_ID)) {
                        //  Disable the stock button
                        checkOnlyStock.setSelected(false);
                        checkOnlyStock.setEnabled(false);
                    } else
                        checkOnlyStock.setEnabled(true);
                }
            }
        } else if (component instanceof Checkbox) {
            Checkbox cb = (Checkbox) component;
            //  ShowDetail check box
            if (cb.getName() != null && cb.getName().equals("ShowDetail")) {
                // Refresh only the ATP tab 
                refreshAtpTab();
                return;
            }
        } else if (// a tab in the ATP panel is selected
        component instanceof Tab) {
            if (detailTabBox.getSelectedIndex() == 5) {
                checkShowDetail.setEnabled(true);
            } else {
                checkShowDetail.setEnabled(false);
            }
            refresh();
            return;
        }
    }
    //
    super.onEvent(e);
}
Also used : MProduct(org.compiere.model.MProduct) Tab(org.adempiere.webui.component.Tab) Combobox(org.adempiere.webui.component.Combobox) Checkbox(org.adempiere.webui.component.Checkbox) Component(org.zkoss.zk.ui.Component)

Aggregations

Checkbox (org.adempiere.webui.component.Checkbox)18 Textbox (org.adempiere.webui.component.Textbox)8 Component (org.zkoss.zk.ui.Component)7 Label (org.adempiere.webui.component.Label)6 Datebox (org.adempiere.webui.component.Datebox)5 DecimalFormat (java.text.DecimalFormat)3 SimpleDateFormat (java.text.SimpleDateFormat)3 Combobox (org.adempiere.webui.component.Combobox)3 NumberBox (org.adempiere.webui.component.NumberBox)3 Button (org.adempiere.webui.component.Button)2 WSearchEditor (org.adempiere.webui.editor.WSearchEditor)2 IDColumn (org.compiere.minigrid.IDColumn)2 Decimalbox (org.zkoss.zul.Decimalbox)2 Hbox (org.zkoss.zul.Hbox)2 Panelchildren (org.zkoss.zul.Panelchildren)2 Radio (org.zkoss.zul.Radio)2 Radiogroup (org.zkoss.zul.Radiogroup)2 Toolbar (org.zkoss.zul.Toolbar)2 Tree (org.zkoss.zul.Tree)2 BigDecimal (java.math.BigDecimal)1