* @param reader The reader to read data from.
* @param preference The preference object that the data is to be added to.
* @throws XMLStreamException Thrown if there is an error reading from the reader.
*/
private static void parsePhase(XMLStreamReader reader, View view) throws XMLStreamException {
Phase phase = new Phase();
phase.setName(reader.getAttributeValue(null, ATTRIBUTE_NAME));
boolean endFound = false;
while (!endFound) {
if (reader.hasNext()) {
int eventType = reader.next();
if (eventType == XMLStreamConstants.START_ELEMENT) {
QName elementQName = reader.getName();
String elementName = elementQName.toString();
if (ELEMENT_COLUMN_ENTRY.equals(elementName)) {
ColumnEntry colEntry = new ColumnEntry();
colEntry.setName(reader.getAttributeValue(null, ATTRIBUTE_NAME));
String width = reader.getAttributeValue(null, ATTRIBUTE_WIDTH);
try {
colEntry.setWidth(Integer.valueOf(width));
}
catch (NumberFormatException e) {
// just don't set the width
}
colEntry.setResizable(Boolean.valueOf(reader.getAttributeValue(null,
ATTRIBUTE_RESIZABLE)));
colEntry.setEnable(Boolean.valueOf(reader
.getAttributeValue(null, ATTRIBUTE_ENABLE)));
phase.getColumnEntry().add(colEntry);
}
}
else if (eventType == XMLStreamConstants.END_ELEMENT) {
if (ELEMENT_PHASE.equals(reader.getName().toString())) {
// this is the end of the Phase element