[OpenMap Users] OM Dialogs Issue

From: oland <com_at_navicon.dk>
Date: Tue, 12 Dec 2006 07:24:32 -0800 (PST)

Not sure this is a general problem but when the LayersPanel toolbar button
launches the layers dialog it gets the parent frame from the bean context
but when using, e .g., BasicMapPanel there is no frame in the bean context
which causes at least the LayersPanel dialog to be without a parent. If
there are other dialogs created in a simmilar way they will also be created
without a parent.

So why is the bean context used for finding the parent frame?

Something like

http://weblogs.java.net/blog/hansmuller/

Frame frameForActionEvent(ActionEvent e) {
    if (e.getSource() instanceof Component) {
        Component c = (Component)e.getSource();
        while(c != null) {
            if (c instanceof Frame) {
                return (Frame)c;
            }
            c = (c instanceof JPopupMenu) ? ((JPopupMenu)c).getInvoker() :
c.getParent();
        }
    }
    return null;
}

public void showMyDialog(ActionEvent e) {
    Window dialogOwner = frameForActionEvent(e);
    JDialog dialog = new MyDialog(dialogOwner, true);
    dialog.pack();
    aboutBox.setLocationRelativeTo(dialogOwner);
    dialog.setVisible(true);
}

should do the trick.

The workaround is to just put the parent frame into the bean context by
hand.

regards
/carsten
-- 
View this message in context: http://www.nabble.com/OM-Dialogs-Issue-tf2808112.html#a7835155
Sent from the OpenMap mailing list archive at Nabble.com.
--
[To unsubscribe to this list send an email to "majdart_at_bbn.com"
with the following text in the BODY of the message "unsubscribe openmap-users"]
Received on Tue Dec 12 2006 - 10:27:13 EST

This archive was generated by hypermail 2.3.0 : Tue Mar 28 2017 - 23:25:08 EDT