Skip to content

Commit

Permalink
Merge pull request #273 from dlsc-software-consulting-gmbh/staging
Browse files Browse the repository at this point in the history
Staging
  • Loading branch information
dlemmermann authored Aug 24, 2023
2 parents c281b06 + 491b02a commit 1391832
Show file tree
Hide file tree
Showing 17 changed files with 205 additions and 17 deletions.
Binary file added documentation/apiref/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added documentation/caspiancssref/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added documentation/cssref/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
74 changes: 74 additions & 0 deletions documentation/documentation.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
[
{
"id": "openjfxstartedref",
"name": "Getting Started with JavaFX",
"description": "A quick-start guide detailing JavaFX setup across different IDEs and build tools such as Maven and Gradle. Ideal for newcomers or those seeking smooth integration.",
"url": "https://openjfx.io/openjfx-docs//",
"tags": "Getting Started",
"createdOn": "2023-08-23",
"modifiedOn": "2023-08-23"
},
{
"id": "fxdocsref",
"name": "JavaFX Documentation Project",
"description": "Consolidates key information for developers. It's open source and encourages community contributions for enhanced quality and usefulness.",
"url": "https://fxdocs.github.io/docs/html5/",
"tags": "Getting Started",
"createdOn": "2023-08-23",
"modifiedOn": "2023-08-23"
},
{
"id": "apiref",
"name": "JavaFX API Documentation",
"description": "A comprehensive reference guide covering all classes, methods, and interfaces of JavaFX. Essential for developers seeking in-depth knowledge of its functionalities.",
"url": "https://openjfx.io/javadoc/20/",
"tags": "Documentation",
"createdOn": "2023-08-23",
"modifiedOn": "2023-08-23"
},
{
"id": "fxmlref",
"name": "JavaFX FXML Reference",
"description": "An introductory guide to FXML, the XML-based markup language designed for building JavaFX user interfaces. ",
"url": "https://openjfx.io/javadoc/20/javafx.fxml/javafx/fxml/doc-files/introduction_to_fxml.html",
"tags": "FXML",
"createdOn": "2023-08-23",
"modifiedOn": "2023-08-23"
},
{
"id": "cssref",
"name": "JavaFX CSS Reference",
"description": "An in-depth guide to JavaFX CSS styling, detailing properties, pseudo-classes, control skins, and their structural breakdown.",
"url": "https://openjfx.io/javadoc/20/javafx.graphics/javafx/scene/doc-files/cssref.html",
"tags": "CSS",
"createdOn": "2023-08-23",
"modifiedOn": "2023-08-23"
},
{
"id": "modenacssref",
"name": "JavaFX Default CSS (Modena)",
"description": "Modena is the default theme for JavaFX 8+. This guide provides the built-in CSS styles, helping developers customize and enhance the UI.",
"url": "https://github.com/openjdk/jfx/blob/master/modules/javafx.controls/src/main/resources/com/sun/javafx/scene/control/skin/modena/modena.css",
"tags": "CSS",
"createdOn": "2023-08-23",
"modifiedOn": "2023-08-23"
},
{
"id": "caspiancssref",
"name": "JavaFX CSS (Caspian)",
"description": "Caspian is the default theme for JavaFX 2.x. This guide offers the built-in CSS styles, helping developers customize and enhance the UI.",
"url": "https://github.com/openjdk/jfx/blob/master/modules/javafx.controls/src/main/resources/com/sun/javafx/scene/control/skin/caspian/caspian.css",
"tags": "CSS",
"createdOn": "2023-08-23",
"modifiedOn": "2023-08-23"
},
{
"id": "oraclestartedref",
"name": "Getting Started with JavaFX8",
"description": "An essential guide to JavaFX 8 fundamentals, offering insights into core concepts and practices. Valuable for developers aiming to grasp the foundational aspects of JavaFX.",
"url": "https://docs.oracle.com/javase/8/javafx/get-started-tutorial/index.html",
"tags": "Getting Started",
"createdOn": "2023-08-23",
"modifiedOn": "2023-08-23"
}
]
Binary file added documentation/fxdocsref/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added documentation/fxmlref/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added documentation/modenacssref/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added documentation/openjfxstartedref/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added documentation/oraclestartedref/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 26 additions & 2 deletions src/main/java/com/dlsc/jfxcentral/data/DataRepository.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.dlsc.jfxcentral.data.model.Book;
import com.dlsc.jfxcentral.data.model.Company;
import com.dlsc.jfxcentral.data.model.Coordinates;
import com.dlsc.jfxcentral.data.model.Documentation;
import com.dlsc.jfxcentral.data.model.Download;
import com.dlsc.jfxcentral.data.model.IkonliPack;
import com.dlsc.jfxcentral.data.model.Library;
Expand Down Expand Up @@ -161,6 +162,7 @@ public void clearData() {
getLinksOfTheWeek().clear();
getIkonliPacks().clear();
getMembers().clear();
getDocumentation().clear();
}

