You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by da...@apache.org on 2013/07/25 18:18:14 UTC

svn commit: r1507050 - /isis/site/trunk/content/core/dynamic-layouts.md

Author: danhaywood
Date: Thu Jul 25 16:18:14 2013
New Revision: 1507050

URL: http://svn.apache.org/r1507050
Log:
more on dynamic layouts

Modified:
    isis/site/trunk/content/core/dynamic-layouts.md

Modified: isis/site/trunk/content/core/dynamic-layouts.md
URL: http://svn.apache.org/viewvc/isis/site/trunk/content/core/dynamic-layouts.md?rev=1507050&r1=1507049&r2=1507050&view=diff
==============================================================================
--- isis/site/trunk/content/core/dynamic-layouts.md (original)
+++ isis/site/trunk/content/core/dynamic-layouts.md Thu Jul 25 16:18:14 2013
@@ -1,14 +1,19 @@
 Title: Static and Dynamic Layouts
 
-Because Isis implements the [naked objects pattern](http://en.wikipedia.org/wiki/Naked_objects), the domain objects are rendered in the UI based only metadata gleaned from the domain classes themselves.
+> You can also watch a [screencast](../getting-started/screencasts.html) demonstrating static and dynamic layouts. 
 
-## Specifying layout using annotations
+Because Isis implements the [naked objects pattern](http://en.wikipedia.org/wiki/Naked_objects), the domain objects are rendered in the UI based only metadata gleaned from the domain classes themselves.  This metadata can be specified statically, using annotations, or dynamically, using a JSON file.
 
-### @MemberOrder Annotation ###
+## Specifying layout statically, using annotations
 
-To specify the relative order of domain class properties and classes, the `@MemberOrder` annotation is used.  For example:
+### The @MemberOrder Annotation ###
+
+To specify the relative order of domain class properties and classes, the `@MemberOrder` annotation is used.
+
+For example:
 
     public class ToDoItem {
+
         @MemberOrder(sequence="1")
         public String getDescription() { ... }
 
@@ -31,10 +36,9 @@ To specify the relative order of domain 
         public Long getVersionSequence() { ... }
 
         ...
-
     } 
 
-defines three property (or member) groups, "General", "Detail" and "Misc"; "General" is the default if no `name` attribute is specified.  Properties in the same member group are rendered together, as a fieldset.  
+This defines three property (or member) groups, "General", "Detail" and "Misc"; "General" is the default if no `name` attribute is specified.  Properties in the same member group are rendered together, as a fieldset.  
 
 In addition, actions can optionally be associated (rendered close to) either properties or actions.  This is done by overloading the `@MemberOrder`'s `name` attribute, holding the value of the property or collection.
 
@@ -49,6 +53,7 @@ For example:
         public SortedSet<ToDoItem> getDependencies() { ... }
 
 
+        // actions ...
         @MemberOrder(name="complete", sequence="1")
         public ToDoItem completed() { ...}
 
@@ -56,6 +61,7 @@ For example:
         public ToDoItem notYetCompleted() { ...}
 
 
+        // more actions ...
         @MemberOrder(name="dependencies", sequence="1")
         public ToDoItem add(ToDoItem t) { ...}
 
@@ -66,14 +72,14 @@ For example:
 
 will associate the `completed()` and `notYetCompleted()` actions with the `complete` property, and will associate the `add()` and `remove()` actions with the `dependencies` collection.
 
-If the `name` attribute is omitted, then the action is rendered near the header.
+If the `name` attribute is omitted, then the action is rendered near the header.  Note also that the `@MemberOrder`'s `name` attribute has no meaning for collections.
 
-Finally, note that the `@MemberOrder`'s `name` attribute has no meaning for collections.
 
+### The @MemberGroupLayout Annotation
 
-### @MemberGroupLayout Annotation
+The `@MemberGroupLayout` annotation specifies the relative positioning of  property groups as being either in a left column, a middle column or in a right column.  It also specifies the relative width.
 
-The `@MemberGroupLayout` annotation specifies the relative positioning of  property groups as being either in a left column, a middle column or in a right column.  It also specifies the relative width: 
+For example:
 
     @MemberGroupLayout(
          columnSpans={3,3,0,6}, left={"General", "Misc"}, middle="Detail")
@@ -115,14 +121,14 @@ If the sum of all the columns exceeds 12
 
 While the use of annotations to specify layout metadata is typesafe, it does have the disadvantage that changing the layout means recompiling the code and redeploying.
 
-So, instead, the layout metadata can be specified using a JSON layout file.  The [`DeveloperUtilitiesService`](services/developer-utilities-service.html) can then be used to refresh the layout (rebuilding the metamodel for the domain class in question).
+So, instead, the layout metadata can be specified using a JSON layout file.  The [Developer Utilities Service](services/developer-utilities-service.html) can then be used to refresh the layout (rebuilding the metamodel for the domain class in question).
 
-The JSON layout file takes the name `Xxx.layout.json`, where `Xxx` is the class name, and resides in the same package as the class.  For example, the layout for the [`ToDoItem`](https://github.com/apache/isis/blob/f38fdb92941172eabb12e0943509f239e6d5925f/example/application/quickstart_wicket_restful_jdo/dom/src/main/java/dom/todo/ToDoItem.java) class is [`ToDoItem.layout.json`](https://github.com/apache/isis/blob/f38fdb92941172eabb12e0943509f239e6d5925f/example/application/quickstart_wicket_restful_jdo/dom/src/main/java/dom/todo/ToDoItem.layout.json)  
+The JSON layout file takes the name `Xxx.layout.json`, and resides in the same package as the class.  For example, the layout for the [ToDoItem](https://github.com/apache/isis/blob/f38fdb92941172eabb12e0943509f239e6d5925f/example/application/quickstart_wicket_restful_jdo/dom/src/main/java/dom/todo/ToDoItem.java) class is [ToDoItem.layout.json](https://github.com/apache/isis/blob/f38fdb92941172eabb12e0943509f239e6d5925f/example/application/quickstart_wicket_restful_jdo/dom/src/main/java/dom/todo/ToDoItem.layout.json)  
 
 The format of the `.layout.json` file is:
 
     {
-        columns: [                                  // list of columns
+        columns: [                                      // list of columns
             {
                 span: 6,                                // span of the left-hand property column
                 memberGroups: {                         // ordered map of member (property) groups