Re: [Wicket-user] Wicket way of doing (inter-)component updates?

2006-08-22 Thread Andre Matheus
Could you please explain better the option 2?

If do you have an example it could be useful.

Thanks.
___
André Matheus

On 8/21/06, Eelco Hillenius [EMAIL PROTECTED] wrote:
 Basically you have the choice between either:
 1) using observers/ event listeners for notification much like you
 would probably do with swing;
 2) use a hierarchal model that is shared between components so that
 any change in that model is automatically cascaded.

 1) is probably more work and has the danger that it causes a domino
 effect letting you end up with a zillion listeners, but the advantage
 is that you don't need a foreign model and it is more loosely bound.

 My personal preference is usually 2). Not that this model hierarchy
 can be on the actual model objects as well as on the IModels
 themselves.

 Eelco

 -
 Using Tomcat but need to do more? Need to support web services, security?
 Get stuff done quickly with pre-integrated technology to make your job easier
 Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
 http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
 ___
 Wicket-user mailing list
 Wicket-user@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/wicket-user



-- 
__
André Matheus

-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


[Wicket-user] Override RatingPanel Property

2006-08-22 Thread Joe Toth
I can't seem override the resource value in the RatingPanel component.Added rating.simple=Please Rate to my properties file, but its not picking it up. Is there something else I have to do?Thanks
-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] Wicket way of doing (inter-)component updates?

2006-08-22 Thread jan_bar
Hi,

I would like to see some sample too. In my opinion, the hierarchical model
sample should be part of the wicket samples. We can very easy partition our
pages into Panels, Borders and whatever, but what about models? They are not
so easy to use. I think that a set of possible solutions (model - best
practices) used by core Wicket developers may be of immense help.

Thank you, Jan

Andre Matheus [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
Could you please explain better the option 2?

If do you have an example it could be useful.

Thanks.
___
André Matheus

On 8/21/06, Eelco Hillenius [EMAIL PROTECTED] wrote:
 Basically you have the choice between either:
 1) using observers/ event listeners for notification much like you
 would probably do with swing;
 2) use a hierarchal model that is shared between components so that
 any change in that model is automatically cascaded.

 1) is probably more work and has the danger that it causes a domino
 effect letting you end up with a zillion listeners, but the advantage
 is that you don't need a foreign model and it is more loosely bound.

 My personal preference is usually 2). Not that this model hierarchy
 can be on the actual model objects as well as on the IModels
 themselves.

 Eelco

 -
 Using Tomcat but need to do more? Need to support web services, security?
 Get stuff done quickly with pre-integrated technology to make your job
easier
 Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
 http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
 ___
 Wicket-user mailing list
 Wicket-user@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/wicket-user



-- 
__
André Matheus

-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job
easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642




-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] body onload contributors

2006-08-22 Thread Nili Adoram
We have issued bug number 1544413 about this.
However, is there a workaround for this?
Currently, after a few ajax refreshes the onLoad attribute is huge!
Thanks
Nili

Eelco Hillenius wrote:
 I can imagine something like this yes; we probably don't have a nifty
 filter mechanism for onload contribs as we have for header
 contributions. If you could open up an issue for this, we could take a
 look. Thanks,

 Eelco


 On 8/16/06, Nili Adoram [EMAIL PROTECTED] wrote:
   
 Hi,

 I have attached a AjaxSelfUpdatingTimerBehavior to one of the page
 components and discovered that when I navigate from on link to the other
 then the AjaxSelfUpdatingTimerBehavior adds another similar JS statement
 to html body onload and onunload attributes.
 all Links (ExternalLink) point to same page with different parameters.

 Is there anything I can do to stop this behavior?


 Thanks,
 Tomer



 -
 Using Tomcat but need to do more? Need to support web services, security?
 Get stuff done quickly with pre-integrated technology to make your job easier
 Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
 http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
 ___
 Wicket-user mailing list
 Wicket-user@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/wicket-user

 

 -
 Using Tomcat but need to do more? Need to support web services, security?
 Get stuff done quickly with pre-integrated technology to make your job easier
 Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
 http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
 ___
 Wicket-user mailing list
 Wicket-user@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/wicket-user

   

-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] body onload contributors

2006-08-22 Thread Tomer Mevorach
It is not ajax refreshes that makes onload and onunload attributes huge 
but regular links and data sorting.

Regards,
Tomer

