FileDocCategorySizeDatePackage
Table.javaAPI DocGlassfish v2 API5433Fri May 04 22:34:50 BST 2007com.sun.enterprise.diagnostics.report.html

Table

public class Table extends HTMLElement
author
Jagadish

Fields Summary
private int
border
private int
cellSpacing
private String
alignment
private float
width
private boolean
absoluteWidth
public static final String
ALIGN_LEFT
public static final String
ALIGN_CENTER
public static final String
ALIGN_RIGHT
Constructors Summary
public Table()
Creates a new instance of Table

    
           
      
        super("table");
    
public Table(int border, int cellSpacing)
Creates a new instance of Table

        this();
        addAttribute("border",String.valueOf(border));
        addAttribute("cellspacing",String.valueOf(cellSpacing));
        
    
Methods Summary
public TRaddRow(java.util.Iterator values, boolean header, java.lang.String cssClass)

        TR row = new TR();
        while(values.hasNext()) {
            CSSElement tableData = null;
            if(header)
                tableData = new TH();
            else
                tableData = new TD();
            
            tableData.addText(values.next());
            setCSSClass(tableData, cssClass);
            row.add(tableData);
        }
        add(row);
        return row;
    
public TRaddRow(java.util.ArrayList elements, java.lang.String cssClass)

        TR row = new TR();
        for(int i=0; i<elements.size();i++){
            TD tableData = new TD();
            tableData.add((Element)elements.get(i));
            setCSSClass(tableData, cssClass);
            row.add(tableData);
        }
        add(row);
        return row;
    
public java.lang.StringgetAlignment()

        return alignment;
    
public intgetBorder()

        return border;
    
public intgetCellSpacing()

        return cellSpacing;
    
public floatgetWidth()

        return width;
    
public booleanisAbsoluteWidth()

        return absoluteWidth;
    
public voidsetAlignment(java.lang.String alignment)

        this.alignment = alignment;
        setAttribute("alignment",alignment );
    
private voidsetAttribute(java.lang.String property, java.lang.String value)

        if(!(property==null || value==null)){
            List<Attribute> attributes= getAttributes(property);
            if(attributes.size()==0){
                addAttribute(property,value);
            }
            else{
                Attribute attribute = attributes.get(0);
                attribute.setValue(value);   
            }
        }
    
public voidsetBorder(int border)
Sets the border attribute for the table

param
border in pixels

        this.border = border;
        setAttribute("border",String.valueOf(border));
    
private voidsetCSSClass(CSSElement element, java.lang.String cssClass)

        if(cssClass != null){
            element.setCSSClass(cssClass);
        } 
    
public voidsetCellSpacing(int cellSpacing)

        this.cellSpacing = cellSpacing;
        setAttribute("cellspacing", String.valueOf(cellSpacing));
    
public voidsetWidth(float width, boolean absolute)

        this.width = width;
        this.absoluteWidth = absolute;
        if(absolute){
            setAttribute("width",String.valueOf(width));
        }
        else{
            setAttribute("width",String.valueOf(width)+"%" );
        }