Package org.apache.cocoon.forms.formmodel

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


    protected class WidgetLabelHandler extends Handler {
        public Handler process() throws SAXException {
            switch (event) {
            case EVENT_START_ELEMENT:
                widgetPath = getWidgetId(input.attrs);
                Widget widget = getWidget(widgetPath);
                widget.generateLabel(getContentHandler());
                widget = null;
                return this;
            case EVENT_ELEMENT:
                return nullHandler;
            case EVENT_END_ELEMENT:
View Full Code Here


    ArrayList copletDatas = new ArrayList();
       
    int size = r.getSize();
    for(int i = 0; i < size; i++) {
      RepeaterRow row = r.getRow(i);
      Widget widget = row.getChild("selected");
      Boolean val = (Boolean) widget.getValue();
      if(val.booleanValue()) {
        coplets.add(row.getChild("coplet").getValue());
      }
    }
    for(Iterator it = lets.iterator(); it.hasNext();) {
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_lookupWidget(String id) {
        Widget sub = null;
        sub = delegate.lookupWidget(id);
        return wrap(sub);
    }
View Full Code Here

        this.convertor = convertor;
        this.convertorLocale = convertorLocale;
    }

    public void doLoad(Widget frmModel, JXPathContext jctx) throws BindingException {
        Widget widget = selectWidget(frmModel,this.multiValueId);
        if (widget == null) {
            throw new BindingException("The widget with the ID [" + this.multiValueId
                    + "] referenced in the binding does not exist in the form definition.");
        }

        // Move to multi value context
        Pointer ptr = jctx.getPointer(this.multiValuePath);
        if (ptr.getNode() != null) {
            // There are some nodes to load from

            JXPathContext multiValueContext = jctx.getRelativeContext(ptr);
            // build a jxpath iterator for pointers
            Iterator rowPointers = multiValueContext.iterate(this.rowPath);

            LinkedList list = new LinkedList();

            while (rowPointers.hasNext()) {
                Object value = rowPointers.next();

                if (value != null && convertor != null) {
                    if (value instanceof String) {
                        ConversionResult conversionResult = convertor.convertFromString((String)value, convertorLocale, null);
                        if (conversionResult.isSuccessful())
                            value = conversionResult.getResult();
                        else
                            value = null;
                    } else {
                        getLogger().warn("Convertor ignored on backend-value which isn't of type String.");
                    }
                }

                list.add(value);
            }

            widget.setValue(list.toArray());
        }

        if (getLogger().isDebugEnabled())
            getLogger().debug("done loading values " + toString());
    }
View Full Code Here

        if (getLogger().isDebugEnabled())
            getLogger().debug("done loading values " + toString());
    }

    public void doSave(Widget frmModel, JXPathContext jctx) throws BindingException {
        Widget widget = selectWidget(frmModel,this.multiValueId);
        Object[] values = (Object[])widget.getValue();

        JXPathContext multiValueContext = jctx.getRelativeContext(jctx.createPath(this.multiValuePath));
        // Delete all that is already present
        multiValueContext.removeAll(this.rowPath);
View Full Code Here

        this.saveScript = saveScript;
    }

    public void doLoad(Widget frmModel, JXPathContext jctx) {
        if (this.loadScript != null) {
            Widget widget = selectWidget(frmModel,this.id);
   
            // Move to widget context
            Pointer pointer = jctx.getPointer(this.path);
   
            // FIXME: remove this ugly hack and get the request from the
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.