private void doLoadData(String reason) {
Expand Down Expand Up @@ -246,7 +248,12 @@ private void doLoadData(String reason) {
List<Member> members = gson.fromJson(new FileReader(membersFile, StandardCharsets.UTF_8), new TypeToken<List<Member>>() {
}.getType());

setData(homeText, openJFXText, people, books, videos, libraries, news, blogs, companies, tools, realWorldApps, downloads, tutorials, tips, links, ikonliPacks, members);
// load documentation
File documentationFile = new File(getRepositoryDirectory(), "documentation/documentation.json");
List<Documentation> documentation = gson.fromJson(new FileReader(documentationFile, StandardCharsets.UTF_8), new TypeToken<List<Documentation>>() {
}.getType());

setData(homeText, openJFXText, people, books, videos, libraries, news, blogs, companies, tools, realWorldApps, downloads, tutorials, tips, links, ikonliPacks, members,documentation);

LOG.fine("data loading finished");
} catch (Exception e) {
Expand All @@ -258,7 +265,7 @@ private void doLoadData(String reason) {

private void setData(String homeText, String openJFXText, List<Person> people, List<Book> books, List<Video> videos, List<Library> libraries,
List<News> news, List<Blog> blogs, List<Company> companies, List<Tool> tools, List<RealWorldApp> realWorldApps, List<Download> downloads,
List<Tutorial> tutorials, List<Tip> tips, List<LinksOfTheWeek> links, List<IkonliPack> ikonliPacks, List<Member> members) {
List<Tutorial> tutorials, List<Tip> tips, List<LinksOfTheWeek> links, List<IkonliPack> ikonliPacks, List<Member> members, List<Documentation> documentation) {
clearData();

setOpenJFXText(openJFXText);
Expand All @@ -279,6 +286,7 @@ private void setData(String homeText, String openJFXText, List<Person> people, L
getLinksOfTheWeek().setAll(links);
getIkonliPacks().setAll(ikonliPacks);
getMembers().setAll(members);
getDocumentation().setAll(documentation);

List<ModelObject> recentItems = findRecentItems();
getRecentItems().setAll(recentItems);
Expand All @@ -301,6 +309,7 @@ private List<ModelObject> findRecentItems() {
result.addAll(findRecentItems(getTips()));
result.addAll(findRecentItems(getIkonliPacks()));
result.addAll(findRecentItems(getMembers()));
result.addAll(findRecentItems(getDocumentation()));
// LinksOfTheWeek are not reachable through links!
// result.addAll(findRecentItems(getLinksOfTheWeek()));

Expand Down Expand Up @@ -396,6 +405,10 @@ public Optional<Member> getMemberById(String id) {
return members.stream().filter(item -> item.getId().equals(id)).findFirst();
}

public Optional<Documentation> getDocumentationById(String id) {
return documentation.stream().filter(item -> item.getId().equals(id)).findFirst();
}

public <T extends ModelObject> ObservableList<T> getLinkedObjects(ModelObject modelObject, Class<T> clazz) {
List<T> itemList = getList(clazz);
List<String> idsList = getIdList(modelObject, clazz);
Expand Down Expand Up @@ -435,6 +448,8 @@ private <T extends ModelObject> List<String> getIdList(ModelObject modelObject,
return modelObject.getIkonliPackIds();
} else if (clazz.equals(Member.class)) {
return modelObject.getMemberIds();
} else if (clazz.equals(Documentation.class)) {
return modelObject.getDocumentationIds();
}

throw new IllegalArgumentException("unsupported class type: " + clazz.getSimpleName());
Expand Down Expand Up @@ -471,6 +486,8 @@ public <T extends ModelObject> List<T> getList(Class<T> clazz) {
return (List<T>) ikonliPacks;
} else if (clazz.equals(Member.class)) {
return (List<T>) members;
} else if (clazz.equals(Documentation.class)) {
return (List<T>) documentation;
}

throw new IllegalArgumentException("unsupported class type: " + clazz.getSimpleName());
Expand Down Expand Up @@ -847,6 +864,12 @@ public ObservableList<Member> getMembers() {
return members;
}

private final ObservableList<Documentation> documentation = FXCollections.observableArrayList();

public ObservableList<Documentation> getDocumentation() {
return documentation;
}

private String loadString(File file) {
LOG.fine("loading string from: " + file);

Expand Down Expand Up @@ -1018,6 +1041,7 @@ public List<ModelObject> search(String pattern) {
search(getTips(), pattern, result);
search(getIkonliPacks(), pattern, result);
search(getMembers(), pattern, result);
search(getDocumentation(), pattern, result);
return result;
}

Expand Down
17 changes: 17 additions & 0 deletions src/main/java/com/dlsc/jfxcentral/data/DataRepository2.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.dlsc.jfxcentral.data.model.Book;
import com.dlsc.jfxcentral.data.model.Company;
import com.dlsc.jfxcentral.data.model.Coordinates;
import com.dlsc.jfxcentral.data.model.Documentation;
import com.dlsc.jfxcentral.data.model.Download;
import com.dlsc.jfxcentral.data.model.IkonliPack;
import com.dlsc.jfxcentral.data.model.Library;
Expand Down Expand Up @@ -107,6 +108,7 @@ public void clearData() {
getLinksOfTheWeek().clear();
getIkonliPacks().clear();
getMembers().clear();
getDocumentation().clear();
}

private void doLoadData(String reason) {
Expand Down Expand Up @@ -135,6 +137,7 @@ private void doLoadData(String reason) {
linksOfTheWeek.addAll(load(getFile("links/links.json"), new TypeToken<List<LinksOfTheWeek>>() {}.getType()));
ikonliPacks.addAll(load(getFile("ikonlipacks/ikonlipacks.json"), new TypeToken<List<IkonliPack>>() {}.getType()));
members.addAll(load(getFile("members/members.json"), new TypeToken<List<Member>>() {}.getType()));
documentation.addAll(load(getFile("documentation/documentation.json"), new TypeToken<List<Documentation>>() {}.getType()));
} catch (Exception e) {
e.printStackTrace();
}
Expand Down Expand Up @@ -214,6 +217,10 @@ public Optional<Member> getMemberById(String id) {
return members.stream().filter(item -> item.getId().equals(id)).findFirst();
}

public Optional<Documentation> getDocumentationById(String id) {
return documentation.stream().filter(item -> item.getId().equals(id)).findFirst();
}

public <T extends ModelObject> List<T> getLinkedObjects(ModelObject modelObject, Class<T> clazz) {
List<T> itemList = getList(clazz);
List<String> idsList = getIdList(modelObject, clazz);
Expand Down Expand Up @@ -251,6 +258,8 @@ private <T extends ModelObject> List<String> getIdList(ModelObject modelObject,
return modelObject.getIkonliPackIds();
}else if (clazz.equals(Member.class)) {
return modelObject.getMemberIds();
} else if (clazz.equals(Documentation.class)) {
return modelObject.getDocumentationIds();
}

throw new IllegalArgumentException("unsupported class type: " + clazz.getSimpleName());
Expand Down Expand Up @@ -287,6 +296,8 @@ public <T extends ModelObject> List<T> getList(Class<T> clazz) {
return (List<T>) ikonliPacks;
} else if (clazz.equals(Member.class)) {
return (List<T>) members;
} else if (clazz.equals(Documentation.class)) {
return (List<T>) documentation;
}

throw new IllegalArgumentException("unsupported class type: " + clazz.getSimpleName());
Expand Down Expand Up @@ -522,6 +533,12 @@ public List<Member> getMembers() {
return members;
}

private final List<Documentation> documentation = new ArrayList<>();

public List<Documentation> getDocumentation() {
return documentation;
}

public String getHomeText() {
return homeText;
}
Expand Down
22 changes: 8 additions & 14 deletions src/main/java/com/dlsc/jfxcentral/data/ImageManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
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.Library;
import com.dlsc.jfxcentral.data.model.Member;
Expand All @@ -19,9 +20,6 @@
import org.apache.commons.lang3.StringUtils;

import java.io.File;
import java.io.FileInputStream;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.net.URLConnection;
import java.time.ZonedDateTime;
Expand Down Expand Up @@ -137,13 +135,9 @@ public File libraryFile(Library library) {
return localImageFile(new File(DataRepository.getInstance().getRepositoryDirectory(), "libraries/" + library.getId() + "/"), "logo.png");
}








public File documentationFile(Documentation doc) {
return localImageFile(new File(DataRepository.getInstance().getRepositoryDirectory(), "documentation/" + doc.getId() + "/"), "logo.png");
}

private File localImageFile(File directory, String photoFileName) {
if (StringUtils.isBlank(photoFileName)) {
Expand Down Expand Up @@ -269,10 +263,10 @@ public ObjectProperty<Image> libraryImageProperty(Library library, String imageP
return fileToImageProperty(file, MISSING_IMAGE);
}





public ObjectProperty<Image> documentationImageProperty(Documentation doc) {
File file = documentationFile(doc);
return fileToImageProperty(file, null);
}

public ObjectProperty<Image> fileToImageProperty(File file, Image placeholderImage) {
ObjectProperty<Image> property = new SimpleObjectProperty<>();
Expand Down
16 changes: 16 additions & 0 deletions src/main/java/com/dlsc/jfxcentral/data/model/Documentation.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.dlsc.jfxcentral.data.model;

public class Documentation extends ModelObject {
private String url;

public Documentation() {
}

public String getUrl() {
return url;
}

public void setUrl(String url) {
this.url = url;
}
}
9 changes: 9 additions & 0 deletions src/main/java/com/dlsc/jfxcentral/data/model/ModelObject.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public abstract class ModelObject {
private List<String> linksOfTheWeekIds = new ArrayList<>();
private List<String> ikonliPackIds = new ArrayList<>();
private List<String> memberIds = new ArrayList<>();
private List<String> documentationIds = new ArrayList<>();

protected ModelObject() {
}
Expand Down Expand Up @@ -278,6 +279,14 @@ public void setIkonliPackIds(List<String> ikonliPackIds) {
this.ikonliPackIds = ikonliPackIds;
}

public List<String> getDocumentationIds() {
return documentationIds;
}

public void setDocumentationIds(List<String> documentationIds) {
this.documentationIds = documentationIds;
}

public LocalDate getCreationOrUpdateDate() {
LocalDate modifiedOn = getModifiedOn();
if (modifiedOn != null) {
Expand Down
17 changes: 17 additions & 0 deletions src/test/java/com/dlsc/jfxcentral/data/DataRepository2Test.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
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.IkonliPack;
import com.dlsc.jfxcentral.data.model.Library;
Expand Down Expand Up @@ -64,6 +65,7 @@ public void shouldLoadData() {
assertFalse(repository.getTutorials().isEmpty());
assertFalse(repository.getIkonliPacks().isEmpty());
assertFalse(repository.getMembers().isEmpty());
assertFalse(repository.getDocumentation().isEmpty());

assertTrue(StringUtils.isNotBlank(repository.getHomeText()));
assertTrue(StringUtils.isNotBlank(repository.getOpenJFXText()));
Expand Down Expand Up @@ -92,6 +94,7 @@ public void shouldClearData() {
assertTrue(repository.getTutorials().isEmpty());
assertTrue(repository.getIkonliPacks().isEmpty());
assertTrue(repository.getMembers().isEmpty());
assertTrue(repository.getDocumentation().isEmpty());

assertTrue(StringUtils.isBlank(repository.getHomeText()));
assertTrue(StringUtils.isBlank(repository.getOpenJFXText()));
Expand Down Expand Up @@ -123,6 +126,7 @@ public void shouldRefreshData() {
assertFalse(repository.getTutorials().isEmpty());
assertFalse(repository.getIkonliPacks().isEmpty());
assertFalse(repository.getMembers().isEmpty());
assertFalse(repository.getDocumentation().isEmpty());

assertTrue(StringUtils.isNotBlank(repository.getHomeText()));
assertTrue(StringUtils.isNotBlank(repository.getOpenJFXText()));
Expand Down Expand Up @@ -826,4 +830,17 @@ public void shouldGetIkonliPacks() {
// then
assertFalse(ikonliPacks.isEmpty());
}

@Test
public void shouldGetDocumentation() {
// given
DataRepository2 repository = DataRepository2.getInstance();
repository.reload();

// when
List<Documentation> documentation = repository.getDocumentation();

// then
assertFalse(documentation.isEmpty());
}
}
Loading

0 comments on commit 1391832

Please sign in to comment.