Sorry.. I hit the wrong key and sent this
before I was finished.
I’d have to agree with you.
I don’t think a mandatory prefix is
necessary. However the prefix can still be defined to specify the name of
the attribute when using wicket=’xxx’ style names.
In my case, I would like to beable to
achieve the following :
No mandatory prefix.
Have wicket leave any ID attrbiute there.
Have wicket remove any
wicket=’xxx’ attribute.
My reasoning is :
a) html developer designs the page using
ID to attach css selectors and _javascript_ code – we can’t remove
these
b) java developer binds existing IDs to
java components, adds extra id attributes and attachs non repeated components -
these can be left in the html
c) java developer adds wicket='blah'
attributes for repeated components - these should be removed. I use
wicket='' instead of id='' for repeated attributes, since an ID should be
unique for the whole html document. where as wicket='id' only needs to be
unique within its parent component.
Cameron.
From:
[EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Gili
Sent: Saturday, 12 March 2005 2:41
AM
To:
[email protected]
Subject: RE: [Wicket-develop]
Wicket prefix
You bring up a good point but I don't think we need to worry about it because
we have checking on the other end. If you refer to five wicket components in
your HTML code and have five wicket components in your Java code but the Java
code can only locate four, then you will get an error. The only possible case
is where you refer to more components from your HTML side than from your Wicket
side.
In such a case, at the very least, the HTML code will look fine because part of
coding for Wicket is adding previewability around the tags. In other words, I
don't think it would be as terrible a loss as you mention. Sorry but I am
really against magic or forced-upon-me stuff if I can avoid it.
Gili
--Original Message Text---
From: Cameron Braid
Date: Sat, 12 Mar 2005 02:36:53
+1000
v\:* {behavior:url(#default#VML);}o\:* {behavior:url(#default#VML);}w\:*
{behavior:url(#default#VML);}.shape {behavior:url(#default#VML);}
One thing that would be lost without having a mandatory prefix is the
runtime checking that every component in the html has a coresponding java
component.
i.e. anything with id=wicket-whatever MUST have a component bound to it.
I dont think that is any great loss.
Cameron
From:
[EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Gili
Sent: Saturday, 12 March 2005 2:25
AM
To:
[email protected]
Subject: RE: [Wicket-develop] Wicket
prefix
Your web design team that knows nothing about Wicket need know nothing. Their
preexisting methods that pick up tags by their IDs will keep on working
assuming they are working with static HTML. I am only discussing what happens
with dynamically generated code and its IDs.
I don't understand the strong reluctance to have developers create new
components like this:
Label myLabel = new Label("wicket-label1", "This is my label
text");
versus
Label myLabel = new Label("label1", "This is my label
text");
Remember, your Java developers can create components and assign them any
variable names they wish. The only thing they would need to change is the
"binding name" and insert "wicket-" into it. I really don't
think this has anything to do with naming conventions. Java developers can call
their own variables whatever they want. Obviously there needs to be some sort
of contract when interfacing outside their bounds (the markup). And I mean,
you're already doing this! Right now you're coding:
Label myLabel = new Label("label1", "This is my label
text");
but if your component ends up generating any JS or CSS it needs to be smart
enough to insert "wicket-" in front of it. Either way you have to be
aware of this prefix issue which is why I'm saying we might as well give the
developer full-control over it.
As for the prefix being a "best-practice", I think that is a
subjective matter. We should really leave it up to developers to name their
variables any way they see fit. I know of no programming language that imposes
prefixes on variable names. Why start now?
Gili
--Original Message Text---
From: Christopher Turner
Date: Fri, 11 Mar 2005 10:02:11
+0100
Perhaps I was not being 100% clear. My web page design team know NOTHING about
wicket. I want them free to use any HTML or _javascript_ constructs that they
wish, be able to utilise their existing library of _javascript_ functions (with
whatever ids these already use) and tools and so on. I don't want to enforce
any particular programming style, naming convention or anything on them. I
would prefer that they just get on with their job of writing good looking
pages. In the same way I want my development team to just worry about writing
good quality Java code without having to worry about component naming conventions
and so on - I want them to call a name component "name" component,
not some weird made up name just in case the web team happened to already have
taken the name id.
Having the wicket prefix is therefore essential for binding together the HTML
pages and the Java components in a way that doesn't cause name clashes and
which also makes it obvious which tags in the HTML are bound to wicket
components and which is not.
Regardless of the above I would suggest that it is 'best practice' to use the
wicket prefix anyway even as a sole developer. Even as a single developer
working on a project, were I to leave my company then it would be much easier
for another developer to pick the code and HTML up after I was gone and be
immediately able to see which HTML tags bind to Wicket components and which do
not. Not having the wicket prefix (or whatever you choose to call it) visible
in the HTML source is a bit like writing code without comments - the only way
you can understand how it works is to open all the files and look for where
identical names are used!
Regards,
Chris