All Projects → Naoghuman → lib-preferences

Naoghuman / lib-preferences

Licence: GPL-3.0 license
Lib-Preferences is a library for easy storing simple data to a Preferences.properties file in a Java(FX) & Maven desktop application.

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to lib-preferences

Lib I18n
The library `Lib-I18N` allows a developer to bind a key-value pair of a `.properties` file to a [StringBinding]. This makes it very easy to change the language during runtime in a [JavaFX] application.
Stars: ✭ 40 (+233.33%)
Mutual labels:  netbeans, maven, javafx
openjfx-docs
Getting started guide for JavaFX 11
Stars: ✭ 70 (+483.33%)
Mutual labels:  netbeans, maven, javafx
JasperViewerFX
The JasperViewerFX is a free JavaFX library which aims to avoid use of JasperReport's swing viewer
Stars: ✭ 27 (+125%)
Mutual labels:  javafx, javafx-library, javafx-8
Samples
JavaFX samples to run with different options and build tools
Stars: ✭ 352 (+2833.33%)
Mutual labels:  netbeans, maven, javafx
MaskedTextField
MaskedTextField is an component similar to JFormmatedText field and can be used in same way.
Stars: ✭ 21 (+75%)
Mutual labels:  javafx, javafx-library, javafx-8
Preferencesfx
A framework for easily creating a UI for application settings / preferences.
Stars: ✭ 449 (+3641.67%)
Mutual labels:  preferences, javafx
Azkar-App
Desktop Application 💻 for Calculating Muslim prayer times 🕌 , Morning and Nights Azkar 🤲 with notification for random Azkar that pops-up in specific time.
Stars: ✭ 64 (+433.33%)
Mutual labels:  maven, javafx
advanced-bindings
Collection of Binding helpers for JavaFX(8)
Stars: ✭ 63 (+425%)
Mutual labels:  javafx, javafx-library
Drombler Fx
Drombler FX - the modular application framework for JavaFX.
Stars: ✭ 52 (+333.33%)
Mutual labels:  maven, javafx
vic2 economy analyzer
Victoria 2 savegame economy analyzer, updated version
Stars: ✭ 44 (+266.67%)
Mutual labels:  maven, javafx
PowerPreference
💾 A Powerful library to control and simplify the usage of shared preference in Android.
Stars: ✭ 95 (+691.67%)
Mutual labels:  preferences, preference
LogoRRR
A log viewer which visualises log events such that it is easy to identify problems or events of interest. This app was implemented using Scala and JavaFX, GluonHQ toolchain and GraalVM as platform.
Stars: ✭ 40 (+233.33%)
Mutual labels:  maven, javafx
Bank-Account-Simulation
A Bank Account Simulation with JavaFX and SQLite back-end. Material UX|UI.
Stars: ✭ 19 (+58.33%)
Mutual labels:  javafx, javafx-library
medusa
A JavaFX library for Gauges
Stars: ✭ 605 (+4941.67%)
Mutual labels:  javafx, javafx-library
jakartaee8-starter-boilerplate
A boilerplate project for starting a Jakarta EE 8 application in seconds
Stars: ✭ 55 (+358.33%)
Mutual labels:  netbeans, maven
Maven Jpackage Template
Sample project illustrating building nice, small cross-platform JavaFX-based desktop apps with native installers while still using the standard Maven dependency system.
Stars: ✭ 74 (+516.67%)
Mutual labels:  maven, javafx
GNCarousel
Carousel based on web design
Stars: ✭ 19 (+58.33%)
Mutual labels:  javafx, javafx-8
mano-simulator
🖥️ An assembler and hardware simulator for the Mano Basic Computer, a 16 bit computer.
Stars: ✭ 20 (+66.67%)
Mutual labels:  javafx, javafx-8
Javafx Maven Plugin
Maven plugin for JavaFX
Stars: ✭ 764 (+6266.67%)
Mutual labels:  maven, javafx
Hellojpro
Stars: ✭ 46 (+283.33%)
Mutual labels:  maven, javafx

Lib-Preferences

Build Status license: GPL v3 GitHub release

Intention

Lib-Preferences is a library for easy storing simple data to a Preferences.properties file in a Java(FX) & Maven desktop application.

Image: UML Lib-Preferences
UML-diagram_Lib-Preferences_v0.6.0_2018-12-14_18-14.png

