class AastraXmlApi::PhoneFormattedTextScreenEntry

Public Class Methods

new(text, size, align, type) click to toggle source

Creates new formatted text entry. size is one of 'normal' (default) or 'double'. align is one of 'left' (default), 'center', or 'right'. type must be one of 'normal', 'scrollstart', or 'scrollend'.

# File lib/aastra_xml_api/phone_formatted_text_screen_entry.rb, line 21
def initialize(text, size, align, type)
  if size == 'double' then
    @text = convert_high_ascii(text)
  else
    @text = text
  end
  @size = size
  @align = align
  @type = type
end

Public Instance Methods

render() click to toggle source

Create XML text output for this entry.

# File lib/aastra_xml_api/phone_formatted_text_screen_entry.rb, line 33
def render
  case @type
  when "normal"
    xml = "<Line"
    xml += " Size=\"#{@size}\"" if not @size.nil?
    xml += " Align=\"#{@align}\"" if not @align.nil?
    xml += ">"
    xml += "#{escape(@text)}</Line>\n"
  when "scrollstart"
    xml = "<Scroll"
    xml += " Height=\"#{@size}\"" if not @size.nil?
    xml += ">\n"
  when "scrollend" then xml = "</Scroll>\n"
  end
  return xml
end