Module: JRubyFX::FXImports

Included in:
JRubyFX, Controller, DSL, DSL::ClassUtils
Defined in:
lib/jrubyfx/imports.rb,
lib/jrubyfx/part_imports.rb

Overview

If you need JavaFX, just include this module. Its sole purpose in life is to import all JavaFX stuff, plus a few useful Java classes (like Void)

Constant Summary collapse

LOCAL_NAME_MAP =
{ 
  :Animation => "javafx.animation.Animation",
  :AnimationTimer => "javafx.animation.AnimationTimer",
  :FadeTransition => "javafx.animation.FadeTransition",
  :FillTransition => "javafx.animation.FillTransition",
  :Interpolator => "javafx.animation.Interpolator",
  :KeyFrame => "javafx.animation.KeyFrame",
  :KeyValue => "javafx.animation.KeyValue",
  :ParallelTransition => "javafx.animation.ParallelTransition",
  :PathTransition => "javafx.animation.PathTransition",
  :PauseTransition => "javafx.animation.PauseTransition",
  :RotateTransition => "javafx.animation.RotateTransition",
  :ScaleTransition => "javafx.animation.ScaleTransition",
  :SequentialTransition => "javafx.animation.SequentialTransition",
  :StrokeTransition => "javafx.animation.StrokeTransition",
  :Timeline => "javafx.animation.Timeline",
  :Transition => "javafx.animation.Transition",
  :TranslateTransition => "javafx.animation.TranslateTransition",
  :Platform => "javafx.application.Platform",
  :SimpleBooleanProperty => "javafx.beans.property.SimpleBooleanProperty",
  :SimpleDoubleProperty => "javafx.beans.property.SimpleDoubleProperty",
  :SimpleFloatProperty => "javafx.beans.property.SimpleFloatProperty",
  :SimpleIntegerProperty => "javafx.beans.property.SimpleIntegerProperty",
  :SimpleListProperty => "javafx.beans.property.SimpleListProperty",
  :SimpleLongProperty => "javafx.beans.property.SimpleLongProperty",
  :SimpleMapProperty => "javafx.beans.property.SimpleMapProperty",
  :SimpleObjectProperty => "javafx.beans.property.SimpleObjectProperty",
  :SimpleSetProperty => "javafx.beans.property.SimpleSetProperty",
  :SimpleStringProperty => "javafx.beans.property.SimpleStringProperty",
  :ChangeListener => "javafx.beans.value.ChangeListener",
  :FXCollections => "javafx.collections.FXCollections",
  :Worker => "javafx.concurrent.Worker",
  :Task => "javafx.concurrent.Task",
  :Service => "javafx.concurrent.Service",
  :Event => "javafx.event.Event",
  :ActionEvent => "javafx.event.ActionEvent",
  :EventHandler => "javafx.event.EventHandler",
  :Initializable => "javafx.fxml.Initializable",
  :LoadException => "javafx.fxml.LoadException",
  :HorizontalDirection => "javafx.geometry.HorizontalDirection",
  :HPos => "javafx.geometry.HPos",
  :Insets => "javafx.geometry.Insets",
  :Orientation => "javafx.geometry.Orientation",
  :Pos => "javafx.geometry.Pos",
  :Rectangle2D => "javafx.geometry.Rectangle2D",
  :Side => "javafx.geometry.Side",
  :VerticalDirection => "javafx.geometry.VerticalDirection",
  :VPos => "javafx.geometry.VPos",
  :Group => "javafx.scene.Group",
  :Node => "javafx.scene.Node",
  :Parent => "javafx.scene.Parent",
  :Scene => "javafx.scene.Scene",
  :Canvas => "javafx.scene.canvas.Canvas",
  :AreaChart => "javafx.scene.chart.AreaChart",
  :Axis => "javafx.scene.chart.Axis",
  :BarChart => "javafx.scene.chart.BarChart",
  :BubbleChart => "javafx.scene.chart.BubbleChart",
  :CategoryAxis => "javafx.scene.chart.CategoryAxis",
  :Chart => "javafx.scene.chart.Chart",
  :LineChart => "javafx.scene.chart.LineChart",
  :NumberAxis => "javafx.scene.chart.NumberAxis",
  :PieChart => "javafx.scene.chart.PieChart",
  :ScatterChart => "javafx.scene.chart.ScatterChart",
  :StackedAreaChart => "javafx.scene.chart.StackedAreaChart",
  :StackedBarChart => "javafx.scene.chart.StackedBarChart",
  :ValueAxis => "javafx.scene.chart.ValueAxis",
  :XYChart => "javafx.scene.chart.XYChart",
  :Accordion => "javafx.scene.control.Accordion",
  :Button => "javafx.scene.control.Button",
  :Cell => "javafx.scene.control.Cell",
  :CheckBox => "javafx.scene.control.CheckBox",
  :CheckBoxTreeItem => "javafx.scene.control.CheckBoxTreeItem",
  :CheckMenuItem => "javafx.scene.control.CheckMenuItem",
  :ChoiceBox => "javafx.scene.control.ChoiceBox",
  :ColorPicker => "javafx.scene.control.ColorPicker",
  :ComboBox => "javafx.scene.control.ComboBox",
  :ContextMenu => "javafx.scene.control.ContextMenu",
  :Hyperlink => "javafx.scene.control.Hyperlink",
  :Label => "javafx.scene.control.Label",
  :ListCell => "javafx.scene.control.ListCell",
  :ListView => "javafx.scene.control.ListView",
  :Menu => "javafx.scene.control.Menu",
  :MenuBar => "javafx.scene.control.MenuBar",
  :MenuButton => "javafx.scene.control.MenuButton",
  :MenuItem => "javafx.scene.control.MenuItem",
  :Pagination => "javafx.scene.control.Pagination",
  :PasswordField => "javafx.scene.control.PasswordField",
  :PopupControl => "javafx.scene.control.PopupControl",
  :ProgressBar => "javafx.scene.control.ProgressBar",
  :ProgressIndicator => "javafx.scene.control.ProgressIndicator",
  :RadioButton => "javafx.scene.control.RadioButton",
  :RadioMenuItem => "javafx.scene.control.RadioMenuItem",
  :ScrollBar => "javafx.scene.control.ScrollBar",
  :ScrollPane => "javafx.scene.control.ScrollPane",
  :Separator => "javafx.scene.control.Separator",
  :SeparatorMenuItem => "javafx.scene.control.SeparatorMenuItem",
  :Slider => "javafx.scene.control.Slider",
  :SplitMenuButton => "javafx.scene.control.SplitMenuButton",
  :SplitPane => "javafx.scene.control.SplitPane",
  :Tab => "javafx.scene.control.Tab",
  :TableView => "javafx.scene.control.TableView",
  :TableCell => "javafx.scene.control.TableCell",
  :TableColumn => "javafx.scene.control.TableColumn",
  :TabPane => "javafx.scene.control.TabPane",
  :TextArea => "javafx.scene.control.TextArea",
  :TextField => "javafx.scene.control.TextField",
  :TitledPane => "javafx.scene.control.TitledPane",
  :ToggleButton => "javafx.scene.control.ToggleButton",
  :ToggleGroup => "javafx.scene.control.ToggleGroup",
  :ToolBar => "javafx.scene.control.ToolBar",
  :Tooltip => "javafx.scene.control.Tooltip",
  :TreeCell => "javafx.scene.control.TreeCell",
  :TreeItem => "javafx.scene.control.TreeItem",
  :TreeView => "javafx.scene.control.TreeView",
  :ContentDisplay => "javafx.scene.control.ContentDisplay",
  :OverrunStyle => "javafx.scene.control.OverrunStyle",
  :SelectionMode => "javafx.scene.control.SelectionMode",
  :Blend => "javafx.scene.effect.Blend",
  :BlendMode => "javafx.scene.effect.BlendMode",
  :Bloom => "javafx.scene.effect.Bloom",
  :BlurType => "javafx.scene.effect.BlurType",
  :BoxBlur => "javafx.scene.effect.BoxBlur",
  :ColorAdjust => "javafx.scene.effect.ColorAdjust",
  :ColorInput => "javafx.scene.effect.ColorInput",
  :DisplacementMap => "javafx.scene.effect.DisplacementMap",
  :DropShadow => "javafx.scene.effect.DropShadow",
  :GaussianBlur => "javafx.scene.effect.GaussianBlur",
  :Glow => "javafx.scene.effect.Glow",
  :ImageInput => "javafx.scene.effect.ImageInput",
  :InnerShadow => "javafx.scene.effect.InnerShadow",
  :Lighting => "javafx.scene.effect.Lighting",
  :MotionBlur => "javafx.scene.effect.MotionBlur",
  :PerspectiveTransform => "javafx.scene.effect.PerspectiveTransform",
  :Reflection => "javafx.scene.effect.Reflection",
  :SepiaTone => "javafx.scene.effect.SepiaTone",
  :Shadow => "javafx.scene.effect.Shadow",
  :Image => "javafx.scene.image.Image",
  :ImageView => "javafx.scene.image.ImageView",
  :PixelReader => "javafx.scene.image.PixelReader",
  :PixelWriter => "javafx.scene.image.PixelWriter",
  :Clipboard => "javafx.scene.input.Clipboard",
  :ClipboardContent => "javafx.scene.input.ClipboardContent",
  :ContextMenuEvent => "javafx.scene.input.ContextMenuEvent",
  :DragEvent => "javafx.scene.input.DragEvent",
  :GestureEvent => "javafx.scene.input.GestureEvent",
  :InputEvent => "javafx.scene.input.InputEvent",
  :InputMethodEvent => "javafx.scene.input.InputMethodEvent",
  :KeyCode => "javafx.scene.input.KeyCode",
  :KeyEvent => "javafx.scene.input.KeyEvent",
  :Mnemonic => "javafx.scene.input.Mnemonic",
  :MouseButton => "javafx.scene.input.MouseButton",
  :MouseDragEvent => "javafx.scene.input.MouseDragEvent",
  :MouseEvent => "javafx.scene.input.MouseEvent",
  :RotateEvent => "javafx.scene.input.RotateEvent",
  :ScrollEvent => "javafx.scene.input.ScrollEvent",
  :SwipeEvent => "javafx.scene.input.SwipeEvent",
  :TouchEvent => "javafx.scene.input.TouchEvent",
  :TransferMode => "javafx.scene.input.TransferMode",
  :ZoomEvent => "javafx.scene.input.ZoomEvent",
  :AnchorPane => "javafx.scene.layout.AnchorPane",
  :BorderPane => "javafx.scene.layout.BorderPane",
  :ColumnConstraints => "javafx.scene.layout.ColumnConstraints",
  :FlowPane => "javafx.scene.layout.FlowPane",
  :GridPane => "javafx.scene.layout.GridPane",
  :HBox => "javafx.scene.layout.HBox",
  :Pane => "javafx.scene.layout.Pane",
  :Priority => "javafx.scene.layout.Priority",
  :RowConstraints => "javafx.scene.layout.RowConstraints",
  :StackPane => "javafx.scene.layout.StackPane",
  :TilePane => "javafx.scene.layout.TilePane",
  :VBox => "javafx.scene.layout.VBox",
  :AudioClip => "javafx.scene.media.AudioClip",
  :AudioEqualizer => "javafx.scene.media.AudioEqualizer",
  :AudioTrack => "javafx.scene.media.AudioTrack",
  :EqualizerBand => "javafx.scene.media.EqualizerBand",
  :Media => "javafx.scene.media.Media",
  :MediaException => "javafx.scene.media.MediaException",
  :MediaErrorEvent => "javafx.scene.media.MediaErrorEvent",
  :MediaMarkerEvent => "javafx.scene.media.MediaMarkerEvent",
  :MediaPlayer => "javafx.scene.media.MediaPlayer",
  :MediaView => "javafx.scene.media.MediaView",
  :VideoTrack => "javafx.scene.media.VideoTrack",
  :Color => "javafx.scene.paint.Color",
  :CycleMethod => "javafx.scene.paint.CycleMethod",
  :ImagePattern => "javafx.scene.paint.ImagePattern",
  :LinearGradient => "javafx.scene.paint.LinearGradient",
  :Paint => "javafx.scene.paint.Paint",
  :RadialGradient => "javafx.scene.paint.RadialGradient",
  :Stop => "javafx.scene.paint.Stop",
  :Arc => "javafx.scene.shape.Arc",
  :ArcTo => "javafx.scene.shape.ArcTo",
  :ArcType => "javafx.scene.shape.ArcType",
  :Circle => "javafx.scene.shape.Circle",
  :ClosePath => "javafx.scene.shape.ClosePath",
  :CubicCurve => "javafx.scene.shape.CubicCurve",
  :CubicCurveTo => "javafx.scene.shape.CubicCurveTo",
  :Ellipse => "javafx.scene.shape.Ellipse",
  :FillRule => "javafx.scene.shape.FillRule",
  :HLineTo => "javafx.scene.shape.HLineTo",
  :Line => "javafx.scene.shape.Line",
  :LineTo => "javafx.scene.shape.LineTo",
  :MoveTo => "javafx.scene.shape.MoveTo",
  :Path => "javafx.scene.shape.Path",
  :PathElement => "javafx.scene.shape.PathElement",
  :Polygon => "javafx.scene.shape.Polygon",
  :Polyline => "javafx.scene.shape.Polyline",
  :QuadCurve => "javafx.scene.shape.QuadCurve",
  :QuadCurveTo => "javafx.scene.shape.QuadCurveTo",
  :Rectangle => "javafx.scene.shape.Rectangle",
  :Shape => "javafx.scene.shape.Shape",
  :StrokeLineCap => "javafx.scene.shape.StrokeLineCap",
  :StrokeLineJoin => "javafx.scene.shape.StrokeLineJoin",
  :StrokeType => "javafx.scene.shape.StrokeType",
  :SVGPath => "javafx.scene.shape.SVGPath",
  :VLineTo => "javafx.scene.shape.VLineTo",
  :Font => "javafx.scene.text.Font",
  :FontPosture => "javafx.scene.text.FontPosture",
  :FontSmoothingType => "javafx.scene.text.FontSmoothingType",
  :FontWeight => "javafx.scene.text.FontWeight",
  :Text => "javafx.scene.text.Text",
  :TextAlignment => "javafx.scene.text.TextAlignment",
  :TextBoundsType => "javafx.scene.text.TextBoundsType",
  :Affine => "javafx.scene.transform.Affine",
  :Rotate => "javafx.scene.transform.Rotate",
  :Scale => "javafx.scene.transform.Scale",
  :Shear => "javafx.scene.transform.Shear",
  :Translate => "javafx.scene.transform.Translate",
  :WebView => "javafx.scene.web.WebView",
  :HTMLEditor => "javafx.scene.web.HTMLEditor",
  :DirectoryChooser => "javafx.stage.DirectoryChooser",
  :FileChooser => "javafx.stage.FileChooser",
  :Modality => "javafx.stage.Modality",
  :Popup => "javafx.stage.Popup",
  :PopupWindow => "javafx.stage.PopupWindow",
  :Screen => "javafx.stage.Screen",
  :Stage => "javafx.stage.Stage",
  :StageStyle => "javafx.stage.StageStyle",
  :Window => "javafx.stage.Window",
  :WindowEvent => "javafx.stage.WindowEvent",
  :Duration => "javafx.util.Duration"
}
JFX_CLASS_HIERARCHY =