Nili Adoram wrote:
 We have issued bug number 1544413 about this.
 However, is there a workaround for this?
 Currently, after a few ajax refreshes the onLoad attribute is huge!
 Thanks
 Nili

 Eelco Hillenius wrote:
   
 I can imagine something like this yes; we probably don't have a nifty
 filter mechanism for onload contribs as we have for header
 contributions. If you could open up an issue for this, we could take a
 look. Thanks,

 Eelco


 On 8/16/06, Nili Adoram [EMAIL PROTECTED] wrote:
   
 
 Hi,

 I have attached a AjaxSelfUpdatingTimerBehavior to one of the page
 components and discovered that when I navigate from on link to the other
 then the AjaxSelfUpdatingTimerBehavior adds another similar JS statement
 to html body onload and onunload attributes.
 all Links (ExternalLink) point to same page with different parameters.

 Is there anything I can do to stop this behavior?


 Thanks,
 Tomer



 -
 Using Tomcat but need to do more? Need to support web services, security?
 Get stuff done quickly with pre-integrated technology to make your job 
 easier
 Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
 http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
 ___
 Wicket-user mailing list
 Wicket-user@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/wicket-user

 
   
 -
 Using Tomcat but need to do more? Need to support web services, security?
 Get stuff done quickly with pre-integrated technology to make your job easier
 Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
 http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
 ___
 Wicket-user mailing list
 Wicket-user@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/wicket-user

   
 

 -
 Using Tomcat but need to do more? Need to support web services, security?
 Get stuff done quickly with pre-integrated technology to make your job easier
 Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
 http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
 ___
 Wicket-user mailing list
 Wicket-user@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/wicket-user

   


-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] Form submit from outside Wicket

2006-08-22 Thread Nili Adoram
But how would the bookmarkable page would know it is supposed to submit 
its form instead of rendering ?

Johan Compagner wrote:
 i would submit to a bookmarkable page yes.
 That would be the easiest thing to do.

 johan


 On 3/29/06, *Sven Meier*  [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] 
 wrote:

 How would you handle a submit of a form that originates from
 outside of
 Wicket?

 Let me explain:

 In many web applications some forms (e.g. 'search a product') are
 replicated on other pages of the same application or even on other
 sites
 of business partners or advertisers.
 For our actionframework-brethren this poses no problem, because an
 action (e.g. a Struts action) can usally be initated with a form post.
 But I don't have a clue how to do something similar in wicket. AFAIK a
 form has to be rendered first, before being able to accept
 incoming data
 on the next request.

 Does somebody have a suggestion for this, something like 'open a page
 with a bookmarkable link and immediately submit its contained form
 with
 the transmitted parameters'?

 Thanks

 Sven


 ---
 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=lnkkid=110944bid=241720dat=121642
 http://sel.as-us.falkag.net/sel?cmd=lnkkid=110944bid=241720dat=121642
 ___
 Wicket-user mailing list
 Wicket-user@lists.sourceforge.net
 mailto:Wicket-user@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/wicket-user



-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] Form submit from outside Wicket

2006-08-22 Thread Frank Bille
Bookmarkable pages has a PageParameters constructor. From these parameters can you get the form values. You would now that it would be a submit because the pageparameters contains the expected values.- Frank
On 8/22/06, Nili Adoram [EMAIL PROTECTED] wrote:
But how would the bookmarkable page would know it is supposed to submitits form instead of rendering ?Johan Compagner wrote: i would submit to a bookmarkable page yes. That would be the easiest thing to do.
 johan On 3/29/06, *Sven Meier*  [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote:
 How would you handle a submit of a form that originates from outside of Wicket? Let me explain: In many web applications some forms (e.g. 'search a product') are
 replicated on other pages of the same application or even on other sites of business partners or advertisers. For our actionframework-brethren this poses no problem, because an
 action (e.g. a Struts action) can usally be initated with a form post. But I don't have a clue how to do something similar in wicket. AFAIK a form has to be rendered first, before being able to accept
 incoming data on the next request. Does somebody have a suggestion for this, something like 'open a page with a bookmarkable link and immediately submit its contained form
 with the transmitted parameters'? Thanks Sven --- 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=lnkkid=110944bid=241720dat=121642 
http://sel.as-us.falkag.net/sel?cmd=lnkkid=110944bid=241720dat=121642 ___ Wicket-user mailing list 
Wicket-user@lists.sourceforge.net mailto:Wicket-user@lists.sourceforge.net 
https://lists.sourceforge.net/lists/listinfo/wicket-user-Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easierDownload IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642___Wicket-user mailing list
Wicket-user@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/wicket-user
-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] Wicket way of doing (inter-)component updates?

2006-08-22 Thread Eelco Hillenius
Take a look at how NewUserWizard of wicket-examples/wizard works. It
uses itself as the model object:

