if your border component has markup, it will be scoped to the component (the markupcontainer), not the page. that's why i carefully said the resource is scoped: "by the class associated with the markup that contained it".
That's even better. So if I understand this correctly: it is application-wide sharing but visible only within the scope of my component. Is that correct?
pretty much. but it's not about visibility exactly. the scope just provides namespacing so that you can have two images called "left" that don't conflict with each other. otherwise, that's exactly it.
I never know the corner color ahead of time. My markup has names such as "topLeftCorner" but you won't find the corner size or color anywhere in the name because I don't know it ahead of time. Are you saying that with the new scheme, I'd have to use an AttributeModifier to change the "src" attribute per <img> tag depending upon its parameters to ensure that different corner images end up with different filenames? I mean... with the change you just made... now people have to watch out that images with the same filename are always identical because they get shared whereas before you wouldn't have to worry about this necessarily because the image name would get scoped related to the component *instance* (if I understand correctly). So say my Page had two components: 1) redBorder 2) blueBorder and both had images with the same names, there would be no conflict because the filename would get prefixed with redBorder or blueBorder. Now, I'd have to proactively use AttributeModifier to fix up "src". Am I understanding this correctly?
no, i mixed up the issues slightly. my bad.
to create these corner images dynamically like this in different colors, you're going to have to deal with resourcereferences directly. it's actually not very hard. you just create an anonymous ResourceReference class which takes the name of the image with the color in it and then implement newResource(). then your round border will work everywhere and the caching will all be automatic. you would scope the corner images by hand in this case.
it would look /something/ like this (getting a little crazy with nested classes):
int width, height; Color color;
...
add(new Image("topLeft", new ResourceReference(RoundBorder.class, "topLeft" + color)
{
public Resource newResource()
{
return new RenderedDynamicImageResource(width, height)
{
public void render(Graphics2D graphics)
{
graphics.setBackground(color);
graphics.fillRoundRect(...);
}
};
}
}));
make sense?
Gili
------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click _______________________________________________ Wicket-develop mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/wicket-develop
------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click _______________________________________________ Wicket-develop mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/wicket-develop
