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

Simplify MobileCategoryHeader instantiation #629

Merged
merged 2 commits into from
Jul 13, 2024
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import com.dlsc.jfxcentral2.components.SizeSupport;
import com.dlsc.jfxcentral2.model.Size;
import com.dlsc.jfxcentral2.utils.MobileLinkUtil;
import com.dlsc.jfxcentral2.utils.PagePath;
import javafx.beans.binding.Bindings;
import javafx.beans.property.ObjectProperty;
import javafx.beans.property.SimpleObjectProperty;
Expand Down Expand Up @@ -52,10 +51,6 @@ public MobileCategoryHeader() {
setMaxHeight(Region.USE_PREF_SIZE);
}

protected String goBackLink() {
return PagePath.HOME;
}

// size support

public final ObjectProperty<Size> sizeProperty() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,7 @@ public List<Node> content() {
Blog blog = getItem();

// header
MobileCategoryHeader header = new MobileCategoryHeader(){
@Override
protected String goBackLink() {
return PagePath.BLOGS;
}
};
header.previewImageProperty().bind(ImageManager.getInstance().blogIconImageProperty(blog));
MobileCategoryHeader header = new MobileCategoryHeader();
header.sizeProperty().bind(sizeProperty());
header.setTitle(blog.getName());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,7 @@ public List<Node> content() {
Book book = getItem();

// header
MobileCategoryHeader header = new MobileCategoryHeader(){
@Override
protected String goBackLink() {
return PagePath.BOOKS;
}
};
// header.previewImageProperty().bind(ImageManager.getInstance().bookCoverImageProperty(book));
MobileCategoryHeader header = new MobileCategoryHeader();
header.sizeProperty().bind(sizeProperty());
header.setTitle(book.getName());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,7 @@ public List<Node> content() {
Company company = getItem();

// header
MobileCategoryHeader header = new MobileCategoryHeader(){
@Override
protected String goBackLink() {
return PagePath.COMPANIES;
}
};
MobileCategoryHeader header = new MobileCategoryHeader();
header.sizeProperty().bind(sizeProperty());
header.setIcon(IkonUtil.getModelIkon(Company.class));
header.setTitle(company.getName());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
package com.dlsc.jfxcentral2.mobile.pages.details;

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.jfxcentral2.components.PrettyScrollPane;
import com.dlsc.jfxcentral2.components.overviewbox.LearnOverviewBox;
import com.dlsc.jfxcentral2.mobile.components.MobileCategoryHeader;
import com.dlsc.jfxcentral2.model.Size;
import com.dlsc.jfxcentral2.utils.PagePath;
import javafx.beans.property.ObjectProperty;
import javafx.scene.Node;
import javafx.scene.layout.Priority;
Expand All @@ -28,20 +24,7 @@ public List<Node> content() {
Learn learn = getItem();

// header
MobileCategoryHeader header = new MobileCategoryHeader() {
@Override
protected String goBackLink() {
Class<? extends Learn> modelClazz = getModelClazz();
if (modelClazz == LearnJavaFX.class) {
return PagePath.LEARN_JAVAFX;
} else if (modelClazz == LearnRaspberryPi.class) {
return PagePath.LEARN_RASPBERRYPI;
} else if (modelClazz == LearnMobile.class) {
return PagePath.LEARN_MOBILE;
}
return PagePath.HOME;
}
};
MobileCategoryHeader header = new MobileCategoryHeader();
header.sizeProperty().bind(sizeProperty());
header.setTitle(learn.getName());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,7 @@ public List<Node> content() {
Library library = getItem();

// header
MobileCategoryHeader header = new MobileCategoryHeader(){
@Override
protected String goBackLink() {
return PagePath.LIBRARIES;
}
};
header.previewImageProperty().bind(ImageManager.getInstance().libraryFeaturedImageProperty(library));
MobileCategoryHeader header = new MobileCategoryHeader();
header.sizeProperty().bind(sizeProperty());
header.setTitle(library.getName());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,7 @@ public List<Node> content() {
Person person = getItem();

// header
MobileCategoryHeader header = new MobileCategoryHeader(){
@Override
protected String goBackLink() {
return PagePath.PEOPLE;
}
};
header.previewImageProperty().bind(ImageManager.getInstance().personImageProperty(person));
MobileCategoryHeader header = new MobileCategoryHeader();
header.sizeProperty().bind(sizeProperty());
header.setTitle(person.getName());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,7 @@ public List<Node> content() {
RealWorldApp app = getItem();

// header
MobileCategoryHeader header = new MobileCategoryHeader(){
@Override
protected String goBackLink() {
return PagePath.SHOWCASES;
}
};
header.previewImageProperty().bind(ImageManager.getInstance().realWorldAppBannerImageProperty(app));
MobileCategoryHeader header = new MobileCategoryHeader();
header.sizeProperty().bind(sizeProperty());
header.setTitle(app.getName());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,7 @@ public List<Node> content() {
Tip tip = getItem();

// header
MobileCategoryHeader header = new MobileCategoryHeader(){
@Override
protected String goBackLink() {
return PagePath.TIPS;
}
};
header.previewImageProperty().bind(ImageManager.getInstance().tipBannerImageProperty(tip));
MobileCategoryHeader header = new MobileCategoryHeader();
header.sizeProperty().bind(sizeProperty());
header.setTitle(tip.getName());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,7 @@ public List<Node> content() {
Tool tool = getItem();

// header
MobileCategoryHeader header = new MobileCategoryHeader(){
@Override
protected String goBackLink() {
return PagePath.TOOLS;
}
};
header.previewImageProperty().bind(ImageManager.getInstance().toolImageProperty(tool));
MobileCategoryHeader header = new MobileCategoryHeader();
header.sizeProperty().bind(sizeProperty());
header.setTitle(tool.getName());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,7 @@ public List<Node> content() {
Tutorial tutorial = getItem();

// header
MobileCategoryHeader header = new MobileCategoryHeader(){
@Override
protected String goBackLink() {
return PagePath.TUTORIALS;
}
};
header.previewImageProperty().bind(ImageManager.getInstance().tutorialImageLargeProperty(tutorial));
MobileCategoryHeader header = new MobileCategoryHeader();
header.sizeProperty().bind(sizeProperty());
header.setTitle(tutorial.getName());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import com.dlsc.jfxcentral2.components.overviewbox.VideoOverviewBox;
import com.dlsc.jfxcentral2.mobile.components.MobileCategoryHeader;
import com.dlsc.jfxcentral2.model.Size;
import com.dlsc.jfxcentral2.utils.PagePath;
import javafx.beans.property.ObjectProperty;
import javafx.scene.Node;
import javafx.scene.layout.Priority;
Expand All @@ -26,13 +25,7 @@ public List<Node> content() {
Video video = getItem();

// header
MobileCategoryHeader header = new MobileCategoryHeader(){
@Override
protected String goBackLink() {
return PagePath.VIDEOS;
}
};
header.previewImageProperty().bind(ImageManager.getInstance().youTubeImageProperty(video));
MobileCategoryHeader header = new MobileCategoryHeader();
header.sizeProperty().bind(sizeProperty());
header.setTitle(video.getName());

Expand Down
Loading