Package muntjac :: Package ui :: Module select :: Class Select
[hide private]
[frames] | no frames]

Class Select

source code

                            object --+                        
                                     |                        
                   util.IEventListener --+                    
                                         |                    
             terminal.paintable.IPaintable --+                
                                             |                
                                object --+   |                
                                         |   |                
    terminal.variable_owner.IVariableOwner --+                
                                             |                
                                object --+   |                
                                         |   |                
               terminal.sizeable.ISizeable --+                
                                             |                
                          component.IComponent --+            
                                                 |            
                                    object --+   |            
                                             |   |            
  event.method_event_source.IMethodEventSource --+            
                                                 |            
              abstract_component.AbstractComponent --+        
                                                     |        
                                object --+           |        
                                         |           |        
                   data.buffered.IBuffered --+       |        
                                             |       |        
                                object --+   |       |        
                                         |   |       |        
             data.validatable.IValidatable --+       |        
                                             |       |        
            data.buffered.IBufferedValidatable --+   |        
                                                 |   |        
                                    object --+   |   |        
                                             |   |   |        
            data.property.IValueChangeNotifier --+   |        
                                                 |   |        
                                    object --+   |   |        
                                             |   |   |        
            data.property.IValueChangeListener --+   |        
                                                 |   |        
                                object --+       |   |        
                                         |       |   |        
                     data.property.IViewer --+   |   |        
                                             |   |   |        
                         data.property.IEditor --+   |        
                                                 |   |        
                        object --+               |   |        
                                 |               |   |        
               util.IEventListener --+           |   |        
                                     |           |   |        
         terminal.paintable.IPaintable --+       |   |        
                                         |       |   |        
                            object --+   |       |   |        
                                     |   |       |   |        
terminal.variable_owner.IVariableOwner --+       |   |        
                                         |       |   |        
                            object --+   |       |   |        
                                     |   |       |   |        
           terminal.sizeable.ISizeable --+       |   |        
                                         |       |   |        
                      component.IComponent --+   |   |        
                                             |   |   |        
                          component.IFocusable --+   |        
                                                 |   |        
                                      field.IField --+        
                                                     |        
                                        object --+   |        
                                                 |   |        
                    event.action.IShortcutNotifier --+        
                                                     |        
                                        object --+   |        
                                                 |   |        
       data.property.IReadOnlyStatusChangeNotifier --+        
                                                     |        
                                        object --+   |        
                                                 |   |        
       data.property.IReadOnlyStatusChangeListener --+        
                                                     |        
                          abstract_field.AbstractField --+    
                                                         |    
                                            object --+   |    
                                                     |   |    
                             data.container.IContainer --+    
                                                         |    
                                            object --+   |    
                                                     |   |    
                                data.container.IViewer --+    
                                                         |    
                                            object --+   |    
                                                     |   |    
             data.container.IPropertySetChangeListener --+    
                                                         |    
                                            object --+   |    
                                                     |   |    
             data.container.IPropertySetChangeNotifier --+    
                                                         |    
                                            object --+   |    
                                                     |   |    
                 data.container.IItemSetChangeNotifier --+    
                                                         |    
                                            object --+   |    
                                                     |   |    
                 data.container.IItemSetChangeListener --+    
                                                         |    
                            abstract_select.AbstractSelect --+
                                                             |
                                                object --+   |
                                                         |   |
                                abstract_select.IFiltering --+
                                                             |
                                                object --+   |
                                                         |   |
                          event.field_events.IBlurNotifier --+
                                                             |
                                                object --+   |
                                                         |   |
                         event.field_events.IFocusNotifier --+
                                                             |
                                                            Select
Known Subclasses:

A class representing a selection of items the user has selected in a UI. The set of choices is presented as a set of IItems in a IContainer.

A Select component may be in single- or multiselect mode. Multiselect mode means that more than one item can be selected simultaneously.


Authors:
Vaadin Ltd., Richard Lincoln

Version: 1.1.2

Instance Methods [hide private]
 
__init__(self, *args)
Creates an empty Select with caption, that is connected to a data-source or is filled from a collection of option values.
source code
 
paintContent(self, target)
Paints the content of this component.
source code
 
getOptionsWithFilter(self, needNullSelectOption)
Returns the filtered options for the current page using a container filter.
source code
 
buildFilter(self, filterString, filteringMode)
Constructs a filter instance to use when using a IFilterable container in the ITEM_CAPTION_MODE_PROPERTY mode.
source code
 
containerItemSetChange(self, event)
Lets the listener know a Containers IItem set has changed.
source code
 
sanitetizeList(self, options, needNullSelectOption)
Makes correct sublist of given list of options.
source code
 
