Revision 129
1.10/tags/gvSIG_3D_Animation_1_10_build_16/extensions/extDockingSkin/build.number | ||
---|---|---|
1 |
#Build Number for ANT. Do not edit! |
|
2 |
#Tue May 19 11:11:42 CEST 2009 |
|
3 |
build.number=1234 |
1.10/tags/gvSIG_3D_Animation_1_10_build_16/extensions/extDockingSkin/src/test/java/org/gvsig/AppTest.java | ||
---|---|---|
1 |
package org.gvsig; |
|
2 |
|
|
3 |
import junit.framework.Test; |
|
4 |
import junit.framework.TestCase; |
|
5 |
import junit.framework.TestSuite; |
|
6 |
|
|
7 |
/** |
|
8 |
* Unit test for simple App. |
|
9 |
*/ |
|
10 |
public class AppTest |
|
11 |
extends TestCase |
|
12 |
{ |
|
13 |
/** |
|
14 |
* Create the test case |
|
15 |
* |
|
16 |
* @param testName name of the test case |
|
17 |
*/ |
|
18 |
public AppTest( String testName ) |
|
19 |
{ |
|
20 |
super( testName ); |
|
21 |
} |
|
22 |
|
|
23 |
/** |
|
24 |
* @return the suite of tests being tested |
|
25 |
*/ |
|
26 |
public static Test suite() |
|
27 |
{ |
|
28 |
return new TestSuite( AppTest.class ); |
|
29 |
} |
|
30 |
|
|
31 |
/** |
|
32 |
* Rigourous Test :-) |
|
33 |
*/ |
|
34 |
public void testApp() |
|
35 |
{ |
|
36 |
assertTrue( true ); |
|
37 |
} |
|
38 |
} |
1.10/tags/gvSIG_3D_Animation_1_10_build_16/extensions/extDockingSkin/src/main/java/org/gvsig/menus/ToolbarMenus.java | ||
---|---|---|
1 |
/** |
|
2 |
* |
|
3 |
*/ |
|
4 |
package org.gvsig.menus; |
|
5 |
|
|
6 |
import java.awt.event.ActionEvent; |
|
7 |
import java.awt.event.ActionListener; |
|
8 |
import java.net.URL; |
|
9 |
|
|
10 |
import javax.swing.ImageIcon; |
|
11 |
|
|
12 |
import com.iver.andami.PluginServices; |
|
13 |
import com.iver.andami.plugins.Extension; |
|
14 |
import com.iver.andami.plugins.config.generate.Menu; |
|
15 |
import com.iver.andami.ui.mdiFrame.SelectableToolBar; |
|
16 |
import com.iver.utiles.XMLEntity; |
|
17 |
|
|
18 |
/** |
|
19 |
* @author cesar |
|
20 |
* |
|
21 |
*/ |
|
22 |
public class ToolbarMenus extends Extension implements ActionListener { |
|
23 |
private final String ACTIONCOMMANDBASE = "CHANGE_VISIBILITY-"; |
|
24 |
private final String MENUBASE = "Ver/Toolbars/"; |
|
25 |
private final String ENABLEDIMAGE = "images/enabled.png"; |
|
26 |
|
|
27 |
/* (non-Javadoc) |
|
28 |
* @see com.iver.andami.plugins.Extension#execute(java.lang.String) |
|
29 |
*/ |
|
30 |
public void execute(String actionCommand) { |
|
31 |
// TODO Auto-generated method stub |
|
32 |
|
|
33 |
} |
|
34 |
|
|
35 |
|
|
36 |
/* (non-Javadoc) |
|
37 |
* @see com.iver.andami.plugins.Extension#isEnabled() |
|
38 |
*/ |
|
39 |
public boolean isEnabled() { |
|
40 |
return true; |
|
41 |
} |
|
42 |
|
|
43 |
/* (non-Javadoc) |
|
44 |
* @see com.iver.andami.plugins.Extension#isVisible() |
|
45 |
*/ |
|
46 |
public boolean isVisible() { |
|
47 |
// TODO Auto-generated method stub |
|
48 |
return false; |
|
49 |
} |
|
50 |
|
|
51 |
/* |
|
52 |
* (non-Javadoc) |
|
53 |
* @see com.iver.andami.plugins.Extension#actionPerformed() |
|
54 |
*/ |
|
55 |
public void actionPerformed(ActionEvent e) { |
|
56 |
String toolbarName = e.getActionCommand().substring(ACTIONCOMMANDBASE.length()); |
|
57 |
javax.swing.JMenuItem menu = PluginServices.getMainFrame().getMenuEntry((MENUBASE+toolbarName).split("/")); |
|
58 |
|
|
59 |
if (!toolbarName.equals("")) { |
|
60 |
|
|
61 |
boolean oldVisibility = PluginServices.getMainFrame().getToolbarVisibility(toolbarName); |
|
62 |
if (oldVisibility==false) { |
|
63 |
URL icon = PluginServices.getPluginServices(this).getClassLoader().getResource(ENABLEDIMAGE); |
|
64 |
menu.setIcon(new ImageIcon(icon)); |
|
65 |
persistStatus(toolbarName, !oldVisibility); |
|
66 |
} |
|
67 |
else { |
|
68 |
menu.setIcon(null); |
|
69 |
persistStatus(toolbarName, !oldVisibility); |
|
70 |
} |
|
71 |
PluginServices.getMainFrame().setToolbarVisibility(toolbarName, !oldVisibility); |
|
72 |
} |
|
73 |
} |
|
74 |
|
|
75 |
/* |
|
76 |
* (non-Javadoc) |
|
77 |
* @see com.iver.andami.plugins.Extension#initialize() |
|
78 |
*/ |
|
79 |
public void initialize() { |
|
80 |
getPersistedStatus(); |
|
81 |
SelectableToolBar[] toolBars = PluginServices.getMainFrame().getToolbars(); |
|
82 |
for (int i=toolBars.length-1; i>0; i--) { |
|
83 |
Menu menu = new Menu(); |
|
84 |
menu.setActionCommand(ACTIONCOMMANDBASE+toolBars[i].getName()); |
|
85 |
//menu.setTooltip(PluginServices.getText(this, "muestra_oculta_la_toolbar")); |
|
86 |
menu.setText(MENUBASE+toolBars[i].getName()); |
|
87 |
if (toolBars[i].getAndamiVisibility()) |
|
88 |
menu.setIcon(ENABLEDIMAGE); |
|
89 |
PluginServices.getMainFrame().addMenu(menu, this, PluginServices.getPluginServices(this).getClassLoader()); |
|
90 |
} |
|
91 |
|
|
92 |
} |
|
93 |
|
|
94 |
/** |
|
95 |
* Save the status of the provided toolbar. |
|
96 |
* |
|
97 |
* @param toolbarName The toolbar name whose status wants to be saved. |
|
98 |
* @param visible Whether or not the toolbar is visible. |
|
99 |
*/ |
|
100 |
private void persistStatus(String toolbarName, boolean visible) { |
|
101 |
PluginServices ps = PluginServices.getPluginServices(this); |
|
102 |
XMLEntity xml = ps.getPersistentXML(); |
|
103 |
XMLEntity child = null; |
|
104 |
for (int i=xml.getChildrenCount()-1; i>=0; i--) { |
|
105 |
if (xml.getChild(i).getName().equals("Toolbars")) |
|
106 |
child = xml.getChild(i).getChild(0); |
|
107 |
|
|
108 |
} |
|
109 |
if (child==null) { |
|
110 |
XMLEntity toolbars = new XMLEntity(); |
|
111 |
toolbars.setName("Toolbars"); |
|
112 |
child = new XMLEntity(); |
|
113 |
toolbars.addChild(child); |
|
114 |
xml.addChild(toolbars); |
|
115 |
} |
|
116 |
|
|
117 |
if (visible) { |
|
118 |
child.putProperty(toolbarName, "visible"); |
|
119 |
} |
|
120 |
else { |
|
121 |
child.putProperty(toolbarName, "hidden"); |
|
122 |
} |
|
123 |
ps.setPersistentXML(xml); |
|
124 |
|
|
125 |
} |
|
126 |
|
|
127 |
/** |
|
128 |
* Reads the stored toolbars' status from plugin-persinstence.xml, |
|
129 |
* and sets the toolbars accordingly. |
|
130 |
* |
|
131 |
*/ |
|
132 |
private void getPersistedStatus() { |
|
133 |
PluginServices ps = PluginServices.getPluginServices(this); |
|
134 |
XMLEntity xml = ps.getPersistentXML(); |
|
135 |
XMLEntity child = null; |
|
136 |
for (int i=xml.getChildrenCount()-1; i>=0; i--) { |
|
137 |
if (xml.getChild(i).getName().equals("Toolbars")) |
|
138 |
child = xml.getChild(i).getChild(0); |
|
139 |
|
|
140 |
} |
|
141 |
if (child!=null) { |
|
142 |
SelectableToolBar[] toolBars = PluginServices.getMainFrame().getToolbars(); |
|
143 |
for (int i=toolBars.length-1; i>=0; i--) { |
|
144 |
if (child.contains(toolBars[i].getName())) |
|
145 |
toolBars[i].setAndamiVisibility(child.getStringProperty(toolBars[i].getName()).equals("visible")); |
|
146 |
} |
|
147 |
} |
|
148 |
} |
|
149 |
} |
1.10/tags/gvSIG_3D_Animation_1_10_build_16/extensions/extDockingSkin/src/main/java/org/gvsig/StatusBar.java | ||
---|---|---|
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
2 |
* |
|
3 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
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 |
* Generalitat Valenciana |
|
22 |
* Conselleria d'Infraestructures i Transport |
|
23 |
* Av. Blasco Ib??ez, 50 |
|
24 |
* 46010 VALENCIA |
|
25 |
* SPAIN |
|
26 |
* |
|
27 |
* +34 963862235 |
|
28 |
* gvsig@gva.es |
|
29 |
* www.gvsig.gva.es |
|
30 |
* |
|
31 |
* or |
|
32 |
* |
|
33 |
* IVER T.I. S.A |
|
34 |
* Salamanca 50 |
|
35 |
* 46005 Valencia |
|
36 |
* Spain |
|
37 |
* |
|
38 |
* +34 963163400 |
|
39 |
* dac@iver.es |
|
40 |
*/ |
|
41 |
package org.gvsig; |
|
42 |
|
|
43 |
import com.iver.andami.PluginServices; |
|
44 |
import com.iver.andami.messages.MessageEvent; |
|
45 |
import com.iver.andami.messages.Messages; |
|
46 |
import com.iver.andami.messages.NotificationListener; |
|
47 |
import com.iver.andami.messages.NotificationManager; |
|
48 |
import com.iver.andami.plugins.Extension; |
|
49 |
|
|
50 |
|
|
51 |
/** |
|
52 |
* Plugin que escucha las notificaciones que recive la aplicaci?n y las muestra |
|
53 |
* en la barra de estado |
|
54 |
*/ |
|
55 |
public class StatusBar extends Extension implements NotificationListener { |
|
56 |
private int i; |
|
57 |
private int pr; |
|
58 |
/** |
|
59 |
* @see com.iver.mdiApp.IExtension#initialize() |
|
60 |
*/ |
|
61 |
public void initialize() { |
|
62 |
NotificationManager.addNotificationListener(this); |
|
63 |
} |
|
64 |
|
|
65 |
/** |
|
66 |
* @see com.iver.mdiApp.NotificationListener#errorEvent(java.lang.String) |
|
67 |
*/ |
|
68 |
public void errorEvent(MessageEvent e) { |
|
69 |
PluginServices.getMainFrame().getStatusBar().setErrorText(e.getMessages()[0]); |
|
70 |
} |
|
71 |
|
|
72 |
/** |
|
73 |
* @see com.iver.mdiApp.NotificationListener#warningEvent(java.lang.String) |
|
74 |
*/ |
|
75 |
public void warningEvent(MessageEvent e) { |
|
76 |
PluginServices.getMainFrame().getStatusBar().setWarningText(e.getMessages()[0]); |
|
77 |
} |
|
78 |
|
|
79 |
/** |
|
80 |
* @see com.iver.mdiApp.NotificationListener#infoEvent(java.lang.String) |
|
81 |
*/ |
|
82 |
public void infoEvent(MessageEvent e) { |
|
83 |
PluginServices.getMainFrame().getStatusBar().setInfoText(e.getMessages()[0]); |
|
84 |
} |
|
85 |
|
|
86 |
/* (non-Javadoc) |
|
87 |
* @see com.iver.andami.plugins.Extension#execute(java.lang.String) |
|
88 |
*/ |
|
89 |
public void execute(String actionCommand) { |
|
90 |
// TODO Auto-generated method stub |
|
91 |
|
|
92 |
} |
|
93 |
|
|
94 |
/* (non-Javadoc) |
|
95 |
* @see com.iver.andami.plugins.Extension#isEnabled() |
|
96 |
*/ |
|
97 |
public boolean isEnabled() { |
|
98 |
// TODO Auto-generated method stub |
|
99 |
return false; |
|
100 |
} |
|
101 |
|
|
102 |
/* (non-Javadoc) |
|
103 |
* @see com.iver.andami.plugins.Extension#isVisible() |
|
104 |
*/ |
|
105 |
public boolean isVisible() { |
|
106 |
// TODO Auto-generated method stub |
|
107 |
return false; |
|
108 |
} |
|
109 |
|
|
110 |
|
|
111 |
} |
1.10/tags/gvSIG_3D_Animation_1_10_build_16/extensions/extDockingSkin/src/main/java/org/gvsig/mdiManager/frames/ExternalFrame.java | ||
---|---|---|
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
2 |
* |
|
3 |
* Copyright (C) 2007 IVER T.I. and Generalitat Valenciana. |
|
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 |
* Generalitat Valenciana |
|
22 |
* Conselleria d'Infraestructures i Transport |
|
23 |
* Av. Blasco Ib??ez, 50 |
|
24 |
* 46010 VALENCIA |
|
25 |
* SPAIN |
|
26 |
* |
|
27 |
* +34 963862235 |
|
28 |
* gvsig@gva.es |
|
29 |
* www.gvsig.gva.es |
|
30 |
* |
|
31 |
* or |
|
32 |
* |
|
33 |
* IVER T.I. S.A |
|
34 |
* Salamanca 50 |
|
35 |
* 46005 Valencia |
|
36 |
* Spain |
|
37 |
* |
|
38 |
* +34 963163400 |
|
39 |
* dac@iver.es |
|
40 |
*/ |
|
41 |
package org.gvsig.mdiManager.frames; |
|
42 |
|
|
43 |
import java.awt.Dialog; |
|
44 |
import java.awt.Dimension; |
|
45 |
import java.awt.Frame; |
|
46 |
import java.awt.HeadlessException; |
|
47 |
import java.awt.event.ComponentEvent; |
|
48 |
import java.awt.event.ComponentListener; |
|
49 |
|
|
50 |
import javax.swing.JComponent; |
|
51 |
import javax.swing.JDialog; |
|
52 |
|
|
53 |
/** |
|
54 |
* @author Cesar Martinez Izquierdo <cesar.martinez@iver.es> |
|
55 |
* |
|
56 |
*/ |
|
57 |
public class ExternalFrame extends JDialog implements IFrame, ComponentListener { |
|
58 |
private static final long serialVersionUID = 1L; |
|
59 |
|
|
60 |
private void initFrame() { |
|
61 |
addComponentListener(this); |
|
62 |
} |
|
63 |
|
|
64 |
/** |
|
65 |
* Creates a non-modal dialog without a title and without a specified |
|
66 |
* <code>Frame</code> owner. A shared, hidden frame will be |
|
67 |
* set as the owner of the dialog. |
|
68 |
* <p> |
|
69 |
* This constructor sets the component's locale property to the value |
|
70 |
* returned by <code>JComponent.getDefaultLocale</code>. |
|
71 |
* |
|
72 |
* @exception HeadlessException if GraphicsEnvironment.isHeadless() |
|
73 |
* returns true. |
|
74 |
* @see java.awt.GraphicsEnvironment#isHeadless |
|
75 |
* @see JComponent#getDefaultLocale |
|
76 |
*/ |
|
77 |
public ExternalFrame() throws HeadlessException { |
|
78 |
super(); |
|
79 |
initFrame(); |
|
80 |
} |
|
81 |
|
|
82 |
/** |
|
83 |
* Creates a non-modal dialog without a title with the |
|
84 |
* specified <code>Frame</code> as its owner. If <code>owner</code> |
|
85 |
* is <code>null</code>, a shared, hidden frame will be set as the |
|
86 |
* owner of the dialog. |
|
87 |
* <p> |
|
88 |
* This constructor sets the component's locale property to the value |
|
89 |
* returned by <code>JComponent.getDefaultLocale</code>. |
|
90 |
* |
|
91 |
* @param owner the <code>Frame</code> from which the dialog is displayed |
|
92 |
* @exception HeadlessException if GraphicsEnvironment.isHeadless() |
|
93 |
* returns true. |
|
94 |
* @see java.awt.GraphicsEnvironment#isHeadless |
|
95 |
* @see JComponent#getDefaultLocale |
|
96 |
*/ |
|
97 |
public ExternalFrame(Frame owner) throws HeadlessException { |
|
98 |
super(owner); |
|
99 |
initFrame(); |
|
100 |
} |
|
101 |
|
|
102 |
/** |
|
103 |
* Creates a modal or non-modal dialog without a title and |
|
104 |
* with the specified owner <code>Frame</code>. If <code>owner</code> |
|
105 |
* is <code>null</code>, a shared, hidden frame will be set as the |
|
106 |
* owner of the dialog. |
|
107 |
* <p> |
|
108 |
* This constructor sets the component's locale property to the value |
|
109 |
* returned by <code>JComponent.getDefaultLocale</code>. |
|
110 |
* |
|
111 |
* @param owner the <code>Frame</code> from which the dialog is displayed |
|
112 |
* @param modal true for a modal dialog, false for one that allows |
|
113 |
* others windows to be active at the same time |
|
114 |
* @exception HeadlessException if GraphicsEnvironment.isHeadless() |
|
115 |
* returns true. |
|
116 |
* @see java.awt.GraphicsEnvironment#isHeadless |
|
117 |
* @see JComponent#getDefaultLocale |
|
118 |
*/ |
|
119 |
public ExternalFrame(Frame owner, boolean modal) throws HeadlessException { |
|
120 |
super(owner, modal); |
|
121 |
initFrame(); |
|
122 |
} |
|
123 |
|
|
124 |
/** |
|
125 |
* Creates a non-modal dialog with the specified title and |
|
126 |
* with the specified owner frame. If <code>owner</code> |
|
127 |
* is <code>null</code>, a shared, hidden frame will be set as the |
|
128 |
* owner of the dialog. |
|
129 |
* <p> |
|
130 |
* This constructor sets the component's locale property to the value |
|
131 |
* returned by <code>JComponent.getDefaultLocale</code>. |
|
132 |
* |
|
133 |
* @param owner the <code>Frame</code> from which the dialog is displayed |
|
134 |
* @param title the <code>String</code> to display in the dialog's |
|
135 |
* title bar |
|
136 |
* @exception HeadlessException if GraphicsEnvironment.isHeadless() |
|
137 |
* returns true. |
|
138 |
* @see java.awt.GraphicsEnvironment#isHeadless |
|
139 |
* @see JComponent#getDefaultLocale |
|
140 |
*/ |
|
141 |
public ExternalFrame(Frame owner, String title) throws HeadlessException { |
|
142 |
super(owner, title); |
|
143 |
initFrame(); |
|
144 |
} |
|
145 |
|
|
146 |
/** |
|
147 |
* Creates a modal or non-modal dialog with the specified title |
|
148 |
* and the specified owner <code>Frame</code>. If <code>owner</code> |
|
149 |
* is <code>null</code>, a shared, hidden frame will be set as the |
|
150 |
* owner of this dialog. All constructors defer to this one. |
|
151 |
* <p> |
|
152 |
* NOTE: Any popup components (<code>JComboBox</code>, |
|
153 |
* <code>JPopupMenu</code>, <code>JMenuBar</code>) |
|
154 |
* created within a modal dialog will be forced to be lightweight. |
|
155 |
* <p> |
|
156 |
* This constructor sets the component's locale property to the value |
|
157 |
* returned by <code>JComponent.getDefaultLocale</code>. |
|
158 |
* |
|
159 |
* @param owner the <code>Frame</code> from which the dialog is displayed |
|
160 |
* @param title the <code>String</code> to display in the dialog's |
|
161 |
* title bar |
|
162 |
* @param modal true for a modal dialog, false for one that allows |
|
163 |
* other windows to be active at the same time |
|
164 |
* @exception HeadlessException if GraphicsEnvironment.isHeadless() |
|
165 |
* returns true. |
|
166 |
* @see java.awt.GraphicsEnvironment#isHeadless |
|
167 |
* @see JComponent#getDefaultLocale |
|
168 |
*/ |
|
169 |
public ExternalFrame(Frame owner, String title, boolean modal) |
|
170 |
throws HeadlessException { |
|
171 |
super(owner, title, modal); |
|
172 |
initFrame(); |
|
173 |
} |
|
174 |
|
|
175 |
/** |
|
176 |
* Creates a non-modal dialog without a title with the |
|
177 |
* specified <code>Dialog</code> as its owner. |
|
178 |
* <p> |
|
179 |
* This constructor sets the component's locale property to the value |
|
180 |
* returned by <code>JComponent.getDefaultLocale</code>. |
|
181 |
* |
|
182 |
* @param owner the non-null <code>Dialog</code> from which the dialog is displayed |
|
183 |
* @exception HeadlessException if GraphicsEnvironment.isHeadless() |
|
184 |
* returns true. |
|
185 |
* @see java.awt.GraphicsEnvironment#isHeadless |
|
186 |
* @see JComponent#getDefaultLocale |
|
187 |
*/ |
|
188 |
public ExternalFrame(Dialog owner) throws HeadlessException { |
|
189 |
super(owner); |
|
190 |
initFrame(); |
|
191 |
} |
|
192 |
|
|
193 |
/** |
|
194 |
* Creates a modal or non-modal dialog without a title and |
|
195 |
* with the specified owner dialog. |
|
196 |
* <p> |
|
197 |
* This constructor sets the component's locale property to the value |
|
198 |
* returned by <code>JComponent.getDefaultLocale</code>. |
|
199 |
* |
|
200 |
* @param owner the non-null <code>Dialog</code> from which the dialog is displayed |
|
201 |
* @param modal true for a modal dialog, false for one that allows |
|
202 |
* other windows to be active at the same time |
|
203 |
* @exception HeadlessException if GraphicsEnvironment.isHeadless() |
|
204 |
* returns true. |
|
205 |
* @see java.awt.GraphicsEnvironment#isHeadless |
|
206 |
* @see JComponent#getDefaultLocale |
|
207 |
*/ |
|
208 |
public ExternalFrame(Dialog owner, boolean modal) throws HeadlessException { |
|
209 |
super(owner, modal); |
|
210 |
initFrame(); |
|
211 |
} |
|
212 |
|
|
213 |
/** |
|
214 |
* Creates a non-modal dialog with the specified title and |
|
215 |
* with the specified owner dialog. |
|
216 |
* <p> |
|
217 |
* This constructor sets the component's locale property to the value |
|
218 |
* returned by <code>JComponent.getDefaultLocale</code>. |
|
219 |
* |
|
220 |
* @param owner the non-null <code>Dialog</code> from which the dialog is displayed |
|
221 |
* @param title the <code>String</code> to display in the dialog's |
|
222 |
* title bar |
|
223 |
* @exception HeadlessException if GraphicsEnvironment.isHeadless() |
|
224 |
* returns true. |
|
225 |
* @see java.awt.GraphicsEnvironment#isHeadless |
|
226 |
* @see JComponent#getDefaultLocale |
|
227 |
*/ |
|
228 |
public ExternalFrame(Dialog owner, String title) throws HeadlessException { |
|
229 |
super(owner, title); |
|
230 |
initFrame(); |
|
231 |
} |
|
232 |
|
|
233 |
/** |
|
234 |
* Creates a modal or non-modal dialog with the specified title |
|
235 |
* and the specified owner frame. |
|
236 |
* <p> |
|
237 |
* This constructor sets the component's locale property to the value |
|
238 |
* returned by <code>JComponent.getDefaultLocale</code>. |
|
239 |
* |
|
240 |
* @param owner the non-null <code>Dialog</code> from which the dialog is displayed |
|
241 |
* @param title the <code>String</code> to display in the dialog's |
|
242 |
* title bar |
|
243 |
* @param modal true for a modal dialog, false for one that allows |
|
244 |
* other windows to be active at the same time |
|
245 |
* @exception HeadlessException if GraphicsEnvironment.isHeadless() |
|
246 |
* returns true. |
|
247 |
* @see java.awt.GraphicsEnvironment#isHeadless |
|
248 |
* @see JComponent#getDefaultLocale |
|
249 |
*/ |
|
250 |
public ExternalFrame(Dialog owner, String title, boolean modal) |
|
251 |
throws HeadlessException { |
|
252 |
super(owner, title, modal); |
|
253 |
initFrame(); |
|
254 |
} |
|
255 |
|
|
256 |
/** |
|
257 |
* Stores the minimum allowed size for this JDialog. If it is null, there |
|
258 |
* is no minimum size for this window. |
|
259 |
*/ |
|
260 |
Dimension minimumSize = null; |
|
261 |
|
|
262 |
/* (non-Javadoc) |
|
263 |
* @see com.iver.core.mdiManager.frames.IFrame#setHeight(int) |
|
264 |
*/ |
|
265 |
public void setHeight(int height) { |
|
266 |
super.setSize(getWidth(), height); |
|
267 |
} |
|
268 |
|
|
269 |
/* (non-Javadoc) |
|
270 |
* @see com.iver.core.mdiManager.frames.IFrame#setWidth(int) |
|
271 |
*/ |
|
272 |
public void setWidth(int width) { |
|
273 |
super.setSize(width, getHeight()); |
|
274 |
} |
|
275 |
|
|
276 |
/* (non-Javadoc) |
|
277 |
* @see com.iver.core.mdiManager.frames.IFrame#setX(int) |
|
278 |
*/ |
|
279 |
public void setX(int x) { |
|
280 |
super.setLocation(x, getX()); |
|
281 |
} |
|
282 |
|
|
283 |
/* (non-Javadoc) |
|
284 |
* @see com.iver.core.mdiManager.frames.IFrame#setY(int) |
|
285 |
*/ |
|
286 |
public void setY(int y) { |
|
287 |
super.setLocation(y, getY()); |
|
288 |
} |
|
289 |
|
|
290 |
/* (non-Javadoc) |
|
291 |
* @see com.iver.core.mdiManager.frames.IFrame#getMinimumSize() |
|
292 |
*/ |
|
293 |
public Dimension getMinimumSize() { |
|
294 |
return minimumSize; |
|
295 |
} |
|
296 |
|
|
297 |
/* (non-Javadoc) |
|
298 |
* @see com.iver.core.mdiManager.frames.IFrame#setMinimumSize(java.awt.Dimension) |
|
299 |
*/ |
|
300 |
public void setMinimumSize(Dimension minSize) { |
|
301 |
minimumSize = minSize; |
|
302 |
adjustToMinSize(); |
|
303 |
} |
|
304 |
|
|
305 |
/** |
|
306 |
* Adjust the window to the minimum size, if necessary. |
|
307 |
*/ |
|
308 |
private void adjustToMinSize() { |
|
309 |
if (minimumSize==null) return; |
|
310 |
int height, width; |
|
311 |
Dimension currentSize = getSize(); |
|
312 |
boolean modified=false; |
|
313 |
|
|
314 |
if (currentSize.height < minimumSize.height) { |
|
315 |
height = minimumSize.height; |
|
316 |
modified = true; |
|
317 |
} |
|
318 |
else { |
|
319 |
height = currentSize.height; |
|
320 |
} |
|
321 |
|
|
322 |
if (currentSize.width < minimumSize.width) { |
|
323 |
width = minimumSize.width; |
|
324 |
modified = true; |
|
325 |
} |
|
326 |
else { |
|
327 |
width = currentSize.width; |
|
328 |
} |
|
329 |
if (modified) { |
|
330 |
boolean isResizable = isResizable(); |
|
331 |
setResizable(false); |
|
332 |
setSize(width, height); |
|
333 |
setResizable(isResizable); |
|
334 |
show(); |
|
335 |
} |
|
336 |
} |
|
337 |
|
|
338 |
public void componentHidden(ComponentEvent e) { |
|
339 |
// TODO Auto-generated method stub |
|
340 |
|
|
341 |
} |
|
342 |
|
|
343 |
public void componentMoved(ComponentEvent e) { |
|
344 |
// TODO Auto-generated method stub |
|
345 |
|
|
346 |
} |
|
347 |
|
|
348 |
public void componentResized(ComponentEvent e) { |
|
349 |
// this is necessary because in Java 1.4/1.5, JDialog doesn't have a |
|
350 |
// setMinimum method. It's solved in 1.6, we'll remove this after migration. |
|
351 |
adjustToMinSize(); |
|
352 |
|
|
353 |
} |
|
354 |
|
|
355 |
public void componentShown(ComponentEvent e) { |
|
356 |
// TODO Auto-generated method stub |
|
357 |
|
|
358 |
} |
|
359 |
|
|
360 |
} |
1.10/tags/gvSIG_3D_Animation_1_10_build_16/extensions/extDockingSkin/src/main/java/org/gvsig/mdiManager/frames/IFrame.java | ||
---|---|---|
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
2 |
* |
|
3 |
* Copyright (C) 2007 IVER T.I. and Generalitat Valenciana. |
|
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 |
* Generalitat Valenciana |
|
22 |
* Conselleria d'Infraestructures i Transport |
|
23 |
* Av. Blasco Ib??ez, 50 |
|
24 |
* 46010 VALENCIA |
|
25 |
* SPAIN |
|
26 |
* |
|
27 |
* +34 963862235 |
|
28 |
* gvsig@gva.es |
|
29 |
* www.gvsig.gva.es |
|
30 |
* |
|
31 |
* or |
|
32 |
* |
|
33 |
* IVER T.I. S.A |
|
34 |
* Salamanca 50 |
|
35 |
* 46005 Valencia |
|
36 |
* Spain |
|
37 |
* |
|
38 |
* +34 963163400 |
|
39 |
* dac@iver.es |
|
40 |
*/ |
|
41 |
|
|
42 |
/** |
|
43 |
* |
|
44 |
*/ |
|
45 |
package org.gvsig.mdiManager.frames; |
|
46 |
|
|
47 |
import java.awt.Dimension; |
|
48 |
import java.awt.Rectangle; |
|
49 |
|
|
50 |
/** |
|
51 |
* This interface is a model for CorePlugin windows. When CorePlugin receives an |
|
52 |
* IWindow object, it creates a JInternalFrame or a JDialog, depending on |
|
53 |
* the specified properties. |
|
54 |
* |
|
55 |
* This interface allows coreplugin to talk to JInternalFrames and JDialogs in |
|
56 |
* a uniform way. |
|
57 |
* |
|
58 |
* @author Cesar Martinez Izquierdo <cesar.martinez@iver.es> |
|
59 |
*/ |
|
60 |
public interface IFrame { |
|
61 |
/** |
|
62 |
* Gets the title property |
|
63 |
* |
|
64 |
* @return |
|
65 |
*/ |
|
66 |
public String getTitle(); |
|
67 |
|
|
68 |
/** |
|
69 |
* Sets the title property. |
|
70 |
* |
|
71 |
* @param title The new title. |
|
72 |
*/ |
|
73 |
public void setTitle(String title); |
|
74 |
|
|
75 |
/** |
|
76 |
* Returns the current x coordinate of the window's origin. |
|
77 |
* |
|
78 |
* @return Returns the value (in pixels) of the x coordinate |
|
79 |
* of the window's origin. |
|
80 |
*/ |
|
81 |
public int getX(); |
|
82 |
|
|
83 |
/** |
|
84 |
* Sets the value of the x coordinate for the origin of the associated |
|
85 |
* window. |
|
86 |
* |
|
87 |
* @param x The value (in pixels) of the x coordinate |
|
88 |
*/ |
|
89 |
public void setX(int x); |
|
90 |
|
|
91 |
/** |
|
92 |
* Returns the current y coordinate of the window's origin. |
|
93 |
* |
|
94 |
* @return Returns the value (in pixels) of the y coordinate |
|
95 |
* of the window's origin. |
|
96 |
*/ |
|
97 |
public int getY(); |
|
98 |
|
|
99 |
/** |
|
100 |
* Sets the value of the y coordinate for the origin of the associated |
|
101 |
* window. |
|
102 |
* |
|
103 |
* @param y The value (in pixels) of the y coordinate |
|
104 |
*/ |
|
105 |
public void setY(int y); |
|
106 |
|
|
107 |
/** |
|
108 |
* Gets the window height. |
|
109 |
* |
|
110 |
* @return The window height (in pixels). |
|
111 |
*/ |
|
112 |
public int getHeight(); |
|
113 |
|
|
114 |
/** |
|
115 |
* Gets the window width. |
|
116 |
* |
|
117 |
* @return The window width (in pixels). |
|
118 |
*/ |
|
119 |
public int getWidth(); |
|
120 |
|
|
121 |
/** |
|
122 |
* Sets the window height. |
|
123 |
* |
|
124 |
* @param The window height (in pixels) |
|
125 |
*/ |
|
126 |
public void setHeight(int height); |
|
127 |
|
|
128 |
/** |
|
129 |
* Sets the window width. |
|
130 |
* |
|
131 |
* @param The window width (in pixels) |
|
132 |
*/ |
|
133 |
public void setWidth(int width); |
|
134 |
|
|
135 |
/** |
|
136 |
* Gets the minimum allowed size for this window. |
|
137 |
* |
|
138 |
* @return minSize The minimum allowed size for this window. |
|
139 |
*/ |
|
140 |
public Dimension getMinimumSize(); |
|
141 |
|
|
142 |
/** |
|
143 |
* Sets the minimum allowed size for this window. If null is provided, |
|
144 |
* the minimum size is disabled (and thus |
|
145 |
* the window can be resized to any size). |
|
146 |
* |
|
147 |
* @param minSize The minimum allowed size for this window. |
|
148 |
*/ |
|
149 |
public void setMinimumSize(Dimension minSize); |
|
150 |
|
|
151 |
/** |
|
152 |
* Gets the window bounds. |
|
153 |
* |
|
154 |
* @return The window bounds. |
|
155 |
*/ |
|
156 |
public Rectangle getBounds(); |
|
157 |
|
|
158 |
/** |
|
159 |
* Sets the window bounds. |
|
160 |
* |
|
161 |
* @param bounds The window bounds. |
|
162 |
*/ |
|
163 |
public void setBounds(Rectangle bounds); |
|
164 |
|
|
165 |
public void setLocation(int x, int y); |
|
166 |
|
|
167 |
} |
1.10/tags/gvSIG_3D_Animation_1_10_build_16/extensions/extDockingSkin/src/main/java/org/gvsig/mdiManager/frames/InternalFrame.java | ||
---|---|---|
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
2 |
* |
|
3 |
* Copyright (C) 2007 IVER T.I. and Generalitat Valenciana. |
|
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 |
* Generalitat Valenciana |
|
22 |
* Conselleria d'Infraestructures i Transport |
|
23 |
* Av. Blasco Ib??ez, 50 |
|
24 |
* 46010 VALENCIA |
|
25 |
* SPAIN |
|
26 |
* |
|
27 |
* +34 963862235 |
|
28 |
* gvsig@gva.es |
|
29 |
* www.gvsig.gva.es |
|
30 |
* |
|
31 |
* or |
|
32 |
* |
|
33 |
* IVER T.I. S.A |
|
34 |
* Salamanca 50 |
|
35 |
* 46005 Valencia |
|
36 |
* Spain |
|
37 |
* |
|
38 |
* +34 963163400 |
|
39 |
* dac@iver.es |
|
40 |
*/ |
|
41 |
package org.gvsig.mdiManager.frames; |
|
42 |
|
|
43 |
import javax.swing.JInternalFrame; |
|
44 |
|
|
45 |
/** |
|
46 |
* @author Cesar Martinez Izquierdo <cesar.martinez@iver.es> |
|
47 |
* |
|
48 |
*/ |
|
49 |
public class InternalFrame extends JInternalFrame implements IFrame { |
|
50 |
private static final long serialVersionUID = 1L; |
|
51 |
|
|
52 |
/** |
|
53 |
* Creates a non-resizable, non-closable, non-maximizable, |
|
54 |
* non-iconifiable <code>JInternalFrame</code> with no title. |
|
55 |
*/ |
|
56 |
public InternalFrame() { |
|
57 |
super(); |
|
58 |
} |
|
59 |
|
|
60 |
/** |
|
61 |
* Creates a non-resizable, non-closable, non-maximizable, |
|
62 |
* non-iconifiable <code>JInternalFrame</code> with the specified title. |
|
63 |
* Note that passing in a <code>null</code> <code>title</code> results in |
|
64 |
* unspecified behavior and possibly an exception. |
|
65 |
* |
|
66 |
* @param title the non-<code>null</code> <code>String</code> |
|
67 |
* to display in the title bar |
|
68 |
*/ |
|
69 |
public InternalFrame(String title) { |
|
70 |
super(title); |
|
71 |
} |
|
72 |
|
|
73 |
/** |
|
74 |
* Creates a non-closable, non-maximizable, non-iconifiable |
|
75 |
* <code>JInternalFrame</code> with the specified title |
|
76 |
* and resizability. |
|
77 |
* |
|
78 |
* @param title the <code>String</code> to display in the title bar |
|
79 |
* @param resizable if <code>true</code>, the internal frame can be resized |
|
80 |
*/ |
|
81 |
public InternalFrame(String title, boolean resizable) { |
|
82 |
super(title, resizable); |
|
83 |
} |
|
84 |
|
|
85 |
/** |
|
86 |
* Creates a non-maximizable, non-iconifiable <code>JInternalFrame</code> |
|
87 |
* with the specified title, resizability, and |
|
88 |
* closability. |
|
89 |
* |
|
90 |
* @param title the <code>String</code> to display in the title bar |
|
91 |
* @param resizable if <code>true</code>, the internal frame can be resized |
|
92 |
* @param closable if <code>true</code>, the internal frame can be closed |
|
93 |
*/ |
|
94 |
public InternalFrame(String title, boolean resizable, boolean closable) { |
|
95 |
super(title, resizable, closable); |
|
96 |
} |
|
97 |
|
|
98 |
/** |
|
99 |
* Creates a non-iconifiable <code>JInternalFrame</code> |
|
100 |
* with the specified title, |
|
101 |
* resizability, closability, and maximizability. |
|
102 |
* |
|
103 |
* @param title the <code>String</code> to display in the title bar |
|
104 |
* @param resizable if <code>true</code>, the internal frame can be resized |
|
105 |
* @param closable if <code>true</code>, the internal frame can be closed |
|
106 |
* @param maximizable if <code>true</code>, the internal frame can be maximized |
|
107 |
*/ |
|
108 |
public InternalFrame(String title, boolean resizable, boolean closable, |
|
109 |
boolean maximizable) { |
|
110 |
super(title, resizable, closable, maximizable); |
|
111 |
} |
|
112 |
|
|
113 |
/** |
|
114 |
* Creates a <code>JInternalFrame</code> with the specified title, |
|
115 |
* resizability, closability, maximizability, and iconifiability. |
|
116 |
* All <code>JInternalFrame</code> constructors use this one. |
|
117 |
* |
|
118 |
* @param title the <code>String</code> to display in the title bar |
|
119 |
* @param resizable if <code>true</code>, the internal frame can be resized |
|
120 |
* @param closable if <code>true</code>, the internal frame can be closed |
|
121 |
* @param maximizable if <code>true</code>, the internal frame can be maximized |
|
122 |
* @param iconifiable if <code>true</code>, the internal frame can be iconified |
|
123 |
*/ |
|
124 |
public InternalFrame(String title, boolean resizable, boolean closable, |
|
125 |
boolean maximizable, boolean iconifiable) { |
|
126 |
|
|
127 |
super(title, resizable, closable, maximizable, iconifiable); |
|
128 |
} |
|
129 |
|
|
130 |
|
|
131 |
/* (non-Javadoc) |
|
132 |
* @see com.iver.core.mdiManager.frames.IFrame#setHeight(int) |
|
133 |
*/ |
|
134 |
public void setHeight(int height) { |
|
135 |
super.setSize(getWidth(), height); |
|
136 |
} |
|
137 |
|
|
138 |
/* (non-Javadoc) |
|
139 |
* @see com.iver.core.mdiManager.frames.IFrame#setWidth(int) |
|
140 |
*/ |
|
141 |
public void setWidth(int width) { |
|
142 |
super.setSize(width, getHeight()); |
|
143 |
} |
|
144 |
|
|
145 |
/* (non-Javadoc) |
|
146 |
* @see com.iver.core.mdiManager.frames.IFrame#setX(int) |
|
147 |
*/ |
|
148 |
public void setX(int x) { |
|
149 |
super.setLocation(x, getX()); |
|
150 |
} |
|
151 |
|
|
152 |
/* (non-Javadoc) |
|
153 |
* @see com.iver.core.mdiManager.frames.IFrame#setY(int) |
|
154 |
*/ |
|
155 |
public void setY(int y) { |
|
156 |
super.setLocation(y, getY()); |
|
157 |
} |
|
158 |
|
|
159 |
} |
1.10/tags/gvSIG_3D_Animation_1_10_build_16/extensions/extDockingSkin/src/main/java/org/gvsig/mdiManager/DockWindowStack.java | ||
---|---|---|
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
2 |
* |
|
3 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
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 |
* Generalitat Valenciana |
|
22 |
* Conselleria d'Infraestructures i Transport |
|
23 |
* Av. Blasco Ib??ez, 50 |
|
24 |
* 46010 VALENCIA |
|
25 |
* SPAIN |
|
26 |
* |
|
27 |
* +34 963862235 |
|
28 |
* gvsig@gva.es |
|
29 |
* www.gvsig.gva.es |
|
30 |
* |
|
31 |
* or |
|
32 |
* |
|
33 |
* IVER T.I. S.A |
|
34 |
* Salamanca 50 |
|
35 |
* 46005 Valencia |
|
36 |
* Spain |
|
37 |
* |
|
38 |
* +34 963163400 |
|
39 |
* dac@iver.es |
|
40 |
*/ |
|
41 |
package org.gvsig.mdiManager; |
|
42 |
|
|
43 |
import java.awt.event.ActionListener; |
|
44 |
import java.util.Hashtable; |
|
45 |
import java.util.Vector; |
|
46 |
|
|
47 |
import com.iver.andami.PluginServices; |
|
48 |
import com.iver.andami.plugins.config.generate.Menu; |
|
49 |
import com.iver.andami.ui.mdiManager.IWindow; |
|
50 |
import com.iver.andami.ui.mdiManager.WindowInfo; |
|
51 |
|
|
52 |
/** |
|
53 |
* |
|
54 |
*/ |
|
55 |
public class DockWindowStack { |
|
56 |
private Vector vistas = new Vector(); |
|
57 |
|
|
58 |
private DockInfoSupport vis; |
|
59 |
|
|
60 |
private Hashtable viewMenu = new Hashtable(); |
|
61 |
|
|
62 |
/** |
|
63 |
* @param vis |
|
64 |
*/ |
|
65 |
public DockWindowStack(DockInfoSupport vis) { |
|
66 |
this.vis = vis; |
|
67 |
} |
|
68 |
|
|
69 |
public void add(IWindow v, final ActionListener listener) { |
|
70 |
vistas.add(v); |
|
71 |
WindowInfo vi = vis.getWindowInfo(v); |
|
72 |
int id = vi.getId(); |
|
73 |
Menu m = new Menu(); |
|
74 |
m.setActionCommand(""+id); |
|
75 |
m.setTooltip(PluginServices.getText(this, "activa_la_ventana")); |
|
76 |
m.setText("Ventana/"+vi.getTitle()); |
|
77 |
viewMenu.put(v, m); |
|
78 |
PluginServices.getMainFrame().addMenu(m, listener, PluginServices.getPluginServices(this).getClassLoader() ); |
|
79 |
} |
|
80 |
|
|
81 |
public void remove(IWindow v){ |
|
82 |
Menu m = (Menu) viewMenu.get(v); |
|
83 |
if (m == null) return; |
|
84 |
PluginServices.getMainFrame().removeMenu(m); |
|
85 |
viewMenu.remove(v); |
|
86 |
vistas.remove(v); |
|
87 |
} |
|
88 |
|
|
89 |
/** |
|
90 |
* FJP: No se usa, y no s? para qu? estaba pensado. |
|
91 |
*/ |
|
92 |
public void ctrltab(){ |
|
93 |
IWindow v = (IWindow) vistas.remove(vistas.size() - 1); |
|
94 |
vistas.add(0, v); |
|
95 |
} |
|
96 |
|
|
97 |
public IWindow getActiveWindow(){ |
|
98 |
if (vistas.size() == 0) return null; |
|
99 |
int index = vistas.size()-1; |
|
100 |
while (index >= 0) |
|
101 |
{ |
|
102 |
IWindow aux = (IWindow) vistas.get(index); |
|
103 |
if (!aux.getWindowInfo().isPalette()) |
|
104 |
{ |
|
105 |
// System.err.println("getActiveView = " + aux.getWindowInfo().getTitle()); |
|
106 |
return aux; |
|
107 |
} |
|
108 |
index--; |
|
109 |
} |
|
110 |
return null; |
|
111 |
} |
|
112 |
/** |
|
113 |
* Se utiliza cuando ya est? abierta la vista para indicar |
|
114 |
* que la pasamos a activa. De esta forma evitamos que el |
|
115 |
* getActiveView devuelva algo que no es. |
|
116 |
* En realidad lo que haces es mover la vista a la ?ltima |
|
117 |
* posici?n. |
|
118 |
* @param v |
|
119 |
*/ |
|
120 |
public void setActive(IWindow v) |
|
121 |
{ |
|
122 |
IWindow copia = null; |
|
123 |
boolean bCopiar = false; |
|
124 |
// Si es de tipo palette, no se pone como activa. |
|
125 |
// De esta forma, nunca nos la devolver?.... Bueno, |
|
126 |
// igual si cerramos la de encima. Voy a ponerle en |
|
127 |
// getActiveView que si es de tipo Palette, devuelva la |
|
128 |
// de abajo. |
|
129 |
if (v.getWindowInfo().isPalette()) return; |
|
130 |
|
|
131 |
for (int i=0; i < vistas.size(); i++) |
|
132 |
{ |
|
133 |
IWindow aux = (IWindow) vistas.get(i); |
|
134 |
if (aux == v) |
|
135 |
{ |
|
136 |
copia = aux; |
|
137 |
bCopiar = true; |
|
138 |
} |
|
139 |
if (bCopiar) |
|
140 |
{ |
|
141 |
if (i < vistas.size()-1) |
|
142 |
{ |
|
143 |
IWindow siguiente = (IWindow) vistas.get(i+1); |
|
144 |
vistas.set(i,siguiente); |
|
145 |
} |
|
146 |
else // La ?ltima |
|
147 |
vistas.set(i,copia); |
|
148 |
} |
|
149 |
} // for |
|
150 |
} |
|
151 |
} |
1.10/tags/gvSIG_3D_Animation_1_10_build_16/extensions/extDockingSkin/src/main/java/org/gvsig/mdiManager/SingletonSupport.java | ||
---|---|---|
1 |
/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana |
|
2 |
* |
|
3 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
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 |
* Generalitat Valenciana |
|
22 |
* Conselleria d'Infraestructures i Transport |
|
23 |
* Av. Blasco Ib��ez, 50 |
|
24 |
* 46010 VALENCIA |
|
25 |
* SPAIN |
|
26 |
* |
|
27 |
* +34 963862235 |
|
28 |
* gvsig@gva.es |
|
29 |
* www.gvsig.gva.es |
|
30 |
* |
|
31 |
* or |
|
32 |
* |
|
33 |
* IVER T.I. S.A |
|
34 |
* Salamanca 50 |
|
35 |
* 46005 Valencia |
|
36 |
* Spain |
|
37 |
* |
|
38 |
* +34 963163400 |
|
39 |
* dac@iver.es |
|
40 |
*/ |
|
41 |
package org.gvsig.mdiManager; |
|
42 |
|
|
43 |
import java.awt.Component; |
|
44 |
import java.awt.Dimension; |
|
45 |
import java.awt.Rectangle; |
|
46 |
import java.util.ArrayList; |
|
47 |
|
|
48 |
import net.infonode.docking.RootWindow; |
|
49 |
import net.infonode.tabbedpanel.titledtab.TitledTabProperties; |
|
50 |
|
|
51 |
import com.iver.andami.PluginServices; |
|
52 |
import com.iver.andami.ui.mdiFrame.MDIFrame; |
|
53 |
import com.iver.andami.ui.mdiManager.SingletonDialogAlreadyShownException; |
|
54 |
import com.iver.andami.ui.mdiManager.SingletonWindow; |
|
55 |
import com.iver.andami.ui.mdiManager.WindowInfo; |
|
56 |
|
|
57 |
|
|
58 |
/** |
|
59 |
* DOCUMENT ME! |
|
60 |
* |
|
61 |
* @author $author$ |
|
62 |
* @version $Revision: 15982 $ |
|
63 |
*/ |
|
64 |
public class SingletonSupport { |
|
65 |
private static int singletonViewInfoID = 0; |
|
66 |
/** Hashtable que asocia contenido con vistas */ |
|
67 |
private HashMap contentWindowInfo = new HashMap(); |
|
68 |
private DockInfoSupport dockInfoSupport; |
|
69 |
private DockWindowSupport dockWindowSupport; |
|
70 |
private HashMap contentFrame = new HashMap(); |
|
71 |
|
|
72 |
public RootWindow rootWindow = null; |
|
73 |
|
|
74 |
/** |
|
75 |
* DOCUMENT ME! |
|
76 |
* |
|
77 |
* @param vis DOCUMENT ME! |
|
78 |
* @param fvs |
|
79 |
* |
|
80 |
* @see com.iver.andami.ui.mdiManager.MDIManager#init(com.iver.andami.ui.mdiFrame.MDIFrame) |
|
81 |
*/ |
|
82 |
public SingletonSupport(DockInfoSupport vis, DockWindowSupport fvs) { |
|
83 |
this.dockInfoSupport = vis; |
|
84 |
this.dockWindowSupport = fvs; |
|
85 |
} |
|
86 |
public SingletonSupport() { |
|
87 |
} |
|
88 |
|
|
89 |
public DockInfoSupport getDockInfoSupport() { |
|
90 |
return dockInfoSupport; |
|
91 |
} |
|
92 |
public void setDockInfoSupport(DockInfoSupport dockInfoSupport) { |
|
93 |
this.dockInfoSupport = dockInfoSupport; |
|
94 |
} |
|
95 |
public DockWindowSupport getDockWindowSupport() { |
|
96 |
return dockWindowSupport; |
|
97 |
} |
|
98 |
public void setDockWindowSupport(DockWindowSupport dockWindowSupport) { |
|
99 |
this.dockWindowSupport = dockWindowSupport; |
|
100 |
} |
|
101 |
/** |
|
102 |
* Devuelve una referencia a la vista si ya est� mostrada o null si la |
|
103 |
* vista no ha sido a�adida o ya fue cerrada |
|
104 |
* |
|
105 |
* @param windowClass DOCUMENT ME! |
|
106 |
* @param model DOCUMENT ME! |
|
107 |
* @param wi DOCUMENT ME! |
|
108 |
* |
|
109 |
* @return true si la vista existe ya y false si la vista no existe |
|
110 |
* |
|
111 |
* @throws SingletonDialogAlreadyShownException DOCUMENT ME! |
|
112 |
*/ |
|
113 |
public boolean registerWindow(Class windowClass, Object model, WindowInfo wi) { |
|
114 |
//Se comprueba si la ventana est� siendo mostrada |
|
115 |
SingletonWindowInfo swi = new SingletonWindowInfo(windowClass, model); |
|
116 |
|
|
117 |
if (contentWindowInfo.containsKey(swi)) { |
|
118 |
if (wi.isModal()) { |
|
119 |
throw new SingletonDialogAlreadyShownException(); |
|
120 |
} |
|
121 |
|
|
122 |
wi.setWindowInfo((WindowInfo)contentWindowInfo.get(swi)); |
|
123 |
|
|
124 |
return true; |
|
125 |
} else { |
|
126 |
//La ventana singleton no estaba mostrada |
|
127 |
//Se asocia el modelo con la vista |
|
128 |
contentWindowInfo.put(swi, wi); |
|
129 |
return false; |
|
130 |
} |
|
131 |
} |
|
132 |
|
|
133 |
public void openSingletonWindow(SingletonWindow sw, Component frame){ |
|
134 |
SingletonWindowInfo swi = new SingletonWindowInfo(sw.getClass(), sw.getWindowModel()); |
|
135 |
contentFrame.put(swi, frame); |
|
136 |
} |
|
137 |
|
|
138 |
public boolean contains(SingletonWindow sw){ |
|
139 |
SingletonWindowInfo swi = new SingletonWindowInfo(sw.getClass(), sw.getWindowModel()); |
|
140 |
return contentFrame.containsKey(swi); |
|
141 |
} |
|
142 |
|
|
143 |
/** |
|
144 |
* DOCUMENT ME! |
|
145 |
* |
|
146 |
* @param sw |
|
147 |
*/ |
|
148 |
public void closeWindow(SingletonWindow sw) { |
|
149 |
SingletonWindowInfo swi = new SingletonWindowInfo(sw.getClass(), sw.getWindowModel()); |
|
150 |
WindowInfo windowInfo = (WindowInfo) contentWindowInfo.get(swi); |
|
151 |
if (windowInfo!=null) { |
|
152 |
dockWindowSupport.updateWindowInfo(sw, windowInfo); |
|
153 |
} |
|
154 |
contentFrame.remove(swi); |
|
155 |
} |
|
156 |
|
|
157 |
/** |
|
158 |
* Representa una vista singleton manteniendo el modelo y la clase de la |
|
159 |
* vista que lo muestra |
|
160 |
* |
|
161 |
* @author Fernando Gonz�lez Cort�s |
|
162 |
*/ |
|
163 |
public class SingletonWindowInfo { |
|
164 |
|
|
165 |
public int id; |
|
166 |
|
|
167 |
/** Clase de la vista */ |
|
168 |
public Class clase; |
|
169 |
|
|
170 |
/** Modelo que representa la vista */ |
|
171 |
public Object modelo; |
|
172 |
|
|
173 |
/** |
|
174 |
* Creates a new SingletonView object. |
|
175 |
* |
|
176 |
* @param clase Clase de la vista |
|
177 |
* @param modelo Modelo que representa la vista |
|
178 |
*/ |
|
179 |
public SingletonWindowInfo(Class clase, Object modelo) { |
|
180 |
this.clase = clase; |
|
181 |
this.modelo = modelo; |
|
182 |
this.id = singletonViewInfoID; |
|
183 |
singletonViewInfoID++; |
|
184 |
} |
|
185 |
|
|
186 |
/** |
|
187 |
* @see java.lang.Object#equals(java.lang.Object) |
|
188 |
*/ |
|
189 |
public boolean equals(Object obj) { |
|
190 |
if (obj.getClass() != SingletonWindowInfo.class) { |
|
191 |
throw new IllegalArgumentException(); |
|
192 |
} |
|
193 |
|
|
194 |
SingletonWindowInfo s = (SingletonWindowInfo) obj; |
|
195 |
|
|
196 |
if ((clase == s.clase) && (modelo == s.modelo)) { |
|
197 |
return true; |
|
198 |
} else { |
|
199 |
return false; |
|
200 |
} |
|
201 |
} |
|
202 |
} |
|
203 |
|
|
204 |
private Component getFrame(SingletonWindowInfo svi){ |
|
205 |
WindowInfo vi = (WindowInfo) contentWindowInfo.get(svi); |
|
206 |
return (DockWindow) contentFrame.get(svi); |
|
207 |
} |
|
208 |
|
|
209 |
public Component getFrame(Class viewClass, Object model){ |
|
210 |
SingletonWindowInfo svi = new SingletonWindowInfo(viewClass, model); |
|
211 |
return getFrame(svi); |
|
212 |
} |
|
213 |
|
|
214 |
/** |
|
215 |
* @param model |
|
216 |
* @return |
|
217 |
*/ |
|
218 |
public Component[] getFrames(Object model) { |
|
219 |
ArrayList ret = new ArrayList(); |
|
220 |
|
|
221 |
ArrayList keys = contentFrame.getKeys(); |
|
222 |
for (int i = 0; i < keys.size(); i++) { |
|
223 |
SingletonWindowInfo svi = (SingletonWindowInfo) keys.get(i); |
|
224 |
|
|
225 |
if (svi.modelo == model){ |
|
226 |
ret.add(contentFrame.get(svi)); |
|
227 |
} |
|
228 |
} |
|
229 |
|
|
230 |
return (DockWindow[]) ret.toArray(new DockWindow[0]); |
|
231 |
} |
|
232 |
|
|
233 |
/** |
|
234 |
* @param view |
|
235 |
* @return |
|
236 |
*/ |
|
237 |
public Component getFrame(SingletonWindow sv) { |
|
238 |
SingletonWindowInfo svi = new SingletonWindowInfo(sv.getClass(), sv.getWindowModel()); |
|
239 |
return getFrame(svi); |
|
240 |
} |
|
241 |
|
|
242 |
/** |
|
243 |
* @param sv |
|
244 |
* @param i |
|
245 |
*/ |
|
246 |
public void setX(SingletonWindow sv, int x) { |
|
247 |
DockWindow o = (DockWindow) contentFrame.get(new SingletonWindowInfo(sv.getClass(), sv.getWindowModel())); |
|
248 |
|
|
249 |
if (o == null) return; |
|
250 |
o.setLocation(x, o.getY()); |
|
251 |
} |
|
252 |
|
|
253 |
/** |
|
254 |
* @param sv |
|
255 |
* @param i |
|
256 |
*/ |
|
257 |
public void setY(SingletonWindow sv, int y) { |
|
258 |
DockWindow o = (DockWindow) contentFrame.get(new SingletonWindowInfo(sv.getClass(), sv.getWindowModel())); |
|
259 |
|
|
260 |
if (o == null) return; |
|
261 |
|
|
262 |
o.setLocation(o.getX(), y); |
|
263 |
} |
|
264 |
|
|
265 |
/** |
|
266 |
* @param sv |
|
267 |
* @param i |
|
268 |
*/ |
|
269 |
public void setHeight(SingletonWindow sv, int height) { |
|
270 |
DockWindow o = (DockWindow) contentFrame.get(new SingletonWindowInfo(sv.getClass(), sv.getWindowModel())); |
|
271 |
|
|
272 |
if (o == null) return; |
|
273 |
|
|
274 |
o.setSize(o.getWidth(), height); |
|
275 |
} |
|
276 |
|
|
277 |
/** |
|
278 |
* @param sv |
|
279 |
* @param i |
|
280 |
*/ |
|
281 |
public void setWidth(SingletonWindow sv, int width) { |
|
282 |
DockWindow o = (DockWindow) contentFrame.get(new SingletonWindowInfo(sv.getClass(), sv.getWindowModel())); |
|
283 |
|
|
284 |
if (o == null) return; |
|
285 |
o.setSize(width, o.getHeight()); |
|
286 |
} |
|
287 |
|
|
288 |
/** |
|
289 |
* @param sw |
|
290 |
* @param maximized |
|
291 |
*/ |
|
292 |
public void setMaximized(SingletonWindow sw, boolean maximized) { |
|
293 |
DockWindow frame = (DockWindow) contentFrame.get(new SingletonWindowInfo(sw.getClass(), sw.getWindowModel())); |
|
294 |
|
|
295 |
if (frame == null) return; |
|
296 |
frame.getWindowProperties().setMaximizeEnabled(maximized); |
|
297 |
} |
|
298 |
|
|
299 |
/** |
|
300 |
* @param sw |
|
301 |
* @param maximized |
|
302 |
*/ |
|
303 |
public void setNormalBounds(SingletonWindow sw, Rectangle normalBounds) { |
|
304 |
DockWindow frame = (DockWindow) contentFrame.get(new SingletonWindowInfo(sw.getClass(), sw.getWindowModel())); |
|
305 |
|
|
306 |
if (frame == null) return; |
|
307 |
// frame.setNormalBounds(normalBounds); |
|
308 |
} |
Also available in: Unified diff