gvsig-tools / org.gvsig.tools / library / trunk / org.gvsig.tools / org.gvsig.tools.main / src / main / java / org / gvsig / tools / main / window / ModalAction.java @ 3009
History | View | Annotate | Download (3.54 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 2
|
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 |
/*
|
25 |
* AUTHORS (In addition to CIT):
|
26 |
* 2010 {} {{Task}}
|
27 |
*/
|
28 |
package org.gvsig.tools.main.window; |
29 |
|
30 |
import java.awt.Dimension; |
31 |
import java.awt.FlowLayout; |
32 |
import java.awt.event.ActionEvent; |
33 |
import java.beans.PropertyChangeListener; |
34 |
import javax.swing.Action; |
35 |
import javax.swing.JButton; |
36 |
import javax.swing.JComponent; |
37 |
import javax.swing.JPanel; |
38 |
import javax.swing.JTabbedPane; |
39 |
import javax.swing.JTextField; |
40 |
import org.gvsig.tools.main.MainAction; |
41 |
import org.gvsig.tools.swing.api.ToolsSwingLocator; |
42 |
import org.gvsig.tools.swing.api.windowmanager.WindowManager; |
43 |
|
44 |
/**
|
45 |
* Shows the panel of usability components.
|
46 |
*
|
47 |
* @author 2010- C?sar Ordi?ana - gvSIG team
|
48 |
*/
|
49 |
public class ModalAction extends MainAction { |
50 |
|
51 |
|
52 |
private static final WindowManager manager = |
53 |
ToolsSwingLocator.getWindowManager(); |
54 |
|
55 |
/**
|
56 |
* @see MainAction#MainAction(JTabbedPane)
|
57 |
*/
|
58 |
public ModalAction(JTabbedPane tabbedPane) { |
59 |
super("Modal", tabbedPane); |
60 |
putValue(SHORT_DESCRIPTION, "Modal components");
|
61 |
} |
62 |
|
63 |
@Override
|
64 |
protected JComponent createComponent() { |
65 |
JPanel panel = new JPanel(); |
66 |
panel.setLayout(new FlowLayout()); |
67 |
JButton button = new JButton(new Action() { |
68 |
|
69 |
@Override
|
70 |
public void actionPerformed(ActionEvent arg0) { |
71 |
JTextField jtext = new JTextField(); |
72 |
jtext.setPreferredSize(new Dimension(300, 30)); |
73 |
|
74 |
JPanel auxpanel = new JPanel(); |
75 |
auxpanel.add(jtext); |
76 |
WindowManager wm = ToolsSwingLocator.getWindowManager(); |
77 |
wm.showWindow(auxpanel, "Action", WindowManager.MODE.DIALOG);
|
78 |
System.out.println("Value = "+jtext.getText()); |
79 |
} |
80 |
|
81 |
@Override
|
82 |
public void setEnabled(boolean b) { |
83 |
// TODO Auto-generated method stub
|
84 |
|
85 |
} |
86 |
|
87 |
@Override
|
88 |
public void removePropertyChangeListener(PropertyChangeListener listener) { |
89 |
// TODO Auto-generated method stub
|
90 |
|
91 |
} |
92 |
|
93 |
@Override
|
94 |
public void putValue(String key, Object value) { |
95 |
// TODO Auto-generated method stub
|
96 |
|
97 |
} |
98 |
|
99 |
@Override
|
100 |
public boolean isEnabled() { |
101 |
return true; |
102 |
} |
103 |
|
104 |
@Override
|
105 |
public Object getValue(String key) { |
106 |
// TODO Auto-generated method stub
|
107 |
return null; |
108 |
} |
109 |
|
110 |
@Override
|
111 |
public void addPropertyChangeListener(PropertyChangeListener listener) { |
112 |
// TODO Auto-generated method stub
|
113 |
|
114 |
} |
115 |
}); |
116 |
button.setText("Show modal window");
|
117 |
panel.add(button); |
118 |
|
119 |
return panel;
|
120 |
} |
121 |
|
122 |
@Override
|
123 |
protected String getComponentTitle() { |
124 |
return "Modal"; |
125 |
} |
126 |
|
127 |
} |