@Override public void start(Stage stage) throws Exception { preloaderStage = stage; preloaderStage.setScene(preloaderScene); preloaderStage.show(); if (DEMO_MODE) { final DoubleProperty prog = new SimpleDoubleProperty(0){ @Override protected void invalidated() { handleProgressNotification(new ProgressNotification(get())); } }; Timeline t = new Timeline(); t.getKeyFrames().add(new KeyFrame(Duration.seconds(20), new KeyValue(prog, 1))); t.play(); } }
public static PackageContents getPackageContents(PackageType pkg, AuthHandler handler, DoubleProperty progress) throws IOException { int retries = 3; if (app.getPackageContents(pkg) == null && retries > 0) { File targetFile = getPackageFile(pkg, handler, progress); Logger.getLogger(AppController.class.getName()).log(Level.INFO, "Package downloaded to {0}", targetFile.getPath()); try { PackageContents contents = new PackageContents(targetFile, pkg); app.putPackageContents(pkg, contents); return contents; } catch (IOException ex) { Logger.getLogger(PackageOps.class.getName()).log(Level.SEVERE, null, ex); if (retries-- <= 0) { throw ex; } else { app.clearPackageContents(pkg); } } } return app.getPackageContents(pkg); }
public void filesRead(DoubleProperty progress, double value) { double progressVal = value / (strFiles.size() + 1); clear(); //Parser for (StringFile strFile : strFiles) { strFile.clearReadyData(); Parser.parseTypedefs(strFile, strFile.getToken()); typedefs.addAll(strFile.typedefs); nameSpaces.add(strFile.workspace.getNameSpace()); progressAdd(progress, progressVal); } dataBaseInsert(); progressAdd(progress, progressVal); }
public void filesPreload(DoubleProperty progress, double value) { double progressVal = value / (strFiles.size() + typedefs.size() + 1); //Workspace Load ( remove usings errados ) for (StringFile strFile : strFiles) { strFile.workspace.load(); if (progress != null) progress.add(progressVal); } //Preload for (Typedef typedef : typedefs) { typedef.preload(); progressAdd(progress, progressVal); } progressAdd(progress, progressVal); }
@Override protected void seriesAdded(Series<X, Y> series, int seriesIndex) { // create new path for series Path seriesLine = new Path(); seriesLine.setStrokeLineJoin(StrokeLineJoin.BEVEL); series.setNode(seriesLine); // create series Y multiplier DoubleProperty seriesYAnimMultiplier = new SimpleDoubleProperty(this, "seriesYMultiplier"); seriesYMultiplierMap.put(series, seriesYAnimMultiplier); // handle any data already in series if (shouldAnimate()) { seriesLine.setOpacity(0); seriesYAnimMultiplier.setValue(0d); } else { seriesYAnimMultiplier.setValue(1d); } getPlotChildren().add(seriesLine); List<KeyFrame> keyFrames = new ArrayList<KeyFrame>(); if (shouldAnimate()) { // animate in new series keyFrames.add(new KeyFrame(Duration.ZERO, new KeyValue(seriesLine.opacityProperty(), 0), new KeyValue(seriesYAnimMultiplier, 0))); keyFrames.add(new KeyFrame(Duration.millis(200), new KeyValue(seriesLine.opacityProperty(), 1))); keyFrames.add(new KeyFrame(Duration.millis(500), new KeyValue(seriesYAnimMultiplier, 1))); } for (int j = 0; j < series.getData().size(); j++) { Data<X, Y> item = series.getData().get(j); final Node symbol = createSymbol(series, seriesIndex, item, j); if (symbol != null) { if (shouldAnimate()) symbol.setOpacity(0); getPlotChildren().add(symbol); if (shouldAnimate()) { // fade in new symbol keyFrames.add(new KeyFrame(Duration.ZERO, new KeyValue(symbol.opacityProperty(), 0))); keyFrames.add(new KeyFrame(Duration.millis(200), new KeyValue(symbol.opacityProperty(), 1))); } } } if (shouldAnimate()) animate(keyFrames.toArray(new KeyFrame[keyFrames.size()])); }
public static Object get(ObservableValue valueModel) { if (valueModel instanceof DoubleProperty) { return ((DoubleProperty)valueModel).get(); } else if (valueModel instanceof ObjectProperty) { return ((ObjectProperty)valueModel).get(); } return null; }
public static void set(ObservableValue valueModel, Object value) { if (valueModel instanceof DoubleProperty) { ((DoubleProperty)valueModel).set((Double)value); } else if (valueModel instanceof ObjectProperty) { ((ObjectProperty)valueModel).set(value); } }
private KeyValue createKeyValue(NodeModel nodeModel, KeyValueModel keyValueModel) { Optional<DoubleProperty> doubleProperty = ModelFunctions.getDoubleProperty(nodeModel.getNode(), keyValueModel.getField()); if (doubleProperty.isPresent()) { return new KeyValue(doubleProperty.get(), (double) keyValueModel.getValue(), keyValueModel.getInterpolator().toFxInterpolator()); } Optional<ObjectProperty<Paint>> paintProperty = ModelFunctions.getPaintProperty(nodeModel.getNode(), keyValueModel.getField()); if (paintProperty.isPresent()) { return new KeyValue(paintProperty.get(), (Paint) keyValueModel.getValue(), keyValueModel.getInterpolator().toFxInterpolator()); } throw new UnsupportedOperationException(); }
public DoubleProperty xProperty() throws InterruptedException, ExecutionException { if (Platform.isFxApplicationThread()) { return getNode().layoutXProperty(); } final FutureTask<DoubleProperty> task = new FutureTask<>(() -> getNode().layoutXProperty()); Platform.runLater(task); return task.get(); }
public final MatrixItemSeries build() { final MatrixItemSeries SERIES = new MatrixItemSeries(); if (properties.keySet().contains("itemsArray")) { SERIES.setItems(((ObjectProperty<MatrixItem[]>) properties.get("itemsArray")).get()); } if(properties.keySet().contains("itemsList")) { SERIES.setItems(((ObjectProperty<List<MatrixItem>>) properties.get("itemsList")).get()); } for (String key : properties.keySet()) { if ("name".equals(key)) { SERIES.setName(((StringProperty) properties.get(key)).get()); } else if ("fill".equals(key)) { SERIES.setFill(((ObjectProperty<Paint>) properties.get(key)).get()); } else if ("stroke".equals(key)) { SERIES.setStroke(((ObjectProperty<Paint>) properties.get(key)).get()); } else if ("symbolFill".equals(key)) { SERIES.setSymbolFill(((ObjectProperty<Color>) properties.get(key)).get()); } else if ("symbolStroke".equals(key)) { SERIES.setSymbolStroke(((ObjectProperty<Color>) properties.get(key)).get()); } else if ("symbol".equals(key)) { SERIES.setSymbol(((ObjectProperty<Symbol>) properties.get(key)).get()); } else if ("chartType".equals(key)) { SERIES.setChartType(((ObjectProperty<ChartType>) properties.get(key)).get()); } else if ("symbolsVisible".equals(key)) { SERIES.setSymbolsVisible(((BooleanProperty) properties.get(key)).get()); } else if ("symbolSize".equals(key)) { SERIES.setSymbolSize(((DoubleProperty) properties.get(key)).get()); } else if ("strokeWidth".equals(key)) { SERIES.setStrokeWidth(((DoubleProperty) properties.get(key)).get()); } } return SERIES; }
public DoubleProperty yProperty() throws InterruptedException, ExecutionException { if (Platform.isFxApplicationThread()) { return getNode().layoutYProperty(); } final FutureTask<DoubleProperty> task = new FutureTask<>(() -> getNode().layoutYProperty()); Platform.runLater(task); return task.get(); }
/** * Downloads a file and saves it at the given location. * * @param url * the url to download from * @param outputPath * the path where to save the downloaded file * @param progressProperty * a property that will contain the current download process from 0.0 to 1.0 * @param fileLength * length of the file * @return the downloaded file * @throws IOException * if an errors occurs while writing the file or opening the stream */ public static File downloadFile(final URL url, final String outputPath, final DoubleProperty progressProperty, final double fileLength) throws IOException { try (final InputStream input = url.openStream(); final FileOutputStream fileOutputStream = new FileOutputStream(outputPath);) { final double currentProgress = (int) progressProperty.get(); final byte[] buffer = new byte[10000]; while (true) { final double length = input.read(buffer); if (length <= 0) { break; } /* * Setting the progress property inside of a run later in order to avoid a crash, * since this function is usually used inside of a different thread than the ui * thread. */ Platform.runLater(() -> { final double additional = length / fileLength * (1.0 - currentProgress); progressProperty.set(progressProperty.get() + additional); }); fileOutputStream.write(buffer, 0, (int) length); } return new File(outputPath); } }
public final HeatMap build() { double width = 400; double height = 400; ColorMapping colorMapping = ColorMapping.LIME_YELLOW_RED; double eventRadius = 15.5; boolean fadeColors = false; double heatMapOpacity = 0.5; OpacityDistribution opacityDistribution = OpacityDistribution.CUSTOM; for (String key : properties.keySet()) { if ("prefSize".equals(key)) { Dimension2D dim = ((ObjectProperty<Dimension2D>) properties.get(key)).get(); width = dim.getWidth(); height = dim.getHeight(); } else if ("width".equals(key)) { width = ((DoubleProperty) properties.get(key)).get(); } else if ("height".equals(key)) { height = ((DoubleProperty) properties.get(key)).get(); } else if ("colorMapping".equals(key)) { colorMapping = ((ObjectProperty<ColorMapping>) properties.get(key)).get(); } else if ("eventRadius".equals(key)) { eventRadius = ((DoubleProperty) properties.get(key)).get(); } else if ("fadeColors".equals(key)) { fadeColors = ((BooleanProperty) properties.get(key)).get(); } else if ("heatMapOpacity".equals(key)) { heatMapOpacity = ((DoubleProperty) properties.get(key)).get(); } else if ("opacityDistribution".equals(key)) { opacityDistribution = ((ObjectProperty<OpacityDistribution>) properties.get(key)).get(); } } return new HeatMap(width, height, colorMapping, eventRadius, fadeColors, heatMapOpacity, opacityDistribution); }
public ImageEntryView (String label, DoubleProperty width, DoubleProperty height, String cssClass) { this(label, cssClass); initImageView(width, height); init(); }
public DoubleProperty heightProperty()throws InterruptedException,ExecutionException{ if (Platform.isFxApplicationThread()) { return body.heightProperty(); } counter++; if(counter>maxCounter){ throw new ExecutionException(new Exception(hint)); } final FutureTask<DoubleProperty> task = new FutureTask<>(() -> body.heightProperty()); Platform.runLater(task); return task.get(); }
public BaseResize(Node node, DoubleProperty width, DoubleProperty height) { super(node); this.width = width; this.height = height; enable.addListener((ob, o, n) -> { if (n == false) { setCursor(Corner.CENTER); } }); }
public CollectionGridPageFactory(List<Image> images, int pageSize, ImageClickHandler clickHandler, DoubleProperty gridGap, DoubleProperty imageHeight) { this.images = images; this.pageSize = pageSize; this.clickHandler = clickHandler; this.gridGap = gridGap; this.imageHeight = imageHeight; }
public void initialize() { // get URL of the video file URL url = VideoPlayerController.class.getResource("sts117.mp4"); // create a Media object for the specified URL Media media = new Media(url.toExternalForm()); // create a MediaPlayer to control Media playback mediaPlayer = new MediaPlayer(media); // specify which MediaPlayer to display in the MediaView mediaView.setMediaPlayer(mediaPlayer); // set handler to be called when the video completes playing mediaPlayer.setOnEndOfMedia(() -> { playing = false; playPauseButton.setText("Play"); }); // set handler that displays an ExceptionDialog if an error occurs mediaPlayer.setOnError(() -> { ExceptionDialog dialog = new ExceptionDialog(mediaPlayer.getError()); dialog.showAndWait(); }); // bind the MediaView's width/height to the scene's width/height DoubleProperty width = mediaView.fitWidthProperty(); DoubleProperty height = mediaView.fitHeightProperty(); width.bind(Bindings.selectDouble( mediaView.sceneProperty(), "width")); height.bind(Bindings.selectDouble( mediaView.sceneProperty(), "height")); }
@Test public void testSaveDouble() { // given String name = "double"; double value = Double.MAX_VALUE; DoubleProperty property = new SimpleDoubleProperty(null, name, value); // when PreferencesUtils.save(property, preferences); // then double saved = preferences.getDouble(name, -1); assertEquals(value, saved); }
public DoubleProperty widthProperty()throws InterruptedException,ExecutionException{ if (Platform.isFxApplicationThread()) { return body.widthProperty(); } counter++; if(counter>maxCounter){ throw new ExecutionException(new Exception(hint)); } final FutureTask<DoubleProperty> task = new FutureTask<>(() -> body.widthProperty()); Platform.runLater(task); return task.get(); }
public final AreaHeatMap build() { final AreaHeatMap CONTROL = new AreaHeatMap(); for (String key : properties.keySet()) { if ("prefSize".equals(key)) { Dimension2D dim = ((ObjectProperty<Dimension2D>) properties.get(key)).get(); CONTROL.setPrefSize(dim.getWidth(), dim.getHeight()); } else if ("colorMapping".equals(key)) { CONTROL.setColorMapping(((ObjectProperty<ColorMapping>) properties.get(key)).get()); } else if("useColorMapping".equals(key)) { CONTROL.setUseColorMapping(((BooleanProperty) properties.get(key)).get()); } else if ("quality".equals(key)) { CONTROL.setQuality(((IntegerProperty) properties.get(key)).get()); } else if ("heatMapOpacity".equals(key)) { CONTROL.setHeatMapOpacity(((DoubleProperty) properties.get(key)).get()); } else if ("dataPointsVisible".equals(key)) { CONTROL.setDataPointsVisible(((BooleanProperty) properties.get(key)).get()); } else if ("smoothedHull".equals(key)) { CONTROL.setSmoothedHull(((BooleanProperty) properties.get(key)).get()); } else if ("discreteColors".equals(key)) { CONTROL.setDiscreteColors(((BooleanProperty) properties.get(key)).get()); } else if ("noOfCloserInfluentPoints".equals(key)) { CONTROL.setNoOfCloserInfluentPoints(((IntegerProperty) properties.get(key)).get()); } } if (properties.keySet().contains("dataPointsArray")) { CONTROL.setDataPoints(((ObjectProperty<DataPoint[]>) properties.get("dataPointsArray")).get()); } if(properties.keySet().contains("dataPointsList")) { CONTROL.setDataPoints(((ObjectProperty<List<DataPoint>>) properties.get("dataPointsList")).get()); } return CONTROL; }
public void filesCrossLoad(DoubleProperty progress, double value) { double progressVal = value / (typedefs.size() + 1); //Crossload for (Typedef typedef : typedefs) { typedef.crossLoad(); progressAdd(progress, progressVal); } progressAdd(progress, progressVal); }
public final ChartItem build() { final ChartItem ITEM = new ChartItem(); for (String key : properties.keySet()) { if ("name".equals(key)) { ITEM.setName(((StringProperty) properties.get(key)).get()); } else if ("value".equals(key)) { ITEM.setValue(((DoubleProperty) properties.get(key)).get()); } else if("fill".equals(key)) { ITEM.setFill(((ObjectProperty<Color>) properties.get(key)).get()); } else if("stroke".equals(key)) { ITEM.setStroke(((ObjectProperty<Color>) properties.get(key)).get()); } else if("textColor".equals(key)) { ITEM.setTextColor(((ObjectProperty<Color>) properties.get(key)).get()); } else if("timestamp".equals(key)) { ITEM.setTimestamp(((ObjectProperty<Instant>) properties.get(key)).get()); } else if ("timestampDateTime".equals(key)) { ITEM.setTimestamp(((ObjectProperty<ZonedDateTime>) properties.get(key)).get()); } else if("symbol".equals(key)) { ITEM.setSymbol(((ObjectProperty<Symbol>) properties.get(key)).get()); } else if("animated".equals(key)) { ITEM.setAnimated(((BooleanProperty) properties.get(key)).get()); } else if("animationDuration".equals(key)) { ITEM.setAnimationDuration(((LongProperty) properties.get(key)).get()); } } return ITEM; }
@Override public void projectReload(boolean makeFile, DoubleProperty progress) { synchronized (compileLock) { syncToFiles(); super.projectReload(makeFile, progress); syncToInner(); } }
@Override public String[] projectExport(DoubleProperty progress, boolean asLib) { synchronized (compileLock) { syncToFiles(); String[] textFiles; textFiles = super.projectExport(progress, asLib); syncToInner(); return textFiles; } }
public static DoubleProperty posCorrelationUpperFilterProperty() { return posCorrelationUpperFilter; }
public DoubleProperty maxValueProperty() { return maxValue; }
public DoubleProperty yProperty() { return yProperty; }
public DoubleProperty xProperty() throws InterruptedException,ExecutionException{ if(Platform.isFxApplicationThread()) return body.layoutXProperty(); final FutureTask<DoubleProperty> task = new FutureTask<>(()->body.layoutXProperty()); Platform.runLater(task); return task.get(); }
public DoubleProperty propertyYProperty() { return propertyY; }
public DoubleProperty getRightValue() { return endValue; }
public DoubleProperty centerProperty() { return center; }
protected DoubleProperty angleStepProperty() { return angleStep; }
public static DoubleProperty minFrequencyProperty() { return minFrequencyFilter; }
public DoubleProperty widthProperty(){ return background.widthProperty(); }
public DoubleProperty volumeProperty() { return volume; }
@Override public DoubleProperty getHeight () { return new SimpleDoubleProperty(0); }
@Override public DoubleProperty getWidth () { return myWidth; }
@Override public DoubleProperty getValueProperty () { return myValue; }