Skip to content

Commit

Permalink
Merge pull request #662 from dlsc-software-consulting-gmbh/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
dlemmermann committed Sep 4, 2024
2 parents 693a604 + 1ac638c commit d9ec3ba
Show file tree
Hide file tree
Showing 23 changed files with 166 additions and 139 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
package com.dlsc.jfxcentral2.app.pages;

import animatefx.animation.FadeIn;
import animatefx.animation.FadeOut;
import animatefx.animation.GlowBackground;
import animatefx.animation.SlideOutUp;
import animatefx.animation.Tada;
import animatefx.animation.Wobble;
import com.dlsc.jfxcentral2.app.RepositoryManager;
import com.dlsc.jfxcentral2.app.utils.RepositoryUpdater;
import com.dlsc.jfxcentral2.components.CustomImageView;
Expand All @@ -18,7 +24,10 @@
import javafx.scene.layout.Region;
import javafx.scene.layout.StackPane;
import javafx.scene.layout.VBox;
import javafx.scene.paint.Color;
import javafx.scene.text.TextAlignment;
import javafx.util.Duration;
import one.jpro.jproutils.treeshowing.TreeShowing;

public class MobileRefreshPage extends StackPane {

Expand Down Expand Up @@ -65,7 +74,6 @@ private void setupFirstTimeUI() {

Label loadLabel = new Label();
loadLabel.getStyleClass().add("load-label");
loadLabel.setManaged(false);
loadLabel.setVisible(false);
loadLabel.setTextAlignment(TextAlignment.CENTER);
loadLabel.textProperty().bind(Bindings.createStringBinding(() -> {
Expand All @@ -81,19 +89,27 @@ private void setupFirstTimeUI() {
}, repositoryUpdater.loadMessageProperty(), repositoryUpdater.loadPercentageProperty()));

// bottom part
Button startButton = new Button("Get Started");
Button startButton = new Button("Start");
startButton.getStyleClass().add("start-button");
startButton.setVisible(true);
startButton.setVisible(true);

startButton.setOnAction(evt -> {
startButton.setVisible(false);
startButton.setManaged(false);
loadLabel.setVisible(true);
loadLabel.setManaged(true);
repositoryUpdater.performUpdate(false);
FadeOut fadeOut = new FadeOut(startButton);
fadeOut.setSpeed(2);

FadeIn fadeIn = new FadeIn(loadLabel);
fadeIn.setSpeed(2);
fadeIn.setOnFinished(e -> repositoryUpdater.performUpdate(false));

fadeOut.setOnFinished(e -> {
startButton.setVisible(false);
loadLabel.setVisible(true);
fadeIn.play();
});

fadeOut.play();
});

VBox bottomBox = new VBox(startButton, loadLabel);
StackPane bottomBox = new StackPane(startButton, loadLabel);
bottomBox.getStyleClass().add("bottom-box");

VBox content = new VBox(logo, introPane, bottomBox);
Expand Down
1 change: 1 addition & 0 deletions app/src/main/java/module-info.java
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@
requires com.gluonhq.attach.util;
requires com.dlsc.jfxcentral2.mobile;
requires jpro.utils.treeshowing;
requires animatefx;

exports com.dlsc.jfxcentral2.app;
exports com.dlsc.jfxcentral2.app.pages;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,29 +40,26 @@ public CustomMarkdownView() {
getStylesheets().add(Objects.requireNonNull(CustomMarkdownView.class.getResource("markdown.css")).toExternalForm());

TreeShowing.treeShowing(this).addListener(it -> setupWorkAroundForWebViewLayout());
Platform.runLater(this::setupWorkAroundForWebViewLayout);
mdStringProperty().addListener(it -> Platform.runLater(this::setupWorkAroundForWebViewLayout));
}

private void setupWorkAroundForWebViewLayout() {
List<WebView> webViews = new ArrayList<>();
getChildrenUnmodifiable().forEach(child -> collectWebViews(child, webViews));
webViews.forEach(view -> {
fixIt(view);
view.localToSceneTransformProperty().addListener((obs, oldV, newV) -> fixIt(view));
});
webViews.forEach(view -> view.localToSceneTransformProperty().addListener((obs, oldV, newV) -> fixIt(view)));
}

boolean fixing = false;

private void fixIt(WebView view) {
if (!fixing) {
fixing = true;
view.setLayoutY(view.getLayoutY() + 1);
double width = view.getWidth();
double height = view.getHeight();
view.resize(width + 1, height + 1);
view.resize(width, height);
fixing = false;
Platform.runLater(() -> fixing = false);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Priority;
import javafx.scene.layout.Region;
import javafx.scene.layout.StackPane;
import org.kordamp.ikonli.javafx.FontIcon;
import org.kordamp.ikonli.materialdesign.MaterialDesign;

Expand All @@ -28,8 +30,18 @@ public MobileSearchTextField() {
BorderPane.setAlignment(icon, Pos.CENTER);
BorderPane.setMargin(textField, new Insets(0, 10, 0, 10));

// right side clear button
Region arrow = new Region();
arrow.getStyleClass().add("arrow");
StackPane arrowButton = new StackPane(arrow);
arrowButton.getStyleClass().add("arrow-button");
arrowButton.setOnMousePressed(e -> textField.clear());
arrowButton.visibleProperty().bind(textField.textProperty().isNotEmpty());
BorderPane.setAlignment(arrowButton, Pos.CENTER_RIGHT);

setLeft(icon);
setCenter(textField);
setRight(arrowButton);
}

private final StringProperty text = new SimpleStringProperty();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,14 @@ public static Node createVideoViewNode(Video video, boolean closeable) {
return webView;
}

StackPane webViewWrapper = new StackPane();
webViewWrapper.getStyleClass().add("web-view-wrapper");

Button closeButton = new Button();
closeButton.setFocusTraversable(false);
closeButton.getStyleClass().addAll("close-button", "blue-button");
closeButton.setGraphic(new FontIcon(IkonUtil.close));

WebViewWrapper webViewWrapper = new WebViewWrapper(webView, closeButton);
webViewWrapper.getStyleClass().add("web-view-wrapper");

closeButton.setOnAction(event -> {
Pane parent = (Pane) webViewWrapper.getParent();
if (parent != null) {
Expand All @@ -83,14 +84,35 @@ public static Node createVideoViewNode(Video video, boolean closeable) {
}
});

StackPane.setAlignment(closeButton, Pos.TOP_RIGHT);
StackPane.setMargin(closeButton, new Insets(5, 5, 0, 0));

webViewWrapper.getChildren().addAll(webView, closeButton);
webViewWrapper.setFocusTraversable(false);
return webViewWrapper;
}

private static class WebViewWrapper extends StackPane {

public WebViewWrapper(WebView webView, Button closeButton) {
StackPane.setAlignment(closeButton, Pos.TOP_RIGHT);
StackPane.setMargin(closeButton, new Insets(5, 5, 0, 0));
getChildren().addAll(webView, closeButton);
setFocusTraversable(false);

webView.localToSceneTransformProperty().addListener((obs, oldV, newV) -> fixIt(webView));
}

boolean fixing = false;

private void fixIt(WebView view) {
if (!fixing) {
fixing = true;
view.setLayoutY(view.getLayoutY() + 1);
double width = view.getWidth();
double height = view.getHeight();
view.resize(width + 1, height + 1);
view.resize(width, height);
Platform.runLater(() -> fixing = false);
}
}
}

private static void bindWidthAndHeight(HTMLView htmlView, Region region) {
DoubleBinding widthBinding = Bindings.createDoubleBinding(() -> region.getWidth() - region.getInsets().getLeft() - region.getInsets().getRight(), region.widthProperty(), region.insetsProperty());

Expand Down
5 changes: 5 additions & 0 deletions mobile/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@

<dependencies>

<dependency>
<groupId>io.github.typhon0</groupId>
<artifactId>AnimateFX</artifactId>
</dependency>

<dependency>
<groupId>com.gluonhq.attachextended</groupId>
<artifactId>yt</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
package com.dlsc.jfxcentral2.mobile.components;

import com.dlsc.jfxcentral2.components.CustomImageView;
import javafx.beans.binding.Bindings;
import javafx.beans.binding.NumberBinding;
import javafx.beans.property.ObjectProperty;
import javafx.beans.property.SimpleObjectProperty;
import javafx.geometry.Pos;
import javafx.scene.control.Label;
import javafx.scene.image.Image;
import javafx.scene.layout.Priority;
import javafx.scene.layout.Region;
import javafx.scene.layout.StackPane;
import javafx.scene.layout.VBox;

Expand All @@ -17,9 +22,16 @@ public IntroCard() {

CustomImageView imageView = new CustomImageView();
imageView.imageProperty().bind(imageProperty());
imageView.setPreserveRatio(true);

StackPane imageWrapper = new StackPane(imageView);
imageWrapper.getStyleClass().add("image-wrapper");
imageWrapper.setMinSize(0, 0);
VBox.setVgrow(imageWrapper, Priority.ALWAYS);

NumberBinding size = Bindings.min(imageWrapper.widthProperty(), imageWrapper.heightProperty());
imageView.fitWidthProperty().bind(size);
imageView.fitHeightProperty().bind(size);

Label titleLabel = new Label();
titleLabel.getStyleClass().add("title");
Expand All @@ -29,6 +41,7 @@ public IntroCard() {
descriptionLabel.getStyleClass().add("description");
descriptionLabel.textProperty().bind(descriptionProperty());
descriptionLabel.setWrapText(true);
descriptionLabel.setMinHeight(Region.USE_PREF_SIZE);

getChildren().addAll(imageWrapper, titleLabel, descriptionLabel);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,24 +24,21 @@ public record IntroCardData(String title, String description, String imageUrl) {
}

public final List<IntroCardData> introCardData = new ArrayList<>(List.of(
new IntroCardData("Books", "Beginner guides, advanced tutorials, game development.", "books.png"),
new IntroCardData("Videos", "Watch videos of conference talks, demos, and tutorials.", "videos.png"),
new IntroCardData("Libraries", "Explore third-party libraries that you can add to your own applications.", "libraries.png"),
new IntroCardData("Tutorials", "See a listing of places where you can find good online tutorials.", "tutorials.png"),
new IntroCardData("Tools", "Find out which tools are available for styling, testing, packaging, etc...", "tools.png"),
new IntroCardData("Links of The Week", "Miscellaneous stuff found on the web that is related to JavaFX.", "news.png"),
new IntroCardData("Tips & Tricks", "Real-world tips and tricks for effective user interface development.", "tips.png"),
new IntroCardData("Blogs", "A collection of blogs related to JavaFX", "blogs.png"),
new IntroCardData("People", "People that influence the JavaFX ecosystem.", "people.png"),
new IntroCardData("Companies", "Companies that contribute to the JavaFX ecosystem.", "companies.png")
new IntroCardData("People", "Discover people that influence the JavaFX ecosystem.", "people.png"),
new IntroCardData("Libraries", "Explore third-party libraries that you can add to your JavaFX applications.", "libraries.png"),
new IntroCardData("Videos", "Watch videos of JavaFX conference talks, demos, and tutorials.", "videos.png"),
new IntroCardData("Books", "Become aware of literature available for JavaFX.", "books.png"),
new IntroCardData("Tools", "Find out which tools are available for your JavaFX coding needs.", "tools.png"),
new IntroCardData("Links of the Week", "Dive into random stuff found on the web that is related to JavaFX.", "news.png"),
new IntroCardData("Tutorials", "Read the list of tutorials for JavaFX.", "tutorials.png"),
new IntroCardData("Tips & Tricks", "Study tips and tricks for JavaFX user interface development.", "tips.png"),
new IntroCardData("Blogs", "Browse through a collection of blogs related to programming in JavaFX", "blogs.png"),
new IntroCardData("Companies", "Find out which companies contribute to JavaFX.", "companies.png")
));

public IntroPane() {
getStyleClass().add(DEFAULT_STYLE_CLASS);

// shuffle pages
Collections.shuffle(introCardData);

// page view
pageView = new PageView();
pageView.setSwitchPageDuration(Duration.seconds(0.5));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,40 +4,27 @@
import com.dlsc.jfxcentral.data.model.Blog;
import com.dlsc.jfxcentral.data.model.Book;
import com.dlsc.jfxcentral.data.model.Library;
import com.dlsc.jfxcentral.data.model.LinksOfTheWeek;
import com.dlsc.jfxcentral.data.model.ModelObject;
import com.dlsc.jfxcentral.data.model.Person;
import com.dlsc.jfxcentral.data.model.RealWorldApp;
import com.dlsc.jfxcentral.data.model.Tip;
import com.dlsc.jfxcentral.data.model.Video;
import com.dlsc.jfxcentral2.components.MobileSearchTextField;
import com.dlsc.jfxcentral2.components.MobilePageBase;

import com.dlsc.jfxcentral2.components.MobileSearchTextField;
import com.dlsc.jfxcentral2.mobile.components.LearnCategoryBox;
import com.dlsc.jfxcentral2.mobile.components.MobileSearchView;
import com.dlsc.jfxcentral2.mobile.home.CategoryAdvancedView;
import com.dlsc.jfxcentral2.mobile.home.CategoryPreviewView;
import com.dlsc.jfxcentral2.mobile.home.HomePageHeader;
import com.dlsc.jfxcentral2.mobile.home.WeekLinksView;
import com.dlsc.jfxcentral2.utils.OSUtil;
import com.dlsc.jfxcentral2.utils.PagePath;
import com.dlsc.jfxcentral2.utils.StringUtil;
import javafx.beans.binding.Bindings;
import javafx.beans.property.ObjectProperty;
import javafx.beans.property.ReadOnlyObjectWrapper;
import javafx.geometry.Pos;
import javafx.scene.Node;
import javafx.scene.control.Button;
import javafx.scene.control.ScrollPane;
import javafx.scene.control.ToggleButton;
import javafx.scene.input.MouseButton;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Priority;
import javafx.scene.layout.Region;
import javafx.scene.layout.StackPane;
import javafx.scene.layout.VBox;
import javafx.scene.shape.Rectangle;
import org.apache.commons.lang3.StringUtils;

import java.util.ArrayList;
Expand Down Expand Up @@ -79,7 +66,7 @@ private MobileHomePage() {

// search field
MobileSearchTextField searchTextField = new MobileSearchTextField();
searchTextField.setRight(createSearchCancelButton());
searchTextField.setRight(createSearchFieldRightNode(searchTextField));
searchTextField.setPromptText("Search for anything...");
searchTextField.setOnMousePressed(event -> setContentType(ContentType.SEARCH));
searchTextField.setOnTouchPressed(event -> setContentType(ContentType.SEARCH));
Expand Down Expand Up @@ -107,11 +94,14 @@ private MobileHomePage() {
});
}

private Button createSearchCancelButton() {
Button button = new Button("Cancel");
button.visibleProperty().bind(contentTypeProperty().isEqualTo(ContentType.SEARCH));
button.setOnMouseClicked(evt -> setContentType(ContentType.NORMAL));
return button;
private HBox createSearchFieldRightNode(MobileSearchTextField searchTextField) {
Button cancelButton = new Button("Cancel");
cancelButton.visibleProperty().bind(contentTypeProperty().isEqualTo(ContentType.SEARCH));
cancelButton.setOnMouseClicked(evt -> setContentType(ContentType.NORMAL));

HBox rightBox = new HBox(searchTextField.getRight(), cancelButton);
rightBox.getStyleClass().add("right-box");
return rightBox;
}

private Node createNormalView() {
Expand Down
1 change: 1 addition & 0 deletions mobile/src/main/java/module-info.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
requires batik.svggen;
requires com.github.weisj.jsvg;
requires org.scenicview.scenicview;
requires animatefx;

requires fr.brouillard.oss.cssfx;

Expand Down
Loading

0 comments on commit d9ec3ba

Please sign in to comment.