Recent site activity

Home‎ > ‎UI‎ > ‎

Places

Activities & Places, Request Factory and Editors Demo




Reference

http://tbroyer.posterous.com/ - Thomas has made some greate info on these.



ListEditor and Owned Collection in App Engine

Using a list order is a fantastic way to deal with a list of sub editors. The only difference with an Owned Collection on App Engine is that you have to independently remove items. You can always add or change an item on persist but you will not be able to delete/remote an item during persist. Both JDO and JPA will not remove items on a persist. The datastore low level api will need to remove the items. 

JPA @OneToMany

        OneToMany Source
  /**
    * owned collection
    * @Persistent(defaultFetchGroup = "true", dependentElement = "true") - for JDO
    */
  @OneToMany(fetch=FetchType.EAGER, cascade=CascadeType.ALL, targetEntity=TodoData.class)
  private List<TodoData> todos;

Debugging Editors

        Debugging Source
// this really helps with debugging the editors
    String s = EditorHierarchyPrinter.toString(driver);
    System.out.println("EditorHierarchyPrinter = " + s);

Widget State Distinction Using Enums

I like to consolidate my widgets state management using enums to distinguish the states. This prevents me from sparsely spreading around setters for visible or enabled on widgets elements and forgetting where I put them. 


Why use a String Id

I don't like to use Long as id to identify objects because I've found I like to take advantage of strong consistency in App Engine when embedding or having the object own its children and thus the keys of the children have there parents key in them too. So what I do is make the id a String and use keyToString which turns the key into base64 safe string for passing around. This also gets rid of setters and getters and worrying about parent ownerships and thus simplifies the code to and from the client and server.

Here is an example of url using the Id
https://demogwtpeople.appspot.com/#peopleedit:ImFnOXpmbVJsYlc5bmQzUndaVzl3YkdWeUVBc1NDbEJsYjNCc1pVUmhkR0VZQWd3Ig==@0@BtqU$h7AuXGib4BLRwM2oS73jp8= - this link comprises of a base 64 app engine key identifying the object to be edited.




RichTextArea In an Editor

RichTextArea widget isn't part of the editor framework by default yet. So what I do is extend it until it gets added. I haven't wrapped a decorator around this yet to indicate errors. 


SSL AppSpot on AppEngine

Using https://project.appspot.com is a simple adjustment in the web.xml file.

         Source
    <!-- ssl -->
    <security-constraint>
        <web-resource-collection>
            <url-pattern>/*</url-pattern>
        </web-resource-collection>
        <user-data-constraint>
            <transport-guarantee>CONFIDENTIAL</transport-guarantee>
        </user-data-constraint>
    </security-constraint>





Comments