Re: [Wicket-user] Formatting non-html templates

2007-05-05 Thread Jean-Baptiste Quenot
* David Leangen:

  and now component.setRenderBodyOnly(true)

 Looks like this approach does exactly what I want after all. :-D

I guess you can  also add a markup filter that  will strip out the
XML tags.
-- 
 Jean-Baptiste Quenot
aka  John Banana   Qwerty
http://caraldi.com/jbq/

-
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] Formatting non-html templates

2007-04-27 Thread David Leangen
On Fri, 2007-04-27 at 07:59 +0200, Juergen Donnerstag wrote:
 You know that you can remove all tag from output, do you? To remove
 wicket:xx is simply a matter of settings and all other tags (e.g.
 span wicket:id=..) can be removed by subclassing onComponentTag
 and not output anything.

Sure, I guess that would work for embedding panels into the text-only
page.

However, the body of the text must not have any tags and the mime-type
header must be text/plain.

So, subclassing WebPage would not work, and even if it did, it seems to
be that it would be a bad hack that breaks the wicket model.

I am therefore subclassing Page with a PlainTextPage class, which seems
to be more appropriate.

Trying what you suggest above gives me:

  java.text.ParseException: Malformed tag

My .plain file is of the form:

**
tag wicket:id=testtest/tag
plain text goes here
**

If I try to insert a component, I get the above error. I tried with this
in my java file:

  add( new ExternalLink( test, test.html ) );


Cheers,
Dave





-
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] Formatting non-html templates

2007-04-27 Thread David Leangen

Ok, my bad. The error had nothing to do with what you suggested.

I'm playing around with all this now.

Thanks for the tips!




On Fri, 2007-04-27 at 15:09 +0900, David Leangen wrote:
 On Fri, 2007-04-27 at 07:59 +0200, Juergen Donnerstag wrote:
  You know that you can remove all tag from output, do you? To remove
  wicket:xx is simply a matter of settings and all other tags (e.g.
  span wicket:id=..) can be removed by subclassing onComponentTag
  and not output anything.
 
 Sure, I guess that would work for embedding panels into the text-only
 page.
 
 However, the body of the text must not have any tags and the mime-type
 header must be text/plain.
 
 So, subclassing WebPage would not work, and even if it did, it seems to
 be that it would be a bad hack that breaks the wicket model.
 
 I am therefore subclassing Page with a PlainTextPage class, which seems
 to be more appropriate.
 
 Trying what you suggest above gives me:
 
   java.text.ParseException: Malformed tag
 
 My .plain file is of the form:
 
 **
 tag wicket:id=testtest/tag
 plain text goes here
 **
 
 If I try to insert a component, I get the above error. I tried with this
 in my java file:
 
   add( new ExternalLink( test, test.html ) );
 
 
 Cheers,
 Dave
 
 
 
 
 
 -
 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] Formatting non-html templates

2007-04-27 Thread David Leangen
  On Fri, 2007-04-27 at 07:59 +0200, Juergen Donnerstag wrote:
   You know that you can remove all tag from output, do you? To remove
   wicket:xx is simply a matter of settings and all other tags (e.g.
   span wicket:id=..) can be removed by subclassing onComponentTag
   and not output anything.

This approach does not work, since wicket must output some kind of tag.

Even when setting 

  getMarkupSettings().setStripWicketTags( true );

and when @Overiding on ComponentTag so it doesn't output anything,
wicket still needs to output SOMETHING.

For example, with the above settings, if I try to add a label using this
template:

tag wicket:id=test-labeltest/tag

wicket will output this:

tagtest/tag


It looks like Eelco's suggesting of using TextTemplate is the way to go.
I just need to figure out how to serve it the way I want.


Cheers,
Dave





-
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] Formatting non-html templates

2007-04-27 Thread Juergen Donnerstag
 tag wicket:id=test-labeltest/tag

 wicket will output this:

 tagtest/tag


and now component.setRenderBodyOnly(true)

Juergen

-
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] Formatting non-html templates

2007-04-27 Thread David Leangen
  tag wicket:id=test-labeltest/tag
 
  wicket will output this:
 
  tagtest/tag
 
 
 and now component.setRenderBodyOnly(true)

Ah! Eureka!

Thank you for this. :-)

Looks like this approach does exactly what I want after all. :-D





-
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


[Wicket-user] Formatting non-html templates

2007-04-26 Thread David Leangen

Hello!

I have overridden Page with PlainTextPage that outputs text/plain.

I'm wondering: what's the best way to be able to add the plain-text
equivalent of panels to my template?

