Search in sources :

Example 1 with Radio

use of org.zkoss.zul.Radio in project spatial-portal by AtlasOfLivingAustralia.

the class AreaMapPolygon method loadLayerSelection.

public void loadLayerSelection() {
    try {
        Radio rSelectedLayer = (Radio) getFellowIfAny("rSelectedLayer");
        List<MapLayer> layers = getMapComposer().getContextualLayers();
        if (!layers.isEmpty()) {
            for (int i = 0; i < layers.size(); i++) {
                MapLayer lyr = layers.get(i);
                Radio rAr = new Radio(lyr.getDisplayName());
                rAr.setId(lyr.getDisplayName().replaceAll(" ", ""));
                rAr.setValue(lyr.getDisplayName());
                rAr.setParent(rgPolygonLayers);
                if (i == 0) {
                    rAr.setSelected(true);
                }
                rgPolygonLayers.insertBefore(rAr, rSelectedLayer);
            }
            rSelectedLayer.setSelected(true);
        }
    } catch (Exception e) {
    }
}
Also used : MapLayer(au.org.emii.portal.menu.MapLayer) Radio(org.zkoss.zul.Radio)

Example 2 with Radio

use of org.zkoss.zul.Radio in project spatial-portal by AtlasOfLivingAustralia.

the class AddSpeciesInArea method loadAreaLayers.

public void loadAreaLayers() {
    try {
        List<MapLayer> layers = null;
        Map m = args;
        if (m != null) {
            for (Object o : m.entrySet()) {
                if (((Map.Entry) o).getKey() instanceof String && ((Map.Entry) o).getKey().equals(StringConstants.POLYGON_LAYERS)) {
                    layers = (List<MapLayer>) ((Map.Entry) o).getValue();
                }
            }
        }
        for (int i = 0; layers != null && i < layers.size(); i++) {
            MapLayer lyr = layers.get(i);
            Radio rAr = new Radio(lyr.getDisplayName());
            rAr.setId(lyr.getDisplayName().replaceAll(" ", "") + i);
            rAr.setValue(lyr.getName());
            rAr.setParent(rgArea);
            rgArea.insertBefore(rAr, rAreaCurrent);
        }
        if (!allSpecies) {
            //set as default in the zul
            rAreaSelected = rAreaWorld;
        } else {
            rAreaWorld.setVisible(false);
            rAreaAustralia.setVisible(false);
            for (int i = 0; i < rgArea.getItemCount(); i++) {
                if (rgArea.getItemAtIndex(i).isVisible()) {
                    rAreaSelected = rgArea.getItemAtIndex(i);
                    rgArea.setSelectedItem(rAreaSelected);
                    Clients.evalJavaScript("jq('#" + rAreaSelected.getUuid() + "-real').attr('checked', true);");
                    break;
                }
            }
        }
    } catch (Exception e) {
        LOGGER.error(StringConstants.UNABLE_TO_LOAD_ACTIVE_AREA_LAYERS, e);
    }
}
Also used : MapLayer(au.org.emii.portal.menu.MapLayer) Radio(org.zkoss.zul.Radio) HashMap(java.util.HashMap) Map(java.util.Map)

Example 3 with Radio

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

the class WBOMDrop method onEvent.

//	addDisplay
/**************************************************************************
	 *	Action Listener
	 *  @param e event
	 */
