Form Architecture

Discussions about design and architecture principles, including native JADE systems and JADE interoperating with other technologies
ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Form Architecture

Postby ConvertFromOldNGs » Fri Aug 07, 2009 11:14 am

by Wilfred Verkley >> Tue, 2 Mar 1999 20:53:38 GMT

Hi Jaders

I was having a look at how forms are stored in the jade database the other day and I noticed that all the form definitions are instances of the "Form" class. Why is this? My Initial expectation was that when I design a "CustomerForm" that a single persistent instance of this class exists in the database.

I suspect the reason is so that jade doesnt have to do a re-org everytime the CustomerForm is altered?

Is there then a way of finding out what class a form definition belongs to? ie to programmatically change the definition of all the forms belonging to a certain sub-class.

Thanks,

----
Wilfred Verkley
wxv@wang.co.nz

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: Form Architecture

Postby ConvertFromOldNGs » Fri Aug 07, 2009 11:14 am

by Eric Peachey >> Tue, 2 Mar 1999 22:01:44 GMT

Hello Wilfred,

Below is a wee JadeScript that we've used for adjusting some properties of forms programmatically.

We inherited it from somebody else so I don't know it intimately. However, it gets the current locale which seems to have a collection of forms. I think the form name is the same as the class name for the form. I'd imagine that the class property of a form object would also give you its class.

Hope this is of some use.

Eric Peachey
Cardinal Engineering Centre Dunedin New Zealand ------------------------------------------------------------------------------- formAdjust() updating;

vars
rr:Form;
ff:Frame;
cc:Control;
i, j:Integer;
ll:Locale;
framesDone:ObjectArray;
begin

ll := currentSchema.getBaseLocale;
foreach rr in ll.getForms do
if currentSchema.getClass(rr.name).getSuperclass.name="SuperDuperForm" then
if rr.name= "CustomerForm" then
write "";
write "Form found "&rr.name;
beginTransaction;
// Labels to true
i := rr.controlCount;
while i > 0 do
cc:= rr.controls(i);
if cc.isKindOf(Label) and cc.parent.name <> "oneLine" then if cc.left <> 0 then
cc.left := (cc.left * 0.8333333).Integer +1;
endif;
cc.width := (cc.width * 0.8333333).Integer +1;
endif;
i := i - 1;
endwhile;
//resize Frames
i := rr.controlCount;
while i > 0 do
cc:= rr.controls(i);
if cc.isKindOf(Frame) and cc.name <> "oneLine" then

cc.width := (cc.width * 0.8333333).Integer;
cc.height := (cc.height -3 );

endif;
i := i - 1;
endwhile;
//Labels back to false

commitTransaction;
write "Done boyo";
endif;
endif;
endforeach;

end; ---------------------------------------------------------------------------------------------------------

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: Form Architecture

Postby ConvertFromOldNGs » Fri Aug 07, 2009 11:14 am

by Dean Cooper >> Tue, 2 Mar 1999 23:08:30 GMT
We inherited it from somebody else so I don't know it intimately. However, it gets the current locale which seems to have a collection of forms. I think the form name is the same as the class name for the form. I'd imagine that the class property of a form object would also give you its class.


Schemas have a collection of locales and as Eric's posting indicates, you should go through a locale to get to the forms for that locale. Be aware that if you have multiple non-clone locales in your schema (clone locales don't have any forms of their own, they use the forms of the locale they are a clone of), there will be multiple copies of each form; one per non-clone locale. All forms are instances of the Form class (to avoid having to reorg whenever properties are added to a form, as Wilfred observed). Each form has a name, which must match the name of its corresponding Form subclass. You should use form names and class names to link Form instances with your Form subclasses and vice versa. The class property of a form object will *not* return the user Form subclass, it will return the Form class (because the object is an instance of Form).

Dean.


Return to “Design and Architecture”

Who is online

Users browsing this forum: No registered users and 24 guests