Skip to content

Commit

Permalink
Merge pull request #579 from dlsc-software-consulting-gmbh/develop
Browse files Browse the repository at this point in the history
Misc.
  • Loading branch information
dlemmermann authored Dec 8, 2023
2 parents 7315668 + b7cd35d commit 03f3068
Show file tree
Hide file tree
Showing 98 changed files with 773 additions and 335 deletions.
1 change: 0 additions & 1 deletion .launchers/JFXCentral2App.run.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
<configuration default="false" name="JFXCentral2App" type="Application" factoryName="Application" nameIsGenerated="true">
<option name="MAIN_CLASS_NAME" value="com.dlsc.jfxcentral2.app.JFXCentral2App" />
<module name="app" />
<option name="VM_PARAMETERS" value="-Xmx1024m" />
<extension name="coverage">
<pattern>
<option name="PATTERN" value="com.dlsc.jfxcentral2.app.stage.*" />
Expand Down
22 changes: 20 additions & 2 deletions app/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,22 @@
</dependency>
-->

<!--
<dependency>
<groupId>com.gluonhq.attachextended</groupId>
<artifactId>yt</artifactId>
<version>${attach.extended.version}</version>
</dependency>
<dependency>
<groupId>com.gluonhq.attachextended</groupId>
<artifactId>yt</artifactId>
<version>${attach.extended.version}</version>
<scope>runtime</scope>
<classifier>${attach.extended.classifier}</classifier>
</dependency>
-->

<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-swing</artifactId>
Expand Down Expand Up @@ -456,13 +472,13 @@
<macAppStore>${mac.app.store}</macAppStore>
<bundleShortVersion>${bundle.short.version}</bundleShortVersion>
<bundleVersion>${bundle.version}</bundleVersion>
<skipSigning>true</skipSigning>
<!-- skipSigning>true</skipSigning -->
<!-- simulatorDevice>iPhone 15 Pro Max</simulatorDevice -->
<!-- simulatorDevice>iPhone SE (3rd generation)</simulatorDevice -->
<!-- simulatorDevice>iPad Pro (12.9-inch) (6th generation)</simulatorDevice -->
<!-- simulatorDevice>iPad Pro (11-inch) (4th generation)</simulatorDevice -->
<!-- simulatorDevice>iPad Pro (12.9-inch) (2nd generation)</simulatorDevice -->
<simulatorDevice>iPad (10th generation)</simulatorDevice>
<!-- simulatorDevice>iPad (10th generation)</simulatorDevice -->
<!-- for Android -->
<versionCode>${version.code}</versionCode>
<providedKeyStorePath>${provided.keystore.path}</providedKeyStorePath>
Expand Down Expand Up @@ -542,6 +558,7 @@
<gluonfx.target>ios</gluonfx.target>
<bundle.version>${env.GITHUB_RUN_NUMBER}</bundle.version>
<bundle.short.version>1.0</bundle.short.version>
<attach.extended.classifier>ios</attach.extended.classifier>
</properties>
</profile>
<profile>
Expand All @@ -557,6 +574,7 @@
<properties>
<gluonfx.target>android</gluonfx.target>
<app.identifier>com.dlsc.jfxcentral</app.identifier>
<attach.extended.classifier>android</attach.extended.classifier>
<version.code>${env.GITHUB_RUN_NUMBER}</version.code>
<provided.keystore.path>${env.GLUON_ANDROID_KEYSTOREPATH}</provided.keystore.path>
<provided.keystore.password>${env.GLUON_ANDROID_KEYSTORE_PASSWORD}</provided.keystore.password>
Expand Down
24 changes: 22 additions & 2 deletions app/src/main/java/com/dlsc/jfxcentral2/app/JFXCentral2App.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
import com.dlsc.jfxcentral2.app.pages.details.VideoDetailsPage;
import com.dlsc.jfxcentral2.app.stage.CustomStage;
import com.dlsc.jfxcentral2.app.utils.PrettyScrollPane;
import com.dlsc.jfxcentral2.app.utils.VideoPane;
import com.dlsc.jfxcentral2.model.Size;
import com.dlsc.jfxcentral2.utils.NodeUtil;
import com.dlsc.jfxcentral2.utils.OSUtil;
Expand Down Expand Up @@ -94,7 +95,6 @@
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.PrintStream;
import java.util.Locale;
import java.util.Objects;
import java.util.function.Supplier;
Expand Down Expand Up @@ -175,6 +175,12 @@ public void start(Stage stage) {
});
}

