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() 

Source Link

Document

The constructor of ObjectProperty

Usage

From source file:Main.java

public static void main(String[] args) {
    ObjectProperty<Lighting> root = new SimpleObjectProperty<Lighting>();
    final ObjectBinding<Color> colorBinding = Bindings.select(root, "light", "color");
    colorBinding.addListener(new ChangeListener<Color>() {
        @Override/*from  www  . jav  a2 s.  co m*/
        public void changed(ObservableValue<? extends Color> observableValue, Color oldValue, Color newValue) {
            System.out.println(oldValue + "new = " + newValue);
        }
    });
    Light firstLight = new Light.Point();
    firstLight.setColor(Color.BLACK);

    Light secondLight = new Light.Point();
    secondLight.setColor(Color.WHITE);

    Lighting firstLighting = new Lighting();
    firstLighting.setLight(firstLight);

    root.set(firstLighting);
    firstLighting.setLight(firstLight);
    firstLight.setColor(Color.RED);
}

From source file:mesclasses.model.Mot.java

public Mot() {
    super();
    this.id = RandomStringUtils.randomAlphanumeric(5);
    this.dateCloture = new SimpleObjectProperty<>();
}

From source file:mesclasses.model.Cours.java

public Cours() {
    this.id = RandomStringUtils.randomAlphanumeric(5);
    day = new SimpleStringProperty();
    classe = new SimpleObjectProperty<>();
    room = new SimpleStringProperty("");
    week = new SimpleStringProperty();
    startHour = new SimpleIntegerProperty(8);
    startMin = new SimpleIntegerProperty(0);
    endHour = new SimpleIntegerProperty(9);
    endMin = new SimpleIntegerProperty(0);
    ponctuel = new SimpleBooleanProperty(false);
}

From source file:com.ucu.seguridad.views.AbstractFxmlView.java

public AbstractFxmlView() {

    this.presenterProperty = new SimpleObjectProperty<>();
    this.resource = getClass().getResource(getFxmlName());
    this.bundle = getResourceBundle(getBundleName());
}

From source file:mesclasses.model.EleveData.java

public EleveData() {
    super();/*from ww w . j a  v  a  2 s . c  o m*/
    this.id = "donnee_" + RandomStringUtils.randomAlphanumeric(10);
    date = new SimpleObjectProperty<>();
    retard = new SimpleIntegerProperty();
    absent = new SimpleBooleanProperty();
    travailPasFait = new SimpleBooleanProperty();
    devoir = new SimpleBooleanProperty();
    motCarnet = new SimpleBooleanProperty();
    motSigne = new SimpleBooleanProperty();
    exclus = new SimpleBooleanProperty();
    oubliMateriel = new SimpleStringProperty();
    motif = new SimpleStringProperty();
}

From source file:de.rkl.tools.tzconv.model.ApplicationModel.java

@SuppressWarnings("unused")
public ApplicationModel() {
    mainDateTime = new SimpleObjectProperty<>();
    selectedZoneIds = new SimpleListProperty<>();
    templateFile = new SimpleObjectProperty<>();
}

From source file:com.panemu.tiwulfx.form.BaseControl.java

public BaseControl(String propertyName, E control) {
    this.inputControl = control;
    this.propertyName = propertyName;
    HBox.setHgrow(control, Priority.ALWAYS);
    setAlignment(Pos.CENTER_LEFT);/*from w  w  w  . j  ava 2s  . com*/
    control.setMaxWidth(Double.MAX_VALUE);
    control.setMinHeight(USE_PREF_SIZE);
    getChildren().add(control);
    getChildren().add(imagePlaceHolder);

    required.addListener(imageListener);
    valid.addListener(imageListener);

    this.getStyleClass().add("form-control");
    value = new SimpleObjectProperty<>();
    bindValuePropertyWithControl(control);
    bindEditablePropertyWithControl(control);

    addEventHandler(MouseEvent.ANY, new EventHandler<MouseEvent>() {
        @Override
        public void handle(MouseEvent event) {
            if (event.getEventType() == MouseEvent.MOUSE_MOVED && !isValid() && !getPopup().isShowing()) {
                Point2D p = BaseControl.this.localToScene(0.0, 0.0);
                getPopup().show(BaseControl.this, p.getX() + getScene().getX() + getScene().getWindow().getX(),
                        p.getY() + getScene().getY() + getScene().getWindow().getY()
                                + getInputComponent().getHeight() - 1);
            } else if (event.getEventType() == MouseEvent.MOUSE_EXITED && getPopup().isShowing()) {
                getPopup().hide();
            }
        }
    });
    getInputComponent().addEventHandler(MouseEvent.MOUSE_ENTERED, new EventHandler<MouseEvent>() {
        @Override
        public void handle(MouseEvent t) {
            if (!isValid() && getPopup().isShowing()) {
                getPopup().hide();
            }
        }
    });
}

