svn-gvsig-desktop / tags / v1_1_Build_1002 / applications / appgvSIG / src / com / iver / cit / gvsig / LayoutEditableControls.java @ 12070
History | View | Annotate | Download (4.82 KB)
1 |
/*
|
---|---|
2 |
* Created on 05-may-2004
|
3 |
*
|
4 |
* To change the template for this generated file go to
|
5 |
* Window>Preferences>Java>Code Generation>Code and Comments
|
6 |
*/
|
7 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
8 |
*
|
9 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
10 |
*
|
11 |
* This program is free software; you can redistribute it and/or
|
12 |
* modify it under the terms of the GNU General Public License
|
13 |
* as published by the Free Software Foundation; either version 2
|
14 |
* of the License, or (at your option) any later version.
|
15 |
*
|
16 |
* This program is distributed in the hope that it will be useful,
|
17 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
18 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
19 |
* GNU General Public License for more details.
|
20 |
*
|
21 |
* You should have received a copy of the GNU General Public License
|
22 |
* along with this program; if not, write to the Free Software
|
23 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
24 |
*
|
25 |
* For more information, contact:
|
26 |
*
|
27 |
* Generalitat Valenciana
|
28 |
* Conselleria d'Infraestructures i Transport
|
29 |
* Av. Blasco Ib??ez, 50
|
30 |
* 46010 VALENCIA
|
31 |
* SPAIN
|
32 |
*
|
33 |
* +34 963862235
|
34 |
* gvsig@gva.es
|
35 |
* www.gvsig.gva.es
|
36 |
*
|
37 |
* or
|
38 |
*
|
39 |
* IVER T.I. S.A
|
40 |
* Salamanca 50
|
41 |
* 46005 Valencia
|
42 |
* Spain
|
43 |
*
|
44 |
* +34 963163400
|
45 |
* dac@iver.es
|
46 |
*/
|
47 |
package com.iver.cit.gvsig; |
48 |
|
49 |
import java.awt.event.KeyEvent; |
50 |
|
51 |
import javax.swing.KeyStroke; |
52 |
|
53 |
import com.iver.andami.PluginServices; |
54 |
import com.iver.andami.plugins.Extension; |
55 |
import com.iver.andami.ui.mdiManager.IWindow; |
56 |
import com.iver.cit.gvsig.gui.layout.Layout; |
57 |
import com.iver.cit.gvsig.project.documents.layout.LayoutKeyEvent; |
58 |
|
59 |
|
60 |
/**
|
61 |
* Extensi?n para controlar las operaciones basicas de edici?n sobre el Layout.
|
62 |
*
|
63 |
* @author Vicente Caballero Navarro
|
64 |
*/
|
65 |
public class LayoutEditableControls extends Extension { |
66 |
private static LayoutKeyEvent lke=new LayoutKeyEvent(); |
67 |
private static KeyStroke copyLayout = KeyStroke.getKeyStroke(KeyEvent.VK_C, KeyEvent.CTRL_MASK); |
68 |
private static KeyStroke cutLayout = KeyStroke.getKeyStroke(KeyEvent.VK_X, KeyEvent.CTRL_MASK); |
69 |
private static KeyStroke pasteLayout = KeyStroke.getKeyStroke(KeyEvent.VK_V, KeyEvent.CTRL_MASK); |
70 |
private static KeyStroke leftLayout = KeyStroke.getKeyStroke(KeyEvent.VK_LEFT,0); |
71 |
private static KeyStroke rightLayout = KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT,0); |
72 |
private static KeyStroke upLayout = KeyStroke.getKeyStroke(KeyEvent.VK_UP,0); |
73 |
private static KeyStroke downLayout = KeyStroke.getKeyStroke(KeyEvent.VK_DOWN,0); |
74 |
private static KeyStroke undoLayout = KeyStroke.getKeyStroke(KeyEvent.VK_Z, KeyEvent.CTRL_MASK); |
75 |
private static KeyStroke redoLayout = KeyStroke.getKeyStroke(KeyEvent.VK_Y, KeyEvent.CTRL_MASK); |
76 |
private static KeyStroke del1Layout = KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0); |
77 |
private static KeyStroke del2Layout = KeyStroke.getKeyStroke(KeyEvent.VK_BACK_SPACE, 0); |
78 |
/**
|
79 |
* @see com.iver.andami.plugins.IExtension#execute(java.lang.String)
|
80 |
*/
|
81 |
public void execute(String s) { |
82 |
Layout layout = (Layout) PluginServices.getMDIManager().getActiveWindow(); |
83 |
if (s.equals("PROPERTIES")) { |
84 |
layout.showFProperties(); |
85 |
} |
86 |
} |
87 |
/**
|
88 |
* @see com.iver.mdiApp.plugins.IExtension#isVisible()
|
89 |
*/
|
90 |
public boolean isVisible() { |
91 |
IWindow f = PluginServices.getMDIManager().getActiveWindow(); |
92 |
|
93 |
if (f == null) { |
94 |
return false; |
95 |
} |
96 |
|
97 |
if (f instanceof Layout) { |
98 |
return true; |
99 |
} |
100 |
return false; |
101 |
} |
102 |
|
103 |
/**
|
104 |
* @see com.iver.andami.plugins.IExtension#initialize()
|
105 |
*/
|
106 |
public void initialize() { |
107 |
registerKeys(); |
108 |
} |
109 |
private static void registerKeys() { |
110 |
PluginServices.registerKeyStroke(copyLayout, lke); |
111 |
PluginServices.registerKeyStroke(cutLayout, lke); |
112 |
PluginServices.registerKeyStroke(pasteLayout, lke); |
113 |
PluginServices.registerKeyStroke(leftLayout, lke); |
114 |
PluginServices.registerKeyStroke(rightLayout, lke); |
115 |
PluginServices.registerKeyStroke(upLayout, lke); |
116 |
PluginServices.registerKeyStroke(downLayout, lke); |
117 |
PluginServices.registerKeyStroke(undoLayout, lke); |
118 |
PluginServices.registerKeyStroke(redoLayout, lke); |
119 |
PluginServices.registerKeyStroke(del1Layout, lke); |
120 |
PluginServices.registerKeyStroke(del2Layout, lke); |
121 |
} |
122 |
private static void unregisterKeys() { |
123 |
PluginServices.unRegisterKeyStroke(copyLayout); |
124 |
PluginServices.unRegisterKeyStroke(cutLayout); |
125 |
PluginServices.unRegisterKeyStroke(pasteLayout); |
126 |
PluginServices.unRegisterKeyStroke(leftLayout); |
127 |
PluginServices.unRegisterKeyStroke(rightLayout); |
128 |
PluginServices.unRegisterKeyStroke(upLayout); |
129 |
PluginServices.unRegisterKeyStroke(downLayout); |
130 |
PluginServices.unRegisterKeyStroke(undoLayout); |
131 |
PluginServices.unRegisterKeyStroke(redoLayout); |
132 |
PluginServices.unRegisterKeyStroke(del1Layout); |
133 |
PluginServices.unRegisterKeyStroke(del2Layout); |
134 |
} |
135 |
/**
|
136 |
* @see com.iver.andami.plugins.IExtension#isEnabled()
|
137 |
*/
|
138 |
public boolean isEnabled() { |
139 |
return true; |
140 |
} |
141 |
} |