Skip to content

Commit

Permalink
Fix: <Type>Prefroperty#bind now persist to Preferences store
Browse files Browse the repository at this point in the history
Fix: Get around docker-java Bind#parse bug for Windows
Add --vendor, --win-dir-choose and --win-menu to installer
  • Loading branch information
kinhong committed Feb 4, 2020
1 parent bd964f7 commit 63a5e48
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 15 deletions.
5 changes: 0 additions & 5 deletions app/openlabeler-app.iml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Maven: org.controlsfx:controlsfx:11.0.0" level="project" />
<orderEntry type="library" name="Maven: org.tensorflow:tensorflow:1.15.0" level="project" />
<orderEntry type="library" name="Maven: org.tensorflow:libtensorflow:1.15.0" level="project" />
<orderEntry type="library" name="Maven: org.tensorflow:libtensorflow_jni:1.15.0" level="project" />
<orderEntry type="library" name="Maven: org.tensorflow:proto:1.15.0" level="project" />
<orderEntry type="library" name="Maven: org.openjfx:javafx-controls:11.0.2" level="project" />
<orderEntry type="library" name="Maven: org.openjfx:javafx-controls:mac:11.0.2" level="project" />
<orderEntry type="library" name="Maven: org.openjfx:javafx-graphics:11.0.2" level="project" />
Expand Down
25 changes: 17 additions & 8 deletions app/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,12 @@
</plugin>
</plugins>
</build>
<properties>
<project.build.add-modules>
java.base,java.logging,java.desktop,java.prefs,java.xml,javafx.base,javafx.graphics,javafx.controls,javafx.fxml,javafx.web,javafx.media
</project.build.add-modules>
<project.vendor>OpenLabeler</project.vendor>
</properties>
<profiles>
<profile>
<id>mac</id>
Expand Down Expand Up @@ -274,6 +280,8 @@
<argument>${project.build.directory}/libs</argument>
<argument>--class</argument>
<argument>com.easymobo.openlabeler.Main</argument>
<argument>--vendor</argument>
<argument>${project.vendor}</argument>
<argument>--version</argument>
<argument>${revision}</argument>
<argument>--main-jar</argument>
Expand All @@ -291,9 +299,7 @@
<argument>--module-path</argument>
<argument>${java.home}/jmods:${project.build.directory}/mods</argument>
<argument>--add-modules</argument>
<argument>
java.base,java.logging,java.desktop,java.prefs,java.xml,javafx.base,javafx.graphics,javafx.controls,javafx.fxml,javafx.web,javafx.media
</argument>
<argument>${project.build.add-modules}</argument>
<argument>--strip-native-commands</argument>
</arguments>
</configuration>
Expand Down Expand Up @@ -351,6 +357,8 @@
<argument>${project.build.directory}/libs</argument>
<argument>--class</argument>
<argument>com.easymobo.openlabeler.Main</argument>
<argument>--vendor</argument>
<argument>${project.vendor}</argument>
<argument>--version</argument>
<argument>${revision}</argument>
<argument>--main-jar</argument>
Expand All @@ -370,9 +378,7 @@
<argument>--module-path</argument>
<argument>${java.home}/jmods:${project.build.directory}/mods</argument>
<argument>--add-modules</argument>
<argument>
java.base,java.logging,java.desktop,java.prefs,java.xml,javafx.base,javafx.graphics,javafx.controls,javafx.fxml,javafx.web,javafx.media
</argument>
<argument>${project.build.add-modules}</argument>
<argument>--strip-native-commands</argument>
</arguments>
</configuration>
Expand Down Expand Up @@ -434,6 +440,8 @@
<argument>${project.build.directory}/libs</argument>
<argument>--class</argument>
<argument>com.easymobo.openlabeler.Main</argument>
<argument>--vendor</argument>
<argument>${project.vendor}</argument>
<argument>--version</argument>
<argument>${revision}</argument>
<argument>--main-jar</argument>
Expand All @@ -446,14 +454,15 @@
<argument>OpenLabeler</argument>
<argument>--icon</argument>
<argument>${project.build.directory}/classes/icon.ico</argument>
<argument>--win-dir-chooser</argument>
<argument>--win-shortcut</argument>
<argument>true</argument>
<argument>--win-menu</argument>

