Workspace , modules and view

7 posts / 0 new
Last post
joshkam
Offline
Joined: 11/20/2009
Workspace , modules and view

Hi guys

I am reading the reference guide and i got lost somewhere. I have been able to describe the model and the view and now am doing the application, workspaces and modules part. My questions is, how are the views that i created linked to the modules. How does the module know which view to put where? i know am definately missing something important.

 

 

Kind regards.

vvandens
Offline
Joined: 05/29/2008
Workspaces, modules and view

Hi Josh,

I think you've already gone throught §I.7.1.3 of the ref doc. You have a basic customization there, where you declare a view (City.module.view) as being the one to use when displaying one of the cities (elementViewDescriptor). This will certainly be one of the most current usage. The doc is still missing a lot of details on this, but I'm working hard to improve it for the next release.

To go beyond this usage scenario, here are a few details regarding how views are connected to modules.

A module provides a projectedViewDescriptor. When the user selects a module, Jspresso retrieves its projectedViewDescriptor, creates the view based on it and installs the created view in the workspace window. So, basically, you assign the view to display for a module by configuring its projectedViewDescriptor.

Now, you may wonder why we didn't go through this property when dealing with the modules of the HR sample application. This is because we are only using FilterableBeanCollectionModule. This built-in module type automatically generates its projectedViewDescriptor based on the type of entity it's managing, i.e. it displays a view containing :

  1. A top form for the QBE filter (based on the list of queriableProperties of the entity)
  2. A table to display the result of the query
  3. A set of actions.

One of the actions above is used to focus the selected entity in the workspace window (using the configured elementViewDescriptor). What this action does internally is :

  1. Create a new BeanModule
  2. Take the elementViewDescriptor and make it the projectedViewDescriptor of the new bean module created above
  3. Install the bean module as a child of the filterable collection module
  4. Select the new bean module in the workspace navigator

So you've manipulated modules' projectedViewDescriptor without even knowing it since you've used a FilterableBeanCollectionModule that hides those details.

Of course, although QBE screens are often the entry points on a domain model, you might need to have a module -either for a single model or for a collection- that, for instance, bypasses the filter/query step to immediately display a list of entities when the user selects the module in the workspace navigator. In that case, FilterableBeanCollectionModule is not suitable anymore. So you would build either a BeanModule (for a single bean model) or a BeanCollectionModule (for a bean collection model) and configure it explicitely with a projectedViewDescriptor. Now the only problem left, since there is no QBE step anymore, is "how do you pre-load the module object(s) to display as model" ? This is done through the use of a module startupAction. Take a look at this thread to understand how this would be implemented.

 

Don't hesitate to post back if you need some further explaination on the topic.

HTH,

Vincent

aol
Offline
Joined: 09/25/2009
Hi, views placement is

Hi,

views placement is defined in your view.xml file. (xml snipplets are from reference applicatoin):

 

<bean id="Employee.module.view" parent="decoratedView" class="org.jspresso.framework.view.descriptor.basic.BasicSplitViewDescriptor">

<!-- we create a split view, a vertical split by default (one subview above another -->
    <property name="leftTopViewDescriptor" ref="Employee.pane" /> <!-- place an Employee pane in the top subview -->
    <property name="rightBottomViewDescriptor"> <!-- in the bottom subview ... -->
      <bean class="org.jspresso.framework.view.descriptor.basic.BasicSplitViewDescriptor"> <!--we create another split view -->
        <property name="orientation" value="HORIZONTAL" /> <!-- now we would like a horizontal one -->
        <property name="cascadingModels" value="true" />
        <property name="leftTopViewDescriptor" ref="Employee-events.table" /> <!-- events table is on the left ... -->
        <property name="rightBottomViewDescriptor" ref="Event.text.pane" /> <!-- ... and event text is on the right. -->
      </bean>
    </property>
    <property name="actionMap">
     <!-- snip -->
    </property>
  </bean>

 

forntend.xml is responsible for describing workspaes and the application controller.

define a workspace there. something like that

<bean id="Employees.workspace" parent="abstractWorkspace" scope="prototype">
    <property name="name" value="employees.workspace" />
    <property name="description" value="employees.workspace.description" />
    <property name="iconImageURL" value="classpath:org/jspresso/hrsample/images/people-48x48.png" />
    <property name="modules">  <!-- a list of modules used in the workspace -->
      <list>
        <!-- snip   -->
        <bean parent="abstractFilterableBeanCollectionModule"> <!-- a module - is a set of views you've described in the view.xml -->
          <property name="name" value="employees.module" />
          <property name="description" value="employees.module.description" />
          <property name="iconImageURL" value="classpath:org/jspresso/hrsample/images/employees-48x48.png" />
          <property name="elementComponentDescriptor" ref="Employee" /> <!--reference to the model -->
          <property name="elementViewDescriptor" ref="Employee.module.view" /> <!--reference to the view -->
          <property name="pageSize" value="4" />
        </bean>
      </list>
    </property>
<!-- snip -->
  </bean>

... and the final step - list you workspaces in the application controller

<bean id="applicationFrontController" parent="frontController" scope="prototype">
    <property name="name" value="hrsample.name" />
    <property name="iconImageURL" value="classpath:org/jspresso/hrsample/images/people-48x48.png" />
    <property name="loginContextName" value="hrsample" />
    <property name="forcedStartingLocale" value="en" />
    <property name="workspaces">
      <list>
<!--snip -->
        <ref bean="Employees.workspace" />
<!-- snip -->
      </list>
    </property>
  </bean>

 

 

Hope that helps you a bit,

 

Regards,

Andrey

joshkam
Offline
Joined: 11/20/2009
Workspace , modules and view

Thanks alot guys for the prompt response.

That really helped. atleast i know where to begin. However, there seems to be alot nice features that are still not documented especially on Views , actions and modules.

josh

aol
Offline
Joined: 09/25/2009
Yeah, Josh, jspresso is kinda

Yeah, Josh, jspresso is kinda gold mine, haha ;))

Hope, all that "treasures" will be documented some day... )

vvandens
Offline
Joined: 05/29/2008
Hopefully

Hopefully, I can help you to dig into the mine until I finish to draw the map Wink.

 

Vincent

aol
Offline
Joined: 09/25/2009
Sure, you do, Vincent! your

Sure, you do, Vincent!

your thorough answers help me very much!

 

Andrey