com.ibm.as400.util.html.UnorderedListItem Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jt400 Show documentation
Show all versions of jt400 Show documentation
The Open Source version of the IBM Toolbox for Java
///////////////////////////////////////////////////////////////////////////////
//
// JTOpen (IBM Toolbox for Java - OSS version)
//
// Filename: UnorderedListItem.java
//
// The source code contained herein is licensed under the IBM Public License
// Version 1.0, which has been approved by the Open Source Initiative.
// Copyright (C) 1997-2001 International Business Machines Corporation and
// others. All rights reserved.
//
///////////////////////////////////////////////////////////////////////////////
package com.ibm.as400.util.html;
import com.ibm.as400.access.Trace;
import com.ibm.as400.access.ExtendedIllegalArgumentException;
import java.beans.PropertyChangeSupport;
/**
* The UnorderedListItem class represents an item in an unordered list item.
*
* This example creates a UnorderedListItem tag:
*
* // Create an UnorderedList.
* UnorderedList list = new UnorderedList(HTMLConstants.SQUARE);
*
* // Create an UnorderedListItem.
* UnorderedListItem listItem = new UnorderedListItem();
*
* // Set the data in the list item.
* listItem.setItemData(new HTMLText("my list item"));
*
* // Add the list item to the UnorderedList.
* list.addListItem(listItem);
* System.out.println(list.toString());
*
*
* Here is the output of the UnorderedListItem tag:
*
* <ul type="square">
* <li>my list item</li>
* </ul>
*
* Here is the output of the UnorderedListItem tag using XSL-Formatting Objects:
*
* <fo:block-container>
* <fo:list-block>
* <fo:list-item>
* <fo:list-item-label>Å</fo:list-item-label>
* <fo:list-item-body><fo:block-container><fo:block>my list item</fo:block>
* </fo:block-container>
* </fo:list-item-body>
* </fo:list-item>
* </fo:list-block>
* </fo:block-container>
*
*
* UnorderedListItem objects generate the following events:
*
* - PropertyChangeEvent
*
**/
public class UnorderedListItem extends HTMLListItem
{
private static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others.";
static final long serialVersionUID = -4124433047652031568L;
private String type_; //The labeling scheme used to display the unordered list item .
/**
* Constructs a default UnorderedList object.
**/
public UnorderedListItem()
{
super();
}
/**
* Constructs a UnorderedListItem object with the specified data.
* @param data The data to use in the unordered list item.
**/
public UnorderedListItem(HTMLTagElement data)
{
super();
setItemData(data);
}
/**
* Returns the type attribute.
* @return The type attribute.
**/
String getTypeAttribute()
{
//@B1D
StringBuffer s = new StringBuffer("");
if (type_ != null)
{
if (type_.equals(HTMLConstants.DISC))
s.append(" type=\"disc\"");
else if (type_.equals(HTMLConstants.SQUARE))
s.append(" type=\"square\"");
else if (type_.equals(HTMLConstants.CIRCLE))
s.append(" type=\"circle\"");
return new String(s);
}
else
return "";
}
/**
* Returns the label for the XSL-FO list-label.
* @return The label.
**/
String getTypeAttributeFO(String type, int label) //@C1A
{
StringBuffer s = new StringBuffer("");
if (type != null)
{
if (type.equals(HTMLConstants.DISC))
s.append("·");
else if (type.equals(HTMLConstants.SQUARE))
s.append("Å");
else if (type.equals(HTMLConstants.CIRCLE))
s.append("Ê");
}
return s.toString();
}
/**
* Returns the type of the labeling scheme.
* @return The type.
**/
public String getType()
{
return type_;
}
/**
* Deserializes and initializes transient data.
**/
private void readObject(java.io.ObjectInputStream in)
throws java.io.IOException, ClassNotFoundException
{
in.defaultReadObject();
//@CRS changes_ = new PropertyChangeSupport(this);
}
/**
* Sets the labeling scheme to be used. The default scheme is disc.
* When used at the ListItem level, all subsequent list labels will
* carry the new TYPE scheme unless set again by a later TYPE attribute.
*
* @param type The labeling scheme. One of the following constants
* defined in HTMLConstants: DISC, SQUARE, or CIRCLE.
*
* @see com.ibm.as400.util.html.HTMLConstants
**/
public void setType(String type)
{
if (type == null)
throw new NullPointerException("type");
// If type is not one of the valid HTMLConstants, throw an exception.
if ( !(type.equals(HTMLConstants.DISC)) && !(type.equals(HTMLConstants.CIRCLE)) && !(type.equals(HTMLConstants.SQUARE)) )
{
throw new ExtendedIllegalArgumentException("type", ExtendedIllegalArgumentException.PARAMETER_VALUE_NOT_VALID);
}
//@CRS if (Trace.isTraceOn())
//@CRS Trace.log(Trace.INFORMATION, " Setting labeling type for .");
String old = type_;
type_ = type;
if (changes_ != null) changes_.firePropertyChange("type", old, type ); //@CRS
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy