Class: Java::javafx::stage::FileChooser
- Inherits:
-
Object
- Object
- Java::javafx::stage::FileChooser
- Includes:
- JRubyFX::DSL
- Defined in:
- lib/jrubyfx/core_ext/file_chooser.rb
Overview
JRubyFX DSL extensions for JavaFX FileChooser
Constant Summary
Constants included from JRubyFX::DSL
JRubyFX::DSL::NAME_TO_CLASSES, JRubyFX::DSL::NAME_TO_CLASS_NAME
Constants included from JRubyFX::FXImports
JRubyFX::FXImports::JFX_CLASS_HIERARCHY, JRubyFX::FXImports::LOCAL_NAME_MAP
Constants included from JRubyFX
Instance Method Summary collapse
-
#add_extension_filter(desc, filter = nil) ⇒ Object
call-seq: add_extension_filter(description) add_extension_filter(description, filter) add_extension_filter(description, [filter, …]).
-
#add_extension_filters(filters) ⇒ Object
call-seq: add_extension_filters([description, …]) add_extension_filters(=> filter, …) add_extension_filters(=> [filter, …], …).
Methods included from JRubyFX::DSL
compile_dsl, included, load_dsl, #logical_lookup, #method_missing, #self_test_lookup, write_color_method_converter, write_enum_converter, write_enum_method_converter, write_event_method
Methods included from JRubyFX::FXImports
Methods included from JRubyFX
#build, included, load_fx, #run_later, #with
Methods included from JRubyFX::Utils::CommonUtils
#attempt_conversion, #populate_properties, #split_args_from_properties
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class JRubyFX::DSL
Instance Method Details
#add_extension_filter(desc, filter = nil) ⇒ Object
call-seq:
add_extension_filter(description)
add_extension_filter(description, filter)
add_extension_filter(description, [filter, ...])
Takes ether a straight descriptions with embedded (*.whatnot) filter, or separately, where filter can be an array or a string. Note that without a filter, the description MUST contain a list of extensions in parens.
Examples
add_extension_filter("Ruby Files (*.rb)")
add_extension_filter("Ruby Files (*.rb)", "*.rb")
add_extension_filter("Ruby Files (*.rb)", ["*.rb", "*.rbw"])
36 37 38 39 40 41 42 43 44 |
# File 'lib/jrubyfx/core_ext/file_chooser.rb', line 36 def add_extension_filter(desc, filter=nil) if filter == nil # Attempt to parse out list of stuff in parens filter = desc.match(/\(([\*\.\w;:, ]+)\)$/)[1] # grab everthing inside last parens filter = filter.split(/[:; ,]/).delete_if(&:empty?) end filter = [filter] unless filter.is_a? Array extension_filters.add(ExtensionFilter.new(desc.to_s, filter)) end |
#add_extension_filters(filters) ⇒ Object
call-seq:
add_extension_filters([description, ...])
add_extension_filters({description => filter, ...})
add_extension_filters({description => [filter, ...], ...})
Takes a straight list of descriptions with embedded (*.whatnot) filters, or a hash of “description” => “*.whatnot” or a hash of “description => [”*.whatnot“, ”*.etc“]
Examples
add_extension_filters(["Ruby Files (*.rb)", "Python Files (*.py)"])
add_extension_filters("Ruby Files (*.rb)" => "*.rb", "Python Files (*.py)" => ["*.py", "*.pyc"])
57 58 59 60 61 62 |
# File 'lib/jrubyfx/core_ext/file_chooser.rb', line 57 def add_extension_filters(filters) #works with both arrays and hashes filters.each do |filters| add_extension_filter(*filters) end end |