Revision 8879 branches/v10/libraries/libCorePlugin/src/com/iver/core/mdiManager/NewSkin.java
NewSkin.java | ||
---|---|---|
47 | 47 |
import java.awt.Dimension; |
48 | 48 |
import java.awt.KeyEventDispatcher; |
49 | 49 |
import java.awt.Point; |
50 |
import java.awt.Window; |
|
51 | 50 |
import java.awt.event.ActionEvent; |
52 | 51 |
import java.awt.event.ActionListener; |
53 | 52 |
import java.awt.event.KeyEvent; |
... | ... | |
55 | 54 |
import java.awt.event.WindowEvent; |
56 | 55 |
import java.beans.PropertyVetoException; |
57 | 56 |
import java.util.ArrayList; |
58 |
import java.util.Collection; |
|
59 | 57 |
import java.util.Iterator; |
60 | 58 |
import java.util.TreeMap; |
61 | 59 |
|
... | ... | |
65 | 63 |
import javax.swing.JDialog; |
66 | 64 |
import javax.swing.JFrame; |
67 | 65 |
import javax.swing.JInternalFrame; |
68 |
import javax.swing.JRootPane; |
|
69 | 66 |
import javax.swing.KeyStroke; |
70 | 67 |
import javax.swing.event.InternalFrameEvent; |
71 | 68 |
import javax.swing.event.InternalFrameListener; |
72 | 69 |
|
73 | 70 |
import org.apache.log4j.Logger; |
74 | 71 |
|
75 |
import com.iver.andami.GlobalKeyEventDispatcher; |
|
76 |
import com.iver.andami.Launcher; |
|
77 | 72 |
import com.iver.andami.PluginServices; |
78 | 73 |
import com.iver.andami.plugins.Extension; |
79 | 74 |
import com.iver.andami.ui.mdiFrame.GlassPane; |
80 | 75 |
import com.iver.andami.ui.mdiFrame.MDIFrame; |
81 | 76 |
import com.iver.andami.ui.mdiFrame.NewStatusBar; |
77 |
import com.iver.andami.ui.mdiManager.IWindow; |
|
78 |
import com.iver.andami.ui.mdiManager.IWindowListener; |
|
82 | 79 |
import com.iver.andami.ui.mdiManager.MDIManager; |
83 | 80 |
import com.iver.andami.ui.mdiManager.MDIUtilities; |
84 | 81 |
import com.iver.andami.ui.mdiManager.SingletonDialogAlreadyShownException; |
85 | 82 |
import com.iver.andami.ui.mdiManager.SingletonWindow; |
86 |
import com.iver.andami.ui.mdiManager.IWindow; |
|
87 | 83 |
import com.iver.andami.ui.mdiManager.WindowInfo; |
88 |
import com.iver.andami.ui.mdiManager.IWindowListener; |
|
89 |
import com.iver.core.StatusBar; |
|
90 | 84 |
|
91 | 85 |
/** |
92 | 86 |
* |
... | ... | |
123 | 117 |
*/ |
124 | 118 |
private FrameWindowSupport fws; |
125 | 119 |
|
126 |
private WindowInfoSupport vis;
|
|
120 |
private WindowInfoSupport wis;
|
|
127 | 121 |
|
128 | 122 |
private WindowStackSupport wss; |
129 | 123 |
|
... | ... | |
145 | 139 |
|
146 | 140 |
fws = new FrameWindowSupport(mainFrame); |
147 | 141 |
dss = new DialogStackSupport(mainFrame); |
148 |
sws = new SingletonWindowSupport(vis, fws);
|
|
149 |
vis = new WindowInfoSupport(mainFrame, fws, sws);
|
|
150 |
fws.setVis(vis);
|
|
151 |
wss = new WindowStackSupport(vis);
|
|
142 |
sws = new SingletonWindowSupport(wis, fws);
|
|
143 |
wis = new WindowInfoSupport(mainFrame, fws, sws);
|
|
144 |
fws.setVis(wis);
|
|
145 |
wss = new WindowStackSupport(wis);
|
|
152 | 146 |
|
153 | 147 |
|
154 | 148 |
// TODO (jaume) esto no deber?a de estar aqu?... |
... | ... | |
183 | 177 |
*/ |
184 | 178 |
public IWindow addWindow(IWindow p) throws SingletonDialogAlreadyShownException { |
185 | 179 |
// se obtiene la informaci?n de la vista |
186 |
WindowInfo wi = vis.getWindowInfo(p);
|
|
180 |
WindowInfo wi = wis.getWindowInfo(p);
|
|
187 | 181 |
|
188 | 182 |
// Se comprueban las incompatibilidades que pudieran haber en la vista |
189 | 183 |
MDIUtilities.checkWindowInfo(wi); |
... | ... | |
212 | 206 |
addJInternalFrame(frame, wi); |
213 | 207 |
wss.add(p, new ActionListener() { |
214 | 208 |
public void actionPerformed(ActionEvent e) { |
215 |
IWindow v = vis.getWindowById(Integer.parseInt(e
|
|
209 |
IWindow v = wis.getWindowById(Integer.parseInt(e
|
|
216 | 210 |
.getActionCommand())); |
217 | 211 |
JInternalFrame f = fws.getJInternalFrame(v); |
218 | 212 |
activateJInternalFrame(f); |
... | ... | |
234 | 228 |
// Se sit?a la vista en la pila de vistas |
235 | 229 |
wss.add(p, new ActionListener() { |
236 | 230 |
public void actionPerformed(ActionEvent e) { |
237 |
IWindow v = vis.getWindowById(Integer.parseInt(e
|
|
231 |
IWindow v = wis.getWindowById(Integer.parseInt(e
|
|
238 | 232 |
.getActionCommand())); |
239 | 233 |
JInternalFrame f = fws.getJInternalFrame(v); |
240 | 234 |
activateJInternalFrame(f); |
... | ... | |
256 | 250 |
*/ |
257 | 251 |
public IWindow addCentredWindow(IWindow p) throws SingletonDialogAlreadyShownException { |
258 | 252 |
// se obtiene la informaci?n de la vista |
259 |
WindowInfo vi = vis.getWindowInfo(p);
|
|
253 |
WindowInfo vi = wis.getWindowInfo(p);
|
|
260 | 254 |
|
261 | 255 |
// Se comprueban las incompatibilidades que pudieran haber en la vista |
262 | 256 |
MDIUtilities.checkWindowInfo(vi); |
... | ... | |
272 | 266 |
|
273 | 267 |
if (p instanceof SingletonWindow) { |
274 | 268 |
SingletonWindow sv = (SingletonWindow) p; |
275 |
if (sws.registerWindow(sv.getClass(), sv.getWindowModel(), vis
|
|
269 |
if (sws.registerWindow(sv.getClass(), sv.getWindowModel(), wis
|
|
276 | 270 |
.getWindowInfo(sv))) { |
277 | 271 |
singletonPreviouslyAdded = true; |
278 | 272 |
} |
... | ... | |
286 | 280 |
addJInternalFrame(frame, vi); |
287 | 281 |
wss.add(p, new ActionListener() { |
288 | 282 |
public void actionPerformed(ActionEvent e) { |
289 |
IWindow w = vis.getWindowById(Integer.parseInt(e
|
|
283 |
IWindow w = wis.getWindowById(Integer.parseInt(e
|
|
290 | 284 |
.getActionCommand())); |
291 | 285 |
JInternalFrame f = fws.getJInternalFrame(w); |
292 | 286 |
centreJInternalFrame(f); // Centre this JInternalFrame |
... | ... | |
311 | 305 |
// Se sit?a la vista en la pila de vistas |
312 | 306 |
wss.add(p, new ActionListener() { |
313 | 307 |
public void actionPerformed(ActionEvent e) { |
314 |
IWindow w = vis.getWindowById(Integer.parseInt(e
|
|
308 |
IWindow w = wis.getWindowById(Integer.parseInt(e
|
|
315 | 309 |
.getActionCommand())); |
316 | 310 |
JInternalFrame f = fws.getJInternalFrame(w); |
317 | 311 |
activateJInternalFrame(f); |
... | ... | |
450 | 444 |
* @param p |
451 | 445 |
*/ |
452 | 446 |
private void addJInternalFrame(IWindow p) { |
453 |
WindowInfo wi = vis.getWindowInfo(p);
|
|
447 |
WindowInfo wi = wis.getWindowInfo(p);
|
|
454 | 448 |
|
455 | 449 |
JInternalFrame wnd = fws.getJInternalFrame(p); |
456 | 450 |
|
... | ... | |
506 | 500 |
dlg.addWindowListener(new DialogWindowListener()); |
507 | 501 |
dss.pushDialog(dlg); |
508 | 502 |
|
509 |
dlg.setVisible(vis.getWindowInfo(p).isVisible());
|
|
503 |
dlg.setVisible(wis.getWindowInfo(p).isVisible());
|
|
510 | 504 |
} |
511 | 505 |
|
512 | 506 |
/** |
... | ... | |
572 | 566 |
* @see com.iver.andami.ui.mdiManager.MDIManager#getWindowInfo(com.iver.andami.ui.mdiManager.IWindow) |
573 | 567 |
*/ |
574 | 568 |
public WindowInfo getWindowInfo(IWindow w) { |
575 |
WindowInfo wi = vis.getWindowInfo(w);
|
|
569 |
WindowInfo wi = wis.getWindowInfo(w);
|
|
576 | 570 |
|
577 |
JInternalFrame f = fws.getJInternalFrame(w); |
|
571 |
/* |
|
572 |
* This is done now in vis.getWindowInfo(w) |
|
573 |
* |
|
574 |
* JInternalFrame f = fws.getJInternalFrame(w); |
|
578 | 575 |
wi.setX(f.getX()); |
579 | 576 |
wi.setY(f.getY()); |
580 | 577 |
wi.setHeight(f.getHeight()); |
... | ... | |
582 | 579 |
// isClosed() doesn't work as (I) expected, why? Using isShowing instead |
583 | 580 |
wi.setClosed(!f.isShowing()); |
584 | 581 |
wi.setNormalBounds(f.getNormalBounds()); |
585 |
wi.setMaximized(f.isMaximum()); |
|
582 |
wi.setMaximized(f.isMaximum());*/
|
|
586 | 583 |
return wi; |
587 | 584 |
} |
588 | 585 |
|
... | ... | |
743 | 740 |
|
744 | 741 |
IWindow panel = fws.getWindow((JInternalFrame) e.getSource()); |
745 | 742 |
|
746 |
WindowInfo wi = vis.getWindowInfo(panel);
|
|
743 |
WindowInfo wi = wis.getWindowInfo(panel);
|
|
747 | 744 |
if (wi.isPalette()) |
748 | 745 |
return; |
749 | 746 |
|
... | ... | |
782 | 779 |
// e.getInternalFrame().getTitle()); |
783 | 780 |
|
784 | 781 |
JInternalFrame c = (JInternalFrame) e.getSource(); |
785 |
WindowInfo wi = vis.getWindowInfo((IWindow) fws.getWindow(c));
|
|
782 |
WindowInfo wi = wis.getWindowInfo((IWindow) fws.getWindow(c));
|
|
786 | 783 |
|
787 | 784 |
IWindow win = fws.getWindow(c); |
788 | 785 |
callWindowClosed(win); |
... | ... | |
828 | 825 |
JInternalFrame c = (JInternalFrame) e.getSource(); |
829 | 826 |
IWindow win = fws.getWindow(c); |
830 | 827 |
if (win != null) { |
831 |
WindowInfo wi = vis.getWindowInfo(win);
|
|
828 |
WindowInfo wi = wis.getWindowInfo(win);
|
|
832 | 829 |
if (wi.isPalette()) |
833 | 830 |
return; |
834 | 831 |
wi.setSelectedTool(mainFrame.getSelectedTool()); |
... | ... | |
897 | 894 |
return (IWindow[]) windows.toArray(new IWindow[0]); |
898 | 895 |
} |
899 | 896 |
|
897 |
/** |
|
898 |
* @see com.iver.andami.ui.mdiManager.MDIManager#getOrderedWindows() |
|
899 |
*/ |
|
900 | 900 |
public IWindow[] getOrderedWindows() { |
901 | 901 |
//ArrayList windows = new ArrayList(); |
902 | 902 |
TreeMap windows = new TreeMap(); |
903 | 903 |
Iterator winIterator = fws.getWindowIterator(); |
904 | 904 |
|
905 |
JInternalFrame frame;
|
|
905 |
Component frame;
|
|
906 | 906 |
IWindow win; |
907 | 907 |
/** |
908 | 908 |
* The order of the window in the JDesktopPane. Smaller numbers |
... | ... | |
911 | 911 |
int zPosition; |
912 | 912 |
while (winIterator.hasNext()) { |
913 | 913 |
win = (IWindow) winIterator.next(); |
914 |
frame = fws.getJInternalFrame(win); |
|
915 |
|
|
916 |
zPosition = panel.getPosition(frame); |
|
917 |
windows.put(new Integer(zPosition), win); |
|
914 |
frame = fws.getFrame(win); |
|
915 |
zPosition = panel.getPosition(frame); |
|
916 |
windows.put(new Integer(zPosition), win); |
|
918 | 917 |
} |
919 | 918 |
winIterator = windows.values().iterator(); |
920 | 919 |
ArrayList winList = new ArrayList(); |
Also available in: Unified diff