Search in sources :

Example 41 with Event

use of org.zkoss.zk.ui.event.Event in project adempiere by adempiere.

the class WindowContainer method insertBefore.

/**
     * 
     * @param refTab
     * @param comp
     * @param title
     * @param closeable
     * @param enable
     */
public void insertBefore(Tab refTab, Component comp, String title, boolean closeable, boolean enable) {
    Tab tab = new Tab();
    title = title.replaceAll("[&]", "");
    if (title.length() <= MAX_TITLE_LENGTH) {
        tab.setLabel(title);
    } else {
        tab.setTooltiptext(title);
        title = title.substring(0, 27) + "...";
        tab.setLabel(title);
    }
    tab.setClosable(closeable);
    // fix scroll position lost coming back into a grid view tab
    tab.addEventListener(Events.ON_SELECT, new EventListener<Event>() {

        public void onEvent(Event event) throws Exception {
            Tab tab = (Tab) event.getTarget();
            org.zkoss.zul.Tabpanel panel = tab.getLinkedPanel();
            Component component = panel.getFirstChild();
            if (component != null && component.getAttribute(ITabOnSelectHandler.ATTRIBUTE_KEY) instanceof ITabOnSelectHandler) {
                ITabOnSelectHandler handler = (ITabOnSelectHandler) component.getAttribute(ITabOnSelectHandler.ATTRIBUTE_KEY);
                handler.onSelect();
            }
        }
    });
    Tabpanel tabpanel = null;
    if (comp instanceof Tabpanel) {
        tabpanel = (Tabpanel) comp;
    } else {
        tabpanel = new Tabpanel();
        tabpanel.appendChild(comp);
    }
    tabpanel.setZclass("desktop-tabpanel");
    tabpanel.setHeight("100%");
    tabpanel.setWidth("100%");
    tabpanel.setStyle("position: relative;");
    if (refTab == null) {
        tabbox.getTabs().appendChild(tab);
        tabbox.getTabpanels().appendChild(tabpanel);
    } else {
        org.zkoss.zul.Tabpanel refpanel = refTab.getLinkedPanel();
        tabbox.getTabs().insertBefore(tab, refTab);
        tabbox.getTabpanels().insertBefore(tabpanel, refpanel);
    }
    if (enable)
        setSelectedTab(tab);
}
Also used : Tab(org.adempiere.webui.component.Tab) Event(org.zkoss.zk.ui.event.Event) Component(org.zkoss.zk.ui.Component) Tabpanel(org.adempiere.webui.component.Tabpanel)

Example 42 with Event

use of org.zkoss.zk.ui.event.Event in project adempiere by adempiere.

the class WSearch method fillPopup.

/**
	 * Find the search targets and load the pop-up menu.  If there are no saved
	 * searches, the FindWindow will open.
	 */
private void fillPopup() {
    MUserQuery[] search = MUserQuery.get(Env.getCtx(), m_AD_Tab_ID);
    if (search.length == 0) {
        // No queries to add to the popup. Just return;
        return;
    }
    //  There are saved queries, so create the pop-up menu.
    //  The first item is "Search" which will open the FindWindow
    Menuitem menuItem = new Menuitem(Msg.getMsg(Env.getCtx(), "Search"));
    menuItem.addEventListener(Events.ON_CLICK, new EventListener() {

        @Override
        public void onEvent(Event event) throws Exception {
            // Just open the find window
            find();
        }
    });
    m_popup.appendChild(menuItem);
    for (final MUserQuery query : search) {
        menuItem = new Menuitem(query.getName());
        menuItem.addEventListener(Events.ON_CLICK, new EventListener() {

            @Override
            public void onEvent(Event event) throws Exception {
                // Set the query
                m_query = query.getQuery(m_AD_Table_ID, m_targetWindowNo, m_findFields);
                m_panel.onFindCallback(m_query);
            }
        });
        m_popup.appendChild(menuItem);
    }
}
Also used : MUserQuery(org.compiere.model.MUserQuery) Menuitem(org.zkoss.zul.Menuitem) Event(org.zkoss.zk.ui.event.Event) EventListener(org.zkoss.zk.ui.event.EventListener)

Example 43 with Event

use of org.zkoss.zk.ui.event.Event in project adempiere by adempiere.

the class InfoProductPanel method statInit.

