use of javafx.beans.property.SimpleBooleanProperty in project jgnash by ccavanaugh.
the class CheckComboBox method getItemBooleanProperty.
private BooleanProperty getItemBooleanProperty(final T item) {
if (itemBooleanPropertyMap.get(item) == null) {
SimpleBooleanProperty booleanProperty = new SimpleBooleanProperty();
itemBooleanPropertyMap.put(item, booleanProperty);
booleanProperty.addListener(checkedChangeListener);
}
return itemBooleanPropertyMap.get(item);
}
use of javafx.beans.property.SimpleBooleanProperty in project NMEAParser by tvesalainen.
the class ViewerPage method loadPage.
public static ViewerPage loadPage(ViewerService service, String fxml, ResourceBundle bundle, StringExpression styleExpression) throws IOException {
BooleanProperty active = new SimpleBooleanProperty();
FXMLLoader load = new FXMLLoader(ViewerPage.class.getResource(fxml), bundle);
Parent parent = load.load();
parent.styleProperty().bind(styleExpression);
service.register(active, parent.lookupAll("*"));
return new ViewerPage(active, parent);
}
use of javafx.beans.property.SimpleBooleanProperty in project NMEAParser by tvesalainen.
the class FXPropertySetter method setDisable.
/**
* this is run in platform thread
* @param property
*/
protected void setDisable(String property, boolean disabled) {
ObservableBooleanValue obv = disabledMap.get(property);
if (obv instanceof SimpleBooleanProperty) {
SimpleBooleanProperty sbp = (SimpleBooleanProperty) obv;
sbp.set(disabled);
}
}
use of javafx.beans.property.SimpleBooleanProperty in project Smartcity-Smarthouse by TechnionYP5777.
the class ConfigurationWindowController method initialize.
/*
* (non-Javadoc)
*
* @see
* il.ac.technion.cs.smarthouse.gui_controller.GuiController#initialize(java
* .lang.Object, il.ac.technion.cs.smarthouse.gui_controller.GuiController,
* java.net.URL, java.util.ResourceBundle)
*/
@Override
protected <T extends GuiController<SensorsSimulator>> void initialize(SensorsSimulator model1, T parent1, URL location, ResourceBundle b) {
backButton.setOnAction(__1 -> ((DeveloperSimulatorController) this.getParentController()).moveToSensorsList());
nameColumn.setCellValueFactory(cellData -> new ReadOnlyStringWrapper(cellData.getValue().getKey()));
typeColumn.setCellValueFactory(cellData -> new ReadOnlyStringWrapper(cellData.getValue().getValue().getName()));
deleteColumn.setCellValueFactory(param -> new SimpleBooleanProperty(param.getValue() != null));
deleteColumn.setCellFactory(p -> {
final ButtonCell $ = new ButtonCell();
$.setAlignment(Pos.CENTER);
return $;
});
addTypeField.setPromptText("Field Type");
addTypeField.getItems().addAll(Types.values());
addNameField.focusedProperty().addListener(new ChangeListener<Boolean>() {
@Override
public void changed(ObservableValue<? extends Boolean> b, Boolean oldValue, Boolean newValue) {
if (// Focusing out
!newValue)
addNameField.setStyle("-fx-border-color: " + (addNameField.getText().isEmpty() ? "red" : "green"));
}
});
alias.focusedProperty().addListener(new ChangeListener<Boolean>() {
@Override
public void changed(ObservableValue<? extends Boolean> b, Boolean oldValue, Boolean newValue) {
if (// Focusing out
!newValue)
alias.setStyle("-fx-border-color: " + (alias.getText().isEmpty() ? "red" : "green"));
}
});
commName.focusedProperty().addListener(new ChangeListener<Boolean>() {
@Override
public void changed(ObservableValue<? extends Boolean> b, Boolean oldValue, Boolean newValue) {
if (// Focusing out
!newValue)
commName.setStyle("-fx-border-color: " + (commName.getText().isEmpty() ? "red" : "green"));
}
});
final int btnCount = buttonBox.getChildren().size();
addNameField.prefWidthProperty().bind(buttonBox.widthProperty().divide(btnCount));
addTypeField.prefWidthProperty().bind(buttonBox.widthProperty().divide(btnCount));
addButton.prefWidthProperty().bind(buttonBox.widthProperty().divide(btnCount));
addButton.setOnAction(__1 -> addField());
saveButton.setOnAction(__1 -> saveNewSensor());
fieldsTable.setItems(typesList);
}
use of javafx.beans.property.SimpleBooleanProperty in project Smartcity-Smarthouse by TechnionYP5777.
the class MainSensorListController method initialize.
/*
* (non-Javadoc)
*
* @see
* il.ac.technion.cs.smarthouse.gui_controller.GuiController#initialize(java
* .lang.Object, il.ac.technion.cs.smarthouse.gui_controller.GuiController,
* java.net.URL, java.util.ResourceBundle)
*/
@Override
protected <T extends GuiController<SensorsSimulator>> void initialize(SensorsSimulator model1, T parent1, URL location, ResourceBundle b) {
Consumer<GenericSensor> addConsumer = x -> {
this.sensors.add(new Pair<String, String>(model1.getSensorId(x), x.getCommname() + "(" + x.getAlias() + ")"));
sensors.sort(new Comparator<Pair<String, String>>() {
@Override
public int compare(Pair<String, String> o1, Pair<String, String> o2) {
return o1.getValue().compareTo(o2.getValue());
}
});
};
model1.addListenerWhen(SensorsSimulator.Action.ADD, addConsumer);
sensorTable.setItems(sensors);
nameColumn.prefWidthProperty().bind(sensorTable.widthProperty().multiply(0.7));
nameColumn.setResizable(false);
nameColumn.setCellValueFactory(cellData -> new ReadOnlyStringWrapper(cellData.getValue().getValue()));
configColumn.prefWidthProperty().bind(sensorTable.widthProperty().multiply(0.1));
configColumn.setResizable(false);
configColumn.setCellValueFactory(param -> new SimpleBooleanProperty(param.getValue() != null));
configColumn.setCellFactory(p -> {
final ButtonCell $ = new ButtonCell();
$.setAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent e) {
final TextInputDialog dialog = new TextInputDialog();
dialog.setGraphic(new ImageView(new Image(getClass().getResourceAsStream("/Homeicon.png"))));
dialog.setTitle("Sensor simulator");
dialog.setHeaderText("Clone Sensor");
dialog.setContentText("Please enter the cloned sensor alias:");
final Optional<String> result = dialog.showAndWait();
if (!result.isPresent())
return;
final String name = result.get();
MainSensorListController.this.getModel().cloneSensor($.getTableView().getItems().get($.getIndex()).getKey(), name);
}
});
$.setImage(new ImageView(new Image(getClass().getResourceAsStream("/Copy.png"))));
$.setAlignment(Pos.CENTER);
return $;
});
messageColumn.prefWidthProperty().bind(sensorTable.widthProperty().multiply(0.1));
messageColumn.setResizable(false);
messageColumn.setCellValueFactory(param -> new SimpleBooleanProperty(param.getValue() != null));
messageColumn.setCellFactory(p -> {
final ButtonCell $ = new ButtonCell();
$.setAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent e) {
setSelectedSensor($.getTableView().getItems().get($.getIndex()).getKey());
((DeveloperSimulatorController) MainSensorListController.this.getParentController()).openMessageWindow();
}
});
$.setImage(new ImageView(new Image(getClass().getResourceAsStream("/Message.png"))));
$.setAlignment(Pos.CENTER);
return $;
});
deleteColumn.prefWidthProperty().bind(sensorTable.widthProperty().multiply(0.1));
deleteColumn.setResizable(false);
deleteColumn.setCellValueFactory(param -> new SimpleBooleanProperty(param.getValue() != null));
deleteColumn.setCellFactory(p -> {
final ButtonCell $ = new ButtonCell();
$.setAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent e) {
Alert alert = new Alert(AlertType.CONFIRMATION);
alert.setTitle("Confirmation Dialog");
alert.setHeaderText("Are you sure?");
alert.setContentText("The sensor will be deleted forever!");
Optional<ButtonType> result = alert.showAndWait();
if (result.get() != ButtonType.OK)
return;
final Pair<String, String> currentSensor = $.getTableView().getItems().get($.getIndex());
model1.removeSensor(currentSensor.getKey());
MainSensorListController.this.sensors.remove(currentSensor);
}
});
$.setImage(new ImageView(new Image(getClass().getResourceAsStream("/Delete.png"))));
$.setAlignment(Pos.CENTER);
return $;
});
addButton.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent e) {
((DeveloperSimulatorController) MainSensorListController.this.getParentController()).moveToConfiguration();
}
});
}
Aggregations