<!-- jlink arguments -->
<argument>--module-path</argument>
<argument>${java.home}/jmods;${project.build.directory}/mods</argument>
<argument>--add-modules</argument>
<argument>java.base,java.logging,java.desktop,java.prefs,java.xml,javafx.base,javafx.graphics,javafx.controls,javafx.fxml,javafx.web,javafx.media</argument>
<argument>${project.build.add-modules}</argument>
<argument>--strip-native-commands</argument>
</arguments>
</configuration>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
package com.easymobo.openlabeler.preference;

import javafx.beans.property.SimpleBooleanProperty;
import javafx.beans.property.SimpleIntegerProperty;
import javafx.beans.property.SimpleObjectProperty;
import javafx.beans.property.SimpleStringProperty;
import javafx.scene.paint.Color;
Expand All @@ -34,6 +35,9 @@ public static class BooleanPrefProperty extends SimpleBooleanProperty
public BooleanPrefProperty(Preferences pref, String baseKey, boolean defVal) {
super(pref, baseKey, pref.getBoolean(baseKey, defVal));
this.defVal = defVal;
this.addListener((observable, oldVal, newVal) -> {
((Preferences)getBean()).putBoolean(getName(), newVal);
});
}

@Override
Expand All @@ -43,13 +47,35 @@ public void set(boolean use) {
}
}

public static class IntegerPrefProperty extends SimpleIntegerProperty
{
private final int defVal;

public IntegerPrefProperty(Preferences pref, String baseKey, int defVal) {
super(pref, baseKey, pref.getInt(baseKey, defVal));
this.defVal = defVal;
this.addListener((observable, oldVal, newVal) -> {
((Preferences)getBean()).putInt(getName(), newVal.intValue());
});
}

@Override
public void set(int val) {
((Preferences)getBean()).putInt(getName(), val);
super.set(val);
}
}

public static class StringPrefProperty extends SimpleStringProperty
{
private final String defVal;

public StringPrefProperty(Preferences pref, String baseKey, String defVal) {
super(pref, baseKey, pref.get(baseKey, defVal));
this.defVal = defVal;
this.addListener((observable, oldVal, newVal) -> {
((Preferences)getBean()).put(getName(), newVal);
});
}

@Override
Expand All @@ -70,6 +96,9 @@ public ObjectPrefProperty(Preferences pref, String baseKey, T defVal, Function<S
this.defVal = defVal;
this.fromString = fromString;
this.toString = toString;
this.addListener((observable, oldVal, newVal) -> {
((Preferences)getBean()).put(getName(), toString.apply(newVal));
});
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import com.github.dockerjava.api.model.Bind;
import com.github.dockerjava.api.model.Container;
import com.github.dockerjava.api.model.HostConfig;
import com.github.dockerjava.api.model.Volume;
import com.github.dockerjava.core.DockerClientBuilder;
import com.google.protobuf.TextFormat;
import javafx.application.Platform;
Expand Down Expand Up @@ -494,8 +495,8 @@ public static String getDockerModelConfigPath() {
}

public static Bind[] getDockerBinds() {
Bind dataDir = Bind.parse(Settings.getTFDataDir() + ":/root/data");
Bind modelDir = Bind.parse(Settings.getTFBaseModelDir() + ":/root/model");
Bind dataDir = new Bind(Settings.getTFDataDir(), new Volume("/root/data"));
Bind modelDir = new Bind(Settings.getTFBaseModelDir(), new Volume("/root/model"));
return new Bind[] { dataDir, modelDir };
}
}

0 comments on commit 63a5e48

Please sign in to comment.