Search in sources :

Example 6 with Row

use of org.zkoss.zul.Row in project adempiere by adempiere.

the class ADTabPanel method dynamicDisplay.

/**
	 * Validate display properties of fields of current row
	 * @param col
	 */
public void dynamicDisplay(int col) {
    if (!gridTab.isOpen()) {
        return;
    }
    for (WEditor comp : editors) {
        comp.setMandatoryLabels();
    }
    //  Selective
    if (col > 0) {
        GridField changedField = gridTab.getField(col);
        String columnName = changedField.getColumnName();
        ArrayList<?> dependants = gridTab.getDependantFields(columnName);
        logger.config("(" + gridTab.toString() + ") " + columnName + " - Dependents=" + dependants.size());
        if (dependants.size() == 0 && changedField.getCallout().length() == 0) {
            return;
        }
    }
    boolean noData = gridTab.getRowCount() == 0;
    logger.config(gridTab.toString() + " - Rows=" + gridTab.getRowCount());
    for (WEditor comp : editors) {
        GridField mField = comp.getGridField();
        if (mField != null && mField.getIncluded_Tab_ID() <= 0) {
            if (//  check context
            mField.isDisplayed(true)) {
                if (!comp.isVisible()) {
                    //  visibility
                    comp.setVisible(true);
                }
                if (noData) {
                    comp.setReadWrite(false);
                } else {
                    //  r/w - check Context
                    boolean rw = mField.isEditable(true);
                    comp.setReadWrite(rw);
                    //  check context
                    comp.setMandatory(mField.isMandatory(true));
                    comp.dynamicDisplay();
                }
                //	
                comp.repaintComponent();
            } else if (comp.isVisible()) {
                comp.setVisible(false);
            }
        }
    }
    //  all components
    //hide row if all editor within the row is invisible
    List<?> rows = grid.getRows().getChildren();
    for (int i = 0; i < rows.size(); i++) {
        org.zkoss.zul.Row row = (org.zkoss.zul.Row) rows.get(i);
        List<?> components = row.getChildren();
        boolean visible = false;
        boolean editorRow = false;
        for (int j = 0; j < components.size(); j++) {
            Component component = (Component) components.get(j);
            if (editorIds.contains(component.getUuid())) {
                editorRow = true;
                if (component.isVisible()) {
                    visible = true;
                    break;
                }
            }
        }
        if (editorRow && (row.isVisible() != visible))
            row.setVisible(visible);
    }
    //hide fieldgroup if all editor row within the fieldgroup is invisible
    for (Iterator<Entry<String, List<org.zkoss.zul.Row>>> i = fieldGroupHeaders.entrySet().iterator(); i.hasNext(); ) {
        Map.Entry<String, List<org.zkoss.zul.Row>> entry = i.next();
        List<org.zkoss.zul.Row> contents = fieldGroupContents.get(entry.getKey());
        boolean visible = false;
        for (org.zkoss.zul.Row row : contents) {
            if (row.isVisible()) {
                visible = true;
                break;
            }
        }
        List<org.zkoss.zul.Row> headers = entry.getValue();
        for (org.zkoss.zul.Row row : headers) {
            if (row.isVisible() != visible)
                row.setVisible(visible);
        }
    }
    for (EmbeddedPanel ep : includedPanel) {
        if (ep.gridWindow.getTab(ep.tabIndex).isDisplayed()) {
            ep.windowPanel.getParent().setVisible(true);
            ep.group.setVisible(true);
        } else {
            ep.windowPanel.getParent().setVisible(false);
            ep.group.setVisible(false);
        }
    }
    //Horizontal
    for (HorizontalEmbeddedPanel ep : horizontalIncludedPanel) {
        if (ep.gridWindow.getTab(ep.tabIndex).isDisplayed()) {
            ep.windowPanel.getParent().setVisible(true);
            ep.divComponent.setVisible(true);
        } else {
            ep.windowPanel.getParent().setVisible(false);
            ep.divComponent.setVisible(false);
        }
    }
    logger.config(gridTab.toString() + " - fini - " + (col <= 0 ? "complete" : "seletive"));
}
Also used : org.zkoss.zul(org.zkoss.zul) Row(org.zkoss.zul.Row) Entry(java.util.Map.Entry) Row(org.zkoss.zul.Row) Component(org.zkoss.zk.ui.Component) HtmlBasedComponent(org.zkoss.zk.ui.HtmlBasedComponent)

Example 7 with Row

use of org.zkoss.zul.Row in project adempiere by adempiere.

the class ADTabPanel method createEmbeddedPanelUI.

