ilog.webui.dhtml.components

Class IlxWList

    • Field Detail

      • MODEL_PROPERTY

        public static final java.lang.String MODEL_PROPERTY
        Name of the model property.
        See Also:
        Constant Field Values
      • SELECTION_MODEL_PROPERTY

        public static final java.lang.String SELECTION_MODEL_PROPERTY
        Name of the selectionModel property.
        See Also:
        Constant Field Values
      • CELL_RENDERER_PROPERTY

        public static final java.lang.String CELL_RENDERER_PROPERTY
        Name of the cellRenderer property.
        See Also:
        Constant Field Values
      • ACTION_PROPERTY

        public static final java.lang.String ACTION_PROPERTY
        Name of the action property.
        See Also:
        Constant Field Values
      • UI_PROPERTY

        public static final java.lang.String UI_PROPERTY
        Name of the UI property.
        See Also:
        Constant Field Values
      • CSS_RESOURCE_NAME

        public static final java.lang.String CSS_RESOURCE_NAME
        Resource path to the user-agent CSS.
        See Also:
        Constant Field Values
    • Constructor Detail

      • IlxWList

        public IlxWList(javax.swing.ListModel model)
        Constructs an IlxWList that displays the elements in the specified, non-null model.

        All IlxWList constructors delegate to this one.

        Throws:
        java.lang.IllegalArgumentException - If dataModel is null
        Parameters:
        model - The data model for this list.
      • IlxWList

        public IlxWList(java.lang.Object[] listData)
        Constructs an IlxWList that displays the elements in the specified array.

        This constructor simply delegates to the ListModel constructor.

        Parameters:
        listData - The array of Objects to be loaded into the data model.
      • IlxWList

        public IlxWList()
        Constructs an IlxWList with an empty model.
    • Method Detail

      • getColumnWidth

        public int getColumnWidth()
        Returns the width of the component in pixels.
      • setColumnWidth

        public void setColumnWidth(int columnWidth)
        Sets the width of the component in pixels.
        Parameters:
        columnWidth - The width of the component in pixels.
      • getRowHeight

        public int getRowHeight()
        Returns the height of the component. This corresponds to the number of items displayed in the drop-down list without scrolling.
      • setRowHeight

        public void setRowHeight(int rowHeight)
        Sets the height of the component, that is, the number of items displayed in the drop-down list without scrolling.
        Parameters:
        rowHeight - The height of the component in list items.
      • setCellRenderer

        public void setCellRenderer(IlxWListCellRenderer cellRenderer)
        Sets the delegate used to render each cell in the list.

        By default this property is null and the list is rendered as a <select> HTML element where cells are representing by an <option> element whose values are the string values of the data model. To see an example which sets the cell renderer, see the class description above.

        Parameters:
        cellRenderer - The IlxWListCellRenderer that renders list cells.
        See Also:
        getCellRenderer()
      • getModel

        public javax.swing.ListModel getModel()
        Returns the data model that holds the list of items displayed by the IlxWList component.
        Returns:
        The list model that provides the displayed list of items.
        See Also:
        setModel(javax.swing.ListModel)
      • setModel

        public void setModel(javax.swing.ListModel model)
        Sets the model that represents the contents or "value" of the list and clears the list selection after notifying PropertyChangeListeners.
        Throws:
        java.lang.IllegalArgumentException - If model is null.
        Parameters:
        model - The ListModel that provides the list of items for display.
        See Also:
        getModel()
      • setListData

        public void setListData(java.lang.Object[] listData)
        Constructs a ListModel from an array of objects and then applies setModel to it.
        Parameters:
        listData - An array of Objects containing the items to display in the list.
        See Also:
        setModel(javax.swing.ListModel)
      • createSelectionModel

        protected javax.swing.ListSelectionModel createSelectionModel()
        Returns an instance of DefaultListSelectionModel.

        This method is used by the constructor to initialize the selectionModel property.

        Returns:
        The ListSelectionModel used by this list.
        See Also:
        setSelectionModel(javax.swing.ListSelectionModel), DefaultListSelectionModel
      • getSelectionModel

        public javax.swing.ListSelectionModel getSelectionModel()
        Returns the value of the current selection model.

        The selection model handles the task of making single selections, selections of contiguous ranges, and non-contiguous selections.

        Returns:
        The selection model that implements list selections.
        See Also:
        setSelectionModel(javax.swing.ListSelectionModel), ListSelectionModel
      • getListSelectionListeners

        public javax.swing.event.ListSelectionListener[] getListSelectionListeners()
      • addListSelectionListener

        public void addListSelectionListener(javax.swing.event.ListSelectionListener listener)
        Adds a listener to the list that's notified each time a change to the selection occurs.

        Listeners added directly to the IlxWList will have their ListSelectionEvent.getSource() == this IlxWList (instead of the ListSelectionModel).

        Parameters:
        listener - The ListSelectionListener to add.
        See Also:
        getSelectionModel()
      • setSelectionModel

        public void setSelectionModel(javax.swing.ListSelectionModel selectionModel)
        Sets the selectionModel for the list to a non-null ListSelectionModel implementation.

        The selection model handles the task of making single selections, selections of contiguous ranges, and non-contiguous selections.

        Throws:
        java.lang.IllegalArgumentException - If selectionModel is null.
        Parameters:
        selectionModel - The ListSelectionModel that implements the selections.
        See Also:
        getSelectionModel()
      • setSelectionMode

        public void setSelectionMode(int selectionMode)
        Determines whether single-item or multiple-item selections are allowed.

        The following selectionMode values are allowed:

        • SINGLE_SELECTION Only one list index can be selected at a time. In this mode the setSelectionInterval and addSelectionInterval methods are equivalent, and only the second index argument is used.
        • SINGLE_INTERVAL_SELECTION One contiguous index interval can be selected at a time. In this mode setSelectionInterval and addSelectionInterval are equivalent.
        • MULTIPLE_INTERVAL_SELECTION In this mode, there is no restriction as to what can be selected. This is the default value.
        Parameters:
        selectionMode - An integer specifying the type of selections that are permissible.
        See Also:
        getSelectionMode()
      • getSelectionMode

        public int getSelectionMode()
        Returns whether single-item or multiple-item selections are allowed.
        Returns:
        The value of the selection mode.
        See Also:
        setSelectionMode(int)
      • getMinSelectionIndex

        public int getMinSelectionIndex()
        Returns the smallest selected cell index.

        This is a convenience method that just delegates to the selectionModel.

        Returns:
        The smallest selected cell index.
        See Also:
        ListSelectionModel.getMinSelectionIndex(), addListSelectionListener(javax.swing.event.ListSelectionListener)
      • getMaxSelectionIndex

        public int getMaxSelectionIndex()
        Returns the largest selected cell index.

        This is a convenience method that just delegates to the selectionModel.

        Returns:
        The largest selected cell index.
        See Also:
        ListSelectionModel.getMaxSelectionIndex(), addListSelectionListener(javax.swing.event.ListSelectionListener)
      • isSelectedIndex

        public boolean isSelectedIndex(int index)
        Returns true if the specified index is selected.

        This is a convenience method that just delegates to the selectionModel.

        Parameters:
        index - Index to be queried for selection state.
        Returns:
        True if the specified index is selected.
        See Also:
        ListSelectionModel.isSelectedIndex(int), setSelectedIndex(int), addListSelectionListener(javax.swing.event.ListSelectionListener)
      • removeSelectionInterval

        public void removeSelectionInterval(int index0,
                                   int index1)
        Sets the selection to be the set difference of the specified interval and the current selection.

        Both the anchor and lead indices are removed. It is not necessary for anchor to be less than lead. This is a convenience method that just delegates to the selectionModel.

        Parameters:
        index0 - The first index to remove from the selection.
        index1 - The last index to remove from the selection.
        See Also:
        ListSelectionModel.removeSelectionInterval(int, int), setSelectionInterval(int, int), addSelectionInterval(int, int), addListSelectionListener(javax.swing.event.ListSelectionListener)
      • setSelectedValue

        public void setSelectedValue(java.lang.Object element)
        Selects the specified object from the list.

        The list will scroll to display the selected object.

        Parameters:
        element - The object to select.
      • isEnabled

        public boolean isEnabled()
        Determines whether this component is enabled.
        Returns:
        true if the component is enabled; false otherwise.
        See Also:
        setEnabled(boolean)
      • setEnabled

        public void setEnabled(boolean enabled)
        Enables or disables this component.

        Parameters:
        enabled - If true, this component is enabled; otherwise this component is disabled.
        See Also:
        isEnabled()
      • getAction

        public IlxWAction getAction()
        Gets the action that will be called when the user selects an item in the list.

        By default, this action is a Java action (IlxWJavaAction) of which the perform method calls setSelectedIndex on the list.

        If the given action is a Java action (IlxWJavaAction), or a JavaScript action (IlxWJSAction), the argument array passed to the perform method is a 1-length array containing the string representation of the selected index.

        Returns:
        The action to perform when the user selects an item from the list.
        See Also:
        setAction(ilog.webui.dhtml.components.IlxWAction)
      • setAction

        public void setAction(IlxWAction action)
        Sets the action which will be called when the user selects an item in the list.

        Parameters:
        action - The action to perform when the user selects an item from the list.
        See Also:
        getAction()
      • getCellAt

        public IlxWComponent getCellAt(int index)
        Gets the component representing the cell at the given index. This component wraps the component returned by IlxWListCellRenderer.getListCellComponent.

        Under certain circumstances you may actually need to access the cell component, in order, for instance, to dynamically set the background-color of the whole cell.

        This component is not persistent and can be deleted/created at any time during the rendering phase. Consequently you should call this method only from the scope of IlxWListCellRenderer.getListCellComponent, and never keep a reference on the returned component outside this scope.

      • notifyDependencies

        public void notifyDependencies(IlxWPort port)
        Specified by:
        notifyDependencies in interface ilog.webui.dhtml.IlxWDependencyProvider
        Overrides:
        notifyDependencies in class IlxWComponent

© Copyright IBM Corp. 1987, 2015