on 6/14/01 3:14 PM, "Diethelm Guallar, Gonzalo" <[EMAIL PROTECTED]>
wrote:
>> In reality, these days, a properly designed application
>> should never have
>> *any* Java Screen modules other than potentially a
>> "Default.java" which gets
>> executed for every Screen template in a directory. This is
>> called the Pull Model.
>
> Could you expand a little on that? Say you have a read-only
> app (where you show the contents of your DB tables, but can't
> modify them at all). So, no action classes here. Now, say you
> have two screens, SA showing the contents of table A, and SB
> showing the contents of table B. The selects and peers used
> to retrieve the data are totally different in each screen.
> I naturally see two screen classes here, SA.java and SB.java.
> If this is not correct, or it is the old-fashioned way of doing
> things, how would you do the same with one Default.java screen?
It has been old fashioned since I wrote the Pull Model document.
You create a PullTool which puts an object into the Context. This object has
the ability to execute code which would be the results of the tables as say
a Vector. If you use Torque, it makes it even easier since the BO's are
created for you.
In other words, you have TableA.java. TableAPeer.java will return a list of
TableA objects in the doSelect() method. You then write a Pull Tool and add
it to the context through the configuration in the TR.props file.
#set ( $tableData = $tool.TableA)
#foreach ( $tableRow in $tableData )
<tr><td>$tableRow.Column</td></tr>
#end
This way, your template is not tied to any code in order to place the table
data into the context. Instead it is retrieved directly through the $tool.
The nice thing is that the $tool can do things like cache the data behind
the scenes using the Global Cache Service...
-jon
--
"Open source is not available to commercial companies."
-Steve Ballmer, CEO Microsoft
<http://www.suntimes.com/output/tech/cst-fin-micro01.html>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]