class Lebowski::Foundation::Panes::AlertPane

Represents a proxy to a SproutCore alert pane (SC.AlertPane)

Constants

ALERT_PROPERTY_TYPE
ALERT_TYPES
ALERT_TYPE_ERROR
ALERT_TYPE_INFO
ALERT_TYPE_PLAIN
ALERT_TYPE_WARN
BUTTONS
BUTTON_ONE
BUTTON_THREE
BUTTON_TWO

Public Instance Methods

button_count() click to toggle source
# File lib/lebowski/foundation/panes/alert.rb, line 74
def button_count()
  counter = 0
  each_button do |button|
    counter = counter.next
  end
  return counter
end
click_button(title) click to toggle source
# File lib/lebowski/foundation/panes/alert.rb, line 100
def click_button(title)
  raise ArgumentError.new "title can not be nil" if title.nil?
  each_button do |button|
    if not (button['title'] =~ /^#{title}$/i).nil?
      button.click
      return
    end
  end
end
each_button() { |btn| ... } click to toggle source
# File lib/lebowski/foundation/panes/alert.rb, line 82
def each_button(&block)
  raise ArgumentError.new "must provide a block" if (not block_given?)
  BUTTONS.each do |button|
    btn = self[button]
    next if (btn == :undefined)
    next if (not btn['isVisible'])
    yield btn
  end
end
has_button?(title) click to toggle source
# File lib/lebowski/foundation/panes/alert.rb, line 92
def has_button?(title)
  raise ArgumentError.new "title can not be nil" if title.nil?
  each_button do |button|
    return true if (not (button['title'] =~ /^#{title}$/i).nil?)
  end
  return false
end
is_alert?() click to toggle source
# File lib/lebowski/foundation/panes/alert.rb, line 56
def is_alert?()
  return is_type?(:alert)
end
Also aliased as: is_warn?
is_error?() click to toggle source
# File lib/lebowski/foundation/panes/alert.rb, line 62
def is_error?()
  return is_type?(:error)
end
is_info?() click to toggle source
# File lib/lebowski/foundation/panes/alert.rb, line 66
def is_info?()
  return is_type?(:info)
end
is_plain?() click to toggle source
# File lib/lebowski/foundation/panes/alert.rb, line 70
def is_plain?()
  return is_type?(:plain)
end
is_type?(key) click to toggle source
# File lib/lebowski/foundation/panes/alert.rb, line 48
def is_type?(key)
  if (not ALERT_TYPES.has_key?(key))
    raise ArgumentError.new "require valid key: #{key}" 
  end
  
  return (not (self[ALERT_PROPERTY_TYPE] =~ /#{ALERT_TYPES[key]}/i).nil?)
end
is_warn?()
Alias for: is_alert?
type() click to toggle source
# File lib/lebowski/foundation/panes/alert.rb, line 40
def type()
  return :alert if is_alert?
  return :error if is_error?
  return :info if is_info?
  return :plain if is_plain?
  return "" 
end