Class ListItem
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class ListItem

public class netscape.application.ListItem
    extends java.lang.Object
    implements java.lang.Cloneable,
               netscape.util.Codable
{
    /* Constructors
     */
    public ListItem();

    /* Methods
     */
    public Object clone();
    public String command();
    public Object data();
    public void decode(Decoder);
    public void describeClassInfo(ClassInfo);
    protected void drawBackground(Graphics, Rect);
    public void drawInRect(Graphics, Rect);
    protected void drawStringInRect(Graphics, String, Font, Rect, int);
    public void encode(Encoder);
    public void finishDecoding();
    public Font font();
    public Image image();
    public boolean isEnabled();
    public boolean isSelected();
    public boolean isTransparent();
    public ListView listView();
    public int minHeight();
    public int minWidth();
    public Color selectedColor();
    public Image selectedImage();
    public void setCommand(String);
    public void setData(Object);
    public void setEnabled(boolean);
    public void setFont(Font);
    public void setImage(Image);
    public void setSelected(boolean);
    public void setSelectedColor(Color);
    public void setSelectedImage(Image);
    public void setTitle(String);
    public String title();
}
Object subclass representing a single ListView entry.
See Also:
ListView

Constructors

ListItem

  public ListItem()
Constructs an empty ListItem.

Methods

clone

  public Object clone()
Clones the ListItem. ListView adds addtional rows by cloning its prototype ListItem. Note that if you have setData() on the prototype ListItem, clone() does not clone the data (all ListItem clones will reference the same data).
Overrides:
clone in class Object

listView

  public ListView listView()
Returns the ListView associated with the ListItem. Returns null if the ListItem is not in a ListView.

isTransparent

  public boolean isTransparent()
Returns true if the ListItem is transparent, allowing ListView to optimize its drawing. ListView only draws the background of transparent ListItems.

setCommand

  public void setCommand(String newCommand)
Sets the command associated with this ListItem. ListView sends ListItem's command instead of its own when the ListItem is single-clicked.

command

  public String command()
Returns the command associated with this ListItem.
See Also:
setCommand

setTitle

  public void setTitle(String aString)
Sets the title the ListItem displays.

title

  public String title()
Returns the title the ListItem displays.
See Also:
setTitle

setSelected

  public void setSelected(boolean flag)
Called by ListView when a ListItem is selected. By default, selected ListItems highlight by painting a white background.

isSelected

  public boolean isSelected()
Returns true if the ListItem is selected.
See Also:
setSelected

setEnabled

  public void setEnabled(boolean flag)
Enables or disables the ListItem. Disabled ListItems cannot be selected, and render their title using Color.gray.

isEnabled

  public boolean isEnabled()
Returns true if the ListItem is enabled.
See Also:
setEnabled

setImage

  public void setImage(Image anImage)
Sets the Image the ListItem displays next to its title.
See Also:
setSelectedImage

image

  public Image image()
Returns the Image the ListItem displays next to its title.
See Also:
setImage

setSelectedImage

  public void setSelectedImage(Image anImage)
Sets the Image the ListItem displays next to its title when selected.
See Also:
setImage

selectedImage

  public Image selectedImage()
Returns the Image the ListItem displays next to its title when selected.
See Also:
setSelectedImage

setFont

  public void setFont(Font aFont)
Sets the Font the ListItem uses to render its title.

font

  public Font font()
Returns the Font the ListItem uses to render its title. If no Font has been set, returns Font.defaultFont().
See Also:
defaultFont

setSelectedColor

  public void setSelectedColor(Color color)
Sets the color the ListItem uses to draw its background when selected.

selectedColor

  public Color selectedColor()
Returns the color the ListItem uses to draw its background when selected.

setData

  public void setData(Object data)
Sets the ListItem's data, a storage place for arbitrary data associated with the ListItem.

data

  public Object data()
Returns the ListItem's data.
See Also:
setData

minWidth

  public int minWidth()
Returns the minimum width required to display the ListItem's title and Image, if any.

minHeight

  public int minHeight()
Returns the minimum height required to display the ListItem's title and Image, if any.

drawBackground

  protected void drawBackground(Graphics g,
                                Rect boundsRect)
Called from drawInRect() to draw the ListItem's background. Subclasses can override this method to draw custom backgrounds.

drawStringInRect

  protected void drawStringInRect(Graphics g,
                                  String title,
                                  Font titleFont,
                                  Rect textBounds,
                                  int justification)
Called from drawInRect() to draw the ListItem's title. Subclasses can override this method to draw the title string in a special way.

drawInRect

  public void drawInRect(Graphics g,
                         Rect boundsRect)
Called by ListView to draw the ListItem. If the ListItem is transparent, its ListView will have already drawn its background. If not, the ListItem should entirely fill boundsRect.

describeClassInfo

  public void describeClassInfo(ClassInfo info)
Describes the ListItem class' information.
See Also:
describeClassInfo

encode

  public void encode(Encoder encoder) throws CodingException
Archives the ListItem instance.
See Also:
encode

decode

  public void decode(Decoder decoder) throws CodingException
Unarchives the ListItem instance.
See Also:
decode

finishDecoding

  public void finishDecoding() throws CodingException
Finishes the ListItem's unarchiving.
See Also:
finishDecoding

All Packages  Class Hierarchy  This Package  Previous  Next  Index