private void createEmbeddedPanelUI(EmbeddedPanel ep) {
    org.zkoss.zul.Row row = new Row();
    row.setSpans("5");
    if (!ep.gridWindow.getTab(ep.tabIndex).isDisplayed()) {
        row.setVisible(false);
        ep.group.setVisible(false);
    }
    grid.getRows().insertBefore(row, includedTabFooter.get(ep.adTabId));
    ep.windowPanel.createPart(row);
    ep.windowPanel.getComponent().setWidth("100%");
    ep.windowPanel.getComponent().setStyle("position: relative");
    //ep.windowPanel.getComponent().setHeight(400 + "px");
    Label title = new Label(ep.gridWindow.getTab(ep.tabIndex).getName());
    ep.group.appendChild(title);
    ep.group.appendChild(ep.windowPanel.getToolbar());
    ep.windowPanel.getStatusBar().setZclass("z-group-foot");
    ep.windowPanel.initPanel(-1, null);
}
Also used : org.zkoss.zul(org.zkoss.zul) Row(org.zkoss.zul.Row) Label(org.adempiere.webui.component.Label) Row(org.zkoss.zul.Row)

Example 8 with Row

use of org.zkoss.zul.Row in project adempiere by adempiere.

the class WOrderReceiptIssue method jbInit.

//	fillPicks
/**
	 *  Static Init.
	 *  Places static visual elements into the window.
	 *  This is only run as part of the windows initialization process
	 *  <pre>
	 *  mainPanel
	 *      northPanel
	 *      centerPanel
	 *          xMatched
	 *          xPanel
	 *          xMathedTo
	 *      southPanel
	 *  </pre>
	 *  @throws Exception
	 */
