mit einem Klick
javafx-patterns
// JavaFX patterns for Xeres including controller structure with FXML views, WindowController lifecycle, WindowManager usage, and JavaFX-Spring integration.
// JavaFX patterns for Xeres including controller structure with FXML views, WindowController lifecycle, WindowManager usage, and JavaFX-Spring integration.
ArchUnit architecture rules enforced in Xeres including common module rules (logging, utility classes), app module rules (no field injection, RsService naming), and UI module rules (WindowController naming).
Cryptography patterns for Xeres including PGP operations, key generation, and hash functions with best practices.
DTO and mapper patterns for Xeres using Java records, canonical constructors with validation, and static mapper utility classes.
Flyway SQL migration patterns for Xeres including naming conventions, H2 database patterns, enum types, foreign keys, and best practices.
Gradle build configuration for Xeres including build commands, version management, module structure, and key plugins.
Code style, naming conventions, license headers, and patterns for Xeres Java project. Covers Allman braces, utility classes, package structure, and field injection rules.
| name | javafx-patterns |
| description | JavaFX patterns for Xeres including controller structure with FXML views, WindowController lifecycle, WindowManager usage, and JavaFX-Spring integration. |
Controllers are Spring components with FXML views:
@Component
@FxmlView(value = "/view/contact/contact_view.fxml")
public class ContactViewController implements Controller
{
@FXML
private TreeTableView<Contact> contactTreeTableView;
@Override
public void initialize()
{ ...}
}
For windows/dialogs, implement WindowController interface:
@Component
@FxmlView(value = "/view/settings/settings_window.fxml")
public class SettingsWindowController implements WindowController
{
@Override
public void onShowing()
{ ...}
@Override
public void onShown()
{ ...}
@Override
public void onClose()
{ ...}
}
Naming convention: *WindowController
Use WindowManager for window lifecycle.
public class JavaFxApplication extends Application
{
private ConfigurableApplicationContext springContext;
@Override
public void init()
{
springContext = new SpringApplicationBuilder()
.sources(springApplicationClass)
.headless(false)
.initializers(initializers())
.run(getParameters().getRaw().toArray(new String[0]));
}
}
Never call FileChooser.setInitialDirectory() directly. Use ChooserUtils:
// Bad
fileChooser.setInitialDirectory(someDirectory);
// Good
ChooserUtils.
setInitialDirectory(fileChooser, someDirectory);
ui/src/main/resources/view/<feature>/<feature>_view.fxml
ui/src/main/resources/view/<feature>/<feature>_window.fxml (for dialogs)
Use JavaFX properties for observable data:
private final StringProperty nameProperty = new SimpleStringProperty();
private final ObjectProperty<Profile> selectedProfile = new SimpleObjectProperty<>();
Dispatch events through Spring's ApplicationEventPublisher:
public record ContactSelectedEvent(Contact contact)
{
}