Example usage for javafx.beans.property SimpleObjectProperty SimpleObjectProperty

List of usage examples for javafx.beans.property SimpleObjectProperty SimpleObjectProperty

Introduction

In this page you can find the example usage for javafx.beans.property SimpleObjectProperty SimpleObjectProperty.

Prototype

public SimpleObjectProperty(T initialValue) 

Source Link

Document

The constructor of ObjectProperty

Usage

From source file:org.cryptomator.ui.model.Vault.java

/**
 * Package private constructor, use {@link VaultFactory}.
 * //  w  w  w  .ja v a2 s. co m
 * @param string
 */
Vault(String id, Path vaultDirectoryPath, ShorteningFileSystemFactory shorteningFileSystemFactory,
        CryptoFileSystemFactory cryptoFileSystemFactory, DeferredCloser closer) {
    this.path = new SimpleObjectProperty<Path>(vaultDirectoryPath);
    this.shorteningFileSystemFactory = shorteningFileSystemFactory;
    this.cryptoFileSystemFactory = cryptoFileSystemFactory;
    this.closer = closer;
    this.id = id;
    try {
        setMountName(name().getValue());
    } catch (IllegalArgumentException e) {
        // mount name needs to be set by the user explicitly later
    }
}

From source file:org.kles.m3.service.CheckM3ConnectionService.java

public CheckM3ConnectionService(M3Connector src) {
    m3connector = new SimpleObjectProperty<>(src);
}

From source file:org.nmrfx.processor.gui.spectra.PeakListAttributes.java

public final ObjectProperty<PeakDisplayParameters.LabelTypes> labelTypeProperty() {
    if (peakLabelType == null) {
        peakLabelType = new SimpleObjectProperty<PeakDisplayParameters.LabelTypes>(Number);
    }//  www  .ja  v  a2  s.  c o  m
    return this.peakLabelType;
}

From source file:org.nmrfx.processor.gui.spectra.PeakListAttributes.java

public final ObjectProperty<PeakDisplayParameters.DisplayTypes> displayTypeProperty() {
    if (displayType == null) {
        displayType = new SimpleObjectProperty<PeakDisplayParameters.DisplayTypes>(DisplayTypes.Peak);
    }//  www . ja  va 2 s . com
    return this.displayType;
}

From source file:org.noroomattheinn.visibletesla.AppContext.java

AppContext(Application app, Stage stage) {
    this.app = app;
    this.stage = stage;
    this.persistentState = Preferences.userNodeForPackage(this.getClass());
    this.inactivityModeListener = null;

    this.inactivityState = new SimpleObjectProperty<>(InactivityType.Awake);
    this.shuttingDown = new SimpleBooleanProperty(false);

    this.lastKnownChargeState = new SimpleObjectProperty<>();
    this.lastKnownDrivingState = new SimpleObjectProperty<>();
    this.lastKnownGUIState = new SimpleObjectProperty<>();
    this.lastKnownHVACState = new SimpleObjectProperty<>();
    this.lastKnownSnapshotState = new SimpleObjectProperty<>();
    this.lastKnownVehicleState = new SimpleObjectProperty<>();
    this.schedulerActivityReport = new SimpleObjectProperty<>();

    this.simulatedUnits = new SimpleObjectProperty<>();
    this.simulatedWheels = new SimpleObjectProperty<>();
    this.simulatedColor = new SimpleObjectProperty<>();
    this.simulatedRoof = new SimpleObjectProperty<>();

    this.prefs = new Prefs(this);

    appFilesFolder = ensureAppFilesFolder();

    establishProxy();/* w w w. j  av  a 2 s .c  o  m*/
}

From source file:org.noroomattheinn.visibletesla.NotifierController.java

