Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/abykuruvilla-dev/JFXNodeMapper
Maps ResultSets and other popular data representations to JavaFx Nodes based on thier ids
https://github.com/abykuruvilla-dev/JFXNodeMapper
Last synced: 25 days ago
JSON representation
Maps ResultSets and other popular data representations to JavaFx Nodes based on thier ids
- Host: GitHub
- URL: https://github.com/abykuruvilla-dev/JFXNodeMapper
- Owner: abykuruvilla-dev
- License: mit
- Created: 2018-10-11T15:38:32.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2018-10-18T06:03:09.000Z (about 6 years ago)
- Last Synced: 2024-05-18T21:37:46.340Z (7 months ago)
- Language: Java
- Size: 38.1 KB
- Stars: 6
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
- AwesomeJavaFX - JFXNodeMapper - Javafx Node mapping to various data formats like csv,xml,json and resultset. (Libraries, Tools and Projects)
README
# JFXNodeMapper
[![Build Status](https://camo.githubusercontent.com/cfcaf3a99103d61f387761e5fc445d9ba0203b01/68747470733a2f2f7472617669732d63692e6f72672f6477796c2f657374612e7376673f6272616e63683d6d6173746572)](https://github.com/CaptainParanoid/JFXNodeMapper)
JFXNodeMapper is a simple library that focuses on mapping data from common data represntation formats to JavaFx Nodes. Our main focus is to build a library that,
- Requires minimal configuration.
- Easy to understand.
- Small Size.# Features
- Automatic Node traversal to find children nodes and assign data to them based on their ids.
- Accept JSON and ResultSet as data source.
- Support custom mappings for nodes that has custom datatypes using event listners
- Supports customised datatype conversions.
# Upcoming Features
- Support for csv and xml.
- Reverse mapping, i.e convert Nodes to JSON ,CSV and XML,# How to use JFXNodeMapper in your project
- Add JFXNodeMapper to your project
- Assign id to nodes same as the Key/Column name
- (Optional) Assign custom mapping to node
- Pass the root node or parent node that contains the required fields to be mapped.
- Pass data source.
- See the Magic
# Examples* Mapping from a JSON string
```java
Scene scene = parent.getScene();
Node root = scene.getRoot();
DataMapper mapper = new DataMapper();
mapper.setRoot(root);
String json = getJsonFromServer();
mapper.setDataFromJSON(json); // json keys and node ids should match
```* Mapping from a ResultSet object
```java
Scene scene = parent.getScene();
Node root = scene.getRoot();
DataMapper mapper = new DataMapper();
mapper.setRoot(root);
Resulset resultset = getAllStudentDetails();
mapper.setDataFromResultSet(resultSet); //column name and node ids should match
```* Mapping from JSON string with custom mapping
```java
Scene scene = parent.getScene();
Node root = scene.getRoot();
DataMapper mapper = new DataMapper();
mapper.setRoot(root);
String json = getJsonFromServer();
// this listner will be called whenever the specified id is encountered.
// this will override all other mappings for the specified id
mapper.mapToCustomDataType("subject-combo", (data, id, node) -> {
ComboBox subs = (ComboBox) node;
String subject = (String)data;
subs.getItems.add(subject);
});
mapper.setDataFromJSON(json); // JSON keys and node ids should match
```