Thanks again for the reply, Rainer - some more questions/discussion on DataType.

Recap: I asked about DataType and if it could be sub-classed and then autowired 
to a DB column. 
Rainer replied, saying column object can hold other meta-data, and can be used 
to store control type (see below).

Please understand first that I am not criticizing, I am new to EmpireDB and 
want to learn more.  I am not a troll! :-)

In the code snippet below, the control type is registered and set with a String 
literal. So compile-time-safety is gone which seems counter to a core EmpireDB 
design goal, yes? If I understand correctly, why that approach?

I loaded the examples and src and see that DataType is a Java enum which 
explains why creating an EmailText datatype that extends TEXT is not possible. 
But doesn't this design make DataType.TEXT another compile-time-unsafe literal 
in disguise as a constant integer? 

I do not like JSP. I probably will not use Struts2. I'm looking at Apache Click 
with Velocity templates and components. Has anyone adapted the 
InputControlManager work for other frameworks? What

-Tim


> In Empire-db the column object does not only contain database related 
> properties but might as well hold other additional information 
> (meta-information) that can then be used by the presentation layer or by 
> other pieces of (possibly generic) code.
> Especially for ui-components there is a property called controlType that 
> indicates what kind of control should be used for this column - independent 
> from the data type. And depending on the type of control the column may then 
> have other properties that are useful for ui-definition or generic code like 
> e.g. a list of valid values, a min- max value etc.
> In the struts2 extensions there are a number of predefined control types but 
> you may easily create your own type. The predefines types are: "text", 
> "select", "checkbox", "phone", "radio", "textarea", "email", "hlink" and 
> "password". In order to create a new one, create a class that extends 
> "org.apache.empire.struts2.jsp.controls.InputControl" and register it like 
> this: 

> InputControlManager.registerControl("mycontrol", new MyInputControl())
> 
> public final DBTableColumn EMAIL;
> public Employees(DBDatabase db)
> {
>   super("EMPLOYEES", db);
>   EMAIL= addColumn("EMAIL", DataType.TEXT, 80, DataMode.Nullable);
>   EMAIL.setControlType("email");
> }


Reply via email to