Re: Announcement: Annotation-based Mounting of Resources

2009-10-14 Thread Robin Sander


Hi Stefan.

this sounds really interesting!
As I see that you don't use Spring to parse your annoations, are there  
any plans to combine parts of your work with wicketstuff-annotation?
Because I would like to use @MountPath from wicketstuff-annotation as  
well but not for the price of adding Spring as a dependency.


And another question: is it possible to use the versioning/replacement  
features without actually merging those files?


Robin.


On 14.10.2009, at 09:42, Stefan Fussenegger wrote:

Today, I’m happy to announce the availability of annotation-based  
mounting and merging of resources in wicketstuff-merged-resources  
(version 3.0-SNAPSHOT for Wicket 1.4, version 2.1-SNAPSHOT for  
Wicket 1.3). In order to mount resources, all that’s needed is  
adding annotations to component classes:


@JsContribution
@CssContribution(media = "print")
@ResourceContribution(value = "accept.png", path = "/img/accept.png")
public class PanelOne extends Panel {

   public PanelOne(String id) {
   super(id);
   // ...
   }
}

As an added benefit, you’ll get all the other features of  
wicketstuff-merged-resources:


merging of multiple files into one for less HTTP requests
adding of versions to resource paths for aggressive caching
pre-processing of resources (e.g. replacing colors in CSS files)
optionally uploading them to Amazon Cloudfront (well, at least you  
can expect this feature soon – we are using it already)
So you will speed up rendering of your pages while simplifying and  
reducing your code (there’s no need to merge, mount or add  
HeaderContributors manually anymore)!


More on our blog ...
http://techblog.molindo.at/2009/10/wicket-annotation-based-mounting-of-resources.html

... and Wicket Stuff Wiki:
http://wicketstuff.org/confluence/display/STUFFWIKI/wicketstuff-merged-resources

Cheers

-
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: PropertyResolver.MapGetSet does ignore PropertyResolverConverter

2009-10-13 Thread Robin Sander


Forget this post, obviously wicket IDs have to be strings...

On 13.10.2009, at 17:47, Robin Sander wrote:



Hi,

I want to use a Map within a CompoundPropertyModel  
but it seems that String keys are supported only
since MapGetSet.setValue() ignores the given  
PropertyResolverConverter. So my SimpleEnumConverter is not used

an I end up with:
java.lang.ClassCastException: java.lang.String cannot be cast to  
java.lang.Enum

at java.util.EnumMap.put(EnumMap.java:62)
at org.apache.wicket.util.lang.PropertyResolver 
$MapGetSet.setValue(PropertyResolver.java:743)
at org.apache.wicket.util.lang.PropertyResolver 
$ObjectAndGetSetter.setValue(PropertyResolver.java:588)
at org.apache.wicket.util.lang.PropertyResolver.setValue 
(PropertyResolver.java:136)
at org.apache.wicket.model.AbstractPropertyModel.setObject 
(AbstractPropertyModel.java:169)
at org.apache.wicket.Component.setDefaultModelObject 
(Component.java:3052)
at org.apache.wicket.markup.html.form.FormComponent.updateModel 
(FormComponent.java:1168)


Now ListGetSet also ignores PropertyResolverConverter but  
ArrayGetSet and MethodGetAndSet do not, so

is this by Intention or a possible bug?
I know the workaround is easy but I would like to use such a map for  
a group of checkboxes.


Thanks in advance,

Robin.



-
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



PropertyResolver.MapGetSet does ignore PropertyResolverConverter

2009-10-13 Thread Robin Sander


Hi,

I want to use a Map within a CompoundPropertyModel but  
it seems that String keys are supported only
since MapGetSet.setValue() ignores the given  
PropertyResolverConverter. So my SimpleEnumConverter is not used

an I end up with:
 java.lang.ClassCastException: java.lang.String cannot be cast to  
java.lang.Enum

 at java.util.EnumMap.put(EnumMap.java:62)
 at org.apache.wicket.util.lang.PropertyResolver 
$MapGetSet.setValue(PropertyResolver.java:743)
 at org.apache.wicket.util.lang.PropertyResolver 
$ObjectAndGetSetter.setValue(PropertyResolver.java:588)
 at org.apache.wicket.util.lang.PropertyResolver.setValue 
(PropertyResolver.java:136)
 at org.apache.wicket.model.AbstractPropertyModel.setObject 
