Class: JLDrill::GetFilenameContext

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

Defined Under Namespace

Classes: FilenameSelectorView

Constant Summary collapse

OPEN =
0
SAVE =
1

Instance Attribute Summary collapse

Attributes inherited from Context::Context

#mainView, #parent, #viewBridge

Instance Method Summary collapse

Methods inherited from Context::Context

#addView, #exit, #isEntered?, #onExit, #peekAtView, #setupViews

Constructor Details

#initialize(viewBridge) ⇒ GetFilenameContext

Returns a new instance of GetFilenameContext.



16
17
18
19
20
# File 'lib/jldrill/contexts/GetFilenameContext.rb', line 16

def initialize(viewBridge)
	super(viewBridge)
	@filename = nil
	@directory = nil
end

Instance Attribute Details

#directoryObject

Returns the value of attribute directory.



13
14
15
# File 'lib/jldrill/contexts/GetFilenameContext.rb', line 13

def directory
  @directory
end

#filenameObject (readonly)

Returns the value of attribute filename.



13
14
15
# File 'lib/jldrill/contexts/GetFilenameContext.rb', line 13

def filename
  @filename
end

Instance Method Details

#createViewsObject



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

def createViews
    		@mainView = @viewBridge.FilenameSelectorView.new(self)
end

#destroyViewsObject



47
48
49
50
# File 'lib/jldrill/contexts/GetFilenameContext.rb', line 47

def destroyViews
    @mainView.destroy if !@mainView.nil?
    @mainView = nil
end

#enter(parent, type) ⇒ Object



52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/jldrill/contexts/GetFilenameContext.rb', line 52

def enter(parent, type)
    super(parent)
    @mainView.directory = @directory
  		@mainView.run(type)
  		filename = @mainView.filename
          if !filename.nil?
              @filename = filename
              @directory = @mainView.directory
          end
  		self.exit
  		@filename
end