Re: Property Model Issue

2012-02-04 Thread Sam Barrow

On Sat, 2012-02-04 at 10:27 -0500, James Carman wrote:
 I would avoid cpms like the plague.  Too much magic.
 On Feb 3, 2012 5:12 PM, Sam Barrow s...@sambarrow.com wrote:
 

Yeah, I know what you mean. I usually try to avoid them, I'm not too
fond of runtime reflection, loss of compile time type checking, etc. At
the same time though there is something to be said for doing things the
conventional way within a framework, and from everything I've seen this
is it.

I actually figured out the problem. When wicket tries to initModel it
searches parent components for their model, but it doesn't use getModel,
it uses getModelImpl, which does none of initModel magic. In effect,
it's incapable of handling chains of nested models in which more than
two links in a row are not manually specified.



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



Property Model Issue

2012-02-03 Thread Sam Barrow
Hi guys,

I'm having an issue with property models.

I have a DataView running over a number of Post objects. The Post object
has a property named product with appropriate getter/setter.

new DataViewPost(posts, provider) {
  protected void populateItem(final ItemPost item) {
item.setModel(CompoundPropertyModel.of(item.getModel()));
item.add(new ProductPanel(product));
  }
}

The issue is within ProductPanel. It has a number of labels, each only
specifying a name (no model). In my initModel() I am creating a
CompoundPropertyModel around super.initModel(). I was expecting it to
pull these properties from the model object of my ProductPanel.

public class ProductPanel extends GenericPanelProduct {
  public ProductPanel(final String id) {
add(new Label(name));
add(new Label(condition));
  }
  protected IModel? initModel() {
return CompoundPropertyModel.of(super.initModel());
  }
}

But I get this error: org.apache.wicket.WicketRuntimeException: No get
method defined for class: class com.cellcycleusa.domain.Post expression:
name.

Seems that it's trying to access the Post object from the DataView to
pull the property from, not the model object of the ProductPanel itself.

Now the really funny part is that if I just add this to ProductPanel,
everything works fine:

protected void onBeforeRender() {
  getModel();
  super.onBeforeRender();
}

Or if I specify the model objects for the labels within ProductPanel
like this:

new Label(name, new ComponentPropertyModelString(name))

That works as well.

What am I doing wrong?

-- 

Sam Barrow
Squidix IT Services




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



Re: Property Model Issue

2012-02-03 Thread Sam Barrow

On Fri, 2012-02-03 at 13:57 -0800, Dan Retzlaff wrote:
 Hi Sam,
 
 I think your use of Item#setModel() and Component#initModel() are
 unconventional. Try:
 

Hi Dan,