private void jbInit() throws Exception {
    Center center = new Center();
    South south = new South();
    North north = new North();
    form.appendChild(mainPanel);
    mainPanel.appendChild(TabsReceiptsIssue);
    mainPanel.setStyle("width: 100%; height: 100%; padding: 0; margin: 0");
    ReceiptIssueOrder.setWidth("100%");
    ReceiptIssueOrder.setHeight("99%");
    ReceiptIssueOrder.appendChild(north);
    north.appendChild(northPanel);
    northPanel.appendChild(fieldGrid);
    orderLabel.setText(Msg.translate(Env.getCtx(), "PP_Order_ID"));
    Rows tmpRows = fieldGrid.newRows();
    // 1st
    Row tmpRow = tmpRows.newRow();
    tmpRow.appendChild(orderLabel.rightAlign());
    tmpRow.appendChild(orderField.getComponent());
    resourceLabel.setText(Msg.translate(Env.getCtx(), "S_Resource_ID"));
    tmpRow.appendChild(resourceLabel.rightAlign());
    tmpRow.appendChild(resourceField.getComponent());
    warehouseLabel.setText(Msg.translate(Env.getCtx(), "M_Warehouse_ID"));
    tmpRow.appendChild(warehouseLabel.rightAlign());
    tmpRow.appendChild(warehouseField.getComponent());
    // Product 2nd
    tmpRow = tmpRows.newRow();
    tmpRow.appendChild(productLabel.rightAlign());
    tmpRow.appendChild(productField.getComponent());
    tmpRow.appendChild(uomLabel.rightAlign());
    tmpRow.appendChild(uomField.getComponent());
    tmpRow.appendChild(uomorderLabel.rightAlign());
    tmpRow.appendChild(uomorderField.getComponent());
    tmpRow = tmpRows.newRow();
    orderedQtyLabel.setText(Msg.translate(Env.getCtx(), "QtyOrdered"));
    tmpRow.appendChild(orderedQtyLabel.rightAlign());
    tmpRow.appendChild(orderedQtyField.getComponent());
    deliveredQtyLabel.setText(Msg.translate(Env.getCtx(), "QtyDelivered"));
    tmpRow.appendChild(deliveredQtyLabel.rightAlign());
    tmpRow.appendChild(deliveredQtyField.getComponent());
    openQtyLabel.setText(Msg.translate(Env.getCtx(), "QtyBackOrdered"));
    tmpRow.appendChild(openQtyLabel.rightAlign());
    tmpRow.appendChild(openQtyField.getComponent());
    //3rd
    tmpRow = tmpRows.newRow();
    tmpRow.appendChild(productLabel.rightAlign());
    tmpRow.appendChild(productField.getComponent());
    tmpRow.appendChild(uomLabel.rightAlign());
    tmpRow.appendChild(uomField.getComponent());
    tmpRow.appendChild(uomorderLabel.rightAlign());
    tmpRow.appendChild(uomorderField.getComponent());
    //4th
    tmpRow = tmpRows.newRow();
    QtyBatchsLabel.setText(Msg.translate(Env.getCtx(), "QtyBatchs"));
    tmpRow.appendChild(QtyBatchsLabel.rightAlign());
    tmpRow.appendChild(qtyBatchsField.getComponent());
    QtyBatchSizeLabel.setText(Msg.translate(Env.getCtx(), "QtyBatchSize"));
    tmpRow.appendChild(QtyBatchSizeLabel.rightAlign());
    tmpRow.appendChild(qtyBatchSizeField.getComponent());
    openQtyLabel.setText(Msg.translate(Env.getCtx(), "QtyBackOrdered"));
    tmpRow.appendChild(openQtyLabel.rightAlign());
    tmpRow.appendChild(openQtyField.getComponent());
    //5th
    tmpRow = tmpRows.newRow();
    tmpRow.appendChild(labelcombo.rightAlign());
    tmpRow.appendChild(pickcombo);
    tmpRow.appendChild(backflushGroupLabel.rightAlign());
    tmpRow.appendChild(backflushGroup);
    tmpRow.appendChild(new Space());
    tmpRow.appendChild(new Space());
    //6th
    tmpRow = tmpRows.newRow();
    toDeliverQtyLabel.setText(Msg.translate(Env.getCtx(), "QtyToDeliver"));
    tmpRow.appendChild(toDeliverQtyLabel.rightAlign());
    tmpRow.appendChild(toDeliverQty.getComponent());
    scrapQtyLabel.setText(Msg.translate(Env.getCtx(), "QtyScrap"));
    tmpRow.appendChild(scrapQtyLabel.rightAlign());
    tmpRow.appendChild(scrapQtyField.getComponent());
    rejectQtyLabel.setText(Msg.translate(Env.getCtx(), "QtyReject"));
    tmpRow.appendChild(rejectQtyLabel.rightAlign());
    tmpRow.appendChild(rejectQty.getComponent());
    //7th
    tmpRow = tmpRows.newRow();
    movementDateLabel.setText(Msg.translate(Env.getCtx(), "MovementDate"));
    tmpRow.appendChild(movementDateLabel.rightAlign());
    tmpRow.appendChild(movementDateField.getComponent());
    locatorLabel.setText(Msg.translate(Env.getCtx(), "M_Locator_ID"));
    tmpRow.appendChild(locatorLabel.rightAlign());
    tmpRow.appendChild(locatorField.getComponent());
    attributeLabel.setText(Msg.translate(Env.getCtx(), "M_AttributeSetInstance_ID"));
    tmpRow.appendChild(attributeLabel.rightAlign());
    tmpRow.appendChild(attribute.getComponent());
    ReceiptIssueOrder.appendChild(center);
    center.appendChild(issue);
    ReceiptIssueOrder.appendChild(south);
    south.appendChild(PanelBottom);
    Process.setLabel(Msg.translate(Env.getCtx(), "OK"));
    PanelBottom.appendChild(Process);
    PanelBottom.setWidth("100%");
    PanelBottom.setStyle("text-align:center");
    Tabs tabs = new Tabs();
    Tab tab1 = new Tab();
    Tab tab2 = new Tab();
    tab1.setLabel(Msg.parseTranslation(Env.getCtx(), "@IsShipConfirm@"));
    tab2.setLabel(Msg.parseTranslation(Env.getCtx(), "@Generate@"));
    tabs.appendChild(tab1);
    tabs.appendChild(tab2);
    TabsReceiptsIssue.appendChild(tabs);
    Tabpanels tabps = new Tabpanels();
    Tabpanel tabp1 = new Tabpanel();
    Tabpanel tabp2 = new Tabpanel();
    TabsReceiptsIssue.appendChild(tabps);
    TabsReceiptsIssue.setWidth("100%");
    TabsReceiptsIssue.setHeight("100%");
    tabps.appendChild(tabp1);
    tabps.appendChild(tabp2);
    tabp1.appendChild(ReceiptIssueOrder);
    tabp1.setWidth("100%");
    tabp1.setHeight("100%");
    tabp2.appendChild(Generate);
    tabp2.setWidth("100%");
    tabp2.setHeight("100%");
    Generate.appendChild(info);
    Generate.setVisible(true);
    info.setVisible(true);
    TabsReceiptsIssue.addEventListener(Events.ON_CHANGE, this);
}
Also used : Space(org.zkoss.zul.Space) Center(org.zkoss.zul.Center) MTab(org.compiere.model.MTab) Tab(org.adempiere.webui.component.Tab) Tabpanels(org.zkoss.zul.Tabpanels) South(org.zkoss.zul.South) Tabs(org.adempiere.webui.component.Tabs) North(org.zkoss.zul.North) Row(org.zkoss.zul.Row) Tabpanel(org.zkoss.zul.Tabpanel) Rows(org.adempiere.webui.component.Rows)

