Class: Element
- Inherits:
-
Object
- Object
- Element
- Defined in:
- lib/fxmlloader/elts.rb
Direct Known Subclasses
DefineElement, PropertyElement, UnknownStaticPropertyElement, ValueElement
Instance Attribute Summary collapse
-
#current ⇒ Object
Returns the value of attribute current.
-
#eventHandlerAttributes ⇒ Object
Returns the value of attribute eventHandlerAttributes.
-
#instancePropertyAttributes ⇒ Object
Returns the value of attribute instancePropertyAttributes.
-
#lineNumber ⇒ Object
Returns the value of attribute lineNumber.
-
#loadListener ⇒ Object
Returns the value of attribute loadListener.
-
#parent ⇒ Object
Returns the value of attribute parent.
-
#parentLoader ⇒ Object
Returns the value of attribute parentLoader.
-
#staticPropertyAttributes ⇒ Object
Returns the value of attribute staticPropertyAttributes.
-
#staticPropertyElements ⇒ Object
Returns the value of attribute staticPropertyElements.
-
#value ⇒ Object
Returns the value of attribute value.
-
#valueAdapter ⇒ Object
Returns the value of attribute valueAdapter.
-
#xmlStreamReader ⇒ Object
Returns the value of attribute xmlStreamReader.
Instance Method Summary collapse
- #add(element) ⇒ Object
- #addEventHandler(attribute, eventHandler) ⇒ Object
- #applyProperty(name, sourceType, value) ⇒ Object
- #callz ⇒ Object
- #getProperties ⇒ Object
- #getValueAdapter ⇒ Object
-
#initialize(current, xmlStreamReader, loadListener, parentLoader) ⇒ Element
constructor
A new instance of Element.
- #isBidirectionalBindingExpression(aValue) ⇒ Object
- #isBindingExpression(aValue) ⇒ Object
- #isCollection ⇒ Object
- #isTyped ⇒ Object
-
#populateArrayFromString(type, stringValue) ⇒ Object
TODO: fix this udp to use java arrays.
-
#populateListFromString(valueAdapter, listPropertyName, stringValue) ⇒ Object
TODO: check the types.
- #processAttribute(prefix, localName, value) ⇒ Object
- #processCharacters ⇒ Object
- #processEndElement ⇒ Object
- #processEventHandlerAttributes ⇒ Object
- #processInstancePropertyAttributes ⇒ Object
- #processPropertyAttribute(attribute) ⇒ Object
- #processStartElement ⇒ Object
- #processValue3(sourceType, propertyName, aValue) ⇒ Object
-
#resolvePrefixedValue(aValue) ⇒ Object
Resolves value prefixed with RELATIVE_PATH_PREFIX and RESOURCE_KEY_PREFIX.
- #set(value) ⇒ Object
- #staticLoad ⇒ Object
- #updateValue(value) ⇒ Object
- #warnDeprecatedEscapeSequence(prefix) ⇒ Object
Constructor Details
#initialize(current, xmlStreamReader, loadListener, parentLoader) ⇒ Element
Returns a new instance of Element.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/fxmlloader/elts.rb', line 10 def initialize(current, xmlStreamReader, loadListener, parentLoader) @parent = current; @lineNumber = xmlStreamReader.getLocation().getLineNumber(); @current = current; @xmlStreamReader = xmlStreamReader @loadListener = loadListener @value = nil @valueAdapter = nil @eventHandlerAttributes = [] @instancePropertyAttributes = [] @staticPropertyAttributes = [] @staticPropertyElements = [] @parentLoader = parentLoader end |
Instance Attribute Details
#current ⇒ Object
Returns the value of attribute current.
8 9 10 |
# File 'lib/fxmlloader/elts.rb', line 8 def current @current end |
#eventHandlerAttributes ⇒ Object
Returns the value of attribute eventHandlerAttributes.
9 10 11 |
# File 'lib/fxmlloader/elts.rb', line 9 def eventHandlerAttributes @eventHandlerAttributes end |
#instancePropertyAttributes ⇒ Object
Returns the value of attribute instancePropertyAttributes.
9 10 11 |
# File 'lib/fxmlloader/elts.rb', line 9 def instancePropertyAttributes @instancePropertyAttributes end |
#lineNumber ⇒ Object
Returns the value of attribute lineNumber.
8 9 10 |
# File 'lib/fxmlloader/elts.rb', line 8 def lineNumber @lineNumber end |
#loadListener ⇒ Object
Returns the value of attribute loadListener.
8 9 10 |
# File 'lib/fxmlloader/elts.rb', line 8 def loadListener @loadListener end |
#parent ⇒ Object
Returns the value of attribute parent.
8 9 10 |
# File 'lib/fxmlloader/elts.rb', line 8 def parent @parent end |
#parentLoader ⇒ Object
Returns the value of attribute parentLoader.
8 9 10 |
# File 'lib/fxmlloader/elts.rb', line 8 def parentLoader @parentLoader end |
#staticPropertyAttributes ⇒ Object
Returns the value of attribute staticPropertyAttributes.
9 10 11 |
# File 'lib/fxmlloader/elts.rb', line 9 def staticPropertyAttributes @staticPropertyAttributes end |
#staticPropertyElements ⇒ Object
Returns the value of attribute staticPropertyElements.
9 10 11 |
# File 'lib/fxmlloader/elts.rb', line 9 def staticPropertyElements @staticPropertyElements end |
#value ⇒ Object
Returns the value of attribute value.
9 10 11 |
# File 'lib/fxmlloader/elts.rb', line 9 def value @value end |
#valueAdapter ⇒ Object
Returns the value of attribute valueAdapter.
9 10 11 |
# File 'lib/fxmlloader/elts.rb', line 9 def valueAdapter @valueAdapter end |
#xmlStreamReader ⇒ Object
Returns the value of attribute xmlStreamReader.
8 9 10 |
# File 'lib/fxmlloader/elts.rb', line 8 def xmlStreamReader @xmlStreamReader end |
Instance Method Details
#add(element) ⇒ Object
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/fxmlloader/elts.rb', line 56 def add(element) dputs callz + "about to add #{element} to #{value.to_java}" # If value is a list, add element to it; otherwise, get the value # of the default property, which is assumed to be a list and add # to that (coerce to the appropriate type) if (@value.kind_of?(Enumerable) || @value.java_kind_of?(java.util.List)) value.to_java else type = value.java_class defaultProperty = type.annotation(DefaultProperty.java_class); defaultPropertyName = defaultProperty.to_java.value(); # Get the list value list = getProperties[defaultPropertyName] # Coerce the element to the list item type if (!Map.java_class.assignable_from?(type)) listType = @valueAdapter.getGenericType(defaultPropertyName); element = RubyWrapperBeanAdapter.coerce(element, RubyWrapperBeanAdapter.getListItemType(listType)); end list = list.to_java if list.class == Java::JavaObject list end.add(element) end |
#addEventHandler(attribute, eventHandler) ⇒ Object
509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 |
# File 'lib/fxmlloader/elts.rb', line 509 def addEventHandler(attribute, eventHandler) if (attribute.name.end_with?(FXL::CHANGE_EVENT_HANDLER_SUFFIX)) i = FXL::EVENT_HANDLER_PREFIX.length(); j = attribute.name.length() - FXL::CHANGE_EVENT_HANDLER_SUFFIX.length(); if (i == j) if (@value.is_a? ObservableList) list = @value; list.addListener(ObservableListChangeAdapter.new(list, eventHandler)); elsif (@value.is_a? ObservableMap) map = @value; map.addListener(ObservableMapChangeAdapter.new(map, eventHandler)); else raise LoadException.new("Invalid event source."); end else key = attribute.name[i].downcase + attribute.name[i + 1, j] propertyModel = getValueAdapter().getPropertyModel(key); if (propertyModel == nil) raise LoadException.new(@value.getClass().getName() + " does not define" + " a property model for \"" + key + "\"."); end propertyModel.addListener(PropertyChangeAdapter.new(@value, eventHandler)); end else getValueAdapter[attribute.name] = eventHandler end end |
#applyProperty(name, sourceType, value) ⇒ Object
447 448 449 450 451 452 453 |
# File 'lib/fxmlloader/elts.rb', line 447 def applyProperty(name, sourceType, value) if (sourceType == nil) getProperties[name] = value else RubyWrapperBeanAdapter.put3(@value, sourceType, name, value); end end |
#callz ⇒ Object
27 28 29 30 31 32 33 34 35 |
# File 'lib/fxmlloader/elts.rb', line 27 def callz numz = 1 pppn = @parent while pppn numz+=1 pppn = pppn.parent end (" " * numz) + @lineNumber.to_s + ": " end |
#getProperties ⇒ Object
133 134 135 |
# File 'lib/fxmlloader/elts.rb', line 133 def getProperties() return (isTyped()) ? getValueAdapter() : @value; end |
#getValueAdapter ⇒ Object
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 |
# File 'lib/fxmlloader/elts.rb', line 111 def getValueAdapter() if (@valueAdapter == nil) dputs callz + "trying to get itqq" dprint callz dprint @value dputs @value.class dputs caller if @value.class.to_s == "Java::JavafxFxml::ObjectBuilder" dputs caller end if @value.is_a? java.lang.Object dputs callz + "trying to call wrapper" @valueAdapter = RubyWrapperBeanAdapter.new(@value); else dputs callz + "trying to call ruby object wrapper" @valueAdapter = RubyObjectWrapperBeanAdapter.new(@value) end dputs callz + "got" end return @valueAdapter; end |
#isBidirectionalBindingExpression(aValue) ⇒ Object
272 273 274 |
# File 'lib/fxmlloader/elts.rb', line 272 def isBidirectionalBindingExpression(aValue) return aValue.start_with?(FXL::BI_DIRECTIONAL_BINDING_PREFIX); end |
#isBindingExpression(aValue) ⇒ Object
264 265 266 267 268 269 270 |
# File 'lib/fxmlloader/elts.rb', line 264 def isBindingExpression(aValue) dputs callz + "checking if '#{aValue}' is a binding prefix..." # TODO: BINDING_EXPRESSION_PREFIX == ${ q = aValue.start_with?("${") && aValue.end_with?(FXL::BINDING_EXPRESSION_SUFFIX); dputs callz + "it is? #{q.inspect}" q end |
#isCollection ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/fxmlloader/elts.rb', line 37 def isCollection() # Return true if value is a list, or if the value's type defines # a default property that is a list collection = false if (@value.kind_of?(Enumerable) || @value.java_kind_of?(Java.java.util.List)) collection = true; else defaultProperty = @value.java_class.annotation(DefaultProperty.java_class); if (defaultProperty != nil) collection = getProperties()[defaultProperty.value].java_kind_of?(Java.java.util.List) else collection = false; end end dputs callz + "Is it a collection? #{collection.inspect} <= #{@value.java_class}" return collection; end |
#isTyped ⇒ Object
102 103 104 105 106 107 108 109 |
# File 'lib/fxmlloader/elts.rb', line 102 def isTyped() dputs callz + "checking if typed" dp @value.class dp @value q = !(@value.java_kind_of? Java::java.util.Map or @value.is_a? Hash ); dputs callz + "type result: #{q.inspect}" q end |
#populateArrayFromString(type, stringValue) ⇒ Object
TODO: fix this udp to use java arrays
394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 |
# File 'lib/fxmlloader/elts.rb', line 394 def populateArrayFromString( type, stringValue) propertyValue = nil; # Split the string and set the values as an array componentType = type.getComponentType(); if (stringValue.length > 0) values = stringValue.split(FXL::ARRAY_COMPONENT_DELIMITER); propertyValue = Array.newInstance(componentType, values.length); values.length.times do |i| Array.set(propertyValue, i, RubyWrapperBeanAdapter.coerce(resolvePrefixedValue(values[i].strip), type.getComponentType())); end else propertyValue = Array.newInstance(componentType, 0); end return propertyValue; end |
#populateListFromString(valueAdapter, listPropertyName, stringValue) ⇒ Object
TODO: check the types
421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 |
# File 'lib/fxmlloader/elts.rb', line 421 def populateListFromString( valueAdapter, listPropertyName,stringValue) # Split the string and add the values to the list list = valueAdapter[listPropertyName].to_java listType = valueAdapter.getGenericType(listPropertyName); itemType = RubyWrapperBeanAdapter.getGenericListItemType(listType); if (itemType.is_a? ParameterizedType) itemType = ( itemType).getRawType(); end if (stringValue.length() > 0) values = stringValue.split(FXL::ARRAY_COMPONENT_DELIMITER) for aValue in values aValue = aValue.strip list.add( RubyWrapperBeanAdapter.coerce(resolvePrefixedValue(aValue), itemType)); end end end |
#processAttribute(prefix, localName, value) ⇒ Object
168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 |
# File 'lib/fxmlloader/elts.rb', line 168 def processAttribute(prefix, localName, value) if (prefix == nil) # Add the attribute to the appropriate list if (localName.start_with?(FXL::EVENT_HANDLER_PREFIX)) if (@loadListener != nil) @loadListener.readEventHandlerAttribute(localName, value); end dputs callz + "found eventHandler prefix #{prefix}, #{localName}, #{value}" eventHandlerAttributes <<(Attribute.new(localName, nil, value)); else i = localName.rindex('.'); if (i == nil) # The attribute represents an instance property if (@loadListener != nil) @loadListener.readPropertyAttribute(localName, nil, value); end dputs callz + "found property attrib #{prefix}, #{localName}, #{value}" instancePropertyAttributes << (Attribute.new(localName, nil, value)); else # The attribute represents a static property name = localName[(i + 1)..-1]; sourceType = parentLoader.getType(localName[0, i]); dputs callz + "found static property #{prefix}, #{localName}, #{value}" dputs callz + "and its #{sourceType}, #{staticLoad}" if (sourceType != nil) if (@loadListener != nil) @loadListener.readPropertyAttribute(name, sourceType, value); end @staticPropertyAttributes << (Attribute.new(name, sourceType, value)); elsif (staticLoad) if (@loadListener != nil) @loadListener.readUnknownStaticPropertyAttribute(localName, value); end else raise LoadException.new(localName + " is not a valid attribute."); end end end else raise LoadException.new(prefix + ":" + localName + " is not a valid attribute."); end end |
#processCharacters ⇒ Object
156 157 158 |
# File 'lib/fxmlloader/elts.rb', line 156 def processCharacters() raise LoadException.new("Unexpected characters in input stream."); end |
#processEndElement ⇒ Object
152 153 154 |
# File 'lib/fxmlloader/elts.rb', line 152 def processEndElement() # No-op end |
#processEventHandlerAttributes ⇒ Object
455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 |
# File 'lib/fxmlloader/elts.rb', line 455 def processEventHandlerAttributes() if (@eventHandlerAttributes.length > 0 && !parentLoader.staticLoad) for attribute in @eventHandlerAttributes eventHandler = nil; attrValue = attribute.value; if (attrValue.start_with?(FXL::CONTROLLER_METHOD_PREFIX)) attrValue = attrValue[FXL::CONTROLLER_METHOD_PREFIX.length..-1] if (!attrValue.start_with?(FXL::CONTROLLER_METHOD_PREFIX)) if (attrValue.length() == 0) raise LoadException.new("Missing controller method."); end if (parentLoader.controller == nil) dputs "eek" raise LoadException.new("No controller specified. "); end # method = parentLoader.controller.method(attrValue) # # if (method == nil) # raise LoadException.new("Controller method \"" + attrValue + "\" not found."); # end eventHandler = EventHandlerWrapper.new(parentLoader.controller, attrValue) end elsif (attrValue.start_with?(FXL::EXPRESSION_PREFIX)) attrValue = attrValue[FXL::EXPRESSION_PREFIX.length..-1] if (attrValue.length() == 0) raise LoadException.new("Missing expression reference."); end dputs callz + "exprValue!' #{attrValue}'" expression = Expression.get(@namespace, KeyPath.parse(attrValue)); if (expression.is_a? EventHandler) eventHandler = expression; end end if (eventHandler == nil) if (attrValue.length() == 0 || @scriptEngine == nil) raise LoadException.new("Error resolving " + attribute.name + "='" + attribute.value + "', either the event handler is not in the Namespace or there is an error in the script."); end eventHandler = ScriptEventHandler.new(attrValue, @scriptEngine); end # Add the handler if (eventHandler != nil) addEventHandler(attribute, eventHandler); end end end end |
#processInstancePropertyAttributes ⇒ Object
160 161 162 163 164 165 166 |
# File 'lib/fxmlloader/elts.rb', line 160 def processInstancePropertyAttributes() if (@instancePropertyAttributes.length > 0) for attribute in @instancePropertyAttributes processPropertyAttribute(attribute); end end end |
#processPropertyAttribute(attribute) ⇒ Object
217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 |
# File 'lib/fxmlloader/elts.rb', line 217 def processPropertyAttribute(attribute) value = attribute.value; if (isBindingExpression(value)) dputs callz + "is a binding !" # Resolve the expression if (attribute.sourceType != nil) raise LoadException.new("Cannot bind to static property."); end if (!isTyped()) raise LoadException.new("Cannot bind to untyped object."); end # TODO We may want to identify binding properties in processAttribute() # and apply them after build() has been called if (@value.is_a? Builder) raise LoadException.new("Cannot bind to builder property."); end value = value[2..-2] # TODO: BINDING_EXPRESSION_PREFIX == ${ #value.length() - 1]; # TODO: this only works for 7, not 8 dputs "getting expression value of '#{value}' with #{parentLoader.namespace}" expression = Expression.valueOf(value); dputs callz + "got the expression as '#{expression}'" dp expression # Create the binding targetAdapter = RubyWrapperBeanAdapter.new(@value); dputs callz + "target adapter is #{targetAdapter} from #{value}" propertyModel = targetAdapter.getPropertyModel(attribute.name).to_java type = targetAdapter.getType(attribute.name); dputs callz + "prop model is #{propertyModel.inspect} and type is #{type.inspect}" if (propertyModel.is_a? Property) dputs callz + "checking out value using #{parentLoader.namespace}" #expression.value_property.addListener(JRExpressionTargetMapping.new(expression, getProperties(), Expression.split(value))); ( propertyModel).bind(RRExpressionValue.new(parentLoader.namespace, expression, type)); dputs callz + "bound!" end elsif (isBidirectionalBindingExpression(value)) raise UnsupportedOperationException.new("This feature is not currently enabled."); else dputs callz + "processing 3 for #{attribute.sourceType}, #{attribute.name}, #{value}" processValue3(attribute.sourceType, attribute.name, value); end end |
#processStartElement ⇒ Object
137 138 139 140 141 142 143 144 145 146 147 148 149 150 |
# File 'lib/fxmlloader/elts.rb', line 137 def processStartElement() n = @xmlStreamReader.getAttributeCount() n.times do |i| prefix = @xmlStreamReader.getAttributePrefix(i); localName = @xmlStreamReader.getAttributeLocalName(i); value = @xmlStreamReader.getAttributeValue(i); if (@loadListener && prefix && prefix == (FXL::FX_NAMESPACE_PREFIX)) @loadListener.readInternalAttribute(prefix + ":" + localName, value); end processAttribute(prefix, localName, value); end end |
#processValue3(sourceType, propertyName, aValue) ⇒ Object
276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 |
# File 'lib/fxmlloader/elts.rb', line 276 def processValue3( sourceType, propertyName, aValue) processed = false; #process list or array first if (sourceType == nil && isTyped()) dputs callz + "getting value adptr" lvalueAdapter = getValueAdapter(); type = lvalueAdapter.getType(propertyName); if (type == nil) dputs "Processing values3 fails on: " dp sourceType, propertyName, aValue dp lvalueAdapter dp caller raise PropertyNotFoundException.new("Property \"" + propertyName + "\" does not exist" + " or is read-only."); end dputs "checking assignable" if (List.java_class.assignable_from?(type) && lvalueAdapter.read_only?(propertyName)) populateListFromString(lvalueAdapter, propertyName, aValue); processed = true; elsif false #TODO: fix type.ruby_class.ancestors.include? Enumerable applyProperty(propertyName, sourceType, populateArrayFromString(type, aValue)); processed = true; end end dputs callz + "276" if (!processed) dputs callz + "Must appky it" applyProperty(propertyName, sourceType, resolvePrefixedValue(aValue)); dputs callz + "280" processed = true; end return processed; end |
#resolvePrefixedValue(aValue) ⇒ Object
Resolves value prefixed with RELATIVE_PATH_PREFIX and RESOURCE_KEY_PREFIX.
316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 |
# File 'lib/fxmlloader/elts.rb', line 316 def resolvePrefixedValue(aValue) if (aValue.start_with?(FXL::ESCAPE_PREFIX)) aValue = aValue[FXL::ESCAPE_PREFIX.length..-1] if (aValue.length == 0 || !(aValue.start_with?(FXL::ESCAPE_PREFIX) || aValue.start_with?(FXL::RELATIVE_PATH_PREFIX) || aValue.start_with?(FXL::RESOURCE_KEY_PREFIX) || aValue.start_with?(FXL::EXPRESSION_PREFIX) || aValue.start_with?(FXL::BI_DIRECTIONAL_BINDING_PREFIX))) raise LoadException.new("Invalid escape sequence."); end return aValue; elsif (aValue.start_with?(FXL::RELATIVE_PATH_PREFIX)) aValue = aValue[FXL::RELATIVE_PATH_PREFIX.length..-1] if (aValue.length == 0) raise LoadException.new("Missing relative path."); end if (aValue.start_with?(FXL::RELATIVE_PATH_PREFIX)) # The prefix was escaped warnDeprecatedEscapeSequence(RELATIVE_PATH_PREFIX); return aValue; else begin return (aValue[0] == '/') ? classLoader.getResource(aValue[1..-1]).to_s : URL.new(parentLoader.location, aValue).to_s rescue MalformedURLException => e dp e dputs "#{parentLoader.location} + /+ #{aValue}" raise "whoops" end end elsif (aValue.start_with?(FXL::RESOURCE_KEY_PREFIX)) aValue = aValue[FXL::RESOURCE_KEY_PREFIX.length..-1] if (aValue.length() == 0) raise LoadException.new("Missing resource key."); end if (aValue.start_with?(FXL::RESOURCE_KEY_PREFIX)) # The prefix was escaped warnDeprecatedEscapeSequence(FXL::RESOURCE_KEY_PREFIX); return aValue; else # Resolve the resource value if (@resources == nil) raise LoadException.new("No resources specified."); end if (!@resources.has_key?(aValue)) raise LoadException.new("Resource \"" + aValue + "\" not found."); end return @resources.getString(aValue); end elsif (aValue.start_with?(FXL::EXPRESSION_PREFIX)) aValue = aValue[FXL::EXPRESSION_PREFIX.length..-1] if (aValue.length() == 0) raise LoadException.new("Missing expression."); end if (aValue.start_with?(FXL::EXPRESSION_PREFIX)) # The prefix was escaped warnDeprecatedEscapeSequence(FXL::EXPRESSION_PREFIX); return aValue; elsif (aValue == (FXL::NULL_KEYWORD)) # The attribute value is nil return nil; end dputs callz + "Getting expression '#{aValue}'" # remove all nils, them add one in at the end so [0] returns nil if empty q = (KeyPath.parse(aValue).map{|i|parentLoader.namespace[i]} - [nil] + [nil])[0] dputs callz + "Parsed Expression! #{q};;;;#{q.inspect}" return q end return aValue; end |
#set(value) ⇒ Object
81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/fxmlloader/elts.rb', line 81 def set(value) unless @value raise LoadException.new("Cannot set value on this element."); end # Apply value to this element's properties type = @value.java_class; defaultProperty = type.getAnnotation(DefaultProperty.java_class); if (defaultProperty == nil) raise LoadException.new("Element does not define a default property."); end getProperties[defaultProperty.value] = value end |
#staticLoad ⇒ Object
24 25 26 |
# File 'lib/fxmlloader/elts.rb', line 24 def staticLoad @parentLoader.staticLoad end |
#updateValue(value) ⇒ Object
96 97 98 99 100 |
# File 'lib/fxmlloader/elts.rb', line 96 def updateValue(value) dputs callz + "Updating value from #{@value} to #{value.class}" @value = value; @valueAdapter = nil; end |
#warnDeprecatedEscapeSequence(prefix) ⇒ Object
443 444 445 |
# File 'lib/fxmlloader/elts.rb', line 443 def warnDeprecatedEscapeSequence(prefix) puts(prefix + prefix + " is a deprecated escape sequence. " + "Please use \\" + prefix + " instead."); end |