Class: RRExpressionValue

Inherits:
Object
  • Object
show all
Defined in:
lib/fxmlloader/j8_expression_value.rb

Overview

/**

  • Class representing an observable expression value.

*/

Instance Method Summary collapse

Constructor Details

#initialize(namespace, expression, type) ⇒ RRExpressionValue

Returns a new instance of RRExpressionValue.



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/fxmlloader/j8_expression_value.rb', line 35

def initialize(namespace, expression, type)
  super()
  if (namespace == nil)
    raise "NullPointerException.new();"
  end

  if (expression == nil)
    raise "NullPointerException.new();"
  end

  if (type == nil)
    raise "NullPointerException.new();"
  end

  @listenerCount = 0;

  @namespace = namespace;
  @expression = expression;
  @type = type;

  arguments = expression.getArguments();
  @argumentMonitors = java.util.ArrayList.new(arguments.size());

  for  argument in arguments
    @argumentMonitors.add(KeyPathMonitor.new(self, argument.iterator()));
  end
end

Instance Method Details

#addListener(listener) ⇒ Object



68
69
70
71
72
73
74
75
# File 'lib/fxmlloader/j8_expression_value.rb', line 68

def addListener( listener)
  if (@listenerCount == 0)
    monitorArguments();
  end

  super(listener);
  @listenerCount += 1
end

#getValueObject



64
65
66
# File 'lib/fxmlloader/j8_expression_value.rb', line 64

def getValue()
  return RubyWrapperBeanAdapter.coerce(@expression.evaluate(@namespace), @type);
end

#monitorArgumentsObject



86
87
88
89
90
# File 'lib/fxmlloader/j8_expression_value.rb', line 86

def monitorArguments()
  for  argumentMonitor in @argumentMonitors
    argumentMonitor.monitor(@namespace);
  end
end

#removeListener(listener) ⇒ Object



77
78
79
80
81
82
83
84
# File 'lib/fxmlloader/j8_expression_value.rb', line 77

def removeListener( listener)
  super(listener);
  @listenerCount-=1

  if (@listenerCount == 0)
    unmonitorArguments();
  end
end

#unmonitorArgumentsObject



92
93
94
95
96
# File 'lib/fxmlloader/j8_expression_value.rb', line 92

def unmonitorArguments()
  for  argumentMonitor in   @argumentMonitors
    argumentMonitor.unmonitor();
  end
end