Class DesignerUtil


  • public final class DesignerUtil
    extends Object
    Since:
    6.0.0
    Author:
    Clément Fournier
    • Method Detail

      • setOf

        public static <T> Set<T> setOf​(T... ts)
      • setOf

        public static <T> Set<T> setOf​(T ts)
      • setOf

        public static <T> Set<T> setOf()
      • getFxml

        public static URL getFxml​(String simpleName)
        Gets the URL to an fxml file from its simple name.
        Parameters:
        simpleName - Simple name of the file, i.e. with no directory prefixes or extension
        Returns:
        A URL to an fxml file
      • getResource

        public static URL getResource​(String resRelativeToDesignerDir)
        Gets the URL to a file from its simple name.
        Returns:
        A URL to a file
      • getCss

        public static URL getCss​(String simpleName)
        Gets the URL to an css file from its simple name.
        Parameters:
        simpleName - Simple name of the file, i.e. with no directory prefixes or extension
        Returns:
        A URL to a css file
      • addCustomStyleSheets

        public static void addCustomStyleSheets​(javafx.scene.Parent target,
                                                String... styleSheetSimpleName)
      • simpleListCellFactory

        public static <T> javafx.util.Callback<javafx.scene.control.ListView<T>,​javafx.scene.control.ListCell<T>> simpleListCellFactory​(Function<T,​String> converter,
                                                                                                                                              Function<T,​String> toolTipMaker)
      • stringConverter

        public static <T> javafx.util.StringConverter<T> stringConverter​(@NonNull Function<T,​String> toString,
                                                                         @NonNull Function<String,​T> fromString)
      • mapToggleGroupToUserData

        public static <T> org.reactfx.value.Var<T> mapToggleGroupToUserData​(javafx.scene.control.ToggleGroup toggleGroup,
                                                                            Supplier<T> defaultValue)
        Given a toggle group whose toggles all have user data of type T, maps the selected toggle property to a Var<T>
      • selectFirst

        @SafeVarargs
        public static <T> Optional<T> selectFirst​(Supplier<Optional<T>>... opts)
        Returns the first non-empty optional in the arguments, or else Optional.empty.
      • rewireInit

        public static <T> org.reactfx.Subscription rewireInit​(javafx.beans.property.Property<T> underlying,
                                                              javafx.beans.property.Property<T> ui)
        Like the other overload, using the setter of the ui property.
      • rewireInit

        public static <T> org.reactfx.Subscription rewireInit​(javafx.beans.property.Property<T> underlying,
                                                              javafx.beans.value.ObservableValue<? extends T> ui,
                                                              Consumer<? super T> setter)
        Binds the underlying property to a source of values (UI property). The UI property is also initialised using a setter.
        Type Parameters:
        T - Type of values
        Parameters:
        underlying - The underlying property
        ui - The property exposed to the user (the one in this wizard)
        setter - Setter to initialise the UI value
      • rewire

        public static <T> org.reactfx.Subscription rewire​(javafx.beans.property.Property<T> underlying,
                                                          javafx.beans.value.ObservableValue<? extends T> source)
        Like rewireInit, with no initialisation.
      • stackTraceToXPath

        public static Optional<String> stackTraceToXPath​(String stackTrace)
        Works out an xpath query that matches the node which was being visited during the failure.

        The query selects nodes that have exactly the same ancestors than the node in which the last call from the stack trace.

        Parameters:
        stackTrace - full stack trace
        Returns:
        An xpath expression if possible
      • printShortStackTrace

        public static void printShortStackTrace​(Throwable e)
      • printShortStackTrace

        public static void printShortStackTrace​(Throwable e,
                                                PrintStream stream)
      • sanitizeExceptionMessage

        public static String sanitizeExceptionMessage​(Throwable exception)
      • stackTraceToXPath

        public static Optional<String> stackTraceToXPath​(Throwable e)
        Works out an xpath query that matches the node which was being visited during the failure.
        Parameters:
        e - Exception
        Returns:
        A query, if possible.
        See Also:
        stackTraceToXPath(String)
      • getDefaultRelatedNodesSelector

        public static net.sourceforge.pmd.util.designerbindings.RelatedNodesSelector getDefaultRelatedNodesSelector()
      • controllerFactoryKnowing

        public static javafx.util.Callback<Class<?>,​Object> controllerFactoryKnowing​(Object... controllers)
      • updateProgressOnConsole

        public static org.reactfx.Subscription updateProgressOnConsole​(Supplier<Double> progressGetter)
      • customBuilderFactory

        public static javafx.util.BuilderFactory customBuilderFactory​(@NonNull DesignerRoot owner)
      • attrToXpathString

        public static String attrToXpathString​(net.sourceforge.pmd.lang.rule.xpath.Attribute attr)
      • makeStyledText

        public static javafx.scene.text.Text makeStyledText​(String text,
                                                            String cssClass)