On Jun 26, 2005, at 11:16 PM, Chris Turner wrote:
...
* Panels. Great stuff. But how do I make things modular across
different projects? Can I jar a panel's code and html up and
simply drop it in another project's classpath?
Yes, just package your panel, the markup and any resource bundles
into a jar and drop it into your next project. Wicket was designed
to work this way. There are also some clever things that you can do
with borders (and in 1.1 markup inheritance) to allow even more
customisation of reusable panels - but we are still working out the
best patterns for doing this. There are some ideas in the Wiki.
That sounds good. As an experiment I create a little counter panel.
The markup looks like this:
<wicket:panel>
<span wicket:id="count">123</span>
</wicket:panel>
And this is the code (quick hack, not thread safe):
public class Counter extends Panel
{
static Map mCounters = new HashMap();
private String mCounterName;
public Counter(String componentName, String counterName)
{
super(componentName);
mCounterName = counterName;
Integer count = (Integer) mCounters.get(mCounterName);
if (count == null) {
count = new Integer(1);
} else {
count = new Integer(count.intValue() + 1);
}
mCounters.put(mCounterName, count);
add(new Label("count", count.toString()));
}
}
Pretty simple. And I can now make different counters for pages like
this:
add(new Counter("counter", "HomepageCounter"));
Is that the correct way to configure Panels? Or am I supposed to do
it through markup in HTML? (More like the JSP way)
S.
-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user