Class: AastraXmlApi::PhoneFormattedTextScreenEntry

Inherits:
Phone
  • Object
show all
Defined in:
lib/aastra_xml_api/phone_formatted_text_screen_entry.rb

Constant Summary

Constants inherited from Phone

AastraXmlApi::Phone::HIGHASCII

Instance Method Summary collapse

Methods inherited from Phone

#addIcon, #addSoftkey, #convert_high_ascii, #escape, #getRefreshTimeout, #getRefreshURL, #setAllowAnswer, #setBeep, #setCancelAction, #setDestroyOnExit, #setLockIn, #setRefresh, #setTimeout, #setTitle, #setTitleWrap

Constructor Details

#initialize(text, size, align, type) ⇒ PhoneFormattedTextScreenEntry

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’.



21
22
23
24
25
26
27
28
29
30
# 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

Instance Method Details

#renderObject

Create XML text output for this entry.



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# 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