Re: Adding a User Object to the Component Class

2009-11-27 Thread Keith Bennett

Igor  Martijn -

Thanks for all the information.  I didn't know about the existence of  
metadata in the various classes; that's what I was looking for.


I have a question about the metadata implementation.  The javadoc  
indicates that the special MetaDataKey approach (rather than using a  
plain Map) is necessary because object identity will not work due to  
serializations and deserializations.  However, although Object's  
equals() tests for identity, other classes override it for tests of  
logical equality.  So why isn't it possible to use a regular Map and  
rely on the programmer to provide an appropriate equals() for custom  
classes?


Thanks,
Keith


On Nov 27, 2009, at 2:55 AM, Igor Vaynberg wrote:


datatable.setmetadata(mykey, myobject);


.. somewhere in a component under datatable
public mytype findreference() {
  datatable table=findparent(datatable.class);
  return table.getmetadata(mykey);
}


-igor

On Thu, Nov 26, 2009 at 11:02 PM, Keith Bennett keithrbenn...@gmail.com 
 wrote:

Igor -

Thanks for responding.

The User solution would work where all components would share the  
same

reference, but I need each table would have its own reference.

Also, I was thinking it would be nice for each component to have  
its own

Object.  I realize I could have been clearer about that.

Thanks,
Keith



On Nov 27, 2009, at 1:16 AM, Igor Vaynberg wrote:


create your own subclass of websession that holds the user and then
anywhere within a wicket request you can get to it via:

((MySession)Session.get()).getUser()

-igor

On Thu, Nov 26, 2009 at 6:20 PM, Keith Bennett keithrbenn...@gmail.com 


wrote:


All -

I'm coding a Wicket table and would like all the components in  
the table

to
have access to a specific reference.

Another framework I worked with a very long time ago (Vermont  
Views, I
believe) addressed this by providing a user pointer in the class  
that

could
be used for any purpose the programmer wanted.  It was a void *  
in C; in

Java it would be an Object reference.

What do you think about adding this to Wicket's Component class,  
and

maybe
even others, like Page, Form, etc.?

Thanks,
Keith

---
Keith R. Bennett
Senior Software Consultant
Linked In: http://www.linkedin.com/in/keithrbennett
Blogs: http://krbtech.wordpress.com, http://keithrbennett.wordpress.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



Adding a User Object to the Component Class

2009-11-26 Thread Keith Bennett

All -

I'm coding a Wicket table and would like all the components in the  
table to have access to a specific reference.


Another framework I worked with a very long time ago (Vermont Views, I  
believe) addressed this by providing a user pointer in the class that  
could be used for any purpose the programmer wanted.  It was a void *  
in C; in Java it would be an Object reference.


What do you think about adding this to Wicket's Component class, and  
maybe even others, like Page, Form, etc.?


Thanks,
Keith

---
Keith R. Bennett
Senior Software Consultant
Linked In: http://www.linkedin.com/in/keithrbennett
Blogs: http://krbtech.wordpress.com, http://keithrbennett.wordpress.com




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



Re: Adding a User Object to the Component Class

2009-11-26 Thread Igor Vaynberg
create your own subclass of websession that holds the user and then
anywhere within a wicket request you can get to it via:

((MySession)Session.get()).getUser()

-igor

On Thu, Nov 26, 2009 at 6:20 PM, Keith Bennett keithrbenn...@gmail.com wrote:
 All -

 I'm coding a Wicket table and would like all the components in the table to
 have access to a specific reference.

 Another framework I worked with a very long time ago (Vermont Views, I
 believe) addressed this by providing a user pointer in the class that could
 be used for any purpose the programmer wanted.  It was a void * in C; in
 Java it would be an Object reference.

 What do you think about adding this to Wicket's Component class, and maybe
 even others, like Page, Form, etc.?

 Thanks,
 Keith

 ---
 Keith R. Bennett
 Senior Software Consultant
 Linked In: http://www.linkedin.com/in/keithrbennett
 Blogs: http://krbtech.wordpress.com, http://keithrbennett.wordpress.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



Re: Adding a User Object to the Component Class

2009-11-26 Thread Keith Bennett

Igor -

Thanks for responding.

The User solution would work where all components would share the same  
reference, but I need each table would have its own reference.


Also, I was thinking it would be nice for each component to have its  
own Object.  I realize I could have been clearer about that.


Thanks,
Keith



On Nov 27, 2009, at 1:16 AM, Igor Vaynberg wrote:


