Class: RootElement

Inherits:
ValueElement show all
Defined in:
lib/fxmlloader/real_elts.rb

Overview

Element representing a predefined root value

Instance Attribute Summary

Attributes inherited from ValueElement

#fx_id

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 Method Details

#constructValueObject



375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
# File 'lib/fxmlloader/real_elts.rb', line 375

def constructValue()
  if (@type == nil)
    raise LoadException.new(FXL::ROOT_TYPE_ATTRIBUTE + " is required.");
  end

  type = parentLoader.getType(@type);

  if (type == nil)
    raise LoadException.new(@type + " is not a valid type.");
  end

  value=nil
  root = parentLoader.root
  if (root == nil)
    raise LoadException.new("Root hasn't been set. Use method setRoot() before load.");
  else
    if (!type.isAssignableFrom(root.java_class()))
      raise LoadException.new("Root is not an instance of "                   + type.getName() + ".");
    end

    value = root;
  end

  return value;
end

#processAttribute(prefix, localName, value) ⇒ Object



358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
# File 'lib/fxmlloader/real_elts.rb', line 358

def processAttribute( prefix,  localName,  value)

  if (prefix == nil)
    if (localName == (FXL::ROOT_TYPE_ATTRIBUTE))
      if (loadListener != nil)
        loadListener.readInternalAttribute(localName, value);
      end

      @type = value;
    else
      super(prefix, localName, value);
    end
  else
    super(prefix, localName, value);
  end
end