Results 1 to 2 of 2

Thread: BUG/ENH: BaseTreeModel generics too restrictive

  1. #1
    Ext User
    Join Date
    Jun 2008
    Posts
    6
    Vote Rating
    0
      0  

    Default BUG/ENH: BaseTreeModel generics too restrictive

    BaseTreeModel is declared as:

    public class BaseTreeModel<T extends TreeModel> extends BaseModel implements TreeModel<T> { .. }

    with the parent attribute of type T:

    protected T parent;

    and the children collection of type List<T>:

    protected List<T> children;

    This is extremely restrictive i.e. mandating that the parent and children be of the same type. I can honestly say that I have never actually designed or worked with tree models where all the data nodes were of the same type.

    Can you split the parent and child type parameters into separate types?

    Cheers
    Craig

  2. #2
    Sencha - GXT Dev Team darrellmeyer's Avatar
    Join Date
    May 2007
    Location
    Washington, DC
    Posts
    2,242
    Vote Rating
    2
      0  

    Default

    If you have different parent / child types, then specify the common super type, which may be TreeModel. In this scenario, you will need to perform the appropriate casts.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •