Revision 4774
trunk/applications/appgvSIG/src/com/iver/cit/gvsig/LayoutEditableToolsExtension.java | ||
---|---|---|
44 | 44 |
import com.iver.andami.plugins.Extension; |
45 | 45 |
import com.iver.andami.ui.mdiManager.View; |
46 | 46 |
|
47 |
import com.iver.cit.gvsig.gui.layout.FLayoutFunctions; |
|
47 | 48 |
import com.iver.cit.gvsig.gui.layout.Layout; |
48 | 49 |
|
49 | 50 |
import org.apache.log4j.Logger; |
... | ... | |
74 | 75 |
layout = (Layout) PluginServices.getMDIManager().getActiveView(); |
75 | 76 |
|
76 | 77 |
logger.debug("Comand : " + s); |
77 |
|
|
78 |
boolean insertGroupPosibility=false; |
|
78 | 79 |
if (s.equals("SELECT")) { |
79 | 80 |
layout.setTool(Layout.SELECT); |
80 | 81 |
} else if (s.equals("RECTANGLEVIEW")) { |
81 | 82 |
layout.setTool(Layout.RECTANGLEVIEW); |
83 |
insertGroupPosibility=true; |
|
82 | 84 |
} else if (s.equals("RECTANGLEPICTURE")) { |
83 | 85 |
layout.setTool(Layout.RECTANGLEPICTURE); |
86 |
insertGroupPosibility=true; |
|
84 | 87 |
} else if (s.equals("RECTANGLESCALEBAR")) { |
85 | 88 |
layout.setTool(Layout.RECTANGLESCALEBAR); |
89 |
insertGroupPosibility=true; |
|
86 | 90 |
} else if (s.equals("RECTANGLELEGEND")) { |
87 | 91 |
layout.setTool(Layout.RECTANGLELEGEND); |
92 |
insertGroupPosibility=true; |
|
88 | 93 |
} else if (s.equals("RECTANGLETEXT")) { |
89 | 94 |
layout.setTool(Layout.RECTANGLETEXT); |
95 |
insertGroupPosibility=true; |
|
90 | 96 |
} else if (s.equals("RECTANGLENORTH")) { |
91 | 97 |
layout.setTool(Layout.RECTANGLENORTH); |
98 |
insertGroupPosibility=true; |
|
92 | 99 |
} else if (s.equals("RECTANGLEBOX")) { |
93 | 100 |
layout.setTool(Layout.RECTANGLEBOX); |
101 |
insertGroupPosibility=true; |
|
94 | 102 |
} else if (s.equals("POINT")) { |
95 | 103 |
layout.setTool(Layout.POINT); |
96 | 104 |
} else if (s.equals("LINE")) { |
... | ... | |
109 | 117 |
}else if (s.compareTo("VERTEX")==0){ |
110 | 118 |
layout.setTool(Layout.EDIT); |
111 | 119 |
} |
120 |
if (layout.isEditGroup() && insertGroupPosibility){ |
|
121 |
FLayoutFunctions funtions=new FLayoutFunctions(layout); |
|
122 |
funtions.addFFrame(); |
|
123 |
} |
|
112 | 124 |
} |
113 | 125 |
|
114 | 126 |
/** |
trunk/applications/appgvSIG/src/com/iver/cit/gvsig/gui/layout/FLayoutDraw.java | ||
---|---|---|
112 | 112 |
layout.getAT().concatenate(escalado); |
113 | 113 |
layout.getAtributes().setDistanceUnitX(layout.getRect()); |
114 | 114 |
layout.getAtributes().setDistanceUnitY(layout.getRect()); |
115 |
for (int i = 0; i < layout.getFFrames().length; i++) { |
|
116 |
IFFrame f = (IFFrame) layout.getFFrame(i); |
|
115 |
IFFrame[] fframes=layout.getFFrames(); |
|
116 |
for (int i = 0; i < fframes.length; i++) { |
|
117 |
IFFrame f = fframes[i]; |
|
117 | 118 |
f.draw(g2, layout.getAT(), layout.getVisibleRect(), |
118 | 119 |
imgBase); |
119 | 120 |
// Dibuja el s?mbolo de que contiene un tag. |
... | ... | |
122 | 123 |
} |
123 | 124 |
} |
124 | 125 |
|
125 |
if (!(layout.getFFrames().length==0)) {
|
|
126 |
if (!(fframes.length==0)) {
|
|
126 | 127 |
layout.setStatus(Layout.ACTUALIZADO); |
127 | 128 |
} else { |
128 | 129 |
layout.setStatus(Layout.DESACTUALIZADO); |
... | ... | |
449 | 450 |
*/ |
450 | 451 |
public void drawHandlers(Graphics2D g, Color color) { |
451 | 452 |
g.setColor(color); |
453 |
IFFrame[] fframes=layout.getFFrames(); |
|
454 |
for (int i = 0; i < fframes.length; i++) { |
|
455 |
IFFrame fframe = fframes[i]; |
|
452 | 456 |
|
453 |
for (int i = 0; i < layout.getFFrames().length; i++) { |
|
454 |
IFFrame fframe = (IFFrame) layout.getFFrame(i); |
|
455 |
|
|
456 | 457 |
if (fframe.getSelected() != IFFrame.NOSELECT) { |
457 | 458 |
fframe.drawHandlers((Graphics2D) g); |
458 | 459 |
} |
trunk/applications/appgvSIG/src/com/iver/cit/gvsig/gui/layout/EventsHandler.java | ||
---|---|---|
62 | 62 |
import com.iver.andami.PluginServices; |
63 | 63 |
import com.iver.cit.gvsig.gui.layout.fframes.IFFrame; |
64 | 64 |
import com.iver.cit.gvsig.gui.layout.fframes.IFFrameEditable; |
65 |
import com.iver.cit.gvsig.gui.layout.fframes.IFFrameGroupSelectable; |
|
65 | 66 |
|
66 | 67 |
|
67 | 68 |
/** |
... | ... | |
130 | 131 |
if (e.getButton() != MouseEvent.BUTTON3) { |
131 | 132 |
layout.setLastPoint(e.getPoint()); |
132 | 133 |
layout.repaint(); |
133 |
}
|
|
134 |
} |
|
134 | 135 |
if (layout.getTool() == Layout.EDIT){ |
135 |
for (int i=0;i<layout.getFFrames().length;i++){ |
|
136 |
IFFrame frame=(IFFrame)layout.getFFrame(i); |
|
136 |
IFFrame[] fframes=layout.getFFrames(); |
|
137 |
for (int i=0;i<fframes.length;i++){ |
|
138 |
IFFrame frame=fframes[i]; |
|
137 | 139 |
if (frame instanceof IFFrameEditable){ |
138 | 140 |
((IFFrameEditable)frame).pointDragged(FLayoutUtilities.toSheetPoint(e.getPoint(),layout.getAT())); |
139 | 141 |
layout.setStatus(Layout.GRAPHICS); |
140 |
|
|
142 |
|
|
141 | 143 |
} |
142 | 144 |
} |
143 |
|
|
145 |
|
|
144 | 146 |
} |
145 | 147 |
} |
146 | 148 |
|
... | ... | |
190 | 192 |
if (E.getButton() == MouseEvent.BUTTON1) { |
191 | 193 |
if (layout.getTool() == Layout.SELECT) { |
192 | 194 |
m_pointSelected = new Point2D.Double(E.getX(), E.getY()); |
193 |
|
|
194 |
if (layout.getFFrames().length > 0) {
|
|
195 |
IFFrame[] fframes=layout.getFFrames(); |
|
196 |
if (fframes.length > 0) {
|
|
195 | 197 |
ArrayList listSelect = new ArrayList(); |
196 |
|
|
197 |
for (int j = 0; j < layout.getFFrames().length; j++) { |
|
198 |
if (((IFFrame) layout.getFFrame(j)).getContains( |
|
198 |
for (int j = 0; j < fframes.length; j++) { |
|
199 |
if (fframes[j].getContains( |
|
199 | 200 |
m_pointSelected) != IFFrame.NOSELECT) { |
200 |
listSelect.add((IFFrame) layout.getFFrame(j));
|
|
201 |
listSelect.add(fframes[j]);
|
|
201 | 202 |
} |
202 | 203 |
} |
203 | 204 |
|
... | ... | |
215 | 216 |
(index > (listSelect.size() - 1))) { |
216 | 217 |
index = 0; |
217 | 218 |
} |
218 |
|
|
219 |
for (int j = 0; j < layout.getFFrames().length; |
|
219 |
for (int j = 0; j < fframes.length; |
|
220 | 220 |
j++) { |
221 |
IFFrame fframe = (IFFrame) layout.getFFrame(j);
|
|
221 |
IFFrame fframe = fframes[j];
|
|
222 | 222 |
|
223 | 223 |
if (!E.isShiftDown()) { |
224 | 224 |
fframe.setSelected(false); |
... | ... | |
263 | 263 |
public void mouseEntered(MouseEvent arg0) { |
264 | 264 |
/* TODO PluginServices.getMainFrame().getStatusBar().setMessage("0", |
265 | 265 |
layout.getAtributes().getNameUnit()); |
266 |
|
|
266 |
|
|
267 | 267 |
if (layout.getTool() == Layout.PAN) { |
268 | 268 |
layout.setMapCursor(Layout.iLayoutpan); |
269 | 269 |
} else if (layout.getTool() == Layout.ZOOM_MAS) { |
... | ... | |
343 | 343 |
layout.setCancelDrawing(true); |
344 | 344 |
} else if (layout.getTool() == Layout.SELECT) { |
345 | 345 |
m_pointSelected = new Point2D.Double(E.getX(), E.getY()); |
346 |
IFFrame[] fframes=layout.getFFrames(); |
|
347 |
for (int i = 0; i < fframes.length; i++) { |
|
348 |
IFFrame fframe = fframes[i]; |
|
346 | 349 |
|
347 |
for (int i = 0; i < layout.getFFrames().length; i++) { |
|
348 |
IFFrame fframe = ((IFFrame) layout.getFFrame(i)); |
|
349 |
|
|
350 | 350 |
if (m_pointSelected != null) { |
351 | 351 |
if (!E.isShiftDown()) { |
352 | 352 |
if ((fframe.getSelected() != IFFrame.NOSELECT)) { |
353 |
fframe.setSelected(m_pointSelected); |
|
353 |
fframe.setSelected(m_pointSelected,E);
|
|
354 | 354 |
} |
355 |
}else if (fframe instanceof IFFrameGroupSelectable){ |
|
356 |
fframe.setSelected(m_pointSelected,E); |
|
355 | 357 |
} |
356 | 358 |
} |
357 | 359 |
|
... | ... | |
371 | 373 |
} |
372 | 374 |
} else if (layout.getTool() == Layout.SET_TAG) { |
373 | 375 |
m_pointSelected = new Point2D.Double(E.getX(), E.getY()); |
376 |
IFFrame[] fframes=layout.getFFrames(); |
|
377 |
for (int i = 0; i < fframes.length; i++) { |
|
378 |
IFFrame fframe = fframes[i]; |
|
374 | 379 |
|
375 |
for (int i = 0; i < layout.getFFrames().length; i++) { |
|
376 |
IFFrame fframe = ((IFFrame) layout.getFFrame(i)); |
|
377 |
|
|
378 | 380 |
if (m_pointSelected != null) { |
379 | 381 |
if (fframe.contains(m_pointSelected)) { |
380 | 382 |
fframe.openTag(); |
... | ... | |
382 | 384 |
} |
383 | 385 |
} |
384 | 386 |
} else if (layout.getTool() == Layout.EDIT){ |
385 |
for (int i=0;i<layout.getFFrames().length;i++){ |
|
386 |
IFFrame frame=(IFFrame)layout.getFFrame(i); |
|
387 |
IFFrame[] fframes=layout.getFFrames(); |
|
388 |
for (int i=0;i<fframes.length;i++){ |
|
389 |
IFFrame frame=fframes[i]; |
|
387 | 390 |
if (frame instanceof IFFrameEditable){ |
388 | 391 |
((IFFrameEditable)frame).pointPressed(FLayoutUtilities.toSheetPoint(E.getPoint(),layout.getAT())); |
389 | 392 |
} |
... | ... | |
423 | 426 |
(layout.getTool() == Layout.RECTANGLETEXT) || |
424 | 427 |
(layout.getTool() == Layout.RECTANGLENORTH)|| |
425 | 428 |
(layout.getTool() == Layout.RECTANGLEBOX)) { |
426 |
events.setFFrame();
|
|
429 |
events.addFFrame();
|
|
427 | 430 |
PluginServices.getMainFrame().enableControls(); |
428 | 431 |
layout.refresh(); |
429 | 432 |
} else if (layout.getTool() == Layout.VIEW_ZOOMIN) { |
... | ... | |
440 | 443 |
layout.setStatus(Layout.GRAPHICS); |
441 | 444 |
layout.repaint(); |
442 | 445 |
} else if (layout.getTool() == Layout.EDIT){ |
443 |
for (int i=0;i<layout.getFFrames().length;i++){ |
|
444 |
IFFrame frame=(IFFrame)layout.getFFrame(i); |
|
446 |
IFFrame[] fframes=layout.getFFrames(); |
|
447 |
for (int i=0;i<fframes.length;i++){ |
|
448 |
IFFrame frame=fframes[i]; |
|
445 | 449 |
if (frame instanceof IFFrameEditable){ |
446 | 450 |
if (frame.getSelected()!=IFFrame.NOSELECT && ((IFFrameEditable)frame).isEditing()){ |
447 | 451 |
/*IFFrame fframeAux=frame.cloneFFrame(layout); |
... | ... | |
467 | 471 |
} else if (E.getButton() == MouseEvent.BUTTON3) { |
468 | 472 |
} |
469 | 473 |
|
470 |
|
|
474 |
|
|
471 | 475 |
} |
472 | 476 |
private void delLastPoint(){ |
473 | 477 |
layout.getGeometryAdapter().delLastPoint(); |
... | ... | |
484 | 488 |
(layout.getTool() == Layout.POINT)) { |
485 | 489 |
layout.getGeometryAdapter().end(); |
486 | 490 |
PluginServices.getMainFrame().enableControls(); |
487 |
events.setFFrame();
|
|
491 |
events.addFFrame();
|
|
488 | 492 |
layout.initGeometryAdapter(); |
489 | 493 |
layout.refresh(); |
490 | 494 |
} |
... | ... | |
509 | 513 |
layout.delFFrameSelected(); |
510 | 514 |
layout.refresh(); |
511 | 515 |
break; |
512 |
|
|
516 |
|
|
513 | 517 |
} |
514 | 518 |
}else{ |
515 | 519 |
switch (arg0.getKeyCode()) { |
... | ... | |
573 | 577 |
case KeyEvent.VK_RIGHT: |
574 | 578 |
case KeyEvent.VK_UP: |
575 | 579 |
case KeyEvent.VK_DOWN: |
576 |
|
|
580 |
|
|
577 | 581 |
layout.getEFS().startComplexCommand(); |
578 | 582 |
for (int i=0;i<fframes.length;i++){ |
579 | 583 |
IFFrame fframeAux=fframes[i].cloneFFrame(layout); |
... | ... | |
589 | 593 |
} |
590 | 594 |
difX=0; |
591 | 595 |
difY=0; |
592 |
|
|
596 |
|
|
593 | 597 |
} |
594 | 598 |
|
595 | 599 |
public void keyTyped(KeyEvent arg0) { |
596 | 600 |
// TODO Auto-generated method stub |
597 |
|
|
601 |
|
|
598 | 602 |
} |
599 | 603 |
private Rectangle2D getRectMove(Rectangle2D r,int difX,int difY) { |
600 | 604 |
Rectangle2D rectMove=new Rectangle2D.Double(); |
trunk/applications/appgvSIG/src/com/iver/cit/gvsig/gui/layout/FLayoutGraphics.java | ||
---|---|---|
49 | 49 |
import com.iver.cit.gvsig.gui.layout.dialogs.FAlignDialog; |
50 | 50 |
import com.iver.cit.gvsig.gui.layout.dialogs.FBorderDialog; |
51 | 51 |
import com.iver.cit.gvsig.gui.layout.dialogs.FPositionDialog; |
52 |
import com.iver.cit.gvsig.gui.layout.fframes.FFrameBox;
|
|
52 |
import com.iver.cit.gvsig.gui.layout.fframes.FFrameTable;
|
|
53 | 53 |
import com.iver.cit.gvsig.gui.layout.fframes.FFrameGraphics; |
54 | 54 |
import com.iver.cit.gvsig.gui.layout.fframes.FFrameGroup; |
55 | 55 |
import com.iver.cit.gvsig.gui.layout.fframes.FFrameLegend; |
... | ... | |
285 | 285 |
return Layout.RECTANGLESCALEBAR; |
286 | 286 |
} else if (fframe instanceof FFrameNorth) { |
287 | 287 |
return Layout.RECTANGLENORTH; |
288 |
} else if (fframe instanceof FFrameBox) {
|
|
288 |
} else if (fframe instanceof FFrameTable) {
|
|
289 | 289 |
return Layout.RECTANGLEBOX; |
290 | 290 |
} else if (fframe instanceof FFramePicture) { |
291 | 291 |
return Layout.RECTANGLEPICTURE; |
trunk/applications/appgvSIG/src/com/iver/cit/gvsig/gui/layout/FLayoutZooms.java | ||
---|---|---|
90 | 90 |
} |
91 | 91 |
} |
92 | 92 |
*/ |
93 |
|
|
93 |
|
|
94 | 94 |
if (p1.getX()>p2.getX()){ |
95 | 95 |
int aux=p2.x; |
96 | 96 |
p2.x=p1.x; |
... | ... | |
161 | 161 |
((FFrameView)fframes[i]).getRectView(point1,point2); |
162 | 162 |
} |
163 | 163 |
} |
164 |
|
|
165 |
|
|
164 |
|
|
165 |
|
|
166 | 166 |
} else { |
167 | 167 |
double wv = FLayoutUtilities.toSheetDistance(layout.getVisibleRect() |
168 | 168 |
.getWidth(), |
... | ... | |
195 | 195 |
|
196 | 196 |
rScreen.setRect(FLayoutUtilities.fromSheetRect(rSheet, |
197 | 197 |
layout.getAT())); |
198 |
|
|
199 |
IFFrame[] fframes=layout.getFFrames(); |
|
198 |
|
|
199 |
/* IFFrame[] fframes=layout.getFFrames();
|
|
200 | 200 |
for (int i=0;i<fframes.length;i++){ |
201 | 201 |
if (fframes[i] instanceof FFrameView){ |
202 | 202 |
((FFrameView)fframes[i]).getRectView(p1,p2); |
203 | 203 |
} |
204 | 204 |
} |
205 |
*/ |
|
205 | 206 |
} |
206 | 207 |
|
207 | 208 |
if (FLayoutUtilities.isPosible(rScreen)) { |
208 | 209 |
layout.getRect().setRect(rScreen); |
209 | 210 |
} |
210 |
|
|
211 |
|
|
211 | 212 |
} |
212 | 213 |
|
213 | 214 |
/** |
trunk/applications/appgvSIG/src/com/iver/cit/gvsig/gui/layout/FLayoutFunctions.java | ||
---|---|---|
51 | 51 |
import java.awt.geom.Point2D; |
52 | 52 |
import java.awt.geom.Rectangle2D; |
53 | 53 |
|
54 |
import com.iver.cit.gvsig.gui.layout.fframes.FFrameBox;
|
|
54 |
import com.iver.cit.gvsig.gui.layout.fframes.FFrameTable;
|
|
55 | 55 |
import com.iver.cit.gvsig.gui.layout.fframes.FFrameGraphics; |
56 | 56 |
import com.iver.cit.gvsig.gui.layout.fframes.FFrameGroup; |
57 | 57 |
import com.iver.cit.gvsig.gui.layout.fframes.FFrameLegend; |
... | ... | |
88 | 88 |
public void setSelect() { |
89 | 89 |
IFFrame fframe = null; |
90 | 90 |
boolean isUpdate = false; |
91 |
IFFrame[] fframes=layout.getFFrames(); |
|
92 |
for (int i = 0; i < fframes.length; i++) { |
|
93 |
fframe = fframes[i]; |
|
91 | 94 |
|
92 |
for (int i = 0; i < layout.getFFrames().length; i++) { |
|
93 |
fframe = (IFFrame) layout.getFFrame(i); |
|
94 |
|
|
95 | 95 |
int difx = (layout.getLastPoint().x - layout.getFirstPoint().x); |
96 | 96 |
int dify = (layout.getLastPoint().y - layout.getFirstPoint().y); |
97 | 97 |
|
98 | 98 |
if (((Math.abs(difx) > 3) || (Math.abs(dify) > 3)) && |
99 | 99 |
(fframe.getSelected() != IFFrame.NOSELECT)) { |
100 |
Rectangle2D rectangle = fframe.getMovieRect(difx, dify); |
|
101 |
|
|
100 |
Rectangle2D rectangle = fframe.getLastMoveRect(); |
|
101 |
if (rectangle==null) |
|
102 |
return; |
|
102 | 103 |
if (layout.isCuadricula()) { |
103 | 104 |
//cuadrar con la cuadr?cula dibujada y despu?s en el mouseReleased guardar ese rect?ngulo de la misma forma. |
104 | 105 |
FLayoutUtilities.setRectGrid(rectangle, |
... | ... | |
144 | 145 |
/** |
145 | 146 |
* A?ade un fframe al Layout del tipo preseleccionado y abre el di?logo |
146 | 147 |
* para configurar las caracter?sticas. |
148 |
* @return TODO |
|
147 | 149 |
*/ |
148 |
public void setFFrame() {
|
|
150 |
public IFFrame addFFrame() {
|
|
149 | 151 |
IFFrame fframe = null; |
150 | 152 |
boolean isadd = false; |
151 | 153 |
|
... | ... | |
169 | 171 |
fframe = new FFrameNorth(); |
170 | 172 |
isadd = true; |
171 | 173 |
} else if (layout.getTool() == Layout.RECTANGLEBOX) { |
172 |
fframe = new FFrameBox();
|
|
174 |
fframe = new FFrameTable();
|
|
173 | 175 |
isadd = true; |
174 | 176 |
} else if ((layout.getTool() == Layout.LINE) || |
175 | 177 |
(layout.getTool() == Layout.POLYLINE) || |
... | ... | |
201 | 203 |
fframe.setBoundBox(FLayoutUtilities.toSheetRect(r, layout.getAT())); |
202 | 204 |
|
203 | 205 |
if (layout.openFFrameDialog(fframe)) { |
204 |
layout.addFFrame(fframe, true,true); |
|
206 |
if (!layout.isEditGroup()){ |
|
207 |
layout.addFFrame(fframe, true,true); |
|
208 |
} |
|
205 | 209 |
} |
206 | 210 |
}else{ |
207 | 211 |
if (layout.getTool() == Layout.POINT){ |
... | ... | |
215 | 219 |
layout.addFFrame(fframe, true,true); |
216 | 220 |
///fframe.setBoundBox(FLayoutUtilities.toSheetRect(r, layout.getAT())); |
217 | 221 |
} |
222 |
return fframe; |
|
218 | 223 |
} |
219 | 224 |
|
220 | 225 |
private Rectangle2D getRectangle(int tolerance,Point2D first,Point2D last) { |
... | ... | |
250 | 255 |
* @param p2 Punto final del desplazamiento. |
251 | 256 |
*/ |
252 | 257 |
public void setViewPan(Point p1, Point p2) { |
253 |
for (int i = 0; i < layout.getFFrames().length; i++) { |
|
254 |
if (layout.getFFrame(i) instanceof IFFrameUseFMap) { |
|
255 |
IFFrameUseFMap fframe = (IFFrameUseFMap) layout.getFFrame(i); |
|
258 |
IFFrame[] fframes=layout.getFFrames(); |
|
259 |
for (int i = 0; i < fframes.length; i++) { |
|
260 |
if (fframes[i] instanceof IFFrameUseFMap) { |
|
261 |
IFFrameUseFMap fframe = (IFFrameUseFMap) fframes[i]; |
|
256 | 262 |
|
257 | 263 |
if (((IFFrame)fframe).getSelected() != IFFrame.NOSELECT) { |
258 | 264 |
Rectangle2D.Double r = new Rectangle2D.Double(); |
trunk/applications/appgvSIG/src/com/iver/cit/gvsig/FFrameGroupExtension.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 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.View; |
|
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.gui.layout.fframes.IFFrame; |
|
49 |
import com.iver.cit.gvsig.gui.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 implements Extension { |
|
60 |
private Layout layout = null; |
|
61 |
|
|
62 |
/** |
|
63 |
* @see com.iver.andami.plugins.Extension#inicializar() |
|
64 |
*/ |
|
65 |
public void inicializar() { |
|
66 |
} |
|
67 |
|
|
68 |
/** |
|
69 |
* @see com.iver.andami.plugins.Extension#execute(java.lang.String) |
|
70 |
*/ |
|
71 |
public void execute(String s) { |
|
72 |
layout = (Layout) PluginServices.getMDIManager().getActiveView(); |
|
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.Extension#isEnabled() |
|
109 |
*/ |
|
110 |
public boolean isEnabled() { |
|
111 |
return true; |
|
112 |
} |
|
113 |
|
|
114 |
/** |
|
115 |
* @see com.iver.andami.plugins.Extension#isVisible() |
|
116 |
*/ |
|
117 |
public boolean isVisible() { |
|
118 |
View view = PluginServices.getMDIManager().getActiveView(); |
|
119 |
if (view instanceof Layout) { |
|
120 |
Layout l = (Layout) view; |
|
121 |
IFFrame[] fframes = l.getFFrameSelected(); |
|
122 |
|
|
123 |
for (int i = 0; i < fframes.length; i++) { |
|
124 |
if (fframes[i] instanceof FFrameTable) { |
|
125 |
return true; |
|
126 |
} |
|
127 |
} |
|
128 |
} |
|
129 |
return false; |
|
130 |
} |
|
131 |
} |
|
0 | 132 |
Also available in: Unified diff