FileDocCategorySizeDatePackage
WidgetPullParser.javaAPI DocAndroid 1.5 API3995Wed May 06 22:41:10 BST 2009com.android.ide.eclipse.editors.layout

WidgetPullParser

public class WidgetPullParser extends BasePullParser
{@link IXmlPullParser} implementation to render android widget bitmap.

The parser emulates a layout that contains just one widget, described by the {@link ViewElementDescriptor} passed in the constructor.

Fields Summary
private final com.android.ide.eclipse.editors.layout.descriptors.ViewElementDescriptor
mDescriptor
private String[]
mAttributes
Constructors Summary
public WidgetPullParser(com.android.ide.eclipse.editors.layout.descriptors.ViewElementDescriptor descriptor)


       
        mDescriptor = descriptor;
        
        String[] segments = mDescriptor.getCanonicalClassName().split(AndroidConstants.RE_DOT);
        mAttributes[0][1] = segments[segments.length-1];
    
Methods Summary
public intgetAttributeCount()

        return mAttributes.length; // text attribute
    
public java.lang.StringgetAttributeName(int index)

        if (index < mAttributes.length) {
            return mAttributes[index][0];
        }
        
        return null;
    
public java.lang.StringgetAttributeNamespace(int index)

        return SdkConstants.NS_RESOURCES;
    
public java.lang.StringgetAttributePrefix(int index)

        // pass
        return null;
    
public java.lang.StringgetAttributeValue(int index)

        if (index < mAttributes.length) {
            return mAttributes[index][1];
        }
        
        return null;
    
public java.lang.StringgetAttributeValue(java.lang.String ns, java.lang.String name)

        if (SdkConstants.NS_RESOURCES.equals(ns)) {
            for (String[] attribute : mAttributes) {
                if (name.equals(attribute[0])) {
                    return attribute[1];
                }
            }
        }
        
        return null;
    
public intgetDepth()

        // pass
        return 0;
    
public java.lang.StringgetName()

        return mDescriptor.getXmlLocalName();
    
public java.lang.StringgetNamespace()

        // pass
        return null;
    
public java.lang.StringgetPositionDescription()

        // pass
        return null;
    
public java.lang.StringgetPrefix()

        // pass
        return null;
    
public java.lang.ObjectgetViewKey()

        // we need a viewKey or the ILayoutResult will not contain any ILayoutViewInfo
        return mDescriptor;
    
public booleanisEmptyElementTag()

        if (mParsingState == START_TAG) {
            return true;
        }
        
        throw new XmlPullParserException("Call to isEmptyElementTag while not in START_TAG",
                this, null);
    
public voidonNextFromEndTag()

        // just one tag. we are done.
        mParsingState = END_DOCUMENT;
    
public voidonNextFromStartDocument()

        // just go to start_tag
        mParsingState = START_TAG;
    
public voidonNextFromStartTag()

        // since we have no children, just go to end_tag
        mParsingState = END_TAG;