wicket-contrib-velocity seems to be no good, since it appears to be for
html templates.


Should I implement my own velocity stuff, or is there a better way?

Maybe something like this already exists, but I just haven't seen it?


Thanks!
Dave




-
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] Formatting non-html templates

2007-04-26 Thread Eelco Hillenius
 Hello!

 I have overridden Page with PlainTextPage that outputs text/plain.

Hmmm. Does that work? Wicket still needs tags to operate...

 I'm wondering: what's the best way to be able to add the plain-text
 equivalent of panels to my template?

Resources. See for instance TextTemplate and friend.

 wicket-contrib-velocity seems to be no good, since it appears to be for
 html templates.

Velocity can be used for anything really. But it only makes sense to
use Velocity over e.g. TextTemplate or StringResourceStream or
whatever if you need to do some (semi) complex rendering, with loops
and conditionals and stuff.

 Should I implement my own velocity stuff, or is there a better way?

 Maybe something like this already exists, but I just haven't seen it?

Entirely depends on what exactly you need. I think you should play
around with resources a bit.

Eelco

-
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] Formatting non-html templates

2007-04-26 Thread David Leangen

Just to be sure we're talking about the same thing here... ;-)

  I have overridden Page with PlainTextPage that outputs text/plain.
 
 Hmmm. Does that work? Wicket still needs tags to operate...

Since there's so much nice stuff already available through Wicket and
my Wicket framework is already all set up, I was thinking of using
Wicket to provide access to text-only resources (and eventually others,
too).

For example, I want to read in some page parameters and, based on those
parameters, directly return a page of mime-type text/plain with some
strictly text-only output (i.e. no tags).

In other words, this is accessed directly from the outside as a url,
preferably mounted as a nice/pretty url.


  I'm wondering: what's the best way to be able to add the plain-text
  equivalent of panels to my template?
 
 Resources. See for instance TextTemplate and friend.

I took a quick look... but aren't resources used internally by wicket
for embedding into an html page? If so, it doesn't sound like this would
work for what I'm intending...

Or maybe I just don't see how to access the resource via a url to
accomplish what I'm after.


Cheers,
Dave




-
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] Formatting non-html templates

2007-04-26 Thread Juergen Donnerstag
You know that you can remove all tag from output, do you? To remove
wicket:xx is simply a matter of settings and all other tags (e.g.
span wicket:id=..) can be removed by subclassing onComponentTag
and not output anything.

Juergen

On 4/27/07, David Leangen [EMAIL PROTECTED] wrote:
 Just to be sure we're talking about the same thing here... ;-)

   I have overridden Page with PlainTextPage that outputs text/plain.
 
  Hmmm. Does that work? Wicket still needs tags to operate...

 Since there's so much nice stuff already available through Wicket and
 my Wicket framework is already all set up, I was thinking of using
 Wicket to provide access to text-only resources (and eventually others,
 too).

 For example, I want to read in some page parameters and, based on those
 parameters, directly return a page of mime-type text/plain with some
 strictly text-only output (i.e. no tags).

 In other words, this is accessed directly from the outside as a url,
 preferably mounted as a nice/pretty url.


   I'm wondering: what's the best way to be able to add the plain-text
   equivalent of panels to my template?
 
  Resources. See for instance TextTemplate and friend.

 I took a quick look... but aren't resources used internally by wicket
 for embedding into an html page? If so, it doesn't sound like this would
 work for what I'm intending...

 Or maybe I just don't see how to access the resource via a url to
 accomplish what I'm after.


 Cheers,
 Dave




 -
 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] Formatting Dates

2006-06-21 Thread Igor Vaynberg
yeah, you pretty much nailed it. although i would extend webmarkupcomponent instead of label since you are really not using any of label's functionality.as an alternative to this method you can create an imodel decorator that has the formatting in getobject...
IModel.getObject(Component c) { Date d=(Datre)delegate.getObject(c); return formattedDate(d);}that way you can use any existing output component and still maintain the format.in the project i work on i have the model and the component wraps whatever it gets passed through the consturctor with that model
ie...class DateLabel extends Label { public DateLabel(String id, IModel model) { super(id, new DateFormatModel(model)); }}but in the end, whatever works for you :)
-IgorOn 6/21/06, Stefan Arentz [EMAIL PROTECTED] wrote:
I keep asking silly questions :-)I have a lot of ListViews that need to show ISO formatted dates. Is it common practice to make a WebComponent for that? For example like this:public class DateLabel extends Label
{ static private final Format sDateFormat = new SimpleDateFormat(-MM-dd HH:mm:ss); public DateLabel(String id) { super(id); } public DateLabel(String id, Date model)
 { super(id, new Model(model)); } public DateLabel(String id, IModel model) { super(id, model); } protected void onComponentTagBody(final MarkupStream markupStream, final ComponentTag openTag)
 { replaceComponentTagBody(markupStream, openTag, sDateFormat.format(getModelObject())); }}I must admit that I'm not really in a Wicket Mindset yet. Maybe a Wicket Jedi Master can tell me whether this is the right approach :-)
