Java Code Examples for javafx.beans.property.SimpleObjectProperty

The following are top voted examples for showing how to use javafx.beans.property.SimpleObjectProperty. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: OneClient   File: UpdateDialog.java   View source code 7 votes vote down vote up
@SuppressWarnings("unchecked")
public UpdateDialog(List<CurseFullProject.CurseFile> files) {
	super(files);
	TableColumn<CurseFullProject.CurseFile, String> columnName = new TableColumn<>("Files");
	columnName.setCellValueFactory(cell -> new SimpleStringProperty(cell.getValue().getFileName()));

	TableColumn<CurseFullProject.CurseFile, String> columnVersion = new TableColumn<>("Version");
	columnVersion.setCellValueFactory(cell -> new SimpleStringProperty(cell.getValue().getGameVersion().stream().collect(Collectors.joining(", "))));
	TableColumn<CurseFullProject.CurseFile, Date> columnDate = new TableColumn<>("Release Date");
	columnDate.setCellValueFactory(cell -> new SimpleObjectProperty<>(cell.getValue().getDate()));

	table.getColumns().addAll(columnName, columnVersion, columnDate);

	setTitle("File Update Dialog");
	dialogPane.setHeaderText("Please Choose a File Version");
	dialogPane.getStyleClass().add("pack-update-dialog");
	dialogPane.getButtonTypes().addAll(ButtonType.OK, ButtonType.CANCEL);
}
 
Example 2
Project: fxutils   File: FXLocalization.java   View source code 6 votes vote down vote up
/**
 * Initializes an FXLocalization object that manages the resource bundle of your app for switching between languages.
 * See also {@link ResourceBundle}.
 * 
 * @param supportedLocales A list of the language locales supported by the client app.
 * @param basePath Base path used to load the resource bundles. 
 * @param classLoader Class loader used to load the resource bundles.
 */
public FXLocalization(List<Locale> supportedLocales, String basePath, ClassLoader classLoader) {
	if(supportedLocales.isEmpty())
		supportedLocales.add(Locale.getDefault());
	
	this.supportedLocales = supportedLocales;
	this.basePath = basePath;
	this.classLoader = classLoader;
	
	languageDisplayNames = supportedLocales.stream()
			.map(loc -> loc.getDisplayLanguage(loc).toUpperCase())
			.collect(Collectors.toList());
	
	locale = new SimpleObjectProperty<>(getDefaultLocale());
	locale.addListener((obs,o,n) -> Locale.setDefault(n));
}
 
Example 3
Project: hygene   File: QueryTest.java   View source code 5 votes vote down vote up
public void beforeEach() {
    final GraphStore graphStore = mock(GraphStore.class);
    when(graphStore.getGfaFileProperty()).thenReturn(new SimpleObjectProperty<>());
    searchQuery = mock(SearchQuery.class);

    query = new Query(graphStore);
    query.setSearchQuery(searchQuery);
}
 
Example 4
Project: CSS-Editor-FX   File: MainFrameController.java   View source code 5 votes vote down vote up
TabEntity() {
  this.tab = new Tab();
  this.manager = new CodeAreaManager(new CodeArea());
  this.codeArea = manager.getCodeArea();
  this.file = new SimpleObjectProperty<>();
  this.name = new SimpleStringProperty();
  this.icon = new FontAwesomeIconView();
  this.order = new SimpleIntegerProperty(nameOrder.next());

  init();

  CacheUtil.cache(MainFrameController.this, tab, () -> this);
}
 
Example 5
Project: CSS-Editor-FX   File: SimpleOption.java   View source code 5 votes vote down vote up
SimpleOption(T defaultValue, String describe) {
  this.property = new SimpleObjectProperty<>();
  this.defaultValue = defaultValue;
  this.describe = describe;

  property.setValue(defaultValue);
}
 
