Re: Pure Swing + EOF distribution channel

"Pierre Gilquin" <[email protected]> Wed, 9 Nov 2005 18:27:41 +0100
Newsgroups gmane.comp.web.webobjects.eof
Message-ID <[email protected]>
Your are welcome.


Seems what I did is different (may be not everything is mandatory)

1) in the main.wo, I add a WOJavaClientApplet
with bindings like this
{
 applicationClassName =3D "mypackage.MyAppAdmin";
 height =3D 512;
 width =3D 512;
}

2) on the client side mypackage.MyAppAdmin.java

public class MilapiAdmin extends EOApplication {

    protected void finishInitialization()
    {
//    super.finishInitialization(); // il faut eviter le comportement par=
=20
defaut
// support for ssl
      Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());
      System.setProperty("java.protocol.handler.pkgs",=20
"com.sun.net.ssl.internal.www.protocol");


      new MainApplication(); // my real EOF application
    }

    public static void main(String[] args) {

    try {

     System.out.println("Attempting to contact server...");

     EOClientApplicationSupport.main(new=20
String[]{args[0],args[1],"-applicationClassName","mypackage.MyAppAdmin"})=
;

    }
    catch(Exception e) {
        e.printStackTrace();
       JOptionPane.showMessageDialog(null, "D=E9sol=E9, l'application ne =
peut se=20
connecter au serveur " + args[1] + ".\nPri=E8re de contacter le support."=
 ,=20
"Probl=E8me de connection", JOptionPane.ERROR_MESSAGE);
       System.exit(0);
    }

}

MainApplication.java is the standart Java appli where you can create a=20
editing context and play with the data.
You can them start appli with :

java -classpath "wojavaclient.jar;...." mypackage.MyAppAdmin -application=
URL=20
http://myServer/cgi-bin/WebObjects/MyAppServer.woa
Tell me if you need more details.


Pierre


----- Original Message -----=20
From: "Florijan Stamenkovic" <[email protected]>
To: "Pierre Gilquin" <[email protected]>
Cc: "EOF at Omni" <[email protected]>
Sent: Wednesday, November 09, 2005 3:41 PM
Subject: Re: Pure Swing + EOF distribution channel


Hi Pierre,

Thanks a lot for the hand. I posted the same question to webobjects
list at Apple and got to a solution. I am sending a part of the thread
below (response from [email protected]. Please feel free to comment.

Best regards,
Flor


>
>
> I've recently done something similar. I believe the correct way to do w=
hat=20
> you propose is to create a subclass of EOApplication. Make sure you hav=
e=20
> the function:
> protected void finishInitialization() {
> super.finishInitialization();
>
> // call your startup code
>
> }
>
> Bind this new subclass to applicationClassName in the JavaClient=20
> component. It's very similar to the server side, to get access to your=20
> application object call EOApplication.sharedInstance() and typecast it =
to=20
> your class.
>
>
> The framework will be completely initialized after you call the super=20
> function and you can do what you want. The one caveat is don't specify =
an=20
> interfaceControllerClassname binding in your JavaClient component and d=
o=20
> specify the EOClientApplicationSupport as the main class.
> Be sure to register your windows with the EOApplication's window observ=
er.=20
> I believe it'll quit the program if nothing is registered with it after=
 a=20
> certain amount of time.
>
> Some other useful startup bindings/arguments:
>
> splashIconName
> splashIconURL provides a startup splash screen based on the icon
>
> One gotcha I've found is creating fetch objects from specification's in=
=20
> the EOModel. They appear to return null all the time. The trick is to=20
> create an EODataSource with the fetch name and then call fetchObjects o=
n=20
> it.
>
> Even without the nibs, XML, and rules there is a LOT to the java client=
's=20
> library that you can still utilize. I'm doing something very similar to=
=20
> you and I've found that each time I come up with a way to do something =
I=20
> discover there's already a way to do it in the library with a simple=20
> function call. My biggest complaint about it is that the whole framewor=
k=20
> seems to assume that all the layout's are of EOViewLayout and will try =
to=20
> repackage it into one if you pass it some windows. At the very least I'=
d=20
> be hesitant to throw out the EOAssociations. I've already created some=20
> classes to allow creation of associations with JLabel's.
>
> Let me know if you figure out getting menus to work based on the=20
> EOAction's. Menu's are not required for my app but I'll be looking into=
 it=20
> later.
>
> I agree the lack of documentation is a horrendous oversight on Apple's=20
> part. Hopefully they'll document what they already have before they go=20
> further.
> Hope this helps.

_______________________________________________
EOF mailing list
[email protected]
http://www.omnigroup.com/mailman/listinfo/eof