@Override
protected void initializeState() {
    lastOdoCheck = prefs.storage().getDouble(OdoCheckKey, 0);

    socHitsTrigger = new GenericTrigger<>(socHits.selectedProperty(), bdHelper, "SOC", NotifySOCHitsKey,
            GenericTrigger.Predicate.HitsOrExceeds, socHitsField.numberProperty(), new BigDecimal(88.0),
            TypicalDebounce);//from  www  .  j  av  a  2  s  .c  om
    socHitsMessageTarget = new MessageTarget(prefs, vinKey("MT_" + NotifySOCHitsKey), SOCHitSubj, SOCHitMsg);

    socFallsTrigger = new GenericTrigger<>(socFalls.selectedProperty(), bdHelper, "SOC", NotifySOCFallsKey,
            GenericTrigger.Predicate.FallsBelow, socFallsField.numberProperty(), new BigDecimal(50.0),
            TypicalDebounce);
    socFallsMessageTarget = new MessageTarget(prefs, vinKey("MT_" + NotifySOCFallsKey), SOCFellSubj,
            SOCFellMsg);

    speedHitsTrigger = new GenericTrigger<>(speedHits.selectedProperty(), bdHelper, "Speed", NotifySpeedKey,
            GenericTrigger.Predicate.HitsOrExceeds, speedHitsField.numberProperty(), new BigDecimal(70.0),
            SpeedDebounce);
    shMessageTarget = new MessageTarget(prefs, vinKey("MT_" + NotifySpeedKey), SpeedHitSubj, SpeedHitMsg);

    odoHitsTrigger = new GenericTrigger<>(odoHits.selectedProperty(), bdHelper, "Odometer", NotifyOdoKey,
            GenericTrigger.Predicate.GT, odoHitsField.numberProperty(), new BigDecimal(14325), TypicalDebounce);
    ohMessageTarget = new MessageTarget(prefs, vinKey("MT_" + NotifyOdoKey), OdoHitsSubj, OdoHitsMsg);

    seTrigger = new GenericTrigger<>(schedulerEvent.selectedProperty(), stringHelper, "Scheduler", NotifySEKey,
            GenericTrigger.Predicate.AnyChange, new SimpleObjectProperty<>("Anything"), "Anything", 0L);
    seMessageTarget = new MessageTarget(prefs, vinKey("MT_" + NotifySEKey), SchedEventSubj, SchedEventMsg);

    csTrigger = new GenericTrigger<>(chargeState.selectedProperty(), stringListHelper, "Charge State",
            NotifyCSKey, GenericTrigger.Predicate.Becomes, csSelectProp, new StringList("Anything"), 0L);
    csMessageTarget = new MessageTarget(prefs, vinKey("MT_" + NotifyCSKey), ChargeStateSubj, ChargeStateMsg);

    for (int i = 0; i < 4; i++) {
        GeoTrigger gt = geoTriggers[i];
        gt.trigger = new GenericTrigger<>(gt.enabled.selectedProperty(), areaHelper,
                "Enter GeoUtils.CircularArea", NotifyEnterKey + i, GenericTrigger.Predicate.HitsOrExceeds,
                gt.prop, new GeoUtils.CircularArea(), GeoDebounce);
        gt.messageTarget = new MessageTarget(prefs, vinKey("MT_" + NotifyEnterKey + i), EnterAreaSubj,
                EnterAreaMsg);
    }
    for (int i = 4; i < 8; i++) {
        GeoTrigger gt = geoTriggers[i];
        gt.trigger = new GenericTrigger<>(gt.enabled.selectedProperty(), areaHelper,
                "Left GeoUtils.CircularArea", NotifyLeftKey + i, GenericTrigger.Predicate.FallsBelow, gt.prop,
                new GeoUtils.CircularArea(), GeoDebounce);
        gt.messageTarget = new MessageTarget(prefs, vinKey("MT_" + NotifyLeftKey + i), LeftAreaSubj,
                LeftAreaMsg);
    }
    for (final GeoTrigger g : geoTriggers) {
        String name = g.prop.get().name;
        if (name != null && !name.isEmpty()) {
            g.enabled.setText(name);
        }
        g.prop.addListener(new ChangeListener<GeoUtils.CircularArea>() {
            @Override
            public void changed(ObservableValue<? extends GeoUtils.CircularArea> ov, GeoUtils.CircularArea t,
                    GeoUtils.CircularArea t1) {
                if (t1.name != null && !t1.name.isEmpty()) {
                    g.enabled.setText(t1.name);
                }
            }
        });
    }

    // Other types of trigger
    ccTrigger = new DeviationTrigger(0.19, 5 * 60 * 1000);
    pcTrigger = new DeviationTrigger(0.19, 5 * 60 * 1000);
    caMessageTarget = new MessageTarget(prefs, vinKey("MT_" + NotifyCAKey), ChargeAnomalySubj,
            ChargeAnomalyMsg);
    chargeAnomaly.setSelected(prefs.storage().getBoolean(vinKey(NotifyCAKey), false));

    unlockedTrigger = new StationaryTrigger(unlocked.selectedProperty(), unlockedDoorsField.numberProperty());
    ulMessageTarget = new MessageTarget(prefs, vinKey("MT_" + NotifyULKey), UnlockedSubj, UnlockedMsg);
    unlocked.setSelected(prefs.storage().getBoolean(vinKey(NotifyULKey), false));
    unlockedDoorsField.numberProperty()
            .set(new BigDecimal(prefs.storage().getLong(vinKey(NotifyULValKey), UnlockedThreshold)));
    checkForUnlocked = false;

    startListening();
}

