Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump versions and CI #621

Merged
merged 5 commits into from
Sep 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,21 @@ name: Java CI

on: [push, pull_request]
env:
JAVA_REFERENCE_VERSION: 11
JAVA_REFERENCE_VERSION: 17

jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04]
java: [11, 17, 19]
java: [17, 20]
fail-fast: false
max-parallel: 4
name: Test JDK ${{ matrix.java }}, ${{ matrix.os }}
environment: coverage # open environment, no critical secrets
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
fetch-depth: 25
- name: Set version environment for version string
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/coverity.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ jobs:
environment: coverity # environment needs to be manually triggered only use on demand
steps:
- name: Checkout branch on that the Coverity scan was dispatched
uses: actions/checkout@v2
uses: actions/checkout@v3
if: ${{ github.event_name == 'workflow_run' }}
with:
ref: ${{ github.event.workflow_run.head_branch }}
fetch-depth: 25
- uses: actions/checkout@v2
- uses: actions/checkout@v3
if: ${{ github.event_name != 'workflow_run' }}
with:
fetch-depth: 25
Expand All @@ -41,15 +41,15 @@ jobs:
echo "setting env:"
cat ${GITHUB_ENV}
- name: Cache the Maven packages to speed up build
uses: actions/cache@v1
uses: actions/cache@v3
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Set up JDK11
uses: actions/setup-java@v2.1.0
uses: actions/setup-java@v3
with:
java-version: 11
java-version: 17
distribution: 'adopt'
- name: Download Coverity Build Tool
run: |
Expand Down
2 changes: 1 addition & 1 deletion chartfx-chart/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
<dependency>
<groupId>org.testfx</groupId>
<artifactId>testfx-junit5</artifactId>
<version>4.0.16-alpha</version>
<version>4.0.17</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
15 changes: 15 additions & 0 deletions chartfx-chart/src/main/java/io/fair_acc/chartfx/XYChart.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import io.fair_acc.bench.MeasurementRecorder;
import io.fair_acc.chartfx.axes.Axis;
import io.fair_acc.chartfx.axes.spi.AxisRange;
import io.fair_acc.chartfx.axes.spi.CategoryAxis;
import io.fair_acc.chartfx.plugins.ChartPlugin;
import io.fair_acc.chartfx.renderer.PolarTickStep;
import io.fair_acc.chartfx.renderer.Renderer;
Expand Down Expand Up @@ -228,6 +229,20 @@
if (changed && (axis.isAutoRanging() || axis.isAutoGrowRanging())) {
axis.invalidateRange();
}

