Search in sources :

Example 31 with Component

use of org.zkoss.zk.ui.Component in project adempiere by adempiere.

the class InfoBPartnerPanel method onEvent.

public void onEvent(Event e) {
    if (!p_loadedOK)
        return;
    Component component = e.getTarget();
    if (component != null) {
        if (// a tab in the subordinate panel is selected
        component instanceof Tab) {
            refresh();
            return;
        }
    }
    super.onEvent(e);
}
Also used : Tab(org.adempiere.webui.component.Tab) Component(org.zkoss.zk.ui.Component)

Example 32 with Component

use of org.zkoss.zk.ui.Component 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)

Example 33 with Component

use of org.zkoss.zk.ui.Component in project adempiere by adempiere.

the class ProcessPanel method process.

/**
	 * Save Parameters and process it
	 */
public void process() {
    if (saveParameters() == null) {
        showBusyDialog();
        Clients.response(new AuEcho((Component) parent.getParentContainer(), "runProcess", null));
    }
}
Also used : AuEcho(org.zkoss.zk.au.out.AuEcho) Component(org.zkoss.zk.ui.Component)

Example 34 with Component

use of org.zkoss.zk.ui.Component in project adempiere by adempiere.

the class WWFActivity method onEvent.

public void onEvent(Event event) throws Exception {
    Component comp = event.getTarget();
    String eventName = event.getName();
    if (eventName.equals(Events.ON_CLICK)) {
        if (comp == bZoom)
            cmd_zoom();
        else if (comp == bOK) {
            Clients.showBusy(Msg.getMsg(Env.getCtx(), "Processing"));
            Events.echoEvent("onOK", this, null);
        } else if (comp == fAnswerButton)
            cmd_button();
    } else if (Events.ON_SELECT.equals(eventName) && comp == listbox) {
        m_index = listbox.getSelectedIndex();
        if (m_index >= 0)
            display(m_index);
    }
}
Also used : Component(org.zkoss.zk.ui.Component)

Example 35 with Component

use of org.zkoss.zk.ui.Component in project spatial-portal by AtlasOfLivingAustralia.

the class MapComposer method updateLayerControls.

public void updateLayerControls() {
    adjustActiveLayersList();
    //remove any scatterplot legend
    Component c = getFellowIfAny("scatterplotlayerlegend");
    if (c != null) {
        c.detach();
    }
    //remove children
    for (int i = layerControls.getChildren().size() - 1; i >= 0; i--) {
        layerControls.getChildren().get(i).detach();
    }
    MapLayer selectedLayer = this.getActiveLayersSelection(false);
    if (selectedLayer == null) {
        if (activeLayersList.getItemCount() > 0) {
            activeLayersList.setSelectedIndex(0);
            selectedLayer = (MapLayer) activeLayersList.getModel().getElementAt(0);
        } else {
            return;
        }
    }
    lblSelectedLayer.setValue(selectedLayer.getDisplayName());
    String page;
    Window window;
    if (selectedLayer.getType() == LayerUtilitiesImpl.SCATTERPLOT) {
        page = "WEB-INF/zul/legend/LayerLegendScatterplot.zul";
    } else if (selectedLayer.getType() == LayerUtilitiesImpl.MAP) {
        page = "WEB-INF/zul/legend/MapOptions.zul";
    } else {
        Map params = new HashMap();
        llc2MapLayer = selectedLayer;
        params.put("map_layer", llc2MapLayer);
        window = (Window) Executions.createComponents("WEB-INF/zul/legend/LayerLegendGeneral.zul", layerControls, params);
        try {
            window.doEmbedded();
        } catch (Exception e) {
            LOGGER.error("error setting up layer legend", e);
        }
        return;
    }
    window = (Window) Executions.createComponents(page, layerControls, null);
    try {
        if (window instanceof HasMapLayer) {
            ((HasMapLayer) window).setMapLayer(selectedLayer);
        }
    } catch (Exception e) {
        LOGGER.error("failed to set map layer to window: " + (window != null ? window.getId() : "window is null"), e);
    }
    try {
        window.doEmbedded();
    } catch (Exception e) {
        LOGGER.error("error setting layer legend", e);
    }
}
Also used : Window(org.zkoss.zul.Window) HasMapLayer(au.org.emii.portal.menu.HasMapLayer) MapLayer(au.org.emii.portal.menu.MapLayer) HasMapLayer(au.org.emii.portal.menu.HasMapLayer) SpeciesAutoCompleteComponent(au.org.ala.spatial.composer.species.SpeciesAutoCompleteComponent) Component(org.zkoss.zk.ui.Component) RemoteMap(au.org.emii.portal.util.RemoteMap) ParseException(org.json.simple.parser.ParseException)

Aggregations

Component (org.zkoss.zk.ui.Component)70 IOException (java.io.IOException)8 HtmlBasedComponent (org.zkoss.zk.ui.HtmlBasedComponent)8 Checkbox (org.adempiere.webui.component.Checkbox)7 ToolBarButton (org.adempiere.webui.component.ToolBarButton)7 Div (org.zkoss.zul.Div)7 Listitem (org.zkoss.zul.Listitem)7 MapLayer (au.org.emii.portal.menu.MapLayer)6 Button (org.adempiere.webui.component.Button)6 Tabpanel (org.adempiere.webui.component.Tabpanel)6 WEditor (org.adempiere.webui.editor.WEditor)6 ParseException (org.json.simple.parser.ParseException)6 Event (org.zkoss.zk.ui.event.Event)6 MapComposer (au.org.emii.portal.composer.MapComposer)5 PreparedStatement (java.sql.PreparedStatement)5 ResultSet (java.sql.ResultSet)5 DashboardPanel (org.adempiere.webui.dashboard.DashboardPanel)5 HeaderPanel (org.adempiere.webui.panel.HeaderPanel)5 SidePanel (org.adempiere.webui.panel.SidePanel)5 UiException (org.zkoss.zk.ui.UiException)5