Example 6
Project: MineIDE   File: WizardStepBuilder.java   View source code 5 votes vote down vote up
@SuppressWarnings("unchecked")
public WizardStepBuilder addFileChooser(final String fieldName, final String fileChooseLabel, final String startDir,
        final FileChooser.ExtensionFilter... filters)
{
    final WizardStep current = this.current;
    final HBox box = new HBox();
    final JFXButton button = new JFXButton(fileChooseLabel);
    button.setStyle("-fx-text-fill: BLACK;-fx-font-size: 18px;-fx-opacity: 0.7;");
    final FileChooser fileChooser = new FileChooser();
    fileChooser.setTitle(fileChooseLabel);
    fileChooser.setInitialDirectory(new File(startDir));
    fileChooser.getExtensionFilters().addAll(filters);
    this.current.getData().put(fieldName, new SimpleObjectProperty<File>());

    button.setOnAction(
            e -> current.getData().get(fieldName).setValue(fileChooser.showOpenDialog(MineIDE.primaryStage)));

    final Label label = new Label(fieldName);
    GridPane.setHalignment(label, HPos.RIGHT);
    GridPane.setHalignment(button, HPos.LEFT);
    this.current.add(label, 0, this.current.getData().size() - 1);

    final JFXTextField text = new JFXTextField();
    text.setEditable(false);
    this.current.getData().get(fieldName).addListener(
            (ChangeListener<File>) (observable, oldValue, newValue) -> text.setText(newValue.getAbsolutePath()));

    box.getChildren().addAll(text, button);
    this.current.add(box, 1, this.current.getData().size() - 1);
    return this;
}
 
Example 7
Project: JavaFX-EX   File: BeanUtil.java   View source code 5 votes vote down vote up
public static <F, T> ObservableValue<T> nestValue(ObservableValue<F> pf, Function<F, ObservableValue<T>> func) {
  ObservableValue<T> current = func.apply(pf.getValue());
  Property<T> nestProp = new SimpleObjectProperty<>();
  nestProp.bind(current);
  pf.addListener((ob, o, n) -> {
    ObservableValue<T> pt = func.apply(n);
    nestProp.unbind();
    nestProp.bind(pt);
  });
  return nestProp;
}
 
Example 8
Project: CSS-Editor-FX   File: OptionsController.java   View source code 5 votes vote down vote up
private void initKey() {
    commandColumn.setCellValueFactory(cdf -> new SimpleStringProperty(cdf.getValue().getDescribe()));
    bindingColumn.setCellValueFactory(cdf -> CacheUtil.cache(OptionsController.this,
        cdf.getValue(), () -> new SimpleObjectProperty<>(cdf.getValue().get())));
//    bindingColumn.setCellValueFactory(cdf -> new SimpleObjectProperty<>(cdf.getValue().get()));

    bindingColumn.setEditable(true);
    bindingColumn.setCellFactory(column -> new KeyEditField());

    keyTable.getItems().setAll(Options.KEY.getChildren(KeyCombination.class));
    onSubmit.add(() -> keyTable.getItems().forEach(key -> key.set(bindingColumn.getCellData(key))));
  }
 
Example 9
Project: ExtremeGuiMakeover   File: AnimatedIcon.java   View source code 5 votes vote down vote up
public AnimatedIcon() {
    iconFill = new SimpleObjectProperty<>(Color.ORANGE);

    line1 = new Line(4, 8, 28, 8);
    line1.setStrokeWidth(3);
    line1.strokeProperty().bind(iconFill);
    line1.setManaged(false);
    line1.setStrokeLineCap(StrokeLineCap.ROUND);

    line2 = new Line(4, 16, 28, 16);
    line2.setStrokeWidth(3);
    line2.strokeProperty().bind(iconFill);
    line2.setManaged(false);
    line2.setStrokeLineCap(StrokeLineCap.ROUND);

    line3 = new Line(4, 24, 28, 24);
    line3.setStrokeWidth(3);
    line3.strokeProperty().bind(iconFill);
    line3.setManaged(false);
    line3.setStrokeLineCap(StrokeLineCap.ROUND);

    getChildren().addAll(line1, line2, line3);
    setPrefWidth(32);
    setPrefHeight(32);
    setMinWidth(USE_PREF_SIZE);
    setMinHeight(USE_PREF_SIZE);
    setMaxWidth(USE_PREF_SIZE);
    setMaxHeight(USE_PREF_SIZE);
}
 
Example 10
Project: can4eve   File: CANPropertyManager.java   View source code 5 votes vote down vote up
/**
 * add the given property
 * 
 * @param canValue
 * @param property
 */
public <T> void addCanProperty(CANValue<T> canValue,
    SimpleObjectProperty<T> property) {
  CANProperty<CANValue<T>, T> canProperty = new CANProperty<CANValue<T>, T>(
      canValue, property);
  getCanProperties().put(canValue.canInfo.getName(), canProperty);
}
 
