(app-watch watch-key app-ref old-value new-value)
(apply-attributes
{:keys [onscreen-component app-val old-view new-view attr-appliers] :as ctx})
Takes the diff of the old-view and new-view and applies only the changes to the onscreen component. The old-view is the one from the previous @app-ref render call. It is not the one stored in the component. When children components are being used it's impossible to tell if the child component is associated with the previous old-view or not and some appliers work on the parent and not the component itself. For instance the :tab-title and :tab-tooltip for Swing's JTabbedPane. Those attributes occur on the children but make changes to the parent. If a child is removed then the parent (JTabbedPane in this case) may need updates based on the children sliding into place. That is, the child at 2 may become the child at 1 if the child at 0 is removed. The child at 1 then needs all its attributes updated to look like what should be rendered at spot 1. The component is reused. Avoid this by using :id on the rendered results.
Takes the diff of the old-view and new-view and applies only the changes to the onscreen component. The old-view is the one from the previous @app-ref render call. It is _not_ the one stored in the component. When children components are being used it's impossible to tell if the child component is associated with the previous old-view or not and some appliers work on the parent and not the component itself. For instance the :tab-title and :tab-tooltip for Swing's JTabbedPane. Those attributes occur on the children but make changes to the parent. If a child is removed then the parent (JTabbedPane in this case) may need updates based on the children sliding into place. That is, the child at 2 may become the child at 1 if the child at 0 is removed. The child at 1 then needs all its attributes updated to look like what should be rendered at spot 1. The component is reused. Avoid this by using :id on the rendered results.
(assoc-view ctx onscreen-component view)
(children-applier? attr-applier)
(component-applier? attr-applier)
(component-did-mount? old-value new-value)
(create-comp app-ref comp)
(create-comp app-ref comp props)
Create a new top level component. There should not be many of these. This is akin to a main window. In the most extreme cases there may be a couple of hundred of these. In a typical case there will be between one component and a half a dozen components. The code is optimized for a small number of top level components. Legacy apps that wish to mount components in an existing non-Retroact component can use this to construct such "detached" components, which are essentially top level components as far as Retroact is concerned but not in the native windowing system. Note, the onscreen-component is built asynchronously and may be added to the legacy component in its component-did-mount or ... TODO: in the future there may be another way to do this.
If :comp-id exists in comp then an existing top level component will be reused if one exists matching the supplied value of :comp-id.
Create a new top level component. There should not be many of these. This is akin to a main window. In the most extreme cases there may be a couple of hundred of these. In a typical case there will be between one component and a half a dozen components. The code is optimized for a small number of top level components. Legacy apps that wish to mount components in an existing non-Retroact component can use this to construct such "detached" components, which are essentially top level components as far as Retroact is concerned but not in the native windowing system. Note, the onscreen-component is built asynchronously and may be added to the legacy component in its component-did-mount or ... TODO: in the future there may be another way to do this. If :comp-id exists in comp then an existing top level component will be reused if one exists matching the supplied value of :comp-id.
(destroy-comp app-ref comp-id)
Destroy a component. You'll need to keep comp-id created with create-comp in order to call this.
Destroy a component. You'll need to keep comp-id created with create-comp in order to call this.
(gen-retroact-thread-id)
(get-comp id)
(get-in-toolkit-config ctx k)
(get-view ctx onscreen-component)
(init-app)
(init-app comp)
(init-app comp props)
Initialize app data as an atom and return the atom. The atom is wired in to necessary watches, core.async channels, and any other fns and structures to make it functional and not just a regular atom. The result is an atom that is reactive to changes according to FRP (Functional Reactive Programming). Components may subsequently be added to the app. For convenience there is a single arg version of this fn that will create a component. Although nothing prevents multiple calls to init-app and the code will work properly when multiple calls are made, init-app is intended to be called once. The resources (including threads) allocated are done so as if this is for the entire application.
Initialize app data as an atom and return the atom. The atom is wired in to necessary watches, core.async channels, and any other fns and structures to make it functional and not just a regular atom. The result is an atom that is reactive to changes according to FRP (Functional Reactive Programming). Components may subsequently be added to the app. For convenience there is a single arg version of this fn that will create a component. Although nothing prevents multiple calls to init-app and the code will work properly when multiple calls are made, init-app is intended to be called once. The resources (including threads) allocated are done so as if this is for the entire application.
(init-app-ref app-ref)
Initialize ref/atom/agent to work as state and "app" for Retroact components. If an application already has its own ref for handling state, this fn will allow the app to use that ref with Retroact instead of the default atom based empty state created by Retroact. There's no difference between using this and init-app. init-app is just a shortcut to use a default atom based ref.
Initialize ref/atom/agent to work as state and "app" for Retroact components. If an application already has its own ref for handling state, this fn will allow the app to use that ref with Retroact instead of the default atom based empty state created by Retroact. There's no difference between using this and init-app. init-app is just a shortcut to use a default atom based ref.
(instantiate-class ctx ui)
(pad col length)
(redraw-onscreen-component ctx component)
(register-comp-type! app-ref class-key klass attr-appliers)
Add custom components and their attribute appliers. This may be useful when extending a Java Swing component, for instance - though preference should be given to using the existing components when possible.
Add custom components and their attribute appliers. This may be useful when extending a Java Swing component, for instance - though preference should be given to using the existing components when possible.
(run-later f & args)
(run-on-toolkit-thread ctx f & args)
(run-on-toolkit-thread-with-result ctx f & args)
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close