// Feature for backwards compatibility: Category axes that do not have
// their categories set copy the categories of the first dataset of the
// first renderer that is using this axis.
if (axis instanceof CategoryAxis catAxis) {
for (Renderer renderer : getRenderers()) {
if (renderer.isUsingAxis(axis)) {
if (!renderer.getDatasets().isEmpty()) {
catAxis.updateCategories(renderer.getDatasets().get(0));
}
break;
}
}

Check warning on line 244 in chartfx-chart/src/main/java/io/fair_acc/chartfx/XYChart.java

View check run for this annotation

Codecov / codecov/patch

chartfx-chart/src/main/java/io/fair_acc/chartfx/XYChart.java#L244

Added line #L244 was not covered by tests
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import java.util.concurrent.ConcurrentHashMap;
import java.util.function.Predicate;

import javafx.application.Platform;
import javafx.beans.property.BooleanProperty;
import javafx.beans.property.DoubleProperty;
import javafx.beans.property.ObjectProperty;
Expand Down Expand Up @@ -53,6 +54,7 @@
import io.fair_acc.dataset.DataSet;
import io.fair_acc.dataset.EditConstraints;
import io.fair_acc.dataset.EditableDataSet;
import io.fair_acc.dataset.events.ChartBits;

/**
*
Expand Down Expand Up @@ -151,6 +153,14 @@ public class EditDataSet extends TableViewer {
}
};

@Override
public void runPostLayout() {
super.runPostLayout();
if (getChart().getBitState().isDirty(ChartBits.AxisMask | ChartBits.DataSetMask)) {
updateMarker();
}
}

/**
* Creates an event handler that handles a mouse drag on the node.
*/
Expand Down Expand Up @@ -967,11 +977,6 @@ protected class SelectedDataPoint extends Circle {
setOnMouseReleased(dragOver);
setOnMouseDragOver(dragOver);
// this.setOnMouseExited(dragOver);

// TODO: what are these?
// xAxis.addListener(evt -> FXUtils.runFX(() -> this.setCenterX(getX())));
// yAxis.addListener(evt -> FXUtils.runFX(() -> this.setCenterY(getY())));
// dataSet.addListener(e -> FXUtils.runFX(this::update));
}

public void applyDrag(final double deltaX, final double deltaY) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@
* TODO: revisit this plugin. we should be able to turn this into a single chart listener and an update method (ennerf)
* TODO: this is using Chart::getDataSets() which doesn't really exist anymore
*
* @deprecated prototype which is not usable yet and has to be adopted to the new layout
* @author akrimm
*/
@Deprecated
public class UpdateAxisLabels extends ChartPlugin {
private static final Logger LOGGER = LoggerFactory.getLogger(UpdateAxisLabels.class);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import static io.fair_acc.chartfx.axes.AxisMode.X;

import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
Expand Down Expand Up @@ -40,10 +41,7 @@
import io.fair_acc.chartfx.Chart;
import io.fair_acc.chartfx.axes.Axis;
import io.fair_acc.chartfx.axes.AxisMode;
import io.fair_acc.chartfx.plugins.AbstractSingleValueIndicator;
import io.fair_acc.chartfx.plugins.ParameterMeasurements;
import io.fair_acc.chartfx.plugins.XValueIndicator;
import io.fair_acc.chartfx.plugins.YValueIndicator;
import io.fair_acc.chartfx.plugins.*;
import io.fair_acc.chartfx.plugins.measurements.utils.CheckedValueField;
import io.fair_acc.chartfx.plugins.measurements.utils.DataSetSelector;
import io.fair_acc.chartfx.plugins.measurements.utils.ValueIndicatorSelector;
Expand Down Expand Up @@ -301,14 +299,26 @@
}

protected void removeAction() {
// remove unused indicators
List<ChartPlugin> toRemove = new ArrayList<>();
getValueIndicatorsUser().forEach(ind -> {
if (!ind.isAutoRemove()) {
return;

Check warning on line 306 in chartfx-chart/src/main/java/io/fair_acc/chartfx/plugins/measurements/AbstractChartMeasurement.java

View check run for this annotation

Codecov / codecov/patch

chartfx-chart/src/main/java/io/fair_acc/chartfx/plugins/measurements/AbstractChartMeasurement.java#L306

Added line #L306 was not covered by tests
}
boolean used = plugin.getChartMeasurements().stream().anyMatch(measurement -> measurement != this && measurement.getValueIndicatorsUser().contains(ind));
if (!used) {
toRemove.add(ind);
}
});
plugin.getChart().getPlugins().removeAll(toRemove);

getMeasurementPlugin().getChartMeasurements().remove(this);
getMeasurementPlugin().getDataView().getChildren().remove(dataViewWindow);
getMeasurementPlugin().getDataView().getVisibleChildren().remove(dataViewWindow);
getMeasurementPlugin().getDataView().getUndockedChildren().remove(dataViewWindow);
getValueIndicatorsUser().removeListener(valueIndicatorsUserChangeListener);

removeSliderChangeListener();
cleanUpSuperfluousIndicators();
}

protected void removeSliderChangeListener() {
Expand All @@ -323,15 +333,6 @@
});
}

protected void cleanUpSuperfluousIndicators() {
final Chart chart = getMeasurementPlugin().getChart();
if (chart == null) {
return;
}
final List<AbstractSingleValueIndicator> allIndicators = chart.getPlugins().stream().filter(p -> p instanceof AbstractSingleValueIndicator).map(p -> (AbstractSingleValueIndicator) p).collect(Collectors.toList());
// TODO: allIndicators.stream().filter((final AbstractSingleValueIndicator indicator) -> indicator.isAutoRemove() && indicator.getBitState().isEmpty()).forEach((final AbstractSingleValueIndicator indicator) -> getMeasurementPlugin().getChart().getPlugins().remove(indicator));
}

