You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Matthijs Wensveen <m....@func.nl> on 2007/12/05 08:10:49 UTC

IComponentResolver question. Was: How to dynamically generate HTML page?

I was looking at the code of AutoComponentPanel and found similarities 
between this and IComponentResolver. AutoComponentPanel has an 
overridable getMarkupComponent(ComponentTag, MarkupStream) where 
IComponentResolver has resolve(MarkupContainer, MarkupStream, 
ComponentTag). Can someone explain this class and its uses to me? Is it 
something that I should want to use for AutoComponentPanel?

We user AutoComponentPanel as a base class for some other panels that 
provide dynamic markup. Would it be better (aka the wicket-way (tm)) 
when AutoComponentPanel is re-written as an IComponentResolver that can 
be used by the currently subclassing panels. They would then need to 
implement IComponentResolver too but can call my rewritten 
AutoComponentPanelAsResolverSomething in their implementing methods.

Would this be a better way to go?

How should this work when I add my resolver with 
Application.getPageSettings().addComponentResolver(resolver)?

Thanks,
Matthijs Wensveen

Matthijs Wensveen wrote:
> Hello Praveen,
>
> Wouter Huijnink presented something similar to what you need at the 
> wicket meetup in Amsterdam. We generate html dynamically from xml, 
> using xslt. A component called AutoComponentPanel parses the html and 
> adds components to the hierarchy accordingly. This is actually a 
> two-step process. The first step is telling wicket you want to supply 
> markup yourself instead of letting wicket read it from the 
> corresponding html file. You can do this by implementing 
> IMarkupResourceStreamProvider and if applicable also 
> IMarkupCacheKeyProvider. Then you need to parse the markup stream and 
> add components.
>
> If you're interested I can send the AutoComponentPanel code. It still 
> needs some work to make it shine, but we plan to open source it anyway 
> as part of a wicket-based QTI framework.
>
> PS. Unfortunately Wouter's slides aren't uploaded yet.
>
>
> Pen wrote:
>> thanks Johan for your reply. I did take look into your slides.
>> We can generate HTML pages, we have no issue with it. But how to display
>> this newly created HTML pages which only exists in memory, there is no
>> physical file. And also to navigate to this new HTML page.
>>
>> For example If I create a simple HTML page at runtime like below 
>> test.html.
>> How to display it and navigate to it. As it also requires corresponding
>> test.java. This is simple one. But what if we have wicket:Ids we need
>> construct the Java files with all the action listener also.
>>
>> test.html
>> <html>
>> <body>
>>    <h1>Hello world! </h1>
>> </body>
>> <html>
>>
>>
>> ~Praveen
>>
>>
>>
>> Johan Compagner wrote:
>>  
>>> Generate on one side the html by a servlet or special template
>>> generator, that reads in your db data and generate the component
>>> structure on the other side.
>>>
>>> Look at he slides i put on of the presentation that i did for the
>>> wicket user group in the netherlands
>>>
>>> 2007/12/4, Pen <du...@yahoo.com>:
>>>    
>>>> I looked into the example wicketstuff-crud, this is basically in 
>>>> memory
>>>> database with basic CRUD operation. this is not what exactly I am
>>>> looking.
>>>> Let me restate the question. We have application where in user can 
>>>> create
>>>> a
>>>> webpages using web designer by drag-n-drop where is html elements like
>>>> text,
>>>> image, selection box, combo box and save it in DB.
>>>> It will be Json format parse it to POJO and store in DB. for example
>>>> Image
>>>> object looks like this
>>>> which has got position, style, etc .
>>>> [{"position":({left:60, top:40}),
>>>> "size":({width:100,height:80}),
>>>> "positionTop":40,"positionLeft":60,"sizeWidth":100,"sizeHeight":80,
>>>> "cssClass":"",
>>>> "style":"left:60px;top:40px;width:100px;height:80px;",
>>>> ]}}]})
>>>>
>>>> Now we need to read from the DB and reconstruct the same Image 
>>>> object has
>>>> a
>>>> html page. We can construct the above object with HTML tags.
>>>> But the question is how to display this html pages, since it exists 
>>>> only
>>>> in
>>>> memory and also how to navigate to this newly created page.
>>>>
>>>> ~Praveen
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> igor.vaynberg wrote:
>>>>      
>>>>> see how wicketstuff-crud does it in wicket-stuff svn
>>>>>
>>>>> -igor
>>>>>
>>>>>
>>>>> On Dec 3, 2007 6:30 PM, Pen <du...@yahoo.com> wrote:
>>>>>        
>>>>>> I am a new wicker user.  We need to construct/generate  a HTML page
>>>>>> dynamically at runtime from the HTML elements like image and 
>>>>>> text.           
>>>> This
>>>>      
>>>>>> page only exists in memory(session/cache) and  there is no physical
>>>>>>           
>>>> file.
>>>>      
>>>>>> so
>>>>>> how to generate such page and corresponding java class. How this can
>>>>>>           
>>>> be
>>>>      
>>>>>> done
>>>>>> for static elements like image and text versus dynamically for form
>>>>>> submit.
>>>>>> Also how to navigate to this newly generated html page.
>>>>>>
>>>>>> ~Praveen
>>>>>> -- 
>>>>>> View this message in context:
>>>>>>
>>>>>>           
>>>> http://www.nabble.com/How-to-dynamically-generate-HTML-page--tf4940771.html#a14143413 
>>>>
>>>>      
>>>>>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>>>>>
>>>>>>
>>>>>> --------------------------------------------------------------------- 
>>>>>>
>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>
>>>>>>
>>>>>>           
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>
>>>>>
>>>>>
>>>>>         
>>>> -- 
>>>> View this message in context:
>>>> http://www.nabble.com/How-to-dynamically-generate-HTML-page--tf4940771.html#a14156946 
>>>>
>>>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>
>>>>
>>>>       
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>>
>>>     
>>
>>   
>
>


-- 
Matthijs Wensveen
Func. Internet Integration
W http://www.func.nl
T +31 20 4230000
F +31 20 4223500 


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