本文整理汇总了Java中javafx.beans.property.DoubleProperty类的典型用法代码示例。如果您正苦于以下问题:Java DoubleProperty类的具体用法?Java DoubleProperty怎么用?Java DoubleProperty使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DoubleProperty类属于javafx.beans.property包,在下文中一共展示了DoubleProperty类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: start
import javafx.beans.property.DoubleProperty; //导入依赖的package包/类
@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();
}
}
示例2: getPackageContents
import javafx.beans.property.DoubleProperty; //导入依赖的package包/类
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);
}
示例3: filesRead
import javafx.beans.property.DoubleProperty; //导入依赖的package包/类
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);
}
示例4: filesPreload
import javafx.beans.property.DoubleProperty; //导入依赖的package包/类
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);
}
示例5: seriesAdded
import javafx.beans.property.DoubleProperty; //导入依赖的package包/类
@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()]));
}
示例6: get
import javafx.beans.property.DoubleProperty; //导入依赖的package包/类
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;
}
示例7: set
import javafx.beans.property.DoubleProperty; //导入依赖的package包/类
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);
}
}
示例8: createKeyValue
import javafx.beans.property.DoubleProperty; //导入依赖的package包/类
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();
}
示例9: xProperty
import javafx.beans.property.DoubleProperty; //导入依赖的package包/类
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();
}
示例10: build
import javafx.beans.property.DoubleProperty; //导入依赖的package包/类
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;
}
示例11: yProperty
import javafx.beans.property.DoubleProperty; //导入依赖的package包/类
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();
}
示例12: downloadFile
import javafx.beans.property.DoubleProperty; //导入依赖的package包/类
/**
* 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);
}
}
示例13: build
import javafx.beans.property.DoubleProperty; //导入依赖的package包/类
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);
}
示例14: ImageEntryView
import javafx.beans.property.DoubleProperty; //导入依赖的package包/类
public ImageEntryView (String label,
DoubleProperty width,
DoubleProperty height,
String cssClass) {
this(label, cssClass);
initImageView(width, height);
init();
}
示例15: heightProperty
import javafx.beans.property.DoubleProperty; //导入依赖的package包/类
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();
}