Class: OpenHAB::DSL::Sitemaps::WidgetBuilder
- Inherits:
-
Object
- Object
- OpenHAB::DSL::Sitemaps::WidgetBuilder
- Includes:
- Core::EntityLookup
- Defined in:
- lib/openhab/dsl/sitemaps/builder.rb
Overview
Base class for all widgets
Direct Known Subclasses
ButtonBuilder, ChartBuilder, ColorpickerBuilder, DefaultBuilder, InputBuilder, LinkableWidgetBuilder, SetpointBuilder, SwitchBuilder, VideoBuilder
Instance Attribute Summary collapse
-
#icon ⇒ String, ...
The icon to show It can be a string, or a hash of conditions and icons.
-
#icon_colors ⇒ Hash<String, String>, Hash<Array<String>, String>
readonly
Icon color rules.
-
#item ⇒ String, ...
The item whose state to show.
- #label ⇒ String?
-
#label_colors ⇒ Hash<String, String>, Hash<Array<String>, String>
readonly
Label color rules.
-
#static_icon ⇒ String?
The static icon to show This is mutually exclusive with #icon.
-
#value_colors ⇒ Hash<String, String>, Hash<Array<String>, String>
readonly
Value color rules.
-
#visibilities ⇒ Array<String>
readonly
Visibility rules.
Instance Method Summary collapse
-
#icon_color(rules) ⇒ Hash<String, String>
Adds one or more new rules for setting the icon color.
-
#label_color(rules) ⇒ Hash<String, String>
Adds one or more new rules for setting the label color.
-
#value_color(rules) ⇒ Hash<String, String>
Adds one or more new rules for setting the value color.
-
#visibility(*rules) ⇒ Array<String>
Adds one or more new visibility rules.
Methods included from Core::EntityLookup
#items, #method_missing, #things
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class OpenHAB::Core::EntityLookup
Instance Attribute Details
#icon ⇒ String, ...
The icon to show It can be a string, or a hash of conditions and icons.
96 97 98 |
# File 'lib/openhab/dsl/sitemaps/builder.rb', line 96 def icon @icon end |
#icon_colors ⇒ Hash<String, String>, Hash<Array<String>, String> (readonly)
Icon color rules
114 115 116 |
# File 'lib/openhab/dsl/sitemaps/builder.rb', line 114 def icon_colors @icon_colors end |
#item ⇒ String, ...
The item whose state to show
79 80 81 |
# File 'lib/openhab/dsl/sitemaps/builder.rb', line 79 def item @item end |
#label ⇒ String?
76 77 78 |
# File 'lib/openhab/dsl/sitemaps/builder.rb', line 76 def label @label end |
#label_colors ⇒ Hash<String, String>, Hash<Array<String>, String> (readonly)
Label color rules
106 107 108 |
# File 'lib/openhab/dsl/sitemaps/builder.rb', line 106 def label_colors @label_colors end |
#static_icon ⇒ String?
The static icon to show This is mutually exclusive with #icon
102 103 104 |
# File 'lib/openhab/dsl/sitemaps/builder.rb', line 102 def static_icon @static_icon end |
#value_colors ⇒ Hash<String, String>, Hash<Array<String>, String> (readonly)
Value color rules
110 111 112 |
# File 'lib/openhab/dsl/sitemaps/builder.rb', line 110 def value_colors @value_colors end |
#visibilities ⇒ Array<String> (readonly)
Visibility rules
118 119 120 |
# File 'lib/openhab/dsl/sitemaps/builder.rb', line 118 def visibilities @visibilities end |
Instance Method Details
#icon_color(rules) ⇒ Hash<String, String>
Adds one or more new rules for setting the icon color
203 204 205 206 |
# File 'lib/openhab/dsl/sitemaps/builder.rb', line 203 def icon_color(rules) rules = { default: rules } if rules.is_a?(String) @icon_colors.merge!(rules) end |
#label_color(rules) ⇒ Hash<String, String>
Adds one or more new rules for setting the label color
189 190 191 192 |
# File 'lib/openhab/dsl/sitemaps/builder.rb', line 189 def label_color(rules) rules = { default: rules } if rules.is_a?(String) @label_colors.merge!(rules) end |