Class: Y2Network::Dialogs::IPAddressLabel
- Inherits:
-
CWM::InputField
- Object
- CWM::InputField
- Y2Network::Dialogs::IPAddressLabel
- Defined in:
- src/lib/y2network/dialogs/additional_address.rb
Overview
Widget to modify the label of an additional IP address configuration
Instance Method Summary collapse
- #init ⇒ Object
-
#initialize(name, settings, focus: false) ⇒ IPAddressLabel
constructor
A new instance of IPAddressLabel.
- #label ⇒ Object
- #store ⇒ Object
- #validate ⇒ Object
Constructor Details
#initialize(name, settings, focus: false) ⇒ IPAddressLabel
Returns a new instance of IPAddressLabel.
109 110 111 112 113 114 115 |
# File 'src/lib/y2network/dialogs/additional_address.rb', line 109 def initialize(name, settings, focus: false) textdomain "network" @name = name @settings = settings @focus = focus end |
Instance Method Details
#init ⇒ Object
117 118 119 120 121 |
# File 'src/lib/y2network/dialogs/additional_address.rb', line 117 def init self.value = @settings.label focus if @focus Yast::UI.ChangeWidget(Id(), :ValidChars, Yast::String.CAlnum) end |
#label ⇒ Object
123 124 125 |
# File 'src/lib/y2network/dialogs/additional_address.rb', line 123 def label _("&Address Label") end |
#store ⇒ Object
127 128 129 |
# File 'src/lib/y2network/dialogs/additional_address.rb', line 127 def store @settings.label = value end |
#validate ⇒ Object
131 132 133 134 135 136 137 |
# File 'src/lib/y2network/dialogs/additional_address.rb', line 131 def validate return true if "#{@name}.#{value}" =~ /^[[:alnum:]._:-]{1,15}\z/ Yast::Popup.Error(_("Label is too long.")) focus false end |