Package org.apache.cocoon.forms.formmodel

Examples of org.apache.cocoon.forms.formmodel.Widget


     * Adds a widget not contained in a repeater.
     * @param context
     * @param path
     */
    private void addSimpleWidget(Widget context, String path) {
        Widget widget = context.lookupWidget(path);
        if (widget == null) throw new IllegalArgumentException("Cannot find a widget with path " + path + " relative to widget " + context.getName());
        if (this.noRepeaterWidgets == null) this.noRepeaterWidgets = new ArrayList();
        this.noRepeaterWidgets.add(widget);
        newAdditions.add(widget);       
    }
View Full Code Here


    //---------------------------------------------------------------------------------------------
    // Widget management
    //---------------------------------------------------------------------------------------------

    public Widget getWidgetForPath(TreePath path) {
        Widget result = (Widget)this.pathWidgets.get(path);
        if (result == null && !this.pathWidgets.containsKey(path)) {
            result = createWidgetForPath(path);
            if (result != null) {
                result.setAttribute("TreePath", path);
            }
            this.pathWidgets.put(path, result);
        }

        return result;
View Full Code Here

    protected Widget selectWidget(Widget parent, String id) {
        if (id == null) {
            return parent;
        }

        Widget childWidget = parent.lookupWidget(id);
        if (childWidget == null) {
            String containerId = parent.getRequestParameterName();
            if (containerId == null || "".equals(containerId)) {
                containerId = "top-level form-widget";
            } else {
View Full Code Here

     */
    public Object put(Object key, Object value) {
        String name = (String)key;
        if (lowerCase) name = name.toLowerCase();
       
        Widget w = container.getChild(name);
        if (w != null) {
            return setValue(w, value);
        } else {
            throw new UnsupportedOperationException(container + " has no child named '" + key + "'");
        }
View Full Code Here

        Iterator iter = map.entrySet().iterator();
        while(iter.hasNext()) {
            Map.Entry entry = (Map.Entry)iter.next();
            String name = (String)entry.getKey();
            if (lowerCase) name = name.toLowerCase();
            Widget w = container.getChild(name);
            if (w != null) {
                setValue(w, entry.getValue());
            }
        }
    }
View Full Code Here

    }

    public Object get(Object key) {
        String name = (String)key;
        if (lowerCase) name = name.toLowerCase();
        Widget w = container.getChild(name);
        return w == null ? null : asValueOrMap(w);
    }
View Full Code Here

    /**
     * Actively performs the binding from the ObjectModel wrapped in a jxpath
     * context to the CForms-form-widget specified in this object.
     */
    public void doLoad(Widget frmModel, JXPathContext jxpc) throws BindingException {
        Widget widget = selectWidget(frmModel, this.fieldId);
        if (widget == null) {
            throw new BindingException("The widget with the ID [" + this.fieldId
                    + "] referenced in the binding does not exist in the form definition.");
        }
        if (!(widget instanceof Tree)) throw new BindingException("Widget " + this.fieldId + " is not a Tree!");
View Full Code Here

        if (this.currentWidget == null) {
            // The name of the root element is ignored
            this.currentWidget = this.widget;

        } else if (this.currentWidget instanceof ContainerWidget) {
            Widget child = ((ContainerWidget)this.currentWidget).getChild(loc);
            if (child == null) {
                throw new SAXException("There is no widget with id: " + loc +
                                       " as child to: " + this.currentWidget.getId());
            }
            this.currentWidget = child;
View Full Code Here

            if (childBindings != null) {
                int size = childBindings.length;
                identity = new ArrayList(size);
                for (int i = 0; i < size; i++) {
                    String fieldId = ((ValueJXPathBinding) childBindings[i]).getFieldId();
                    Widget widget = row.lookupWidget(fieldId);
                    Object value = widget.getValue();
                    identity.add(value);
                }
            }
        }
        return identity;
View Full Code Here

    //---------------------------------------------------------------------------------------------
    // Widget management
    //---------------------------------------------------------------------------------------------

    public Widget getWidgetForPath(TreePath path) {
        Widget result = (Widget)this.pathWidgets.get(path);
        if (result == null && !this.pathWidgets.containsKey(path)) {
            result = createWidgetForPath(path);
            if (result != null) {
                result.setAttribute("TreePath", path);
            }
            this.pathWidgets.put(path, result);
        }

        return result;
View Full Code Here

TOP

Related Classes of org.apache.cocoon.forms.formmodel.Widget

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.