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

Change DataRepository2 references to DataRepository #678

Closed
wants to merge 1 commit into from
Closed
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
@@ -1,7 +1,7 @@
package com.dlsc.jfxcentral2.app;

import com.dlsc.gemsfx.util.StageManager;
import com.dlsc.jfxcentral.data.DataRepository2;
import com.dlsc.jfxcentral.data.DataRepository;
import com.dlsc.jfxcentral.data.model.Blog;
import com.dlsc.jfxcentral.data.model.Book;
import com.dlsc.jfxcentral.data.model.Company;
Expand Down Expand Up @@ -328,7 +328,7 @@ private Response createResponse(Request request, Class<? extends ModelObject> cl
int index = request.getPath().lastIndexOf("/");
if (index > 0) {
String id = request.getPath().substring(index + 1).trim();
if (!DataRepository2.getInstance().isValidId(clazz, id)) {
if (!DataRepository.getInstance().isValidId(clazz, id)) {
return Response.view(new ErrorPage(size, request));
}

Expand Down Expand Up @@ -360,7 +360,7 @@ private Route createIconPackOrDetailRoute(String path) {
String ikonliPackId = parts[1];
String iconDescription = parts[2];

return DataRepository2.getInstance().getIkonliPackById(ikonliPackId)
return DataRepository.getInstance().getIkonliPackById(ikonliPackId)
.flatMap(ikonliPack -> IkonliPackUtil.getInstance().getIkon(ikonliPack, iconDescription)
.map(ikon -> {
IconInfo iconInfo = new IconInfoBuilder(ikon, ikonliPack.getName(), ikonliPackId).build();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.dlsc.jfxcentral2.app;

import com.dlsc.jfxcentral.data.DataRepository2;
import com.dlsc.jfxcentral.data.DataRepository;
import com.dlsc.jfxcentral.data.model.Blog;
import com.dlsc.jfxcentral.data.model.Book;
import com.dlsc.jfxcentral.data.model.Company;
Expand Down Expand Up @@ -220,7 +220,7 @@ private MobileRoute createCategoryOrDetailRoute(String path, Class<? extends Mod
int index = url.lastIndexOf("/");
if (index > 0 && clazz != null) {
String id = url.substring(index + 1).trim();
if (!DataRepository2.getInstance().isValidId(clazz, id)) {
if (!DataRepository.getInstance().isValidId(clazz, id)) {
return MobileResponse.view(url, new Label("Error: 404"));
}
return MobileResponse.view(url, detailedResponse.call(id));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.dlsc.jfxcentral2.app;

import com.dlsc.jfxcentral.data.DataRepository2;
import com.dlsc.jfxcentral.data.DataRepository;
import com.dlsc.jfxcentral2.utils.LOGGER;
import com.dlsc.jfxcentral2.utils.OSUtil;
import javafx.application.Platform;
Expand Down Expand Up @@ -62,7 +62,7 @@ public static void updateRepository(ProgressMonitor monitor) {
}

private static File getRepositoryDirectory() {
return DataRepository2.getRepositoryDirectory();
return DataRepository.getInstance().getRepositoryDirectory();
}

public static boolean isFirstTimeSetup() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.dlsc.jfxcentral2.app;

import com.dlsc.jfxcentral.data.DataRepository2;
import com.dlsc.jfxcentral.data.DataRepository;
import com.dlsc.jfxcentral.data.model.Documentation;
import com.dlsc.jfxcentral.data.model.ModelObject;
import com.dlsc.jfxcentral2.utils.LOGGER;
Expand Down Expand Up @@ -76,7 +76,7 @@ public void refresh() {
Menu utilities = new Menu("Utilities");
Menu documentation = new Menu("Documentation");

DataRepository2 repository = DataRepository2.getInstance();
DataRepository repository = DataRepository.getInstance();

repository.getTools().stream().sorted(Comparator.comparing(ModelObject::getName)).forEach(mo -> createMenuItem(tools, mo));
repository.getPeople().stream().sorted(Comparator.comparing(ModelObject::getName)).forEach(mo -> createMenuItem(people, mo));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.dlsc.jfxcentral2.app.pages;

import com.dlsc.jfxcentral.data.DataRepository2;
import com.dlsc.jfxcentral.data.DataRepository;
import com.dlsc.jfxcentral.data.model.Blog;
import com.dlsc.jfxcentral.data.model.Book;
import com.dlsc.jfxcentral.data.model.Company;
Expand Down Expand Up @@ -51,7 +51,7 @@ public abstract class DetailsPageBase<T extends ModelObject> extends PageBase {

public DetailsPageBase(ObjectProperty<Size> size, Class<? extends T> clazz, String itemId) {
super(size, Mode.DARK);
setItem(DataRepository2.getInstance().getByID(clazz, itemId));
setItem(DataRepository.getInstance().getByID(clazz, itemId));
}

public T getItem() {
Expand Down Expand Up @@ -120,7 +120,7 @@ private <MO extends ModelObject> void maybeAddBox(ModelObject modelObject, Class
return;
}

List<MO> linkedObjects = DataRepository2.getInstance().getLinkedObjects(modelObject, clazz);
List<MO> linkedObjects = DataRepository.getInstance().getLinkedObjects(modelObject, clazz);
if (!linkedObjects.isEmpty()) {
DetailsBoxBase<MO> box = boxSupplier.get();
box.getItems().setAll(linkedObjects);
Expand All @@ -130,9 +130,9 @@ private <MO extends ModelObject> void maybeAddBox(ModelObject modelObject, Class
}

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);
List<LearnJavaFX> fxList = DataRepository.getInstance().getLinkedObjects(modelObject, LearnJavaFX.class);
List<LearnMobile> mobileList = DataRepository.getInstance().getLinkedObjects(modelObject, LearnMobile.class);
List<LearnRaspberryPi> learnRaspberryPiList = DataRepository.getInstance().getLinkedObjects(modelObject, LearnRaspberryPi.class);
if (!fxList.isEmpty() || !mobileList.isEmpty() || !learnRaspberryPiList.isEmpty()) {
LearnDetailBox box = new LearnDetailBox();
box.getItems().setAll(fxList);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.dlsc.jfxcentral2.app.pages;

import com.dlsc.jfxcentral.data.DataRepository2;
import com.dlsc.jfxcentral.data.DataRepository;
import com.dlsc.jfxcentral.data.model.LinksOfTheWeek;
import com.dlsc.jfxcentral2.components.DetailsContentPane;
import com.dlsc.jfxcentral2.components.LinksOfTheWeekView;
Expand Down Expand Up @@ -67,7 +67,7 @@ public Node content() {

// links of the week view
LinksOfTheWeekView linksOfTheWeekView = new LinksOfTheWeekView();
linksOfTheWeekView.getLinksOfTheWeeks().setAll(DataRepository2.getInstance().getLinksOfTheWeek());
linksOfTheWeekView.getLinksOfTheWeeks().setAll(DataRepository.getInstance().getLinksOfTheWeek());
linksOfTheWeekView.sizeProperty().bind(sizeProperty());

// this is a category page, but we still need to use the details content pane for layout purposes
Expand Down Expand Up @@ -130,7 +130,7 @@ private HBox createPaginationBox(LinksOfTheWeekView linksOfTheWeekView) {

@Override
protected ObservableList<LinksOfTheWeek> getCategoryItems() {
return FXCollections.observableArrayList(DataRepository2.getInstance().getLinksOfTheWeek());
return FXCollections.observableArrayList(DataRepository.getInstance().getLinksOfTheWeek());
}

@Override
Expand All @@ -144,7 +144,7 @@ protected SearchFilterView<LinksOfTheWeek> createSearchFilterView() {
}

protected List<MenuView.Item> createMenuItems(LinksOfTheWeekView linksOfTheWeekView) {
List<LinksOfTheWeek> linksOfTheWeek = DataRepository2.getInstance().getLinksOfTheWeek();
List<LinksOfTheWeek> linksOfTheWeek = DataRepository.getInstance().getLinksOfTheWeek();
List<LinksOfTheWeek> weeks = new ArrayList<>(linksOfTheWeek);

return weeks
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.dlsc.jfxcentral2.app.pages;

import com.dlsc.jfxcentral.data.DataRepository2;
import com.dlsc.jfxcentral.data.DataRepository;
import com.dlsc.jfxcentral.data.model.LinksOfTheWeek;
import com.dlsc.jfxcentral2.components.HomePageTopView;
import com.dlsc.jfxcentral2.components.Mode;
Expand Down Expand Up @@ -38,7 +38,7 @@ public Node content() {
homePageTopView.sizeProperty().bind(sizeProperty());

// links of the Week
List<LinksOfTheWeek> linksOfTheWeek = DataRepository2.getInstance().getLinksOfTheWeek();
List<LinksOfTheWeek> linksOfTheWeek = DataRepository.getInstance().getLinksOfTheWeek();

WeekLinksLiteView weekLinksLiteView = new WeekLinksLiteView();
weekLinksLiteView.sizeProperty().bind(sizeProperty());
Expand All @@ -56,7 +56,7 @@ public Node content() {
// video gallery
VideoGalleryView videoGallery = new VideoGalleryView();
videoGallery.sizeProperty().bind(sizeProperty());
videoGallery.getVideos().setAll(randomSubList(DataRepository2.getInstance().getVideos(), 12));
videoGallery.getVideos().setAll(randomSubList(DataRepository.getInstance().getVideos(), 12));
videoGallery.blockingProperty().addListener(it -> setBlocking(videoGallery.isBlocking()));
videoGallery.onCloseGlassPaneProperty().addListener(it -> setOnCloseGlassPane(videoGallery.getOnCloseGlassPane()));
return wrapContent(homePageTopView, weekLinksLiteView, websiteChangesView, videoGallery);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.dlsc.jfxcentral2.app.pages;

import com.dlsc.jfxcentral.data.DataRepository2;
import com.dlsc.jfxcentral.data.DataRepository;
import com.dlsc.jfxcentral2.components.FeaturesContainer;
import com.dlsc.jfxcentral2.components.Mode;
import com.dlsc.jfxcentral2.components.StripView;
Expand Down Expand Up @@ -39,7 +39,7 @@ public Node content() {
// team view
TeamView teamView = new TeamView();
teamView.sizeProperty().bind(sizeProperty());
teamView.getMembers().setAll(DataRepository2.getInstance().getMembers());
teamView.getMembers().setAll(DataRepository.getInstance().getMembers());

// features
FeaturesContainer featuresContainer = new FeaturesContainer();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.dlsc.jfxcentral2.app.pages.category;

import com.dlsc.jfxcentral.data.DataRepository2;
import com.dlsc.jfxcentral.data.DataRepository;
import com.dlsc.jfxcentral.data.model.Blog;
import com.dlsc.jfxcentral2.app.pages.CategoryPageBase;
import com.dlsc.jfxcentral2.components.filters.BlogsFilterView;
Expand Down Expand Up @@ -63,6 +63,6 @@ protected SearchFilterView<Blog> createSearchFilterView() {

@Override
protected ObservableList<Blog> getCategoryItems() {
return FXCollections.observableArrayList(DataRepository2.getInstance().getBlogs());
return FXCollections.observableArrayList(DataRepository.getInstance().getBlogs());
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.dlsc.jfxcentral2.app.pages.category;

import com.dlsc.jfxcentral.data.DataRepository2;
import com.dlsc.jfxcentral.data.DataRepository;
import com.dlsc.jfxcentral.data.model.Book;
import com.dlsc.jfxcentral2.app.pages.CategoryPageBase;
import com.dlsc.jfxcentral2.components.filters.BooksFilterView;
Expand Down Expand Up @@ -61,6 +61,6 @@ protected SearchFilterView<Book> createSearchFilterView() {

@Override
protected ObservableList<Book> getCategoryItems() {
return FXCollections.observableArrayList(DataRepository2.getInstance().getBooks());
return FXCollections.observableArrayList(DataRepository.getInstance().getBooks());
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.dlsc.jfxcentral2.app.pages.category;

import com.dlsc.jfxcentral.data.DataRepository2;
import com.dlsc.jfxcentral.data.DataRepository;
import com.dlsc.jfxcentral.data.model.Company;
import com.dlsc.jfxcentral2.app.pages.CategoryPageBase;
import com.dlsc.jfxcentral2.components.filters.CompaniesFilterView;
Expand Down Expand Up @@ -58,6 +58,6 @@ protected SearchFilterView<Company> createSearchFilterView() {

@Override
protected ObservableList<Company> getCategoryItems() {
return FXCollections.observableArrayList(DataRepository2.getInstance().getCompanies());
return FXCollections.observableArrayList(DataRepository.getInstance().getCompanies());
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.dlsc.jfxcentral2.app.pages.category;

import com.dlsc.jfxcentral.data.DataRepository2;
import com.dlsc.jfxcentral.data.DataRepository;
import com.dlsc.jfxcentral.data.model.Documentation;
import com.dlsc.jfxcentral2.app.pages.CategoryPageBase;
import com.dlsc.jfxcentral2.components.filters.DocumentationFilterView;
Expand Down Expand Up @@ -63,6 +63,6 @@ protected SearchFilterView<Documentation> createSearchFilterView() {

@Override
protected ObservableList<Documentation> getCategoryItems() {
return FXCollections.observableArrayList(DataRepository2.getInstance().getDocumentation());
return FXCollections.observableArrayList(DataRepository.getInstance().getDocumentation());
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.dlsc.jfxcentral2.app.pages.category;

import com.dlsc.jfxcentral.data.DataRepository2;
import com.dlsc.jfxcentral.data.DataRepository;
import com.dlsc.jfxcentral.data.model.Download;
import com.dlsc.jfxcentral2.app.pages.CategoryPageBase;
import com.dlsc.jfxcentral2.components.DownloadsBox;
Expand Down Expand Up @@ -63,7 +63,7 @@ protected SearchFilterView<Download> createSearchFilterView() {

@Override
protected ObservableList<Download> getCategoryItems() {
return FXCollections.observableArrayList(DataRepository2.getInstance().getDownloads());
return FXCollections.observableArrayList(DataRepository.getInstance().getDownloads());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.dlsc.jfxcentral2.app.pages.category;

import com.dlsc.jfxcentral.data.DataRepository2;
import com.dlsc.jfxcentral.data.DataRepository;
import com.dlsc.jfxcentral.data.model.Learn;
import com.dlsc.jfxcentral2.model.Size;
import javafx.beans.property.ObjectProperty;
Expand Down Expand Up @@ -35,7 +35,7 @@ protected String getCategoryDescription() {

@Override
protected ObservableList<Learn> getCategoryItems() {
return FXCollections.observableArrayList(DataRepository2.getInstance().getLearnJavaFX());
return FXCollections.observableArrayList(DataRepository.getInstance().getLearnJavaFX());
}

}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.dlsc.jfxcentral2.app.pages.category;

import com.dlsc.jfxcentral.data.DataRepository2;
import com.dlsc.jfxcentral.data.DataRepository;
import com.dlsc.jfxcentral.data.model.Learn;
import com.dlsc.jfxcentral2.model.Size;
import javafx.beans.property.ObjectProperty;
Expand Down Expand Up @@ -36,6 +36,6 @@ protected String getCategoryDescription() {

@Override
protected ObservableList<Learn> getCategoryItems() {
return FXCollections.observableArrayList(DataRepository2.getInstance().getLearnMobile());
return FXCollections.observableArrayList(DataRepository.getInstance().getLearnMobile());
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.dlsc.jfxcentral2.app.pages.category;

import com.dlsc.jfxcentral.data.DataRepository2;
import com.dlsc.jfxcentral.data.DataRepository;
import com.dlsc.jfxcentral.data.model.Learn;
import com.dlsc.jfxcentral2.model.Size;
import javafx.beans.property.ObjectProperty;
Expand Down Expand Up @@ -36,6 +36,6 @@ protected String getCategoryDescription() {

@Override
protected ObservableList<Learn> getCategoryItems() {
return FXCollections.observableArrayList(DataRepository2.getInstance().getLearnRaspberryPi());
return FXCollections.observableArrayList(DataRepository.getInstance().getLearnRaspberryPi());
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.dlsc.jfxcentral2.app.pages.category;

import com.dlsc.jfxcentral.data.DataRepository2;
import com.dlsc.jfxcentral.data.DataRepository;
import com.dlsc.jfxcentral.data.model.Library;
import com.dlsc.jfxcentral2.app.pages.CategoryPageBase;
import com.dlsc.jfxcentral2.components.filters.LibrariesFilterView;
Expand Down Expand Up @@ -67,6 +67,6 @@ protected SearchFilterView<Library> createSearchFilterView() {

@Override
protected ObservableList<Library> getCategoryItems() {
return FXCollections.observableArrayList(DataRepository2.getInstance().getLibraries());
return FXCollections.observableArrayList(DataRepository.getInstance().getLibraries());
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.dlsc.jfxcentral2.app.pages.category;

import com.dlsc.jfxcentral.data.DataRepository2;
import com.dlsc.jfxcentral.data.DataRepository;
import com.dlsc.jfxcentral.data.model.Person;
import com.dlsc.jfxcentral2.app.pages.CategoryPageBase;
import com.dlsc.jfxcentral2.components.filters.PeopleFilterView;
Expand Down Expand Up @@ -77,6 +77,6 @@ protected SearchFilterView<Person> createSearchFilterView() {

@Override
protected ObservableList<Person> getCategoryItems() {
return FXCollections.observableArrayList(DataRepository2.getInstance().getPeople());
return FXCollections.observableArrayList(DataRepository.getInstance().getPeople());
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.dlsc.jfxcentral2.app.pages.category;

import com.dlsc.jfxcentral.data.DataRepository2;
import com.dlsc.jfxcentral.data.DataRepository;
import com.dlsc.jfxcentral.data.model.RealWorldApp;
import com.dlsc.jfxcentral2.app.pages.CategoryPageBase;
import com.dlsc.jfxcentral2.components.filters.SearchFilterView;
Expand Down Expand Up @@ -58,6 +58,6 @@ protected SearchFilterView<RealWorldApp> createSearchFilterView() {

@Override
protected ObservableList<RealWorldApp> getCategoryItems() {
return FXCollections.observableArrayList(DataRepository2.getInstance().getRealWorldApps());
return FXCollections.observableArrayList(DataRepository.getInstance().getRealWorldApps());
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.dlsc.jfxcentral2.app.pages.category;

import com.dlsc.jfxcentral.data.DataRepository2;
import com.dlsc.jfxcentral.data.DataRepository;
import com.dlsc.jfxcentral.data.model.Tip;
import com.dlsc.jfxcentral2.app.pages.CategoryPageBase;
import com.dlsc.jfxcentral2.components.filters.SearchFilterView;
Expand Down Expand Up @@ -58,6 +58,6 @@ protected SearchFilterView<Tip> createSearchFilterView() {

@Override
protected ObservableList<Tip> getCategoryItems() {
return FXCollections.observableArrayList(DataRepository2.getInstance().getTips());
return FXCollections.observableArrayList(DataRepository.getInstance().getTips());
}
}
Loading
Loading