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


399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
# File 'lib/fxmlloader/real_elts.rb', line 399

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)
    if $JRUBYFX_AOT_COMPILING
      root = parentLoader.root = type.ruby_class.new
      value = root
    else
      raise LoadException.new("Root hasn't been set. Use method setRoot() before load.");
    end
  else
    if (!type.isAssignableFrom(root.java_class()))
      raise LoadException.new("Root is not an instance of "										+ type.getName() + ".");
    end

    value = root;
  end
  rputs value, "with(__local_fxml_controller) do"
  rnest 1
  return value;
end

#processAttribute(prefix, localName, value) ⇒ Object


382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
# File 'lib/fxmlloader/real_elts.rb', line 382

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