VideoPane videoPane = new VideoPane(size);
videoPane.onCloseProperty().bind(onCloseVideoPaneProperty());
videoPane.visibleProperty().bind(onCloseVideoPaneProperty().isNotNull());
setOnCloseVideoPane(() -> {});

StackPane wrapper = new StackPane(parent, videoPane);

// customs stage for decorations / the chrome
CustomStage customStage = new CustomStage(stage, parent, sessionManager, size);
Expand All @@ -194,7 +200,7 @@ public void start(Stage stage) {
scene.setFill(Color.web("#070B32"));
scene.widthProperty().addListener((it -> updateSizeProperty(scene)));
scene.getStylesheets().add(Objects.requireNonNull(NodeUtil.class.getResource("/com/dlsc/jfxcentral2/theme.css")).toExternalForm());
scene.focusOwnerProperty().addListener(it -> System.out.println("focus owner: " + scene.getFocusOwner()));
// scene.focusOwnerProperty().addListener(it -> System.out.println("focus owner: " + scene.getFocusOwner()));
updateSizeProperty(scene);

stage.setScene(scene);
Expand All @@ -210,6 +216,20 @@ public void start(Stage stage) {
stage.show();
}

private final ObjectProperty<Runnable> onCloseVideoPane = new SimpleObjectProperty<>(this, "onCloseVideoPane");

public Runnable getOnCloseVideoPane() {
return onCloseVideoPane.get();
}

public ObjectProperty<Runnable> onCloseVideoPaneProperty() {
return onCloseVideoPane;
}

public void setOnCloseVideoPane(Runnable onClose) {
this.onCloseVideoPane.set(onClose);
}

public Route createRoute() {
Route route = Route.empty()
.and(RouteUtils.get("/", r -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@
import com.dlsc.jfxcentral.data.model.Blog;
import com.dlsc.jfxcentral.data.model.Book;
import com.dlsc.jfxcentral.data.model.Company;
import com.dlsc.jfxcentral.data.model.Documentation;
import com.dlsc.jfxcentral.data.model.Download;
import com.dlsc.jfxcentral.data.model.Learn;
import com.dlsc.jfxcentral.data.model.LearnJavaFX;
import com.dlsc.jfxcentral.data.model.LearnMobile;
import com.dlsc.jfxcentral.data.model.LearnRaspberryPi;
import com.dlsc.jfxcentral.data.model.Library;
import com.dlsc.jfxcentral.data.model.ModelObject;
import com.dlsc.jfxcentral.data.model.Person;
Expand All @@ -21,12 +26,14 @@
import com.dlsc.jfxcentral2.components.detailsbox.CompaniesDetailsBox;
import com.dlsc.jfxcentral2.components.detailsbox.DetailsBoxBase;
import com.dlsc.jfxcentral2.components.detailsbox.DownloadsDetailsBox;
import com.dlsc.jfxcentral2.components.detailsbox.LearnDetailBox;
import com.dlsc.jfxcentral2.components.detailsbox.LibrariesDetailsBox;
import com.dlsc.jfxcentral2.components.detailsbox.PersonsDetailsBox;
import com.dlsc.jfxcentral2.components.detailsbox.TipsAndTricksDetailsBox;
import com.dlsc.jfxcentral2.components.detailsbox.ToolsDetailsBox;
import com.dlsc.jfxcentral2.components.detailsbox.TutorialsDetailsBox;
import com.dlsc.jfxcentral2.components.detailsbox.VideosDetailsBox;
import com.dlsc.jfxcentral2.components.detailsbox.DocumentationDetailsBox;
import com.dlsc.jfxcentral2.model.Size;
import com.dlsc.jfxcentral2.utils.OSUtil;
import javafx.beans.property.ObjectProperty;
Expand Down Expand Up @@ -92,6 +99,7 @@ protected List<DetailsBoxBase<?>> createDetailBoxes() {
maybeAddBox(modelObject, Video.class, VideosDetailsBox::new, boxes);
maybeAddBox(modelObject, Blog.class, BlogsDetailsBox::new, boxes);
maybeAddBox(modelObject, Tutorial.class, TutorialsDetailsBox::new, boxes);
maybeAddBox(modelObject, Learn.class, LearnDetailBox::new, boxes);

if (!isMobile() && !OSUtil.isAndroidOrIOS()) {
maybeAddBox(modelObject, Download.class, DownloadsDetailsBox::new, boxes);
Expand All @@ -101,11 +109,17 @@ protected List<DetailsBoxBase<?>> createDetailBoxes() {
maybeAddBox(modelObject, RealWorldApp.class, AppsDetailsBox::new, boxes);
maybeAddBox(modelObject, Person.class, PersonsDetailsBox::new, boxes);
maybeAddBox(modelObject, Company.class, CompaniesDetailsBox::new, boxes);
maybeAddBox(modelObject, Documentation.class, DocumentationDetailsBox::new, boxes);

return boxes;
}

private <MO extends ModelObject> void maybeAddBox(ModelObject modelObject, Class<MO> clazz, Supplier<DetailsBoxBase<MO>> boxSupplier, List<DetailsBoxBase<?>> boxList) {
if (clazz.equals(Learn.class)) {
addLearnBox(modelObject, boxList);
return;
}

List<MO> linkedObjects = DataRepository2.getInstance().getLinkedObjects(modelObject, clazz);
if (!linkedObjects.isEmpty()) {
DetailsBoxBase<MO> box = boxSupplier.get();
Expand All @@ -114,4 +128,18 @@ private <MO extends ModelObject> void maybeAddBox(ModelObject modelObject, Class
boxList.add(box);
}
}

private void addLearnBox(ModelObject modelObject, List<DetailsBoxBase<?>> boxList) {
List<LearnJavaFX> fxList = DataRepository2.getInstance().getLinkedObjects(modelObject, LearnJavaFX.class);
List<LearnMobile> mobileList = DataRepository2.getInstance().getLinkedObjects(modelObject, LearnMobile.class);
List<LearnRaspberryPi> learnRaspberryPiList = DataRepository2.getInstance().getLinkedObjects(modelObject, LearnRaspberryPi.class);
if (!fxList.isEmpty() || !mobileList.isEmpty() || !learnRaspberryPiList.isEmpty()) {
LearnDetailBox box = new LearnDetailBox();
box.getItems().setAll(fxList);
box.getItems().addAll(mobileList);
box.getItems().addAll(learnRaspberryPiList);
box.sizeProperty().bind(sizeProperty());
boxList.add(box);
}
}
}
26 changes: 25 additions & 1 deletion app/src/main/java/com/dlsc/jfxcentral2/app/pages/PageBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,21 @@
import com.dlsc.jfxcentral2.components.TopPane;
import com.dlsc.jfxcentral2.components.hamburger.HamburgerMenuView;
import com.dlsc.jfxcentral2.model.Size;
import com.dlsc.jfxcentral2.utils.OSUtil;
import javafx.beans.property.BooleanProperty;
import javafx.beans.property.ObjectProperty;
import javafx.beans.property.SimpleBooleanProperty;
import javafx.beans.property.SimpleObjectProperty;
import javafx.geometry.Pos;
import javafx.scene.Node;
import javafx.scene.control.Button;
import javafx.scene.input.SwipeEvent;
import javafx.scene.layout.Priority;
import javafx.scene.layout.Region;
import javafx.scene.layout.StackPane;
import javafx.scene.layout.VBox;
import one.jpro.platform.routing.View;
import org.kordamp.ikonli.javafx.FontIcon;
import org.kordamp.ikonli.materialdesign.MaterialDesign;

import java.util.ArrayList;
import java.util.Collections;
Expand Down Expand Up @@ -111,6 +113,14 @@ public Node wrapContent(Region... content) {
}
});

Button closeGlassPaneButton = new Button();
closeGlassPaneButton.getStyleClass().add("close-button");
closeGlassPaneButton.setGraphic(new FontIcon(MaterialDesign.MDI_CLOSE_CIRCLE_OUTLINE));
closeGlassPaneButton.setOnAction(evt -> getOnCloseGlassPane().run());
closeGlassPaneButton.visibleProperty().bind(onCloseGlassPane.isNotNull());
StackPane.setAlignment(closeGlassPaneButton, Pos.TOP_RIGHT);
glassPane.getChildren().add(closeGlassPaneButton);

if (menuMode.equals(Mode.LIGHT)) {
// make sure the JFX logo can be fully seen (without this call it gets clipped)
// the JFX logo uses scale-x / -y, hence it is bigger than its parent container
Expand Down Expand Up @@ -171,6 +181,20 @@ public void setBlocking(boolean blocking) {
this.blocking.set(blocking);
}

private final ObjectProperty<Runnable> onCloseGlassPane = new SimpleObjectProperty<>(this, "onCloseGlassPane");

public Runnable getOnCloseGlassPane() {
return onCloseGlassPane.get();
}

public ObjectProperty<Runnable> onCloseGlassPaneProperty() {
return onCloseGlassPane;
}

public void setOnCloseGlassPane(Runnable onCloseGlasspane) {
this.onCloseGlassPane.set(onCloseGlasspane);
}

private void updateStyleClassBasedOnSize(Node node) {
node.getStyleClass().removeAll("lg", "md", "sm");
switch (getSize()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ public Node content() {
VideoGalleryView videoGallery = new VideoGalleryView();
videoGallery.sizeProperty().bind(sizeProperty());
videoGallery.getVideos().setAll(randomSubList(DataRepository2.getInstance().getVideos(), 12));

videoGallery.blockingProperty().addListener(it -> setBlocking(videoGallery.isBlocking()));
videoGallery.onCloseGlassPaneProperty().addListener(it -> setOnCloseGlassPane(videoGallery.getOnCloseGlassPane()));
return wrapContent(homePageTopView, weekLinksLiteView, websiteChangesView, videoGallery);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,6 @@ protected SearchFilterView<Video> createSearchFilterView() {

@Override
protected Callback<Video, Node> getDetailNodeProvider() {
if (OSUtil.isNative()) {
return null;
}
return video -> VideoViewFactory.createVideoViewNode(video, true);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.dlsc.jfxcentral.data.model.Learn;
import com.dlsc.jfxcentral2.app.pages.DetailsPageBase;
import com.dlsc.jfxcentral2.components.DetailsContentPane;
import com.dlsc.jfxcentral2.components.LearnPaginationBox;
import com.dlsc.jfxcentral2.components.headers.LearnDetailHeader;
import com.dlsc.jfxcentral2.components.overviewbox.LearnOverviewBox;
import com.dlsc.jfxcentral2.model.Size;
Expand All @@ -29,9 +30,12 @@ public Node content() {

// details
DetailsContentPane detailsContentPane = new DetailsContentPane();
detailsContentPane.getStyleClass().add("learn-details-content-pane");
detailsContentPane.sizeProperty().bind(sizeProperty());
detailsContentPane.getCenterNodes().add(learnOverviewBox);
detailsContentPane.getDetailBoxes().setAll(createDetailBoxes());
LearnPaginationBox paginationBox = new LearnPaginationBox(learn, LearnPaginationBox.Position.LEFT, sizeProperty());
detailsContentPane.setLeftTopExtraNode(paginationBox);

return wrapContent(learnDetailHeader, detailsContentPane);
}
Expand Down
Loading

0 comments on commit 03f3068

Please sign in to comment.