Skip to content

Commit

Permalink
Update to newer java versions
Browse files Browse the repository at this point in the history
  • Loading branch information
I-Al-Istannen committed Dec 13, 2022
1 parent a00f3d3 commit e4866d8
Show file tree
Hide file tree
Showing 23 changed files with 538 additions and 1,064 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/releases.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,17 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
java-version: 8
java-package: jdk+fx
java-version: 11
distribution: 'temurin'

- name: Build
run: mvn clean package

- name: Upload binary
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: Binary
path: target/MiMaDebugger.jar
Expand All @@ -33,7 +33,7 @@ jobs:
steps:

- name: Download binaries
uses: actions/download-artifact@v2
uses: actions/download-artifact@v3
with:
name: Binary

Expand Down
92 changes: 71 additions & 21 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>me.ialistannen</groupId>
<artifactId>MiMaDebugger</artifactId>
<version>1.0-SNAPSHOT</version>
<version>1.1-SNAPSHOT</version>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand All @@ -18,22 +18,22 @@
**/me/ialistannen/mimadebugger/machine/instructions/Immutable*,
**/me/ialistannen/mimadebugger/gui/**/*
</sonar.coverage.exclusions>
<junit.version>5.9.0</junit.version>
</properties>

<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<version>3.10.1</version>
<configuration>
<target>8</target>
<source>8</source>
<release>11</release>
</configuration>
</plugin>

<plugin>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version>
<version>3.3.0</version>
<executions>
<execution>
<id>shade</id>
Expand All @@ -50,7 +50,7 @@
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<manifestEntries>
<Main-Class>me.ialistannen.mimadebugger.gui.MiMaGui</Main-Class>
<Main-Class>me.ialistannen.mimadebugger.gui.Launcher</Main-Class>
</manifestEntries>
</transformer>
</transformers>
Expand All @@ -59,7 +59,7 @@

<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.1</version>
<version>3.0.0-M7</version>
<!--Work around ubuntu packaging a broken java version,
see https://stackoverflow.com/a/53016532-->
<configuration>
Expand All @@ -70,7 +70,7 @@
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.2</version>
<version>0.8.8</version>
<executions>
<execution>
<id>prepare-agent</id>
Expand Down Expand Up @@ -122,47 +122,97 @@
<dependency>
<groupId>org.immutables</groupId>
<artifactId>value</artifactId>
<version>2.7.1</version>
<version>2.9.2</version>
<scope>provided</scope>
</dependency>

<!--PERSISTENT COLLECTIONS-->
<dependency>
<groupId>org.pcollections</groupId>
<artifactId>pcollections</artifactId>
<version>3.0.3</version>
<version>4.0.1</version>
</dependency>

<dependency>
<groupId>com.jfoenix</groupId>
<artifactId>jfoenix</artifactId>
<version>8.0.7</version>
<version>9.0.10</version>
</dependency>

<dependency>
<groupId>org.fxmisc.richtext</groupId>
<artifactId>richtextfx</artifactId>
<version>0.9.1</version>
<version>0.11.0</version>
<exclusions>
<exclusion>
<artifactId>javafx-base</artifactId>
<groupId>org.openjfx</groupId>
</exclusion>
<exclusion>
<artifactId>javafx-controls</artifactId>
<groupId>org.openjfx</groupId>
</exclusion>
<exclusion>
<artifactId>javafx-fxml</artifactId>
<groupId>org.openjfx</groupId>
</exclusion>
<exclusion>
<artifactId>javafx-graphics</artifactId>
<groupId>org.openjfx</groupId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-base</artifactId>
<version>19</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>19</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-fxml</artifactId>
<version>19</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-graphics</artifactId>
<version>19</version>
<classifier>win</classifier>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-graphics</artifactId>
<version>19</version>
<classifier>mac</classifier>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-graphics</artifactId>
<version>19</version>
<classifier>linux</classifier>
</dependency>

<!--TEST-->
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>3.23.1</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.3.1</version>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId>
<version>5.3.1</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.hamcrest/hamcrest-junit -->
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-junit</artifactId>
<version>2.0.0.0</version>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
8 changes: 8 additions & 0 deletions src/main/java/me/ialistannen/mimadebugger/gui/Launcher.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package me.ialistannen.mimadebugger.gui;

