Also, 2 very useful implementations of a KeyProvider and a TreeContentProvider where added in tacos-4.1

http://fisheye3.cenqua.com/browse/tacos/tacos-4.1/trunk/tacos-core/src/java/net/sf/tacos/model/impl/BeanPropertyKeyProvider.java?r=469
http://fisheye3.cenqua.com/browse/tacos/tacos-4.1/trunk/tacos-core/src/java/net/sf/tacos/model/impl/BeanWithChildrenTreeContentProvider.java?r=469


Borut BolĨina wrote:
Have a look at this blog
http://andyhot.di.uoa.gr/blojsom/blog/default/java/2006/08/17/Tapestry-Building-Trees-with-Tacos-and-Annotations.html

It sure helped me.

Cheers,
Borut

Wojtek Ciesielski wrote:
Hi all,

I am trying to figure out some elegant way to use Tapestry to build dynamic ajax-based tree-like UI widget. In general it's about showing some hierarchical data:

* Some data item
   * some sub property
   * some sub property
     * last level of props
   * some sub property

Each level of that tree is (at least I planned in this way) a separate component as on each of those levels different things are shown with different actions. So here comes the question: how to approach this problem in a way that could be implemented by someone, who knows basics of Tapestry?

I thought about creating separate page (let's call it AjaxComponentProvider) which would be called when user clicks an item. This page would have injected components for those levels and would render next level of components (by deleting rendering to sub-components) as an XML. This XML would be then inserted into the page. Thanks to such approach it would be easy to switch from AJAX-based display to 'classical' one.

One thing that I can't find is how to obtain a String with URL to a AjaxComponentProvider with some additional properties... My initial ACP looks like this:

public abstract class AjaxComponentProvider extends DatapatrolBasePage {
 public static final String pageName = "AjaxComponentProvider";
 public enum Action {GET_OCCURRENCE_DETAILS}
 public abstract Action getAction();
 public abstract void setAction(Action a);
 @InjectComponent("OccurrenceInfo")
 public abstract OccurrenceInfo getOccurrenceInfoComponent();
 public DpOccurrence getShownOccurrence() {
   Collection<DpItem> items = MockDataProvider.createSearchedItems();
return (DpOccurrence) items.iterator().next().getDpOccurrences().toArray()[0];
 }
 /**
* @see org.apache.tapestry.BaseComponent#renderComponent(org.apache.tapestry.IMarkupWriter, org.apache.tapestry.IRequestCycle)
  */
 @Override
protected void renderComponent(IMarkupWriter arg0, IRequestCycle arg1) {
   OccurrenceInfo oic = getOccurrenceInfoComponent();
   oic.render(arg0,arg1);
   //super.renderComponent(arg0, arg1);
 }
}


And on a page that is supposed to use ACP to obtain some sub-level I wanted to put something like

@InjectPage(AjaxComponentProvider.pageName)
public abstract AjaxComponentProvider getAjaxComponentProvider();

public String getLink() {

   AjaxComponentProvider acp = getAjaxComponentProvider();
   acp.setAction(Action.GET_OCCURRENCE_DETAILS);
String toRet = // here I need to get string with url to AjaxComponentProvider page with props set
   return toRet;
 }


this getLink() method would be used in composing javascript on the template to create ajax requests...

What are you thoughts about it? Am I missing some much easier and elegant way to do this?



----------------------------------------------------------------------
Najlepiej wytresowany pies swiata >>>
Zobacz >>> http://link.interia.pl/f1a34


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to