Revision 42638 trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.coreplugin.app/org.gvsig.coreplugin.app.mainplugin/src/main/java/org/gvsig/coreplugin/mdiManager/FrameWindowSupport.java
FrameWindowSupport.java | ||
---|---|---|
28 | 28 |
import java.awt.Image; |
29 | 29 |
import java.awt.event.ComponentEvent; |
30 | 30 |
import java.awt.event.ComponentListener; |
31 |
import java.util.Hashtable;
|
|
31 |
import java.util.HashMap;
|
|
32 | 32 |
import java.util.Iterator; |
33 |
import java.util.Map; |
|
34 |
import java.util.Set; |
|
33 | 35 |
|
34 | 36 |
import javax.swing.ImageIcon; |
35 | 37 |
import javax.swing.JComponent; |
... | ... | |
38 | 40 |
import javax.swing.JInternalFrame; |
39 | 41 |
import javax.swing.JPanel; |
40 | 42 |
import org.gvsig.andami.PluginServices; |
43 |
import org.gvsig.andami.ui.ToolsWindowManager; |
|
41 | 44 |
|
42 | 45 |
import org.gvsig.andami.ui.mdiFrame.MDIFrame; |
43 | 46 |
import org.gvsig.andami.ui.mdiManager.IWindow; |
... | ... | |
46 | 49 |
import org.gvsig.coreplugin.mdiManager.frames.IFrame; |
47 | 50 |
import org.gvsig.coreplugin.mdiManager.frames.InternalFrame; |
48 | 51 |
import org.gvsig.i18n.Messages; |
52 |
import org.slf4j.Logger; |
|
53 |
import org.slf4j.LoggerFactory; |
|
49 | 54 |
|
50 | 55 |
|
51 | 56 |
|
... | ... | |
53 | 58 |
* |
54 | 59 |
*/ |
55 | 60 |
public class FrameWindowSupport { |
56 |
private Hashtable frameView = new Hashtable(); |
|
57 |
private Hashtable viewFrame = new Hashtable(); |
|
61 |
private static Logger logger = LoggerFactory.getLogger(FrameWindowSupport.class); |
|
62 |
|
|
63 |
private Map frameView = new HashMap(); |
|
64 |
private Map<IWindow,Object> viewFrame = new HashMap(); |
|
58 | 65 |
private Image icon; |
59 | 66 |
private WindowInfoSupport vis; |
60 |
private JFrame mainFrame;
|
|
67 |
private JFrame mainFrame;
|
|
61 | 68 |
|
62 | 69 |
/** |
63 | 70 |
* Creates a new FrameViewSupport object. |
... | ... | |
82 | 89 |
* @return |
83 | 90 |
*/ |
84 | 91 |
public boolean contains(JInternalFrame wnd) { |
85 |
return frameView.contains(wnd); |
|
92 |
return frameView.containsValue(wnd);
|
|
86 | 93 |
} |
87 | 94 |
|
88 | 95 |
/** |
... | ... | |
127 | 134 |
* @return DOCUMENT ME! |
128 | 135 |
*/ |
129 | 136 |
public JInternalFrame getJInternalFrame(IWindow p) { |
130 |
JInternalFrame frame = (JInternalFrame) viewFrame.get(p); |
|
137 |
JInternalFrame frame = null; |
|
138 |
try { |
|
139 |
for( Map.Entry<IWindow,Object> entry : viewFrame.entrySet()) { |
|
140 |
if( entry.getKey() instanceof ToolsWindowManager.Window ) { |
|
141 |
JComponent contents = ((ToolsWindowManager.Window)entry.getKey()).getContents(); |
|
142 |
if( p == contents ) { |
|
143 |
frame = (JInternalFrame) entry.getValue(); |
|
144 |
} |
|
145 |
} |
|
146 |
} |
|
147 |
} catch(Exception ex) { |
|
148 |
logger.warn("Can't get JInternalFrame from IWindow ("+p.getWindowInfo().getTitle()+").",ex); |
|
149 |
} |
|
150 |
if( frame == null ) { |
|
151 |
frame = (JInternalFrame) viewFrame.get(p); |
|
152 |
} |
|
131 | 153 |
|
132 | 154 |
if (frame == null) { |
133 | 155 |
//ViewInfo vi = vis.getViewInfo(p); |
Also available in: Unified diff