Re: [Wicket-user] Accessing Template Value of a Label

2007-05-22 Thread Erik van Oosten

You can change the template to:

DefaultValue label wicket:id=marked*/label

In the java code you do something like:

add(new WebMarkupContainer(marked).setVisible(condition));

Regards,
Erik.



severian wrote:
 
 I'm not sure that what I describe here is possible, but if it is, I'd be
 grateful if someone could point me in the right direction.
 
 I'd like to allow template designers to give some default text for a
 lable, e.g.:
 label wicket:id=myLabelDefaultValue/label
 
 And I'd then like to be able to either leave that text untouched, or
 append it with a * character, depending on some other criteria that I
 can query in the Page class.  But I can't find a way to make wicket retain
 the template value (DefaultValue), never mind let me append other
 characters.
 
 I was hoping (for example) that I could derive a class from Label and play
 some tricks with onComponentTagBody/replaceComponentTagBody.  But it looks
 like the templateValue (DefaultValue) is not available to me.
 
 Am I missing something?  Or does Wicket throw away the Label text set in
 the template before I have a chance to do anything with it?
 

-- 
View this message in context: 
http://www.nabble.com/Accessing-Template-Value-of-a-Label-tf3796116.html#a10737326
Sent from the Wicket - User mailing list archive at Nabble.com.


-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] Accessing Template Value of a Label

2007-05-22 Thread severian

Thanks for that Erik, I may well have to go with that if there are no other
suggestions.  But I'm still keen to learn if I can keep the Label text once
I add a wicket:id attribute to the label markup.

I may, for example, have to change (later in development) the label-marking
mechanism.  So, instead of adding a * character, I may have to colour the
label red, or add a border, or whatever.  So I was looking for a way to
centralise the label-marking mechanism in java, with no impact on the
markup, to make such a change as easy as possible.

I figured the best way to do this was just to make the whole label a wicket
component, so that I could manipulate it however I liked in java.  But doing
that seems to lose the label text altogether...
-- 
View this message in context: 
http://www.nabble.com/Accessing-Template-Value-of-a-Label-tf3796116.html#a10737498
Sent from the Wicket - User mailing list archive at Nabble.com.


-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] Accessing Template Value of a Label

2007-05-22 Thread severian

Thanks again Erik.  Using WebMarkupContainer rather than Label certainly
seems to help in terms of retaining the template text.  Butusing your
specified markup:
Default Label

Is there a way (without further altering the markup) to end up with output
which looks like:
Default Label*

I'd be happy with any non-DHTML mechanism at all (adding style as behaviour,
over-riding onComponentTagBody etc)!  Your original suggestion (having
another component whose visibility I control) means further markup
modification, which I'd like to avoid if possible.

Severian.
-- 
View this message in context: 
http://www.nabble.com/Accessing-Template-Value-of-a-Label-tf3796116.html#a10738421
Sent from the Wicket - User mailing list archive at Nabble.com.


-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] Accessing Template Value of a Label

2007-05-22 Thread severian

OK Erik, it seems like the following works:

class MyContainer extends WebMarkupContainer {
public MyContainer(String id) {
super(id);
}

@Override
protected void onComponentTagBody(final MarkupStream markupStream,
final ComponentTag openTag) {
super.onComponentTagBody(markupStream, openTag);
getResponse().write(*);
}
}

I'm happy with this solution, unless anyone tells me otherwise.  I can
easily change MyContainer to add a style (or whatever) as my requirements
change, without touching the markup.

Thanks again,
Severian.
-- 
View this message in context: 
http://www.nabble.com/Accessing-Template-Value-of-a-Label-tf3796116.html#a10738690
Sent from the Wicket - User mailing list archive at Nabble.com.


-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] Accessing Template Value of a Label

2007-05-22 Thread Erik van Oosten

Well, actually, I like that solution.

 Erik.


severian wrote:
 
 OK Erik, it seems like the following works:
 
 class MyContainer extends WebMarkupContainer {
 public MyContainer(String id) {
 super(id);
 }
 
 @Override
 protected void onComponentTagBody(final MarkupStream markupStream,
 final ComponentTag openTag) {
 super.onComponentTagBody(markupStream, openTag);
 getResponse().write(*);
 }
 }
 
 I'm happy with this solution, unless anyone tells me otherwise.  I can
 easily change MyContainer to add a style (or whatever) as my requirements
 change, without touching the markup.
 
 Thanks again,
 Severian.
 

