• Home
    • View
    • Login
    This page
    • Normal
    • Export PDF
    • Page Information

    Loading...
  1. Dashboard
  2. Undefined Space
  3. OpenJFX
  4. CSS API to support custom UI Controls

Page History

Versions Compared

Old Version 10

changes.mady.by.user J. Duke

Saved on Dec 06, 2012

compared with

New Version 11

changes.mady.by.user J. Duke

Saved on Dec 10, 2012

  • Previous Change: Difference between versions 9 and 10
  • Next Change: Difference between versions 11 and 12
  • View Page History

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

CSS is an integral part of JavaFX but heretofore has been implemented exclusively in private API within, primarily, the com.sun.javafx.css package. Adding a styleable property or pseudo-class state in JavaFX is fairly straight-forward and exposing certain elements of the internal API will facilitate the development of custom UI controls in the open source environment. This document outlines this public API.

Use Case

Say a contributor wished to develop a Watermark control which could overlay a region and present a widget for obtaining copyright information. The Watermark API has a StringProperty cornerProperty that controls which corner of the region the widget is to be displayed. The contributor wishes to make this cornerProperty styleable through CSS.

Design Goals

The primary goal is to create an API that allows CSS styling to be applied to a JavaFX property. The API should support the following javafx.beans.property types: BooleanProperty, FloatProperty, DoubleProperty, IntegerProperty, LongProperty, and StringProperty. Support for ObjectProperty is desired but would, possibly, require additional hooks into the parser or public API to convert a parsed value to the parameterized type which may not be feasible at this time. However, the ability to style an ObjectProperty with a parameterized type such as Insets or Paint is essential.

...

The current implementation of CSS in JavaFX is only a small portion of the W3C standards and is only partially compliant with those standards. It is beyond the scope of this API implementation to rectify differences between the W3C standards and the current JavaFX implementation.

Use Case

Say a contributor wished to develop a Watermark control which could overlay a region and present a widget for obtaining copyright information. The Watermark API has a StringProperty cornerProperty that controls which corner of the region the widget is to be displayed. The contributor wishes to make this cornerProperty styleable through CSS.

Architecture

There are two main pieces to the architecture. First is a StyleablePropertyMetaData whose value can be represented syntactically in a .css file. A StyleablePropertyMetaData encapsulates the CSS property name, the type into which the string value is converted, and the default value of the property. Second is the JavaFX property to which the parsed StyleablePropertyMetaData value applies. Any JavaFX property that supports this styling is a StyleableProperty. A StyleableProperty also incorporates additional logic to ensure that values set by the user through calls to set methods are not overridden by styles in a user agent stylesheet.

...

Overview
Content Tools
ThemeBuilder

Terms of Use
• License: GPLv2
• Privacy • Trademarks • Contact Us

Powered by a free Atlassian Confluence Open Source Project License granted to https://www.atlassian.com/software/views/opensource-community-additional-license-offer. Evaluate Confluence today.

  • Kolekti ThemeBuilder Powered by Atlassian Confluence 8.5.23
  • Kolekti ThemeBuilder printed.by.atlassian.confluence
  • Report a bug
  • Atlassian News
Atlassian
Kolekti ThemeBuilder EngineAtlassian Confluence
{"serverDuration": 924, "requestCorrelationId": "d4a4f384b818d16a"}