(AbstractPropertyModel.java:169)
 at org.apache.wicket.Component.setDefaultModelObject 
(Component.java:3052)
 at org.apache.wicket.markup.html.form.FormComponent.updateModel 
(FormComponent.java:1168)


Now ListGetSet also ignores PropertyResolverConverter but ArrayGetSet  
and MethodGetAndSet do not, so

is this by Intention or a possible bug?
I know the workaround is easy but I would like to use such a map for a  
group of checkboxes.


Thanks in advance,

Robin.



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



Re: How to store/load strings shared by many (but not all) pages?

2009-10-05 Thread Robin Sander


Wicket uses a chain of resolvers, by default these are: (see Settings  
class)


 ComponentStringResourceLoader, PackageStringResourceLoader,  
ClassStringResourceLoader and ValidatorStringResourceLoader.


So besides the component specific resource you may define respources  
per package (e.g. 'package_de.properties') and for the
whole application, the latter named like your application class (e.g.  
MyApp.properties)




On Oct 4, 2009, at 05:32, David Chang wrote:

I am reading <> and have this i18n/i10n-related  
question :


Suppose that I have a string that is used on multiple (but NOT ALL)  
pages. One solution is that I can put this string in the property  
files for each page on which the string is used.


Any other better solutions?

Thanks for your input!




-
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: How to use link

2009-08-26 Thread Robin Sander