public class NewUserWizard extends WizardNewUserWizard
{
...
private static final ListString allRoles = Arrays.asList(new
String[] { admin, user,
moderator, joker, slacker });

private boolean assignRoles = false;

private User user;

public NewUserWizard(MarkupContainer parent, String id)
{
super(parent, id);

// create a blank user
user = new User();

setModel(new CompoundPropertyModelNewUserWizard(this));
...


Then, later on, that is used like:

  new RequiredTextField(this, user.firstName);
  new RequiredTextField(this, user.lastName);
  new TextField(this, user.department);
  new CheckBox(this, assignRoles);


The point here is that NewUserWizard is used as the compound model
object, nesting the user and assignRoles properties. Instead of
NewUserWizard, we could have any other class to nest those properties,
and instead of a CompoundPropertyModel, we could have just passed the
model in the constructors of the panels that use them. And instead of
relying on one top level model object, we could have used nested
IModel instances:

public class GimmeAll {
  private User user;
  private boolean assignRoles;
  ...
}

public class UserModel extends LoadableDetachableModelUser {

  private final IModelGimmeAll parentModel;

  public UserModel(IModelGimmeAll model) {
this.parentModel = model;
  }

  protected User load() {
GimmeAll o = parentModel.getObject();
return (o != null) ? o.getUser() : null;
  }

  protected void onDetach() {
parentModel.detach();
  }
}

and finally, in 2.0 you can 'force' using the proper model even if it
is not the concrete object yet:

public class SomePanel extends PanelUser {
  public SomePanel(MarkupContainer parent, IModelUser model) {
super(parent, model);
  }
}


Does that help?

Eelco


On 8/22/06, jan_bar [EMAIL PROTECTED] wrote:
 Hi,

 I would like to see some sample too. In my opinion, the hierarchical model
 sample should be part of the wicket samples. We can very easy partition our
 pages into Panels, Borders and whatever, but what about models? They are not
 so easy to use. I think that a set of possible solutions (model - best
 practices) used by core Wicket developers may be of immense help.

 Thank you, Jan

 Andre Matheus [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
 Could you please explain better the option 2?

 If do you have an example it could be useful.

 Thanks.
 ___
 André Matheus

 On 8/21/06, Eelco Hillenius [EMAIL PROTECTED] wrote:
  Basically you have the choice between either:
  1) using observers/ event listeners for notification much like you
  would probably do with swing;
  2) use a hierarchal model that is shared between components so that
  any change in that model is automatically cascaded.
 
  1) is probably more work and has the danger that it causes a domino
  effect letting you end up with a zillion listeners, but the advantage
  is that you don't need a foreign model and it is more loosely bound.
 
  My personal preference is usually 2). Not that this model hierarchy
  can be on the actual model objects as well as on the IModels
  themselves.
 
  Eelco
 
  -
  Using Tomcat but need to do more? Need to support web services, security?
  Get stuff done quickly with pre-integrated technology to make your job
 easier
  Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
  http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
  ___
  Wicket-user mailing list
  Wicket-user@lists.sourceforge.net
  https://lists.sourceforge.net/lists/listinfo/wicket-user
 


 --
 __
 André Matheus

 -
 Using Tomcat but need to do more? Need to support web services, security?
 Get stuff done quickly with pre-integrated technology to make your job
 easier
 Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
 http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642






 -
 Using Tomcat but need to do more? Need to support web services, security?
 Get stuff done quickly with pre-integrated technology to make your job easier
 Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
 http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642

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




-
Using Tomcat but need to do more? Need to support web services, 

Re: [Wicket-user] Wicket way of doing (inter-)component updates?

2006-08-22 Thread jan_bar
Thanks Eelco for your time. I hope I get the intent even if I did not looked
at Wicket 2.0.

The first solution with CompoundPropertyModel is clear, I just hesitate to
use the component id as the model accessor string. But my hesitation can be
solved with BoundCompoundPropertyModel.

The second solutions is interesting albeit more code is needed.

The last remark is not clear to me, I have look into Wicket 2.0 sources.

Thanks again, Jan