From source file:org.samcrow.frameviewer.trajectory.ui.FrameController.java

private static ObjectProperty<List<Trajectory0>> createTrajectoriesProperty() {
    final List<Trajectory0> initialList = new ArrayList<>();
    return new SimpleObjectProperty<>(initialList);
}

From source file:org.sleuthkit.autopsy.imageanalyzer.gui.MetaDataPane.java

@FXML
void initialize() {
    assert attributeColumn != null : "fx:id=\"attributeColumn\" was not injected: check your FXML file 'MetaDataPane.fxml'.";
    assert imageView != null : "fx:id=\"imageView\" was not injected: check your FXML file 'MetaDataPane.fxml'.";
    assert tableView != null : "fx:id=\"tableView\" was not injected: check your FXML file 'MetaDataPane.fxml'.";
    assert valueColumn != null : "fx:id=\"valueColumn\" was not injected: check your FXML file 'MetaDataPane.fxml'.";
    TagUtils.registerListener(this);
    Category.registerListener(this);

    tableView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
    tableView.setPlaceholder(new Label("Select a file to show its details here."));

    attributeColumn.setCellValueFactory((param) -> new SimpleObjectProperty<>(param.getValue().getKey()));
    attributeColumn.setCellFactory(/*from   w  w w  .j  ava 2 s .  c o m*/
            (param) -> new TableCell<Pair<DrawableAttribute<?>, ? extends Object>, DrawableAttribute<?>>() {
                @Override
                protected void updateItem(DrawableAttribute<?> item, boolean empty) {
                    super.updateItem(item, empty); //To change body of generated methods, choose Tools | Templates.
                    if (item != null) {
                        setText(item.getDisplayName());
                        setGraphic(new ImageView(item.getIcon()));
                    } else {
                        setGraphic(null);
                        setText(null);
                    }
                }
            });

    attributeColumn.setPrefWidth(USE_COMPUTED_SIZE);

    valueColumn.setCellValueFactory((p) -> {
        if (p.getValue().getKey() == DrawableAttribute.TAGS) {
            return new SimpleStringProperty(
                    ((Collection<TagName>) p.getValue().getValue()).stream().map(TagName::getDisplayName)
                            .filter((String t) -> t.startsWith(Category.CATEGORY_PREFIX) == false)
                            .collect(Collectors.joining(" ; ", "", "")));
        } else {
            return new SimpleStringProperty(StringUtils.join((Collection<?>) p.getValue().getValue(), " ; "));
        }
    });
    valueColumn.setPrefWidth(USE_COMPUTED_SIZE);
    valueColumn.setCellFactory((p) -> new TableCell<Pair<DrawableAttribute<?>, ? extends Object>, String>() {
        @Override
        public void updateItem(String item, boolean empty) {
            super.updateItem(item, empty);
            if (!isEmpty()) {
                Text text = new Text(item);
                text.wrappingWidthProperty().bind(getTableColumn().widthProperty());
                setGraphic(text);
            } else {
                setGraphic(null);
            }
        }
    });
    tableView.getColumns().setAll(Arrays.asList(attributeColumn, valueColumn));

    //listen for selection change
    controller.getSelectionModel().lastSelectedProperty().addListener((observable, oldFileID, newFileID) -> {
        setFile(newFileID);
    });

    //        MetaDataPane.this.visibleProperty().bind(controller.getMetaDataCollapsed().not());
    //        MetaDataPane.this.managedProperty().bind(controller.getMetaDataCollapsed().not());
}