create your own subclass of websession that holds the user and then
anywhere within a wicket request you can get to it via:

((MySession)Session.get()).getUser()

-igor

On Thu, Nov 26, 2009 at 6:20 PM, Keith Bennett keithrbenn...@gmail.com 
 wrote:

All -

I'm coding a Wicket table and would like all the components in the  
table to

have access to a specific reference.

Another framework I worked with a very long time ago (Vermont  
Views, I
believe) addressed this by providing a user pointer in the class  
that could
be used for any purpose the programmer wanted.  It was a void * in  
C; in

Java it would be an Object reference.

What do you think about adding this to Wicket's Component class,  
and maybe

even others, like Page, Form, etc.?

Thanks,
Keith

---
Keith R. Bennett
Senior Software Consultant
Linked In: http://www.linkedin.com/in/keithrbennett
Blogs: http://krbtech.wordpress.com, http://keithrbennett.wordpress.com




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



Re: Adding a User Object to the Component Class

2009-11-26 Thread Martijn Dashorst
Adding another reference to component would increase the memory
footprint for all users. You are the first one to ask so there's
little to no demand for it. Wicket already has a default object slot:
the model. If that doesn't solve your problem use the metadata.

Martijn

On Friday, November 27, 2009, Keith Bennett keithrbenn...@gmail.com wrote:
 Igor -

 Thanks for responding.

 The User solution would work where all components would share the same 
 reference, but I need each table would have its own reference.

 Also, I was thinking it would be nice for each component to have its own 
 Object.  I realize I could have been clearer about that.

 Thanks,
 Keith



 On Nov 27, 2009, at 1:16 AM, Igor Vaynberg wrote:


 create your own subclass of websession that holds the user and then
 anywhere within a wicket request you can get to it via:

 ((MySession)Session.get()).getUser()

 -igor

 On Thu, Nov 26, 2009 at 6:20 PM, Keith Bennett keithrbenn...@gmail.com 
 wrote:

 All -

 I'm coding a Wicket table and would like all the components in the table to
 have access to a specific reference.

 Another framework I worked with a very long time ago (Vermont Views, I
 believe) addressed this by providing a user pointer in the class that could
 be used for any purpose the programmer wanted.  It was a void * in C; in
 Java it would be an Object reference.

 What do you think about adding this to Wicket's Component class, and maybe
 even others, like Page, Form, etc.?

 Thanks,
 Keith

 ---
 Keith R. Bennett
 Senior Software Consultant
 Linked In: http://www.linkedin.com/in/keithrbennett
 Blogs: http://krbtech.wordpress.com, http://keithrbennett.wordpress.com




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



-- 
Become a Wicket expert, learn from the best: http://wicketinaction.com
Apache Wicket 1.4 increases type safety for web applications
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.4.0

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



Re: Adding a User Object to the Component Class

2009-11-26 Thread Igor Vaynberg
datatable.setmetadata(mykey, myobject);


.. somewhere in a component under datatable
public mytype findreference() {
   datatable table=findparent(datatable.class);
   return table.getmetadata(mykey);
}


-igor

On Thu, Nov 26, 2009 at 11:02 PM, Keith Bennett keithrbenn...@gmail.com wrote:
 Igor -

 Thanks for responding.

 The User solution would work where all components would share the same
 reference, but I need each table would have its own reference.

 Also, I was thinking it would be nice for each component to have its own
 Object.  I realize I could have been clearer about that.

 Thanks,
 Keith



 On Nov 27, 2009, at 1:16 AM, Igor Vaynberg wrote:

 create your own subclass of websession that holds the user and then
 anywhere within a wicket request you can get to it via:

 ((MySession)Session.get()).getUser()

 -igor

 On Thu, Nov 26, 2009 at 6:20 PM, Keith Bennett keithrbenn...@gmail.com
 wrote:

 All -

 I'm coding a Wicket table and would like all the components in the table
 to
 have access to a specific reference.

 Another framework I worked with a very long time ago (Vermont Views, I
 believe) addressed this by providing a user pointer in the class that
 could
 be used for any purpose the programmer wanted.  It was a void * in C; in
 Java it would be an Object reference.

 What do you think about adding this to Wicket's Component class, and
 maybe
 even others, like Page, Form, etc.?

 Thanks,
 Keith

 ---
 Keith R. Bennett
 Senior Software Consultant
 Linked In: http://www.linkedin.com/in/keithrbennett
 Blogs: http://krbtech.wordpress.com, http://keithrbennett.wordpress.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