Eelco Hillenius [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
Take a look at how NewUserWizard of wicket-examples/wizard works. It
uses itself as the model object:

public class NewUserWizard extends WizardNewUserWizard
{
...
private static final ListString allRoles = Arrays.asList(new
String[] { admin, user,
moderator, joker, slacker });

private boolean assignRoles = false;

private User user;

public NewUserWizard(MarkupContainer parent, String id)
{
super(parent, id);

// create a blank user
user = new User();

setModel(new CompoundPropertyModelNewUserWizard(this));
...


Then, later on, that is used like:

  new RequiredTextField(this, user.firstName);
  new RequiredTextField(this, user.lastName);
  new TextField(this, user.department);
  new CheckBox(this, assignRoles);


The point here is that NewUserWizard is used as the compound model
object, nesting the user and assignRoles properties. Instead of
NewUserWizard, we could have any other class to nest those properties,
and instead of a CompoundPropertyModel, we could have just passed the
model in the constructors of the panels that use them. And instead of
relying on one top level model object, we could have used nested
IModel instances:

public class GimmeAll {
  private User user;
  private boolean assignRoles;
  ...
}

public class UserModel extends LoadableDetachableModelUser {

  private final IModelGimmeAll parentModel;

  public UserModel(IModelGimmeAll model) {
this.parentModel = model;
  }

  protected User load() {
GimmeAll o = parentModel.getObject();
return (o != null) ? o.getUser() : null;
  }

  protected void onDetach() {
parentModel.detach();
  }
}

and finally, in 2.0 you can 'force' using the proper model even if it
is not the concrete object yet:

public class SomePanel extends PanelUser {
  public SomePanel(MarkupContainer parent, IModelUser model) {
super(parent, model);
  }
}


Does that help?

Eelco


On 8/22/06, jan_bar [EMAIL PROTECTED] wrote:
 Hi,

 I would like to see some sample too. In my opinion, the hierarchical model
 sample should be part of the wicket samples. We can very easy partition
our
 pages into Panels, Borders and whatever, but what about models? They are
not
 so easy to use. I think that a set of possible solutions (model - best
 practices) used by core Wicket developers may be of immense help.

 Thank you, Jan

 Andre Matheus [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
 Could you please explain better the option 2?

 If do you have an example it could be useful.

 Thanks.
 ___
 André Matheus

 On 8/21/06, Eelco Hillenius [EMAIL PROTECTED] wrote:
  Basically you have the choice between either:
  1) using observers/ event listeners for notification much like you
  would probably do with swing;
  2) use a hierarchal model that is shared between components so that
  any change in that model is automatically cascaded.
 
  1) is probably more work and has the danger that it causes a domino
  effect letting you end up with a zillion listeners, but the advantage
  is that you don't need a foreign model and it is more loosely bound.
 
  My personal preference is usually 2). Not that this model hierarchy
  can be on the actual model objects as well as on the IModels
  themselves.
 
  Eelco
 

 -
  Using Tomcat but need to do more? Need to support web services,
security?
  Get stuff done quickly with pre-integrated technology to make your job
 easier
  Download IBM WebSphere Application Server v.1.0.1 based on Apache
Geronimo
  http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
  ___
  Wicket-user mailing list
  Wicket-user@lists.sourceforge.net
  https://lists.sourceforge.net/lists/listinfo/wicket-user
 


 --
 __
 André Matheus

 -
 Using Tomcat but need to do more? Need to support web services, security?
 Get stuff done quickly with pre-integrated technology to make your job
 easier
 Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
 http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642






 -
 Using Tomcat but need to do more? Need to support web services, security?
 Get stuff done quickly with pre-integrated technology to make your job
easier
 Download IBM WebSphere Application Server v.1.0.1 based on Apache 

Re: [Wicket-user] Wicket way of doing (inter-)component updates?

2006-08-22 Thread Eelco Hillenius
 The last remark is not clear to me, I have look into Wicket 2.0 sources.

The difference between 1.x and 2.x is that in 2 you can apply generics
to models and components. For example, you can now do this:

public MyComponent(MarkupContainer p, IModelMyType m)

forcing on clients that a model is passed in that returns an object 'MyType'.

In 1.x, you could only do

public MyComponent(MarkupContainer p, IModel m)

which neither forces proper use nor is very readable. So often, if you
need component dependencies to be strong typed, what you would do in
1.x is:

public MyComponent(MarkupContainer p, MyType o)

Working with generics like we now support in 2 has all the flexibility
of working with IModels, but with the additional advantage of strong
typing.

Eelco

* btw, that first argument p is only needed for 2.0, but I kept in in
the example so that it wouldn't distract.

-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


[Wicket-user] best practice for uploading and using content (images) with wicket?

2006-08-22 Thread Sebastian Pflugbeil








Hi Wicket Team and Wicket Mailinglist!



As this is my first post on this list, I would like
to introduce myself. My name is Sebastian and I am working on a university
project, comparing Java web frameworks. As you might guess, my primary topic is
the Wicket framework ;). I am not what one would call a programmer or coder, I guess.
Rather someone familiar with the underling concepts, but sometimes a bit lots
with the actual implementations of a certain language. So please excuse me, if
my questions are stupid ;).



