Re: Styling label tags

2013-09-04 Thread Lucio Crusca
On Monday 02 September 2013 10:12:25 Martin Grigorov wrote:
 On Sat, Aug 31, 2013 at 10:18 AM, Lucio Crusca lu...@sulweb.org wrote:
  In data venerdì 30 agosto 2013 10:48:35, Martin Grigorov ha scritto:
   Hi Lucio,
   The suggested solution should work.
  Which one? I think I've tried all of them and reported issues here,
but
  maybe
  I missed one.
 FormComponentLabel + AttributeModifier

I didn't understand how I'm supposed to use the FormComponentLabel class, 
since wicket:id and wicket:for cannot be put together in the same label
tag and I need a reusable and repeatable panel with a styled label tag
inside. I asked for an example and Francois Meillet provided one, but his
example didn't use the wiket:for attribute, which I need, and using a
dummy for=anything is invalid HTML.





-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Styling label tags

2013-09-04 Thread Martin Grigorov
Hi Lucio,

On Wed, Sep 4, 2013 at 10:06 AM, Lucio Crusca lu...@sulweb.org wrote:

 On Monday 02 September 2013 10:12:25 Martin Grigorov wrote:
  On Sat, Aug 31, 2013 at 10:18 AM, Lucio Crusca lu...@sulweb.org wrote:
   In data venerdì 30 agosto 2013 10:48:35, Martin Grigorov ha scritto:
Hi Lucio,
The suggested solution should work.
   Which one? I think I've tried all of them and reported issues here,
 but
   maybe
   I missed one.
  FormComponentLabel + AttributeModifier

 I didn't understand how I'm supposed to use the FormComponentLabel class,
 since wicket:id and wicket:for cannot be put together in the same label
 tag and I need a reusable and repeatable panel with a styled label tag
 inside. I asked for an example and Francois Meillet provided one, but his
 example didn't use the wiket:for attribute, which I need, and using a
 dummy for=anything is invalid HTML.


Wicket is open source, i.e. it is very easy to see what a given class does.
You can check
https://github.com/apache/wicket/blob/master/wicket-core/src/main/java/org/apache/wicket/markup/html/form/FormComponentLabel.java?source=cc#L76
and
see that FormComponentLabel sets the 'for' attribute for you. So there is
no need of wicket:for in this case.

Also there is
https://github.com/apache/wicket/blob/master/wicket-core/src/main/java/org/apache/wicket/markup/html/form/SimpleFormComponentLabel.java?source=cc
that
uses form component's label to set the text if you want.
Wicket-Examples project provides examples how to use these components. See
https://github.com/apache/wicket/blob/master/wicket-examples/src/main/java/org/apache/wicket/examples/forminput/FormInput.java?source=cc#L126

What's left for you is to use AttributeModifier or its specialization
AttributeAppender to set the class for any label.






 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




Re: Styling label tags

2013-09-04 Thread francois meillet
Hi Lucio,

The for=anything was referring to the id=anything of the input tag,
which is valid. See http://www.w3schools.com/tags/tag_label.asp.

form wicket:id=form
label wicket:id=label_tag for=anything
span  wicket:id=label_tag_Text /span
/label
input wicket:id=name type=text size=40 id=anything 
/form

François


On Wed, Sep 4, 2013 at 9:06 AM, Lucio Crusca lu...@sulweb.org wrote:

 On Monday 02 September 2013 10:12:25 Martin Grigorov wrote:
  On Sat, Aug 31, 2013 at 10:18 AM, Lucio Crusca lu...@sulweb.org wrote:
   In data venerdì 30 agosto 2013 10:48:35, Martin Grigorov ha scritto:
Hi Lucio,
The suggested solution should work.
   Which one? I think I've tried all of them and reported issues here,
 but
   maybe
   I missed one.
  FormComponentLabel + AttributeModifier

 I didn't understand how I'm supposed to use the FormComponentLabel class,
 since wicket:id and wicket:for cannot be put together in the same label
 tag and I need a reusable and repeatable panel with a styled label tag
 inside. I asked for an example and Francois Meillet provided one, but his
 example didn't use the wiket:for attribute, which I need, and using a
 dummy for=anything is invalid HTML.





 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




