gvsig-projects-pool / org.gvsig.winmgr / trunk / org.gvsig.winmgr.app / org.gvsig.winmgr.app.mainplugin / src / main / java / org / gvsig / coreplugin / mdiManager / DialogStackSupport.java @ 682
History | View | Annotate | Download (2.44 KB)
1 |
/**
|
---|---|
2 |
* gvSIG. Desktop Geographic Information System.
|
3 |
*
|
4 |
* Copyright (C) 2007-2013 gvSIG Association.
|
5 |
*
|
6 |
* This program is free software; you can redistribute it and/or
|
7 |
* modify it under the terms of the GNU General Public License
|
8 |
* as published by the Free Software Foundation; either version 3
|
9 |
* of the License, or (at your option) any later version.
|
10 |
*
|
11 |
* This program is distributed in the hope that it will be useful,
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14 |
* GNU General Public License for more details.
|
15 |
*
|
16 |
* You should have received a copy of the GNU General Public License
|
17 |
* along with this program; if not, write to the Free Software
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19 |
* MA 02110-1301, USA.
|
20 |
*
|
21 |
* For any additional information, do not hesitate to contact us
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com.
|
23 |
*/
|
24 |
package org.gvsig.coreplugin.mdiManager; |
25 |
|
26 |
import java.awt.Cursor; |
27 |
import java.util.ArrayList; |
28 |
import java.util.Iterator; |
29 |
|
30 |
import javax.swing.JDialog; |
31 |
|
32 |
import org.gvsig.andami.ui.mdiFrame.MDIFrame; |
33 |
import org.slf4j.Logger; |
34 |
import org.slf4j.LoggerFactory; |
35 |
|
36 |
|
37 |
|
38 |
/**
|
39 |
*
|
40 |
*/
|
41 |
public class DialogStackSupport{ |
42 |
/** log */
|
43 |
private static Logger logger = LoggerFactory.getLogger(DialogStackSupport.class.getName()); |
44 |
|
45 |
/** Pila de di?logos modales mostrados */
|
46 |
private ArrayList dialogStack = new ArrayList(0); |
47 |
|
48 |
private ArrayList dialogCursors = new ArrayList(0); |
49 |
|
50 |
public DialogStackSupport(MDIFrame frame){
|
51 |
} |
52 |
|
53 |
public void pushDialog(JDialog dlg){ |
54 |
dialogStack.add(dlg); |
55 |
} |
56 |
|
57 |
public JDialog popDialog(){ |
58 |
int dialogStackSize=dialogStack.size();
|
59 |
if (dialogStackSize<1) |
60 |
return null; |
61 |
return (JDialog) dialogStack.remove(dialogStackSize - 1); |
62 |
} |
63 |
|
64 |
/**
|
65 |
* @return
|
66 |
*/
|
67 |
public void setWaitCursor() { |
68 |
dialogCursors.clear(); |
69 |
for (Iterator iter = dialogStack.iterator(); iter.hasNext();) { |
70 |
JDialog dlg = (JDialog) iter.next(); |
71 |
dialogCursors.add(dlg.getCursor()); |
72 |
dlg.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); |
73 |
dlg.getGlassPane().setVisible(true);
|
74 |
} |
75 |
} |
76 |
|
77 |
/**
|
78 |
*
|
79 |
*/
|
80 |
public void restoreCursor() { |
81 |
for (Iterator iter = dialogStack.iterator(); iter.hasNext();) { |
82 |
JDialog dlg = (JDialog) iter.next(); |
83 |
|
84 |
// TODO: RECUPERAR EL CURSOR
|
85 |
dlg.setCursor(null);
|
86 |
dlg.getGlassPane().setVisible(false);
|
87 |
} |
88 |
} |
89 |
} |