Package org.apache.cocoon.woody.formmodel

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


                throw new SAXException("WoodyTemplateTransformer: the element \"repeater-widget\" can only be used for repeater widgets.");
        } else if (inWidgetElement) {
            xmlCompiler.startElement(namespaceURI, localName, qName, attributes);
        } else if (namespaceURI.equals(Constants.WT_NS)) {
            if (localName.equals("widget-label")) {
                Widget widget = getWidget(attributes);
                widget.generateLabel(contentHandler);
            } else if (localName.equals("repeater-widget-label")) {
                Widget widget = getWidget(attributes);
                if (!(widget instanceof Repeater))
                    throw new SAXException("WoodyTemplateTransformer: 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("WoodyTemplateTransformer: the element \"repeater-widget-label\" requires a \"widget-id\" attribute.");
                ((Repeater)widget).generateWidgetLabel(widgetId, contentHandler);
            } else if (localName.equals("repeater-size")) {
                Widget widget = getWidget(attributes);
                if (!(widget instanceof Repeater))
                    throw new SAXException("WoodyTemplateTransformer: the element \"repeater-size\" can only be used for repeater widgets.");
                contentHandler.startPrefixMapping(Constants.WI_PREFIX, Constants.WI_NS);
                ((Repeater)widget).generateSize(contentHandler);
                contentHandler.endPrefixMapping(Constants.WI_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("WoodyTemplateTransformer: missing id attribute on a woody element.");
        Widget widget = contextWidget.getWidget(widgetId);
        if (widget == null)
            throw new SAXException("WoodyTemplateTransformer: widget with id \"" + widgetId + "\" does not exist in the container " + contextWidget.getFullyQualifiedId());
        return widget;
    }
View Full Code Here

    /**
     * Actively performs the binding from the ObjectModel wrapped in a jxpath
     * context to the Woody-form-widget specified in this object.
     */
    public void doLoad(Widget frmModel, JXPathContext jxpc) throws BindingException {
        Widget widget = frmModel.getWidget(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.");
        }

        Object value = jxpc.getValue(this.xpath);
        if (value != null && convertor != null) {
            if (value instanceof String) {
                value = convertor.convertFromString((String)value, convertorLocale, null);
            } else {
                getLogger().warn("Convertor ignored on backend-value which isn't of type String.");
            }
        }

        widget.setValue(value);
        if (getLogger().isDebugEnabled()) {
            getLogger().debug("Done loading " + toString() + " -- value= " + value);
        }
    }
View Full Code Here

    private List getUniqueRowValues(Repeater.RepeaterRow thisRow) {
        List values = new ArrayList();
        Iterator iter = this.uniqueRowBinding.iterator();
        while (iter.hasNext()) {
            UniqueFieldJXPathBinding key = (UniqueFieldJXPathBinding)iter.next();
            Widget rowIdWidget = thisRow.getWidget(key.getFieldId());
            Object rowIdValue = rowIdWidget.getValue();
            values.add(rowIdValue);
        }
        return values;
    }
View Full Code Here

    }

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

        Object result = super.get(id, start);
        if (result != NOT_FOUND) {
            return result;
        }
        if (delegate != null && !(delegate instanceof Repeater)) {
            Widget sub = delegate.getWidget(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_getWidget(String id) {
        Widget sub = delegate.getWidget(id);
        return wrap(sub);
    }
View Full Code Here

        }
        return classBinding;
    }

    protected Widget getWidget(Widget widget, String id) {
        Widget childWidget = widget.getWidget(id);
        if (childWidget != null) {
            return childWidget;
        } else {
            throw new RuntimeException(getClass().getName() + ": Widget \"" +
                    id + "\" does not exist in container \"" +
View Full Code Here

TOP

Related Classes of org.apache.cocoon.woody.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.