Class: JLDrill::SetOptionsContext::OptionsView

Inherits:
Context::View show all
Defined in:
lib/jldrill/contexts/SetOptionsContext.rb

Direct Known Subclasses

Gtk::OptionsView, Test::OptionsView

Instance Attribute Summary collapse

Attributes inherited from Context::View

#context

Instance Method Summary collapse

Methods inherited from Context::View

#addView, #getWidget, #removeView, #removingViewFrom, #viewAddedTo

Constructor Details

#initialize(context) ⇒ OptionsView

Returns a new instance of OptionsView.



21
22
23
24
25
# File 'lib/jldrill/contexts/SetOptionsContext.rb', line 21

def initialize(context)
    super(context)
    @optionsSet = false
    @options = Options.new(nil)
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



19
20
21
# File 'lib/jldrill/contexts/SetOptionsContext.rb', line 19

def options
  @options
end

Instance Method Details

#destroyObject

Destroy the options window



28
29
30
# File 'lib/jldrill/contexts/SetOptionsContext.rb', line 28

def destroy
    # Please define in the concrete class
end

#exitObject

This is a convenience method for the tests so that they have something to catch rather than the exit() on the context.



62
63
64
# File 'lib/jldrill/contexts/SetOptionsContext.rb', line 62

def exit
    @context.exit
end

#optionsSet=(bool) ⇒ Object

Indicate that the options have been modified or not.



33
34
35
# File 'lib/jldrill/contexts/SetOptionsContext.rb', line 33

def optionsSet=(bool)
    @optionsSet = bool
end

#optionsSet?Boolean

Returns true if the options have been modified

Returns:

  • (Boolean)


38
39
40
# File 'lib/jldrill/contexts/SetOptionsContext.rb', line 38

def optionsSet?
    return @optionsSet
end

#runObject

Display the options dialog and get input from the user



54
55
56
57
58
# File 'lib/jldrill/contexts/SetOptionsContext.rb', line 54

def run
    # Please write the code for the concrete class and then
    # call super().  This will simply exit the context.
    exit
end

#setDictionaryFilename(filename) ⇒ Object

Update the UI with the filename of the dictionary



49
50
51
# File 'lib/jldrill/contexts/SetOptionsContext.rb', line 49

def setDictionaryFilename(filename)
    # Please override in the concrete class
end

#update(options) ⇒ Object

Update the UI with the options passed in



43
44
45
46
# File 'lib/jldrill/contexts/SetOptionsContext.rb', line 43

def update(options)
    @options.assign(options)
    # Call super() first and then write UI specific code
end