-- 
View this message in context: 
http://www.nabble.com/Accessing-Template-Value-of-a-Label-tf3796116.html#a10738893
Sent from the Wicket - User mailing list archive at Nabble.com.


-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] Accessing Template Value of a Label

2007-05-22 Thread Johan Compagner

in 1.3 you could if you want use a IComponentBorder for that.

johan

On 5/22/07, severian [EMAIL PROTECTED] wrote:



OK Erik, it seems like the following works:

class MyContainer extends WebMarkupContainer {
public MyContainer(String id) {
super(id);
}

@Override
protected void onComponentTagBody(final MarkupStream markupStream,
final ComponentTag openTag) {
super.onComponentTagBody(markupStream, openTag);
getResponse().write(*);
}
}

I'm happy with this solution, unless anyone tells me otherwise.  I can
easily change MyContainer to add a style (or whatever) as my requirements
change, without touching the markup.

Thanks again,
Severian.
--
View this message in context:
http://www.nabble.com/Accessing-Template-Value-of-a-Label-tf3796116.html#a10738690
Sent from the Wicket - User mailing list archive at Nabble.com.


-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] Accessing Template Value of a Label

2007-05-22 Thread Martijn Dashorst
This seems more like a stylesheet problem than a text generation
problem. Do /you/ need to change the way things are presented or your
designer?

In stylesheets you can add a * before or after some markup tag, or
make the border red, or have a line under it, or make the text larger.

Martijn

On 5/22/07, severian [EMAIL PROTECTED] wrote:

 OK Erik, it seems like the following works:

 class MyContainer extends WebMarkupContainer {
 public MyContainer(String id) {
 super(id);
 }

 @Override
 protected void onComponentTagBody(final MarkupStream markupStream,
 final ComponentTag openTag) {
 super.onComponentTagBody(markupStream, openTag);
 getResponse().write(*);
 }
 }

 I'm happy with this solution, unless anyone tells me otherwise.  I can
 easily change MyContainer to add a style (or whatever) as my requirements
 change, without touching the markup.

 Thanks again,
 Severian.
 --
 View this message in context: 
 http://www.nabble.com/Accessing-Template-Value-of-a-Label-tf3796116.html#a10738690
 Sent from the Wicket - User mailing list archive at Nabble.com.


 -
 This SF.net email is sponsored by DB2 Express
 Download DB2 Express C - the FREE version of DB2 express and take
 control of your XML. No limits. Just data. Click to get it now.
 http://sourceforge.net/powerbar/db2/
 ___
 Wicket-user mailing list
 Wicket-user@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/wicket-user



-- 
Join the wicket community at irc.freenode.net: ##wicket
Wicket 1.2.6 contains a very important fix. Download Wicket now!
http://wicketframework.org

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] Accessing Template Value of a Label

2007-05-22 Thread severian

Martijn

In principle, I agree.  In practise, however, I understand that the css
selector that lets you append text is not supported by all browsers, and
specifically not by IE6 (I'd be delighted if I was wrong about this).  Which
is why I've been trying to find a maintainable Java solution...

Severian.
-- 
View this message in context: 
http://www.nabble.com/Accessing-Template-Value-of-a-Label-tf3796116.html#a10739409
Sent from the Wicket - User mailing list archive at Nabble.com.


-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] Accessing Template Value of a Label

2007-05-22 Thread Martijn Dashorst
On 5/22/07, severian [EMAIL PROTECTED] wrote:
 specifically not by IE6 (I'd be delighted if I was wrong about this).

Not having touched IE in over a year I am of no use in this regard :).

 Which is why I've been trying to find a maintainable Java solution...

In the very least I would make it a custom component, so you don't
have that functionality spread across your whole app. Then when IE6
finally dies and withers away you only have to change one component
:).

Martijn


-- 
Join the wicket community at irc.freenode.net: ##wicket
Wicket 1.2.6 contains a very important fix. Download Wicket now!
http://wicketframework.org

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user