public void onEvent(Event e) throws Exception {
    log.config(e.getName());
    Object source = e.getTarget();
    //	Toggle Qty Enabled
    if (source instanceof Checkbox || source instanceof Radio) {
        cmd_selection(source);
        //	need to de-select the others in group	
        if (source instanceof Radio) {
            //	find Button Group
            Iterator<Radiogroup> it = m_buttonGroups.values().iterator();
            while (it.hasNext()) {
                Radiogroup group = it.next();
                Enumeration en = (Enumeration) group.getChildren();
                while (en.hasMoreElements()) {
                    //	We found the group
                    if (source == en.nextElement()) {
                        Enumeration info = (Enumeration) group.getChildren();
                        while (info.hasMoreElements()) {
                            Object infoObj = info.nextElement();
                            if (source != infoObj)
                                cmd_selection(infoObj);
                        }
                    }
                }
            }
        }
    } else //	Product / Qty
    if (source == productField || source == productQty) {
        m_qty = productQty.getValue();
        ListItem listitem = productField.getSelectedItem();
        KeyNamePair pp = null;
        if (listitem != null)
            pp = listitem.toKeyNamePair();
        m_product = MProduct.get(Env.getCtx(), pp.getKey());
        createMainPanel();
    //sizeIt();
    } else //	Order
    if (source == orderField) {
        ListItem listitem = orderField.getSelectedItem();
        KeyNamePair pp = null;
        if (listitem != null)
            pp = listitem.toKeyNamePair();
        boolean valid = (pp != null && pp.getKey() > 0);
        if (invoiceField != null)
            invoiceField.setEnabled(!valid);
        if (projectField != null)
            projectField.setEnabled(!valid);
    } else //	Invoice
    if (source == invoiceField) {
        ListItem listitem = invoiceField.getSelectedItem();
        KeyNamePair pp = null;
        if (listitem != null)
            pp = listitem.toKeyNamePair();
        boolean valid = (pp != null && pp.getKey() > 0);
        if (orderField != null)
            orderField.setEnabled(!valid);
        if (projectField != null)
            projectField.setEnabled(!valid);
    } else //	Project
    if (source == projectField) {
        ListItem listitem = projectField.getSelectedItem();
        KeyNamePair pp = null;
        if (listitem != null)
            pp = listitem.toKeyNamePair();
        boolean valid = (pp != null && pp.getKey() > 0);
        //
        if (orderField != null)
            orderField.setEnabled(!valid);
        if (invoiceField != null)
            invoiceField.setEnabled(!valid);
    } else //	OK
    if (confirmPanel.getButton("Ok").equals(e.getTarget())) {
        if (cmd_save())
            SessionManager.getAppDesktop().closeActiveWindow();
    } else if (confirmPanel.getButton("Cancel").equals(e.getTarget()))
        SessionManager.getAppDesktop().closeActiveWindow();
    //	Enable OK
    boolean OK = m_product != null;
    if (OK) {
        KeyNamePair pp = null;
        if (orderField != null) {
            ListItem listitem = orderField.getSelectedItem();
            if (listitem != null)
                pp = listitem.toKeyNamePair();
        }
        if ((pp == null || pp.getKey() <= 0) && invoiceField != null) {
            ListItem listitem = invoiceField.getSelectedItem();
            if (listitem != null)
                pp = listitem.toKeyNamePair();
        }
        if ((pp == null || pp.getKey() <= 0) && projectField != null) {
            ListItem listitem = projectField.getSelectedItem();
            if (listitem != null)
                pp = listitem.toKeyNamePair();
        }
        OK = (pp != null && pp.getKey() > 0);
    }
    confirmPanel.setEnabled("Ok", OK);
}
Also used : Enumeration(java.util.Enumeration) Checkbox(org.adempiere.webui.component.Checkbox) Radiogroup(org.zkoss.zul.Radiogroup) Radio(org.zkoss.zul.Radio) ListItem(org.adempiere.webui.component.ListItem) KeyNamePair(org.compiere.util.KeyNamePair)

Example 4 with Radio

use of org.zkoss.zul.Radio in project spatial-portal by AtlasOfLivingAustralia.

the class MapOptions method afterCompose.

@Override
public void afterCompose() {
    super.afterCompose();
    String baseMap = getMapComposer().getBaseMap();
    for (Radio r : rgBaseMap.getItems()) {
        if (r.getValue().equals(baseMap)) {
            rgBaseMap.setSelectedItem(r);
            break;
        }
    }
}
Also used : Radio(org.zkoss.zul.Radio)

Example 5 with Radio

use of org.zkoss.zul.Radio in project spatial-portal by AtlasOfLivingAustralia.

the class AreaMapPolygon method onCheck$rgPolygonLayers.

public void onCheck$rgPolygonLayers(Event event) {
    Radio selectedItem = rgPolygonLayers.getSelectedItem();
    //Add and remove layer to set as top layer
    String layerName = selectedItem.getValue();
    MapComposer mc = getMapComposer();
    MapLayer ml = mc.getMapLayer(layerName);
    mc.removeLayer(layerName);
    mc.activateLayer(ml, true);
}
Also used : MapComposer(au.org.emii.portal.composer.MapComposer) MapLayer(au.org.emii.portal.menu.MapLayer) Radio(org.zkoss.zul.Radio)

Aggregations

Radio (org.zkoss.zul.Radio)6 MapLayer (au.org.emii.portal.menu.MapLayer)3 Checkbox (org.adempiere.webui.component.Checkbox)2 Radiogroup (org.zkoss.zul.Radiogroup)2 MapComposer (au.org.emii.portal.composer.MapComposer)1 Enumeration (java.util.Enumeration)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 Label (org.adempiere.webui.component.Label)1 ListItem (org.adempiere.webui.component.ListItem)1 KeyNamePair (org.compiere.util.KeyNamePair)1 HtmlBasedComponent (org.zkoss.zk.ui.HtmlBasedComponent)1 Decimalbox (org.zkoss.zul.Decimalbox)1 Hbox (org.zkoss.zul.Hbox)1