Skip to content

Commit

Permalink
Merge pull request #586 from dlsc-software-consulting-gmbh/develop
Browse files Browse the repository at this point in the history
Misc
  • Loading branch information
dlemmermann authored Dec 18, 2023
2 parents 4eb911b + a71bf37 commit 3bf8462
Show file tree
Hide file tree
Showing 23 changed files with 181 additions and 62 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public Node content() {
header.sizeProperty().bind(sizeProperty());
header.setTitle(getCategoryTitle());
header.setIkon(getCategoryIkon());
header.setDescription(getCategoryDescription());

// filter
SearchFilterView<T> filterView = createSearchFilterView();
Expand Down Expand Up @@ -69,6 +70,10 @@ public Node content() {
return wrapContent(header, contentPane);
}

protected String getCategoryDescription(){
return null;
}

protected int getNumberOfGridViewColumns() {
return 3;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ protected Ikon getCategoryIkon() {
return IkonUtil.getModelIkon(Blog.class);
}

@Override
protected String getCategoryDescription() {
return "Visit our blog section for articles from JavaFX experts, featuring practical tips, cutting-edge insights, and more from the world of JavaFX.";
}

@Override
protected Callback<Blog, TileViewBase<Blog>> getTileViewProvider() {
return BlogTileView::new;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,14 @@ protected Ikon getCategoryIkon() {
return IkonUtil.getModelIkon(Book.class);
}

@Override
protected String getCategoryDescription() {
return """
Explore our JavaFX book selection, offering everything from beginner guides to advanced tutorials, \
including game development and specific use-cases like JavaFX for Raspberry Pi.
""";
}

@Override
protected Callback<Book, TileViewBase<Book>> getTileViewProvider() {
return BookTileView::new;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ protected Ikon getCategoryIkon() {
return IkonUtil.getModelIkon(Company.class);
}

@Override
protected String getCategoryDescription() {
return "Explore companies in JavaFX, especially those with significant influence and contributions to the JavaFX community, shaping and advancing the ecosystem.";
}

@Override
protected Callback<Company, TileViewBase<Company>> getTileViewProvider() {
return CompanyTileView::new;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ protected Ikon getCategoryIkon() {
return IkonUtil.getModelIkon(Documentation.class);
}

@Override
protected String getCategoryDescription() {
return "Access comprehensive resources including JavaFX API documentation, plugin guides, CSS references, and default style sheets.";
}

@Override
protected int getNumberOfGridViewRows() {
return 5;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ protected Ikon getCategoryIkon() {
return IkonUtil.getModelIkon(Download.class);
}

@Override
protected String getCategoryDescription() {
return "Find downloadable resources for JavaFX development, including game demo apps, development tools, and more.";
}

@Override
protected Callback<Download, TileViewBase<Download>> getTileViewProvider() {
return download -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import com.dlsc.jfxcentral2.components.PacksIconsView;
import com.dlsc.jfxcentral2.components.StripView;
import com.dlsc.jfxcentral2.components.filters.SearchFilterView;
import com.dlsc.jfxcentral2.components.headers.PacksIconsHeader;
import com.dlsc.jfxcentral2.components.headers.CategoryHeader;
import com.dlsc.jfxcentral2.components.tiles.TileViewBase;
import com.dlsc.jfxcentral2.model.Size;
import com.dlsc.jfxcentral2.utils.IkonUtil;
Expand Down Expand Up @@ -60,7 +60,10 @@ protected SearchFilterView<IkonliPack> createSearchFilterView() {
@Override
public Node content() {
// header
PacksIconsHeader header = new PacksIconsHeader();
CategoryHeader header = new CategoryHeader();
header.setTitle("Icons");
header.setIkon(IkonUtil.icons);
header.setDescription("Explore thousands of icons from the Ikonli project, searchable by icon name or library.");
header.sizeProperty().bind(sizeProperty());

PacksIconsView packsIconsView = new PacksIconsView();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ protected String getCategoryTitle() {
return "Learn JavaFX";
}

@Override
protected String getCategoryDescription() {
return "Explore JavaFX tutorials, ranging from basic usage to practical techniques, continuously updated to enrich your learning journey.";
}

@Override
protected ObservableList<Learn> getCategoryItems() {
return FXCollections.observableArrayList(DataRepository2.getInstance().getLearnJavaFX());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ protected String getCategoryTitle() {
return "Learn Mobile";
}

@Override
protected String getCategoryDescription() {
return "Discover tutorials and guides on developing with JavaFX in the mobile domain, offering insights and techniques for mobile application development.";
}

@Override
protected ObservableList<Learn> getCategoryItems() {
return FXCollections.observableArrayList(DataRepository2.getInstance().getLearnMobile());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ protected String getCategoryTitle() {
return "Learn Raspberry Pi";
}

@Override
protected String getCategoryDescription() {
return "Explore tutorials focused on using JavaFX in Raspberry Pi development, providing guidance for creating JavaFX applications on this versatile platform.";
}

@Override
protected ObservableList<Learn> getCategoryItems() {
return FXCollections.observableArrayList(DataRepository2.getInstance().getLearnRaspberryPi());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,15 @@ protected Ikon getCategoryIkon() {
return IkonUtil.getModelIkon(Library.class);
}

@Override
protected String getCategoryDescription() {
return """
Explore our curated selection of JavaFX third-party libraries. This page presents \
a diverse range of tools including components, game engines, styles, 3D graphics, \
and frameworks, ideal for expanding the capabilities of your JavaFX projects.
""";
}

@Override
protected int getNumberOfGridViewRows() {
return 5;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ public String description() {
return "A curated list of people connected to JavaFX. They develop libraries, applications, tools or they present at conferences and evangelise JavaFX.";
}

@Override
protected String getCategoryDescription() {
return "Meet influential JavaFX experts, columnists, and notable figures who have significantly contributed to the field, including Java champions.";
}

@Override
protected CategoryHeader createCategoryHeader() {
CategoryHeader header = super.createCategoryHeader();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ protected Ikon getCategoryIkon() {
return IkonUtil.getModelIkon(RealWorldApp.class);
}

@Override
protected String getCategoryDescription() {
return "Explore real-world JavaFX applications, notable for their professional functionality and aesthetically pleasing UI, demonstrating the practical versatility of JavaFX.";
}

@Override
protected Callback<RealWorldApp, TileViewBase<RealWorldApp>> getTileViewProvider() {
return AppTileView::new;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ protected Ikon getCategoryIkon() {
return IkonUtil.getModelIkon(Tip.class);
}

@Override
protected String getCategoryDescription() {
return "Discover practical JavaFX tips in this section, featuring articles that share real-world techniques and tricks for effective JavaFX development.";
}

@Override
protected Callback<Tip, TileViewBase<Tip>> getTileViewProvider() {
return TipsAndTricksTileView::new;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ protected Ikon getCategoryIkon() {
return IkonUtil.getModelIkon(Tool.class);
}

@Override
protected String getCategoryDescription() {
return "Delve into our selection of JavaFX tools, including plugins, layout and CSS tools, testing, packaging, and more.";
}

@Override
protected int getNumberOfGridViewRows() {
return 5;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ public String description() {
return "A curated list of online tutorials covering JavaFX topics.";
}

@Override
protected String getCategoryDescription() {
return "Browse tutorials ranging from JavaFX basics to advanced application and game development.";
}

@Override
protected String getCategoryTitle() {
return "Tutorials";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,14 @@ protected Ikon getCategoryIkon() {
return IkonUtil.getModelIkon(Utility.class);
}

@Override
protected String getCategoryDescription() {
return """
Access a suite of ready-to-use JavaFX development tools directly on this page. Explore \
functionalities like SVG processing, gradient adjustment, effect generation, and style customization and more.
""";
}

@Override
protected int getNumberOfGridViewRows() {
return 5;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import com.dlsc.jfxcentral2.components.tiles.VideoTileView;
import com.dlsc.jfxcentral2.model.Size;
import com.dlsc.jfxcentral2.utils.IkonUtil;
import com.dlsc.jfxcentral2.utils.OSUtil;
import com.dlsc.jfxcentral2.utils.VideoViewFactory;
import javafx.beans.property.ObjectProperty;
import javafx.collections.FXCollections;
Expand Down Expand Up @@ -44,6 +43,11 @@ protected Ikon getCategoryIkon() {
return IkonUtil.getModelIkon(Video.class);
}

@Override
protected String getCategoryDescription() {
return "Browse JavaFX videos featuring conference talks, application demos, and tutorials, offering insights for all levels of JavaFX expertise.";
}

@Override
protected SearchFilterView<Video> createSearchFilterView() {
return new VideosFilterView();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import javafx.scene.layout.BackgroundRepeat;
import javafx.scene.layout.BackgroundSize;
import javafx.scene.layout.Region;
import javafx.scene.layout.VBox;
import org.kordamp.ikonli.Ikon;
import org.kordamp.ikonli.javafx.FontIcon;

Expand All @@ -43,26 +44,38 @@ public CategoryHeader() {
FontIcon fontIcon = new FontIcon();
fontIcon.iconCodeProperty().bind(ikonProperty());

Label label = new Label();
label.textProperty().bind(titleProperty());
label.setGraphic(fontIcon);
label.getStyleClass().add("header-title");
label.managedProperty().bind(label.visibleProperty());
label.visibleProperty().bind(titleProperty().isNotEmpty().or(ikonProperty().isNotNull()));
Label titleLabel = new Label();
titleLabel.textProperty().bind(titleProperty());
titleLabel.setGraphic(fontIcon);
titleLabel.getStyleClass().add("header-title");
titleLabel.managedProperty().bind(titleLabel.visibleProperty());
titleLabel.visibleProperty().bind(titleProperty().isNotEmpty().or(ikonProperty().isNotNull()));

Label descriptionLabel = new Label();
descriptionLabel.getStyleClass().add("header-description");
descriptionLabel.setWrapText(true);
descriptionLabel.textProperty().bind(descriptionProperty());
descriptionLabel.managedProperty().bind(descriptionLabel.visibleProperty());
descriptionLabel.visibleProperty().bind(descriptionProperty().isNotEmpty());

VBox defaultContent = new VBox(titleLabel, descriptionLabel);
defaultContent.getStyleClass().add("default-content");
defaultContent.managedProperty().bind(defaultContent.visibleProperty());
defaultContent.visibleProperty().bind(titleLabel.visibleProperty().or(descriptionLabel.visibleProperty()));

Region overlay = new Region();
overlay.getStyleClass().add("overlay");

getChildren().setAll(overlay, label);
getChildren().setAll(overlay, defaultContent);

activateModePseudoClass();
modeProperty().addListener(it -> activateModePseudoClass());
/*
* Only one label and content can be displayed. If the content is not empty, the content will be displayed,
* otherwise the label will be displayed
* Only one defaultContent and content can be displayed. If the content is not empty, the content will be displayed,
* otherwise the defaultContent will be displayed
*/
contentProperty().addListener((ob, ov, nv) -> getChildren().setAll(overlay, Objects.requireNonNullElse(getContent(), label)));
sizeProperty().addListener((ob, ov, nv) -> getChildren().setAll(overlay, Objects.requireNonNullElse(getContent(), label)));
contentProperty().addListener((ob, ov, nv) -> getChildren().setAll(overlay, Objects.requireNonNullElse(getContent(), defaultContent)));
sizeProperty().addListener((ob, ov, nv) -> getChildren().setAll(overlay, Objects.requireNonNullElse(getContent(), defaultContent)));


if (!WebAPI.isBrowser()) {
Expand Down Expand Up @@ -187,4 +200,18 @@ public ObjectProperty<Mode> modeProperty() {
public void setMode(Mode mode) {
this.mode.set(mode);
}

private final StringProperty description = new SimpleStringProperty(this, "description");

public String getDescription() {
return description.get();
}

public StringProperty descriptionProperty() {
return description;
}

public void setDescription(String description) {
this.description.set(description);
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ public static Node createVideoViewNode(Video video, boolean closeable) {
});
WebEngine webEngine = webView.getEngine();
webEngine.load("https://www.youtube.com/embed/" + video.getId());
removeSpinner(webEngine);
webView.sceneProperty().addListener(it -> {
if (webView.getScene() == null) {
webEngine.loadContent("empty");
Expand Down Expand Up @@ -117,23 +116,4 @@ private static void bindWidthAndHeight(WebView htmlView, Region region) {
htmlView.maxWidthProperty().bind(widthBinding);
htmlView.maxHeightProperty().bind(widthBinding.divide(16).multiply(9));
}

/**
* Removes the spinner from the WebView.
* This workaround, suggested by @José Pereda, addresses a bug in JavaFX WebView version 21.0.1(WebKit 616.1) and later
*/
private static void removeSpinner(WebEngine webEngine) {
webEngine.getLoadWorker().stateProperty().addListener((obs, oldState, newState) -> {
if (newState == Worker.State.SUCCEEDED) {
webEngine.executeScript("""
const spinner = document.querySelector('.ytp-spinner');
if (spinner) {
spinner.remove();
}
"""
);
}
});
}

}
Loading

0 comments on commit 3bf8462

Please sign in to comment.