public class Launcher {

public static void main(String[] args) {
MiMaGui.launch(MiMaGui.class, args);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.layout.BorderPane;
import me.ialistannen.mimadebugger.gui.util.AutoSizableTableViewSkin;
import me.ialistannen.mimadebugger.gui.util.FxmlUtil;
import me.ialistannen.mimadebugger.gui.util.TableHelper;
import me.ialistannen.mimadebugger.machine.memory.Registers;
Expand Down Expand Up @@ -42,6 +43,7 @@ void initialize() {
tableView.widthProperty().addListener(
(observable, oldValue, newValue) -> TableHelper.autoSizeColumns(tableView)
);
tableView.setSkin(new AutoSizableTableViewSkin(tableView));
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
package me.ialistannen.mimadebugger.gui.util;

import javafx.scene.control.TableColumnBase;
import javafx.scene.control.TableView;
import javafx.scene.control.skin.NestedTableColumnHeader;
import javafx.scene.control.skin.TableColumnHeader;
import javafx.scene.control.skin.TableHeaderRow;
import javafx.scene.control.skin.TableViewSkin;
import javafx.scene.control.skin.TableViewSkinBase;

public class AutoSizableTableViewSkin<T> extends TableViewSkin<T> {

public AutoSizableTableViewSkin(TableView<T> tableView) {
super(tableView);
}

@Override
protected TableHeaderRow createTableHeaderRow() {
return new MyTableHeaderRow(this);
}

public static class MyTableHeaderRow extends TableHeaderRow {

public MyTableHeaderRow(TableViewSkinBase base) {
super(base);
}

@Override
protected NestedTableColumnHeader createRootHeader() {
return new MyNestedTableColumnHeader();
}

}

public static class ColumnHeader extends TableColumnHeader {

public ColumnHeader(TableColumnBase col) {
super(col);
}

public void resizeColumnToFitContent() {
super.resizeColumnToFitContent(-1);
}
}

public static class MyNestedTableColumnHeader extends NestedTableColumnHeader {

public MyNestedTableColumnHeader() {
super(null);
}

@Override
protected TableColumnHeader createTableColumnHeader(TableColumnBase col) {
return new ColumnHeader(col);
}

}
}
Original file line number Diff line number Diff line change
@@ -1,22 +1,17 @@
package me.ialistannen.mimadebugger.gui.util;

import com.sun.javafx.scene.control.skin.TableViewSkin;
import java.lang.reflect.Method;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.logging.Level;
import java.util.logging.Logger;
import javafx.beans.property.SimpleObjectProperty;
import javafx.scene.Node;
import javafx.scene.control.TableCell;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import me.ialistannen.mimadebugger.gui.util.AutoSizableTableViewSkin.ColumnHeader;

public final class TableHelper {

private static final Logger LOGGER = Logger.getLogger("TableHelper");

private TableHelper() {
throw new UnsupportedOperationException("No instantiation");
}
Expand All @@ -42,9 +37,8 @@ public static <S, T> TableColumn<S, T> column(String name, Function<S, T> valueF
}

/**
* Creates a new {@link TableCell} with the given mutation function.
*
* This method takes care of all the default emptying and resetting of the cell,
* Creates a new {@link TableCell} with the given mutation function. This method takes care of all
* the default emptying and resetting of the cell,
* <em>but does not null the graphic.</em>
*
* @param creation the supplier to create a graphic
Expand All @@ -57,7 +51,7 @@ public static <S, T> TableColumn<S, T> column(String name, Function<S, T> valueF
*/
public static <S, T, D extends Node> TableCell<S, T> cell(Function<T, D> creation,
Consumer<D> clear, BiConsumer<T, D> set) {
return new TableCell<S, T>() {
return new TableCell<>() {
@Override
protected void updateItem(T item, boolean empty) {
super.updateItem(item, empty);
Expand Down Expand Up @@ -89,15 +83,9 @@ protected void updateItem(T item, boolean empty) {
* @param tableView the table view to resize
*/
public static void autoSizeColumns(TableView<?> tableView) {
try {
Method method = TableViewSkin.class
.getDeclaredMethod("resizeColumnToFitContent", TableColumn.class, int.class);
method.setAccessible(true);
for (TableColumn<?, ?> column : tableView.getColumns()) {
method.invoke(tableView.getSkin(), column, -1);
}
} catch (ReflectiveOperationException e) {
LOGGER.log(Level.WARNING, "Error setting tableview size", e);
for (TableColumn<?, ?> column : tableView.getColumns()) {
ColumnHeader header = (ColumnHeader) column.getStyleableNode();
header.resizeColumnToFitContent();
}
}

Expand Down
Loading

0 comments on commit e4866d8

Please sign in to comment.