Top Description Inners Fields Constructors Methods
com.dlsc.showcase

public Class CssShowcaseView

extends Control
Class Inheritance
Imports
com.dlsc.showcase.impl.CssShowcaseViewSkin, fr.brouillard.oss.cssfx.CSSFX, fr.brouillard.oss.cssfx.api.URIToPathConverter, javafx.beans.Observable, javafx.beans.property.ListProperty, .ObjectProperty, .SimpleListProperty, .SimpleObjectProperty, javafx.collections.FXCollections, .ObservableList, javafx.scene.control.Control, .Skin, .Tab, javafx.scene.input.TransferMode, java.io.File, java.net.MalformedURLException, .URI, .URISyntaxException, java.nio.file.Path, .Paths, java.util.ArrayList, .List, java.util.stream.Collectors

A control that showcases all JavaFX controls individually and in combination with each other. Different stylesheet configurations can be assigned to the view so that developers can immediately see the impact of any changes they make to their styling code.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class

Field Summary

Modifier and TypeField and Description
private final ListProperty<Tab>
private final ListProperty<CssShowcaseView.CssConfiguration>
private static URIToPathConverter
ISO_FILE_CONVERTER

CSSFX fake converter that returns the same file as the one provided.

private final ObjectProperty<CssShowcaseView.CssConfiguration>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public ListProperty<Tab>

Returns:

list of additional tabs
additionalTabsProperty
()

A list of application specific tabs that will be added to the built-in tabs.

public final ListProperty<CssShowcaseView.CssConfiguration>

Returns:

the list of available configurations
configurationsProperty
()

Stores a list of stylesheet configurations that the user can select individually.

protected Skin<?>
createDefaultSkin()

Overrides javafx.scene.control.Control.createDefaultSkin.

Create a new instance of the default skin for this control.

public ObservableList<Tab>
public final ObservableList<CssShowcaseView.CssConfiguration>
public final CssShowcaseView.CssConfiguration
public String
getUserAgentStylesheet()

Overrides javafx.scene.layout.Region.getUserAgentStylesheet.

An implementation may specify its own user-agent styles for this Region, and its children, by overriding this method.

public final ObjectProperty<CssShowcaseView.CssConfiguration>

Returns:

the currently active configuration
selectedConfigurationProperty
()

The currently selected CSS configuration.

public void
public final void
public final void
Inherited from javafx.scene.control.Control:
computeMaxHeightcomputeMaxWidthcomputeMinHeightcomputeMinWidthcomputePrefHeightcomputePrefWidthcontextMenuPropertyexecuteAccessibleActiongetBaselineOffsetgetClassCssMetaDatagetContextMenugetControlCssMetaDatagetCssMetaDatagetInitialFocusTraversablegetSkingetTooltipisResizablelayoutChildrenqueryAccessibleAttributesetContextMenusetSkinsetTooltipskinPropertytooltipProperty

Field Detail

additionalTabsback to summary
private final ListProperty<Tab> additionalTabs
configurationsback to summary
private final ListProperty<CssShowcaseView.CssConfiguration> configurations
ISO_FILE_CONVERTERback to summary
private static URIToPathConverter ISO_FILE_CONVERTER

CSSFX fake converter that returns the same file as the one provided. By doing that changes in that file will be handled automatically by CSSFX

selectedConfigurationback to summary
private final ObjectProperty<CssShowcaseView.CssConfiguration> selectedConfiguration

Constructor Detail

CssShowcaseViewback to summary
public CssShowcaseView()

Method Detail

additionalTabsPropertyback to summary
public ListProperty<Tab> additionalTabsProperty()

A list of application specific tabs that will be added to the built-in tabs.

Returns:ListProperty<Tab>

list of additional tabs

configurationsPropertyback to summary
public final ListProperty<CssShowcaseView.CssConfiguration> configurationsProperty()

Stores a list of stylesheet configurations that the user can select individually.

Returns:ListProperty<CssShowcaseView.CssConfiguration>

the list of available configurations

See Also
selectedConfigurationProperty()
createDefaultSkinback to summary
protected Skin<?> createDefaultSkin()

Overrides javafx.scene.control.Control.createDefaultSkin.

Doc from javafx.scene.control.Control.createDefaultSkin.

Create a new instance of the default skin for this control. This is called to create a skin for the control if no skin is provided via CSS -fx-skin or set explicitly in a sub-class with setSkin(...).

