public class

CustomElementCollection

extends Object
implements Extension
java.lang.Object
   ↳ com.google.gdata.data.spreadsheet.CustomElementCollection

Class Overview

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.

Summary

Fields
private Map<String, CustomElementCollection.CustomElement> values All values, indexed by the header column.
Public Constructors
CustomElementCollection()
Public Methods
void clearValueLocal(String columnHeader)
Locally clears the particular value.
void generate(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, String namespace, String localName, Attributes attrs)
Yields an XML handler for parsing a Cell element.
Set<String> getTags()
Gets a list of all tags that are set for this entry.
String getValue(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(String columnHeader, String newContents)
Locally sets the value at the particular cell, specified by the column name.
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.google.gdata.data.Extension

Fields

private Map<String, CustomElementCollection.CustomElement> values

All values, indexed by the header column. For instance, the pair "name", "bill" would mean that the cell in the column labelled "name" has the text "bill".

Public Constructors

public CustomElementCollection ()

Public Methods

public void clearValueLocal (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.

public void generate (XmlWriter w, ExtensionProfile extProfile)

Writes this cell as XML, omitting any unspecified fields.

Parameters
w XML writer
extProfile Extension profile
Throws
IOException

public static ExtensionDescription getDefaultDescription ()

Returns the suggested extension description.

public XmlParser.ElementHandler getHandler (ExtensionProfile extProfile, String namespace, String localName, Attributes attrs)

Yields an XML handler for parsing a Cell element.

Parameters
extProfile Extension profile
namespace Extension namespace
localName Tag name, without the namespace prefix
attrs Tag attributes
Returns
  • an element handler
Throws
IOException
ParseException

public Set<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

public String getValue (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

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

public void setValueLocal (String columnHeader, 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
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.