My problem at this moment is the following. I need to
implement a feature in wicket that lets me upload images to a webpage and then
use those images to be displayed on certain pages. It doesnt really
matter if the images are stored on the file system or in a database. I am not looking
for a solution to an explicit problem but rather for a best practice that shows
how the wicket framework supports such a feature.



I have tried to read up on anything I could find addressing
such a feature. But everything I got so far is either way beyond my scope of
understanding, not offering enough to archive the goal or just not working as I
understand it should. 



I have tried to read the example in the wiki (http://www.wicket-wiki.org.uk/wiki/index.php/UploadDownload),
but I can not really follow it. Too many libraries used that are not included
and overall to confusing for a non professional like myself.

I did understand the example for the upload in the
wikiexamples though. No problems writing files to disk or even to database,
following that example code. 



My attempt to store images in the Database is looking
something like this:



To write to the Database, I use this code sniped:



 public
final void onSubmit()

 {

 try

 {

 //
get the content of the upload field

 final
FileUpload upload_image = upload.getFileUpload();

 

 //
create a byte array of the uploaded item

 byte[]
bild = upload_image.getBytes(); 

 

 if(upload_image
!= null)

 {

 
*write byte[] to database* 

 }

 }

 catch
(Exception e) { }

 }



So far so good. Got my byte array stored. The source
file is a jpeg image. I am not sure if I miss some kind cast here to let the
system know what *sort* of byte array it should use.



When I try to retrieve the image from the database, I
use the following code:



 public
ResourceReference getImage()

 {

 return
new ResourceReference(some.class, bild)

 {

 public
BufferedDynamicImageResource newResource() 

 {

 try

 {

// get
the byte[] from DB

 byte[]
bild = a.getBild();

 

// create
a buffered image template

 BufferedDynamicImageResource resource = new
BufferedDynamicImageResource();

 BufferedImage
image = new BufferedImage(200, 200, BufferedImage.TYPE_INT_RGB);

 

//
transform the byte[] back to an image (does it work that way? How does

//
java know it was a jpeg before and not a gif for example?)

 java.awt.Image
i = Toolkit.getDefaultToolkit().createImage(bild);

 

 //
convert image to buffered image

 image.getGraphics().drawImage(i,
0, 0, null);

 

 Graphics
g = image.getGraphics();

 g.drawImage(i,
0, 0, null);

 g.dispose();

 

//
return the image

 resource.setImage(image);

 return
resource;

 }

 catch
(Exception e) { }

 }

 };

 }



This leads to a black box in the place my image is
supposed to be. So I guess somewhere along the way I lose my image information.
My best guess is, that the problem lies in the image conversion. Jpeg isnt
a java.awt.image, I suppose.



But still leaves the question, does wicket offer
anything more to me to help me here? To make things (even) simpler for me?





The next attempt I took was storing images on the
file system. This went pretty well, as it pretty much is covered by the upload
example from the wicket examples. I was able to put the files in pretty much
any directory I liked, following that code. The problems started once again,
when I tried to retrieve and reuse the stored data. In the past I did a bit of PHP
programming and was used to just store my things anywhere on the web server as
a file and access them again via URL. This doesnt really work for me in the
java world (using jboss application server, ejb3, wicket), as the resources are
stored in archives and not easily written to archives at runtime (at least to
my current knowledge  please correct me if wicket offers a way to do
such a thing).

I understand that wicket uses resource references to
stream resources not in the actual environment of the core application.
But I cannot seem to get that concept working correctly. I guess, my closest
attempt to reference a resource outside an archive would be this one: 





 java.io.File
f = new java.io.File(d:/someimage.jpg);

 File
ff = new File(f);

 

 FileResourceStream
frs = new FileResourceStream(ff);



 ResourceStreamRequestTarget
resource = new ResourceStreamRequestTarget(frs, frs.getContentType());

 

 String
url = "">

 

 WebMarkupContainer
bild = new WebMarkupContainer(bild);

 add(bild);

Re: [Wicket-user] best practice for uploading and using content (images) with wicket?

2006-08-22 Thread Eelco Hillenius
Hi,

I haven't read through your whole email, but the cdapp example in
wicket-contrib-examples which you can find in the wicket-stuff
repository has functionality for uploading an image (edit details of a
cd), which is then stored in the database. That image is then
displayed as a thumbnail and the full image is displayed in a popup
when you click on the image.

I suggest you check that example out and see whether that helps you.

Rgds,

Eelco

-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] best practice for uploading and using content (images) with wicket?

