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);
}
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);
}
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));
}
}
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);
}
}
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);
}
}
Aggregations