From 22c351cda5d773e42fe39f98a49864492c2fa839 Mon Sep 17 00:00:00 2001 From: weisj Date: Tue, 30 Jun 2020 01:06:33 +0200 Subject: [PATCH] Remove stale code. --- .../pbjar/jxlayer/plaf/ext/MouseEventUI.java | 65 +++++-------- .../pbjar/jxlayer/plaf/ext/TransformUI.java | 91 ------------------- .../plaf/ext/transform/TransformRPMImpl.java | 7 -- .../jxlayer/repaint/RepaintManagerUtils.java | 9 -- 4 files changed, 22 insertions(+), 150 deletions(-) diff --git a/core/src/main/java/org/pbjar/jxlayer/plaf/ext/MouseEventUI.java b/core/src/main/java/org/pbjar/jxlayer/plaf/ext/MouseEventUI.java index 23e26df6..716f7c20 100644 --- a/core/src/main/java/org/pbjar/jxlayer/plaf/ext/MouseEventUI.java +++ b/core/src/main/java/org/pbjar/jxlayer/plaf/ext/MouseEventUI.java @@ -197,40 +197,23 @@ public class MouseEventUI extends AbstractLayerUI { Point point = mouseEvent.getPoint(); SwingUtilities.convertPointToScreen(point, mouseEvent.getComponent()); SwingUtilities.convertPointFromScreen(point, layer); - /* - * Removed the contains check because it results in jumping when - * dragging internal frames in a desktop pane and dragging outside the - * boundaries of the desktop. - * - * Introduced this check to solve some scrolling problem, but don't - * quite remember the specifics. Maybe that problem is gone by other - * changes. - */ - // Rectangle layerBounds = layer.getBounds(); - // Container parent = layer.getParent(); - // Rectangle parentRectangle = new Rectangle(-layerBounds.x, - // -layerBounds.y, parent.getWidth(), parent.getHeight()); - // if (parentRectangle.contains(point)) { + return transformPoint(layer, point); - // } else { - // return new Point(-1, -1); - // } } private MouseWheelEvent createMouseWheelEvent(final MouseWheelEvent mouseWheelEvent, final Point point, final Component target) { - return new MouseWheelEvent(target, // - mouseWheelEvent.getID(), // - mouseWheelEvent.getWhen(), // - mouseWheelEvent.getModifiersEx(), // - point.x, // - point.y, // - mouseWheelEvent.getClickCount(), // - mouseWheelEvent.isPopupTrigger(), // - mouseWheelEvent.getScrollType(), // - mouseWheelEvent.getScrollAmount(), // - mouseWheelEvent.getWheelRotation() // - ); + return new MouseWheelEvent(target, + mouseWheelEvent.getID(), + mouseWheelEvent.getWhen(), + mouseWheelEvent.getModifiersEx(), + point.x, + point.y, + mouseWheelEvent.getClickCount(), + mouseWheelEvent.isPopupTrigger(), + mouseWheelEvent.getScrollType(), + mouseWheelEvent.getScrollAmount(), + mouseWheelEvent.getWheelRotation()); } private void dispatchMouseEvent(final MouseEvent mouseEvent) { @@ -300,8 +283,6 @@ public class MouseEventUI extends AbstractLayerUI { } } - @SuppressWarnings("Duplicates") - private Component getMouseMotionListeningComponent(final Component component) { /* * Mouse motion events may result in MOUSE_ENTERED and MOUSE_EXITED. @@ -340,10 +321,8 @@ public class MouseEventUI extends AbstractLayerUI { if (view == null) { return null; } else { - Point viewPoint = SwingUtilities.convertPoint(layer, targetPoint, - view); - return SwingUtilities.getDeepestComponentAt(view, viewPoint.x, - viewPoint.y); + Point viewPoint = SwingUtilities.convertPoint(layer, targetPoint, view); + return SwingUtilities.getDeepestComponentAt(view, viewPoint.x, viewPoint.y); } } @@ -417,14 +396,14 @@ public class MouseEventUI extends AbstractLayerUI { Point newPoint = new Point(targetPoint); SwingUtilities.convertPointToScreen(newPoint, layer); SwingUtilities.convertPointFromScreen(newPoint, target); - return new MouseEvent(target, // - id, // - mouseEvent.getWhen(), // - mouseEvent.getModifiersEx(), // - newPoint.x, // - newPoint.y, // - mouseEvent.getClickCount(), // - mouseEvent.isPopupTrigger(), // + return new MouseEvent(target, + id, + mouseEvent.getWhen(), + mouseEvent.getModifiersEx(), + newPoint.x, + newPoint.y, + mouseEvent.getClickCount(), + mouseEvent.isPopupTrigger(), mouseEvent.getButton()); } } diff --git a/core/src/main/java/org/pbjar/jxlayer/plaf/ext/TransformUI.java b/core/src/main/java/org/pbjar/jxlayer/plaf/ext/TransformUI.java index 11b9cf75..94ae9deb 100644 --- a/core/src/main/java/org/pbjar/jxlayer/plaf/ext/TransformUI.java +++ b/core/src/main/java/org/pbjar/jxlayer/plaf/ext/TransformUI.java @@ -270,97 +270,6 @@ public class TransformUI extends MouseEventUI { : new AffineTransform(); } - /* - * {@inheritDoc} - *

- * This implementation does the following: - *

    - *
  1. - * A {@link BufferedImage} is created the size of the clip bounds of the - * argument graphics object.
  2. - *
  3. - * A Graphics object is obtained from the image.
  4. - *
  5. - * The image is filled with a background color.
  6. - *
  7. - * The image graphics is translated according to x and y of the clip bounds. - *
  8. - *
  9. - * The clip from the argument graphics object is set to the image graphics.
  10. - *
  11. - * {@link #configureGraphics(Graphics2D, JXLayer)} is invoked with the image - * graphics as an argument.
  12. - *
  13. - * {@link #paintLayer(Graphics2D, JXLayer)} is invoked with the image - * graphics as an argument.
  14. - *
  15. - * The image graphics is disposed.
  16. - *
  17. - * The image is drawn on the argument graphics object.
  18. - *
- */ - /* - * @SuppressWarnings("unchecked") - * - * @Override - * public final void paint(Graphics g, JComponent component) { - * Graphics2D g2 = (Graphics2D) g; - * JXLayer layer = (JXLayer) component; - * Shape clip = g2.getClip(); - * Rectangle clipBounds = g2.getClipBounds(); - * BufferedImage buffer = layer.getGraphicsConfiguration() - * .createCompatibleImage(clipBounds.width, clipBounds.height, - * Transparency.OPAQUE);// - * Graphics2D g3 = buffer.createGraphics(); - * try { - * g3.setColor(this.getBackgroundColor(layer)); - * g3.fillRect(0, 0, buffer.getWidth(), buffer.getHeight()); - * g3.translate(-clipBounds.x, -clipBounds.y); - * g3.setClip(clip); - * configureGraphics(g3, layer); - * paintLayer(g3, layer); - * } catch (Throwable t) { - */ - /* - * Under some rare circumstances, the graphics engine may throw a - * transformation exception like this: - * - * sun.dc.pr.PRError: setPenT4: invalid pen transformation - * (singular) - * - * As far as I understand this happens when the result of the - * transformation has a zero sized surface. - * - * It will happen for example when shear X and shear Y are both set - * to 1. - * - * It will also happen when scale X or scale Y are set to 0. - * - * Since this Exception only seems to be thrown under the condition - * of a zero sized painting surface, no harm is done. Therefore the - * error logging below has been commented out, but remain in the - * source for the case that someone wants to investigate this - * phenomenon in more depth. - * - * The Exception however MUST be caught, not only to be able dispose - * the image's graphics object, but also to prevent that JXLayer - * enters a problematic state (the isPainting flag would not be - * reset). - */ - // System.err.println(t); - // AffineTransform at = g3.getTransform(); - // System.err.println(at); - // System.err.println("scaleX = " + at.getScaleX() + " scaleY = " - // + at.getScaleY() + " shearX = " + at.getShearX() - // + " shearY = " + at.getShearY()); - /* - * } finally { - * g3.dispose(); - * } - * g2.drawImage(buffer, clipBounds.x, clipBounds.y, null); - * setDirty(false); - * } - */ /** * Overridden to replace the {@link LayoutManager}, to add some listeners and to ensure that an appropriate {@link * RepaintManager} is installed. diff --git a/core/src/main/java/org/pbjar/jxlayer/plaf/ext/transform/TransformRPMImpl.java b/core/src/main/java/org/pbjar/jxlayer/plaf/ext/transform/TransformRPMImpl.java index 612f8716..59eaad32 100644 --- a/core/src/main/java/org/pbjar/jxlayer/plaf/ext/transform/TransformRPMImpl.java +++ b/core/src/main/java/org/pbjar/jxlayer/plaf/ext/transform/TransformRPMImpl.java @@ -63,13 +63,6 @@ public final class TransformRPMImpl { */ public static final boolean hack = false; - static { - LOGGER.setUseParentHandlers(false); - ConsoleHandler handler = new ConsoleHandler(); - handler.setFormatter(new LogFormatter()); - LOGGER.addHandler(handler); - } - private TransformRPMImpl() {} /** diff --git a/core/src/main/java/org/pbjar/jxlayer/repaint/RepaintManagerUtils.java b/core/src/main/java/org/pbjar/jxlayer/repaint/RepaintManagerUtils.java index 1d8280a1..b0c201d9 100644 --- a/core/src/main/java/org/pbjar/jxlayer/repaint/RepaintManagerUtils.java +++ b/core/src/main/java/org/pbjar/jxlayer/repaint/RepaintManagerUtils.java @@ -57,13 +57,6 @@ public final class RepaintManagerUtils { */ private static final boolean swingX = isSwingXAvailable(); - static { - LOGGER.setUseParentHandlers(false); - ConsoleHandler handler = new ConsoleHandler(); - handler.setFormatter(new LogFormatter()); - LOGGER.addHandler(handler); - } - private RepaintManagerUtils() {} /** @@ -157,8 +150,6 @@ public final class RepaintManagerUtils { private static class DisplayAction extends AbstractAction { - private static final long serialVersionUID = 1L; - public DisplayAction() { super("RPM tree"); }