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.
110 111 112 113 114 115 116 117 |
# File 'src/lib/y2network/dialogs/additional_address.rb', line 110 def initialize(name, settings, focus: false) super() textdomain "network" @name = name @settings = settings @focus = focus end |
Instance Method Details
#init ⇒ Object
119 120 121 122 123 |
# File 'src/lib/y2network/dialogs/additional_address.rb', line 119 def init self.value = @settings.label focus if @focus Yast::UI.ChangeWidget(Id(), :ValidChars, Yast::String.CAlnum) end |
#label ⇒ Object
125 126 127 |
# File 'src/lib/y2network/dialogs/additional_address.rb', line 125 def label _("&Address Label") end |
#store ⇒ Object
129 130 131 |
# File 'src/lib/y2network/dialogs/additional_address.rb', line 129 def store @settings.label = value end |
#validate ⇒ Object
133 134 135 136 137 138 139 |
# File 'src/lib/y2network/dialogs/additional_address.rb', line 133 def validate return true if "#{@name}.#{value}" =~ /^[[:alnum:]._:-]{1,15}\z/ Yast::Popup.Error(_("Label is too long.")) focus false end |