Package org.apache.cocoon.forms.formmodel

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


                        repeater.addRow();
                    }
                }
            }
        } else if (delegate != null) {
            Widget sub = delegate.lookupWidget(id);
            if (sub instanceof Field) {
                Field field = (Field)sub;
                value = unwrap(value);
                if (value instanceof Double) {
                    // make cforms accept a JS Number
View Full Code Here


                if (repeaterWidget && !(widget instanceof Repeater)) {
                    throw new SAXException("FormsTemplateTransformer: the element \"repeater-widget\" can only be used for repeater widgets.");
                }
            } else if (localName.equals(WIDGET_LABEL)) {
                checkContextWidgetAvailable(qName);
                Widget widget = getWidget(attributes);
                widget.generateLabel(contentHandler);
            } else if (localName.equals(REPEATER_WIDGET_LABEL)) {
                checkContextWidgetAvailable(qName);
                Widget widget = getWidget(attributes);
                if (!(widget instanceof Repeater)) {
                    throw new SAXException("FormsTemplateTransformer: the element \"repeater-widget-label\" can only be used for repeater widgets.");
                }
                String widgetId = attributes.getValue("widget-id");
                if (widgetId == null || widgetId.equals("")) {
                    throw new SAXException("FormsTemplateTransformer: the element \"repeater-widget-label\" requires a \"widget-id\" attribute.");
                }
                ((Repeater)widget).generateWidgetLabel(widgetId, contentHandler);
            } else if (localName.equals(REPEATER_SIZE)) {
                checkContextWidgetAvailable(qName);
                Widget widget = getWidget(attributes);
                if (!(widget instanceof Repeater))
                    throw new SAXException("FormsTemplateTransformer: the element \"repeater-size\" can only be used for repeater widgets.");
                contentHandler.startPrefixMapping(Constants.INSTANCE_PREFIX, Constants.INSTANCE_NS);
                ((Repeater)widget).generateSize(contentHandler);
                contentHandler.endPrefixMapping(Constants.INSTANCE_PREFIX);
View Full Code Here

    protected Widget getWidget(Attributes attributes) throws SAXException {
        String widgetId = attributes.getValue("id");
        if (widgetId == null || widgetId.equals("")) {
            throw new SAXException("FormsTemplateTransformer: missing id attribute on a Cocoon Forms element.");
        }
        Widget widget = ((ContainerWidget)contextWidget).getChild(widgetId);
        if (widget == null) {
            throw new SAXException("FormsTemplateTransformer: widget with id \"" + widgetId + "\" does not exist in the container " + contextWidget.getRequestParameterName());
        }
        return widget;
    }
View Full Code Here

        }
        return widgetId;
    }

    protected Widget getWidget(String widgetPath) throws SAXException {
        Widget widget = ((ContainerWidget)contextWidget).lookupWidget(widgetPath);
        if (widget == null) {
            if (contextWidget.getRequestParameterName().equals("")) {
                throwSAXException("No widget exists at the path \"" + widgetPath + "\", relative to the form container.");
            } else {
                throwSAXException("No widget exists at the path \"" + widgetPath + "\", relative to the container \"" +
View Full Code Here

        }
    }

    public boolean has(String id, Scriptable start) {
        if (delegate != null && delegate instanceof ContainerWidget) {
            Widget sub = ((ContainerWidget)delegate).getChild(id);
            if (sub != null) {
                return true;
            }
        }
        return super.has(id, start);
View Full Code Here

        Object result = super.get(id, start);
        if (result != NOT_FOUND) {
            return result;
        }
        if (delegate != null && delegate instanceof ContainerWidget) {
            Widget sub = ((ContainerWidget)delegate).getChild(id);
            if (sub != null) {
                return wrap(sub);
            }
        }
        return NOT_FOUND;
View Full Code Here

            List list = new LinkedList();
            for (int i = 0; i < result.length; i++) {
                list.add(result[i]);
            }
            while (iter.hasNext()) {
                Widget widget = (Widget)iter.next();
                list.add(widget.getId());
            }
            result = list.toArray();
        }
        return result;
    }
View Full Code Here

        }
        return result;
    }

    private void deleteRow(Repeater repeater, int index) {
        Widget row = repeater.getRow(index);
        ScriptableWidget s = wrap(row);
        s.notifyRemoveRow();
        formWidget.deleteWrapper(row);
        repeater.removeRow(index);
    }
View Full Code Here

        }
        return false;
    }

    public ScriptableWidget jsFunction_getChild(String id) {
        Widget sub = null;
        if (delegate instanceof ContainerWidget)
            sub = ((ContainerWidget)delegate).getChild(id);
        return wrap(sub);
    }
View Full Code Here

            sub = ((ContainerWidget)delegate).getChild(id);
        return wrap(sub);
    }

    public ScriptableWidget jsFunction_lookupWidget(String id) {
        Widget sub = null;
        sub = delegate.lookupWidget(id);
        return wrap(sub);
    }
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.