Re: Styling label tags

2013-09-02 Thread Martin Grigorov
On Sat, Aug 31, 2013 at 10:18 AM, Lucio Crusca lu...@sulweb.org wrote:

 In data venerdì 30 agosto 2013 10:48:35, Martin Grigorov ha scritto:
  Hi Lucio,
 
  The suggested solution should work.

 Which one? I think I've tried all of them and reported issues here, but
 maybe
 I missed one.


FormComponentLabel + AttributeModifier




 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




Re: Styling label tags

2013-09-02 Thread tan_packt
Hi..There is a new Apache Wicket book. Instant Apache Wicket 6 by João
Sávio Ceregatti Longo and Felipe Fedel Pinto. In case you'd be interested in
getting an ebook copy and writing a review on your
blog/website/amazon.com/goodreads.com. Please contact me at:
tan...@packtpub.com 
Here is the link of the book for your convenience: http://bit.ly/15w4LEI 



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Styling-label-tags-tp4661070p4661167.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Styling label tags

2013-08-31 Thread Lucio Crusca
In data venerdì 30 agosto 2013 10:48:35, Martin Grigorov ha scritto:
 Hi Lucio,
 
 The suggested solution should work.

Which one? I think I've tried all of them and reported issues here, but maybe 
I missed one.


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Styling label tags

2013-08-30 Thread Lucio Crusca
In data mercoledì 28 agosto 2013 08:59:56, Lucio Crusca ha scritto:
 Maybe that would work to some extent, but it would have at least the
 following issues: [...]

No more replies. Should I deduce there's no known solution?

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Styling label tags

2013-08-30 Thread Martin Grigorov
Hi Lucio,

The suggested solution should work.
Did you try it ?
What kind of issues you faced ?

Give us more details and some code and we will tell you where is the
problem.


On Fri, Aug 30, 2013 at 11:36 AM, Lucio Crusca lu...@sulweb.org wrote:

 In data mercoledì 28 agosto 2013 08:59:56, Lucio Crusca ha scritto:
  Maybe that would work to some extent, but it would have at least the
  following issues: [...]

 No more replies. Should I deduce there's no known solution?

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




Re: AW: AW: AW: Styling label tags

2013-08-28 Thread Lucio Crusca
In data martedì 27 agosto 2013 15:58:52, francois meillet ha scritto:
 try that
 form wicket:id=form
 label wicket:id=label_tag for=anything
 span  wicket:id=label_tag_Text /span
 /label
 input wicket:id=name type=text size=40 id=anything 
 /form

Maybe that would work to some extent, but it would have at least the following 
issues:

1. it wouldn't pass HTML validation (label for=... must refer to an 
existing input id=...)

2. Given 1 above, it wouldn't be possible to reuse the panel in a 
RepeatingView and obtain valid HTML anymore, because in RepeatingViews Wicket 
needs wicket:for attribute in order to generate valid for=... and id=... 
pairs.

3. it wouldn't pass to the browser the information about what label matches 
what input field (the fact they invented the label tag must mean something, 
right?)
 


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Styling label tags

2013-08-27 Thread Lucio Crusca
In data lunedì 26 agosto 2013 11:28:27, francois meillet ha scritto:
 have a look to
 
 http://ci.apache.org/projects/wicket/apidocs/6.0.x/org/apache/wicket/markup
 /html/form/FormComponentLabel.html and
 http://ci.apache.org/projects/wicket/apidocs/6.0.x/org/apache/wicket/markup
 /html/form/SimpleFormComponentLabel.html
 
 François

I've had a look, but I'm afraid I need a little example. I have the following 
markup:

wicket:panel
  label wicket:for=input
span wicket:id=inputSpan[label text]/span
input wicket:id=input type=checkbox /
  /label
/wicket:panel

and the following (simplified) java code:

