diff --git a/.github/workflows/main.linux.temurin.current.yml b/.github/workflows/main.linux.temurin.current.yml index ddf9951f..c9b7c7bd 100644 --- a/.github/workflows/main.linux.temurin.current.yml +++ b/.github/workflows/main.linux.temurin.current.yml @@ -14,7 +14,7 @@ jobs: - name: JDK uses: actions/setup-java@v3 with: - java-version: 20 + java-version: 21 distribution: 'temurin' - name: Build run: mvn --errors clean verify site diff --git a/.github/workflows/main.linux.temurin.lts.yml b/.github/workflows/main.linux.temurin.lts.yml index 8097a2de..1e6e9889 100644 --- a/.github/workflows/main.linux.temurin.lts.yml +++ b/.github/workflows/main.linux.temurin.lts.yml @@ -14,7 +14,7 @@ jobs: - name: JDK uses: actions/setup-java@v3 with: - java-version: 17 + java-version: 21 distribution: 'temurin' - name: Build run: mvn --errors clean verify site diff --git a/.github/workflows/main.windows.temurin.current.yml b/.github/workflows/main.windows.temurin.current.yml index ac380632..5099ab81 100644 --- a/.github/workflows/main.windows.temurin.current.yml +++ b/.github/workflows/main.windows.temurin.current.yml @@ -14,7 +14,7 @@ jobs: - name: JDK uses: actions/setup-java@v3 with: - java-version: 20 + java-version: 21 distribution: 'temurin' - name: Build run: mvn --errors clean verify site diff --git a/.github/workflows/main.windows.temurin.lts.yml b/.github/workflows/main.windows.temurin.lts.yml index 4c52f6b7..941f19c3 100644 --- a/.github/workflows/main.windows.temurin.lts.yml +++ b/.github/workflows/main.windows.temurin.lts.yml @@ -14,7 +14,7 @@ jobs: - name: JDK uses: actions/setup-java@v3 with: - java-version: 17 + java-version: 21 distribution: 'temurin' - name: Build run: mvn --errors clean verify site diff --git a/com.io7m.jsycamore.api/src/main/java/com/io7m/jsycamore/api/events/SyEventType.java b/com.io7m.jsycamore.api/src/main/java/com/io7m/jsycamore/api/events/SyEventType.java index a81b0e2a..5b859afd 100644 --- a/com.io7m.jsycamore.api/src/main/java/com/io7m/jsycamore/api/events/SyEventType.java +++ b/com.io7m.jsycamore.api/src/main/java/com/io7m/jsycamore/api/events/SyEventType.java @@ -16,6 +16,7 @@ package com.io7m.jsycamore.api.events; +import com.io7m.jsycamore.api.keyboard.SyKeyEventType; import com.io7m.jsycamore.api.menus.SyMenuEventType; import com.io7m.jsycamore.api.mouse.SyMouseEventType; import com.io7m.jsycamore.api.windows.SyWindowEventType; @@ -25,7 +26,7 @@ */ public sealed interface SyEventType - permits com.io7m.jsycamore.api.keyboard.SyKeyEventType, + permits SyKeyEventType, SyMenuEventType, SyMouseEventType, SyWindowEventType diff --git a/com.io7m.jsycamore.awt/src/main/java/com/io7m/jsycamore/awt/internal/SyAWTNodeRenderer.java b/com.io7m.jsycamore.awt/src/main/java/com/io7m/jsycamore/awt/internal/SyAWTNodeRenderer.java index 65643093..ce4727d3 100644 --- a/com.io7m.jsycamore.awt/src/main/java/com/io7m/jsycamore/awt/internal/SyAWTNodeRenderer.java +++ b/com.io7m.jsycamore.awt/src/main/java/com/io7m/jsycamore/awt/internal/SyAWTNodeRenderer.java @@ -25,9 +25,11 @@ import com.io7m.jsycamore.api.rendering.SyPaintGradientLinear; import com.io7m.jsycamore.api.rendering.SyRenderNodeComposite; import com.io7m.jsycamore.api.rendering.SyRenderNodeImage; +import com.io7m.jsycamore.api.rendering.SyRenderNodeNoop; import com.io7m.jsycamore.api.rendering.SyRenderNodeShape; import com.io7m.jsycamore.api.rendering.SyRenderNodeText; import com.io7m.jsycamore.api.rendering.SyRenderNodeType; +import com.io7m.jsycamore.api.rendering.SyShapeComposite; import com.io7m.jsycamore.api.rendering.SyShapePolygon; import com.io7m.jsycamore.api.rendering.SyShapeRectangle; import com.io7m.jsycamore.api.spaces.SySpaceComponentRelativeType; @@ -36,7 +38,7 @@ import com.io7m.jsycamore.api.text.SyFontDirectoryType; import com.io7m.jsycamore.api.text.SyFontException; import com.io7m.jtensors.core.parameterized.vectors.PVector4D; -import com.io7m.junreachable.UnreachableCodeException; +import com.io7m.junreachable.UnimplementedCodeException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -148,15 +150,14 @@ private static Paint fillToPaint( final PAreaI boundingArea, final SyPaintFillType fillPaint) { - if (fillPaint instanceof SyPaintFlat flat) { - return fillToPaintFlat(flat); - } - - if (fillPaint instanceof SyPaintGradientLinear linear) { - return fillToPaintGradientLinear(boundingArea, linear); - } - - throw new UnreachableCodeException(); + return switch (fillPaint) { + case final SyPaintFlat flat -> { + yield fillToPaintFlat(flat); + } + case final SyPaintGradientLinear linear -> { + yield fillToPaintGradientLinear(boundingArea, linear); + } + }; } private static Color toColor4( @@ -213,11 +214,14 @@ private static Paint edgeToPaint( final PAreaI boundingArea, final SyPaintEdgeType edgePaint) { - if (edgePaint instanceof SyPaintFlat flat) { - return edgeToPaintFlat(flat); - } - - throw new UnreachableCodeException(); + return switch (edgePaint) { + case final SyPaintFlat flat -> { + yield edgeToPaintFlat(flat); + } + case final SyPaintGradientLinear linear -> { + throw new UnimplementedCodeException(); + } + }; } private static Paint edgeToPaintFlat( @@ -276,13 +280,16 @@ private static void renderNodeShape( final Graphics2D g, final SyRenderNodeShape shape) { - if (shape.shape() instanceof SyShapeRectangle rectangle) { - renderShapeRectangle(g, shape.edgePaint(), shape.fillPaint(), rectangle); - return; - } - if (shape.shape() instanceof SyShapePolygon polygon) { - renderShapePolygon(g, shape.edgePaint(), shape.fillPaint(), polygon); - return; + switch (shape.shape()) { + case final SyShapeRectangle r -> { + renderShapeRectangle(g, shape.edgePaint(), shape.fillPaint(), r); + } + case final SyShapePolygon p -> { + renderShapePolygon(g, shape.edgePaint(), shape.fillPaint(), p); + } + case final SyShapeComposite c -> { + + } } } @@ -322,23 +329,24 @@ public void renderNode( final SyRenderNodeType renderNode) { try { - if (renderNode instanceof SyRenderNodeShape shape) { - renderNodeShape(graphics2D, shape); - return; - } - if (renderNode instanceof SyRenderNodeText text) { - renderNodeText(graphics2D, this.fontDirectory, text); - return; - } - if (renderNode instanceof SyRenderNodeImage image) { - this.renderNodeImage(graphics2D, image); - return; - } - if (renderNode instanceof SyRenderNodeComposite composite) { - for (final var node : composite.nodes()) { - this.renderNode(graphics2D, node); + switch (renderNode) { + case final SyRenderNodeShape shape -> { + renderNodeShape(graphics2D, shape); + } + case final SyRenderNodeText text -> { + this.renderNodeText(graphics2D, this.fontDirectory, text); + } + case final SyRenderNodeImage image -> { + this.renderNodeImage(graphics2D, image); + } + case final SyRenderNodeComposite composite -> { + for (final var node : composite.nodes()) { + this.renderNode(graphics2D, node); + } + } + case final SyRenderNodeNoop noOp -> { + } - return; } } finally { if (this.debugBounds) { diff --git a/com.io7m.jsycamore.theme.spi/src/main/java/com/io7m/jsycamore/theme/spi/SyThemeValues.java b/com.io7m.jsycamore.theme.spi/src/main/java/com/io7m/jsycamore/theme/spi/SyThemeValues.java index 4888e9fc..1ca7d6dc 100644 --- a/com.io7m.jsycamore.theme.spi/src/main/java/com/io7m/jsycamore/theme/spi/SyThemeValues.java +++ b/com.io7m.jsycamore.theme.spi/src/main/java/com/io7m/jsycamore/theme/spi/SyThemeValues.java @@ -447,47 +447,43 @@ private void evaluate() while (iterator.hasNext()) { final var node = iterator.next(); - if (node instanceof SyValueFunctionInteger functionNode) { - functionNode.evaluate( - Optional.ofNullable(this.nodes.get(functionNode.source())) - .orElseThrow(UnreachableCodeException::new) - ); - continue; - } - - if (node instanceof SyValueFunctionDouble functionNode) { - functionNode.evaluate( - Optional.ofNullable(this.nodes.get(functionNode.source())) - .orElseThrow(UnreachableCodeException::new) - ); - continue; - } - - if (node instanceof SyValueFunctionFont functionNode) { - functionNode.evaluate( - Optional.ofNullable(this.nodes.get(functionNode.source())) - .orElseThrow(UnreachableCodeException::new) - ); - continue; - } - - if (node instanceof SyValueFunctionColor4D functionNode) { - functionNode.evaluate( - Optional.ofNullable(this.nodes.get(functionNode.source())) - .orElseThrow(UnreachableCodeException::new) - ); - continue; - } - - if (node instanceof SyConstantType) { - continue; + switch (node) { + case final SyValueFunctionInteger functionNode -> { + functionNode.evaluate( + Optional.ofNullable(this.nodes.get(functionNode.source())) + .orElseThrow(UnreachableCodeException::new) + ); + continue; + } + case final SyValueFunctionDouble functionNode -> { + functionNode.evaluate( + Optional.ofNullable(this.nodes.get(functionNode.source())) + .orElseThrow(UnreachableCodeException::new) + ); + continue; + } + case final SyValueFunctionFont functionNode -> { + functionNode.evaluate( + Optional.ofNullable(this.nodes.get(functionNode.source())) + .orElseThrow(UnreachableCodeException::new) + ); + continue; + } + case final SyValueFunctionColor4D functionNode -> { + functionNode.evaluate( + Optional.ofNullable(this.nodes.get(functionNode.source())) + .orElseThrow(UnreachableCodeException::new) + ); + continue; + } + case final SyConstantType syConstantType -> { + continue; + } } - - throw new UnreachableCodeException(); } } - private static record ValueEdge( + private record ValueEdge( SyValueNodeType source, SyValueNodeType target) { diff --git a/pom.xml b/pom.xml index ae32f3b5..74d1d0b0 100644 --- a/pom.xml +++ b/pom.xml @@ -9,7 +9,7 @@ com.io7m.primogenitor com.io7m.primogenitor - 7.5.0 + 8.1.0 com.io7m.jsycamore @@ -36,11 +36,11 @@ 0.1.0 - 2.9.3 - 20.0.1 - 1.7.3 - 5.9.3 - 5.3.1 + 2.10.0 + 21.0.1 + 1.8.1 + 5.10.0 + 5.6.0 @@ -171,12 +171,12 @@ org.slf4j slf4j-api - 2.0.7 + 2.0.9 ch.qos.logback logback-classic - 1.4.7 + 1.4.11 net.java.dev.designgridlayout @@ -191,7 +191,7 @@ com.github.ben-manes.caffeine caffeine - 3.1.6 + 3.1.8 com.google.errorprone