Statistics
| Revision:

gvsig-3d / 2.1 / trunk / org.gvsig.gvsig3d / org.gvsig.gvsig3d.app / org.gvsig.gvsig3d.app.commons / src / main / java / org / gvsig / gvsig3d / app / skin / JDialogStackSupport.java @ 385

History | View | Annotate | Download (2.84 KB)

1
/* gvSIG 3D extension for gvSIG
2
 *
3
 * Copyright (C) 2012 Prodevelop.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 *
19
 * For more information, contact:
20
 *
21
 *   Prodevelop, S.L.
22
 *   Pza. Don Juan de Villarrasa, 14 - 5
23
 *   46001 Valencia
24
 *   Spain
25
 *
26
 *   +34 963 510 612
27
 *   +34 963 510 968
28
 *   prode@prodevelop.es
29
 *   http://www.prodevelop.es
30
 */
31
/*
32
 * AUTHORS:
33
 * 2012 AI2 - Instituto Universitario de Automatica e Informatica Industrial.
34
 * Universitat Politecnica de Valencia (UPV)
35
 * http://www.ai2.upv.es
36
 */
37

    
38

    
39
package org.gvsig.gvsig3d.app.skin;
40

    
41
import java.awt.Cursor;
42
import java.util.ArrayList;
43
import java.util.Iterator;
44

    
45
import javax.swing.JDialog;
46

    
47
import org.gvsig.andami.ui.mdiFrame.MDIFrame;
48
import org.gvsig.coreplugin.mdiManager.DialogStackSupport;
49
import org.slf4j.Logger;
50
import org.slf4j.LoggerFactory;
51

    
52
/**
53
 * @author Jesus Zarzoso- jzarzoso@ai2.upv.es
54
 * @version $Id$
55
 * 
56
 */
57
public class JDialogStackSupport extends DialogStackSupport {
58

    
59
    /** log */
60
    private static Logger logger =
61
        LoggerFactory.getLogger(DialogStackSupport.class.getName());
62

    
63
    /** Pila de dialogos modales mostrados */
64
    private ArrayList dialogStack = new ArrayList(0);
65

    
66
    private ArrayList dialogCursors = new ArrayList(0);
67

    
68
    public JDialogStackSupport(MDIFrame frame) {
69
        super(frame);
70
    }
71

    
72
    public void pushDialog(JDialog dlg) {
73
        dialogStack.add(dlg);
74
    }
75

    
76
    public JDialog popDialog() {
77
        return (JDialog) dialogStack.remove(dialogStack.size() - 1);
78
    }
79

    
80
    /**
81
     * @return
82
     */
83
    public void setWaitCursor() {
84
        dialogCursors.clear();
85
        for (Iterator iter = dialogStack.iterator(); iter.hasNext();) {
86
            JDialog dlg = (JDialog) iter.next();
87
            dialogCursors.add(dlg.getCursor());
88
            dlg.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
89
            dlg.getGlassPane().setVisible(true);
90
        }
91
    }
92

    
93
    /**
94
     * 
95
     */
96
    public void restoreCursor() {
97
        for (Iterator iter = dialogStack.iterator(); iter.hasNext();) {
98
            JDialog dlg = (JDialog) iter.next();
99

    
100
            // TODO: RECUPERAR EL CURSOR
101
            dlg.setCursor(null);
102
            dlg.getGlassPane().setVisible(false);
103
        }
104
    }
105

    
106
}