Class: LdsArea

Inherits:
Object
  • Object
show all
Defined in:
lib/TNR360/components/lds_area.rb

Instance Method Summary collapse

Constructor Details

#initialize(browser, idArea, block = nil) ⇒ LdsArea

constructor



17
18
19
20
21
22
23
# File 'lib/TNR360/components/lds_area.rb', line 17

def initialize(browser, idArea, block=nil)
  @browser =browser
  @idArea=idArea
  @parentBlock=block
  update
  @exists
end

Instance Method Details

#collapseObject



117
118
119
120
121
122
# File 'lib/TNR360/components/lds_area.rb', line 117

def collapse
  if (@collapsible && !@collapsed)
    @current_element.legend(:index => 0).div(:index => 0).when_present.click
  end
  update
end

#expandObject



124
125
126
127
128
129
# File 'lib/TNR360/components/lds_area.rb', line 124

def expand
  if (@collapsible && @collapsed)
    @current_element.legend(:index => 0).div(:index => 0).when_present.click
  end
  update
end

#findElement(idElement) ⇒ Object

method locate current element



64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/TNR360/components/lds_area.rb', line 64

def findElement idElement
  begin
    #if element not yet available in screen, wait for some time
    if @parentBlock != nil
      @parentBlock.getElement.div(:index => 2).fieldset(:id, idElement).wait_until_present(10)
      @current_element=@parentBlock.getElement.div(:index => 2).fieldset(:id, idElement)
    end
  rescue

    raise "Element "+idElement+" Not Found"

  ensure
    #rien dans finally pour ce cas
    if @parentBlock == nil
      if @browser.fieldset(:id, idElement).wait_until_present(10)
        count=@browser.fieldsets(:id, idElement).length
      end
      if count==0
        raise "Element "+idElement+" Not Found"
      else
        if count >1
          raise "Several Elements with id "+idElement+"  Found, specify block"
        end
      end
      @current_element=@browser.fieldset(:id, idElement).when_present
    end
  end
  @current_element
end

#getElementObject

Getters



133
134
135
# File 'lib/TNR360/components/lds_area.rb', line 133

def getElement
  @current_element
end

#getIdAreaObject



137
138
139
# File 'lib/TNR360/components/lds_area.rb', line 137

def getIdArea
  @idArea
end

#getParentBlocObject



141
142
143
# File 'lib/TNR360/components/lds_area.rb', line 141

def getParentBloc
  @parentBlock
end

#getTitleObject



145
146
147
# File 'lib/TNR360/components/lds_area.rb', line 145

def getTitle
  @title
end

#isCollapsed?Boolean

Returns:

  • (Boolean)


153
154
155
# File 'lib/TNR360/components/lds_area.rb', line 153

def isCollapsed?
  @collapsed
end

#isCollapsible?Boolean

Returns:

  • (Boolean)


149
150
151
# File 'lib/TNR360/components/lds_area.rb', line 149

def isCollapsible?
  @collapsible
end

#isExist?Boolean

Returns:

  • (Boolean)


161
162
163
# File 'lib/TNR360/components/lds_area.rb', line 161

def isExist?
  @exists
end

#isVisible?Boolean

Returns:

  • (Boolean)


157
158
159
# File 'lib/TNR360/components/lds_area.rb', line 157

def isVisible?
  @visible
end

#refreshObject

refresh object status from browser



27
28
29
30
31
32
33
# File 'lib/TNR360/components/lds_area.rb', line 27

def refresh
  #Look for element in browser
  @current_element= findElement @idArea
  #update other data
  update
  @exists
end

#reverse_collapseObject

LdsScreen Actions



110
111
112
113
114
115
# File 'lib/TNR360/components/lds_area.rb', line 110

def reverse_collapse
  if (@collapsible)
    @current_element.legend(:index => 0).div(:index => 0).when_present.click
  end
  update
end

#to_sObject

print object



96
97
98
99
100
101
102
103
104
105
106
# File 'lib/TNR360/components/lds_area.rb', line 96

def to_s
  "\n***** Area *****"+
      "\nIdArea : "+ no_null(@idArea)+
      "\nIdParentBlock : "+(no_null(@parentBlock)=="" ? "" : @parentBlock.getIdBlock)+
      "\nTitle : "+ no_null(@title)+
      "\nCollapsible :"+ bool_no_null(@collapsible.to_s)+
      "\nCollapsed :"+ bool_no_null(@collapsed.to_s)+
      "\nVisible : "+ bool_no_null(@visible.to_s)+
      "\nExists : "+ bool_no_null(@exists.to_s)+
      "\n**********"
end