2006-08-22 Thread Igor Vaynberg
your problem is not retreiving the data from the db - it is the weird stuff you try to do when stream it back to the browser. why all the awt image stuff? all you have to do is read the byte array from the db and stream it back to the browser.
here is some pseudo codeadd(new Image(myimage) { Resource getResource() { return new ByteArrayResource(getBytesFromDb()); }}img wicket:id=myimage width=200 height=200/
if you really want to resize the image to 200x200 before storing it in the db or creating a thumbnail then i would look over that wiki example and extract the resizing logic - but if all you want to do is stream it back then the above will do.
-IgorOn 8/22/06, Sebastian Pflugbeil [EMAIL PROTECTED]
 wrote:












Hi Wicket Team and Wicket Mailinglist!



As this is my first post on this list, I would like
to introduce myself. My name is Sebastian and I am working on a university
project, comparing Java web frameworks. As you might guess, my primary topic is
the Wicket framework ;). I am not what one would call a programmer or coder, I guess.
Rather someone familiar with the underling concepts, but sometimes a bit lots
with the actual implementations of a certain language. So please excuse me, if
my questions are stupid ;).



My problem at this moment is the following. I need to
implement a feature in wicket that lets me upload images to a webpage and then
use those images to be displayed on certain pages. It doesn't really
matter if the images are stored on the file system or in a database. I am not looking
for a solution to an explicit problem but rather for a best practice that shows
how the wicket framework supports such a feature.



I have tried to read up on anything I could find addressing
such a feature. But everything I got so far is either way beyond my scope of
understanding, not offering enough to archive the goal or just not working as I
understand it should. 



I have tried to read the example in the wiki (
http://www.wicket-wiki.org.uk/wiki/index.php/
UploadDownload),
but I can not really follow it. Too many libraries used that are not included
and overall to confusing for a non professional like myself.

I did understand the example for the upload in the
wikiexamples though. No problems writing files to disk or even to database,
following that example code. 



My attempt to store images in the Database is looking
something like this:



To write to the Database, I use this code sniped:



 public
final void onSubmit()

 {

 try

 {

 //
get the content of the upload field

 final
FileUpload upload_image = upload.getFileUpload();

 

 //
create a byte array of the uploaded item

 byte[]
bild = upload_image.getBytes(); 

 

 if(upload_image
!= null)

 {

 
*write byte[] to database* 

 }

 }

 catch
(Exception e) { }

 }



So far so good. Got my byte array stored. The source
file is a jpeg image. I am not sure if I miss some kind cast here to let the
system know what *sort* of byte array it should use.



When I try to retrieve the image from the database, I
use the following code:



 public
ResourceReference getImage()

 {

 return
new ResourceReference(some.class, bild)

 {

 public
BufferedDynamicImageResource newResource() 

 {

 try

 {

// get
the byte[] from DB

 byte[]
bild = a.getBild();

 

// create
a buffered image template

 BufferedDynamicImageResource resource = new
BufferedDynamicImageResource();

 BufferedImage
image = new BufferedImage(200, 200, BufferedImage.TYPE_INT_RGB);

 

//
transform the byte[] back to an image (does it work that way? How does

//
java know it was a jpeg before and not a gif for example?)

 java.awt.Image
i = Toolkit.getDefaultToolkit().createImage(bild);

 

 //
convert image to buffered image

 image.getGraphics().drawImage(i,
0, 0, null);

 

 Graphics
g = image.getGraphics();

 g.drawImage(i,
0, 0, null);

 g.dispose();

 

//
return the image

 resource.setImage(image);

 return
resource;

 }

 catch
(Exception e) { }

 }

 };

 }



This leads to a black box in the place my image is
supposed to be. So I guess somewhere along the way I lose my image information.
My best guess is, that the problem lies in the image conversion. Jpeg isn't
a java.awt.image, I suppose.



But still leaves the question, does wicket offer
anything more to me to help me here? To make things (even) simpler for me?





The next attempt I took was storing images on the
file system. This went pretty well, as it pretty much is covered by the upload
example from the wicket examples. I was able to put the files in pretty much
any directory I liked, following that code. The problems started once again,
when I tried to retrieve and reuse the stored data. In the past I did a bit of PHP
programming and was used to just store my things anywhere on the web server as
a file and access them again via URL. This doesn't really work for me in the
java world (using jboss application server, ejb3, wicket), as the resources are
stored in archives and not easily written to 

Re: [Wicket-user] How to link to dynamic downloads in Wicket app?

2006-08-22 Thread Eelco Hillenius
You could check out wicket-examples/captcha (wicket.examples.captcha)
or wicket-contrib-jasperreports (in the wicket-stuff repo).

Eelco


