FileDocCategorySizeDatePackage
PropertyElements.javaAPI DocGlassfish v2 API5178Fri May 04 22:34:56 BST 2007com.sun.enterprise.tools.common.properties

PropertyElements

public class PropertyElements extends Object
author
vkraemer
version

Fields Summary
private com.sun.enterprise.tools.common.dd.connector.ResourceAdapter
ra
Constructors Summary
public PropertyElements(com.sun.enterprise.tools.common.dd.connector.ResourceAdapter ra)
Creates new PropertyElements

        this.ra = ra;
    
public PropertyElements(PropertyElements source)

        this.ra = (ResourceAdapter) source.ra.clone();
    
PropertyElements(String[] args)

        int rowCount = 0;
        if (null != args && args.length > 0) {
            try {
                rowCount = Integer.parseInt(args[0]);
            }
            catch (Throwable t) {
                t.printStackTrace();
            }
        }
        ra = new ResourceAdapter();
        for (int i = 0; i < rowCount; i++) {
            ra.addPropertyElement(true);
            ra.setAttributeValue(ResourceAdapter.PROPERTY,i,"name",""+i); //NOI18N
            ra.setAttributeValue(ResourceAdapter.PROPERTY,i,"value",""+(rowCount - i)); //NOI18N
        }
        //
        // Note: the ResourceAdapter MUST be part of a SunConnector or the
        // PropertyElementsTableModel is BROKEN.
        SunConnector connectorDD = SunConnector.createGraph();
        connectorDD.setResourceAdapter(ra);
    
Methods Summary
java.lang.StringdumpIt()

        return ra.dumpBeanNode();
    
public java.lang.ObjectgetAttributeDetail(int row, int col)

 
        return ra.getAttributeValue(ResourceAdapter.PROPERTY, row, intToAttribute(col)); //NOI18N
    
public intgetLength()

        return ra.sizePropertyElement();
    
public com.sun.enterprise.tools.common.dd.connector.ResourceAdaptergetResourceAdapter()

        return ra;
    
public intgetWidth()

        return 2;
    
private java.lang.StringintToAttribute(int col)

        if (col == 0) 
            return "name"; // NOI18N
        if (col == 1)
            return "value"; // NOI18N
        return "error"; // NOI18N
    
public voidsetAttributeDetail(java.lang.Object v, int r, int c)

 
        String input = (String) v;
        if (null == input || 0 == input.trim().length()) {
            // test for need to delete
            if (r >= getLength())
                return;
            int otherDex = c - 1;
            if (otherDex < 0)
                otherDex = -otherDex;
            String otherVal = ra.getAttributeValue(ResourceAdapter.PROPERTY, r, 
                intToAttribute(otherDex));
            if (null == otherVal || 0 == otherVal.trim().length()) {
                ra.removePropertyElement(r);
                return;
            }
            input = " "; // NOI18N
        }
        while (r >= getLength())
            ra.addPropertyElement(true);
        ra.setAttributeValue(ResourceAdapter.PROPERTY, r, intToAttribute(c), input); //NOI18N
    
public java.lang.StringtoString()

        return ra.dumpBeanNode();