1 |
1 |
/*
|
2 |
2 |
* Created on 20-feb-2004
|
3 |
3 |
*
|
4 |
|
* To change the template for this generated file go to
|
5 |
|
* Window>Preferences>Java>Code Generation>Code and Comments
|
6 |
4 |
*/
|
7 |
5 |
package com.iver.cit.gvsig.gui.layout;
|
8 |
6 |
|
|
7 |
import com.iver.andami.PluginServices;
|
|
8 |
import com.iver.andami.ui.mdiManager.SingletonView;
|
|
9 |
import com.iver.andami.ui.mdiManager.ViewInfo;
|
|
10 |
import com.iver.andami.ui.mdiManager.ViewListener;
|
|
11 |
|
|
12 |
import com.iver.cit.gvsig.Abrir;
|
|
13 |
import com.iver.cit.gvsig.fmap.ColorEvent;
|
|
14 |
import com.iver.cit.gvsig.fmap.DriverException;
|
|
15 |
import com.iver.cit.gvsig.fmap.ExtentEvent;
|
|
16 |
import com.iver.cit.gvsig.fmap.ViewPortListener;
|
|
17 |
import com.iver.cit.gvsig.gui.layout.dialogs.FConfigLayoutDialog;
|
|
18 |
import com.iver.cit.gvsig.gui.layout.fframes.FFrame;
|
|
19 |
import com.iver.cit.gvsig.gui.layout.fframes.FFrameGraphics;
|
|
20 |
import com.iver.cit.gvsig.gui.layout.fframes.FFrameLegend;
|
|
21 |
import com.iver.cit.gvsig.gui.layout.fframes.FFramePicture;
|
|
22 |
import com.iver.cit.gvsig.gui.layout.fframes.FFrameScaleBar;
|
|
23 |
import com.iver.cit.gvsig.gui.layout.fframes.FFrameText;
|
|
24 |
import com.iver.cit.gvsig.gui.layout.fframes.FFrameView;
|
|
25 |
import com.iver.cit.gvsig.gui.layout.fframes.IFFrame;
|
|
26 |
import com.iver.cit.gvsig.gui.layout.fframes.dialogs.FFrameGraphicsDialog;
|
|
27 |
import com.iver.cit.gvsig.gui.layout.fframes.dialogs.FFrameLegendDialog;
|
|
28 |
import com.iver.cit.gvsig.gui.layout.fframes.dialogs.FFramePictureDialog;
|
|
29 |
import com.iver.cit.gvsig.gui.layout.fframes.dialogs.FFrameScaleBarDialog;
|
|
30 |
import com.iver.cit.gvsig.gui.layout.fframes.dialogs.FFrameTextDialog;
|
|
31 |
import com.iver.cit.gvsig.gui.layout.fframes.dialogs.FFrameViewDialog;
|
|
32 |
import com.iver.cit.gvsig.gui.layout.fframes.dialogs.IFFrameDialog;
|
|
33 |
import com.iver.cit.gvsig.project.MapProperties;
|
|
34 |
import com.iver.cit.gvsig.project.castor.Project;
|
|
35 |
import com.iver.cit.gvsig.project.castor.ProjectMap;
|
|
36 |
|
|
37 |
import com.iver.utiles.XMLEntity;
|
|
38 |
|
|
39 |
import org.apache.log4j.Logger;
|
|
40 |
|
9 |
41 |
import java.awt.Color;
|
10 |
42 |
import java.awt.Cursor;
|
11 |
43 |
import java.awt.Graphics;
|
... | ... | |
23 |
55 |
import java.awt.print.Printable;
|
24 |
56 |
import java.awt.print.PrinterException;
|
25 |
57 |
import java.awt.print.PrinterJob;
|
|
58 |
|
26 |
59 |
import java.util.ArrayList;
|
27 |
60 |
import java.util.Hashtable;
|
28 |
61 |
|
... | ... | |
38 |
71 |
import javax.print.event.PrintJobAdapter;
|
39 |
72 |
import javax.print.event.PrintJobEvent;
|
40 |
73 |
import javax.print.event.PrintJobListener;
|
|
74 |
|
41 |
75 |
import javax.swing.AbstractAction;
|
42 |
76 |
import javax.swing.Action;
|
43 |
77 |
import javax.swing.ImageIcon;
|
44 |
78 |
import javax.swing.JPanel;
|
45 |
79 |
import javax.swing.KeyStroke;
|
46 |
80 |
|
47 |
|
import org.apache.log4j.Logger;
|
48 |
81 |
|
49 |
|
import com.iver.andami.PluginServices;
|
50 |
|
import com.iver.andami.ui.mdiManager.SingletonView;
|
51 |
|
import com.iver.andami.ui.mdiManager.ViewInfo;
|
52 |
|
import com.iver.andami.ui.mdiManager.ViewListener;
|
53 |
|
import com.iver.cit.gvsig.Abrir;
|
54 |
|
import com.iver.cit.gvsig.fmap.ColorEvent;
|
55 |
|
import com.iver.cit.gvsig.fmap.DriverException;
|
56 |
|
import com.iver.cit.gvsig.fmap.ExtentEvent;
|
57 |
|
import com.iver.cit.gvsig.fmap.ViewPortListener;
|
58 |
|
import com.iver.cit.gvsig.fmap.drivers.DriverIOException;
|
59 |
|
import com.iver.cit.gvsig.gui.layout.dialogs.FConfigLayoutDialog;
|
60 |
|
import com.iver.cit.gvsig.gui.layout.fframes.FFrame;
|
61 |
|
import com.iver.cit.gvsig.gui.layout.fframes.FFrameGraphics;
|
62 |
|
import com.iver.cit.gvsig.gui.layout.fframes.FFrameLegend;
|
63 |
|
import com.iver.cit.gvsig.gui.layout.fframes.FFramePicture;
|
64 |
|
import com.iver.cit.gvsig.gui.layout.fframes.FFrameScaleBar;
|
65 |
|
import com.iver.cit.gvsig.gui.layout.fframes.FFrameText;
|
66 |
|
import com.iver.cit.gvsig.gui.layout.fframes.FFrameView;
|
67 |
|
import com.iver.cit.gvsig.gui.layout.fframes.IFFrame;
|
68 |
|
import com.iver.cit.gvsig.gui.layout.fframes.dialogs.FFrameGraphicsDialog;
|
69 |
|
import com.iver.cit.gvsig.gui.layout.fframes.dialogs.FFrameLegendDialog;
|
70 |
|
import com.iver.cit.gvsig.gui.layout.fframes.dialogs.FFramePictureDialog;
|
71 |
|
import com.iver.cit.gvsig.gui.layout.fframes.dialogs.FFrameScaleBarDialog;
|
72 |
|
import com.iver.cit.gvsig.gui.layout.fframes.dialogs.FFrameTextDialog;
|
73 |
|
import com.iver.cit.gvsig.gui.layout.fframes.dialogs.FFrameViewDialog;
|
74 |
|
import com.iver.cit.gvsig.gui.layout.fframes.dialogs.IFFrameDialog;
|
75 |
|
import com.iver.cit.gvsig.project.MapProperties;
|
76 |
|
import com.iver.cit.gvsig.project.castor.Project;
|
77 |
|
import com.iver.cit.gvsig.project.castor.ProjectMap;
|
78 |
|
import com.iver.utiles.XMLEntity;
|
79 |
|
|
80 |
|
|
81 |
82 |
/**
|
82 |
83 |
* Mapa.
|
83 |
84 |
*
|
84 |
85 |
* @author Vicente Caballero Navarro
|
85 |
86 |
*/
|
86 |
|
public class Layout extends JPanel implements SingletonView,ViewPortListener,ViewListener {
|
87 |
|
private static Logger logger = Logger.getLogger(Layout.class.getName());
|
|
87 |
public class Layout extends JPanel implements SingletonView, ViewPortListener,
|
|
88 |
ViewListener {
|
|
89 |
private static Logger logger = Logger.getLogger(Layout.class.getName());
|
|
90 |
public static final int ZOOM_MAS = 1;
|
|
91 |
public static final int ZOOM_MENOS = 2;
|
|
92 |
public static final int PAN = 3;
|
|
93 |
public static final int DESACTUALIZADO = 4;
|
|
94 |
public static final int RECTANGLEVIEW = 5;
|
|
95 |
public static final int RECTANGLEPICTURE = 6;
|
|
96 |
public static final int RECTANGLESCALEBAR = 7;
|
|
97 |
public static final int RECTANGLELEGEND = 8;
|
|
98 |
public static final int RECTANGLETEXT = 9;
|
|
99 |
public static final int RECTANGLE = 10;
|
|
100 |
public static final int ACTUALIZADO = 11;
|
|
101 |
public static final int SELECT = 12;
|
|
102 |
public static final int POINT = 13;
|
|
103 |
public static final int LINE = 14;
|
|
104 |
public static final int POLYLINE = 15;
|
|
105 |
public static final int RECTANGLESIMPLE = 16;
|
|
106 |
public static final int CIRCLE = 17;
|
|
107 |
public static final int POLYGON = 18;
|
|
108 |
public static final int GRAPHICS = 19;
|
|
109 |
public static final int RECTANGLESYMBOL = 20;
|
|
110 |
public static final int RECTANGLEGROUP = 21;
|
|
111 |
public static final int VIEW_ZOOMIN = 22;
|
|
112 |
public static final int VIEW_ZOOMOUT = 23;
|
|
113 |
public static final int VIEW_FULL = 24;
|
|
114 |
public static final int VIEW_PAN = 25;
|
|
115 |
public static final int SET_TAG = 26;
|
|
116 |
public static final Image iLayoutpan = new ImageIcon(Abrir.class.getClassLoader()
|
|
117 |
.getResource("images/LayoutHand.gif")).getImage();
|
|
118 |
public static final Image ipan = new ImageIcon(Abrir.class.getClassLoader()
|
|
119 |
.getResource("images/Hand.gif")).getImage();
|
|
120 |
public static final Image iLayoutzoomin = new ImageIcon(Abrir.class.getClassLoader()
|
|
121 |
.getResource("images/LayoutZoomInCursor.gif")).getImage();
|
|
122 |
public static final Image izoomin = new ImageIcon(Abrir.class.getClassLoader()
|
|
123 |
.getResource("images/ZoomInCursor.gif")).getImage();
|
|
124 |
public static final Image iLayoutzoomout = new ImageIcon(Abrir.class.getClassLoader()
|
|
125 |
.getResource("images/LayoutZoomOutCursor.gif")).getImage();
|
|
126 |
public static final Image izoomout = new ImageIcon(Abrir.class.getClassLoader()
|
|
127 |
.getResource("images/ZoomOutCursor.gif")).getImage();
|
|
128 |
public static final Image iinfo = new ImageIcon(Abrir.class.getClassLoader()
|
|
129 |
.getResource("images/InfoCursor.gif")).getImage();
|
|
130 |
public static final Image icrux = new ImageIcon(Abrir.class.getClassLoader()
|
|
131 |
.getResource("images/CruxCursor.png")).getImage();
|
|
132 |
public static final Image itag = new ImageIcon(Abrir.class.getClassLoader()
|
|
133 |
.getResource("images/tagCursor.gif")).getImage();
|
|
134 |
public static final Image iPoint = new ImageIcon(Abrir.class.getClassLoader()
|
|
135 |
.getResource("images/PointCursor.png")).getImage();
|
|
136 |
public static final Image iRect = new ImageIcon(Abrir.class.getClassLoader()
|
|
137 |
.getResource("images/RectCursor.png")).getImage();
|
|
138 |
public static final Image iLine = new ImageIcon(Abrir.class.getClassLoader()
|
|
139 |
.getResource("images/LineCursor.png")).getImage();
|
|
140 |
public static final Image iRectangle = new ImageIcon(Abrir.class.getClassLoader()
|
|
141 |
.getResource("images/RectangleCursor.png")).getImage();
|
|
142 |
public static final Image iCircle = new ImageIcon(Abrir.class.getClassLoader()
|
|
143 |
.getResource("images/CircleCursor.png")).getImage();
|
|
144 |
public static final Image iPoligon = new ImageIcon(Abrir.class.getClassLoader()
|
|
145 |
.getResource("images/PoligonCursor.png")).getImage();
|
|
146 |
public static Hashtable nums = new Hashtable();
|
|
147 |
private Point origin = new Point(50, 50);
|
|
148 |
private Point rectOrigin = new Point(origin);
|
|
149 |
private Rectangle2D.Double rect = new Rectangle2D.Double(rectOrigin.x,
|
|
150 |
rectOrigin.y, 400, 300);
|
|
151 |
private Point m_FirstPoint = new Point(0, 0);
|
|
152 |
private Point m_PointAnt = new Point(0, 0);
|
|
153 |
private Point m_LastPoint = new Point(0, 0);
|
|
154 |
private EventsHandler events;
|
|
155 |
private int tool = ZOOM_MAS;
|
|
156 |
private int status = DESACTUALIZADO;
|
|
157 |
private BufferedImage img = null;
|
|
158 |
private AffineTransform m_MatrizTransf;
|
|
159 |
private Rectangle2D rectVisible;
|
|
160 |
private IFFrameDialog fframedialog = null;
|
|
161 |
private ArrayList m_fframes = new ArrayList();
|
|
162 |
private FConfigLayoutDialog m_configLayout = null;
|
|
163 |
private MapProperties m_propertiesLayout = null;
|
|
164 |
private Attributes m_attributes = null;
|
|
165 |
private PrintService[] m_cachePrintServices = null;
|
|
166 |
private PrintRequestAttributeSet m_cachePrintRequestAtributeSet = null;
|
|
167 |
private PrintService m_cachePrintService = null;
|
|
168 |
private boolean m_bCancelDrawing = false;
|
|
169 |
private boolean isCuadricula = false;
|
|
170 |
private boolean initial = true;
|
|
171 |
private ProjectMap map = null;
|
|
172 |
private Rectangle reSel = null;
|
|
173 |
private boolean isReSel = true;
|
88 |
174 |
|
89 |
|
/** DOCUMENT ME! */
|
90 |
|
public static final int ZOOM_MAS = 1;
|
|
175 |
// private String m_name = null;
|
|
176 |
private boolean m_showRuler = true;
|
|
177 |
private FLayoutDraw layoutPaint = null;
|
|
178 |
private boolean isDrawCuadricula = true;
|
|
179 |
private Doc doc = null;
|
|
180 |
private PrintRequestAttributeSet att = null;
|
91 |
181 |
|
92 |
|
/** DOCUMENT ME! */
|
93 |
|
public static final int ZOOM_MENOS = 2;
|
|
182 |
/**
|
|
183 |
* Creates a new Layout object.
|
|
184 |
*/
|
|
185 |
public Layout() {
|
|
186 |
this.setLayout(null);
|
|
187 |
events = new EventsHandler(this);
|
|
188 |
layoutPaint = new FLayoutDraw(this);
|
|
189 |
addComponentListener(events);
|
|
190 |
addMouseMotionListener(events);
|
|
191 |
addMouseListener(events);
|
|
192 |
m_MatrizTransf = new AffineTransform();
|
|
193 |
m_MatrizTransf.setToIdentity();
|
|
194 |
this.initComponents();
|
|
195 |
}
|
94 |
196 |
|
95 |
|
/** DOCUMENT ME! */
|
96 |
|
public static final int PAN = 3;
|
|
197 |
/**
|
|
198 |
* Rellena el ProjectMap del Layout.
|
|
199 |
*
|
|
200 |
* @param m ProjectMap.
|
|
201 |
*/
|
|
202 |
public void setProjectMap(ProjectMap m) {
|
|
203 |
map = m;
|
|
204 |
}
|
97 |
205 |
|
98 |
|
/** DOCUMENT ME! */
|
99 |
|
public static final int DESACTUALIZADO = 4;
|
|
206 |
/**
|
|
207 |
* Devuelve el rect?ngulo de selecci?n por rect?ngulo.
|
|
208 |
*
|
|
209 |
* @return Rect?ngulo de selecci?n.
|
|
210 |
*/
|
|
211 |
public Rectangle getReSel() {
|
|
212 |
return reSel;
|
|
213 |
}
|
100 |
214 |
|
101 |
|
/** DOCUMENT ME! */
|
102 |
|
public static final int RECTANGLEVIEW = 5;
|
|
215 |
/**
|
|
216 |
* Devuelve true si se debe dibujar el rect?ngulo de selecci?n y realizar
|
|
217 |
* la sellecci?n.
|
|
218 |
*
|
|
219 |
* @return true si se realiza la selecci?n por rect?ngulo.
|
|
220 |
*/
|
|
221 |
public boolean isReSel() {
|
|
222 |
return isReSel;
|
|
223 |
}
|
103 |
224 |
|
104 |
|
/** DOCUMENT ME! */
|
105 |
|
public static final int RECTANGLEPICTURE = 6;
|
|
225 |
/**
|
|
226 |
* Rellena con true si se debe de dibujar y seleccionar por rect?ngulo de
|
|
227 |
* selecci?n.
|
|
228 |
*
|
|
229 |
* @param b boolean.
|
|
230 |
*/
|
|
231 |
public void setIsReSel(boolean b) {
|
|
232 |
isReSel = b;
|
|
233 |
}
|
106 |
234 |
|
107 |
|
/** DOCUMENT ME! */
|
108 |
|
public static final int RECTANGLESCALEBAR = 7;
|
|
235 |
/**
|
|
236 |
* Devuelve true si el dibujado ha sido cancelado.
|
|
237 |
*
|
|
238 |
* @return true si el dibujado ha sido cancelado.
|
|
239 |
*/
|
|
240 |
public synchronized boolean isDrawingCancelled() {
|
|
241 |
return m_bCancelDrawing;
|
|
242 |
}
|
109 |
243 |
|
110 |
|
/** DOCUMENT ME! */
|
111 |
|
public static final int RECTANGLELEGEND = 8;
|
|
244 |
/**
|
|
245 |
* Pone el dibuja a cancelado o no seg?n se quiera.
|
|
246 |
*
|
|
247 |
* @param b true si se quiere cancelar el dibujado.
|
|
248 |
*/
|
|
249 |
public synchronized void setCancelDrawing(boolean b) {
|
|
250 |
m_bCancelDrawing = b;
|
112 |
251 |
|
113 |
|
/** DOCUMENT ME! */
|
114 |
|
public static final int RECTANGLETEXT = 9;
|
|
252 |
for (int i = 0; i < getFFrames().size(); i++) {
|
|
253 |
IFFrame fframe = (IFFrame) getFFrames().get(i);
|
115 |
254 |
|
116 |
|
/** DOCUMENT ME! */
|
117 |
|
public static final int RECTANGLE = 10;
|
|
255 |
if (fframe instanceof FFrameView &&
|
|
256 |
(((FFrameView) fframe).getFMap() != null)) {
|
|
257 |
////TODO((FFrameView) getFFrames().get(i)).getFMap().setCancelDrawing(b);
|
|
258 |
}
|
|
259 |
}
|
|
260 |
}
|
118 |
261 |
|
119 |
|
/** DOCUMENT ME! */
|
120 |
|
public static final int ACTUALIZADO = 11;
|
|
262 |
/**
|
|
263 |
* Obtiene el ArrayList con todos los FFrames que se han a?adido al Layout.
|
|
264 |
*
|
|
265 |
* @return Array con todos los fframes que contiene el Layout.
|
|
266 |
*/
|
|
267 |
public ArrayList getFFrames() {
|
|
268 |
return m_fframes;
|
|
269 |
}
|
121 |
270 |
|
122 |
|
/** DOCUMENT ME! */
|
123 |
|
public static final int SELECT = 12;
|
|
271 |
/**
|
|
272 |
* Obtiene el rect que se ajusta al tama?o de la ventana, para ver el folio
|
|
273 |
* entero.
|
|
274 |
*/
|
|
275 |
public void fullRect() {
|
|
276 |
rect.setRect(origin.x, origin.y, getWidth() - (origin.x * 2),
|
|
277 |
getHeight() - (origin.x * 2));
|
124 |
278 |
|
125 |
|
/** DOCUMENT ME! */
|
126 |
|
public static final int POINT = 13;
|
|
279 |
if (m_attributes.isLandSpace()) {
|
|
280 |
rect = m_attributes.getRectangleLandscape(rect, getWidth(),
|
|
281 |
getHeight());
|
|
282 |
} else {
|
|
283 |
rect = m_attributes.getRectanglePortrait(rect, getWidth(),
|
|
284 |
getHeight());
|
|
285 |
}
|
127 |
286 |
|
128 |
|
/** DOCUMENT ME! */
|
129 |
|
public static final int LINE = 14;
|
|
287 |
status = DESACTUALIZADO;
|
|
288 |
repaint();
|
|
289 |
}
|
130 |
290 |
|
131 |
|
/** DOCUMENT ME! */
|
132 |
|
public static final int POLYLINE = 15;
|
|
291 |
/**
|
|
292 |
* M?todo para imprimir el Layout sin modificar la matriz de
|
|
293 |
* transformaci?n.
|
|
294 |
*
|
|
295 |
* @param g2
|
|
296 |
*/
|
|
297 |
public void drawLayoutPrint(Graphics2D g2) {
|
|
298 |
setCancelDrawing(false);
|
133 |
299 |
|
134 |
|
/** DOCUMENT ME! */
|
135 |
|
public static final int RECTANGLESIMPLE = 16;
|
|
300 |
setCursor(Cursor.getDefaultCursor());
|
136 |
301 |
|
137 |
|
/** DOCUMENT ME! */
|
138 |
|
public static final int CIRCLE = 17;
|
|
302 |
double scale = 0;
|
139 |
303 |
|
140 |
|
/** DOCUMENT ME! */
|
141 |
|
public static final int POLYGON = 18;
|
|
304 |
///if (rect.width > rect.height) {
|
|
305 |
/// scale = rect.width / m_attributes.m_sizePaper.getAlto() * 1;
|
|
306 |
///} else {
|
|
307 |
scale = rect.height / m_attributes.m_sizePaper.getAlto() * 1;
|
142 |
308 |
|
143 |
|
/** DOCUMENT ME! */
|
144 |
|
public static final int GRAPHICS = 19;
|
|
309 |
///}
|
|
310 |
AffineTransform escalado = new AffineTransform();
|
|
311 |
AffineTransform translacion = new AffineTransform();
|
|
312 |
translacion.setToTranslation(rect.getMinX(), rect.getMinY());
|
|
313 |
escalado.setToScale(scale, scale);
|
|
314 |
m_MatrizTransf.setToIdentity();
|
|
315 |
m_MatrizTransf.concatenate(translacion);
|
|
316 |
m_MatrizTransf.concatenate(escalado);
|
|
317 |
m_attributes.setDistanceUnitX(rect);
|
|
318 |
m_attributes.setDistanceUnitY(rect);
|
145 |
319 |
|
146 |
|
/** DOCUMENT ME! */
|
147 |
|
public static final int RECTANGLESYMBOL = 20;
|
|
320 |
for (int i = 0; i < getFFrames().size(); i++) {
|
|
321 |
try {
|
|
322 |
((IFFrame) getFFrames().get(i)).print(g2, getAT());
|
|
323 |
} catch (DriverException e) {
|
|
324 |
e.printStackTrace();
|
|
325 |
}
|
|
326 |
}
|
148 |
327 |
|
149 |
|
/** DOCUMENT ME! */
|
150 |
|
public static final int RECTANGLEGROUP = 21;
|
|
328 |
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
|
329 |
}
|
151 |
330 |
|
152 |
|
/** DOCUMENT ME! */
|
153 |
|
public static final int VIEW_ZOOMIN = 22;
|
|
331 |
/**
|
|
332 |
* Clip sobre el rect?ngulo visible.
|
|
333 |
*
|
|
334 |
* @param g2d Graphics sobre el que hacer el clip.
|
|
335 |
*/
|
|
336 |
private void clipVisibleRect(Graphics2D g2d) {
|
|
337 |
rectVisible = this.getVisibleRect();
|
|
338 |
g2d.clipRect((int) rectVisible.getMinX(), (int) rectVisible.getMinY(),
|
|
339 |
(int) rectVisible.getWidth(), (int) rectVisible.getHeight());
|
|
340 |
}
|
154 |
341 |
|
155 |
|
/** DOCUMENT ME! */
|
156 |
|
public static final int VIEW_ZOOMOUT = 23;
|
|
342 |
/**
|
|
343 |
* Inicializa los componentes.
|
|
344 |
*/
|
|
345 |
private void initComponents() {
|
|
346 |
m_attributes = new Attributes();
|
|
347 |
m_attributes.setDistanceUnitX(rect);
|
|
348 |
m_attributes.setDistanceUnitY(rect);
|
|
349 |
actionDelFFrame();
|
|
350 |
}
|
157 |
351 |
|
158 |
|
/** DOCUMENT ME! */
|
159 |
|
public static final int VIEW_FULL = 24;
|
|
352 |
/**
|
|
353 |
* Crea un ActionEvent para controlar las teclas que se pulsen cuando este
|
|
354 |
* el Layout Focusable a true.
|
|
355 |
*/
|
|
356 |
private void actionDelFFrame() {
|
|
357 |
Action doNothing = new AbstractAction() {
|
|
358 |
public void actionPerformed(ActionEvent e) {
|
|
359 |
for (int i = getFFrames().size() - 1; i >= 0; i--) {
|
|
360 |
IFFrame fframe = (IFFrame) getFFrames().get(i);
|
160 |
361 |
|
161 |
|
/** DOCUMENT ME! */
|
162 |
|
public static final int VIEW_PAN = 25;
|
163 |
|
public static final int SET_TAG=26;
|
164 |
|
/** DOCUMENT ME! */
|
165 |
|
public static final Image iLayoutpan = new ImageIcon(Abrir.class.getClassLoader()
|
166 |
|
.getResource("images/LayoutHand.gif")).getImage();
|
|
362 |
if (fframe.getSelected() != FFrame.NOSELECT) {
|
|
363 |
getFFrames().remove(i);
|
|
364 |
}
|
|
365 |
}
|
167 |
366 |
|
168 |
|
/** DOCUMENT ME! */
|
169 |
|
public static final Image ipan = new ImageIcon(Abrir.class.getClassLoader()
|
170 |
|
.getResource("images/Hand.gif")).getImage();
|
|
367 |
refresh();
|
|
368 |
}
|
|
369 |
};
|
171 |
370 |
|
172 |
|
/** DOCUMENT ME! */
|
173 |
|
public static final Image iLayoutzoomin = new ImageIcon(Abrir.class.getClassLoader()
|
174 |
|
.getResource("images/LayoutZoomInCursor.gif")).getImage();
|
|
371 |
this.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0),
|
|
372 |
"doNothing");
|
|
373 |
this.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_BACK_SPACE, 0),
|
|
374 |
"doNothing");
|
|
375 |
this.getActionMap().put("doNothing", doNothing);
|
|
376 |
}
|
175 |
377 |
|
176 |
|
/** DOCUMENT ME! */
|
177 |
|
public static final Image izoomin = new ImageIcon(Abrir.class.getClassLoader()
|
178 |
|
.getResource("images/ZoomInCursor.gif")).getImage();
|
|
378 |
/**
|
|
379 |
* paintComponent del Layout.
|
|
380 |
*
|
|
381 |
* @param g Graphics del Layout.
|
|
382 |
*/
|
|
383 |
protected void paintComponent(Graphics g) {
|
|
384 |
super.paintComponent(g);
|
179 |
385 |
|
180 |
|
/** DOCUMENT ME! */
|
181 |
|
public static final Image iLayoutzoomout = new ImageIcon(Abrir.class.getClassLoader()
|
182 |
|
.getResource("images/LayoutZoomOutCursor.gif")).getImage();
|
|
386 |
switch (status) {
|
|
387 |
case ZOOM_MAS:
|
|
388 |
logger.debug("zoom mas");
|
|
389 |
layoutPaint.drawRectangle((Graphics2D) g);
|
183 |
390 |
|
184 |
|
/** DOCUMENT ME! */
|
185 |
|
public static final Image izoomout = new ImageIcon(Abrir.class.getClassLoader()
|
186 |
|
.getResource("images/ZoomOutCursor.gif")).getImage();
|
|
391 |
g.drawImage(img, 0, 0, this);
|
|
392 |
layoutPaint.drawRuler((Graphics2D) g, Color.black);
|
|
393 |
g.setColor(Color.black);
|
|
394 |
g.setXORMode(Color.white);
|
187 |
395 |
|
188 |
|
/** DOCUMENT ME! */
|
189 |
|
public static final Image iinfo = new ImageIcon(Abrir.class.getClassLoader()
|
190 |
|
.getResource("images/InfoCursor.gif")).getImage();
|
|
396 |
Rectangle r = new Rectangle();
|
191 |
397 |
|
192 |
|
/** DOCUMENT ME! */
|
193 |
|
public static final Image icrux = new ImageIcon(Abrir.class.getClassLoader()
|
194 |
|
.getResource("images/CruxCursor.png")).getImage();
|
195 |
|
|
196 |
|
public static final Image itag = new ImageIcon(Abrir.class.getClassLoader()
|
197 |
|
.getResource("images/tagCursor.gif")).getImage();
|
198 |
|
|
199 |
|
private Point origin = new Point(50, 50);
|
200 |
|
private Point rectOrigin = new Point(origin);
|
201 |
|
private Rectangle2D.Double rect = new Rectangle2D.Double(rectOrigin.x,
|
202 |
|
rectOrigin.y, 400, 300);
|
203 |
|
private Point m_FirstPoint = new Point(0, 0);
|
204 |
|
private Point m_PointAnt = new Point(0, 0);
|
205 |
|
private Point m_LastPoint = new Point(0, 0);
|
206 |
|
private EventsHandler events;
|
207 |
|
private int tool = ZOOM_MAS;
|
208 |
|
private int status = DESACTUALIZADO;
|
209 |
|
private BufferedImage img = null;
|
210 |
|
private AffineTransform m_MatrizTransf;
|
211 |
|
private Rectangle2D rectVisible;
|
212 |
|
private IFFrameDialog fframedialog = null;
|
213 |
|
private ArrayList m_fframes = new ArrayList();
|
214 |
|
private FConfigLayoutDialog m_configLayout = null;
|
215 |
|
private MapProperties m_propertiesLayout = null;
|
216 |
|
private Attributes m_attributes = null;
|
217 |
|
private PrintService[] m_cachePrintServices = null;
|
218 |
|
private PrintRequestAttributeSet m_cachePrintRequestAtributeSet = null;
|
219 |
|
private PrintService m_cachePrintService = null;
|
220 |
|
private boolean m_bCancelDrawing = false;
|
221 |
|
private boolean isCuadricula = false;
|
222 |
|
private boolean initial = true;
|
223 |
|
private ProjectMap map = null;
|
224 |
|
private Rectangle reSel = null;
|
225 |
|
private boolean isReSel = true;
|
226 |
|
// private String m_name = null;
|
227 |
|
private boolean m_showRuler = true;
|
228 |
|
private FLayoutDraw layoutPaint = null;
|
229 |
|
private boolean isDrawCuadricula=true;
|
230 |
|
public static Hashtable nums=new Hashtable();
|
231 |
|
private Doc doc=null;
|
232 |
|
private PrintRequestAttributeSet att=null;
|
233 |
|
/**
|
234 |
|
* Creates a new Layout object.
|
235 |
|
*/
|
236 |
|
public Layout() {
|
237 |
|
this.setLayout(null);
|
238 |
|
events = new EventsHandler(this);
|
239 |
|
layoutPaint = new FLayoutDraw(this);
|
240 |
|
addComponentListener(events);
|
241 |
|
addMouseMotionListener(events);
|
242 |
|
addMouseListener(events);
|
243 |
|
m_MatrizTransf = new AffineTransform();
|
244 |
|
m_MatrizTransf.setToIdentity();
|
245 |
|
this.initComponents();
|
246 |
|
}
|
|
398 |
r.setFrameFromDiagonal(m_FirstPoint, m_LastPoint);
|
|
399 |
g.drawRect(r.x, r.y, r.width, r.height);
|
247 |
400 |
|
248 |
|
/**
|
249 |
|
* Rellena el ProjectMap del Layout.
|
250 |
|
*
|
251 |
|
* @param m ProjectMap.
|
252 |
|
*/
|
253 |
|
public void setProjectMap(ProjectMap m) {
|
254 |
|
map = m;
|
255 |
|
}
|
|
401 |
break;
|
256 |
402 |
|
257 |
|
/**
|
258 |
|
* Devuelve el rect?ngulo de selecci?n por rect?ngulo.
|
259 |
|
*
|
260 |
|
* @return Rect?ngulo de selecci?n.
|
261 |
|
*/
|
262 |
|
public Rectangle getReSel() {
|
263 |
|
return reSel;
|
264 |
|
}
|
|
403 |
case RECTANGLE:
|
|
404 |
logger.debug("rectangle");
|
|
405 |
layoutPaint.drawRectangle((Graphics2D) g);
|
265 |
406 |
|
266 |
|
/**
|
267 |
|
* Devuelve true si se debe dibujar el rect?ngulo de selecci?n y realizar
|
268 |
|
* la sellecci?n.
|
269 |
|
*
|
270 |
|
* @return true si se realiza la selecci?n por rect?ngulo.
|
271 |
|
*/
|
272 |
|
public boolean isReSel() {
|
273 |
|
return isReSel;
|
274 |
|
}
|
|
407 |
g.drawImage(img, 0, 0, this);
|
|
408 |
layoutPaint.drawRuler((Graphics2D) g, Color.black);
|
|
409 |
g.setColor(Color.black);
|
|
410 |
g.setXORMode(Color.white);
|
275 |
411 |
|
276 |
|
/**
|
277 |
|
* Rellena con true si se debe de dibujar y seleccionar por rect?ngulo de
|
278 |
|
* selecci?n.
|
279 |
|
*
|
280 |
|
* @param b boolean.
|
281 |
|
*/
|
282 |
|
public void setIsReSel(boolean b) {
|
283 |
|
isReSel = b;
|
284 |
|
}
|
|
412 |
Rectangle re = new Rectangle();
|
|
413 |
re.setFrameFromDiagonal(m_FirstPoint, m_LastPoint);
|
285 |
414 |
|
286 |
|
/**
|
287 |
|
* Devuelve true si el dibujado ha sido cancelado.
|
288 |
|
*
|
289 |
|
* @return true si el dibujado ha sido cancelado.
|
290 |
|
*/
|
291 |
|
public synchronized boolean isDrawingCancelled() {
|
292 |
|
return m_bCancelDrawing;
|
293 |
|
}
|
|
415 |
if (isCuadricula()) {
|
|
416 |
FLayoutUtilities.setRectGrid(re,
|
|
417 |
m_attributes.getUnitInPixelsX(),
|
|
418 |
m_attributes.getUnitInPixelsY(), m_MatrizTransf);
|
|
419 |
}
|
294 |
420 |
|
295 |
|
/**
|
296 |
|
* Pone el dibuja a cancelado o no seg?n se quiera.
|
297 |
|
*
|
298 |
|
* @param b true si se quiere cancelar el dibujado.
|
299 |
|
*/
|
300 |
|
public synchronized void setCancelDrawing(boolean b) {
|
301 |
|
m_bCancelDrawing = b;
|
|
421 |
g.drawRect(re.x, re.y, re.width, re.height);
|
302 |
422 |
|
303 |
|
for (int i = 0; i < getFFrames().size(); i++) {
|
304 |
|
IFFrame fframe = (IFFrame) getFFrames().get(i);
|
|
423 |
break;
|
305 |
424 |
|
306 |
|
if (fframe instanceof FFrameView &&
|
307 |
|
(((FFrameView) fframe).getFMap() != null)) {
|
308 |
|
////TODO((FFrameView) getFFrames().get(i)).getFMap().setCancelDrawing(b);
|
309 |
|
}
|
310 |
|
}
|
311 |
|
}
|
|
425 |
case PAN:
|
|
426 |
logger.debug("pan");
|
312 |
427 |
|
313 |
|
/**
|
314 |
|
* Obtiene el ArrayList con todos los FFrames que se han a?adido al Layout.
|
315 |
|
*
|
316 |
|
* @return Array con todos los fframes que contiene el Layout.
|
317 |
|
*/
|
318 |
|
public ArrayList getFFrames() {
|
319 |
|
return m_fframes;
|
320 |
|
}
|
|
428 |
//g.setXORMode(Color.black);
|
|
429 |
rect.x = rectOrigin.x + (m_LastPoint.x - m_PointAnt.x);
|
|
430 |
rect.y = rectOrigin.y + (m_LastPoint.y - m_PointAnt.y);
|
321 |
431 |
|
322 |
|
/**
|
323 |
|
* DOCUMENT ME!
|
324 |
|
*
|
325 |
|
* @param frames DOCUMENT ME!
|
326 |
|
*/
|
327 |
|
private void setFFrames(ArrayList frames) {
|
328 |
|
m_fframes = frames;
|
329 |
|
}
|
|
432 |
//g.clearRect(0, 0, getWidth(), getHeight());
|
|
433 |
layoutPaint.drawRectangle((Graphics2D) g);
|
330 |
434 |
|
331 |
|
/**
|
332 |
|
* Obtiene el rect que se ajusta al tama?o de la ventana, para ver el folio
|
333 |
|
* entero.
|
334 |
|
*/
|
335 |
|
public void fullRect() {
|
336 |
|
rect.setRect(origin.x, origin.y, getWidth() - (origin.x * 2),
|
337 |
|
getHeight() - (origin.x * 2));
|
|
435 |
if (img != null) {
|
|
436 |
g.drawImage(img, (getLastPoint().x - getPointAnt().x),
|
|
437 |
(m_LastPoint.y - m_PointAnt.y), this);
|
|
438 |
}
|
338 |
439 |
|
339 |
|
if (m_attributes.isLandSpace()) {
|
340 |
|
rect = m_attributes.getRectangleLandscape(rect, getWidth(),
|
341 |
|
getHeight());
|
342 |
|
} else {
|
343 |
|
rect = m_attributes.getRectanglePortrait(rect, getWidth(),
|
344 |
|
getHeight());
|
345 |
|
}
|
|
440 |
layoutPaint.drawRuler((Graphics2D) g, Color.black);
|
346 |
441 |
|
347 |
|
status = DESACTUALIZADO;
|
348 |
|
repaint();
|
349 |
|
}
|
|
442 |
break;
|
350 |
443 |
|
351 |
|
/**
|
352 |
|
* M?todo para imprimir el Layout sin modificar la matriz de
|
353 |
|
* transformaci?n.
|
354 |
|
*
|
355 |
|
* @param g2
|
356 |
|
*/
|
357 |
|
public void drawLayoutPrint(Graphics2D g2) {
|
358 |
|
setCancelDrawing(false);
|
359 |
|
|
360 |
|
setCursor(Cursor.getDefaultCursor());
|
|
444 |
case VIEW_PAN:
|
361 |
445 |
|
362 |
|
double scale = 0;
|
|
446 |
// logger.debug("View pan");
|
|
447 |
layoutPaint.drawRectangle((Graphics2D) g);
|
|
448 |
layoutPaint.drawRuler((Graphics2D) g, Color.black);
|
363 |
449 |
|
364 |
|
///if (rect.width > rect.height) {
|
365 |
|
/// scale = rect.width / m_attributes.m_sizePaper.getAlto() * 1;
|
366 |
|
///} else {
|
367 |
|
scale = rect.height / m_attributes.m_sizePaper.getAlto() * 1;
|
|
450 |
for (int i = 0; i < getFFrames().size(); i++) {
|
|
451 |
if (getFFrames().get(i) instanceof FFrameView) {
|
|
452 |
FFrameView fframe = (FFrameView) getFFrames().get(i);
|
368 |
453 |
|
369 |
|
///}
|
370 |
|
AffineTransform escalado = new AffineTransform();
|
371 |
|
AffineTransform translacion = new AffineTransform();
|
372 |
|
translacion.setToTranslation(rect.getMinX(), rect.getMinY());
|
373 |
|
escalado.setToScale(scale, scale);
|
374 |
|
m_MatrizTransf.setToIdentity();
|
375 |
|
m_MatrizTransf.concatenate(translacion);
|
376 |
|
m_MatrizTransf.concatenate(escalado);
|
377 |
|
m_attributes.setDistanceUnitX(rect);
|
378 |
|
m_attributes.setDistanceUnitY(rect);
|
|
454 |
if (fframe.getSelected() != FFrame.NOSELECT) {
|
|
455 |
Rectangle2D.Double rec = fframe.getBoundingBox(getAT());
|
379 |
456 |
|
380 |
|
for (int i = 0; i < getFFrames().size(); i++) {
|
381 |
|
try {
|
382 |
|
((IFFrame) getFFrames().get(i)).print(g2, getAT());
|
383 |
|
} catch (DriverException e) {
|
384 |
|
e.printStackTrace();
|
385 |
|
}
|
386 |
|
}
|
387 |
|
|
388 |
|
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
389 |
|
}
|
|
457 |
if (img != null) {
|
|
458 |
//g.drawImage(img, 0, 0, this);
|
|
459 |
rec = (Rectangle2D.Double) rec.createIntersection(getVisibleRect());
|
390 |
460 |
|
391 |
|
/**
|
392 |
|
* Clip sobre el rect?ngulo visible.
|
393 |
|
*
|
394 |
|
* @param g2d Graphics sobre el que hacer el clip.
|
395 |
|
*/
|
396 |
|
private void clipVisibleRect(Graphics2D g2d) {
|
397 |
|
rectVisible = this.getVisibleRect();
|
398 |
|
g2d.clipRect((int) rectVisible.getMinX(), (int) rectVisible.getMinY(),
|
399 |
|
(int) rectVisible.getWidth(), (int) rectVisible.getHeight());
|
400 |
|
}
|
|
461 |
//((Graphics2D)g).clearRect((int)rec.x,(int)rec.y,(int)rec.width,(int)rec.height);
|
|
462 |
}
|
401 |
463 |
|
402 |
|
/**
|
403 |
|
* Inicializa los componentes.
|
404 |
|
*/
|
405 |
|
private void initComponents() {
|
406 |
|
m_attributes = new Attributes();
|
407 |
|
m_attributes.setDistanceUnitX(rect);
|
408 |
|
m_attributes.setDistanceUnitY(rect);
|
409 |
|
actionDelFFrame();
|
410 |
|
}
|
|
464 |
if (fframe.getBufferedImage() != null) {
|
|
465 |
layoutPaint.drawHandlers((Graphics2D) g,
|
|
466 |
Color.black);
|
|
467 |
g.clipRect((int) rec.x, (int) rec.y,
|
|
468 |
(int) rec.width, (int) rec.height);
|
411 |
469 |
|
412 |
|
/**
|
413 |
|
* Crea un ActionEvent para controlar las teclas que se pulsen cuando este
|
414 |
|
* el Layout Focusable a true.
|
415 |
|
*/
|
416 |
|
private void actionDelFFrame() {
|
417 |
|
Action doNothing = new AbstractAction() {
|
418 |
|
public void actionPerformed(ActionEvent e) {
|
419 |
|
for (int i = getFFrames().size() - 1; i >= 0; i--) {
|
420 |
|
IFFrame fframe = (IFFrame) getFFrames().get(i);
|
|
470 |
//g.setColor(Color.gray);
|
|
471 |
//g.fillRect(0,0,getWidth(),getHeight());
|
|
472 |
layoutPaint.drawRectangle((Graphics2D) g);
|
|
473 |
layoutPaint.drawRuler((Graphics2D) g,
|
|
474 |
Color.black);
|
421 |
475 |
|
422 |
|
if (fframe.getSelected() != FFrame.NOSELECT) {
|
423 |
|
getFFrames().remove(i);
|
424 |
|
}
|
425 |
|
}
|
|
476 |
g.drawImage(fframe.getBufferedImage(),
|
|
477 |
m_LastPoint.x - m_PointAnt.x,
|
|
478 |
m_LastPoint.y - m_PointAnt.y, this);
|
|
479 |
System.out.println(
|
|
480 |
"m_LastPoint.x - m_PointAnt.x" +
|
|
481 |
(m_LastPoint.x - m_PointAnt.x));
|
|
482 |
System.out.println(
|
|
483 |
"m_LastPoint.y - m_PointAnt.y" +
|
|
484 |
(m_LastPoint.y - m_PointAnt.y));
|
|
485 |
}
|
|
486 |
}
|
|
487 |
}
|
|
488 |
}
|
426 |
489 |
|
427 |
|
refresh();
|
428 |
|
}
|
429 |
|
};
|
|
490 |
//g.setXORMode(Color.black);
|
|
491 |
break;
|
430 |
492 |
|
431 |
|
this.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0),
|
432 |
|
"doNothing");
|
433 |
|
this.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_BACK_SPACE, 0),
|
434 |
|
"doNothing");
|
435 |
|
this.getActionMap().put("doNothing", doNothing);
|
436 |
|
}
|
|
493 |
case SELECT:
|
|
494 |
logger.debug("select");
|
|
495 |
layoutPaint.drawRectangle((Graphics2D) g);
|
437 |
496 |
|
438 |
|
/**
|
439 |
|
* paintComponent del Layout.
|
440 |
|
*
|
441 |
|
* @param g Graphics del Layout.
|
442 |
|
*/
|
443 |
|
protected void paintComponent(Graphics g) {
|
444 |
|
super.paintComponent(g);
|
|
497 |
g.drawImage(img, 0, 0, this);
|
445 |
498 |
|
446 |
|
switch (status) {
|
447 |
|
case ZOOM_MAS:
|
448 |
|
logger.debug("zoom mas");
|
449 |
|
layoutPaint.drawRectangle((Graphics2D) g);
|
|
499 |
if (isReSel) {
|
|
500 |
reSel = new Rectangle();
|
|
501 |
reSel.setFrameFromDiagonal(m_FirstPoint, m_LastPoint);
|
|
502 |
g.drawRect(reSel.x, reSel.y, reSel.width, reSel.height);
|
|
503 |
}
|
450 |
504 |
|
451 |
|
g.drawImage(img, 0, 0, this);
|
452 |
|
layoutPaint.drawRuler((Graphics2D) g, Color.black);
|
453 |
|
g.setColor(Color.black);
|
454 |
|
g.setXORMode(Color.white);
|
|
505 |
for (int i = 0; i < getFFrames().size(); i++) {
|
|
506 |
IFFrame fframe = (IFFrame) getFFrames().get(i);
|
455 |
507 |
|
456 |
|
Rectangle r = new Rectangle();
|
|
508 |
if (fframe.getSelected() != FFrame.NOSELECT) {
|
|
509 |
g.setColor(Color.black);
|
|
510 |
fframe.drawHandlers((Graphics2D) g);
|
457 |
511 |
|
458 |
|
r.setFrameFromDiagonal(m_FirstPoint, m_LastPoint);
|
459 |
|
g.drawRect(r.x, r.y, r.width, r.height);
|
|
512 |
int difx = (m_LastPoint.x - m_FirstPoint.x);
|
|
513 |
int dify = (m_LastPoint.y - m_FirstPoint.y);
|
460 |
514 |
|
461 |
|
break;
|
|
515 |
if ((Math.abs(difx) > 3) || (Math.abs(dify) > 3)) {
|
|
516 |
Rectangle2D rectangle = fframe.getMovieRect(difx,
|
|
517 |
dify);
|
462 |
518 |
|
463 |
|
case RECTANGLE:
|
464 |
|
logger.debug("rectangle");
|
465 |
|
layoutPaint.drawRectangle((Graphics2D) g);
|
|
519 |
if (rectangle != null) {
|
|
520 |
if (isCuadricula) {
|
|
521 |
FLayoutUtilities.setRectGrid(rectangle,
|
|
522 |
m_attributes.getUnitInPixelsX(),
|
|
523 |
m_attributes.getUnitInPixelsY(),
|
|
524 |
m_MatrizTransf);
|
|
525 |
}
|
466 |
526 |
|
467 |
|
g.drawImage(img, 0, 0, this);
|
468 |
|
layoutPaint.drawRuler((Graphics2D) g, Color.black);
|
469 |
|
g.setColor(Color.black);
|
470 |
|
g.setXORMode(Color.white);
|
|
527 |
g.drawRect((int) rectangle.getMinX(),
|
|
528 |
(int) rectangle.getMinY(),
|
|
529 |
(int) rectangle.getWidth(),
|
|
530 |
(int) rectangle.getHeight());
|
|
531 |
}
|
|
532 |
}
|
|
533 |
}
|
|
534 |
}
|
471 |
535 |
|
472 |
|
Rectangle re = new Rectangle();
|
473 |
|
re.setFrameFromDiagonal(m_FirstPoint, m_LastPoint);
|
|
536 |
layoutPaint.drawRuler((Graphics2D) g, Color.black);
|
474 |
537 |
|
475 |
|
if (isCuadricula()) {
|
476 |
|
FLayoutUtilities.setRectGrid(re,
|
477 |
|
m_attributes.getUnitInPixelsX(),
|
478 |
|
m_attributes.getUnitInPixelsY(), m_MatrizTransf);
|
479 |
|
}
|
|
538 |
break;
|
480 |
539 |
|
481 |
|
g.drawRect(re.x, re.y, re.width, re.height);
|
|
540 |
case GRAPHICS:
|
|
541 |
layoutPaint.drawRectangle((Graphics2D) g);
|
|
542 |
g.drawImage(img, 0, 0, this);
|
|
543 |
layoutPaint.drawRuler((Graphics2D) g, Color.black);
|
482 |
544 |
|
483 |
|
break;
|
|
545 |
break;
|
484 |
546 |
|
485 |
|
case PAN:
|
486 |
|
logger.debug("pan");
|
|
547 |
case DESACTUALIZADO:
|
|
548 |
logger.debug("desactualizado");
|
|
549 |
img = new BufferedImage(getWidth(), getHeight(),
|
|
550 |
BufferedImage.TYPE_INT_ARGB);
|
487 |
551 |
|
488 |
|
//g.setXORMode(Color.black);
|
489 |
|
rect.x = rectOrigin.x + (m_LastPoint.x - m_PointAnt.x);
|
490 |
|
rect.y = rectOrigin.y + (m_LastPoint.y - m_PointAnt.y);
|
|
552 |
Graphics gimag = img.getGraphics();
|
|
553 |
clipVisibleRect((Graphics2D) gimag);
|
491 |
554 |
|
492 |
|
//g.clearRect(0, 0, getWidth(), getHeight());
|
493 |
|
layoutPaint.drawRectangle((Graphics2D) g);
|
|
555 |
if (initial) {
|
|
556 |
fullRect();
|
|
557 |
initial = false;
|
|
558 |
}
|
494 |
559 |
|
495 |
|
if (img != null) {
|
496 |
|
g.drawImage(img, (getLastPoint().x - getPointAnt().x),
|
497 |
|
(m_LastPoint.y - m_PointAnt.y), this);
|
498 |
|
}
|
|
560 |
try {
|
|
561 |
layoutPaint.drawLayout((Graphics2D) gimag, img);
|
|
562 |
} catch (DriverException e) {
|
|
563 |
e.printStackTrace();
|
|
564 |
}
|
499 |
565 |
|
500 |
|
layoutPaint.drawRuler((Graphics2D) g, Color.black);
|
|
566 |
layoutPaint.drawRectangle((Graphics2D) g);
|
501 |
567 |
|
502 |
|
break;
|
|
568 |
g.drawImage(img, 0, 0, this);
|
|
569 |
layoutPaint.drawHandlers((Graphics2D) g, Color.black);
|
|
570 |
layoutPaint.drawRuler((Graphics2D) g, Color.black);
|
503 |
571 |
|
504 |
|
case VIEW_PAN:
|
|
572 |
break;
|
505 |
573 |
|
506 |
|
// logger.debug("View pan");
|
507 |
|
layoutPaint.drawRectangle((Graphics2D) g);
|
508 |
|
layoutPaint.drawRuler((Graphics2D) g, Color.black);
|
|
574 |
case ACTUALIZADO:
|
|
575 |
layoutPaint.drawRectangle((Graphics2D) g);
|
509 |
576 |
|
510 |
|
for (int i = 0; i < getFFrames().size(); i++) {
|
511 |
|
if (getFFrames().get(i) instanceof FFrameView) {
|
512 |
|
FFrameView fframe = (FFrameView) getFFrames().get(i);
|
|
577 |
g.drawImage(img, 0, 0, this);
|
|
578 |
layoutPaint.drawHandlers((Graphics2D) g, Color.black);
|
|
579 |
layoutPaint.drawRuler((Graphics2D) g, Color.black);
|
|
580 |
}
|
|
581 |
}
|
513 |
582 |
|
514 |
|
if (fframe.getSelected() != FFrame.NOSELECT) {
|
515 |
|
Rectangle2D.Double rec = fframe.getBoundingBox(getAT());
|
|
583 |
/**
|
|
584 |
* A?ade un fframe al Arraylist m_fframes.
|
|
585 |
*
|
|
586 |
* @param frame fframe a a?adir.
|
|
587 |
* @param clearSelection para que se quede seleccionado ?nicamente el que
|
|
588 |
* a?adimos y false si lo que se pretende es que no se
|
|
589 |
* deseleccionen lo que ya est?n seleccionados.
|
|
590 |
*/
|
|
591 |
public void addFFrame(IFFrame frame, boolean clearSelection) {
|
|
592 |
if (clearSelection) {
|
|
593 |
for (int i = getFFrames().size() - 1; i >= 0; i--) {
|
|
594 |
IFFrame fframe1 = (IFFrame) getFFrames().get(i);
|
|
595 |
fframe1.setSelected(false);
|
|
596 |
}
|
|
597 |
}
|
516 |
598 |
|
517 |
|
if (img != null) {
|
518 |
|
|
519 |
|
//g.drawImage(img, 0, 0, this);
|
520 |
|
|
521 |
|
rec = (Rectangle2D.Double) rec.createIntersection(getVisibleRect());
|
522 |
|
//((Graphics2D)g).clearRect((int)rec.x,(int)rec.y,(int)rec.width,(int)rec.height);
|
523 |
|
}
|
|
599 |
if (frame instanceof FFrameView &&
|
|
600 |
(((FFrameView) frame).getFMap() != null)) {
|
|
601 |
((FFrameView) frame).getFMap().getViewPort().addExtentListener(this);
|
|
602 |
}
|
524 |
603 |
|
525 |
|
if (fframe.getBufferedImage() != null) {
|
526 |
|
layoutPaint.drawHandlers((Graphics2D) g,
|
527 |
|
Color.black);
|
528 |
|
g.clipRect((int) rec.x, (int) rec.y,
|
529 |
|
(int) rec.width, (int) rec.height);
|
|
604 |
if (nums.containsKey(frame.getClass())) {
|
|
605 |
nums.put(frame.getClass(),
|
|
606 |
new Integer(Integer.parseInt(nums.get(frame.getClass())
|
|
607 |
.toString()) + 1));
|
|
608 |
} else {
|
|
609 |
nums.put(frame.getClass(), new Integer(0));
|
|
610 |
}
|
530 |
611 |
|
531 |
|
//g.setColor(Color.gray);
|
532 |
|
//g.fillRect(0,0,getWidth(),getHeight());
|
533 |
|
layoutPaint.drawRectangle((Graphics2D) g);
|
534 |
|
layoutPaint.drawRuler((Graphics2D) g,
|
535 |
|
Color.black);
|
|
612 |
frame.setNum(Integer.parseInt(nums.get(frame.getClass()).toString()));
|
|
613 |
getFFrames().add(frame);
|
|
614 |
frame.setSelected(true);
|
|
615 |
}
|
536 |
616 |
|
537 |
|
g.drawImage(fframe.getBufferedImage(),
|
538 |
|
m_LastPoint.x - m_PointAnt.x,
|
539 |
|
m_LastPoint.y - m_PointAnt.y, this);
|
540 |
|
System.out.println(
|
541 |
|
"m_LastPoint.x - m_PointAnt.x" +
|
542 |
|
(m_LastPoint.x - m_PointAnt.x));
|
543 |
|
System.out.println(
|
544 |
|
"m_LastPoint.y - m_PointAnt.y" +
|
545 |
|
(m_LastPoint.y - m_PointAnt.y));
|
546 |
|
}
|
547 |
|
}
|
548 |
|
}
|
549 |
|
}
|
|
617 |
/**
|
|
618 |
* Abre el di?logo de propiedades del folio, pasando como par?metro el
|
|
619 |
* PrinterJob.
|
|
620 |
*
|
|
621 |
* @param job
|
|
622 |
*/
|
|
623 |
public void showPagePropertiesWindow(PrinterJob job) {
|
|
624 |
PageFormat pf1; //=new PageFormat();
|
550 |
625 |
|
551 |
|
//g.setXORMode(Color.black);
|
552 |
|
break;
|
|
626 |
pf1 = m_attributes.getPageFormat();
|
|
627 |
pf1 = job.pageDialog(pf1);
|
|
628 |
m_attributes.setPageFormat(pf1);
|
|
629 |
refresh();
|
|
630 |
}
|
553 |
631 |
|
554 |
|
case SELECT:
|
555 |
|
logger.debug("select");
|
556 |
|
layoutPaint.drawRectangle((Graphics2D) g);
|
|
632 |
/**
|
|
633 |
* Refresca el Layout.
|
|
634 |
*/
|
|
635 |
public void refresh() {
|
|
636 |
rect = m_attributes.obtainRect(false, rect, getWidth(), getHeight());
|
|
637 |
status = DESACTUALIZADO;
|
|
638 |
repaint();
|
|
639 |
}
|
557 |
640 |
|
558 |
|
g.drawImage(img, 0, 0, this);
|
|
641 |
/**
|
|
642 |
* Obtiene el rect?ngulo que representa el folio con las caracter?sticas
|
|
643 |
* que contiene attributes y diferenciando si es para visualizar en
|
|
644 |
* pantalla o para imprimir.
|
|
645 |
*
|
|
646 |
* @param isPrint si es para imprimir.
|
|
647 |
*/
|
|
648 |
public void obtainRect(boolean isPrint) {
|
|
649 |
m_attributes.obtainRect(isPrint, rect, getWidth(), getHeight());
|
|
650 |
}
|
559 |
651 |
|
560 |
|
if (isReSel) {
|
561 |
|
reSel = new Rectangle();
|
562 |
|
reSel.setFrameFromDiagonal(m_FirstPoint, m_LastPoint);
|
563 |
|
g.drawRect(reSel.x, reSel.y, reSel.width, reSel.height);
|
564 |
|
}
|
|
652 |
/**
|
|
653 |
* Muestra el di?logo de configuraci?n del Layout.
|
|
654 |
*/
|
|
655 |
public void showFConfig() {
|
|
656 |
FConfigLayoutDialog m_configLayout = new FConfigLayoutDialog(this);
|
|
657 |
PluginServices.getMDIManager().addView(m_configLayout);
|
|
658 |
}
|
565 |
659 |
|
566 |
|
for (int i = 0; i < getFFrames().size(); i++) {
|
567 |
|
IFFrame fframe = (IFFrame) getFFrames().get(i);
|
|
660 |
/**
|
|
661 |
* Mestra el di?logo de propiedades del Layout.
|
|
662 |
*/
|
|
663 |
public void showFProperties() {
|
|
664 |
if (map == null) {
|
|
665 |
map = new ProjectMap();
|
|
666 |
map.setModel(this);
|
|
667 |
map.setName(getName());
|
|
668 |
}
|
568 |
669 |
|
569 |
|
if (fframe.getSelected() != FFrame.NOSELECT) {
|
570 |
|
g.setColor(Color.black);
|
571 |
|
fframe.drawHandlers((Graphics2D) g);
|
|
670 |
m_propertiesLayout = new MapProperties(map);
|
|
671 |
PluginServices.getMDIManager().addView(m_propertiesLayout);
|
|
672 |
}
|
572 |
673 |
|
573 |
|
int difx = (m_LastPoint.x - m_FirstPoint.x);
|
574 |
|
int dify = (m_LastPoint.y - m_FirstPoint.y);
|
|
674 |
/**
|
|
675 |
* Muestra el di?logo de imprimir pasandole el printerJob como par?metro.
|
|
676 |
*
|
|
677 |
* @param job
|
|
678 |
*/
|
|
679 |
public void showPrintDialog(PrinterJob job) {
|
|
680 |
if (job != null) {
|
|
681 |
job.printDialog();
|
575 |
682 |
|
576 |
|
if ((Math.abs(difx) > 3) || (Math.abs(dify) > 3)) {
|
577 |
|
Rectangle2D rectangle = fframe.getMovieRect(difx,
|
578 |
|
dify);
|
|
683 |
try {
|
|
684 |
job.setPrintable((Printable) PluginServices.getExtension(
|
|
685 |
com.iver.cit.gvsig.Print.class));
|
|
686 |
job.print();
|
|
687 |
} catch (PrinterException e) {
|
|
688 |
e.printStackTrace();
|
|
689 |
}
|
|
690 |
} else {
|
|
691 |
boolean print = false;
|
579 |
692 |
|
580 |
|
if (rectangle != null) {
|
581 |
|
if (isCuadricula) {
|
582 |
|
FLayoutUtilities.setRectGrid(rectangle,
|
583 |
|
m_attributes.getUnitInPixelsX(),
|
584 |
|
m_attributes.getUnitInPixelsY(),
|
585 |
|
m_MatrizTransf);
|
586 |
|
}
|
|
693 |
//Actualizar attributes
|
|
694 |
att = m_attributes.toPrintAttributes();
|
587 |
695 |
|
588 |
|
g.drawRect((int) rectangle.getMinX(),
|
589 |
|
(int) rectangle.getMinY(),
|
590 |
|
(int) rectangle.getWidth(),
|
591 |
|
(int) rectangle.getHeight());
|
592 |
|
}
|
593 |
|
}
|
594 |
|
}
|
595 |
|
}
|
|
696 |
//------------------ The Printing things --------------------- //
|
|
697 |
DocFlavor flavor = DocFlavor.SERVICE_FORMATTED.PRINTABLE;
|
596 |
698 |
|
597 |
|
layoutPaint.drawRuler((Graphics2D) g, Color.black);
|
|
699 |
// returns the set of printers that support printing a specific document type (such as GIF)
|
|
700 |
// with a specific set of attributes (such as two sided).
|
|
701 |
// PrintRequestAttributeSet pras = new HashPrintRequestAttributeSet();
|
|
702 |
// interestingly, the printer dialog's default behavior has changed with the new API: by default the dialog is not shown.
|
|
703 |
// So we must use the ServiceUI class to create a print dialog
|
|
704 |
// returns the default print service.
|
|
705 |
if (m_cachePrintServices == null) {
|
|
706 |
m_cachePrintServices = PrintServiceLookup.lookupPrintServices(flavor,
|
|
707 |
null);
|
|
708 |
}
|
598 |
709 |
|
599 |
|
break;
|
|
710 |
PrintService defaultService = null;
|
600 |
711 |
|
601 |
|
case GRAPHICS:
|
602 |
|
layoutPaint.drawRectangle((Graphics2D) g);
|
603 |
|
g.drawImage(img, 0, 0, this);
|
604 |
|
layoutPaint.drawRuler((Graphics2D) g, Color.black);
|
|
712 |
if (m_cachePrintService == null) {
|
|
713 |
defaultService = PrintServiceLookup.lookupDefaultPrintService();
|
|
714 |
}
|
605 |
715 |
|
606 |
|
break;
|
|
716 |
if (m_cachePrintService == null) {
|
|
717 |
m_cachePrintService = ServiceUI.printDialog(null, 200, 200,
|
|
718 |
m_cachePrintServices, defaultService, flavor, att);
|
607 |
719 |
|
608 |
|
case DESACTUALIZADO:
|
609 |
|
logger.debug("desactualizado");
|
610 |
|
img = new BufferedImage(getWidth(), getHeight(),
|
611 |
|
BufferedImage.TYPE_INT_ARGB);
|
|
720 |
// m_cachePrintRequestAtributeSet = new HashPrintRequestAttributeSet();
|
|
721 |
// m_cachePrintRequestAtributeSet.addAll(pras);
|
|
722 |
} else {
|
|
723 |
m_cachePrintService = ServiceUI.printDialog(null, 200, 200,
|
|
724 |
m_cachePrintServices, m_cachePrintService, flavor, att);
|
|
725 |
}
|
612 |
726 |
|
613 |
|
Graphics gimag = img.getGraphics();
|
614 |
|
clipVisibleRect((Graphics2D) gimag);
|
|
727 |
if (m_cachePrintService != null) {
|
|
728 |
DocPrintJob jobNuevo = m_cachePrintService.createPrintJob();
|
|
729 |
PrintJobListener pjlistener = new PrintJobAdapter() {
|
|
730 |
public void printDataTransferCompleted(PrintJobEvent e) {
|
|
731 |
System.out.println("Fin de impresi?n");
|
|
732 |
}
|
|
733 |
};
|
615 |
734 |
|
616 |
|
if (initial) {
|
617 |
|
fullRect();
|
618 |
|
initial = false;
|
619 |
|
}
|
|
735 |
jobNuevo.addPrintJobListener(pjlistener);
|
620 |
736 |
|
621 |
|
try {
|
622 |
|
layoutPaint.drawLayout((Graphics2D) gimag, img);
|
623 |
|
} catch (DriverException e) {
|
624 |
|
e.printStackTrace();
|
625 |
|
}
|
626 |
|
layoutPaint.drawRectangle((Graphics2D) g);
|
|
737 |
// DocAttributeSet das = new HashDocAttributeSet();
|
|
738 |
doc = new SimpleDoc((Printable) PluginServices.getExtension(
|
|
739 |
com.iver.cit.gvsig.Print.class), flavor, null);
|
627 |
740 |
|
628 |
|
g.drawImage(img, 0, 0, this);
|
629 |
|
layoutPaint.drawHandlers((Graphics2D) g, Color.black);
|
630 |
|
layoutPaint.drawRuler((Graphics2D) g, Color.black);
|
|
741 |
try {
|
|
742 |
jobNuevo.print(doc, att);
|
631 |
743 |
|
632 |
|
break;
|
633 |
|
|
634 |
|
case ACTUALIZADO:
|
635 |
|
layoutPaint.drawRectangle((Graphics2D) g);
|
636 |
|
|
637 |
|
g.drawImage(img, 0, 0, this);
|
638 |
|
layoutPaint.drawHandlers((Graphics2D) g, Color.black);
|
639 |
|
layoutPaint.drawRuler((Graphics2D) g, Color.black);
|
640 |
|
}
|
641 |
|
}
|
642 |
|
|
643 |
|
/**
|
644 |
|
* A?ade un fframe al Arraylist m_fframes.
|
645 |
|
*
|
646 |
|
* @param frame fframe a a?adir.
|
647 |
|
* @param clearSelection para que se quede seleccionado ?nicamente el que
|
648 |
|
* a?adimos y false si lo que se pretende es que no se
|
649 |
|
* deseleccionen lo que ya est?n seleccionados.
|
650 |
|
*/
|
651 |
|
public void addFFrame(IFFrame frame, boolean clearSelection) {
|
652 |
|
if (clearSelection) {
|
653 |
|
for (int i = getFFrames().size() - 1; i >= 0; i--) {
|
654 |
|
IFFrame fframe1 = (IFFrame) getFFrames().get(i);
|
655 |
|
fframe1.setSelected(false);
|
656 |
|
}
|
657 |
|
}
|
658 |
|
|
659 |
|
if (frame instanceof FFrameView &&
|
660 |
|
(((FFrameView) frame).getFMap() != null)) {
|
661 |
|
((FFrameView) frame).getFMap().getViewPort().addExtentListener(this);
|
662 |
|
}
|
663 |
|
if (nums.containsKey(frame.getClass())){
|
664 |
|
nums.put(frame.getClass(),new Integer(Integer.parseInt(nums.get(frame.getClass()).toString())+1));
|
665 |
|
}else{
|
666 |
|
nums.put(frame.getClass(),new Integer(0));
|
667 |
|
}
|
668 |
|
|
669 |
|
frame.setNum(Integer.parseInt(nums.get(frame.getClass()).toString()));
|
670 |
|
getFFrames().add(frame);
|
671 |
|
frame.setSelected(true);
|
672 |
|
|
673 |
|
}
|
674 |
|
|
675 |
|
/**
|
676 |
|
* Abre el di?logo de propiedades del folio, pasando como par?metro el
|
677 |
|
* PrinterJob.
|
678 |
|
*
|
679 |
|
* @param job
|
680 |
|
*/
|
681 |
|
public void showPagePropertiesWindow(PrinterJob job) {
|
682 |
|
PageFormat pf1; //=new PageFormat();
|
683 |
|
|
684 |
|
pf1 = m_attributes.getPageFormat();
|
685 |
|
pf1 = job.pageDialog(pf1);
|
686 |
|
m_attributes.setPageFormat(pf1);
|
687 |
|
refresh();
|
688 |
|
}
|
689 |
|
|
690 |
|
/**
|
691 |
|
* Refresca el Layout.
|
692 |
|
*/
|
693 |
|
public void refresh() {
|
694 |
|
rect = m_attributes.obtainRect(false, rect, getWidth(), getHeight());
|
695 |
|
status = DESACTUALIZADO;
|
696 |
|
repaint();
|
697 |
|
}
|
698 |
|
|
699 |
|
/**
|
700 |
|
* Obtiene el rect?ngulo que representa el folio con las caracter?sticas
|
701 |
|
* que contiene attributes y diferenciando si es para visualizar en
|
702 |
|
* pantalla o para imprimir.
|
703 |
|
*
|
704 |
|
* @param isPrint si es para imprimir.
|
705 |
|
*/
|
706 |
|
public void obtainRect(boolean isPrint) {
|
707 |
|
m_attributes.obtainRect(isPrint, rect, getWidth(), getHeight());
|
708 |
|
}
|
709 |
|
|
710 |
|
/**
|
711 |
|
* Muestra el di?logo de configuraci?n del Layout.
|
712 |
|
*/
|
713 |
|
public void showFConfig() {
|
714 |
|
FConfigLayoutDialog m_configLayout = new FConfigLayoutDialog(this);
|
715 |
|
PluginServices.getMDIManager().addView(m_configLayout);
|
716 |
|
}
|
717 |
|
|
718 |
|
/**
|
719 |
|
* Mestra el di?logo de propiedades del Layout.
|
720 |
|
*/
|
721 |
|
public void showFProperties() {
|
722 |
|
if (map == null) {
|
723 |
|
map = new ProjectMap();
|
724 |
|
map.setModel(this);
|
725 |
|
map.setName(getName());
|
726 |
|
}
|
727 |
|
|
728 |
|
m_propertiesLayout = new MapProperties(map);
|
729 |
|
PluginServices.getMDIManager().addView(m_propertiesLayout);
|
730 |
|
}
|
731 |
|
|
732 |
|
/**
|
733 |
|
* Muestra el di?logo de imprimir pasandole el printerJob como par?metro.
|
734 |
|
*
|
735 |
|
* @param job
|
736 |
|
*/
|
737 |
|
public void showPrintDialog(PrinterJob job) {
|
738 |
|
if (job!=null){
|
739 |
|
job.printDialog();
|
740 |
|
try {
|
741 |
|
job.setPrintable((Printable) PluginServices.getExtension(com.iver.cit.gvsig.Print.class));
|
742 |
|
job.print();
|
743 |
|
} catch (PrinterException e) {
|
744 |
|
e.printStackTrace();
|
|
744 |
// m_attributes.
|
|
745 |
} catch (PrintException pe) {
|
|
746 |
pe.printStackTrace();
|
745 |
747 |
}
|
746 |
|
}else{
|
747 |
|
boolean print = false;
|
|
748 |
}
|
|
749 |
}
|
748 |
750 |
|
749 |
|
//Actualizar attributes
|
750 |
|
|
751 |
|
att = m_attributes.toPrintAttributes();
|
752 |
|
|
753 |
|
//------------------ The Printing things --------------------- //
|
754 |
|
DocFlavor flavor = DocFlavor.SERVICE_FORMATTED.PRINTABLE;
|
|
751 |
/* try {
|
|
752 |
print = job.printDialog(att);
|
|
753 |
} catch (Exception e) {
|
|
754 |
logger.error("Abriendo el Di?logo de imprimir"); //System.out.println("Excepci?n "+e);
|
|
755 |
}
|
|
756 |
if (print) {
|
|
757 |
job.setPrintable((Printable) App.instance.getPc().getExtension(com.iver.cit.gvsig.Print.class));
|
|
758 |
try {
|
|
759 |
job.print(att);
|
|
760 |
} catch (Exception ex) {
|
|
761 |
ex.printStackTrace();
|
|
762 |
}
|
|
763 |
} */
|
|
764 |
fullRect();
|
|
765 |
}
|
755 |
766 |
|
756 |
|
// returns the set of printers that support printing a specific document type (such as GIF)
|
757 |
|
// with a specific set of attributes (such as two sided).
|
758 |
|
// PrintRequestAttributeSet pras = new HashPrintRequestAttributeSet();
|
759 |
|
|
|
767 |
/**
|
|
768 |
* Sustituye el puntero del rat?n por la imagen que se le pasa como
|
|
769 |
* par?metro.
|
|
770 |
*
|
|
771 |
* @param image
|
|
772 |
*/
|
|
773 |
public void setMapCursor(Image image) {
|
|
774 |
Cursor cur = Toolkit.getDefaultToolkit().createCustomCursor(image,
|
|
775 |
new Point(16, 16), "");
|
|
776 |
setCursor(cur);
|
|
777 |
}
|
760 |
778 |
|
761 |
|
// interestingly, the printer dialog's default behavior has changed with the new API: by default the dialog is not shown.
|
762 |
|
// So we must use the ServiceUI class to create a print dialog
|
763 |
|
// returns the default print service.
|
764 |
|
if (m_cachePrintServices == null)
|
765 |
|
m_cachePrintServices = PrintServiceLookup.lookupPrintServices(flavor, null);
|
766 |
|
|
767 |
|
PrintService defaultService = null;
|
768 |
|
if (m_cachePrintService == null)
|
769 |
|
defaultService = PrintServiceLookup.lookupDefaultPrintService();
|
770 |
|
|
771 |
|
if (m_cachePrintService == null)
|
772 |
|
{
|
773 |
|
|
774 |
|
m_cachePrintService = ServiceUI.printDialog(null, 200, 200,
|
775 |
|
m_cachePrintServices, defaultService, flavor, att);
|
776 |
|
|
777 |
|
// m_cachePrintRequestAtributeSet = new HashPrintRequestAttributeSet();
|