- All Implemented Interfaces:
Styleable,EventTarget,Skinnable
A control to display multiple error messages inside a window.
The error messages will be added through a call to
addMessage()
and they can be removed again by calling
removeMessage(). The id identifies the
respective message.
The messages are displayed in the sequence they were added.
To automate the display of error messages, you can create a message
trigger, by calling
addMessageTrigger().
The id of the trigger is also the id of the message that is controlled
through the message trigger.
The messages itself are displayed through instances of
Label
that has the CSS Style Class
"errorDisplay".
- Note:
-
- The minimum height for an
ErrorDisplaycontrol is 55.0. The vertical scrollbar does not work properly for smaller values.
- The minimum height for an
- Author:
- Thomas Thrien (thomas.thrien@tquadrat.org)
- Version:
- $Id: ErrorDisplay.java 1112 2024-03-10 14:16:51Z tquadrat $
- Since:
- 0.4.3
- UML Diagram
-
UML Diagram for "org.tquadrat.foundation.fx.control.ErrorDisplay"
-
Property Summary
PropertiesTypePropertyDescriptionfinal ReadOnlyBooleanPropertyReturns the reference to a boolean property that istrueif currently no messages are displayed.final ReadOnlyMapProperty<String, String> Provides a reference to the messages property.Properties inherited from class javafx.scene.control.Control
contextMenu, skin, tooltipProperties inherited from class javafx.scene.layout.Region
background, border, cacheShape, centerShape, height, insets, maxHeight, maxWidth, minHeight, minWidth, opaqueInsets, padding, prefHeight, prefWidth, scaleShape, shape, snapToPixel, widthProperties inherited from class javafx.scene.Parent
needsLayoutProperties inherited from class javafx.scene.Node
accessibleHelp, accessibleRoleDescription, accessibleRole, accessibleText, blendMode, boundsInLocal, boundsInParent, cacheHint, cache, clip, cursor, depthTest, disabled, disable, effectiveNodeOrientation, effect, eventDispatcher, focused, focusTraversable, focusVisible, focusWithin, hover, id, inputMethodRequests, layoutBounds, layoutX, layoutY, localToParentTransform, localToSceneTransform, managed, mouseTransparent, nodeOrientation, onContextMenuRequested, onDragDetected, onDragDone, onDragDropped, onDragEntered, onDragExited, onDragOver, onInputMethodTextChanged, onKeyPressed, onKeyReleased, onKeyTyped, onMouseClicked, onMouseDragEntered, onMouseDragExited, onMouseDragged, onMouseDragOver, onMouseDragReleased, onMouseEntered, onMouseExited, onMouseMoved, onMousePressed, onMouseReleased, onRotate, onRotationFinished, onRotationStarted, onScrollFinished, onScroll, onScrollStarted, onSwipeDown, onSwipeLeft, onSwipeRight, onSwipeUp, onTouchMoved, onTouchPressed, onTouchReleased, onTouchStationary, onZoomFinished, onZoom, onZoomStarted, opacity, parent, pickOnBounds, pressed, rotate, rotationAxis, scaleX, scaleY, scaleZ, scene, style, translateX, translateY, translateZ, viewOrder, visible -
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ObservableMap<String, String> The error messages to display.private final MapProperty<String, String> The property for the messages.private final Map<String, ErrorDisplay.MessageTrigger> The message triggers.static final StringThe style class for theLabelinstances that show the messages: "errorDisplay".Fields inherited from class javafx.scene.layout.Region
USE_COMPUTED_SIZE, USE_PREF_SIZEFields inherited from class javafx.scene.Node
BASELINE_OFFSET_SAME_AS_HEIGHT -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal voidaddMessage(String message) Adds a message to display, using the empty string as the id for the message.final voidaddMessage(String id, String message) Adds a message to display.final voidaddMessageTrigger(String id, Supplier<String> messageSupplier, BooleanBinding binding) Adds a message trigger.final voidaddMessageTrigger(Supplier<String> messageSupplier, BooleanBinding binding) Adds a message trigger, using the empty string as id.protected final Skin<?> final ReadOnlyBooleanPropertyReturns the reference to a boolean property that istrueif currently no messages are displayed.Returns the messages.final booleanisEmpty()Checks whether there are any messages to display.final ReadOnlyMapProperty<String, String> Provides a reference to the messages property.final voidRemoves the message with the empty string as its id.final voidremoveMessage(String id) Removes the message with the given id.final voidRemoves the message trigger with the empty string as its id.final voidRemoves the message trigger with the given id.Methods inherited from class org.tquadrat.foundation.fx.internal.FoundationFXControl
getUserAgentStylesheetMethods inherited from class javafx.scene.control.Control
computeMaxHeight, computeMaxWidth, computeMinHeight, computeMinWidth, computePrefHeight, computePrefWidth, contextMenuProperty, executeAccessibleAction, getBaselineOffset, getClassCssMetaData, getContextMenu, getControlCssMetaData, getCssMetaData, getInitialFocusTraversable, getSkin, getTooltip, isResizable, layoutChildren, queryAccessibleAttribute, setContextMenu, setSkin, setTooltip, skinProperty, tooltipPropertyMethods inherited from class javafx.scene.layout.Region
backgroundProperty, borderProperty, cacheShapeProperty, centerShapeProperty, getBackground, getBorder, getHeight, getInsets, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getOpaqueInsets, getPadding, getPrefHeight, getPrefWidth, getShape, getUserAgentStylesheet, getWidth, heightProperty, insetsProperty, isCacheShape, isCenterShape, isScaleShape, isSnapToPixel, layoutInArea, layoutInArea, layoutInArea, layoutInArea, maxHeight, maxHeightProperty, maxWidth, maxWidthProperty, minHeight, minHeightProperty, minWidth, minWidthProperty, opaqueInsetsProperty, paddingProperty, positionInArea, positionInArea, prefHeight, prefHeightProperty, prefWidth, prefWidthProperty, resize, scaleShapeProperty, setBackground, setBorder, setCacheShape, setCenterShape, setHeight, setMaxHeight, setMaxSize, setMaxWidth, setMinHeight, setMinSize, setMinWidth, setOpaqueInsets, setPadding, setPrefHeight, setPrefSize, setPrefWidth, setScaleShape, setShape, setSnapToPixel, setWidth, shapeProperty, snappedBottomInset, snappedLeftInset, snappedRightInset, snappedTopInset, snapPosition, snapPositionX, snapPositionY, snapSize, snapSizeX, snapSizeY, snapSpace, snapSpaceX, snapSpaceY, snapToPixelProperty, widthPropertyMethods inherited from class javafx.scene.Parent
getChildren, getChildrenUnmodifiable, getManagedChildren, getStylesheets, isNeedsLayout, layout, lookup, needsLayoutProperty, requestLayout, requestParentLayout, setNeedsLayout, updateBoundsMethods inherited from class javafx.scene.Node
accessibleHelpProperty, accessibleRoleDescriptionProperty, accessibleRoleProperty, accessibleTextProperty, addEventFilter, addEventHandler, applyCss, autosize, blendModeProperty, boundsInLocalProperty, boundsInParentProperty, buildEventDispatchChain, cacheHintProperty, cacheProperty, clipProperty, computeAreaInScreen, contains, contains, cursorProperty, depthTestProperty, disabledProperty, disableProperty, effectiveNodeOrientationProperty, effectProperty, eventDispatcherProperty, fireEvent, focusedProperty, focusTraversableProperty, focusVisibleProperty, focusWithinProperty, getAccessibleHelp, getAccessibleRole, getAccessibleRoleDescription, getAccessibleText, getBlendMode, getBoundsInLocal, getBoundsInParent, getCacheHint, getClip, getContentBias, getCursor, getDepthTest, getEffect, getEffectiveNodeOrientation, getEventDispatcher, getId, getInitialCursor, getInputMethodRequests, getLayoutBounds, getLayoutX, getLayoutY, getLocalToParentTransform, getLocalToSceneTransform, getNodeOrientation, getOnContextMenuRequested, getOnDragDetected, getOnDragDone, getOnDragDropped, getOnDragEntered, getOnDragExited, getOnDragOver, getOnInputMethodTextChanged, getOnKeyPressed, getOnKeyReleased, getOnKeyTyped, getOnMouseClicked, getOnMouseDragEntered, getOnMouseDragExited, getOnMouseDragged, getOnMouseDragOver, getOnMouseDragReleased, getOnMouseEntered, getOnMouseExited, getOnMouseMoved, getOnMousePressed, getOnMouseReleased, getOnRotate, getOnRotationFinished, getOnRotationStarted, getOnScroll, getOnScrollFinished, getOnScrollStarted, getOnSwipeDown, getOnSwipeLeft, getOnSwipeRight, getOnSwipeUp, getOnTouchMoved, getOnTouchPressed, getOnTouchReleased, getOnTouchStationary, getOnZoom, getOnZoomFinished, getOnZoomStarted, getOpacity, getParent, getProperties, getPseudoClassStates, getRotate, getRotationAxis, getScaleX, getScaleY, getScaleZ, getScene, getStyle, getStyleableParent, getStyleClass, getTransforms, getTranslateX, getTranslateY, getTranslateZ, getTypeSelector, getUserData, getViewOrder, hasProperties, hoverProperty, idProperty, inputMethodRequestsProperty, intersects, intersects, isCache, isDisable, isDisabled, isFocused, isFocusTraversable, isFocusVisible, isFocusWithin, isHover, isManaged, isMouseTransparent, isPickOnBounds, isPressed, isVisible, layoutBoundsProperty, layoutXProperty, layoutYProperty, localToParent, localToParent, localToParent, localToParent, localToParent, localToParentTransformProperty, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToSceneTransformProperty, localToScreen, localToScreen, localToScreen, localToScreen, localToScreen, lookupAll, managedProperty, mouseTransparentProperty, nodeOrientationProperty, notifyAccessibleAttributeChanged, onContextMenuRequestedProperty, onDragDetectedProperty, onDragDoneProperty, onDragDroppedProperty, onDragEnteredProperty, onDragExitedProperty, onDragOverProperty, onInputMethodTextChangedProperty, onKeyPressedProperty, onKeyReleasedProperty, onKeyTypedProperty, onMouseClickedProperty, onMouseDragEnteredProperty, onMouseDragExitedProperty, onMouseDraggedProperty, onMouseDragOverProperty, onMouseDragReleasedProperty, onMouseEnteredProperty, onMouseExitedProperty, onMouseMovedProperty, onMousePressedProperty, onMouseReleasedProperty, onRotateProperty, onRotationFinishedProperty, onRotationStartedProperty, onScrollFinishedProperty, onScrollProperty, onScrollStartedProperty, onSwipeDownProperty, onSwipeLeftProperty, onSwipeRightProperty, onSwipeUpProperty, onTouchMovedProperty, onTouchPressedProperty, onTouchReleasedProperty, onTouchStationaryProperty, onZoomFinishedProperty, onZoomProperty, onZoomStartedProperty, opacityProperty, parentProperty, parentToLocal, parentToLocal, parentToLocal, parentToLocal, parentToLocal, pickOnBoundsProperty, pressedProperty, pseudoClassStateChanged, relocate, removeEventFilter, removeEventHandler, requestFocus, resizeRelocate, rotateProperty, rotationAxisProperty, scaleXProperty, scaleYProperty, scaleZProperty, sceneProperty, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, screenToLocal, screenToLocal, screenToLocal, setAccessibleHelp, setAccessibleRole, setAccessibleRoleDescription, setAccessibleText, setBlendMode, setCache, setCacheHint, setClip, setCursor, setDepthTest, setDisable, setDisabled, setEffect, setEventDispatcher, setEventHandler, setFocused, setFocusTraversable, setHover, setId, setInputMethodRequests, setLayoutX, setLayoutY, setManaged, setMouseTransparent, setNodeOrientation, setOnContextMenuRequested, setOnDragDetected, setOnDragDone, setOnDragDropped, setOnDragEntered, setOnDragExited, setOnDragOver, setOnInputMethodTextChanged, setOnKeyPressed, setOnKeyReleased, setOnKeyTyped, setOnMouseClicked, setOnMouseDragEntered, setOnMouseDragExited, setOnMouseDragged, setOnMouseDragOver, setOnMouseDragReleased, setOnMouseEntered, setOnMouseExited, setOnMouseMoved, setOnMousePressed, setOnMouseReleased, setOnRotate, setOnRotationFinished, setOnRotationStarted, setOnScroll, setOnScrollFinished, setOnScrollStarted, setOnSwipeDown, setOnSwipeLeft, setOnSwipeRight, setOnSwipeUp, setOnTouchMoved, setOnTouchPressed, setOnTouchReleased, setOnTouchStationary, setOnZoom, setOnZoomFinished, setOnZoomStarted, setOpacity, setPickOnBounds, setPressed, setRotate, setRotationAxis, setScaleX, setScaleY, setScaleZ, setStyle, setTranslateX, setTranslateY, setTranslateZ, setUserData, setViewOrder, setVisible, snapshot, snapshot, startDragAndDrop, startFullDrag, styleProperty, toBack, toFront, toString, translateXProperty, translateYProperty, translateZProperty, usesMirroring, viewOrderProperty, visiblePropertyMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface javafx.css.Styleable
getStyleableNode
-
Property Details
-
empty
Returns the reference to a boolean property that istrueif currently no messages are displayed.- See Also:
-
messages
Provides a reference to the messages property.- See Also:
-
-
Field Details
-
STYLE_CLASS_MessageDisplayLabel
The style class for theLabelinstances that show the messages: "errorDisplay".- See Also:
-
m_Messages
The error messages to display.
The key is the message id, the value is the message text; only the text is shown.
-
m_MessagesProperty
The property for the messages. -
m_MessageTriggers
The message triggers.
-
-
Constructor Details
-
ErrorDisplay
public ErrorDisplay()Creates a new instance ofErrorDisplay.
-
-
Method Details
-
addMessage
Adds a message to display.- Parameters:
id- The id for the message; this allows to remove the message again later, when the error condition has been removed.message- This is the text to display.
-
addMessage
Adds a message to display, using the empty string as the id for the message.- Parameters:
message- This is the text to display.
-
addMessageTrigger
public final void addMessageTrigger(String id, Supplier<String> messageSupplier, BooleanBinding binding) Adds a message trigger.
The message provided by the given supplier will be displayed when the given instance of
BooleanBindingevaluates totrue.Use this to control the visibility of a particular message based on the status of the given binding.
- Parameters:
id- The message id.messageSupplier- The supplier for the message text.binding- The binding that controls the appearance of the message.- See Also:
-
addMessageTrigger
Adds a message trigger, using the empty string as id.
Use this to control the visibility of a particular message based on the status of the given binding.
- Parameters:
messageSupplier- The supplier for the message text.binding- The binding that controls the appearance of the message.
-
createDefaultSkin
- Overrides:
createDefaultSkinin classControl
-
emptyProperty
Returns the reference to a boolean property that istrueif currently no messages are displayed.- Returns:
- The property reference.
- See Also:
-
getMessages
Returns the messages.- Returns:
- The messages.
-
isEmpty
Checks whether there are any messages to display.- Returns:
trueif there are no messages to show,falseotherwise.
-
messagesProperty
Provides a reference to the messages property.- Returns:
- The property reference.
- See Also:
-
removeMessage
Removes the message with the given id.
If there is no message with that id, nothing happens.
- Parameters:
id- The id for the message to remove.
-
removeMessage
Removes the message with the empty string as its id.
If there is no message with that id, nothing happens.
-
removeMessageTrigger
Removes the message trigger with the given id.
If there is no message trigger with that id, nothing happens.
- Parameters:
id- The id for the message trigger to remove.
-
removeMessageTrigger
Removes the message trigger with the empty string as its id.
If there is no message trigger with that id, nothing happens.
-