protected void updateSlider() {
if (!valueIndicatorSelector.isReuseIndicators()) {
getValueIndicatorsUser().clear();
Expand All @@ -340,7 +341,6 @@
for (int i = 0; i < requiredNumberOfIndicators; i++) {
updateSlider(i);
}
cleanUpSuperfluousIndicators();
}

protected AbstractSingleValueIndicator updateSlider(final int requestedIndex) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,7 @@ protected void addNewIndicators(ChartPlugin newPlugin) {
valueIndicators.add((AbstractSingleValueIndicator) newPlugin);
}

if (reuseIndicators.isSelected() && valueIndicatorsUser.size() < 2 && !valueIndicatorsUser.contains(newPlugin)) {
valueIndicatorsUser.add((AbstractSingleValueIndicator) newPlugin);
if (reuseIndicators.isSelected() && valueIndicatorsUser.size() < (indicatorListView.getSelectionModel().getSelectionMode() == SelectionMode.SINGLE ? 1 : 2) && !valueIndicatorsUser.contains(newPlugin)) {
indicatorListView.getSelectionModel().select((AbstractSingleValueIndicator) newPlugin);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,17 @@
// empty by default
}

/**
* Checks whether a renderer is actively using a given axis. The
* result is only valid after updateAxes has been called.
* <p>
* @param axis axis to be checked
* @return true if the renderer is actively using the given axis
*/
default boolean isUsingAxis(Axis axis) {
return getAxes().contains(axis);

Check warning on line 106 in chartfx-chart/src/main/java/io/fair_acc/chartfx/renderer/Renderer.java

View check run for this annotation

Codecov / codecov/patch

chartfx-chart/src/main/java/io/fair_acc/chartfx/renderer/Renderer.java#L106

Added line #L106 was not covered by tests
}

/**
* Updates the range for the specified axis.
* Does nothing if the axis is not used.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import io.fair_acc.chartfx.XYChart;
import io.fair_acc.chartfx.axes.Axis;
import io.fair_acc.chartfx.axes.spi.AxisRange;
import io.fair_acc.chartfx.axes.spi.CategoryAxis;
import io.fair_acc.chartfx.ui.css.DataSetNode;
import io.fair_acc.dataset.DataSet;
import io.fair_acc.dataset.utils.AssertUtils;
Expand Down Expand Up @@ -85,6 +86,22 @@
if (yAxis == null) {
yAxis = chart.getYAxis();
}

// Update category axes (TODO: remove this API?)
if (!getDatasets().isEmpty()) {
var ds = getDatasets().get(0);
if (xAxis instanceof CategoryAxis xCat) {
xCat.updateCategories(ds);
}
if (yAxis instanceof CategoryAxis yCat) {
yCat.updateCategories(ds);

Check warning on line 97 in chartfx-chart/src/main/java/io/fair_acc/chartfx/renderer/spi/AbstractRendererXY.java

View check run for this annotation

Codecov / codecov/patch

chartfx-chart/src/main/java/io/fair_acc/chartfx/renderer/spi/AbstractRendererXY.java#L97

Added line #L97 was not covered by tests
}
}
}

@Override
public boolean isUsingAxis(Axis axis) {
return axis == xAxis || axis == yAxis;
}

protected Axis ensureAxisInChart(Axis axis) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ public void updateAxes() {
}
}

@Override
public boolean isUsingAxis(Axis axis) {
return super.isUsingAxis(axis) || axis == zAxis;
}

@Override
public void updateAxisRange(Axis axis, AxisRange range) {
super.updateAxisRange(axis, range);
Expand Down
19 changes: 14 additions & 5 deletions chartfx-generate/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,26 +27,28 @@
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
<version>3.6.3</version>
<version>3.9.4</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-plugin-annotations</artifactId>
<version>3.6.0</version>
<version>3.9.0</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-project</artifactId>
<version>2.2.1</version>
</dependency>
<scope>provided</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin> <!-- move descriptor goal from process-classes to compile phase so that `mvn clean compile` works -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-plugin-plugin</artifactId>
<version>3.6.0</version>
<version>3.9.0</version>
<executions>
<execution>
<id>earlierPluginXML</id>
Expand All @@ -73,6 +75,13 @@
</execution>
</executions>
</plugin>
<plugin> <!-- attaching the javadoc fails the build because maven-project introduces a dependency with an invalid module descriptor -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
</project>
</project>
2 changes: 1 addition & 1 deletion chartfx-math/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
<dependency>
<groupId>net.jafama</groupId>
<artifactId>jafama</artifactId>
<version>2.3.1</version>
<version>2.3.2</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
2 changes: 1 addition & 1 deletion chartfx-samples/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
<dependency>
<groupId>net.jafama</groupId>
<artifactId>jafama</artifactId>
<version>2.3.1</version>
<version>2.3.2</version>
</dependency>
<dependency> <!-- Hierarchy debugging -->
<groupId>net.raumzeitfalle.fx</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ public Node getChartPanel(final Stage primaryStage) {
chart.getPlugins().add(new EditAxis());
chart.getPlugins().add(new EditDataSet());
chart.getPlugins().add(new DataPointTooltip());
chart.getPlugins().add(new UpdateAxisLabels());
root.getChildren().add(chart);

final DoubleDataSet dataSet1 = new DoubleDataSet("data set #1 (full change)");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,6 @@ private static XYChart getDefaultChart() {
final XYChart chart = new XYChart();
chart.getPlugins().add(new Zoomer());
chart.getPlugins().add(new EditAxis());
chart.getPlugins().add(new UpdateAxisLabels());
chart.getXAxis().setAutoRanging(true);
chart.getYAxis().setAutoRanging(true);
VBox.setVgrow(chart, Priority.ALWAYS);
Expand Down
Loading