예제 #1
0
파일: ModOption.java 프로젝트: Thue/FreeCol
  /** {@inheritDoc} */
  @Override
  protected void writeAttributes(FreeColXMLWriter xw) throws XMLStreamException {
    super.writeAttributes(xw);

    if (value != null) {
      xw.writeAttribute(VALUE_TAG, value.getId());
    }
  }
예제 #2
0
 /**
  * Initialize this object from an XML-representation of this object.
  *
  * @param in The input stream with the XML.
  * @throws XMLStreamException if a problem was encountered during parsing.
  */
 @Override
 public void readFromXML(XMLStreamReader in) throws XMLStreamException {
   final String id = in.getAttributeValue(null, ID_ATTRIBUTE_TAG);
   editable = getAttribute(in, "editable", true);
   if (id != null) {
     setId(id);
   }
   while (in.nextTag() != XMLStreamConstants.END_ELEMENT) {
     String optionId = in.getAttributeValue(null, ID_ATTRIBUTE_TAG);
     Option option = getOption(optionId);
     if (option == null) {
       AbstractOption abstractOption = readOption(in);
       if (abstractOption != null) {
         add(abstractOption);
         abstractOption.setGroup(this.getId());
       }
     } else {
       option.readFromXML(in);
     }
   }
 }