Example 9 with Row

use of org.zkoss.zul.Row in project adempiere by adempiere.

the class WCRPDetail method jbInit.

private void jbInit() {
    dateFrom = new WDateEditor("DateFrom", true, false, true, "DateFrom");
    dateTo = new WDateEditor("DateTo", true, false, true, "DateTo");
    Rows rows = new Rows();
    Row row = null;
    new GridFactory();
    Grid northPanel = GridFactory.newGridLayout();
    rows.setParent(northPanel);
    row = rows.newRow();
    row.appendChild(new Label(Msg.translate(Env.getCtx(), "S_Resource_ID")).rightAlign());
    row.appendChild(resource.getComponent());
    row.appendChild(new Label(Msg.translate(Env.getCtx(), "DateFrom")).rightAlign());
    row.appendChild(dateFrom.getComponent());
    row.appendChild(new Label(Msg.translate(Env.getCtx(), "DateTo")).rightAlign());
    row.appendChild(dateTo.getComponent());
    ConfirmPanel confirmPanel = new ConfirmPanel(true);
    confirmPanel.addActionListener(this);
    North north = new North();
    north.appendChild(northPanel);
    mainLayout.appendChild(north);
    //West west = new West();
    //chartPanel.setWidth("400");
    //west.appendChild(chartPanel);
    //west.setSplittable(true);
    //west.setAutoscroll(true);
    //mainLayout.appendChild(west);
    South south = new South();
    south.appendChild(confirmPanel);
    mainLayout.appendChild(south);
}
Also used : WDateEditor(org.adempiere.webui.editor.WDateEditor) ConfirmPanel(org.adempiere.webui.component.ConfirmPanel) Grid(org.adempiere.webui.component.Grid) GridFactory(org.adempiere.webui.component.GridFactory) Label(org.adempiere.webui.component.Label) South(org.zkoss.zul.South) North(org.zkoss.zul.North) Row(org.zkoss.zul.Row) Rows(org.adempiere.webui.component.Rows)

Example 10 with Row

use of org.zkoss.zul.Row in project adempiere by adempiere.

the class WCRP method jbInit.

private void jbInit() throws Exception {
    resourceLabel.setText(Msg.translate(Env.getCtx(), "S_Resource_ID"));
    dateFromLabel.setText(Msg.translate(Env.getCtx(), "DateFrom"));
    Rows rows = new Rows();
    Row row = null;
    rows.setParent(northPanel);
    row = rows.newRow();
    row.appendChild(resourceLabel.rightAlign());
    row.appendChild(resource.getComponent());
    row.appendChild(dateFromLabel.rightAlign());
    row.appendChild(dateFrom.getComponent());
    centerPanel.appendChild(chartPanel);
    JFreeChart jchart = ChartFactory.createBarChart3D("", // X-Axis label
    Msg.translate(Env.getCtx(), "Days"), // Y-Axis label
    Msg.translate(Env.getCtx(), "Hours"), // Dataset
    new DefaultCategoryDataset(), // orientation
    PlotOrientation.VERTICAL, // include legend
    true, // tooltips?
    true, // URLs?
    false);
    renderChart(jchart);
    confirmPanel.addActionListener(this);
}
Also used : Row(org.zkoss.zul.Row) DefaultCategoryDataset(org.jfree.data.category.DefaultCategoryDataset) JFreeChart(org.jfree.chart.JFreeChart) Rows(org.adempiere.webui.component.Rows)

Aggregations

Row (org.zkoss.zul.Row)15 org.zkoss.zul (org.zkoss.zul)7 Rows (org.adempiere.webui.component.Rows)5 Label (org.adempiere.webui.component.Label)4 PropertyVetoException (java.beans.PropertyVetoException)3 Component (org.zkoss.zk.ui.Component)3 Borderlayout (org.zkoss.zkex.zul.Borderlayout)3 Grid (org.adempiere.webui.component.Grid)2 HtmlBasedComponent (org.zkoss.zk.ui.HtmlBasedComponent)2 North (org.zkoss.zul.North)2 South (org.zkoss.zul.South)2 ResultSetMetaData (java.sql.ResultSetMetaData)1 SQLException (java.sql.SQLException)1 Entry (java.util.Map.Entry)1 org.adempiere.webui.component (org.adempiere.webui.component)1 Column (org.adempiere.webui.component.Column)1 Columns (org.adempiere.webui.component.Columns)1 ConfirmPanel (org.adempiere.webui.component.ConfirmPanel)1 GridFactory (org.adempiere.webui.component.GridFactory)1 Tab (org.adempiere.webui.component.Tab)1