//	initComponents
private void statInit() {
    //  Fill the grid, setup the center data table & add the tabs
    initComponents();
    Rows rows = new Rows();
    Row row = new Row();
    rows.appendChild(row);
    row.appendCellChild(lblValue.rightAlign());
    row.appendCellChild(fieldValue);
    row.appendCellChild(lblWarehouse.rightAlign());
    row.appendCellChild(fWarehouse_ID.getComponent());
    row.appendCellChild(lblBlank.rightAlign());
    row.appendCellChild(checkOnlyStock);
    row = new Row();
    rows.appendChild(row);
    row.appendCellChild(lblName.rightAlign());
    row.appendCellChild(fieldName);
    row.appendCellChild(lblPriceList.rightAlign());
    row.appendCellChild(fPriceList_ID.getComponent());
    row.appendCellChild(lblAS.rightAlign());
    row.appendCellChild(fAS_ID.getComponent());
    //
    row = new Row();
    rows.appendChild(row);
    row.appendCellChild(lblUPC.rightAlign());
    row.appendCellChild(fieldUPC);
    row.appendCellChild(lblProductCategory.rightAlign());
    row.appendCellChild(fProductCategory_ID.getComponent());
    row.appendCellChild(lblASI.rightAlign());
    row.appendCellChild(fASI_ID.getComponent());
    row = new Row();
    rows.appendChild(row);
    row.appendCellChild(lblSKU.rightAlign());
    row.appendCellChild(fieldSKU);
    row.appendCellChild(lblVendor.rightAlign());
    row.appendCellChild(fVendor_ID.getComponent());
    row.appendCellChild(lblBlank.rightAlign());
    row.appendCellChild(checkAND);
    //
    ColumnInfo[] s_layoutWarehouse = new ColumnInfo[] { new ColumnInfo(" ", "M_Warehouse_ID", IDColumn.class), new ColumnInfo(Msg.translate(Env.getCtx(), "WarehouseName"), "WarehouseName", String.class), new ColumnInfo(Msg.translate(Env.getCtx(), "QtyAvailable"), "sum(QtyAvailable)", Double.class, true, true, null), new ColumnInfo(Msg.translate(Env.getCtx(), "QtyOnHand"), "sum(QtyOnHand)", Double.class), new ColumnInfo(Msg.translate(Env.getCtx(), "QtyReserved"), "sum(QtyReserved)", Double.class), new ColumnInfo(Msg.translate(Env.getCtx(), "QtyOrdered"), "sum(QtyOrdered)", Double.class) };
    //        		new ColumnInfo(Msg.translate(Env.getCtx(), "DocumentNote"), "DocumentNote", String.class)};
    /**	From Clause							*/
    String s_sqlFrom = " M_PRODUCT_STOCK_V ";
    /** Where Clause						*/
    String s_sqlWhere = "(QtyOnHand <> 0 OR QtyAvailable <> 0 OR QtyReserved <> 0 OR QtyOrdered <> 0) AND M_Product_ID = ?";
    //      String s_sqlWhere = "M_Product_ID = ?";
    m_sqlWarehouse = warehouseTbl.prepareTable(s_layoutWarehouse, s_sqlFrom, s_sqlWhere, false, "M_PRODUCT_STOCK_V");
    m_sqlWarehouse += " Group By M_Warehouse_ID, WarehouseName ";
    m_sqlWarehouse += " Order By sum(QtyOnHand) DESC, WarehouseName ";
    warehouseTbl.setMultiSelection(false);
    warehouseTbl.setSizedByContent(false);
    //warehouseTbl.autoSize();
    warehouseTbl.setShowTotals(true);
    //warehouseTbl.getModel().addTableModelListener(this);
    warehouseTbl.setAttribute("zk_component_ID", "Lookup_Data_Warehouse");
    ColumnInfo[] s_layoutSubstitute = new ColumnInfo[] { new ColumnInfo(Msg.translate(Env.getCtx(), "Warehouse"), "orgname", String.class), new ColumnInfo(Msg.translate(Env.getCtx(), "Description"), "description", String.class), new ColumnInfo(Msg.translate(Env.getCtx(), "Value"), "value", String.class), new ColumnInfo(Msg.translate(Env.getCtx(), "Name"), "Name", String.class), new ColumnInfo(Msg.translate(Env.getCtx(), "QtyAvailable"), "QtyAvailable", Double.class, true, true, null), new ColumnInfo(Msg.translate(Env.getCtx(), "QtyOnHand"), "QtyOnHand", Double.class), new ColumnInfo(Msg.translate(Env.getCtx(), "QtyReserved"), "QtyReserved", Double.class), new ColumnInfo(Msg.translate(Env.getCtx(), "PriceStd"), "PriceStd", Double.class) };
    s_sqlFrom = "M_PRODUCT_SUBSTITUTERELATED_V";
    s_sqlWhere = "M_Product_ID = ? AND M_PriceList_Version_ID = ? and RowType = 'S'";
    m_sqlSubstitute = substituteTbl.prepareTable(s_layoutSubstitute, s_sqlFrom, s_sqlWhere, false, "M_PRODUCT_SUBSTITUTERELATED_V");
    substituteTbl.setMultiSelection(false);
    substituteTbl.autoSize();
    substituteTbl.getModel().addTableModelListener(this);
    substituteTbl.setAttribute("zk_component_ID", "Lookup_Data_Substitute");
    ColumnInfo[] s_layoutRelated = new ColumnInfo[] { new ColumnInfo(Msg.translate(Env.getCtx(), "Warehouse"), "orgname", String.class), new ColumnInfo(Msg.translate(Env.getCtx(), "Description"), "description", String.class), new ColumnInfo(Msg.translate(Env.getCtx(), "Value"), "value", String.class), new ColumnInfo(Msg.translate(Env.getCtx(), "Name"), "Name", String.class), new ColumnInfo(Msg.translate(Env.getCtx(), "QtyAvailable"), "QtyAvailable", Double.class, true, true, null), new ColumnInfo(Msg.translate(Env.getCtx(), "QtyOnHand"), "QtyOnHand", Double.class), new ColumnInfo(Msg.translate(Env.getCtx(), "QtyReserved"), "QtyReserved", Double.class), new ColumnInfo(Msg.translate(Env.getCtx(), "PriceStd"), "PriceStd", Double.class) };
    s_sqlFrom = "M_PRODUCT_SUBSTITUTERELATED_V";
    s_sqlWhere = "M_Product_ID = ? AND M_PriceList_Version_ID = ? and RowType = 'R'";
    m_sqlRelated = relatedTbl.prepareTable(s_layoutRelated, s_sqlFrom, s_sqlWhere, false, "M_PRODUCT_SUBSTITUTERELATED_V");
    relatedTbl.setMultiSelection(false);
    relatedTbl.autoSize();
    relatedTbl.getModel().addTableModelListener(this);
    relatedTbl.setAttribute("zk_component_ID", "Lookup_Data_Related");
    //Available to Promise Tab
    m_tableAtp.setMultiSelection(false);
    m_tableAtp.autoSize();
    m_tableAtp.setShowTotals(true);
    m_tableAtp.setAttribute("zk_component_ID", "Lookup_Data_ATP");
    //Vendor tab
    ColumnInfo[] s_layoutVendor = new ColumnInfo[] { new ColumnInfo(Msg.translate(Env.getCtx(), "Vendor"), "(SELECT bp.Name FROM C_BPartner bp WHERE bp.C_BPartner_ID = M_PRODUCT_PO.C_BPartner_ID)", String.class), new ColumnInfo(Msg.translate(Env.getCtx(), "IsCurrentVendor"), "IsCurrentVendor", Boolean.class), new ColumnInfo(Msg.translate(Env.getCtx(), "C_UOM_ID"), "(SELECT Name FROM C_UOM WHERE C_UOM_ID = M_PRODUCT_PO.C_UOM_ID)", String.class), new ColumnInfo(Msg.translate(Env.getCtx(), "C_Currency_ID"), "(SELECT iso_code FROM C_Currency WHERE C_Currency_ID = M_PRODUCT_PO.C_Currency_ID)", String.class), new ColumnInfo(Msg.translate(Env.getCtx(), "PriceList"), "PriceList", BigDecimal.class), new ColumnInfo(Msg.translate(Env.getCtx(), "PricePO"), "PricePO", BigDecimal.class), new ColumnInfo(Msg.translate(Env.getCtx(), "VendorProductNo"), "VendorProductNo", String.class), new ColumnInfo(Msg.translate(Env.getCtx(), "Order_Min"), "Order_Min", Double.class), new ColumnInfo(Msg.translate(Env.getCtx(), "DeliveryTime_Promised"), "DeliveryTime_Promised", Double.class), new ColumnInfo(Msg.translate(Env.getCtx(), "DeliveryTime_Actual"), "DeliveryTime_Actual", Double.class) };
    s_sqlFrom = "M_PRODUCT_PO";
    s_sqlWhere = "M_Product_ID = ?";
    m_sqlVendor = vendorTbl.prepareTable(s_layoutVendor, s_sqlFrom, s_sqlWhere, false, "M_PRODUCT_PO");
    vendorTbl.setMultiSelection(false);
    vendorTbl.autoSize();
    vendorTbl.setAttribute("zk_component_ID", "Lookup_Data_Vendor");
    detailTabBox.setHeight("100%");
    Tabpanels tabPanels = new Tabpanels();
    detailTabBox.appendChild(tabPanels);
    Tabs tabs = new Tabs();
    detailTabBox.appendChild(tabs);
    Tab tab = new Tab(Util.cleanAmp(Msg.translate(Env.getCtx(), "Warehouse")));
    tab.addEventListener(Events.ON_SELECT, this);
    tabs.appendChild(tab);
    Tabpanel desktopTabPanel = new Tabpanel();
    desktopTabPanel.setHeight("100%");
    desktopTabPanel.appendChild(warehouseTbl);
    tabPanels.appendChild(desktopTabPanel);
    tab = new Tab(Msg.translate(Env.getCtx(), "Description"));
    tab.addEventListener(Events.ON_SELECT, this);
    tabs.appendChild(tab);
    desktopTabPanel = new Tabpanel();
    desktopTabPanel.setHeight("100%");
    fieldDescription.setWidth("99%");
    fieldDescription.setHeight("99%");
    desktopTabPanel.appendChild(fieldDescription);
    tabPanels.appendChild(desktopTabPanel);
    tab = new Tab(Msg.translate(Env.getCtx(), "ProductAttribute"));
    tab.addEventListener(Events.ON_SELECT, this);
    tabs.appendChild(tab);
    desktopTabPanel = new Tabpanel();
    desktopTabPanel.setHeight("100%");
    fieldPAttributes.setWidth("99%");
    fieldPAttributes.setHeight("99%");
    desktopTabPanel.appendChild(fieldPAttributes);
    tabPanels.appendChild(desktopTabPanel);
    tab = new Tab(Msg.translate(Env.getCtx(), "Substitute_ID"));
    tab.addEventListener(Events.ON_SELECT, this);
    tabs.appendChild(tab);
    desktopTabPanel = new Tabpanel();
    desktopTabPanel.setHeight("100%");
    desktopTabPanel.appendChild(substituteTbl);
    tabPanels.appendChild(desktopTabPanel);
    tab = new Tab(Msg.translate(Env.getCtx(), "RelatedProduct_ID"));
    tab.addEventListener(Events.ON_SELECT, this);
    tabs.appendChild(tab);
    desktopTabPanel = new Tabpanel();
    desktopTabPanel.setHeight("100%");
    desktopTabPanel.appendChild(relatedTbl);
    tabPanels.appendChild(desktopTabPanel);
    tab = new Tab(Msg.getMsg(Env.getCtx(), "ATP"));
    tab.addEventListener(Events.ON_SELECT, this);
    tabs.appendChild(tab);
    desktopTabPanel = new Tabpanel();
    desktopTabPanel.setHeight("100%");
    desktopTabPanel.appendChild(m_tableAtp);
    tabPanels.appendChild(desktopTabPanel);
    tab = new Tab(Util.cleanAmp(Msg.translate(Env.getCtx(), "Vendor")));
    tab.addEventListener(Events.ON_SELECT, this);
    tabs.appendChild(tab);
    desktopTabPanel = new Tabpanel();
    desktopTabPanel.setHeight("100%");
    desktopTabPanel.appendChild(vendorTbl);
    tabPanels.appendChild(desktopTabPanel);
    tabs.setAttribute("zk_component_ID", "Subordinate_Tabs");
    //  Add the tabs to the center south layout
    Borderlayout tabLayout = new Borderlayout();
    //  
    North north = new North();
    tabLayout.appendChild(north);
    north.appendChild(checkShowDetail);
    //
    Center center = new Center();
    tabLayout.appendChild(center);
    center.appendChild(detailTabBox);
    //  Set main panel elements.  The other elements are handled by the info.java class
    p_criteriaGrid.appendChild(rows);
    p_centerSouth.appendChild(tabLayout);
    p_centerSouth.setTitle(Msg.translate(Env.getCtx(), "WarehouseStock"));
    p_centerSouth.setTooltiptext(Msg.translate(Env.getCtx(), "WarehouseStock"));
    super.setSizes();
    warehouseTbl.addActionListener(new EventListener<Event>() {

        public void onEvent(Event event) throws Exception {
            if (warehouseTbl.getRowCount() > 0) {
                int selectedRow = warehouseTbl.getSelectedRow();
                if (selectedRow < 0)
                    selectedRow = 0;
                Object wh_data = warehouseTbl.getValueAt(selectedRow, warehouseTbl.getKeyColumnIndex());
                if (wh_data != null && wh_data instanceof IDColumn) {
                    IDColumn dataColumn = (IDColumn) wh_data;
                    m_ATP_M_Warehouse_ID = dataColumn.getRecord_ID();
                } else {
                    m_ATP_M_Warehouse_ID = m_M_Warehouse_ID;
                }
            } else {
                m_ATP_M_Warehouse_ID = m_M_Warehouse_ID;
            }
        }
    });
}
Also used : Center(org.zkoss.zul.Center) ColumnInfo(org.compiere.minigrid.ColumnInfo) Borderlayout(org.zkoss.zul.Borderlayout) SQLException(java.sql.SQLException) IDColumn(org.compiere.minigrid.IDColumn) Tab(org.adempiere.webui.component.Tab) Tabpanels(org.adempiere.webui.component.Tabpanels) Tabs(org.adempiere.webui.component.Tabs) Event(org.zkoss.zk.ui.event.Event) North(org.zkoss.zul.North) Row(org.adempiere.webui.component.Row) Tabpanel(org.adempiere.webui.component.Tabpanel) Rows(org.adempiere.webui.component.Rows)

