Class DesignerUtil
- java.lang.Object
-
- net.sourceforge.pmd.util.fxdesigner.util.DesignerUtil
-
public final class DesignerUtil extends Object
- Since:
- 6.0.0
- Author:
- Clément Fournier
-
-
Field Summary
Fields Modifier and Type Field Description static String
DESIGNER_DOC_URL
static String
DESIGNER_NEW_ISSUE_URL
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
addCustomStyleSheets(javafx.scene.Parent target, String... styleSheetSimpleName)
static String
attrToXpathString(net.sourceforge.pmd.lang.rule.xpath.Attribute attr)
static javafx.util.Callback<Class<?>,Object>
controllerFactoryKnowing(Object... controllers)
static javafx.util.BuilderFactory
customBuilderFactory(@NonNull DesignerRoot owner)
static URL
getCss(String simpleName)
Gets the URL to an css file from its simple name.static net.sourceforge.pmd.util.designerbindings.RelatedNodesSelector
getDefaultRelatedNodesSelector()
static URL
getFxml(String simpleName)
Gets the URL to an fxml file from its simple name.static URL
getResource(String resRelativeToDesignerDir)
Gets the URL to a file from its simple name.static javafx.scene.text.Text
makeStyledText(String text, String cssClass)
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>static <T> Optional<T>
or(Optional<T> base, Supplier<Optional<T>> fallback)
Was added in java 9...static void
printShortStackTrace(Throwable e)
static void
printShortStackTrace(Throwable e, PrintStream stream)
static <T> org.reactfx.Subscription
rewire(javafx.beans.property.Property<T> underlying, javafx.beans.value.ObservableValue<? extends T> source)
Like rewireInit, with no initialisation.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.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).static String
sanitizeExceptionMessage(Throwable exception)
static <T> Optional<T>
selectFirst(Supplier<Optional<T>>... opts)
Returns the first non-empty optional in the arguments, or else Optional.empty.static <T> Set<T>
setOf()
static <T> Set<T>
setOf(T ts)
static <T> Set<T>
setOf(T... ts)
static <T> javafx.util.Callback<javafx.scene.control.ListView<T>,javafx.scene.control.ListCell<T>>
simpleListCellFactory(Function<T,String> converter, Function<T,String> toolTipMaker)
static Optional<String>
stackTraceToXPath(String stackTrace)
Works out an xpath query that matches the node which was being visited during the failure.static Optional<String>
stackTraceToXPath(Throwable e)
Works out an xpath query that matches the node which was being visited during the failure.static <T> javafx.util.StringConverter<T>
stringConverter(@NonNull Function<T,String> toString, @NonNull Function<String,T> fromString)
static org.reactfx.Subscription
updateProgressOnConsole(Supplier<Double> progressGetter)
-
-
-
Field Detail
-
DESIGNER_DOC_URL
public static final String DESIGNER_DOC_URL
- See Also:
- Constant Field Values
-
DESIGNER_NEW_ISSUE_URL
public static final String DESIGNER_NEW_ISSUE_URL
- See Also:
- Constant Field Values
-
-
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()
-
or
public static <T> Optional<T> or(Optional<T> base, Supplier<Optional<T>> fallback)
Was added in java 9...
-
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 propertyui
- 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)
-
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)
-
-