Added: sis/ip-review/rev/01096/MouseReshapeTracker.xhtml URL: http://svn.apache.org/viewvc/sis/ip-review/rev/01096/MouseReshapeTracker.xhtml?rev=1884563&view=auto ============================================================================== --- sis/ip-review/rev/01096/MouseReshapeTracker.xhtml (added) +++ sis/ip-review/rev/01096/MouseReshapeTracker.xhtml Thu Dec 17 17:18:06 2020 @@ -0,0 +1,426 @@ + + + + + MouseReshapeTracker changes for revisions 1091:1096 + + + +
+

MouseReshapeTracker changes for revisions 1091:1096

+ +

Mostly reformatting, maybe done by some automatic tools. + The reformatting does not apply to Apache SIS since the code has been reformatted again. + Contains also a typo fix (isDraging renamed isDragging), + but that typo was already identified in a "TODO" comment.

+ +

Command line:

+
svn diff --extensions "--unified --ignore-space-change --ignore-all-space --ignore-eol-style" -r1091:1096 https://svn.osgeo.org/geotools/trunk/modules/extension/widgets-swing/src/main/java/org/geotools/gui/swing/MouseReshapeTracker.java
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Revision 1091Revision 1096
* }
+* </pre></blockquote>
+*
+* @version 1.0
+* @author Martin Desruisseaux
+*/
* }
+* </pre></blockquote>
+*
+* $Id: MouseReshapeTracker.java,v 1.3 2002/07/15 15:50:34 loxnard Exp $
+* @version 1.0
+* @author Martin Desruisseaux
+*/
 * Indicates if the user is currently dragging the rectangle.
+ * For this field to become <code>true</code>, the mouse must
+ * have been over the rectangle as the user pressed the mouse button.
+ * TODO: Replace all occurrences of "isDraging" with "isDragging".
+ */
+private transient boolean isDraging;
+
+/**
+ * Indicates which edges the user is currently adjusting with the mouse.
 * Indicates if the user is currently dragging the rectangle.
+ * For this field to become <code>true</code>, the mouse must
+ * have been over the rectangle as the user pressed the mouse button.
+ */
+private transient boolean isDragging;
+
+/**
+ * Indicates which edges the user is currently adjusting with the mouse.
 * in order to finish the construction of certain
+ * fields.
+ */
+private void readObject(final ObjectInputStream in) throws IOException, ClassNotFoundException {
+    drawnShape=logicalShape;
+    update();
+}
 * in order to finish the construction of certain
+ * fields.
+ */
+private void readObject(final ObjectInputStream in) throws IOException,
+                                                           ClassNotFoundException {
+    drawnShape=logicalShape;
+    update();
+}
    tmp.x = (i&1)==0 ? drawnShape.getMinX() : drawnShape.getMaxX();
+    tmp.y = (i&2)==0 ? drawnShape.getMinY() : drawnShape.getMaxY();
+    transform.transform(tmp, tmp);
+    if (tmp.x<xmin) xmin=tmp.x;
+    if (tmp.x>xmax) xmax=tmp.x;
+    if (tmp.y<ymin) ymin=tmp.y;
+    if (tmp.y>ymax) ymax=tmp.y;
+}
+x      = (int) Math.floor(xmin)      -1;
+y      = (int) Math.floor(ymin)      -1;
+width  = (int) Math.ceil (xmax-xmin) +2;
    tmp.x = (i&1)==0 ? drawnShape.getMinX() : drawnShape.getMaxX();
