Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JFXNotifications is here !! (the beginning ...) #969

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 75 additions & 0 deletions demo/src/main/java/demos/components/NotificationDemo.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
package demos.components;

import com.jfoenix.controls.JFXButton;
import com.jfoenix.controls.JFXNotifications;
import com.jfoenix.notification.template.JFXSimpleNotificationTemplate;
import de.jensd.fx.glyphs.fontawesome.FontAwesomeIcon;
import de.jensd.fx.glyphs.fontawesome.FontAwesomeIconView;
import javafx.application.Application;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.layout.FlowPane;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;
import javafx.util.Duration;

public final class NotificationDemo extends Application {

@Override
public void start(Stage stage) {
JFXButton buttonTopLeft = new JFXButton("Open TOP LEFT");
JFXButton buttonTopCenter = new JFXButton("Open TOP CENTER");
JFXButton buttonTopRight = new JFXButton("Open TOP RIGHT");
JFXButton buttonCenterLeft = new JFXButton("Open CENTER LEFT");
JFXButton buttonCenter = new JFXButton("Open CENTER");
JFXButton buttonCenterRight = new JFXButton("Open CENTER RIGHT");
JFXButton buttonBottomLeft = new JFXButton("Open BOTTOM LEFT");
JFXButton buttonBottomCenter = new JFXButton("Open BOTTOM CENTER");
JFXButton buttonBottomRight = new JFXButton("Open BOTTOM RIGHT");

buttonTopLeft.setOnAction( __ -> showDialog(Pos.TOP_LEFT));
buttonTopCenter.setOnAction( __ -> showDialog(Pos.TOP_CENTER));
buttonTopRight.setOnAction( __ -> showDialog(Pos.TOP_RIGHT));
buttonCenterLeft.setOnAction( __ -> showDialog(Pos.CENTER_LEFT));
buttonCenter.setOnAction( __ -> showDialog(Pos.CENTER));
buttonCenterRight.setOnAction( __ -> showDialog(Pos.CENTER_RIGHT));
buttonBottomLeft.setOnAction( __ -> showDialog(Pos.BOTTOM_LEFT));
buttonBottomCenter.setOnAction( __ -> showDialog(Pos.BOTTOM_CENTER));
buttonBottomRight.setOnAction( __ -> showDialog(Pos.BOTTOM_RIGHT));
FlowPane pane = new FlowPane();
pane.setHgap(5);
pane.setVgap(5);
pane.getChildren().addAll(buttonTopLeft,buttonTopCenter,buttonTopRight,buttonCenterLeft,
buttonCenter,buttonCenterRight,buttonBottomLeft,buttonBottomCenter,buttonBottomRight);
pane.getChildren().forEach(button -> {
button.setStyle("-fx-background-color: WHITE");
((JFXButton)button).setButtonType(JFXButton.ButtonType.RAISED);
});
final Scene scene = new Scene(pane, 800, 200);
scene.getStylesheets().addAll(NotificationDemo.class.getResource("/css/jfoenix-fonts.css").toExternalForm(),
NotificationDemo.class.getResource("/css/jfoenix-design.css").toExternalForm(),
NotificationDemo.class.getResource("/css/jfoenix-components.css").toExternalForm());
stage.setTitle("JFXNotification Demo");
stage.setScene(scene);
stage.show();
}

private void showDialog(Pos pos){
JFXSimpleNotificationTemplate template = new JFXSimpleNotificationTemplate();
FontAwesomeIconView icon = new FontAwesomeIconView(FontAwesomeIcon.GLASS);
template.setHeader(icon, "Fast Food");
template.setBody("Lily (MacDonald)","Su pedido esta listo, solo debe recogerlo en el lugar mas solicitado");
JFXButton aceptar = new JFXButton("Responder");
template.setActions(aceptar);
JFXNotifications.create().position(pos)
.hideAfter(Duration.seconds(6))
.template(template)
.showMessage();
}

public static void main(String[] args) {
launch(args);
}

}
1 change: 1 addition & 0 deletions demo/src/main/java/demos/components/PopupDemo.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public void start(Stage primaryStage) throws Exception {
main.getChildren().add(container);

JFXPopup popup = new JFXPopup(list);

rippler.setOnMouseClicked(e -> popup.show(rippler, PopupVPosition.TOP, PopupHPosition.LEFT));

final Scene scene = new Scene(main, 800, 800);
Expand Down
19 changes: 19 additions & 0 deletions demo/src/main/resources/css/jfoenix-components.css
Original file line number Diff line number Diff line change
Expand Up @@ -340,4 +340,23 @@
-fx-padding: 5 0 5 0;
}

.jfx-notification-template .jfx-notification-action {
-fx-spacing: 5;
}

.jfx-notification-template .jfx-notification-action > .btn-action {
-jfx-disable-visual-focus: true;
-fx-text-fill: #2E7D32;
-fx-background-insets: 0;
-fx-padding: 0 0 0 0;
-fx-alignment: center;
-fx-font-family: "Roboto Medium";
-fx-cursor: HAND;
-fx-pref-width: 90;
-fx-pref-height: 30;
}

.jfx-notification-template .jfx-notification-header > .glyph-icon{
-glyph-size: 16;
-fx-fill: #2E7D32;
}
Loading