Google Data APIs Client Library (1.41.1)



com.google.gdata.data.spreadsheet
Class CustomElementCollection

java.lang.Object
  extended by com.google.gdata.data.spreadsheet.CustomElementCollection
All Implemented Interfaces:
Extension

public class CustomElementCollection
extends java.lang.Object
implements Extension

Extension that globs together all "gsx:" tags into one. Designed for row-based access to spreadsheets. extra tags. Another option is overriding ListEntry's getExtensionHandler method. Finally, this might be embedded as a private class inside of ListEntry.


Constructor Summary
CustomElementCollection()
           
 
Method Summary
 void clearValueLocal(java.lang.String columnHeader)
          Locally clears the particular value.
 void generate(com.google.gdata.util.common.xml.XmlWriter w, ExtensionProfile extProfile)
          Writes this cell as XML, omitting any unspecified fields.
static ExtensionDescription getDefaultDescription()
          Returns the suggested extension description.
 XmlParser.ElementHandler getHandler(ExtensionProfile extProfile, java.lang.String namespace, java.lang.String localName, org.xml.sax.Attributes attrs)
          Yields an XML handler for parsing a Cell element.
 java.util.Set<java.lang.String> getTags()
          Gets a list of all tags that are set for this entry.
 java.lang.String getValue(java.lang.String columnHeader)
          Gets the text at the cell, whose column is named columnHeader.
 void replaceWithLocal(CustomElementCollection other)
          Locally clears all existing values and copies the contents of the other element collection over.
 void setValueLocal(java.lang.String columnHeader, java.lang.String newContents)
          Locally sets the value at the particular cell, specified by the column name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CustomElementCollection

public CustomElementCollection()
Method Detail

getValue

public java.lang.String getValue(java.lang.String columnHeader)
Gets the text at the cell, whose column is named columnHeader. For instance, if the spreadsheet has a column "Name", then calling getValue("name") will return the selected row's cell in that name column.

Parameters:
columnHeader - the lowercase, stripped version of the column header
Returns:
the contents of the cell

setValueLocal

public void setValueLocal(java.lang.String columnHeader,
                          java.lang.String newContents)
Locally sets the value at the particular cell, specified by the column name. For instance, setValueLocal("name", "Ensulato") will change the name column of this row to "Ensulato". To commit the change, you must . The particular column you specify must already exist in the spreadsheet; new columns are not automatically added.

Parameters:
columnHeader - the header column (must already exist)
newContents - the new contents; may not start with an '=' sign
Throws:
java.lang.IllegalArgumentException - if the contents begins with an equals sign if a non-existent columnHeader is used. But, when adding a new entry, there needs to be a way to locally know the schema.

clearValueLocal

public void clearValueLocal(java.lang.String columnHeader)
Locally clears the particular value. Note that if the entire row is cleared, the entry will be rejected. You must actually delete the row.

Parameters:
columnHeader - the column header to clear.

replaceWithLocal

public void replaceWithLocal(CustomElementCollection other)
Locally clears all existing values and copies the contents of the other element collection over.

Parameters:
other - the custom element collection

getTags

public java.util.Set<java.lang.String> getTags()
Gets a list of all tags that are set for this entry. The initial order of the tags is preserved. For instance, this might return an iterable with "name", "address", "manager", "employeeid".

Returns:
an Iterable with all the different tags for getValue

getDefaultDescription

public static ExtensionDescription getDefaultDescription()
Returns the suggested extension description.


generate

public void generate(com.google.gdata.util.common.xml.XmlWriter w,
                     ExtensionProfile extProfile)
              throws java.io.IOException
Writes this cell as XML, omitting any unspecified fields.

Specified by:
generate in interface Extension
Parameters:
w - XML writer
extProfile - extension profile
Throws:
java.io.IOException

getHandler

public XmlParser.ElementHandler getHandler(ExtensionProfile extProfile,
                                           java.lang.String namespace,
                                           java.lang.String localName,
                                           org.xml.sax.Attributes attrs)
                                    throws ParseException,
                                           java.io.IOException
Yields an XML handler for parsing a Cell element.

Specified by:
getHandler in interface Extension
Parameters:
extProfile - extension profile
namespace - extension namespace
localName - tag name, without the namespace prefix
attrs - tag attributes
Returns:
an element handler
Throws:
ParseException - when an unexpected tag or badly-formatted XML is detected
java.io.IOException