You're right, this should work. I think that specifically for
the purpose of my RoundCornerBorder this makes a lot of sense since it
is unlikely there will be any reuse.
The *ideal* solution is that I construct a whole bunch of
RoundCornerBorder components, Wicket scans the CSS associated with each
component and if any are found to be identical, it only creates it once
(in the <head>) and has both components share the reference.
It would be super cool ;P I don't expect this pre-1.0, but when
designing some sort of CSS solution, please try aiming for this level
of flexibility. Maybe scanning the output CSS isn't necessarily
required. Maybe it's enough to say:
The same input into <wicket:component> should yield the same output.
Hence, we can reuse their CSS. So, if I put in two RoundCornerBorders
with the same input values, it should share CSS somehow.
Another thought is that if the CSS associated with the
component is a first-class citizen, then we simply invoke hashCode() on
it and if the two CSSs have the same hashCode() then we go forward with
equals() -- which is more expensive -- and if they're equal we share
them. hashCode() would be based on the input variables to
<wicket:component> and equals() would return true only for those
components that are fully defined by their input variables. Any
component that is defined by some other external variable (say, it
invokes random() internally or something) might return the same
hashCode() but equals() would return false.
These are all just ideas I wanted to put out there...
Gili
On Sun, 13 Feb 2005 13:14:03 -0800, Jonathan Locke wrote:
>
>i've been confused on this until just now. see:
>
>http://www.w3schools.com/css/css_howto.asp
>
>according to this, you can create links and "internal" stylesheets in
>the header.
>
>/inline/ styles are done like this:
>
><p style="color: sienna; margin-left: 20px">
>This is a paragraph
></p>
>
>which ought to solve your problem. although perhaps not in a super
>efficient way if you
>have a lot of style attributes and a lot of instances with the same
>values set.
>
>Gili wrote:
>
>> To my knowledge, you *cannot* inline CSS within the component.
>>The only form of inline CSS is the kind that shows up within the <head>
>>that and that is not local to the component (from a namespace
>>perspective) nor is it physically close to the component tag.
>>
>>Gili
>>
>>On Sun, 13 Feb 2005 09:27:58 -0800, Jonathan Locke wrote:
>>
>>
>>
>>>one idea i have is that components themselves get to decide how they
>>>contribute CSS info.
>>>
>>>for your RoundCornerBorder, you might simply /not/ contribute CSS info
>>>and instead generate it local to the component. the problem with that
>>>is that if you have a site with hundreds of these components, they'll
>>>all have inline per-instance css, which is inefficient. you ideally
>>>want to be able to have this all inline at the top of a page or even in
>>>a separate file if all the instances are going to have the same colors
>>>etc. right?
>>>
>>>Jonathan Locke wrote:
>>>
>>>
>>>
>>>>yeah, i was wondering about that...
>>>>
>>>>i've written a bunch of a proof of concept for the stylesheet ideas
>>>>i've been throwing around and i'm kindof stopped on this problem at
>>>>the moment...
>>>>
>>>>Gili wrote:
>>>>
>>>>
>>>>
>>>>>On Sun, 13 Feb 2005 17:38:36 +0100, Eelco Hillenius wrote:
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>>Authors should never depend on globally defined styles like for <p>
>>>>>>etc. They should use classes, selectors and inline styles. Now,
>>>>>>selectors can be a problem, as when you use the id attribute for
>>>>>>wicket components, that id will generally be less usable for css.
>>>>>>What authors can do - like I do a lot in the project I'm working on
>>>>>>- is to use <span or <div tags for marking style, and within that
>>>>>>the usual wicket tags.
>>>>>>
>>>>>>
>>>>>>
>>>>> Agreed, but say for my RoundCornerBorder, how do I bind my CSS
>>>>>so it is local only to my component?
>>>>>
>>>>>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
>>>>
>>>>
>>>>
>>>-------------------------------------------------------
>>>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
>>
>>
>>
>
>
>-------------------------------------------------------
>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