Example 11
Project: stvs   File: ConstraintSpecificationValidatorTest.java   View source code 5 votes vote down vote up
@Test
public void testProblems() {
  JsonElement testjson = JsonTableParser.jsonFromResource(testfile, ConstraintSpecificationValidatorTest.class);

  List<CodeIoVariable> codeIoVariables = JsonTableParser.codeIoVariablesFromJson(testjson);

  List<Type> typeContext = Arrays.asList(TypeInt.INT, TypeBool.BOOL);

  FreeVariableList freeVars = JsonTableParser.freeVariableSetFromJson(testjson);

  ConstraintSpecification testSpec =
      JsonTableParser.constraintTableFromJson(testjson);

  FreeVariableListValidator validator = new FreeVariableListValidator(
      new SimpleObjectProperty<>(typeContext),
      freeVars
  );

  ConstraintSpecificationValidator recognizer = new ConstraintSpecificationValidator(
      new SimpleObjectProperty<>(typeContext),
      new SimpleObjectProperty<>(codeIoVariables),
      validator.validFreeVariablesProperty(),
      testSpec
  );

  List<Class<?>> expectedProblems = JsonTableParser.expectedSpecProblemsFromJson(testjson);

  System.out.println("Expecting problems: " + expectedProblems.stream().map(Class::getSimpleName).collect(Collectors.toList()));

  System.out.println("Actual Problems: ");
  recognizer.problemsProperty().get().forEach(System.out::println);

  assertEquals("Problem list emptiness: ",
      expectedProblems.isEmpty(),
      recognizer.problemsProperty().get().isEmpty());
  assertTrue(
      expectedProblems.stream().allMatch(aClass ->
          recognizer.problemsProperty().get().stream().anyMatch(aClass::isInstance)));
}
 
Example 12
Project: ScrabbleGame   File: Scrabble.java   View source code 5 votes vote down vote up
/**
 * Initializes the ScrabbleGame with all the needed information
 *
 * @param language The language to be used during the game
 * @param players  The players
 * @param bag      The bag
 * @param board    The board
 */
protected void initializeScrabbleGame(LanguageInterface language, List<PlayerInterface> players, PlayerInterface currentPlayer, BagInterface bag, BoardInterface board) {
    this.consecutiveTurnsSkipped = 0;
    this.language = language;
    this.board = board;
    this.players = new ArrayList<>(players);
    this.currentPlayer = new SimpleObjectProperty<>(currentPlayer);
    this.bag = bag;
    this.checkIfArtificialIntelligenceShouldPlay();
}
 
Example 13
Project: H-Uppaal   File: ComponentController.java   View source code 5 votes vote down vote up
public void toggleDeclaration(final MouseEvent mouseEvent) {
    final Circle circle = new Circle(0);
    circle.setCenterX(component.get().getWidth() - (toggleDeclarationButton.getWidth() - mouseEvent.getX()));
    circle.setCenterY(-1 * mouseEvent.getY());

    final ObjectProperty<Node> clip = new SimpleObjectProperty<>(circle);
    declaration.clipProperty().bind(clip);

    final Transition rippleEffect = new Transition() {
        private final double maxRadius = Math.sqrt(Math.pow(getComponent().getWidth(), 2) + Math.pow(getComponent().getHeight(), 2));

        {
            setCycleDuration(Duration.millis(500));
        }

        protected void interpolate(final double fraction) {
            if (getComponent().isDeclarationOpen()) {
                circle.setRadius(fraction * maxRadius);
            } else {
                circle.setRadius(maxRadius - fraction * maxRadius);
            }
            clip.set(circle);
        }
    };

    final Interpolator interpolator = Interpolator.SPLINE(0.785, 0.135, 0.15, 0.86);
    rippleEffect.setInterpolator(interpolator);

    rippleEffect.play();
    getComponent().declarationOpenProperty().set(!getComponent().isDeclarationOpen());
}
 
Example 14
Project: Squid   File: RunsViewModel.java   View source code 4 votes vote down vote up
public ReadOnlyObjectProperty<ObservableList<PrawnFile.Run>> shrimpRunsProperty() {
    return new SimpleObjectProperty<>(shrimpRuns);
}
 
Example 15
Project: charts   File: PixelMatrixBuilder.java   View source code 4 votes vote down vote up
public final B pixelOnColor(final Color COLOR) {
    properties.put("pixelOnColor", new SimpleObjectProperty(COLOR));
    return (B)this;
}
 
Example 16
Project: worldheatmap   File: WorldBuilder.java   View source code 4 votes vote down vote up
public final B maxSize(final double WIDTH, final double HEIGHT) {
    properties.put("maxSize", new SimpleObjectProperty<>(new Dimension2D(WIDTH, HEIGHT)));
    return (B)this;
}
 
