DhBulletedList Class

DhBulletedList Class

This Package | All Packages

DhSection
  |
  +--DhBulletedList
public class DhBulletedList
extends DhSection
implements DhStringIDs

Represents the ordered and unordered list items in HTML. This is a simple container class into which items can be added, each getting its own bullet or number, as appropriate.

Constructors
Name Description
DhBulletedList() Creates a list.
DhBulletedList( int listType ) Creates a list.

Methods
Name Description
getElementCount() Returns the current number of elements in the list.
getListType() Retrieves the current list type.
insert( DhElement newElement, int index ) Inserts an element into the list at the specified index.
item( int index ) Retrieves the element at the specified index.
remove( DhElement e ) Removes the specified element from the list.
remove( int index ) Removes the element at the specified index from the list.
removeAll() Removes all the elements from the list.
setListType( int newType ) Sets the current list type.

Constructors

DhBulletedList.DhBulletedList

Syntax 1
public DhBulletedList();
Description

Creates a list. This default constructor creates a bulleted list (ListTypeEnum.BULLETED).

See Also
wfc.html.ListTypeEnum.BULLETED



Syntax 2
public DhBulletedList( int listType );
Parameters
listType
The type of list, which can be one of the constants provided in ListTypeEnum.
Description

Creates a list.

Exceptions

IllegalArgumentException thrown if listType is not one of class constants.

Methods

DhBulletedList.getElementCount

Syntax
public int getElementCount();
Return Value

Returns the number of direct children (nonrecursive count).

Description

Returns the current number of elements in the list. Only top-level (direct children of the DhList) elements are counted.

DhBulletedList.getListType

Syntax
public int getListType();
Return Value

Returns one of the constants provided in ListTypeEnum.

Description

Retrieves the current list type.

DhBulletedList.insert

Syntax
public void insert( DhElement newElement, int index );
Parameters
newElement
The new element to insert.
index
The zero-based index where the element is to be placed.
Description

Inserts an element into the list at the specified index. If the index is less than 0 or greater than the number of elements in the list, the element is added to the end of the list.

DhBulletedList.item

Syntax
public DhElement item( int index );
Parameters
index
The index of the element to retrieve.
Description

Retrieves the element at the specified index.

Exceptions

RuntimeException thrown if index is not in the list.

DhBulletedList.remove

Syntax 1
public int remove( DhElement e );
Return Value

Returns the index of the element that was removed.

Description

Removes the specified element from the list.



Syntax 2
public int remove( int index );
Return Value

Returns the index of the element that was removed.

Description

Removes the element at the specified index from the list.

DhBulletedList.removeAll

Syntax
public void removeAll();
Description

Removes all the elements from the list.

DhBulletedList.setListType

Syntax
public void setListType( int newType );
Parameters
newType
The desired list type, which can be one of the constants provided in ListTypeEnum.
Description

Sets the current list type.