Class: Context::View

Inherits:
Object show all
Defined in:
lib/Context/View.rb

Overview

This is the abstract view class

Direct Known Subclasses

PageView

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(context) ⇒ View

Returns a new instance of View.



6
7
8
# File 'lib/Context/View.rb', line 6

def initialize(context)
	@context = context
end

Instance Attribute Details

#contextObject (readonly)

Returns the value of attribute context.



5
6
7
# File 'lib/Context/View.rb', line 5

def context
  @context
end

Instance Method Details

#addView(view) ⇒ Object



10
11
12
13
14
15
16
17
18
19
# File 'lib/Context/View.rb', line 10

def addView(view)
	myWidget = getWidget()
	if(myWidget != nil)
		newWidget = view.getWidget()
		if !newWidget.nil?
  				myWidget.add(newWidget)
  				newWidget.addedTo(myWidget)
  		    end
	end
end

#closeObject

Concrete classes should override this method



37
38
# File 'lib/Context/View.rb', line 37

def close
end

#getWidgetObject

Concrete classes should override this method



41
42
43
# File 'lib/Context/View.rb', line 41

def getWidget
	return nil
end

#notifyKey(widget, key) ⇒ Object



45
46
47
# File 'lib/Context/View.rb', line 45

def notifyKey(widget, key)
	@context.notifyKey(self, key)
end

#openObject

Concrete classes should override this method



33
34
# File 'lib/Context/View.rb', line 33

def open
end

#removeView(view) ⇒ Object



21
22
23
24
25
26
27
28
29
30
# File 'lib/Context/View.rb', line 21

def removeView(view)
    myWidget = getWidget()
    if(myWidget != nil)
        oldWidget = view.getWidget()
        if !oldWidget.nil?
            myWidget.remove(oldWidget)
            oldWidget.removedFrom(myWidget)
        end
    end
end