On 3/5/08, Nino Saturnino Martinez Vazquez Wael <[EMAIL PROTECTED]> wrote: > Answer below: > > > James Carman Wrote: > > Couldn't you use a VelocityPanel to generate your markup and have it > parse the markup after it's generated to avoid the whole "need to use > the right markup ids" part? I was thinking about doing something like > this for generating dynamic editor forms (a la Trails) for objects, > since Wicket doesn't like you putting TextFields on <spans> (you must > use an <input> tag). I was going to have a Velocity script that > decides what type of tag to spit out based on the type of component in > the list. > > > What I found simple, which I perhaps did not explain clearly.. Where to only > accept basePanels in forexample addMenu method, that way a base panel would > look something like this: > > > > public class BasePanelItem extends Panel { > > public final static String ITEM_ID = "item"; > > public AccordionPanelItem() { > super(ITEM_ID); > } > > Now we have the id fixed... > > Then the user only need add what ever user wants when user extends > basePanelItem.. So this solves that too... And the problem with > attaching to wrong tags are solved too... There might be some overhead > because each time you want todo something special you need to create a > panel, but I think it's worth it.. > > PS, youve seen the web beans project right? > http://wicketwebbeans.sourceforge.net/ >
Yes, I've seen WWB. But, I'm a "roll your own" kind of guy. Actually, I'm going through this experiment to help me learn Wicket. I was part of the Trails team and I was wondering how we'd do the same thing in Wicket. > > > regards Nino > > > > Nino Saturnino Martinez Vazquez Wael wrote: > > Sure there a dozens of ways todo this, mine is just one of them. Im > > starting a new thread since it'll be more exposed then. > > > > The idea is following: > > > > Parent: > > > > public class BasePage extends WebPage { > > > > protected final String LINK_LABEL_ID = "linkText"; > > protected final String LINK_ID = "link"; > > > > protected final String FOOTER_ID = "item"; > > protected final String HEADER_ID = "item"; > > > > protected List<WebMarkupContainer> generalAccordionItem = new > > ArrayList<WebMarkupContainer>(); > > > > protected List<WebMarkupContainer> footer = new > > ArrayList<WebMarkupContainer>(); > > protected List<WebMarkupContainer> header = new > > ArrayList<WebMarkupContainer>(); > > > > private AccordionPanel accordionPanel; > > > > /** > > * Constructor that is invoked when page is invoked without a session. > > * > > * @param parameters > > * Page parameters > > */ > > public BasePage() { > > accordionPanel = new AccordionPanel("accordionMenu"); > > add(accordionPanel); > > > > add(new ListView("footerContent", footer) { > > @Override > > protected void populateItem(ListItem item) { > > WebMarkupContainer webMarkupContainer = > > (WebMarkupContainer) item > > .getModelObject(); > > item.add(webMarkupContainer); > > > > } > > }); > > add(new ListView("headerContent", header) { > > @Override > > protected void populateItem(ListItem item) { > > WebMarkupContainer webMarkupContainer = > > (WebMarkupContainer) item > > .getModelObject(); > > item.add(webMarkupContainer); > > > > } > > }); > > > > } > > protected void addMenu(AccordionPanelItem accordionPanelItem) { > > accordionPanel.addMenu(accordionPanelItem); > > }; > > > > protected void addFooter(WebMarkupContainer webMarkupContainer) { > > footer.add(webMarkupContainer); > > }; > > protected void addHeader(WebMarkupContainer webMarkupContainer) { > > header.add(webMarkupContainer); > > }; > > > > Subs/Children then calls the methods... Problem with this technique is > > that you need to use the right markup id's.. To make sure they are > > always set, and giving full control to the child/sub on what to add, > > I'd suggest that you create a BasePanel which encapsules the id, and > > then required that instead of a markupcontainer, that way subs/child > > only need to have panels that extend the basepanel... > > > > But it depends on your needs, mine weren't that tricky.. > > > > > > regards Nino > > > > -- > -Wicket for love > -Jme for fun > > Nino Martinez Wael > Java Specialist @ Jayway DK > http://www.jayway.dk > +45 2936 7684 > > > --------------------------------------------------------------------- > 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]