diff --git a/org.jhotdraw8.application/src/main/java/org.jhotdraw8.application/org/jhotdraw8/application/AbstractApplication.java b/org.jhotdraw8.application/src/main/java/org.jhotdraw8.application/org/jhotdraw8/application/AbstractApplication.java index c130cd71b..2137af532 100755 --- a/org.jhotdraw8.application/src/main/java/org.jhotdraw8.application/org/jhotdraw8/application/AbstractApplication.java +++ b/org.jhotdraw8.application/src/main/java/org.jhotdraw8.application/org/jhotdraw8/application/AbstractApplication.java @@ -10,6 +10,7 @@ import javafx.beans.property.ReadOnlyBooleanProperty; import javafx.beans.property.ReadOnlyBooleanWrapper; import javafx.beans.property.ReadOnlyListProperty; +import javafx.beans.property.ReadOnlyListWrapper; import javafx.beans.property.ReadOnlyMapProperty; import javafx.beans.property.ReadOnlyMapWrapper; import javafx.beans.property.ReadOnlySetProperty; @@ -59,7 +60,7 @@ public abstract class AbstractApplication extends javafx.application.Application private final @NonNull ReadOnlyMapProperty actions = new ReadOnlyMapWrapper(this, ACTIONS_PROPERTY, FXCollections.observableMap(new LinkedHashMap<>())).getReadOnlyProperty(); private final @NonNull ReadOnlySetProperty activities = new ReadOnlySetWrapper(this, ACTIVITIES_PROPERTY, FXCollections.observableSet(new LinkedHashSet<>())).getReadOnlyProperty(); - private final @NonNull ReadOnlyListProperty stylesheets = new javafx.beans.property.ReadOnlyListWrapper(this, STYLESHEETS_PROPERTY, FXCollections.observableArrayList()).getReadOnlyProperty(); + private final @NonNull ReadOnlyListProperty stylesheets = new ReadOnlyListWrapper(this, STYLESHEETS_PROPERTY, FXCollections.observableArrayList()).getReadOnlyProperty(); private final @NonNull ObjectProperty> activityFactory = new SimpleObjectProperty<>(this, ACTIVITY_FACTORY_PROPERTY); private final @NonNull ObjectProperty> menuFactory = new SimpleObjectProperty<>(this, MENU_BAR_FACTORY_PROPERTY); diff --git a/org.jhotdraw8.application/src/main/java/org.jhotdraw8.application/org/jhotdraw8/application/resources/ClasspathResources.java b/org.jhotdraw8.application/src/main/java/org.jhotdraw8.application/org/jhotdraw8/application/resources/ClasspathResources.java index c320c2dbc..5670b8058 100755 --- a/org.jhotdraw8.application/src/main/java/org.jhotdraw8.application/org/jhotdraw8/application/resources/ClasspathResources.java +++ b/org.jhotdraw8.application/src/main/java/org.jhotdraw8.application/org/jhotdraw8/application/resources/ClasspathResources.java @@ -161,7 +161,7 @@ public Object getModule() { * * @param baseName the base name * @return the resource bundle - * @see java.util.ResourceBundle + * @see ResourceBundle */ public static @NonNull Resources getResources(@NonNull String baseName) throws MissingResourceException { @@ -174,7 +174,7 @@ public Object getModule() { * @param baseName the base name * @param locale the locale * @return the resource bundle - * @see java.util.ResourceBundle + * @see ResourceBundle */ static Resources getResources(@NonNull String baseName, @NonNull Locale locale) throws MissingResourceException { diff --git a/org.jhotdraw8.application/src/main/java/org.jhotdraw8.application/org/jhotdraw8/application/resources/Resources.java b/org.jhotdraw8.application/src/main/java/org.jhotdraw8.application/org/jhotdraw8/application/resources/Resources.java index 39cc7629b..5aa5f5ed7 100755 --- a/org.jhotdraw8.application/src/main/java/org.jhotdraw8.application/org/jhotdraw8/application/resources/Resources.java +++ b/org.jhotdraw8.application/src/main/java/org.jhotdraw8.application/org/jhotdraw8/application/resources/Resources.java @@ -190,7 +190,7 @@ default void configureToolBarButton(@NonNull ButtonBase button, String argument, boolean containsKey(String key); /** - * Returns a formatted string using {@link java.util.Formatter}. + * Returns a formatted string using {@link Formatter}. * * @param key the key * @param arguments the arguments @@ -201,7 +201,7 @@ default void configureToolBarButton(@NonNull ButtonBase button, String argument, } /** - * Returns a formatted string using {@link java.text.MessageFormat}. + * Returns a formatted string using {@link MessageFormat}. * * @param key the key * @param arguments the arguments diff --git a/org.jhotdraw8.base/src/main/java/org.jhotdraw8.base/org/jhotdraw8/base/converter/CaseInsensitiveMappedConverter.java b/org.jhotdraw8.base/src/main/java/org.jhotdraw8.base/org/jhotdraw8/base/converter/CaseInsensitiveMappedConverter.java index f83d69e9c..ab882a29a 100755 --- a/org.jhotdraw8.base/src/main/java/org.jhotdraw8.base/org/jhotdraw8/base/converter/CaseInsensitiveMappedConverter.java +++ b/org.jhotdraw8.base/src/main/java/org.jhotdraw8.base/org/jhotdraw8/base/converter/CaseInsensitiveMappedConverter.java @@ -27,7 +27,7 @@ public CaseInsensitiveMappedConverter(@NonNull Map fromStringMap) { } @Override - public @Nullable E fromString(@NonNull CharBuffer in, @Nullable IdResolver idResolver) throws ParseException, IOException { + public @Nullable E fromString(@NonNull CharBuffer in, @Nullable IdResolver idResolver) throws ParseException { if (in == null) { throw new ParseException("Illegal value=null", 0); } diff --git a/org.jhotdraw8.base/src/main/java/org.jhotdraw8.base/org/jhotdraw8/base/converter/Converter.java b/org.jhotdraw8.base/src/main/java/org.jhotdraw8.base/org/jhotdraw8/base/converter/Converter.java index 40df99cff..cb0539b24 100755 --- a/org.jhotdraw8.base/src/main/java/org.jhotdraw8.base/org/jhotdraw8/base/converter/Converter.java +++ b/org.jhotdraw8.base/src/main/java/org.jhotdraw8.base/org/jhotdraw8/base/converter/Converter.java @@ -36,12 +36,12 @@ public interface Converter { * @param idResolver The factory for looking up object ids. Nullable for some * converters. * @return The value. Nullable. - * @throws ParseException if conversion failed. The error offset field is - * set to the position where parsing failed. The position of the buffer is - * undefined. - * @throws java.io.IOException Thrown by the CharBuffer. + * @throws ParseException if conversion failed. The error offset field is + * set to the position where parsing failed. The position of the buffer is + * undefined. + * @throws IOException Thrown by the CharBuffer. */ - default @Nullable T fromString(@NonNull CharSequence in, @Nullable IdResolver idResolver) throws ParseException, IOException { + default @Nullable T fromString(@NonNull CharSequence in, @Nullable IdResolver idResolver) throws ParseException { return fromString(CharBuffer.wrap(in), idResolver); } @@ -60,13 +60,13 @@ public interface Converter { * @param idResolver The factory for looking up object ids. Nullable for non-resolving * converters. * @return The value. Nullable. - * @throws ParseException if conversion failed. The error offset field is - * set to the position where parsing failed. The position of the buffer is - * undefined. - * @throws java.io.IOException Thrown by the CharBuffer. + * @throws ParseException if conversion failed. The error offset field is + * set to the position where parsing failed. The position of the buffer is + * undefined. + * @throws IOException Thrown by the CharBuffer. */ @Nullable - T fromString(@NonNull CharBuffer in, @Nullable IdResolver idResolver) throws ParseException, IOException; + T fromString(@NonNull CharBuffer in, @Nullable IdResolver idResolver) throws ParseException; /** * Converts a value to a string and appends it to the provided @@ -79,7 +79,7 @@ public interface Converter { * @param idSupplier The factory for creating object ids. Nullable for non-resolving * converters. * @param value The value. Nullable. - * @throws java.io.IOException thrown by Appendable + * @throws IOException thrown by Appendable */ void toString(Appendable out, @Nullable IdSupplier idSupplier, @Nullable TT value) throws IOException; @@ -96,12 +96,12 @@ public interface Converter { * beginning of the string when this method is invoked. After completion of * this method, the position is set after the last consumed character. * @return The value. Nullable. - * @throws ParseException if conversion failed. The error offset field is - * set to the position where parsing failed. The position of the buffer is - * undefined. - * @throws java.io.IOException Thrown by the CharBuffer. + * @throws ParseException if conversion failed. The error offset field is + * set to the position where parsing failed. The position of the buffer is + * undefined. + * @throws IOException Thrown by the CharBuffer. */ - default @Nullable T fromString(@NonNull CharBuffer in) throws ParseException, IOException { + default @Nullable T fromString(@NonNull CharBuffer in) throws ParseException { return fromString(in, null); } @@ -121,7 +121,7 @@ public interface Converter { * @throws ParseException on conversion failure * @throws IOException on IO failure */ - default @Nullable T fromString(@NonNull CharSequence in) throws ParseException, IOException { + default @Nullable T fromString(@NonNull CharSequence in) throws ParseException { CharBuffer buf = CharBuffer.wrap(in); T value = fromString(buf); if (buf.remaining() != 0) { @@ -184,7 +184,7 @@ public interface Converter { * @param the value type * @param out The appendable * @param value The value. Nullable. - * @throws java.io.IOException thrown by Appendable + * @throws IOException thrown by Appendable */ default void toString(@NonNull Appendable out, @Nullable TT value) throws IOException { toString(out, null, value); @@ -212,6 +212,28 @@ default void toString(@NonNull Appendable out, @Nullable TT value return out.toString(); } + /** + * Converts a value to a String. + *

+ * This method does not change the state of the converter. + *

+ * Note: this is a convenience method. Implementing classes rarely need to + * overwrite this method. + * + * @param the value type + * @param value The value. Nullable. + * @return The String. + */ + default @NonNull String toString(@Nullable IdSupplier idSupplier, @Nullable TT value) { + StringBuilder out = new StringBuilder(); + try { + toString(out, idSupplier, value); + } catch (IOException ex) { + throw new RuntimeException(ex); + } + return out.toString(); + } + default boolean needsIdResolver() { return false; } diff --git a/org.jhotdraw8.base/src/main/java/org.jhotdraw8.base/org/jhotdraw8/base/converter/DefaultConverter.java b/org.jhotdraw8.base/src/main/java/org.jhotdraw8.base/org/jhotdraw8/base/converter/DefaultConverter.java index 574c02523..bb89390ab 100755 --- a/org.jhotdraw8.base/src/main/java/org.jhotdraw8.base/org/jhotdraw8/base/converter/DefaultConverter.java +++ b/org.jhotdraw8.base/src/main/java/org.jhotdraw8.base/org/jhotdraw8/base/converter/DefaultConverter.java @@ -35,7 +35,7 @@ public DefaultConverter() { } @Override - public @Nullable Object fromString(@NonNull CharBuffer buf, @Nullable IdResolver idResolver) throws ParseException, IOException { + public @Nullable Object fromString(@NonNull CharBuffer buf, @Nullable IdResolver idResolver) throws ParseException { String str = buf.toString(); buf.position(buf.limit()); return "null".equals(str) ? null : str; diff --git a/org.jhotdraw8.base/src/main/java/org.jhotdraw8.base/org/jhotdraw8/base/converter/DoubleConverter.java b/org.jhotdraw8.base/src/main/java/org.jhotdraw8.base/org/jhotdraw8/base/converter/DoubleConverter.java index bd5bd8b39..3131514ed 100644 --- a/org.jhotdraw8.base/src/main/java/org.jhotdraw8.base/org/jhotdraw8/base/converter/DoubleConverter.java +++ b/org.jhotdraw8.base/src/main/java/org.jhotdraw8.base/org/jhotdraw8/base/converter/DoubleConverter.java @@ -38,7 +38,7 @@ public DoubleConverter(boolean nullable, DecimalFormat decimalFormat, DecimalFor } @Override - public @Nullable Double fromString(@NonNull CharBuffer in, @Nullable IdResolver idResolver) throws ParseException, IOException { + public @Nullable Double fromString(@NonNull CharBuffer in, @Nullable IdResolver idResolver) throws ParseException { try { if (in.isEmpty() && nullable) return null; var result = Double.parseDouble(in.toString()); diff --git a/org.jhotdraw8.base/src/main/java/org.jhotdraw8.base/org/jhotdraw8/base/converter/FloatConverter.java b/org.jhotdraw8.base/src/main/java/org.jhotdraw8.base/org/jhotdraw8/base/converter/FloatConverter.java index a34696002..5145d16c7 100644 --- a/org.jhotdraw8.base/src/main/java/org.jhotdraw8.base/org/jhotdraw8/base/converter/FloatConverter.java +++ b/org.jhotdraw8.base/src/main/java/org.jhotdraw8.base/org/jhotdraw8/base/converter/FloatConverter.java @@ -30,7 +30,7 @@ public FloatConverter(boolean nullable) { } @Override - public @Nullable Float fromString(@NonNull CharBuffer in, @Nullable IdResolver idResolver) throws ParseException, IOException { + public @Nullable Float fromString(@NonNull CharBuffer in, @Nullable IdResolver idResolver) throws ParseException { try { if (in.isEmpty() && nullable) return null; var result = Float.parseFloat(in.toString()); diff --git a/org.jhotdraw8.base/src/main/java/org.jhotdraw8.base/org/jhotdraw8/base/converter/FormatConverterAdapter.java b/org.jhotdraw8.base/src/main/java/org.jhotdraw8.base/org/jhotdraw8/base/converter/FormatConverterAdapter.java index 2543f7fb4..774a392b5 100755 --- a/org.jhotdraw8.base/src/main/java/org.jhotdraw8.base/org/jhotdraw8/base/converter/FormatConverterAdapter.java +++ b/org.jhotdraw8.base/src/main/java/org.jhotdraw8.base/org/jhotdraw8/base/converter/FormatConverterAdapter.java @@ -7,7 +7,6 @@ import org.jhotdraw8.annotation.NonNull; import org.jhotdraw8.annotation.Nullable; -import java.io.IOException; import java.io.Serial; import java.nio.CharBuffer; import java.text.FieldPosition; @@ -49,8 +48,6 @@ public FormatConverterAdapter(Converter converter) { } catch (ParseException ex) { pos.setErrorIndex(ex.getErrorOffset()); return null; - } catch (IOException ex) { - return null; } } } diff --git a/org.jhotdraw8.base/src/main/java/org.jhotdraw8.base/org/jhotdraw8/base/converter/IdResolver.java b/org.jhotdraw8.base/src/main/java/org.jhotdraw8.base/org/jhotdraw8/base/converter/IdResolver.java index e5f64d367..616d623b3 100644 --- a/org.jhotdraw8.base/src/main/java/org.jhotdraw8.base/org/jhotdraw8/base/converter/IdResolver.java +++ b/org.jhotdraw8.base/src/main/java/org.jhotdraw8.base/org/jhotdraw8/base/converter/IdResolver.java @@ -14,8 +14,8 @@ public interface IdResolver { * Gets the object for the specified id. Returns null if the id has no * object. * - * @param id the id - * @return the object + * @param id the id or null + * @return the object if present */ @Nullable Object getObject(@Nullable String id); @@ -24,8 +24,8 @@ public interface IdResolver { * Returns null if the id has no object of this type. * * @param clazz the clazz - * @param id the id - * @return the object + * @param id the id or null + * @return the object if present with the specified type */ default @Nullable T getObject(@NonNull Class clazz, @Nullable String id) { Object object = getObject(id); @@ -47,5 +47,4 @@ public interface IdResolver { * @return an internal URI (typically an absolute path) */ @NonNull URI absolutize(@NonNull URI uri); - } diff --git a/org.jhotdraw8.base/src/main/java/org.jhotdraw8.base/org/jhotdraw8/base/converter/IntegerConverter.java b/org.jhotdraw8.base/src/main/java/org.jhotdraw8.base/org/jhotdraw8/base/converter/IntegerConverter.java index 0c470e3fb..f5fa0bf53 100644 --- a/org.jhotdraw8.base/src/main/java/org.jhotdraw8.base/org/jhotdraw8/base/converter/IntegerConverter.java +++ b/org.jhotdraw8.base/src/main/java/org.jhotdraw8.base/org/jhotdraw8/base/converter/IntegerConverter.java @@ -22,7 +22,7 @@ public IntegerConverter(boolean nullable) { } @Override - public @Nullable Integer fromString(@NonNull CharBuffer in, @Nullable IdResolver idResolver) throws ParseException, IOException { + public @Nullable Integer fromString(@NonNull CharBuffer in, @Nullable IdResolver idResolver) throws ParseException { try { if (in.isEmpty() && nullable) return null; var result = Integer.parseInt(in.toString()); diff --git a/org.jhotdraw8.base/src/main/java/org.jhotdraw8.base/org/jhotdraw8/base/converter/MappedConverter.java b/org.jhotdraw8.base/src/main/java/org.jhotdraw8.base/org/jhotdraw8/base/converter/MappedConverter.java index eeb093f5b..24964d599 100755 --- a/org.jhotdraw8.base/src/main/java/org.jhotdraw8.base/org/jhotdraw8/base/converter/MappedConverter.java +++ b/org.jhotdraw8.base/src/main/java/org.jhotdraw8.base/org/jhotdraw8/base/converter/MappedConverter.java @@ -43,7 +43,7 @@ public MappedConverter(@NonNull Map fromStringMap, String nullValue) } @Override - public @Nullable E fromString(@NonNull CharBuffer in, @Nullable IdResolver idResolver) throws ParseException, IOException { + public @Nullable E fromString(@NonNull CharBuffer in, @Nullable IdResolver idResolver) throws ParseException { if (in == null) { throw new ParseException("Illegal value=null", 0); } diff --git a/org.jhotdraw8.base/src/main/java/org.jhotdraw8.base/org/jhotdraw8/base/io/StreamPosTokenizer.java b/org.jhotdraw8.base/src/main/java/org.jhotdraw8.base/org/jhotdraw8/base/io/StreamPosTokenizer.java index d6b90ba51..96c9b30e2 100755 --- a/org.jhotdraw8.base/src/main/java/org.jhotdraw8.base/org/jhotdraw8/base/io/StreamPosTokenizer.java +++ b/org.jhotdraw8.base/src/main/java/org.jhotdraw8.base/org/jhotdraw8/base/io/StreamPosTokenizer.java @@ -983,7 +983,7 @@ public int nextToken() throws IOException { * tokenizer. * * @return the next char - * @throws java.io.IOException in case of an IO error + * @throws IOException in case of an IO error */ public int nextChar() throws IOException { if (pushedBack) { @@ -1002,7 +1002,7 @@ public int nextChar() throws IOException { * Unreads a character back into the input stream of the tokenizer. * * @param ch The character - * @throws java.io.IOException in case of an IO error + * @throws IOException in case of an IO error */ public void pushCharBack(int ch) throws IOException { if (pushedBack) { diff --git a/org.jhotdraw8.color/src/main/java/org.jhotdraw8.color/org/jhotdraw8/color/ParametricHsvColorSpace.java b/org.jhotdraw8.color/src/main/java/org.jhotdraw8.color/org/jhotdraw8/color/ParametricHsvColorSpace.java index 5c96a6a91..9e7222648 100755 --- a/org.jhotdraw8.color/src/main/java/org.jhotdraw8.color/org/jhotdraw8/color/ParametricHsvColorSpace.java +++ b/org.jhotdraw8.color/src/main/java/org.jhotdraw8.color/org/jhotdraw8/color/ParametricHsvColorSpace.java @@ -90,7 +90,7 @@ public float getMaxValue(int component) { r = g = b = value; } else { float h = (float) (hue - Math.floor(hue)) * 6; - float f = h - (float) java.lang.Math.floor(h); + float f = h - (float) Math.floor(h); float p = value * (1f - saturation); float q = value * (1f - saturation * f); float t = value * (1f - (saturation * (1f - f))); diff --git a/org.jhotdraw8.css/src/main/java/org.jhotdraw8.css/org/jhotdraw8/css/converter/StringOrIdentCssConverter.java b/org.jhotdraw8.css/src/main/java/org.jhotdraw8.css/org/jhotdraw8/css/converter/StringOrIdentCssConverter.java index 4d5bfbfce..2ae4613a0 100755 --- a/org.jhotdraw8.css/src/main/java/org.jhotdraw8.css/org/jhotdraw8/css/converter/StringOrIdentCssConverter.java +++ b/org.jhotdraw8.css/src/main/java/org.jhotdraw8.css/org/jhotdraw8/css/converter/StringOrIdentCssConverter.java @@ -28,10 +28,16 @@ public StringOrIdentCssConverter() { } @Override - public @Nullable String fromString(@NonNull CharBuffer buf, @Nullable IdResolver idResolver) throws ParseException, IOException { + public @Nullable String fromString(@NonNull CharBuffer buf, @Nullable IdResolver idResolver) throws ParseException { StreamCssTokenizer tt = new StreamCssTokenizer(new CharBufferReader(buf), null); - if (tt.next() != CssTokenType.TT_STRING && tt.current() != CssTokenType.TT_IDENT) { - throw new ParseException("Css String or Ident expected. " + tt.current(), buf.position()); + try { + if (tt.next() != CssTokenType.TT_STRING && tt.current() != CssTokenType.TT_IDENT) { + throw new ParseException("Css String or Ident expected. " + tt.current(), buf.position()); + } + } catch (IOException e) { + ParseException parseException = new ParseException(e.getMessage(), 0); + parseException.initCause(e); + throw parseException; } return tt.currentString(); } diff --git a/org.jhotdraw8.css/src/main/java/org.jhotdraw8.css/org/jhotdraw8/css/converter/WordCssConverter.java b/org.jhotdraw8.css/src/main/java/org.jhotdraw8.css/org/jhotdraw8/css/converter/WordCssConverter.java index d5daecd08..d3d120ef4 100755 --- a/org.jhotdraw8.css/src/main/java/org.jhotdraw8.css/org/jhotdraw8/css/converter/WordCssConverter.java +++ b/org.jhotdraw8.css/src/main/java/org.jhotdraw8.css/org/jhotdraw8/css/converter/WordCssConverter.java @@ -39,7 +39,7 @@ public void toString(@NonNull Appendable out, @Nullable IdSupplier idSupplier, @ } @Override - public @NonNull String fromString(@NonNull CharBuffer in, @Nullable IdResolver idResolver) throws ParseException, IOException { + public @NonNull String fromString(@NonNull CharBuffer in, @Nullable IdResolver idResolver) throws ParseException { int pos = in.position(); StringBuilder out = new StringBuilder(); while (in.remaining() > 0 && !Character.isWhitespace(in.charAt(0))) { diff --git a/org.jhotdraw8.draw/src/main/java/org.jhotdraw8.draw/org/jhotdraw8/draw/action/AbstractDrawingViewAction.java b/org.jhotdraw8.draw/src/main/java/org.jhotdraw8.draw/org/jhotdraw8/draw/action/AbstractDrawingViewAction.java index 5a4c03a38..3e6beb3a3 100755 --- a/org.jhotdraw8.draw/src/main/java/org.jhotdraw8.draw/org/jhotdraw8/draw/action/AbstractDrawingViewAction.java +++ b/org.jhotdraw8.draw/src/main/java/org.jhotdraw8.draw/org/jhotdraw8/draw/action/AbstractDrawingViewAction.java @@ -19,7 +19,7 @@ /** * This abstract class can be extended to implement an {@code Action} that acts * on behalf of the selected figures of a - * {@link org.jhotdraw8.draw.DrawingView}. + * {@link DrawingView}. *

* By default the disabled state of this action reflects the disabled state of * the active {@code DrawingView}. If no drawing view is active, this action is diff --git a/org.jhotdraw8.draw/src/main/java/org.jhotdraw8.draw/org/jhotdraw8/draw/constrain/Constrainer.java b/org.jhotdraw8.draw/src/main/java/org.jhotdraw8.draw/org/jhotdraw8/draw/constrain/Constrainer.java index b3030bde8..bbfb149f9 100755 --- a/org.jhotdraw8.draw/src/main/java/org.jhotdraw8.draw/org/jhotdraw8/draw/constrain/Constrainer.java +++ b/org.jhotdraw8.draw/src/main/java/org.jhotdraw8.draw/org/jhotdraw8/draw/constrain/Constrainer.java @@ -15,7 +15,7 @@ * A constrainer constrains editing operations performed by * {@link org.jhotdraw8.draw.tool.Tool}s and * {@link org.jhotdraw8.draw.handle.Handle}s on a - * {@link org.jhotdraw8.draw.DrawingView}. + * {@link DrawingView}. *

* {@code Constrainer} objects are associated to {@code DrawingView}'s. *

diff --git a/org.jhotdraw8.draw/src/main/java/org.jhotdraw8.draw/org/jhotdraw8/draw/css/value/CssColor.java b/org.jhotdraw8.draw/src/main/java/org.jhotdraw8.draw/org/jhotdraw8/draw/css/value/CssColor.java index b0b38a1f1..e653ed867 100755 --- a/org.jhotdraw8.draw/src/main/java/org.jhotdraw8.draw/org/jhotdraw8/draw/css/value/CssColor.java +++ b/org.jhotdraw8.draw/src/main/java/org.jhotdraw8.draw/org/jhotdraw8/draw/css/value/CssColor.java @@ -12,7 +12,6 @@ import org.jhotdraw8.draw.css.converter.ColorCssConverter; import org.jhotdraw8.draw.render.RenderContext; -import java.io.IOException; import java.text.ParseException; import java.util.Objects; @@ -136,7 +135,7 @@ public boolean equals(@Nullable Object obj) { public static @NonNull CssColor valueOf(@NonNull String value) { try { return converter.fromString(value); - } catch (ParseException | IOException e) { + } catch (ParseException e) { return new NamedCssColor(value, Color.BLACK); } } diff --git a/org.jhotdraw8.draw/src/main/java/org.jhotdraw8.draw/org/jhotdraw8/draw/figure/AbstractElbowLineConnectionWithMarkersFigure.java b/org.jhotdraw8.draw/src/main/java/org.jhotdraw8.draw/org/jhotdraw8/draw/figure/AbstractElbowLineConnectionWithMarkersFigure.java index 39ee2c997..373028d03 100755 --- a/org.jhotdraw8.draw/src/main/java/org.jhotdraw8.draw/org/jhotdraw8/draw/figure/AbstractElbowLineConnectionWithMarkersFigure.java +++ b/org.jhotdraw8.draw/src/main/java/org.jhotdraw8.draw/org/jhotdraw8/draw/figure/AbstractElbowLineConnectionWithMarkersFigure.java @@ -6,6 +6,7 @@ import javafx.collections.ObservableList; import javafx.geometry.Point2D; +import javafx.scene.Group; import javafx.scene.Node; import javafx.scene.shape.Path; import javafx.scene.shape.PathElement; @@ -18,10 +19,21 @@ import org.jhotdraw8.css.value.UnitConverter; import org.jhotdraw8.draw.connector.Connector; import org.jhotdraw8.draw.css.value.CssPoint2D; -import org.jhotdraw8.draw.handle.*; +import org.jhotdraw8.draw.handle.Handle; +import org.jhotdraw8.draw.handle.HandleType; +import org.jhotdraw8.draw.handle.LineConnectorHandle; +import org.jhotdraw8.draw.handle.LineOutlineHandle; +import org.jhotdraw8.draw.handle.MoveHandle; +import org.jhotdraw8.draw.handle.PathIterableOutlineHandle; +import org.jhotdraw8.draw.handle.SelectionHandle; import org.jhotdraw8.draw.locator.PointLocator; import org.jhotdraw8.draw.render.RenderContext; -import org.jhotdraw8.geom.*; +import org.jhotdraw8.geom.AwtShapes; +import org.jhotdraw8.geom.FXGeom; +import org.jhotdraw8.geom.FXPathElementsBuilder; +import org.jhotdraw8.geom.FXPreciseRotate; +import org.jhotdraw8.geom.PointAndDerivative; +import org.jhotdraw8.geom.SvgPaths; import org.jhotdraw8.geom.intersect.IntersectionPointEx; import java.awt.geom.AffineTransform; @@ -62,7 +74,7 @@ public AbstractElbowLineConnectionWithMarkersFigure(double startX, double startY @Override public @NonNull Node createNode(@NonNull RenderContext drawingView) { - javafx.scene.Group g = new javafx.scene.Group(); + Group g = new Group(); final Polyline line = new Polyline(); final Path startMarker = new Path(); final Path endMarker = new Path(); @@ -136,7 +148,7 @@ protected void updateEndMarkerNode(RenderContext ctx, Path node) { @Override public void updateNode(@NonNull RenderContext ctx, @NonNull Node node) { - javafx.scene.Group g = (javafx.scene.Group) node; + Group g = (Group) node; Polyline lineNode = (Polyline) g.getChildren().get(0); final Path startMarkerNode = (Path) g.getChildren().get(1); final Path endMarkerNode = (Path) g.getChildren().get(2); @@ -183,7 +195,7 @@ public void updateNode(@NonNull RenderContext ctx, @NonNull Node node) { updateEndMarkerNode(ctx, endMarkerNode); } - protected void updateMarkerNode(RenderContext ctx, javafx.scene.Group group, + protected void updateMarkerNode(RenderContext ctx, Group group, @NonNull Path markerNode, @NonNull PointAndDerivative pd, @Nullable String svgString, double markerScaleFactor) { if (svgString != null) { diff --git a/org.jhotdraw8.draw/src/main/java/org.jhotdraw8.draw/org/jhotdraw8/draw/figure/AbstractPathConnectionWithMarkersFigure.java b/org.jhotdraw8.draw/src/main/java/org.jhotdraw8.draw/org/jhotdraw8/draw/figure/AbstractPathConnectionWithMarkersFigure.java index f1db3db6e..60a4b3930 100755 --- a/org.jhotdraw8.draw/src/main/java/org.jhotdraw8.draw/org/jhotdraw8/draw/figure/AbstractPathConnectionWithMarkersFigure.java +++ b/org.jhotdraw8.draw/src/main/java/org.jhotdraw8.draw/org/jhotdraw8/draw/figure/AbstractPathConnectionWithMarkersFigure.java @@ -5,6 +5,7 @@ package org.jhotdraw8.draw.figure; import javafx.geometry.Point2D; +import javafx.scene.Group; import javafx.scene.Node; import javafx.scene.shape.Path; import javafx.scene.shape.PathElement; @@ -129,7 +130,7 @@ public void createHandles(@NonNull HandleType handleType, @NonNull List @Override public @NonNull Node createNode(@NonNull RenderContext drawingView) { - javafx.scene.Group g = new javafx.scene.Group(); + Group g = new Group(); final Path line = new Path(); final Path startMarker = new Path(); final Path endMarker = new Path(); @@ -296,7 +297,7 @@ protected void updateLineNode(@NonNull RenderContext ctx, @NonNull Path node) { } - protected void updateMarkerNode(RenderContext ctx, javafx.scene.Group group, + protected void updateMarkerNode(RenderContext ctx, Group group, @NonNull Path markerNode, @NonNull PointAndDerivative pd, @Nullable String svgString, double markerScaleFactor) { if (svgString != null) { @@ -335,7 +336,7 @@ public void updateNode(@NonNull RenderContext ctx, @NonNull Node node) { } - javafx.scene.Group g = (javafx.scene.Group) node; + Group g = (Group) node; Path lineNode = (Path) g.getChildren().get(0); final Path startMarkerNode = (Path) g.getChildren().get(1); final Path endMarkerNode = (Path) g.getChildren().get(2); diff --git a/org.jhotdraw8.draw/src/main/java/org.jhotdraw8.draw/org/jhotdraw8/draw/figure/AbstractStraightLineConnectionWithMarkersFigure.java b/org.jhotdraw8.draw/src/main/java/org.jhotdraw8.draw/org/jhotdraw8/draw/figure/AbstractStraightLineConnectionWithMarkersFigure.java index 61793f67b..1eb879a6f 100755 --- a/org.jhotdraw8.draw/src/main/java/org.jhotdraw8.draw/org/jhotdraw8/draw/figure/AbstractStraightLineConnectionWithMarkersFigure.java +++ b/org.jhotdraw8.draw/src/main/java/org.jhotdraw8.draw/org/jhotdraw8/draw/figure/AbstractStraightLineConnectionWithMarkersFigure.java @@ -5,6 +5,7 @@ package org.jhotdraw8.draw.figure; import javafx.geometry.Point2D; +import javafx.scene.Group; import javafx.scene.Node; import javafx.scene.shape.Line; import javafx.scene.shape.Path; @@ -15,10 +16,19 @@ import org.jhotdraw8.annotation.Nullable; import org.jhotdraw8.draw.connector.Connector; import org.jhotdraw8.draw.css.value.CssPoint2D; -import org.jhotdraw8.draw.handle.*; +import org.jhotdraw8.draw.handle.Handle; +import org.jhotdraw8.draw.handle.HandleType; +import org.jhotdraw8.draw.handle.LineConnectorHandle; +import org.jhotdraw8.draw.handle.LineOutlineHandle; +import org.jhotdraw8.draw.handle.MoveHandle; +import org.jhotdraw8.draw.handle.SelectionHandle; import org.jhotdraw8.draw.locator.PointLocator; import org.jhotdraw8.draw.render.RenderContext; -import org.jhotdraw8.geom.*; +import org.jhotdraw8.geom.FXPathElementsBuilder; +import org.jhotdraw8.geom.FXPreciseRotate; +import org.jhotdraw8.geom.FXShapes; +import org.jhotdraw8.geom.PointAndDerivative; +import org.jhotdraw8.geom.SvgPaths; import java.awt.geom.AffineTransform; import java.awt.geom.PathIterator; @@ -84,7 +94,7 @@ public void createHandles(@NonNull HandleType handleType, @NonNull List @Override public @NonNull Node createNode(@NonNull RenderContext drawingView) { - javafx.scene.Group g = new javafx.scene.Group(); + Group g = new Group(); final Line line = new Line(); final Path startMarker = new Path(); final Path endMarker = new Path(); @@ -177,7 +187,7 @@ protected void updateEndMarkerNode(RenderContext ctx, Path node) { protected void updateLineNode(@NonNull RenderContext ctx, @NonNull Line node) { } - protected void updateMarkerNode(RenderContext ctx, javafx.scene.Group group, + protected void updateMarkerNode(RenderContext ctx, Group group, @NonNull Path markerNode, @NonNull PointAndDerivative pd, @Nullable String svgString, double markerScaleFactor) { if (svgString != null) { @@ -209,7 +219,7 @@ protected void updateMarkerNode(RenderContext ctx, javafx.scene.Group group, @Override public void updateNode(@NonNull RenderContext ctx, @NonNull Node node) { - javafx.scene.Group g = (javafx.scene.Group) node; + Group g = (Group) node; Line lineNode = (Line) g.getChildren().get(0); final Path startMarkerNode = (Path) g.getChildren().get(1); final Path endMarkerNode = (Path) g.getChildren().get(2); diff --git a/org.jhotdraw8.draw/src/main/java/org.jhotdraw8.draw/org/jhotdraw8/draw/figure/Figure.java b/org.jhotdraw8.draw/src/main/java/org.jhotdraw8.draw/org/jhotdraw8/draw/figure/Figure.java index e2ab6af1a..16deb2728 100755 --- a/org.jhotdraw8.draw/src/main/java/org.jhotdraw8.draw/org/jhotdraw8/draw/figure/Figure.java +++ b/org.jhotdraw8.draw/src/main/java/org.jhotdraw8.draw/org/jhotdraw8/draw/figure/Figure.java @@ -110,7 +110,7 @@ *

* Update Strategy. A figure does not automatically update its computed * property values. The update strategy is factored out into - * {@link org.jhotdraw8.draw.model.DrawingModel}. + * {@link DrawingModel}. * * @author Werner Randelshofer */ @@ -390,7 +390,7 @@ default void createHandles(@NonNull HandleType handleType, @NonNull List /** * This method is invoked on a figure by - * {@link org.jhotdraw8.draw.model.DrawingModel} when it determines that one + * {@link DrawingModel} when it determines that one * or more layout subjects have been added or removed. *

* The default implementation of this method is empty. @@ -400,7 +400,7 @@ default void layoutSubjectChanged() { /** * This method is invoked on a figure by - * {@link org.jhotdraw8.draw.model.DrawingModel} when it determines that a + * {@link DrawingModel} when it determines that a * property has been changed. *

* The default implementation of this method is empty. @@ -415,7 +415,7 @@ default void propertyChanged(Key key, @Nullable T oldValue, @Nullable T n /** * This method is invoked on a figure by - * {@link org.jhotdraw8.draw.model.DrawingModel} when it determines that one + * {@link DrawingModel} when it determines that one * or more layout observers have been added or removed. *

* The default implementation of this method is empty. @@ -826,7 +826,7 @@ default double getPreferredAspectRatio() { *

* This figure does not keep track of changes that cause the invalidation of * its transformation matrices. Use a - * {@link org.jhotdraw8.draw.model.DrawingModel} to manage the + * {@link DrawingModel} to manage the * transformation matrices of the figures in a drawing. Or call this method * on a figure and all its descendants, after you have performed a change * which invalidated the transform matrices of the figure. @@ -976,7 +976,7 @@ default boolean isVisible() { * if layout of the other figures has been performed first. *

* A figure does not keep track of changes that require layout updates. - * Use {@link org.jhotdraw8.draw.model.DrawingModel} to manage layout updates. + * Use {@link DrawingModel} to manage layout updates. *

* The default implementation is empty. *

@@ -990,7 +990,7 @@ default void layout(@NonNull RenderContext ctx) { /** * This method is invoked on a figure by - * {@link org.jhotdraw8.draw.model.DrawingModel} when it determines that the + * {@link DrawingModel} when it determines that the * figure needs to be laid out. *

* The default implementation of this method calls {@link #layout}. @@ -1195,7 +1195,7 @@ default void translateInLocal(@NonNull CssPoint2D t) { /** * This method is invoked on a figure by - * {@link org.jhotdraw8.draw.model.DrawingModel} when it determines that the + * {@link DrawingModel} when it determines that the * figure needs to apply its stylesheet again. *

* The default implementation of this method calls {@link #updateCss}. @@ -1226,7 +1226,7 @@ default void stylesheetChanged(@NonNull RenderContext ctx) { /** * This method is invoked on a figure and all its descendants by - * {@link org.jhotdraw8.draw.model.DrawingModel} when it determines that the + * {@link DrawingModel} when it determines that the * transformation of the figure has changed. *

* The default implementation of this method calls @@ -1241,7 +1241,7 @@ default void transformChanged() { * values and on the and the property values of its ancestors. *

* This figure does not keep track of changes that require CSS updates. Use - * a {@link org.jhotdraw8.draw.model.DrawingModel} to manage CSS updates. + * a {@link DrawingModel} to manage CSS updates. * * @param ctx the render context */ @@ -1277,7 +1277,7 @@ default void transformChanged() { * input events on Java FX nodes to the corresponding figure. *

* This figure does not keep track of changes that require node updates. - * {@link org.jhotdraw8.draw.model.DrawingModel} to manage node updates. + * {@link DrawingModel} to manage node updates. * * @param ctx the render context * @param node the node which was created with {@link #createNode} diff --git a/org.jhotdraw8.draw/src/main/java/org.jhotdraw8.draw/org/jhotdraw8/draw/figure/GroupFigure.java b/org.jhotdraw8.draw/src/main/java/org.jhotdraw8.draw/org/jhotdraw8/draw/figure/GroupFigure.java index b15b31d4c..056d68f5b 100755 --- a/org.jhotdraw8.draw/src/main/java/org.jhotdraw8.draw/org/jhotdraw8/draw/figure/GroupFigure.java +++ b/org.jhotdraw8.draw/src/main/java/org.jhotdraw8.draw/org/jhotdraw8/draw/figure/GroupFigure.java @@ -5,6 +5,7 @@ package org.jhotdraw8.draw.figure; import javafx.collections.ObservableList; +import javafx.scene.Group; import javafx.scene.Node; import javafx.scene.transform.Transform; import org.jhotdraw8.annotation.NonNull; @@ -34,7 +35,7 @@ public GroupFigure() { @Override public @NonNull Node createNode(@NonNull RenderContext drawingView) { - javafx.scene.Group n = new javafx.scene.Group(); + Group n = new Group(); n.setAutoSizeChildren(false); n.setManaged(false); return n; @@ -73,7 +74,7 @@ public void updateNode(@NonNull RenderContext ctx, @NonNull Node n) { for (Figure child : getChildren()) { nodes.add(ctx.getNode(child)); } - ObservableList group = ((javafx.scene.Group) n).getChildren(); + ObservableList group = ((Group) n).getChildren(); if (!group.equals(nodes)) { group.setAll(nodes); } diff --git a/org.jhotdraw8.draw/src/main/java/org.jhotdraw8.draw/org/jhotdraw8/draw/figure/Layer.java b/org.jhotdraw8.draw/src/main/java/org.jhotdraw8.draw/org/jhotdraw8/draw/figure/Layer.java index 9f6280d2d..1678513d7 100755 --- a/org.jhotdraw8.draw/src/main/java/org.jhotdraw8.draw/org/jhotdraw8/draw/figure/Layer.java +++ b/org.jhotdraw8.draw/src/main/java/org.jhotdraw8.draw/org/jhotdraw8/draw/figure/Layer.java @@ -10,7 +10,7 @@ * Defines a layer of a {@link Drawing}. *

* The parent of a {@code Layer} must be a {@code Drawing} or a {@code Clipping} . Method - * {@link #isSuitableParent(org.jhotdraw8.draw.figure.Figure)} must be + * {@link #isSuitableParent(Figure)} must be * implementend accordingly. *

* A layer does not have handles and is not selectable. diff --git a/org.jhotdraw8.draw/src/main/java/org.jhotdraw8.draw/org/jhotdraw8/draw/figure/PageFigure.java b/org.jhotdraw8.draw/src/main/java/org.jhotdraw8.draw/org/jhotdraw8/draw/figure/PageFigure.java index 371fed674..d7e447649 100755 --- a/org.jhotdraw8.draw/src/main/java/org.jhotdraw8.draw/org/jhotdraw8/draw/figure/PageFigure.java +++ b/org.jhotdraw8.draw/src/main/java/org.jhotdraw8.draw/org/jhotdraw8/draw/figure/PageFigure.java @@ -8,6 +8,7 @@ import javafx.geometry.BoundingBox; import javafx.geometry.Bounds; import javafx.geometry.Insets; +import javafx.scene.Group; import javafx.scene.Node; import javafx.scene.paint.Color; import javafx.scene.shape.ClosePath; @@ -133,7 +134,7 @@ private double computeContentAreaFactor() { @Override public @NonNull Node createNode(@NonNull RenderContext ctx) { - javafx.scene.Group n = new javafx.scene.Group(); + Group n = new Group(); n.setManaged(false); n.setAutoSizeChildren(false); @@ -150,7 +151,7 @@ private double computeContentAreaFactor() { insetsBoundsNode.setStrokeType(StrokeType.CENTERED); insetsBoundsNode.getStrokeDashArray().setAll(5.0); - javafx.scene.Group currentPageNode = new javafx.scene.Group(); + Group currentPageNode = new Group(); n.getChildren().addAll(pageBoundsNode, insetsBoundsNode, contentBoundsNode, currentPageNode); n.getProperties().put(PAGE_BOUNDS_PROPERTY, pageBoundsNode); @@ -381,7 +382,7 @@ public void reshapeInLocal(@NonNull Transform transform) { @Override public void updateNode(@NonNull RenderContext ctx, @NonNull Node node) { - javafx.scene.Group groupNode = (javafx.scene.Group) node; + Group groupNode = (Group) node; // We can't use #applyTransformableFigureProperties(node) because // this will rotate around an unpredictable center! node.getTransforms().setAll(getLocalToParent(true)); @@ -389,7 +390,7 @@ public void updateNode(@NonNull RenderContext ctx, @NonNull Node node) { Rectangle contentBoundsNode = (Rectangle) groupNode.getProperties().get(CONTENT_BOUNDS_PROPERTY); Path pageBoundsNode = (Path) groupNode.getProperties().get(PAGE_BOUNDS_PROPERTY); Path pageInsetsNode = (Path) groupNode.getProperties().get(PAGE_INSETS_PROPERTY); - javafx.scene.Group currentPageNode = (javafx.scene.Group) groupNode.getProperties().get(CURRENT_PAGE_PROPERTY); + Group currentPageNode = (Group) groupNode.getProperties().get(CURRENT_PAGE_PROPERTY); applyFillableFigureProperties(ctx, pageBoundsNode); applyStrokableFigureProperties(ctx, pageBoundsNode); diff --git a/org.jhotdraw8.draw/src/main/java/org.jhotdraw8.draw/org/jhotdraw8/draw/figure/ShapeableFigure.java b/org.jhotdraw8.draw/src/main/java/org.jhotdraw8.draw/org/jhotdraw8/draw/figure/ShapeableFigure.java index cbee00410..eff7d5884 100755 --- a/org.jhotdraw8.draw/src/main/java/org.jhotdraw8.draw/org/jhotdraw8/draw/figure/ShapeableFigure.java +++ b/org.jhotdraw8.draw/src/main/java/org.jhotdraw8.draw/org/jhotdraw8/draw/figure/ShapeableFigure.java @@ -6,13 +6,23 @@ import javafx.geometry.Bounds; import javafx.geometry.Insets; +import javafx.geometry.Rectangle2D; import javafx.scene.shape.Path; import javafx.scene.shape.PathElement; import org.jhotdraw8.annotation.NonNull; import org.jhotdraw8.css.value.CssSize; -import org.jhotdraw8.draw.key.*; +import org.jhotdraw8.draw.key.CssInsetsStyleableMapAccessor; +import org.jhotdraw8.draw.key.CssSizeStyleableKey; +import org.jhotdraw8.draw.key.DoubleStyleableKey; +import org.jhotdraw8.draw.key.NullableSvgPathStyleableKey; +import org.jhotdraw8.draw.key.Rectangle2DStyleableMapAccessor; import org.jhotdraw8.draw.render.RenderContext; -import org.jhotdraw8.geom.*; +import org.jhotdraw8.geom.AwtPathBuilder; +import org.jhotdraw8.geom.AwtShapes; +import org.jhotdraw8.geom.FXPathElementsBuilder; +import org.jhotdraw8.geom.FXRectangles; +import org.jhotdraw8.geom.NineRegionsScalingBuilder; +import org.jhotdraw8.geom.SvgPaths; import java.awt.geom.Path2D; import java.text.ParseException; @@ -68,7 +78,7 @@ default void applyShapeableProperties(RenderContext ctx, @NonNull Path node, @No Path2D path = builder.build(); - javafx.geometry.Rectangle2D shapeBounds = getStyled(SHAPE_BOUNDS); + Rectangle2D shapeBounds = getStyled(SHAPE_BOUNDS); final Bounds srcBounds = shapeBounds == null || FXRectangles.isEmpty(shapeBounds) ? FXRectangles.getBounds(path) : FXRectangles.getBounds(shapeBounds); Insets shapeSlice = getStyledNonNull(SHAPE_SLICE).getConvertedValue(srcBounds.getWidth(), srcBounds.getHeight()); diff --git a/org.jhotdraw8.draw/src/main/java/org.jhotdraw8.draw/org/jhotdraw8/draw/input/ClipboardInputFormat.java b/org.jhotdraw8.draw/src/main/java/org.jhotdraw8.draw/org/jhotdraw8/draw/input/ClipboardInputFormat.java index d941dea14..2d4d329ce 100755 --- a/org.jhotdraw8.draw/src/main/java/org.jhotdraw8.draw/org/jhotdraw8/draw/input/ClipboardInputFormat.java +++ b/org.jhotdraw8.draw/src/main/java/org.jhotdraw8.draw/org/jhotdraw8/draw/input/ClipboardInputFormat.java @@ -31,7 +31,7 @@ public interface ClipboardInputFormat { * clipboard is added to this parent. Otherwise, the content is added into an * unspecified layer. * @return the figures that were read from the clipboard - * @throws java.io.IOException if an IO error occurs + * @throws IOException if an IO error occurs */ Set

read(Clipboard clipboard, DrawingModel model, Drawing drawing, @Nullable Figure parent) throws IOException; } diff --git a/org.jhotdraw8.draw/src/main/java/org.jhotdraw8.draw/org/jhotdraw8/draw/input/ClipboardOutputFormat.java b/org.jhotdraw8.draw/src/main/java/org.jhotdraw8.draw/org/jhotdraw8/draw/input/ClipboardOutputFormat.java index 25fd25a5f..be93f1cff 100755 --- a/org.jhotdraw8.draw/src/main/java/org.jhotdraw8.draw/org/jhotdraw8/draw/input/ClipboardOutputFormat.java +++ b/org.jhotdraw8.draw/src/main/java/org.jhotdraw8.draw/org/jhotdraw8/draw/input/ClipboardOutputFormat.java @@ -25,7 +25,7 @@ public interface ClipboardOutputFormat { * * @param out The clipboard * @param drawing The drawing. - * @throws java.io.IOException if an IO error occurs + * @throws IOException if an IO error occurs */ default void write(Map out, Drawing drawing) throws IOException { write(out, drawing, Collections.singleton(drawing)); @@ -37,7 +37,7 @@ default void write(Map out, Drawing drawing) throws IOExcept * @param out The clipboard * @param drawing The drawing. * @param selection A selection - * @throws java.io.IOException if an IO error occurs + * @throws IOException if an IO error occurs */ void write(Map out, Drawing drawing, Collection
selection) throws IOException; } diff --git a/org.jhotdraw8.draw/src/main/java/org.jhotdraw8.draw/org/jhotdraw8/draw/inspector/AbstractStyleAttributesInspector.java b/org.jhotdraw8.draw/src/main/java/org.jhotdraw8.draw/org/jhotdraw8/draw/inspector/AbstractStyleAttributesInspector.java index 02b29691a..2331120cb 100755 --- a/org.jhotdraw8.draw/src/main/java/org.jhotdraw8.draw/org/jhotdraw8/draw/inspector/AbstractStyleAttributesInspector.java +++ b/org.jhotdraw8.draw/src/main/java/org.jhotdraw8.draw/org/jhotdraw8/draw/inspector/AbstractStyleAttributesInspector.java @@ -238,7 +238,7 @@ private void apply(ActionEvent event) { } catch (IOException ex) { ex.printStackTrace(); return; - } catch (java.text.ParseException e) { + } catch (ParseException e) { e.printStackTrace(); new Alert(Alert.AlertType.ERROR, e.getMessage()).showAndWait(); textArea.positionCaret(e.getErrorOffset()); diff --git a/org.jhotdraw8.draw/src/main/java/org.jhotdraw8.draw/org/jhotdraw8/draw/inspector/GridInspector.java b/org.jhotdraw8.draw/src/main/java/org.jhotdraw8.draw/org/jhotdraw8/draw/inspector/GridInspector.java index 23ac7389f..fd152be65 100755 --- a/org.jhotdraw8.draw/src/main/java/org.jhotdraw8.draw/org/jhotdraw8/draw/inspector/GridInspector.java +++ b/org.jhotdraw8.draw/src/main/java/org.jhotdraw8.draw/org/jhotdraw8/draw/inspector/GridInspector.java @@ -174,7 +174,7 @@ protected void onDrawingViewChanged(ObservableValue obser Converter converter = new ColorCssConverter(true); try { gridConstrainer.setGridColor(converter.fromString(prefs.get("gridColor", gridConstrainer.getGridColor().getName()))); - } catch (ParseException | IOException ex) { + } catch (ParseException ex) { // don't set color if preferences is bogus } newValue.setConstrainer(gridConstrainer); diff --git a/org.jhotdraw8.draw/src/main/java/org.jhotdraw8.draw/org/jhotdraw8/draw/io/AbstractExportOutputFormat.java b/org.jhotdraw8.draw/src/main/java/org.jhotdraw8.draw/org/jhotdraw8/draw/io/AbstractExportOutputFormat.java index adad90080..08814b48f 100755 --- a/org.jhotdraw8.draw/src/main/java/org.jhotdraw8.draw/org/jhotdraw8/draw/io/AbstractExportOutputFormat.java +++ b/org.jhotdraw8.draw/src/main/java/org.jhotdraw8.draw/org/jhotdraw8/draw/io/AbstractExportOutputFormat.java @@ -105,7 +105,7 @@ protected void writePages(@Nullable Path dir, String basename, @NonNull Drawing * @param drawing the drawing * @param pages the pages * @param hints the hints - * @throws java.io.IOException in case of failure + * @throws IOException in case of failure */ protected void writePages(@Nullable Path dir, String basename, @NonNull Drawing drawing, @NonNull List pages, @NonNull Map, Object> hints) throws IOException { IdFactory idFactory = new SimpleIdFactory(); @@ -201,7 +201,7 @@ protected void writeSlices(@Nullable Path dir, @NonNull Drawing drawing) throws * @param dir * @param drawing * @param slices - * @throws java.io.IOException + * @throws IOException */ private void writeSlices(@NonNull Path dir, @NonNull Drawing drawing, @NonNull List slices, String suffix, double dpi) throws IOException { Map, Object> hints = new HashMap<>(); diff --git a/org.jhotdraw8.draw/src/main/java/org.jhotdraw8.draw/org/jhotdraw8/draw/io/FigureFactory.java b/org.jhotdraw8.draw/src/main/java/org.jhotdraw8.draw/org/jhotdraw8/draw/io/FigureFactory.java index 54e40c1f5..1f976da42 100755 --- a/org.jhotdraw8.draw/src/main/java/org.jhotdraw8.draw/org/jhotdraw8/draw/io/FigureFactory.java +++ b/org.jhotdraw8.draw/src/main/java/org.jhotdraw8.draw/org/jhotdraw8/draw/io/FigureFactory.java @@ -32,7 +32,7 @@ public interface FigureFactory { * * @param f the figure * @return the name - * @throws java.io.IOException if the factory does not support this figure + * @throws IOException if the factory does not support this figure */ @Nullable String getElementNameByFigure(Figure f) throws IOException; @@ -41,7 +41,7 @@ public interface FigureFactory { * * @param elementName the name * @return the figure - * @throws java.io.IOException if the factory does not support this name + * @throws IOException if the factory does not support this name */ @NonNull Figure createFigureByElementName(String elementName) throws IOException; @@ -52,7 +52,7 @@ public interface FigureFactory { * @param f the figure * @param key the key * @return The name. - * @throws java.io.IOException if the factory does not support the key for + * @throws IOException if the factory does not support the key for * the specified figure */ String getAttributeNameByKey(Figure f, MapAccessor key) throws IOException; @@ -63,7 +63,7 @@ public interface FigureFactory { * @param f the figure * @param name the name * @return the key - * @throws java.io.IOException if the factory does not support the name for + * @throws IOException if the factory does not support the name for * the specified figure */ @Nullable MapAccessor getKeyByAttributeName(Figure f, String name) throws IOException; @@ -81,7 +81,7 @@ public interface FigureFactory { * @param f the figure * @param key the key * @return The name. - * @throws java.io.IOException if the factory does not support the key for + * @throws IOException if the factory does not support the key for * the specified figure */ String getElementNameByKey(Figure f, MapAccessor key) throws IOException; @@ -92,7 +92,7 @@ public interface FigureFactory { * @param f the figure * @param name the name * @return the key - * @throws java.io.IOException if the factory does not support the name for + * @throws IOException if the factory does not support the name for * the specified figure */ MapAccessor getKeyByElementName(Figure f, String name) throws IOException; @@ -104,7 +104,7 @@ public interface FigureFactory { * @param key the key * @param value the value * @return the mapped attribute value - * @throws java.io.IOException if the factory does not support a mapping for + * @throws IOException if the factory does not support a mapping for * the specified key */ @NonNull String valueToString(MapAccessor key, T value) throws IOException; @@ -118,7 +118,7 @@ public interface FigureFactory { * @param key the key * @param value the value * @param w the writer for creating the node list. - * @throws java.io.IOException if the factory does not support a mapping for + * @throws IOException if the factory does not support a mapping for * the specified key */ void valueToNodeList(MapAccessor key, Object value, XMLStreamWriter w) throws IOException, XMLStreamException; @@ -133,7 +133,7 @@ public interface FigureFactory { * @param key the key * @param nodeList the nodeList * @return the mapped attribute value. - * @throws java.io.IOException if the factory does not support a mapping for + * @throws IOException if the factory does not support a mapping for * the specified key */ @Nullable T nodeListToValue(MapAccessor key, List nodeList) throws IOException; @@ -145,7 +145,7 @@ public interface FigureFactory { * @param key the key * @param cdata the XML attribute value * @return the mapped value - * @throws java.io.IOException if the factory does not support a mapping for + * @throws IOException if the factory does not support a mapping for * the specified key */ @Nullable T stringToValue(MapAccessor key, String cdata) throws IOException; @@ -204,7 +204,7 @@ default boolean isDefaultValue(Figure f, @NonNull MapAccessor key, @Nulla * * @param internal an internal representation of the drawing * @return An external representation of the drawing. - * @throws java.io.IOException if no external representation can be created + * @throws IOException if no external representation can be created */ default Drawing toExternalDrawing(Drawing internal) throws IOException { return internal; @@ -219,7 +219,7 @@ default Drawing toExternalDrawing(Drawing internal) throws IOException { * * @param external an external representation of the drawing * @return An internal representation of the drawing. - * @throws java.io.IOException if no internal representation can be created + * @throws IOException if no internal representation can be created */ default Drawing fromExternalDrawing(Drawing external) throws IOException { return external; @@ -230,7 +230,7 @@ default Drawing fromExternalDrawing(Drawing external) throws IOException { * * @return The stylesheets key of the Drawing object. Return null if * stylesheets shall not be supported. The default implementation returns - * {@link org.jhotdraw8.draw.figure.Drawing#AUTHOR_STYLESHEETS}. + * {@link Drawing#AUTHOR_STYLESHEETS}. */ default MapAccessor> getStylesheetsKey() { return Drawing.AUTHOR_STYLESHEETS; diff --git a/org.jhotdraw8.draw/src/main/java/org.jhotdraw8.draw/org/jhotdraw8/draw/io/InputFormat.java b/org.jhotdraw8.draw/src/main/java/org.jhotdraw8.draw/org/jhotdraw8/draw/io/InputFormat.java index a8f2d1279..b3cb046af 100755 --- a/org.jhotdraw8.draw/src/main/java/org.jhotdraw8.draw/org/jhotdraw8/draw/io/InputFormat.java +++ b/org.jhotdraw8.draw/src/main/java/org.jhotdraw8.draw/org/jhotdraw8/draw/io/InputFormat.java @@ -41,7 +41,7 @@ public interface InputFormat { * drawing. * @param workState for progress monitoring and cancelling the operation * @return the figure - * @throws java.io.IOException if an IO error occurs + * @throws IOException if an IO error occurs */ default @NonNull Figure read(@NonNull URI uri, @Nullable Drawing drawing, @NonNull WorkState workState) throws IOException { return read(Paths.get(uri), drawing, workState); @@ -57,7 +57,7 @@ public interface InputFormat { * drawing. * @param workState for progress monitoring and cancelling the operation * @return the figure - * @throws java.io.IOException if an IO error occurs + * @throws IOException if an IO error occurs */ default @NonNull Figure read(@NonNull Path file, @Nullable Drawing drawing, @NonNull WorkState workState) throws IOException { URI documentHome = file.getParent() == null ? FileSystems.getDefault().getPath(System.getProperty("user.home")).toUri() : file.getParent().toUri(); @@ -78,7 +78,7 @@ public interface InputFormat { * @param documentHome the URI used to resolve external references from the document * @param workState for progress monitoring and cancelling the operation * @return the drawing - * @throws java.io.IOException if an IO error occurs + * @throws IOException if an IO error occurs */ @NonNull Figure read(@NonNull InputStream in, Drawing drawing, URI documentHome, @NonNull WorkState workState) throws IOException; diff --git a/org.jhotdraw8.draw/src/main/java/org.jhotdraw8.draw/org/jhotdraw8/draw/io/OutputFormat.java b/org.jhotdraw8.draw/src/main/java/org.jhotdraw8.draw/org/jhotdraw8/draw/io/OutputFormat.java index cc376f998..3f1a6ae43 100755 --- a/org.jhotdraw8.draw/src/main/java/org.jhotdraw8.draw/org/jhotdraw8/draw/io/OutputFormat.java +++ b/org.jhotdraw8.draw/src/main/java/org.jhotdraw8.draw/org/jhotdraw8/draw/io/OutputFormat.java @@ -35,7 +35,7 @@ public interface OutputFormat { * @param uri The resource identifier * @param drawing The drawing. * @param workState for progress monitoring and cancelling the operation - * @throws java.io.IOException if an IO error occurs + * @throws IOException if an IO error occurs */ default void write(@NonNull URI uri, @NonNull Drawing drawing, @NonNull WorkState workState) throws IOException { write(Paths.get(uri), drawing, workState); @@ -48,7 +48,7 @@ default void write(@NonNull URI uri, @NonNull Drawing drawing, @NonNull WorkStat * @param file the file * @param drawing the drawing * @param workState for progress monitoring and cancelling the operation - * @throws java.io.IOException if an IO error occurs + * @throws IOException if an IO error occurs */ default void write(@NonNull Path file, @NonNull Drawing drawing, @NonNull WorkState workState) throws IOException { try (BufferedOutputStream out = new BufferedOutputStream(Files.newOutputStream(file))) { @@ -64,7 +64,7 @@ default void write(@NonNull Path file, @NonNull Drawing drawing, @NonNull WorkSt * if this URI is null, all URIs in the document will be absolute * @param drawing The drawing. * @param workState for progress monitoring and cancelling the operation - * @throws java.io.IOException if an IO error occurs + * @throws IOException if an IO error occurs */ void write(@NonNull OutputStream out, @Nullable URI documentHome, @NonNull Drawing drawing, @NonNull WorkState workState) throws IOException; diff --git a/org.jhotdraw8.draw/src/main/java/org.jhotdraw8.draw/org/jhotdraw8/draw/popup/ExamplesPicker.java b/org.jhotdraw8.draw/src/main/java/org.jhotdraw8.draw/org/jhotdraw8/draw/popup/ExamplesPicker.java index aad731ebc..a2cddd01e 100755 --- a/org.jhotdraw8.draw/src/main/java/org.jhotdraw8.draw/org/jhotdraw8/draw/popup/ExamplesPicker.java +++ b/org.jhotdraw8.draw/src/main/java/org.jhotdraw8.draw/org/jhotdraw8/draw/popup/ExamplesPicker.java @@ -15,7 +15,6 @@ import org.jhotdraw8.draw.DrawLabels; import org.jhotdraw8.icollection.immutable.ImmutableList; -import java.io.IOException; import java.text.ParseException; import java.util.function.BiConsumer; @@ -45,7 +44,7 @@ private void init() { valueItem.setOnAction(e -> { try { callback.accept(true, converter.fromString(s)); - } catch (ParseException | IOException ex) { + } catch (ParseException ex) { ex.printStackTrace(); } }); diff --git a/org.jhotdraw8.draw/src/main/java/org.jhotdraw8.draw/org/jhotdraw8/draw/xml/converter/BezierPathXmlConverter.java b/org.jhotdraw8.draw/src/main/java/org.jhotdraw8.draw/org/jhotdraw8/draw/xml/converter/BezierPathXmlConverter.java index 93dcbe4fd..b4cfaf61a 100755 --- a/org.jhotdraw8.draw/src/main/java/org.jhotdraw8.draw/org/jhotdraw8/draw/xml/converter/BezierPathXmlConverter.java +++ b/org.jhotdraw8.draw/src/main/java/org.jhotdraw8.draw/org/jhotdraw8/draw/xml/converter/BezierPathXmlConverter.java @@ -36,24 +36,28 @@ public BezierPathXmlConverter(boolean nullable) { } @Override - public @Nullable BezierPath fromString(@NonNull CharBuffer buf, @Nullable IdResolver idResolver) throws ParseException, IOException { + public @Nullable BezierPath fromString(@NonNull CharBuffer buf, @Nullable IdResolver idResolver) throws ParseException { String input = buf.toString(); + buf.position(buf.limit()); StreamCssTokenizer tt = new StreamCssTokenizer(new CharBufferReader(buf)); BezierPath p = null; - if (tt.next() == CssTokenType.TT_IDENT) { - if (!nullable) { - throw new ParseException("String expected. " + tt.current(), buf.position()); - } - if (CssTokenType.IDENT_NONE.equals(tt.currentString())) { - buf.position(buf.limit()); - return null; + try { + if (tt.next() == CssTokenType.TT_IDENT) { + if (!nullable) { + throw new ParseException("String expected. " + tt.current(), buf.position()); + } + if (CssTokenType.IDENT_NONE.equals(tt.currentString())) { + buf.position(buf.limit()); + return null; + } } + } catch (IOException e) { + throw new ParseException(e.getMessage(), 0); } BezierPathBuilder builder = new BezierPathBuilder(); SvgPaths.svgStringToBuilder(input, builder); BezierPath path = builder.build(); - buf.position(buf.limit()); return path; } diff --git a/org.jhotdraw8.draw/src/main/java/org.jhotdraw8.draw/org/jhotdraw8/draw/xml/converter/ConnectorXmlConverter.java b/org.jhotdraw8.draw/src/main/java/org.jhotdraw8.draw/org/jhotdraw8/draw/xml/converter/ConnectorXmlConverter.java index f88350b2d..3b1966b97 100755 --- a/org.jhotdraw8.draw/src/main/java/org.jhotdraw8.draw/org/jhotdraw8/draw/xml/converter/ConnectorXmlConverter.java +++ b/org.jhotdraw8.draw/src/main/java/org.jhotdraw8.draw/org/jhotdraw8/draw/xml/converter/ConnectorXmlConverter.java @@ -75,10 +75,14 @@ public void toString(@NonNull Appendable out, @Nullable IdSupplier idSupplier, @ } @Override - public @Nullable Connector fromString(@NonNull CharBuffer buf, @Nullable IdResolver idResolver) throws ParseException, IOException { + public @Nullable Connector fromString(@NonNull CharBuffer buf, @Nullable IdResolver idResolver) throws ParseException { Connector c; CssTokenizer tt = new StreamCssTokenizer(new CharBufferReader(buf)); - c = parseConnector(tt, idResolver); + try { + c = parseConnector(tt, idResolver); + } catch (IOException e) { + throw new ParseException(e.getMessage(), 0); + } if (!buf.toString().trim().isEmpty()) { throw new ParseException("Locator: End expected, found:" + buf, buf.position()); diff --git a/org.jhotdraw8.draw/src/main/java/org.jhotdraw8.draw/org/jhotdraw8/draw/xml/converter/FXSvgPathXmlConverter.java b/org.jhotdraw8.draw/src/main/java/org.jhotdraw8.draw/org/jhotdraw8/draw/xml/converter/FXSvgPathXmlConverter.java index 56e59e49a..3e217dc35 100755 --- a/org.jhotdraw8.draw/src/main/java/org.jhotdraw8.draw/org/jhotdraw8/draw/xml/converter/FXSvgPathXmlConverter.java +++ b/org.jhotdraw8.draw/src/main/java/org.jhotdraw8.draw/org/jhotdraw8/draw/xml/converter/FXSvgPathXmlConverter.java @@ -29,9 +29,14 @@ public FXSvgPathXmlConverter() { } @Override - public @Nullable ImmutableList fromString(@NonNull CharBuffer buf, @Nullable IdResolver idResolver) throws ParseException, IOException { + public @Nullable ImmutableList fromString(@NonNull CharBuffer buf, @Nullable IdResolver idResolver) throws ParseException { CharBuffer out = CharBuffer.allocate(buf.remaining()); - int count = buf.read(out); + int count = 0; + try { + count = buf.read(out); + } catch (IOException e) { + throw new ParseException(e.getMessage(), 0); + } out.position(0); out.limit(count); final String string = out.toString(); diff --git a/org.jhotdraw8.draw/src/main/java/org.jhotdraw8.draw/org/jhotdraw8/draw/xml/converter/Path2DDoubleXmlConverter.java b/org.jhotdraw8.draw/src/main/java/org.jhotdraw8.draw/org/jhotdraw8/draw/xml/converter/Path2DDoubleXmlConverter.java index 7f11ef4cc..922b34230 100755 --- a/org.jhotdraw8.draw/src/main/java/org.jhotdraw8.draw/org/jhotdraw8/draw/xml/converter/Path2DDoubleXmlConverter.java +++ b/org.jhotdraw8.draw/src/main/java/org.jhotdraw8.draw/org/jhotdraw8/draw/xml/converter/Path2DDoubleXmlConverter.java @@ -38,12 +38,9 @@ public Path2DDoubleXmlConverter() { } @Override - public Path2D.@Nullable Double fromString(@NonNull CharBuffer buf, @Nullable IdResolver idResolver) throws ParseException, IOException { - CharBuffer out = CharBuffer.allocate(buf.remaining()); - int count = buf.read(out); - out.position(0); - out.limit(count); - final String string = out.toString(); + public Path2D.@Nullable Double fromString(@NonNull CharBuffer buf, @Nullable IdResolver idResolver) throws ParseException { + final String string = buf.toString(); + buf.position(buf.length()); if ("none".equals(string)) { return null; } diff --git a/org.jhotdraw8.draw/src/main/java/org.jhotdraw8.draw/org/jhotdraw8/draw/xml/converter/PathMetricsXmlConverter.java b/org.jhotdraw8.draw/src/main/java/org.jhotdraw8.draw/org/jhotdraw8/draw/xml/converter/PathMetricsXmlConverter.java index df6f4e0b2..602bf1ff7 100755 --- a/org.jhotdraw8.draw/src/main/java/org.jhotdraw8.draw/org/jhotdraw8/draw/xml/converter/PathMetricsXmlConverter.java +++ b/org.jhotdraw8.draw/src/main/java/org.jhotdraw8.draw/org/jhotdraw8/draw/xml/converter/PathMetricsXmlConverter.java @@ -36,25 +36,29 @@ public PathMetricsXmlConverter(boolean nullable) { } @Override - public @Nullable PathMetrics fromString(@NonNull CharBuffer buf, @Nullable IdResolver idResolver) throws ParseException, IOException { + public @Nullable PathMetrics fromString(@NonNull CharBuffer buf, @Nullable IdResolver idResolver) throws ParseException { String input = buf.toString(); + buf.position(buf.limit()); StreamCssTokenizer tt = new StreamCssTokenizer(new CharBufferReader(buf)); PathMetrics p = null; - if (tt.next() == CssTokenType.TT_IDENT) { - if (!nullable) { - throw new ParseException("String expected. " + tt.current(), buf.position()); - } - if (CssTokenType.IDENT_NONE.equals(tt.currentString())) { - buf.position(buf.limit()); - return null; + try { + if (tt.next() == CssTokenType.TT_IDENT) { + if (!nullable) { + throw new ParseException("String expected. " + tt.current(), buf.position()); + } + if (CssTokenType.IDENT_NONE.equals(tt.currentString())) { + buf.position(buf.limit()); + return null; + } } + } catch (IOException e) { + throw new ParseException(e.getMessage(), 0); } PathMetricsBuilder builder = new PathMetricsBuilder(); SvgPaths.svgStringToBuilder(input, builder); p = builder.build(); - buf.position(buf.limit()); return p; } diff --git a/org.jhotdraw8.draw/src/main/java/org.jhotdraw8.draw/org/jhotdraw8/draw/xml/converter/SvgPathXmlConverter.java b/org.jhotdraw8.draw/src/main/java/org.jhotdraw8.draw/org/jhotdraw8/draw/xml/converter/SvgPathXmlConverter.java index 59c17a80a..f524b5727 100755 --- a/org.jhotdraw8.draw/src/main/java/org.jhotdraw8.draw/org/jhotdraw8/draw/xml/converter/SvgPathXmlConverter.java +++ b/org.jhotdraw8.draw/src/main/java/org.jhotdraw8.draw/org/jhotdraw8/draw/xml/converter/SvgPathXmlConverter.java @@ -26,12 +26,9 @@ public SvgPathXmlConverter() { } @Override - public @Nullable SVGPath fromString(@NonNull CharBuffer buf, @Nullable IdResolver idResolver) throws ParseException, IOException { - CharBuffer out = CharBuffer.allocate(buf.remaining()); - int count = buf.read(out); - out.position(0); - out.limit(count); - final String string = out.toString(); + public @Nullable SVGPath fromString(@NonNull CharBuffer buf, @Nullable IdResolver idResolver) throws ParseException { + final String string = buf.toString(); + buf.position(buf.length()); if ("none".equals(string)) { return null; } diff --git a/org.jhotdraw8.draw/src/test/java/org.jhotdraw8.draw/org/jhotdraw8/draw/css/converter/csscolormodule4/ComputeTestcommon.java b/org.jhotdraw8.draw/src/test/java/org.jhotdraw8.draw/org/jhotdraw8/draw/css/converter/csscolormodule4/ComputeTestcommon.java index a05800453..91fc83723 100644 --- a/org.jhotdraw8.draw/src/test/java/org.jhotdraw8.draw/org/jhotdraw8/draw/css/converter/csscolormodule4/ComputeTestcommon.java +++ b/org.jhotdraw8.draw/src/test/java/org.jhotdraw8.draw/org/jhotdraw8/draw/css/converter/csscolormodule4/ComputeTestcommon.java @@ -7,7 +7,6 @@ import org.jhotdraw8.draw.css.converter.ColorCssConverter; import org.jhotdraw8.draw.css.value.CssColor; -import java.io.IOException; import java.text.DecimalFormat; import java.text.DecimalFormatSymbols; import java.text.ParseException; @@ -41,7 +40,7 @@ public static void test_computed_value(@NonNull String property, @NonNull String CssColor parsed = colorConverter.fromString(specified); String actualComputed = colorConverter.toString(parsed); assertEquals(computed, actualComputed, message); - } catch (ParseException | IOException e) { + } catch (ParseException e) { throw new AssertionError(message, e); } } @@ -75,7 +74,7 @@ public static void test_computed_value_to_rgb(@NonNull String property, @NonNull + (c.getOpacity() != 1 ? ", " + number.toString(c.getOpacity()) : "") + ")"; assertEquals(computed, actualComputed, message); - } catch (ParseException | IOException e) { + } catch (ParseException e) { throw new AssertionError(message, e); } } diff --git a/org.jhotdraw8.examples/src/main/java/org.jhotdraw8.examples/org/jhotdraw8/examples/fxml/FxmlApplication.java b/org.jhotdraw8.examples/src/main/java/org.jhotdraw8.examples/org/jhotdraw8/examples/fxml/FxmlApplication.java index 39c75656b..415ea693c 100644 --- a/org.jhotdraw8.examples/src/main/java/org.jhotdraw8.examples/org/jhotdraw8/examples/fxml/FxmlApplication.java +++ b/org.jhotdraw8.examples/src/main/java/org.jhotdraw8.examples/org/jhotdraw8/examples/fxml/FxmlApplication.java @@ -5,6 +5,7 @@ package org.jhotdraw8.examples.fxml; +import javafx.application.Application; import javafx.beans.property.ObjectProperty; import javafx.beans.property.SimpleObjectProperty; import javafx.fxml.FXMLLoader; @@ -24,7 +25,7 @@ * An application that adds a {@link Parent} created from an FXML file * to its primary {@link Stage}. */ -public abstract class FxmlApplication extends javafx.application.Application { +public abstract class FxmlApplication extends Application { private static final String FXML_PROPERTY_NAME = "fxml"; private final ObjectProperty fxml = new SimpleObjectProperty<>(this, FXML_PROPERTY_NAME); diff --git a/org.jhotdraw8.examples/src/main/java/org.jhotdraw8.examples/org/jhotdraw8/examples/mini/BezierArcLengthExampleMain.java b/org.jhotdraw8.examples/src/main/java/org.jhotdraw8.examples/org/jhotdraw8/examples/mini/BezierArcLengthExampleMain.java index 312e54b02..9d445ba6b 100644 --- a/org.jhotdraw8.examples/src/main/java/org.jhotdraw8.examples/org/jhotdraw8/examples/mini/BezierArcLengthExampleMain.java +++ b/org.jhotdraw8.examples/src/main/java/org.jhotdraw8.examples/org/jhotdraw8/examples/mini/BezierArcLengthExampleMain.java @@ -6,6 +6,7 @@ package org.jhotdraw8.examples.mini; import javafx.application.Application; +import javafx.geometry.Point2D; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.input.MouseEvent; @@ -230,7 +231,7 @@ private void updateDistancePoints(Group distancePoints) { for (int i = 1, n = 10; i < n; i++) { double s = i / (double) n; - javafx.geometry.Point2D p = param.interpolate(s); + Point2D p = param.interpolate(s); Circle e = new Circle(p.getX(), p.getY(), 2); e.setFill(Color.BLUE); distancePoints.getChildren().add(e); @@ -247,7 +248,7 @@ private void addApproximatedDistancePoints(Group distancePoints) { double s = i / (double) n; double t = CubicCurves.invArcLength(b, 0, s * totalLength, epsilon); PointAndDerivative pat = CubicCurves.eval(b, 0, t); - javafx.geometry.Point2D p = pat.getPoint(javafx.geometry.Point2D::new); + Point2D p = pat.getPoint(Point2D::new); Circle e = new Circle(p.getX(), p.getY(), 4); e.setFill(Color.RED); distancePoints.getChildren().add(e); @@ -293,7 +294,7 @@ private void addApproximatedDistancePointsGaussLegendre(Group distancePoints) { double s = i / (double) n; double t = sToT.applyAsDouble(s * totalLength); PointAndDerivative pat = CubicCurves.eval(b, 0, t); - javafx.geometry.Point2D p = pat.getPoint(javafx.geometry.Point2D::new); + Point2D p = pat.getPoint(Point2D::new); Circle e = new Circle(p.getX(), p.getY(), 4); e.setFill(Color.ORANGE); distancePoints.getChildren().add(e); @@ -312,8 +313,8 @@ private void updateTimePoints() { curve.getControlY2(), curve.getEndX(), curve.getEndY(), t); - javafx.geometry.Point2D perp = new javafx.geometry.Point2D(pat.dy(), -pat.dx()); - javafx.geometry.Point2D tg = perp.normalize(); + Point2D perp = new Point2D(pat.dy(), -pat.dx()); + Point2D tg = perp.normalize(); timePoints.getChildren().add(new Line(pat.x() - tg.getX(), pat.y() - tg.getY(), pat.x() + tg.getX(), pat.y() + tg.getY())); @@ -405,7 +406,7 @@ public Segment(double pos, double x0, double y0, double x1, double y1) { /** * Absolute arc-length position. */ - public javafx.geometry.Point2D interpolate(double sabs) { + public Point2D interpolate(double sabs) { // return new javafx.geometry.Point2D(x0,y0); return FXGeom.lerp(x0, y0, x1, y1, (sabs - pos) / length); } @@ -450,13 +451,13 @@ public PathArcLengthParameterization(PathIterator it) { /** * Interpolates in {@code s in [0,1] */ - public javafx.geometry.Point2D interpolate(double s) { + public Point2D interpolate(double s) { double pos = s * length; Segment key = new Segment(pos); int search = Collections.binarySearch(segments, key); int index = Math.min(search < 0 ? ~search - 1 : search, segments.size() - 1); if (index < 0) { - return new javafx.geometry.Point2D(0, 0);// path is empty + return new Point2D(0, 0);// path is empty } else { Segment segment = segments.get(index); return segment.interpolate(pos); diff --git a/org.jhotdraw8.examples/src/main/java/org.jhotdraw8.examples/org/jhotdraw8/examples/mini/BiArcApproExampleMain.java b/org.jhotdraw8.examples/src/main/java/org.jhotdraw8.examples/org/jhotdraw8/examples/mini/BiArcApproExampleMain.java index 6a36fd42e..78b05a0f3 100755 --- a/org.jhotdraw8.examples/src/main/java/org.jhotdraw8.examples/org/jhotdraw8/examples/mini/BiArcApproExampleMain.java +++ b/org.jhotdraw8.examples/src/main/java/org.jhotdraw8.examples/org/jhotdraw8/examples/mini/BiArcApproExampleMain.java @@ -19,6 +19,7 @@ import javafx.scene.shape.MoveTo; import javafx.scene.shape.Path; import javafx.scene.shape.PathElement; +import javafx.scene.shape.Polyline; import javafx.scene.shape.QuadCurveTo; import javafx.stage.Stage; import org.jhotdraw8.annotation.NonNull; @@ -29,6 +30,7 @@ import org.jhotdraw8.geom.biarc.CubicCurveToBiArc; import java.awt.geom.CubicCurve2D; +import java.awt.geom.Point2D; import java.util.List; /** @@ -37,7 +39,7 @@ * @author Werner Randelshofer */ public class BiArcApproExampleMain extends Application { - private final javafx.scene.shape.Polyline polyline = new javafx.scene.shape.Polyline( + private final Polyline polyline = new Polyline( 110, 200, 160, 180, 210, 120, @@ -194,7 +196,7 @@ private void approxBezierCurve(ObservableList inf1, double x, doubl for (double t : CubicCurveCharacteristics.inflectionPoints( x, y, x1, y1, x2, y2, x3, y3)) { double r = 2; - java.awt.geom.Point2D p = CubicCurves.eval(x, y, x1, y1, x2, y2, x3, y3, t).getPoint(java.awt.geom.Point2D.Double::new); + Point2D p = CubicCurves.eval(x, y, x1, y1, x2, y2, x3, y3, t).getPoint(Point2D.Double::new); // Draw a circle around each inflection point inf1.add(new MoveTo(p.getX() - r, p.getY())); diff --git a/org.jhotdraw8.examples/src/main/java/org.jhotdraw8.examples/org/jhotdraw8/examples/mini/ContourPathExampleMain.java b/org.jhotdraw8.examples/src/main/java/org.jhotdraw8.examples/org/jhotdraw8/examples/mini/ContourPathExampleMain.java index 03a62eb99..c031cb155 100755 --- a/org.jhotdraw8.examples/src/main/java/org.jhotdraw8.examples/org/jhotdraw8/examples/mini/ContourPathExampleMain.java +++ b/org.jhotdraw8.examples/src/main/java/org.jhotdraw8.examples/org/jhotdraw8/examples/mini/ContourPathExampleMain.java @@ -24,6 +24,7 @@ import javafx.scene.paint.Color; import javafx.scene.shape.Path; import javafx.scene.shape.PathElement; +import javafx.scene.shape.Polyline; import javafx.stage.Stage; import org.jhotdraw8.annotation.NonNull; import org.jhotdraw8.geom.FXShapes; @@ -40,7 +41,7 @@ * @author Werner Randelshofer */ public class ContourPathExampleMain extends Application { - private final javafx.scene.shape.Polyline polyline = new javafx.scene.shape.Polyline( + private final Polyline polyline = new Polyline( 110, 200, 160, 180, 210, 120, @@ -182,7 +183,7 @@ private void updatePath() { } - private void doOffsetPath(javafx.scene.shape.Polyline polyline, Path path, double offset) { + private void doOffsetPath(Polyline polyline, Path path, double offset) { PlinePath pap = createPline(polyline); ContourBuilder papb = new ContourBuilder(); List offsetPlines = papb.parallelOffset(pap, offset); @@ -195,7 +196,7 @@ private void doOffsetPath(javafx.scene.shape.Polyline polyline, Path path, doubl } } - private @NonNull PlinePath createPline(javafx.scene.shape.Polyline polyline) { + private @NonNull PlinePath createPline(Polyline polyline) { PlinePath pap = new PlinePath(); ObservableList points = polyline.getPoints(); for (int i = 0, n = points.size(); i < n; i += 2) { diff --git a/org.jhotdraw8.examples/src/main/java/org.jhotdraw8.examples/org/jhotdraw8/examples/mini/MultipleMasterShapeMain.java b/org.jhotdraw8.examples/src/main/java/org.jhotdraw8.examples/org/jhotdraw8/examples/mini/MultipleMasterShapeMain.java index 9259de217..75b5730cd 100644 --- a/org.jhotdraw8.examples/src/main/java/org.jhotdraw8.examples/org/jhotdraw8/examples/mini/MultipleMasterShapeMain.java +++ b/org.jhotdraw8.examples/src/main/java/org.jhotdraw8.examples/org/jhotdraw8/examples/mini/MultipleMasterShapeMain.java @@ -5,6 +5,7 @@ import javafx.scene.Scene; import javafx.scene.shape.Path; import javafx.scene.shape.Rectangle; +import javafx.scene.shape.Shape; import javafx.scene.text.Font; import javafx.scene.text.Text; import javafx.stage.Stage; @@ -39,7 +40,7 @@ public void start(Stage stage) throws Exception { Text tx = new Text("a"); tx.setFont(Font.font("Helvetica Neue Bold", 144f)); - Path path = (Path) javafx.scene.shape.Shape.subtract(tx, new Rectangle()); + Path path = (Path) Shape.subtract(tx, new Rectangle()); System.out.println(FXSvgPaths.doubleSvgStringFromPathElements(path.getElements())); } } diff --git a/org.jhotdraw8.fxbase/src/main/java/org.jhotdraw8.fxbase/org/jhotdraw8/fxbase/concurrent/CompletableWorker.java b/org.jhotdraw8.fxbase/src/main/java/org.jhotdraw8.fxbase/org/jhotdraw8/fxbase/concurrent/CompletableWorker.java index 3333ef857..80e95cb88 100644 --- a/org.jhotdraw8.fxbase/src/main/java/org.jhotdraw8.fxbase/org/jhotdraw8/fxbase/concurrent/CompletableWorker.java +++ b/org.jhotdraw8.fxbase/src/main/java/org.jhotdraw8.fxbase/org/jhotdraw8/fxbase/concurrent/CompletableWorker.java @@ -11,7 +11,7 @@ /** * A {@code CompletableWorker} is a {@link Worker} that - * provides value that it produces in a {@link java.util.concurrent.CompletionStage} + * provides value that it produces in a {@link CompletionStage} * which completes (or fails) on the FX Application Thread. * * @param the result type diff --git a/org.jhotdraw8.fxbase/src/main/java/org.jhotdraw8.fxbase/org/jhotdraw8/fxbase/control/TextInputControlUndoAdapter.java b/org.jhotdraw8.fxbase/src/main/java/org.jhotdraw8.fxbase/org/jhotdraw8/fxbase/control/TextInputControlUndoAdapter.java index 72b7bbcdd..0f93598b6 100644 --- a/org.jhotdraw8.fxbase/src/main/java/org.jhotdraw8.fxbase/org/jhotdraw8/fxbase/control/TextInputControlUndoAdapter.java +++ b/org.jhotdraw8.fxbase/src/main/java/org.jhotdraw8.fxbase/org/jhotdraw8/fxbase/control/TextInputControlUndoAdapter.java @@ -22,7 +22,7 @@ import java.util.function.UnaryOperator; /** - * This adapter can be bound to a {@link javafx.scene.control.TextInputControl} + * This adapter can be bound to a {@link TextInputControl} * to support undo/redo with a {@link FXUndoManager}. *

* This text filter can be added to multiple text input controls. diff --git a/org.jhotdraw8.fxbase/src/main/java/org.jhotdraw8.fxbase/org/jhotdraw8/fxbase/converter/StringConverterAdapter.java b/org.jhotdraw8.fxbase/src/main/java/org.jhotdraw8.fxbase/org/jhotdraw8/fxbase/converter/StringConverterAdapter.java index 914e3e838..881d7689d 100755 --- a/org.jhotdraw8.fxbase/src/main/java/org.jhotdraw8.fxbase/org/jhotdraw8/fxbase/converter/StringConverterAdapter.java +++ b/org.jhotdraw8.fxbase/src/main/java/org.jhotdraw8.fxbase/org/jhotdraw8/fxbase/converter/StringConverterAdapter.java @@ -9,7 +9,6 @@ import org.jhotdraw8.annotation.Nullable; import org.jhotdraw8.base.converter.Converter; -import java.io.IOException; import java.text.ParseException; /** @@ -36,7 +35,7 @@ public StringConverterAdapter(Converter converter) { public @Nullable T fromString(@NonNull String string) { try { return converter.fromString(string); - } catch (ParseException | IOException ex) { + } catch (ParseException ex) { return converter.getDefaultValue(); } } diff --git a/org.jhotdraw8.fxbase/src/main/java/org.jhotdraw8.fxbase/org/jhotdraw8/fxbase/event/SimpleWeakListener.java b/org.jhotdraw8.fxbase/src/main/java/org.jhotdraw8.fxbase/org/jhotdraw8/fxbase/event/SimpleWeakListener.java index ef303df8d..0c5e1f469 100755 --- a/org.jhotdraw8.fxbase/src/main/java/org.jhotdraw8.fxbase/org/jhotdraw8/fxbase/event/SimpleWeakListener.java +++ b/org.jhotdraw8.fxbase/src/main/java/org.jhotdraw8.fxbase/org/jhotdraw8/fxbase/event/SimpleWeakListener.java @@ -4,6 +4,7 @@ */ package org.jhotdraw8.fxbase.event; +import javafx.beans.WeakListener; import org.jhotdraw8.annotation.NonNull; import org.jhotdraw8.annotation.Nullable; import org.jhotdraw8.base.event.Listener; @@ -19,7 +20,7 @@ * @param the type of the event * @author Werner Randelshofer */ -public final class SimpleWeakListener implements Listener, javafx.beans.WeakListener { +public final class SimpleWeakListener implements Listener, WeakListener { private final @NonNull WeakReference> ref; private final Consumer> removeListener; diff --git a/org.jhotdraw8.fxbase/src/main/java/org.jhotdraw8.fxbase/org/jhotdraw8/fxbase/text/StyleConverterAdapter.java b/org.jhotdraw8.fxbase/src/main/java/org.jhotdraw8.fxbase/org/jhotdraw8/fxbase/text/StyleConverterAdapter.java index bb9dd43a4..f95cea5fc 100755 --- a/org.jhotdraw8.fxbase/src/main/java/org.jhotdraw8.fxbase/org/jhotdraw8/fxbase/text/StyleConverterAdapter.java +++ b/org.jhotdraw8.fxbase/src/main/java/org.jhotdraw8.fxbase/org/jhotdraw8/fxbase/text/StyleConverterAdapter.java @@ -11,7 +11,6 @@ import org.jhotdraw8.annotation.Nullable; import org.jhotdraw8.base.converter.Converter; -import java.io.IOException; import java.text.ParseException; /** @@ -33,7 +32,7 @@ public StyleConverterAdapter(Converter converter) { public @Nullable T convert(@NonNull ParsedValue value, Font font) { try { return converter.fromString(value.getValue()); - } catch (ParseException | IOException ex) { + } catch (ParseException ex) { return converter.getDefaultValue(); } } diff --git a/org.jhotdraw8.fxbase/src/main/java/org.jhotdraw8.fxbase/org/jhotdraw8/fxbase/tree/TreeNode.java b/org.jhotdraw8.fxbase/src/main/java/org.jhotdraw8.fxbase/org/jhotdraw8/fxbase/tree/TreeNode.java index 086463443..d0dd79c45 100755 --- a/org.jhotdraw8.fxbase/src/main/java/org.jhotdraw8.fxbase/org/jhotdraw8/fxbase/tree/TreeNode.java +++ b/org.jhotdraw8.fxbase/src/main/java/org.jhotdraw8.fxbase/org/jhotdraw8/fxbase/tree/TreeNode.java @@ -93,7 +93,7 @@ default void dumpTree() { * * @param out an output stream * @param depth the indentation depth - * @throws java.io.IOException from appendable + * @throws IOException from appendable */ default void dumpTree(@NonNull Appendable out, int depth) throws IOException { for (int i = 0; i < depth; i++) { diff --git a/org.jhotdraw8.fxbase/src/main/java/org.jhotdraw8.fxbase/org/jhotdraw8/fxbase/undo/FXUndoManager.java b/org.jhotdraw8.fxbase/src/main/java/org.jhotdraw8.fxbase/org/jhotdraw8/fxbase/undo/FXUndoManager.java index b61e1313a..e854e61d1 100644 --- a/org.jhotdraw8.fxbase/src/main/java/org.jhotdraw8.fxbase/org/jhotdraw8/fxbase/undo/FXUndoManager.java +++ b/org.jhotdraw8.fxbase/src/main/java/org.jhotdraw8.fxbase/org/jhotdraw8/fxbase/undo/FXUndoManager.java @@ -16,7 +16,7 @@ import javax.swing.undo.UndoManager; public class FXUndoManager implements UndoableEditListener { - private final javax.swing.undo.@NonNull UndoManager manager; + private final @NonNull UndoManager manager; private final @NonNull BooleanProperty canUndo = new SimpleBooleanProperty(this, "canUndo", false); private final @NonNull BooleanProperty canRedo = new SimpleBooleanProperty(this, "canRedo", false); private final @NonNull StringProperty undoName = new SimpleStringProperty(this, "undoName", "Undo"); diff --git a/org.jhotdraw8.fxbase/src/main/java/org.jhotdraw8.fxbase/org/jhotdraw8/fxbase/undo/UndoableEditHelper.java b/org.jhotdraw8.fxbase/src/main/java/org.jhotdraw8.fxbase/org/jhotdraw8/fxbase/undo/UndoableEditHelper.java index ade608657..4c055de6e 100644 --- a/org.jhotdraw8.fxbase/src/main/java/org.jhotdraw8.fxbase/org/jhotdraw8/fxbase/undo/UndoableEditHelper.java +++ b/org.jhotdraw8.fxbase/src/main/java/org.jhotdraw8.fxbase/org/jhotdraw8/fxbase/undo/UndoableEditHelper.java @@ -12,7 +12,7 @@ import java.util.function.Consumer; /** - * Helper for firing {@link org.jhotdraw8.fxbase.undo.CompositeEdit} events. + * Helper for firing {@link CompositeEdit} events. */ public class UndoableEditHelper { private @Nullable CompositeEdit edit; diff --git a/org.jhotdraw8.fxcollection/src/main/java/org.jhotdraw8.fxcollection/org/jhotdraw8/fxcollection/sharedkeys/SharedKeysMap.java b/org.jhotdraw8.fxcollection/src/main/java/org.jhotdraw8.fxcollection/org/jhotdraw8/fxcollection/sharedkeys/SharedKeysMap.java index 7fbb6bca4..4345e3fbe 100755 --- a/org.jhotdraw8.fxcollection/src/main/java/org.jhotdraw8.fxcollection/org/jhotdraw8/fxcollection/sharedkeys/SharedKeysMap.java +++ b/org.jhotdraw8.fxcollection/src/main/java/org.jhotdraw8.fxcollection/org/jhotdraw8/fxcollection/sharedkeys/SharedKeysMap.java @@ -155,7 +155,7 @@ public boolean isEmpty() { public V put(K key, V value) { Integer index = keyMap.get(key); if (index == null) { - throw new UnsupportedOperationException("cannot put key=" + key + " value=" + value); + throw new UnsupportedOperationException("Cannot put key=" + key + " value=" + value); } return setValue(index, key, value); } diff --git a/org.jhotdraw8.geom/src/main/java/org.jhotdraw8.geom/org/jhotdraw8/geom/Angles.java b/org.jhotdraw8.geom/src/main/java/org.jhotdraw8.geom/org/jhotdraw8/geom/Angles.java index 5118974c8..e521ee917 100644 --- a/org.jhotdraw8.geom/src/main/java/org.jhotdraw8.geom/org/jhotdraw8/geom/Angles.java +++ b/org.jhotdraw8.geom/src/main/java/org.jhotdraw8.geom/org/jhotdraw8/geom/Angles.java @@ -7,6 +7,8 @@ import org.jhotdraw8.annotation.NonNull; +import java.awt.geom.Point2D; + import static java.lang.Math.PI; public class Angles { @@ -115,8 +117,8 @@ public static int direction(double x1, double y1, double x2, double y2) { * @param y the x value of the vector * @return the perpendicular vector */ - public static java.awt.geom.Point2D.@NonNull Double perp(double x, double y) { - return new java.awt.geom.Point2D.Double(y, -x); + public static Point2D.@NonNull Double perp(double x, double y) { + return new Point2D.Double(y, -x); } public static double atan2Ellipse(double cx, double cy, double rx, double ry, double x, double y) { diff --git a/org.jhotdraw8.geom/src/main/java/org.jhotdraw8.geom/org/jhotdraw8/geom/FXRectangles.java b/org.jhotdraw8.geom/src/main/java/org.jhotdraw8.geom/org/jhotdraw8/geom/FXRectangles.java index 2cbc77f80..14829b8fb 100644 --- a/org.jhotdraw8.geom/src/main/java/org.jhotdraw8.geom/org/jhotdraw8/geom/FXRectangles.java +++ b/org.jhotdraw8.geom/src/main/java/org.jhotdraw8.geom/org/jhotdraw8/geom/FXRectangles.java @@ -5,10 +5,16 @@ package org.jhotdraw8.geom; -import javafx.geometry.*; +import javafx.geometry.BoundingBox; +import javafx.geometry.Bounds; +import javafx.geometry.Insets; +import javafx.geometry.Point2D; +import javafx.geometry.Rectangle2D; import org.jhotdraw8.annotation.NonNull; import org.jhotdraw8.annotation.Nullable; +import java.awt.*; + import static java.lang.Math.max; import static java.lang.Math.min; @@ -19,7 +25,7 @@ public class FXRectangles { * @param shape an AWT shape * @return JavaFX bounds */ - public static @NonNull BoundingBox getBounds(java.awt.@NonNull Shape shape) { + public static @NonNull BoundingBox getBounds(@NonNull Shape shape) { java.awt.geom.Rectangle2D r = shape.getBounds2D(); return new BoundingBox(r.getX(), r.getY(), r.getWidth(), r.getHeight()); } diff --git a/org.jhotdraw8.geom/src/main/java/org.jhotdraw8.geom/org/jhotdraw8/geom/FXShapes.java b/org.jhotdraw8.geom/src/main/java/org.jhotdraw8.geom/org/jhotdraw8/geom/FXShapes.java index 6229f57c2..515e859af 100755 --- a/org.jhotdraw8.geom/src/main/java/org.jhotdraw8.geom/org/jhotdraw8/geom/FXShapes.java +++ b/org.jhotdraw8.geom/src/main/java/org.jhotdraw8.geom/org/jhotdraw8/geom/FXShapes.java @@ -5,17 +5,45 @@ package org.jhotdraw8.geom; import javafx.geometry.Bounds; +import javafx.geometry.Point2D; +import javafx.scene.shape.Arc; +import javafx.scene.shape.ArcTo; +import javafx.scene.shape.ArcType; +import javafx.scene.shape.Circle; +import javafx.scene.shape.ClosePath; +import javafx.scene.shape.CubicCurve; +import javafx.scene.shape.CubicCurveTo; +import javafx.scene.shape.Ellipse; +import javafx.scene.shape.FillRule; +import javafx.scene.shape.HLineTo; +import javafx.scene.shape.Line; +import javafx.scene.shape.LineTo; +import javafx.scene.shape.MoveTo; +import javafx.scene.shape.Path; +import javafx.scene.shape.PathElement; import javafx.scene.shape.Polygon; +import javafx.scene.shape.Polyline; +import javafx.scene.shape.QuadCurve; +import javafx.scene.shape.QuadCurveTo; import javafx.scene.shape.Rectangle; -import javafx.scene.shape.*; +import javafx.scene.shape.SVGPath; +import javafx.scene.shape.StrokeLineCap; +import javafx.scene.shape.StrokeLineJoin; +import javafx.scene.shape.VLineTo; import javafx.scene.text.Text; import javafx.scene.transform.MatrixType; +import javafx.scene.transform.Transform; import org.jhotdraw8.annotation.NonNull; import org.jhotdraw8.annotation.Nullable; -import java.awt.Shape; import java.awt.*; -import java.awt.geom.*; +import java.awt.geom.AffineTransform; +import java.awt.geom.Ellipse2D; +import java.awt.geom.Line2D; +import java.awt.geom.Path2D; +import java.awt.geom.PathIterator; +import java.awt.geom.Rectangle2D; +import java.awt.geom.RoundRectangle2D; import java.text.ParseException; import java.util.ArrayList; import java.util.List; @@ -73,7 +101,7 @@ public static PathIterator awtPathIteratorFromFXPathElements(List p return b.build(); } - public static @NonNull PathIterator awtPathIteratorFromFxPoint2Ds(@NonNull List points, boolean closed, int windingRule, @Nullable AffineTransform tx) { + public static @NonNull PathIterator awtPathIteratorFromFxPoint2Ds(@NonNull List points, boolean closed, int windingRule, @Nullable AffineTransform tx) { return new PathIterator() { final float @NonNull [] srcf = new float[2]; final double @NonNull [] srcd = new double[2]; @@ -83,7 +111,7 @@ public static PathIterator awtPathIteratorFromFXPathElements(List p @Override public int currentSegment(float[] coords) { if (index < size) { - javafx.geometry.Point2D p = points.get(index); + Point2D p = points.get(index); if (tx == null) { coords[0] = (float) p.getX(); coords[1] = (float) p.getY(); @@ -103,7 +131,7 @@ public int currentSegment(float[] coords) { @Override public int currentSegment(double[] coords) { if (index < size) { - javafx.geometry.Point2D p = points.get(index); + Point2D p = points.get(index); if (tx == null) { coords[0] = p.getX(); coords[1] = p.getY(); @@ -439,7 +467,7 @@ private static Shape awtShapeFromFXSvgPath(@NonNull SVGPath node) throws ParseEx * @param fxT A JavaFX Transform. * @return An AWT Transform. */ - public static @Nullable AffineTransform awtTransformFromFX(javafx.scene.transform.@Nullable Transform fxT) { + public static @Nullable AffineTransform awtTransformFromFX(@Nullable Transform fxT) { if (fxT == null) { return null; } @@ -486,7 +514,7 @@ private static Shape awtShapeFromFXSvgPath(@NonNull SVGPath node) throws ParseEx * @param fxT Optional transformation which is applied to the shape * @return JavaFX Shape */ - public static javafx.scene.shape.@NonNull Path fxShapeFromAwt(@NonNull Shape shape, javafx.scene.transform.Transform fxT) { + public static @NonNull Path fxShapeFromAwt(@NonNull Shape shape, Transform fxT) { return fxShapeFromAwt(shape.getPathIterator(awtTransformFromFX(fxT))); } @@ -497,7 +525,7 @@ private static Shape awtShapeFromFXSvgPath(@NonNull SVGPath node) throws ParseEx * @param at Optional transformation which is applied to the shape * @return JavaFX Shape */ - public static javafx.scene.shape.@NonNull Path fxShapeFromAwt(@NonNull Shape shape, AffineTransform at) { + public static @NonNull Path fxShapeFromAwt(@NonNull Shape shape, AffineTransform at) { return fxShapeFromAwt(shape.getPathIterator(at)); } @@ -507,7 +535,7 @@ private static Shape awtShapeFromFXSvgPath(@NonNull SVGPath node) throws ParseEx * @param shape AWT Shape * @return JavaFX Shape */ - public static javafx.scene.shape.@NonNull Path fxShapeFromAwt(@NonNull Shape shape) { + public static @NonNull Path fxShapeFromAwt(@NonNull Shape shape) { return fxShapeFromAwt(shape.getPathIterator(null)); } @@ -517,15 +545,15 @@ private static Shape awtShapeFromFXSvgPath(@NonNull SVGPath node) throws ParseEx * @param iter AWT Path Iterator * @return JavaFX Shape */ - public static javafx.scene.shape.@NonNull Path fxShapeFromAwt(@NonNull PathIterator iter) { - javafx.scene.shape.Path fxpath = new javafx.scene.shape.Path(); + public static @NonNull Path fxShapeFromAwt(@NonNull PathIterator iter) { + Path fxpath = new Path(); switch (iter.getWindingRule()) { case PathIterator.WIND_EVEN_ODD: - fxpath.setFillRule(javafx.scene.shape.FillRule.EVEN_ODD); + fxpath.setFillRule(FillRule.EVEN_ODD); break; case PathIterator.WIND_NON_ZERO: - fxpath.setFillRule(javafx.scene.shape.FillRule.NON_ZERO); + fxpath.setFillRule(FillRule.NON_ZERO); break; default: throw new IllegalArgumentException("illegal winding rule " + iter.getWindingRule()); diff --git a/org.jhotdraw8.geom/src/main/java/org.jhotdraw8.geom/org/jhotdraw8/geom/FXSvgPaths.java b/org.jhotdraw8.geom/src/main/java/org.jhotdraw8.geom/org/jhotdraw8/geom/FXSvgPaths.java index 4883489e2..e7116cd68 100644 --- a/org.jhotdraw8.geom/src/main/java/org.jhotdraw8.geom/org/jhotdraw8/geom/FXSvgPaths.java +++ b/org.jhotdraw8.geom/src/main/java/org.jhotdraw8.geom/org/jhotdraw8/geom/FXSvgPaths.java @@ -16,6 +16,7 @@ import javafx.scene.shape.PathElement; import javafx.scene.shape.QuadCurveTo; import javafx.scene.shape.VLineTo; +import javafx.scene.transform.Transform; import org.jhotdraw8.annotation.NonNull; import org.jhotdraw8.base.converter.NumberConverter; import org.jhotdraw8.base.io.StreamPosTokenizer; @@ -690,7 +691,7 @@ public static void reshapePathElements(String pathstr, @NonNull Bounds b, List

transformPathElements(@NonNull List elements, FillRule fillRule, javafx.scene.transform.Transform fxT) { + public static @NonNull List transformPathElements(@NonNull List elements, FillRule fillRule, Transform fxT) { ArrayList result = new ArrayList<>(); FXShapes.awtShapeFromFXPathElements(elements, fillRule); return result; diff --git a/org.jhotdraw8.geom/src/main/java/org.jhotdraw8.geom/org/jhotdraw8/geom/Points.java b/org.jhotdraw8.geom/src/main/java/org.jhotdraw8.geom/org/jhotdraw8/geom/Points.java index aeb8a4cda..5a683f49c 100644 --- a/org.jhotdraw8.geom/src/main/java/org.jhotdraw8.geom/org/jhotdraw8/geom/Points.java +++ b/org.jhotdraw8.geom/src/main/java/org.jhotdraw8.geom/org/jhotdraw8/geom/Points.java @@ -9,6 +9,7 @@ import java.awt.*; import java.awt.geom.PathIterator; +import java.awt.geom.Point2D; import static java.lang.Math.sqrt; @@ -66,11 +67,11 @@ public static float distanceF(double x1, double y1, double x2, double y2) { return (float) sqrt((float) (dx * dx + dy * dy)); } - public static boolean almostEqual(java.awt.geom.Point2D v1, java.awt.geom.Point2D v2) { + public static boolean almostEqual(Point2D v1, Point2D v2) { return almostEqual(v1, v2, Rectangles.REAL_THRESHOLD); } - public static boolean almostEqual(java.awt.geom.Point2D v1, java.awt.geom.Point2D v2, double epsilon) { + public static boolean almostEqual(Point2D v1, Point2D v2, double epsilon) { return v1.distanceSq(v2) < epsilon * epsilon; } @@ -82,11 +83,11 @@ public static boolean almostEqual(double x0, double y0, double x1, double y1, do return squaredDistance(x0, y0, x1, y1) < epsilon * epsilon; } - public static boolean almostZero(java.awt.geom.Point2D.Double v) { + public static boolean almostZero(Point2D.Double v) { return almostZero(v, Rectangles.REAL_THRESHOLD); } - public static boolean almostZero(java.awt.geom.Point2D.Double v, double epsilon) { + public static boolean almostZero(Point2D.Double v, double epsilon) { return Points2D.magnitudeSq(v) < epsilon * epsilon; } diff --git a/org.jhotdraw8.geom/src/main/java/org.jhotdraw8.geom/org/jhotdraw8/geom/PolylineToCubicCurve.java b/org.jhotdraw8.geom/src/main/java/org.jhotdraw8.geom/org/jhotdraw8/geom/PolylineToCubicCurve.java index c787d741a..30cc2723b 100755 --- a/org.jhotdraw8.geom/src/main/java/org.jhotdraw8.geom/org/jhotdraw8/geom/PolylineToCubicCurve.java +++ b/org.jhotdraw8.geom/src/main/java/org.jhotdraw8.geom/org/jhotdraw8/geom/PolylineToCubicCurve.java @@ -70,7 +70,7 @@ public static void fitBezierPath(@NonNull PathBuilder builder, Point2D[] digi * @param error the maximal allowed error between the bezier path and the * digitized points. */ - public static void fitBezierPath(@NonNull PathBuilder builder, java.util.@NonNull List digitizedPoints, double error) { + public static void fitBezierPath(@NonNull PathBuilder builder, @NonNull List digitizedPoints, double error) { // Split into segments at corners ArrayList> segments; segments = splitAtCorners(digitizedPoints, 77 / 180d * Math.PI, error * error); @@ -171,13 +171,13 @@ public static void fitBezierPath(@NonNull PathBuilder builder, @NonNull Bezie * 0, this method only removes sequences of coincident points. * @return Digitized points with a minimal distance. */ - public static @NonNull ArrayList removeClosePoints(java.util.@NonNull List digitizedPoints, double minDistance) { + public static @NonNull ArrayList removeClosePoints(@NonNull List digitizedPoints, double minDistance) { if (minDistance == 0) { return removeCoincidentPoints(digitizedPoints); } else { double squaredDistance = minDistance * minDistance; - java.util.ArrayList cleaned = new ArrayList<>(); + ArrayList cleaned = new ArrayList<>(); if (digitizedPoints.size() > 0) { Point2D prev = digitizedPoints.getFirst(); cleaned.add(prev); @@ -208,8 +208,8 @@ public static void fitBezierPath(@NonNull PathBuilder builder, @NonNull Bezie * @param digitizedPoints Digitized points * @return Digitized points without subsequent duplicates. */ - private static @NonNull ArrayList removeCoincidentPoints(java.util.@NonNull List digitizedPoints) { - java.util.ArrayList cleaned = new ArrayList<>(); + private static @NonNull ArrayList removeCoincidentPoints(@NonNull List digitizedPoints) { + ArrayList cleaned = new ArrayList<>(); if (digitizedPoints.size() > 0) { Point2D prev = digitizedPoints.getFirst(); cleaned.add(prev); @@ -237,7 +237,7 @@ public static void fitBezierPath(@NonNull PathBuilder builder, @NonNull Bezie * @return Segments of digitized points, each segment having less than * maximal angle between points. */ - public static @NonNull ArrayList> splitAtCorners(java.util.@NonNull List digitizedPoints, double maxAngle, double minDistance) { + public static @NonNull ArrayList> splitAtCorners(@NonNull List digitizedPoints, double maxAngle, double minDistance) { IntArrayList cornerIndices = findCorners(digitizedPoints, maxAngle, minDistance); ArrayList> segments = new ArrayList<>(cornerIndices.size() + 1); @@ -263,7 +263,7 @@ public static void fitBezierPath(@NonNull PathBuilder builder, @NonNull Bezie * for corner detection * @return list of corner indices. */ - public static @NonNull IntArrayList findCorners(java.util.@NonNull List digitizedPoints, double minAngle, double minDistance) { + public static @NonNull IntArrayList findCorners(@NonNull List digitizedPoints, double minAngle, double minDistance) { IntArrayList cornerIndices = new IntArrayList(); double squaredDistance = minDistance * minDistance; @@ -329,8 +329,8 @@ public static void fitBezierPath(@NonNull PathBuilder builder, @NonNull Bezie * @param weight Weight of the current point * @return Digitized points with reduced noise. */ - public static @NonNull ArrayList reduceNoise(java.util.@NonNull List digitizedPoints, double weight) { - java.util.ArrayList cleaned = new ArrayList<>(); + public static @NonNull ArrayList reduceNoise(@NonNull List digitizedPoints, double weight) { + ArrayList cleaned = new ArrayList<>(); if (digitizedPoints.size() > 0) { Point2D prev = digitizedPoints.getFirst(); cleaned.add(prev); diff --git a/org.jhotdraw8.geom/src/main/java/org.jhotdraw8.geom/org/jhotdraw8/geom/Rectangles.java b/org.jhotdraw8.geom/src/main/java/org.jhotdraw8.geom/org/jhotdraw8/geom/Rectangles.java index 3adf4e37a..c4fe3400b 100755 --- a/org.jhotdraw8.geom/src/main/java/org.jhotdraw8.geom/org/jhotdraw8/geom/Rectangles.java +++ b/org.jhotdraw8.geom/src/main/java/org.jhotdraw8.geom/org/jhotdraw8/geom/Rectangles.java @@ -6,6 +6,8 @@ import org.jhotdraw8.annotation.NonNull; +import java.awt.geom.Rectangle2D; + import static java.lang.Math.max; /** @@ -71,7 +73,7 @@ public static boolean contains(double rx, double ry, double rw, double rh, doubl * @param r2 Rectangle 2. * @return true if r1 contains r2. */ - public static boolean containsAWT(java.awt.geom.@NonNull Rectangle2D r1, java.awt.geom.@NonNull Rectangle2D r2) { + public static boolean containsAWT(@NonNull Rectangle2D r1, @NonNull Rectangle2D r2) { return (r2.getX()) >= r1.getX() && r2.getY() >= r1.getY() && (r2.getX() + max(0, r2.getWidth())) <= r1.getX() + max(0, r1.getWidth()) diff --git a/org.jhotdraw8.geom/src/main/java/org.jhotdraw8.geom/org/jhotdraw8/geom/ReversePathIterator.java b/org.jhotdraw8.geom/src/main/java/org.jhotdraw8.geom/org/jhotdraw8/geom/ReversePathIterator.java index 9198f7c36..82cf490a3 100644 --- a/org.jhotdraw8.geom/src/main/java/org.jhotdraw8.geom/org/jhotdraw8/geom/ReversePathIterator.java +++ b/org.jhotdraw8.geom/src/main/java/org.jhotdraw8.geom/org/jhotdraw8/geom/ReversePathIterator.java @@ -18,21 +18,21 @@ * There are several static convenience methods to create a reverse path iterator from * a shape directly: *

    - *
  • {@link #getReversePathIterator(java.awt.Shape)} + *
  • {@link #getReversePathIterator(Shape)} * for reversing the standard path iterator
  • - *
  • {@link #getReversePathIterator(java.awt.Shape, double)} + *
  • {@link #getReversePathIterator(Shape, double)} * for reversing a flattened path iterator
  • - *
  • {@link #getReversePathIterator(java.awt.Shape, java.awt.geom.AffineTransform)} + *
  • {@link #getReversePathIterator(Shape, AffineTransform)} * for reversing a transformed path iterator
  • - *
  • {@link #getReversePathIterator(java.awt.Shape, java.awt.geom.AffineTransform, double)} + *
  • {@link #getReversePathIterator(Shape, AffineTransform, double)} * for reversing a transformed flattened path iterator
  • - *
  • {@link #getReversePathIterator(java.awt.Shape, int)} + *
  • {@link #getReversePathIterator(Shape, int)} * for reversing the standard path iterator while explicitly defining a winding rule
  • - *
  • {@link #getReversePathIterator(java.awt.Shape, double, int)} + *
  • {@link #getReversePathIterator(Shape, double, int)} * for reversing a flattened path iterator while explicitly defining a winding rule
  • - *
  • {@link #getReversePathIterator(java.awt.Shape, java.awt.geom.AffineTransform, int)} + *
  • {@link #getReversePathIterator(Shape, AffineTransform, int)} * for reversing a transformed path iterator while explicitly defining a winding rule
  • - *
  • {@link #getReversePathIterator(java.awt.Shape, java.awt.geom.AffineTransform, double, int)} + *
  • {@link #getReversePathIterator(Shape, AffineTransform, double, int)} * for reversing a transformed flattened path iterator while explicitly defining a winding rule
  • *
*

diff --git a/org.jhotdraw8.geom/src/main/java/org.jhotdraw8.geom/org/jhotdraw8/geom/SvgPaths.java b/org.jhotdraw8.geom/src/main/java/org.jhotdraw8.geom/org/jhotdraw8/geom/SvgPaths.java index e568c1845..21ad4641a 100644 --- a/org.jhotdraw8.geom/src/main/java/org.jhotdraw8.geom/org/jhotdraw8/geom/SvgPaths.java +++ b/org.jhotdraw8.geom/src/main/java/org.jhotdraw8.geom/org/jhotdraw8/geom/SvgPaths.java @@ -18,6 +18,7 @@ import java.awt.geom.IllegalPathStateException; import java.awt.geom.Path2D; import java.awt.geom.PathIterator; +import java.awt.geom.Rectangle2D; import java.io.IOException; import java.io.StringReader; import java.text.ParseException; @@ -694,7 +695,7 @@ public static void svgStringReshapeToBuilder(@Nullable String pathstr, @NonNull Shape shape = null; try { shape = svgStringToAwtShape(pathstr); - java.awt.geom.Rectangle2D r2d = shape.getBounds2D(); + Rectangle2D r2d = shape.getBounds2D(); Transform tx = FXTransforms.createReshapeTransform( r2d.getX(), r2d.getY(), r2d.getWidth(), r2d.getHeight(), b.getMinX(), b.getMinY(), b.getWidth(), b.getHeight() diff --git a/org.jhotdraw8.graph/src/main/java/org.jhotdraw8.graph/org/jhotdraw8/graph/io/AdjacencyListWriter.java b/org.jhotdraw8.graph/src/main/java/org.jhotdraw8.graph/org/jhotdraw8/graph/io/AdjacencyListWriter.java index 33a63adc2..df8e8303d 100644 --- a/org.jhotdraw8.graph/src/main/java/org.jhotdraw8.graph/org/jhotdraw8/graph/io/AdjacencyListWriter.java +++ b/org.jhotdraw8.graph/src/main/java/org.jhotdraw8.graph/org/jhotdraw8/graph/io/AdjacencyListWriter.java @@ -46,7 +46,7 @@ public String write(@NonNull DirectedGraph graph) { * @param the arrow data type * @param w the writer * @param graph the graph to be dumped - * @throws java.io.IOException if writing fails + * @throws IOException if writing fails */ public void write(@NonNull Appendable w, @NonNull DirectedGraph graph) throws IOException { write(w, graph, Object::toString); @@ -60,7 +60,7 @@ public void write(@NonNull Appendable w, @NonNull DirectedGraph gra * @param w the writer * @param graph the graph to be dumped * @param toStringFunction a function which converts a vertex to a string - * @throws java.io.IOException if writing fails + * @throws IOException if writing fails */ public void write(@NonNull Appendable w, @NonNull DirectedGraph graph, @NonNull Function toStringFunction) throws IOException { { diff --git a/org.jhotdraw8.graph/src/main/java/org.jhotdraw8.graph/org/jhotdraw8/graph/io/GraphvizWriter.java b/org.jhotdraw8.graph/src/main/java/org.jhotdraw8.graph/org/jhotdraw8/graph/io/GraphvizWriter.java index e61db29f2..d6b276dbc 100644 --- a/org.jhotdraw8.graph/src/main/java/org.jhotdraw8.graph/org/jhotdraw8/graph/io/GraphvizWriter.java +++ b/org.jhotdraw8.graph/src/main/java/org.jhotdraw8.graph/org/jhotdraw8/graph/io/GraphvizWriter.java @@ -58,7 +58,7 @@ public GraphvizWriter() { * @param the arrow data type * @param w the writer * @param graph the graph - * @throws java.io.IOException if writing fails + * @throws IOException if writing fails */ public void write(@NonNull Appendable w, @NonNull DirectedGraph graph) throws IOException { write(w, graph, v -> "\"" + v + '"', null, null, null); @@ -74,7 +74,7 @@ public void write(@NonNull Appendable w, @NonNull DirectedGraph gra * @param graph the graph * @param vertexToString a function that converts a vertex to a String for * use as vertex name - * @throws java.io.IOException if writing fails + * @throws IOException if writing fails */ public void write(@NonNull Appendable w, @NonNull DirectedGraph graph, @NonNull Function vertexToString) throws IOException { @@ -124,7 +124,7 @@ public String write(@NonNull DirectedGraph graph, * @param arrowAttributes a function that converts an arrow to a String for * use as arrow attributes * @param graphId the id of the graph - * @throws java.io.IOException if writing fails + * @throws IOException if writing fails */ public void write(final @NonNull Appendable w, final @NonNull DirectedGraph graph, diff --git a/org.jhotdraw8.icollection/src/main/java/org.jhotdraw8.icollection/org/jhotdraw8/icollection/ChampMap.java b/org.jhotdraw8.icollection/src/main/java/org.jhotdraw8.icollection/org/jhotdraw8/icollection/ChampMap.java index f340578ab..e4f76a6cb 100644 --- a/org.jhotdraw8.icollection/src/main/java/org.jhotdraw8.icollection/org/jhotdraw8/icollection/ChampMap.java +++ b/org.jhotdraw8.icollection/src/main/java/org.jhotdraw8.icollection/org/jhotdraw8/icollection/ChampMap.java @@ -26,6 +26,7 @@ import java.util.Iterator; import java.util.Map; import java.util.Objects; +import java.util.Random; import java.util.Spliterator; /** @@ -98,7 +99,7 @@ public class ChampMap /** * We do not guarantee an iteration order. Make sure that nobody accidentally relies on it. */ - static final int SALT = new java.util.Random().nextInt(); + static final int SALT = new Random().nextInt(); final @NonNull BitmapIndexedNode root; final int size; diff --git a/org.jhotdraw8.icollection/src/main/java/org.jhotdraw8.icollection/org/jhotdraw8/icollection/NaturalComparator.java b/org.jhotdraw8.icollection/src/main/java/org.jhotdraw8.icollection/org/jhotdraw8/icollection/NaturalComparator.java index db2624980..9d2e0616e 100644 --- a/org.jhotdraw8.icollection/src/main/java/org.jhotdraw8.icollection/org/jhotdraw8/icollection/NaturalComparator.java +++ b/org.jhotdraw8.icollection/src/main/java/org.jhotdraw8.icollection/org/jhotdraw8/icollection/NaturalComparator.java @@ -53,7 +53,7 @@ public int hashCode() { * Instance control for object serialization. * * @return The singleton instance of NaturalComparator. - * @see java.io.Serializable + * @see Serializable */ private Object readResolve() { return INSTANCE; diff --git a/org.jhotdraw8.icollection/src/main/java/org.jhotdraw8.icollection/org/jhotdraw8/icollection/impl/champmap/ChampMap.java b/org.jhotdraw8.icollection/src/main/java/org.jhotdraw8.icollection/org/jhotdraw8/icollection/impl/champmap/ChampMap.java index 3be8f5a1b..f12024ff6 100644 --- a/org.jhotdraw8.icollection/src/main/java/org.jhotdraw8.icollection/org/jhotdraw8/icollection/impl/champmap/ChampMap.java +++ b/org.jhotdraw8.icollection/src/main/java/org.jhotdraw8.icollection/org/jhotdraw8/icollection/impl/champmap/ChampMap.java @@ -15,6 +15,7 @@ import java.util.AbstractMap; import java.util.Map; import java.util.Objects; +import java.util.Random; import java.util.Set; /** @@ -85,7 +86,7 @@ public class ChampMap extends AbstractMap implements Serializable, C /** * We do not guarantee an iteration order. Make sure that nobody accidentally relies on it. */ - static final int SALT = new java.util.Random().nextInt(); + static final int SALT = new Random().nextInt(); public ChampMap() { this.root = BitmapIndexedNode.emptyNode(); diff --git a/org.jhotdraw8.icollection/src/main/java/org.jhotdraw8.icollection/org/jhotdraw8/icollection/impl/vector/ArrayType.java b/org.jhotdraw8.icollection/src/main/java/org.jhotdraw8.icollection/org/jhotdraw8/icollection/impl/vector/ArrayType.java index e51ee393c..2fa0be609 100644 --- a/org.jhotdraw8.icollection/src/main/java/org.jhotdraw8.icollection/org/jhotdraw8/icollection/impl/vector/ArrayType.java +++ b/org.jhotdraw8.icollection/src/main/java/org.jhotdraw8.icollection/org/jhotdraw8/icollection/impl/vector/ArrayType.java @@ -6,6 +6,7 @@ import java.io.Serial; import java.io.Serializable; +import java.util.Iterator; /** * Helper to replace reflective array access. @@ -139,7 +140,7 @@ default Object asArray(T element) { /** * Store the content of an iterator in an array */ - static Object[] asArray(java.util.Iterator it, int length) { + static Object[] asArray(Iterator it, int length) { final Object[] array = new Object[length]; for (int i = 0; i < length; i++) { array[i] = it.next(); diff --git a/org.jhotdraw8.icollection/src/main/java/org.jhotdraw8.icollection/org/jhotdraw8/icollection/impl/vector/BitMappedTrie.java b/org.jhotdraw8.icollection/src/main/java/org.jhotdraw8.icollection/org/jhotdraw8/icollection/impl/vector/BitMappedTrie.java index 355d67c2d..f14fe8aad 100644 --- a/org.jhotdraw8.icollection/src/main/java/org.jhotdraw8.icollection/org/jhotdraw8/icollection/impl/vector/BitMappedTrie.java +++ b/org.jhotdraw8.icollection/src/main/java/org.jhotdraw8.icollection/org/jhotdraw8/icollection/impl/vector/BitMappedTrie.java @@ -13,7 +13,13 @@ import java.io.Serial; import java.io.Serializable; -import java.util.*; +import java.util.Collection; +import java.util.Collections; +import java.util.Iterator; +import java.util.NoSuchElementException; +import java.util.SequencedCollection; +import java.util.Spliterator; +import java.util.Spliterators; import java.util.function.Consumer; import java.util.function.Function; import java.util.function.Predicate; @@ -133,7 +139,7 @@ protected BitMappedTrie prependAll(@NonNull Iterable iterable) { } @NonNull - public BitMappedTrie prepend(java.util.@NonNull Iterator iterator, int size) { + public BitMappedTrie prepend(@NonNull Iterator iterator, int size) { BitMappedTrie result = this; while (size > 0) { Object array = result.array; @@ -181,7 +187,7 @@ private boolean isFullLeft() { return offset == 0; } - private @NonNull NodeModifier prependToLeaf(java.util.@NonNull Iterator iterator) { + private @NonNull NodeModifier prependToLeaf(@NonNull Iterator iterator) { return (array, index) -> { final Object copy = type.copy(array, BRANCHING_FACTOR); while (iterator.hasNext() && index >= 0) { @@ -215,7 +221,7 @@ public BitMappedTrie appendAll(@NonNull Iterable iterable) { } @NonNull - public BitMappedTrie append(java.util.@NonNull Iterator iterator, int size) { + public BitMappedTrie append(@NonNull Iterator iterator, int size) { BitMappedTrie result = this; while (size > 0) { Object array = result.array; @@ -263,7 +269,7 @@ private boolean isFullRight() { return (offset + length + 1) > treeSize(BRANCHING_FACTOR, depthShift); } - private @NonNull NodeModifier appendToLeaf(java.util.@NonNull Iterator iterator, int leafSize) { + private @NonNull NodeModifier appendToLeaf(@NonNull Iterator iterator, int leafSize) { return (array, index) -> { final Object copy = type.copy(array, leafSize); while (iterator.hasNext() && index < leafSize) { diff --git a/org.jhotdraw8.icollection/src/main/java/org.jhotdraw8.icollection/org/jhotdraw8/icollection/readonly/ReadOnlyList.java b/org.jhotdraw8.icollection/src/main/java/org.jhotdraw8.icollection/org/jhotdraw8/icollection/readonly/ReadOnlyList.java index 003d95a17..7a4c5ce1d 100755 --- a/org.jhotdraw8.icollection/src/main/java/org.jhotdraw8.icollection/org/jhotdraw8/icollection/readonly/ReadOnlyList.java +++ b/org.jhotdraw8.icollection/src/main/java/org.jhotdraw8.icollection/org/jhotdraw8/icollection/readonly/ReadOnlyList.java @@ -60,7 +60,7 @@ default E getLast(int index) { * Gets the first element of the list. * * @return the first element - * @throws java.util.NoSuchElementException if the list is empty + * @throws NoSuchElementException if the list is empty */ @Override default E getFirst() { @@ -74,7 +74,7 @@ default E getFirst() { * Gets the last element of the list. * * @return the last element - * @throws java.util.NoSuchElementException if the list is empty + * @throws NoSuchElementException if the list is empty */ @Override default E getLast() { diff --git a/org.jhotdraw8.icollection/src/main/java/org.jhotdraw8.icollection/org/jhotdraw8/icollection/readonly/ReadOnlySequencedMap.java b/org.jhotdraw8.icollection/src/main/java/org.jhotdraw8.icollection/org/jhotdraw8/icollection/readonly/ReadOnlySequencedMap.java index 5560821d1..4d0d851e9 100644 --- a/org.jhotdraw8.icollection/src/main/java/org.jhotdraw8.icollection/org/jhotdraw8/icollection/readonly/ReadOnlySequencedMap.java +++ b/org.jhotdraw8.icollection/src/main/java/org.jhotdraw8.icollection/org/jhotdraw8/icollection/readonly/ReadOnlySequencedMap.java @@ -44,7 +44,7 @@ public interface ReadOnlySequencedMap extends ReadOnlyMap { * Gets the first entry in this map or {@code null} if this map is empty. * * @return the first entry or {@code null} - * @throws java.util.NoSuchElementException if the map is empty + * @throws NoSuchElementException if the map is empty */ default Map.@Nullable Entry firstEntry() { return isEmpty() ? null : readOnlyEntrySet().iterator().next(); @@ -54,7 +54,7 @@ public interface ReadOnlySequencedMap extends ReadOnlyMap { * Gets the last entry in this map or {@code null} if this map is empty. * * @return the last entry or {@code null} - * @throws java.util.NoSuchElementException if the map is empty + * @throws NoSuchElementException if the map is empty */ default Map.@Nullable Entry lastEntry() { return isEmpty() ? null : readOnlyReversed().readOnlyEntrySet().iterator().next(); diff --git a/org.jhotdraw8.icollection/src/main/java/org.jhotdraw8.icollection/org/jhotdraw8/icollection/serialization/ListSerializationProxy.java b/org.jhotdraw8.icollection/src/main/java/org.jhotdraw8.icollection/org/jhotdraw8/icollection/serialization/ListSerializationProxy.java index 35b0f141a..37a2f9f13 100644 --- a/org.jhotdraw8.icollection/src/main/java/org.jhotdraw8.icollection/org/jhotdraw8/icollection/serialization/ListSerializationProxy.java +++ b/org.jhotdraw8.icollection/src/main/java/org.jhotdraw8.icollection/org/jhotdraw8/icollection/serialization/ListSerializationProxy.java @@ -8,6 +8,8 @@ import org.jhotdraw8.annotation.NonNull; import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; import java.io.Serial; import java.io.Serializable; import java.util.ArrayList; @@ -64,7 +66,7 @@ protected ListSerializationProxy(@NonNull List serialized) { } @Serial - private void writeObject(java.io.@NonNull ObjectOutputStream s) + private void writeObject(@NonNull ObjectOutputStream s) throws IOException { s.writeInt(serialized.size()); for (E e : serialized) { @@ -73,7 +75,7 @@ private void writeObject(java.io.@NonNull ObjectOutputStream s) } @Serial - private void readObject(java.io.@NonNull ObjectInputStream s) + private void readObject(@NonNull ObjectInputStream s) throws IOException, ClassNotFoundException { int n = s.readInt(); deserializedElements = new ArrayList<>(n); diff --git a/org.jhotdraw8.icollection/src/main/java/org.jhotdraw8.icollection/org/jhotdraw8/icollection/serialization/MapSerializationProxy.java b/org.jhotdraw8.icollection/src/main/java/org.jhotdraw8.icollection/org/jhotdraw8/icollection/serialization/MapSerializationProxy.java index 3543fcb2f..74204f9ef 100644 --- a/org.jhotdraw8.icollection/src/main/java/org.jhotdraw8.icollection/org/jhotdraw8/icollection/serialization/MapSerializationProxy.java +++ b/org.jhotdraw8.icollection/src/main/java/org.jhotdraw8.icollection/org/jhotdraw8/icollection/serialization/MapSerializationProxy.java @@ -8,6 +8,8 @@ import org.jhotdraw8.annotation.NonNull; import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; import java.io.Serial; import java.io.Serializable; import java.util.AbstractMap; @@ -67,7 +69,7 @@ protected MapSerializationProxy(Map serialized) { } @Serial - private void writeObject(java.io.@NonNull ObjectOutputStream s) + private void writeObject(@NonNull ObjectOutputStream s) throws IOException { s.writeInt(serialized.size()); for (Map.Entry entry : serialized.entrySet()) { @@ -77,7 +79,7 @@ private void writeObject(java.io.@NonNull ObjectOutputStream s) } @Serial - private void readObject(java.io.@NonNull ObjectInputStream s) + private void readObject(@NonNull ObjectInputStream s) throws IOException, ClassNotFoundException { int n = s.readInt(); deserializedEntries = new ArrayList<>(n); diff --git a/org.jhotdraw8.icollection/src/main/java/org.jhotdraw8.icollection/org/jhotdraw8/icollection/serialization/SetSerializationProxy.java b/org.jhotdraw8.icollection/src/main/java/org.jhotdraw8.icollection/org/jhotdraw8/icollection/serialization/SetSerializationProxy.java index 80c5a530e..4d5908ae1 100644 --- a/org.jhotdraw8.icollection/src/main/java/org.jhotdraw8.icollection/org/jhotdraw8/icollection/serialization/SetSerializationProxy.java +++ b/org.jhotdraw8.icollection/src/main/java/org.jhotdraw8.icollection/org/jhotdraw8/icollection/serialization/SetSerializationProxy.java @@ -8,6 +8,8 @@ import org.jhotdraw8.annotation.NonNull; import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; import java.io.Serial; import java.io.Serializable; import java.util.ArrayList; @@ -65,7 +67,7 @@ protected SetSerializationProxy(@NonNull Set serialized) { } @Serial - private void writeObject(java.io.@NonNull ObjectOutputStream s) + private void writeObject(@NonNull ObjectOutputStream s) throws IOException { s.writeInt(serialized.size()); for (E e : serialized) { @@ -74,7 +76,7 @@ private void writeObject(java.io.@NonNull ObjectOutputStream s) } @Serial - private void readObject(java.io.@NonNull ObjectInputStream s) + private void readObject(@NonNull ObjectInputStream s) throws IOException, ClassNotFoundException { int n = s.readInt(); deserializedElements = new ArrayList<>(n); diff --git a/org.jhotdraw8.icollection/src/main/java/org.jhotdraw8.icollection/org/jhotdraw8/icollection/serialization/SortedMapSerializationProxy.java b/org.jhotdraw8.icollection/src/main/java/org.jhotdraw8.icollection/org/jhotdraw8/icollection/serialization/SortedMapSerializationProxy.java index 0b3d87593..135235966 100644 --- a/org.jhotdraw8.icollection/src/main/java/org.jhotdraw8.icollection/org/jhotdraw8/icollection/serialization/SortedMapSerializationProxy.java +++ b/org.jhotdraw8.icollection/src/main/java/org.jhotdraw8.icollection/org/jhotdraw8/icollection/serialization/SortedMapSerializationProxy.java @@ -8,6 +8,8 @@ import org.jhotdraw8.annotation.NonNull; import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; import java.io.Serial; import java.io.Serializable; import java.util.AbstractMap; @@ -70,7 +72,7 @@ protected SortedMapSerializationProxy(SortedMap serialized) { } @Serial - private void writeObject(java.io.@NonNull ObjectOutputStream s) + private void writeObject(@NonNull ObjectOutputStream s) throws IOException { s.writeObject(serialized.comparator()); s.writeInt(serialized.size()); @@ -82,7 +84,7 @@ private void writeObject(java.io.@NonNull ObjectOutputStream s) @SuppressWarnings("unchecked") @Serial - private void readObject(java.io.@NonNull ObjectInputStream s) + private void readObject(@NonNull ObjectInputStream s) throws IOException, ClassNotFoundException { deserializedComparator = (Comparator) s.readObject(); int n = s.readInt(); diff --git a/org.jhotdraw8.icollection/src/main/java/org.jhotdraw8.icollection/org/jhotdraw8/icollection/serialization/SortedSetSerializationProxy.java b/org.jhotdraw8.icollection/src/main/java/org.jhotdraw8.icollection/org/jhotdraw8/icollection/serialization/SortedSetSerializationProxy.java index 6e778226e..02b0fc5ae 100644 --- a/org.jhotdraw8.icollection/src/main/java/org.jhotdraw8.icollection/org/jhotdraw8/icollection/serialization/SortedSetSerializationProxy.java +++ b/org.jhotdraw8.icollection/src/main/java/org.jhotdraw8.icollection/org/jhotdraw8/icollection/serialization/SortedSetSerializationProxy.java @@ -8,6 +8,8 @@ import org.jhotdraw8.annotation.NonNull; import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; import java.io.Serial; import java.io.Serializable; import java.util.ArrayList; @@ -67,7 +69,7 @@ protected SortedSetSerializationProxy(@NonNull SortedSet serialized) { } @Serial - private void writeObject(java.io.@NonNull ObjectOutputStream s) + private void writeObject(@NonNull ObjectOutputStream s) throws IOException { s.writeObject(serialized.comparator()); s.writeInt(serialized.size()); @@ -78,7 +80,7 @@ private void writeObject(java.io.@NonNull ObjectOutputStream s) @Serial @SuppressWarnings("unchecked") - private void readObject(java.io.@NonNull ObjectInputStream s) + private void readObject(@NonNull ObjectInputStream s) throws IOException, ClassNotFoundException { deserializedComparator = (Comparator) s.readObject(); int n = s.readInt(); diff --git a/org.jhotdraw8.os/src/main/java/org.jhotdraw8.os/org/jhotdraw8/os/macos/BinaryPListParser.java b/org.jhotdraw8.os/src/main/java/org.jhotdraw8.os/org/jhotdraw8/os/macos/BinaryPListParser.java index 726748ea8..cbfcaab33 100755 --- a/org.jhotdraw8.os/src/main/java/org.jhotdraw8.os/org/jhotdraw8/os/macos/BinaryPListParser.java +++ b/org.jhotdraw8.os/src/main/java/org.jhotdraw8.os/org/jhotdraw8/os/macos/BinaryPListParser.java @@ -36,7 +36,7 @@ *

* The DOM returned by this reader is equivalent to the * DOM returned, if a PList file in XML format is parsed with - * a standard {@link javax.xml.parsers.DocumentBuilder}. + * a standard {@link DocumentBuilder}. *

* Description about property list taken from * Apple's online documentation: @@ -282,7 +282,7 @@ public BinaryPListParser() { /** * Parses a binary PList file and turns it into a DOM. * The Document is equivalent with a XML PList file parsed using - * a standard {@link javax.xml.parsers.DocumentBuilder}. + * a standard {@link DocumentBuilder}. * * @param file A file containing a binary PList. * @return Returns the parsed Element. diff --git a/org.jhotdraw8.svg/src/main/java/org.jhotdraw8.svg/org/jhotdraw8/svg/figure/AbstractSvgGradientFigure.java b/org.jhotdraw8.svg/src/main/java/org.jhotdraw8.svg/org/jhotdraw8/svg/figure/AbstractSvgGradientFigure.java index ce7c9eb94..bc4dfbe5d 100755 --- a/org.jhotdraw8.svg/src/main/java/org.jhotdraw8.svg/org/jhotdraw8/svg/figure/AbstractSvgGradientFigure.java +++ b/org.jhotdraw8.svg/src/main/java/org.jhotdraw8.svg/org/jhotdraw8/svg/figure/AbstractSvgGradientFigure.java @@ -4,6 +4,7 @@ */ package org.jhotdraw8.svg.figure; +import javafx.scene.Group; import javafx.scene.Node; import javafx.scene.paint.Color; import javafx.scene.paint.CycleMethod; @@ -83,7 +84,7 @@ public AbstractSvgGradientFigure() { @Override public @NonNull Node createNode(@NonNull RenderContext drawingView) { - javafx.scene.Group g = new javafx.scene.Group(); + Group g = new Group(); g.setAutoSizeChildren(false); g.setManaged(false); g.setVisible(false); diff --git a/org.jhotdraw8.svg/src/main/java/org.jhotdraw8.svg/org/jhotdraw8/svg/figure/SvgDefsFigure.java b/org.jhotdraw8.svg/src/main/java/org.jhotdraw8.svg/org/jhotdraw8/svg/figure/SvgDefsFigure.java index d9757621a..c558f4a7c 100755 --- a/org.jhotdraw8.svg/src/main/java/org.jhotdraw8.svg/org/jhotdraw8/svg/figure/SvgDefsFigure.java +++ b/org.jhotdraw8.svg/src/main/java/org.jhotdraw8.svg/org/jhotdraw8/svg/figure/SvgDefsFigure.java @@ -5,6 +5,7 @@ package org.jhotdraw8.svg.figure; import javafx.collections.ObservableList; +import javafx.scene.Group; import javafx.scene.Node; import org.jhotdraw8.annotation.NonNull; import org.jhotdraw8.css.value.CssSize; @@ -42,7 +43,7 @@ public SvgDefsFigure() { @Override public @NonNull Node createNode(@NonNull RenderContext drawingView) { - javafx.scene.Group g = new javafx.scene.Group(); + Group g = new Group(); g.setAutoSizeChildren(false); g.setManaged(false); return g; @@ -64,7 +65,7 @@ public void updateNode(@NonNull RenderContext ctx, @NonNull Node n) { for (Figure child : getChildren()) { nodes.add(ctx.getNode(child)); } - ObservableList group = ((javafx.scene.Group) n).getChildren(); + ObservableList group = ((Group) n).getChildren(); if (!group.equals(nodes)) { group.setAll(nodes); } diff --git a/org.jhotdraw8.svg/src/main/java/org.jhotdraw8.svg/org/jhotdraw8/svg/figure/SvgGFigure.java b/org.jhotdraw8.svg/src/main/java/org.jhotdraw8.svg/org/jhotdraw8/svg/figure/SvgGFigure.java index 531228107..8607f50ca 100755 --- a/org.jhotdraw8.svg/src/main/java/org.jhotdraw8.svg/org/jhotdraw8/svg/figure/SvgGFigure.java +++ b/org.jhotdraw8.svg/src/main/java/org.jhotdraw8.svg/org/jhotdraw8/svg/figure/SvgGFigure.java @@ -5,6 +5,7 @@ package org.jhotdraw8.svg.figure; import javafx.collections.ObservableList; +import javafx.scene.Group; import javafx.scene.Node; import javafx.scene.transform.Transform; import org.jhotdraw8.annotation.NonNull; @@ -39,7 +40,7 @@ public class SvgGFigure extends AbstractCompositeFigure @Override public @NonNull Node createNode(@NonNull RenderContext drawingView) { - javafx.scene.Group g = new javafx.scene.Group(); + Group g = new Group(); g.setAutoSizeChildren(false); g.setManaged(false); return g; @@ -78,7 +79,7 @@ public void updateNode(@NonNull RenderContext ctx, @NonNull Node n) { for (Figure child : getChildren()) { nodes.add(ctx.getNode(child)); } - ObservableList group = ((javafx.scene.Group) n).getChildren(); + ObservableList group = ((Group) n).getChildren(); if (!group.equals(nodes)) { group.setAll(nodes); } diff --git a/org.jhotdraw8.svg/src/main/java/org.jhotdraw8.svg/org/jhotdraw8/svg/figure/SvgPathFigure.java b/org.jhotdraw8.svg/src/main/java/org.jhotdraw8.svg/org/jhotdraw8/svg/figure/SvgPathFigure.java index 963340d4a..16f585eaf 100755 --- a/org.jhotdraw8.svg/src/main/java/org.jhotdraw8.svg/org/jhotdraw8/svg/figure/SvgPathFigure.java +++ b/org.jhotdraw8.svg/src/main/java/org.jhotdraw8.svg/org/jhotdraw8/svg/figure/SvgPathFigure.java @@ -9,6 +9,7 @@ import javafx.scene.Group; import javafx.scene.Node; import javafx.scene.shape.FillRule; +import javafx.scene.shape.Path; import javafx.scene.shape.PathElement; import javafx.scene.transform.Transform; import org.jhotdraw8.annotation.NonNull; @@ -53,8 +54,8 @@ public class SvgPathFigure extends AbstractLeafFigure @Override public @NonNull Node createNode(@NonNull RenderContext ctx) { Group g = new Group(); - javafx.scene.shape.Path n0 = new javafx.scene.shape.Path(); - javafx.scene.shape.Path n1 = new javafx.scene.shape.Path(); + Path n0 = new Path(); + Path n1 = new Path(); n0.setManaged(false); n1.setManaged(false); g.getChildren().addAll(n0, n1); @@ -129,8 +130,8 @@ public void reshapeInLocal(double x, double y, double width, double height) { @Override public void updateNode(@NonNull RenderContext ctx, @NonNull Node node) { Group g = (Group) node; - javafx.scene.shape.Path n0 = (javafx.scene.shape.Path) g.getChildren().get(0); - javafx.scene.shape.Path n1 = (javafx.scene.shape.Path) g.getChildren().get(1); + Path n0 = (Path) g.getChildren().get(0); + Path n1 = (Path) g.getChildren().get(1); applyHideableFigureProperties(ctx, node); applyStyleableFigureProperties(ctx, node); diff --git a/org.jhotdraw8.svg/src/main/java/org.jhotdraw8.svg/org/jhotdraw8/svg/io/AbstractFXSvgWriter.java b/org.jhotdraw8.svg/src/main/java/org.jhotdraw8.svg/org/jhotdraw8/svg/io/AbstractFXSvgWriter.java index 7d2ec64da..d576952b9 100755 --- a/org.jhotdraw8.svg/src/main/java/org.jhotdraw8.svg/org/jhotdraw8/svg/io/AbstractFXSvgWriter.java +++ b/org.jhotdraw8.svg/src/main/java/org.jhotdraw8.svg/org/jhotdraw8/svg/io/AbstractFXSvgWriter.java @@ -350,7 +350,7 @@ private void drawText(@NonNull XMLStreamWriter w, @Nullable String str, protected abstract String getSvgVersion(); - private void initIdFactoryRecursively(javafx.scene.@NonNull Node node) throws IOException { + private void initIdFactoryRecursively(@NonNull Node node) throws IOException { String id = node.getId(); if (id != null && idFactory.getObject(id) == null) { idFactory.putIdAndObject(id, node); @@ -360,7 +360,7 @@ private void initIdFactoryRecursively(javafx.scene.@NonNull Node node) throws IO if (node instanceof Parent) { Parent pp = (Parent) node; - for (javafx.scene.Node child : pp.getChildrenUnmodifiable()) { + for (Node child : pp.getChildrenUnmodifiable()) { initIdFactoryRecursively(child); } } @@ -414,7 +414,7 @@ private boolean shouldWriteDefsRecursively(Node node) { if (node instanceof Parent) { Parent pp = (Parent) node; - for (javafx.scene.Node child : pp.getChildrenUnmodifiable()) { + for (Node child : pp.getChildrenUnmodifiable()) { if (shouldWriteDefsRecursively(child)) { return true; } @@ -634,7 +634,7 @@ private void writeDefsRecursively(XMLStreamWriter w, Node node) throws IOExcepti if (node instanceof Parent) { Parent pp = (Parent) node; - for (javafx.scene.Node child : pp.getChildrenUnmodifiable()) { + for (Node child : pp.getChildrenUnmodifiable()) { writeDefsRecursively(w, child); } } @@ -879,7 +879,7 @@ protected void writeNodeRecursively(@NonNull XMLStreamWriter w, @NonNull Node no if (node instanceof Parent) { final Parent pp = (Parent) node; - for (javafx.scene.Node child : pp.getChildrenUnmodifiable()) { + for (Node child : pp.getChildrenUnmodifiable()) { writeNodeRecursively(w, child, depth + 1); } } @@ -954,7 +954,7 @@ protected void writeStrokedShapeElement(@NonNull XMLStreamWriter w, @NonNull Sha cap, join, (float) fxShape.getStrokeMiterLimit(), dashes.length == 0 ? null : dashes, (float) fxShape.getStrokeDashOffset()).createStrokedShape(shape); - java.awt.geom.Area area = new java.awt.geom.Area(strokedShape); + Area area = new Area(strokedShape); switch (fxShape.getStrokeType()) { case INSIDE: diff --git a/org.jhotdraw8.svg/src/main/java/org.jhotdraw8.svg/org/jhotdraw8/svg/io/FigureSvgTinyReader.java b/org.jhotdraw8.svg/src/main/java/org.jhotdraw8.svg/org/jhotdraw8/svg/io/FigureSvgTinyReader.java index 5bb71a6e4..0471799d6 100644 --- a/org.jhotdraw8.svg/src/main/java/org.jhotdraw8.svg/org/jhotdraw8/svg/io/FigureSvgTinyReader.java +++ b/org.jhotdraw8.svg/src/main/java/org.jhotdraw8.svg/org/jhotdraw8/svg/io/FigureSvgTinyReader.java @@ -355,7 +355,7 @@ private void readAttributes(XMLStreamReader r, Figure node, Map, Object> hints = new HashMap<>(); idFactory.setDocumentHome(documentHome); RenderContext.RENDERING_INTENT.put(hints, RenderingIntent.EXPORT); - javafx.scene.Node drawingNode = toNode(external, selection, hints); + Node drawingNode = toNode(external, selection, hints); final AbstractFXSvgWriter exporter = createExporter(); exporter.setRelativizePaths(isRelativizePaths()); Document doc = exporter.toDocument(drawingNode, @@ -148,7 +148,7 @@ public void write(@NonNull Map clipboard, @NonNull Drawing d StringWriter out = new StringWriter(); Map, Object> hints = new HashMap<>(); RenderContext.RENDERING_INTENT.put(hints, RenderingIntent.EXPORT); - javafx.scene.Node drawingNode = toNode(drawing, selection, hints); + Node drawingNode = toNode(drawing, selection, hints); final AbstractFXSvgWriter exporter = createExporter(); exporter.setRelativizePaths(isRelativizePaths()); exporter.write(out, drawingNode, @@ -169,7 +169,7 @@ public void write(@NonNull Path file, @NonNull Drawing drawing, @NonNull WorkSta try (OutputStream w = Files.newOutputStream(file)) { final AbstractFXSvgWriter exporter = createExporter(); exporter.setRelativizePaths(isRelativizePaths()); - javafx.scene.Node drawingNode = toNode(drawing, Collections.singletonList(drawing), hints); + Node drawingNode = toNode(drawing, Collections.singletonList(drawing), hints); exporter.write(w, drawingNode, new CssDimension2D(drawing.getNonNull(Drawing.WIDTH), drawing.getNonNull(Drawing.HEIGHT))); } diff --git a/org.jhotdraw8.xml/src/main/java/org.jhotdraw8.xml/org/jhotdraw8/xml/XmlUtil.java b/org.jhotdraw8.xml/src/main/java/org.jhotdraw8.xml/org/jhotdraw8/xml/XmlUtil.java index 2b7cf6dff..275c9ea16 100755 --- a/org.jhotdraw8.xml/src/main/java/org.jhotdraw8.xml/org/jhotdraw8/xml/XmlUtil.java +++ b/org.jhotdraw8.xml/src/main/java/org.jhotdraw8.xml/org/jhotdraw8/xml/XmlUtil.java @@ -27,6 +27,7 @@ import javax.xml.stream.XMLInputFactory; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; +import javax.xml.stream.XMLStreamWriter; import javax.xml.transform.OutputKeys; import javax.xml.transform.Result; import javax.xml.transform.Source; @@ -165,7 +166,7 @@ public static Document read(InputSource inputSource, boolean namespaceAware) thr * @param inputSource the input source * @param namespaceAware whether to be name space aware * @return the document - * @throws java.io.IOException in case of failure + * @throws IOException in case of failure */ public static @NonNull Document readWithLocations(InputSource inputSource, boolean namespaceAware) throws IOException { try { @@ -272,6 +273,18 @@ public static void write(@NonNull Result result, @NonNull Document doc, @Nullabl } } + /** + * Creates an XMLStreamWriter that only writes data to the specified file. + * That is, it does not create socket connections. + * + * @param file a file + * @return an XMLStreamWriter + * @throws XMLStreamException when the XMLStreamWriter could not be created + */ + public static XMLStreamWriter streamWriter(final @NonNull Result file, @Nullable Properties outputProperties) throws XMLStreamException { + return ((StAXResult) replaceStreamResultByStAXResult(file, outputProperties)).getXMLStreamWriter(); + } + /** * Creates an XMLStreamReader that only reads data from the specified file. * That is, it does not create socket connections. @@ -280,7 +293,6 @@ public static void write(@NonNull Result result, @NonNull Document doc, @Nullabl * @return an XMLStreamReader * @throws XMLStreamException when the XMLStreamReader could not be created */ - public static XMLStreamReader streamReader(final @NonNull Source file) throws XMLStreamException { final XMLInputFactory dbf = XMLInputFactory.newInstance(); @@ -295,7 +307,6 @@ public static XMLStreamReader streamReader(final @NonNull Source file) throws XM namespace) -> null ); return dbf.createXMLStreamReader(file); - } /** @@ -306,18 +317,19 @@ public static XMLStreamReader streamReader(final @NonNull Source file) throws XM * @return the StaxResult if replacement was successful, the provided result otherwise */ private static Result replaceStreamResultByStAXResult(@NonNull Result result, @Nullable Properties outputProperties) { + if (outputProperties == null) outputProperties = new Properties(); if (result instanceof StreamResult sr) { IndentingXMLStreamWriter w; if (sr.getOutputStream() != null) w = new IndentingXMLStreamWriter(sr.getOutputStream(), Charset.forName((String) outputProperties.getOrDefault(OutputKeys.ENCODING, "UTF-8"))); - else if (sr.getWriter()!=null){ + else if (sr.getWriter() != null) { w = new IndentingXMLStreamWriter(sr.getWriter()); } else { return result; } - //w.setSortAttributes(false); + w.setSortAttributes(true); try { - int indentation = Integer.parseInt((String) outputProperties.getOrDefault(HTTP_XML_APACHE_ORG_XSLT_INDENT_AMOUNT, "0")); + int indentation = Integer.parseInt((String) outputProperties.getOrDefault(HTTP_XML_APACHE_ORG_XSLT_INDENT_AMOUNT, "2")); w.setIndentation(" ".repeat(indentation)); } catch (NumberFormatException e) { // bail @@ -329,7 +341,6 @@ else if (sr.getWriter()!=null){ } - private static class LocationFilter extends XMLFilterImpl { private Locator locator = null; diff --git a/org.jhotdraw8.xml/src/main/java/org.jhotdraw8.xml/org/jhotdraw8/xml/converter/DoubleXmlConverter.java b/org.jhotdraw8.xml/src/main/java/org.jhotdraw8.xml/org/jhotdraw8/xml/converter/DoubleXmlConverter.java index b989386c4..22a560bbe 100644 --- a/org.jhotdraw8.xml/src/main/java/org.jhotdraw8.xml/org/jhotdraw8/xml/converter/DoubleXmlConverter.java +++ b/org.jhotdraw8.xml/src/main/java/org.jhotdraw8.xml/org/jhotdraw8/xml/converter/DoubleXmlConverter.java @@ -45,7 +45,7 @@ public boolean getAllowsNullValue() { } @Override - public @Nullable Double fromString(@NonNull CharBuffer in, @Nullable IdResolver idResolver) throws ParseException, IOException { + public @Nullable Double fromString(@NonNull CharBuffer in, @Nullable IdResolver idResolver) throws ParseException { String str = in.toString(); try { if (str.strip().length() != str.length()) throw new NumberFormatException(); diff --git a/org.jhotdraw8.xml/src/main/java/org.jhotdraw8.xml/org/jhotdraw8/xml/converter/FloatXmlConverter.java b/org.jhotdraw8.xml/src/main/java/org.jhotdraw8.xml/org/jhotdraw8/xml/converter/FloatXmlConverter.java index f0a87f2c3..d5790a768 100644 --- a/org.jhotdraw8.xml/src/main/java/org.jhotdraw8.xml/org/jhotdraw8/xml/converter/FloatXmlConverter.java +++ b/org.jhotdraw8.xml/src/main/java/org.jhotdraw8.xml/org/jhotdraw8/xml/converter/FloatXmlConverter.java @@ -45,7 +45,7 @@ public boolean getAllowsNullValue() { } @Override - public @Nullable Float fromString(@NonNull CharBuffer in, @Nullable IdResolver idResolver) throws ParseException, IOException { + public @Nullable Float fromString(@NonNull CharBuffer in, @Nullable IdResolver idResolver) throws ParseException { String str = in.toString(); try { if (str.strip().length() != str.length()) throw new NumberFormatException(); diff --git a/org.jhotdraw8.xml/src/main/java/org.jhotdraw8.xml/org/jhotdraw8/xml/converter/IntegerXmlConverter.java b/org.jhotdraw8.xml/src/main/java/org.jhotdraw8.xml/org/jhotdraw8/xml/converter/IntegerXmlConverter.java index 2f86337b5..20c5925a8 100644 --- a/org.jhotdraw8.xml/src/main/java/org.jhotdraw8.xml/org/jhotdraw8/xml/converter/IntegerXmlConverter.java +++ b/org.jhotdraw8.xml/src/main/java/org.jhotdraw8.xml/org/jhotdraw8/xml/converter/IntegerXmlConverter.java @@ -33,14 +33,15 @@ public IntegerXmlConverter() { @Override - public @Nullable Integer fromString(@NonNull CharBuffer in, @Nullable IdResolver idResolver) throws ParseException, IOException { + public @Nullable Integer fromString(@NonNull CharBuffer in, @Nullable IdResolver idResolver) throws ParseException { + String str = in.toString(); try { if (in.isEmpty() && nullable) return null; - var result = Integer.parseInt(in.toString()); + var result = Integer.parseInt(str); in.position(in.length()); return result; } catch (NumberFormatException e) { - throw new ParseException("Illegal double value.", 0); + throw new ParseException("Illegal integer value=\"" + str + "\".", 0); } } diff --git a/org.jhotdraw8.xml/src/main/java/org.jhotdraw8.xml/org/jhotdraw8/xml/converter/ListXmlConverter.java b/org.jhotdraw8.xml/src/main/java/org.jhotdraw8.xml/org/jhotdraw8/xml/converter/ListXmlConverter.java index 5b3b517b1..eb6acabc2 100755 --- a/org.jhotdraw8.xml/src/main/java/org.jhotdraw8.xml/org/jhotdraw8/xml/converter/ListXmlConverter.java +++ b/org.jhotdraw8.xml/src/main/java/org.jhotdraw8.xml/org/jhotdraw8/xml/converter/ListXmlConverter.java @@ -70,7 +70,7 @@ public boolean needsIdResolver() { @Override - public @Nullable ImmutableList fromString(@NonNull CharBuffer in, @Nullable IdResolver idResolver) throws ParseException, IOException { + public @Nullable ImmutableList fromString(@NonNull CharBuffer in, @Nullable IdResolver idResolver) throws ParseException { String str = in.toString(); if (prefix != null) { if (!str.startsWith(prefix)) throw new ParseException("Must start with \"" + prefix + "\"", 0); diff --git a/org.jhotdraw8.xml/src/main/java/org.jhotdraw8.xml/org/jhotdraw8/xml/converter/LongXmlConverter.java b/org.jhotdraw8.xml/src/main/java/org.jhotdraw8.xml/org/jhotdraw8/xml/converter/LongXmlConverter.java index 17c00d2cf..1c5d3e672 100644 --- a/org.jhotdraw8.xml/src/main/java/org.jhotdraw8.xml/org/jhotdraw8/xml/converter/LongXmlConverter.java +++ b/org.jhotdraw8.xml/src/main/java/org.jhotdraw8.xml/org/jhotdraw8/xml/converter/LongXmlConverter.java @@ -18,7 +18,7 @@ * Schema Part 2: Datatypes Second Edition: 3.2.13 integer *

*/ -public class LongXmlConverter implements Converter { +public class LongXmlConverter implements Converter { private final boolean nullable; @@ -33,10 +33,10 @@ public LongXmlConverter() { @Override - public @Nullable Integer fromString(@NonNull CharBuffer in, @Nullable IdResolver idResolver) throws ParseException, IOException { + public @Nullable Long fromString(@NonNull CharBuffer in, @Nullable IdResolver idResolver) throws ParseException { try { if (in.isEmpty() && nullable) return null; - var result = Integer.parseInt(in.toString()); + var result = Long.parseLong(in.toString()); in.position(in.length()); return result; } catch (NumberFormatException e) { @@ -45,14 +45,14 @@ public LongXmlConverter() { } @Override - public void toString(Appendable buf, @Nullable IdSupplier idSupplier, @Nullable TT value) throws IOException { + public void toString(Appendable buf, @Nullable IdSupplier idSupplier, @Nullable TT value) throws IOException { if (value != null) { - buf.append(Integer.toString(value)); + buf.append(Long.toString(value)); } } @Override - public @Nullable Integer getDefaultValue() { - return 0; + public @Nullable Long getDefaultValue() { + return 0L; } } diff --git a/org.jhotdraw8.xml/src/main/java/org.jhotdraw8.xml/org/jhotdraw8/xml/converter/ObjectReferenceXmlConverter.java b/org.jhotdraw8.xml/src/main/java/org.jhotdraw8.xml/org/jhotdraw8/xml/converter/ObjectReferenceXmlConverter.java index 86f059107..e30a98737 100755 --- a/org.jhotdraw8.xml/src/main/java/org.jhotdraw8.xml/org/jhotdraw8/xml/converter/ObjectReferenceXmlConverter.java +++ b/org.jhotdraw8.xml/src/main/java/org.jhotdraw8.xml/org/jhotdraw8/xml/converter/ObjectReferenceXmlConverter.java @@ -47,12 +47,12 @@ public void toString(@NonNull Appendable out, @Nullable IdSupplie } @Override - public @Nullable T fromString(@NonNull CharBuffer buf, @Nullable IdResolver idResolver) throws ParseException, IOException { + public @Nullable T fromString(@NonNull CharBuffer buf, @Nullable IdResolver idResolver) throws ParseException { return fromString(buf.toString(), idResolver); } @Override - public @Nullable T fromString(@Nullable CharSequence buf, @Nullable IdResolver idResolver) throws ParseException, IOException { + public @Nullable T fromString(@Nullable CharSequence buf, @Nullable IdResolver idResolver) throws ParseException { if (idResolver == null) { throw new IllegalArgumentException("IdResolver is required for this converter"); } diff --git a/org.jhotdraw8.xml/src/main/java/org.jhotdraw8.xml/org/jhotdraw8/xml/converter/SetXmlConverter.java b/org.jhotdraw8.xml/src/main/java/org.jhotdraw8.xml/org/jhotdraw8/xml/converter/SetXmlConverter.java index a132836fd..75360fa52 100755 --- a/org.jhotdraw8.xml/src/main/java/org.jhotdraw8.xml/org/jhotdraw8/xml/converter/SetXmlConverter.java +++ b/org.jhotdraw8.xml/src/main/java/org.jhotdraw8.xml/org/jhotdraw8/xml/converter/SetXmlConverter.java @@ -62,7 +62,7 @@ public SetXmlConverter(@NonNull Converter elementConverter, @Nullable String } @Override - public @Nullable ImmutableSequencedSet fromString(@NonNull CharBuffer in, @Nullable IdResolver idResolver) throws ParseException, IOException { + public @Nullable ImmutableSequencedSet fromString(@NonNull CharBuffer in, @Nullable IdResolver idResolver) throws ParseException { String str = in.toString(); if (prefix != null) { if (!str.startsWith(prefix)) throw new ParseException("Must start with \"" + prefix + "\"", 0); diff --git a/org.jhotdraw8.xml/src/main/java/org.jhotdraw8.xml/org/jhotdraw8/xml/converter/UriXmlConverter.java b/org.jhotdraw8.xml/src/main/java/org.jhotdraw8.xml/org/jhotdraw8/xml/converter/UriXmlConverter.java index 5525be831..cd94f44e6 100755 --- a/org.jhotdraw8.xml/src/main/java/org.jhotdraw8.xml/org/jhotdraw8/xml/converter/UriXmlConverter.java +++ b/org.jhotdraw8.xml/src/main/java/org.jhotdraw8.xml/org/jhotdraw8/xml/converter/UriXmlConverter.java @@ -34,7 +34,7 @@ public void toString(@NonNull Appendable out, @Nullable IdSupplier idSupplier, @ } @Override - public @Nullable URI fromString(@NonNull CharBuffer in, @Nullable IdResolver idResolver) throws ParseException, IOException { + public @Nullable URI fromString(@NonNull CharBuffer in, @Nullable IdResolver idResolver) throws ParseException { String str = in.toString().trim(); in.position(in.limit());// fully consume the buffer if (CssTokenType.IDENT_NONE.equals(str)) { diff --git a/org.jhotdraw8.xml/src/main/java/org.jhotdraw8.xml/org/jhotdraw8/xml/converter/UrlXmlConverter.java b/org.jhotdraw8.xml/src/main/java/org.jhotdraw8.xml/org/jhotdraw8/xml/converter/UrlXmlConverter.java index 9f487d359..73681a5c3 100755 --- a/org.jhotdraw8.xml/src/main/java/org.jhotdraw8.xml/org/jhotdraw8/xml/converter/UrlXmlConverter.java +++ b/org.jhotdraw8.xml/src/main/java/org.jhotdraw8.xml/org/jhotdraw8/xml/converter/UrlXmlConverter.java @@ -11,6 +11,7 @@ import org.jhotdraw8.base.converter.IdSupplier; import java.io.IOException; +import java.net.MalformedURLException; import java.net.URL; import java.nio.CharBuffer; import java.text.ParseException; @@ -33,12 +34,19 @@ public void toString(@NonNull Appendable out, @Nullable IdSupplier idSupplier, @ } @Override - public @Nullable URL fromString(@NonNull CharBuffer in, @Nullable IdResolver idResolver) throws ParseException, IOException { + public @Nullable URL fromString(@NonNull CharBuffer in, @Nullable IdResolver idResolver) throws ParseException { String str = in.toString(); if (str.isEmpty()) { return null; } - URL value = new URL(str); + URL value = null; + try { + value = new URL(str); + } catch (MalformedURLException e) { + ParseException parseException = new ParseException(e.getMessage(), 0); + parseException.initCause(e); + throw parseException; + } in.position(in.limit()); return value; } diff --git a/org.jhotdraw8.xml/src/main/java/org.jhotdraw8.xml/org/jhotdraw8/xml/converter/WordListXmlConverter.java b/org.jhotdraw8.xml/src/main/java/org.jhotdraw8.xml/org/jhotdraw8/xml/converter/WordListXmlConverter.java index 659020382..6996bdf42 100755 --- a/org.jhotdraw8.xml/src/main/java/org.jhotdraw8.xml/org/jhotdraw8/xml/converter/WordListXmlConverter.java +++ b/org.jhotdraw8.xml/src/main/java/org.jhotdraw8.xml/org/jhotdraw8/xml/converter/WordListXmlConverter.java @@ -71,7 +71,7 @@ public > void toString(Appendable out, } @Override - public ImmutableList fromString(@NonNull CharBuffer buf, @Nullable IdResolver idResolver) throws ParseException, IOException { + public ImmutableList fromString(@NonNull CharBuffer buf, @Nullable IdResolver idResolver) throws ParseException { final TreeSet tree = new TreeSet<>(NFD_COMPARATOR); tree.addAll(Arrays.asList(buf.toString().split("\\s+"))); buf.position(buf.length());// consume buffer diff --git a/org.jhotdraw8.xml/src/main/java/org.jhotdraw8.xml/org/jhotdraw8/xml/converter/WordSetXmlConverter.java b/org.jhotdraw8.xml/src/main/java/org.jhotdraw8.xml/org/jhotdraw8/xml/converter/WordSetXmlConverter.java index 207beba2a..0ba7337e3 100755 --- a/org.jhotdraw8.xml/src/main/java/org.jhotdraw8.xml/org/jhotdraw8/xml/converter/WordSetXmlConverter.java +++ b/org.jhotdraw8.xml/src/main/java/org.jhotdraw8.xml/org/jhotdraw8/xml/converter/WordSetXmlConverter.java @@ -83,7 +83,7 @@ public > void toString(Appendable out, @Nullable } @Override - public ImmutableSet fromString(@NonNull CharBuffer buf, @Nullable IdResolver idResolver) throws ParseException, IOException { + public ImmutableSet fromString(@NonNull CharBuffer buf, @Nullable IdResolver idResolver) throws ParseException { String[] strings = buf.toString().split("\\s+"); // If there is a comparator, we do not need to use a sequenced set,