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.
161 162 163 164 165 166 |
# File 'lib/fxmlloader/real_elts.rb', line 161 def initialize(current, xmlStreamReader, loadListener, parentLoader) super @source = nil; @resources = parentLoader.resources; @charset = parentLoader.charset; end |
Instance Attribute Details
#charset ⇒ Object
TODO: cleanup
160 161 162 |
# File 'lib/fxmlloader/real_elts.rb', line 160 def charset @charset end |
#resources ⇒ Object
TODO: cleanup
160 161 162 |
# File 'lib/fxmlloader/real_elts.rb', line 160 def resources @resources end |
#source ⇒ Object
TODO: cleanup
160 161 162 |
# File 'lib/fxmlloader/real_elts.rb', line 160 def source @source end |
Instance Method Details
#constructValue ⇒ Object
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 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 |
# File 'lib/fxmlloader/real_elts.rb', line 198 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
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 |
# File 'lib/fxmlloader/real_elts.rb', line 168 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 |