You have to add a Link instance to the item, for example

 item.add(new BookmarkablePageLink("link", TargetPage.class);

If you want to have a label inside the link add the label to the link  
instead of the item

and use a markup like:

 name



On 26.08.2009, at 12:00, Gerald Fernando wrote:


Hello Friends,
this is my code

add(new ListView("people", p.writeNews("arts"))
   {
   @Override protected void populateItem(ListItem item)
   {
   RSSReader person = (RSSReader)item.getModelObject();

item.add(new Label("title", person.title));  -  
title


item.add(new Label("link", person.link));
corresponding web Address of title
item.add(new Label("description",  
person.description));

description
   }

When i click title that shows that web Page

how to do it


--
Thanks®ards,
Gerald A



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



Re: wicket auth roles example

2009-08-26 Thread Robin Sander


In wicket-examples there is an authentication and authorization app:

http://www.wicket-library.com/wicket-examples/authentication/
http://www.wicket-library.com/wicket-examples/authorization/


On 26.08.2009, at 15:48, Eyal Golan wrote:


Hello,
is there an example, and if so, which, in wicketstuff or somewhere  
else for

Wicket-Auth-Roles?
is it the phone book app?

Thanks,


Eyal Golan
egola...@gmail.com

Visit: http://jvdrums.sourceforge.net/
LinkedIn: http://www.linkedin.com/in/egolan74

P  Save a tree. Please don't print this e-mail unless it's really  
necessary



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



Re: Newbie question: fileupload AJAX progressbar ?

2009-08-20 Thread Robin Sander


Hi,

I'm using Firefox 3.5.2 and the strange thing is that the live demo  
works (progress bar shows progress)
and the same sources copied into my (wicket 1.4) app do not work  
properly. (no progress shown)


That's why I asked for further requirements on the server side. I'm  
using Glassfish V2, maybe the
container is messing things up? I will try it again with the new  
wicket 1.4.1 and then with Tomcat

as a container...


On 20.08.2009, at 03:58, Ashika Umanga Umagiliya wrote:


Hi Robin,

Are you using Safari , I saw in following threads that its not  
working properly with Safari .


http://www.nabble.com/UploadProgressBar-in-firefox-and-ie6-tp24166616p24205091.html
http://www.nabble.com/UploadProgressBar-does-not-work-in-Safari-browser--to21571997.html#a24322943

Regards

Robin Sander wrote:


I've just copied the example upload page from  
http://www.wicket-library.com/wicket-examples/upload/single
into my application with the same result: upload works but the  
progess bar is NOT updated.


So, anything else needed besides overriding 'newWebRequest()' ?
I'm using wicket, wicket-datetime and wicket-extensions, all in  
version 1.4.0.

Do I need another wicket module? Maybe some kind of wicket-ajax ??



On 19.08.2009, at 12:25, Robin Sander wrote:



Hi,

are there any further requirements? I use Wicket 1.4.0, defined  
'newWebRequest' in
my Application class and though I do see a progress bar and the  
upload works perfectly

I do not see any progress! (the bar never changes)
Is the progress automatically reported by the server side or do I  
have to implement

something or add/modify some Javascript?

Robin.


On 19.08.2009, at 09:19, Stefan Lindner wrote:


Hi Ashika,

I pointed yopu tot he documentation because I was not sure if  
using UploadWebRequest has any side effects. Does not seem so.


Stefan

-Ursprüngliche Nachricht-
Von: Ashika Umanga Umagiliya [mailto:auma...@biggjapan.com]
Gesendet: Mittwoch, 19. August 2009 09:10
An: users@wicket.apache.org
Betreff: Re: Newbie question: fileupload AJAX progressbar ?

Thanks Stefan,

That solved my problem.
Since UploadProgreeBar is a component of 'wicket-extensions', i  
refered
documentation at http://www.wicketframework.org/wicket- 
extensions/ which
is kind of updated (versoin 1.2) . I had to download  
documentation for

1.4 from the maven repository.

Thanks again.

Stefan Lindner wrote:

You need

   @Override
   protected WebRequest newWebRequest(HttpServletRequest  
servletRequest) {

   return new UploadWebRequest(servletRequest);
   }

In your Application's class. I think you should definitly read  
the APIdoc (see UploadProgressBar)!


Stefan

-Ursprüngliche Nachricht-
Von: Ashika Umanga Umagiliya [mailto:auma...@biggjapan.com]
Gesendet: Mittwoch, 19. August 2009 07:17
An: users@wicket.apache.org
Betreff: Newbie question: fileupload AJAX progressbar ?

Greetings all,

I am new to Wicket and I used 'UploadProgressBar' to create an  
AJAX
brogressbar for fileupload.(refered example at wicket- 
library.org )

But when uploading a file, eventhough progreebar showed,theres no
activity nor incrementation of the bar
I have posted my code, what could be the problem?

Thanks in advance.




public class UploadPage extends WebPage {

 ///fileupload form
 private class FileUploadForm extends Form{

 private FileUploadField fileuploadField;
 public FileUploadForm(String name){
 super(name);
 setMultiPart(true);
 add(fileuploadField=new FileUploadField("fileInput"));
 setMaxSize(Bytes.gigabytes(4));

 }
 @Override
 protected void onSubmit() {
  final FileUpload upload =  
fileuploadField.getFileUpload();

 if (upload != null)
 {

 File newFile = new File(getUploadFolder(),
upload.getClientFileName());

 try
 {
  newFile.createNewFile();
 upload.writeTo(newFile);

 UploadPage.this.info("saved file: " +
upload.getClientFileName());
 }
 catch (Exception e)
 {
 throw new IllegalStateException("Unable to  
write

file");
 }
 }
 }

 }


 public UploadPage(final PageParameters parameters) {
 final FeedbackPanel uploadFfeedback=new
FeedbackPanel("uploadFeedback");
 add(uploadFfeedback);

 final FileUploadForm fileUploadForm=new
FileUploadForm("ajaxupload");
 fileUploadForm.add(new UploadProgressBar("progress",
fileUploadForm));
 add(fileUploadForm);
 }


 private Folder getUploadFolder(){
 return
((SVRWebApplication)Application.get()).getUploadFolder();
 }


}


-

Re: Newbie question: fileupload AJAX progressbar ?

2009-08-19 Thread Robin Sander


I've just copied the example upload page from  
http://www.wicket-library.com/wicket-examples/upload/single
into my application with the same result: upload works but the progess  
bar is NOT updated.


So, anything else needed besides overriding 'newWebRequest()' ?
I'm using wicket, wicket-datetime and wicket-extensions, all in  
version 1.4.0.

Do I need another wicket module? Maybe some kind of wicket-ajax ??



On 19.08.2009, at 12:25, Robin Sander wrote:



Hi,

are there any further requirements? I use Wicket 1.4.0, defined  
'newWebRequest' in
my Application class and though I do see a progress bar and the  
upload works perfectly

I do not see any progress! (the bar never changes)
Is the progress automatically reported by the server side or do I  
have to implement

something or add/modify some Javascript?

Robin.


On 19.08.2009, at 09:19, Stefan Lindner wrote:


Hi Ashika,

I pointed yopu tot he documentation because I was not sure if using  
UploadWebRequest has any side effects. Does not seem so.


Stefan

-Ursprüngliche Nachricht-
Von: Ashika Umanga Umagiliya [mailto:auma...@biggjapan.com]
Gesendet: Mittwoch, 19. August 2009 09:10
An: users@wicket.apache.org
Betreff: Re: Newbie question: fileupload AJAX progressbar ?

Thanks Stefan,

That solved my problem.
Since UploadProgreeBar is a component of 'wicket-extensions', i  
refered
documentation at http://www.wicketframework.org/wicket-extensions/  
which
is kind of updated (versoin 1.2) . I had to download documentation  
for

1.4 from the maven repository.

Thanks again.

Stefan Lindner wrote:

You need

@Override
	protected WebRequest newWebRequest(HttpServletRequest  
servletRequest) {

return new UploadWebRequest(servletRequest);
}

In your Application's class. I think you should definitly read the  
APIdoc (see UploadProgressBar)!


Stefan

-Ursprüngliche Nachricht-
Von: Ashika Umanga Umagiliya [mailto:auma...@biggjapan.com]
Gesendet: Mittwoch, 19. August 2009 07:17
An: users@wicket.apache.org
Betreff: Newbie question: fileupload AJAX progressbar ?

Greetings all,

I am new to Wicket and I used 'UploadProgressBar' to create an AJAX
brogressbar for fileupload.(refered example at wicket-library.org )
But when uploading a file, eventhough progreebar showed,theres no
activity nor incrementation of the bar
I have posted my code, what could be the problem?

Thanks in advance.




public class UploadPage extends WebPage {

  ///fileupload form
  private class FileUploadForm extends Form{

  private FileUploadField fileuploadField;
  public FileUploadForm(String name){
  super(name);
  setMultiPart(true);
  add(fileuploadField=new FileUploadField("fileInput"));
  setMaxSize(Bytes.gigabytes(4));

  }
  @Override
  protected void onSubmit() {
   final FileUpload upload =  
fileuploadField.getFileUpload();

  if (upload != null)
  {

  File newFile = new File(getUploadFolder(),
upload.getClientFileName());

  try
  {
   newFile.createNewFile();
  upload.writeTo(newFile);

  UploadPage.this.info("saved file: " +
upload.getClientFileName());
  }
  catch (Exception e)
  {
  throw new IllegalStateException("Unable to  
write

file");
  }
  }
  }

  }


  public UploadPage(final PageParameters parameters) {
  final FeedbackPanel uploadFfeedback=new
FeedbackPanel("uploadFeedback");
  add(uploadFfeedback);

  final FileUploadForm fileUploadForm=new
FileUploadForm("ajaxupload");
  fileUploadForm.add(new UploadProgressBar("progress",
fileUploadForm));
  add(fileUploadForm);
  }


  private Folder getUploadFolder(){
  return
((SVRWebApplication)Application.get()).getUploadFolder();
  }


}


-
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





-
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



-
To uns

Re: Newbie question: fileupload AJAX progressbar ?

2009-08-19 Thread Robin Sander


Hi,

are there any further requirements? I use Wicket 1.4.0, defined  
'newWebRequest' in
my Application class and though I do see a progress bar and the upload  
works perfectly

I do not see any progress! (the bar never changes)
Is the progress automatically reported by the server side or do I have  
to implement

something or add/modify some Javascript?

Robin.


On 19.08.2009, at 09:19, Stefan Lindner wrote:


Hi Ashika,

I pointed yopu tot he documentation because I was not sure if using  
UploadWebRequest has any side effects. Does not seem so.


Stefan

-Ursprüngliche Nachricht-
Von: Ashika Umanga Umagiliya [mailto:auma...@biggjapan.com]
Gesendet: Mittwoch, 19. August 2009 09:10
An: users@wicket.apache.org
Betreff: Re: Newbie question: fileupload AJAX progressbar ?

Thanks Stefan,

That solved my problem.
Since UploadProgreeBar is a component of 'wicket-extensions', i  
refered
documentation at http://www.wicketframework.org/wicket-extensions/  
which

is kind of updated (versoin 1.2) . I had to download documentation for
1.4 from the maven repository.

Thanks again.

Stefan Lindner wrote:

You need

@Override
	protected WebRequest newWebRequest(HttpServletRequest  
servletRequest) {

return new UploadWebRequest(servletRequest);
}

In your Application's class. I think you should definitly read the  
APIdoc (see UploadProgressBar)!


Stefan

-Ursprüngliche Nachricht-
Von: Ashika Umanga Umagiliya [mailto:auma...@biggjapan.com]
Gesendet: Mittwoch, 19. August 2009 07:17
An: users@wicket.apache.org
Betreff: Newbie question: fileupload AJAX progressbar ?

Greetings all,

I am new to Wicket and I used 'UploadProgressBar' to create an AJAX
brogressbar for fileupload.(refered example at wicket-library.org )
But when uploading a file, eventhough progreebar showed,theres no
activity nor incrementation of the bar
I have posted my code, what could be the problem?

Thanks in advance.




public class UploadPage extends WebPage {

   ///fileupload form
   private class FileUploadForm extends Form{

   private FileUploadField fileuploadField;
   public FileUploadForm(String name){
   super(name);
   setMultiPart(true);
   add(fileuploadField=new FileUploadField("fileInput"));
   setMaxSize(Bytes.gigabytes(4));

   }
   @Override
   protected void onSubmit() {
final FileUpload upload =  
fileuploadField.getFileUpload();

   if (upload != null)
   {

   File newFile = new File(getUploadFolder(),
upload.getClientFileName());

   try
   {
newFile.createNewFile();
   upload.writeTo(newFile);

   UploadPage.this.info("saved file: " +
upload.getClientFileName());
   }
   catch (Exception e)
   {
   throw new IllegalStateException("Unable to  
write

file");
   }
   }
   }

   }


   public UploadPage(final PageParameters parameters) {
   final FeedbackPanel uploadFfeedback=new
FeedbackPanel("uploadFeedback");
   add(uploadFfeedback);

   final FileUploadForm fileUploadForm=new
FileUploadForm("ajaxupload");
   fileUploadForm.add(new UploadProgressBar("progress",
fileUploadForm));
   add(fileUploadForm);
   }


   private Folder getUploadFolder(){
   return
((SVRWebApplication)Application.get()).getUploadFolder();
   }


}


-
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





-
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



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



Re: DataView/IDataProvider/Detach

2009-08-07 Thread Robin Sander


Hi,

correct me if I'm wrong, Igor, but I thought detach() is used to keep  
the model memory footprint low

*between requests* and Serialization is a total different story.
If I mark a field as transient I don't have to nullify it in detach().
For example using a IDataProvider for pagination:
If I set a (transient) field to null after every request I have to  
initialize it before every request too,
sounds inefficient to me. To re-initialize a transient field I would  
use readObject(ObjectInputStream in)

instead.
If I'm right the following comment in IDetachable is misleading:

/**
	 * Detaches model after use. This is generally used to null out  
transient references that can be

 * re-attached later.
 */
void detach();

What am I missing?

Robin.



On 06.08.2009, at 21:45, Igor Vaynberg wrote:


yep, lazy init is the way to do things. also helps to mark those
fields as transient as an additional safeguard.

-igor

On Thu, Aug 6, 2009 at 12:22 AM, Gabi Kaltman  
wrote:

Hi,

I'm very young on the Wicket planet, so please excuse my simple  
question related to DataView/IDataProvider


My configuration:
1. I use a DataView (MyDataView)
2. I added a PageNavigator to MyDataView
3. I defined a IDataProvider attached to  MyDataView (MyDataProvider)
4. MyDataProvider has a not-serializable field (MyField)
5. MyField is used in the method MyDataProvider.size()
6. I use Wicket 1.4.0

What I do:
1.  In the method MyDataProvider.detach() , I nullify MyField  
(MyField = null)


What happens:
1. When I navigate through pages, I get a NPE in  
MyDataProvider.size() as MyField became null


How I fixed it:
1. I overrode in MyDataView the method getDataProvider(). Didn't  
work. I noticed that this method is never invoked
2. I tested again null in MyDataProvider.size(). If MyField is  
null, I just reinitialize it. It works


My question is if this solution is the optimal one, or there is a  
better one?


Thanks,
kaltman






-
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: Label i18n in 1.4 final

2009-08-04 Thread Robin Sander


Yes, you're right!!
In case of a simple label there seem to be too many name parts for my  
understanding.

So, I always need a last part for the ResourceModel, right?
(like ..)

Imagine a form with many textfields each with a  
SimpleFormComponentLabel and

an additional Label. So I have to define something like:

form.name.label.text
form.name.hint.text
form

and so on in a Page.properties file.
If I use Application.properties only I can ommit the last part so for  
now I will stick

with Application.properties...

thanks!


On 04.08.2009, at 19:12, Sven Meier wrote:


Shouldn't that be:

sidebar.header.header = Sidebar Header!

??

Sven

On Di, 2009-08-04 at 16:53 +0200, Robin Sander wrote:

sidebar.header = Sidebar Header!



-
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: Label i18n in 1.4 final

2009-08-04 Thread Robin Sander


Hi Craig,

yes you're right, this would work but I wanted to get an understanding  
of the algorithm and
tried the examples mentioned in the wiki page. In addition I dont  
don't like find-grained
property-files and at the moment I'm using one big  
Application.properties file with the full
class-name of a component as a prefix (so the keys are changed too  
during

refactoring)



On 04.08.2009, at 18:42, Craig McIlwee wrote:

Have you tried creating a properties file for the panel,  
Sidebar.properties?  By putting the value in your Index.properties  
aren't you kind of breaking encapsulation by adding knowledge of the  
panel's inner workings to the page?


-Original Message-
From: Robin Sander [mailto:robin.san...@gmx.net]
Sent: Tuesday, August 04, 2009 10:54 AM
To: users@wicket.apache.org
Subject: Re: Label i18n in 1.4 final


Hi,

yes, this does work but would interfere with a page-level label called
"header", doesn't it?
That's why the component-path up to the page is used as a prefix, I
thought...


On 04.08.2009, at 16:21, Eyal Golan wrote:


As far as I remember, you need to call the proprty 'header'

header = Sidebar Header!



Eyal Golan
egola...@gmail.com

Visit: http://jvdrums.sourceforge.net/
LinkedIn: http://www.linkedin.com/in/egolan74

P  Save a tree. Please don't print this e-mail unless it's really
necessary


On Tue, Aug 4, 2009 at 5:14 PM, Robin Sander 
wrote:



Hello,

I'm trying to add internationalization to my wicket application  
using

Wicket 1.4 final.
In order to customize labels I don't use wicket:message but use  
Label

subclasses.

So, both the Wiki page "General i18n in Wicket" an Wicket in Action
state
that I may define
a property file for a page, say Index.properties and define any  
label

resource in this file.

So far so good, it seems to work as long as I don't have a label
nested in
a panel or in a form!
Say I have a page Index and a panel Sidebar like this:

public class Sidebar extends Panel {
 public Sidebar(final String id) {
 super(id);
 add(new Label("header", new ResourceModel("header")));
 ...
}
}

public class Index extends WebPage {
 public Index() {
 super();
 add(new Sidebar("sidebar"));
}
}

Now, if I define

sidebar.header = Sidebar Header!

in a file 'Index.properties' a MissingResourceException is thrown.
Does anybody know how to do it right?

regards,

Robin.


-
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




-
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: Label i18n in 1.4 final

2009-08-04 Thread Robin Sander


Hi,

yes, this does work but would interfere with a page-level label called  
"header", doesn't it?
That's why the component-path up to the page is used as a prefix, I  
thought...



On 04.08.2009, at 16:21, Eyal Golan wrote:


As far as I remember, you need to call the proprty 'header'

header = Sidebar Header!



Eyal Golan
egola...@gmail.com

Visit: http://jvdrums.sourceforge.net/
LinkedIn: http://www.linkedin.com/in/egolan74

P  Save a tree. Please don't print this e-mail unless it's really  
necessary



On Tue, Aug 4, 2009 at 5:14 PM, Robin Sander   
wrote:




Hello,

I'm trying to add internationalization to my wicket application using
Wicket 1.4 final.
In order to customize labels I don't use wicket:message but use Label
subclasses.

So, both the Wiki page "General i18n in Wicket" an Wicket in Action  
state

that I may define
a property file for a page, say Index.properties and define any label
resource in this file.

So far so good, it seems to work as long as I don't have a label  
nested in

a panel or in a form!
Say I have a page Index and a panel Sidebar like this:

public class Sidebar extends Panel {
  public Sidebar(final String id) {
  super(id);
  add(new Label("header", new ResourceModel("header")));
  ...
 }
}

public class Index extends WebPage {
  public Index() {
  super();
  add(new Sidebar("sidebar"));
 }
}

Now, if I define

sidebar.header = Sidebar Header!

in a file 'Index.properties' a MissingResourceException is thrown.
Does anybody know how to do it right?

regards,

Robin.


-
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



Label i18n in 1.4 final

2009-08-04 Thread Robin Sander


Hello,

I'm trying to add internationalization to my wicket application using  
Wicket 1.4 final.
In order to customize labels I don't use wicket:message but use Label  
subclasses.


So, both the Wiki page "General i18n in Wicket" an Wicket in Action  
state that I may define
a property file for a page, say Index.properties and define any label  
resource in this file.


So far so good, it seems to work as long as I don't have a label  
nested in a panel or in a form!

Say I have a page Index and a panel Sidebar like this:

public class Sidebar extends Panel {
public Sidebar(final String id) {
super(id);
add(new Label("header", new ResourceModel("header")));
...
   }
}

public class Index extends WebPage {
public Index() {
super();
add(new Sidebar("sidebar"));
   }
}

Now, if I define

sidebar.header = Sidebar Header!

in a file 'Index.properties' a MissingResourceException is thrown.
Does anybody know how to do it right?

regards,

Robin.


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



Re: DynamicWebResource and ajax request

2009-07-09 Thread Robin Sander


I don't know if this is the recommended way, but there is a  
urlFor(ResourceReference) method in Component,
so you can store the (mounted) ResourceReference in the application,  
then access it in the Component which

needs the URL and call urlFor() with the reference.

If any Wicket developer reads this, I think the whole resource/shared  
resource thing needs some clarification.
E.g. is ResourceReference a SharedResourceReference? If yes, why is  
there no method

mount(String, ResourceReference)?

Robin.

On 07.07.2009, at 16:42, Mathias Nilsson wrote:


Hi,

I just need to be clear on some things. When reading the doc on  
Resource it
states that  "Resources themselves do not currently have URLs.  
Instead, they

are referred to by components that have URLs."

Let's say I have created a mypanel that extends panel. I implement  
my own

DynamicWebresource and I make it available by doing
Application 
.get().getSharedResources().add( mypanel.class.getName() , new

MyDynamicResource());

Does this mean that I can make an Ajax request to getPage().urlFor(
mypanel.class.getName() ) and return the getData() of
DynamicWebResource.ResourceState in MyDynamicResource?
The reason why I'm asking is that some browsers does not get the url  
for the

panel.

// Mathias



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



Re: How to use a mounted shared resource as a link resource?

2009-07-09 Thread Robin Sander


To answer my own question in case anybody else has a similiar problem:

There's a urlFor(ResourceReference) method in Component, so store the  
ResourceReference
in the application, then access it in the Component which needs the  
URL and call urlFor().




On 26.06.2009, at 16:21, Robin Sander wrote:



Say, I have an image 'logo.png' in the same package as class  
'StaticScope' and I mount this image

as a shared resource at path 'static/images/logo.png'.
How should I access this resource in other components?

For example:

In MyApplication.init():
 ...
 ResourceReference ref = new ResourceReference(StaticScope.class,  
"logo.png");
 mountSharedResource("static/images/logo.png",  
ref.getSharedResourceKey());

 ...

Fine, now my image is accessible at the mounted path 'http:/// 
static/images/logo.png'.


But if I try to access this resource in Java using  
SharedResource.get(...), for example to use it in a Link,
I always end up with the wrong URL ( something like ? 
wicket:interface=:0:header:logolink:image::IResourceListener::)


Here's my code:

public class Header extends Panel {

 public Header(final String id) {
super(id);
add(new SimpleAttributeModifier("id", "header"));
		BookmarkablePageLink logoLink = new  
BookmarkablePageLink("logolink", HOMEPAGE_CLASS);

// XXX
		Resource resource =  
KuppelboxApplication 
.getInstance().getSharedResources().get(StaticScope.class,  
"logo.png", null, null, true);


logoLink.add(new Image("image", resource));
add(logoLink);
add(new UserPanel("user-panel", Index.class));
}
}

Or should I use "new Image("image", new  
ResourceReference(StaticScope.class, "logo.png"))?

(but then I wonder why SharedResources returns Resource only)
Or should I use wicket:link? Or static HTML code only?


Regards,

Robin.

-
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: Can a RadioChoice display input for null value?

2009-07-03 Thread Robin Sander


To answer my own question in case anybody else has the same problem:

It is not possible out of the box. You have to pass null together with  
the other options to RadioChoice
and then set your own ChoiceRenderer which returns the localized value  
in the same way as

AbstractSingleSelectChoice.getDefaultChoice() does for DropDownChoice.
To achieve this I pass a reference to the component to the renderer  
and then return the localized

value in getDisplayValue(), e.g like this:

String getDisplayValue(Object value) {
  if (value != null) {
 return value.toString();
  } else {
String result =  
component.getLocalizer().getStringIgnoreSettings(component.getId() +  
".nullValid", component, null, null);

if (Strings.isEmpty(result)) {
	result = component.getLocalizer().getString("nullValid", component,  
"");

}
return result;
  }
}

In order to get a pre-selected null value you have to return  
"-1" (AbstractSingleSelectChoice#NO_SELECTION_VALUE)

in getIdValue().

This is kind of a hack for several reasons:
- code from AbstractSingleSelectChoice.getDefaultChoice() is duplicated.
- some magic constants are re-used but unfortunately there are no  
constants in Wicket for them

  (e.g. ".nullValid" or "-1" for the null ID) or they are not public.
- the renderer keeps a reference to the component it is attached to



On 02.07.2009, at 19:30, Robin Sander wrote:



Hello,

is it possible to get RadioChoice behave more like DropDownChoice  
concerning a null value?
Consider a RadioChoice defining a search parameter, e.g. two values  
'male' and 'female' and a third one

meaning "doesn't matter".
With a DropDownChoice I could easily use setNullValid(true) and then  
define a property .nullValid

which is them used for the null value.
Looking into the source it seems that DropDownChoice always adds  
getDefaultChoice() which does the
magic while RadioChoice does not. Can anyone elaborate on this  
topic? Is there a workaround?


Background is that I have dozens of enums with property files for  
localization and a self-written
EnumChoiceRenderer which does the localization. So if I have a  
property of (enum) type Gender
which defines Gender.MALE and Gender.FEMALE I can't easily define a  
special "NULL" value

without modifying the enum.
So the only option I see would be to really pass null to the  
RadioChoice or to define a special
enum (like GenderWithNull) for any enum I want to use in a  
RadioChoice.


regards,

Robin.


-
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



Can a RadioChoice display input for null value?

2009-07-02 Thread Robin Sander


Hello,

is it possible to get RadioChoice behave more like DropDownChoice  
concerning a null value?
Consider a RadioChoice defining a search parameter, e.g. two values  
'male' and 'female' and a third one

meaning "doesn't matter".
With a DropDownChoice I could easily use setNullValid(true) and then  
define a property .nullValid

which is them used for the null value.
Looking into the source it seems that DropDownChoice always adds  
getDefaultChoice() which does the
magic while RadioChoice does not. Can anyone elaborate on this topic?  
Is there a workaround?


Background is that I have dozens of enums with property files for  
localization and a self-written
EnumChoiceRenderer which does the localization. So if I have a  
property of (enum) type Gender
which defines Gender.MALE and Gender.FEMALE I can't easily define a  
special "NULL" value

without modifying the enum.
So the only option I see would be to really pass null to the  
RadioChoice or to define a special

enum (like GenderWithNull) for any enum I want to use in a RadioChoice.

regards,

Robin.


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



How to use a mounted shared resource as a link resource?

2009-06-26 Thread Robin Sander


Say, I have an image 'logo.png' in the same package as class  
'StaticScope' and I mount this image

as a shared resource at path 'static/images/logo.png'.
How should I access this resource in other components?

For example:

In MyApplication.init():
  ...
  ResourceReference ref = new ResourceReference(StaticScope.class,  
"logo.png");
  mountSharedResource("static/images/logo.png",  
ref.getSharedResourceKey());

  ...

Fine, now my image is accessible at the mounted path 'http:/// 
static/images/logo.png'.


But if I try to access this resource in Java using  
SharedResource.get(...), for example to use it in a Link,
I always end up with the wrong URL ( something like ?wicket:interface=: 
0:header:logolink:image::IResourceListener::)


Here's my code:

public class Header extends Panel {

  public Header(final String id) {
super(id);
add(new SimpleAttributeModifier("id", "header"));
		BookmarkablePageLink logoLink = new  
BookmarkablePageLink("logolink", HOMEPAGE_CLASS);

// XXX
		Resource resource =  
KuppelboxApplication 
.getInstance().getSharedResources().get(StaticScope.class, "logo.png",  
null, null, true);


logoLink.add(new Image("image", resource));
add(logoLink);
add(new UserPanel("user-panel", Index.class));
}
}

Or should I use "new Image("image", new  
ResourceReference(StaticScope.class, "logo.png"))?

(but then I wonder why SharedResources returns Resource only)
Or should I use wicket:link? Or static HTML code only?


Regards,

Robin.

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