cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bart Molenkamp" <b.molenk...@bizzdesign.nl>
Subject RE: Selection-List CocoonForms
Date Fri, 03 Jun 2005 07:07:07 GMT
Hi Dennis,

I don't exactly understand what you mean, but I'll try to answer. You
can configure
your selection list class as I showed you below. For example, a simple
field widget
which has a selection list:

<fd:field id="user" required="true">
  <fd:datatype base="string"/>
  <fd:label>...</fd:label>
  <fd:selection-list type="java" 
    nullable="false"
    class="my.lists.UserSelectionList"/>
</fd:field>

The forms framework will create a new instance of your list, set it up
(see any Avalon
Documentation for that). The forms framework will call your list when
required, and
you need to write code to populate the list. CForms will read this, and
put the data
in a widget. E.g.

class MyList extends AbstractSelectionList {
...
protected boolean build() throws Exception {
  PersistenceManager persistenceManager =
this.manager.lookup(PersistenceManager.ROLE);
  Collection users = persistenceManager.getAllUsers();
  Iterator i = users.iterator();
  while (i.hasNext()) {
    User user = i.next();
    addItem(user.getId(), user.getName());  // Add a user to the form.
  }

  ...
  return true;  // dynamic: CForms rebuild this list when it is
displayed again.
}


It is up to you to set rebuild to true or false.

HTH,
Bart.                


________________________________________
Van: dennis_riedel@web.de [mailto:dennis_riedel@web.de] 
Verzonden: donderdag 2 juni 2005 18:01
Aan: users@cocoon.apache.org
Onderwerp: Re: Selection-List CocoonForms

Hi.
At first a lot of thanks to Derek for these interesting alternatives.
Didn`t thought of it this way (using Sitemap, XML and XSL) although
thats the cocoony way of doing it isn`t it? (Cocoon - xml publishing
framework). Thx alot.

Second: that is the solution I am looking for. Thx Bart.
But how do I give my SelectionList Class to the Form? Will I put the
Instance in a viewData Array and give it to the pipeline?
Do you set rebuild on usage on true or false in your SelectionList
Class?

Dennis


Bart Molenkamp wrote: 
Hi,

There is a Java implementation. You can write a class that extends
org.apache.cocoon.forms.datatype.AbstractJavaSelectionList and then add
something like this to your <fd:field>:

<fd:selection-list type="java"
  class="my.cocoon.MySelectionList"

I use it myself to create a list from some database resources.

HTH,
Bart.

  
-----Oorspronkelijk bericht-----
Van: dennis_riedel@web.de [mailto:dennis_riedel@web.de]
Verzonden: donderdag 2 juni 2005 14:15
Aan: cocoon user mailing list
Onderwerp: Selection-List CocoonForms

Hello.
Is there no other possibility for dynamic selection lists than
-flow-jxpath implementation
-enum implementation
??

I want to load the data for my selection list from database and like
    
the
  
JSF idea with backing beans load my bean into my form.
So the selection list should be able to read the collection of items,
display them and I must save the selection in my bean to save the data
to database.

Thx for any idea.

Dennis

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
    



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


  



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message