Class: HDBView

Inherits:
HDivTag show all
Defined in:
lib/hwidgets/hdbview.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(moduleName: nil, modelName: nil, filter: "true", sortField: "id", sortDirection: "asc", pageSize: '5', page: 0, paginationView: true, filterView: true, actionMenu: true, actionButtons: true, poid: nil, **args) ⇒ HDBView

Returns a new instance of HDBView.



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/hwidgets/hdbview.rb', line 5

def initialize(moduleName: nil, modelName: nil,
               filter: "true", sortField: "id", sortDirection: "asc",
               pageSize: '5', page: 0,
               paginationView: true, filterView: true, actionMenu: true, actionButtons: true,
               poid: nil,
               **args)

  @moduleName = moduleName
  @modelName = modelName
  @oid = hm().malloc(self, poid).obj.object_id.to_s
  @pageSize = pageSize
  @page = page
  @paginationView = paginationView
  @filterView = filterView
  @actionMenu = actionMenu
  @dbTableView = HDBTableView.new(moduleName: moduleName, modelName: modelName,
                                 filter: filter, sortField: sortField, sortDirection: sortDirection,
                                 pageSize: pageSize, page: page, poid: @oid)  
  HDBTableView.tableViewDecorator(@dbTableView)
  
  super(class: 'hdbview', id: @oid, **args)
  self.hotLog("hdbview oid: #{@oid}".hight_purple)
  self.actionButtons() if actionButtons
  self.dropDowns() if actionMenu
  self << HDBFilterView.new(sourceView: @dbTableView) if filterView
  self << HPagination.new(sourceView: @dbTableView, pages: @dbTableView.rpcPages, pageSize: pageSize, 
                          rowsForPage: [@pageSize, 10, 100, 'all']) if paginationView 
  self << @dbTableView
  return self

end

Instance Attribute Details

#oidObject (readonly)

Returns the value of attribute oid.



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

def oid
  @oid
end

Instance Method Details

#actionButtonsObject



48
49
50
51
52
53
54
55
56
57
# File 'lib/hwidgets/hdbview.rb', line 48

def actionButtons

  actionBtns = hv().viewByType(@moduleName, @modelName, :table).xpath("//actionbuttons")
  actionBtns.each do |button|
    nodes = button.xpath(".//button")
    buttons = nodes.to_a_of_h
    self << HDBActionButtons.new(sourceView: @dbTableView, buttons: buttons) if buttons.any?
  end

end


37
38
39
40
41
42
43
44
45
46
# File 'lib/hwidgets/hdbview.rb', line 37

def dropDowns

  actionMenus = hv().viewByType(@moduleName, @modelName, :table).xpath("//actionmenu")
  actionMenus.each do |menu|
    nodes = menu.xpath(".//item")
    items = nodes.to_a_of_h
    self << HDropDown.new(sourceView: @dbTableView, caption: menu["name"], items: items) if items.any?
  end

end

#htmlObject



59
60
61
# File 'lib/hwidgets/hdbview.rb', line 59

def html
  return super
end