On 8/22/06, spencer.c [EMAIL PROTECTED] wrote:

 Hello all.  I'm coming from a Tapestry background, and I'm trying to
 determine some similarities/differences between the two frameworks.  I think
 I have my head around the basic application/page flow, but I have a question
 regarding how I should plan to intergrate a dynamic download provider.

 Example: A report generator which generates a pdf on the fly based upon
 database records that were selected from a Wicket page.  How would I go
 about constructing this?  Obviously I could just have a servlet and
 construct the entire URL manually and link to it that way, but that isn't
 very OO, and is not very elegant.  Tapestry has services which you can
 instantiate and assign member variables to directly in you page's event
 handler.  Is there an analagous feature in Wicket?  Or would you just
 override some base page, even though it wouldn't be returning markup?

 Thoughts on this are greatly appreciated.

 Thanks in advance!

 Spencer



 --
 View this message in context: 
 http://www.nabble.com/How-to-link-to-dynamic-downloads-in-Wicket-app--tf2149647.html#a5936134
 Sent from the Wicket - User forum at Nabble.com.


 -
 Using Tomcat but need to do more? Need to support web services, security?
 Get stuff done quickly with pre-integrated technology to make your job easier
 Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
 http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
 ___
 Wicket-user mailing list
 Wicket-user@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/wicket-user


-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


[Wicket-user] How to link to dynamic downloads in Wicket app?

2006-08-22 Thread spencer.c

Hello all.  I'm coming from a Tapestry background, and I'm trying to
determine some similarities/differences between the two frameworks.  I think
I have my head around the basic application/page flow, but I have a question
regarding how I should plan to intergrate a dynamic download provider.

Example: A report generator which generates a pdf on the fly based upon
database records that were selected from a Wicket page.  How would I go
about constructing this?  Obviously I could just have a servlet and
construct the entire URL manually and link to it that way, but that isn't
very OO, and is not very elegant.  Tapestry has services which you can
instantiate and assign member variables to directly in you page's event
handler.  Is there an analagous feature in Wicket?  Or would you just
override some base page, even though it wouldn't be returning markup?

Thoughts on this are greatly appreciated.

Thanks in advance!

Spencer



-- 
View this message in context: 
http://www.nabble.com/How-to-link-to-dynamic-downloads-in-Wicket-app--tf2149647.html#a5936134
Sent from the Wicket - User forum at Nabble.com.


-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] How to link to dynamic downloads in Wicket app?

2006-08-22 Thread Igor Vaynberg
the closest you can get to tapestry is a shared dynamic resource. you pass params much the same way - get a resource ref of the dynamic resource - construct a url for it using urlfor(resourceref) and then append any params you want - the resource then reads these params from the Request object. this is useful in situations where you need to feed data to the tags - like src attr of an img tag. there is a wiki article [1] (although somewhat convoluted with nonwicket stuff because it shows thumbnailing) that shows how to do this. here is the email thread with the discussion about the article and some other download related stuff [2].
another approach is to just stream the data out into the browser as a response to onclick or what not. this is useful when you want to create a download link. check out DownloadLink - it works with a file - but the concept can be easily generalized to retrieve the data from anywhere else. there is also a thread here [3] 
[1] http://www.wicket-wiki.org.uk/wiki/index.php/UploadDownload[2] 
http://www.nabble.com/Image-upload-tf1487150.html#a4194065[3] http://www.nabble.com/Stream-Excel-to-the-client-tf1955606.html#a5363673
hope this gets you started-IgorOn 8/22/06, spencer.c [EMAIL PROTECTED]
 wrote:Hello all.I'm coming from a Tapestry background, and I'm trying to
determine some similarities/differences between the two frameworks.I thinkI have my head around the basic application/page flow, but I have a questionregarding how I should plan to intergrate a dynamic download provider.
Example: A report generator which generates a pdf on the fly based upondatabase records that were selected from a Wicket page.How would I goabout constructing this?Obviously I could just have a servlet and
construct the entire URL manually and link to it that way, but that isn'tvery OO, and is not very elegant.Tapestry has services which you caninstantiate and assign member variables to directly in you page's event
handler.Is there an analagous feature in Wicket?Or would you justoverride some base page, even though it wouldn't be returning markup?Thoughts on this are greatly appreciated.Thanks in advance!
Spencer--View this message in context: http://www.nabble.com/How-to-link-to-dynamic-downloads-in-Wicket-app--tf2149647.html#a5936134
Sent from the Wicket - User forum at Nabble.com.-Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easierDownload IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642___Wicket-user mailing list
Wicket-user@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/wicket-user
-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] Form submit from outside Wicket

2006-08-22 Thread Nili Adoram
But then I would not have the Form.process() method called with all its 
benefits (form validation etc).
Is it valid to invoke it from page constructor?

