Package org.apache.cocoon.forms.formmodel

Examples of org.apache.cocoon.forms.formmodel.Repeater$RepeaterRow


            }
        }
        if (!(wdg instanceof Repeater)) {
            throw new IllegalArgumentException("The widget with path " + reppath + " relative to widget " + context.getName() + " is not a repeater!");
        }
        Repeater repeater = (Repeater)wdg;
        if (context instanceof Repeater.RepeaterRow) {
            // Add this repeater to the repeater widgets
            addRepeaterWidget((Repeater) context.getParent(), repeater);
        }
       
        addRepeaterPath(repeater, childpath);
        if (childpath.indexOf('*') != -1) {
            for (int i = 0; i < repeater.getSize(); i++) {
                Repeater.RepeaterRow row = repeater.getRow(i);
                recurseRepeaters(row, childpath, false);
            }
        } else {
            for (int i = 0; i < repeater.getSize(); i++) {
                Repeater.RepeaterRow row = repeater.getRow(i);
              Widget okwdg = row.lookupWidget(childpath);
              if (okwdg != null) {
                  addRepeaterWidget(repeater, okwdg);
              }
            }
View Full Code Here


    public Collection getWidgets() {
        List list = new ArrayList();
        if (this.noRepeaterWidgets != null) list.addAll(this.noRepeaterWidgets);
        if (this.repeaterWidgets != null) {
          for (Iterator iter = this.repeaterWidgets.keySet().iterator(); iter.hasNext();) {
              Repeater repeater = (Repeater) iter.next();
              list.addAll((Collection)this.repeaterWidgets.get(repeater));
          }
        }
        return list;
    }
View Full Code Here

            // they are recieved, the position attribute is not used
            if (!ITEM.equals(loc)) {
                throw new SAXException("The element: " + loc +
                                       " is not allowed as a direct child of a Repeater");
            }
            Repeater repeater = (Repeater) currentWidget;
            this.currentWidget = repeater.addRow();

        } else if (this.currentWidget instanceof MultiValueField) {
            this.isMultiValueItem = true;
            if (!ITEM.equals(loc)) {
                throw new SAXException("The element: " + loc +
View Full Code Here

        } else if (widget instanceof ContainerWidget) {
            Iterator children = ((ContainerWidget)widget).getChildren();
            while (children.hasNext())
                generateSAX((Widget)children.next());
        } else if (widget instanceof Repeater) {
            Repeater repeater = (Repeater)widget;
            for (int i = 0; i < repeater.getSize(); i++)
                generateSAX(repeater.getRow(i), ITEM);
        }
        end(id);
    }
View Full Code Here

     * over to the actual binding-children.
     */
    public void doLoad(Widget frmModel, JXPathContext jxpc)
    throws BindingException {
        // Find the repeater
        Repeater repeater = (Repeater) selectWidget(frmModel, this.repeaterId);
        if (repeater == null) {
            throw new BindingException("The repeater with the ID [" + this.repeaterId
                    + "] referenced in the binding does not exist in the form definition.");
        }

        repeater.clear();

        Pointer ptr = jxpc.getPointer(this.repeaterPath);
        if (ptr.getNode() != null) {
            // There are some nodes to load from
            final int initialSize = repeater.getSize();

            // build a jxpath iterator for pointers
            JXPathContext repeaterContext = jxpc.getRelativeContext(ptr);
            Iterator rowPointers = repeaterContext.iteratePointers(this.rowPath);
            //iterate through it
            int currentRow = 0;
            while (rowPointers.hasNext()) {
                // create a new row, take that as the frmModelSubContext
                Repeater.RepeaterRow thisRow;
                if (currentRow < initialSize) {
                    thisRow = repeater.getRow(currentRow++);
                } else {
                    thisRow = repeater.addRow();
                }
                // make a jxpath ObjectModelSubcontext on the iterated element
                Pointer jxp = (Pointer)rowPointers.next();
                JXPathContext rowContext = repeaterContext.getRelativeContext(jxp);
                // hand it over to children
View Full Code Here

     * child-bindings are allowed to visit the narrowed contexts.
     */
    public void doSave(Widget frmModel, JXPathContext jxpc)
    throws BindingException {
        // Find the repeater
        Repeater repeater = (Repeater) selectWidget(frmModel, this.repeaterId);

        // and his context, creating the path if needed
        JXPathContext repeaterContext =
            jxpc.getRelativeContext(jxpc.createPath(this.repeaterPath));

        // create set of updatedRowIds
        Set updatedRows = new HashSet();
        //create list of rows to insert at end
        List rowsToInsert = new ArrayList();

        // iterate rows in the form model...
        int formRowCount = repeater.getSize();
        for (int i = 0; i < formRowCount; i++) {
            Repeater.RepeaterRow thisRow = repeater.getRow(i);

            // Get the identity
            List identity = getIdentity(thisRow);

            if (hasNonNullElements(identity)) {
View Full Code Here

            // they are recieved, the position attribute is not used
            if (!ITEM.equals(loc)) {
                throw new SAXException("The element: " + loc +
                                       " is not allowed as a direct child of a Repeater");
            }
            Repeater repeater = (Repeater) currentWidget;
            this.currentWidget = repeater.addRow();

        } else if (this.currentWidget instanceof MultiValueField) {
            this.isMultiValueItem = true;
            if (!ITEM.equals(loc)) {
                throw new SAXException("The element: " + loc +
View Full Code Here

        } else if (widget instanceof ContainerWidget) {
            Iterator children = ((ContainerWidget)widget).getChildren();
            while (children.hasNext())
                generateSAX((Widget)children.next());
        } else if (widget instanceof Repeater) {
            Repeater repeater = (Repeater)widget;
            for (int i = 0; i < repeater.getSize(); i++)
                generateSAX(repeater.getRow(i), ITEM);
        }
        end(id);
    }
View Full Code Here

                childBindings, insertBinding, deleteBindings, identityBindings);
    this.adapterClass = adapterClass;
  }

  public void doLoad(Widget frmModel, JXPathContext jxpc) throws BindingException {
        Repeater repeater = (Repeater) selectWidget(frmModel, super.getId());
        if (!(repeater instanceof EnhancedRepeater)) {
            super.doLoad(frmModel, jxpc);
            return;
        }
View Full Code Here

    rep.setCollection(collection);
    rep.doPageLoad();
  }

  public void doSave(Widget frmModel, JXPathContext jxpc) throws BindingException {
    Repeater repeater = (Repeater) selectWidget(frmModel, super.getId());
    if (!(repeater instanceof EnhancedRepeater)) {
      super.doSave(frmModel, jxpc);
      return;
    }
View Full Code Here

TOP

Related Classes of org.apache.cocoon.forms.formmodel.Repeater$RepeaterRow

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.