Liking cljdoc? Tell your friends :D

cljfx.plorer

Inspect and query JavaFX scene graphs from Clojure.

el is a scene graph element, e.g., Node, Window, Scene, or synthetic ROOT.

Public entry points:

  • props for reading supported properties from an el
  • tree for building a nested representation of an el and its children
  • all and one for querying the live JavaFX graph

Examples:

(props el :only [:id :text])
(tree :depth 3)
(tree el :props [:id])
(all Text)
(one "#root")
(key-press! el :alt)
(mouse-press! el :primary)
(mouse-release! el :primary)
(key-release! el :alt)
Inspect and query JavaFX scene graphs from Clojure.
 
`el` is a scene graph element, e.g., Node, Window, Scene, or synthetic ROOT.

Public entry points:
- `props` for reading supported properties from an el
- `tree` for building a nested representation of an el and its children
- `all` and `one` for querying the live JavaFX graph

Examples:

```clojure
(props el :only [:id :text])
(tree :depth 3)
(tree el :props [:id])
(all Text)
(one "#root")
(key-press! el :alt)
(mouse-press! el :primary)
(mouse-release! el :primary)
(key-release! el :alt)
```
raw docstring

-childrenclj

(-children el)
source

allclj

(all & args)

Return all matching els for selectors.

Queries start from el when provided, otherwise from ROOT, and run left to right. > makes the next step direct-child only.

Selector forms:

  • Class matches by instance?
  • * matches anything
  • strings match #id, .style-class, or #id.style-class
  • functions and vars that resolve to functions are predicates
  • maps match el properties (equality or predicate)

Map keys:

  • ordinary keys compare against el properties
  • :fx.plorer/class adds a class match
  • :fx.plorer/pred adds an el predicate
  • :fx.plorer/style-classes requires all listed CSS classes

Example:

