isVisible Problem

2008-09-25 Thread Markus Haspl
hi,

i have a WebPage with a lot of Panels on it. Each Panel overrides the
isVisible() method because not every Panel should be displayed on the page.
The Problem is: the constructor of each Panel (also which aren't visible) is
called and i have a lot of load on the server. So i tried to make a init()
method (add's all components to the panel) wich is only called when
isVisible==true, but then i get the errors that it couldn't find the
components on panelXX.

thanks
markus


Re: isVisible Problem

2008-09-25 Thread Markus Haspl
thank you eric! i will change the Overrides.



On Thu, Sep 25, 2008 at 5:09 PM, Erik van Oosten [EMAIL PROTECTED]wrote:

 Overriding isVisible can be quite evil. The problem is that it is called
 also in the detach phase. When isVisible depends on the model, your model is
 often reloaded!

 There are 2 solutions:
 - within method isVisible cache the result, clear the cache in the
 onDetach.
 - (recommended) don't override isVisible but do:

 @Override void onBeforeRender() {
  setVisible(.);
 }
 @Override boolean callOnBeforeRenderIfNotVisible() {
  return true;
 }

 Regards,
   Erik.


 Markus Haspl wrote:

 hi,

 i have a WebPage with a lot of Panels on it. Each Panel overrides the
 isVisible() method because not every Panel should be displayed on the
 page.
 The Problem is: the constructor of each Panel (also which aren't visible)
 is
 called and i have a lot of load on the server. So i tried to make a init()
 method (add's all components to the panel) wich is only called when
 isVisible==true, but then i get the errors that it couldn't find the
 components on panelXX.

 thanks
 markus




 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




Re: Dynamic PageExpiredPage

2008-09-23 Thread Markus Haspl
On Mon, Sep 22, 2008 at 6:04 PM, Justin Morgan - Logic Sector 
[EMAIL PROTECTED] wrote:

 Create a custom Wicket session subclass that holds your portal:

 public class MySession extends WebSession {
private Portal  _portal;
public MySession(Request request) {
super(request);
LOGGER.debug(Instantiated);
_portal = new Portal();
}
public Portal getPortal() { return _portal; }
public void setPortal(Portal portal) { _portal = portal; }
 }

 Somewhere in your normal page:
 ((MySession) getSession()).setPortal(myPortal);

 Somewhere in your PageExpiredPage:
 Portal myPortal = ((MySession) getSession()).getPortal();

 In your Wicket Application subclass:
/** @see org.apache.wicket.Application#newSession(Request, Response) */
@Override
public Session newSession(Request request, Response response) {
return new MySession(request);
}

 Best regards,

 Justin


Thanks! But i thought that the Session will be invalide when the PageExpired
Error comes? Isn't that true? If not so, than your approach will be very
fine.


Re: Dynamic PageExpiredPage

2008-09-23 Thread Markus Haspl
hi martijn,

your tipp with the cookie works! thank you!
markus

On Tue, Sep 23, 2008 at 10:19 AM, Martijn Dashorst 
[EMAIL PROTECTED] wrote:

 In your case I would set a client side cookie that stores the portal
 id. This way you can identify which portal the user was visiting and
 make your PageExpiredPage customized.

 Martijn

 On Tue, Sep 23, 2008 at 10:00 AM, Markus Haspl [EMAIL PROTECTED] wrote:
  On Mon, Sep 22, 2008 at 6:04 PM, Justin Morgan - Logic Sector 
  [EMAIL PROTECTED] wrote:
 
  Create a custom Wicket session subclass that holds your portal:
 
  public class MySession extends WebSession {
 private Portal  _portal;
 public MySession(Request request) {
 super(request);
 LOGGER.debug(Instantiated);
 _portal = new Portal();
 }
 public Portal getPortal() { return _portal; }
 public void setPortal(Portal portal) { _portal = portal; }
  }
 
  Somewhere in your normal page:
  ((MySession) getSession()).setPortal(myPortal);
 
  Somewhere in your PageExpiredPage:
  Portal myPortal = ((MySession) getSession()).getPortal();
 
  In your Wicket Application subclass:
 /** @see org.apache.wicket.Application#newSession(Request, Response)
 */
 @Override
 public Session newSession(Request request, Response response) {
 return new MySession(request);
 }
 
  Best regards,
 
  Justin
 
 
  Thanks! But i thought that the Session will be invalide when the
 PageExpired
  Error comes? Isn't that true? If not so, than your approach will be very
  fine.
 



 --
 Become a Wicket expert, learn from the best: http://wicketinaction.com
 Apache Wicket 1.3.4 is released
 Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




Dynamic PageExpiredPage

2008-09-22 Thread Markus Haspl
hi,

i've searched the mailing List and the docs but i didn't find a solution for
my problem. I need a custom dynamic PageExpiredErrorPage. I don't know how
to make this because i only see the method:
getApplicationSettings().setPageExpiredErrorPage(Page.class); In the
Page.class i can't work with the PageParameters, so i can't make it dynamic.

thanks
markus


Re: Dynamic PageExpiredPage

2008-09-22 Thread Markus Haspl
On Mon, Sep 22, 2008 at 3:48 PM, Uwe Schäfer [EMAIL PROTECTED]wrote:

 Markus Haspl schrieb:

  getApplicationSettings().setPageExpiredErrorPage(Page.class); In the
 Page.class i can't work with the PageParameters, so i can't make it
 dynamic.


 what kind of data would you like to pass to it, and - more important -
 where could you possibly get it from ?



i have a PageParameter (portalId) which indicates on which Portal the User
is on. In the database there are a lot of portals, every portal has it's own
users, pages and so on. So, every portal should have its own
PageExpiredErrorPage.


Save CSS/Stylesheet in Database

2008-08-26 Thread Markus Haspl
hi,

i want to save all the CSS Data for each component in the database. That's
no problem, i save the key and values for the component in a table. But, i
don't know how i can provide the Page and the components the CSS
Information. Is there an easy way to have a complete dynamic Stylesheet
which gets the Data from the database?

thanks
markus


Re: Save CSS/Stylesheet in Database

2008-08-26 Thread Markus Haspl
because every component has his own css styles, but the users (registered
users in the database) should change the look  feel of their own page.



On Tue, Aug 26, 2008 at 1:53 PM, Michael Sparer [EMAIL PROTECTED]wrote:


 why do you want to do this? why not using HeaderContributors and css files
 analog to your html files?


 Markus Haspl wrote:
 
  hi,
 
  i want to save all the CSS Data for each component in the database.
 That's
  no problem, i save the key and values for the component in a table. But,
 i
  don't know how i can provide the Page and the components the CSS
  Information. Is there an easy way to have a complete dynamic Stylesheet
  which gets the Data from the database?
 
  thanks
  markus
 
 


 -
 Michael Sparer
 http://talk-on-tech.blogspot.com
 --
 View this message in context:
 http://www.nabble.com/Save-CSS-Stylesheet-in-Database-tp19159504p19160485.html
 Sent from the Wicket - User mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




Re: ListView in Forms

2008-08-11 Thread Markus Haspl
hi,

thanks. this works :-)

avajon

On Sat, Aug 9, 2008 at 1:11 AM, brian.diekelman [EMAIL PROTECTED] wrote:



 There are a few things going on here... try this and see if it does what
 you
 want it to do.  If so reply back and I'll explain what the underlying issue
 was:

 TextField propertiesName = new TextField(name,new
 PropertyModel(pluginProperties, name));
 TextField propertiesValue = new TextField(value,new
 PropertyModel(pluginProperties, value));
 CheckBox propertiesDefault = new CheckBox(defaultProperty,new
 PropertyModel(pluginProperties, defaultProperty));


 Markus Haspl wrote:
 
  no, there aren't any errors.
 
  but i don't understand why i have to use propertiesName.getModelObject();
  in
  the onSubmit() method. Because there may be hundrets of propertiesName in
  the ListView/Form.
 
  Would it be better to make a Forms in a ListView? But then i need for
  every
  Form a submit-button. that wouldn't be so nice...
 
  thanks
 
 
 

 --
 View this message in context:
 http://www.nabble.com/ListView-in-Forms-tp18852263p18900382.html
 Sent from the Wicket - User mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




Re: ListView in Forms

2008-08-07 Thread Markus Haspl
no, there aren't any errors.

but i don't understand why i have to use propertiesName.getModelObject(); in
the onSubmit() method. Because there may be hundrets of propertiesName in
the ListView/Form.

Would it be better to make a Forms in a ListView? But then i need for every
Form a submit-button. that wouldn't be so nice...

thanks

On Wed, Aug 6, 2008 at 7:01 PM, Igor Vaynberg [EMAIL PROTECTED]wrote:

 if there are no errors then you are not using your models properly

  TextField propertiesName = new TextField(name,new
 Model(pluginProperties.getName()));

 to get a value back with a model like that you would have to call
 propertiesName.getModelObject()

 -igor

 On Wed, Aug 6, 2008 at 8:27 AM, Markus Haspl [EMAIL PROTECTED] wrote:
  there are no valiation errors. with info() i get the old values.
   info(+property.getName()+: +property.getValue()+ ==
  +property.isDefaultProperty());
 
 
  On Wed, Aug 6, 2008 at 5:03 PM, Igor Vaynberg [EMAIL PROTECTED]
 wrote:
 
  add a feedbackpanel and see if there are any validation errors
 
  -igor
 
  On Wed, Aug 6, 2008 at 7:19 AM, Markus Haspl [EMAIL PROTECTED] wrote:
   hi,
  
   first, i'm a very newbie to wicket... I want to add a ListView in a
 Form.
   The ListView has two Texfields and one Checkbox each row. When i
 submit
  the
   form the values are still the old ones.
  
   here the code:
  
   private class InputForm extends Form {
  
  
  
IModel pluginPropertiesModel;
  
public InputForm(String id, IPlugin plugin){
  super(id);
  
  
  
  final IPlugin Iplugin = plugin;
  
  pluginPropertiesModel = new LoadableDetachableModel(){
  public Object load()
  {
  log.debug(load the Model);
  Iplugin.loadPluginProperties();
  return pluginProperties;
  }
  };
  
  ListView propertiesList = new ListView(pluginRepeater,
   pluginPropertiesModel) {
  
  @Override
  public void populateItem(ListItem item)
  {
  PluginProperties pluginProperties =
   (PluginProperties)item.getModelObject();
  TextField propertiesName = new TextField(name,new
   Model(pluginProperties.getName()));
  TextField propertiesValue = new
 TextField(value,new
   Model(pluginProperties.getValue()));
  CheckBox propertiesDefault = new
   CheckBox(defaultProperty,new
  Model(pluginProperties.isDefaultProperty()));
  item.add(propertiesName);
  item.add(propertiesValue);
  item.add(propertiesDefault);
  }
  };
  propertiesList.setReuseItems(true);
  add(propertiesList);
  
  add(new Button(saveButton));
  
  
  }
  
  public void onSubmit()
  {
  ListPluginProperties pluginProperties =
   (ListPluginProperties)pluginPropertiesModel.getObject();
  for(PluginProperties property:pluginProperties){
  info(+property.getName()+: +property.getValue()+
 ==
   +property.isDefaultProperty());
  log.debug(+property.getName()+:
 +property.getValue()+
   == +property.isDefaultProperty());
  }
  
  
  
  
  }
  }
  
  
   thanks in advance
   markus
  
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




ListView in Forms

2008-08-06 Thread Markus Haspl
hi,

first, i'm a very newbie to wicket... I want to add a ListView in a Form.
The ListView has two Texfields and one Checkbox each row. When i submit the
form the values are still the old ones.

here the code:

private class InputForm extends Form {



 IModel pluginPropertiesModel;

 public InputForm(String id, IPlugin plugin){
super(id);



final IPlugin Iplugin = plugin;

pluginPropertiesModel = new LoadableDetachableModel(){
public Object load()
{
log.debug(load the Model);
Iplugin.loadPluginProperties();
return pluginProperties;
}
};

ListView propertiesList = new ListView(pluginRepeater,
pluginPropertiesModel) {

@Override
public void populateItem(ListItem item)
{
PluginProperties pluginProperties =
(PluginProperties)item.getModelObject();
TextField propertiesName = new TextField(name,new
Model(pluginProperties.getName()));
TextField propertiesValue = new TextField(value,new
Model(pluginProperties.getValue()));
CheckBox propertiesDefault = new
CheckBox(defaultProperty,new Model(pluginProperties.isDefaultProperty()));
item.add(propertiesName);
item.add(propertiesValue);
item.add(propertiesDefault);
}
};
propertiesList.setReuseItems(true);
add(propertiesList);

add(new Button(saveButton));


}

public void onSubmit()
{
ListPluginProperties pluginProperties =
(ListPluginProperties)pluginPropertiesModel.getObject();
for(PluginProperties property:pluginProperties){
info(+property.getName()+: +property.getValue()+ ==
+property.isDefaultProperty());
log.debug(+property.getName()+: +property.getValue()+
== +property.isDefaultProperty());
}




}
}


thanks in advance
markus


Re: ListView in Forms

2008-08-06 Thread Markus Haspl
there are no valiation errors. with info() i get the old values.
 info(+property.getName()+: +property.getValue()+ ==
+property.isDefaultProperty());


On Wed, Aug 6, 2008 at 5:03 PM, Igor Vaynberg [EMAIL PROTECTED]wrote:

 add a feedbackpanel and see if there are any validation errors

 -igor

 On Wed, Aug 6, 2008 at 7:19 AM, Markus Haspl [EMAIL PROTECTED] wrote:
  hi,
 
  first, i'm a very newbie to wicket... I want to add a ListView in a Form.
  The ListView has two Texfields and one Checkbox each row. When i submit
 the
  form the values are still the old ones.
 
  here the code:
 
  private class InputForm extends Form {
 
 
 
   IModel pluginPropertiesModel;
 
   public InputForm(String id, IPlugin plugin){
 super(id);
 
 
 
 final IPlugin Iplugin = plugin;
 
 pluginPropertiesModel = new LoadableDetachableModel(){
 public Object load()
 {
 log.debug(load the Model);
 Iplugin.loadPluginProperties();
 return pluginProperties;
 }
 };
 
 ListView propertiesList = new ListView(pluginRepeater,
  pluginPropertiesModel) {
 
 @Override
 public void populateItem(ListItem item)
 {
 PluginProperties pluginProperties =
  (PluginProperties)item.getModelObject();
 TextField propertiesName = new TextField(name,new
  Model(pluginProperties.getName()));
 TextField propertiesValue = new TextField(value,new
  Model(pluginProperties.getValue()));
 CheckBox propertiesDefault = new
  CheckBox(defaultProperty,new
 Model(pluginProperties.isDefaultProperty()));
 item.add(propertiesName);
 item.add(propertiesValue);
 item.add(propertiesDefault);
 }
 };
 propertiesList.setReuseItems(true);
 add(propertiesList);
 
 add(new Button(saveButton));
 
 
 }
 
 public void onSubmit()
 {
 ListPluginProperties pluginProperties =
  (ListPluginProperties)pluginPropertiesModel.getObject();
 for(PluginProperties property:pluginProperties){
 info(+property.getName()+: +property.getValue()+ ==
  +property.isDefaultProperty());
 log.debug(+property.getName()+: +property.getValue()+
  == +property.isDefaultProperty());
 }
 
 
 
 
 }
 }
 
 
  thanks in advance
  markus
 

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




Re: ListView in Forms

2008-08-06 Thread Markus Haspl
i thought i have to use it when i need the updatet values...

On Wed, Aug 6, 2008 at 4:28 PM, Hoover, William [EMAIL PROTECTED] wrote:

 Why do you use propertiesList.setReuseItems(true)?

 -Original Message-
 From: Markus Haspl [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, August 06, 2008 10:20 AM
 To: users@wicket.apache.org
 Subject: ListView in Forms

 hi,

 first, i'm a very newbie to wicket... I want to add a ListView in a
 Form.
 The ListView has two Texfields and one Checkbox each row. When i submit
 the form the values are still the old ones.

 here the code:

 private class InputForm extends Form {



  IModel pluginPropertiesModel;

  public InputForm(String id, IPlugin plugin){
super(id);



final IPlugin Iplugin = plugin;

pluginPropertiesModel = new LoadableDetachableModel(){
public Object load()
{
log.debug(load the Model);
Iplugin.loadPluginProperties();
return pluginProperties;
}
};

ListView propertiesList = new ListView(pluginRepeater,
 pluginPropertiesModel) {

@Override
public void populateItem(ListItem item)
{
PluginProperties pluginProperties =
 (PluginProperties)item.getModelObject();
TextField propertiesName = new TextField(name,new
 Model(pluginProperties.getName()));
TextField propertiesValue = new
 TextField(value,new Model(pluginProperties.getValue()));
CheckBox propertiesDefault = new
 CheckBox(defaultProperty,new
 Model(pluginProperties.isDefaultProperty()));
item.add(propertiesName);
item.add(propertiesValue);
item.add(propertiesDefault);
}
};
propertiesList.setReuseItems(true);
add(propertiesList);

add(new Button(saveButton));


}

public void onSubmit()
{
ListPluginProperties pluginProperties =
 (ListPluginProperties)pluginPropertiesModel.getObject();
for(PluginProperties property:pluginProperties){
info(+property.getName()+: +property.getValue()+ ==
 +property.isDefaultProperty());
log.debug(+property.getName()+:
 +property.getValue()+
 == +property.isDefaultProperty());
}




}
}


 thanks in advance
 markus


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]