Skip to content

Commit ffd86f1

Browse files
committed
Add javadoc
1 parent d6b4847 commit ffd86f1

File tree

4 files changed

+267
-23
lines changed

4 files changed

+267
-23
lines changed

deps.edn

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{:deps {cljfx/cljfx {:mvn/version "1.7.22"}
2-
cljfx/css {:mvn/version "1.1.0"}}
2+
cljfx/css {:mvn/version "1.1.0"}
3+
#_#_enlive/enlive {:mvn/version "1.1.6"}}
34
:aliases {;; clj -T:build deploy
45
:build {:deps {io.github.clojure/tools.build {:git/tag "v0.8.2" :git/sha "ba1a2bf"}
56
clj-commons/pomegranate {:mvn/version "1.2.0"}}

src/cljfx/dev.clj

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,10 @@
240240
(load "dev/help")
241241

242242
(defn help
243-
"Print help about cljfx types and props"
243+
"Print help about cljfx types and props
244+
245+
All the information provided by this window can also be retrieved using
246+
cjlfx.dev/help-ui window."
244247
([]
245248
(let [ts (->> @registry :types)]
246249
(println "Available cljfx types:")
@@ -255,7 +258,8 @@
255258
(or (keyword? fx-type) (qualified-symbol? fx-type))
256259
(let [r @registry
257260
props (get-in r [:props fx-type])
258-
type (get-in r [:types fx-type])]
261+
type (get-in r [:types fx-type])
262+
javadoc (get-in r [:javadoc fx-type])]
259263
(when (or type props)
260264
(println "Cljfx type:")
261265
(println fx-type)
@@ -264,6 +268,10 @@
264268
(println "Instance class:")
265269
(println (:of type))
266270
(println))
271+
(when javadoc
272+
(println "Javadoc URL:")
273+
(println (str javadoc-prefix javadoc))
274+
(println))
267275
(when (:req type)
268276
(if (set? (:req type))
269277
(do (println "Required props, either:")
@@ -363,12 +371,19 @@
363371
(load "dev/ui")
364372

365373
(defn help-ui
366-
"Open a window with cljfx type and prop reference"
374+
"Open a window with cljfx type and prop reference
375+
376+
All the information provided by this window can also be retrieved using
377+
cjlfx.dev/help fn.
378+
379+
Controls in the window:
380+
- type when focused on type/prop list views - filter the list view
381+
- Escape when focused on type/prop list views - clear the filter
382+
- Ctrl+Tab/Ctrl+Shift+Tab when focuesed on prop/javadoc tab pane - switch tabs"
367383
[]
368384
(launch-help-ui!)
369385
nil)
370386

371387
;; stretch goals
372-
;; - integrate javadocs
373388
;; - dev cljfx type->lifecycle wrapper that adds inspector capabilities.
374389
;; - dev ui builder

src/cljfx/dev/definitions.clj

Lines changed: 211 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2493,6 +2493,217 @@
24932493
:node {:type :desc :of javafx.scene.Node}}
24942494
:of 'javafx.scene.chart.XYChart$Series)
24952495

2496+
(comment
2497+
2498+
(def --index
2499+
(net.cgrand.enlive-html/html-resource ;; super slow, def?
2500+
(java.io.StringReader.
2501+
(slurp "https://openjfx.io/javadoc/14/index-all.html"))))
2502+
2503+
(->> (net.cgrand.enlive-html/select
2504+
--index
2505+
[(net.cgrand.enlive-html/attr-starts :title "class in")])
2506+
(map #(-> % :attrs :href))
2507+
distinct
2508+
(map #(let [[module path] (str/split % #"/" 2)]
2509+
[module (second (re-matches #"^[a-z/]+(.+)\.html$" path)) path]))
2510+
(remove
2511+
#{["javafx.graphics" "StringConverter" "javafx/css/converter/StringConverter.html"]})
2512+
(map #(let [[module class-name path] %]
2513+
[(->> (str/split (str/replace class-name "." "") #"(?<!(^|[A-Z]))(?=[A-Z])|(?<!^)(?=[A-Z][a-z])")
2514+
(map str/lower-case)
2515+
(str/join "-")
2516+
(keyword))
2517+
module
2518+
path]))
2519+
(map (fn [[k v path]]
2520+
[(if (clojure.string/starts-with? (name k) "spinner-value-factory-")
2521+
(keyword (subs (name k) (count "spinner-value-factory-")))
2522+
k)
2523+
v
2524+
path]))
2525+
(filter (fn [[k]]
2526+
(contains? (:types @@#'cljfx.dev/registry) k)))
2527+
(map (fn [[k v p]]
2528+
[k (str v "/" p)]))
2529+
(into {}))
2530+
2531+
,)
2532+
2533+
(swap! registry assoc :javadoc
2534+
{:sphere "javafx.graphics/javafx/scene/shape/Sphere.html"
2535+
:indexed-cell "javafx.controls/javafx/scene/control/IndexedCell.html"
2536+
:svg-path "javafx.graphics/javafx/scene/shape/SVGPath.html"
2537+
:path "javafx.graphics/javafx/scene/shape/Path.html"
2538+
:html-editor "javafx.web/javafx/scene/web/HTMLEditor.html"
2539+
:text-area "javafx.controls/javafx/scene/control/TextArea.html"
2540+
:pie-chart "javafx.controls/javafx/scene/chart/PieChart.html"
2541+
:parallel-camera "javafx.graphics/javafx/scene/ParallelCamera.html"
2542+
:tile-pane "javafx.graphics/javafx/scene/layout/TilePane.html"
2543+
:table-view "javafx.controls/javafx/scene/control/TableView.html"
2544+
:bloom "javafx.graphics/javafx/scene/effect/Bloom.html"
2545+
:gaussian-blur "javafx.graphics/javafx/scene/effect/GaussianBlur.html"
2546+
:point-light "javafx.graphics/javafx/scene/PointLight.html"
2547+
:progress-bar "javafx.controls/javafx/scene/control/ProgressBar.html"
2548+
:combo-box "javafx.controls/javafx/scene/control/ComboBox.html"
2549+
:pane "javafx.graphics/javafx/scene/layout/Pane.html"
2550+
:popup "javafx.graphics/javafx/stage/Popup.html"
2551+
:menu-item "javafx.controls/javafx/scene/control/MenuItem.html"
2552+
:anchor-pane "javafx.graphics/javafx/scene/layout/AnchorPane.html"
2553+
:table-row "javafx.controls/javafx/scene/control/TableRow.html"
2554+
:custom-menu-item "javafx.controls/javafx/scene/control/CustomMenuItem.html"
2555+
:group "javafx.graphics/javafx/scene/Group.html"
2556+
:media-view "javafx.media/javafx/scene/media/MediaView.html"
2557+
:stage "javafx.graphics/javafx/stage/Stage.html"
2558+
:arc "javafx.graphics/javafx/scene/shape/Arc.html"
2559+
:light-spot "javafx.graphics/javafx/scene/effect/Light.Spot.html"
2560+
:affine "javafx.graphics/javafx/scene/transform/Affine.html"
2561+
:shear "javafx.graphics/javafx/scene/transform/Shear.html"
2562+
:radio-menu-item "javafx.controls/javafx/scene/control/RadioMenuItem.html"
2563+
:close-path "javafx.graphics/javafx/scene/shape/ClosePath.html"
2564+
:list-spinner-value-factory "javafx.controls/javafx/scene/control/SpinnerValueFactory.ListSpinnerValueFactory.html"
2565+
:number-axis "javafx.controls/javafx/scene/chart/NumberAxis.html"
2566+
:scale "javafx.graphics/javafx/scene/transform/Scale.html"
2567+
:button "javafx.controls/javafx/scene/control/Button.html"
2568+
:lighting "javafx.graphics/javafx/scene/effect/Lighting.html"
2569+
:tool-bar "javafx.controls/javafx/scene/control/ToolBar.html"
2570+
:bar-chart "javafx.controls/javafx/scene/chart/BarChart.html"
2571+
:xy-chart-series "javafx.controls/javafx/scene/chart/XYChart.Series.html"
2572+
:radio-button "javafx.controls/javafx/scene/control/RadioButton.html"
2573+
:perspective-camera "javafx.graphics/javafx/scene/PerspectiveCamera.html"
2574+
:move-to "javafx.graphics/javafx/scene/shape/MoveTo.html"
2575+
:text-input-dialog "javafx.controls/javafx/scene/control/TextInputDialog.html"
2576+
:split-menu-button "javafx.controls/javafx/scene/control/SplitMenuButton.html"
2577+
:rotate-transition "javafx.graphics/javafx/animation/RotateTransition.html"
2578+
:pause-transition "javafx.graphics/javafx/animation/PauseTransition.html"
2579+
:grid-pane "javafx.graphics/javafx/scene/layout/GridPane.html"
2580+
:combo-box-list-cell "javafx.controls/javafx/scene/control/cell/ComboBoxListCell.html"
2581+
:sub-scene "javafx.graphics/javafx/scene/SubScene.html"
2582+
:scale-transition "javafx.graphics/javafx/animation/ScaleTransition.html"
2583+
:text-flow "javafx.graphics/javafx/scene/text/TextFlow.html"
2584+
:box "javafx.graphics/javafx/scene/shape/Box.html"
2585+
:cubic-curve "javafx.graphics/javafx/scene/shape/CubicCurve.html"
2586+
:quad-curve-to "javafx.graphics/javafx/scene/shape/QuadCurveTo.html"
2587+
:circle "javafx.graphics/javafx/scene/shape/Circle.html"
2588+
:text-field-list-cell "javafx.controls/javafx/scene/control/cell/TextFieldListCell.html"
2589+
:motion-blur "javafx.graphics/javafx/scene/effect/MotionBlur.html"
2590+
:line-to "javafx.graphics/javafx/scene/shape/LineTo.html"
2591+
:h-line-to "javafx.graphics/javafx/scene/shape/HLineTo.html"
2592+
:popup-control "javafx.controls/javafx/scene/control/PopupControl.html"
2593+
:drop-shadow "javafx.graphics/javafx/scene/effect/DropShadow.html"
2594+
:flow-pane "javafx.graphics/javafx/scene/layout/FlowPane.html"
2595+
:stacked-bar-chart "javafx.controls/javafx/scene/chart/StackedBarChart.html"
2596+
:tree-table-cell "javafx.controls/javafx/scene/control/TreeTableCell.html"
2597+
:alert "javafx.controls/javafx/scene/control/Alert.html"
2598+
:mesh-view "javafx.graphics/javafx/scene/shape/MeshView.html"
2599+
:color-adjust "javafx.graphics/javafx/scene/effect/ColorAdjust.html"
2600+
:progress-indicator "javafx.controls/javafx/scene/control/ProgressIndicator.html"
2601+
:text-field "javafx.controls/javafx/scene/control/TextField.html"
2602+
:tree-view "javafx.controls/javafx/scene/control/TreeView.html"
2603+
:menu-bar "javafx.controls/javafx/scene/control/MenuBar.html"
2604+
:fill-transition "javafx.graphics/javafx/animation/FillTransition.html"
2605+
:color-picker "javafx.controls/javafx/scene/control/ColorPicker.html"
2606+
:image-input "javafx.graphics/javafx/scene/effect/ImageInput.html"
2607+
:category-axis "javafx.controls/javafx/scene/chart/CategoryAxis.html"
2608+
:stack-pane "javafx.graphics/javafx/scene/layout/StackPane.html"
2609+
:xy-chart-data "javafx.controls/javafx/scene/chart/XYChart.Data.html"
2610+
:tree-item "javafx.controls/javafx/scene/control/TreeItem.html"
2611+
:accordion "javafx.controls/javafx/scene/control/Accordion.html"
2612+
:spinner "javafx.controls/javafx/scene/control/Spinner.html"
2613+
:v-box "javafx.graphics/javafx/scene/layout/VBox.html"
2614+
:double-spinner-value-factory "javafx.controls/javafx/scene/control/SpinnerValueFactory.DoubleSpinnerValueFactory.html"
2615+
:canvas "javafx.graphics/javafx/scene/canvas/Canvas.html"
2616+
:password-field "javafx.controls/javafx/scene/control/PasswordField.html"
2617+
:v-line-to "javafx.graphics/javafx/scene/shape/VLineTo.html"
2618+
:region "javafx.graphics/javafx/scene/layout/Region.html"
2619+
:displacement-map "javafx.graphics/javafx/scene/effect/DisplacementMap.html"
2620+
:cubic-curve-to "javafx.graphics/javafx/scene/shape/CubicCurveTo.html"
2621+
:scroll-pane "javafx.controls/javafx/scene/control/ScrollPane.html"
2622+
:triangle-mesh "javafx.graphics/javafx/scene/shape/TriangleMesh.html"
2623+
:split-pane "javafx.controls/javafx/scene/control/SplitPane.html"
2624+
:toggle-button "javafx.controls/javafx/scene/control/ToggleButton.html"
2625+
:date-picker "javafx.controls/javafx/scene/control/DatePicker.html"
2626+
:date-cell "javafx.controls/javafx/scene/control/DateCell.html"
2627+
:table-column "javafx.controls/javafx/scene/control/TableColumn.html"
2628+
:web-view "javafx.web/javafx/scene/web/WebView.html"
2629+
:line "javafx.graphics/javafx/scene/shape/Line.html"
2630+
:list-view "javafx.controls/javafx/scene/control/ListView.html"
2631+
:choice-box "javafx.controls/javafx/scene/control/ChoiceBox.html"
2632+
:bubble-chart "javafx.controls/javafx/scene/chart/BubbleChart.html"
2633+
:stacked-area-chart "javafx.controls/javafx/scene/chart/StackedAreaChart.html"
2634+
:pagination "javafx.controls/javafx/scene/control/Pagination.html"
2635+
:media-player "javafx.media/javafx/scene/media/MediaPlayer.html"
2636+
:quad-curve "javafx.graphics/javafx/scene/shape/QuadCurve.html"
2637+
:ambient-light "javafx.graphics/javafx/scene/AmbientLight.html"
2638+
:check-box "javafx.controls/javafx/scene/control/CheckBox.html"
2639+
:label "javafx.controls/javafx/scene/control/Label.html"
2640+
:image-view "javafx.graphics/javafx/scene/image/ImageView.html"
2641+
:color-input "javafx.graphics/javafx/scene/effect/ColorInput.html"
2642+
:cylinder "javafx.graphics/javafx/scene/shape/Cylinder.html"
2643+
:border-pane "javafx.graphics/javafx/scene/layout/BorderPane.html"
2644+
:row-constraints "javafx.graphics/javafx/scene/layout/RowConstraints.html"
2645+
:context-menu "javafx.controls/javafx/scene/control/ContextMenu.html"
2646+
:integer-spinner-value-factory "javafx.controls/javafx/scene/control/SpinnerValueFactory.IntegerSpinnerValueFactory.html"
2647+
:translate-transition "javafx.graphics/javafx/animation/TranslateTransition.html"
2648+
:ellipse "javafx.graphics/javafx/scene/shape/Ellipse.html"
2649+
:pie-chart-data "javafx.controls/javafx/scene/chart/PieChart.Data.html"
2650+
:tree-table-row "javafx.controls/javafx/scene/control/TreeTableRow.html"
2651+
:inner-shadow "javafx.graphics/javafx/scene/effect/InnerShadow.html"
2652+
:light-distant "javafx.graphics/javafx/scene/effect/Light.Distant.html"
2653+
:table-cell "javafx.controls/javafx/scene/control/TableCell.html"
2654+
:stroke-transition "javafx.graphics/javafx/animation/StrokeTransition.html"
2655+
:translate "javafx.graphics/javafx/scene/transform/Translate.html"
2656+
:dialog "javafx.controls/javafx/scene/control/Dialog.html"
2657+
:tree-cell "javafx.controls/javafx/scene/control/TreeCell.html"
2658+
:rotate "javafx.graphics/javafx/scene/transform/Rotate.html"
2659+
:sequential-transition "javafx.graphics/javafx/animation/SequentialTransition.html"
2660+
:hyperlink "javafx.controls/javafx/scene/control/Hyperlink.html"
2661+
:tab-pane "javafx.controls/javafx/scene/control/TabPane.html"
2662+
:column-constraints "javafx.graphics/javafx/scene/layout/ColumnConstraints.html"
2663+
:button-bar "javafx.controls/javafx/scene/control/ButtonBar.html"
2664+
:blend "javafx.graphics/javafx/scene/effect/Blend.html"
2665+
:path-transition "javafx.graphics/javafx/animation/PathTransition.html"
2666+
:box-blur "javafx.graphics/javafx/scene/effect/BoxBlur.html"
2667+
:fade-transition "javafx.graphics/javafx/animation/FadeTransition.html"
2668+
:menu-button "javafx.controls/javafx/scene/control/MenuButton.html"
2669+
:area-chart "javafx.controls/javafx/scene/chart/AreaChart.html"
2670+
:choice-dialog "javafx.controls/javafx/scene/control/ChoiceDialog.html"
2671+
:h-box "javafx.graphics/javafx/scene/layout/HBox.html"
2672+
:tree-table-column "javafx.controls/javafx/scene/control/TreeTableColumn.html"
2673+
:shadow "javafx.graphics/javafx/scene/effect/Shadow.html"
2674+
:tab "javafx.controls/javafx/scene/control/Tab.html"
2675+
:separator "javafx.controls/javafx/scene/control/Separator.html"
2676+
:check-menu-item "javafx.controls/javafx/scene/control/CheckMenuItem.html"
2677+
:dialog-pane "javafx.controls/javafx/scene/control/DialogPane.html"
2678+
:perspective-transform "javafx.graphics/javafx/scene/effect/PerspectiveTransform.html"
2679+
:arc-to "javafx.graphics/javafx/scene/shape/ArcTo.html"
2680+
:cell "javafx.controls/javafx/scene/control/Cell.html"
2681+
:polyline "javafx.graphics/javafx/scene/shape/Polyline.html"
2682+
:phong-material "javafx.graphics/javafx/scene/paint/PhongMaterial.html"
2683+
:media "javafx.media/javafx/scene/media/Media.html"
2684+
:glow "javafx.graphics/javafx/scene/effect/Glow.html"
2685+
:parallel-transition "javafx.graphics/javafx/animation/ParallelTransition.html"
2686+
:toggle-group "javafx.controls/javafx/scene/control/ToggleGroup.html"
2687+
:scatter-chart "javafx.controls/javafx/scene/chart/ScatterChart.html"
2688+
:reflection "javafx.graphics/javafx/scene/effect/Reflection.html"
2689+
:menu "javafx.controls/javafx/scene/control/Menu.html"
2690+
:tooltip "javafx.controls/javafx/scene/control/Tooltip.html"
2691+
:rectangle "javafx.graphics/javafx/scene/shape/Rectangle.html"
2692+
:tree-table-view "javafx.controls/javafx/scene/control/TreeTableView.html"
2693+
:list-cell "javafx.controls/javafx/scene/control/ListCell.html"
2694+
:line-chart "javafx.controls/javafx/scene/chart/LineChart.html"
2695+
:text-formatter "javafx.controls/javafx/scene/control/TextFormatter.html"
2696+
:slider "javafx.controls/javafx/scene/control/Slider.html"
2697+
:polygon "javafx.graphics/javafx/scene/shape/Polygon.html"
2698+
:sepia-tone "javafx.graphics/javafx/scene/effect/SepiaTone.html"
2699+
:scene "javafx.graphics/javafx/scene/Scene.html"
2700+
:titled-pane "javafx.controls/javafx/scene/control/TitledPane.html"
2701+
:text "javafx.graphics/javafx/scene/text/Text.html"
2702+
:scroll-bar "javafx.controls/javafx/scene/control/ScrollBar.html"
2703+
:light-point "javafx.graphics/javafx/scene/effect/Light.Point.html"})
2704+
2705+
(def ^:private javadoc-prefix "https://openjfx.io/javadoc/18/")
2706+
24962707
(comment
24972708
(require '[clojure.java.io :as io])
24982709
(defn- prop-forms->descs [xs & {:keys [on-class imports]}]

0 commit comments

Comments
 (0)