Forgot to mention ...
... the main method does not work since it cannot get a handle on the backend
(dependent component). However I plan to retro fit the DefaultEmbeddedKernel code
into the main so the UI can be blown up like any old application. This is also
another nice place/use for kernel embedding: GUIs.
>
> From: <[EMAIL PROTECTED]>
> Date: 2003/10/21 Tue PM 07:54:44 EDT
> To: "Avalon Developers List" <[EMAIL PROTECTED]>
> Subject: Re: merlin swing apps
>
> > Does anybody have any thoughts on pros and cons of building swing
> > applications
> > with merlin? I have a rather large swing app running in Fortress right
> > now, and
> > that's all running as expected.
> >
> > Now, I'm splitting the app into a server component and a
> > client component iso a pure client side app. It's be nice to be able to
> > use the same
> > technology for the client and the server side, so I can easily move
> > components from
> > one side to the other as required. It'd also be great to be able to
> > auto-download
> > updates from a central server and things like that. Seems like Merlin is
> > especially
> > apt at all that. However, Merlin seems to be more targeted at server
> > applications,
> > so I'm wondering what would be required to let Merlin run a swing app
> > (some hooks
> > during startup, being able to trap runtime exceptions and at the very
> > least display
> > them to the users, event bus,...)
> >
> > Anybody any observations?
> >
>
> I actually built a swing application to use while debugging/managing/inspecting a
> complex component called a backend database. I wrote a client GUI component that
> basically had a dependency on the database and blew up a Frame subclass that needed
> a handle to the database component supplied.
>
> I made the setVisible(true) call happen in the execute() lifecycle method of the
> component. Here's the gui component code which is simply a wrapper around a frame.
>
> public class BackendDatabaseViewer extends AbstractLogEnabled
> implements Serviceable, Executable
> {
> /** A handle on the atomic backend */
> private AbstractBackend m_backend ;
>
> /**
> * Viewer main is not really used.
> *
> * @param a_argv
> */
> public static void main( String [] argv )
> {
> // set up system Look&Feel
> try
> {
> UIManager.setLookAndFeel( UIManager
> .getSystemLookAndFeelClassName() ) ;
> }
> catch ( Exception e )
> {
> System.out.println( "Could not set look and feel to use " +
> UIManager.getSystemLookAndFeelClassName() + "." ) ;
> e.printStackTrace() ;
> }
>
> BackendDatabaseViewer l_viewer = new BackendDatabaseViewer () ;
>
> try
> {
> l_viewer.execute() ;
> }
> catch ( Exception e )
> {
> e.printStackTrace() ;
> System.exit( -1 ) ;
> }
> }
>
>
> public void execute() throws Exception
> {
> BackendFrame l_frame = new BackendFrame( m_backend, getLogger() ) ;
>
> Dimension l_screenSize = Toolkit.getDefaultToolkit().getScreenSize() ;
> Dimension l_frameSize = l_frame.getSize() ;
> l_frameSize.height = ( ( l_frameSize.height > l_screenSize.height )
> ? l_screenSize.height : l_frameSize.height) ;
> l_frameSize.width = ( ( l_frameSize.width > l_screenSize.width )
> ? l_screenSize.width : l_frameSize.width ) ;
> l_frame.setLocation( ( l_screenSize.width - l_frameSize.width ) / 2,
> ( l_screenSize.height - l_frameSize.height ) / 2) ;
>
> l_frame.setVisible( true );
> System.out.println( l_frameSize ) ;
> }
>
> /**
> * @avalon.dependency
> * type="ldapd.server.backend.AtomicBackend"
> * key="system-backend" version="1.0"
> *
> * @see org.apache.avalon.framework.service.Serviceable#service(
> * org.apache.avalon.framework.service.ServiceManager)
> */
> public void service( ServiceManager a_manager )
> throws ServiceException
> {
> m_backend = ( AbstractBackend ) a_manager.lookup( "system-backend" ) ;
> getLogger().debug( "Got handle on system backend!" ) ;
> }
> }
>
> So if I can do this another better way I would also be interested in advice from the
> Avalon team as well.
>
> Alex
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]