why dont we activate it by default?

-Igor


On 5/8/06, Juergen Donnerstag <[EMAIL PROTECTED] > wrote:
On 5/8/06, Aaron Hiniker <[EMAIL PROTECTED] > wrote:
> <wicket:panel>
>
>     <wicket:fragment wicket:id="edit">  edit    </wicket:fragment>
>     <wicket:fragment wicket:id="view">  view  </wicket:fragment>
>
> </wicket:panel>
>
> throws:
>
> Caused by: java.text.ParseException: Unkown tag name with Wicket namespace:
> 'fragment'. Might be you haven't installed the appropriate resolver?
>         at
> wicket.markup.parser.filter.WicketTagIdentifier.nextTag(WicketTagIdentifier.java:104)
>         at
> wicket.markup.parser.filter.TagTypeHandler.nextTag(TagTypeHandler.java:83)
>         at
> wicket.markup.parser.filter.HtmlHandler.nextTag(HtmlHandler.java:86)
>         at
> wicket.markup.parser.filter.WicketRemoveTagHandler.nextTag(WicketRemoveTagHandler.java:70)
>         at
> wicket.markup.parser.filter.WicketLinkTagHandler.nextTag(WicketLinkTagHandler.java:101)
>         at
> wicket.markup.parser.filter.BodyOnLoadHandler.nextTag(BodyOnLoadHandler.java:75)
>         at
> wicket.markup.parser.filter.PrependContextPathHandler.nextTag(PrependContextPathHandler.java:109)
>         at
> wicket.markup.MarkupParser.parseMarkup(MarkupParser.java:250)
>         ... 67 more
>

you need to register it. It is not yet activated by default
application.getPageSettings().addComponentResolver(new FragmentResolver());

>
> I'm not sure what the deal is.. this is RC3... although this works for me,
> and I can live with it for now:
>
> <wicket:panel>
>
> </wicket:panel>
>
> <fragment wicket:id="edit">  edit    </fragment>
> <fragment wicket:id="view">  view  </fragment>
>

This might work now, but might not in the future. It is definitely not
supported.


> I have that method working in other parts of my application.  They are
> self-contained components that access the fragments in a listView.  My
> "blocker" right now is using a different method:  basically my container
> object can't add a fragment accessed from another component that is not in
> the hierarchy (because it doesn't need to be, only the fragment)  Any
> thoughts on how to accomplish this?
>
> FYI:
> The design principal here is that I have a ProfileItemRenderer that accepts
> a ProfileItem.  The ProfileItem can by anything from an image, to a blog, to
> a classified ad, etc, and the ProfileItemRenderer will instantiate these
> ProfileItem components on the fly (by querying the database for which items
> should be place in the user's profile).  On a normal profile view, the
> ProfileItemRenderer will ask each ProfileItem for the "View" fragment.  If
> the user wants to edit their profile, the ProfileItemRenderer will ask each
> ProfileItem for it's "Edit" fragment.  Since many of these components are
> very simple/basic, it would be really helpful to get all the markup in one
> file.
>
>
> Aaron
>
>
>
> On Sun, 2006-05-07 at 23:16 -0700, Igor Vaynberg wrote:
> it should work w/out the namespace
>
> the problem is that the fragment tag is outside of the panel, it should be
> inside
>
> so
>
> <wicket:panel>
> <wicket:fragment.....>
> </wicket:fragment>
> </wicket:panel>
>
> try that and see if it does the trick.
>
> -Igor
>
>
> On 5/7/06, Aaron Hiniker <[EMAIL PROTECTED]> wrote:
> Yes, the "fragment provider" is a Panel.  The markup looks like this:
>
> <wicket:panel>
>
> </wicket:panel>
>
> <fragment wicket:id="edit"> ... </fragment>
>
> <fragment wicket:id="view"> ... </fragment>
>
>
> Since the component is providing fragments only, the "main" markup content
> is empty and I really don't wish/need to render it.  Only the fragments that
> the container selects (Edit/View/etc).
>
> Btw..  wicket doesn't recognize <wicket:fragment> only <fragment> due to
> some namespace code in WicketTag or whatever.  I've tried adding a namespace
> to <html> with no luck.  The fragments *do* load using <fragment>, it just
> doesn't seem like the intended behavior.
>
>
>
> Aaron
>
>
>
> On Sun, 2006-05-07 at 23:03 -0700, Igor Vaynberg wrote:
> the only components that can supply fragments are the ones that have markup
> themselves - ie a page, a panel, or a border because the fragment has to
> live in someone's markup and those are the only ones that have it.
>
> so is your component a panel, a border, or a page?
>
> -Igor
>
>
> On 5/7/06, Aaron Hiniker <[EMAIL PROTECTED] > wrote:
> I am trying to encapsulate Edit/View/Select markup into one Component.  I
> want to set the mode, then add the Fragment to the parent container.
>
> My first attempts went something like this:
>
>
> parent.add( component.getFragment( "markupId", Mode.Edit ) );



> ... and in the component#getFragment(), something like this:
>
> public Component getFragment( String id, Mode mode )
{
if ( mode ==
> Mode.Edit )
return new Fragment( id, "edit", this );   // <-- the "this"
> forces markup from this component, right?

return new Fragment( id, "view"
> );
}



This throws a NPE:

java.lang.NullPointerException
        at
> wicket.markup.html.panel.Fragment.renderFragment (Fragment.java:218)
>        at
>
wicket.markup.html.panel.Fragment.onComponentTagBody(Fragment.java:202)
>        at
> wicket.Component.renderComponent(Component.java:1662)

>   at wicket.MarkupContainer.onRender (MarkupContainer.java:917)
        at
>
wicket.Component.render(Component.java:1507)
        at
> wicket.MarkupContainer.renderNext(MarkupContainer.java:1324)
> .... more ....

I saw a recent commit to Fragment#onComponentTagBody() by
> Eelco that will throw a more descriptive exception instead of this NPE
> indicating if the markup could not be found.

Specifically, in the source
> code it says that the "component used to load the fragment" must be in the
> page heirarchy.  Is this true?
A component cannot just provide fragments
> to container in the manner am I trying to illustrate above?  I basically
> need Edit/View/Select versions of

a component and I would like to put them
> all into the same markup file.

Aaron

>
>
>
>


-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmdlnk&kid0709&bid&3057&dat1642
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to