use of com.jfoenix.controls.JFXButton 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();
}
use of com.jfoenix.controls.JFXButton in project SmartCity-Market by TechnionYP5777.
the class DialogMessagesService method alertCreator.
private static void alertCreator(String title, String header, String content) {
JFXDialogLayout dialogContent = new JFXDialogLayout();
dialogContent.setHeading(new Text(header == null ? title : title + "\n" + header));
dialogContent.setBody(new Text(content));
JFXButton close = new JFXButton("Close");
close.getStyleClass().add("JFXButton");
dialogContent.setActions(close);
JFXDialog dialog = new JFXDialog((StackPane) AbstractApplicationScreen.stage.getScene().getRoot(), dialogContent, JFXDialog.DialogTransition.CENTER);
close.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent __) {
dialog.close();
}
});
dialog.show();
}
use of com.jfoenix.controls.JFXButton in project JFoenix by jfoenixadmin.
the class MasonryPaneController method init.
@PostConstruct
public void init() throws FlowException, VetoException {
ArrayList<Node> children = new ArrayList<>();
for (int i = 0; i < 20; i++) {
StackPane child = new StackPane();
double width = Math.random() * 100 + 100;
child.setMinWidth(width);
child.setMaxWidth(width);
child.setPrefWidth(width);
double height = Math.random() * 100 + 100;
child.setMinHeight(height);
child.setMaxHeight(height);
child.setPrefHeight(height);
JFXDepthManager.setDepth(child, 1);
children.add(child);
// create content
VBox content = new VBox();
StackPane header = new StackPane();
String headerColor = getDefaultColor(i % 12);
header.setStyle("-fx-background-radius: 5 5 0 0; -fx-background-color: " + headerColor);
VBox.setVgrow(header, Priority.ALWAYS);
StackPane body = new StackPane();
body.setMinHeight(Math.random() * 20 + 50);
content.getChildren().addAll(header, body);
body.setStyle("-fx-background-radius: 0 0 5 5; -fx-background-color: rgb(255,255,255,0.87);");
// create button
JFXButton button = new JFXButton("");
button.setButtonType(ButtonType.RAISED);
button.setStyle("-fx-background-radius: 40;-fx-background-color: " + getDefaultColor((int) ((Math.random() * 12) % 12)));
button.setPrefSize(40, 40);
button.setRipplerFill(Color.valueOf(headerColor));
button.setScaleX(0);
button.setScaleY(0);
SVGGlyph glyph = new SVGGlyph(-1, "test", "M1008 6.286q18.857 13.714 15.429 36.571l-146.286 877.714q-2.857 16.571-18.286 25.714-8 4.571-17.714 4.571-6.286 0-13.714-2.857l-258.857-105.714-138.286 168.571q-10.286 13.143-28 13.143-7.429 0-12.571-2.286-10.857-4-17.429-13.429t-6.571-20.857v-199.429l493.714-605.143-610.857 528.571-225.714-92.571q-21.143-8-22.857-31.429-1.143-22.857 18.286-33.714l950.857-548.571q8.571-5.143 18.286-5.143 11.429 0 20.571 6.286z", Color.WHITE);
glyph.setSize(20, 20);
button.setGraphic(glyph);
button.translateYProperty().bind(Bindings.createDoubleBinding(() -> {
return header.getBoundsInParent().getHeight() - button.getHeight() / 2;
}, header.boundsInParentProperty(), button.heightProperty()));
StackPane.setMargin(button, new Insets(0, 12, 0, 0));
StackPane.setAlignment(button, Pos.TOP_RIGHT);
Timeline animation = new Timeline(new KeyFrame(Duration.millis(240), new KeyValue(button.scaleXProperty(), 1, Interpolator.EASE_BOTH), new KeyValue(button.scaleYProperty(), 1, Interpolator.EASE_BOTH)));
animation.setDelay(Duration.millis(100 * i + (1000)));
animation.play();
child.getChildren().addAll(content, button);
}
masonryPane.getChildren().addAll(children);
Platform.runLater(() -> scrollPane.requestLayout());
JFXScrollPane.smoothScrolling(scrollPane);
}
use of com.jfoenix.controls.JFXButton in project JFoenix by jfoenixadmin.
the class SVGLoaderController method createIconButton.
private Button createIconButton(SVGGlyph glyph) {
JFXButton button = new JFXButton(null, glyph);
button.ripplerFillProperty().bind(glyphDetailViewer.colorPicker.valueProperty());
glyphDetailViewer.colorPicker.valueProperty().addListener((o, oldVal, newVal) -> {
String webColor = "#" + Integer.toHexString(newVal.hashCode()).substring(0, 6).toUpperCase();
BackgroundFill fill = ((Region) glyphDetailViewer.sizeSlider.lookup(".thumb")).getBackground().getFills().get(0);
((Region) glyphDetailViewer.sizeSlider.lookup(".thumb")).setBackground(new Background(new BackgroundFill(Color.valueOf(webColor), fill.getRadii(), fill.getInsets())));
// glyphDetailViewer.sizeSlider.lookup(".thumb").setStyle("-fx-background-color: "+webColor+"; -fx-fill: "+webColor+";");
if (lastClicked != null)
lastClicked.setBackground(new Background(new BackgroundFill(Color.valueOf(glyphDetailViewer.colorPicker.getValue().toString().substring(0, 8) + "33"), null, null)));
});
button.setOnAction(event -> {
if (lastClicked != null)
lastClicked.setBackground(new Background(new BackgroundFill(Color.TRANSPARENT, null, null)));
button.setBackground(new Background(new BackgroundFill(Color.valueOf(glyphDetailViewer.colorPicker.getValue().toString().substring(0, 8) + "33"), null, null)));
lastClicked = button;
viewGlyphDetail(glyph);
});
Tooltip.install(button, new Tooltip(glyph.getName()));
return button;
}
use of com.jfoenix.controls.JFXButton in project JFoenix by jfoenixadmin.
the class TabsDemo method start.
@Override
public void start(Stage primaryStage) {
primaryStage.setTitle("Tabs");
Group root = new Group();
Scene scene = new Scene(root, 700, 250);
JFXTabPane tabPane = new JFXTabPane();
Tab tab = new Tab();
tab.setText(msg);
tab.setContent(new Label("Tab 0"));
tabPane.getTabs().add(tab);
tabPane.setPrefSize(300, 200);
Tab tab1 = new Tab();
tab1.setText("Tab 01");
tab1.setContent(new Label("Tab 01"));
tabPane.getTabs().add(tab1);
SingleSelectionModel<Tab> selectionModel = tabPane.getSelectionModel();
selectionModel.select(1);
JFXButton button = new JFXButton("New Tab");
button.setOnMouseClicked((o) -> {
Tab temp = new Tab();
int count = tabPane.getTabs().size();
temp.setText(msg + count);
temp.setContent(new Label("Tab 0" + count));
tabPane.getTabs().add(temp);
});
tabPane.setMaxWidth(500);
HBox hbox = new HBox();
hbox.getChildren().addAll(button, tabPane);
hbox.setSpacing(50);
hbox.setAlignment(Pos.CENTER);
hbox.setStyle("-fx-padding:20");
root.getChildren().addAll(hbox);
scene.getStylesheets().add(TabsDemo.class.getResource("/resources/css/jfoenix-components.css").toExternalForm());
primaryStage.setScene(scene);
primaryStage.show();
primaryStage.setTitle("JFX Tabs Demo");
}
Aggregations