Example 44 with Event

use of org.zkoss.zk.ui.event.Event in project adempiere by adempiere.

the class WBrowser method initComponents.

/**
	 * Initialize View Components
	 */
private void initComponents() {
    toolsBar = new ToolBar();
    bZoom = new Button();
    bExport = new Button();
    bDelete = new Button();
    tabsPanel = new Tabbox();
    searchTab = new Borderlayout();
    collapsibleSeach = new North();
    topPanel = new Hbox();
    searchGrid = new WBrowserSearch(getWindowNo(), getAD_Browse_ID(), BrowserSearch.COLUMNS_2);
    detail = new WBrowserTable(this);
    detail.addEventListener(Events.ON_SELECT, this);
    bCancel = new Button();
    bOk = new Button();
    detailPanel = new Borderlayout();
    Borderlayout mainLayout = new Borderlayout();
    setupToolBar();
    bSelectAll.setLabel(Msg.getMsg(Env.getCtx(), "SelectAll").replaceAll("[&]", ""));
    bSelectAll.setEnabled(false);
    bSelectAll.addActionListener(new EventListener() {

        public void onEvent(Event evt) {
            selectedRows();
        }
    });
    toolsBar.appendChild(bSelectAll);
    //TODO: victor.perez@e-evolution.com pending print functionality
    /*bPrint.setLabel("Print");

		bPrint.addActionListener(new EventListener() {
			@Override
			public void onEvent(Event event) throws Exception {
				bPrintActionPerformed(event);
			}
		});

		toolsBar.appendChild(bPrint);*/
    bZoom.setLabel(Msg.getMsg(Env.getCtx(), "Zoom").replaceAll("[&]", ""));
    bZoom.setEnabled(false);
    bZoom.addActionListener(new EventListener() {

        public void onEvent(Event evt) {
            cmd_Zoom();
        }
    });
    //Only enable if exist a reference
    if (AD_Window_ID > 0)
        toolsBar.appendChild(bZoom);
    bExport.setLabel(Msg.getMsg(Env.getCtx(), "Export"));
    bExport.setEnabled(false);
    bExport.addActionListener(new EventListener() {

        public void onEvent(Event evt) {
            cmd_Export();
        }
    });
    toolsBar.appendChild(bExport);
    bDelete.setLabel(Msg.getMsg(Env.getCtx(), "Delete").replaceAll("[&]", ""));
    bDelete.setEnabled(false);
    bDelete.addActionListener(new EventListener() {

        public void onEvent(Event evt) {
            cmd_deleteSelection();
        }
    });
    if (isDeleteable())
        toolsBar.appendChild(bDelete);
    m_frame.setWidth("100%");
    m_frame.setHeight("100%");
    m_frame.setStyle("position: absolute; padding: 0; margin: 0");
    m_frame.appendChild(mainLayout);
    mainLayout.setWidth("100%");
    mainLayout.setHeight("100%");
    mainLayout.setStyle("position: absolute");
    North north = new North();
    north.appendChild(toolsBar);
    mainLayout.appendChild(north);
    searchTab = new Borderlayout();
    searchTab.setWidth("99.4%");
    searchTab.setHeight("99.4%");
    searchTab.setStyle("background-color: transparent");
    topPanel = new Hbox();
    topPanel.setStyle("background-color: transparent");
    bSearch.setLabel(Msg.getMsg(Env.getCtx(), "StartSearch"));
    bSearch.addActionListener(new EventListener() {

        public void onEvent(Event evt) {
            cmd_Search();
        }
    });
    Vbox vbox = new Vbox();
    vbox.appendChild(topPanel);
    vbox.appendChild(bSearch);
    vbox.setAlign("center");
    vbox.setWidth("100%");
    vbox.setStyle("background-color: transparent");
    Div div = new Div();
    div.appendChild(vbox);
    div.setWidth("100%");
    div.setHeight("100%");
    collapsibleSeach.setTitle(Msg.getMsg(Env.getCtx(), ("SearchCriteria")));
    collapsibleSeach.setCollapsible(true);
    collapsibleSeach.setAutoscroll(true);
    collapsibleSeach.appendChild(div);
    collapsibleSeach.setStyle("overflow-y:auto");
    collapsibleSeach.setStyle("background-color: transparent");
    collapsibleSeach.setStyle("border: none");
    searchTab.appendChild(collapsibleSeach);
    detail.setWidth("100%");
    //detail.setHeight("100%");
    Center dCenter = new Center();
    dCenter.appendChild(detail);
    dCenter.setBorder("none");
    detail.setVflex(true);
    detail.setFixedLayout(true);
    dCenter.setHflex("true");
    dCenter.setVflex("true");
    dCenter.setAutoscroll(true);
    detailPanel.setHeight("100%");
    detailPanel.setWidth("100%");
    detailPanel.appendCenter(detail);
    //		Div dv = new Div();
    div.appendChild(detailPanel);
    div.setHeight("100%");
    div.setWidth("100%");
    searchTab.appendCenter(detailPanel);
    Hbox hbox = new Hbox();
    //		bCancel.setLabel(Msg.getMsg(Env.getCtx(), "Cancel").replaceAll("[&]",""));
    bCancel.addActionListener(new EventListener() {

        public void onEvent(Event evt) {
            cmd_Cancel();
        }
    });
    //		bOk.setLabel(Msg.getMsg(Env.getCtx(), "Ok").replaceAll("[&]",""));
    bOk.addActionListener(new EventListener() {

        public void onEvent(Event evt) {
            cmd_Ok();
        }
    });
    Div confirmDiv = new Div();
    confirmDiv.setAlign("center");
    hbox.appendChild(bCancel);
    hbox.appendChild(bOk);
    hbox.setAlign("center");
    confirmDiv.appendChild(hbox);
    Separator separator = new Separator();
    separator.setBar(true);
    confirmDiv.appendChild(separator);
    confirmDiv.appendChild(statusBar);
    searchTab.appendSouth(confirmDiv);
    searchTab.getSouth().setBorder("none");
    Tabpanel search = new Tabpanel();
    search.setWidth("100%");
    search.appendChild(searchTab);
    Tab tabSearch = new Tab();
    tabSearch.addEventListener(Events.ON_SELECT, this);
    tabSearch.setLabel(Msg.getMsg(Env.getCtx(), "Search").replaceAll("[&]", ""));
    Tabs tabs = new Tabs();
    tabs.appendChild(tabSearch);
    Tabpanels tabPanels = new Tabpanels();
    tabPanels.setWidth("100%");
    tabPanels.appendChild(search);
    //graphPanel = new Borderlayout();
    //TODO victor.perez@e-evolution.com implement Graph Functionality
    //Tabpanel graph = new Tabpanel();
    //graph.setWidth("100%");
    //graph.appendChild(graphPanel);
    //Tab tabGraph = new Tab();
    //tabGraph.addEventListener(Events.ON_SELECT, this);
    //tabGraph.setLabel(Msg.getMsg(Env.getCtx(), "Graph").replaceAll("[&]",
    //		""));
    //tabs.appendChild(tabGraph);
    //tabPanels.appendChild(graph);
    tabsPanel.setWidth("100%");
    tabsPanel.setHeight("100%");
    tabsPanel.appendChild(tabs);
    tabsPanel.appendChild(tabPanels);
    mainLayout.appendCenter(tabsPanel);
}
Also used : Hbox(org.zkoss.zul.Hbox) Center(org.zkoss.zul.Center) Tabbox(org.adempiere.webui.component.Tabbox) Borderlayout(org.adempiere.webui.component.Borderlayout) Div(org.zkoss.zul.Div) Tab(org.adempiere.webui.component.Tab) Button(org.adempiere.webui.component.Button) Tabpanels(org.adempiere.webui.component.Tabpanels) ToolBar(org.adempiere.webui.component.ToolBar) WBrowserTable(org.eevolution.grid.WBrowserTable) Event(org.zkoss.zk.ui.event.Event) Tabs(org.adempiere.webui.component.Tabs) North(org.zkoss.zul.North) EventListener(org.zkoss.zk.ui.event.EventListener) Vbox(org.zkoss.zul.Vbox) Tabpanel(org.adempiere.webui.component.Tabpanel) Separator(org.zkoss.zul.Separator)

