Search in sources :

Example 16 with Tabpanel

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

the class AboutWindow method createAbout.

private Tabpanel createAbout() {
    Tabpanel tabPanel = new Tabpanel();
    Vbox vbox = new Vbox();
    vbox.setWidth("100%");
    vbox.setHeight("100%");
    vbox.setAlign("center");
    vbox.setPack("center");
    vbox.setParent(tabPanel);
    Image image = new Image(ThemeManager.getSmallLogo());
    image.setParent(vbox);
    Text text = new Text(Adempiere.getSubtitle());
    text.setParent(vbox);
    Separator separator = new Separator();
    separator.setParent(vbox);
    text = new Text(Adempiere.getVersion());
    text.setParent(vbox);
    separator = new Separator();
    separator.setParent(vbox);
    ToolBarButton link = new ToolBarButton();
    link.setLabel("Github Project Site");
    link.setHref("http://github.com/adempiere");
    link.setTarget("_blank");
    link.setParent(vbox);
    separator = new Separator();
    separator.setParent(vbox);
    link = new ToolBarButton();
    link.setLabel("ADempiere.io");
    link.setHref("http://www.adempiere.io");
    link.setTarget("_blank");
    link.setParent(vbox);
    separator = new Separator();
    separator.setParent(vbox);
    link = new ToolBarButton();
    link.setLabel("ADempiere.net");
    link.setHref("http://www.adempiere.net");
    link.setTarget("_blank");
    link.setParent(vbox);
    separator = new Separator();
    separator.setParent(vbox);
    link = new ToolBarButton();
    link.setLabel("ADempiere Wiki");
    link.setHref("http://wiki.adempiere.net");
    link.setTarget("_blank");
    link.setParent(vbox);
    return tabPanel;
}
Also used : ToolBarButton(org.adempiere.webui.component.ToolBarButton) Text(org.zkoss.zhtml.Text) Image(org.zkoss.zul.Image) Tabpanel(org.adempiere.webui.component.Tabpanel) Vbox(org.zkoss.zul.Vbox) Separator(org.zkoss.zul.Separator)

Example 17 with Tabpanel

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

the class WTextEditorDialog method init.

private void init() {
    setBorder("normal");
    VerticalBox vbox = new VerticalBox();
    appendChild(vbox);
    tabbox = new Tabbox();
    vbox.appendChild(tabbox);
    Tabs tabs = new Tabs();
    tabbox.appendChild(tabs);
    Tabpanels tabPanels = new Tabpanels();
    tabbox.appendChild(tabPanels);
    Tab tab = new Tab("Text");
    tabs.appendChild(tab);
    Tabpanel tabPanel = new Tabpanel();
    tabPanels.appendChild(tabPanel);
    textBox = new Textbox(text);
    textBox.setCols(80);
    textBox.setRows(30);
    textBox.setEnabled(editable);
    textBox.setWidth("700px");
    textBox.setHeight("500px");
    tabPanel.appendChild(textBox);
    tab = new Tab("HTML");
    tabs.appendChild(tab);
    tabPanel = new Tabpanel();
    tabPanels.appendChild(tabPanel);
    if (editable) {
        editor = new FCKeditor();
        tabPanel.appendChild(editor);
        editor.setWidth("700px");
        editor.setHeight("500px");
        editor.setValue(text);
    } else {
        Div div = new Div();
        div.setHeight("500px");
        div.setWidth("700px");
        div.setStyle("overflow: auto; border: 1px solid");
        tabPanel.appendChild(div);
        Html html = new Html();
        div.appendChild(html);
        html.setContent(text);
    }
    vbox.appendChild(new Separator());
    ConfirmPanel confirmPanel = new ConfirmPanel(true);
    vbox.appendChild(confirmPanel);
    confirmPanel.addButton(confirmPanel.createButton(ConfirmPanel.A_RESET));
    confirmPanel.addActionListener(this);
    if (maxSize > 0) {
        status = new Label();
        appendChild(status);
        updateStatus(text.length());
        status.setStyle("margin-top:10px;");
        textBox.addEventListener(Events.ON_CHANGE, this);
        editor.addEventListener(Events.ON_CHANGE, this);
    }
    tabbox.addEventListener(Events.ON_SELECT, this);
}
Also used : VerticalBox(org.adempiere.webui.component.VerticalBox) Textbox(org.adempiere.webui.component.Textbox) Label(org.adempiere.webui.component.Label) Html(org.zkoss.zul.Html) Tabbox(org.adempiere.webui.component.Tabbox) Div(org.zkoss.zul.Div) Tab(org.adempiere.webui.component.Tab) ConfirmPanel(org.adempiere.webui.component.ConfirmPanel) Tabpanels(org.adempiere.webui.component.Tabpanels) Tabs(org.adempiere.webui.component.Tabs) Tabpanel(org.adempiere.webui.component.Tabpanel) Separator(org.zkoss.zul.Separator) FCKeditor(org.zkforge.fckez.FCKeditor)

