/** Lays out the invalid views and returns the area to be repainted. */ private Rectangle layoutViews() { if (!Thread.currentThread().getName().startsWith("AWT-EventQueue") && !isDotNet()) { // REVIEW remove this check and exception when problem with multiple // field drawing is resolved // (Bug 1) throw new IsisException("Drawing with wrong thread: " + Thread.currentThread()); } // overlayView.layout(new Size(rootView.getSize())); // rootView.layout(new Size(rootView.getSize())); final Size rootViewSize = rootView.getSize(); overlayView.layout(); rootView.layout(); synchronized (redrawArea) { if (!redrawArea.equals(NO_REDRAW)) { final Rectangle r2 = new Rectangle( redrawArea.getX(), redrawArea.getY(), redrawArea.getWidth(), redrawArea.getHeight()); redrawArea.setBounds(NO_REDRAW); return r2; } } return null; }
/** Force a repaint of the damaged area of the viewer. */ @Override public void scheduleRepaint() { updateNotifier.invalidateViewsForChangedObjects(); synchronized (redrawArea) { if (!redrawArea.equals(NO_REDRAW) || refreshStatus) { UI_LOG.debug("repaint viewer " + redrawArea); final Bounds area = new Bounds(redrawArea); area.translate(insets.left, insets.top); renderingArea.repaint(area.getX(), area.getY(), area.getWidth(), area.getHeight()); redrawArea.setBounds(NO_REDRAW); } } }
@Override public void markDamaged(final Bounds bounds) { if (spy != null) { spy.addDamagedArea(bounds); } synchronized (redrawArea) { if (redrawArea.equals(NO_REDRAW)) { redrawArea.setBounds(bounds); UI_LOG.debug("damage - new area " + redrawArea); } else { if (!bounds.getSize().equals(NO_SIZE)) { redrawArea.union(bounds); UI_LOG.debug("damage - extend area " + redrawArea + " - to include " + bounds); } } } }