This is the list of all classes in JavaFX that most apps should care about. It is a hashmaps with the leafs as arrays. Where a leaf also contains more packages, the hashmap key is “” (empty string). You can utilize this constant to save yourself some typing when adding code for most/all of the JavaFX classes by using either ‘Hash.flat_tree_inject` from jrubyfx/utils.rb or writing your own traversal function

{ :javafx => {
    :animation => %w[Animation AnimationTimer FadeTransition FillTransition Interpolator KeyFrame KeyValue ParallelTransition PathTransition
    PauseTransition RotateTransition ScaleTransition SequentialTransition StrokeTransition Timeline Transition TranslateTransition],
    :application => ['Platform'],
    :beans => {
      :property => %w[SimpleBooleanProperty SimpleDoubleProperty SimpleFloatProperty SimpleIntegerProperty SimpleListProperty SimpleLongProperty SimpleMapProperty SimpleObjectProperty SimpleSetProperty SimpleStringProperty],
      #TODO: import more
      :value => ['ChangeListener']
    },
    :collections => ['FXCollections'],
    :concurrent => %w[Worker Task Service],
    :event => %w[Event ActionEvent EventHandler],
    :fxml => ['Initializable', 'LoadException'],
    :geometry => %w[HorizontalDirection HPos Insets Orientation Pos Rectangle2D Side VerticalDirection VPos],
    :scene => {
      '' => %w[Group Node Parent Scene],
      :canvas => ['Canvas'],
      :chart => %w[AreaChart Axis BarChart BubbleChart CategoryAxis Chart LineChart NumberAxis
      PieChart ScatterChart StackedAreaChart StackedBarChart ValueAxis XYChart],
      :control => %w[Accordion Button Cell CheckBox CheckBoxTreeItem CheckMenuItem ChoiceBox ColorPicker ComboBox ContextMenu Hyperlink
      Label ListCell ListView Menu MenuBar MenuButton MenuItem Pagination PasswordField PopupControl ProgressBar ProgressIndicator RadioButton
      RadioMenuItem ScrollBar ScrollPane Separator SeparatorMenuItem Slider SplitMenuButton SplitPane Tab TableView TableCell TableColumn TabPane TextArea
      TextField TitledPane ToggleButton ToggleGroup ToolBar Tooltip TreeCell TreeItem TreeView ContentDisplay OverrunStyle SelectionMode],
      :effect => %w[Blend BlendMode Bloom BlurType BoxBlur ColorAdjust ColorInput DisplacementMap DropShadow GaussianBlur Glow ImageInput
      InnerShadow Lighting MotionBlur PerspectiveTransform Reflection SepiaTone Shadow],
      :image => %w[Image ImageView PixelReader PixelWriter],
      :input => %w[Clipboard ClipboardContent ContextMenuEvent DragEvent GestureEvent InputEvent InputMethodEvent KeyCode KeyEvent
      Mnemonic MouseButton MouseDragEvent MouseEvent RotateEvent ScrollEvent SwipeEvent TouchEvent TransferMode ZoomEvent],
      :layout => %w[AnchorPane BorderPane ColumnConstraints FlowPane GridPane HBox Pane Priority RowConstraints StackPane TilePane VBox],
      :media => %w[AudioClip AudioEqualizer AudioTrack EqualizerBand Media MediaException
      MediaErrorEvent MediaMarkerEvent MediaPlayer MediaView VideoTrack],
      :paint => %w[Color CycleMethod ImagePattern LinearGradient Paint RadialGradient Stop],
      :shape => %w[Arc ArcTo ArcType Circle ClosePath CubicCurve CubicCurveTo Ellipse FillRule HLineTo Line LineTo MoveTo Path PathElement
      Polygon Polyline QuadCurve QuadCurveTo Rectangle Shape StrokeLineCap StrokeLineJoin StrokeType SVGPath VLineTo],
      :text => %w[Font FontPosture FontSmoothingType FontWeight Text TextAlignment TextBoundsType],
      :transform => %w[Affine Rotate Scale Shear Translate],
      :web => ['WebView', 'HTMLEditor']
    },
    :stage => %w[DirectoryChooser FileChooser Modality Popup PopupWindow Screen Stage StageStyle Window WindowEvent],
    :util => ['Duration']
  }
}

Instance Method Summary collapse

Instance Method Details

#const_missing(c) ⇒ Object

The below lines are generated by ‘rake reflect`. Do not edit.



64
65
66
67
68
69
70
# File 'lib/jrubyfx/imports.rb', line 64

def const_missing(c)
  if LOCAL_NAME_MAP.has_key? c
    java_import(LOCAL_NAME_MAP[c])[0]
  else
    super
  end
end