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
ButtongridBuilder, 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
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.
71 72 73 |
# File 'lib/openhab/dsl/sitemaps/builder.rb', line 71 def icon @icon end |
#icon_colors ⇒ Hash<String, String>, Hash<Array<String>, String> (readonly)
Icon color rules
89 90 91 |
# File 'lib/openhab/dsl/sitemaps/builder.rb', line 89 def icon_colors @icon_colors end |
#item ⇒ String, ...
The item whose state to show
54 55 56 |
# File 'lib/openhab/dsl/sitemaps/builder.rb', line 54 def item @item end |
#label ⇒ String?
51 52 53 |
# File 'lib/openhab/dsl/sitemaps/builder.rb', line 51 def label @label end |
#label_colors ⇒ Hash<String, String>, Hash<Array<String>, String> (readonly)
Label color rules
81 82 83 |
# File 'lib/openhab/dsl/sitemaps/builder.rb', line 81 def label_colors @label_colors end |
#static_icon ⇒ String?
The static icon to show This is mutually exclusive with #icon
77 78 79 |
# File 'lib/openhab/dsl/sitemaps/builder.rb', line 77 def static_icon @static_icon end |
#value_colors ⇒ Hash<String, String>, Hash<Array<String>, String> (readonly)
Value color rules
85 86 87 |
# File 'lib/openhab/dsl/sitemaps/builder.rb', line 85 def value_colors @value_colors end |
#visibilities ⇒ Array<String> (readonly)
Visibility rules
93 94 95 |
# File 'lib/openhab/dsl/sitemaps/builder.rb', line 93 def visibilities @visibilities end |
Instance Method Details
#icon_color(rules) ⇒ Hash<String, String>
Adds one or more new rules for setting the icon color
173 174 175 176 |
# File 'lib/openhab/dsl/sitemaps/builder.rb', line 173 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
159 160 161 162 |
# File 'lib/openhab/dsl/sitemaps/builder.rb', line 159 def label_color(rules) rules = { default: rules } if rules.is_a?(String) @label_colors.merge!(rules) end |
#value_color(rules) ⇒ Hash<String, String>
Adds one or more new rules for setting the value color
166 167 168 169 |
# File 'lib/openhab/dsl/sitemaps/builder.rb', line 166 def value_color(rules) rules = { default: rules } if rules.is_a?(String) @value_colors.merge!(rules) end |
#visibility(*rules) ⇒ Array<String>
Adds one or more new visibility rules
180 181 182 |
# File 'lib/openhab/dsl/sitemaps/builder.rb', line 180 def visibility(*rules) @visibilities.concat(rules) end |