Re: Problem with webobject attributes in WOBuilder
Re: Problem with webobject attributes in WOBuilder
- Subject: Re: Problem with webobject attributes in WOBuilder
- From: John Larson <email@hidden>
- Date: Fri, 16 Jun 2006 19:21:41 -0500
On Jun 16, 2006, at 7:27 AM, Mike Schrag wrote:
If I want my title to be "Mike Schrag's Home Page," then I have
some issues. Who generates that string (localization aside for the
moment)? Technically that string is entirely a view construct (the
next designer may want to change it to "The Home Page of Mike
Schrag"), but because it has a variable stuck in the middle, it has
to be in Java code.
A couple of days ago I commented that I store parameters for my code
in a database table that is separate from my business logic - or "the
model" as it relates to the business model. Then when I want to pull
in the title for a page, I have that parameter key coded, but the
value is pulled from the database. That way, though the key is hard
coded in Java, the value can be changed with sql. The same could be
accomplished with an XML file stored locally to the application
server, or a text file, or an html get command, or even the CSS
content: property (if you're using a compatible browser). My point
is that there are many methods to retrieve data external to the
compiled application, and Java code that returns that String value
for binding to a style tag in the WOComponent subclass is clean and
flexible. It is entirely possible to even have a separate EOModel
for a table to hold this display value to completely separate it from
the business model.
My take on the MVC model has been that when I'm looking at code for
processing invoices, I don't want to see code relating to the color
of the invoice total, or the logo to show in the corner, etc. I want
to see invoice processing code. Likewise, when I'm controlling
workflow, I want to see components moving from one state to another,
not code for marking customers for past-due collection. Lastly, when
I am writing code for controlling the color of a box, or the
placement of an element, I don't want to see the other two. I don't
believe that any of these stages exclude any particular technology
from being utilized to perform the work of that layer.
I use CSS for nearly all my positioning, colors, logos, etc. and
alter the CSS file directly. But I also rely heavily on Java code to
streamline the work of generating arbitrary strings to put in class
values (css Class). For example, I have a Java class called
GreenBarControl that has two methods:void reset() and String
greenBarColor(). I use this class in view WOComponents and always
call the instance gbControl. I have awake() call gbControl.reset()
and when I have a table, I bind a "class" attribute to
gbControl.greenBarColor(). greenBarColor() then returns either
"greenBar" or "whiteBar" and then in my css file I have classes
"greenBar" and "whiteBar" with the appropriate colors, background
images, padding, etc. that I want to use when the view calls for a
green-bar-like output. The result is excellent. There is hardly any
code in the WOComponent, results are consistent across the site,
implementation is simple and lightweight, and changes to the
appearance of the site can be done in the css file. I have seen the
other implementations of the green bar effect in css and jScript, and
this is much easier.
Like I said, I guess to me the exclusion of a particular technology
in the production of a page is not totally fair. As long as the code
is neat, organized, readable and with other code for the same MVC
layer, then I don't see the problem.
Humbly submitted,
John
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden