Class: HLabelTag

Inherits:
HWidget show all
Defined in:
lib/hwidgets/hlabeltag.rb

Instance Attribute Summary collapse

Attributes inherited from HWidget

#tag

Instance Method Summary collapse

Methods inherited from HWidget

#_addJsSlot, #_set, #_setStyle, #addJsFunction, #appendChild, #appendChilds, #buildSignature, #closeTag, #connect, #copyConstructor, #get, #getChilds, #getElementBy, #getSystemProperty, #hotLog, #openTag, #replacePlaceholder, #reset, #set, #setChilds, #setCloseTag, #setClosedTag, #setEnablePlaceholder, #setInnerHTML, #setParent, #setPlaceholder, #setPlaceholders, #setProperties, #setSlots, #setStyle, #setStyles, #setSystemProperties, #setSystemProperty, #setTag, #storeSlots, #storeStyle, #strProperties, test, #unset, widgetSpace

Constructor Details

#initialize(name = "", modelName = "", placeholder = "") ⇒ HLabelTag

Returns a new instance of HLabelTag.



5
6
7
8
9
10
11
# File 'lib/hwidgets/hlabeltag.rb', line 5

def initialize(name = "", modelName = "", placeholder = "")
  super("label")
  @name = name
  @modelName = modelName
  @placeholder = placeholder
  @carriageReturn = false
end

Instance Attribute Details

#modelNameObject

Returns the value of attribute modelName.



3
4
5
# File 'lib/hwidgets/hlabeltag.rb', line 3

def modelName
  @modelName
end

#nameObject

Returns the value of attribute name.



3
4
5
# File 'lib/hwidgets/hlabeltag.rb', line 3

def name
  @name
end

#placeholderObject

Returns the value of attribute placeholder.



3
4
5
# File 'lib/hwidgets/hlabeltag.rb', line 3

def placeholder
  @placeholder
end

Instance Method Details

#htmlObject



18
19
20
21
22
23
24
25
26
27
28
# File 'lib/hwidgets/hlabeltag.rb', line 18

def html()

  return "" if(@placeholder == nil)

  cr = (@carriageReturn) ? HIO.htmlEcholn("<br/>") : ""
  self.set(for: "#{@modelName}_#{@name}").
    setInnerHTML(@placeholder)
  
  return super() + cr

end

#setCarriageReturn(value = true) ⇒ Object



13
14
15
16
# File 'lib/hwidgets/hlabeltag.rb', line 13

def setCarriageReturn(value = true)
  @carriageReturn = value
  return self
end