+    tmp.y = (i&2)==0 ? drawnShape.getMinY() : drawnShape.getMaxY();
+    transform.transform(tmp, tmp);
+    if (tmp.x < xmin) {
+        xmin = tmp.x;
+}
+    if (tmp.x > xmax) {
+        xmax = tmp.x;
+    }
+    if (tmp.y < ymin) {
+        ymin = tmp.y;
+    }
+    if (tmp.y > ymax) {
+        ymax = tmp.y;
+    }
+}
+x      = (int) Math.floor(xmin)      -1;
+y      = (int) Math.floor(ymin)      -1;
+width  = (int) Math.ceil (xmax-xmin) +2;
 * {@link #setClipMinMax setClipMinMax(...)} rather than
+ * <code>setClip(...)</code>.
+ */
+public final void setClip(final double x, final double y, final double width, final double height) {
+    setClipMinMax(x, x+width, y, y+height);
+}
 * {@link #setClipMinMax setClipMinMax(...)} rather than
+ * <code>setClip(...)</code>.
+ */
+public final void setClip(final double x, final double y, final double width,
+                          final double height) {
+    setClipMinMax(x, x+width, y, y+height);
+}
        final double tmp=ymin;
+        ymin=ymax; ymax=tmp;
+    }
+    if (!Double.isNaN(xmin)) this.xmin=xmin;
+    if (!Double.isNaN(xmax)) this.xmax=xmax;
+    if (!Double.isNaN(ymin)) this.ymin=ymin;
+    if (!Double.isNaN(ymax)) this.ymax=ymax;
+    setFrame(logicalShape.getX(), logicalShape.getY(), logicalShape.getWidth(), logicalShape.getHeight());
+}
+
+/**
+ * Method called automatically when a change in the clip is required.
        final double tmp=ymin;
+        ymin=ymax; ymax=tmp;
+    }
+    if (!Double.isNaN(xmin)) {
+        this.xmin = xmin;
+}
+    if (!Double.isNaN(xmax)) {
+        this.xmax = xmax;
+    }
+    if (!Double.isNaN(ymin)) {
+        this.ymin = ymin;
+    }
+    if (!Double.isNaN(ymax)) {
+        this.ymax = ymax;
+    }
+    setFrame(logicalShape.getX(), logicalShape.getY(), logicalShape.getWidth(),
+             logicalShape.getHeight());
+}
+
+/**
+ * Method called automatically when a change in the clip is required.
 */
+public void setAdjustable(int side, final boolean adjustable) {
+    side=convertSwingConstant(side);
+    if (adjustable) adjustableSides |=  side;
+    else            adjustableSides &= ~side;
+}
+
+/*
+ * Converts a Swing edge constant to system used by this package.
 */