Example 17
Project: charts   File: AxisBuilder.java   View source code 4 votes vote down vote up
public final B zoneId(final ZoneId  ID) {
    properties.put("zoneId", new SimpleObjectProperty<>(ID));
    return (B)this;
}
 
Example 18
Project: charts   File: WorldBuilder.java   View source code 4 votes vote down vote up
public final B strokeColor(final Color COLOR) {
    properties.put("strokeColor", new SimpleObjectProperty<>(COLOR));
    return (B)this;
}
 
Example 19
Project: hygene   File: GraphDimensionsCalculator.java   View source code 4 votes vote down vote up
/**
 * Create a new instance of {@link GraphDimensionsCalculator}.
 *
 * @param graphStore the {@link GraphStore} who's {@link org.dnacronym.hygene.parser.GfaFile} is observed
 */
@Inject
@SuppressWarnings({"PMD.AvoidInstantiatingObjectsInLoops", "squid:S1188", "squid:S3776"})
public GraphDimensionsCalculator(final GraphStore graphStore) {
    observableQueryNodes = FXCollections.observableArrayList();
    readOnlyObservableNodes = new ReadOnlyListWrapper<>(observableQueryNodes);

    centerNodeIdProperty = new SimpleIntegerProperty(1);
    radiusProperty = new SimpleIntegerProperty(DEFAULT_RADIUS);

    nodeCountProperty = new SimpleIntegerProperty(1);

    centerNodeIdProperty.addListener((observable, oldValue, newValue) -> {
        if (newValue.intValue() < 1) {
            centerNodeIdProperty.set(1);
            return;
        }
        if (newValue.intValue() >= getNodeCountProperty().intValue() - 1) {
            centerNodeIdProperty.set(nodeCountProperty.intValue() - 2);
            return;
        }

        centerPointQuery.query(centerNodeIdProperty.get(), radiusProperty.get());
    });
    radiusProperty.addListener((observable, oldValue, newValue) -> {
        if (centerPointQuery == null) {
            return;
        }
        centerPointQuery.query(centerNodeIdProperty.get(), radiusProperty.get());
    });

    viewPointProperty = new SimpleLongProperty(2000);
    viewPointProperty.addListener((observable, oldValue, newValue) -> {
        if (newValue.longValue() < 0) {
            viewPointProperty.set(0);
            return;
        }
        final int sentinelId = getGraphProperty().get().getNodeArrays().length - 1;
        final long sentinelEndPosition = getGraphProperty().get().getRealEndXPosition(sentinelId);
        if (newValue.longValue() > sentinelEndPosition) {
            viewPointProperty.set(sentinelEndPosition);
            return;
        }

        centerNodeIdProperty.set(getGraphProperty().get().getNodeAtPosition(newValue.longValue()));
        calculate(subgraph);
    });
    viewRadiusProperty = new SimpleIntegerProperty(1);
    viewRadiusProperty.addListener((observable, oldValue, newValue) -> {
        calculate(subgraph);
        radiusProperty.set(((newValue.intValue() + FafospLayerer.LAYER_WIDTH - 1)
                / FafospLayerer.LAYER_WIDTH) / 2);
    });

    nodeHeightProperty = new SimpleDoubleProperty(1);
    laneHeightProperty = new SimpleDoubleProperty(1);
    laneCountProperty = new SimpleIntegerProperty(1);

    graphProperty = new SimpleObjectProperty<>();
    graphStore.getGfaFileProperty().addListener((observable, oldValue, newValue) -> setGraph(newValue.getGraph()));

    HygeneEventBus.getInstance().register(this);
}
 
Example 20
Project: charts   File: GridBuilder.java   View source code 4 votes vote down vote up
public final B padding(final Insets INSETS) {
    properties.put("padding", new SimpleObjectProperty<>(INSETS));
    return (B)this;
}
 
Example 21
Project: charts   File: MatrixItemSeriesBuilder.java   View source code 4 votes vote down vote up
public final B items(final MatrixItem... ITEMS) {
    properties.put("itemsArray", new SimpleObjectProperty<>(ITEMS));
    return (B)this;
}
 
Example 22
Project: H-Uppaal   File: FilePresentation.java   View source code 4 votes vote down vote up
public SimpleObjectProperty<Component> componentProperty() {
    return component;
}
 
Example 23
Project: charts   File: AxisBuilder.java   View source code 4 votes vote down vote up
public final B locale(final Locale LOCALE) {
    properties.put("locale", new SimpleObjectProperty<>(LOCALE));
    return (B)this;
}
 