Example 18 with Tabpanel

use of org.adempiere.webui.component.Tabpanel 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 19 with Tabpanel

use of org.adempiere.webui.component.Tabpanel 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 20 with Tabpanel

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

the class DefaultDesktop method createHomeTab.

private void createHomeTab() {
    Tabpanel homeTab = new Tabpanel();
    windowContainer.addWindow(homeTab, Msg.getMsg(Env.getCtx(), "Home").replaceAll("&", ""), false);
    Portallayout portalLayout = new Portallayout();
    portalLayout.setWidth("100%");
    portalLayout.setHeight("100%");
    portalLayout.setStyle("position: absolute; overflow: auto");
    homeTab.appendChild(portalLayout);
    // Dashboard content
    Portalchildren portalchildren = null;
    int currentColumnNo = 0;
    String sql = "SELECT COUNT(DISTINCT COLUMNNO) " + "FROM PA_DASHBOARDCONTENT " + "WHERE (AD_CLIENT_ID=0 OR AD_CLIENT_ID=?) AND ISACTIVE='Y'";
    int noOfCols = DB.getSQLValue(null, sql, Env.getAD_Client_ID(Env.getCtx()));
    int width = noOfCols <= 0 ? 100 : 100 / noOfCols;
    /* sql = "SELECT x.* "
			+ "FROM PA_DASHBOARDCONTENT x "
			+ "WHERE (x.AD_CLIENT_ID=0 OR x.AD_CLIENT_ID=?) AND x.ISACTIVE='Y' "
			+ "ORDER BY x.COLUMNNO, x.AD_CLIENT_ID, x.LINE ";*/
    StringBuffer sqlContent = new StringBuffer();
    sqlContent.append("SELECT x.PA_DASHBOARDCONTENT_ID, x.AD_CLIENT_ID, x.AD_ORG_ID, x.ISACTIVE ,");
    sqlContent.append("       COALESCE(XTRL.NAME,x.NAME) AS NAME ,");
    sqlContent.append(" x.AD_WINDOW_ID ,");
    sqlContent.append(" x.DESCRIPTION ,");
    sqlContent.append("  x.HTML ,");
    sqlContent.append("  x.LINE ,");
    sqlContent.append("  x.PA_GOAL_ID ,");
    sqlContent.append(" x.COLUMNNO ,");
    sqlContent.append(" x.ZULFILEPATH ,");
    sqlContent.append(" x.ISCOLLAPSIBLE ,");
    sqlContent.append(" x.GOALDISPLAY ,");
    sqlContent.append(" x.ISOPENBYDEFAULT ,");
    sqlContent.append("  x.ISEVENTREQUIRED ,");
    sqlContent.append("  x.ZOOM_WINDOW_ID ,");
    sqlContent.append(" x.ZOOM_TAB_ID ,");
    sqlContent.append("  x.PAGESIZE ,");
    sqlContent.append(" x.ONEVENT ,");
    sqlContent.append(" x.AD_BROWSE_ID ,");
    sqlContent.append(" x.ZOOM_FIELD_ID ");
    sqlContent.append(" FROM PA_DASHBOARDCONTENT x ");
    sqlContent.append(" LEFT JOIN PA_DASHBOARDCONTENT_TRL xtrl on x.PA_DASHBOARDCONTENT_ID = xtrl.PA_DASHBOARDCONTENT_ID " + "AND xtrl.AD_LANGUAGE = ?");
    sqlContent.append(" WHERE (x.AD_CLIENT_ID=0 OR x.AD_CLIENT_ID=?) AND x.ISACTIVE='Y' ");
    sqlContent.append(" ORDER BY x.COLUMNNO, x.AD_CLIENT_ID, x.LINE ");
    PreparedStatement pstmt = null;
    ResultSet rs = null;
    try {
        pstmt = DB.prepareStatement(sqlContent.toString(), null);
        pstmt.setString(1, Env.getAD_Language(Env.getCtx()));
        pstmt.setInt(2, Env.getAD_Client_ID(Env.getCtx()));
        rs = pstmt.executeQuery();
        while (rs.next()) {
            int columnNo = rs.getInt(X_PA_DashboardContent.COLUMNNAME_ColumnNo);
            if (portalchildren == null || currentColumnNo != columnNo) {
                portalchildren = new Portalchildren();
                portalLayout.appendChild(portalchildren);
                portalchildren.setWidth(width + "%");
                portalchildren.setStyle("padding: 5px");
                currentColumnNo = columnNo;
            }
            Panel panel = new Panel();
            panel.setStyle("margin-bottom:10px");
            panel.setTitle(rs.getString(X_PA_DashboardContent.COLUMNNAME_Name));
            String description = rs.getString(X_PA_DashboardContent.COLUMNNAME_Description);
            if (description != null)
                panel.setTooltiptext(description);
            String collapsible = rs.getString(X_PA_DashboardContent.COLUMNNAME_IsCollapsible);
            panel.setCollapsible(collapsible.equals("Y"));
            String isOpenByDefault = rs.getString(X_PA_DashboardContent.COLUMNNAME_IsOpenByDefault);
            panel.setOpen(isOpenByDefault.equals("Y"));
            panel.setBorder("normal");
            portalchildren.appendChild(panel);
            Panelchildren content = new Panelchildren();
            panel.appendChild(content);
            boolean panelEmpty = true;
            // HTML content
            String htmlContent = rs.getString(X_PA_DashboardContent.COLUMNNAME_HTML);
            if (htmlContent != null) {
                StringBuffer result = new StringBuffer("<html><head>");
                URL url = getClass().getClassLoader().getResource("org/compiere/images/PAPanel.css");
                InputStreamReader ins;
                try {
                    ins = new InputStreamReader(url.openStream());
                    BufferedReader bufferedReader = new BufferedReader(ins);
                    String cssLine;
                    while ((cssLine = bufferedReader.readLine()) != null) result.append(cssLine + "\n");
                } catch (IOException e1) {
                    logger.log(Level.SEVERE, e1.getLocalizedMessage(), e1);
                }
                result.append("</head><body><div class=\"content\">\n");
                result.append(stripHtml(htmlContent, false) + "<br>\n");
                result.append("</div>\n</body>\n</html>\n</html>");
                Html html = new Html();
                html.setContent(result.toString());
                content.appendChild(html);
                panelEmpty = false;
            }
            // Window
            int AD_Window_ID = rs.getInt(X_PA_DashboardContent.COLUMNNAME_AD_Window_ID);
            if (AD_Window_ID > 0) {
                MDashboardContent dashboardContent = new MDashboardContent(Env.getCtx(), rs.getInt(X_PA_DashboardContent.COLUMNNAME_PA_DashboardContent_ID), null);
                int AD_Menu_ID = dashboardContent.getAD_Menu_ID();
                ToolBarButton btn = new ToolBarButton(String.valueOf(AD_Menu_ID));
                I_AD_Menu menu = dashboardContent.getAD_Menu();
                btn.setLabel(menu.getName());
                btn.addEventListener(Events.ON_CLICK, this);
                content.appendChild(btn);
                panelEmpty = false;
            }
            //SmartBrowse
            int AD_Browse_ID = rs.getInt(X_PA_DashboardContent.COLUMNNAME_AD_Browse_ID);
            if (AD_Browse_ID > 0) {
                try {
                    //setting Tab ID to context
                    Env.setContext(Env.getCtx(), "#AD_Browse_ID", rs.getInt(X_PA_DashboardContent.COLUMNNAME_AD_Browse_ID));
                    Env.setContext(Env.getCtx(), "#PageSize", rs.getInt(X_PA_DashboardContent.COLUMNNAME_PageSize));
                    Env.setContext(Env.getCtx(), "#Zoom_Tab_ID", rs.getInt(X_PA_DashboardContent.COLUMNNAME_Zoom_Tab_ID));
                    Env.setContext(Env.getCtx(), "#Zoom_Window_ID", rs.getInt(X_PA_DashboardContent.COLUMNNAME_Zoom_Window_ID));
                    Env.setContext(Env.getCtx(), "#Zoom_Field_ID", rs.getInt(X_PA_DashboardContent.COLUMNNAME_Zoom_Field_ID));
                    Env.setContext(Env.getCtx(), "#OnEvent", rs.getString(X_PA_DashboardContent.COLUMNNAME_onevent));
                    Component component = Executions.createComponents(dynamic_Dashboard_zulFilepath, content, null);
                    if (component != null) {
                        if (component instanceof DashboardPanel) {
                            DashboardPanel dashboardPanel = (DashboardPanel) component;
                            if (!dashboardPanel.getChildren().isEmpty()) {
                                content.appendChild(dashboardPanel);
                                dashboardRunnable.add(dashboardPanel);
                                panelEmpty = false;
                            }
                        } else {
                            content.appendChild(component);
                            panelEmpty = false;
                        }
                    }
                } catch (Exception e) {
                    logger.log(Level.WARNING, "Failed to create components. zul=" + dynamic_Dashboard_zulFilepath, e);
                }
            }
            // Goal
            int PA_Goal_ID = rs.getInt(X_PA_DashboardContent.COLUMNNAME_PA_Goal_ID);
            if (PA_Goal_ID > 0) {
                //link to open performance detail
                Toolbarbutton link = new Toolbarbutton();
                link.setImage("/images/Zoom16.png");
                link.setAttribute("PA_Goal_ID", PA_Goal_ID);
                link.addEventListener(Events.ON_CLICK, new EventListener() {

                    public void onEvent(Event event) throws Exception {
                        int PA_Goal_ID = (Integer) event.getTarget().getAttribute("PA_Goal_ID");
                        MGoal goal = new MGoal(Env.getCtx(), PA_Goal_ID, null);
                        new WPerformanceDetail(goal);
                    }
                });
                content.appendChild(link);
                String goalDisplay = rs.getString(X_PA_DashboardContent.COLUMNNAME_GoalDisplay);
                MGoal goal = new MGoal(Env.getCtx(), PA_Goal_ID, null);
                WGraph graph = new WGraph(goal, 55, false, true, !(X_PA_DashboardContent.GOALDISPLAY_Chart.equals(goalDisplay)), X_PA_DashboardContent.GOALDISPLAY_Chart.equals(goalDisplay));
                content.appendChild(graph);
                panelEmpty = false;
            }
            // ZUL file url
            String url = rs.getString(X_PA_DashboardContent.COLUMNNAME_ZulFilePath);
            if (url != null) {
                try {
                    Component component = Executions.createComponents(url, content, null);
                    if (component != null) {
                        if (component instanceof DashboardPanel) {
                            DashboardPanel dashboardPanel = (DashboardPanel) component;
                            if (!dashboardPanel.getChildren().isEmpty()) {
                                content.appendChild(dashboardPanel);
                                dashboardRunnable.add(dashboardPanel);
                                panelEmpty = false;
                            }
                        } else {
                            content.appendChild(component);
                            panelEmpty = false;
                        }
                    }
                } catch (Exception e) {
                    logger.log(Level.WARNING, "Failed to create components. zul=" + url, e);
                }
            }
            if (panelEmpty)
                panel.detach();
        }
    } catch (Exception e) {
        logger.log(Level.WARNING, "Failed to create dashboard content", e);
    } finally {
    }
    //
    //register as 0
    registerWindow(homeTab);
    if (!portalLayout.getDesktop().isServerPushEnabled())
        portalLayout.getDesktop().enableServerPush(true);
    dashboardRunnable.refreshDashboard();
    dashboardThread = new Thread(dashboardRunnable, "UpdateInfo");
    dashboardThread.setDaemon(true);
    dashboardThread.start();
}
Also used : MDashboardContent(org.compiere.model.MDashboardContent) WPerformanceDetail(org.adempiere.webui.apps.graph.WPerformanceDetail) Portallayout(org.zkoss.zkmax.zul.Portallayout) URL(java.net.URL) DashboardPanel(org.adempiere.webui.dashboard.DashboardPanel) I_AD_Menu(org.compiere.model.I_AD_Menu) ResultSet(java.sql.ResultSet) Toolbarbutton(org.zkoss.zul.Toolbarbutton) EventListener(org.zkoss.zk.ui.event.EventListener) Component(org.zkoss.zk.ui.Component) Tabpanel(org.adempiere.webui.component.Tabpanel) MGoal(org.compiere.model.MGoal) ToolBarButton(org.adempiere.webui.component.ToolBarButton) InputStreamReader(java.io.InputStreamReader) WGraph(org.adempiere.webui.apps.graph.WGraph) Html(org.zkoss.zul.Html) PreparedStatement(java.sql.PreparedStatement) Panelchildren(org.zkoss.zul.Panelchildren) IOException(java.io.IOException) IOException(java.io.IOException) SidePanel(org.adempiere.webui.panel.SidePanel) HeaderPanel(org.adempiere.webui.panel.HeaderPanel) DashboardPanel(org.adempiere.webui.dashboard.DashboardPanel) Panel(org.zkoss.zul.Panel) Portalchildren(org.zkoss.zkmax.zul.Portalchildren) BufferedReader(java.io.BufferedReader) Event(org.zkoss.zk.ui.event.Event) OpenEvent(org.zkoss.zk.ui.event.OpenEvent)

Aggregations

Tabpanel (org.adempiere.webui.component.Tabpanel)23 Tab (org.adempiere.webui.component.Tab)10 ToolBarButton (org.adempiere.webui.component.ToolBarButton)7 Vbox (org.zkoss.zul.Vbox)7 Tabpanels (org.adempiere.webui.component.Tabpanels)6 Tabs (org.adempiere.webui.component.Tabs)6 Component (org.zkoss.zk.ui.Component)6 Div (org.zkoss.zul.Div)6 Tabbox (org.adempiere.webui.component.Tabbox)5 Hbox (org.zkoss.zul.Hbox)5 IOException (java.io.IOException)4 DesktopTabpanel (org.adempiere.webui.component.DesktopTabpanel)4 Row (org.adempiere.webui.component.Row)4 Rows (org.adempiere.webui.component.Rows)4 Event (org.zkoss.zk.ui.event.Event)4 Html (org.zkoss.zul.Html)4 BufferedReader (java.io.BufferedReader)3 InputStreamReader (java.io.InputStreamReader)3 URL (java.net.URL)3 PreparedStatement (java.sql.PreparedStatement)3