getFirstItemIndexOnCurrentPage(self, needNullSelectOption, size)
Returns the index of the first item on the current page.
source code
 
getLastItemIndexOnCurrentPage(self, needNullSelectOption, size, first)
Returns the index of the last item on the current page.
source code
 
adjustCurrentPage(self, page, needNullSelectOption, indexToEnsureInView, size)
Adjusts the index of the current page if necessary: make sure the current page is not after the end of the contents, and optionally go to the page containing a specific item.
source code
 
getFilteredOptions(self)
Filters the options in memory and returns the full filtered list.
source code
 
changeVariables(self, source, variables)
Invoked when the value of a variable has changed.
source code
 
requestRepaint(self)
Requests that the paintable should be repainted as soon as possible.
source code
 
optionRepaint(self) source code
 
setFilteringMode(self, filteringMode)
Sets the option filtering mode.
source code
 
getFilteringMode(self)
Gets the current filtering mode.
source code
 
setColumns(self, columns)
Note, one should use more generic setWidth(String) method instead of this.
source code
 
getColumns(self) source code
 
addListener(self, listener, iface=None)
Adds a new IProperty or IItem set change listener for this IContainer.
source code
 
addCallback(self, callback, eventType=None, *args) source code
 
removeListener(self, listener, iface=None)
Removes a previously registered IProperty and IItemset change listener.
source code
 
removeCallback(self, callback, eventType=None) source code
 
setMultiSelect(self, multiSelect)
Sets the multiselect mode.
source code
 
isMultiSelect(self)
Is the select in multiselect mode? In multiselect mode
source code
 
setScrollToSelectedItem(self, scrollToSelectedItem)
Sets whether to scroll the selected item visible (directly open the page on which it is) when opening the combo box popup or not.
source code
 
isScrollToSelectedItem(self)
Returns true if the select should find the page with the selected item when opening the popup (single select combo box only).
source code

Inherited from abstract_select.AbstractSelect: __len__, addContainerProperty, addItem, attach, containerPropertySetChange, containsId, detach, fireItemSetChange, firePropertySetChange, getCaptionChangeListener, getContainerDataSource, getContainerProperty, getContainerPropertyIds, getItem, getItemCaption, getItemCaptionMode, getItemCaptionPropertyId, getItemIcon, getItemIconPropertyId, getItemIds, getListeners, getNewItemHandler, getNullSelectionItemId, getType, getValue, getVisibleItemIds, isEmpty, isNewItemsAllowed, isNullSelectionAllowed, isSelected, paintItem, removeAllItems, removeContainerProperty, removeItem, select, setContainerDataSource, setItemCaption, setItemCaptionMode, setItemCaptionPropertyId, setItemIcon, setItemIconPropertyId, setNewItemHandler, setNewItemsAllowed, setNullSelectionAllowed, setNullSelectionItemId, setValue, size, unselect

Inherited from abstract_field.AbstractField: __str__, addShortcutListener, addValidator, commit, discard, fireReadOnlyStatusChange, fireValueChange, focus, getActionManager, getErrorMessage, getPropertyDataSource, getRequiredError, getTabIndex, getValidators, isInvalidAllowed, isInvalidCommitted, isModified, isReadOnly, isReadThrough, isRequired, isValid, isValidationVisible, isWriteThrough, readOnlyStatusChange, readValueFromProperty, removeShortcutListener, removeValidator, setCurrentBufferedSourceException, setInternalValue, setInvalidAllowed, setInvalidCommitted, setPropertyDataSource, setReadOnly, setReadThrough, setRequired, setRequiredError, setTabIndex, setValidationVisible, setWriteThrough, shouldHideErrors, validate, valueChange

Inherited from abstract_component.AbstractComponent: __getstate__, __setstate__, addStyleName, childRequestedRepaint, fireComponentErrorEvent, fireComponentEvent, fireEvent, fireRequestRepaintEvent, getApplication, getCSSHeight, getCSSWidth, getCaption, getComponentError, getData, getDebugId, getDescription, getErrorHandler, getHeight, getHeightUnits, getIcon, getLocale, getParent, getStyle, getStyleName, getWidth, getWidthUnits, getWindow, handleError, hasListeners, isEnabled, isImmediate, isVisible, paint, parseStringSize, registerCallback, registerListener, removeStyleName, requestRepaintRequests, setCaption, setComponentError, setData, setDebugId, setDescription, setEnabled, setErrorHandler, setHeight, setHeightUnits, setIcon, setImmediate, setLocale, setParent, setSizeFull, setSizeUndefined, setStyle, setStyleName, setVisible, setWidth, setWidthUnits, withdrawCallback, withdrawListener

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __subclasshook__

