Class: Xsdvi::SVG::Symbols::Field
- Inherits:
-
Xsdvi::SVG::Symbol
- Object
- Tree::Element
- Xsdvi::SVG::Symbol
- Xsdvi::SVG::Symbols::Field
- Defined in:
- lib/xsdvi/svg/symbols/field.rb
Overview
Symbol for XSD field
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
-
#xpath ⇒ Object
Returns the value of attribute xpath.
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 ⇒ Field
constructor
A new instance of Field.
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 ⇒ Field
Returns a new instance of Field.
12 13 14 15 |
# File 'lib/xsdvi/svg/symbols/field.rb', line 12 def initialize super @xpath = nil end |
Instance Attribute Details
#xpath ⇒ Object
Returns the value of attribute xpath.
10 11 12 |
# File 'lib/xsdvi/svg/symbols/field.rb', line 10 def xpath @xpath end |
Instance Method Details
#calculate_height ⇒ Object
36 37 38 |
# File 'lib/xsdvi/svg/symbols/field.rb', line 36 def calculate_height MID_HEIGHT end |
#calculate_width ⇒ Object
29 30 31 32 33 34 |
# File 'lib/xsdvi/svg/symbols/field.rb', line 29 def calculate_width calc = Utils::WidthCalculator.new(MIN_WIDTH) calc.new_width(15, 5) calc.new_width(15, xpath) calc.width end |
#draw ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/xsdvi/svg/symbols/field.rb', line 17 def draw draw_g_start print("<rect class='shadow' x='3' y='3' width='#{width}' " \ "height='#{height}' rx='9'/>") print("<rect class='boxfield' x='0' y='0' width='#{width}' " \ "height='#{height}' rx='9'/>") print("<text class='strong' x='5' y='13'>field</text>") print("<text class='visible' x='5' y='27'>#{xpath}</text>") if xpath draw_connection draw_g_end end |