From source file:org.sleuthkit.autopsy.imagegallery.gui.MetaDataPane.java

@FXML
void initialize() {
    assert attributeColumn != null : "fx:id=\"attributeColumn\" was not injected: check your FXML file 'MetaDataPane.fxml'.";
    assert imageView != null : "fx:id=\"imageView\" was not injected: check your FXML file 'MetaDataPane.fxml'.";
    assert tableView != null : "fx:id=\"tableView\" was not injected: check your FXML file 'MetaDataPane.fxml'.";
    assert valueColumn != null : "fx:id=\"valueColumn\" was not injected: check your FXML file 'MetaDataPane.fxml'.";
    TagUtils.registerListener(this);
    ImageGalleryController.getDefault().getCategoryManager().registerListener(this);

    tableView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
    tableView.setPlaceholder(new Label("Select a file to show its details here."));

    attributeColumn.setCellValueFactory((param) -> new SimpleObjectProperty<>(param.getValue().getKey()));
    attributeColumn.setCellFactory(/*from  ww w .j a  va2 s  .c  om*/
            (param) -> new TableCell<Pair<DrawableAttribute<?>, ? extends Object>, DrawableAttribute<?>>() {
                @Override
                protected void updateItem(DrawableAttribute<?> item, boolean empty) {
                    super.updateItem(item, empty); //To change body of generated methods, choose Tools | Templates.
                    if (item != null) {
                        setText(item.getDisplayName());
                        setGraphic(new ImageView(item.getIcon()));
                    } else {
                        setGraphic(null);
                        setText(null);
                    }
                }
            });

    attributeColumn.setPrefWidth(USE_COMPUTED_SIZE);

    valueColumn.setCellValueFactory((p) -> {
        if (p.getValue().getKey() == DrawableAttribute.TAGS) {
            return new SimpleStringProperty(
                    ((Collection<TagName>) p.getValue().getValue()).stream().map(TagName::getDisplayName)
                            .filter((String t) -> t.startsWith(Category.CATEGORY_PREFIX) == false)
                            .collect(Collectors.joining(" ; ", "", "")));
        } else {
            return new SimpleStringProperty(StringUtils.join((Iterable<?>) p.getValue().getValue(), " ; "));
        }
    });
    valueColumn.setPrefWidth(USE_COMPUTED_SIZE);
    valueColumn.setCellFactory((p) -> new TableCell<Pair<DrawableAttribute<?>, ? extends Object>, String>() {
        @Override
        public void updateItem(String item, boolean empty) {
            super.updateItem(item, empty);
            if (!isEmpty()) {
                Text text = new Text(item);
                text.wrappingWidthProperty().bind(getTableColumn().widthProperty());
                setGraphic(text);
            } else {
                setGraphic(null);
            }
        }
    });
    tableView.getColumns().setAll(Arrays.asList(attributeColumn, valueColumn));

    //listen for selection change
    controller.getSelectionModel().lastSelectedProperty().addListener((observable, oldFileID, newFileID) -> {
        setFile(newFileID);
    });

    //        MetaDataPane.this.visibleProperty().bind(controller.getMetaDataCollapsed().not());
    //        MetaDataPane.this.managedProperty().bind(controller.getMetaDataCollapsed().not());
}

From source file:org.sleuthkit.autopsy.timeline.ShowInTimelineDialog.java

/**
 * Common Private Constructor/*  w  w w. j a  v a2 s.  c  o m*/
 *
 * @param controller The controller for this Dialog.
 * @param eventIDS   A List of eventIDs to present to the user to choose
 *                   from.
 */
