Class: Xsdvi::SVG::Symbols::Keyref
- Inherits:
-
Xsdvi::SVG::Symbol
- Object
- Tree::Element
- Xsdvi::SVG::Symbol
- Xsdvi::SVG::Symbols::Keyref
- Defined in:
- lib/xsdvi/svg/symbols/keyref.rb
Overview
Symbol for XSD keyref identity constraint
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
-
#name ⇒ Object
Returns the value of attribute name.
-
#namespace ⇒ Object
Returns the value of attribute namespace.
-
#refer ⇒ Object
Returns the value of attribute refer.
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 ⇒ Keyref
constructor
A new instance of Keyref.
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 ⇒ Keyref
Returns a new instance of Keyref.
12 13 14 15 16 17 |
# File 'lib/xsdvi/svg/symbols/keyref.rb', line 12 def initialize super @name = nil @namespace = nil @refer = nil end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
10 11 12 |
# File 'lib/xsdvi/svg/symbols/keyref.rb', line 10 def name @name end |
#namespace ⇒ Object
Returns the value of attribute namespace.
10 11 12 |
# File 'lib/xsdvi/svg/symbols/keyref.rb', line 10 def namespace @namespace end |
#refer ⇒ Object
Returns the value of attribute refer.
10 11 12 |
# File 'lib/xsdvi/svg/symbols/keyref.rb', line 10 def refer @refer end |
Instance Method Details
#calculate_height ⇒ Object
43 44 45 |
# File 'lib/xsdvi/svg/symbols/keyref.rb', line 43 def calculate_height MAX_HEIGHT end |
#calculate_width ⇒ Object
35 36 37 38 39 40 41 |
# File 'lib/xsdvi/svg/symbols/keyref.rb', line 35 def calculate_width calc = Utils::WidthCalculator.new(MIN_WIDTH) calc.new_width(15, name, 8) calc.new_width(15, namespace) calc.new_width(15, refer, 7) calc.width end |
#draw ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/xsdvi/svg/symbols/keyref.rb', line 19 def draw process_description draw_g_start print("<rect class='shadow' x='3' y='3' width='#{width}' " \ "height='#{height}' rx='9'/>") print("<rect class='boxkeyref' x='0' y='0' width='#{width}' " \ "height='#{height}' rx='9'/>") print("<text class='visible' x='5' y='13'>#{namespace}</text>") if namespace print("<text class='strong' x='5' y='27'>keyref: #{name}</text>") if name print("<text class='visible' x='5' y='41'>refer: #{refer}</text>") if refer draw_description(41) draw_connection draw_use draw_g_end end |