(all root Text)
(all > Window)
(all VBox > Text)
(all {:id some?})
(all "#id.class.other-class")
(all {:fx.plorer/class Text :id "title" :fx.plorer/style-classes #{"primary"}})
Return all matching els for `selectors`.

Queries start from `el` when provided, otherwise from `ROOT`, and run left
to right. `>` makes the next step direct-child only.

Selector forms:
- `Class` matches by `instance?`
- `*` matches anything
- strings match `#id`, `.style-class`, or `#id.style-class`
- functions and vars that resolve to functions are predicates
- maps match el properties (equality or predicate)

Map keys:
- ordinary keys compare against el properties
- `:fx.plorer/class` adds a class match
- `:fx.plorer/pred` adds an el predicate
- `:fx.plorer/style-classes` requires all listed CSS classes

Example:

```clojure
(all root Text)
(all > Window)
(all VBox > Text)
(all {:id some?})
(all "#id.class.other-class")
(all {:fx.plorer/class Text :id "title" :fx.plorer/style-classes #{"primary"}})
```
sourceraw docstring

key-press!clj

(key-press! key)
(key-press! el key)

Dispatch a synthetic key press for key on el.

key may be a KeyCode or a keyword such as :enter, :tab, :escape, :a, :shift, :control, :alt, or :meta.

Returns the focused node that received the event. Printable keys also emit a synthetic KEY_TYPED event. Pair each call with key-release!, especially for modifiers, to avoid leaking held-key state. Throws when there is no focus owner or when the focused node is outside el.

Dispatch a synthetic key press for `key` on `el`.

`key` may be a `KeyCode` or a keyword such as `:enter`, `:tab`, `:escape`,
`:a`, `:shift`, `:control`, `:alt`, or `:meta`.

Returns the focused node that received the event. Printable keys also emit a
synthetic `KEY_TYPED` event. Pair each call with `key-release!`, especially
for modifiers, to avoid leaking held-key state. Throws when there is no focus
owner or when the focused node is outside `el`.
sourceraw docstring

key-release!clj

(key-release! key)
(key-release! el key)

Dispatch a synthetic key release for key on el.

Accepts the same key forms as key-press! and returns the focused node that received the event.

Modifier state is tracked across key-press! and key-release!, so release keys you press, e.g. :shift, :control, :alt, or :meta. Throws when there is no focus owner or when the focused node is outside el.

Dispatch a synthetic key release for `key` on `el`.

Accepts the same key forms as `key-press!` and returns the focused node that
received the event.

Modifier state is tracked across `key-press!` and `key-release!`, so release
keys you press, e.g. `:shift`, `:control`, `:alt`, or `:meta`. Throws when
there is no focus owner or when the focused node is outside `el`.
sourceraw docstring

mouse-press!clj

(mouse-press! button)
(mouse-press! el button)

Dispatch a synthetic mouse press for button on el.

button may be a MouseButton or one of :primary, :middle, or :secondary.

Clicks the visual center of el and returns the picked node. Throws if el is not showing, has no scene coordinates, or if a different node is picked. Pair each call with mouse-release!; a failed press sends a balancing release first.

Dispatch a synthetic mouse press for `button` on `el`.

`button` may be a `MouseButton` or one of `:primary`, `:middle`, or
`:secondary`.

Clicks the visual center of `el` and returns the picked node. Throws if `el`
is not showing, has no scene coordinates, or if a different node is picked.
Pair each call with `mouse-release!`; a failed press sends a balancing
release first.
sourceraw docstring

mouse-release!clj

(mouse-release! button)
(mouse-release! el button)

Dispatch a synthetic mouse release for button on el.

Accepts the same button forms as mouse-press! and returns the picked node. Supported button keywords are :primary, :middle, and :secondary.

The event uses the visual center of el. Throws if el is not showing, has no scene coordinates, or if a different node is picked.

Dispatch a synthetic mouse release for `button` on `el`.

Accepts the same button forms as `mouse-press!` and returns the picked node.
Supported button keywords are `:primary`, `:middle`, and `:secondary`.

The event uses the visual center of `el`. Throws if `el` is not showing, has
no scene coordinates, or if a different node is picked.
sourceraw docstring

oneclj

(one & args)

Return the only matching el for selectors.

Same selector forms as all. Throws IllegalStateException on 0 or many matches.

Example:

(one root "#title")
(one "#root")
Return the only matching el for `selectors`.

Same selector forms as `all`. Throws `IllegalStateException` on 0 or many
matches.

Example:

```clojure
(one root "#title")
(one "#root")
```
sourceraw docstring

propsclj

(props el & {:keys [only]})

Return a map of supported property values for el.

Behavior:

  • returned keys are the supported logical props for el
  • unsupported keys are omitted
  • supported keys with nil values are included
  • :only limits which keys are read

Example:

(props el)
(props text-el :only [:text :id])
Return a map of supported property values for `el`.

Behavior:
- returned keys are the supported logical props for `el`
- unsupported keys are omitted
- supported keys with nil values are included
- `:only` limits which keys are read

Example:

```clojure
(props el)
(props text-el :only [:text :id])
```
sourceraw docstring

treeclj

(tree & args)

Return a tree for el, or from the synthetic root when el is omitted.

Behavior:

  • with no el, traversal starts from the synthetic root
  • each node always includes :el
  • :props is included only when requested
  • :children is included unless :depth is 0
  • :depth 0 returns just the current node
  • :depth 1 includes immediate children

Examples:

(tree el)
(tree el :props [:id])
(tree :depth 3 :props [:id :title])
Return a tree for `el`, or from the synthetic root when `el` is omitted.

Behavior:
- with no `el`, traversal starts from the synthetic root
- each node always includes `:el`
- `:props` is included only when requested
- `:children` is included unless `:depth` is 0
- `:depth 0` returns just the current node
- `:depth 1` includes immediate children

Examples:

```clojure
(tree el)
(tree el :props [:id])
(tree :depth 3 :props [:id :title])
```
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close