S.

___Wicket-user mailing listWicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] Formatting Dates

2006-06-21 Thread Eelco Hillenius
And if you always/ throughout your whole web application have to
format in a certain style, you can register a converter that does
that.

Eelco


On 6/21/06, Igor Vaynberg [EMAIL PROTECTED] wrote:
 yeah, you pretty much nailed it. although i would extend webmarkupcomponent
 instead of label since you are really not using any of label's
 functionality.

 as an alternative to this method you can create an imodel decorator that has
 the formatting in getobject...

 IModel.getObject(Component c) {
Date d=(Datre)delegate.getObject(c);
return formattedDate(d);
 }

 that way you can use any existing output component and still maintain the
 format.

 in the project i work on i have the model and the component wraps whatever
 it gets passed through the consturctor with that model

 ie...

 class DateLabel extends Label {

 public DateLabel(String id, IModel model) {
   super(id, new DateFormatModel(model));
 }
 }

 but in the end, whatever works for you :)

 -Igor




 On 6/21/06, Stefan Arentz [EMAIL PROTECTED] wrote:
 

 I keep asking silly questions :-)

 I have a lot of ListViews that need to show ISO formatted dates. Is it
 common practice to make a WebComponent for that? For example like this:

 public class DateLabel extends Label
 {
 static private final Format sDateFormat = new
 SimpleDateFormat(-MM-dd HH:mm:ss);

 public DateLabel(String id)
 {
 super(id);
 }

 public DateLabel(String id, Date model)
 {
 super(id, new Model(model));
 }

 public DateLabel(String id, IModel model)
 {
 super(id, model);
 }

 protected void onComponentTagBody(final MarkupStream markupStream, final
 ComponentTag openTag)
 {
 replaceComponentTagBody(markupStream, openTag,
 sDateFormat.format(getModelObject()));
 }
 }

 I must admit that I'm not really in a Wicket Mindset yet. Maybe a Wicket
 Jedi Master can tell me whether this is the right approach :-)

  S.




 ___
 Wicket-user mailing list
 Wicket-user@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/wicket-user






 ___
 Wicket-user mailing list
 Wicket-user@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/wicket-user





___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


[Wicket-user] Formatting DatePIcker

2006-04-18 Thread Aditya Patel
I am trying to format the DatePicker component using DatePickerSettings but the format is not being applied to the Date and instead the format String "MM/dd/" is getting displayed when I select a Date. Below is the code:private static final String DATE_FORMAT_STRING = "MM/dd/";DatePickerSettings settings = new DatePickerSettings(); settings.setIfFormat(DATE_FORMAT_STRING); RequiredTextField dateField1 = new RequiredTextField("startDate", Date.class); add(dateField1); add(new DatePicker("dateFieldPicker1", dateField1, settings));  
		Yahoo! Messenger with Voice. Make PC-to-Phone Calls to the US (and 30+ countries) for 2¢/min or less.

Re: [Wicket-user] Formatting DatePIcker

2006-04-18 Thread Eelco Hillenius
Thanks for answering. I improved the javadocs.

Eelco

On 4/18/06, Marco Geier [EMAIL PROTECTED] wrote:
 use *JavaScript* format semantics instead of java's.

 e.g.
 private static final String DATE_FORMAT_STRING = %m/%d/%Y;

 Aditya Patel wrote:
  I am trying to format the DatePicker component using DatePickerSettings but 
  the format is not being applied to the Date and instead  the format String 
  MM/dd/ is getting displayed when I select a Date. Below is the code:
 
  private static final String DATE_FORMAT_STRING = MM/dd/;
  DatePickerSettings settings = new DatePickerSettings();
  settings.setIfFormat(DATE_FORMAT_STRING);
  RequiredTextField dateField1 = new 
  RequiredTextField(startDate, Date.class);
  add(dateField1);
  add(new DatePicker(dateFieldPicker1, dateField1, settings));
 
 
 
 
 
 
 
  -
  Yahoo! Messenger with Voice. Make PC-to-Phone Calls to the US (and 30+ 
  countries) for 2¢/min or less.

 --
 ___

 Dipl.-Ing. Marco Geier
 EyeTea GmbH
 Germany
 phone   +49 (0)721 662464-0
 fax +49 (0)721 662464-1
 mobile  +49 (0)177 6579590
 [EMAIL PROTECTED]


 ---
 This SF.Net email is sponsored by xPML, a groundbreaking scripting language
 that extends applications into web and mobile media. Attend the live webcast
 and join the prime developer group breaking into this new coding territory!
 http://sel.as-us.falkag.net/sel?cmdlnkkid0944bid$1720dat1642
 ___
 Wicket-user mailing list
 Wicket-user@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/wicket-user



