>Hi,
>
>I'm Using WO4, NT4
>
>I finally decided to move some of my code into a framework so that I could
>share with my co-workers. I built a framework and put 2-3 pages in it. Did
>a Make install. Added it to a project by dragging the framework into the
>frameworks suitcase. BUT in WOBuilder I don't see my framework pages when I
>look at the custom class lists. What did I do wrong? Is the only way to use
>pages from a framework through a Palette? I thought I have seen pages from
>other frameworks show up but I'm not positive. Any/All help is very
>appreciated.
>
>Bob Stuart
>Lockheed Martin


In the framework directory(folder) are all the pages you have built ending
in folders ending in .wo.  Just make sure you have set each page type to
"partial document" from the inspector.

Now when you share your code, you ship the whole framework in
myFrameWork.framework and all the .wo folders in side of an
myFrameWork.framework\Resources\ folder.

Your coworkers can then just open the .wo folders and drag the components
from the editor into their editor if they want.

However, after you have built your framework for install you can create a
palette with all the pages you desire.

>From the builder, choose Palettes->New Palette and place it somewhere you
like (I alway put it into myFrameWork.framework\ folder). Make the palette
editable now as per the docs.

Now from the filesystem, drag all the .wo folders you want into the palette
builder.  You can change the name/icon as you like.  Save the palette and
away you go.


More fun with frameworks:

After you have build the framework you will want to subclass the
corresponding class files to get all the code and functionality for the
component.  Or just call its methods if they are static.  I do both, but
there is a small wrinkle.

Example:
        In the framework you have:

        public class myParentClass extends Object{
                private dataClass myParentClassData;

                WOComponent submit(){ ... do it ... };
        }

        Somewhere in your framework:

        WOComponent nextPage = new
                        pageWithName(nameOfPageInstalledByWOApplCode);

        nextPage.setMyParentClassData(theData);

        return nextPage;

=========================Nice Clean Line===============================

        In you WO application you have:

        public class myChildClass extends myParentClass{

                public myChildClass(){ super(); }

                WOComponent submit(){ return(super.submit()) };

        }

        Elsewhere in you WO code:

                myFrameworkClass.setNameOfPageInstalledByWOApplCode(
                        "myChildClass");
                (This page has your components and is called myChildClass.wo)




The fun part is when you ask for the new subclassed class and try to
construct it from within the framework (ie, a callback page for errors).
In java, I have found that the parents constructor gets called twice and
wipes out the attibutes even after you have called the setter() from within
your framework.

To fix this problem define in the .api file a required parameter with the
same name; eg; myParentClassData. Then using the component inspector,
connect the required parameter to itself myParentClassData =
myParentClassData.  This causes the framework and WOE to save the
dataObject, so your framework's code will work like you think it should.

More to come:

I have been working on a big project to define an Role Based Access Control
(RBAC) framework for the last month and I am just about ready to release
it.  I have spent a lot of time figuring out frameworks and how to debug
them.  I am currently writting my lessons on frameworks, how to work with
them and debug them and such and will post it to the list when I am done.

Hope this helps
ty









Reply via email to