Class Methods [hide private]

Inherited from abstract_field.AbstractField: constructField

Class Variables [hide private]
  CLIENT_WIDGET = None
hash(x)

Inherited from abstract_select.AbstractSelect: ITEM_CAPTION_MODE_EXPLICIT, ITEM_CAPTION_MODE_EXPLICIT_DEFAULTS_ID, ITEM_CAPTION_MODE_ICON_ONLY, ITEM_CAPTION_MODE_ID, ITEM_CAPTION_MODE_INDEX, ITEM_CAPTION_MODE_ITEM, ITEM_CAPTION_MODE_PROPERTY

Inherited from abstract_component.AbstractComponent: SIZE_PATTERN

Inherited from terminal.sizeable.ISizeable: SIZE_UNDEFINED, UNITS_CM, UNITS_EM, UNITS_EX, UNITS_INCH, UNITS_MM, UNITS_PERCENTAGE, UNITS_PICAS, UNITS_PIXELS, UNITS_POINTS, UNIT_SYMBOLS

Inherited from abstract_select.IFiltering: FILTERINGMODE_CONTAINS, FILTERINGMODE_OFF, FILTERINGMODE_STARTSWITH

Instance Variables [hide private]
  pageLength
Holds value of property pageLength.
  _currentPage
Current page when the user is 'paging' trough options
  _filteredSize
Number of options that pass the filter, excluding the null
  _filteredOptions
Cache of filtered options, used only by the in-memory
  _optionRequest
Flag to indicate that request repaint is called by filter
  _filteringContainer
True if the container is being filtered temporarily and item
  _scrollToSelectedItem
Flag to indicate whether to scroll the selected item visible

Inherited from abstract_select.AbstractSelect: itemIdMapper, items

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, *args)
(Constructor)

source code 

Creates an empty Select with caption, that is connected to a data-source or is filled from a collection of option values.

Parameters:
  • args - tuple of the form
    • ()
    • (caption)
      1. the caption of the component.
    • (caption, dataSource)
      1. the caption of the component.
      2. the IContainer datasource to be selected from by this select.
    • (caption, options)
      1. the caption of the component.
      2. the Collection containing the options.
Overrides: object.__init__
(inherited documentation)

paintContent(self, target)

source code 

Paints the content of this component.

Parameters:
  • target - the Paint Event.
Raises:
Overrides: abstract_component.AbstractComponent.paintContent

getOptionsWithFilter(self, needNullSelectOption)

source code 

Returns the filtered options for the current page using a container filter.

As a size effect, filteredSize is set to the total number of items passing the filter.

The current container must be IFilterable and IIndexed, and the filtering mode must be suitable for container filtering (tested with canUseContainerFilter).

Use getFilteredOptions and sanitetizeList if this is not the case.

Parameters:
  • needNullSelectOption
Returns:
filtered list of options (may be empty) or null if cannot use container filters

buildFilter(self, filterString, filteringMode)

source code 

Constructs a filter instance to use when using a IFilterable container in the ITEM_CAPTION_MODE_PROPERTY mode.

Note that the client side implementation expects the filter string to apply to the item caption string it sees, so changing the behavior of this method can cause problems.

containerItemSetChange(self, event)

source code 

Lets the listener know a Containers IItem set has changed.

Parameters:
  • event - change event text
Overrides: data.container.IItemSetChangeListener.containerItemSetChange
(inherited documentation)

sanitetizeList(self, options, needNullSelectOption)

source code 

Makes correct sublist of given list of options.

If paint is not an option request (affected by page or filter change), page will be the one where possible selection exists.

Detects proper first and last item in list to return right page of options. Also, if the current page is beyond the end of the list, it will be adjusted.

Parameters:
  • options
  • needNullSelectOption - flag to indicate if nullselect option needs to be taken into consideration

getFirstItemIndexOnCurrentPage(self, needNullSelectOption, size)

source code 

Returns the index of the first item on the current page. The index is to the underlying (possibly filtered) contents. The null item, if any, does not have an index but takes up a slot on the first page.

Parameters:
  • needNullSelectOption - true if a null option should be shown before any other options (takes up the first slot on the first page, not counted in index)
  • size - number of items after filtering (not including the null item, if any)
Returns:
first item to show on the UI (index to the filtered list of options, not taking the null item into consideration if any)

getLastItemIndexOnCurrentPage(self, needNullSelectOption, size, first)

source code 

Returns the index of the last item on the current page. The index is to the underlying (possibly filtered) contents. If needNullSelectOption is true, the null item takes up the first slot on the first page, effectively reducing the first page size by one.

