use of javafx.beans.binding.DoubleBinding in project JFoenix by jfoenixadmin.
the class GenericEditableTreeTableCell method createEditorNode.
private void createEditorNode() {
EventHandler<KeyEvent> keyEventsHandler = new EventHandler<KeyEvent>() {
@Override
public void handle(KeyEvent t) {
if (t.getCode() == KeyCode.ENTER) {
commitHelper(false);
} else if (t.getCode() == KeyCode.ESCAPE) {
cancelEdit();
} else if (t.getCode() == KeyCode.TAB) {
commitHelper(false);
TreeTableColumn nextColumn = getNextColumn(!t.isShiftDown());
if (nextColumn != null) {
getTreeTableView().edit(getIndex(), nextColumn);
}
}
}
};
ChangeListener<Boolean> focusChangeListener = new ChangeListener<Boolean>() {
@Override
public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) {
//of stopping the double commit.
if (!newValue && editorNode != null) {
commitHelper(true);
}
}
};
DoubleBinding minWidthBinding = Bindings.createDoubleBinding(() -> {
return this.getWidth() - this.getGraphicTextGap() * 2 - this.getBaselineOffset();
}, this.widthProperty(), this.graphicTextGapProperty());
editorNode = builder.createNode(getValue(), minWidthBinding, keyEventsHandler, focusChangeListener);
}
use of javafx.beans.binding.DoubleBinding in project NMEAParser by tvesalainen.
the class CurrentArrowCanvas method bind.
@Override
public void bind(ViewerPreferences preferences, PropertyStore propertyStore, BooleanProperty active) {
super.bind(preferences, propertyStore, active);
ObservableNumberValue currentAngleOverGround = propertyStore.getBinding("currentAngleOverGround");
// fix current direction
DoubleBinding fixed = Bindings.createDoubleBinding(() -> Navis.normalizeAngle(currentAngleOverGround.doubleValue() + 180), currentAngleOverGround);
angleProperty().bind(fixed);
valueProperty().bind(propertyStore.getBinding("currentSpeedOverGround"));
disableProperty().bind(propertyStore.getDisableBind("currentAngleOverGround", "currentSpeedOverGround"));
}
Aggregations