public class LabeledCheckbox extends Panel
{
  public LabeledCheckbox(String id, String uiText, IModelBoolean model)
  {
super(id);
Label spanLabel = new Label(inputSpan, uiText);
add(spanLabel.setRenderBodyOnly(false));
CheckBox cb = new checkBox(input, model);
cb.setLabel(Model.of(uiText));
add(cb);
setRenderBodyOnly(true);
  }
}

If I add a FormComponentLabel then I need to specify its wicket:id attribute, 
but I can't use both wicket:id and wicket:for attributes together.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



AW: Styling label tags

2013-08-27 Thread Collinson, Alasdair
I would go a completely different route: add an AttributeModifier [1]. It 
should look something like this:

Label  label = new Label(label, Model.of(Text));
label.add(new AttributeModifier(class, Model.of(cssClassName)));

This is explained in more detail in the wicket-guide [2], Chapter 4.2.

Alasdair

[1] 
http://ci.apache.org/projects/wicket/apidocs/6.0.x/org/apache/wicket/AttributeModifier.html
[2] http://code.google.com/p/wicket-guide/ 

-Ursprüngliche Nachricht-
Von: Lucio Crusca [mailto:lu...@sulweb.org] 
Gesendet: Dienstag, 27. August 2013 13:16
An: users@wicket.apache.org
Betreff: Re: Styling label tags

In data lunedì 26 agosto 2013 11:28:27, francois meillet ha scritto:
 have a look to
 
 http://ci.apache.org/projects/wicket/apidocs/6.0.x/org/apache/wicket/m
 arkup /html/form/FormComponentLabel.html and 
 http://ci.apache.org/projects/wicket/apidocs/6.0.x/org/apache/wicket/m
 arkup /html/form/SimpleFormComponentLabel.html
 
 François

I've had a look, but I'm afraid I need a little example. I have the following
markup:

wicket:panel
  label wicket:for=input
span wicket:id=inputSpan[label text]/span
input wicket:id=input type=checkbox /
  /label
/wicket:panel

and the following (simplified) java code:

public class LabeledCheckbox extends Panel {
  public LabeledCheckbox(String id, String uiText, IModelBoolean model)
  {
super(id);
Label spanLabel = new Label(inputSpan, uiText);
add(spanLabel.setRenderBodyOnly(false));
CheckBox cb = new checkBox(input, model);
cb.setLabel(Model.of(uiText));
add(cb);
setRenderBodyOnly(true);
  }
}

If I add a FormComponentLabel then I need to specify its wicket:id attribute, 
but I can't use both wicket:id and wicket:for attributes together.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: AW: Styling label tags

2013-08-27 Thread Lucio Crusca
In data martedì 27 agosto 2013 13:30:43, Collinson, Alasdair ha scritto:
 I would go a completely different route: add an AttributeModifier [1]. It
 should look something like this:
 
 Label  label = new Label(label, Model.of(Text));
 label.add(new AttributeModifier(class, Model.of(cssClassName)));

But that route doesn't lead me to add the class attribute to the label tag, 
right? If wrong, can you please show me the corresponding markup?


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



AW: AW: Styling label tags

2013-08-27 Thread Collinson, Alasdair
It does. Here's a quick example, adapted from a quickstart:

package com.mycompany;

import org.apache.wicket.AttributeModifier;
import org.apache.wicket.request.mapper.parameter.PageParameters;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.model.Model;

public class HomePage extends WebPage {
private static final long serialVersionUID = 1L;

public HomePage(final PageParameters parameters) {
super(parameters);

Label label = new Label(version, 
getApplication().getFrameworkSettings().getVersion());
label.add(new AttributeModifier(class, Model.of(ninja)));
add(label);
}
}

!DOCTYPE html
html xmlns:wicket=http://wicket.apache.org;
head
meta charset=utf-8 /
titleAttributeModifier Demo/title
style type=text/css
.ninja {
display:none;
}
/style
/head
body
div id=hd/div
div id=bd
p
Do you see the following? 
-gt;wicket:container wicket:id=version1.5-SNAPSHOT/wicket:containerlt;-
/p
/div
div id=ft/div
/body
/html

