svn-gvsig-desktop / tags / v1_0_RELEASE / applications / appgvSIG / src / com / iver / cit / gvsig / FFrameGroupExtension.java @ 9167
History | View | Annotate | Download (3.82 KB)
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 com.iver.cit.gvsig; |
42 |
|
43 |
import com.iver.andami.PluginServices; |
44 |
import com.iver.andami.plugins.Extension; |
45 |
import com.iver.andami.ui.mdiManager.IWindow; |
46 |
import com.iver.cit.gvsig.gui.layout.Layout; |
47 |
import com.iver.cit.gvsig.gui.layout.fframes.FFrameTable; |
48 |
import com.iver.cit.gvsig.project.documents.layout.fframes.IFFrame; |
49 |
import com.iver.cit.gvsig.project.documents.layout.fframes.IFFrameGroupSelectable; |
50 |
|
51 |
|
52 |
|
53 |
/**
|
54 |
* Extensi?n preparada para controlar las opciones que se pueden realizar sobre
|
55 |
* una tabla a?adida en el Layout.
|
56 |
*
|
57 |
* @author Vicente Caballero Navarro
|
58 |
*/
|
59 |
public class FFrameGroupExtension extends Extension { |
60 |
private Layout layout = null; |
61 |
|
62 |
/**
|
63 |
* @see com.iver.andami.plugins.IExtension#initialize()
|
64 |
*/
|
65 |
public void initialize() { |
66 |
} |
67 |
|
68 |
/**
|
69 |
* @see com.iver.andami.plugins.IExtension#execute(java.lang.String)
|
70 |
*/
|
71 |
public void execute(String s) { |
72 |
layout = (Layout) PluginServices.getMDIManager().getActiveWindow(); |
73 |
IFFrame[] fframes = layout.getFFrameSelected();
|
74 |
|
75 |
if (s.equals("NOEDITGROUP")) { |
76 |
for (int i = 0; i < fframes.length; i++) { |
77 |
if (fframes[i] instanceof IFFrameGroupSelectable) { |
78 |
IFFrameGroupSelectable fframeTable=(IFFrameGroupSelectable)fframes[i]; |
79 |
fframeTable.selectFFrame(false);
|
80 |
} |
81 |
} |
82 |
layout.setEditGroup(false);
|
83 |
} else if (s.equals("JOIN")) { |
84 |
for (int i = 0; i < fframes.length; i++) { |
85 |
if (fframes[i] instanceof IFFrameGroupSelectable) { |
86 |
IFFrameGroupSelectable fframeTable=(IFFrameGroupSelectable)fframes[i].cloneFFrame(layout); |
87 |
IFFrame newFFrame=fframeTable.joinFFrame(); |
88 |
if (newFFrame !=null){ |
89 |
layout.getEFS().modifyFFrame((IFFrame)fframes[i],(IFFrame)fframeTable); |
90 |
layout.updateFFrames(); |
91 |
layout.refresh(); |
92 |
} |
93 |
|
94 |
} |
95 |
} |
96 |
} else if (s.equals("EDITGROUP")) { |
97 |
for (int i = 0; i < fframes.length; i++) { |
98 |
if (fframes[i] instanceof IFFrameGroupSelectable) { |
99 |
IFFrameGroupSelectable fframeTable=(IFFrameGroupSelectable)fframes[i]; |
100 |
fframeTable.selectFFrame(true);
|
101 |
} |
102 |
} |
103 |
layout.setEditGroup(true);
|
104 |
} |
105 |
} |
106 |
|
107 |
/**
|
108 |
* @see com.iver.andami.plugins.IExtension#isEnabled()
|
109 |
*/
|
110 |
public boolean isEnabled() { |
111 |
layout = (Layout) PluginServices.getMDIManager().getActiveWindow(); |
112 |
if (!layout.isEditable())
|
113 |
return false; |
114 |
return true; |
115 |
} |
116 |
|
117 |
/**
|
118 |
* @see com.iver.andami.plugins.IExtension#isVisible()
|
119 |
*/
|
120 |
public boolean isVisible() { |
121 |
IWindow view = PluginServices.getMDIManager().getActiveWindow(); |
122 |
if (view instanceof Layout) { |
123 |
Layout l = (Layout) view; |
124 |
IFFrame[] fframes = l.getFFrameSelected();
|
125 |
|
126 |
for (int i = 0; i < fframes.length; i++) { |
127 |
if (fframes[i] instanceof FFrameTable) { |
128 |
return true; |
129 |
} |
130 |
} |
131 |
} |
132 |
return false; |
133 |
} |
134 |
} |