+public void setAdjustable(int side, final boolean adjustable) {
+    side=convertSwingConstant(side);
+    if (adjustable) {
+        adjustableSides |=  side;
+}
+    else {
+        adjustableSides &= ~side;
+    }
+}
+
+/*
+ * Converts a Swing edge constant to system used by this package.
 * one of its edges, and adjusts the mouse pointer icon accordingly.
+ */
+public void mouseMoved(final MouseEvent event) {
+    if (!isDraging) {
+        final Component source=event.getComponent();
+        if (source!=null) {
+            int x=event.getX(); tmp.x=x;
 * one of its edges, and adjusts the mouse pointer icon accordingly.
+ */
+public void mouseMoved(final MouseEvent event) {
+    if (!isDragging) {
+        final Component source=event.getComponent();
+        if (source!=null) {
+            int x=event.getX(); tmp.x=x;
 */
+final int old=adjustingSides;
+adjustingSides=0;
+if (Math.abs(x-=this.x)     <=RESIZE_POS) adjustingSides |= WEST;
+if (Math.abs(y-=this.y)     <=RESIZE_POS) adjustingSides |= NORTH;
+if (Math.abs(x- this.width) <=RESIZE_POS) adjustingSides |= EAST;
+if (Math.abs(y- this.height)<=RESIZE_POS) adjustingSides |= SOUTH;
+
+adjustingSides &= adjustableSides;
+if (adjustingSides!=old || mouseOverRectChanged) {
 */
+final int old=adjustingSides;
+adjustingSides=0;
+if (Math.abs(x -= this.x)<=RESIZE_POS){
+    adjustingSides |= WEST;
+}
+if (Math.abs(y -= this.y)<=RESIZE_POS){
+    adjustingSides |= NORTH;
+}
+if (Math.abs(x - this.width)<=RESIZE_POS) {
+    adjustingSides |= EAST;
+}
+if (Math.abs(y - this.height)<=RESIZE_POS) {
+    adjustingSides |= SOUTH;
+}
+
+adjustingSides &= adjustableSides;
+if (adjustingSides!=old || mouseOverRectChanged) {
    }
+}
+if (mouseOverRectChanged) {
+    // Ajouter et retirer des 'listeners' marchait bien,  mais avait
+    // l'inconvénient de changer l'ordre des 'listeners'. Ca causait
+    // problème lorsque cet ordre était important.
+
+    //source.addMouseListener(this);
+    this.mouseOverRect=mouseOverRect;
    }
+}
+if (mouseOverRectChanged) {
+    // Adding and removing listeners worked well, but had
+    // the disadvantage of changing the order of the
+    // listeners. This caused problems when the order was
+    // important.
+
+    //source.addMouseListener(this);
+    this.mouseOverRect=mouseOverRect;
    if (drawnShape.contains(transform.inverseTransform(tmp,tmp))) {
+        mouseDX = tmp.x-drawnShape.getX();
+        mouseDY = tmp.y-drawnShape.getY();
+        isDraging=true;
+        e.consume();
+    }
+} catch (NoninvertibleTransformException exception) {
    if (drawnShape.contains(transform.inverseTransform(tmp,tmp))) {
+        mouseDX = tmp.x-drawnShape.getX();
+        mouseDY = tmp.y-drawnShape.getY();
+        isDragging = true;
+        e.consume();
+    }
+} catch (NoninvertibleTransformException exception) {
/**
+ * Method called automatically during mouse drags.  The default
+ * implementation applies the mouse movement to the rectangle and notifies
+ * the component where the event which it needs to redraw, at least in part,
+ * came from.
+ */
+public void mouseDragged(final MouseEvent e) {
+    if (isDraging) {
+        final int adjustingLogicalSides=this.adjustingLogicalSides;
+        final Component source=e.getComponent();
+        if (source!=null) try {
/**
+ * Method called automatically during mouse drags.  The default
+ * implementation applies the mouse movement to the rectangle and notifies
+ * the component where the event which it needs to redraw, at least in
+ * part, came from.
+ */
+public void mouseDragged(final MouseEvent e) {
+    if (isDragging) {
+        final int adjustingLogicalSides=this.adjustingLogicalSides;
+        final Component source=e.getComponent();
+        if (source!=null) try {
 */
+switch (adjustingLogicalSides & (EAST|WEST)) {
+    case WEST: {
+        if (x0<xmin) x0=xmin;
+        dx += drawnShape.getX()-x0;
+        if (!(dx>0)) {
+            dx=drawnShape.getWidth();
 */
+switch (adjustingLogicalSides & (EAST|WEST)) {
+    case WEST: {
+        if (x0 < xmin) {
+            x0 = xmin;
+        }
+        dx += drawnShape.getX()-x0;
+        if (!(dx>0)) {
+            dx=drawnShape.getWidth();
case EAST: {
+    dx += x0 - (x0=drawnShape.getX());
+    final double limit=xmax-x0;
+    if (dx>limit) dx=limit;
+    if (!(dx>0)) {
+        dx=drawnShape.getWidth();
+        x0=drawnShape.getX();
case EAST: {
+    dx += x0 - (x0=drawnShape.getX());
+    final double limit=xmax-x0;
+    if (dx > limit) {
+        dx = limit;
+    }
+    if (!(dx>0)) {
+        dx=drawnShape.getWidth();
+        x0=drawnShape.getX();
}
+switch (adjustingLogicalSides & (NORTH|SOUTH)) {
+    case NORTH: {
+        if (y0<ymin) y0=ymin;
+        dy += drawnShape.getY()-y0;
+        if (!(dy>0)) {
+            dy=drawnShape.getHeight();
}
+switch (adjustingLogicalSides & (NORTH|SOUTH)) {
+    case NORTH: {
+        if (y0 < ymin) {
+            y0=ymin;
+        }
+        dy += drawnShape.getY()-y0;
+        if (!(dy>0)) {
+            dy=drawnShape.getHeight();
    /*
+     * Adjustment for special cases.
+     */
+    if ((adjustingLogicalSides & EAST )!=0) mouseDX += (drawnShape.getWidth() -oldWidth);
+    if ((adjustingLogicalSides & SOUTH)!=0) mouseDY += (drawnShape.getHeight()-oldHeight);
+} catch (NoninvertibleTransformException exception) {
+    // Ignore.
+}
    /*
+     * Adjustment for special cases.
+     */
+    if ((adjustingLogicalSides & EAST) != 0) {
+        mouseDX += (drawnShape.getWidth() - oldWidth);
+    }
+    if ((adjustingLogicalSides & SOUTH) != 0) {
+        mouseDY += (drawnShape.getHeight() - oldHeight);
+    }
+} catch (NoninvertibleTransformException exception) {
+    // Ignore.
+}
 * that the changes are finished.
+ */
+public void mouseReleased(final MouseEvent event) {
+    if (isDraging && (event.getModifiers() & MouseEvent.BUTTON1_MASK)!=0) {
+        isDraging=false;
+        final Component source=event.getComponent();
+        try {
+            tmp.x=event.getX();
 * that the changes are finished.
+ */
+public void mouseReleased(final MouseEvent event) {
+    if (isDragging && (event.getModifiers() & MouseEvent.BUTTON1_MASK) != 0) {
+        isDragging = false;
+        final Component source=event.getComponent();
+        try {
+            tmp.x=event.getX();
    if (!mouseOverRect && source!=null) source.setCursor(null);
+    event.consume();
+} catch (NoninvertibleTransformException exception) {
+    // Ignore cette exception.
+} try {
+    // Il faut que 'isDraging=false'.
+    fireStateChanged();
+} catch (RuntimeException exception) {
+    ExceptionMonitor.show(source, exception);
    if (!mouseOverRect && source!=null) source.setCursor(null);
+    event.consume();
+} catch (NoninvertibleTransformException exception) {
+    // Ignore this exception.
+} try {
+    // It is essential that 'isDragging=false'.
+    fireStateChanged();
+} catch (RuntimeException exception) {
+    ExceptionMonitor.show(source, exception);
 * size of the visor has changed.
+ */
+private void fireStateWillChange() {
+    stateWillChange(isDraging);
+}
+
+/**
 * size of the visor has changed.
+ */
+private void fireStateWillChange() {
+    stateWillChange(isDragging);
+}
+
+/**
 */
+private void fireStateChanged() {
+    updateEditors();
+    stateChanged(isDraging);
+}
+
+/**
 */
+private void fireStateChanged() {
+    updateEditors();
+    stateChanged(isDragging);
+}
+
+/**
 * but it will do because it is unlikely that we will ever add more
+ * than 4 editors.
+ */
+final Control control=new Control(editor, (format instanceof DateFormat), convertSwingConstant(side), toRepaint);
+if (editors==null) {
+    editors = new Control[1];
+} else {
 * but it will do because it is unlikely that we will ever add more
+ * than 4 editors.
+ */
+final Control control = new Control(editor, (format instanceof DateFormat),
+                                    convertSwingConstant(side), toRepaint);
+if (editors==null) {
+    editors = new Control[1];
+} else {
 * @throws IllegalArgumentException if <code>axis</code>
+ *         isn't one of the valid codes.
+ */
+public void setEditorsSynchronized(final int axis, final boolean state) throws IllegalArgumentException {
+    switch (axis) {
+        case SwingConstants.HORIZONTAL: synchronizeX=state; break;
+        case SwingConstants.VERTICAL:   synchronizeY=state; break;
 * @throws IllegalArgumentException if <code>axis</code>
+ *         isn't one of the valid codes.
+ */
+public void setEditorsSynchronized(final int axis, final boolean state)
+                                   throws IllegalArgumentException {
+    switch (axis) {
+        case SwingConstants.HORIZONTAL: synchronizeX=state; break;
+        case SwingConstants.VERTICAL:   synchronizeY=state; break;
+
+ + Added: sis/ip-review/rev/01097/ExceptionMonitor.xhtml URL: http://svn.apache.org/viewvc/sis/ip-review/rev/01097/ExceptionMonitor.xhtml?rev=1884563&view=auto ============================================================================== --- sis/ip-review/rev/01097/ExceptionMonitor.xhtml (added) +++ sis/ip-review/rev/01097/ExceptionMonitor.xhtml Thu Dec 17 17:18:06 2020 @@ -0,0 +1,125 @@ + + + + + ExceptionMonitor changes for revisions 1090:1097 + + + +
+

ExceptionMonitor changes for revisions 1090:1097

+ +

Reformatting only, maybe done by some automatic tools. + Does not apply to Apache SIS since the code has been reformatted again.

+ +

Command line:

+
svn diff --extensions "--unified --ignore-space-change --ignore-all-space --ignore-eol-style" -r1090:1097 https://svn.osgeo.org/geotools/trunk/modules/extension/widgets-swing/src/main/java/org/geotools/gui/swing/ExceptionMonitor.java
+ + + + + + + + + + + + + + +
Revision 1090Revision 1097
* <i>Swing</i> component. The standard {@link java.lang.Exception} class
+* contains methods which write the exception to the error console.
+* This <code>ExceptionMonitor</code> class adds static methods which make
+* the message, and eventually the exception trace, appear in a
+* viewer component.
+*
+* <p>&nbsp;</p>
+* <p align="center"><img src="doc-files/ExceptionMonitor.png"></p>
+* <p>&nbsp;</p>
+*
+* @version 1.0
+* @author Martin Desruisseaux
+*/
* <i>Swing</i> component. The standard {@link java.lang.Exception} class
+* contains methods which write the exception to the error console.
+* This <code>ExceptionMonitor</code> class adds static methods which make
+* the message, and eventually the exception trace, appear in a viewer
+* component.
+*
+* <p>&nbsp;</p>
+* <p align="center"><img src="doc-files/ExceptionMonitor.png"></p>
+* <p>&nbsp;</p>
+*
+* $Id: ExceptionMonitor.java,v 1.3 2002/07/15 15:52:38 loxnard Exp $
+* @version 1.0
+* @author Martin Desruisseaux
+*/
 *        transform, default colour, etc...)
+ * @param widgetBounds Size of the trace which was being drawn.
+ */
+public static void paintStackTrace(final Graphics2D graphics, final Rectangle widgetBounds, final Throwable exception) {
+    /*
+     * Obtains the exception trace in the form of a character chain.
+     * The carriage returns in this chain can be "\r", "\n" or "r\n".
 *        transform, default colour, etc...)
+ * @param widgetBounds Size of the trace which was being drawn.
+ */
+public static void paintStackTrace(final Graphics2D graphics, final Rectangle widgetBounds,
+                                   final Throwable exception) {
+    /*
+     * Obtains the exception trace in the form of a character chain.
+     * The carriage returns in this chain can be "\r", "\n" or "r\n".
* Class in charge of displaying any exception messages and eventually
+* their traces. The message will appear in a dialog box or in an
+* internal window, depending on the parent.
+* <strong>Note:</strong> All methods in this class must be called in the same
+* thread as the <i>Swing</i> thread.
+*
+* @version 1.0
+* @author Martin Desruisseaux
* Class in charge of displaying any exception messages and eventually
+* their traces. The message will appear in a dialog box or in an
+* internal window, depending on the parent.
+* <strong>Note:</strong> All methods in this class must be called in the
+* same thread as the <i>Swing</i> thread.
+*
+* @version 1.0
+* @author Martin Desruisseaux
textArea.setWrapStyleWord(true);
+textArea.setBackground(null);
+textArea.setBorder(null); // Certain L&Fs have a border.
+/**
+ * Constructs the rest of the dialog box.  The title bar will
+ * contain the name of the exception class.
textArea.setWrapStyleWord(true);
+textArea.setBackground(null);
+textArea.setBorder(null); // Certain L&Fs have a border.
+
+/**
+ * Constructs the rest of the dialog box.  The title bar will
+ * contain the name of the exception class.
JComponent traceComponent=null;
+for (Throwable cause  = exception;
+               cause != null;
+               cause  = cause.getCause())
+{
+    final JTextArea text=new JTextArea(1, WIDTH);
+    text.setTabSize(4);
+    text.setText(printStackTrace(cause));
JComponent traceComponent=null;
+for (Throwable cause  = exception;
+               cause != null;
+cause  = cause.getCause()) {
+    final JTextArea text=new JTextArea(1, WIDTH);
+    text.setTabSize(4);
+    text.setText(printStackTrace(cause));
if (traceComponent!=null) {
+    if (!(traceComponent instanceof JTabbedPane)) {
+        String classname = Utilities.getShortClassName(exception);
+        JTabbedPane tabs = new JTabbedPane(JTabbedPane.TOP, JTabbedPane.SCROLL_TAB_LAYOUT);
+        tabs.addTab(classname, traceComponent);
+        traceComponent = tabs;
+    }
if (traceComponent!=null) {
+    if (!(traceComponent instanceof JTabbedPane)) {
+        String classname = Utilities.getShortClassName(exception);
+        JTabbedPane tabs = new JTabbedPane(JTabbedPane.TOP,
+                                           JTabbedPane.SCROLL_TAB_LAYOUT);
+        tabs.addTab(classname, traceComponent);
+        traceComponent = tabs;
+    }
+
+ + Added: sis/ip-review/rev/01097/HEADER.html URL: http://svn.apache.org/viewvc/sis/ip-review/rev/01097/HEADER.html?rev=1884563&view=auto ============================================================================== --- sis/ip-review/rev/01097/HEADER.html (added) +++ sis/ip-review/rev/01097/HEADER.html Thu Dec 17 17:18:06 2020 @@ -0,0 +1,17 @@ + + + + + Revision 1097 + + +
+

Revision 1097

+ + + + +
Author:loxnard
Date:2002-07-15
Message:Updated Javadocs
+
+ + Added: sis/ip-review/rev/01188/HEADER.html URL: http://svn.apache.org/viewvc/sis/ip-review/rev/01188/HEADER.html?rev=1884563&view=auto ============================================================================== --- sis/ip-review/rev/01188/HEADER.html (added) +++ sis/ip-review/rev/01188/HEADER.html Thu Dec 17 17:18:06 2020 @@ -0,0 +1,17 @@ + + + + + Revision 1188 + + +
+

Revision 1188

+ + + + +
Author:jmacgill
Date:2002-07-22
Message:made setVisibableArea non final for now as MapPane needs to use it.
+
+ +