Example 24
Project: charts   File: AreaHeatMapBuilder.java   View source code 4 votes vote down vote up
public final B colorMapping(final ColorMapping COLOR_MAPPING) {
    properties.put("colorMapping", new SimpleObjectProperty<>(COLOR_MAPPING));
    return (B)this;
}
 
Example 25
Project: charts   File: XYSeriesBuilder.java   View source code 4 votes vote down vote up
public final B items(final XYItem... ITEMS) {
    properties.put("itemsArray", new SimpleObjectProperty<>(ITEMS));
    return (B)this;
}
 
Example 26
Project: worldheatmap   File: WorldBuilder.java   View source code 4 votes vote down vote up
public final B prefSize(final double WIDTH, final double HEIGHT) {
    properties.put("prefSize", new SimpleObjectProperty<>(new Dimension2D(WIDTH, HEIGHT)));
    return (B)this;
}
 
Example 27
Project: charts   File: XYZSeriesBuilder.java   View source code 4 votes vote down vote up
public final B chartType(final ChartType TYPE) {
    properties.put("chartType", new SimpleObjectProperty<>(TYPE));
    return (B)this;
}
 
Example 28
Project: charts   File: StreamChartBuilder.java   View source code 4 votes vote down vote up
public final B category(final Category CATEGORY) {
    properties.put("category", new SimpleObjectProperty<>(CATEGORY));
    return (B)this;
}
 
Example 29
Project: SunburstChart   File: SunburstChartBuilder.java   View source code 4 votes vote down vote up
public final B brightTextColor(final Color COLOR) {
    properties.put("brightTextColor", new SimpleObjectProperty(COLOR));
    return (B)this;
}
 
Example 30
Project: charts   File: WorldBuilder.java   View source code 4 votes vote down vote up
public final B pressedColor(final Color COLOR) {
    properties.put("pressedColor", new SimpleObjectProperty<>(COLOR));
    return (B)this;
}
 
Example 31
Project: charts   File: ChartItemBuilder.java   View source code 4 votes vote down vote up
public final B stroke(final Color COLOR) {
    properties.put("stroke", new SimpleObjectProperty(COLOR));
    return (B)this;
}
 
Example 32
Project: charts   File: AxisBuilder.java   View source code 4 votes vote down vote up
public final B tickLabelFormat(final TickLabelFormat FORMAT) {
    properties.put("tickLabelFormat", new SimpleObjectProperty<>(FORMAT));
    return (B)this;
}
 
Example 33
Project: charts   File: SankeyPlotBuilder.java   View source code 4 votes vote down vote up
public final B streamFillMode(final StreamFillMode MODE) {
    properties.put("streamFillMode", new SimpleObjectProperty<>(MODE));
    return (B)this;
}
 
Example 34
Project: worldheatmap   File: WorldBuilder.java   View source code 4 votes vote down vote up
public final B mousePressHandler(final EventHandler<MouseEvent> HANDLER) {
    properties.put("mousePressHandler", new SimpleObjectProperty(HANDLER));
    return (B)this;
}
 
Example 35
Project: charts   File: SankeyPlotBuilder.java   View source code 4 votes vote down vote up
public final B streamColor(final Color COLOR) {
    properties.put("streamColor", new SimpleObjectProperty(COLOR));
    return (B)this;
}
 
Example 36
Project: charts   File: PixelMatrixBuilder.java   View source code 4 votes vote down vote up
public final B pixelOffColor(final Color COLOR) {
    properties.put("pixelOffColor", new SimpleObjectProperty(COLOR));
    return (B)this;
}
 
Example 37
Project: charts   File: XYZSeriesBuilder.java   View source code 4 votes vote down vote up
public final B items(final XYZItem... ITEMS) {
    properties.put("itemsArray", new SimpleObjectProperty<>(ITEMS));
    return (B)this;
}
 
Example 38
Project: SunburstChart   File: ChartDataBuilder.java   View source code 4 votes vote down vote up
public final B textColor(final Color COLOR) {
    properties.put("textColor", new SimpleObjectProperty<>(COLOR));
    return (B)this;
}
 
Example 39
Project: charts   File: XYZSeriesBuilder.java   View source code 4 votes vote down vote up
public final B symbolFill(final Color FILL) {
    properties.put("symbolFill", new SimpleObjectProperty<>(FILL));
    return (B)this;
}
 
Example 40
Project: charts   File: NestedBarChartBuilder.java   View source code 4 votes vote down vote up
public final B maxSize(final double WIDTH, final double HEIGHT) {
    properties.put("maxSize", new SimpleObjectProperty<>(new Dimension2D(WIDTH, HEIGHT)));
    return (B)this;
}