Monday, November 29, 2010

Extended Methods for EntityProxies


-== Context ==-
I have created a widget that implicitly holds an EntityProxy as it's
backing value.


MySpecialDisplayPanel<E extends EntityProxy>

I use this panel (which has a Label and other decorations) when I need
to display the entity.
Click on the entity and it swaps to a listbox to choose another. So
the Entity attached to the MySpecialDisplayPanel is the "chosen" value
and a list of applicable entities is the backing store.

I call a method E getEntity() to get back the chosen Entity.

-== My Question ==-
I have a few entities which are displayed by this display panel and I
wanted to add a generic "toString() or getDisplayText() for all
entities so I can reliably just show it anywhere and as "how " the
entity needs to be displayed.

(a) is this the best approach for creating "proxy holding widgets ? "
(b) if it is, how do you suggest I implement the toString across the
Does the EntityProxy prardigm only work with get/set pairs. ?
(that I have to add a {get|set}DisplayString() to all real entities
(abstract base class) ..
or is there an easier / nicer way).

on the real entity.. I was thinking of something like:

public abstract class AbstractEntity {
// .. other fields common for all entities
@Transient // ignore for JPA
private String displayString;
public void setDisplayString(String displayString )
{ this.displayString = displayString;}
public String getDisplayString() { return this.displayString; }

public class BusinessArea extends AbstractEntity {

private String name;
public void setName(String name) { = name;
public String getName() { return; }



(I recall that RequestFactory can't deal with Abstract classes yet -

My fall back is a displayhelper.
suggestions ?

You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to
To unsubscribe from this group, send email to
For more options, visit this group at

No comments:

Post a Comment