Example 45 with Event

use of org.zkoss.zk.ui.event.Event in project adempiere by adempiere.

the class WFactReconcile method initComponents.

/**
	 *  Static Init
	 *  @throws Exception
	 */
private void initComponents() throws Exception {
    //  Buttons
    bCancel.addActionListener(this);
    //
    bGenerate.setLabel(Msg.getMsg(Env.getCtx(), "Process"));
    bGenerate.addActionListener(this);
    bGenerate.setEnabled(false);
    //	
    bReset.setLabel(Msg.getMsg(Env.getCtx(), "Reset"));
    bReset.addActionListener(this);
    bReset.setEnabled(false);
    //
    bZoom.setLabel(Msg.translate(Env.getCtx(), "Fact_Acct_ID"));
    bZoom.setEnabled(false);
    bZoom.addActionListener(this);
    //
    bRefresh.addActionListener(this);
    //  Labels
    labelBlank.setValue(" ");
    labelAcctSchema.setText(Msg.translate(Env.getCtx(), "C_AcctSchema_ID"));
    labelAccount.setText(Msg.translate(Env.getCtx(), "Account_ID"));
    labelBPartner.setText(Msg.translate(Env.getCtx(), "C_BPartner_ID"));
    labelDateAcct.setText(Msg.translate(Env.getCtx(), "DateAcct"));
    labelDateAcct2.setText("-");
    labelProduct.setText(Msg.translate(Env.getCtx(), "M_Product_ID"));
    //
    labelOrg.setText(Msg.translate(Env.getCtx(), "AD_Org_ID"));
    isReconciled.setText(Msg.translate(Env.getCtx(), "IsReconciled"));
    //
    statusBar.setEastVisibility(false);
    statusBar.setAttribute("zk_component_ID", "info_statusBar");
    setStatusLine(Msg.getMsg(Env.getCtx(), "SearchRows_EnterQuery"), false);
    setStatusDB("0");
    //
    differenceLabel.setText(Msg.getMsg(Env.getCtx(), "Difference"));
    differenceField.setReadonly(true);
    differenceField.setValue("0");
    differenceField.setAttribute("zk_component_ID", "ConfirmPanel_differenceField");
    //  Find context and client
    Properties ctx = Env.getCtx();
    m_AD_Client_ID = Env.getAD_Client_ID(Env.getCtx());
    // Organization filter selection
    //  Fact_Acct.C_AcctSchema_ID AD_Column_ID = 2513
    fieldAcctSchema = new WTableDirEditor("C_AcctSchema_ID", false, false, true, MLookupFactory.get(Env.getCtx(), m_WindowNo, 0, MColumn.getColumn_ID(MFactAcct.Table_Name, MFactAcct.COLUMNNAME_C_AcctSchema_ID), DisplayType.TableDir));
    fieldAcctSchema.getComponent().setAttribute("zk_component_ID", "Lookup_Criteria_C_AcctSchema_ID");
    fieldAcctSchema.getComponent().setAttribute("zk_component_prefix", "Lookup_");
    fieldAcctSchema.getComponent().setAttribute("IsDynamic", "False");
    fieldAcctSchema.getComponent().setAttribute("fieldName", "fieldAcctSchema");
    fieldAcctSchema.setValue(MClient.get(Env.getCtx()).getAcctSchema().getC_AcctSchema_ID());
    //
    //Fact_Acct.AD_Org_ID (needed to allow org 0) AD_Column_ID = 839; 
    fieldOrg = new WTableDirEditor("AD_Org_ID", false, false, true, MLookupFactory.get(Env.getCtx(), m_WindowNo, 0, MColumn.getColumn_ID(MFactAcct.Table_Name, MFactAcct.COLUMNNAME_AD_Org_ID), DisplayType.TableDir));
    fieldOrg.getComponent().setAttribute("zk_component_ID", "Lookup_Criteria_AD_Org_ID");
    fieldOrg.getComponent().setAttribute("zk_component_prefix", "Lookup_");
    fieldOrg.getComponent().setAttribute("IsDynamic", "False");
    fieldOrg.getComponent().setAttribute("fieldName", "fieldOrg");
    // Attempt to select "*" and fall back to context           
    fieldOrg.setValue(0);
    if (fieldOrg.getValue() == null || ((Integer) fieldOrg.getValue()).intValue() != 0)
        fieldOrg.setValue(Env.getAD_Org_ID(Env.getCtx()));
    //
    //  BPartner C_Invoice.C_BPartner_ID AD_Column_ID = 3499; 
    fieldBPartner.getComponent().setAttribute("zk_component_ID", "Lookup_Criteria_C_BPartner_ID");
    fieldBPartner.getComponent().setAttribute("zk_component_prefix", "Lookup_");
    fieldBPartner.getComponent().setAttribute("IsDynamic", "False");
    fieldBPartner.getComponent().setAttribute("fieldName", "fieldBPartner");
    fieldBPartner.getComponent().setWidth("200px");
    //
    // Product Fact_Acct.M_Product_ID AD_Column_ID = 2527;        
    fieldProduct.getComponent().setAttribute("zk_component_ID", "Lookup_Criteria_M_Product_ID");
    fieldProduct.getComponent().setAttribute("zk_component_prefix", "Lookup_");
    fieldProduct.getComponent().setAttribute("IsDynamic", "False");
    fieldProduct.getComponent().setAttribute("fieldName", "fieldProduct");
    fieldProduct.getComponent().setWidth("200px");
    //
    // The Account combo.  A bit more involved if we try to filter out the summary accounts.
    MLookup lookup;
    try {
        lookup = MLookupFactory.get(Env.getCtx(), m_WindowNo, MColumn.getColumn_ID(MFactAcct.Table_Name, MFactAcct.COLUMNNAME_Account_ID), DisplayType.TableDir, Env.getLanguage(Env.getCtx()), MFactAcct.COLUMNNAME_Account_ID, 0, false, "C_ElementValue.IsSummary = 'N'");
    } catch (Exception e) {
        // Jut alors!  Drop the validation and try again.
        lookup = MLookupFactory.get(Env.getCtx(), m_WindowNo, 0, MColumn.getColumn_ID(MFactAcct.Table_Name, MFactAcct.COLUMNNAME_Account_ID), DisplayType.TableDir);
    }
    fieldAccount = new WTableDirEditor("AD_Org_ID", true, false, true, lookup);
    fieldAccount.getComponent().setAttribute("zk_component_ID", "Lookup_Criteria_Account_ID");
    fieldAccount.getComponent().setAttribute("zk_component_prefix", "Lookup_");
    fieldAccount.getComponent().setAttribute("IsDynamic", "False");
    fieldAccount.getComponent().setAttribute("fieldName", "fieldAccount");
    if (fieldAccount.getComponent().getItemCount() > 2)
        fieldAccount.getComponent().setSelectedIndex(1);
    //  Define the table
    m_sql = miniTable.prepareTable(new ColumnInfo[] { new ColumnInfo(" ", "fa.Fact_Acct_ID", IDColumn.class, false, false, null), new ColumnInfo(Msg.translate(ctx, "AmtAcct"), "(fa.amtacctdr-fa.amtacctcr)", BigDecimal.class, true, true, null), new ColumnInfo("DR/CR", "(CASE WHEN (fa.amtacctdr-fa.amtacctcr) < 0 THEN 'CR' ELSE 'DR' END)", String.class), new ColumnInfo(Msg.translate(ctx, "C_BPartner_ID"), "bp.Name", String.class), new ColumnInfo(Msg.translate(ctx, "DateAcct"), "fa.DateAcct", Timestamp.class), new ColumnInfo(Msg.translate(ctx, "GL_Category_ID"), "glc.Name", String.class), new ColumnInfo(Msg.translate(ctx, "M_Product_ID"), "p.Value", String.class), new ColumnInfo(Msg.translate(ctx, "Qty"), "Qty", BigDecimal.class), new ColumnInfo(Msg.translate(ctx, "Description"), "fa.Description", String.class), new ColumnInfo(Msg.translate(ctx, "MatchCode"), "r.MatchCode", String.class), new ColumnInfo(Msg.translate(ctx, "DateTrx"), "fa.DateTrx", Timestamp.class), new ColumnInfo(Msg.translate(ctx, "AD_Org_ID"), "o.Value", String.class), new ColumnInfo(Msg.translate(ctx, "Amt"), "abs(fa.amtacctdr-fa.amtacctcr)", BigDecimal.class, 0, true, false, null, false) }, //	FROM
    "Fact_Acct fa" + " LEFT OUTER JOIN Fact_Reconciliation r ON (fa.Fact_Acct_ID=r.Fact_Acct_ID)" + " LEFT OUTER JOIN C_BPartner bp ON (fa.C_BPartner_ID=bp.C_BPartner_ID)" + " LEFT OUTER JOIN AD_Org o ON (o.AD_Org_ID=fa.AD_Org_ID)" + " LEFT OUTER JOIN M_Product p ON (p.M_Product_ID=fa.M_Product_ID)" + " LEFT OUTER JOIN GL_Category glc ON (fa.GL_Category_ID=glc.GL_Category_ID)", //	additional where & order in loadTableInfo()
    " fa.AD_Client_ID=?", true, "fa");
    //
    miniTable.addActionListener(new EventListener() {

        public void onEvent(Event event) throws Exception {
            if (event.getName().equals("onSelect")) {
                calculateSelection();
                boolean enable = (miniTable.getSelectedCount() == 1);
                bZoom.setEnabled(enable);
            }
        }
    });
}
Also used : WTableDirEditor(org.adempiere.webui.editor.WTableDirEditor) MLookup(org.compiere.model.MLookup) ColumnInfo(org.compiere.minigrid.ColumnInfo) Event(org.zkoss.zk.ui.event.Event) WTableModelEvent(org.adempiere.webui.event.WTableModelEvent) EventListener(org.zkoss.zk.ui.event.EventListener) Properties(java.util.Properties) SQLException(java.sql.SQLException)

Aggregations

Event (org.zkoss.zk.ui.event.Event)60 EventListener (org.zkoss.zk.ui.event.EventListener)42 JSONObject (org.json.simple.JSONObject)11 ForwardEvent (org.zkoss.zk.ui.event.ForwardEvent)9 ValueChangeEvent (org.adempiere.exceptions.ValueChangeEvent)7 Component (org.zkoss.zk.ui.Component)7 CheckEvent (org.zkoss.zk.ui.event.CheckEvent)7 LegendObject (au.org.ala.legend.LegendObject)6 IOException (java.io.IOException)6 SQLException (java.sql.SQLException)6 JSONParser (org.json.simple.parser.JSONParser)6 Center (org.zkoss.zul.Center)6 MapLayer (au.org.emii.portal.menu.MapLayer)5 JSONArray (org.json.simple.JSONArray)5 Borderlayout (org.zkoss.zul.Borderlayout)5 Tabpanel (org.adempiere.webui.component.Tabpanel)4 WTableModelEvent (org.adempiere.webui.event.WTableModelEvent)4 ParseException (org.json.simple.parser.ParseException)4 Div (org.zkoss.zul.Div)4 North (org.zkoss.zul.North)4