public static String getChildrenAttributeValue(MAGContainerInterface comp, String fieldname) { int pos = 0; if ((pos = fieldname.indexOf('.')) > 0) { if (fieldname.startsWith("_content[")) { int index = Integer.parseInt( fieldname.substring(fieldname.indexOf('[') + 1, fieldname.indexOf(']'))); if (index >= 0 && index < comp.childrenNum()) { return comp.getChild(index).getAttributeValue(fieldname.substring(pos + 1)); } else { return null; } } else { String id = fieldname.substring(0, pos); MAGComponentInterface child = comp.getChild(id); if (child != null) { return child.getAttributeValue(fieldname.substring(pos + 1)); } else { return null; } } } else { return null; } }
public void updateField(View f) { for (int i = 0; _children != null && i < _children.size(); i++) { MAGComponentInterface comp = getChild(i); if (comp.getField() != null && comp.visible()) { comp.updateField(comp.getField()); } } }
public void releaseResources() { while (childrenNum() > 0) { MAGComponentInterface comp = getChild(childrenNum() - 1); comp.releaseResources(); removeChild(comp); } super.releaseResources(); }
public MAGComponentInterface[] getNamedChildren() { if (_childrenhash == null) { scanNamedChildren(); } MAGComponentInterface[] siblings = new MAGComponentInterface[_childrenhash.size()]; int sibling_idx = 0; for (int i = 0; i < _children.size(); i++) { MAGComponentInterface tmp = getChild(i); if (tmp.id() != null && tmp.id().length() > 0) { if (tmp == _childrenhash.get(tmp.id())) { siblings[sibling_idx] = tmp; sibling_idx++; } } } return siblings; }
public void removeChild(MAGComponentInterface child) { if (child.id() != null && child.id().length() > 0 && _childrenhash != null) { _childrenhash.remove(child.id()); } _children.removeElement(child); }