[
Previous section |
Next section |
This Package |
Package List |
Table of Contents
]
Class ManagedContainer
public class extend.awt.ManagedContainer extends extend.awt.DataContainer {
public ManagedContainer(int)
public void setView(int)
public int countItems()
public ContainerItem getItem(int)
public void addItem(ContainerItem)
public void addItem(ContainerItem, int)
public void replaceItem(ContainerItem, int)
public void clear()
public void delItem(int)
public void delItems(int, int)
public int getSelectedIndex()
public int getSelectedIndexes()[]
public ContainerItem getSelectedItem()
public ContainerItem getSelectedItems()[]
public void select(int)
public void deselect(int)
public boolean isSelected(int)
public void setAutoRefresh(boolean)
public boolean isAutoRefreshEnabled()
}
The ManagedContainer class extends the data container control to add the
automatic management of container items. To do so, the set of container items
are limited to a simple list. So, the DataContainer Tree view is
not allowed.
Management of the container items is modeled after the java.awt.List
control. This allows for easy and automatic management of the relationship
between the container and its items.
ManagedContainer
public ManagedContainer (int newView)
- This is the only constructor for the ManagedContainer class.
- Parameters:
newView -
The view to set the container to. It must be
one of Details_View, List_View or Icon_View. Note:
the DataContainer Tree_View is not allowed in the ManagedContainer.
- Throws:
- IllegalArgumentException
This exception is thrown when any argument is not valid.
setView
public void setView (int newView)
- This method sets the ManagedContainer into one of several views, or
ways of displaying the ContainerItems in the container.
- Parameters:
newView -
The view to set the container to. It must be
one of Details_View, List_View or Icon_View. Note:
the DataContainer Tree_View is not allowed in the ManagedContainer.
- Throws:
- IllegalArgumentException
This exception is thrown when any argument is not valid.
countItems
public int countItems ()
- This method returns the current number of ContainerItems in the
container.
- Returns:
- This method returns an int.
getItem
public ContainerItem getItem (int which)
- This method returns the ContainerItem at the position indicated by
the argument.
- Parameters:
which -
This is the zero-based index of the ContainerItem to
return.
- Returns:
- This method returns a ContainerItem.
- Throws:
- IllegalArgumentException
This exception is thrown when any argument is not valid.
addItem
public void addItem (ContainerItem item)
- This method adds the given ContainerItem to the end of the item list.
- Parameters:
item -
This is the item to add to the end of the list.
addItem
public void addItem (ContainerItem item, int which)
- This method inserts the given ContainerItem at the position indicated
by the second argument. If the second argument is out of range (less than
zero or greater than or equal to the current number of items), the new item
is added to the end of the list.
- Parameters:
item -
This is the item to add to the list.
which -
This is the index of the list at which the item is to
be inserted.
replaceItem
public void replaceItem (ContainerItem item, int which)
- This method replaces the current item at the index given by the second
argument with the item in the first argument.
- Parameters:
item -
The item to place in the list at the given location.
which -
The index in the list whose item will be replaced.
- Throws:
- IllegalArgumentException
This exception is thrown when any argument is not valid.
clear
public void clear ()
- This method removes all ContainerItems from the container.
delItem
public void delItem (int which)
- This method removes the ContainerItem at the given index from the
container's item list.
- Parameters:
which -
The index of the item to remove.
- Throws:
- IllegalArgumentException
This exception is thrown when any argument is not valid.
delItems
public void delItems (int first, int last)
- This method removes all ContainerItems with indices between first
and last inclusive.
- Parameters:
first -
The index of the first item to remove.
last -
The index of the last item to remove.
- Throws:
- IllegalArgumentException
This exception is thrown when any argument is not valid.
getSelectedIndex
public int getSelectedIndex ()
- This method returns the index of the currently selected item. If no
items are selected or more that one item is selected, -1 is returned.
- Returns:
- This method returns an int.
getSelectedIndexes
public int [] getSelectedIndexes ()
- This method returns an array of the indexes of the currently selected
items. If no items are selected, null is returned.
- Returns:
- This method returns an array of ints.
getSelectedItem
public ContainerItem getSelectedItem ()
- This method returns the currently selected item. If no items are
selected or more that one item is selected, null is returned.
- Returns:
- This method returns a ContainerItem.
getSelectedItems
public ContainerItem [] getSelectedItems ()
- This method returns an array of the currently selected items. If no
items are selected, null is returned.
- Returns:
- This method returns an array of ContainerItems.
select
public void select (int which)
- This method puts the ContainerItem at the given index into the selected
state.
- Parameters:
which -
The index of the item to make selected.
- Throws:
- IllegalArgumentException
This exception is thrown when any argument is not valid.
deselect
public void deselect (int which)
- This method puts the ContainerItem at the given index into the unselected
state.
- Parameters:
which -
The index of the item to make unselected.
- Throws:
- IllegalArgumentException
This exception is thrown when any argument is not valid.
isSselected
public boolean isSelected (int which)
- This method returns true if the ContainerItem at the given index
is currently selected, false otherwise.
state.
- Parameters:
which -
The index of the item whose selected state is to be
returned.
- Returns:
- This method returns a boolean.
- Throws:
- IllegalArgumentException
This exception is thrown when any argument is not valid.
setAutoRefresh
public void setAutoRefresh (boolean newState)
- This method sets the autorefresh state of the container. If set to
true, the visual aspect of the container will be refreshed each time
a change is made to the list of ContainerItems. If set to false, refresh
must be manually done. This mechanism allows multiple updates to the
ContainerItem list while avoiding unwanted repaints.
- Parameters:
newState -
The new state of the autorefresh attribute.
isAutoRefreshEnabled
public boolean isAutoRefreshEnabled ()
- This method returns the current state of the autorefresh attribute.
- Returns:
- This method returns a boolean.
Events
The ManagedContainer class posts the same events as its parent, DataContainer.
No additional events are posted.
[
Previous section |
Next section |
This Package |
Package List |
Table of Contents
]