Returns:Skin<?>

new instance of default skin for this control. If null then the control will have no skin unless one is provided by css.

Annotations
@Override
getAdditionalTabsback to summary
public ObservableList<Tab> getAdditionalTabs()
getConfigurationsback to summary
public final ObservableList<CssShowcaseView.CssConfiguration> getConfigurations()
getSelectedConfigurationback to summary
public final CssShowcaseView.CssConfiguration getSelectedConfiguration()
getUserAgentStylesheetback to summary
public String getUserAgentStylesheet()

Overrides javafx.scene.layout.Region.getUserAgentStylesheet.

Doc from javafx.scene.layout.Region.getUserAgentStylesheet.

An implementation may specify its own user-agent styles for this Region, and its children, by overriding this method. These styles are used in addition to whatever user-agent stylesheets are in use. This provides a mechanism for third parties to introduce styles for custom controls.

The URL is a hierarchical URI of the form [scheme:][//authority][path]. If the URL does not have a [scheme:] component, the URL is considered to be the [path] component only. Any leading '/' character of the [path] is ignored and the [path] is treated as a path relative to the root of the application's classpath.

Subclasses overriding this method should not assume any particular implementation approach as to the number and frequency with which it is called. For this reason, attempting any kind of dynamic implementation (i.e. returning different user agent stylesheet values) based on some state change is highly discouraged, as there is no guarantee when, or even if, this method will be called. Some JavaFX CSS implementations may choose to cache this response for an indefinite period of time, and therefore there should be no expectation around when this method is called.



package com.example.javafx.app;

import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.stage.Stage;

public class MyApp extends Application {

    @Override public void start(Stage stage) {
        Scene scene = new Scene(new Group());
        scene.getStylesheets().add("/com/example/javafx/app/mystyles.css");
        stage.setScene(scene);
        stage.show();
    }

    public static void main(String[] args) {
        launch(args);
    }
}
For additional information about using CSS with the scene graph, see the CSS Reference Guide.
Returns:String

A string URL

Annotations
@Override
selectedConfigurationPropertyback to summary
public final ObjectProperty<CssShowcaseView.CssConfiguration> selectedConfigurationProperty()

The currently selected CSS configuration.

Returns:ObjectProperty<CssShowcaseView.CssConfiguration>

the currently active configuration

setAdditionalTabsback to summary
public void setAdditionalTabs(ObservableList<Tab> additionalTabs)
setConfigurationsback to summary
public final void setConfigurations(ObservableList<CssShowcaseView.CssConfiguration> configurations)
setSelectedConfigurationback to summary
public final void setSelectedConfiguration(CssShowcaseView.CssConfiguration selectedConfiguration)
com.dlsc.showcase back to summary

public Class CssShowcaseView.CssConfiguration

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
private String
private List<String>

Constructor Summary

AccessConstructor and Description
public
CssConfiguration(String
the name of the configuration, e.g. "My three custom stylesheets".
name
)

Constructs a new configuration.

public
CssConfiguration(String
the name of the configuration, e.g. "My three custom stylesheets".
name
,
String...
one or more stylesheet URLs to add to the configuration
url
)

Constructs a new configuration.

Method Summary

Modifier and TypeMethod and Description
public String

Returns:

the configuration name
getName
()

Returns the name of the configuration.

public List<String>

Returns:

the list of stylesheet URLs
getStylesheetUrls
()

Returns the list of stylesheet URLs added to this configuration

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

nameback to summary
private String name
stylesheetUrlsback to summary
private List<String> stylesheetUrls

Constructor Detail

CssConfigurationback to summary
public CssConfiguration(String name)

Constructs a new configuration. Stylesheet URLs have to be added by calling getStylesheetUrls() and adding to the list.

Parameters
name:String

the name of the configuration, e.g. "My three custom stylesheets".

CssConfigurationback to summary
public CssConfiguration(String name, String... url)

Constructs a new configuration. Stylesheet URLs have to be added by calling getStylesheetUrls() and adding to the list.

Parameters
name:String

the name of the configuration, e.g. "My three custom stylesheets".

url:String[]

one or more stylesheet URLs to add to the configuration

Method Detail

getNameback to summary
public String getName()

Returns the name of the configuration.

Returns:String

the configuration name

getStylesheetUrlsback to summary
public List<String> getStylesheetUrls()

Returns the list of stylesheet URLs added to this configuration

Returns:List<String>

the list of stylesheet URLs