Frank Bille wrote:
 Bookmarkable pages has a PageParameters constructor. From these 
 parameters can you get the form values. You would now that it would be 
 a submit because the pageparameters contains the expected values.

 - Frank


 On 8/22/06, *Nili Adoram* [EMAIL PROTECTED] 
 mailto:[EMAIL PROTECTED] wrote:

 But how would the bookmarkable page would know it is supposed to
 submit
 its form instead of rendering ?

 Johan Compagner wrote:
  i would submit to a bookmarkable page yes.
  That would be the easiest thing to do.
 
  johan
 
 
  On 3/29/06, *Sven Meier*  [EMAIL PROTECTED]
 mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED]
 mailto:[EMAIL PROTECTED]
  wrote:
 
  How would you handle a submit of a form that originates from
  outside of
  Wicket?
 
  Let me explain:
 
  In many web applications some forms (e.g. 'search a
 product') are
  replicated on other pages of the same application or even on
 other
  sites
  of business partners or advertisers.
  For our actionframework-brethren this poses no problem,
 because an
  action (e.g. a Struts action) can usally be initated with a
 form post.
  But I don't have a clue how to do something similar in
 wicket. AFAIK a
  form has to be rendered first, before being able to accept
  incoming data
  on the next request.
 
  Does somebody have a suggestion for this, something like
 'open a page
  with a bookmarkable link and immediately submit its
 contained form
  with
  the transmitted parameters'?
 
  Thanks
 
  Sven
 
 
  ---
  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=lnkkid=110944bid=241720dat=121642
 http://sel.as-us.falkag.net/sel?cmd=lnkkid=110944bid=241720dat=121642
  
 http://sel.as-us.falkag.net/sel?cmd=lnkkid=110944bid=241720dat=121642
 
 http://sel.as-us.falkag.net/sel?cmd=lnkkid=110944bid=241720dat=121642
  ___
  Wicket-user mailing list
  Wicket-user@lists.sourceforge.net
 mailto:Wicket-user@lists.sourceforge.net
  mailto:Wicket-user@lists.sourceforge.net
 mailto:Wicket-user@lists.sourceforge.net
  https://lists.sourceforge.net/lists/listinfo/wicket-user
 
 

 -
 Using Tomcat but need to do more? Need to support web services,
 security?
 Get stuff done quickly with pre-integrated technology to make your
 job easier
 Download IBM WebSphere Application Server v.1.0.1 based on Apache
 Geronimo
 http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
 http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
 ___
 Wicket-user mailing list
 Wicket-user@lists.sourceforge.net
 mailto:Wicket-user@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/wicket-user


 

 -
 Using Tomcat but need to do more? Need to support web services, security?
 Get stuff done quickly with pre-integrated technology to make your job easier
 Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
 http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
 

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

-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


[Wicket-user] trying to initialize wickets date picker with server time

2006-08-22 Thread Tomer Mevorach
hi,

I have a DatePicker in my application and it works fine when its 
initialized with client machine time.
I have problems initializing it with server time.
in order to initialize it with server time i use the following 
DatePickerSettings and DateConverter:


 private static final DateFormat dateFormat = new 
SimpleDateFormat(MM/dd/ HH:mm);

  private static final DatePickerSettings dateSettings = new 
DatePickerSettings() {

public ResourceReference getLanguage(Locale currentLocale) {
return DatePickerComponentInitializer.getLanguage(Locale.US);
}

@Override
public String toScript(Locale locale, String format) {
StringBuffer script = new StringBuffer(super.toScript(locale,
format));
//init date picker with server time
int last = script.length() - 1;
if (',' != script.charAt(last)) {
script.append(,);
}
script.append(\n\tdate : \ + dateFormat.format(new 
Date()) + \);
return script.toString();
}
};

private static final DateConverter dateConverter = new DateConverter() {

public DateFormat getDateFormat(Locale locale) {
return super.getDateFormat(Locale.US);
}
};

static {
dateSettings.setShowsTime(true);
dateSettings.setTimeFormat(24);
dateSettings.setWeekNumbers(false);
dateConverter.setDateFormat(Locale.US, dateFormat);
}

Here is the rendered JS:

Calendar.setup(
{
inputField : 
6:provisioningForm:startDateType:startDateTypes:1:startDate,
button : 
6:provisioningForm:startDateType:startDateTypes:1:startDatePicker:trigger,
weekNumbers : false,
showsTime : true,
timeFormat : 24,
ifFormat : %m/%d/%Y %H:%M,
date : 08/22/2006 19:06
});


Can anyone please tell my what is it that I'm doing wrong because the 
calendar keeps being initialized with client time.

Regards,
Tomer




-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user