---
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnkkid0944bid$1720dat1642
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


[Wicket-user] formatting

2006-03-15 Thread Vincent Jenks
I thought I had read that wicket has some formatting capabilities? Am I mistaken? Or, am I left to use Java's formatting capabilities?Thanks!


Re: [Wicket-user] formatting

2006-03-15 Thread Igor Vaynberg
formatting?-IgorOn 3/15/06, Vincent Jenks [EMAIL PROTECTED] wrote:
I thought I had read that wicket has some formatting capabilities? Am I mistaken? Or, am I left to use Java's formatting capabilities?Thanks!




Re: [Wicket-user] formatting

2006-03-15 Thread Vincent Jenks
formatting displayed valuesdollars, number of decimal points, dates, etc.On 3/15/06, Igor Vaynberg [EMAIL PROTECTED]
 wrote:formatting?
-IgorOn 3/15/06, Vincent Jenks 
[EMAIL PROTECTED] wrote:
I thought I had read that wicket has some formatting capabilities? Am I mistaken? Or, am I left to use Java's formatting capabilities?Thanks!






Re: [Wicket-user] formatting

2006-03-15 Thread Johan Compagner
thats plain java. You could use a converter for that.johanOn 3/15/06, Vincent Jenks [EMAIL PROTECTED]
 wrote:formatting displayed valuesdollars, number of decimal points, dates, etc.
On 3/15/06, Igor Vaynberg 
[EMAIL PROTECTED]
 wrote:formatting?

-IgorOn 3/15/06, Vincent Jenks 

[EMAIL PROTECTED] wrote:
I thought I had read that wicket has some formatting capabilities? Am I mistaken? Or, am I left to use Java's formatting capabilities?Thanks!








[Wicket-user] Formatting numbers in Labels

2005-11-20 Thread Anders Peterson

With code like this

anItem.add(new Label(return, new PropertyModel(tmpInstrument, 
diffusionProcess.localDrift)));


I'm trying to display small numbers.

1.1465448173051241E-12
1.2381223801081599E-6

In the generated page this just appears as 0 or -0. I want it to be 
0.012381223801081599


How can I create Labels that know how to format these small numbers?

/Anders
--
http://ojalgo.org/

Mathematics, Linear Algebra and Optimisation with Java



---
This SF.Net email is sponsored by the JBoss Inc.  Get Certified Today
Register for a JBoss Training Course.  Free Certification Exam
for All Training Attendees Through End of 2005. For more info visit:
http://ads.osdn.com/?ad_id=7628alloc_id=16845op=click
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] Formatting numbers in Labels

2005-11-20 Thread Christian Essl

If you use BigDecimals this should work out of the box.

To provide your own format you can override getConverter() on the Label or 
for the whole application Application.getConverterFactory(). For details 
see the wicket page on custom converters:

http://www.wicket-wiki.org.uk/wiki/index.php/Using_custom_converters

Christian

On Sun, 20 Nov 2005 13:20:02 +0100, Anders Peterson 
[EMAIL PROTECTED] wrote:



With code like this

anItem.add(new Label(return, new PropertyModel(tmpInstrument, 
diffusionProcess.localDrift)));


I'm trying to display small numbers.

1.1465448173051241E-12
1.2381223801081599E-6

In the generated page this just appears as 0 or -0. I want it to be 
0.012381223801081599


How can I create Labels that know how to format these small numbers?

/Anders




--
Christian Essl 






___ 
Gesendet von Yahoo! Mail - Jetzt mit 1GB Speicher kostenlos - Hier anmelden: http://mail.yahoo.de




---
This SF.Net email is sponsored by the JBoss Inc.  Get Certified Today
Register for a JBoss Training Course.  Free Certification Exam
for All Training Attendees Through End of 2005. For more info visit:
http://ads.osdn.com/?ad_id=7628alloc_id=16845op=click
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user