<?xml version="1.0" encoding="UTF-8"?>
<otrunk id="33754150-b594-11d9-9669-0800200c9a66" >
  <imports>
    <import class="org.concord.otrunk.OTSystem"/>
    <import class="org.concord.otrunk.view.OTFolderObject"/>
    <import class="org.concord.otrunk.view.OTViewEntry"/>
    <import class="org.concord.otrunk.view.OTViewBundle"/>
    <import class="org.concord.otrunk.view.prototype.OTPrototypeViewEntry"/>
    <import class="org.concord.otrunk.view.prototype.OTPrototypeEventController"/>
    <import class="org.concord.otrunk.view.prototype.OTPrototypeMapEntry"/>
    <import class="org.concord.otrunk.view.prototype.OTPropertyReference"/>
    <import class="org.concord.otrunk.ui.OTButton"/>
    <import class="org.concord.framework.otrunk.view.OTFrame"/>
    <import class="org.concord.otrunk.ui.OTText"/>
    <import class="org.concord.otrunk.view.document.OTCompoundDoc"/>
    <import class="org.concord.otrunk.velocity.OTVelocityXHTMLViewEntry"/>
    <import class="org.concord.otrunk.velocity.OTVelocityTemplate"/>

    <import class="org.concord.otrunk.template.OTTemplateEngineBundle"/>
    <import class="org.concord.otrunk.template.OTTemplateEngineEntry"/>
    <import class="org.concord.otrunk.template.OTTemplateObject"/>
    <import class="org.concord.otrunk.template.OTTemplateVariable"/>
    
    <import class="org.concord.otrunk.script.js.OTJavascript" />
    <import class="org.concord.otrunk.script.OTScriptEngineBundle" />
    <import class="org.concord.otrunk.script.OTScriptEngineEntry" />
    <import class="org.concord.otrunk.script.view.OTPrototypeScriptController" />
  </imports>
  <objects>
    <OTSystem>
      <bundles>
        <OTTemplateEngineBundle>
          <engines>
            <OTTemplateEngineEntry objectClass="org.concord.otrunk.velocity.OTVelocityTemplate"
            	engineClass="org.concord.otrunk.velocity.OTVelocityTemplateEngine"/>            
          </engines>
        </OTTemplateEngineBundle>
        <OTScriptEngineBundle>
          <engines>
            <OTScriptEngineEntry
              objectClass="org.concord.otrunk.script.js.OTJavascript"
              engineClass="org.concord.otrunk.script.js.OTJavascriptEngine" />
          </engines>
        </OTScriptEngineBundle>
        <OTViewBundle>
          <viewEntries>
            <OTViewEntry local_id="text_edit"
              objectClass="org.concord.otrunk.ui.OTText" 
              viewClass="org.concord.otrunk.ui.swing.OTTextEditView"/>
            <OTViewEntry
              objectClass="org.concord.otrunk.ui.OTButton"
              viewClass="org.concord.otrunk.ui.swing.OTButtonView"/>
            
            <OTPrototypeViewEntry 
            	objectClass="org.concord.otrunk.view.prototype.OTPropertyReference"
            	viewClass="org.concord.otrunk.view.prototype.OTPrototypePropertyView"
            	viewEntry="${text_edit}">
            	<prototype>
            		<OTText text="default" />
            	</prototype>
            	<controller>
            		<OTPrototypeEventController>
            			<mapping>
            			   <OTPrototypeMapEntry prototypeProperty="text"/>
            			</mapping>
            		</OTPrototypeEventController>
            	</controller>
            </OTPrototypeViewEntry>

            <OTPrototypeViewEntry local_id="button_editor"
            	objectClass="org.concord.otrunk.ui.OTButton"
            	viewClass="org.concord.otrunk.view.prototype.OTPrototypeView"
            	viewEntry="${template_object_view}">
            	<prototype>
            		<OTTemplateObject name="Template Document"
            			template="${object_editing_template}">
            			<variables>
            				<OTTemplateVariable name="model"/>
            				<OTTemplateVariable name="properties">
            					<reference>
            						<OTFolderObject>
            							<children>
            								<OTPropertyReference
            									property="name" />
            								<OTPropertyReference
            									property="text" />
            							</children>
            						</OTFolderObject>
            					</reference>
            				</OTTemplateVariable>
            			</variables>
            		</OTTemplateObject>
            	</prototype>
            	<controller>
            		<OTPrototypeScriptController>
            			<script>
            				<OTJavascript src="object-editor-4.js" />
            			</script>
            		</OTPrototypeScriptController>
            	</controller>
            </OTPrototypeViewEntry>

            <OTViewEntry local_id="document_view"
              objectClass="org.concord.otrunk.view.document.OTDocument" 
              viewClass="org.concord.otrunk.view.document.OTDocumentView"/>                         
			<OTViewEntry local_id="template_object_view"
				objectClass="org.concord.otrunk.template.OTTemplateObject"
				viewClass="org.concord.otrunk.template.OTTemplateObjectView"/>
          </viewEntries>
        </OTViewBundle>
      </bundles>
      <library>
      	<OTVelocityTemplate local_id="object_editing_template">
      		<template>
      			Name: $model.name
      			<table>
      				#foreach( $property in $properties.children.vector)
      				<tr>
      					<td>$property.property :</td>
      					<td>
      						<object refid="$property.globalId" />
      					</td>
      				</tr>
      				#end
      			</table>
      		</template>
      	</OTVelocityTemplate>
      </library>
      <root>
        <OTCompoundDoc name="root">
          <bodyText>
            This is an example of using a prototype view, where the prototype is a template object.
 With OTPropertyReferences pointing to the properties being displayed.  These PropertyReferences are not
 bound to a particular instance in the prototype, but the prototype view's controller binds them when the view
 is first requested.  This should make the view work for any instance of the particular object type (OTClass).
   		  </bodyText>   		  
   		  <children>
			<OTCompoundDoc name="Button Editing Doc">
			  <bodyText>
			     Document for pointing to the editing view of the button object.<br/>
			     <object refid="${button}" viewid="${button_editor}"/>
			  </bodyText>
			</OTCompoundDoc>   		  
   		    <OTButton local_id="button" name="button name" text="Click Me"/>
   		  </children>
   	    </OTCompoundDoc>
      </root>
    </OTSystem>
  </objects>
</otrunk>
