Class: CopyElement
- Inherits:
-
ValueElement
- Object
- Element
- ValueElement
- CopyElement
- Defined in:
- lib/fxmlloader/real_elts.rb
Overview
Element representing a copy
Instance Attribute Summary collapse
-
#source ⇒ Object
Returns the value of attribute source.
Attributes inherited from ValueElement
Attributes inherited from Element
#current, #eventHandlerAttributes, #instancePropertyAttributes, #lineNumber, #loadListener, #parent, #parentLoader, #staticPropertyAttributes, #staticPropertyElements, #value, #valueAdapter, #xmlStreamReader
Instance Method Summary collapse
Methods inherited from ValueElement
#getListValue, #processCharacters, #processEndElement, #processStartElement, #processValue
Methods inherited from Element
#add, #addEventHandler, #applyProperty, #callz, #getProperties, #getValueAdapter, #initialize, #isBidirectionalBindingExpression, #isBindingExpression, #isCollection, #isTyped, #populateArrayFromString, #populateListFromString, #processCharacters, #processEndElement, #processEventHandlerAttributes, #processInstancePropertyAttributes, #processPropertyAttribute, #processStartElement, #processValue3, #resolvePrefixedValue, #set, #staticLoad, #updateValue, #warnDeprecatedEscapeSequence
Constructor Details
This class inherits a constructor from Element
Instance Attribute Details
#source ⇒ Object
Returns the value of attribute source.
293 294 295 |
# File 'lib/fxmlloader/real_elts.rb', line 293 def source @source end |
Instance Method Details
#constructValue ⇒ Object
313 314 315 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 |
# File 'lib/fxmlloader/real_elts.rb', line 313 def constructValue() if (source == nil) raise LoadException.new(FXL::COPY_SOURCE_ATTRIBUTE + " is required."); end path = KeyPath.parse(source); if (!Expression.isDefined(namespace, path)) raise LoadException.new("Value \"" + source + "\" does not exist."); end sourceValue = Expression.get(namespace, path); sourceValueType = sourceValue.java_class(); constructor = nil; begin constructor = ConstructorUtil.getConstructor(sourceValueType, [sourceValueType]); rescue NoSuchMethodException => exception # No-op end value=nil if (constructor != nil) begin #TODO: try to do evil things here ReflectUtil.checkPackageAccess(sourceValueType); value = constructor.newInstance(sourceValue); rescue InstantiationException => exception raise LoadException.new(exception); rescue IllegalAccessException => exception raise LoadException.new(exception); rescue InvocationTargetException => exception raise LoadException.new(exception); end else raise LoadException.new("Can't copy value " + sourceValue + "."); end return value; end |
#processAttribute(prefix, localName, value) ⇒ Object
296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 |
# File 'lib/fxmlloader/real_elts.rb', line 296 def processAttribute(prefix, localName, value) if (prefix == nil) if (localName == (FXL::COPY_SOURCE_ATTRIBUTE)) if (loadListener != nil) loadListener.readInternalAttribute(localName, value); end @source = value; else super(prefix, localName, value); end else super(prefix, localName, value); end end |