Use focused Lombok annotations and preserve generated API documentation
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
# NeitzelLib
|
||||
|
||||
Read README.md and the affected module's README before changes. Use the declared
|
||||
Java/Maven baseline and the enclosing workspace's checkout/landing policy.
|
||||
|
||||
Prefer Lombok for mechanical getters/setters, constructors and logger declarations
|
||||
when changing Java code. Use focused annotations that preserve the existing API,
|
||||
defaults, injection annotations, identity and equality. Keep validation, defensive
|
||||
copies, JavaFX property operations and lifecycle logic explicit; retain records
|
||||
and concise interface adapters. `@Data`/`@Value` require an intentional full value
|
||||
contract, including safe `toString` output. Keep Lombok compile-time-only and
|
||||
preserve every annotation processor in profile-specific configurations.
|
||||
|
||||
Run affected module tests, including FXML/reflection and generated metadata when
|
||||
models change. Inspect Surefire XML: the parent currently ignores test failures.
|
||||
Do not install changed runtime artifacts over a Designer-pinned baseline without
|
||||
explicitly qualifying and recording the replacement.
|
||||
@@ -75,3 +75,22 @@ Some additions for quarkus that might be useful.
|
||||
The [complete quick start](fx/docs/quick-start.md) includes local snapshot installation, a standalone Maven POM, Java classes, FXML and launch commands. Continue with [MVVM and runtime architecture](fx/docs/architecture.md), the [FXML reference](fx/README.md), and the [person desk walkthrough](fx-example/README.md). The [injection guide](injection/README.md) also covers use without JavaFX.
|
||||
|
||||
Build with Java 21. Maven wrapper version is 3.9.11; the project requires Maven 3.8.6 or later. Library version `1.0-SNAPSHOT` denotes development artifacts, not a published stable release. The parent POM currently ignores Surefire failures: check test reports, as explained in the quick start, rather than relying only on Maven's exit code.
|
||||
|
||||
## Java source conventions
|
||||
|
||||
Use focused Lombok annotations for mechanical accessors, constructors and logging;
|
||||
see [the contributor instructions](AGENTS.md). The parent already configures
|
||||
Lombok 1.18.42 as a provided dependency and an explicit annotation processor.
|
||||
It is not required at runtime. Each checkout has a `lombok.config` boundary so
|
||||
workstation-level settings cannot silently change generated APIs.
|
||||
|
||||
Keep behavior-bearing methods and JavaFX property operations explicit. Records
|
||||
remain records, and identity-based Models do not acquire generated equality.
|
||||
The [Person desk example](fx-example/README.md) demonstrates Lombok JavaBeans
|
||||
and constructor injection while retaining ordinary JavaBean APIs.
|
||||
|
||||
API documentation runs Lombok's [delombok](https://projectlombok.org/features/delombok)
|
||||
step at `process-classes` and reads `target/delombok`, including generated methods.
|
||||
The plugin uses the same `${lombok.version}` as compilation; its output is not
|
||||
added to the compiler source roots. Run `verify` (or at least `process-classes`)
|
||||
before invoking standalone Javadoc/site reporting.
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
package de.neitzel.core.commandline;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.Singular;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
/**
|
||||
* The `Parameter` class defines a command-line parameter with associated metadata,
|
||||
* such as constraints on the number of values it accepts, descriptions, and aliases.
|
||||
@@ -21,6 +21,7 @@ import java.util.function.Consumer;
|
||||
@Builder
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
public class Parameter {
|
||||
|
||||
/**
|
||||
@@ -165,30 +166,4 @@ public class Parameter {
|
||||
public Parameter() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new Parameter with the given attributes.
|
||||
*
|
||||
* @param name The name of the parameter.
|
||||
* @param minNumberValues The minimum number of values allowed for this parameter.
|
||||
* @param maxNumberValues The maximum number of values allowed for this parameter.
|
||||
* @param multipleEntries Indicates whether multiple entries are allowed for this parameter.
|
||||
* @param shortDescription A brief description of the parameter.
|
||||
* @param longDescription A detailed description of the parameter.
|
||||
* @param callback A consumer function that processes a list of values associated with this parameter.
|
||||
* @param isHelpCommand Indicates whether this parameter represents a help command.
|
||||
* @param isDefaultParameter Indicates whether this parameter is the default parameter.
|
||||
* @param aliasList A list of aliases for this parameter.
|
||||
*/
|
||||
public Parameter(String name, int minNumberValues, int maxNumberValues, boolean multipleEntries, String shortDescription, String longDescription, Consumer<List<String>> callback, boolean isHelpCommand, boolean isDefaultParameter, List<String> aliasList) {
|
||||
this.name = name;
|
||||
this.minNumberValues = minNumberValues;
|
||||
this.maxNumberValues = maxNumberValues;
|
||||
this.multipleEntries = multipleEntries;
|
||||
this.shortDescription = shortDescription;
|
||||
this.longDescription = longDescription;
|
||||
this.callback = callback;
|
||||
this.isHelpCommand = isHelpCommand;
|
||||
this.isDefaultParameter = isDefaultParameter;
|
||||
this.aliasList = aliasList;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,8 +2,6 @@ package de.neitzel.core.config;
|
||||
|
||||
import de.neitzel.core.io.FileUtils;
|
||||
import de.neitzel.core.util.Strings;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
@@ -14,6 +12,8 @@ import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* Provides a utility class for managing configuration properties in an
|
||||
@@ -22,6 +22,7 @@ import java.util.Properties;
|
||||
* and updating properties.
|
||||
*/
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
public class Configuration {
|
||||
|
||||
/**
|
||||
@@ -43,15 +44,6 @@ public class Configuration {
|
||||
this(new Properties());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new Configuration instance using the provided properties.
|
||||
*
|
||||
* @param properties the Properties object containing configuration key-value pairs
|
||||
*/
|
||||
public Configuration(final Properties properties) {
|
||||
this.properties = properties;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves a boolean property value associated with the specified key. If the key does not exist in the properties,
|
||||
* the provided default value is returned. The method also supports interpreting specific string values as true.
|
||||
|
||||
@@ -5,6 +5,7 @@ import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.Comparator;
|
||||
import java.util.stream.Stream;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* A utility class for creating and managing a temporary directory.
|
||||
@@ -23,6 +24,7 @@ public class TempDirectory implements AutoCloseable {
|
||||
* The directory can be used to safely store temporary runtime files. It is automatically
|
||||
* deleted along with its content when the associated TempDirectory object is closed.
|
||||
*/
|
||||
@Getter
|
||||
private final Path directory;
|
||||
|
||||
/**
|
||||
@@ -37,15 +39,6 @@ public class TempDirectory implements AutoCloseable {
|
||||
this.directory = Files.createTempDirectory(prefix);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the path of the temporary directory associated with this instance.
|
||||
*
|
||||
* @return the {@code Path} of the temporary directory
|
||||
*/
|
||||
public Path getDirectory() {
|
||||
return directory;
|
||||
}
|
||||
|
||||
/**
|
||||
* Closes the temporary directory by cleaning up its contents and deleting the directory itself.
|
||||
* <p>
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
package de.neitzel.core.sql;
|
||||
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
@@ -19,6 +16,9 @@ import java.util.Spliterators;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Stream;
|
||||
import java.util.stream.StreamSupport;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* A generic class for managing SQL queries and their execution using JDBC.
|
||||
@@ -28,6 +28,7 @@ import java.util.stream.StreamSupport;
|
||||
* @param <T> The type of the objects returned by the query.
|
||||
*/
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
public class Query<T> {
|
||||
|
||||
/**
|
||||
@@ -74,15 +75,6 @@ public class Query<T> {
|
||||
*/
|
||||
private String queryText;
|
||||
|
||||
/**
|
||||
* Constructs a new Query object with the given database connection.
|
||||
*
|
||||
* @param connection The Connection object used to interact with the database.
|
||||
*/
|
||||
public Query(Connection connection) {
|
||||
this.connection = connection;
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes the given SQL query using the provided database connection.
|
||||
*
|
||||
|
||||
@@ -22,6 +22,7 @@ import java.sql.Time;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.Calendar;
|
||||
import java.util.Map;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
/**
|
||||
* A wrapper implementation of the {@link ResultSet} interface that modifies or intercepts
|
||||
@@ -31,6 +32,7 @@ import java.util.Map;
|
||||
* If any additional behaviors or transformations are applied, they are documented
|
||||
* in the respective overridden method descriptions.
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
public class TrimmingResultSet implements ResultSet {
|
||||
|
||||
/**
|
||||
@@ -44,15 +46,6 @@ public class TrimmingResultSet implements ResultSet {
|
||||
*/
|
||||
private final ResultSet resultSet;
|
||||
|
||||
/**
|
||||
* Initializes a new instance of the TrimmingResultSet class, wrapping the provided ResultSet.
|
||||
*
|
||||
* @param resultSet the ResultSet to be wrapped and processed by this TrimmingResultSet instance
|
||||
*/
|
||||
public TrimmingResultSet(ResultSet resultSet) {
|
||||
this.resultSet = resultSet;
|
||||
}
|
||||
|
||||
/**
|
||||
* Moves the cursor forward one row from its current position in the ResultSet.
|
||||
*
|
||||
@@ -933,18 +926,6 @@ public class TrimmingResultSet implements ResultSet {
|
||||
return resultSet.getNCharacterStream(columnLabel);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Retrieves the value of the designated column in the current row of this ResultSet object
|
||||
* as an Object in the Java programming language. The value will be converted to the specified
|
||||
@@ -965,8 +946,6 @@ public class TrimmingResultSet implements ResultSet {
|
||||
return resultSet.getObject(columnIndex, map);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Retrieves the value of the specified column as a {@link Ref} object.
|
||||
*
|
||||
@@ -979,8 +958,6 @@ public class TrimmingResultSet implements ResultSet {
|
||||
return resultSet.getRef(columnIndex);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Retrieves the Blob object designated by the given column index from the current row of the result set.
|
||||
*
|
||||
@@ -993,8 +970,6 @@ public class TrimmingResultSet implements ResultSet {
|
||||
return resultSet.getBlob(columnIndex);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Retrieves the CLOB value at the specified column index from the underlying ResultSet.
|
||||
*
|
||||
@@ -1007,8 +982,6 @@ public class TrimmingResultSet implements ResultSet {
|
||||
return resultSet.getClob(columnIndex);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Retrieves an SQL Array object from the specified column index
|
||||
* of the current row in the ResultSet.
|
||||
|
||||
+16
-1
@@ -39,7 +39,22 @@ Paths below are relative to this module. Java sources share `src/main/java/de/ne
|
||||
| `src/test/resources/de/neitzel/fx/example/NameLine.fxml` | Test-only second View of the same Person without reusable Component nodes |
|
||||
| `view/AgeConverter`, `StreetConverter`, `VisitedOnConverter` | Text adaptation, validation failures and ISO dates |
|
||||
|
||||
Use the actual source directories to locate helper services such as `AgeSuffix`, `StreetPolicy` and `FormHeading`. The injection guide explains constructor, field and setter injection with these types. No code generation is required to run this example; `PersonViewModel` is handwritten.
|
||||
Use the actual source directories to locate helper services such as `AgeSuffix`, `StreetPolicy` and `FormHeading`. The injection guide explains constructor, field and setter injection with these types. No Designer code generation is required to run this example; `PersonViewModel` is handwritten.
|
||||
|
||||
## Lombok and annotation processing
|
||||
|
||||
`Person`, `Address` and `Note` use `@Getter`/`@Setter` to generate ordinary JavaBean
|
||||
accessors. Their defaults, mutable lists and object identity are unchanged; no
|
||||
`@Data` equality or string representation is generated. JavaFX property methods
|
||||
remain explicit. `AgeConverter` and `VisitRow` use
|
||||
`@RequiredArgsConstructor(onConstructor_ = @Inject)` so the generated public
|
||||
constructors retain the injection annotation.
|
||||
|
||||
Lombok is inherited from the parent as a compile-time-only dependency. The
|
||||
optional `designer-preview` profile explicitly lists **both** Lombok and the
|
||||
Designer Model metadata processor. Keep both when changing that profile:
|
||||
metadata discovery must see the generated accessors during compilation. The
|
||||
normal build needs no Designer processor; Lombok still runs.
|
||||
|
||||
## Try the behaviors
|
||||
|
||||
|
||||
+5
-8
@@ -36,14 +36,6 @@
|
||||
<build>
|
||||
<finalName>${jar.filename}</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<!-- This module has no Lombok types. Skip the processor so a newer JDK can compile it. -->
|
||||
<proc>none</proc>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.openjfx</groupId>
|
||||
<artifactId>javafx-maven-plugin</artifactId>
|
||||
@@ -132,6 +124,11 @@
|
||||
<configuration>
|
||||
<proc>full</proc>
|
||||
<annotationProcessorPaths combine.self="override">
|
||||
<path>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>${lombok.version}</version>
|
||||
</path>
|
||||
<path>
|
||||
<groupId>de.neitzel.fxdesigner</groupId>
|
||||
<artifactId>designer-model-processor</artifactId>
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
package de.neitzel.fx.example.model;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* An ordinary address the desk edits.
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
public class Address {
|
||||
|
||||
/**
|
||||
@@ -44,78 +48,6 @@ public class Address {
|
||||
this.city = city;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the street.
|
||||
*
|
||||
* @return the street
|
||||
*/
|
||||
public String getStreet() {
|
||||
return street;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the street.
|
||||
*
|
||||
* @param street the street
|
||||
*/
|
||||
public void setStreet(String street) {
|
||||
this.street = street;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the city.
|
||||
*
|
||||
* @return the city
|
||||
*/
|
||||
public String getCity() {
|
||||
return city;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the city.
|
||||
*
|
||||
* @param city the city
|
||||
*/
|
||||
public void setCity(String city) {
|
||||
this.city = city;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the day of the visit.
|
||||
*
|
||||
* @return the date, or {@code null} when none is set
|
||||
*/
|
||||
public LocalDate getVisitedOn() {
|
||||
return visitedOn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the day of the visit.
|
||||
*
|
||||
* @param visitedOn the date, or {@code null} to clear it
|
||||
*/
|
||||
public void setVisitedOn(LocalDate visitedOn) {
|
||||
this.visitedOn = visitedOn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the note attached to this address.
|
||||
*
|
||||
* @return the note, or {@code null} when none is set
|
||||
*/
|
||||
public Note getNote() {
|
||||
return note;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the note attached to this address.
|
||||
*
|
||||
* @param note the note, or {@code null} when there is none
|
||||
*/
|
||||
public void setNote(Note note) {
|
||||
this.note = note;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the street and city, for a combo box row.
|
||||
*
|
||||
|
||||
@@ -1,11 +1,16 @@
|
||||
package de.neitzel.fx.example.model;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* A short note attached to an address.
|
||||
* <p>
|
||||
* The class is a complex attribute of {@link Address}: it has a read-write property of its own.
|
||||
* The home address form nests a component that edits this note.
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
public class Note {
|
||||
|
||||
/**
|
||||
@@ -28,21 +33,4 @@ public class Note {
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the note text.
|
||||
*
|
||||
* @return the text
|
||||
*/
|
||||
public String getText() {
|
||||
return text;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the note text.
|
||||
*
|
||||
* @param text the text
|
||||
*/
|
||||
public void setText(String text) {
|
||||
this.text = text;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,12 +2,16 @@ package de.neitzel.fx.example.model;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* An ordinary person the desk edits.
|
||||
* <p>
|
||||
* Read-write attributes are what the View binds to. The class carries no JavaFX types.
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
public class Person {
|
||||
|
||||
/**
|
||||
@@ -56,151 +60,4 @@ public class Person {
|
||||
public Person() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the name.
|
||||
*
|
||||
* @return the name
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the name.
|
||||
*
|
||||
* @param name the name
|
||||
*/
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the age in years.
|
||||
*
|
||||
* @return the age, or {@code null} when none is set
|
||||
*/
|
||||
public Integer getAge() {
|
||||
return age;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the age in years.
|
||||
*
|
||||
* @param age the age
|
||||
*/
|
||||
public void setAge(Integer age) {
|
||||
this.age = age;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the home address.
|
||||
*
|
||||
* @return the home address, or {@code null} when none is set
|
||||
*/
|
||||
public Address getHome() {
|
||||
return home;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the home address.
|
||||
*
|
||||
* @param home the home address
|
||||
*/
|
||||
public void setHome(Address home) {
|
||||
this.home = home;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the visits.
|
||||
* <p>
|
||||
* After the View has loaded, this is the list the View is watching.
|
||||
*
|
||||
* @return the visits
|
||||
*/
|
||||
public List<Address> getVisits() {
|
||||
return visits;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the visits.
|
||||
*
|
||||
* @param visits the visits
|
||||
*/
|
||||
public void setVisits(List<Address> visits) {
|
||||
this.visits = visits;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the visit chosen in the table and the combo box.
|
||||
*
|
||||
* @return the selected visit, or {@code null} when none is selected
|
||||
*/
|
||||
public Address getSelectedVisit() {
|
||||
return selectedVisit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the visit chosen in the table and the combo box.
|
||||
*
|
||||
* @param selectedVisit the selected visit
|
||||
*/
|
||||
public void setSelectedVisit(Address selectedVisit) {
|
||||
this.selectedVisit = selectedVisit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the tags.
|
||||
* <p>
|
||||
* After the View has loaded, this is the list the View is watching.
|
||||
*
|
||||
* @return the tags
|
||||
*/
|
||||
public List<String> getTags() {
|
||||
return tags;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the tags.
|
||||
*
|
||||
* @param tags the tags
|
||||
*/
|
||||
public void setTags(List<String> tags) {
|
||||
this.tags = tags;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the person is active.
|
||||
*
|
||||
* @return {@code true} when the person is active
|
||||
*/
|
||||
public boolean isActive() {
|
||||
return active;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets whether the person is active.
|
||||
*
|
||||
* @param active {@code true} when the person is active
|
||||
*/
|
||||
public void setActive(boolean active) {
|
||||
this.active = active;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the role.
|
||||
*
|
||||
* @return the role, or {@code null} when none is set
|
||||
*/
|
||||
public Role getRole() {
|
||||
return role;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the role.
|
||||
*
|
||||
* @param role the role
|
||||
*/
|
||||
public void setRole(Role role) {
|
||||
this.role = role;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,11 +3,13 @@ package de.neitzel.fx.example.view;
|
||||
import de.neitzel.fx.view.Converter;
|
||||
import jakarta.inject.Inject;
|
||||
import jakarta.inject.Singleton;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
/**
|
||||
* Translates an age between the Model and the text field.
|
||||
*/
|
||||
@Singleton
|
||||
@RequiredArgsConstructor(onConstructor_ = @Inject)
|
||||
public class AgeConverter implements Converter {
|
||||
|
||||
/**
|
||||
@@ -15,16 +17,6 @@ public class AgeConverter implements Converter {
|
||||
*/
|
||||
private final AgeSuffix suffix;
|
||||
|
||||
/**
|
||||
* Creates a converter that reads its suffix from the injected service.
|
||||
*
|
||||
* @param suffix the suffix written in front of the age
|
||||
*/
|
||||
@Inject
|
||||
public AgeConverter(AgeSuffix suffix) {
|
||||
this.suffix = suffix;
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes the suffix in front of the age.
|
||||
*
|
||||
|
||||
@@ -7,6 +7,7 @@ import javafx.beans.property.ObjectProperty;
|
||||
import javafx.beans.property.SimpleObjectProperty;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.layout.HBox;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
/**
|
||||
* Row that edits one visit in the visit table.
|
||||
@@ -16,6 +17,7 @@ import javafx.scene.layout.HBox;
|
||||
* order: street, city, then the visit date. Remove sits after them and is not a column.
|
||||
*/
|
||||
@Singleton
|
||||
@RequiredArgsConstructor(onConstructor_ = @Inject)
|
||||
public class VisitRow extends HBox {
|
||||
|
||||
/**
|
||||
@@ -28,16 +30,6 @@ public class VisitRow extends HBox {
|
||||
*/
|
||||
private final ObjectProperty<Object> model = new SimpleObjectProperty<>(this, "model");
|
||||
|
||||
/**
|
||||
* Creates a row that can remove its visit.
|
||||
*
|
||||
* @param desk the desk controller
|
||||
*/
|
||||
@Inject
|
||||
public VisitRow(DeskController desk) {
|
||||
this.desk = desk;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the model property the table sets.
|
||||
*
|
||||
|
||||
@@ -3,6 +3,7 @@ package de.neitzel.fx.view;
|
||||
import de.neitzel.injection.ApplicationContext;
|
||||
import javafx.beans.DefaultProperty;
|
||||
import javafx.scene.Parent;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -20,6 +21,7 @@ public class BindingList {
|
||||
/**
|
||||
* The binding elements, in document order.
|
||||
*/
|
||||
@Getter
|
||||
private final List<Object> elements = new ArrayList<>();
|
||||
|
||||
/**
|
||||
@@ -29,18 +31,6 @@ public class BindingList {
|
||||
LoadSession.register(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the binding elements in this list.
|
||||
* <p>
|
||||
* FXML appends child elements to the returned list. A child is a {@link DirectBinding}, a
|
||||
* {@link ComputedBinding}, or a {@link Repeat}.
|
||||
*
|
||||
* @return the mutable list of binding elements
|
||||
*/
|
||||
public List<Object> getElements() {
|
||||
return elements;
|
||||
}
|
||||
|
||||
/**
|
||||
* Applies every binding element in this list.
|
||||
*
|
||||
|
||||
@@ -6,6 +6,8 @@ import java.util.IdentityHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
/**
|
||||
* Carries one child ViewModel's current notices onto its parent.
|
||||
@@ -15,6 +17,7 @@ import java.util.Set;
|
||||
* source is the Attribute name, a dot, and the child source. A further parent carries that copy
|
||||
* the same way, so the source grows into a Path. The copy is not logged again.
|
||||
*/
|
||||
@RequiredArgsConstructor(access = AccessLevel.PRIVATE)
|
||||
final class ChildMessageMirror implements MessageListener {
|
||||
|
||||
/**
|
||||
@@ -37,19 +40,6 @@ final class ChildMessageMirror implements MessageListener {
|
||||
*/
|
||||
private final Map<Message, Message> copies = new IdentityHashMap<>();
|
||||
|
||||
/**
|
||||
* Creates a mirror. {@link #attach} registers it and copies notices already present.
|
||||
*
|
||||
* @param parent the parent ViewModel
|
||||
* @param attribute the Attribute that leads to the child
|
||||
* @param child the child ViewModel
|
||||
*/
|
||||
private ChildMessageMirror(ViewModel parent, String attribute, ViewModel child) {
|
||||
this.parent = parent;
|
||||
this.attribute = attribute;
|
||||
this.child = child;
|
||||
}
|
||||
|
||||
/**
|
||||
* Starts carrying {@code child} onto {@code parent} under {@code attribute}.
|
||||
* <p>
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
package de.neitzel.fx.view;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* One Column of a {@link Table}.
|
||||
* <p>
|
||||
@@ -11,11 +14,15 @@ public class Column {
|
||||
/**
|
||||
* The header text.
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
private String header;
|
||||
|
||||
/**
|
||||
* The Attribute of the row element.
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
private String attribute;
|
||||
|
||||
/**
|
||||
@@ -23,42 +30,6 @@ public class Column {
|
||||
*/
|
||||
private Double width;
|
||||
|
||||
/**
|
||||
* Sets the header text.
|
||||
*
|
||||
* @param header the header text
|
||||
*/
|
||||
public void setHeader(String header) {
|
||||
this.header = header;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the header text.
|
||||
*
|
||||
* @return the header text
|
||||
*/
|
||||
public String getHeader() {
|
||||
return header;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the Attribute name.
|
||||
*
|
||||
* @param attribute the Attribute of the row element
|
||||
*/
|
||||
public void setAttribute(String attribute) {
|
||||
this.attribute = attribute;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Attribute name.
|
||||
*
|
||||
* @return the Attribute of the row element
|
||||
*/
|
||||
public String getAttribute() {
|
||||
return attribute;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the starting width.
|
||||
* <p>
|
||||
|
||||
@@ -1,22 +1,23 @@
|
||||
package de.neitzel.fx.view;
|
||||
|
||||
import de.neitzel.injection.ApplicationContext;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.net.URL;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.AbstractMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import javafx.beans.property.Property;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.scene.Parent;
|
||||
import javafx.util.Builder;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.AbstractMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Set;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.net.URL;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
/**
|
||||
* Loads a Component from {@code ClassName.fxml} in the Component's package.
|
||||
@@ -70,6 +71,7 @@ final class Components {
|
||||
* Collects instance properties while FXML constructs an injected Component.
|
||||
* Properties are applied after its own document and model listener are ready.
|
||||
*/
|
||||
@RequiredArgsConstructor(access = AccessLevel.PRIVATE)
|
||||
private static final class ComponentBuilder extends AbstractMap<String, Object> implements Builder<Object> {
|
||||
/** The injected instance. */
|
||||
private final Object component;
|
||||
@@ -78,16 +80,6 @@ final class Components {
|
||||
/** Values already resolved by the containing FXMLLoader. */
|
||||
private final Map<String, Object> values = new LinkedHashMap<>();
|
||||
|
||||
/**
|
||||
* Creates a builder for an injected instance.
|
||||
* @param component the instance
|
||||
* @param context its dependency context
|
||||
*/
|
||||
private ComponentBuilder(Object component, ApplicationContext context) {
|
||||
this.component = component;
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
/**
|
||||
* Records a property for application after Component initialization.
|
||||
* @param key the property name
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
package de.neitzel.fx.view;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* A Computed binding declared in FXML.
|
||||
* <p>
|
||||
@@ -8,6 +11,8 @@ package de.neitzel.fx.view;
|
||||
* {@code #workingAge}. The method may read the Controller's fields. Its result is written to
|
||||
* the control property. The method does not write the Model.
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
public class ComputedBinding {
|
||||
|
||||
/**
|
||||
@@ -25,57 +30,4 @@ public class ComputedBinding {
|
||||
*/
|
||||
private String method;
|
||||
|
||||
/**
|
||||
* Sets the {@code fx:id} of the control.
|
||||
*
|
||||
* @param control the control id
|
||||
*/
|
||||
public void setControl(String control) {
|
||||
this.control = control;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the control property name, such as {@code text}.
|
||||
*
|
||||
* @param property the property name
|
||||
*/
|
||||
public void setProperty(String property) {
|
||||
this.property = property;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the Controller method. A {@code #method} value names a no-argument method.
|
||||
*
|
||||
* @param method the method value, such as {@code #workingAge}
|
||||
*/
|
||||
public void setMethod(String method) {
|
||||
this.method = method;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the {@code fx:id} of the control.
|
||||
*
|
||||
* @return the control id
|
||||
*/
|
||||
public String getControl() {
|
||||
return control;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the control property name.
|
||||
*
|
||||
* @return the property name
|
||||
*/
|
||||
public String getProperty() {
|
||||
return property;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Controller method value.
|
||||
*
|
||||
* @return the method value, such as {@code #workingAge}
|
||||
*/
|
||||
public String getMethod() {
|
||||
return method;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
package de.neitzel.fx.view;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* A Direct binding declared in FXML.
|
||||
* <p>
|
||||
@@ -10,6 +13,8 @@ package de.neitzel.fx.view;
|
||||
* Model instance behind the ViewModel. Direction values are {@code view}, {@code model}, and
|
||||
* {@code both}. The Converter value is the class name. The container creates that class.
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
public class DirectBinding {
|
||||
|
||||
/**
|
||||
@@ -37,93 +42,4 @@ public class DirectBinding {
|
||||
*/
|
||||
private String converter;
|
||||
|
||||
/**
|
||||
* Sets the {@code fx:id} of the control.
|
||||
*
|
||||
* @param control the control id
|
||||
*/
|
||||
public void setControl(String control) {
|
||||
this.control = control;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the control property name, such as {@code text}.
|
||||
*
|
||||
* @param property the property name
|
||||
*/
|
||||
public void setProperty(String property) {
|
||||
this.property = property;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the Path. One name is an Attribute of this View's ViewModel.
|
||||
*
|
||||
* @param path the path
|
||||
*/
|
||||
public void setPath(String path) {
|
||||
this.path = path;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the direction. Accepted values are {@code view}, {@code model}, and {@code both}.
|
||||
*
|
||||
* @param direction the direction value
|
||||
*/
|
||||
public void setDirection(String direction) {
|
||||
this.direction = direction;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the Converter class name. The container creates that class.
|
||||
*
|
||||
* @param converter the converter class name, or {@code null} when values pass through
|
||||
*/
|
||||
public void setConverter(String converter) {
|
||||
this.converter = converter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the {@code fx:id} of the control.
|
||||
*
|
||||
* @return the control id
|
||||
*/
|
||||
public String getControl() {
|
||||
return control;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the control property name.
|
||||
*
|
||||
* @return the property name
|
||||
*/
|
||||
public String getProperty() {
|
||||
return property;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Path.
|
||||
*
|
||||
* @return the path
|
||||
*/
|
||||
public String getPath() {
|
||||
return path;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the direction value.
|
||||
*
|
||||
* @return {@code view}, {@code model}, or {@code both}
|
||||
*/
|
||||
public String getDirection() {
|
||||
return direction;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Converter class name.
|
||||
*
|
||||
* @return the class name, or {@code null} when values pass through
|
||||
*/
|
||||
public String getConverter() {
|
||||
return converter;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
package de.neitzel.fx.view;
|
||||
|
||||
import de.neitzel.injection.ApplicationContext;
|
||||
import javafx.beans.property.Property;
|
||||
import javafx.collections.ObservableList;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import javafx.beans.property.Property;
|
||||
import javafx.collections.ObservableList;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
/**
|
||||
* Connects one Direct binding to a control property and a ViewModel Attribute.
|
||||
@@ -93,6 +94,7 @@ final class DirectBindingApplier {
|
||||
* {@code name} is the last segment. A conversion failure is recorded on {@code owner} with that
|
||||
* name as the source, so a parent only carries the extended copy.
|
||||
*/
|
||||
@RequiredArgsConstructor(access = AccessLevel.PRIVATE)
|
||||
private static final class Resolved {
|
||||
|
||||
/**
|
||||
@@ -115,20 +117,6 @@ final class DirectBindingApplier {
|
||||
*/
|
||||
private final String name;
|
||||
|
||||
/**
|
||||
* Records one resolved Path.
|
||||
*
|
||||
* @param attribute the Attribute
|
||||
* @param complex whether the Attribute is complex
|
||||
* @param owner the ViewModel that owns it
|
||||
* @param name the last segment
|
||||
*/
|
||||
private Resolved(Property<?> attribute, boolean complex, ViewModel owner, String name) {
|
||||
this.attribute = attribute;
|
||||
this.complex = complex;
|
||||
this.owner = owner;
|
||||
this.name = name;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,15 +2,20 @@ package de.neitzel.fx.view;
|
||||
|
||||
import javafx.beans.property.Property;
|
||||
import javafx.scene.Parent;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
/**
|
||||
* The scene-graph root and ViewModel produced by loading a View for a Model instance.
|
||||
*/
|
||||
@RequiredArgsConstructor(access = AccessLevel.PACKAGE)
|
||||
public final class LoadedView {
|
||||
|
||||
/**
|
||||
* The scene-graph root of the loaded View.
|
||||
*/
|
||||
@Getter
|
||||
private final Parent root;
|
||||
|
||||
/**
|
||||
@@ -18,27 +23,6 @@ public final class LoadedView {
|
||||
*/
|
||||
private final Object viewModel;
|
||||
|
||||
/**
|
||||
* Creates the result of one load.
|
||||
*
|
||||
* @param root the scene-graph root
|
||||
* @param viewModel the ViewModel built for the Model instance, or a replacement that exposes
|
||||
* JavaFX properties by name
|
||||
*/
|
||||
LoadedView(Parent root, Object viewModel) {
|
||||
this.root = root;
|
||||
this.viewModel = viewModel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the scene-graph root.
|
||||
*
|
||||
* @return the root
|
||||
*/
|
||||
public Parent getRoot() {
|
||||
return root;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the ViewModel the View is bound to.
|
||||
* <p>
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package de.neitzel.fx.view;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* A notice on a ViewModel with a severity, a text, and a source.
|
||||
*/
|
||||
@@ -22,16 +24,19 @@ public final class Message {
|
||||
/**
|
||||
* How serious the notice is.
|
||||
*/
|
||||
@Getter
|
||||
private final Severity severity;
|
||||
|
||||
/**
|
||||
* The notice text. A binding failure updates this in place.
|
||||
*/
|
||||
@Getter
|
||||
private String text;
|
||||
|
||||
/**
|
||||
* Where the notice came from, such as a binding Path.
|
||||
*/
|
||||
@Getter
|
||||
private final String source;
|
||||
|
||||
/**
|
||||
@@ -52,33 +57,6 @@ public final class Message {
|
||||
this.source = source;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns how serious the notice is.
|
||||
*
|
||||
* @return the severity
|
||||
*/
|
||||
public Severity getSeverity() {
|
||||
return severity;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the notice text.
|
||||
*
|
||||
* @return the text
|
||||
*/
|
||||
public String getText() {
|
||||
return text;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns where the notice came from.
|
||||
*
|
||||
* @return the source
|
||||
*/
|
||||
public String getSource() {
|
||||
return source;
|
||||
}
|
||||
|
||||
/**
|
||||
* Replaces the text of a binding failure that is already in the list.
|
||||
*
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
package de.neitzel.fx.view;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* A repeat element declared in a {@link BindingList}.
|
||||
* <p>
|
||||
@@ -7,6 +10,8 @@ package de.neitzel.fx.view;
|
||||
* Attribute. The library keeps one Component child in that pane for each Model instance, in
|
||||
* list order.
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
public class Repeat {
|
||||
|
||||
/**
|
||||
@@ -24,57 +29,4 @@ public class Repeat {
|
||||
*/
|
||||
private String collection;
|
||||
|
||||
/**
|
||||
* Sets the {@code fx:id} of the pane that holds the Component children.
|
||||
*
|
||||
* @param pane the pane id
|
||||
*/
|
||||
public void setPane(String pane) {
|
||||
this.pane = pane;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the Component class name. Each element gets a new instance of that class.
|
||||
*
|
||||
* @param component the class name
|
||||
*/
|
||||
public void setComponent(String component) {
|
||||
this.component = component;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the collection Attribute name. The list holds the Model instances.
|
||||
*
|
||||
* @param collection the attribute name
|
||||
*/
|
||||
public void setCollection(String collection) {
|
||||
this.collection = collection;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the {@code fx:id} of the pane.
|
||||
*
|
||||
* @return the pane id
|
||||
*/
|
||||
public String getPane() {
|
||||
return pane;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Component class name.
|
||||
*
|
||||
* @return the class name
|
||||
*/
|
||||
public String getComponent() {
|
||||
return component;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the collection Attribute name.
|
||||
*
|
||||
* @return the attribute name
|
||||
*/
|
||||
public String getCollection() {
|
||||
return collection;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,24 @@
|
||||
package de.neitzel.fx.view;
|
||||
|
||||
import de.neitzel.injection.ApplicationContext;
|
||||
import java.beans.PropertyDescriptor;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.time.Instant;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeParseException;
|
||||
import java.time.temporal.TemporalAccessor;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Comparator;
|
||||
import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
import java.util.IdentityHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import javafx.beans.DefaultProperty;
|
||||
import javafx.beans.property.ObjectProperty;
|
||||
import javafx.beans.property.Property;
|
||||
@@ -23,25 +41,8 @@ import javafx.scene.layout.Priority;
|
||||
import javafx.scene.layout.Region;
|
||||
import javafx.scene.layout.VBox;
|
||||
import javafx.scene.text.Text;
|
||||
|
||||
import java.beans.PropertyDescriptor;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.time.Instant;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeParseException;
|
||||
import java.time.temporal.TemporalAccessor;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashSet;
|
||||
import java.util.IdentityHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* A collection shown with one Component for each element.
|
||||
@@ -98,6 +99,8 @@ public class Table extends VBox {
|
||||
/**
|
||||
* The collection Attribute.
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
private String collection;
|
||||
|
||||
/**
|
||||
@@ -108,6 +111,7 @@ public class Table extends VBox {
|
||||
/**
|
||||
* The Columns, in declared order.
|
||||
*/
|
||||
@Getter
|
||||
private final ObservableList<Column> columns = FXCollections.observableArrayList();
|
||||
|
||||
/**
|
||||
@@ -258,24 +262,6 @@ public class Table extends VBox {
|
||||
buildSortCommands();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the collection Attribute.
|
||||
*
|
||||
* @param collection the collection Attribute
|
||||
*/
|
||||
public void setCollection(String collection) {
|
||||
this.collection = collection;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the collection Attribute.
|
||||
*
|
||||
* @return the collection Attribute
|
||||
*/
|
||||
public String getCollection() {
|
||||
return collection;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the Row class name.
|
||||
*
|
||||
@@ -294,15 +280,6 @@ public class Table extends VBox {
|
||||
return rowClass;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Columns in declared order.
|
||||
*
|
||||
* @return the Columns
|
||||
*/
|
||||
public ObservableList<Column> getColumns() {
|
||||
return columns;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the selection property.
|
||||
* <p>
|
||||
|
||||
@@ -1,25 +1,5 @@
|
||||
package de.neitzel.fx.view;
|
||||
|
||||
import javafx.beans.property.BooleanProperty;
|
||||
import javafx.beans.property.DoubleProperty;
|
||||
import javafx.beans.property.FloatProperty;
|
||||
import javafx.beans.property.IntegerProperty;
|
||||
import javafx.beans.property.LongProperty;
|
||||
import javafx.beans.property.Property;
|
||||
import javafx.beans.property.SimpleBooleanProperty;
|
||||
import javafx.beans.property.SimpleDoubleProperty;
|
||||
import javafx.beans.property.SimpleFloatProperty;
|
||||
import javafx.beans.property.SimpleIntegerProperty;
|
||||
import javafx.beans.property.SimpleLongProperty;
|
||||
import javafx.beans.property.SimpleObjectProperty;
|
||||
import javafx.beans.property.SimpleStringProperty;
|
||||
import javafx.beans.property.StringProperty;
|
||||
import javafx.beans.value.ChangeListener;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.beans.BeanInfo;
|
||||
import java.beans.IntrospectionException;
|
||||
import java.beans.Introspector;
|
||||
@@ -42,6 +22,24 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.function.Consumer;
|
||||
import javafx.beans.property.BooleanProperty;
|
||||
import javafx.beans.property.DoubleProperty;
|
||||
import javafx.beans.property.FloatProperty;
|
||||
import javafx.beans.property.IntegerProperty;
|
||||
import javafx.beans.property.LongProperty;
|
||||
import javafx.beans.property.Property;
|
||||
import javafx.beans.property.SimpleBooleanProperty;
|
||||
import javafx.beans.property.SimpleDoubleProperty;
|
||||
import javafx.beans.property.SimpleFloatProperty;
|
||||
import javafx.beans.property.SimpleIntegerProperty;
|
||||
import javafx.beans.property.SimpleLongProperty;
|
||||
import javafx.beans.property.SimpleObjectProperty;
|
||||
import javafx.beans.property.SimpleStringProperty;
|
||||
import javafx.beans.property.StringProperty;
|
||||
import javafx.beans.value.ChangeListener;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* The object a View binds to, built at runtime for one Model instance.
|
||||
@@ -75,13 +73,9 @@ import java.util.function.Consumer;
|
||||
* status bar unless the developer asks. {@link MessagePopup#showNewMessages} shows each newly added
|
||||
* Message in a dialog. An in-place update does not.
|
||||
*/
|
||||
@Slf4j
|
||||
public class ViewModel {
|
||||
|
||||
/**
|
||||
* Receives error and fatal notices. Info and warn are not logged.
|
||||
*/
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(ViewModel.class);
|
||||
|
||||
/**
|
||||
* The Model instance this ViewModel was built for.
|
||||
*/
|
||||
@@ -770,7 +764,7 @@ public class ViewModel {
|
||||
private static void logSevere(Message message) {
|
||||
Message.Severity severity = message.getSeverity();
|
||||
if (severity == Message.Severity.ERROR || severity == Message.Severity.FATAL) {
|
||||
LOGGER.error(message.getText());
|
||||
log.error(message.getText());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,13 +3,13 @@ package de.neitzel.gson.config;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import lombok.Builder;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import lombok.Builder;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
/**
|
||||
* Represents a configuration utility class that manages application settings and allows
|
||||
@@ -20,6 +20,7 @@ import java.util.Map;
|
||||
* the configuration on the filesystem and retrieve it as needed.
|
||||
*/
|
||||
@Builder(builderClassName = "ConfigurationBuilder")
|
||||
@RequiredArgsConstructor
|
||||
public class JsonConfiguration {
|
||||
/**
|
||||
* The name of the application.
|
||||
@@ -66,21 +67,6 @@ public class JsonConfiguration {
|
||||
*/
|
||||
private final Gson gson;
|
||||
|
||||
/**
|
||||
* Constructs a new {@code JsonConfiguration} instance with the specified parameters.
|
||||
*
|
||||
* @param appName the name of the application
|
||||
* @param homeDir the home directory path for the application
|
||||
* @param settings a map containing configuration settings as key-value pairs
|
||||
* @param gson the Gson instance used for JSON serialization and deserialization
|
||||
*/
|
||||
public JsonConfiguration(String appName, String homeDir, Map<String, String> settings, Gson gson) {
|
||||
this.appName = appName;
|
||||
this.homeDir = homeDir;
|
||||
this.settings = settings;
|
||||
this.gson = gson;
|
||||
}
|
||||
|
||||
/**
|
||||
* Stores a key-value pair into the configuration settings.
|
||||
* The value is serialized into a JSON string before being stored.
|
||||
|
||||
@@ -3,8 +3,6 @@ package de.neitzel.injection;
|
||||
import jakarta.inject.Inject;
|
||||
import jakarta.inject.Named;
|
||||
import jakarta.inject.Singleton;
|
||||
import org.reflections.Reflections;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
@@ -15,6 +13,8 @@ import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import lombok.Getter;
|
||||
import org.reflections.Reflections;
|
||||
|
||||
/**
|
||||
* Scans a base package for Jakarta CDI-style components and derives dependency-injection metadata.
|
||||
@@ -63,6 +63,7 @@ public class ComponentScanner {
|
||||
* in the dependency injection system, ensuring that only resolvable, uniquely identifiable
|
||||
* components can be instantiated and injected.
|
||||
*/
|
||||
@Getter
|
||||
private final Set<Class<?>> notUniqueTypes = new HashSet<>();
|
||||
|
||||
/**
|
||||
@@ -93,6 +94,7 @@ public class ComponentScanner {
|
||||
* Errors added to this list provide detailed descriptions of the specific
|
||||
* issues that prevent certain components from being instantiated correctly.
|
||||
*/
|
||||
@Getter
|
||||
private final List<String> errors = new ArrayList<>();
|
||||
|
||||
/**
|
||||
@@ -115,6 +117,7 @@ public class ComponentScanner {
|
||||
* This map includes concrete component classes as keys and, where unique, their injectable
|
||||
* super types (interfaces/superclasses) as additional keys.
|
||||
*/
|
||||
@Getter
|
||||
private final Map<Class<?>, ComponentData> instantiableComponents = new HashMap<>();
|
||||
|
||||
/**
|
||||
@@ -530,34 +533,6 @@ public class ComponentScanner {
|
||||
return !instantiableComponents.containsKey(type) && !notUniqueTypes.contains(type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the mapping of resolvable injectable types to their {@link ComponentData}.
|
||||
*
|
||||
* @return a map of types to instantiation/injection metadata
|
||||
*/
|
||||
public Map<Class<?>, ComponentData> getInstantiableComponents() {
|
||||
return instantiableComponents;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the set of super types (interfaces/superclasses) that are implemented by multiple
|
||||
* components and therefore cannot be uniquely resolved.
|
||||
*
|
||||
* @return set of non-unique injectable types
|
||||
*/
|
||||
public Set<Class<?>> getNotUniqueTypes() {
|
||||
return notUniqueTypes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns collected errors discovered during scanning and resolution.
|
||||
*
|
||||
* @return list of human-readable error messages
|
||||
*/
|
||||
public List<String> getErrors() {
|
||||
return errors;
|
||||
}
|
||||
|
||||
/**
|
||||
* Immutable description of how to inject a component.
|
||||
*
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
# Keep JavaBean/FXML conventions independent of workstation-level configuration.
|
||||
config.stopBubbling = true
|
||||
@@ -1,6 +1,8 @@
|
||||
package de.neitzel.net.imap;
|
||||
|
||||
import java.util.Objects;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* Represents an IMAP account with server configuration, user credentials, and protocol details.
|
||||
@@ -8,6 +10,8 @@ import java.util.Objects;
|
||||
* representation, equality checks, and hashing.
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
@Getter
|
||||
@Setter
|
||||
public class ImapAccount {
|
||||
|
||||
/**
|
||||
@@ -43,78 +47,6 @@ public class ImapAccount {
|
||||
// default constructor only
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the server address associated with this IMAP
|
||||
*
|
||||
* @return the server address as a String.
|
||||
*/
|
||||
public String getServer() {
|
||||
return server;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the server address for the IMAP account.
|
||||
*
|
||||
* @param server the server address to be configured for the IMAP account
|
||||
*/
|
||||
public void setServer(String server) {
|
||||
this.server = server;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the username associated with this IMAP account.
|
||||
*
|
||||
* @return the username of the IMAP account as a String.
|
||||
*/
|
||||
public String getUser() {
|
||||
return user;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the username associated with the IMAP account.
|
||||
*
|
||||
* @param user The username to be set for this IMAP account.
|
||||
*/
|
||||
public void setUser(String user) {
|
||||
this.user = user;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the password associated with this IMAP account.
|
||||
*
|
||||
* @return the password of the IMAP account.
|
||||
*/
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the password for the IMAP account.
|
||||
*
|
||||
* @param password The password to be set for the account.
|
||||
*/
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the protocol used by this IMAP account.
|
||||
*
|
||||
* @return the protocol as a String, which defines the communication method for the IMAP account.
|
||||
*/
|
||||
public String getProtocol() {
|
||||
return protocol;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the protocol used by the IMAP account.
|
||||
*
|
||||
* @param protocol the protocol to be used, e.g., "IMAP" or "IMAPS".
|
||||
*/
|
||||
public void setProtocol(String protocol) {
|
||||
this.protocol = protocol;
|
||||
}
|
||||
|
||||
/**
|
||||
* Computes the hash code for this instance of the ImapAccount class.
|
||||
* The hash code is based on the values of the server, user, password, and protocol fields.
|
||||
|
||||
@@ -266,6 +266,33 @@
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<!-- Javadoc reads source without annotation processing. Expand Lombok only
|
||||
for documentation; compile the original sources as before. -->
|
||||
<plugin>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok-maven-plugin</artifactId>
|
||||
<version>1.18.20.0</version>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>${lombok.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<configuration>
|
||||
<sourceDirectory>${project.build.sourceDirectory}</sourceDirectory>
|
||||
<outputDirectory>${project.build.directory}/delombok</outputDirectory>
|
||||
<addOutputDirectory>false</addOutputDirectory>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>expand-lombok-for-javadoc</id>
|
||||
<phase>process-classes</phase>
|
||||
<goals><goal>delombok</goal></goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
@@ -277,7 +304,7 @@
|
||||
<goal>jar</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<sourcepath>${project.build.sourceDirectory}</sourcepath>
|
||||
<sourcepath>${project.build.directory}/delombok</sourcepath>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
@@ -346,6 +373,9 @@
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>${maven.javadoc.plugin}</version>
|
||||
<configuration>
|
||||
<sourcepath>${project.build.directory}/delombok</sourcepath>
|
||||
</configuration>
|
||||
<reportSets>
|
||||
<reportSet>
|
||||
<reports>
|
||||
|
||||
Reference in New Issue
Block a user