Yes I never really liked my item.setModel() technique, just didn't seem
right to me but I've seen it in more than one tutorial so I figured it
was the way it was done. I actually moved the compounding part over the
newItem method in dataview just now though, seems cleaner.

 populateItem(ItemPost item) {
 item.add(new ProductPanel(product, item.getModel());
 }
 
 ProductPanel(String id, IModelProduct model) {
 super(id, CompoundPropertyModel.of(model));
 add(new Label(name));
 add(new Label(condition));
 }
 

I'm sure this would work, just wondering if there's a better way to do
this? Is it good practice to manipulate the model in the constructor
like that? Doesn't seem right to me as the model may need to change
(maybe via ajax?). I try to never mess with my models like that outside
of the rendering phase. I've been toying with wicket occasionally for
over a year now, but never gone this far with it so I'm still learning
how it all works.

I would if at all possible like to retain the ability to create a new
ProductPanel without specifying the model in the constructor. This seems
to be the way things are usually done in Wicket so I figured there must
be a better way.

Product is a property of post so I'd be specifying it in two different
places, and again if I wanted to add any more composited components
under ProductPanel.

I've corrected your code to reflect this (I just got your next message).

 populateItem(ItemPost item) {
 item.add(new ProductPanel(product, new
PropertyModelProduct(item.getModel(), product));
 }
 

I was using the compoundpropertymodel to avoid specifying the product
property manually as is done above, but that part is working for me with
no issues, it's just inside ProductPanel that I'm having problems.

It's not that I'm really that lazy, just an issue of best practice for
me.

 On Fri, Feb 3, 2012 at 12:51 PM, Sam Barrow s...@sambarrow.com wrote:
 
  Hi guys,
 
  I'm having an issue with property models.
 
  I have a DataView running over a number of Post objects. The Post object
  has a property named product with appropriate getter/setter.
 
  new DataViewPost(posts, provider) {
   protected void populateItem(final ItemPost item) {
 item.setModel(CompoundPropertyModel.of(item.getModel()));
 item.add(new ProductPanel(product));
   }
  }
 
  The issue is within ProductPanel. It has a number of labels, each only
  specifying a name (no model). In my initModel() I am creating a
  CompoundPropertyModel around super.initModel(). I was expecting it to
  pull these properties from the model object of my ProductPanel.
 
  public class ProductPanel extends GenericPanelProduct {
   public ProductPanel(final String id) {
 add(new Label(name));
 add(new Label(condition));
   }
   protected IModel? initModel() {
 return CompoundPropertyModel.of(super.initModel());
   }
  }
 
  But I get this error: org.apache.wicket.WicketRuntimeException: No get
  method defined for class: class com.cellcycleusa.domain.Post expression:
  name.
 
  Seems that it's trying to access the Post object from the DataView to
  pull the property from, not the model object of the ProductPanel itself.
 
  Now the really funny part is that if I just add this to ProductPanel,
  everything works fine:
 
  protected void onBeforeRender() {
   getModel();
   super.onBeforeRender();
  }
 
  Or if I specify the model objects for the labels within ProductPanel
  like this:
 
  new Label(name, new ComponentPropertyModelString(name))
 
  That works as well.
 
  What am I doing wrong?
 
  --
 
  Sam Barrow
  Squidix IT Services
 
 
 
 
  -
  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: Passing raw value to html

2010-07-26 Thread Sam Barrow
I'll look it up. I always search before asking, I just wasn't able to
find this since it's kind of a difficult set of keywords to search
google for.

On Mon, 2010-07-26 at 08:45 -0700, Igor Vaynberg wrote:
 i think this was discussed already (for this exact usecase even),
 search the archives.
 
 -igor
 
 On Mon, Jul 26, 2010 at 8:42 AM, Sam Barrow s...@sambarrow.com wrote:
  Is there a way to pass a raw value to be displayed in a wicket markup
  file? I'm trying to create a google analytics panel that takes an id
  string and puts it directly in the markup with no tag.
 
  script type=text/javascript
  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', ${MY_RAW_VALUE}]);
  _gaq.push(['_trackPageview']);
  (function() {
   var ga = document.createElement('script'); ga.type =
  'text/javascript'; ga.async = true;
   ga.src = ('https:' == document.location.protocol ? 'https://ssl' :
  'http://www') + '.google-analytics.com/ga.js';
   var s = document.getElementsByTagName('script')[0];
  s.parentNode.insertBefore(ga, s);
  })();
  /script
 
 
  -
  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: Passing raw value to html

2010-07-26 Thread Sam Barrow
I'm not trying to insert javascript, I'm just trying to pass a few
characters into a template. I just happen to be using it in a situation
where javascript is involved.

On Mon, 2010-07-26 at 09:24 -0700, Arjun Dhar wrote:
 My 2 cents : I think the problem is more of inserting javaScript into markup
 as key words perhaps ?! :)
 
 http://ninomartinez.wordpress.com/2008/09/09/apache-wicket-javascript-integration
 : Dont forget to check the video out if you have the time
 
 http://apache-wicket.1842946.n4.nabble.com/Best-way-to-insert-inline-Javascript-td1930869.html#a1930870
 
 ..the first link + video is also a good explanation!



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



Re: Passing raw value to html

2010-07-26 Thread Sam Barrow
Yes that's exactly what I was looking for, I found the example in the
mailing list. Thanks!

On Mon, 2010-07-26 at 09:30 -0700, Arjun Dhar wrote:
 
 Lots of dynamic stuff?
 
 If you have lots of dynamic stuff you can use a texttemplate to interpolate
 your variables with it works really smooth, heres an example:
 
 
 ...
 HashMap variables = new HashMap();
 variables.put(alert, helloworld);
 TextTemplate textTemplate=new TextTemplate();
 textTemplate.interpolate(variables);
 String js= textTemplate.asString();
 
 …
 
 corrosponding java script, notice the template signature ${…}
 
 alert(${alert});
 
 So above code will produce a javascript string ‘alert(“hello world”)’ very
 useful.
 
 
  Thats in the first link I showed you; helps you put variables in
 whatever markup you want. Am sure there are other approaches also, but have
 a look before you think its not meant for you.



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



Lazy Initialization Question

2010-07-24 Thread Sam Barrow
I'm getting hibernate lazy initialization exceptions. I was under the
impression that a smart entity model would fix this
(http://wicketinaction.com/2008/09/building-a-smart-entitymodel/) is
that true? Or do i need opensessioninview as well?



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



Re: Lazy Initialization Question

2010-07-24 Thread Sam Barrow
The entitymodel accesses a generic repository implementation. So I would
definitely need to use open session in view to avoid these?

On Sat, 2010-07-24 at 11:29 +0300, Martin Makundi wrote:
 I would recommend against making your GUI dependent on persistence 
 container...
 
 ...but yes you will need active database connection for lazy loading entities.
 
 **
 Martin
 
 2010/7/24 Sam Barrow s...@sambarrow.com:
  I'm getting hibernate lazy initialization exceptions. I was under the
  impression that a smart entity model would fix this
  (http://wicketinaction.com/2008/09/building-a-smart-entitymodel/) is
  that true? Or do i need opensessioninview as well?
 
 
 
  -
  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: Lazy Initialization Question

2010-07-24 Thread Sam Barrow
The only alternative I've found is DTOs, which would not be practical at
all, we have a very large domain model.

On Sat, 2010-07-24 at 11:58 +0300, Martin Makundi wrote:
 I would avoid using lazy entities in GUI.
 
 **
 Martin
 
 2010/7/24 Sam Barrow s...@sambarrow.com:
  The entitymodel accesses a generic repository implementation. So I would
  definitely need to use open session in view to avoid these?
 
  On Sat, 2010-07-24 at 11:29 +0300, Martin Makundi wrote:
  I would recommend against making your GUI dependent on persistence 
  container...
 
  ...but yes you will need active database connection for lazy loading 
  entities.
 
  **
  Martin
 
  2010/7/24 Sam Barrow s...@sambarrow.com:
   I'm getting hibernate lazy initialization exceptions. I was under the
   impression that a smart entity model would fix this
   (http://wicketinaction.com/2008/09/building-a-smart-entitymodel/) is
   that true? Or do i need opensessioninview as well?
  
  
  
   -
   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: Lazy Initialization Question

2010-07-24 Thread Sam Barrow
It's just a billing system. The problem comes up now in very simple use
cases.

Currently all we're doing is trying to load a collection with a list of
Order domain objects from the Client domain object.

final SortableDataProviderOrder provider = new
RepositoryDataProviderOrder(getOrderRepository()) {
@Override
protected ListOrder load() {
return new 
ArrayListOrder(getClientModelObject().getOrders());
}
};


On Sat, 2010-07-24 at 12:07 +0300, Martin Makundi wrote:
 It's difficult to comment exactly not knowing the actual use case and
 background.. but maybe another design approach would help?
 
 And also it's just my opinnion to try to avoid lazy initialization in
 GUI. Somebody might disagree ;]
 
 **
 Martin
 
 2010/7/24 Sam Barrow s...@sambarrow.com:
  The only alternative I've found is DTOs, which would not be practical at
  all, we have a very large domain model.
 
  On Sat, 2010-07-24 at 11:58 +0300, Martin Makundi wrote:
  I would avoid using lazy entities in GUI.
 
  **
  Martin
 
  2010/7/24 Sam Barrow s...@sambarrow.com:
   The entitymodel accesses a generic repository implementation. So I would
   definitely need to use open session in view to avoid these?
  
   On Sat, 2010-07-24 at 11:29 +0300, Martin Makundi wrote:
   I would recommend against making your GUI dependent on persistence 
   container...
  
   ...but yes you will need active database connection for lazy loading 
   entities.
  
   **
   Martin
  
   2010/7/24 Sam Barrow s...@sambarrow.com:
I'm getting hibernate lazy initialization exceptions. I was under the
impression that a smart entity model would fix this
(http://wicketinaction.com/2008/09/building-a-smart-entitymodel/) is
that true? Or do i need opensessioninview as well?
   
   
   
-
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
 
 
 
 -
 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: Lazy Initialization Question

2010-07-24 Thread Sam Barrow
getClientModel gets an instance of EntityModel which contains a
reference to a repository and an id. The repository has a reference to
the hibernate SessionFactory.

On Sat, 2010-07-24 at 12:20 +0300, Martin Makundi wrote:
 Hi!
 
 If I understand correctly, getClientModelObject() will need a session.
 Is that a problem?
 
 **
 Martin
 
 2010/7/24 Sam Barrow s...@sambarrow.com:
  It's just a billing system. The problem comes up now in very simple use
  cases.
 
  Currently all we're doing is trying to load a collection with a list of
  Order domain objects from the Client domain object.
 
  final SortableDataProviderOrder provider = new
  RepositoryDataProviderOrder(getOrderRepository()) {
 @Override
 protected ListOrder load() {
 return new 
  ArrayListOrder(getClientModelObject().getOrders());
 }
 };
 
 
  On Sat, 2010-07-24 at 12:07 +0300, Martin Makundi wrote:
  It's difficult to comment exactly not knowing the actual use case and
  background.. but maybe another design approach would help?
 
  And also it's just my opinnion to try to avoid lazy initialization in
  GUI. Somebody might disagree ;]
 
  **
  Martin
 
  2010/7/24 Sam Barrow s...@sambarrow.com:
   The only alternative I've found is DTOs, which would not be practical at
   all, we have a very large domain model.
  
   On Sat, 2010-07-24 at 11:58 +0300, Martin Makundi wrote:
   I would avoid using lazy entities in GUI.
  
   **
   Martin
  
   2010/7/24 Sam Barrow s...@sambarrow.com:
The entitymodel accesses a generic repository implementation. So I 
would
definitely need to use open session in view to avoid these?
   
On Sat, 2010-07-24 at 11:29 +0300, Martin Makundi wrote:
I would recommend against making your GUI dependent on persistence 
container...
   
...but yes you will need active database connection for lazy loading 
entities.
   
**
Martin
   
2010/7/24 Sam Barrow s...@sambarrow.com:
 I'm getting hibernate lazy initialization exceptions. I was under 
 the
 impression that a smart entity model would fix this
 (http://wicketinaction.com/2008/09/building-a-smart-entitymodel/) 
 is
 that true? Or do i need opensessioninview as well?



 -
 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
  
  
 
  -
  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: Lazy Initialization Question

2010-07-24 Thread Sam Barrow
Session factory, sorry.

On Sat, 2010-07-24 at 12:31 +0300, Martin Makundi wrote:
 Session factory or also an open session?
 
 **
 Martin
 
 2010/7/24 Sam Barrow s...@sambarrow.com:
  getClientModel gets an instance of EntityModel which contains a
  reference to a repository and an id. The repository has a reference to
  the hibernate SessionFactory.
 
  On Sat, 2010-07-24 at 12:20 +0300, Martin Makundi wrote:
  Hi!
 
  If I understand correctly, getClientModelObject() will need a session.
  Is that a problem?
 
  **
  Martin
 
  2010/7/24 Sam Barrow s...@sambarrow.com:
   It's just a billing system. The problem comes up now in very simple use
   cases.
  
   Currently all we're doing is trying to load a collection with a list of
   Order domain objects from the Client domain object.
  
   final SortableDataProviderOrder provider = new
   RepositoryDataProviderOrder(getOrderRepository()) {
  @Override
  protected ListOrder load() {
  return new 
   ArrayListOrder(getClientModelObject().getOrders());
  }
  };
  
  
   On Sat, 2010-07-24 at 12:07 +0300, Martin Makundi wrote:
   It's difficult to comment exactly not knowing the actual use case and
   background.. but maybe another design approach would help?
  
   And also it's just my opinnion to try to avoid lazy initialization in
   GUI. Somebody might disagree ;]
  
   **
   Martin
  
   2010/7/24 Sam Barrow s...@sambarrow.com:
The only alternative I've found is DTOs, which would not be practical 
at
all, we have a very large domain model.
   
On Sat, 2010-07-24 at 11:58 +0300, Martin Makundi wrote:
I would avoid using lazy entities in GUI.
   
**
Martin
   
2010/7/24 Sam Barrow s...@sambarrow.com:
 The entitymodel accesses a generic repository implementation. So I 
 would
 definitely need to use open session in view to avoid these?

 On Sat, 2010-07-24 at 11:29 +0300, Martin Makundi wrote:
 I would recommend against making your GUI dependent on 
 persistence container...

 ...but yes you will need active database connection for lazy 
 loading entities.

 **
 Martin

 2010/7/24 Sam Barrow s...@sambarrow.com:
  I'm getting hibernate lazy initialization exceptions. I was 
  under the
  impression that a smart entity model would fix this
  (http://wicketinaction.com/2008/09/building-a-smart-entitymodel/)
   is
  that true? Or do i need opensessioninview as well?
 
 
 
  -
  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
   
   
  
   -
   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
 



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



Re: Lazy Initialization Question

2010-07-24 Thread Sam Barrow
I just added opensessioninviewfilter, I'm still getting
org.hibernate.LazyInitializationException: failed to lazily initialize a
collection of role: com.sixserve.domain.Server.controlPanelOptions, no
session or session was closed

The error occurs inside a service method, called from a wicket link

add(new LinkDomainObject(link, getAccount()) {
  @Override
  public void onClick() {
getApplicationService().doThing(getModelObject());
  }
});


On Sat, 2010-07-24 at 12:36 +0300, Martin Makundi wrote:
 Then I think you need to open a session to activate lazy fetching.
 
 2010/7/24 Sam Barrow s...@sambarrow.com:
  Session factory, sorry.
 
  On Sat, 2010-07-24 at 12:31 +0300, Martin Makundi wrote:
  Session factory or also an open session?
 
  **
  Martin
 
  2010/7/24 Sam Barrow s...@sambarrow.com:
   getClientModel gets an instance of EntityModel which contains a
   reference to a repository and an id. The repository has a reference to
   the hibernate SessionFactory.
  
   On Sat, 2010-07-24 at 12:20 +0300, Martin Makundi wrote:
   Hi!
  
   If I understand correctly, getClientModelObject() will need a session.
   Is that a problem?
  
   **
   Martin
  
   2010/7/24 Sam Barrow s...@sambarrow.com:
It's just a billing system. The problem comes up now in very simple 
use
cases.
   
Currently all we're doing is trying to load a collection with a list 
of
Order domain objects from the Client domain object.
   
final SortableDataProviderOrder provider = new
RepositoryDataProviderOrder(getOrderRepository()) {
   @Override
   protected ListOrder load() {
   return new 
ArrayListOrder(getClientModelObject().getOrders());
   }
   };
   
   
On Sat, 2010-07-24 at 12:07 +0300, Martin Makundi wrote:
It's difficult to comment exactly not knowing the actual use case and
background.. but maybe another design approach would help?
   
And also it's just my opinnion to try to avoid lazy initialization in
GUI. Somebody might disagree ;]
   
**
Martin
   
2010/7/24 Sam Barrow s...@sambarrow.com:
 The only alternative I've found is DTOs, which would not be 
 practical at
 all, we have a very large domain model.

 On Sat, 2010-07-24 at 11:58 +0300, Martin Makundi wrote:
 I would avoid using lazy entities in GUI.

 **
 Martin

 2010/7/24 Sam Barrow s...@sambarrow.com:
  The entitymodel accesses a generic repository implementation. 
  So I would
  definitely need to use open session in view to avoid these?
 
  On Sat, 2010-07-24 at 11:29 +0300, Martin Makundi wrote:
  I would recommend against making your GUI dependent on 
  persistence container...
 
  ...but yes you will need active database connection for lazy 
  loading entities.
 
  **
  Martin
 
  2010/7/24 Sam Barrow s...@sambarrow.com:
   I'm getting hibernate lazy initialization exceptions. I was 
   under the
   impression that a smart entity model would fix this
   (http://wicketinaction.com/2008/09/building-a-smart-entitymodel/)
is
   that true? Or do i need opensessioninview as well?
  
  
  
   -
   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


   
-
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

Re: Lazy Initialization Question

2010-07-24 Thread Sam Barrow
I fixed it, I didn't realize I had to move the filter above the wicket
filter

On Sat, 2010-07-24 at 13:00 +0300, Martin Makundi wrote:
 Where did you add opensessioninviewfilter?
 
 **
 Martin
 
 2010/7/24 Sam Barrow s...@sambarrow.com:
  I just added opensessioninviewfilter, I'm still getting
  org.hibernate.LazyInitializationException: failed to lazily initialize a
  collection of role: com.sixserve.domain.Server.controlPanelOptions, no
  session or session was closed
 
  The error occurs inside a service method, called from a wicket link
 
  add(new LinkDomainObject(link, getAccount()) {
   @Override
   public void onClick() {
 getApplicationService().doThing(getModelObject());
   }
  });
 
 
  On Sat, 2010-07-24 at 12:36 +0300, Martin Makundi wrote:
  Then I think you need to open a session to activate lazy fetching.
 
  2010/7/24 Sam Barrow s...@sambarrow.com:
   Session factory, sorry.
  
   On Sat, 2010-07-24 at 12:31 +0300, Martin Makundi wrote:
   Session factory or also an open session?
  
   **
   Martin
  
   2010/7/24 Sam Barrow s...@sambarrow.com:
getClientModel gets an instance of EntityModel which contains a
reference to a repository and an id. The repository has a reference to
the hibernate SessionFactory.
   
On Sat, 2010-07-24 at 12:20 +0300, Martin Makundi wrote:
Hi!
   
If I understand correctly, getClientModelObject() will need a 
session.
Is that a problem?
   
**
Martin
   
2010/7/24 Sam Barrow s...@sambarrow.com:
 It's just a billing system. The problem comes up now in very 
 simple use
 cases.

 Currently all we're doing is trying to load a collection with a 
 list of
 Order domain objects from the Client domain object.

 final SortableDataProviderOrder provider = new
 RepositoryDataProviderOrder(getOrderRepository()) {
@Override
protected ListOrder load() {
return new 
 ArrayListOrder(getClientModelObject().getOrders());
}
};


 On Sat, 2010-07-24 at 12:07 +0300, Martin Makundi wrote:
 It's difficult to comment exactly not knowing the actual use case 
 and
 background.. but maybe another design approach would help?

 And also it's just my opinnion to try to avoid lazy 
 initialization in
 GUI. Somebody might disagree ;]

 **
 Martin

 2010/7/24 Sam Barrow s...@sambarrow.com:
  The only alternative I've found is DTOs, which would not be 
  practical at
  all, we have a very large domain model.
 
  On Sat, 2010-07-24 at 11:58 +0300, Martin Makundi wrote:
  I would avoid using lazy entities in GUI.
 
  **
  Martin
 
  2010/7/24 Sam Barrow s...@sambarrow.com:
   The entitymodel accesses a generic repository 
   implementation. So I would
   definitely need to use open session in view to avoid these?
  
   On Sat, 2010-07-24 at 11:29 +0300, Martin Makundi wrote:
   I would recommend against making your GUI dependent on 
   persistence container...
  
   ...but yes you will need active database connection for 
   lazy loading entities.
  
   **
   Martin
  
   2010/7/24 Sam Barrow s...@sambarrow.com:
I'm getting hibernate lazy initialization exceptions. I 
was under the
impression that a smart entity model would fix this
(http://wicketinaction.com/2008/09/building-a-smart-entitymodel/)
 is
that true? Or do i need opensessioninview as well?
   
   
   
-
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
 
 

 -
 To unsubscribe, e-mail: users

Generics for datatable columns

2010-02-13 Thread Sam Barrow
This is a stupid minor thing but I was wondering.

If I have a datatable of SubClass objects, shouldn't a I be able to add
an IColumnSuperClass to the list of columns?

Not very often used, but could be useful occasionally like for
inheritance with domain entities. Couldn't hurt to implement this right
(just add a generics wildcard)?



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



Re: Worldwide address form

2010-02-03 Thread Sam Barrow
anybody want to work on this? i have my collection of wicket components
and this is just the type of stuff id like to be included.

On Wed, 2010-02-03 at 11:26 +0100, Per Lundholm wrote:
 If you do that, you will be a hero. ;-)
 
 But why not, a component that handles all kinds of addresses in the world is
 a typical joint effort.
 
  If it is in the drop-down of countries, then it is supported. If not your
 country is supported, then contribute!
 
 /Per
 
 On Thu, Jan 28, 2010 at 11:30 PM, Chris Colman chr...@stepaheadsoftware.com
  wrote:
 
  I'm just wondering if anyone knows of a sample 'world address' entry
  form built using wicket.
 
  Ideally the data entry fields for the top level attributes:
 
  - world region
  - country
  - state/zone
 
  Would be drop down list boxes. The contents of any drop down (except the
  world region) would be dictated by the option(s) chosen in the drop down
  lists above it. Eg., if you change the country from Australia to USA
  then the state/zone drop down is populated with the US states.
 
  I was thinking of creating an interface for the data so that a generic
  world wide address form could be written to the interface but the
  implementation of the interface could be tailored to the way an
  individual app stores it's world data.
 
 
   -Original Message-
   From: Per Lundholm [mailto:per.lundh...@gmail.com]
   Sent: Friday, 29 January 2010 8:26 AM
   To: users@wicket.apache.org
   Subject: Re: functional testing
  
   We write tests first and use Wicket's built-in testing.
  
   It has some quirks so you may have to spend time with figuring out how
  to
   click an AjaxCheckBox, for instance.
  
   The tests target the logic of the view, such as when clicking here,
  that
   other thing should be disabled.
  
   Good test coverage really pays off when you have 20 different webapps
  and
   need to work some here and some there.
  
   /Per
  
   On Mon, Jan 25, 2010 at 3:52 AM, Kent Tong k...@cpttm.org.mo wrote:
  
   
For functional testing, I'd suggest Selenium.
   
For unit testing of Wicket pages, I'd suggest Wicket Page Test
(http://wicketpagetest.sourceforge.net).
   
-
--
Kent Tong
Better way to unit test Wicket pages (
http://wicketpagetest.sourceforge.net)
Books on CXF, Axis2, Wicket, JSF (http://http://agileskills2.org)
--
View this message in context:
http://old.nabble.com/functional-testing-tp27278781p27301553.html
Sent from the Wicket - User mailing list archive at Nabble.com.
   
   
   
  -
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org
   
   
 
  -
  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



contributing components

2010-01-27 Thread Sam Barrow
I sent an email to this list the other day about releasing my wicket
component toolkit. Anybody know how to go about this?

I have some pretty interesting stuff, like a BeanPanel that displays a
bean's properties in a nice looking key:value format, and another one
that allows you to upload a file, but is abstracted so you can upload
from a file on the local computer or from a web URL.

My most innovative one accepts a list of files as input, and
automatically generates zip/tar.gz/tar.bz2 archive downloads. I'm sure
these will come in useful to many. If anybody knows how to go about this
please let me know.


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



AjaxSelfUpdatingTimerBehavior

2010-01-26 Thread Sam Barrow
Is there any way to make the AjaxSelfUpdatingTimerBehavior execute X
number of times and then stop until a page refresh/reload?



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



Generics

2010-01-25 Thread Sam Barrow
I've noticed in some places where generics wildcards may be useful that
they are not used. For example, in IColumn.
If I have a Type and a SubType that extends Type, I can't use
IColumnType in a DataTableSubType. Is there any reason for this or
was it just not implemented? Not the most necessary feature, but it
couldn't hurt.

Also is there a reason ListView and similar components require an
IModelList, and will not accept an IModelCollection?


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



Releasing wicket library

2010-01-24 Thread Sam Barrow

In the course of developing my first wicket web application, I've wound
up with quite a few reusable wicket components, validators, and other
utilities. I think things like a LinkPanel, EmailLink, etc etc should be
available, after all wicket is all about reusability.

I'm packaging and releasing them on sourceforge. If anyone's interested,
check it out. Most of the stuff is stable and works, but it's not
carefully tested or ready for release, but I went ahead and put it on
sourceforge so anyone interested can use it or help out.

This is the first upload, I'm currently adding comments and cleaning
some stuff up.

svn co https://swicket.svn.sourceforge.net/svnroot/swicket swicket

It depends on jclib, universal java toolkit (very very useful). jclib in
turn depends on common-collections15, commons-lang and a couple others.
Personally I don't know how anybody lives without these libraries.

svn co https://jclib.svn.sourceforge.net/svnroot/jclib jclib



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



Re: question about swarm

2009-12-31 Thread Sam Barrow
I know I can do that, but there's no way do do it by inheritance? I have
hundreds of anonymous subclasses throughout my application. Seems
sensible that subclasses should inherit their parent's permissions.

On Thu, 2009-12-31 at 10:41 +0100, Olger Warnier wrote:
 Hi Sam, 
 
 I have added a sample to the secureform sample where the home page creates an 
 anonymous class of the MySecurePage
 An anonymous page has a kind of a class name. Look for a 
 
 ERROR - RequestCycle   - Not authorized to instantiate class 
 org.apache.wicket.security.examples.secureform.pages.HomePage$2$1
 org.apache.wicket.authorization.UnauthorizedInstantiationException: Not 
 authorized to instantiate class 
 org.apache.wicket.security.examples.secureform.pages.HomePage$2$1
 
 And add the line to the hive:
 
 permission ${ComponentPermission} 
 org.apache.wicket.security.examples.secureform.pages.HomePage$2$1, render, 
 enable;
 
 As you can see it does not contain a line with the target response page but a 
 line that contains the setResponsePage call. 
 So you need to add a line that contains the 'name' of the anonymous class to 
 the hive.
 
 
 Kind Regards, 
 
 Olger
 
 
 On 31 dec 2009, at 02:46, Sam Barrow wrote:
 
  I hope this is the right list for wasp/swarm.
  How do i manage permissions for an anonymous subclass?
  
  I have a page called ItemPage. I can view ItemPage, but if I try to
  redirect to an anonymous subclass of ItemPage, i get an access denied
  error.
  
  this works:
  setResponsePage(new CreateItemPage(getPage()));
  
  but this doesnt:
  setResponsePage(new CreateItemPage(getPage()) {
  @Override
  protected void onSuccess(final Serializable index) {
  setResponsePage(new ViewItemPage(getBackPage(), index));
  }
  });
  
  hive file:
  
  permission ${ComponentPermission} ${pages}.CreateItemPage, inherit,
  render;
  permission ${ComponentPermission} ${pages}.CreateItemPage, enable;
  
  
  -
  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



question about swarm

2009-12-30 Thread Sam Barrow
I hope this is the right list for wasp/swarm.
How do i manage permissions for an anonymous subclass?

I have a page called ItemPage. I can view ItemPage, but if I try to
redirect to an anonymous subclass of ItemPage, i get an access denied
error.

this works:
setResponsePage(new CreateItemPage(getPage()));

but this doesnt:
setResponsePage(new CreateItemPage(getPage()) {
@Override
protected void onSuccess(final Serializable index) {
setResponsePage(new ViewItemPage(getBackPage(), index));
}
});

hive file:

permission ${ComponentPermission} ${pages}.CreateItemPage, inherit,
render;
permission ${ComponentPermission} ${pages}.CreateItemPage, enable;


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



strange classcastexception

2009-12-28 Thread Sam Barrow
I'm getting this exception when calling getConvertedInput() on
birthDateField.

java.lang.ClassCastException: java.lang.String cannot be cast to
java.util.Date

I'm using wicket 1.4.1


birthDateField = new TextFieldDate(birthDate, new 
ModelDate());
birthDateField.setLabel(new ModelString(Birth Date));
birthDateField.add(new DatePicker());
FormUtils.addField(this, birthDateField);



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



Re: strange classcastexception

2009-12-28 Thread Sam Barrow
I tried that too, still same error.

On Mon, 2009-12-28 at 16:02 +0200, Martin Makundi wrote:
 You forgot to set Type of the textfield... you know, generics are only
 compile-deep.
 
 public TextField(final String id, final ClassT type)
 
 type - Date.class
 
 **
 Martin
 
 2009/12/28 Sam Barrow s...@sambarrow.com:
  I'm getting this exception when calling getConvertedInput() on
  birthDateField.
 
  java.lang.ClassCastException: java.lang.String cannot be cast to
  java.util.Date
 
  I'm using wicket 1.4.1
 
 
 birthDateField = new TextFieldDate(birthDate, new 
  ModelDate());
 birthDateField.setLabel(new ModelString(Birth Date));
 birthDateField.add(new DatePicker());
 FormUtils.addField(this, birthDateField);
 
 
 
  -
  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: strange classcastexception

2009-12-28 Thread Sam Barrow
tried that, didn't work.
any other ideas?

On Mon, 2009-12-28 at 16:11 +0100, Per Newgro wrote:
 Hi Sam,
 
 did you try
 
 birthDateField = new TextFieldDate(birthDate, new ModelDate(), 
 Date.class);
 
 Maybe it helps.
 
 Cheers
 Per
 
 
 -
 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



datatable delete

2009-12-22 Thread Sam Barrow
if i have a link in a row of a datatable that deletes an item, how do i
make that row disappear? or just refresh the whole table?


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



Re: datatable delete

2009-12-22 Thread Sam Barrow
that's how i thought it work, but it doesnt at all for me, ive tried so
many times. i have to re-click the link to the page, even a refresh with
the f5 key doesnt get rid of the missing row.

On Tue, 2009-12-22 at 09:59 -0800, Igor Vaynberg wrote:
 the table refreshes on every render, so as long as your idataprovider
 does not retrieve the row after you delete it it will be gone.
 
 sometimes it pays to simply try and see, most things will work as expected.
 
 -igor
 
 On Tue, Dec 22, 2009 at 9:55 AM, Sam Barrow s...@sambarrow.com wrote:
  if i have a link in a row of a datatable that deletes an item, how do i
  make that row disappear? or just refresh the whole table?
 
 
  -
  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: datatable delete

2009-12-22 Thread Sam Barrow
its the dataprovider, i was supplying it with a collection of rows in
the constructor, rather than getting the data fresh inside the
dataprovider. thanks!

On Tue, 2009-12-22 at 10:05 -0800, Igor Vaynberg wrote:
 then check your delete logic, or set a breakpoint in your dataprovider
 and see why the row entity is still being retrieved.
 
 -igor
 
 On Tue, Dec 22, 2009 at 10:03 AM, Sam Barrow s...@sambarrow.com wrote:
  that's how i thought it work, but it doesnt at all for me, ive tried so
  many times. i have to re-click the link to the page, even a refresh with
  the f5 key doesnt get rid of the missing row.
 
  On Tue, 2009-12-22 at 09:59 -0800, Igor Vaynberg wrote:
  the table refreshes on every render, so as long as your idataprovider
  does not retrieve the row after you delete it it will be gone.
 
  sometimes it pays to simply try and see, most things will work as expected.
 
  -igor
 
  On Tue, Dec 22, 2009 at 9:55 AM, Sam Barrow s...@sambarrow.com wrote:
   if i have a link in a row of a datatable that deletes an item, how do i
   make that row disappear? or just refresh the whole table?
  
  
   -
   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



TextArea with list of strings.

2009-12-04 Thread Sam Barrow

I am trying to make a TextArea that allows you to input a list of
strings (separated by a newline) and turns that list into a Collection.
I had it working but it was kind of hacked together, I'm trying to do it
the clean way now.
I have it working except for two things:

If I give it an empty collection for the model object then it display
square brackets [] inside the text area.
I don't have the conversion 100% working. Like when you have a
TextFieldDate, I'm trying to make it do the same thing to each line.
It works, but when it is an invalid value, instead of a nice error
message X is not a valid Y I get a runtime exception from whatever
IConverter I am using.

Source:

public final class CollectionTextAreaType extends
TextAreaCollectionType {

private static final long serialVersionUID = 7147538499297387635L;

private Class? elementType;

public CollectionTextArea(final String id, final Class? elementType)
{
super(id);
setElementType(elementType);
}
public CollectionTextArea(final String id, final Class? elementType,
final IModelCollectionType model) {
super(id, model);
setElementType(elementType);
}

public Class? getElementType() {
return elementType;
}
public void setElementType(Class? elementType) {
this.elementType = elementType;
}

@Override
protected void onBeforeRender() {
super.onBeforeRender();
}
@Override
@SuppressWarnings(unchecked)
protected void convertInput() {
final String text = getRawInput();
final ListType lines = new ArrayListType();
if (text != null) {
for (final String line: text.split(\\r\\n)) {
if (StringUtils.isNotBlank(line)) {
Type value = (Type)
getApplication().getConverterLocator().getConverter(getElementType()).convertToObject(line,
 getLocale());
lines.add(value);
}
}
}
setConvertedInput(lines);
}

}




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



Re: TextArea with list of strings.

2009-12-04 Thread Sam Barrow
No I'm getting a ConversionException, I must have made a typo. But for
the single text field I get a message in the feedback panel.

On Fri, 2009-12-04 at 13:25 -0800, Igor Vaynberg wrote:
 so walk the code and see where your ConversionException is being
 wrapped by a RuntimeException
 
 -igor
 
 On Fri, Dec 4, 2009 at 1:08 PM, Sam Barrow s...@sambarrow.com wrote:
  That's what I'm doing, but i still get the conversion exception
 
  public final class EmailAddressConverter implements IConverter {
 
 private static final long serialVersionUID = -4264887925119691218L;
 
 @Override
 public Object convertToObject(final String value, final Locale 
  locale)
  {
 if (StringUtils.isNotBlank(value)) {
 if (Valid.emailAddress(value)) {
 return new EmailAddress(value);
 }
 else {
 throw new ConversionException(Invalid email 
  address.);
 }
 }
 else {
 return null;
 }
 }
 @Override
 public String convertToString(final Object value, final Locale 
  locale)
  {
 return value.toString();
 }
 
  }
 
 
  On Fri, 2009-12-04 at 12:16 -0800, Igor Vaynberg wrote:
  you should do convertToObject() call in a try block, catch any
  exception and throw a conversionexception
 
  -igor
 
  On Fri, Dec 4, 2009 at 11:32 AM, Sam Barrow s...@sambarrow.com wrote:
  
   I am trying to make a TextArea that allows you to input a list of
   strings (separated by a newline) and turns that list into a Collection.
   I had it working but it was kind of hacked together, I'm trying to do it
   the clean way now.
   I have it working except for two things:
  
   If I give it an empty collection for the model object then it display
   square brackets [] inside the text area.
   I don't have the conversion 100% working. Like when you have a
   TextFieldDate, I'm trying to make it do the same thing to each line.
   It works, but when it is an invalid value, instead of a nice error
   message X is not a valid Y I get a runtime exception from whatever
   IConverter I am using.
  
   Source:
  
   public final class CollectionTextAreaType extends
   TextAreaCollectionType {
  
  private static final long serialVersionUID = 7147538499297387635L;
  
  private Class? elementType;
  
  public CollectionTextArea(final String id, final Class? 
   elementType)
   {
  super(id);
  setElementType(elementType);
  }
  public CollectionTextArea(final String id, final Class? 
   elementType,
   final IModelCollectionType model) {
  super(id, model);
  setElementType(elementType);
  }
  
  public Class? getElementType() {
  return elementType;
  }
  public void setElementType(Class? elementType) {
  this.elementType = elementType;
  }
  
  @Override
  protected void onBeforeRender() {
  super.onBeforeRender();
  }
  @Override
  @SuppressWarnings(unchecked)
  protected void convertInput() {
  final String text = getRawInput();
  final ListType lines = new ArrayListType();
  if (text != null) {
  for (final String line: text.split(\\r\\n)) {
  if (StringUtils.isNotBlank(line)) {
  Type value = (Type)
   getApplication().getConverterLocator().getConverter(getElementType()).convertToObject(line,
getLocale());
  lines.add(value);
  }
  }
  }
  setConvertedInput(lines);
  }
  
   }
  
  
  
  
   -
   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

Re: TextArea with list of strings.

2009-12-04 Thread Sam Barrow
I'll try that.
What about the problem with the square brackets? I can't find a function
to override that allows me to format the text inside the textarea

On Fri, 2009-12-04 at 14:01 -0800, Igor Vaynberg wrote:
 ok, override convertValue() instead of convertInput() and then the
 exception will be handled for you
 
 -igor
 
 On Fri, Dec 4, 2009 at 1:39 PM, Sam Barrow s...@sambarrow.com wrote:
  No I'm getting a ConversionException, I must have made a typo. But for
  the single text field I get a message in the feedback panel.
 
  On Fri, 2009-12-04 at 13:25 -0800, Igor Vaynberg wrote:
  so walk the code and see where your ConversionException is being
  wrapped by a RuntimeException
 
  -igor
 
  On Fri, Dec 4, 2009 at 1:08 PM, Sam Barrow s...@sambarrow.com wrote:
   That's what I'm doing, but i still get the conversion exception
  
   public final class EmailAddressConverter implements IConverter {
  
  private static final long serialVersionUID = 
   -4264887925119691218L;
  
  @Override
  public Object convertToObject(final String value, final Locale 
   locale)
   {
  if (StringUtils.isNotBlank(value)) {
  if (Valid.emailAddress(value)) {
  return new EmailAddress(value);
  }
  else {
  throw new ConversionException(Invalid 
   email address.);
  }
  }
  else {
  return null;
  }
  }
  @Override
  public String convertToString(final Object value, final Locale 
   locale)
   {
  return value.toString();
  }
  
   }
  
  
   On Fri, 2009-12-04 at 12:16 -0800, Igor Vaynberg wrote:
   you should do convertToObject() call in a try block, catch any
   exception and throw a conversionexception
  
   -igor
  
   On Fri, Dec 4, 2009 at 11:32 AM, Sam Barrow s...@sambarrow.com wrote:
   
I am trying to make a TextArea that allows you to input a list of
strings (separated by a newline) and turns that list into a 
Collection.
I had it working but it was kind of hacked together, I'm trying to do 
it
the clean way now.
I have it working except for two things:
   
If I give it an empty collection for the model object then it display
square brackets [] inside the text area.
I don't have the conversion 100% working. Like when you have a
TextFieldDate, I'm trying to make it do the same thing to each line.
It works, but when it is an invalid value, instead of a nice error
message X is not a valid Y I get a runtime exception from whatever
IConverter I am using.
   
Source:
   
public final class CollectionTextAreaType extends
TextAreaCollectionType {
   
   private static final long serialVersionUID = 
7147538499297387635L;
   
   private Class? elementType;
   
   public CollectionTextArea(final String id, final Class? 
elementType)
{
   super(id);
   setElementType(elementType);
   }
   public CollectionTextArea(final String id, final Class? 
elementType,
final IModelCollectionType model) {
   super(id, model);
   setElementType(elementType);
   }
   
   public Class? getElementType() {
   return elementType;
   }
   public void setElementType(Class? elementType) {
   this.elementType = elementType;
   }
   
   @Override
   protected void onBeforeRender() {
   super.onBeforeRender();
   }
   @Override
   @SuppressWarnings(unchecked)
   protected void convertInput() {
   final String text = getRawInput();
   final ListType lines = new ArrayListType();
   if (text != null) {
   for (final String line: text.split(\\r\\n)) {
   if (StringUtils.isNotBlank(line)) {
   Type value = (Type)
getApplication().getConverterLocator().getConverter(getElementType()).convertToObject(line,
 getLocale());
   lines.add(value);
   }
   }
   }
   setConvertedInput(lines);
   }
   
}
   
   
   
   
-
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: EntityModel

2009-11-12 Thread Sam Barrow
Oh okay. I've been trying to use @SpringBean which of course didn't work
because EntityModel is not a component. Thanks alot!

On Thu, 2009-11-12 at 09:02 +0100, Matthias Keller wrote:
 Injection is easy
 
 Just call:
 InjectorHolder.getInjector().inject(this);
 in your EntityModel constructor.
 
 That's it.
 While developing if you hot-redeploy often, you might also want to do a 
 check in load() like:
 if (this.whateverService == null)
 InjectorHolder.getInjector().inject(this);
 
 Matt
 
 Sam Barrow wrote:
  Yes that shouldn't be a problem I just need to figure out the injection,
  how do you do this? I use wicket-spring also.
 
  On Thu, 2009-11-12 at 08:53 +0100, Matthias Keller wrote:

  Hi Sam
 
  We use Spring to inject them.
  Well, somewhere you'll need that logic what class is loaded by which 
  repo - you could of course do it in a more generic way using factories 
  or a kind of a mapper or whatever...
  Since we only have around 10 classes, this is easy.
 
  If you use hibernate, you can have it for free since you can instruct 
  hibernate to load the instance given the class and the id, for example:
  T entity =  entityManager.find(entityClass, id);
 
  Matt
 
  Sam Barrow wrote:
  
  We have close to a hundred repositories, this wouldn't work. How do you
  inject the services into the EntityModel anyway?
 
  On Thu, 2009-11-12 at 08:34 +0100, Matthias Keller wrote:


  Hi Sam
 
  What exactly do you mean by repository? Do you have to load every entity 
  from another place?
  in load(), we have the code to load every possible entity in our 
  implementation, for example:
 
  T entity;
  if (this.clazz == User.class) {
  entity = userService.load(...);
  } else if (this.clazz == Company.class) {
  entity = companyService.load(...);
  } else .
 
  And so on. In the end, the entity is loaded from wherever it is defined 
  for this class...
 
  Matt
 
  Sam Barrow wrote:
  
  
  Does anybody how to pass a smart EntityModel (link below) to another
  page? We use a different repository for each entity type. I can't get it
  to work. I have tried storing the repository as a field on the
  EntityModel and using an abstract method on EntityModel to retrieve it.
 
  http://wicketinaction.com/2008/09/building-a-smart-entitymodel/



 


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



Re: HTML Editing component

2009-11-11 Thread Sam Barrow
TinyMCE is one of the most popular out there, it has some wicket
integration already done
http://wicketstuff.org/confluence/display/STUFFWIKI/wicket-contrib-tinymce


On Wed, 2009-11-11 at 20:02 -0500, Alex Rass wrote:
 Hi.
 
 Hi.
 
 Did a bit of googling, but didn't find anything good...
 
 Anyone ever had to create an edit screen where you can do html/source
 editor?
 
 Any idea what I can use?
 
 In other words: I store html in database.
 I would like to be able to let my users bring it up inside a wicket screen.
 Edit html as pretty text (and not as bunch of markup)
 And post it back into the database.
 
 What I am looking for is the a component I can use from inside Wicket
 instead of TextField()
 
 Any ideas? I'd prefer one where I have access to source as well as pretty
 (plenty of them around where it's a 2-tab edit component).
 
 Thanks in advance.
 
 I saw something about TinyMCE in some forums...
 
 - Alex.
 
 
 -
 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



EntityModel

2009-11-11 Thread Sam Barrow

Does anybody how to pass a smart EntityModel (link below) to another
page? We use a different repository for each entity type. I can't get it
to work. I have tried storing the repository as a field on the
EntityModel and using an abstract method on EntityModel to retrieve it.

http://wicketinaction.com/2008/09/building-a-smart-entitymodel/



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



Re: EntityModel

2009-11-11 Thread Sam Barrow
We have close to a hundred repositories, this wouldn't work. How do you
inject the services into the EntityModel anyway?

On Thu, 2009-11-12 at 08:34 +0100, Matthias Keller wrote:
 Hi Sam
 
 What exactly do you mean by repository? Do you have to load every entity 
 from another place?
 in load(), we have the code to load every possible entity in our 
 implementation, for example:
 
 T entity;
 if (this.clazz == User.class) {
 entity = userService.load(...);
 } else if (this.clazz == Company.class) {
 entity = companyService.load(...);
 } else .
 
 And so on. In the end, the entity is loaded from wherever it is defined 
 for this class...
 
 Matt
 
 Sam Barrow wrote:
  Does anybody how to pass a smart EntityModel (link below) to another
  page? We use a different repository for each entity type. I can't get it
  to work. I have tried storing the repository as a field on the
  EntityModel and using an abstract method on EntityModel to retrieve it.
 
  http://wicketinaction.com/2008/09/building-a-smart-entitymodel/

 


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



Re: EntityModel

2009-11-11 Thread Sam Barrow
Yes that shouldn't be a problem I just need to figure out the injection,
how do you do this? I use wicket-spring also.

On Thu, 2009-11-12 at 08:53 +0100, Matthias Keller wrote:
 Hi Sam
 
 We use Spring to inject them.
 Well, somewhere you'll need that logic what class is loaded by which 
 repo - you could of course do it in a more generic way using factories 
 or a kind of a mapper or whatever...
 Since we only have around 10 classes, this is easy.
 
 If you use hibernate, you can have it for free since you can instruct 
 hibernate to load the instance given the class and the id, for example:
 T entity =  entityManager.find(entityClass, id);
 
 Matt
 
 Sam Barrow wrote:
  We have close to a hundred repositories, this wouldn't work. How do you
  inject the services into the EntityModel anyway?
 
  On Thu, 2009-11-12 at 08:34 +0100, Matthias Keller wrote:

  Hi Sam
 
  What exactly do you mean by repository? Do you have to load every entity 
  from another place?
  in load(), we have the code to load every possible entity in our 
  implementation, for example:
 
  T entity;
  if (this.clazz == User.class) {
  entity = userService.load(...);
  } else if (this.clazz == Company.class) {
  entity = companyService.load(...);
  } else .
 
  And so on. In the end, the entity is loaded from wherever it is defined 
  for this class...
 
  Matt
 
  Sam Barrow wrote:
  
  Does anybody how to pass a smart EntityModel (link below) to another
  page? We use a different repository for each entity type. I can't get it
  to work. I have tried storing the repository as a field on the
  EntityModel and using an abstract method on EntityModel to retrieve it.
 
  http://wicketinaction.com/2008/09/building-a-smart-entitymodel/


 
 
  -
  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



another serialization question

2009-11-10 Thread Sam Barrow

One more question about serializing objects.
I have a page in the application that I'm working on that calls an
application service which returns a collection of objects of a type I'll
call ValueObject (not serializable). ValueObject has many subclasses
(which are of no concern to my wicket ui, which only deals with the
ValueObject interface).

So i have a page which calls the service and now has a collection of
ValueObjects. What is the best way to pass this object to another page?
Keep in mind it is not serializable and has no identity i can look it up
by



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



Re: another serialization question

2009-11-10 Thread Sam Barrow
But some the ValueObject classes contain a reference to an entity.
Keep in mind I mean ValueObject in the context of domain driven design,
not a DTO / data transfer object.

On Tue, 2009-11-10 at 22:12 -0500, James Carman wrote:
 ValueObjects (if you're following the design pattern) should be serializable.
 
 On Tue, Nov 10, 2009 at 10:03 PM, Sam Barrow s...@sambarrow.com wrote:
 
  One more question about serializing objects.
  I have a page in the application that I'm working on that calls an
  application service which returns a collection of objects of a type I'll
  call ValueObject (not serializable). ValueObject has many subclasses
  (which are of no concern to my wicket ui, which only deals with the
  ValueObject interface).
 
  So i have a page which calls the service and now has a collection of
  ValueObjects. What is the best way to pass this object to another page?
  Keep in mind it is not serializable and has no identity i can look it up
  by
 
 
 
  -
  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: another serialization question

2009-11-10 Thread Sam Barrow
I cannot make them serializable I don't have control over them. But even if I 
did I couldn't because the valueobject has a reference to an entity which 
cannot be serializable. The project also uses db4o which would make it much 
harder to use a serialized version.
Is dtos the best/only way? It would be a very awkward design because I have to 
both deal with subclasses of valueobject and converting the objects back when 
calling the service layer



--Original Message--
From: James Carman
To: users@wicket.apache.org
ReplyTo: users@wicket.apache.org
Subject: Re: another serialization question
Sent: Nov 10, 2009 11:39 PM

Are you designing these value objects from scratch?  Do you have
control over them?  Then, why are you averse to making them
serializable?  If you have a valid reason to not make them
serializable, then why not go with the DTO pattern and just figure out
a way to copy the attributes back and forth between your value objects
and your DTOs?



On Tue, Nov 10, 2009 at 10:17 PM, Sam Barrow s...@sambarrow.com wrote:
 But some the ValueObject classes contain a reference to an entity.
 Keep in mind I mean ValueObject in the context of domain driven design,
 not a DTO / data transfer object.

 On Tue, 2009-11-10 at 22:12 -0500, James Carman wrote:
 ValueObjects (if you're following the design pattern) should be serializable.

 On Tue, Nov 10, 2009 at 10:03 PM, Sam Barrow s...@sambarrow.com wrote:
 
  One more question about serializing objects.
  I have a page in the application that I'm working on that calls an
  application service which returns a collection of objects of a type I'll
  call ValueObject (not serializable). ValueObject has many subclasses
  (which are of no concern to my wicket ui, which only deals with the
  ValueObject interface).
 
  So i have a page which calls the service and now has a collection of
  ValueObjects. What is the best way to pass this object to another page?
  Keep in mind it is not serializable and has no identity i can look it up
  by
 
 
 
  -
  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: another serialization question

2009-11-10 Thread Sam Barrow
The value objects are not simple attributes of an entity. Let me explain what 
they do (a little simplified but the fundamentals are there).

We have a research module that performs pricing research.

ResearchItem
  CellPhoneResearchItem
  IPodResearchItem
  LaptopResearchItem
  Etc

Since the identity of these research items is defined solely by their 
attributes they are implemented as value objects. I know this is different from 
your everyday value object (eg Address) Does this sound like maybe a problem 
that should be addressed in the domain model?
Value objects were chosen since it makes it much easier in many other areas to 
just create a new research item, rather than call repositories to load old ones 
(impossible in some places). No point in loading something you know all the 
attributes of.

The only way to get them reliably is to call 
ResearchItemGenerationService.generateResearchItems()

-Original Message-
From: James Carman jcar...@carmanconsulting.com
Date: Wed, 11 Nov 2009 00:10:15 
To: users@wicket.apache.org
Subject: Re: another serialization question

Can you go through the entity to get to these objects?  Meaning, can
you set up and LDM to get the root entity object and then traverse
to get to the value object you're interested in?  If so, then you can
try to come up with some property path to get you there and use that
to refer to the specific value object you're wanting to edit/view.

On Tue, Nov 10, 2009 at 11:46 PM, Sam Barrow s...@sambarrow.com wrote:
 I cannot make them serializable I don't have control over them. But even if I 
 did I couldn't because the valueobject has a reference to an entity which 
 cannot be serializable. The project also uses db4o which would make it much 
 harder to use a serialized version.
 Is dtos the best/only way? It would be a very awkward design because I have 
 to both deal with subclasses of valueobject and converting the objects back 
 when calling the service layer



 --Original Message--
 From: James Carman
 To: users@wicket.apache.org
 ReplyTo: users@wicket.apache.org
 Subject: Re: another serialization question
 Sent: Nov 10, 2009 11:39 PM

 Are you designing these value objects from scratch?  Do you have
 control over them?  Then, why are you averse to making them
 serializable?  If you have a valid reason to not make them
 serializable, then why not go with the DTO pattern and just figure out
 a way to copy the attributes back and forth between your value objects
 and your DTOs?



 On Tue, Nov 10, 2009 at 10:17 PM, Sam Barrow s...@sambarrow.com wrote:
 But some the ValueObject classes contain a reference to an entity.
 Keep in mind I mean ValueObject in the context of domain driven design,
 not a DTO / data transfer object.

 On Tue, 2009-11-10 at 22:12 -0500, James Carman wrote:
 ValueObjects (if you're following the design pattern) should be 
 serializable.

 On Tue, Nov 10, 2009 at 10:03 PM, Sam Barrow s...@sambarrow.com wrote:
 
  One more question about serializing objects.
  I have a page in the application that I'm working on that calls an
  application service which returns a collection of objects of a type I'll
  call ValueObject (not serializable). ValueObject has many subclasses
  (which are of no concern to my wicket ui, which only deals with the
  ValueObject interface).
 
  So i have a page which calls the service and now has a collection of
  ValueObjects. What is the best way to pass this object to another page?
  Keep in mind it is not serializable and has no identity i can look it up
  by
 
 
 
  -
  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



serialization

2009-11-09 Thread Sam Barrow
Hi. Wondering if someone can help me with a serialization problem I'm
having.
To start off, the domain model in this application does not use
serializable domain objects (the project is using db4o, which does not
play well with serialized objects).

I have a page with this code:

IModelValueObject valueObjectList = new
LoadableDetachableModelValueObject() {
protected void load() {
return getVOGenerator().generateVOs();
}
}
add(new ListViewValueObject(vos, valueObjectList) {
...
});

I'm getting this error:
org.apache.wicket.util.io.SerializableChecker
$WicketNotSerializableException: Unable to serialize
class: ...ValueObject

How do I get around this?



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



Re: serialization

2009-11-09 Thread Sam Barrow
protected void populateItem(final ListItemValueObject item) {
final Money price =
getPricingService().calculatePrice(item.getModelObject());
add(new Label(price, price.toString()));
}

On Mon, 2009-11-09 at 09:56 -0800, Igor Vaynberg wrote:
 what does your listview's populateitem look like?
 
 -igor
 
 On Mon, Nov 9, 2009 at 9:50 AM, Sam Barrow s...@sambarrow.com wrote:
  Hi. Wondering if someone can help me with a serialization problem I'm
  having.
  To start off, the domain model in this application does not use
  serializable domain objects (the project is using db4o, which does not
  play well with serialized objects).
 
  I have a page with this code:
 
  IModelValueObject valueObjectList = new
  LoadableDetachableModelValueObject() {
 protected void load() {
 return getVOGenerator().generateVOs();
 }
  }
  add(new ListViewValueObject(vos, valueObjectList) {
  ...
  });
 
  I'm getting this error:
  org.apache.wicket.util.io.SerializableChecker
  $WicketNotSerializableException: Unable to serialize
  class: ...ValueObject
 
  How do I get around this?
 
 
 
  -
  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: serialization

2009-11-09 Thread Sam Barrow
sorry sorry i made a mistake in the populateItem
these is a nested listview

populateItem(ListItemValueObject item) {
final ValueObject valueObject = item.getModelObject();
add(new ListViewOtherValueObject(child, getOthers()) {
populateItem(ListItemValueObject item) {
Money price = 
getPricingService().calculatePrice(valueObject,
item.getModelObject())
}
}
}

Looks like the problem has to do with me accessing the valueObject
variable from inside the nested ListView. any clean way around this?

On Mon, 2009-11-09 at 09:56 -0800, Igor Vaynberg wrote:
 what does your listview's populateitem look like?
 
 -igor
 
 On Mon, Nov 9, 2009 at 9:50 AM, Sam Barrow s...@sambarrow.com wrote:
  Hi. Wondering if someone can help me with a serialization problem I'm
  having.
  To start off, the domain model in this application does not use
  serializable domain objects (the project is using db4o, which does not
  play well with serialized objects).
 
  I have a page with this code:
 
  IModelValueObject valueObjectList = new
  LoadableDetachableModelValueObject() {
 protected void load() {
 return getVOGenerator().generateVOs();
 }
  }
  add(new ListViewValueObject(vos, valueObjectList) {
  ...
  });
 
  I'm getting this error:
  org.apache.wicket.util.io.SerializableChecker
  $WicketNotSerializableException: Unable to serialize
  class: ...ValueObject
 
  How do I get around this?
 
 
 
  -
  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: serialization

2009-11-09 Thread Sam Barrow
It is.
Problem was actually solved by Martijn's response. Thanks alot!

On Mon, 2009-11-09 at 21:25 +0100, Michael Mosmann wrote:
 Am Montag, den 09.11.2009, 13:07 -0500 schrieb Sam Barrow:
  protected void populateItem(final ListItemValueObject item) {
  final Money price =
  getPricingService().calculatePrice(item.getModelObject());
  add(new Label(price, price.toString()));
  }
 
 is Money serializable?
 
 mm:)
 
 
 -
 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



Attempt to set model object on null model of component

2009-09-28 Thread Sam Barrow
I'm getting this exception:
java.lang.IllegalStateException: Attempt to set model object on null
model of component: form:agent

The only reason i can find is that the field has a null model, but i added a 
new Model() to the field and im still getting it

DropDownChoiceAgent agent = new DropDownChoiceAgent(agent, new 
ModelAgent(), agentList);


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



Collection of strings in form

2009-09-23 Thread Sam Barrow
What is the best way to handle a collection of strings in a form?

DomainObject
String property1
String property2
CollectionString property3

I'm thinking either some type of repeater, or a text area that creates
an element in the collection for each line (might be easier).


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



form with inheritance

2009-09-22 Thread Sam Barrow

I am trying to create a form for a domain object called Shipment. A
Shipment contains a Payment object. Payment is an abstract class, with
subclasses CashPayment, CheckPayment, etc.

What would be the best way to create a form to represent this? I'm
assuming I will use some type tabs with panels for the different types.



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