Liking cljdoc? Tell your friends :D

seesaw.invoke


invoke-latercljmacro

(invoke-later & body)

Equivalent to SwingUtilities/invokeLater. Executes the given body sometime in the future on the Swing UI thread. For example,

(invoke-later (config! my-label :text "New Text"))

Notes:

(seesaw.core/invoke-later) is an alias of this macro.

See:

http://download.oracle.com/javase/6/docs/api/javax/swing/SwingUtilities.html#invokeLater(java.lang.Runnable)

Equivalent to SwingUtilities/invokeLater. Executes the given body sometime
in the future on the Swing UI thread. For example,

  (invoke-later
    (config! my-label :text "New Text"))

Notes:

  (seesaw.core/invoke-later) is an alias of this macro.

See:

  http://download.oracle.com/javase/6/docs/api/javax/swing/SwingUtilities.html#invokeLater(java.lang.Runnable) 
sourceraw docstring

invoke-later*clj

(invoke-later* f & args)
source

invoke-nowcljmacro

(invoke-now & body)

Equivalent to SwingUtilities/invokeAndWait. Executes the given body immediately on the Swing UI thread, possibly blocking the current thread if it's not the Swing UI thread. Returns the result of executing body. For example,

(invoke-now (config! my-label :text "New Text"))

Notes: Be very careful with this function in the presence of locks and stuff.

(seesaw.core/invoke-now) is an alias of this macro.

See: http://download.oracle.com/javase/6/docs/api/javax/swing/SwingUtilities.html#invokeAndWait(java.lang.Runnable)

Equivalent to SwingUtilities/invokeAndWait. Executes the given body immediately
on the Swing UI thread, possibly blocking the current thread if it's not the Swing
UI thread. Returns the result of executing body. For example,

  (invoke-now
    (config! my-label :text "New Text"))

Notes:
  Be very careful with this function in the presence of locks and stuff.

  (seesaw.core/invoke-now) is an alias of this macro.

See:
  http://download.oracle.com/javase/6/docs/api/javax/swing/SwingUtilities.html#invokeAndWait(java.lang.Runnable) 
sourceraw docstring

invoke-now*clj

(invoke-now* f & args)
source

invoke-sooncljmacro

(invoke-soon & body)

Execute code on the swing event thread (EDT) as soon as possible. That is:

  • If the current thread is the EDT, executes body and returns the result
  • Otherise, passes body to (seesaw.core/invoke-later) and returns nil

Notes:

(seesaw.core/invoke-soon) is an alias of this macro.

See: (seesaw.core/invoke-later) http://download.oracle.com/javase/6/docs/api/javax/swing/SwingUtilities.html#invokeLater(java.lang.Runnable)

Execute code on the swing event thread (EDT) as soon as possible. That is:

  * If the current thread is the EDT, executes body and returns the result
  * Otherise, passes body to (seesaw.core/invoke-later) and returns nil

Notes:

  (seesaw.core/invoke-soon) is an alias of this macro.

See:
  (seesaw.core/invoke-later)
  http://download.oracle.com/javase/6/docs/api/javax/swing/SwingUtilities.html#invokeLater(java.lang.Runnable) 
sourceraw docstring

invoke-soon*clj

(invoke-soon* f & args)
source

signallercljmacro

(signaller args & body)

Convenience form of (seesaw.invoke/signaller*).

A use of signaller* like this:

(signaller* (fn [x y z] ... body ...))

can be written like this:

(signaller [x y z] ... body ...)

See: (seesaw.invoke/signaller*)

Convenience form of (seesaw.invoke/signaller*).

A use of signaller* like this:

  (signaller* (fn [x y z] ... body ...))

can be written like this:

  (signaller [x y z] ... body ...)

See:
  (seesaw.invoke/signaller*)
sourceraw docstring

signaller*clj

(signaller* f)

Returns a function that conditionally queues the given function (+ args) on the UI thread. The call is only queued if there is not already a pending call queued.

Suppose you're performing some computation in the background and want to signal some UI component to update. Normally you'd use (seesaw.core/invoke-later) but that can easily flood the UI thread with unnecessary updates. That is, only the "last" queued update really matters since it will overwrite any preceding updates when the event queue is drained. Thus, this function takes care of insuring that only one update call is "in-flight" at any given time.

The returned function returns true if the action was queued, or false if one was already active.

Examples:

; Increment a number in a thread and signal the UI to update a label ; with the current value. Without a signaller, the loop would send ; updates way way way faster than the UI thread could handle them. (defn counting-text-box [] (let [display (label :text "0") value (atom 0) signal (signaller* #(text! display (str @value)))] (future (loop [] (swap! value inc) (signal) (recur))) label))

Note:

You probably want to use the (seesaw.invoke/signaller) convenience form.

See: (seesaw.invoke/invoke-later) (seesaw.invoke/signaller)

Returns a function that conditionally queues the given function (+ args) on 
the UI thread. The call is only queued if there is not already a pending call
queued. 

Suppose you're performing some computation in the background and want
to signal some UI component to update. Normally you'd use (seesaw.core/invoke-later)
but that can easily flood the UI thread with unnecessary updates. That is,
only the "last" queued update really matters since it will overwrite any
preceding updates when the event queue is drained. Thus, this function takes
care of insuring that only one update call is "in-flight" at any given
time.

The returned function returns true if the action was queued, or false if
one was already active.

Examples:

  ; Increment a number in a thread and signal the UI to update a label
  ; with the current value. Without a signaller, the loop would send
  ; updates way way way faster than the UI thread could handle them.
  (defn counting-text-box []
    (let [display (label :text "0")
          value   (atom 0)
          signal  (signaller* #(text! display (str @value)))]
      (future
        (loop []
          (swap! value inc)
          (signal)
          (recur)))
      label))

Note:

  You probably want to use the (seesaw.invoke/signaller) convenience
  form.

See:
  (seesaw.invoke/invoke-later)
  (seesaw.invoke/signaller)
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close