Class: UU::OS::Form::IconPicker

Inherits:
Input show all
Defined in:
uu_os_gvc-0.28.16/lib/uu/os/form/icon_picker.rb

Overview

Component for choosing icons from catalog.

Instance Attribute Summary (collapse)

Attributes inherited from Input

#disabled, #read_only, #required, #submit_value_change, #value, #value_change_action_uri, #width

Attributes inherited from GVC::Component

#attributes, #code, #component_type, #form, #height, #id, #name, #width

Method Summary

Methods inherited from GVC::Component

#add_message, #focus, #initialize, #messages

Constructor Details

This class inherits a constructor from UU::OS::GVC::Component

Instance Attribute Details

- (Object) category_list

Contains JSON with array of categories. Each category must define its own name to display in component and may define list of tags and icon codes. Icons that does not have one of defined tags or its code is not in list of defined codes will be hidden and user cannot select them.

Examples:

# List of categories
icon_picker.category_list = [
 { :text => "All icons"},
 { :text => "Font icons", :iconTagList => ["FONT_ICON"] },
 { :text => "State and font icons", :iconTagList => ["FONT_ICON", "STATE_ICON"] },
 { :text => "Arrow icons", :iconList => ["ICON/ARROW_LEFT","ICON/ARROW_UP","ICON/ARROW_RIGHT","ICON/ARROW_DOWN"] } 
]


54
55
56
# File 'uu_os_gvc-0.28.16/lib/uu/os/form/icon_picker.rb', line 54

def category_list
  @category_list
end

- (Object) data

Data containing list of icons to choose from. If no data is supplied, icons from uuOS image catalog will be used. The component supports data in the format as returned by catalog-listing commands, such as ImageCatalog::ImageCatalog#get_image_list or ImageCatalog#get_image_list.

Examples:

# list only arrow icons from uuOS image catalog
iconpicker.data = UU::OS::ImageCatalog.get_image_list(ctx.uu_uri, :query => "code LIKE 'ICON/ARROW%'")


18
19
20
# File 'uu_os_gvc-0.28.16/lib/uu/os/form/icon_picker.rb', line 18

def data
  @data
end

- (Object) data_uri

URI of a uuCommand to use for loading data. The data returned from the uuCommand must be in a format supported by data attribute.



22
23
24
# File 'uu_os_gvc-0.28.16/lib/uu/os/form/icon_picker.rb', line 22

def data_uri
  @data_uri
end

- (Object) inline

Whether to display the component in an inline form. When in an inline form, icons are immediately visible in a scrollable list. When not in an inline form, only chosen icon is visible and user must open a popup to display the list of available icons. Default value is false.



34
35
36
# File 'uu_os_gvc-0.28.16/lib/uu/os/form/icon_picker.rb', line 34

def inline
  @inline
end

- (Object) rows

How many rows of icons should be immediately visible in the inline list / popup. If 0 is given, the inline list / popup will stretch itself as high as necessary to display all icons at once. Default value is 4.



40
41
42
# File 'uu_os_gvc-0.28.16/lib/uu/os/form/icon_picker.rb', line 40

def rows
  @rows
end

- (Object) search

Whether to display input for filtering icons when selecting the icon from a list (in popup or in an inline list). Default value is true.



27
28
29
# File 'uu_os_gvc-0.28.16/lib/uu/os/form/icon_picker.rb', line 27

def search
  @search
end