RE: [OpenMap Users] OpenMap as a JINI service

From: Martin Chapman <martin.chapman@softwize.net>
Date: Mon Apr 07 2003 - 11:48:55 EDT

I'm not sure if this is what you want but here it is: You could make
your own Swing client and load the map bean window in a Jframe. That
way you can show/hide the window whenever you want...also you are in
control of when the app exit's as well. There is a little more work
because you have to add the tollbars, menus etc... but OpenMap makes it
easy for you because they have nice classes that handle most of the work
for you. Attached is some code is a swing gui that puts the mapbean in
a jframe using a splitter window and a tree control on the left. Also
there are the mapbean menus and toolbar. Let me know if that works.

Martin

-----Original Message-----
From: owner-openmap-users@bbn.com [mailto:owner-openmap-users@bbn.com]
On Behalf Of Connell, Russell
Sent: Sunday, April 06, 2003 5:30 PM
To: 'openmap-users@bbn.com'
Cc: 'openmap@bbn.com'
Subject: [OpenMap Users] OpenMap as a JINI service

(Apologies if this is sent twice... )

Good Morning all,
   I have been attempting to setup Openmap as a Jini service, in
particular implementing ServiceUI code. What this means in effect is
that all the OpenMap classes are dowloaded from a remote webserver and
then executed on a client machine.
The call to start openmap is on the client side ends up as
OpenMapServiceGUI.create().getMapBean();
which is a mostly straight forward copy of the basic
comm.bbn.openmap.app.OpenMap code with some added bits for setting up
the Jini side of the house. and then initiates the class and resource
downloading.

A few issues have arisen.
1: I would prefer to have the client decide when to show the OpenMap
gui, this doesn't seem to be possible.
2: When I shut down the OpenMap window it takes the rest of the client
with it. ( System.exit() ) and i am not entirely sure how I would go
about stopping that.
3: The previous two issues are minor annoyances.
4: When OpenMap finishes loading whenever I interact ( i.e. show/ cause
a repaint ) with the MapBean when any layers are enabled I get the
exception at the bottom of this email and the application has problems
repainting itself...

  I have finally traced this back to the status layer lights on the
InformationDelegator. There seems to be a problem with the image
loading/repainting but I have been unable to trace exactly what is
causing it. What I do know is that if I replace the following code in
InformationDelegator
/***********************************************************************
***********************************************************/
    protected final static transient URL greenURL =
InformationDelegator.class.getResource("green.gif");
    public final static transient ImageIcon greenIcon = new
ImageIcon(greenURL, "stable ish");

with
/***********************************************************************
***********************************************************/
    public final static transient ImageIcon greenIcon = loadImageIcon(
"green.gif" , "stable ish" );

    public static ImageIcon loadImageIcon( String resourceName , String
comment)
    {
        try {
            java.io.BufferedInputStream bis = new
java.io.BufferedInputStream(
InformationDelegator.class.getResourceAsStream( resourceName ) );
            byte b[] = new byte[ bis.available() ];
            bis.read(b );
            ImageIcon icon ;
            if ( comment != null )
               icon = new ImageIcon( b , comment);
            else
               icon = new ImageIcon( b );
            bis.close();
            bis = null;
            b = null;
            return icon;
        } catch ( java.io.IOException e )
        {
        }
        return new ImageIcon();
    }

everything runs fine, both as a standalone application and as my JINI
service.

any and all suggestions at this point would be useful, as my fix
involves modifying bbn code which is a pest for integration with future
releases.

comments
  the resources are there, and are downloaded fromt the server, and are
loaded completely ( as far as i can tell, I check within
InformationDelegator that the Image is
loaded fully ( using the MediaTracker )

Russell Connell
Combat Evaluation
Land Operations Division
Defence Science Technology Organisation
email russell.connell@dsto.defence.gov.au
Phone :08 8259 7660

java.lang.NullPointerException
        at sun.java2d.pipe.DrawImage.copyImage(DrawImage.java:50)
        at sun.java2d.pipe.DrawImage.copyImage(DrawImage.java:749)
        at sun.java2d.SunGraphics2D.drawImage(SunGraphics2D.java:2803)
        at
sun.awt.image.ImageRepresentation.drawToBufImage(ImageRepresentation.
java:726)
        at sun.java2d.pipe.DrawImage.copyImage(DrawImage.java:756)
        at sun.java2d.SunGraphics2D.drawImage(SunGraphics2D.java:2803)
        at sun.java2d.SunGraphics2D.drawImage(SunGraphics2D.java:2793)
        at javax.swing.DebugGraphics.drawImage(DebugGraphics.java:1017)
        at javax.swing.ImageIcon.paintIcon(ImageIcon.java:337)
        at
javax.swing.plaf.basic.BasicButtonUI.paintIcon(BasicButtonUI.java:328
)
        at
javax.swing.plaf.basic.BasicButtonUI.paint(BasicButtonUI.java:248)
        at javax.swing.plaf.ComponentUI.update(ComponentUI.java:142)
        at javax.swing.JComponent.paintComponent(JComponent.java:541)
        at javax.swing.JComponent.paint(JComponent.java:808)
        at
javax.swing.JComponent.paintWithOffscreenBuffer(JComponent.java:4771)

        at
javax.swing.JComponent.paintDoubleBuffered(JComponent.java:4724)
        at
javax.swing.JComponent._paintImmediately(JComponent.java:4668)
        at javax.swing.JComponent.paintImmediately(JComponent.java:4477)
        at
javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:410)

        at
javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(System
EventQueueUtilities.java:117)
        at
java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:178)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:448)
        at
java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchTh
read.java:197)
        at
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThre
ad.java:150)
        at
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:144)

        at
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:136)

        at java.awt.EventDispatchThread.run(EventDispatchThread.java:99)

 

--
[To unsubscribe to this list send an email to "majdart@bbn.com" with the
following text in the BODY of the message "unsubscribe openmap-users"]

--
[To unsubscribe to this list send an email to "majdart@bbn.com"
with the following text in the BODY of the message "unsubscribe openmap-users"]
Received on Mon Apr 7 11:49:11 2003

This archive was generated by hypermail 2.1.8 : Thu May 12 2005 - 07:18:35 EDT