Updates to JFX version

This commit is contained in:
Jamie Mac 2023-03-13 16:55:53 +00:00
parent ec536913eb
commit 2ab6b5ec66
6 changed files with 88 additions and 6 deletions

View File

@ -1,7 +1,6 @@
package clickDetector;
import java.awt.Color;
import java.awt.Paint;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;

View File

@ -84,7 +84,8 @@ public class KetosWorker extends DLModelWorker<KetosResult> {
String jsonString = DLTransformsParser.readJSONString(new File(ketosModel.getAudioReprFile()));
//convert the JSON string to a parameters object.
KetosParams ketosParams = new KetosParams(jsonString);
KetosParams ketosParams = new KetosParams(jsonString);
//important to add this for Ketos models because the JSON string does not necessarily contain and output shape.
//System.out.println("----Default output shape: " + ketosParams.defaultOutputShape + " " + ketosModel.getOutShape());
if (ketosParams.defaultOutputShape==null) {

View File

@ -0,0 +1,67 @@
package rawDeepLearningClassifier.layoutFX;
import javafx.application.Application;
import javafx.geometry.Insets;
import javafx.scene.Scene;
import javafx.scene.control.SpinnerValueFactory.ListSpinnerValueFactory;
import javafx.stage.Stage;
import javafx.util.StringConverter;
import pamViewFX.fxNodes.PamBorderPane;
import pamViewFX.fxNodes.PamSpinner;
import rawDeepLearningClassifier.layoutFX.dlTransfroms.FFTTransformPane;
public class FFTSpinnerBug extends Application{
protected static final String INITAL_VALUE = "0";
public static void main(String[] args) {
Application.launch(args);
}
@Override
public void start(Stage stage) {
//System.out.println("Create step list: " + createStepList().size());
PamSpinner<Number> spinner = new PamSpinner<Number>(FFTTransformPane.createStepList());
spinner.getValueFactory().setConverter(new NumberConverter());
spinner.setPrefWidth(80);
PamBorderPane pane = new PamBorderPane();
pane.setCenter(spinner);
pane.setPadding(new Insets(20,20,20,20));
Scene scene = new Scene(pane, 350, 300);
System.out.println("Size before: " + ((ListSpinnerValueFactory) spinner.getValueFactory()).getItems().size());
spinner.getValueFactory().setValue(1019);
System.out.println("Size after: " + ((ListSpinnerValueFactory) spinner.getValueFactory()).getItems().size());
for (int i=0; i<((ListSpinnerValueFactory) spinner.getValueFactory()).getItems().size(); i++) {
System.out.println("List value: " + i + ": " + ((ListSpinnerValueFactory) spinner.getValueFactory()).getItems().get(i));
}
stage.setTitle("Hello Spinner");
stage.setScene(scene);
stage.show();
}
class NumberConverter extends StringConverter<Number> {
@Override
public String toString(Number object) {
// TODO Auto-generated method stub
return object.toString();
}
@Override
public Number fromString(String string) {
return Integer.valueOf(string);
}
}
}

View File

@ -0,0 +1,11 @@
package rawDeepLearningClassifier.layoutFX;
public class FFTSpinnerBugLauncher {
public static void main(String[] args) {
FFTSpinnerBug.main(args);
}
}

View File

@ -9,7 +9,7 @@ import pamViewFX.fxNodes.PamSpinner;
import javafx.util.StringConverter;
/**
* Transform pane for fourier transform
* Transform pane for Fourier transform
* @author Jamie Macaulay
*
*/
@ -29,7 +29,6 @@ public class FFTTransformPane extends SimpleTransformPane {
return spinner;
}
else return super.createSpinner(i);
}
@ -46,8 +45,9 @@ public class FFTTransformPane extends SimpleTransformPane {
return stepSizeListLength;
}
class NumberConverter extends StringConverter<Number> {
@Override
public String toString(Number object) {
// TODO Auto-generated method stub
@ -61,4 +61,7 @@ public class FFTTransformPane extends SimpleTransformPane {
}
}

View File

@ -191,6 +191,7 @@ public class SimpleTransformPane extends DLTransformPane {
//Set the new numbers
Number[] params = new Number[spinners.size()];
for (int i=0; i<spinners.size(); i++) {
System.out.println("Get params" + spinners.get(i).getValue());
params[i] = spinners.get(i).getValue();
}
@ -218,7 +219,7 @@ public class SimpleTransformPane extends DLTransformPane {
//spinners.get(i).getValueFactory().setValue(simpleTransform.getParams()[i] );
//System.out.println("Set params: " + input.getDLTransformType() + " param val: " + simpleTransform.getParams()[i] + " " + (simpleTransform.getParams()[i] instanceof Float));
System.out.println("Set params: " + input.getDLTransformType() + " param val: " + simpleTransform.getParams()[i] + " " + (simpleTransform.getParams()[i] instanceof Float));
if (simpleTransform.getParams()[i] instanceof Float || simpleTransform.getParams()[i] instanceof Double) {
//System.out.println("Double: simpleTransform.getParams()[i]: " + simpleTransform.getParams()[i] + " " +spinners.get(i).getValueFactory());
spinners.get(i).getValueFactory().setValue(simpleTransform.getParams()[i].doubleValue());