Class: IncludeElement
- Inherits:
-
ValueElement
- Object
- Element
- ValueElement
- IncludeElement
- Defined in:
- lib/fxmlloader/real_elts.rb
Overview
Element representing an include
Instance Attribute Summary collapse
-
#charset ⇒ Object
TODO: cleanup.
-
#resources ⇒ Object
TODO: cleanup.
-
#source ⇒ Object
TODO: cleanup.
Attributes inherited from ValueElement
Attributes inherited from Element
#current, #eventHandlerAttributes, #instancePropertyAttributes, #lineNumber, #loadListener, #parent, #parentLoader, #staticPropertyAttributes, #staticPropertyElements, #value, #valueAdapter, #xmlStreamReader
Instance Method Summary collapse
- #constructValue ⇒ Object
-
#initialize(current, xmlStreamReader, loadListener, parentLoader) ⇒ IncludeElement
constructor
A new instance of IncludeElement.
- #processAttribute(prefix, localName, value) ⇒ Object
Methods inherited from ValueElement
#getListValue, #processCharacters, #processEndElement, #processStartElement, #processValue
Methods inherited from Element
#add, #addEventHandler, #applyProperty, #callz, #getProperties, #getValueAdapter, #isBidirectionalBindingExpression, #isBindingExpression, #isCollection, #isTyped, #populateArrayFromString, #populateListFromString, #processCharacters, #processEndElement, #processEventHandlerAttributes, #processInstancePropertyAttributes, #processPropertyAttribute, #processStartElement, #processValue3, #resolvePrefixedValue, #set, #staticLoad, #updateValue, #warnDeprecatedEscapeSequence
Constructor Details
#initialize(current, xmlStreamReader, loadListener, parentLoader) ⇒ IncludeElement
Returns a new instance of IncludeElement.
188 189 190 191 192 193 |
# File 'lib/fxmlloader/real_elts.rb', line 188 def initialize(current, xmlStreamReader, loadListener, parentLoader) super @source = nil; @resources = parentLoader.resources; @charset = parentLoader.charset; end |
Instance Attribute Details
#charset ⇒ Object
TODO: cleanup
187 188 189 |
# File 'lib/fxmlloader/real_elts.rb', line 187 def charset @charset end |
#resources ⇒ Object
TODO: cleanup
187 188 189 |
# File 'lib/fxmlloader/real_elts.rb', line 187 def resources @resources end |
#source ⇒ Object
TODO: cleanup
187 188 189 |
# File 'lib/fxmlloader/real_elts.rb', line 187 def source @source end |
Instance Method Details
#constructValue ⇒ Object
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 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 |
# File 'lib/fxmlloader/real_elts.rb', line 225 def constructValue() if (source == nil) raise LoadException.new(FXL::INCLUDE_SOURCE_ATTRIBUTE + " is required."); end location = nil if (source[0] == '/') location = classLoader.getResource(source[1..-1]); else if (location == nil) raise LoadException.new("Base location is undefined."); end location = URL.new(location, source); end fxmlLoader = FxmlLoader.new(location, controller, resources, parentLoader.builderFactory, charset, loaders); fxmlLoader.parentLoader = parentSelf if (isCyclic(parentSelf, fxmlLoader)) raise IOException.new( String.format( "Including \"%s\" in \"%s\" created cyclic reference.", fxmlLoader.location.toExternalForm(), parentSelf.location.toExternalForm())); end fxmlLoader.setClassLoader(classLoader); fxmlLoader.setStaticLoad(staticLoad); value = fxmlLoader.load(); if (fx_id != nil) id = fx_id + FXL::CONTROLLER_SUFFIX; controller = fxmlLoader.getController(); namespace.put(id, controller); if (parentLoader.controller != nil) field = getControllerFields().get(id); if (field != nil) begin field.set(parentLoader.controller, controller); rescue IllegalAccessException => exception raise LoadException.new(exception); end end end end return value; end |
#processAttribute(prefix, localName, value) ⇒ Object
195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 |
# File 'lib/fxmlloader/real_elts.rb', line 195 def processAttribute(prefix, localName, value) if (prefix == nil) if (localName == (FXL::INCLUDE_SOURCE_ATTRIBUTE)) if (loadListener != nil) loadListener.readInternalAttribute(localName, value); end source = value; elsif (localName == (FXL::INCLUDE_RESOURCES_ATTRIBUTE)) if (loadListener != nil) loadListener.readInternalAttribute(localName, value); end resources = ResourceBundle.getBundle(value, Locale.getDefault(), parentLoader.resources.java_class().getClassLoader()); elsif (localName == (FXL::INCLUDE_CHARSET_ATTRIBUTE)) if (loadListener != nil) loadListener.readInternalAttribute(localName, value); end charset = Charset.forName(value); else super(prefix, localName, value); end else super(prefix, localName, value); end end |