The resulting page will not show the version number and the html to go with it 
is this:
wicket:container wicket:id=version class=ninja6.10.0/wicket:container

Alasdair

 But that route doesn't lead me to add the class attribute to the label tag, 
 right? If wrong, can you please  show me the corresponding markup?

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: AW: AW: Styling label tags

2013-08-27 Thread Lucio Crusca
In data martedì 27 agosto 2013 14:46:03, Collinson, Alasdair ha scritto:
 It does. 

I don't agree: I can't see any label tags in your markup. I don't need to 
remove my label tags (and I don't want to), I need to dynamically add a 
class=cssClassName to them instead.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



AW: AW: AW: Styling label tags

2013-08-27 Thread Collinson, Alasdair
 I don't agree: I can't see any label tags in your markup. I don't need to 
 remove my label tags (and I don't want to), I need to dynamically add a 
 class=cssClassName to them instead.

Sorry, my mistake - I didn't modify the markup enough. Luckily, whether it's a 
wicket:container or a label doesn't make any difference here. So if you change 
the markup in my example to

Do you see the following? -gt;label 
wicket:id=version1.5-SNAPSHOT/labellt;-

It still works with the same Java-Code.

Alasdair

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: AW: AW: AW: Styling label tags

2013-08-27 Thread Lucio Crusca
In data martedì 27 agosto 2013 15:12:01, Collinson, Alasdair ha scritto:
 So if
 you change the markup in my example to
 
 Do you see the following? -gt;label
 wicket:id=version1.5-SNAPSHOT/labellt;-
 
 It still works with the same Java-Code.

Unfortunately not, because my label tags are part of a form, they have a 
wicket:for attribute referring to the corresponding input tags, and they 
can't have a wicket:id also.


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: AW: AW: AW: Styling label tags

2013-08-27 Thread francois meillet
try that

private class FormExemple extends FormExempleModel {
public FormExemple(String myForm,
CompoundPropertyModelExempleModel model) {
super(myForm, model);

TextFieldString tf_name = new TextFieldString(name);
add(tf_name);

FormComponentLabel formComponentLabel = new
FormComponentLabel(label_tag, tf_name);
formComponentLabel.add(new AttributeModifier(class,
Model.of(YourCssClassName)));

Label label = new Label(label_tag_Text, test_label);
formComponentLabel.add(label);

add(formComponentLabel);
add(tf_name);
}
}



form wicket:id=form
label wicket:id=label_tag for=anything
span  wicket:id=label_tag_Text /span
/label
input wicket:id=name type=text size=40 id=anything 
/form


François


On Tue, Aug 27, 2013 at 3:23 PM, Lucio Crusca lu...@sulweb.org wrote:

 In data martedì 27 agosto 2013 15:12:01, Collinson, Alasdair ha scritto:
  So if
  you change the markup in my example to
 
  Do you see the following? -gt;label
  wicket:id=version1.5-SNAPSHOT/labellt;-
 
  It still works with the same Java-Code.

 Unfortunately not, because my label tags are part of a form, they have a
 wicket:for attribute referring to the corresponding input tags, and they
 can't have a wicket:id also.


 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




Re: Styling label tags

2013-08-26 Thread francois meillet
have a look to

http://ci.apache.org/projects/wicket/apidocs/6.0.x/org/apache/wicket/markup/html/form/FormComponentLabel.html
and
http://ci.apache.org/projects/wicket/apidocs/6.0.x/org/apache/wicket/markup/html/form/SimpleFormComponentLabel.html

François


On Sun, Aug 25, 2013 at 6:30 PM, Lucio Crusca lu...@sulweb.org wrote:

 I need to dynamically set class=cssClassName to some label tags. Just
 now
 I set the label text with:

   myFormComponent.setLabel(...)

 but how do I change its css class?


 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




Styling label tags

2013-08-25 Thread Lucio Crusca
I need to dynamically set class=cssClassName to some label tags. Just now 
I set the label text with:

  myFormComponent.setLabel(...)

but how do I change its css class?


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org