protected DrawingView createDrawingView(Drawing newDrawing) { Dimension d = getDrawingViewSize(); DrawingView newDrawingView = new StandardDrawingView(this, d.width, d.height); newDrawingView.setDrawing(newDrawing); fireViewCreatedEvent(newDrawingView); return newDrawingView; }
/** Inserts a vector of figures and translates them by the given offset. */ protected void insertFigures(Vector figures, int dx, int dy) { FigureEnumeration e = new FigureEnumerator(figures); while (e.hasMoreElements()) { Figure figure = e.nextFigure(); figure.moveBy(dx, dy); figure = fView.add(figure); fView.addToSelection(figure); } }
/** Refreshes the drawing if there is some accumulated damage */ public synchronized void checkDamage() { Iterator each = drawing().drawingChangeListeners(); while (each.hasNext()) { Object l = each.next(); if (l instanceof DrawingView) { ((DrawingView) l).repairDamage(); } } }
/** Copies the selection to the clipboard. */ protected void copySelection() { FigureSelection selection = fView.getFigureSelection(); Clipboard.getClipboard().setContents(selection); }
/** Deletes the selection from the drawing. */ protected void deleteSelection() { fView.drawing().removeAll(fView.selection()); fView.clearSelection(); }
/** * Creates the drawing view used in this application. You need to override this method to use a * DrawingView subclass in your application. By default a standard DrawingView is returned. */ protected DrawingView createDrawingView() { DrawingView createdDrawingView = createDrawingView(createDrawing()); createdDrawingView.drawing().setTitle(getDefaultDrawingTitle()); return createdDrawingView; }