@NbBundle.Messages({
        "ShowInTimelineDialog.amountValidator.message=The entered amount must only contain digits." })
private ShowInTimelineDialog(TimeLineController controller, List<Long> eventIDS) {
    this.controller = controller;

    //load dialog content fxml
    final String name = "nbres:/"
            + StringUtils.replace(ShowInTimelineDialog.class.getPackage().getName(), ".", "/")
            + "/ShowInTimelineDialog.fxml"; // NON-NLS
    try {
        FXMLLoader fxmlLoader = new FXMLLoader(new URL(name));
        fxmlLoader.setRoot(contentRoot);
        fxmlLoader.setController(this);

        fxmlLoader.load();
    } catch (IOException ex) {
        LOGGER.log(Level.SEVERE, "Unable to load FXML, node initialization may not be complete.", ex); //NON-NLS
    }
    //assert that fxml loading happened correctly
    assert eventTable != null : "fx:id=\"eventTable\" was not injected: check your FXML file 'ShowInTimelineDialog.fxml'.";
    assert typeColumn != null : "fx:id=\"typeColumn\" was not injected: check your FXML file 'ShowInTimelineDialog.fxml'.";
    assert dateTimeColumn != null : "fx:id=\"dateTimeColumn\" was not injected: check your FXML file 'ShowInTimelineDialog.fxml'.";
    assert amountSpinner != null : "fx:id=\"amountsSpinner\" was not injected: check your FXML file 'ShowInTimelineDialog.fxml'.";
    assert unitComboBox != null : "fx:id=\"unitChoiceBox\" was not injected: check your FXML file 'ShowInTimelineDialog.fxml'.";

    //validat that spinner has a integer in the text field.
    validationSupport.registerValidator(amountSpinner.getEditor(), false, Validator.createPredicateValidator(
            NumberUtils::isDigits, Bundle.ShowInTimelineDialog_amountValidator_message()));

    //configure dialog properties
    PromptDialogManager.setDialogIcons(this);
    initModality(Modality.APPLICATION_MODAL);

    //add scenegraph loaded from fxml to this dialog.
    DialogPane dialogPane = getDialogPane();
    dialogPane.setContent(contentRoot);
    //add buttons to dialog
    dialogPane.getButtonTypes().setAll(SHOW, ButtonType.CANCEL);

    ///configure dialog controls
    amountSpinner.setValueFactory(new SpinnerValueFactory.IntegerSpinnerValueFactory(1, 1000));
    amountSpinner.getValueFactory().setConverter(new IntegerStringConverter() {
        /**
         * Convert the String to an Integer using Integer.valueOf, but if
         * that throws a NumberFormatException, reset the spinner to the
         * last valid value.
         *
         * @param string The String to convert
         *
         * @return The Integer value of string.
         */
        @Override
        public Integer fromString(String string) {
            try {
                return super.fromString(string);
            } catch (NumberFormatException ex) {
                return amountSpinner.getValue();
            }
        }
    });

    unitComboBox.setButtonCell(new ChronoFieldListCell());
    unitComboBox.setCellFactory(comboBox -> new ChronoFieldListCell());
    unitComboBox.getItems().setAll(SCROLL_BY_UNITS);
    unitComboBox.getSelectionModel().select(ChronoField.MINUTE_OF_HOUR);

    typeColumn.setCellValueFactory(param -> new SimpleObjectProperty<>(param.getValue().getEventType()));
    typeColumn.setCellFactory(param -> new TypeTableCell<>());

    dateTimeColumn.setCellValueFactory(param -> new SimpleObjectProperty<>(param.getValue().getStartMillis()));
    dateTimeColumn.setCellFactory(param -> new DateTimeTableCell<>());

    //add events to table
    eventTable.getItems().setAll(
            eventIDS.stream().map(controller.getEventsModel()::getEventById).collect(Collectors.toSet()));
    eventTable.setPrefHeight(Math.min(200, 24 * eventTable.getItems().size() + 28));
}