Parameters:
  • needNullSelectOption - true if a null option should be shown before any other options (takes up the first slot on the first page, not counted in index)
  • size - number of items after filtering (not including the null item, if any)
  • first - index in the filtered view of the first item of the page
Returns:
index in the filtered view of the last item on the page

adjustCurrentPage(self, page, needNullSelectOption, indexToEnsureInView, size)

source code 

Adjusts the index of the current page if necessary: make sure the current page is not after the end of the contents, and optionally go to the page containing a specific item. There are no side effects but the adjusted page index is returned.

Parameters:
  • page - page number to use as the starting point
  • needNullSelectOption - true if a null option should be shown before any other options (takes up the first slot on the first page, not counted in index)
  • indexToEnsureInView - index of an item that should be included on the page (in the data set, not counting the null item if any), -1 for none
  • size - number of items after filtering (not including the null item, if any)

getFilteredOptions(self)

source code 

Filters the options in memory and returns the full filtered list.

This can be less efficient than using container filters, so use getOptionsWithFilter if possible (filterable container and suitable item caption mode etc.).

changeVariables(self, source, variables)

source code 

Invoked when the value of a variable has changed.

Parameters:
  • source - the Source of the variable change. This is the origin of the event. For example in Web Adapter this is the request.
  • variables - the Mapping from variable names to new variable values.
Overrides: terminal.variable_owner.IVariableOwner.changeVariables

See Also: AbstractComponent.changeVariables

requestRepaint(self)

source code 

Requests that the paintable should be repainted as soon as possible.

Overrides: terminal.paintable.IPaintable.requestRepaint
(inherited documentation)

setFilteringMode(self, filteringMode)

source code 

Sets the option filtering mode.

Parameters:
  • filteringMode - the filtering mode to use
Overrides: abstract_select.IFiltering.setFilteringMode
(inherited documentation)

getFilteringMode(self)

source code 

Gets the current filtering mode.

Returns:
the filtering mode in use
Overrides: abstract_select.IFiltering.getFilteringMode
(inherited documentation)

setColumns(self, columns)

source code 

Note, one should use more generic setWidth(String) method instead of this. This now days actually converts columns to width with em css unit.

Sets the number of columns in the editor. If the number of columns is set 0, the actual number of displayed columns is determined implicitly by the adapter.

Parameters:
  • columns - the number of columns to set.

Deprecated:  

getColumns(self)

source code 

Deprecated: see setter function

addListener(self, listener, iface=None)

source code 

Adds a new IProperty or IItem set change listener for this IContainer.

Parameters:
  • listener - the new IListener to be registered.
Raises:
  • ValueError - unless method has a match in object
Overrides: event.field_events.IFocusNotifier.addListener
(inherited documentation)

addCallback(self, callback, eventType=None, *args)

source code 
Overrides: event.field_events.IFocusNotifier.addCallback

removeListener(self, listener, iface=None)

source code 

Removes a previously registered IProperty and IItemset change listener.

Parameters:
  • listener - the listener to be removed.
Overrides: event.field_events.IFocusNotifier.removeListener
(inherited documentation)

removeCallback(self, callback, eventType=None)

source code 
Overrides: event.field_events.IFocusNotifier.removeCallback

setMultiSelect(self, multiSelect)

source code 

Sets the multiselect mode. Setting multiselect mode false may loose selection information: if selected items set contains one or more selected items, only one of the selected items is kept as selected.

Parameters:
  • multiSelect - the New value of property multiSelect.
Overrides: abstract_select.AbstractSelect.setMultiSelect

Deprecated: use ListSelect, OptionGroup or TwinColSelect instead

See Also: AbstractSelect.setMultiSelect

isMultiSelect(self)

source code 

Is the select in multiselect mode? In multiselect mode

Returns:
the Value of property multiSelect.
Overrides: abstract_select.AbstractSelect.isMultiSelect

Deprecated: use ListSelect, OptionGroup or TwinColSelect instead

See Also: AbstractSelect.isMultiSelect

setScrollToSelectedItem(self, scrollToSelectedItem)

source code 

Sets whether to scroll the selected item visible (directly open the page on which it is) when opening the combo box popup or not. Only applies to single select mode.

This requires finding the index of the item, which can be expensive in many large lazy loading containers.

Parameters:
  • scrollToSelectedItem - true to find the page with the selected item when opening the selection popup

isScrollToSelectedItem(self)

source code 

Returns true if the select should find the page with the selected item when opening the popup (single select combo box only).

Returns:
true if the page with the selected item will be shown when opening the popup

Instance Variable Details [hide private]

pageLength

Holds value of property pageLength. 0 disables paging.