From source file:gov.va.isaac.gui.preferences.plugins.properties.PreferencesPluginComboBoxProperty.java

/**
 * @param name/* w ww .j  av  a2  s .co m*/
 * @param stringConverter
 * 
 * Constructor for ComboBox that displays a String
 * that must be derived/converted from its underlying value
 * 
 * Allows a preexisting Label to be used
 */
protected PreferencesPluginComboBoxProperty(Label label, StringConverter<T> stringConverter) {
    super(label, new ComboBox<T>(), new SimpleObjectProperty<T>(), null, // validator handled below
            stringConverter, new PropertyAction<T, ComboBox<T>>() {
                @Override
                public void apply(PreferencesPluginProperty<T, ComboBox<T>> property) {
                    property.getProperty()
                            .bind(property.getControl().getSelectionModel().selectedItemProperty());
                }
            }, new PropertyAction<T, ComboBox<T>>() {
                @Override
                public void apply(PreferencesPluginProperty<T, ComboBox<T>> property) {
                    property.getControl().getSelectionModel().select(property.readFromPersistedPreferences());
                }
            }, new PropertyAction<T, ComboBox<T>>() {
                @Override
                public void apply(PreferencesPluginProperty<T, ComboBox<T>> property) {
                    GridPane.setHgrow(property.getLabel(), Priority.NEVER);
                    GridPane.setFillWidth(property.getControl(), true);
                    GridPane.setHgrow(property.getControl(), Priority.ALWAYS);
                }
            });
    validator = new ValidBooleanBinding() {
        {
            bind(getProperty());
            setComputeOnInvalidate(true);
        }

        @Override
        protected boolean computeValue() {
            if (getProperty().getValue() == null) {
                this.setInvalidReason("null/unset/unselected " + name);

                logger.debug(getReasonWhyInvalid().get());

                TextErrorColorHelper.setTextErrorColor(label);

                return false;
            } else {
                TextErrorColorHelper.clearTextErrorColor(label);
            }
            if (StringUtils.isEmpty(getStringConverter().convertToString(getProperty().getValue()))) {
                this.setInvalidReason("Invalid " + name);

                logger.debug(getReasonWhyInvalid().get());

                TextErrorColorHelper.setTextErrorColor(label);

                return false;
            } else {
                TextErrorColorHelper.clearTextErrorColor(label);
            }

            this.clearInvalidReason();
            return true;
        }
    };

    control.setCellFactory(new Callback<ListView<T>, ListCell<T>>() {
        @Override
        public ListCell<T> call(ListView<T> param) {
            final ListCell<T> cell = new ListCell<T>() {
                @Override
                protected void updateItem(T c, boolean emptyRow) {
                    super.updateItem(c, emptyRow);

                    if (c == null) {
                        setText(null);
                    } else {
                        String diplay = getStringConverter().convertToString(c);
                        setText(diplay);
                    }
                }
            };

            return cell;
        }
    });
    control.setButtonCell(new ListCell<T>() {
        @Override
        protected void updateItem(T c, boolean emptyRow) {
            super.updateItem(c, emptyRow);
            if (emptyRow) {
                setText("");
            } else {
                String diplay = getStringConverter().convertToString(c);
                setText(diplay);
            }
        }
    });
}

From source file:eu.over9000.skadi.ui.MainWindow.java

@Override
public void init() throws Exception {
    this.persistenceHandler = new PersistenceHandler();
    this.currentState = this.persistenceHandler.loadState();
    this.channelHandler = new ChannelHandler(this.persistenceHandler);
    this.chatHandler = new ChatHandler();
    this.streamHandler = new StreamHandler(this.channelHandler);

    this.detailChannel = new SimpleObjectProperty<>();
}

From source file:cz.lbenda.dataman.rc.DatamanApp.java

