Browse Source

Remove stale code.

pull/187/head
weisj 5 years ago
parent
commit
22c351cda5
  1. 65
      core/src/main/java/org/pbjar/jxlayer/plaf/ext/MouseEventUI.java
  2. 91
      core/src/main/java/org/pbjar/jxlayer/plaf/ext/TransformUI.java
  3. 7
      core/src/main/java/org/pbjar/jxlayer/plaf/ext/transform/TransformRPMImpl.java
  4. 9
      core/src/main/java/org/pbjar/jxlayer/repaint/RepaintManagerUtils.java

65
core/src/main/java/org/pbjar/jxlayer/plaf/ext/MouseEventUI.java

@ -197,40 +197,23 @@ public class MouseEventUI<V extends JComponent> extends AbstractLayerUI<V> {
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<V extends JComponent> extends AbstractLayerUI<V> {
}
}
@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<V extends JComponent> extends AbstractLayerUI<V> {
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<V extends JComponent> extends AbstractLayerUI<V> {
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());
}
}

91
core/src/main/java/org/pbjar/jxlayer/plaf/ext/TransformUI.java

@ -270,97 +270,6 @@ public class TransformUI extends MouseEventUI<JComponent> {
: new AffineTransform();
}
/*
* {@inheritDoc}
* <p>
* This implementation does the following:
* <ol>
* <li>
* A {@link BufferedImage} is created the size of the clip bounds of the
* argument graphics object.</li>
* <li>
* A Graphics object is obtained from the image.</li>
* <li>
* The image is filled with a background color.</li>
* <li>
* The image graphics is translated according to x and y of the clip bounds.
* </li>
* <li>
* The clip from the argument graphics object is set to the image graphics.</li>
* <li>
* {@link #configureGraphics(Graphics2D, JXLayer)} is invoked with the image
* graphics as an argument.</li>
* <li>
* {@link #paintLayer(Graphics2D, JXLayer)} is invoked with the image
* graphics as an argument.</li>
* <li>
* The image graphics is disposed.</li>
* <li>
* The image is drawn on the argument graphics object.</li>
* </ol>
*/
/*
* @SuppressWarnings("unchecked")
*
* @Override
* public final void paint(Graphics g, JComponent component) {
* Graphics2D g2 = (Graphics2D) g;
* JXLayer<? extends JComponent> layer = (JXLayer<? extends JComponent>) 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.

7
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() {}
/**

9
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");
}

Loading…
Cancel
Save