PatternFly Java 0.4.11 API

PatternFly Java

PatternFly Java is a 💯 Java implementation of PatternFly without any JavaScript dependencies (except for charts).

PatternFly Java's Its goal is to provide an easy-to-use, elegant, and efficient API to build complex web applications with PatternFly in Java. PatternFly Java integrates with and builds upon Elemento's builder API. It works with both GWT and J2CL.

API Design

PatternFly Java integrates with and builds upon Elemento's builder API. Static factory methods are used to create the components, and public instance methods add child elements and modify the component.

Static Factory Methods

These methods are used to create a component. They are usually named after the component, are overloaded to accept required and optional arguments, and return an instance of the newly created component:

Button button1 = button("Click me!");
Button button2 = button("PatternFly", "https://www.patternfly.org");

Add Methods

These methods add subcomponents to a main component. They are usually called add<SubComponent>() and return the main component so that the method call can be chained with other methods:

Dropdown dropdown = dropdown()
        .addToggle(menuToggle("Dropdown"))
        .addMenu(menu()
                .addContent(menuContent()
                        .addList(menuList()
                                .addItem(actionMenuItem("item-0", "Action")))));

Builder / Modifier Methods

These methods modify the current component. They return the current component so that the method call can be chained with other methods:

Card card = card()
        .flat()
        .rounded()
        .large();

These methods set ARIA-related attributes in the component. They're usually named aria<Attribute>() and return the component so that the method call can be chained with other methods:

Navigation navigation = navigation(flat)
        .ariaScrollBackLabel("� back")
        .ariaScrollForwardLabel("� forward");

Event Handlers

These methods add event handlers for various events to the component. They are usually named on<Event>(), accept an event handler, and return the component so that the method call can be chained with other methods. PatternFly Java defines some common event handlers that are reused in all components.

Drawer drawer = drawer().id("drw")
        .onToggle((e, c, expanded) -> console.log("Drawer expanded: " + expanded));

Common Interfaces

Common behavior across all components is implemented by base classes and interfaces. All components extend from either BaseComponent or BaseComponentSVG. These base classes implement interfaces from Elemento to manipulate the component element.

In addition, components implement these interfaces to provide a common API:

  • Modifiers The sub-interfaces defined in this 'umbrella' interface are used to toggle one specific flag of a component. For example, card().plain() toggles the plain flag of the card component and is defined in the Modifiers.Plain interface.
  • Closeable Implemented by components that provide some kind of popup that can be closed.
  • ComponentContext, HasIdentifier, and HasItems These interfaces are often implemented by components that have a parent-child relationship.
  • ComponentIcon and ComponentIconAndText  These interfaces are implemented by components that provide text resp. an icon and a text.
  • ComponentProgress Implemented by components that provide some kind of progress.
  • Expandable Implemented by components that provide some kind of expandable content.
  • HasValue and HasObservableValue These interfaces are implemented by components that provide a value or an observable value.

Modules

PatternFly Java consists of these Maven modules (a-z):

PatternFly Java Module Dependencies

Module Description
patternfly-java-bom Bill of materials
patternfly-java-codeeditor PatternFly codeeditor
patternfly-java-components PatternFly components
patternfly-java-core Core PatternFly Java classes
patternfly-java-finder PatternFly Java Finder extension
patternfly-java-gwt PatternFly Java for GWT
patternfly-java-icons PatternFly Java icons
patternfly-java-j2cl PatternFly Java for J2CL
patternfly-java-layouts PatternFly Java layouts
Packages
Package
Description
 
 
 
 
Provides PatternFly component implementations for building web applications in Java.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Core classes and interfaces for PatternFly Java.
Data provider API for managing items and state in data-driven components.
 
 
Flexible filtering API for objects with support for multiple attributes and operators.
Common event handler interfaces used throughout PatternFly Java components.
Provides classes and interfaces for working with predefined SVG icons in PatternFly Java.
PatternFly layouts provide structure and positioning for content on a page.
 
 
 
 
 
 
 
Java wrapper for Popper.js positioning engine used by overlay components.
Styling utilities including CSS classes, modifiers, breakpoints, and CSS variables.
PatternFly design tokens for Java.