use of com.jfoenix.controls.JFXTextField in project JFoenix by jfoenixadmin.
the class JFXTextFieldSkinAndroid method createFloatingLabel.
private void createFloatingLabel() {
if (((JFXTextField) getSkinnable()).isLabelFloat()) {
if (promptText == null) {
// get the prompt text node or create it
boolean triggerFloatLabel = false;
if (textPane.getChildren().get(0) instanceof Text)
promptText = (Text) textPane.getChildren().get(0);
else {
Field field;
try {
field = TextFieldSkin.class.getDeclaredField("promptNode");
field.setAccessible(true);
createPromptNode();
field.set(this, promptText);
// position the prompt node in its position
triggerFloatLabel = true;
} catch (NoSuchFieldException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SecurityException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalArgumentException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalAccessException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
promptText.getTransforms().add(promptTextScale);
promptContainer.getChildren().add(promptText);
if (triggerFloatLabel) {
promptText.setTranslateY(-textPane.getHeight());
promptTextScale.setX(0.85);
promptTextScale.setY(0.85);
}
}
promptTextUpTransition = new CachedTransition(textPane, new Timeline(new KeyFrame(Duration.millis(1300), new KeyValue(promptText.translateYProperty(), -textPane.getHeight(), Interpolator.EASE_BOTH), new KeyValue(promptTextScale.xProperty(), 0.85, Interpolator.EASE_BOTH), new KeyValue(promptTextScale.yProperty(), 0.85, Interpolator.EASE_BOTH)))) {
{
setDelay(Duration.millis(0));
setCycleDuration(Duration.millis(240));
}
};
promptTextColorTransition = new CachedTransition(textPane, new Timeline(new KeyFrame(Duration.millis(1300), new KeyValue(promptTextFill, ((JFXTextField) getSkinnable()).getFocusColor(), Interpolator.EASE_BOTH)))) {
{
setDelay(Duration.millis(0));
setCycleDuration(Duration.millis(160));
}
protected void starting() {
super.starting();
oldPromptTextFill = promptTextFill.get();
}
;
};
promptTextDownTransition = new CachedTransition(textPane, new Timeline(new KeyFrame(Duration.millis(1300), new KeyValue(promptText.translateYProperty(), 0, Interpolator.EASE_BOTH), new KeyValue(promptTextScale.xProperty(), 1, Interpolator.EASE_BOTH), new KeyValue(promptTextScale.yProperty(), 1, Interpolator.EASE_BOTH)))) {
{
setDelay(Duration.millis(0));
setCycleDuration(Duration.millis(240));
}
};
promptTextDownTransition.setOnFinished((finish) -> {
promptText.setTranslateY(0);
promptTextScale.setX(1);
promptTextScale.setY(1);
});
promptText.visibleProperty().unbind();
promptText.visibleProperty().set(true);
}
}
use of com.jfoenix.controls.JFXTextField in project JFoenix by jfoenixadmin.
the class JFXTextFieldOldSkin method createFloatingLabel.
private void createFloatingLabel() {
if (((JFXTextField) getSkinnable()).isLabelFloat()) {
if (promptText == null) {
// get the prompt text node or create it
boolean triggerFloatLabel = false;
if (textPane.getChildren().get(0) instanceof Text)
promptText = (Text) textPane.getChildren().get(0);
else {
Field field;
try {
field = TextFieldSkin.class.getDeclaredField("promptNode");
field.setAccessible(true);
createPromptNode();
field.set(this, promptText);
// position the prompt node in its position
triggerFloatLabel = true;
} catch (NoSuchFieldException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SecurityException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalArgumentException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalAccessException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
promptContainer.getChildren().add(promptText);
if (triggerFloatLabel) {
promptText.setTranslateY(-textPane.getHeight());
promptText.setTranslateX(-(promptText.getLayoutBounds().getWidth() * 0.15) / 2);
promptText.setLayoutY(0);
promptText.setScaleX(0.85);
promptText.setScaleY(0.85);
}
}
promptTextUpTransition = new CachedTransition(textPane, new Timeline(new KeyFrame(Duration.millis(1300), new KeyValue(promptText.translateYProperty(), -textPane.getHeight(), Interpolator.EASE_BOTH), new KeyValue(promptText.translateXProperty(), -(promptText.getLayoutBounds().getWidth() * 0.15) / 2, Interpolator.EASE_BOTH), new KeyValue(promptText.scaleXProperty(), 0.85, Interpolator.EASE_BOTH), new KeyValue(promptText.scaleYProperty(), 0.85, Interpolator.EASE_BOTH)))) {
{
setDelay(Duration.millis(0));
setCycleDuration(Duration.millis(300));
}
};
promptTextColorTransition = new CachedTransition(textPane, new Timeline(new KeyFrame(Duration.millis(1300), new KeyValue(promptTextFill, focusedLine.getStroke(), Interpolator.EASE_BOTH)))) {
{
setDelay(Duration.millis(0));
setCycleDuration(Duration.millis(300));
}
protected void starting() {
super.starting();
oldPromptTextFill = promptTextFill.get();
}
;
};
promptTextDownTransition = new CachedTransition(textPane, new Timeline(new KeyFrame(Duration.millis(1300), new KeyValue(promptText.translateYProperty(), 0, Interpolator.EASE_BOTH), new KeyValue(promptText.translateXProperty(), 0, Interpolator.EASE_BOTH), new KeyValue(promptText.scaleXProperty(), 1, Interpolator.EASE_BOTH), new KeyValue(promptText.scaleYProperty(), 1, Interpolator.EASE_BOTH)))) {
{
setDelay(Duration.millis(0));
setCycleDuration(Duration.millis(300));
}
};
promptTextDownTransition.setOnFinished((finish) -> {
promptText.setTranslateX(0);
promptText.setTranslateY(0);
promptText.setScaleX(1);
promptText.setScaleY(1);
});
promptText.visibleProperty().unbind();
promptText.visibleProperty().set(true);
}
}
use of com.jfoenix.controls.JFXTextField in project JFoenix by jfoenixadmin.
the class DoubleTextFieldEditorBuilder method createNode.
@Override
public Region createNode(Double value, DoubleBinding minWidthBinding, EventHandler<KeyEvent> keyEventsHandler, ChangeListener<Boolean> focusChangeListener) {
StackPane pane = new StackPane();
pane.setStyle("-fx-padding:-10 0 -10 0");
textField = new JFXTextField(value + "");
textField.minWidthProperty().bind(minWidthBinding);
textField.setOnKeyPressed(keyEventsHandler);
textField.focusedProperty().addListener(focusChangeListener);
DoubleValidator validator = new DoubleValidator();
validator.setMessage("Value must be a rational number");
textField.getValidators().add(validator);
pane.getChildren().add(textField);
return pane;
}
use of com.jfoenix.controls.JFXTextField in project SmartCity-Market by TechnionYP5777.
the class GettingPasswordScreen method getContent.
@Override
Parent getContent() {
usernameField = new JFXTextField();
usernameField.textProperty().addListener((observable, oldValue, newValue) -> nextButton.setDisable(newValue.isEmpty()));
VBox vbox = new VBox(5, new Label("Enter Username"), usernameField);
vbox.setAlignment(Pos.CENTER);
return vbox;
}
use of com.jfoenix.controls.JFXTextField in project SmartCity-Market by TechnionYP5777.
the class ManageCatalogProductDetailsTab method initialize.
@Override
public void initialize(URL location, ResourceBundle __) {
createManufacturerList();
createIngredientList();
filterManu.textProperty().addListener(obs -> {
String filter = filterManu.getText();
filteredDataManu.setPredicate(filter == null || filter.length() == 0 ? s -> true : s -> s.contains(filter));
});
manufacturerList.setCellFactory(CheckBoxListCell.forListView(new Callback<String, ObservableValue<Boolean>>() {
@Override
public ObservableValue<Boolean> call(String item) {
BooleanProperty observable = new SimpleBooleanProperty();
observable.set(selectedManu.contains(item));
observable.addListener((obs, wasSelected, isNowSelected) -> {
if (isNowSelected)
selectedManu.add(item);
else
selectedManu.remove(item);
enableButtons();
});
return observable;
}
}));
filterIngr.textProperty().addListener(obs -> {
String filter = filterIngr.getText();
filteredDataIngr.setPredicate(filter == null || filter.length() == 0 ? s -> true : s -> s.contains(filter));
});
ingredientsList.setCellFactory(CheckBoxListCell.forListView(new Callback<String, ObservableValue<Boolean>>() {
@Override
public ObservableValue<Boolean> call(String item) {
BooleanProperty observable = new SimpleBooleanProperty();
observable.set(selectedIngr.contains(item));
observable.addListener((obs, wasSelected, isNowSelected) -> {
if (isNowSelected)
selectedIngr.add(item);
else
selectedIngr.remove(item);
enableButtons();
});
return observable;
}
}));
Label lbl1 = new Label("Insert New Manufacturar");
newManu = new JFXTextField();
okNewManu = new JFXButton("Done!");
okNewManu.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent __) {
addManuPressed();
}
});
VBox manuContainer = new VBox();
manuContainer.getChildren().addAll(lbl1, newManu, okNewManu);
manuContainer.setPadding(new Insets(10, 50, 50, 50));
manuContainer.setSpacing(10);
JFXPopup popup1 = new JFXPopup(manuContainer);
addManuBtn.setOnMouseClicked(e -> popup1.show(addManuBtn, PopupVPosition.TOP, PopupHPosition.LEFT));
newManu.textProperty().addListener((observable, oldValue, newValue) -> enableAddButtons());
Label lbl2 = new Label("Insert New Ingredient");
newIngr = new JFXTextField();
okNewIngr = new JFXButton("Done!");
okNewIngr.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent __) {
addIngPressed();
}
});
VBox ingrContainer = new VBox();
ingrContainer.getChildren().addAll(lbl2, newIngr, okNewIngr);
ingrContainer.setPadding(new Insets(10, 50, 50, 50));
ingrContainer.setSpacing(10);
JFXPopup popup2 = new JFXPopup(ingrContainer);
addIngrBtn.setOnMouseClicked(e -> popup2.show(addIngrBtn, PopupVPosition.TOP, PopupHPosition.LEFT));
newIngr.textProperty().addListener((observable, oldValue, newValue) -> enableAddButtons());
Label lbl3 = new Label("Rename Selected Manufacturar");
renameManuLbl = new JFXTextField();
okRenameManu = new JFXButton("Done!");
okRenameManu.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent __) {
renameManuPressed();
}
});
VBox renameManuContainer = new VBox();
renameManuContainer.getChildren().addAll(lbl3, renameManuLbl, okRenameManu);
renameManuContainer.setPadding(new Insets(10, 50, 50, 50));
renameManuContainer.setSpacing(10);
JFXPopup popup3 = new JFXPopup(renameManuContainer);
renameManu.setOnMouseClicked(e -> popup3.show(renameManu, PopupVPosition.TOP, PopupHPosition.LEFT));
renameManuLbl.textProperty().addListener((observable, oldValue, newValue) -> enableAddButtons());
Label lbl4 = new Label("Rename Selected Ingredient");
renameIngrLbl = new JFXTextField();
okRenameIngr = new JFXButton("Done!");
okRenameIngr.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent __) {
renameIngrPressed();
}
});
VBox renameIngrContainer = new VBox();
renameIngrContainer.getChildren().addAll(lbl4, renameIngrLbl, okRenameIngr);
renameIngrContainer.setPadding(new Insets(10, 50, 50, 50));
renameIngrContainer.setSpacing(10);
JFXPopup popup4 = new JFXPopup(renameIngrContainer);
renameIngr.setOnMouseClicked(e -> popup4.show(renameIngr, PopupVPosition.TOP, PopupHPosition.LEFT));
renameIngrLbl.textProperty().addListener((observable, oldValue, newValue) -> enableAddButtons());
enableButtons();
enableAddButtons();
}
Aggregations