Class: Xsdvi::SVG::Symbols::AnyAttribute
- Inherits:
-
Xsdvi::SVG::Symbol
- Object
- Tree::Element
- Xsdvi::SVG::Symbol
- Xsdvi::SVG::Symbols::AnyAttribute
- Defined in:
- lib/xsdvi/svg/symbols/any_attribute.rb
Overview
Symbol for XSD anyAttribute wildcard
Constant Summary
Constants inherited from Xsdvi::SVG::Symbol
Xsdvi::SVG::Symbol::MAX_HEIGHT, Xsdvi::SVG::Symbol::MID_HEIGHT, Xsdvi::SVG::Symbol::MIN_HEIGHT, Xsdvi::SVG::Symbol::MIN_WIDTH, Xsdvi::SVG::Symbol::PC_LAX, Xsdvi::SVG::Symbol::PC_SKIP, Xsdvi::SVG::Symbol::PC_STRICT, Xsdvi::SVG::Symbol::X_INDENT, Xsdvi::SVG::Symbol::Y_INDENT
Instance Attribute Summary collapse
-
#namespace ⇒ Object
Returns the value of attribute namespace.
-
#process_contents ⇒ Object
Returns the value of attribute process_contents.
Attributes inherited from Xsdvi::SVG::Symbol
#additional_height, #description, #description_string_array, #height, #start_y_position, #svg, #width, #x_position, #y_position, #y_shift
Attributes inherited from Tree::Element
Instance Method Summary collapse
- #calculate_height ⇒ Object
- #calculate_width ⇒ Object
- #draw ⇒ Object
-
#initialize ⇒ AnyAttribute
constructor
A new instance of AnyAttribute.
Methods inherited from Xsdvi::SVG::Symbol
#prepare_box, reset_class_variables, #x_end, #y_end
Methods inherited from Tree::Element
#add_child, #children?, #code, #first_child?, #index, #last_child, #last_child?, #parent?
Constructor Details
#initialize ⇒ AnyAttribute
Returns a new instance of AnyAttribute.
12 13 14 15 16 |
# File 'lib/xsdvi/svg/symbols/any_attribute.rb', line 12 def initialize super @namespace = nil @process_contents = PC_STRICT end |
Instance Attribute Details
#namespace ⇒ Object
Returns the value of attribute namespace.
10 11 12 |
# File 'lib/xsdvi/svg/symbols/any_attribute.rb', line 10 def namespace @namespace end |
#process_contents ⇒ Object
Returns the value of attribute process_contents.
10 11 12 |
# File 'lib/xsdvi/svg/symbols/any_attribute.rb', line 10 def process_contents @process_contents end |
Instance Method Details
#calculate_height ⇒ Object
52 53 54 |
# File 'lib/xsdvi/svg/symbols/any_attribute.rb', line 52 def calculate_height MAX_HEIGHT end |
#calculate_width ⇒ Object
45 46 47 48 49 50 |
# File 'lib/xsdvi/svg/symbols/any_attribute.rb', line 45 def calculate_width calc = Utils::WidthCalculator.new(MIN_WIDTH) # Java only calculates width based on namespace calc.new_width(15, namespace) calc.width end |
#draw ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/xsdvi/svg/symbols/any_attribute.rb', line 18 def draw process_description draw_g_start print("<rect class='shadow' x='3' y='3' width='#{width}' " \ "height='#{height}' rx='9'/>") print("<rect class='boxanyattribute' x='0' y='0' width='#{width}' " \ "height='#{height}' rx='9'/>") # Draw process contents boxes pc_class = case process_contents when PC_STRICT then "strict" when PC_SKIP then "skip" when PC_LAX then "lax" else "strict" end print("<rect class='#{pc_class}' x='6' y='34' width='6' height='6'/>") print("<rect class='#{pc_class}' x='16' y='34' width='6' height='6'/>") print("<rect class='#{pc_class}' x='26' y='34' width='6' height='6'/>") print("<text x='5' y='13'>#{namespace}</text>") if namespace # Java only shows @ symbol, not the full text print("<text class='strong' x='5' y='27'>@</text>") draw_description(34) draw_connection draw_g_end end |