Hint
The UML diagram is created with the Online Modeling Platform GenMyModel.

Content

Specification

With the factory PreferencesFactory the developer have all tools to do the 3 main points from this library:

  1. Make the decision between the application and the module scope.
  2. Let the developer define the key which allowed to store or receive a value.
  3. And finally the decision if a value should be saved or received.

Application scope means that the key must be unique in the hole application.
Module scope means that the key must be unique in a package scope.

Usage of PreferencesFactory

/**
 * 1) Starts the factory process.
 * 2) Activate the 'application' scope.
 * 3) Activate the 'package' scope.
 * 4) Defines the 'key'.
 * 5) Returns the 'value' from type 'T'.
 * 6) Stores the value from type 'T'.
 */
PreferencesFactory.create() // 1
        .application()      // 2
        .module(Class)      // 3
        .key(final String)  // 4
        .get(T);            // 5
        .put(T);            // 6

Examples

How to save, access data in an application scope

How to save, access a Double in an application scope
@Test
public void thirdStepPutGetDoubleReturnsValue() {
    PreferencesFactory.create()
            .application()
            .key("dummy.key6")
            .put(1.2345d);

    double result = PreferencesFactory.create()
            .application()
            .key("dummy.key6")
            .get(5.4321d);
    assertEquals(1.2345d, result, 0);
}

which will write following entry in the file Preferences.properties:

com.github.naoghuman.lib.preferences.internal.dummy.key6=1.2345
How to save, access an Integer in an application scope
@Test
public void thirdStepPutGetIntegerReturnsValue() {
    PreferencesFactory.create()
            .application()
            .key("dummy.key8")
            .put(123456);

    int result = PreferencesFactory.create()
            .application()
            .key("dummy.key8")
            .get(654321);
    assertTrue(123456 == result);
}

which will write following entry in the file Preferences.properties:

com.github.naoghuman.lib.preferences.internal.dummy.key8=123456

How to save, access data in a module scope

How to save, access a Boolean in a module scope
@Test
public void thirdStepPutGetBooleanReturnsValueTrue() {
    PreferencesFactory.create()
            .module(DummyModuleScope.class)
            .key("dummy.key3")
            .put(Boolean.TRUE);

    assertTrue(PreferencesFactory.create()
            .module(DummyModuleScope.class)
            .key("dummy.key3")
            .get(Boolean.TRUE));
}

which will write following entry in the file Preferences.properties:

dummy.module.scope.dummy.key3=true
How to save, access a String in a module scope
@Test
public void thirdStepPutGetStringReturnsValue() {
    PreferencesFactory.create()
            .module(DummyModuleScope.class)
            .key("dummy.key12")
            .put("hello world");

    String result = PreferencesFactory.create()
            .module(DummyModuleScope.class)
            .key("dummy.key12")
            .get("world hello");
    assertEquals("hello world", result);
}

which will write following entry in the file Preferences.properties:

dummy.module.scope.dummy.key12=hello world

Conventions

In this chapter, the interested developer can find out about all the conventions in the library Lib-Preferences.

Features

Lib-Preferencs have many nice features which simplify the developers task to store and access simple data in a Java(FX) application:

JavaDoc

The JavaDoc from the library 'Lib-Preferences' can be explored here: JavaDoc Lib-Preferences v0.6.0

Image: JavaDoc Lib-Preferences v0.6.0
JavaDoc_Lib-Preferences_v0.6.0_2018-12-14_18-23.png

Download

Current version is 0.6.0. Main points in this release are:

Maven coordinates

<dependencies>
    <dependency>
        <groupId>com.github.naoghuman</groupId>
        <artifactId>lib-preferences</artifactId>
        <version>0.6.0</version>
    </dependency>
    <dependency>
        <groupId>com.github.naoghuman</groupId>
        <artifactId>lib-logger</artifactId>
        <version>0.6.0</version>
    </dependency>
</dependencies>

Download:

An overview about all existings releases can be found here:

  • Overview from all releases in Lib-Preferences.

Requirements

In the library following dependencies are registered:

Installation

Contribution

License

The project Lib-Preferences is licensed under General Public License 3.0.

Autor

The project Lib-Preferences is maintained by me, Naoghuman (Peter Rogge). See Contact.

Contact

You can reach me under [email protected].

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].