View Javadoc

1   /*
2    * EditorModelGroupBinding.java
3    *
4    * Created on 3 Март 2006 г., 17:18
5    */
6   
7   package org.weda.tapestry.binding;
8   
9   import org.apache.hivemind.Location;
10  import org.apache.tapestry.BindingException;
11  import org.apache.tapestry.binding.AbstractBinding;
12  import org.apache.tapestry.coerce.ValueConverter;
13  import org.weda.model.EditorModelRegistry;
14  
15  /**
16   *
17   * @author Mikhail Titov
18   */
19  public class EditorModelGroupBinding extends AbstractBinding {
20      private EditorModelRegistry modelRegistry;
21      private String groupName;
22      
23      public EditorModelGroupBinding (
24              String description, ValueConverter valueConverter
25              , Location location
26              , EditorModelRegistry modelRegistry
27              , String groupName)
28      {
29          super(description, valueConverter, location);
30          this.modelRegistry = modelRegistry;
31          this.groupName = groupName;
32      }
33      
34      public Object getObject() {
35          try{
36              return modelRegistry.getEditorModelGroup(groupName);
37          }catch(Exception e){
38              throw new BindingException(e.getMessage(), this, e);
39          }
40      }    
41  
42      public boolean isInvariant() {
43          return false;
44      }
45      
46  }