@SuppressWarnings("unchecked")
@Override/*from   w  w  w .j a  v  a  2 s.co  m*/
public void start(Stage primaryStage) throws Exception {
    StatusHelper.getInstance().setStatusBar(statusBar);
    Thread.currentThread().setUncaughtExceptionHandler((thread, throwable) -> ExceptionMessageFrmController
            .showException(MessageFactory.getInstance().getMessage("UncaughtException"), throwable));

    ribbon = new Ribbon(MessageFactory.getInstance().getMessage("app.name"),
            IconFactory.getInstance().image(this, "dataman.png", IconFactory.IconLocation.APP_ICON));

    primaryStage.getIcons().add(new Image(this.getClass().getResourceAsStream("dataman16.png")));
    primaryStage.getIcons().add(new Image(this.getClass().getResourceAsStream("dataman32.png")));
    primaryStage.getIcons().add(new Image(this.getClass().getResourceAsStream("dataman48.png")));
    primaryStage.getIcons().add(new Image(this.getClass().getResourceAsStream("dataman64.png")));
    primaryStage.getIcons().add(new Image(this.getClass().getResourceAsStream("dataman128.png")));
    primaryStage.setTitle(MessageFactory.getInstance().getMessage("app.name"));

    DbConfigFactory.reloadConfiguration();
    ObjectProperty<DbConfig> currentDbProperty = new SimpleObjectProperty<>();
    ObjectProperty<TableDesc> selectedTableDescProperty = new SimpleObjectProperty<>();

    prepareMainPane();
    ribbon.itemsProperty().addAll(new AddDatabaseHandler(), new ImportDatabaseHandler(),
            new ExportDatabaseHandler(currentDbProperty), new DbConfigMenuOptions(currentDbProperty),
            new ConnectDatabaseHandler(currentDbProperty), new EditDatabaseHandler(currentDbProperty),
            new CopyDatabaseHandler(currentDbProperty), new RemoveDatabaseHandler(currentDbProperty),
            new ReloadDatabaseHandler(currentDbProperty), new RemoveRowsHandler(tableViewObjectProperty),
            new AddRowHandler(tableViewObjectProperty), new ReloadTableHandler(tableViewObjectProperty),
            new SaveTableHandler(tableViewObjectProperty), new SaveAllTableHandler(currentDbProperty),
            new OpenConnectedTablesHandler(tableViewObjectProperty,
                    detailDescriptor -> addRemoveToDetail(detailDescriptor.getTitle(),
                            detailDescriptor.getNode(), detailDescriptor.getClosable())),
            new ExportTableHandler(sqlQueryRowsObjectProperty),
            new ExportTableWithTemplateHandler(sqlQueryRowsObjectProperty), new AboutApplicationHandler());

    Scene scene = new Scene(mainPane);
    te = new SQLEditorController(ribbon::addItem, scene, currentDbProperty, nodeShower);

    addToCenter(SQLEditorController.WINDOW_TITLE, te.getNode(), false);

    Tuple2<Parent, DbTableStructureFrmController> dbTableStructureFrmController = DbTableStructureFrmController
            .createNewInstance();
    addToCenter(DbTableStructureFrmController.WINDOW_TITLE, dbTableStructureFrmController.get1(), false);
    selectedTableDescProperty.addListener(
            (observable, oldValue, newValue) -> dbTableStructureFrmController.get2().setTableDesc(newValue));

    DbStructureFrmController dfc = new DbStructureFrmController(currentDbProperty, td -> new Thread(() -> {
        StatusHelper.getInstance().progressStart(td, DataTableFrmController.TASK_NAME, 2);
        StatusHelper.getInstance().progressNextStep(td, td.getName(), 0);
        DataTableFrmController controller = new DataTableFrmController(td);
        StatusHelper.getInstance().progressNextStep(td, td.getName(), 0);
        Platform.runLater(() -> addToCenter(controller.titleProperty(), controller.getTabView(), true));
        StatusHelper.getInstance().progressFinish(td, DataTableFrmController.STEP_FINISH);
    }).start(), selectedTableDescProperty);
    leftPane.getChildren().add(dfc.getControlledNode());

    RowEditorFrmController rowEditorFrmController = new RowEditorFrmController(tableViewObjectProperty);
    addToRight(RowEditorFrmController.WINDOW_TITLE, rowEditorFrmController.getPane());

    // Scene scene = te.createScene();
    primaryStage.setScene(scene);
    primaryStage.setOnCloseRequest(event -> {
        if (!DialogHelper.getInstance().showUnsavedObjectDialog(SavableRegistry.getInstance())) {
            event.consume();
        }
    });
    primaryStage.show();
    /*
    try {
      // AquaFx.style();
      // FlatterFX.style();
      //AeroFX.style();
    } catch (Exception e) {
      LOG.error("Problem with switch to AquaFx style", e);
    }
    */
}