You can subscribe to this list here.
2012 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(27) |
Jun
(63) |
Jul
(17) |
Aug
(58) |
Sep
(7) |
Oct
(9) |
Nov
(3) |
Dec
(9) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2013 |
Jan
(16) |
Feb
(5) |
Mar
(8) |
Apr
(3) |
May
(9) |
Jun
(7) |
Jul
(11) |
Aug
(1) |
Sep
(5) |
Oct
(33) |
Nov
(21) |
Dec
(32) |
2014 |
Jan
(8) |
Feb
(43) |
Mar
(36) |
Apr
(22) |
May
(69) |
Jun
(76) |
Jul
(66) |
Aug
(53) |
Sep
(39) |
Oct
(62) |
Nov
(28) |
Dec
(16) |
2015 |
Jan
(7) |
Feb
(2) |
Mar
(51) |
Apr
(97) |
May
(58) |
Jun
(20) |
Jul
(8) |
Aug
(5) |
Sep
(5) |
Oct
(27) |
Nov
(28) |
Dec
(43) |
2016 |
Jan
(17) |
Feb
(4) |
Mar
(12) |
Apr
(5) |
May
(15) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <jak...@us...> - 2012-06-06 11:55:13
|
Revision: 1289 http://jsbml.svn.sourceforge.net/jsbml/?rev=1289&view=rev Author: jakobmatthes Date: 2012-06-06 11:55:07 +0000 (Wed, 06 Jun 2012) Log Message: ----------- render extension: add RenderParser template Added Paths: ----------- trunk/extensions/render/src/org/sbml/jsbml/xml/parsers/RenderParser.java Added: trunk/extensions/render/src/org/sbml/jsbml/xml/parsers/RenderParser.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/xml/parsers/RenderParser.java (rev 0) +++ trunk/extensions/render/src/org/sbml/jsbml/xml/parsers/RenderParser.java 2012-06-06 11:55:07 UTC (rev 1289) @@ -0,0 +1,138 @@ +/* + * $Id: RenderParser.java 21:49:24 jakob $ + * $URL: RenderParser.java $ + * + * ---------------------------------------------------------------------------- + * This file is part of JSBML. Please visit <http://sbml.org/Software/JSBML> + * for the latest version of JSBML and more information about SBML. + * + * Copyright (C) 2009-2012 jointly by the following organizations: + * 1. The University of Tuebingen, Germany + * 2. EMBL European Bioinformatics Institute (EBML-EBI), Hinxton, UK + * 3. The California Institute of Technology, Pasadena, CA, USA + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation. A copy of the license agreement is provided + * in the file named "LICENSE.txt" included with this software distribution + * and also available online as <http://sbml.org/Software/JSBML/License>. + * ---------------------------------------------------------------------------- + */ +package org.sbml.jsbml.xml.parsers; + +import java.util.List; + +import org.sbml.jsbml.SBMLDocument; +import org.sbml.jsbml.xml.stax.SBMLObjectForXML; + + +/** + * @author Alexander Diamantikos + * @author Jakob Matthes + * @author Eugen Netz + * @author Jan Rudolph + * @version $Rev$ + * @since 1.0 + * @date 04.06.2012 + */ +public class RenderParser implements ReadingParser, WritingParser { + + /* (non-Javadoc) + * @see org.sbml.jsbml.xml.parsers.WritingParser#getListOfSBMLElementsToWrite(java.lang.Object) + */ + public List<Object> getListOfSBMLElementsToWrite(Object objectToWrite) { + // TODO Auto-generated method stub + return null; + } + + + /* (non-Javadoc) + * @see org.sbml.jsbml.xml.parsers.WritingParser#writeAttributes(org.sbml.jsbml.xml.stax.SBMLObjectForXML, java.lang.Object) + */ + public void writeAttributes(SBMLObjectForXML xmlObject, + Object sbmlElementToWrite) { + // TODO Auto-generated method stub + } + + + /* (non-Javadoc) + * @see org.sbml.jsbml.xml.parsers.WritingParser#writeCharacters(org.sbml.jsbml.xml.stax.SBMLObjectForXML, java.lang.Object) + */ + public void writeCharacters(SBMLObjectForXML xmlObject, + Object sbmlElementToWrite) { + // TODO Auto-generated method stub + } + + + /* (non-Javadoc) + * @see org.sbml.jsbml.xml.parsers.WritingParser#writeElement(org.sbml.jsbml.xml.stax.SBMLObjectForXML, java.lang.Object) + */ + public void writeElement(SBMLObjectForXML xmlObject, Object sbmlElementToWrite) { + // TODO Auto-generated method stub + } + + + /* (non-Javadoc) + * @see org.sbml.jsbml.xml.parsers.WritingParser#writeNamespaces(org.sbml.jsbml.xml.stax.SBMLObjectForXML, java.lang.Object) + */ + public void writeNamespaces(SBMLObjectForXML xmlObject, + Object sbmlElementToWrite) { + // TODO Auto-generated method stub + } + + + /* (non-Javadoc) + * @see org.sbml.jsbml.xml.parsers.ReadingParser#processAttribute(java.lang.String, java.lang.String, java.lang.String, java.lang.String, boolean, java.lang.Object) + */ + public void processAttribute(String elementName, String attributeName, + String value, String prefix, boolean isLastAttribute, Object contextObject) { + // TODO Auto-generated method stub + } + + + /* (non-Javadoc) + * @see org.sbml.jsbml.xml.parsers.ReadingParser#processCharactersOf(java.lang.String, java.lang.String, java.lang.Object) + */ + public void processCharactersOf(String elementName, String characters, + Object contextObject) { + // TODO Auto-generated method stub + } + + + /* (non-Javadoc) + * @see org.sbml.jsbml.xml.parsers.ReadingParser#processEndDocument(org.sbml.jsbml.SBMLDocument) + */ + public void processEndDocument(SBMLDocument sbmlDocument) { + // TODO Auto-generated method stub + } + + + /* (non-Javadoc) + * @see org.sbml.jsbml.xml.parsers.ReadingParser#processEndElement(java.lang.String, java.lang.String, boolean, java.lang.Object) + */ + public boolean processEndElement(String elementName, String prefix, + boolean isNested, Object contextObject) { + // TODO Auto-generated method stub + return false; + } + + + /* (non-Javadoc) + * @see org.sbml.jsbml.xml.parsers.ReadingParser#processNamespace(java.lang.String, java.lang.String, java.lang.String, java.lang.String, boolean, boolean, java.lang.Object) + */ + public void processNamespace(String elementName, String URI, String prefix, + String localName, boolean hasAttributes, boolean isLastNamespace, + Object contextObject) { + // TODO Auto-generated method stub + } + + + /* (non-Javadoc) + * @see org.sbml.jsbml.xml.parsers.ReadingParser#processStartElement(java.lang.String, java.lang.String, boolean, boolean, java.lang.Object) + */ + public Object processStartElement(String elementName, String prefix, + boolean hasAttributes, boolean hasNamespaces, Object contextObject) { + // TODO Auto-generated method stub + return null; + } +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jak...@us...> - 2012-06-06 11:46:07
|
Revision: 1288 http://jsbml.svn.sourceforge.net/jsbml/?rev=1288&view=rev Author: jakobmatthes Date: 2012-06-06 11:45:56 +0000 (Wed, 06 Jun 2012) Log Message: ----------- render extension: fix wrong separator in Style Modified Paths: -------------- trunk/extensions/render/src/org/sbml/jsbml/ext/render/Style.java Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/Style.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/Style.java 2012-06-06 11:32:06 UTC (rev 1287) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/Style.java 2012-06-06 11:45:56 UTC (rev 1288) @@ -351,10 +351,10 @@ if (!isAttributeRead) { isAttributeRead = true; if (attributeName.equals(RenderConstants.roleList)) { - setRoleList(value.split(":")); + setRoleList(value.split(" ")); } else if (attributeName.equals(RenderConstants.typeList)) { - setTypeList(value.split(":")); + setTypeList(value.split(" ")); } else { isAttributeRead = false; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jak...@us...> - 2012-06-06 11:32:16
|
Revision: 1287 http://jsbml.svn.sourceforge.net/jsbml/?rev=1287&view=rev Author: jakobmatthes Date: 2012-06-06 11:32:06 +0000 (Wed, 06 Jun 2012) Log Message: ----------- render extension: merge XMLTools Modified Paths: -------------- trunk/extensions/render/src/org/sbml/jsbml/ext/render/XMLTools.java Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/XMLTools.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/XMLTools.java 2012-06-05 21:57:59 UTC (rev 1286) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/XMLTools.java 2012-06-06 11:32:06 UTC (rev 1287) @@ -112,10 +112,6 @@ * @param value * @return */ - /** - * @param value - * @return - */ public static String decodeColorToString(Color value) { int r = value.getRed(); int g = value.getGreen(); @@ -123,6 +119,21 @@ return ("#" + Integer.toHexString(r) + Integer.toHexString(g) + Integer.toHexString(b)).toUpperCase(); } + + /** + * @param roleList + * @return + */ + public static String arrayToWhitespaceSeparatedString(String[] list) { + String output = ""; + for (int i = 0; i < list.length; i++) { + output += list[i]; + if (i != (list.length - 1)) { + output += " "; + } + } + return output; + } public static String encodeColorToString(Color value){ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jak...@us...> - 2012-06-05 21:58:07
|
Revision: 1286 http://jsbml.svn.sourceforge.net/jsbml/?rev=1286&view=rev Author: jakobmatthes Date: 2012-06-05 21:57:59 +0000 (Tue, 05 Jun 2012) Log Message: ----------- render extension: implement readAttributes and writeXMLAttributes for many classes Modified Paths: -------------- trunk/extensions/render/src/org/sbml/jsbml/ext/render/AbstractRenderPlugin.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/ColorDefinition.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/ExtendedRenderModel.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/GlobalRenderInformation.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/GradientBase.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/GradientStop.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/Image.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/LinearGradient.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/LocalRenderInformation.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/LocalStyle.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/RadialGradient.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderConstants.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderCubicBezier.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderInformationBase.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderPoint.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/Style.java Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/AbstractRenderPlugin.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/AbstractRenderPlugin.java 2012-06-05 20:26:08 UTC (rev 1285) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/AbstractRenderPlugin.java 2012-06-05 21:57:59 UTC (rev 1286) @@ -83,10 +83,10 @@ public AbstractRenderPlugin(String id, String name, int level, int version) { super(); // FIXME getLevelAndVersion, getElementName - /*if (getLevelAndVersion().compareTo(Integer.valueOf(MIN_SBML_LEVEL), - Integer.valueOf(MIN_SBML_VERSION)) < 0) { - throw new LevelVersionError(getElementName(), level, version); - } */ +// if (getLevelAndVersion().compareTo(Integer.valueOf(MIN_SBML_LEVEL), +// Integer.valueOf(MIN_SBML_VERSION)) < 0) { +// throw new LevelVersionError(getElementName(), level, version); +// } initDefaults(); } @@ -126,7 +126,7 @@ return versionMinor; } return null; - // TODO throw new PropertyUndefinedError(RenderConstants.versionMinor, this); + // TODO new PropertyUndefinedError(RenderConstants.versionMinor, this); } /** @@ -186,7 +186,7 @@ public void setVersionMajor(short versionMajor) { Short oldVersionMajor = this.versionMajor; this.versionMajor = versionMajor; - //FIXME firePropertyChange(RenderConstants.versionMajor, oldVersionMajor, this.versionMajor); + firePropertyChange(RenderConstants.versionMajor, oldVersionMajor, this.versionMajor); } /** @@ -198,7 +198,7 @@ if (isSetVersionMajor()) { Short oldVersionMajor = this.versionMajor; this.versionMajor = null; - //FIXME firePropertyChange(RenderConstants.versionMajor, oldVersionMajor, this.versionMajor); + firePropertyChange(RenderConstants.versionMajor, oldVersionMajor, this.versionMajor); return true; } return false; @@ -230,7 +230,7 @@ public void setRenderInformation(GlobalRenderInformation renderInformation) { GlobalRenderInformation oldRenderInformation = this.renderInformation; this.renderInformation = renderInformation; - //FIXME firePropertyChange(RenderConstants.renderInformation, oldRenderInformation, this.renderInformation); + firePropertyChange(RenderConstants.renderInformation, oldRenderInformation, this.renderInformation); } /** @@ -242,7 +242,7 @@ if (isSetRenderInformation()) { GlobalRenderInformation oldRenderInformation = this.renderInformation; this.renderInformation = null; - //FIXME OfirePropertyChange(RenderConstants.renderInformation, oldRenderInformation, this.renderInformation); + firePropertyChange(RenderConstants.renderInformation, oldRenderInformation, this.renderInformation); return true; } return false; @@ -252,10 +252,8 @@ * @see org.sbml.jsbml.ext.SBasePlugin#readAttribute(java.lang.String, java.lang.String, java.lang.String) */ // @Override - public boolean readAttribute(String attributeName, String prefix, - String value) { - // TODO Auto-generated method stub - return false; + public boolean readAttribute(String attributeName, String prefix, String value) { + return false; } /* (non-Javadoc) @@ -287,8 +285,7 @@ */ // @Override public Map<String, String> writeXMLAttributes() { - // TODO Auto-generated method stub - return null; + return null; } } Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/ColorDefinition.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/ColorDefinition.java 2012-06-05 20:26:08 UTC (rev 1285) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/ColorDefinition.java 2012-06-05 21:57:59 UTC (rev 1286) @@ -21,9 +21,12 @@ package org.sbml.jsbml.ext.render; import java.awt.Color; +import java.util.Map; -import org.sbml.jsbml.AbstractSBase; +import org.sbml.jsbml.AbstractNamedSBase; import org.sbml.jsbml.LevelVersionError; +import org.sbml.jsbml.PropertyUndefinedError; +import org.sbml.jsbml.SBase; /** @@ -35,45 +38,73 @@ * @since 1.0 * @date 08.05.2012 */ -public class ColorDefinition extends AbstractSBase { +public class ColorDefinition extends AbstractNamedSBase { /** * */ private static final long serialVersionUID = 8904459123022343452L; - private String id; private Color value; + /** + * Creates an ColorDefinition instance + */ + public ColorDefinition() { + super(); + initDefaults(); + } + /** - * Creates a ColorDefinition instance with an id and a color value + * Creates a ColorDefinition instance with an id. * * @param id - * @param value */ - public ColorDefinition(String id, Color value) { - this.id = id; - this.value = value; + public ColorDefinition(String id) { + super(id); + initDefaults(); } /** - * Creates a ColorDefinition instance with an id, color value, level, and version. + * Creates a ColorDefinition instance with a level and version. * + * @param level + * @param version + */ + public ColorDefinition(int level, int version) { + this(null, null, level, version); + } + + + /** + * Creates a ColorDefinition instance with an id, level, and version. + * * @param id - * @param value * @param level * @param version */ - public ColorDefinition(String id, Color value, int level, int version) { - super(level, version); + public ColorDefinition(String id, int level, int version) { + this(id, null, level, version); + } + + + /** + * Creates a ColorDefinition instance with an id, name, level, and version. + * + * @param id + * @param name + * @param level + * @param version + */ + public ColorDefinition(String id, String name, int level, int version) { + super(id, name, level, version); if (getLevelAndVersion().compareTo(Integer.valueOf(RenderConstants.MIN_SBML_LEVEL), Integer.valueOf(RenderConstants.MIN_SBML_VERSION)) < 0) { throw new LevelVersionError(getElementName(), level, version); } - this.id = id; - this.value = value; + initDefaults(); } @@ -82,46 +113,71 @@ */ public ColorDefinition(ColorDefinition obj) { super(obj); - this.id = obj.id; - this.value = obj.value; + value = obj.value; } - /* (non-Javadoc) - * @see org.sbml.jsbml.AbstractSBase#clone() + /** + * clones this class */ - //@Override public ColorDefinition clone() { return new ColorDefinition(this); } - + + /** - * @return the value of id + * Initializes the default values using the namespace. */ - public String getId(){ - return this.id; + public void initDefaults() { + addNamespace(RenderConstants.namespaceURI); } + + + /* (non-Javadoc) + * @see org.sbml.jsbml.NamedSBase#isIdMandatory() + */ + public boolean isIdMandatory() { + return true; + } - /** - * Set the value of id + + /* (non-Javadoc) + * @see org.sbml.jsbml.AbstractSBase#getAllowsChildren() */ - public void setId(String id){ - String oldId = this.id; - this.id = id; - firePropertyChange(RenderConstants.id, oldId, this.id); + @Override + public boolean getAllowsChildren() { + return false; } + + /* (non-Javadoc) + * @see org.sbml.jsbml.AbstractSBase#getChildCount() + */ + @Override + public int getChildCount() { + int count = 0; + return count; + } + + /* (non-Javadoc) + * @see org.sbml.jsbml.AbstractSBase#getChildAt(int) + */ + @Override + public SBase getChildAt(int childIndex) { + return null; + } + + /** * @return the value of value */ public Color getValue() { if (isSetValue()) { - Color val = value; - return val; - } else { - return null; + return value; } + // This is necessary if we cannot return null here. + throw new PropertyUndefinedError(RenderConstants.value, this); } @@ -157,14 +213,40 @@ } return false; } + /* (non-Javadoc) - * @see org.sbml.jsbml.AbstractSBase#toString() + * @see org.sbml.jsbml.AbstractNamedSBase#writeXMLAttributes() */ - //@Override - public String toString() { - // TODO Auto-generated method stub - return null; - } + @Override + public Map<String, String> writeXMLAttributes() { + Map<String, String> attributes = super.writeXMLAttributes(); + if (isSetValue()) { + attributes.remove(RenderConstants.value); + attributes.put(RenderConstants.shortLabel + ":" + RenderConstants.value, + XMLTools.decodeColorToString(getValue())); + } + return attributes; + } + + /* (non-Javadoc) + * @see org.sbml.jsbml.AbstractNamedSBase#readAttribute(java.lang.String, java.lang.String, java.lang.String) + */ + @Override + public boolean readAttribute(String attributeName, String prefix, String value) { + boolean isAttributeRead = super.readAttribute(attributeName, prefix, value); + if (!isAttributeRead) { + isAttributeRead = true; + if (attributeName.equals(RenderConstants.value)) { + setValue(Color.decode(value)); + } + // END TODO + else { + isAttributeRead = false; + } + } + return isAttributeRead; + } + } Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/ExtendedRenderModel.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/ExtendedRenderModel.java 2012-06-05 20:26:08 UTC (rev 1285) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/ExtendedRenderModel.java 2012-06-05 21:57:59 UTC (rev 1286) @@ -140,7 +140,7 @@ * Set the value of versionMinor */ public void setVersionMinor(int versionMinor) { - int oldVersionMinor = this.versionMinor; +// int oldVersionMinor = this.versionMinor; this.versionMinor = versionMinor; // FIXME firePropertyChange(RenderConstants.versionMinor, oldVersionMinor, this.versionMinor); } @@ -152,7 +152,7 @@ */ public boolean unsetVersionMinor() { if (isSetVersionMinor()) { - int oldVersionMinor = this.versionMinor; +// int oldVersionMinor = this.versionMinor; //FIXME firePropertyChange(RenderConstants.versionMinor, oldVersionMinor, this.versionMinor); return true; } @@ -178,7 +178,7 @@ * Set the value of versionMajor */ public void setVersionMajor(int versionMajor) { - int oldVersionMajor = this.versionMajor; +// int oldVersionMajor = this.versionMajor; this.versionMajor = versionMajor; //firePropertyChange(RenderConstants.versionMajor, oldVersionMajor, this.versionMajor); } @@ -190,7 +190,7 @@ */ public boolean unsetVersionMajor() { if (isSetVersionMajor()) { - int oldVersionMajor = this.versionMajor; +// int oldVersionMajor = this.versionMajor; //firePropertyChange(RenderConstants.versionMajor, oldVersionMajor, this.versionMajor); return true; } @@ -451,7 +451,6 @@ //@Override public boolean readAttribute(String attributeName, String prefix, String value) { - // TODO Auto-generated method stub return false; } @@ -460,7 +459,6 @@ */ //@Override public Map<String, String> writeXMLAttributes() { - // TODO Auto-generated method stub return null; } Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/GlobalRenderInformation.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/GlobalRenderInformation.java 2012-06-05 20:26:08 UTC (rev 1285) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/GlobalRenderInformation.java 2012-06-05 21:57:59 UTC (rev 1286) @@ -21,6 +21,7 @@ package org.sbml.jsbml.ext.render; import java.text.MessageFormat; +import java.util.Map; import org.sbml.jsbml.LevelVersionError; import org.sbml.jsbml.ListOf; @@ -254,4 +255,24 @@ +Math.min(pos, 0))); } + + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.render.RenderInformationBase#writeXMLAttributes() + */ + @Override + public Map<String, String> writeXMLAttributes() { + Map<String, String> attributes = super.writeXMLAttributes(); + return attributes; + } + + + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.render.RenderInformationBase#readAttribute(java.lang.String, java.lang.String, java.lang.String) + */ + @Override + public boolean readAttribute(String attributeName, String prefix, String value) { + boolean isAttributeRead = super.readAttribute(attributeName, prefix, value); + return isAttributeRead; + } + } Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/GradientBase.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/GradientBase.java 2012-06-05 20:26:08 UTC (rev 1285) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/GradientBase.java 2012-06-05 21:57:59 UTC (rev 1286) @@ -20,9 +20,11 @@ */ package org.sbml.jsbml.ext.render; +import java.awt.Color; import java.text.MessageFormat; +import java.util.Map; -import org.sbml.jsbml.AbstractSBase; +import org.sbml.jsbml.AbstractNamedSBase; import org.sbml.jsbml.LevelVersionError; import org.sbml.jsbml.ListOf; import org.sbml.jsbml.SBase; @@ -37,7 +39,7 @@ * @since 1.0 * @date 08.05.2012 */ -public class GradientBase extends AbstractSBase { +public class GradientBase extends AbstractNamedSBase { /** * @@ -60,7 +62,6 @@ REPEAT, } - protected String id; protected Spread spreadMethod; protected ListOf<GradientStop> listOfGradientStops; @@ -79,7 +80,6 @@ * @param id */ public GradientBase(String id, GradientStop stop) { - this.id = id; initDefaults(); this.listOfGradientStops.add(stop); } @@ -147,7 +147,6 @@ */ public GradientBase(GradientBase obj) { super(obj); - this.id = obj.id; this.spreadMethod = obj.spreadMethod; this.listOfGradientStops = obj.listOfGradientStops; } @@ -170,22 +169,6 @@ } /** - * @return the value of id - */ - public String getId(){ - return this.id; - } - - /** - * Set the value of id - */ - public void setId(String id){ - String oldId = this.id; - this.id = id; - firePropertyChange(RenderConstants.id, oldId, this.id); - } - - /** * @return the value of spreadMethod */ public Spread getSpreadMethod() { @@ -313,10 +296,51 @@ /** * create a new GradientStop element and adds it to the ListOfGradientStops list */ - public GradientStop createGradientStop(double offset, ColorDefinition stopColor) { + public GradientStop createGradientStop(double offset, Color stopColor) { GradientStop field = new GradientStop(offset, stopColor, getLevel(), getVersion()); addGradientStop(field); return field; } + /* (non-Javadoc) + * @see org.sbml.jsbml.NamedSBase#isIdMandatory() + */ + public boolean isIdMandatory() { + return true; + } + + + /* (non-Javadoc) + * @see org.sbml.jsbml.AbstractNamedSBase#writeXMLAttributes() + */ + @Override + public Map<String, String> writeXMLAttributes() { + Map<String, String> attributes = super.writeXMLAttributes(); + if (isSetSpreadMethod()) { + attributes.remove(RenderConstants.spreadMethod); + attributes.put(RenderConstants.shortLabel + ":" + RenderConstants.spreadMethod, + getSpreadMethod().toString().toLowerCase()); + } + return attributes; + } + + + /* (non-Javadoc) + * @see org.sbml.jsbml.AbstractNamedSBase#readAttribute(java.lang.String, java.lang.String, java.lang.String) + */ + @Override + public boolean readAttribute(String attributeName, String prefix, String value) { + boolean isAttributeRead = super.readAttribute(attributeName, prefix, value); + if (!isAttributeRead) { + isAttributeRead = true; + if (attributeName.equals(RenderConstants.spreadMethod)) { + setSpreadMethod(Spread.valueOf(value.toUpperCase())); + } + else { + isAttributeRead = false; + } + } + return isAttributeRead; + } + } Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/GradientStop.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/GradientStop.java 2012-06-05 20:26:08 UTC (rev 1285) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/GradientStop.java 2012-06-05 21:57:59 UTC (rev 1286) @@ -20,7 +20,9 @@ */ package org.sbml.jsbml.ext.render; +import java.awt.Color; import java.text.MessageFormat; +import java.util.Map; import org.sbml.jsbml.AbstractSBase; import org.sbml.jsbml.LevelVersionError; @@ -45,18 +47,16 @@ private Double offset; + private Color stopColor; - - private ColorDefinition stopColor; - /** * Creates a GradientStop instance with an offset and a color. * * @param offset * @param color */ - public GradientStop(Double offset, ColorDefinition stopColor) { + public GradientStop(Double offset, Color stopColor) { this.offset = offset; this.stopColor = stopColor; } @@ -69,7 +69,7 @@ * @param level * @param version */ - public GradientStop(Double offset, ColorDefinition stopColor, int level, int version) { + public GradientStop(Double offset, Color stopColor, int level, int version) { super(level, version); if (getLevelAndVersion().compareTo(Integer.valueOf(RenderConstants.MIN_SBML_LEVEL), Integer.valueOf(RenderConstants.MIN_SBML_VERSION)) < 0) { @@ -140,7 +140,7 @@ /** * @return the value of stopColor */ - public ColorDefinition getStopColor() { + public Color getStopColor() { if (isSetStopColor()) { return stopColor; } @@ -174,8 +174,8 @@ /** * Set the value of stopColor */ - public void setStopColor(ColorDefinition stopColor) { - ColorDefinition oldStopColor = this.stopColor; + public void setStopColor(Color stopColor) { + Color oldStopColor = this.stopColor; this.stopColor = stopColor; firePropertyChange(RenderConstants.stopColor, oldStopColor, this.stopColor); } @@ -202,7 +202,7 @@ */ public boolean unsetStopColor() { if (isSetStopColor()) { - ColorDefinition oldStopColor = this.stopColor; + Color oldStopColor = this.stopColor; this.stopColor = null; firePropertyChange(RenderConstants.stopColor, oldStopColor, this.stopColor); return true; @@ -218,5 +218,47 @@ // TODO Auto-generated method stub return null; } + + + /* (non-Javadoc) + * @see org.sbml.jsbml.AbstractSBase#writeXMLAttributes() + */ + @Override + public Map<String, String> writeXMLAttributes() { + Map<String, String> attributes = super.writeXMLAttributes(); + if (isSetOffset()) { + attributes.remove(RenderConstants.offset); + attributes.put(RenderConstants.shortLabel + ":" + RenderConstants.offset, + XMLTools.positioningToString(getOffset(), false)); + } + if (isSetStopColor()) { + attributes.remove(RenderConstants.stopColor); + attributes.put(RenderConstants.shortLabel + ":" + RenderConstants.stopColor, + XMLTools.decodeColorToString(getStopColor())); + } + return attributes; + } + + /* (non-Javadoc) + * @see org.sbml.jsbml.AbstractSBase#readAttribute(java.lang.String, java.lang.String, java.lang.String) + */ + @Override + public boolean readAttribute(String attributeName, String prefix, String value) { + boolean isAttributeRead = super.readAttribute(attributeName, prefix, value); + if (!isAttributeRead) { + isAttributeRead = true; + if (attributeName.equals(RenderConstants.offset)) { + setOffset(XMLTools.parsePosition(value)); + } + else if (attributeName.equals(RenderConstants.stopColor)) { + setStopColor(Color.decode(value)); + } + else { + isAttributeRead = false; + } + } + return isAttributeRead; + } + } Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/Image.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/Image.java 2012-06-05 20:26:08 UTC (rev 1285) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/Image.java 2012-06-05 21:57:59 UTC (rev 1286) @@ -21,6 +21,7 @@ package org.sbml.jsbml.ext.render; import java.text.MessageFormat; +import java.util.Map; import org.sbml.jsbml.PropertyUndefinedError; import org.sbml.jsbml.SBase; @@ -592,4 +593,83 @@ return false; } + + /* (non-Javadoc) + * @see org.sbml.jsbml.AbstractSBase#writeXMLAttributes() + */ + @Override + public Map<String, String> writeXMLAttributes() { + Map<String, String> attributes = super.writeXMLAttributes(); + if (isSetHref()) { + attributes.remove(RenderConstants.href); + attributes.put(RenderConstants.shortLabel + ":" + RenderConstants.href, + getHref()); + } + if (isSetX()) { + attributes.remove(RenderConstants.x); + attributes.put(RenderConstants.shortLabel + ":" + RenderConstants.x, + XMLTools.positioningToString(getX(), isAbsoluteX())); + } + if (isSetY()) { + attributes.remove(RenderConstants.y); + attributes.put(RenderConstants.shortLabel + ":" + RenderConstants.y, + XMLTools.positioningToString(getY(), isAbsoluteY())); + } + if (isSetZ()) { + attributes.remove(RenderConstants.z); + attributes.put(RenderConstants.shortLabel + ":" + RenderConstants.z, + XMLTools.positioningToString(getZ(), isAbsoluteZ())); + } + if (isSetWidth()) { + attributes.remove(RenderConstants.width); + attributes.put(RenderConstants.shortLabel + ":" + RenderConstants.width, + XMLTools.positioningToString(getWidth(), isAbsoluteWidth())); + } + if (isSetHeight()) { + attributes.remove(RenderConstants.height); + attributes.put(RenderConstants.shortLabel + ":" + RenderConstants.height, + XMLTools.positioningToString(getHeight(), isAbsoluteHeight())); + } + return attributes; + } + + + /* (non-Javadoc) + * @see org.sbml.jsbml.AbstractSBase#readAttribute(java.lang.String, java.lang.String, java.lang.String) + */ + @Override + public boolean readAttribute(String attributeName, String prefix, String value) { + boolean isAttributeRead = super.readAttribute(attributeName, prefix, value); + if (!isAttributeRead) { + isAttributeRead = true; + if (attributeName.equals(RenderConstants.href)) { + setHref(value); + } + else if (attributeName.equals(RenderConstants.x)) { + setX(XMLTools.parsePosition(value)); + setAbsoluteX(XMLTools.isAbsolutePosition(value)); + } + else if (attributeName.equals(RenderConstants.y)) { + setY(XMLTools.parsePosition(value)); + setAbsoluteY(XMLTools.isAbsolutePosition(value)); + } + else if (attributeName.equals(RenderConstants.z)) { + setZ(XMLTools.parsePosition(value)); + setAbsoluteZ(XMLTools.isAbsolutePosition(value)); + } + else if (attributeName.equals(RenderConstants.width)) { + setWidth(XMLTools.parsePosition(value)); + setAbsoluteWidth(XMLTools.isAbsolutePosition(value)); + } + else if (attributeName.equals(RenderConstants.height)) { + setHeight(XMLTools.parsePosition(value)); + setAbsoluteHeight(XMLTools.isAbsolutePosition(value)); + } + else { + isAttributeRead = false; + } + } + return isAttributeRead; + } + } Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/LinearGradient.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/LinearGradient.java 2012-06-05 20:26:08 UTC (rev 1285) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/LinearGradient.java 2012-06-05 21:57:59 UTC (rev 1286) @@ -21,6 +21,7 @@ package org.sbml.jsbml.ext.render; import java.text.MessageFormat; +import java.util.Map; import org.sbml.jsbml.PropertyUndefinedError; import org.sbml.jsbml.SBase; @@ -368,4 +369,77 @@ return false; } + + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.render.GradientBase#writeXMLAttributes() + */ + @Override + public Map<String, String> writeXMLAttributes() { + Map<String, String> attributes = super.writeXMLAttributes(); + if (isSetX1()) { + attributes.remove(RenderConstants.x1); + attributes.put(RenderConstants.shortLabel + ":" + RenderConstants.x1, + XMLTools.positioningToString(getX1(), false)); + } + if (isSetX2()) { + attributes.remove(RenderConstants.x2); + attributes.put(RenderConstants.shortLabel + ":" + RenderConstants.x2, + XMLTools.positioningToString(getX1(), false)); + } + if (isSetY1()) { + attributes.remove(RenderConstants.y1); + attributes.put(RenderConstants.shortLabel + ":" + RenderConstants.y1, + XMLTools.positioningToString(getX1(), false)); + } + if (isSetY2()) { + attributes.remove(RenderConstants.y2); + attributes.put(RenderConstants.shortLabel + ":" + RenderConstants.y2, + XMLTools.positioningToString(getX1(), false)); + } + if (isSetZ1()) { + attributes.remove(RenderConstants.z1); + attributes.put(RenderConstants.shortLabel + ":" + RenderConstants.z1, + XMLTools.positioningToString(getX1(), false)); + } + if (isSetZ2()) { + attributes.remove(RenderConstants.z2); + attributes.put(RenderConstants.shortLabel + ":" + RenderConstants.z2, + XMLTools.positioningToString(getX1(), false)); + } + return attributes; + } + + + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.render.GradientBase#readAttribute(java.lang.String, java.lang.String, java.lang.String) + */ + @Override + public boolean readAttribute(String attributeName, String prefix, String value) { + boolean isAttributeRead = super.readAttribute(attributeName, prefix, value); + if (!isAttributeRead) { + isAttributeRead = true; + if (attributeName.equals(RenderConstants.x1)) { + setX1(XMLTools.parsePosition(value)); + } + else if (attributeName.equals(RenderConstants.x2)) { + setX2(XMLTools.parsePosition(value)); + } + else if (attributeName.equals(RenderConstants.y1)) { + setY1(XMLTools.parsePosition(value)); + } + else if (attributeName.equals(RenderConstants.y2)) { + setY2(XMLTools.parsePosition(value)); + } + else if (attributeName.equals(RenderConstants.z1)) { + setZ1(XMLTools.parsePosition(value)); + } + else if (attributeName.equals(RenderConstants.z2)) { + setZ2(XMLTools.parsePosition(value)); + } + else { + isAttributeRead = false; + } + } + return isAttributeRead; + } } Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/LocalRenderInformation.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/LocalRenderInformation.java 2012-06-05 20:26:08 UTC (rev 1285) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/LocalRenderInformation.java 2012-06-05 21:57:59 UTC (rev 1286) @@ -21,6 +21,7 @@ package org.sbml.jsbml.ext.render; import java.text.MessageFormat; +import java.util.Map; import org.sbml.jsbml.LevelVersionError; import org.sbml.jsbml.ListOf; @@ -244,5 +245,25 @@ "Index {0,number,integer} >= {1,number,integer}", childIndex, +Math.min(pos, 0))); } + + + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.render.RenderInformationBase#writeXMLAttributes() + */ + @Override + public Map<String, String> writeXMLAttributes() { + Map<String, String> attributes = super.writeXMLAttributes(); + return attributes; + } + + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.render.RenderInformationBase#readAttribute(java.lang.String, java.lang.String, java.lang.String) + */ + @Override + public boolean readAttribute(String attributeName, String prefix, String value) { + boolean isAttributeRead = super.readAttribute(attributeName, prefix, value); + return isAttributeRead; + } + } Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/LocalStyle.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/LocalStyle.java 2012-06-05 20:26:08 UTC (rev 1285) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/LocalStyle.java 2012-06-05 21:57:59 UTC (rev 1286) @@ -20,8 +20,7 @@ */ package org.sbml.jsbml.ext.render; -import java.util.ArrayList; -import java.util.List; +import java.util.Map; import org.sbml.jsbml.PropertyUndefinedError; @@ -41,7 +40,7 @@ */ private static final long serialVersionUID = 4976081641247006722L; - private List<String> idList; + private String[] idList; /** * Creates a LocalStyle instance with a group @@ -50,7 +49,6 @@ */ public LocalStyle(Group group){ super(group); - this.idList = new ArrayList<String>(); } /** @@ -61,7 +59,6 @@ */ public LocalStyle(int level, int version, Group group) { super(null, level, version, group); - this.idList = new ArrayList<String>(); } /** @@ -74,15 +71,14 @@ */ public LocalStyle(String id, int level, int version, Group group){ super(id, level, version, group); - this.idList = new ArrayList<String>(); } - - + + /** * @return the value of idList */ - public List<String> getIdList() { - if (isSetIdList()) { + public String[] getIDList() { + if (isSetIDList()) { return idList; } // This is necessary if we cannot return null here. @@ -91,9 +87,9 @@ /** - * @return whether idList is set + * @return whether idList is set */ - public boolean isSetIdList() { + public boolean isSetIDList() { return this.idList != null; } @@ -101,26 +97,60 @@ /** * Set the value of idList */ - public void setIdList(List<String> idList) { - List<String> oldIdList = this.idList; + public void setIDList(String[] idList) { + String[] oldIDList = this.idList; this.idList = idList; - firePropertyChange(RenderConstants.idList, oldIdList, this.idList); + firePropertyChange(RenderConstants.idList, oldIDList, this.idList); } /** - * Unsets the variable idList - * @return <code>true</code>, if idList was set before, + * Unsets the variable idList + * @return <code>true</code>, if idList was set before, * otherwise <code>false</code> */ - public boolean unsetIdList() { - if (isSetIdList()) { - List<String> oldIdList = this.idList; + public boolean unsetIDList() { + if (isSetIDList()) { + String[] oldIDList = this.idList; this.idList = null; - firePropertyChange(RenderConstants.idList, oldIdList, this.idList); + firePropertyChange(RenderConstants.idList, oldIDList, this.idList); return true; } return false; } + + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.render.Style#writeXMLAttributes() + */ + @Override + public Map<String, String> writeXMLAttributes() { + Map<String, String> attributes = super.writeXMLAttributes(); + if (isSetIDList()) { + attributes.remove(RenderConstants.idList); + attributes.put(RenderConstants.shortLabel + ":" + RenderConstants.idList, + XMLTools.arrayToWhitespaceSeparatedString(getIDList())); + } + return attributes; + } + + + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.render.Style#readAttribute(java.lang.String, java.lang.String, java.lang.String) + */ + @Override + public boolean readAttribute(String attributeName, String prefix, String value) { + boolean isAttributeRead = super.readAttribute(attributeName, prefix, value); + if (!isAttributeRead) { + isAttributeRead = true; + if (attributeName.equals(RenderConstants.idList)) { + setIDList(value.split(" ")); + } + else { + isAttributeRead = false; + } + } + return isAttributeRead; + } + } Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/RadialGradient.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/RadialGradient.java 2012-06-05 20:26:08 UTC (rev 1285) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/RadialGradient.java 2012-06-05 21:57:59 UTC (rev 1286) @@ -20,6 +20,8 @@ */ package org.sbml.jsbml.ext.render; +import java.util.Map; + import org.sbml.jsbml.PropertyUndefinedError; @@ -691,5 +693,94 @@ } return false; } + + + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.render.GradientBase#writeXMLAttributes() + */ + @Override + public Map<String, String> writeXMLAttributes() { + Map<String, String> attributes = super.writeXMLAttributes(); + if (isSetR()) { + attributes.remove(RenderConstants.r); + attributes.put(RenderConstants.shortLabel + ":" + RenderConstants.r, + XMLTools.positioningToString(getR(), isAbsoluteR())); + } + if (isSetCx()) { + attributes.remove(RenderConstants.cx); + attributes.put(RenderConstants.shortLabel + ":" + RenderConstants.cx, + XMLTools.positioningToString(getCx(), isAbsoluteCx())); + } + if (isSetCy()) { + attributes.remove(RenderConstants.cy); + attributes.put(RenderConstants.shortLabel + ":" + RenderConstants.cy, + XMLTools.positioningToString(getCy(), isAbsoluteCy())); + } + if (isSetCz()) { + attributes.remove(RenderConstants.cz); + attributes.put(RenderConstants.shortLabel + ":" + RenderConstants.cz, + XMLTools.positioningToString(getCz(), isAbsoluteCz())); + } + if (isSetFx()) { + attributes.remove(RenderConstants.fx); + attributes.put(RenderConstants.shortLabel + ":" + RenderConstants.fx, + XMLTools.positioningToString(getFx(), isAbsoluteFx())); + } + if (isSetFy()) { + attributes.remove(RenderConstants.fy); + attributes.put(RenderConstants.shortLabel + ":" + RenderConstants.fy, + XMLTools.positioningToString(getFy(), isAbsoluteFy())); + } + if (isSetFz()) { + attributes.remove(RenderConstants.fz); + attributes.put(RenderConstants.shortLabel + ":" + RenderConstants.fz, + XMLTools.positioningToString(getFz(), isAbsoluteFz())); + } + return attributes; + } + + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.render.GradientBase#readAttribute(java.lang.String, java.lang.String, java.lang.String) + */ + @Override + public boolean readAttribute(String attributeName, String prefix, String value) { + boolean isAttributeRead = super.readAttribute(attributeName, prefix, value); + if (!isAttributeRead) { + isAttributeRead = true; + if (attributeName.equals(RenderConstants.r)) { + setR(XMLTools.parsePosition(value)); + setAbsoluteR(XMLTools.isAbsolutePosition(value)); + } + else if (attributeName.equals(RenderConstants.cx)) { + setCx(XMLTools.parsePosition(value)); + setAbsoluteCx(XMLTools.isAbsolutePosition(value)); + } + else if (attributeName.equals(RenderConstants.cy)) { + setCy(XMLTools.parsePosition(value)); + setAbsoluteCy(XMLTools.isAbsolutePosition(value)); + } + else if (attributeName.equals(RenderConstants.cz)) { + setCz(XMLTools.parsePosition(value)); + setAbsoluteCz(XMLTools.isAbsolutePosition(value)); + } + else if (attributeName.equals(RenderConstants.fx)) { + setFx(XMLTools.parsePosition(value)); + setAbsoluteFx(XMLTools.isAbsolutePosition(value)); + } + else if (attributeName.equals(RenderConstants.fy)) { + setFy(XMLTools.parsePosition(value)); + setAbsoluteFy(XMLTools.isAbsolutePosition(value)); + } + else if (attributeName.equals(RenderConstants.fz)) { + setFz(XMLTools.parsePosition(value)); + setAbsoluteFz(XMLTools.isAbsolutePosition(value)); + } + else { + isAttributeRead = false; + } + } + return isAttributeRead; + } + } Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderConstants.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderConstants.java 2012-06-05 20:26:08 UTC (rev 1285) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderConstants.java 2012-06-05 21:57:59 UTC (rev 1286) @@ -103,7 +103,7 @@ public static final String enableRotationMapping = "enable-rotation-mapping"; public static final String group = "g"; public static final String boundingBox = "bounding-box"; - public static final String transform = "trasform"; + public static final String transform = "transform"; public static final String versionMinor = "version-minor"; public static final String versionMajor = "version-major"; public static final String spreadMethod = "spreadMethod"; @@ -115,4 +115,5 @@ public static final String referenceRenderInformation = "referenceRenderInformation"; public static final String backgroundColor = "backgroundColor"; public static final String idList = "idList"; + public static final String renderInformation = "renderInformation"; } Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderCubicBezier.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderCubicBezier.java 2012-06-05 20:26:08 UTC (rev 1285) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderCubicBezier.java 2012-06-05 21:57:59 UTC (rev 1286) @@ -21,6 +21,7 @@ package org.sbml.jsbml.ext.render; import java.text.MessageFormat; +import java.util.Map; import org.sbml.jsbml.PropertyUndefinedError; import org.sbml.jsbml.SBase; @@ -625,4 +626,84 @@ return false; } + + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.render.RenderPoint#writeXMLAttributes() + */ + @Override + public Map<String, String> writeXMLAttributes() { + Map<String, String> attributes = super.writeXMLAttributes(); + if (isSetX1()) { + attributes.remove(RenderConstants.x1); + attributes.put(RenderConstants.shortLabel + ":" + RenderConstants.x1, + XMLTools.positioningToString(getX1(), isAbsoluteX1())); + } + if (isSetX2()) { + attributes.remove(RenderConstants.x2); + attributes.put(RenderConstants.shortLabel + ":" + RenderConstants.x2, + XMLTools.positioningToString(getX2(), isAbsoluteX2())); + } + if (isSetY1()) { + attributes.remove(RenderConstants.y1); + attributes.put(RenderConstants.shortLabel + ":" + RenderConstants.y1, + XMLTools.positioningToString(getY1(), isAbsoluteY1())); + } + if (isSetY2()) { + attributes.remove(RenderConstants.y2); + attributes.put(RenderConstants.shortLabel + ":" + RenderConstants.y2, + XMLTools.positioningToString(getY2(), isAbsoluteY2())); + } + if (isSetZ1()) { + attributes.remove(RenderConstants.z1); + attributes.put(RenderConstants.shortLabel + ":" + RenderConstants.z1, + XMLTools.positioningToString(getZ1(), isAbsoluteZ1())); + } + if (isSetZ2()) { + attributes.remove(RenderConstants.z2); + attributes.put(RenderConstants.shortLabel + ":" + RenderConstants.z2, + XMLTools.positioningToString(getZ2(), isAbsoluteZ2())); + } + return attributes; + } + + + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.render.RenderPoint#readAttribute(java.lang.String, java.lang.String, java.lang.String) + */ + @Override + public boolean readAttribute(String attributeName, String prefix, String value) { + boolean isAttributeRead = super.readAttribute(attributeName, prefix, value); + if (!isAttributeRead) { + isAttributeRead = true; + if (attributeName.equals(RenderConstants.x1)) { + setX1(XMLTools.parsePosition(value)); + setAbsoluteX1(XMLTools.isAbsolutePosition(value)); + } + else if (attributeName.equals(RenderConstants.x2)) { + setX2(XMLTools.parsePosition(value)); + setAbsoluteX2(XMLTools.isAbsolutePosition(value)); + } + else if (attributeName.equals(RenderConstants.y1)) { + setY1(XMLTools.parsePosition(value)); + setAbsoluteY1(XMLTools.isAbsolutePosition(value)); + } + else if (attributeName.equals(RenderConstants.y2)) { + setY2(XMLTools.parsePosition(value)); + setAbsoluteY2(XMLTools.isAbsolutePosition(value)); + } + else if (attributeName.equals(RenderConstants.z1)) { + setZ1(XMLTools.parsePosition(value)); + setAbsoluteZ1(XMLTools.isAbsolutePosition(value)); + } + else if (attributeName.equals(RenderConstants.z2)) { + setZ2(XMLTools.parsePosition(value)); + setAbsoluteZ2(XMLTools.isAbsolutePosition(value)); + } + else { + isAttributeRead = false; + } + } + return isAttributeRead; + } + } Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderInformationBase.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderInformationBase.java 2012-06-05 20:26:08 UTC (rev 1285) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderInformationBase.java 2012-06-05 21:57:59 UTC (rev 1286) @@ -22,6 +22,7 @@ import java.awt.Color; import java.text.MessageFormat; +import java.util.Map; import org.sbml.jsbml.AbstractNamedSBase; import org.sbml.jsbml.LevelVersionError; @@ -396,14 +397,6 @@ getListOfColorDefinitions().removeFirst(new NameFilter(id)); } - /** - * create a new ColorDefinition element and adds it to the ListOfColorDefinitions list - */ - public ColorDefinition createColorDefinition(String id, Color value) { - ColorDefinition field = new ColorDefinition(id, value, getLevel(), getVersion()); - addColorDefinition(field); - return field; - } /** * @return <code>true</code>, if listOfGradientDefintions contains at least one element, @@ -619,4 +612,62 @@ } getListOfLineEndings().remove(i); } + + + /* (non-Javadoc) + * @see org.sbml.jsbml.AbstractNamedSBase#writeXMLAttributes() + */ + @Override + public Map<String, String> writeXMLAttributes() { + Map<String, String> attributes = super.writeXMLAttributes(); + if (isSetProgramName()) { + attributes.remove(RenderConstants.programName); + attributes.put(RenderConstants.shortLabel + ":" + RenderConstants.programName, + getProgramName()); + } + if (isSetProgramVersion()) { + attributes.remove(RenderConstants.programVersion); + attributes.put(RenderConstants.shortLabel + ":" + RenderConstants.programVersion, + getProgramVersion()); + } + if (isSetReferenceRenderInformation()) { + attributes.remove(RenderConstants.referenceRenderInformation); + attributes.put(RenderConstants.shortLabel + ":" + RenderConstants.referenceRenderInformation, + getReferenceRenderInformation()); + } + if (isSetBackgroundColor()) { + attributes.remove(RenderConstants.backgroundColor); + attributes.put(RenderConstants.shortLabel + ":" + RenderConstants.backgroundColor, + XMLTools.decodeColorToString(getBackgroundColor())); + } + return attributes; + } + + + /* (non-Javadoc) + * @see org.sbml.jsbml.AbstractNamedSBase#readAttribute(java.lang.String, java.lang.String, java.lang.String) + */ + @Override + public boolean readAttribute(String attributeName, String prefix, String value) { + boolean isAttributeRead = super.readAttribute(attributeName, prefix, value); + if (!isAttributeRead) { + isAttributeRead = true; + if (attributeName.equals(RenderConstants.programName)) { + setProgramName(value); + } + else if (attributeName.equals(RenderConstants.programVersion)) { + setProgramVersion(value); + } + else if (attributeName.equals(RenderConstants.referenceRenderInformation)) { + setReferenceRenderInformation(value); + } + else if (attributeName.equals(RenderConstants.backgroundColor)) { + setBackgroundColor(Color.decode(value)); + } + else { + isAttributeRead = false; + } + } + return isAttributeRead; + } } Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderPoint.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderPoint.java 2012-06-05 20:26:08 UTC (rev 1285) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderPoint.java 2012-06-05 21:57:59 UTC (rev 1286) @@ -21,6 +21,7 @@ package org.sbml.jsbml.ext.render; import java.text.MessageFormat; +import java.util.Map; import org.sbml.jsbml.AbstractSBase; import org.sbml.jsbml.PropertyUndefinedError; @@ -386,5 +387,58 @@ } return false; } + + + /* (non-Javadoc) + * @see org.sbml.jsbml.AbstractSBase#writeXMLAttributes() + */ + @Override + public Map<String, String> writeXMLAttributes() { + Map<String, String> attributes = super.writeXMLAttributes(); + if (isSetX()) { + attributes.remove(RenderConstants.x); + attributes.put(RenderConstants.shortLabel + ":" + RenderConstants.x, + XMLTools.positioningToString(getX(), isAbsoluteX())); + } + if (isSetY()) { + attributes.remove(RenderConstants.y); + attributes.put(RenderConstants.shortLabel + ":" + RenderConstants.y, + XMLTools.positioningToString(getY(), isAbsoluteY())); + } + if (isSetZ()) { + attributes.remove(RenderConstants.z); + attributes.put(RenderConstants.shortLabel + ":" + RenderConstants.z, + XMLTools.positioningToString(getZ(), isAbsoluteZ())); + } + return attributes; + } + + /* (non-Javadoc) + * @see org.sbml.jsbml.AbstractSBase#readAttribute(java.lang.String, java.lang.String, java.lang.String) + */ + @Override + public boolean readAttribute(String attributeName, String prefix, String value) { + boolean isAttributeRead = super.readAttribute(attributeName, prefix, value); + if (!isAttributeRead) { + isAttributeRead = true; + if (attributeName.equals(RenderConstants.x)) { + setX(XMLTools.parsePosition(value)); + setAbsoluteX(XMLTools.isAbsolutePosition(value)); + } + else if (attributeName.equals(RenderConstants.y)) { + setY(XMLTools.parsePosition(value)); + setAbsoluteY(XMLTools.isAbsolutePosition(value)); + } + else if (attributeName.equals(RenderConstants.z)) { + setZ(XMLTools.parsePosition(value)); + setAbsoluteZ(XMLTools.isAbsolutePosition(value)); + } + else { + isAttributeRead = false; + } + } + return isAttributeRead; + } + } Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/Style.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/Style.java 2012-06-05 20:26:08 UTC (rev 1285) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/Style.java 2012-06-05 21:57:59 UTC (rev 1286) @@ -1,16 +1,15 @@ /* * $Id$ - * $URL$ - * + * $URL: + * https://jsbml.svn.sourceforge.net/svnroot/jsbml/trunk/extensions/render/ + * src/org/sbml/jsbml/ext/render/Style.java $ * ---------------------------------------------------------------------------- * This file is part of JSBML. Please visit <http://sbml.org/Software/JSBML> * for the latest version of JSBML and more information about SBML. - * * Copyright (C) 2009-2012 jointly by the following organizations: * 1. The University of Tuebingen, Germany * 2. EMBL European Bioinformatics Institute (EBML-EBI), Hinxton, UK * 3. The California Institute of Technology, Pasadena, CA, USA - * * This library is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation. A copy of the license agreement is provided @@ -21,7 +20,7 @@ package org.sbml.jsbml.ext.render; import java.text.MessageFormat; -import java.util.List; +import java.util.Map; import org.sbml.jsbml.AbstractNamedSBase; import org.sbml.jsbml.LevelVersionError; @@ -38,21 +37,19 @@ * @date 08.05.2012 */ public class Style extends AbstractNamedSBase { + /** * */ private static final long serialVersionUID = -4660813321564690910L; - - protected Group group; - protected String id; - protected List<String> roleList; - protected List<String> typeList; + protected String[] roleList; + protected String[] typeList; /** * Creates a Style instance with a group - * + * * @param group */ public Style(Group group) { @@ -61,9 +58,10 @@ initDefaults(); } + /** * Creates a Style instance with a level and version. - * + * * @param level * @param version */ @@ -71,50 +69,63 @@ this(null, level, version, group); } + /** * Creates a Style instance with an id, name, level, and version. - * + * * @param id * @param level * @param version * @param group */ public Style(String id, int level, int version, Group group) { - super(level, version); - if (getLevelAndVersion().compareTo(Integer.valueOf(RenderConstants.MIN_SBML_LEVEL), + super(id, level, version); + if (getLevelAndVersion().compareTo( + Integer.valueOf(RenderConstants.MIN_SBML_LEVEL), Integer.valueOf(RenderConstants.MIN_SBML_VERSION)) < 0) { throw new LevelVersionError(getElementName(), level, version); } - this.id = id; this.group = group; initDefaults(); } + /** * Clone constructor */ public Style(Style obj) { super(obj); - this.id = obj.id; this.roleList = obj.roleList; this.typeList = obj.typeList; this.group = obj.group; } - /* (non-Javadoc) + + /* + * (non-Javadoc) * @see org.sbml.jsbml.AbstractSBase#clone() */ - //@Override + // @Override @Override public Style clone() { return new Style(this); } + + /* + * (non-Javadoc) + * @see org.sbml.jsbml.AbstractSBase#getAllowsChildren() + */ @Override public boolean getAllowsChildren() { return false; } + + /* + * (non-Javadoc) + * @see org.sbml.jsbml.AbstractSBase#getChildAt(int) + */ @Override public SBase getChildAt(int childIndex) { if (childIndex < 0) { @@ -127,6 +138,10 @@ } + /* + * (non-Javadoc) + * @see org.sbml.jsbml.AbstractSBase#getChildCount() + */ @Override public int getChildCount() { int count = 0; @@ -147,18 +162,6 @@ /** - * @return the value of typeList - */ - public List<String> getTypeList() { - if (isSetTypeList()) { - return typeList; - } - // This is necessary if we cannot return null here. - throw new PropertyUndefinedError(RenderConstants.typeList, this); - } - - - /** * Initializes the default values using the namespace. */ public void initDefaults() { @@ -168,10 +171,11 @@ } - /** - * + /* + * (non-Javadoc) + * @see org.sbml.jsbml.NamedSBase#isIdMandatory() */ - //@Override + // @Override public boolean isIdMandatory() { return true; } @@ -186,14 +190,6 @@ /** - * @return whether typeList is set - */ - public boolean isSetTypeList() { - return this.typeList != null; - } - - - /** * Set the value of group */ public void setGroup(Group group) { @@ -203,17 +199,8 @@ } - /** - * Set the value of typeList - */ - public void setTypeList(List<String> typeList) { - List<String> oldTypeList = this.typeList; - this.typeList = typeList; - firePropertyChange(RenderConstants.typeList, oldTypeList, this.typeList); - } - - - /* (non-Javadoc) + /* + * (non-Javadoc) * @see org.sbml.jsbml.AbstractSBase#toString() */ @Override @@ -225,6 +212,7 @@ /** * Unsets the variable group + * * @return <code>true</code>, if group was set before, * otherwise <code>false</code> */ @@ -237,15 +225,76 @@ } return false; } + + + /** + * @return the value of roleList + */ + public String[] getRoleList() { + if (isSetRoleList()) { + return roleList; + } + // This is necessary if we cannot return null here. + throw new PropertyUndefinedError(RenderConstants.roleList, this); + } + /** - * Unsets the variable typeList - * @return <code>true</code>, if typeList was set before, + * @return whether roleList is set + */ + public boolean isSetRoleList() { + return this.roleList != null; + } + + + /** + * Set the value of roleList + */ + public void setRoleList(String[] roleList) { + String[] oldRoleList = this.roleList; + this.roleList = roleList; + firePropertyChange(RenderConstants.roleList, oldRoleList, this.roleList); + } + + + /** + * @return the value of typeList + */ + public String[] getTypeList() { + if (isSetTypeList()) { + return typeList; + } + // This is necessary if we cannot return null here. + throw new PropertyUndefinedError(RenderConstants.typeList, this); + } + + + /** + * @return whether typeList is set + */ + public boolean isSetTypeList() { + return this.typeList != null; + } + + + /** + * Set the value of typeList + */ + public void setTypeList(String[] typeList) { + String[] oldTypeList = this.typeList; + this.typeList = typeList; + firePropertyChange(RenderConstants.typeList, oldTypeList, this.typeList); + } + + + /** + * Unsets the variable typeList + * @return <code>true</code>, if typeList was set before, * otherwise <code>false</code> */ public boolean unsetTypeList() { if (isSetTypeList()) { - List<String> oldTypeList = this.typeList; + String[] oldTypeList = this.typeList; this.typeList = null; firePropertyChange(RenderConstants.typeList, oldTypeList, this.typeList); return true; @@ -253,4 +302,64 @@ return false; } + + /** + * Unsets the variable roleList + * @return <code>true</code>, if roleList was set before, + * otherwise <code>false</code> + */ + public boolean unsetRoleList() { + if (isSetRoleList()) { + String[] oldRoleList = this.roleList; + this.roleList = null; + firePropertyChange(RenderConstants.roleList, oldRoleList, this.roleList); + return true; + } + return false; + } + + + /* + * (non-Javadoc) + * @see org.sbml.jsbml.AbstractNamedSBase#writeXMLAttributes() + */ + @Override + public Map<String, String> writeXMLAttributes() { + Map<String, String> attributes = super.writeXMLAttributes(); + if (isSetRoleList()) { + attributes.remove(RenderConstants.roleList); + attributes.put(RenderConstants.shortLabel + ":" + RenderConstants.roleList, + XMLTools.arrayToWhitespaceSeparatedString(getRoleList())); + } + if (isSetTypeList()) { + attributes.remove(RenderConstants.typeList); + attributes.put(RenderConstants.shortLabel + ":" + RenderConstants.typeList, + XMLTools.arrayToWhitespaceSeparatedString(getTypeList())); + } + return attributes; + } + + + /* + * (non-Javadoc) + * @see org.sbml.jsbml.AbstractNamedSBase#readAttribute(java.lang.String, + * java.lang.String, java.lang.String) + */ + @Override + public boolean readAttribute(String attributeName, String prefix, String value) { + boolean isAttributeRead = super.readAttribute(attributeName, prefix, value); + if (!isAttributeRead) { + isAttributeRead = true; + if (attributeName.equals(RenderConstants.roleList)) { + setRoleList(value.split(":")); + } + else if (attributeName.equals(RenderConstants.typeList)) { + setTypeList(value.split(":")); + } + else { + isAttributeRead = false; + } + } + return isAttributeRead; + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dia...@us...> - 2012-06-05 20:26:14
|
Revision: 1285 http://jsbml.svn.sourceforge.net/jsbml/?rev=1285&view=rev Author: diamantikos Date: 2012-06-05 20:26:08 +0000 (Tue, 05 Jun 2012) Log Message: ----------- GraphicalPrimitive1D, Transformation 2D: Added Methods: - writeXMLAttributes - readAttribute XMLTools: Added Methods: - encode and decode for read/write Modified Paths: -------------- trunk/extensions/render/src/org/sbml/jsbml/ext/render/GraphicalPrimitive1D.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/Transformation2D.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/XMLTools.java Property Changed: ---------------- trunk/extensions/render/src/org/sbml/jsbml/ext/render/XMLTools.java Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/GraphicalPrimitive1D.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/GraphicalPrimitive1D.java 2012-06-04 18:19:35 UTC (rev 1284) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/GraphicalPrimitive1D.java 2012-06-05 20:26:08 UTC (rev 1285) @@ -21,9 +21,11 @@ package org.sbml.jsbml.ext.render; import java.text.MessageFormat; +import java.util.Map; import org.sbml.jsbml.PropertyUndefinedError; import org.sbml.jsbml.SBase; +import org.sbml.jsbml.util.StringTools; /** @@ -160,7 +162,7 @@ /** * @return the value of strokeWidth */ - public int getStrokeWidth() { + public Integer getStrokeWidth() { if (isSetStrokeWidth()) { return strokeWidth; } @@ -236,5 +238,54 @@ } return false; } - + + /* (non-Javadoc) + * @see org.sbml.jsbml.AbstractSBase#writeXMLAttributes() + */ + @Override + public Map<String, String> writeXMLAttributes() { + Map<String, String> attributes = super.writeXMLAttributes(); + if (isSetStroke()) { + attributes.remove(RenderConstants.stroke); + attributes.put(RenderConstants.shortLabel + ":" + RenderConstants.strokeWidth, + XMLTools.encodeColorDefintionToString(getStroke())); + } + if (isSetStrokeDashArray()){ + attributes.remove(RenderConstants.strokeDashArray); + attributes.put(RenderConstants.shortLabel + ":" + RenderConstants.strokeWidth, + XMLTools.encodeArrayShortToString(getStrokeDashArray())); + } + if (isSetStrokeWidth()){ + attributes.remove(RenderConstants.strokeWidth); + attributes.put(RenderConstants.shortLabel + ":" + RenderConstants.strokeWidth, + getStrokeWidth().toString().toLowerCase()); + } + return attributes; + } + + /* (non-Javadoc) + * @see org.sbml.jsbml.AbstractSBase#readAttribute(java.lang.String, java.lang.String, java.lang.String) + */ + @Override + public boolean readAttribute(String attributeName, String prefix, String value) { + boolean isAttributeRead = super.readAttribute(attributeName, prefix, value); + if (!isAttributeRead) { + isAttributeRead = true; + // TODO: catch Exception if Enum.valueOf fails, generate logger output + if (attributeName.equals(RenderConstants.stroke)) { + setStroke(XMLTools.decodeStringToColorDefintion(value)); + } + else if (attributeName.equals(RenderConstants.strokeDashArray)) { + setStrokeDashArray(XMLTools.decodeStringToArrayShort(value)); + } + else if (attributeName.equals(RenderConstants.strokeWidth)) { + setStrokeWidth(StringTools.parseSBMLInt(value)); + } + else { + isAttributeRead = false; + } + } + return isAttributeRead; + } + } Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/Transformation2D.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/Transformation2D.java 2012-06-04 18:19:35 UTC (rev 1284) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/Transformation2D.java 2012-06-05 20:26:08 UTC (rev 1285) @@ -20,6 +20,8 @@ */ package org.sbml.jsbml.ext.render; +import java.util.Map; + import org.sbml.jsbml.PropertyUndefinedError; @@ -114,5 +116,36 @@ } return false; } + + /* (non-Javadoc) + * @see org.sbml.jsbml.AbstractSBase#writeXMLAttributes() + */ + @Override + public Map<String, String> writeXMLAttributes() { + Map<String, String> attributes = super.writeXMLAttributes(); + if (isSetTransform()) { + + attributes.remove(RenderConstants.transform); + attributes.put(RenderConstants.shortLabel + ":" + RenderConstants.transform, + XMLTools.encodeArrayDoubleToString(transform)); + } + return attributes; + } + + /* (non-Javadoc) + * @see org.sbml.jsbml.AbstractSBase#readAttribute(java.lang.String, java.lang.String, java.lang.String) + */ + @Override + public boolean readAttribute(String attributeName, String prefix, String value) { + boolean isAttributeRead = super.readAttribute(attributeName, prefix, value); + if (!isAttributeRead) { + isAttributeRead = true; + // TODO: catch Exception if Enum.valueOf fails, generate logger output + if (attributeName.equals(RenderConstants.transform)) { + setTransform(XMLTools.decodeStringToArrayDouble(value, 6)); + } + } + return isAttributeRead; + } } Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/XMLTools.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/XMLTools.java 2012-06-04 18:19:35 UTC (rev 1284) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/XMLTools.java 2012-06-05 20:26:08 UTC (rev 1285) @@ -1,6 +1,6 @@ /* - * $Id: XMLTools.java 14:58:10 jakob $ - * $URL: XMLTools.java $ + * $Id$ + * $URL$ * * ---------------------------------------------------------------------------- * This file is part of JSBML. Please visit <http://sbml.org/Software/JSBML> @@ -21,6 +21,7 @@ package org.sbml.jsbml.ext.render; import java.awt.Color; +import java.util.ArrayList; import org.sbml.jsbml.util.StringTools; @@ -122,4 +123,107 @@ return ("#" + Integer.toHexString(r) + Integer.toHexString(g) + Integer.toHexString(b)).toUpperCase(); } + + + public static String encodeColorToString(Color value){ + int r = value.getRed(); + int g = value.getGreen(); + int b = value.getBlue(); + int a = value.getAlpha(); + return ("#" + Integer.toHexString(r) + Integer.toHexString(g) + + Integer.toHexString(b) + Integer.toHexString(a)).toUpperCase(); + } + + public static Color decodeStringToColor(String string){ + int r = Integer.parseInt(string.substring(1, 3), 16); + int g = Integer.parseInt(string.substring(3, 5), 16); + int b = Integer.parseInt(string.substring(5, 7), 16); + int a = 255; + if (string.length() == 9){ + a = Integer.parseInt(string.substring(7, 9), 16); + } + + return new Color(r,g,b,a); + } + + public static String encodeColorDefintionToString(ColorDefinition cd){ + return cd.getId() + "," + encodeColorToString(cd.getValue()); + } + + public static ColorDefinition decodeStringToColorDefintion(String value){ + String id = value.substring(0, value.indexOf(",")); + Color color = decodeStringToColor(value.substring(value.indexOf(",") + 1)); + return new ColorDefinition(id, color); + } + + public static String encodeArrayDoubleToString(Double[] array) { + + String s = ""; + + for (int i = 0; i < array.length; i++) { + if(!s.isEmpty()){ + s+=","; + } + s+= Double.toString(array[i]); + } + return s; + } + + public static Double[] decodeStringToArrayDouble(String value, int length) { + + Double[] array = new Double[length]; + String sub = ""; + + for (int i = 0; i < length; i++) { + int index = value.indexOf(","); + if(index == -1) { + sub = value.substring(0); + } + else{ + sub = value.substring(0, index); + value = value.substring(index+1); + } + + array[i] = StringTools.parseSBMLDouble(sub); + } + return array; + } + + + public static String encodeArrayShortToString(Short[] array) { + + String s = ""; + + for (int i = 0; i < array.length; i++) { + if(!s.isEmpty()){ + s+=","; + } + s+= Short.toString(array[i]); + } + return s; + } + + public static Short[] decodeStringToArrayShort(String value) { + + ArrayList<Short> list = new ArrayList<Short>(); + String sub = ""; + int index; + + while(!value.isEmpty()) { + index = value.indexOf(","); + if(index == -1) { + list.add(Short.valueOf(value.substring(0))); + return (Short[]) list.toArray(); + } + else{ + sub = value.substring(0, index); + value = value.substring(index+1); + } + + //array[i] = StringTools.parseSBMLShort(sub); + list.add(Short.valueOf(sub)); + } + return (Short[]) list.toArray(); + } + } Property changes on: trunk/extensions/render/src/org/sbml/jsbml/ext/render/XMLTools.java ___________________________________________________________________ Added: svn:keywords + Rev Id URL This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jak...@us...> - 2012-06-04 18:19:41
|
Revision: 1284 http://jsbml.svn.sourceforge.net/jsbml/?rev=1284&view=rev Author: jakobmatthes Date: 2012-06-04 18:19:35 +0000 (Mon, 04 Jun 2012) Log Message: ----------- render extension: all enum values in uppercase Modified Paths: -------------- trunk/extensions/render/src/org/sbml/jsbml/ext/render/FontFamily.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/GradientBase.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/GraphicalPrimitive2D.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/TextAnchor.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/VTextAnchor.java Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/FontFamily.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/FontFamily.java 2012-06-04 16:50:58 UTC (rev 1283) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/FontFamily.java 2012-06-04 18:19:35 UTC (rev 1284) @@ -31,13 +31,13 @@ /** * */ - serif, + SERIF, /** * */ - sans_serif, + SANS_SERIF, /** * */ - monospace; + MONOSPACE; } Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/GradientBase.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/GradientBase.java 2012-06-04 16:50:58 UTC (rev 1283) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/GradientBase.java 2012-06-04 18:19:35 UTC (rev 1284) @@ -55,9 +55,9 @@ * @date 08.05.2012 */ protected enum Spread { - pad, - reflect, - repeat, + PAD, + REFLECT, + REPEAT, } protected String id; @@ -164,8 +164,8 @@ * Initializes the default values using the namespace. */ public void initDefaults() { - //addNamespace(constant_class.namespaceURI); - this.spreadMethod = Spread.pad; + addNamespace(RenderConstants.namespaceURI); + this.spreadMethod = Spread.PAD; this.listOfGradientStops = new ListOf<GradientStop>(); } Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/GraphicalPrimitive2D.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/GraphicalPrimitive2D.java 2012-06-04 16:50:58 UTC (rev 1283) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/GraphicalPrimitive2D.java 2012-06-04 18:19:35 UTC (rev 1284) @@ -39,8 +39,8 @@ private static final long serialVersionUID = -5666416071124784541L; protected String fill; protected enum FillRule { - nonzero, - evenodd, + NONZERO, + EVENODD, } protected FillRule fillRule; Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/TextAnchor.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/TextAnchor.java 2012-06-04 16:50:58 UTC (rev 1283) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/TextAnchor.java 2012-06-04 18:19:35 UTC (rev 1284) @@ -34,13 +34,13 @@ /** * */ - start, + START, /** * */ - middle, + MIDDLE, /** * */ - end; + END; } Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/VTextAnchor.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/VTextAnchor.java 2012-06-04 16:50:58 UTC (rev 1283) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/VTextAnchor.java 2012-06-04 18:19:35 UTC (rev 1284) @@ -34,13 +34,13 @@ /** * */ - top, + TOP, /** * */ - middle, + MIDDLE, /** * */ - bottom; + BOTTOM; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jak...@us...> - 2012-06-04 16:51:04
|
Revision: 1283 http://jsbml.svn.sourceforge.net/jsbml/?rev=1283&view=rev Author: jakobmatthes Date: 2012-06-04 16:50:58 +0000 (Mon, 04 Jun 2012) Log Message: ----------- XMLTools: method to decode a Color to a hex representation. Modified Paths: -------------- trunk/extensions/render/src/org/sbml/jsbml/ext/render/XMLTools.java Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/XMLTools.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/XMLTools.java 2012-06-03 14:04:18 UTC (rev 1282) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/XMLTools.java 2012-06-04 16:50:58 UTC (rev 1283) @@ -20,6 +20,8 @@ */ package org.sbml.jsbml.ext.render; +import java.awt.Color; + import org.sbml.jsbml.util.StringTools; @@ -104,4 +106,20 @@ public static boolean parseFontWeightBold(String value) { return (value.equals(RenderConstants.fontWeightBoldTrue)); } + + /** + * @param value + * @return + */ + /** + * @param value + * @return + */ + public static String decodeColorToString(Color value) { + int r = value.getRed(); + int g = value.getGreen(); + int b = value.getBlue(); + return ("#" + Integer.toHexString(r) + + Integer.toHexString(g) + Integer.toHexString(b)).toUpperCase(); + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jak...@us...> - 2012-06-03 14:04:24
|
Revision: 1282 http://jsbml.svn.sourceforge.net/jsbml/?rev=1282&view=rev Author: jakobmatthes Date: 2012-06-03 14:04:18 +0000 (Sun, 03 Jun 2012) Log Message: ----------- render extension: firePropertyChange in AbstractRenderPlugin, implement writeXMLAttributes and readAttributes in Text, add XMLTools class with parsing methods. Modified Paths: -------------- trunk/extensions/render/src/org/sbml/jsbml/ext/render/AbstractRenderPlugin.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderConstants.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/Text.java Added Paths: ----------- trunk/extensions/render/src/org/sbml/jsbml/ext/render/XMLTools.java Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/AbstractRenderPlugin.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/AbstractRenderPlugin.java 2012-06-03 09:33:42 UTC (rev 1281) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/AbstractRenderPlugin.java 2012-06-03 14:04:18 UTC (rev 1282) @@ -142,7 +142,7 @@ public void setVersionMinor(Short versionMinor) { Short oldVersionMinor = this.versionMinor; this.versionMinor = versionMinor; - // TODO firePropertyChange(RenderConstants.versionMinor, oldVersionMinor, this.versionMinor); + firePropertyChange(RenderConstants.versionMinor, oldVersionMinor, this.versionMinor); } /** @@ -154,7 +154,7 @@ if (isSetVersionMinor()) { Short oldVersionMinor = this.versionMinor; this.versionMinor = null; - //FIXME firePropertyChange(RenderConstants.versionMinor, oldVersionMinor, this.versionMinor); + firePropertyChange(RenderConstants.versionMinor, oldVersionMinor, this.versionMinor); return true; } return false; Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderConstants.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderConstants.java 2012-06-03 09:33:42 UTC (rev 1281) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderConstants.java 2012-06-03 14:04:18 UTC (rev 1282) @@ -41,7 +41,11 @@ public static final String fontFamily = "font-family"; public static final String fontSize = "font-size"; public static final String fontWeightBold = "font-weight"; + public static final String fontWeightBoldTrue = "bold"; + public static final String fontWeightBoldFalse = "normal"; public static final String fontStyleItalic = "font-style"; + public static final String fontStyleItalicTrue = "italic"; + public static final String fontStyleItalicFalse = "normal"; public static final String textAnchor = "text-anchor"; public static final String vTextAnchor = "vtext-anchor"; public static final String x = "x"; @@ -100,8 +104,8 @@ public static final String group = "g"; public static final String boundingBox = "bounding-box"; public static final String transform = "trasform"; - public static final Object versionMinor = "version-minor"; - public static final Object versionMajor = "version-major"; + public static final String versionMinor = "version-minor"; + public static final String versionMajor = "version-major"; public static final String spreadMethod = "spreadMethod"; public static final String typeList = "typeList"; public static final String roleList = "roleList"; Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/Text.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/Text.java 2012-06-03 09:33:42 UTC (rev 1281) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/Text.java 2012-06-03 14:04:18 UTC (rev 1282) @@ -2,24 +2,26 @@ * $Id$ * $URL$ * - * ---------------------------------------------------------------------------- - * This file is part of JSBML. Please visit <http://sbml.org/Software/JSBML> - * for the latest version of JSBML and more information about SBML. - * - * Copyright (C) 2009-2012 jointly by the following organizations: - * 1. The University of Tuebingen, Germany - * 2. EMBL European Bioinformatics Institute (EBML-EBI), Hinxton, UK - * 3. The California Institute of Technology, Pasadena, CA, USA - * - * This library is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation. A copy of the license agreement is provided - * in the file named "LICENSE.txt" included with this software distribution - * and also available online as <http://sbml.org/Software/JSBML/License>. - * ---------------------------------------------------------------------------- - */ + * ---------------------------------------------------------------------------- + * This file is part of JSBML. Please visit <http://sbml.org/Software/JSBML> + * for the latest version of JSBML and more information about SBML. + * + * Copyright (C) 2009-2012 jointly by the following organizations: + * 1. The University of Tuebingen, Germany + * 2. EMBL European Bioinformatics Institute (EBML-EBI), Hinxton, UK + * 3. The California Institute of Technology, Pasadena, CA, USA + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation. A copy of the license agreement is provided + * in the file named "LICENSE.txt" included with this software distribution + * and also available online as <http://sbml.org/Software/JSBML/License>. + * ---------------------------------------------------------------------------- + */ package org.sbml.jsbml.ext.render; +import java.util.Map; + import org.sbml.jsbml.PropertyUndefinedError; @@ -34,7 +36,7 @@ */ public class Text extends GraphicalPrimitive1D implements FontRenderStyle, Point3D { /** - * + * */ private static final long serialVersionUID = -7468181076596795203L; private Boolean absoluteX, absoluteY, absoluteZ; @@ -228,7 +230,7 @@ public boolean isSetFontSize() { return this.fontSize != null; } - + /* (non-Javadoc) * @see org.sbml.jsbml.ext.render.FontRenderStyle#isSetFontStyleItalic() */ @@ -236,7 +238,7 @@ public boolean isSetFontStyleItalic() { return this.fontStyleItalic != null; } - + /* (non-Javadoc) * @see org.sbml.jsbml.ext.render.FontRenderStyle#isSetFontWeightBold() */ @@ -260,7 +262,7 @@ public boolean isSetVTextAnchor() { return this.vTextAnchor != null; } - + /* (non-Javadoc) * @see org.sbml.jsbml.ext.render.Point3D#isSetX() */ @@ -573,4 +575,106 @@ return false; } + + /* (non-Javadoc) + * @see org.sbml.jsbml.AbstractSBase#writeXMLAttributes() + */ + @Override + public Map<String, String> writeXMLAttributes() { + Map<String, String> attributes = super.writeXMLAttributes(); + if (isSetFontFamily()) { + attributes.remove(RenderConstants.fontFamily); + attributes.put(RenderConstants.shortLabel + ":" + RenderConstants.fontFamily, + getFontFamily().toString().toLowerCase()); + } + if (isSetTextAnchor()) { + attributes.remove(RenderConstants.textAnchor); + attributes.put(RenderConstants.shortLabel + ":" + RenderConstants.textAnchor, + getTextAnchor().toString().toLowerCase()); + } + if (isSetVTextAnchor()) { + attributes.remove(RenderConstants.vTextAnchor); + attributes.put(RenderConstants.shortLabel + ":" + RenderConstants.vTextAnchor, + getVTextAnchor().toString().toLowerCase()); + } + if (isSetFontSize()) { + attributes.remove(RenderConstants.fontSize); + attributes.put(RenderConstants.shortLabel + ":" + RenderConstants.fontSize, + Short.toString(getFontSize())); + } + if (isSetX()) { + attributes.remove(RenderConstants.x); + attributes.put(RenderConstants.shortLabel + ":" + RenderConstants.x, + XMLTools.positioningToString(getX(), isAbsoluteX())); + } + if (isSetY()) { + attributes.remove(RenderConstants.y); + attributes.put(RenderConstants.shortLabel + ":" + RenderConstants.y, + XMLTools.positioningToString(getY(), isAbsoluteY())); + } + if (isSetZ()) { + attributes.remove(RenderConstants.z); + attributes.put(RenderConstants.shortLabel + ":" + RenderConstants.z, + XMLTools.positioningToString(getZ(), isAbsoluteZ())); + } + if (isSetFontStyleItalic()) { + attributes.remove(RenderConstants.fontStyleItalic); + attributes.put(RenderConstants.fontStyleItalic, + XMLTools.fontStyleItalicToString(isFontStyleItalic())); + } + if (isSetFontWeightBold()) { + attributes.remove(RenderConstants.fontWeightBold); + attributes.put(RenderConstants.fontWeightBold, + XMLTools.fontWeightBoldToString(isFontWeightBold())); + } + return attributes; + } + + + /* (non-Javadoc) + * @see org.sbml.jsbml.AbstractSBase#readAttribute(java.lang.String, java.lang.String, java.lang.String) + */ + @Override + public boolean readAttribute(String attributeName, String prefix, String value) { + boolean isAttributeRead = super.readAttribute(attributeName, prefix, value); + if (!isAttributeRead) { + isAttributeRead = true; + // TODO: catch Exception if Enum.valueOf fails, generate logger output + if (attributeName.equals(RenderConstants.fontFamily)) { + setFontFamily(FontFamily.valueOf(value.toUpperCase())); + } + else if (attributeName.equals(RenderConstants.textAnchor)) { + setTextAnchor(TextAnchor.valueOf(value.toUpperCase())); + } + else if (attributeName.equals(RenderConstants.vTextAnchor)) { + setVTextAnchor(VTextAnchor.valueOf(value.toUpperCase())); + } + else if (attributeName.equals(RenderConstants.fontSize)) { + setFontSize(Short.valueOf(value)); + } + else if (attributeName.equals(RenderConstants.x)) { + setX(XMLTools.parsePosition(value)); + setAbsoluteX(XMLTools.isAbsolutePosition(value)); + } + else if (attributeName.equals(RenderConstants.y)) { + setY(XMLTools.parsePosition(value)); + setAbsoluteY(XMLTools.isAbsolutePosition(value)); + } + else if (attributeName.equals(RenderConstants.z)) { + setZ(XMLTools.parsePosition(value)); + setAbsoluteZ(XMLTools.isAbsolutePosition(value)); + } + else if (attributeName.equals(RenderConstants.fontStyleItalic)) { + setFontStyleItalic(XMLTools.parseFontStyleItalic(value)); + } + else if (attributeName.equals(RenderConstants.fontWeightBold)) { + setFontWeightBold(XMLTools.parseFontWeightBold(value)); + } + else { + isAttributeRead = false; + } + } + return isAttributeRead; + } + } Added: trunk/extensions/render/src/org/sbml/jsbml/ext/render/XMLTools.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/XMLTools.java (rev 0) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/XMLTools.java 2012-06-03 14:04:18 UTC (rev 1282) @@ -0,0 +1,107 @@ +/* + * $Id: XMLTools.java 14:58:10 jakob $ + * $URL: XMLTools.java $ + * + * ---------------------------------------------------------------------------- + * This file is part of JSBML. Please visit <http://sbml.org/Software/JSBML> + * for the latest version of JSBML and more information about SBML. + * + * Copyright (C) 2009-2011 jointly by the following organizations: + * 1. The University of Tuebingen, Germany + * 2. EMBL European Bioinformatics Institute (EBML-EBI), Hinxton, UK + * 3. The California Institute of Technology, Pasadena, CA, USA + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation. A copy of the license agreement is provided + * in the file named "LICENSE.txt" included with this software distribution + * and also available online as <http://sbml.org/Software/JSBML/License>. + * ---------------------------------------------------------------------------- + */ +package org.sbml.jsbml.ext.render; + +import org.sbml.jsbml.util.StringTools; + + +/** + * @author Eugen Netz + * @author Alexander Diamantikos + * @author Jakob Matthes + * @author Jan Rudolph + * @version $Rev$ + * @since 1.0 + * @date 03.06.2012 + */ +public class XMLTools { + + /** + * @param x + * @param absoluteX + * @return + */ + public static String positioningToString(double x, boolean absoluteX) { + if (absoluteX) { + return StringTools.toString(x); + } + else { + return StringTools.toString(x * 100d) + "%"; + } + } + + /** + * @param fontStyleItalic + * @return + */ + public static String fontStyleItalicToString(boolean fontStyleItalic) { + return (fontStyleItalic ? + RenderConstants.fontStyleItalicTrue : RenderConstants.fontStyleItalicFalse); + } + + /** + * @param fontWeightBold + * @return + */ + public static String fontWeightBoldToString(boolean fontWeightBold) { + return (fontWeightBold ? + RenderConstants.fontWeightBoldTrue : RenderConstants.fontWeightBoldFalse); + } + + /** + * @param value + * @return + */ + public static Boolean isAbsolutePosition(String value) { + return (! value.endsWith("%")); + } + + /** + * @param value + * @return + */ + public static Double parsePosition(String value) { + if (isAbsolutePosition(value)) { + return StringTools.parseSBMLDouble(value); + } + else { + return (StringTools.parseSBMLDouble(value.substring(0, value.length() - 1)) + / 100d); + } + } + + /** + * @param value + * @return + */ + public static boolean parseFontStyleItalic(String value) { + // TODO: throw Exception if value not in { "normal", "italic" }? + return (value.equals(RenderConstants.fontStyleItalicTrue)); + } + + /** + * @param value + * @return + */ + public static boolean parseFontWeightBold(String value) { + return (value.equals(RenderConstants.fontWeightBoldTrue)); + } +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <and...@us...> - 2012-06-03 09:33:48
|
Revision: 1281 http://jsbml.svn.sourceforge.net/jsbml/?rev=1281&view=rev Author: andreas-draeger Date: 2012-06-03 09:33:42 +0000 (Sun, 03 Jun 2012) Log Message: ----------- The new specialized EventObject TreeNodeRemovedEvent has been implemented in order to make sure that deleted nodes do no longer have a pointer to their previous parent within the tree. At the same time, it is still possible to identify their previous location using the field in the new EventObject. Modified Paths: -------------- branches/jsbml-0.8/NEWS.txt branches/jsbml-0.8/src/org/sbml/jsbml/AbstractTreeNode.java branches/jsbml-0.8/src/org/sbml/jsbml/util/SimpleTreeNodeChangeListener.java branches/jsbml-0.8/src/org/sbml/jsbml/util/TreeNodeChangeListener.java branches/jsbml-0.8/test/org/sbml/jsbml/test/ListenerTest.java Added Paths: ----------- branches/jsbml-0.8/src/org/sbml/jsbml/util/TreeNodeRemovedEvent.java Modified: branches/jsbml-0.8/NEWS.txt =================================================================== --- branches/jsbml-0.8/NEWS.txt 2012-06-03 09:33:15 UTC (rev 1280) +++ branches/jsbml-0.8/NEWS.txt 2012-06-03 09:33:42 UTC (rev 1281) @@ -4,6 +4,14 @@ Version 0.8.0 (15-05-2012) ====================================================================== +* New Features: + + - The new specialized EventObject TreeNodeRemovedEvent has been + implemented in order to make sure that deleted nodes do no longer + have a pointer to their previous parent within the tree. At the + same time, it is still possible to identify their previous + location using the field in the new EventObject. + * Bug Fixes: - There is now a rounding correction for multipliers when merging units Modified: branches/jsbml-0.8/src/org/sbml/jsbml/AbstractTreeNode.java =================================================================== --- branches/jsbml-0.8/src/org/sbml/jsbml/AbstractTreeNode.java 2012-06-03 09:33:15 UTC (rev 1280) +++ branches/jsbml-0.8/src/org/sbml/jsbml/AbstractTreeNode.java 2012-06-03 09:33:42 UTC (rev 1281) @@ -31,6 +31,7 @@ import org.sbml.jsbml.util.StringTools; import org.sbml.jsbml.util.TreeNodeChangeEvent; import org.sbml.jsbml.util.TreeNodeChangeListener; +import org.sbml.jsbml.util.TreeNodeRemovedEvent; import org.sbml.jsbml.util.TreeNodeWithChangeSupport; /** @@ -273,8 +274,10 @@ * @see org.sbml.jsbml.util.TreeNodeWithChangeSupport#fireNodeRemovedEvent() */ public void fireNodeRemovedEvent() { + TreeNode previousParent = getParent(); + parent = null; for (TreeNodeChangeListener listener : listOfListeners) { - listener.nodeRemoved(this); + listener.nodeRemoved(new TreeNodeRemovedEvent(this, previousParent)); } } Modified: branches/jsbml-0.8/src/org/sbml/jsbml/util/SimpleTreeNodeChangeListener.java =================================================================== --- branches/jsbml-0.8/src/org/sbml/jsbml/util/SimpleTreeNodeChangeListener.java 2012-06-03 09:33:15 UTC (rev 1280) +++ branches/jsbml-0.8/src/org/sbml/jsbml/util/SimpleTreeNodeChangeListener.java 2012-06-03 09:33:42 UTC (rev 1281) @@ -68,14 +68,14 @@ } } - /* - * (non-Javadoc) - * @see org.sbml.jsbml.util.TreeNodeChangeListener#nodeRemoved(javax.swing.tree.TreeNode) + /* (non-Javadoc) + * @see org.sbml.jsbml.util.TreeNodeChangeListener#nodeRemoved(org.sbml.jsbml.util.TreeNodeRemovedEvent) */ - public void nodeRemoved(TreeNode sb) { - if (logger.isDebugEnabled()) { - logger.debug(String.format("[DEL]\t%s", sb)); - } + //@Override + public void nodeRemoved(TreeNodeRemovedEvent evt) { + if (logger.isDebugEnabled()) { + logger.debug(String.format("[DEL]\t%s", evt.getSource())); + } } /* Modified: branches/jsbml-0.8/src/org/sbml/jsbml/util/TreeNodeChangeListener.java =================================================================== --- branches/jsbml-0.8/src/org/sbml/jsbml/util/TreeNodeChangeListener.java 2012-06-03 09:33:15 UTC (rev 1280) +++ branches/jsbml-0.8/src/org/sbml/jsbml/util/TreeNodeChangeListener.java 2012-06-03 09:33:42 UTC (rev 1281) @@ -37,8 +37,8 @@ public interface TreeNodeChangeListener extends PropertyChangeListener { /** - * The {@link T} passed to this method has just been added to the - * {@link SBMLDocument} or another containing element. + * The {@link TreeNode} passed to this method has just been added to the + * a containing element. * * @param node * This element is now part of the {@link SBMLDocument}. @@ -46,13 +46,16 @@ public void nodeAdded(TreeNode node); /** - * The {@link T} passed to this method has been removed from a + * The {@link TreeNodeRemovedEvent} passed to this method provides information + * about the node that has been removed from a * containing parent and does hence no longer belong to the - * {@link SBMLDocument} anymore. + * {@link SBMLDocument} anymore. In addition, a pointer to its previous parent + * is also provided. In this way, an implementing class + * can identify the location within the tree where it was before. * * @param node - * This element is not longer part of the {@link SBMLDocument}. + * This element is not longer part of the {@link SBMLDocument}. */ - public void nodeRemoved(TreeNode node); + public void nodeRemoved(TreeNodeRemovedEvent evt); } Added: branches/jsbml-0.8/src/org/sbml/jsbml/util/TreeNodeRemovedEvent.java =================================================================== --- branches/jsbml-0.8/src/org/sbml/jsbml/util/TreeNodeRemovedEvent.java (rev 0) +++ branches/jsbml-0.8/src/org/sbml/jsbml/util/TreeNodeRemovedEvent.java 2012-06-03 09:33:42 UTC (rev 1281) @@ -0,0 +1,134 @@ +/* + * $Id$ + * $URL$ + * + * ---------------------------------------------------------------------------- + * This file is part of JSBML. Please visit <http://sbml.org/Software/JSBML> + * for the latest version of JSBML and more information about SBML. + * + * Copyright (C) 2009-2011 jointly by the following organizations: + * 1. The University of Tuebingen, Germany + * 2. EMBL European Bioinformatics Institute (EBML-EBI), Hinxton, UK + * 3. The California Institute of Technology, Pasadena, CA, USA + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation. A copy of the license agreement is provided + * in the file named "LICENSE.txt" included with this software distribution + * and also available online as <http://sbml.org/Software/JSBML/License>. + * ---------------------------------------------------------------------------- + */ +package org.sbml.jsbml.util; + +import java.util.EventObject; + +import javax.swing.tree.TreeNode; + + +/** + * A special {@link EventObject} to notify a {@link TreeNodeChangeListener} + * about a removed node and its previous position within the tree. To this end, + * this {@link TreeNodeRemovedEvent} contains a pointer to both the actual + * removed node and its previous parent node. Note that when removing an element + * from the SBML tree, its pointer to its parent is set to {@code null}. + * To give an example why information about the previous parent is necessary: + * Imagine, an instance of {@code speciesReference} has been removed from + * the SBML tree. After removing it, the model does no longer point to an + * element with its id. Many {@code reaction}s + * might have been the origin of this removed node. If a + * {@link TreeNodeChangeListener} wants to, e.g., undo this change, + * it is necessary to identify the previous position of the node within the + * tree. That's why this class has two important + * methods, namely {@link #getSource()} and {@link #getPreviosParent()}. + * + * @author Andreas Dräger + * @version $Rev$ + * @since 0.8 + * @date 02.06.2012 + */ +public class TreeNodeRemovedEvent extends EventObject { + + /** + * Generated serial version identifier. + */ + private static final long serialVersionUID = 4860717212990689980L; + + /** + * The previous parent node in the tree, i.e., the node that was the parent of + * the deleted node (see {@link #getSource()}) before the deletion. + */ + private TreeNode previosParent; + + /** + * Creates a new {@link TreeNodeRemovedEvent} that contains information about + * an element that has just been removed from a tree together with its + * previous parent node. + * + * @param source + * the node that has just been removed from the tree. + * @param previousParent + * the node that was the parent node of the removed element, may be + * {@code null} if the node didn't have a parent. + */ + public TreeNodeRemovedEvent(TreeNode source, TreeNode previousParent) { + super(source); + this.previosParent = previousParent; + } + + /** + * Clone constructor. + * + * @param treeNodeRemovedEvent + */ + public TreeNodeRemovedEvent(TreeNodeRemovedEvent treeNodeRemovedEvent) { + this(treeNodeRemovedEvent.getSource(), treeNodeRemovedEvent.getPreviosParent()); + } + + /* (non-Javadoc) + * @see java.lang.Object#clone() + */ + @Override + protected Object clone() throws CloneNotSupportedException { + return new TreeNodeRemovedEvent(this); + } + + /** + * Access the pointer to the previous parent node of the removed node, may be + * {@code null}. + * + * @return the previosParent + * @see #getSource() + */ + public TreeNode getPreviosParent() { + return previosParent; + } + + /* (non-Javadoc) + * @see java.util.EventObject#getSource() + */ + @Override + public TreeNode getSource() { + return (TreeNode) super.getSource(); + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + StringBuilder builder = new StringBuilder(); + builder.append("TreeNodeRemovedEvent ["); + if (source != null) { + builder.append("source="); + builder.append(source); + } + if (previosParent != null) { + builder.append("previosParent="); + builder.append(previosParent); + builder.append(", "); + } + builder.append(']'); + return builder.toString(); + } + +} Property changes on: branches/jsbml-0.8/src/org/sbml/jsbml/util/TreeNodeRemovedEvent.java ___________________________________________________________________ Added: svn:keywords + Id URL Rev Modified: branches/jsbml-0.8/test/org/sbml/jsbml/test/ListenerTest.java =================================================================== --- branches/jsbml-0.8/test/org/sbml/jsbml/test/ListenerTest.java 2012-06-03 09:33:15 UTC (rev 1280) +++ branches/jsbml-0.8/test/org/sbml/jsbml/test/ListenerTest.java 2012-06-03 09:33:42 UTC (rev 1281) @@ -33,6 +33,7 @@ import org.sbml.jsbml.SBO; import org.sbml.jsbml.Species; import org.sbml.jsbml.util.TreeNodeChangeListener; +import org.sbml.jsbml.util.TreeNodeRemovedEvent; import org.sbml.jsbml.xml.stax.SBMLWriter; /** @@ -92,12 +93,11 @@ System.out.printf("Added:\t%s\n", node); } - /* - * (non-Javadoc) - * @see org.sbml.jsbml.util.TreeNodeChangeListener#nodeRemoved(javax.swing.tree.TreeNode) + /* (non-Javadoc) + * @see org.sbml.jsbml.util.TreeNodeChangeListener#nodeRemoved(org.sbml.jsbml.util.TreeNodeRemovedEvent) */ - public void nodeRemoved(TreeNode node) { - System.out.printf("Removed:\t%s\n", node); + public void nodeRemoved(TreeNodeRemovedEvent evt) { + System.out.printf("Removed:\t%s\n", evt.getSource()); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <and...@us...> - 2012-06-03 09:33:24
|
Revision: 1280 http://jsbml.svn.sourceforge.net/jsbml/?rev=1280&view=rev Author: andreas-draeger Date: 2012-06-03 09:33:15 +0000 (Sun, 03 Jun 2012) Log Message: ----------- The new specialized EventObject TreeNodeRemovedEvent has been implemented in order to make sure that deleted nodes do no longer have a pointer to their previous parent within the tree. At the same time, it is still possible to identify their previous location using the field in the new EventObject. SBasePlugin has now also become a TreeNodeWithChangeSupport and AbstractSBasePlugin in turn extends AbstractTreeNode. Modified Paths: -------------- trunk/core/NEWS.txt trunk/core/doc/img/FullTypeHierarchy.dot trunk/core/doc/img/FullTypeHierarchy.pdf trunk/core/doc/img/FullTypeHierarchy.png trunk/core/src/org/sbml/jsbml/AbstractTreeNode.java trunk/core/src/org/sbml/jsbml/ListOf.java trunk/core/src/org/sbml/jsbml/ext/AbstractSBasePlugin.java trunk/core/src/org/sbml/jsbml/ext/SBasePlugin.java trunk/core/src/org/sbml/jsbml/util/SimpleTreeNodeChangeListener.java trunk/core/src/org/sbml/jsbml/util/TreeNodeChangeListener.java trunk/core/test/org/sbml/jsbml/test/ListenerTest.java trunk/modules/celldesigner/src/org/sbml/jsbml/cdplugin/PluginChangeListener.java trunk/modules/compare/test/org/sbml/jsbml/test/ReactionReadTest.java trunk/modules/compare/test/org/sbml/jsbml/test/SBMLReaderTest.java trunk/modules/libSBMLio/src/org/sbml/jsbml/xml/libsbml/LibSBMLChangeListener.java Added Paths: ----------- trunk/core/src/org/sbml/jsbml/util/TreeNodeRemovedEvent.java Modified: trunk/core/NEWS.txt =================================================================== --- trunk/core/NEWS.txt 2012-06-01 15:30:31 UTC (rev 1279) +++ trunk/core/NEWS.txt 2012-06-03 09:33:15 UTC (rev 1280) @@ -6,6 +6,9 @@ * New Features: + - SBasePlugin has now also become a TreeNodeWithChangeSupport and + AbstractSBasePlugin in turn extends AbstractTreeNode. + - The Unit class has two new methods: removeOffset and removeMultiplier. The first one computes a new multiplier from the old offset, the old multiplier, and the scale and then sets @@ -169,6 +172,110 @@ map between ids and local parameters, instead of the remove method. ====================================================================== +Version 0.8.0 (15-05-2012) +====================================================================== + +* New Features: + + - The new specialized EventObject TreeNodeRemovedEvent has been + implemented in order to make sure that deleted nodes do no longer + have a pointer to their previous parent within the tree. At the + same time, it is still possible to identify their previous + location using the field in the new EventObject. + +* Bug Fixes: + + - There is now a rounding correction for multipliers when merging units + that tries to shift multipliers to the scale of a unit. This can only + be done if the logarithm to the base 10 of the multiplier is nearly + an integer number. Nearly means that the distance to the next integer + is not larger than the ensured double precision. + + - [Tracker item #3511439] : The cloning of a Species was not copying the + speciesType attribute. Thanks to Thomas Bernard who noticed and reported + the problem. + + - The units attribute on ASTNode was sometime not written out and the sbml + namespace was sometime missing from the mathML. It should be fine now. + +* Known issues : + + - Reading of more than one RDF Description elements in the RDF annotation + block (the official SBML annotation scheme) is not supported at the + moment. Planned for the next major release. + - The RDF block at the top level of the annotation is considered to be the + official SBML annotation. + - SBML L3 packages are not supported and not kept. + +====================================================================== +Version 0.8-rc2 (12-04-2012) +====================================================================== + +* User visible changes : + + - Major improvements of the reading and writing speed for large models. + +* Bug Fixes: + + - It was forgotten to implement an unsetSubstanceUnits method on the Model + class. Thanks to Robert Byrnes for reporting this problem. + + - In the Reaction class, the setReversible method only accepted Boolean, + no boolean. + + - Several bug fixes and improvements to units derivation, merging and + simplifying. + + - There was a bug in KineticLaw that prevented a correct iteration + through all child elements. + + - When cloning JSBML wrongly assigned the same TreeNodeChangeListeners + to the new data structure. Now, the TreeNodeChangeListeners are not + copied when cloning a JSBML object. + + - The clone methods were corrected to register properly all entities + with an id. + + - QuantityWithUnit did not fire update events when changing its value + because of an incorrect comparison between the previous and the new + value. + + - Corrected a bug that made it impossible to set a kinetic law with an + existing list of local parameters as the new kinetic law in a + different reaction. + + - Meike Aichele detected and fixed the problem that some Listeners were + set too soon in the Model class, so that no Event was detected. + + - One rdf namespace declaration was missing when creating an History + element from scratch. + + - [Tracker item #3511439] : Model.getSpeciesType(String) was + corrected and it's speed improved. Thanks to Thomas Bernard who noticed + and reported the problem. + + - Annotation elements that are missing a proper namespace declaration will + be correctly read and not considered as improper SBML elements. + + - [Tracker item #3487517] : If one empty rdf Bag element was present in an + annotation read by jsbml, an XML element was not closed properly, + resulting in an invalid generated SBML. Thanks to Anna Zhukova to report + this problem. + + - [Tracker item #3434930] : The parsing of a Message as an XML String was + incorrect as the method was expecting only a notes element to enclose + the HTML. + + * Known issues : + + - Reading of more than one RDF Description elements in the RDF annotation + block (the official SBML annotation scheme) is not supported at the + moment. Planned for the next major release. + - The RDF block at the top level of the annotation is considered to be the + official SBML annotation. + - SBML L3 packages are not supported and not kept. + +====================================================================== Version 0.8-rc1 (xx-xx-2011) ====================================================================== Modified: trunk/core/doc/img/FullTypeHierarchy.dot =================================================================== --- trunk/core/doc/img/FullTypeHierarchy.dot 2012-06-01 15:30:31 UTC (rev 1279) +++ trunk/core/doc/img/FullTypeHierarchy.dot 2012-06-03 09:33:15 UTC (rev 1280) @@ -160,6 +160,7 @@ AbstractMathContainer -> StoichiometryMath [dir=back,arrowtail=empty]; AbstractMathContainer -> Trigger [dir=back,arrowtail=empty]; AbstractTreeNode -> AbstractSBase [dir=back,arrowtail=empty]; + AbstractTreeNode -> AbstractSBasePlugin [dir=back,arrowtail=empty]; AbstractTreeNode -> AnnotationElement [dir=back,arrowtail=empty]; AbstractTreeNode -> ASTNode [dir=back,arrowtail=empty]; AbstractTreeNode -> TreeNodeAdapter [dir=back,arrowtail=empty]; @@ -174,7 +175,6 @@ CallableSBase -> Quantity [dir=back,arrowtail=empty,style=dashed]; CallableSBase -> FunctionDefinition [dir=back,arrowtail=empty,style=dashed]; CallableSBase -> Reaction [dir=back,arrowtail=empty,style=dashed]; - Cloneable -> SBasePlugin [dir=back,arrowtail=empty,style=dashed]; Cloneable -> TreeNodeWithChangeSupport [dir=back,arrowtail=empty,style=dashed]; ExplicitRule -> AssignmentRule [dir=back,arrowtail=empty]; ExplicitRule -> RateRule [dir=back,arrowtail=empty]; @@ -207,7 +207,6 @@ SBaseWithUnit -> KineticLaw [dir=back,arrowtail=empty,style=dashed]; SimpleSpeciesReference -> ModifierSpeciesReference [dir=back,arrowtail=empty]; SimpleSpeciesReference -> SpeciesReference [dir=back,arrowtail=empty]; - Serializable -> SBasePlugin [dir=back,arrowtail=empty,style=dashed]; Serializable -> TreeNodeWithChangeSupport [dir=back,arrowtail=empty,style=dashed]; Symbol -> Compartment [dir=back,arrowtail=empty]; Symbol -> Parameter [dir=back,arrowtail=empty]; @@ -216,6 +215,7 @@ TreeNodeChangeListener -> SimpleTreeNodeChangeListener [dir=back,arrowtail=empty,style=dashed]; TreeNodeWithChangeSupport -> AbstractTreeNode [dir=back,arrowtail=empty,style=dashed]; TreeNodeWithChangeSupport -> SBase [dir=back,arrowtail=empty,style=dashed]; + TreeNodeWithChangeSupport -> SBasePlugin [dir=back,arrowtail=empty,style=dashed]; UniqueNamedSBase -> CompartmentType [dir=back,arrowtail=empty,style=dashed]; UniqueNamedSBase -> Event [dir=back,arrowtail=empty,style=dashed]; UniqueNamedSBase -> FunctionDefinition [dir=back,arrowtail=empty,style=dashed]; Modified: trunk/core/doc/img/FullTypeHierarchy.pdf =================================================================== (Binary files differ) Modified: trunk/core/doc/img/FullTypeHierarchy.png =================================================================== (Binary files differ) Modified: trunk/core/src/org/sbml/jsbml/AbstractTreeNode.java =================================================================== --- trunk/core/src/org/sbml/jsbml/AbstractTreeNode.java 2012-06-01 15:30:31 UTC (rev 1279) +++ trunk/core/src/org/sbml/jsbml/AbstractTreeNode.java 2012-06-03 09:33:15 UTC (rev 1280) @@ -34,6 +34,7 @@ import org.sbml.jsbml.util.StringTools; import org.sbml.jsbml.util.TreeNodeChangeEvent; import org.sbml.jsbml.util.TreeNodeChangeListener; +import org.sbml.jsbml.util.TreeNodeRemovedEvent; import org.sbml.jsbml.util.TreeNodeWithChangeSupport; import org.sbml.jsbml.util.filters.Filter; @@ -47,47 +48,46 @@ */ public abstract class AbstractTreeNode implements TreeNodeWithChangeSupport { - /** - * Generated serial version identifier. - */ - private static final long serialVersionUID = 8629109724566600238L; - /** - * Searches the given child in the list of sub-nodes of the parent element. - * - * @param parent - * @param child - * @return the index of the child in the parent's list of childs or -1 if no - * such child can be found. - */ - @SuppressWarnings("unchecked") - public static int indexOf(TreeNode parent, TreeNode child) { - if (child == null) { - throw new IllegalArgumentException("Argument is null."); - } - // linear search - Enumeration<TreeNode> e = parent.children(); - for (int i = 0; e.hasMoreElements(); i++) { - TreeNode elem = e.nextElement(); - if ((child == elem) || child.equals(elem)) { - return i; - } - } - // not found => node is not a child. - return -1; - } - + * Generated serial version identifier. + */ + private static final long serialVersionUID = 8629109724566600238L; + /** - * {@link List} of listeners for this component - */ - protected List<TreeNodeChangeListener> listOfListeners; + * Searches the given child in the list of sub-nodes of the parent element. + * + * @param parent + * @param child + * @return the index of the child in the parent's list of children or -1 if no + * such child can be found. + */ + public static int indexOf(TreeNode parent, TreeNode child) { + if (child == null) { + throw new IllegalArgumentException("Argument is null."); + } + // linear search + Enumeration<TreeNode> e = parent.children(); + for (int i = 0; e.hasMoreElements(); i++) { + TreeNode elem = e.nextElement(); + if ((child == elem) || child.equals(elem)) { + return i; + } + } + // not found => node is not a child. + return -1; + } /** - * The parent element of this {@link Annotation}. - */ - protected TreeNode parent; + * {@link List} of listeners for this component + */ + protected List<TreeNodeChangeListener> listOfListeners; /** + * The parent element of this {@link Annotation}. + */ + protected TreeNode parent; + + /** * Any kind of {@link Object} that can be stored in addition to all other * features of this {@link AbstractTreeNode} in form of key-value pairs. * Note that things stored here will not be written to SBML files. This @@ -97,321 +97,339 @@ private Map<Object, Object> userObjects; /** - * Creates an empty {@link AbstractTreeNode} without child nodes and an - * empty list of {@link TreeNodeChangeListener}s. The pointer to the parent - * of this node is set to <code>null</code>. - */ - public AbstractTreeNode() { - super(); - this.listOfListeners = new LinkedList<TreeNodeChangeListener>(); - this.parent = null; - } - + * Creates an empty {@link AbstractTreeNode} without child nodes and an + * empty list of {@link TreeNodeChangeListener}s. The pointer to the parent + * of this node is set to <code>null</code>. + */ + public AbstractTreeNode() { + super(); + this.listOfListeners = new LinkedList<TreeNodeChangeListener>(); + this.parent = null; + } + /** - * Constructor for cloning. {@link AbstractTreeNode} has two properties: - * {@link #parent} and {@link #listOfListeners}. Both of them are not cloned - * by this method, for two reasons: - * <ul> - * <li>The {@link #parent} is not cloned and is left as <code>null</code> - * because the new {@link AbstractTreeNode} will get a parent set as soon as - * it is added/linked again to a {@link Model}. Note that only the top-level - * element of the cloned sub-tree will have a <code>null</code> value as its - * parent. All sub-element will point to their correct parent element.</li> - * <li>{@link #listOfListeners} is needed in all other setXX() methods. - * Cloning these might lead to strange and unexpected behavior, because when - * doing a deep cloning, the listeners of the old object would suddenly be - * informed about all value changes within this new object. Since we do - * cloning, all values of all child elements have to be touched, i.e., all - * listeners would be informed many times, but each time receive the identical - * value as it was before. Since it is totally unclear of which type listeners - * are, a deep cloning of these is not possible.</li> - * </ul> - * Therefore, it is necessary to keep in mind that the parent of the clone - * will be null and that you have to care by yourself if you are using - * {@link TreeNodeChangeListener}s. - * - * @param node - * The original {@link TreeNode} to be cloned. - */ - public AbstractTreeNode(TreeNode node) { - this(); - // the parent is not cloned and is left as null - // The Object will get a parent set as soon as it is added/linked - // again to a model somehow. - // this.parent = node.getParent(); + * Constructor for cloning. {@link AbstractTreeNode} has two properties: + * {@link #parent} and {@link #listOfListeners}. Both of them are not cloned + * by this method, for two reasons: + * <ul> + * <li>The {@link #parent} is not cloned and is left as <code>null</code> + * because the new {@link AbstractTreeNode} will get a parent set as soon as + * it is added/linked again to a {@link Model}. Note that only the top-level + * element of the cloned sub-tree will have a <code>null</code> value as its + * parent. All sub-element will point to their correct parent element.</li> + * <li>{@link #listOfListeners} is needed in all other setXX() methods. + * Cloning these might lead to strange and unexpected behavior, because when + * doing a deep cloning, the listeners of the old object would suddenly be + * informed about all value changes within this new object. Since we do + * cloning, all values of all child elements have to be touched, i.e., all + * listeners would be informed many times, but each time receive the identical + * value as it was before. Since it is totally unclear of which type listeners + * are, a deep cloning of these is not possible.</li> + * </ul> + * Therefore, it is necessary to keep in mind that the parent of the clone + * will be null and that you have to care by yourself if you are using + * {@link TreeNodeChangeListener}s. + * + * @param node + * The original {@link TreeNode} to be cloned. + */ + public AbstractTreeNode(TreeNode node) { + this(); + // the parent is not cloned and is left as null + // The Object will get a parent set as soon as it is added/linked + // again to a model somehow. + // this.parent = node.getParent(); - /* listOfListeners is needed in all other setXX() methods. - * Cloning these might lead to strange and unexpected behavior. - * This is actually not deep cloning anyway: - */ - if (node instanceof AbstractTreeNode) { - AbstractTreeNode anode = (AbstractTreeNode) node; - // Do not clone listeners! - // this.listOfListeners.addAll(anode.listOfListeners); - if (anode.isSetUserObjects()) { - this.userObjects = new HashMap<Object, Object>(); - this.userObjects.putAll(anode.userObjects); - } - } - } - - /* (non-Javadoc) - * @see org.sbml.jsbml.util.TreeNodeWithChangeSupport#addAllChangeListeners(java.util.Collection) - */ - public boolean addAllChangeListeners( - Collection<TreeNodeChangeListener> listeners) { - boolean success = listOfListeners.addAll(listeners); - Enumeration<TreeNode> children = children(); - while (children.hasMoreElements()) { - TreeNode node = children.nextElement(); - if (node instanceof TreeNodeWithChangeSupport) { - success &= ((TreeNodeWithChangeSupport) node) - .addAllChangeListeners(listeners); - } - } - return success; - } + /* listOfListeners is needed in all other setXX() methods. + * Cloning these might lead to strange and unexpected behavior. + * This is actually not deep cloning anyway: + */ + if (node instanceof AbstractTreeNode) { + AbstractTreeNode anode = (AbstractTreeNode) node; + // Do not clone listeners! + // this.listOfListeners.addAll(anode.listOfListeners); + if (anode.isSetUserObjects()) { + this.userObjects = new HashMap<Object, Object>(); + this.userObjects.putAll(anode.userObjects); + } + } + } - /* (non-Javadoc) - * @see org.sbml.jsbml.util.TreeNodeWithChangeSupport#addTreeNodeChangeListener(org.sbml.jsbml.util.TreeNodeChangeListener) - */ - public void addTreeNodeChangeListener(TreeNodeChangeListener listener) { - if (!listOfListeners.contains(listener)) { - listOfListeners.add(listener); - } - Enumeration<TreeNode> children = children(); - while (children.hasMoreElements()) { - TreeNode node = children.nextElement(); - if (node instanceof TreeNodeWithChangeSupport) { - ((TreeNodeWithChangeSupport) node).addTreeNodeChangeListener(listener); - } - } - } - - /* (non-Javadoc) - * @see javax.swing.tree.TreeNode#children() - */ - public Enumeration<TreeNode> children() { - return new Enumeration<TreeNode>() { - /** - * Total number of children in this enumeration. - */ - private int childCount = getChildCount(); - /** - * Current position in the list of children. - */ - private int index; + /* (non-Javadoc) + * @see org.sbml.jsbml.util.TreeNodeWithChangeSupport#addAllChangeListeners(java.util.Collection) + */ + //@Override + public boolean addAllChangeListeners( + Collection<TreeNodeChangeListener> listeners) { + boolean success = listOfListeners.addAll(listeners); + Enumeration<TreeNode> children = children(); + while (children.hasMoreElements()) { + TreeNode node = children.nextElement(); + if (node instanceof TreeNodeWithChangeSupport) { + success &= ((TreeNodeWithChangeSupport) node) + .addAllChangeListeners(listeners); + } + } + return success; + } - /* (non-Javadoc) - * @see java.util.Enumeration#hasMoreElements() - */ - public boolean hasMoreElements() { - return index < childCount; - } + /* (non-Javadoc) + * @see org.sbml.jsbml.util.TreeNodeWithChangeSupport#addTreeNodeChangeListener(org.sbml.jsbml.util.TreeNodeChangeListener) + */ + //@Override + public void addTreeNodeChangeListener(TreeNodeChangeListener listener) { + if (!listOfListeners.contains(listener)) { + listOfListeners.add(listener); + } + Enumeration<TreeNode> children = children(); + while (children.hasMoreElements()) { + TreeNode node = children.nextElement(); + if (node instanceof TreeNodeWithChangeSupport) { + ((TreeNodeWithChangeSupport) node).addTreeNodeChangeListener(listener); + } + } + } - /* (non-Javadoc) - * @see java.util.Enumeration#nextElement() - */ - public TreeNode nextElement() { - synchronized (this) { - if (index < childCount) { - return getChildAt(index++); - } - } - throw new NoSuchElementException("Enumeration"); - } - }; - } + /* (non-Javadoc) + * @see javax.swing.tree.TreeNode#children() + */ + //@Override + public Enumeration<TreeNode> children() { + return new Enumeration<TreeNode>() { + /** + * Total number of children in this enumeration. + */ + private int childCount = getChildCount(); + /** + * Current position in the list of children. + */ + private int index; - /* (non-Javadoc) - * @see org.sbml.jsbml.util.TreeNodeWithChangeSupport#clearUserObjects() - */ + /* (non-Javadoc) + * @see java.util.Enumeration#hasMoreElements() + */ + //@Override + public boolean hasMoreElements() { + return index < childCount; + } + + /* (non-Javadoc) + * @see java.util.Enumeration#nextElement() + */ + //@Override + public TreeNode nextElement() { + synchronized (this) { + if (index < childCount) { + return getChildAt(index++); + } + } + throw new NoSuchElementException("Enumeration"); + } + }; + } + + /* (non-Javadoc) + * @see org.sbml.jsbml.util.TreeNodeWithChangeSupport#clearUserObjects() + */ + //@Override public void clearUserObjects() { if (isSetUserObjects()) { userObjects.clear(); } } - /* (non-Javadoc) - * @see java.lang.Object#clone() - */ - @Override - public abstract TreeNode clone(); + /* (non-Javadoc) + * @see java.lang.Object#clone() + */ + @Override + public abstract TreeNode clone(); - /* (non-Javadoc) - * @see org.sbml.jsbml.util.TreeNodeWithChangeSupport#containsUserObjectKey(java.lang.Object) - */ + /* (non-Javadoc) + * @see org.sbml.jsbml.util.TreeNodeWithChangeSupport#containsUserObjectKey(java.lang.Object) + */ + //@Override public boolean containsUserObjectKey(Object key) { return userObjects.containsKey(key); } - /* (non-Javadoc) - * @see java.lang.Object#equals(java.lang.Object) - */ - @Override - public boolean equals(Object object) { - // Check if the given object is a pointer to precisely the same object: - if (super.equals(object)) { - return true; - } - // Check if the given object is of identical class and not null: - if ((object == null) || (!getClass().equals(object.getClass()))) { - return false; - } - // Check all child nodes recursively: - if (object instanceof TreeNode) { - TreeNode stn = (TreeNode) object; - int childCount = getChildCount(); - boolean equal = stn.isLeaf() == isLeaf(); - /* - * This is not good because cloned AbstractTreeNodes may not point - * to the same parent as the original and would hence not be equal - * to the cloned object. - */ - // equal &= ((stn.getParent() == null) && isRoot()) - // || (stn.getParent() == getParent()); - equal &= stn.getChildCount() == childCount; - if (equal && (childCount > 0)) { - for (int i = 0; i < childCount; i++) { - if (!stn.getChildAt(i).equals(getChildAt(i))) { - return false; - } - } - } - return equal; - } - return false; - } + /* (non-Javadoc) + * @see java.lang.Object#equals(java.lang.Object) + */ + @Override + public boolean equals(Object object) { + // Check if the given object is a pointer to precisely the same object: + if (super.equals(object)) { + return true; + } + // Check if the given object is of identical class and not null: + if ((object == null) || (!getClass().equals(object.getClass()))) { + return false; + } + // Check all child nodes recursively: + if (object instanceof TreeNode) { + TreeNode stn = (TreeNode) object; + int childCount = getChildCount(); + boolean equal = stn.isLeaf() == isLeaf(); + /* + * This is not good because cloned AbstractTreeNodes may not point + * to the same parent as the original and would hence not be equal + * to the cloned object. + */ + // equal &= ((stn.getParent() == null) && isRoot()) + // || (stn.getParent() == getParent()); + equal &= stn.getChildCount() == childCount; + if (equal && (childCount > 0)) { + for (int i = 0; i < childCount; i++) { + if (!stn.getChildAt(i).equals(getChildAt(i))) { + return false; + } + } + } + return equal; + } + return false; + } - /* (non-Javadoc) - * @see org.sbml.jsbml.util.TreeNodeWithChangeSupport#filter(org.sbml.jsbml.util.filters.Filter) - */ - public List<? extends TreeNode> filter(Filter filter) { - return filter(filter, false); - } + /* (non-Javadoc) + * @see org.sbml.jsbml.util.TreeNodeWithChangeSupport#filter(org.sbml.jsbml.util.filters.Filter) + */ + //@Override + public List<? extends TreeNode> filter(Filter filter) { + return filter(filter, false); + } - /* (non-Javadoc) - * @see org.sbml.jsbml.util.TreeNodeWithChangeSupport#filter(org.sbml.jsbml.util.filters.Filter, boolean) - */ - public List<TreeNode> filter(Filter filter, boolean retainInternalNodes) { - List<TreeNode> list = new LinkedList<TreeNode>(), childList; - TreeNode child; - boolean accepts = filter.accepts(this); - if (accepts) { - list.add(this); - } - for (int i = 0; i < getChildCount(); i++) { - child = getChildAt(i); - if (child instanceof TreeNodeWithChangeSupport) { - childList = ((TreeNodeWithChangeSupport) child).filter(filter, retainInternalNodes); - if (!accepts && retainInternalNodes && (childList.size() > 0)) { - list.add(this); - // prevent adding the current node more often than once: - accepts = true; - } - list.addAll(childList); - } - } - return list; - } + /* (non-Javadoc) + * @see org.sbml.jsbml.util.TreeNodeWithChangeSupport#filter(org.sbml.jsbml.util.filters.Filter, boolean) + */ + //@Override + public List<TreeNode> filter(Filter filter, boolean retainInternalNodes) { + List<TreeNode> list = new LinkedList<TreeNode>(), childList; + TreeNode child; + boolean accepts = filter.accepts(this); + if (accepts) { + list.add(this); + } + for (int i = 0; i < getChildCount(); i++) { + child = getChildAt(i); + if (child instanceof TreeNodeWithChangeSupport) { + childList = ((TreeNodeWithChangeSupport) child).filter(filter, retainInternalNodes); + if (!accepts && retainInternalNodes && (childList.size() > 0)) { + list.add(this); + // prevent adding the current node more often than once: + accepts = true; + } + list.addAll(childList); + } + } + return list; + } - /* (non-Javadoc) - * @see org.sbml.jsbml.util.TreeNodeWithChangeSupport#fireNodeAddedEvent() - */ - public void fireNodeAddedEvent() { - for (TreeNodeChangeListener listener : listOfListeners) { - listener.nodeAdded(this); - } - } + /* (non-Javadoc) + * @see org.sbml.jsbml.util.TreeNodeWithChangeSupport#fireNodeAddedEvent() + */ + //@Override + public void fireNodeAddedEvent() { + for (TreeNodeChangeListener listener : listOfListeners) { + listener.nodeAdded(this); + } + } - /* (non-Javadoc) - * @see org.sbml.jsbml.util.TreeNodeWithChangeSupport#fireNodeRemovedEvent() - */ - public void fireNodeRemovedEvent() { - for (TreeNodeChangeListener listener : listOfListeners) { - listener.nodeRemoved(this); - } - } + /* (non-Javadoc) + * @see org.sbml.jsbml.util.TreeNodeWithChangeSupport#fireNodeRemovedEvent() + */ + //@Override + public void fireNodeRemovedEvent() { + TreeNode previousParent = getParent(); + parent = null; + for (TreeNodeChangeListener listener : listOfListeners) { + listener.nodeRemoved(new TreeNodeRemovedEvent(this, previousParent)); + } + } - /* (non-Javadoc) - * @see org.sbml.jsbml.util.TreeNodeWithChangeSupport#firePropertyChange(java.lang.String, java.lang.Object, java.lang.Object) - */ - public void firePropertyChange(String propertyName, Object oldValue, - Object newValue) { - if (listOfListeners.size() > 0) { - short changeType = -1; // no property change at all - if ((oldValue == null) && (newValue != null)) { - changeType = 0; // element added - } else if ((oldValue != null) && (newValue == null)) { - changeType = 1; // element removed - } else if ((oldValue != null) && !oldValue.equals(newValue)) { - changeType = 2; // real property change - } - if (-1 < changeType) { - boolean newValTreeNode = newValue instanceof TreeNodeWithChangeSupport; - boolean oldValTreeNode = oldValue instanceof TreeNodeWithChangeSupport; - if ((changeType == 0) && newValTreeNode) { - ((TreeNodeWithChangeSupport) newValue).fireNodeAddedEvent(); - } else if ((changeType == 1) && oldValTreeNode) { - ((TreeNodeWithChangeSupport) oldValue).fireNodeRemovedEvent(); - } else { - // TODO: check if notifying and updating the metaId is necessary - // because of the method AbstractSBase.setThisAsParentSBMLObject - if (oldValTreeNode && newValTreeNode) { - notifyChildChange((TreeNode) oldValue, (TreeNode) newValue); - } - /* - * It is not necessary to add the metaId of the new value to - * the SBMLDocument because this is already done in the - * method setThisAsParentSBMLObject, a method that is called - * to link a new element to an existing SBML tree. - */ - // Now we can notify all listeners about the change: - TreeNodeChangeEvent changeEvent = new TreeNodeChangeEvent(this, - propertyName, oldValue, newValue); - for (TreeNodeChangeListener listener : listOfListeners) { - listener.propertyChange(changeEvent); - } - } - } - } - } - - /* (non-Javadoc) - * @see javax.swing.tree.TreeNode#getIndex(javax.swing.tree.TreeNode) - */ - public int getIndex(TreeNode node) { - return indexOf(this, node); - } - - /* (non-Javadoc) - * @see org.sbml.jsbml.util.TreeNodeWithChangeSupport#getListOfTreeNodeChangeListeners() - */ - public List<TreeNodeChangeListener> getListOfTreeNodeChangeListeners() { - return listOfListeners; - } + /* (non-Javadoc) + * @see org.sbml.jsbml.util.TreeNodeWithChangeSupport#firePropertyChange(java.lang.String, java.lang.Object, java.lang.Object) + */ + //@Override + public void firePropertyChange(String propertyName, Object oldValue, + Object newValue) { + if (listOfListeners.size() > 0) { + short changeType = -1; // no property change at all + if ((oldValue == null) && (newValue != null)) { + changeType = 0; // element added + } else if ((oldValue != null) && (newValue == null)) { + changeType = 1; // element removed + } else if ((oldValue != null) && !oldValue.equals(newValue)) { + changeType = 2; // real property change + } + if (-1 < changeType) { + boolean newValTreeNode = newValue instanceof TreeNodeWithChangeSupport; + boolean oldValTreeNode = oldValue instanceof TreeNodeWithChangeSupport; + if ((changeType == 0) && newValTreeNode) { + ((TreeNodeWithChangeSupport) newValue).fireNodeAddedEvent(); + } else if ((changeType == 1) && oldValTreeNode) { + ((TreeNodeWithChangeSupport) oldValue).fireNodeRemovedEvent(); + } else { + // TODO: check if notifying and updating the metaId is necessary + // because of the method AbstractSBase.setThisAsParentSBMLObject + if (oldValTreeNode && newValTreeNode) { + notifyChildChange((TreeNode) oldValue, (TreeNode) newValue); + } + /* + * It is not necessary to add the metaId of the new value to + * the SBMLDocument because this is already done in the + * method setThisAsParentSBMLObject, a method that is called + * to link a new element to an existing SBML tree. + */ + // Now we can notify all listeners about the change: + TreeNodeChangeEvent changeEvent = new TreeNodeChangeEvent(this, + propertyName, oldValue, newValue); + for (TreeNodeChangeListener listener : listOfListeners) { + listener.propertyChange(changeEvent); + } + } + } + } + } - /** - * Returns the number of child elements of this {@link TreeNode}. - * - * @return the number of children TreeNodes the receiver contains. - * @deprecated use {@link #getChildCount()} - */ - @Deprecated - public int getNumChildren() { - return getChildCount(); - } - - /* (non-Javadoc) - * @see javax.swing.tree.TreeNode#getParent() - */ - public TreeNode getParent() { - return parent; - } + /* (non-Javadoc) + * @see javax.swing.tree.TreeNode#getIndex(javax.swing.tree.TreeNode) + */ + //@Override + public int getIndex(TreeNode node) { + return indexOf(this, node); + } - /* (non-Javadoc) - * @see org.sbml.jsbml.util.TreeNodeWithChangeSupport#getUserObject(java.lang.Object) - */ + /* (non-Javadoc) + * @see org.sbml.jsbml.util.TreeNodeWithChangeSupport#getListOfTreeNodeChangeListeners() + */ + //@Override + public List<TreeNodeChangeListener> getListOfTreeNodeChangeListeners() { + return listOfListeners; + } + + /** + * Returns the number of child elements of this {@link TreeNode}. + * + * @return the number of children TreeNodes the receiver contains. + * @deprecated use {@link #getChildCount()} + */ + @Deprecated + public int getNumChildren() { + return getChildCount(); + } + + /* (non-Javadoc) + * @see javax.swing.tree.TreeNode#getParent() + */ + //@Override + public TreeNode getParent() { + return parent; + } + + /* (non-Javadoc) + * @see org.sbml.jsbml.util.TreeNodeWithChangeSupport#getUserObject(java.lang.Object) + */ + //@Override public Object getUserObject(Object key) { if (userObjects == null) { userObjects = new HashMap<Object, Object>(); @@ -419,90 +437,93 @@ return userObjects.get(key); } - /* (non-Javadoc) - * @see java.lang.Object#hashCode() - */ - @Override - public int hashCode() { - // A constant and arbitrary, sufficiently large prime number: - final int prime = 769; - /* - * This method is implemented as suggested in the JavaDoc API - * documentation of the List interface. - */ - - // Compute the initial hashCode based on the name of the actual class. - int hashCode = getClass().getName().hashCode(); - /* - * The following start wouldn't work because it will compute the - * hashCode from the address in memory of the object. - */ - // int hashCode = super.hashCode(); - - // Recursively compute the hashCode for each child node: - TreeNode child; - for (int i = 0; i < getChildCount(); i++) { - child = getChildAt(i); - hashCode = prime * hashCode + (child == null ? 0 : child.hashCode()); - } - - return hashCode; - } - - /* (non-Javadoc) - * @see javax.swing.tree.TreeNode#isLeaf() - */ - public boolean isLeaf() { - return getChildCount() == 0; - } - - /** - * Opposite of {@link #isSetParent()}. - * - * Returns <code>true</code> if this {@link AbstractTreeNode} is the root - * node of a tree, <code>false</code> otherwise. - * - * @return <code>True</code> if this {@link AbstractTreeNode} is the root - * node of a tree, <code>false</code> otherwise. - * - * @see #isSetParent() - */ - public boolean isRoot() { - return !isSetParent(); - } - - /** - * - * @return - */ - public boolean isSetParent() { - return parent != null; - } - - /* (non-Javadoc) - * @see org.sbml.jsbml.util.TreeNodeWithChangeSupport#isSetUserObjects() - */ + /* (non-Javadoc) + * @see java.lang.Object#hashCode() + */ + @Override + public int hashCode() { + // A constant and arbitrary, sufficiently large prime number: + final int prime = 769; + /* + * This method is implemented as suggested in the JavaDoc API + * documentation of the List interface. + */ + + // Compute the initial hashCode based on the name of the actual class. + int hashCode = getClass().getName().hashCode(); + /* + * The following start wouldn't work because it will compute the + * hashCode from the address in memory of the object. + */ + // int hashCode = super.hashCode(); + + // Recursively compute the hashCode for each child node: + TreeNode child; + for (int i = 0; i < getChildCount(); i++) { + child = getChildAt(i); + hashCode = prime * hashCode + (child == null ? 0 : child.hashCode()); + } + + return hashCode; + } + + /* (non-Javadoc) + * @see javax.swing.tree.TreeNode#isLeaf() + */ + //@Override + public boolean isLeaf() { + return getChildCount() == 0; + } + + /** + * Opposite of {@link #isSetParent()}. + * + * Returns <code>true</code> if this {@link AbstractTreeNode} is the root + * node of a tree, <code>false</code> otherwise. + * + * @return <code>True</code> if this {@link AbstractTreeNode} is the root + * node of a tree, <code>false</code> otherwise. + * + * @see #isSetParent() + */ + public boolean isRoot() { + return !isSetParent(); + } + + /** + * + * @return + */ + public boolean isSetParent() { + return parent != null; + } + + /* (non-Javadoc) + * @see org.sbml.jsbml.util.TreeNodeWithChangeSupport#isSetUserObjects() + */ + //@Override public boolean isSetUserObjects() { return (userObjects != null) && !userObjects.isEmpty(); } - - /** - * This method is called when one child has been swapped with another one - * and can be used to check certain properties of the resulting changed - * tree. - * - * @param oldChild - * the element that was a child of this node before the change. - * @param newChild - * the new child whose new parent is this node. - */ - protected void notifyChildChange(TreeNode oldChild, TreeNode newChild) { - // default: empty body, nothing to do. - } + /** + * This method is called when one child has been swapped with another one + * and can be used to check certain properties of the resulting changed + * tree. + * + * @param oldChild + * the element that was a child of this node before the change. + * @param newChild + * the new child whose new parent is this node. + */ + protected void notifyChildChange(TreeNode oldChild, TreeNode newChild) { + // default: empty body, nothing to do. + } + /* (non-Javadoc) - * @see org.sbml.jsbml.util.TreeNodeWithChangeSupport#putUserObject(java.lang.Object, java.lang.Object) - */ + * @see org.sbml.jsbml.util.TreeNodeWithChangeSupport#putUserObject(java.lang.Object, java.lang.Object) + */ + //@Override public void putUserObject(Object key, Object userObject) { if (userObjects == null) { userObjects = new HashMap<Object, Object>(); @@ -511,30 +532,33 @@ firePropertyChange(key.toString(), oldObject, userObject); } - /* (non-Javadoc) - * @see org.sbml.jsbml.util.TreeNodeWithChangeSupport#removeAllTreeNodeChangeListeners() - */ - public void removeAllTreeNodeChangeListeners() { - listOfListeners.clear(); - } - /* (non-Javadoc) - * @see org.sbml.jsbml.util.TreeNodeWithChangeSupport#removeTreeNodeChangeListener(org.sbml.jsbml.util.TreeNodeChangeListener) - */ - public void removeTreeNodeChangeListener(TreeNodeChangeListener l) { - listOfListeners.remove(l); - Enumeration<TreeNode> children = children(); - while (children.hasMoreElements()) { - TreeNode node = children.nextElement(); - if (node instanceof TreeNodeWithChangeSupport) { - ((TreeNodeWithChangeSupport) node).removeTreeNodeChangeListener(l); - } - } - } - - /* (non-Javadoc) + * @see org.sbml.jsbml.util.TreeNodeWithChangeSupport#removeAllTreeNodeChangeListeners() + */ + //@Override + public void removeAllTreeNodeChangeListeners() { + listOfListeners.clear(); + } + + /* (non-Javadoc) + * @see org.sbml.jsbml.util.TreeNodeWithChangeSupport#removeTreeNodeChangeListener(org.sbml.jsbml.util.TreeNodeChangeListener) + */ + //@Override + public void removeTreeNodeChangeListener(TreeNodeChangeListener l) { + listOfListeners.remove(l); + Enumeration<TreeNode> children = children(); + while (children.hasMoreElements()) { + TreeNode node = children.nextElement(); + if (node instanceof TreeNodeWithChangeSupport) { + ((TreeNodeWithChangeSupport) node).removeTreeNodeChangeListener(l); + } + } + } + + /* (non-Javadoc) * @see org.sbml.jsbml.util.TreeNodeWithChangeSupport#removeUserObject(java.lang.Object) */ + //@Override public Object removeUserObject(Object key) { if (userObjects != null) { return userObjects.remove(key); @@ -543,26 +567,27 @@ } /** - * @param parent - * the parent to set - */ - protected void setParent(TreeNode parent) { - TreeNode oldValue = this.parent; - this.parent = parent; - this.firePropertyChange(TreeNodeChangeEvent.parentSBMLObject, oldValue, this.parent); - } + * @param parent + * the parent to set + */ + protected void setParent(TreeNode parent) { + TreeNode oldValue = this.parent; + this.parent = parent; + this.firePropertyChange(TreeNodeChangeEvent.parentSBMLObject, oldValue, this.parent); + } /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return StringTools.firstLetterLowerCase(getClass().getSimpleName()); - } + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return StringTools.firstLetterLowerCase(getClass().getSimpleName()); + } - /* (non-Javadoc) + /* (non-Javadoc) * @see org.sbml.jsbml.util.TreeNodeWithChangeSupport#userObjectKeySet() */ + //@Override public Set<Object> userObjectKeySet() { return userObjects.keySet(); } Modified: trunk/core/src/org/sbml/jsbml/ListOf.java =================================================================== --- trunk/core/src/org/sbml/jsbml/ListOf.java 2012-06-01 15:30:31 UTC (rev 1279) +++ trunk/core/src/org/sbml/jsbml/ListOf.java 2012-06-03 09:33:15 UTC (rev 1280) @@ -50,7 +50,7 @@ * listXXX is a SBML package extension, the SBaseListType value to set would * be 'other'. * - * @author marine + * @author Marine Dumousseau * */ public static enum Type { Modified: trunk/core/src/org/sbml/jsbml/ext/AbstractSBasePlugin.java =================================================================== --- trunk/core/src/org/sbml/jsbml/ext/AbstractSBasePlugin.java 2012-06-01 15:30:31 UTC (rev 1279) +++ trunk/core/src/org/sbml/jsbml/ext/AbstractSBasePlugin.java 2012-06-03 09:33:15 UTC (rev 1280) @@ -20,11 +20,7 @@ */ package org.sbml.jsbml.ext; -import java.util.Enumeration; -import java.util.NoSuchElementException; - -import javax.swing.tree.TreeNode; - +import org.sbml.jsbml.AbstractTreeNode; import org.sbml.jsbml.SBase; @@ -35,7 +31,7 @@ * @since 1.0 * @date 28.10.2011 */ -public abstract class AbstractSBasePlugin implements SBasePlugin { +public abstract class AbstractSBasePlugin extends AbstractTreeNode implements SBasePlugin { /** * Generated serial version identifier. @@ -63,150 +59,58 @@ this.extendedSBase = extendedSBase; } - /** - * Returns the SBase object that is extended by this plug-in. - * - * @return the SBase object that is extended by this plug-in. + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.SBasePlugin#getExtendedSBase() */ + //@Override public SBase getExtendedSBase() { return extendedSBase; } - - /* - * (non-Javadoc) - * @see org.sbml.jsbml.ext.SBasePlugin#children() - */ - public Enumeration<TreeNode> children() { - return new Enumeration<TreeNode>() { - /** - * Total number of children in this enumeration. - */ - private int childCount = getChildCount(); - /** - * Current position in the list of children. - */ - private int index; - /* - * (non-Javadoc) - * - * @see java.util.Enumeration#hasMoreElements() - */ - public boolean hasMoreElements() { - return index < childCount; - } - - /* - * (non-Javadoc) - * - * @see java.util.Enumeration#nextElement() - */ - public TreeNode nextElement() { - synchronized (this) { - if (index < childCount) { - return getChildAt(index++); - } - } - throw new NoSuchElementException("Enumeration"); - } - }; - } - - /* - * (non-Javadoc) + /* (non-Javadoc) * @see java.lang.Object#clone() */ @Override - public abstract SBasePlugin clone(); + public abstract AbstractSBasePlugin clone(); - /* - * (non-Javadoc) + /* (non-Javadoc) * @see java.lang.Object#equals(java.lang.Object) */ @Override public boolean equals(Object object) { - // Check if the given object is a pointer to precisely the same object: - if (super.equals(object)) { - return true; - } - // Check if the given object is of identical class and not null: - if ((object == null) || (!getClass().equals(object.getClass()))) { - return false; - } + boolean equal = super.equals(object); + // Check all child nodes recursively: - if (object instanceof SBase) { - SBase stn = (SBase) object; - int childCount = getChildCount(); - boolean equal = stn.isLeaf() == isLeaf(); - /* - * This is not good because cloned SBase may not point - * to the same parent as the original and would hence not be equal - * to the cloned object. - */ - // equal &= ((stn.getParent() == null) && isRoot()) - // || (stn.getParent() == getParent()); - equal &= stn.getChildCount() == childCount; - if (equal && (childCount > 0)) { - for (int i = 0; i < childCount; i++) { - if (!stn.getChildAt(i).equals(getChildAt(i))) { - return false; - } - } + if (equal && (object instanceof SBasePlugin)) { + SBasePlugin stn = (SBasePlugin) object; + equal &= stn.isSetExtendedSBase() == isSetExtendedSBase(); + if (equal && isSetExtendedSBase()) { + equal &= stn.getExtendedSBase().equals(getExtendedSBase()); } - return equal; } - return false; + return equal; } - - /* - * (non-Javadoc) - * @see org.sbml.jsbml.ext.SBasePlugin#getIndex(org.sbml.jsbml.SBase) + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.SBasePlugin#isSetExtendedSBase() */ - public int getIndex(SBase node) { - // TODO Auto-generated method stub - return 0; + //@Override + public boolean isSetExtendedSBase() { + return extendedSBase != null; } - /* - * (non-Javadoc) + /* (non-Javadoc) * @see java.lang.Object#hashCode() */ @Override public int hashCode() { // A constant and arbitrary, sufficiently large prime number: final int prime = 769; - /* - * This method is implemented as suggested in the JavaDoc API - * documentation of the List interface. - */ - - // Compute the initial hashCode based on the name of the actual class. - int hashCode = getClass().getName().hashCode(); - /* - * The following start wouldn't work because it will compute the - * hashCode from the address in memory of the object. - */ - // int hashCode = super.hashCode(); - - // Recursively compute the hashCode for each child node: - TreeNode child; - for (int i = 0; i < getChildCount(); i++) { - child = getChildAt(i); - hashCode = prime * hashCode + (child == null ? 0 : child.hashCode()); + int hashCode = super.hashCode(); + if (isSetExtendedSBase()) { + hashCode += prime * getExtendedSBase().hashCode(); } - return hashCode; } - - /* - * (non-Javadoc) - * @see org.sbml.jsbml.ext.SBasePlugin#isLeaf() - */ - public boolean isLeaf() { - return getChildCount() == 0; - } - - } Modified: trunk/core/src/org/sbml/jsbml/ext/SBasePlugin.java =================================================================== --- trunk/core/src/org/sbml/jsbml/ext/SBasePlugin.java 2012-06-01 15:30:31 UTC (rev 1279) +++ trunk/core/src/org/sbml/jsbml/ext/SBasePlugin.java 2012-06-03 09:33:15 UTC (rev 1280) @@ -20,13 +20,10 @@ */ package org.sbml.jsbml.ext; -import java.io.Serializable; -import java.util.Enumeration; import java.util.Map; -import javax.swing.tree.TreeNode; - import org.sbml.jsbml.SBase; +import org.sbml.jsbml.util.TreeNodeWithChangeSupport; /** * Defines the methods necessary for an SBase Plugin. When a SBML level 3 is extending @@ -38,9 +35,42 @@ * @version $Rev$ * @since 1.0 */ -public interface SBasePlugin extends Cloneable, Serializable { +public interface SBasePlugin extends TreeNodeWithChangeSupport { /** + * + * @return + */ + public SBasePlugin clone(); + + /** + * + * @param obj + * @return + */ + public boolean equals(Object obj); + + /** + * Returns the SBase object that is extended by this plug-in. + * + * @return the SBase object that is extended by this plug-in. + */ + public SBase getExtendedSBase(); + + /** + * + * @return + */ + public int hashCode(); + + /** + * Check whether an extended SBase has been set. + * + * @return + */ + public boolean isSetExtendedSBase(); + + /** * Reads and sets the attribute if it is know from this {@link SBasePlugin}. * * @param attributeName @@ -51,53 +81,13 @@ * : value of the XML attribute * @return true if the attribute has been successfully read. */ - public boolean readAttribute(String attributeName, String prefix, - String value); + public boolean readAttribute(String attributeName, String prefix, String value); /** - * Returns the child <code>TreeNode</code> at index - * <code>childIndex</code>. - */ - public TreeNode getChildAt(int childIndex); - - /** - * Returns the number of children <code>TreeNode</code>s the receiver - * contains. - */ - public int getChildCount(); - - /** - * Returns the index of <code>node</code> in the receivers children. - * If the receiver does not contain <code>node</code>, -1 will be - * returned. - */ - public int getIndex(SBase node); - - /** - * Returns true if the receiver allows children. - */ - public boolean getAllowsChildren(); - - /** - * Returns true if the receiver is a leaf. - */ - public boolean isLeaf(); - - /** - * Returns the children of the receiver as an <code>Enumeration</code>. - */ - public Enumeration<TreeNode> children(); - - /** * Returns a {@link Map} containing the XML attributes of this object. * * @return a {@link Map} containing the XML attributes of this object. */ public Map<String, String> writeXMLAttributes(); - - public boolean equals(Object obj); - - public int hashCode(); - - public SBasePlugin clone(); + } Modified: trunk/core/src/org/sbml/jsbml/util/SimpleTreeNodeChangeListener.java =================================================================== --- trunk/core/src/org/sbml/jsbml/util/SimpleTreeNodeChangeListener.java 2012-06-01 15:30:31 UTC (rev 1279) +++ trunk/core/src/org/sbml/jsbml/util/SimpleTreeNodeChangeListener.java 2012-06-03 09:33:15 UTC (rev 1280) @@ -21,6 +21,7 @@ package org.sbml.jsbml.util; import java.beans.PropertyChangeEvent; +import java.text.MessageFormat; import javax.swing.tree.TreeNode; @@ -38,7 +39,7 @@ public class SimpleTreeNodeChangeListener implements TreeNodeChangeListener { /** - * + * A {@link Logger} for this class. */ private Logger logger; @@ -58,34 +59,34 @@ return logger; } - /* - * (non-Javadoc) + /* (non-Javadoc) * @see org.sbml.jsbml.util.TreeNodeChangeListener#nodeAdded(javax.swing.tree.TreeNode) */ + //@Override public void nodeAdded(TreeNode sb) { - if (logger.isDebugEnabled()) { - logger.debug(String.format("[ADD]\t%s", sb)); - } + if (logger.isDebugEnabled()) { + logger.debug(MessageFormat.format("[ADD]\t{0}", sb)); + } } - /* - * (non-Javadoc) - * @see org.sbml.jsbml.util.TreeNodeChangeListener#nodeRemoved(javax.swing.tree.TreeNode) + /* (non-Javadoc) + * @see org.sbml.jsbml.util.TreeNodeChangeListener#nodeRemoved(org.sbml.jsbml.util.TreeNodeRemovedEvent) */ - public void nodeRemoved(TreeNode sb) { - if (logger.isDebugEnabled()) { - logger.debug(String.format("[DEL]\t%s", sb)); - } + //@Override + public void nodeRemoved(TreeNodeRemovedEvent evt) { + if (logger.isDebugEnabled()) { + logger.debug(MessageFormat.format("[DEL]\t{0}", evt.getSource())); + } } - /* - * (non-Javadoc) + /* (non-Javadoc) * @see java.beans.PropertyChangeListener#propertyChange(java.beans.PropertyChangeEvent) */ + //@Override public void propertyChange(PropertyChangeEvent ev) { - if (logger.isDebugEnabled()) { - logger.debug(String.format("[CHG]\t%s", ev)); - } + if (logger.isDebugEnabled()) { + logger.debug(MessageFormat.format("[CHG]\t{0}", ev)); + } } } Modified: trunk/core/src/org/sbml/jsbml/util/TreeNodeChangeListener.java =================================================================== --- trunk/core/src/org/sbml/jsbml/util/TreeNodeChangeListener.java 2012-06-01 15:30:31 UTC (rev 1279) +++ trunk/core/src/org/sbml/jsbml/util/TreeNodeChangeListener.java 2012-06-03 09:33:15 UTC (rev 1280) @@ -24,8 +24,6 @@ import javax.swing.tree.TreeNode; -import org.sbml.jsbml.SBMLDocument; - /** * A listener interface that allows applications to get notified if the state of * any {@link TreeNode} object changes. @@ -36,23 +34,26 @@ */ public interface TreeNodeChangeListener extends PropertyChangeListener { - /** - * The {@link T} passed to this method has just been added to the - * {@link SBMLDocument} or another containing element. - * - * @param node - * This element is now part of the {@link SBMLDocument}. - */ - public void nodeAdded(TreeNode node); + /** + * The {@link TreeNode} passed to this method has just been added to the + * a containing element. + * + * @param node + * This element is now part of the {@link SBMLDocument}. + */ + public void nodeAdded(TreeNode node); - /** - * The {@link T} passed to this method has been removed from a - * containing parent and does hence no longer belong to the - * {@link SBMLDocument} anymore. - * - * @param node - * This element is not longer part of the {@link SBMLDocument}. - */ - public void nodeRemoved(TreeNode node); + /** + * The {@link TreeNodeRemovedEvent} passed to this method provides information + * about the node that has been removed from a + * containing parent and does hence no longer belong to the + * {@link SBMLDocument} anymore. In addition, a pointer to its previous parent + * is also provided. In this way, an implementing class + * can identify the location within the tree where it was before. + * + * @param node + * This element is not longer part of the {@link SBMLDocument}. + */ + public void nodeRemoved(TreeNodeRemovedEvent evt); } Added: trunk/core/src/org/sbml/jsbml/util/TreeNodeRemovedEvent.java =================================================================== --- trunk/core/src/org/sbml/jsbml/util/TreeNodeRemovedEvent.java (rev 0) +++ trunk/core/src/org/sbml/jsbml/util/TreeNodeRemovedEvent.java 2012-06-03 09:33:15 UTC (rev 1280) @@ -0,0 +1,134 @@ +/* + * $Id$ + * $URL$ + * + * ---------------------------------------------------------------------------- + * This file is part of JSBML. Please visit <http://sbml.org/Software/JSBML> + * for the latest version of JSBML and more information about SBML. + * + * Copyright (C) 2009-2011 jointly by the following organizations: + * 1. The University of Tuebingen, Germany + * 2. EMBL European Bioinformatics Institute (EBML-EBI), Hinxton, UK + * 3. The California Institute of Technology, Pasadena, CA, USA + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation. A copy of the license agreement is provided + * in the file named "LICENSE.txt" included with this software distribution + * and also available online as <http://sbml.org/Software/JSBML/License>. + * ---------------------------------------------------------------------------- + */ +package org.sbml.jsbml.util; + +import java.util.EventObject; + +import javax.swing.tree.TreeNode; + + +/** + * A special {@link EventObject} to notify a {@link TreeNodeChangeListener} + * about a removed node and its previous position within the tree. To this end, + * this {@link TreeNodeRemovedEvent} contains a pointer to both the actual + * removed node and its previous parent node. Note that when removing an element + * from the SBML tree, its pointer to its parent is set to {@code null}. + * To give an example why information about the previous parent is necessary: + * Imagine, an instance of {@code speciesReference} has been removed from + * the SBML tree. After removing it, the model does no longer point to an + * element with its id. Many {@code reaction}s + * might have been the origin of this removed node. If a + * {@link TreeNodeChangeListener} wants to, e.g., undo this change, + * it is necessary to identify the previous position of the node within the + * tree. That's why this class has two important + * methods, namely {@link #getSource()} and {@link #getPreviosParent()}. + * + * @author Andreas Dräger + * @version $Rev$ + * @since 0.8 + * @date 02.06.2012 + */ +public class TreeNodeRemovedEvent extends EventObject { + + /** + * Generated serial version identifier. + */ + private static final long serialVersionUID = 4860717212990689980L; + + /** + * The previous parent node in the tree, i.e., the node that was the parent of + * the deleted node (see {@link #getSource()}) before the deletion. + */ + private TreeNode previosParent; + + /** + * Creates a new {@link TreeNodeRemovedEvent} that contains information about + * an element that has just been removed from a tree together with its + * previous parent node. + * + * @param source + * the node that has just been removed from the tree. + * @param previousParent + * the node that was the parent node of the removed element, may be + * {@code null} if the node didn't have a parent. + */ + public TreeNodeRemovedEvent(TreeNode source, TreeNode previousParent) { + super(source); + this.previosParent = previousParent; + } + + /** + * Clone constructor. + * ... [truncated message content] |
From: <jak...@us...> - 2012-06-01 15:30:40
|
Revision: 1279 http://jsbml.svn.sourceforge.net/jsbml/?rev=1279&view=rev Author: jakobmatthes Date: 2012-06-01 15:30:31 +0000 (Fri, 01 Jun 2012) Log Message: ----------- fix TODOs, implement necessary methods Modified Paths: -------------- trunk/extensions/render/src/org/sbml/jsbml/ext/render/AbstractRenderPlugin.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/ExtendedRenderModel.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/GlobalRenderInformation.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/LocalRenderInformation.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/LocalStyle.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderConstants.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderInformationBase.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderLayoutPlugin.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderModelPlugin.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderPoint.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/Style.java Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/AbstractRenderPlugin.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/AbstractRenderPlugin.java 2012-06-01 10:58:30 UTC (rev 1278) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/AbstractRenderPlugin.java 2012-06-01 15:30:31 UTC (rev 1279) @@ -2,22 +2,22 @@ * $Id$ * $URL$ * - * ---------------------------------------------------------------------------- - * This file is part of JSBML. Please visit <http://sbml.org/Software/JSBML> - * for the latest version of JSBML and more information about SBML. - * - * Copyright (C) 2009-2012 jointly by the following organizations: - * 1. The University of Tuebingen, Germany - * 2. EMBL European Bioinformatics Institute (EBML-EBI), Hinxton, UK - * 3. The California Institute of Technology, Pasadena, CA, USA - * - * This library is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation. A copy of the license agreement is provided - * in the file named "LICENSE.txt" included with this software distribution - * and also available online as <http://sbml.org/Software/JSBML/License>. - * ---------------------------------------------------------------------------- - */ + * ---------------------------------------------------------------------------- + * This file is part of JSBML. Please visit <http://sbml.org/Software/JSBML> + * for the latest version of JSBML and more information about SBML. + * + * Copyright (C) 2009-2012 jointly by the following organizations: + * 1. The University of Tuebingen, Germany + * 2. EMBL European Bioinformatics Institute (EBML-EBI), Hinxton, UK + * 3. The California Institute of Technology, Pasadena, CA, USA + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation. A copy of the license agreement is provided + * in the file named "LICENSE.txt" included with this software distribution + * and also available online as <http://sbml.org/Software/JSBML/License>. + * ---------------------------------------------------------------------------- + */ package org.sbml.jsbml.ext.render; import java.util.Map; @@ -36,7 +36,7 @@ */ public class AbstractRenderPlugin extends AbstractSBasePlugin { /** - * + * */ private static final long serialVersionUID = -4225426173177528441L; private Short versionMajor; @@ -44,7 +44,7 @@ private GlobalRenderInformation renderInformation; /** - * Creates an AbstractRenderPlugin instance + * Creates an AbstractRenderPlugin instance */ public AbstractRenderPlugin() { super(); @@ -52,8 +52,8 @@ } /** - * Creates a AbstractRenderPlugin instance with a level and version. - * + * Creates a AbstractRenderPlugin instance with a level and version. + * * @param level * @param version */ @@ -62,8 +62,8 @@ } /** - * Creates a AbstractRenderPlugin instance with an id, level, and version. - * + * Creates a AbstractRenderPlugin instance with an id, level, and version. + * * @param id * @param level * @param version @@ -73,8 +73,8 @@ } /** - * Creates a AbstractRenderPlugin instance with an id, name, level, and version. - * + * Creates a AbstractRenderPlugin instance with an id, name, level, and version. + * * @param id * @param name * @param level @@ -96,14 +96,16 @@ public AbstractRenderPlugin(AbstractRenderPlugin obj) { super((SBase) obj); - // TODO: copy all class attributes, e.g.: - // bar = obj.bar; + versionMinor = obj.versionMinor; + versionMajor = obj.versionMajor; + renderInformation = obj.renderInformation.clone(); } /** * clones this class */ - public AbstractRenderPlugin clone() { + @Override + public AbstractRenderPlugin clone() { return new AbstractRenderPlugin(this); } @@ -128,7 +130,7 @@ } /** - * @return whether versionMinor is set + * @return whether versionMinor is set */ public boolean isSetVersionMinor() { return this.versionMinor != null; @@ -144,8 +146,8 @@ } /** - * Unsets the variable versionMinor - * @return <code>true</code>, if versionMinor was set before, + * Unsets the variable versionMinor + * @return <code>true</code>, if versionMinor was set before, * otherwise <code>false</code> */ public boolean unsetVersionMinor() { @@ -157,8 +159,8 @@ } return false; } - - + + /** * @return the value of versionMajor */ @@ -172,7 +174,7 @@ } /** - * @return whether versionMajor is set + * @return whether versionMajor is set */ public boolean isSetVersionMajor() { return this.versionMajor != null; @@ -188,8 +190,8 @@ } /** - * Unsets the variable versionMajor - * @return <code>true</code>, if versionMajor was set before, + * Unsets the variable versionMajor + * @return <code>true</code>, if versionMajor was set before, * otherwise <code>false</code> */ public boolean unsetVersionMajor() { @@ -201,8 +203,8 @@ } return false; } - - + + /** * @return the value of renderInformation */ @@ -216,7 +218,7 @@ } /** - * @return whether renderInformation is set + * @return whether renderInformation is set */ public boolean isSetRenderInformation() { return this.renderInformation != null; @@ -232,8 +234,8 @@ } /** - * Unsets the variable renderInformation - * @return <code>true</code>, if renderInformation was set before, + * Unsets the variable renderInformation + * @return <code>true</code>, if renderInformation was set before, * otherwise <code>false</code> */ public boolean unsetRenderInformation() { @@ -261,7 +263,6 @@ */ // @Override public TreeNode getChildAt(int childIndex) { - // TODO Auto-generated method stub return null; } @@ -270,7 +271,6 @@ */ // @Override public int getChildCount() { - // TODO Auto-generated method stub return 0; } @@ -279,7 +279,6 @@ */ // @Override public boolean getAllowsChildren() { - // TODO Auto-generated method stub return false; } Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/ExtendedRenderModel.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/ExtendedRenderModel.java 2012-06-01 10:58:30 UTC (rev 1278) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/ExtendedRenderModel.java 2012-06-01 15:30:31 UTC (rev 1279) @@ -2,22 +2,22 @@ * $Id$ * $URL$ * - * ---------------------------------------------------------------------------- - * This file is part of JSBML. Please visit <http://sbml.org/Software/JSBML> - * for the latest version of JSBML and more information about SBML. - * - * Copyright (C) 2009-2012 jointly by the following organizations: - * 1. The University of Tuebingen, Germany - * 2. EMBL European Bioinformatics Institute (EBML-EBI), Hinxton, UK - * 3. The California Institute of Technology, Pasadena, CA, USA - * - * This library is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation. A copy of the license agreement is provided - * in the file named "LICENSE.txt" included with this software distribution - * and also available online as <http://sbml.org/Software/JSBML/License>. - * ---------------------------------------------------------------------------- - */ + * ---------------------------------------------------------------------------- + * This file is part of JSBML. Please visit <http://sbml.org/Software/JSBML> + * for the latest version of JSBML and more information about SBML. + * + * Copyright (C) 2009-2012 jointly by the following organizations: + * 1. The University of Tuebingen, Germany + * 2. EMBL European Bioinformatics Institute (EBML-EBI), Hinxton, UK + * 3. The California Institute of Technology, Pasadena, CA, USA + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation. A copy of the license agreement is provided + * in the file named "LICENSE.txt" included with this software distribution + * and also available online as <http://sbml.org/Software/JSBML/License>. + * ---------------------------------------------------------------------------- + */ package org.sbml.jsbml.ext.render; import java.text.MessageFormat; @@ -26,6 +26,7 @@ import org.sbml.jsbml.ListOf; import org.sbml.jsbml.SBase; import org.sbml.jsbml.ext.AbstractSBasePlugin; +import org.sbml.jsbml.util.filters.NameFilter; /** @@ -39,18 +40,17 @@ */ public class ExtendedRenderModel extends AbstractSBasePlugin { /** - * + * */ private static final long serialVersionUID = -7046023464349980639L; - - protected ListOf<LocalRenderInformation> listOfLocalRenderInformation; - protected ListOf<GlobalRenderInformation> listOfGlobalRenderInformation; - // TODO unclear if Integer or int - protected int versionMajor; - protected int versionMinor; + private ListOf<LocalRenderInformation> listOfLocalRenderInformation; + private ListOf<GlobalRenderInformation> listOfGlobalRenderInformation; + private Integer versionMajor; + private Integer versionMinor; + /** - * Creates an ExtendedRenderModel instance + * Creates an ExtendedRenderModel instance */ public ExtendedRenderModel() { super(); @@ -58,8 +58,8 @@ } /** - * Creates a ExtendedRenderModel instance with a level and version. - * + * Creates a ExtendedRenderModel instance with a level and version. + * * @param level * @param version */ @@ -68,8 +68,8 @@ } /** - * Creates a ExtendedRenderModel instance with an id, level, and version. - * + * Creates a ExtendedRenderModel instance with an id, level, and version. + * * @param id * @param level * @param version @@ -79,8 +79,8 @@ } /** - * Creates a ExtendedRenderModel instance with an id, name, level, and version. - * + * Creates a ExtendedRenderModel instance with an id, name, level, and version. + * * @param id * @param name * @param level @@ -109,7 +109,8 @@ /** * clones this class */ - public ExtendedRenderModel clone() { + @Override + public ExtendedRenderModel clone() { return new ExtendedRenderModel(this); } @@ -122,11 +123,6 @@ versionMinor = 0; } - // TODO: Move to RenderConstants - public static final int MIN_SBML_LEVEL = 3; - public static final int MIN_SBML_VERSION = 1; - - /** * @return the value of versionMinor */ @@ -134,7 +130,7 @@ return versionMinor; } /** - * @return whether versionMinor is set + * @return whether versionMinor is set */ public boolean isSetVersionMinor() { return true; @@ -150,8 +146,8 @@ } /** - * Unsets the variable versionMinor - * @return <code>true</code>, if versionMinor was set before, + * Unsets the variable versionMinor + * @return <code>true</code>, if versionMinor was set before, * otherwise <code>false</code> */ public boolean unsetVersionMinor() { @@ -172,7 +168,7 @@ } /** - * @return whether versionMajor is set + * @return whether versionMajor is set */ public boolean isSetVersionMajor() { return true; @@ -188,8 +184,8 @@ } /** - * Unsets the variable versionMajor - * @return <code>true</code>, if versionMajor was set before, + * Unsets the variable versionMajor + * @return <code>true</code>, if versionMajor was set before, * otherwise <code>false</code> */ public boolean unsetVersionMajor() { @@ -203,7 +199,7 @@ /** - * @return <code>true</code>, if listOfGlobalRenderInformation contains at least one element, + * @return <code>true</code>, if listOfGlobalRenderInformation contains at least one element, * otherwise <code>false</code> */ public boolean isSetListOfGlobalRenderInformation() { @@ -236,7 +232,7 @@ } /** - * @return <code>true</code>, if listOfGlobalRenderInformation contained at least one element, + * @return <code>true</code>, if listOfGlobalRenderInformation contained at least one element, * otherwise <code>false</code> */ public boolean unsetListOfGlobalRenderInformation() { @@ -277,12 +273,12 @@ } /** - * TODO: if the ID is mandatory for GlobalRenderInformation objects, - * one should also add this methods + * + * @param id */ - //public void removeGlobalRenderInformation(String id) { - // getListOfGlobalRenderInformation().removeFirst(new NameFilter(id)); - //} + public void removeGlobalRenderInformation(String id) { + getListOfGlobalRenderInformation().removeFirst(new NameFilter(id)); + } /** * create a new GlobalRenderInformation element and adds it to the ListOfGlobalRenderInformation list @@ -304,7 +300,7 @@ } /** - * @return <code>true</code>, if listOfLocalRenderInformation contains at least one element, + * @return <code>true</code>, if listOfLocalRenderInformation contains at least one element, * otherwise <code>false</code> */ public boolean isSetListOfLocalRenderInformation() { @@ -337,7 +333,7 @@ } /** - * @return <code>true</code>, if listOfLocalRenderInformation contained at least one element, + * @return <code>true</code>, if listOfLocalRenderInformation contained at least one element, * otherwise <code>false</code> */ public boolean unsetListOfLocalRenderInformation() { @@ -446,7 +442,7 @@ throw new IndexOutOfBoundsException(MessageFormat.format( "Index {0,number,integer} >= {1,number,integer}", childIndex, - +((int) Math.min(pos, 0)))); + +Math.min(pos, 0))); } /* (non-Javadoc) Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/GlobalRenderInformation.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/GlobalRenderInformation.java 2012-06-01 10:58:30 UTC (rev 1278) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/GlobalRenderInformation.java 2012-06-01 15:30:31 UTC (rev 1279) @@ -20,8 +20,11 @@ */ package org.sbml.jsbml.ext.render; +import java.text.MessageFormat; + import org.sbml.jsbml.LevelVersionError; import org.sbml.jsbml.ListOf; +import org.sbml.jsbml.SBase; /** @@ -33,7 +36,6 @@ * @since 1.0 * @date 08.05.2012 */ -// TODO getter, setter, isset public class GlobalRenderInformation extends RenderInformationBase { /** * @@ -102,8 +104,8 @@ */ public GlobalRenderInformation(String id, String name, int level, int version) { super(id, name, level, version); - if (getLevelAndVersion().compareTo(Integer.valueOf(MIN_SBML_LEVEL), - Integer.valueOf(MIN_SBML_VERSION)) < 0) { + if (getLevelAndVersion().compareTo(Integer.valueOf(RenderConstants.MIN_SBML_LEVEL), + Integer.valueOf(RenderConstants.MIN_SBML_VERSION)) < 0) { throw new LevelVersionError(getElementName(), level, version); } initDefaults(); @@ -125,4 +127,131 @@ addNamespace(RenderConstants.namespaceURI); } + + /** + * @return <code>true</code>, if listOfStyles contains at least one element, + * otherwise <code>false</code> + */ + public boolean isSetListOfStyles() { + if ((listOfStyles == null) || listOfStyles.isEmpty()) { + return false; + } + return true; + } + + + /** + * @return the listOfStyles + */ + public ListOf<Style> getListOfStyles() { + if (!isSetListOfStyles()) { + listOfStyles = new ListOf<Style>(getLevel(), getVersion()); + listOfStyles.addNamespace(RenderConstants.namespaceURI); + listOfStyles.setSBaseListType(ListOf.Type.other); + registerChild(listOfStyles); + } + return listOfStyles; + } + + + /** + * @param listOfStyles + */ + public void setListOfStyles(ListOf<Style> listOfStyles) { + unsetListOfStyles(); + this.listOfStyles = listOfStyles; + registerChild(this.listOfStyles); + } + + + /** + * @return <code>true</code>, if listOfStyles contained at least one element, + * otherwise <code>false</code> + */ + public boolean unsetListOfStyles() { + if (isSetListOfStyles()) { + ListOf<Style> oldStyles = this.listOfStyles; + this.listOfStyles = null; + oldStyles.fireNodeRemovedEvent(); + return true; + } + return false; + } + + + /** + * @param style + */ + public boolean addStyle(Style style) { + return getListOfStyles().add(style); + } + + + /** + * @param style + */ + public boolean removeStyle(Style style) { + if (isSetListOfStyles()) { + return getListOfStyles().remove(style); + } + return false; + } + + + /** + * @param i + */ + public void removeStyle(int i) { + if (!isSetListOfStyles()) { + throw new IndexOutOfBoundsException(Integer.toString(i)); + } + getListOfStyles().remove(i); + } + + + @Override + public int getChildCount() { + int count = super.getChildCount(); + if (isSetListOfStyles()) { + count++; + } + return count; + } + + + @Override + public SBase getChildAt(int childIndex) { + if (childIndex < 0) { + throw new IndexOutOfBoundsException(childIndex + " < 0"); + } + int pos = 0; + if (isSetListOfColorDefinitions()) { + if (pos == childIndex) { + return getListOfColorDefinitions(); + } + pos++; + } + if (isSetListOfGradientDefintions()) { + if (pos == childIndex) { + return getListOfGradientDefintions(); + } + pos++; + } + if (isSetListOfLineEndings()) { + if (pos == childIndex) { + return getListOfLineEndings(); + } + pos++; + } + if (isSetListOfStyles()) { + if (pos == childIndex) { + return getListOfStyles(); + } + pos++; + } + throw new IndexOutOfBoundsException(MessageFormat.format( + "Index {0,number,integer} >= {1,number,integer}", childIndex, + +Math.min(pos, 0))); + } + } Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/LocalRenderInformation.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/LocalRenderInformation.java 2012-06-01 10:58:30 UTC (rev 1278) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/LocalRenderInformation.java 2012-06-01 15:30:31 UTC (rev 1279) @@ -20,8 +20,11 @@ */ package org.sbml.jsbml.ext.render; +import java.text.MessageFormat; + import org.sbml.jsbml.LevelVersionError; import org.sbml.jsbml.ListOf; +import org.sbml.jsbml.SBase; /** @@ -90,8 +93,8 @@ */ public LocalRenderInformation(String id, String name, int level, int version) { super(id, name, level, version); - if (getLevelAndVersion().compareTo(Integer.valueOf(MIN_SBML_LEVEL), - Integer.valueOf(MIN_SBML_VERSION)) < 0) { + if (getLevelAndVersion().compareTo(Integer.valueOf(RenderConstants.MIN_SBML_LEVEL), + Integer.valueOf(RenderConstants.MIN_SBML_VERSION)) < 0) { throw new LevelVersionError(getElementName(), level, version); } initDefaults(); @@ -118,8 +121,7 @@ */ @Override public void initDefaults() { - //TODO - //addNamespace(constant_class.namespaceURI); + addNamespace(RenderConstants.namespaceURI); this.listOfLocalStyles = null; } @@ -140,8 +142,7 @@ public ListOf<LocalStyle> getListOfLocalStyles() { if (!isSetListOfLocalStyles()) { listOfLocalStyles = new ListOf<LocalStyle>(getLevel(), getVersion()); - //TODO - //listOfLocalStyles.addNamespace(constant_class.namespaceURI); + listOfLocalStyles.addNamespace(RenderConstants.namespaceURI); listOfLocalStyles.setSBaseListType(ListOf.Type.other); registerChild(listOfLocalStyles); } @@ -197,17 +198,51 @@ } getListOfLocalStyles().remove(i); } + + + @Override + public int getChildCount() { + int count = super.getChildCount(); + if (isSetListOfLocalStyles()) { + count++; + } + return count; + } - //** - //* create a new LocalStyle element and adds it to the ListOfLocalStyles list - //*/ - //TODO A Style needs a group - /* - public LocalStyle createLocalStyle(String id) { - LocalStyle field = new LocalStyle(id, getLevel(), getVersion()); - addLocalStyle(field); - return field; + + @Override + public SBase getChildAt(int childIndex) { + if (childIndex < 0) { + throw new IndexOutOfBoundsException(childIndex + " < 0"); + } + int pos = 0; + if (isSetListOfColorDefinitions()) { + if (pos == childIndex) { + return getListOfColorDefinitions(); + } + pos++; + } + if (isSetListOfGradientDefintions()) { + if (pos == childIndex) { + return getListOfGradientDefintions(); + } + pos++; + } + if (isSetListOfLineEndings()) { + if (pos == childIndex) { + return getListOfLineEndings(); + } + pos++; + } + if (isSetListOfLocalStyles()) { + if (pos == childIndex) { + return getListOfLocalStyles(); + } + pos++; + } + throw new IndexOutOfBoundsException(MessageFormat.format( + "Index {0,number,integer} >= {1,number,integer}", childIndex, + +Math.min(pos, 0))); } - */ } Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/LocalStyle.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/LocalStyle.java 2012-06-01 10:58:30 UTC (rev 1278) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/LocalStyle.java 2012-06-01 15:30:31 UTC (rev 1279) @@ -2,28 +2,30 @@ * $Id$ * $URL$ * - * ---------------------------------------------------------------------------- - * This file is part of JSBML. Please visit <http://sbml.org/Software/JSBML> - * for the latest version of JSBML and more information about SBML. - * - * Copyright (C) 2009-2012 jointly by the following organizations: - * 1. The University of Tuebingen, Germany - * 2. EMBL European Bioinformatics Institute (EBML-EBI), Hinxton, UK - * 3. The California Institute of Technology, Pasadena, CA, USA - * - * This library is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation. A copy of the license agreement is provided - * in the file named "LICENSE.txt" included with this software distribution - * and also available online as <http://sbml.org/Software/JSBML/License>. - * ---------------------------------------------------------------------------- - */ + * ---------------------------------------------------------------------------- + * This file is part of JSBML. Please visit <http://sbml.org/Software/JSBML> + * for the latest version of JSBML and more information about SBML. + * + * Copyright (C) 2009-2012 jointly by the following organizations: + * 1. The University of Tuebingen, Germany + * 2. EMBL European Bioinformatics Institute (EBML-EBI), Hinxton, UK + * 3. The California Institute of Technology, Pasadena, CA, USA + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation. A copy of the license agreement is provided + * in the file named "LICENSE.txt" included with this software distribution + * and also available online as <http://sbml.org/Software/JSBML/License>. + * ---------------------------------------------------------------------------- + */ package org.sbml.jsbml.ext.render; import java.util.ArrayList; import java.util.List; +import org.sbml.jsbml.PropertyUndefinedError; + /** * @author Eugen Netz * @author Alexander Diamantikos @@ -35,26 +37,25 @@ */ public class LocalStyle extends Style { /** - * + * */ private static final long serialVersionUID = 4976081641247006722L; - - // TODO List of ids or layouts? Type, setters and getters, add, remove + private List<String> idList; - + /** * Creates a LocalStyle instance with a group - * + * * @param group */ public LocalStyle(Group group){ super(group); this.idList = new ArrayList<String>(); } - + /** - * Creates a LocalStyle instance with a level and version. - * + * Creates a LocalStyle instance with a level and version. + * * @param level * @param version */ @@ -62,10 +63,10 @@ super(null, level, version, group); this.idList = new ArrayList<String>(); } - + /** - * Creates a LocalStyle instance with an id, name, level, and version. - * + * Creates a LocalStyle instance with an id, name, level, and version. + * * @param id * @param level * @param version @@ -75,22 +76,51 @@ super(id, level, version, group); this.idList = new ArrayList<String>(); } - + + /** * @return the value of idList */ - public List<String> getIdList(){ - return this.idList; + public List<String> getIdList() { + if (isSetIdList()) { + return idList; + } + // This is necessary if we cannot return null here. + throw new PropertyUndefinedError(RenderConstants.idList, this); } - + + /** + * @return whether idList is set + */ + public boolean isSetIdList() { + return this.idList != null; + } + + + /** * Set the value of idList */ - public void setIdList(ArrayList<String> idList){ - //ArrayList<String> oldIdList = this.idList; + public void setIdList(List<String> idList) { + List<String> oldIdList = this.idList; this.idList = idList; - //TODO - //firePropertyChange(constant_class.idList, oldIdList, this.idList); + firePropertyChange(RenderConstants.idList, oldIdList, this.idList); } + + /** + * Unsets the variable idList + * @return <code>true</code>, if idList was set before, + * otherwise <code>false</code> + */ + public boolean unsetIdList() { + if (isSetIdList()) { + List<String> oldIdList = this.idList; + this.idList = null; + firePropertyChange(RenderConstants.idList, oldIdList, this.idList); + return true; + } + return false; + } + } Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderConstants.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderConstants.java 2012-06-01 10:58:30 UTC (rev 1278) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderConstants.java 2012-06-01 15:30:31 UTC (rev 1279) @@ -2,21 +2,21 @@ * $Id$ * $URL$ * - * ---------------------------------------------------------------------------- - * This file is part of JSBML. Please visit <http://sbml.org/Software/JSBML> - * for the latest version of JSBML and more information about SBML. - * - * Copyright (C) 2009-2012 jointly by the following organizations: - * 1. The University of Tuebingen, Germany - * 2. EMBL European Bioinformatics Institute (EBML-EBI), Hinxton, UK - * 3. The California Institute of Technology, Pasadena, CA, USA - * - * This library is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation. A copy of the license agreement is provided - * in the file named "LICENSE.txt" included with this software distribution - * and also available online as <http://sbml.org/Software/JSBML/License>. - * ---------------------------------------------------------------------------- + * ---------------------------------------------------------------------------- + * This file is part of JSBML. Please visit <http://sbml.org/Software/JSBML> + * for the latest version of JSBML and more information about SBML. + * + * Copyright (C) 2009-2012 jointly by the following organizations: + * 1. The University of Tuebingen, Germany + * 2. EMBL European Bioinformatics Institute (EBML-EBI), Hinxton, UK + * 3. The California Institute of Technology, Pasadena, CA, USA + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation. A copy of the license agreement is provided + * in the file named "LICENSE.txt" included with this software distribution + * and also available online as <http://sbml.org/Software/JSBML/License>. + * ---------------------------------------------------------------------------- */ package org.sbml.jsbml.ext.render; @@ -33,7 +33,11 @@ public interface RenderConstants { public static final int MIN_SBML_LEVEL = 3; public static final int MIN_SBML_VERSION = 1; + public static final String namespaceURI = "http://www.sbml.org/sbml/level3/version1/render/version1"; + + public static final String shortLabel = "render"; + public static final String fontFamily = "font-family"; public static final String fontSize = "font-size"; public static final String fontWeightBold = "font-weight"; @@ -102,4 +106,9 @@ public static final String typeList = "typeList"; public static final String roleList = "roleList"; public static final String value = "value"; + public static final String programName = "programName"; + public static final String programVersion = "programVersion"; + public static final String referenceRenderInformation = "referenceRenderInformation"; + public static final String backgroundColor = "backgroundColor"; + public static final String idList = "idList"; } Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderInformationBase.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderInformationBase.java 2012-06-01 10:58:30 UTC (rev 1278) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderInformationBase.java 2012-06-01 15:30:31 UTC (rev 1279) @@ -21,11 +21,13 @@ package org.sbml.jsbml.ext.render; import java.awt.Color; +import java.text.MessageFormat; import org.sbml.jsbml.AbstractNamedSBase; import org.sbml.jsbml.LevelVersionError; import org.sbml.jsbml.ListOf; import org.sbml.jsbml.PropertyUndefinedError; +import org.sbml.jsbml.SBase; import org.sbml.jsbml.util.filters.NameFilter; /** @@ -37,7 +39,7 @@ * @since 1.0 * @date 04.05.2012 */ -public class RenderInformationBase extends AbstractNamedSBase { +public class RenderInformationBase extends AbstractNamedSBase { /** * @@ -45,13 +47,12 @@ private static final long serialVersionUID = -9096154126197866584L; protected String programName; - protected String programVersion; //TODO int better? + protected String programVersion; protected String referenceRenderInformation; protected Color backgroundColor; protected ListOf<ColorDefinition> listOfColorDefinitions; - // TODO maybe wrong class for linear and radial gradients - protected ListOf<GradientBase> listOfGradientBases; - protected ListOf<LineEnding> listofLineEndings; + protected ListOf<GradientBase> listOfGradientDefintions; + protected ListOf<LineEnding> listOfLineEndings; /** * Creates an RenderInformationBase instance @@ -102,8 +103,8 @@ */ public RenderInformationBase(String id, String name, int level, int version) { super(id, name, level, version); - if (getLevelAndVersion().compareTo(Integer.valueOf(MIN_SBML_LEVEL), - Integer.valueOf(MIN_SBML_VERSION)) < 0) { + if (getLevelAndVersion().compareTo(Integer.valueOf(RenderConstants.MIN_SBML_LEVEL), + Integer.valueOf(RenderConstants.MIN_SBML_VERSION)) < 0) { throw new LevelVersionError(getElementName(), level, version); } initDefaults(); @@ -119,8 +120,8 @@ this.referenceRenderInformation = obj.referenceRenderInformation; this.backgroundColor = obj.backgroundColor; this.listOfColorDefinitions = obj.listOfColorDefinitions; - this.listOfGradientBases = obj.listOfGradientBases; - this.listofLineEndings = obj.listofLineEndings; + this.listOfGradientDefintions = obj.listOfGradientDefintions; + this.listOfLineEndings = obj.listOfLineEndings; } /* (non-Javadoc) @@ -135,14 +136,14 @@ * Initializes the default values using the namespace. */ public void initDefaults() { - //TODO addNamespace(.namespaceURI); + addNamespace(RenderConstants.namespaceURI); this.backgroundColor = new Color(0, 0, 0); this.programName = null; this.programVersion = null; this.referenceRenderInformation = null; this.listOfColorDefinitions = null; - this.listOfGradientBases = null; - this.listofLineEndings = null; + this.listOfGradientDefintions = null; + this.listOfLineEndings = null; } /** @@ -152,12 +153,8 @@ if (isSetProgramName()) { return this.programName; - } else { - return null; } - //TODO Create a Constants class? - // This is necessary if we cannot return null here. - //throw new PropertyUndefinedError("programmName", this); + throw new PropertyUndefinedError(RenderConstants.programName, this); } /** @@ -173,7 +170,7 @@ public void setProgramName(String programName) { String oldProgramName = this.programName; this.programName = programName; - firePropertyChange("programName", oldProgramName, this.programName); + firePropertyChange(RenderConstants.programName, oldProgramName, this.programName); } /** @@ -185,7 +182,7 @@ if (isSetProgramName()) { String oldProgramName = this.programName; this.programName = null; - firePropertyChange("programmName", oldProgramName, this.programName); + firePropertyChange(RenderConstants.programName, oldProgramName, this.programName); return true; } return false; @@ -195,12 +192,11 @@ * @return the value of programVersion */ public String getProgramVersion() { - //TODO: return primitive data type if possible (e.g. int instead of Integer) if (isSetProgramVersion()) { return programVersion; } // This is necessary if we cannot return null here. - throw new PropertyUndefinedError("programVersion", this); + throw new PropertyUndefinedError(RenderConstants.programVersion, this); } /** @@ -216,7 +212,7 @@ public void setProgramVersion(String programVersion) { String oldProgramVersion = this.programVersion; this.programVersion = programVersion; - firePropertyChange("programVersion", oldProgramVersion, this.programVersion); + firePropertyChange(RenderConstants.programVersion, oldProgramVersion, this.programVersion); } /** @@ -228,7 +224,7 @@ if (isSetProgramVersion()) { String oldProgramVersion = this.programVersion; this.programVersion = null; - firePropertyChange("programVersion", oldProgramVersion, this.programVersion); + firePropertyChange(RenderConstants.programVersion, oldProgramVersion, this.programVersion); return true; } return false; @@ -238,13 +234,11 @@ * @return the value of referenceRenderInformation */ public String getReferenceRenderInformation() { - //TODO: if variable is boolean, create an additional "isVar" - //TODO: return primitive data type if possible (e.g. int instead of Integer) if (isSetReferenceRenderInformation()) { return referenceRenderInformation; } // This is necessary if we cannot return null here. - throw new PropertyUndefinedError("referenceRenderInformation", this); + throw new PropertyUndefinedError(RenderConstants.referenceRenderInformation, this); } /** @@ -260,7 +254,7 @@ public void setReferenceRenderInformation(String referenceRenderInformation) { String oldReferenceRenderInformation = this.referenceRenderInformation; this.referenceRenderInformation = referenceRenderInformation; - firePropertyChange("referenceRenderInformation", oldReferenceRenderInformation, this.referenceRenderInformation); + firePropertyChange(RenderConstants.referenceRenderInformation, oldReferenceRenderInformation, this.referenceRenderInformation); } /** @@ -272,7 +266,7 @@ if (isSetReferenceRenderInformation()) { String oldReferenceRenderInformation = this.referenceRenderInformation; this.referenceRenderInformation = null; - firePropertyChange("referenceRenderInformation", oldReferenceRenderInformation, this.referenceRenderInformation); + firePropertyChange(RenderConstants.referenceRenderInformation, oldReferenceRenderInformation, this.referenceRenderInformation); return true; } return false; @@ -282,14 +276,11 @@ * @return the value of backgroundColor */ public Color getBackgroundColor() { - //TODO: return primitive data type if possible (e.g. int instead of Integer) if (isSetBackgroundColor()) { return backgroundColor; - } else { - return null; } // This is necessary if we cannot return null here. - //throw new PropertyUndefinedError("backgroundColor", this); + throw new PropertyUndefinedError(RenderConstants.backgroundColor, this); } /** @@ -305,7 +296,7 @@ public void setBackgroundColor(Color backgroundColor) { Color oldBackgroundColor = this.backgroundColor; this.backgroundColor = backgroundColor; - firePropertyChange("backgroundColor", oldBackgroundColor, this.backgroundColor); + firePropertyChange(RenderConstants.backgroundColor, oldBackgroundColor, this.backgroundColor); } /** @@ -317,7 +308,7 @@ if (isSetBackgroundColor()) { Color oldBackgroundColor = this.backgroundColor; this.backgroundColor = null; - firePropertyChange("backgroundColor", oldBackgroundColor, this.backgroundColor); + firePropertyChange(RenderConstants.backgroundColor, oldBackgroundColor, this.backgroundColor); return true; } return false; @@ -340,8 +331,7 @@ public ListOf<ColorDefinition> getListOfColorDefinitions() { if (!isSetListOfColorDefinitions()) { listOfColorDefinitions = new ListOf<ColorDefinition>(getLevel(), getVersion()); - //TODO - //listOfColorDefinitions.addNamespace(constant_class.namespaceURI); + listOfColorDefinitions.addNamespace(RenderConstants.namespaceURI); listOfColorDefinitions.setSBaseListType(ListOf.Type.other); registerChild(listOfColorDefinitions); } @@ -399,8 +389,8 @@ } /** - * TODO: if the ID is mandatory for ColorDefinition objects, - * one should also add this methods + * + * @param id */ public void removeColorDefinition(String id) { getListOfColorDefinitions().removeFirst(new NameFilter(id)); @@ -416,47 +406,46 @@ } /** - * @return <code>true</code>, if listOfGradientBases contains at least one element, + * @return <code>true</code>, if listOfGradientDefintions contains at least one element, * otherwise <code>false</code> */ - public boolean isSetListOfGradientBases() { - if ((listOfGradientBases == null) || listOfGradientBases.isEmpty()) { + public boolean isSetListOfGradientDefintions() { + if ((listOfGradientDefintions == null) || listOfGradientDefintions.isEmpty()) { return false; } return true; } /** - * @return the listOfGradientBases + * @return the listOfGradientDefintions */ - public ListOf<GradientBase> getListOfGradientBases() { - if (!isSetListOfGradientBases()) { - listOfGradientBases = new ListOf<GradientBase>(getLevel(), getVersion()); - //TODO - //listOfGradientBases.addNamespace(constant_class.namespaceURI); - listOfGradientBases.setSBaseListType(ListOf.Type.other); - registerChild(listOfGradientBases); + public ListOf<GradientBase> getListOfGradientDefintions() { + if (!isSetListOfGradientDefintions()) { + listOfGradientDefintions = new ListOf<GradientBase>(getLevel(), getVersion()); + listOfGradientDefintions.addNamespace(RenderConstants.namespaceURI); + listOfGradientDefintions.setSBaseListType(ListOf.Type.other); + registerChild(listOfGradientDefintions); } - return listOfGradientBases; + return listOfGradientDefintions; } /** - * @param listOfGradientBases + * @param listOfGradientDefintions */ - public void setListOfGradientBases(ListOf<GradientBase> listOfGradientBases) { - unsetListOfGradientBases(); - this.listOfGradientBases = listOfGradientBases; - registerChild(this.listOfGradientBases); + public void setListOfGradientDefintions(ListOf<GradientBase> listOfGradientDefintions) { + unsetListOfGradientDefintions(); + this.listOfGradientDefintions = listOfGradientDefintions; + registerChild(this.listOfGradientDefintions); } /** - * @return <code>true</code>, if listOfGradientBases contained at least one element, + * @return <code>true</code>, if listOfGradientDefintions contained at least one element, * otherwise <code>false</code> */ - public boolean unsetListOfGradientBases() { - if (isSetListOfGradientBases()) { - ListOf<GradientBase> oldGradientBases = this.listOfGradientBases; - this.listOfGradientBases = null; + public boolean unsetListOfGradientDefintions() { + if (isSetListOfGradientDefintions()) { + ListOf<GradientBase> oldGradientBases = this.listOfGradientDefintions; + this.listOfGradientDefintions = null; oldGradientBases.fireNodeRemovedEvent(); return true; } @@ -467,15 +456,15 @@ * @param field */ public boolean addGradientBase(GradientBase field) { - return getListOfGradientBases().add(field); + return getListOfGradientDefintions().add(field); } /** * @param field */ public boolean removeGradientBase(GradientBase field) { - if (isSetListOfGradientBases()) { - return getListOfGradientBases().remove(field); + if (isSetListOfGradientDefintions()) { + return getListOfGradientDefintions().remove(field); } return false; } @@ -484,23 +473,150 @@ * @param i */ public void removeGradientBase(int i) { - if (!isSetListOfGradientBases()) { + if (!isSetListOfGradientDefintions()) { throw new IndexOutOfBoundsException(Integer.toString(i)); } - getListOfGradientBases().remove(i); + getListOfGradientDefintions().remove(i); } - // TODO: Move to RenderConstants - public static final int MIN_SBML_LEVEL = 3; - public static final int MIN_SBML_VERSION = 1; - /* (non-Javadoc) * @see org.sbml.jsbml.NamedSBase#isIdMandatory() */ //@Override public boolean isIdMandatory() { - // TODO Auto-generated method stub - return false; + return true; } + + @Override + public boolean getAllowsChildren() { + return false; + } + + + @Override + public int getChildCount() { + int count = 0; + if (isSetListOfColorDefinitions()) { + count++; + } + if (isSetListOfGradientDefintions()) { + count++; + } + if (isSetListOfLineEndings()) { + count++; + } + return count; + } + + + @Override + public SBase getChildAt(int childIndex) { + if (childIndex < 0) { + throw new IndexOutOfBoundsException(childIndex + " < 0"); + } + int pos = 0; + if (isSetListOfColorDefinitions()) { + if (pos == childIndex) { + return getListOfColorDefinitions(); + } + pos++; + } + if (isSetListOfGradientDefintions()) { + if (pos == childIndex) { + return getListOfGradientDefintions(); + } + pos++; + } + if (isSetListOfLineEndings()) { + if (pos == childIndex) { + return getListOfLineEndings(); + } + pos++; + } + throw new IndexOutOfBoundsException(MessageFormat.format( + "Index {0,number,integer} >= {1,number,integer}", childIndex, + +Math.min(pos, 0))); + } + + + /** + * @return <code>true</code>, if listOfLineEndings contains at least one element, + * otherwise <code>false</code> + */ + public boolean isSetListOfLineEndings() { + if ((listOfLineEndings == null) || listOfLineEndings.isEmpty()) { + return false; + } + return true; + } + + + /** + * @return the listOfLineEndings + */ + public ListOf<LineEnding> getListOfLineEndings() { + if (!isSetListOfLineEndings()) { + listOfLineEndings = new ListOf<LineEnding>(getLevel(), getVersion()); + listOfLineEndings.addNamespace(RenderConstants.namespaceURI); + listOfLineEndings.setSBaseListType(ListOf.Type.other); + registerChild(listOfLineEndings); + } + return listOfLineEndings; + } + + + /** + * @param listOfLineEndings + */ + public void setListOfLineEndings(ListOf<LineEnding> listOfLineEndings) { + unsetListOfLineEndings(); + this.listOfLineEndings = listOfLineEndings; + registerChild(this.listOfLineEndings); + } + + + /** + * @return <code>true</code>, if listOfLineEndings contained at least one element, + * otherwise <code>false</code> + */ + public boolean unsetListOfLineEndings() { + if (isSetListOfLineEndings()) { + ListOf<LineEnding> oldLineEndings = this.listOfLineEndings; + this.listOfLineEndings = null; + oldLineEndings.fireNodeRemovedEvent(); + return true; + } + return false; + } + + + /** + * @param lineEnding + */ + public boolean addLineEnding(LineEnding lineEnding) { + return getListOfLineEndings().add(lineEnding); + } + + + /** + * @param lineEnding + */ + public boolean removeLineEnding(LineEnding lineEnding) { + if (isSetListOfLineEndings()) { + return getListOfLineEndings().remove(lineEnding); + } + return false; + } + + + /** + * @param i + */ + public void removeLineEnding(int i) { + if (!isSetListOfLineEndings()) { + throw new IndexOutOfBoundsException(Integer.toString(i)); + } + getListOfLineEndings().remove(i); + } } Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderLayoutPlugin.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderLayoutPlugin.java 2012-06-01 10:58:30 UTC (rev 1278) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderLayoutPlugin.java 2012-06-01 15:30:31 UTC (rev 1279) @@ -2,22 +2,22 @@ * $Id$ * $URL$ * - * ---------------------------------------------------------------------------- - * This file is part of JSBML. Please visit <http://sbml.org/Software/JSBML> - * for the latest version of JSBML and more information about SBML. - * - * Copyright (C) 2009-2012 jointly by the following organizations: - * 1. The University of Tuebingen, Germany - * 2. EMBL European Bioinformatics Institute (EBML-EBI), Hinxton, UK - * 3. The California Institute of Technology, Pasadena, CA, USA - * - * This library is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation. A copy of the license agreement is provided - * in the file named "LICENSE.txt" included with this software distribution - * and also available online as <http://sbml.org/Software/JSBML/License>. - * ---------------------------------------------------------------------------- - */ + * ---------------------------------------------------------------------------- + * This file is part of JSBML. Please visit <http://sbml.org/Software/JSBML> + * for the latest version of JSBML and more information about SBML. + * + * Copyright (C) 2009-2012 jointly by the following organizations: + * 1. The University of Tuebingen, Germany + * 2. EMBL European Bioinformatics Institute (EBML-EBI), Hinxton, UK + * 3. The California Institute of Technology, Pasadena, CA, USA + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation. A copy of the license agreement is provided + * in the file named "LICENSE.txt" included with this software distribution + * and also available online as <http://sbml.org/Software/JSBML/License>. + * ---------------------------------------------------------------------------- + */ package org.sbml.jsbml.ext.render; import java.text.MessageFormat; @@ -25,6 +25,7 @@ import org.sbml.jsbml.ListOf; import org.sbml.jsbml.SBase; import org.sbml.jsbml.ext.layout.Layout; +import org.sbml.jsbml.util.filters.NameFilter; /** @@ -35,13 +36,13 @@ */ public class RenderLayoutPlugin extends AbstractRenderPlugin { /** - * + * */ private static final long serialVersionUID = 6636572993878851570L; private ListOf<LocalRenderInformation> listOfLocalRenderInformation; - + /** - * Creates an RenderLayoutPlugin instance + * Creates an RenderLayoutPlugin instance */ public RenderLayoutPlugin(Layout layout) { super(); @@ -54,8 +55,7 @@ */ public RenderLayoutPlugin(RenderLayoutPlugin obj) { super(obj); - // TODO: copy all class attributes, e.g.: - // bar = obj.bar; + listOfLocalRenderInformation = obj.listOfLocalRenderInformation.clone(); } /* (non-Javadoc) @@ -71,9 +71,7 @@ */ @Override public void initDefaults() { -// addNamespace(RenderConstants.namespaceURI); - // TODO: init default values here if necessary, e.g.: - // bar = null; +// TODO addNamespace(RenderConstants.namespaceURI); } /* (non-Javadoc) @@ -113,11 +111,11 @@ } throw new IndexOutOfBoundsException(MessageFormat.format( "Index {0,number,integer} >= {1,number,integer}", childIndex, - +((int) Math.min(pos, 0)))); + +Math.min(pos, 0))); } /** - * @return <code>true</code>, if listOfLocalRenderInformation contains at least one element, + * @return <code>true</code>, if listOfLocalRenderInformation contains at least one element, * otherwise <code>false</code> */ public boolean isSetListOfLocalRenderInformation() { @@ -140,9 +138,9 @@ } return listOfLocalRenderInformation; } - + /** - * + * * @param i * @return */ @@ -160,7 +158,7 @@ } /** - * @return <code>true</code>, if listOfLocalRenderInformation contained at least one element, + * @return <code>true</code>, if listOfLocalRenderInformation contained at least one element, * otherwise <code>false</code> */ public boolean unsetListOfLocalRenderInformation() { @@ -201,12 +199,13 @@ } /** - * TODO: if the ID is mandatory for LocalRenderInformation objects, - * one should also add this methods + * + * @param id */ - //public void removeLocalRenderInformation(String id) { - // getListOfLocalRenderInformation().removeFirst(new NameFilter(id)); - //} + public void removeLocalRenderInformation(String id) { + getListOfLocalRenderInformation().removeFirst(new NameFilter(id)); + } + /** * create a new LocalRenderInformation element and adds it to the ListOfLocalRenderInformation list * <p><b>NOTE:</b> Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderModelPlugin.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderModelPlugin.java 2012-06-01 10:58:30 UTC (rev 1278) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderModelPlugin.java 2012-06-01 15:30:31 UTC (rev 1279) @@ -2,22 +2,22 @@ * $Id$ * $URL$ * - * ---------------------------------------------------------------------------- - * This file is part of JSBML. Please visit <http://sbml.org/Software/JSBML> - * for the latest version of JSBML and more information about SBML. - * - * Copyright (C) 2009-2012 jointly by the following organizations: - * 1. The University of Tuebingen, Germany - * 2. EMBL European Bioinformatics Institute (EBML-EBI), Hinxton, UK - * 3. The California Institute of Technology, Pasadena, CA, USA - * - * This library is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation. A copy of the license agreement is provided - * in the file named "LICENSE.txt" included with this software distribution - * and also available online as <http://sbml.org/Software/JSBML/License>. - * ---------------------------------------------------------------------------- - */ + * ---------------------------------------------------------------------------- + * This file is part of JSBML. Please visit <http://sbml.org/Software/JSBML> + * for the latest version of JSBML and more information about SBML. + * + * Copyright (C) 2009-2012 jointly by the following organizations: + * 1. The University of Tuebingen, Germany + * 2. EMBL European Bioinformatics Institute (EBML-EBI), Hinxton, UK + * 3. The California Institute of Technology, Pasadena, CA, USA + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation. A copy of the license agreement is provided + * in the file named "LICENSE.txt" included with this software distribution + * and also available online as <http://sbml.org/Software/JSBML/License>. + * ---------------------------------------------------------------------------- + */ package org.sbml.jsbml.ext.render; import java.text.MessageFormat; @@ -25,6 +25,7 @@ import org.sbml.jsbml.ListOf; import org.sbml.jsbml.SBase; import org.sbml.jsbml.ext.layout.Layout; +import org.sbml.jsbml.util.filters.NameFilter; /** @@ -36,17 +37,17 @@ public class RenderModelPlugin extends AbstractRenderPlugin { /** - * + * */ private static final long serialVersionUID = -4727110538908666931L; - + /** - * + * */ private ListOf<GlobalRenderInformation> listOfGlobalRenderInformation; /** - * Creates an RenderModelPlugin instance + * Creates an RenderModelPlugin instance */ public RenderModelPlugin(ListOf<Layout> listOfLayouts) { super(); @@ -102,7 +103,7 @@ public boolean getAllowsChildren() { return true; } - + /* (non-Javadoc) * @see org.sbml.jsbml.ext.render.AbstractRenderPlugin#getChildAt(int) */ @@ -120,7 +121,7 @@ } throw new IndexOutOfBoundsException(MessageFormat.format( "Index {0,number,integer} >= {1,number,integer}", childIndex, - +((int) Math.min(pos, 0)))); + +Math.min(pos, 0))); } /* (non-Javadoc) @@ -154,13 +155,11 @@ */ @Override public void initDefaults() { -// addNamespace(RenderConstants.namespaceURI); - // TODO: init default values here if necessary, e.g.: - // bar = null; +// TODO addNamespace(RenderConstants.namespaceURI); } /** - * @return <code>true</code>, if listOfGlobalRenderInformation contains at least one element, + * @return <code>true</code>, if listOfGlobalRenderInformation contains at least one element, * otherwise <code>false</code> */ public boolean isSetListOfGlobalRenderInformation() { @@ -191,12 +190,14 @@ } /** - * TODO: if the ID is mandatory for GlobalRenderInformation objects, - * one should also add this methods + * + * @param id */ - //public void removeGlobalRenderInformation(String id) { - // getListOfGlobalRenderInformation().removeFirst(new NameFilter(id)); - //} + public void removeGlobalRenderInformation(String id) { + getListOfGlobalRenderInformation().removeFirst(new NameFilter(id)); + } + + /** * @param listOfGlobalRenderInformation */ @@ -207,7 +208,7 @@ } /** - * @return <code>true</code>, if listOfGlobalRenderInformation contained at least one element, + * @return <code>true</code>, if listOfGlobalRenderInformation contained at least one element, * otherwise <code>false</code> */ public boolean unsetListOfGlobalRenderInformation() { Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderPoint.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderPoint.java 2012-06-01 10:58:30 UTC (rev 1278) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderPoint.java 2012-06-01 15:30:31 UTC (rev 1279) @@ -2,22 +2,22 @@ * $Id$ * $URL$ * - * ---------------------------------------------------------------------------- - * This file is part of JSBML. Please visit <http://sbml.org/Software/JSBML> - * for the latest version of JSBML and more information about SBML. - * - * Copyright (C) 2009-2012 jointly by the following organizations: - * 1. The University of Tuebingen, Germany - * 2. EMBL European Bioinformatics Institute (EBML-EBI), Hinxton, UK - * 3. The California Institute of Technology, Pasadena, CA, USA - * - * This library is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation. A copy of the license agreement is provided - * in the file named "LICENSE.txt" included with this software distribution - * and also available online as <http://sbml.org/Software/JSBML/License>. - * ---------------------------------------------------------------------------- - */ + * ---------------------------------------------------------------------------- + * This file is part of JSBML. Please visit <http://sbml.org/Software/JSBML> + * for the latest version of JSBML and more information about SBML. + * + * Copyright (C) 2009-2012 jointly by the following organizations: + * 1. The University of Tuebingen, Germany + * 2. EMBL European Bioinformatics Institute (EBML-EBI), Hinxton, UK + * 3. The California Institute of Technology, Pasadena, CA, USA + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation. A copy of the license agreement is provided + * in the file named "LICENSE.txt" included with this software distribution + * and also available online as <http://sbml.org/Software/JSBML/License>. + * ---------------------------------------------------------------------------- + */ package org.sbml.jsbml.ext.render; import java.text.MessageFormat; @@ -37,18 +37,18 @@ * @date 08.05.2012 */ public class RenderPoint extends AbstractSBase implements Point3D { - + /** - * + * */ private static final long serialVersionUID = 6792387139122188270L; - + private Boolean absoluteX, absoluteY, absoluteZ; private Double x, y, z; /** - * Creates an RenderPoint instance + * Creates an RenderPoint instance */ public RenderPoint() { super(); @@ -72,9 +72,8 @@ * @see org.sbml.jsbml.AbstractSBase#clone() */ //@Override - public AbstractSBase clone() { - // TODO Auto-generated method stub - return null; + public RenderPoint clone() { + return new RenderPoint(this); } /* (non-Javadoc) @@ -96,7 +95,7 @@ int pos = 0; throw new IndexOutOfBoundsException(MessageFormat.format( "Index {0,number,integer} >= {1,number,integer}", childIndex, - +((int) Math.min(pos, 0)))); + +Math.min(pos, 0))); } /* (non-Javadoc) @@ -130,7 +129,7 @@ // This is necessary if we cannot return null here. throw new PropertyUndefinedError(RenderConstants.y, this); } - + /* (non-Javadoc) * @see org.sbml.jsbml.ext.render.RenderPoint#getZ() */ @@ -299,6 +298,7 @@ ... [truncated message content] |
From: <nik...@us...> - 2012-06-01 10:58:36
|
Revision: 1278 http://jsbml.svn.sourceforge.net/jsbml/?rev=1278&view=rev Author: niko-rodrigue Date: 2012-06-01 10:58:30 +0000 (Fri, 01 Jun 2012) Log Message: ----------- corrected the reaction clone constructor as it was not cloning the compartment attribute. Corrected as well the species.setBoundaryCondition method as it was expecting a Boolean instead of a boolean. Added as well the UnregisterTests from the 0.8 branch Modified Paths: -------------- trunk/core/src/org/sbml/jsbml/Reaction.java trunk/core/src/org/sbml/jsbml/Species.java trunk/core/test/org/sbml/jsbml/xml/test/Tests.java Added Paths: ----------- trunk/core/test/org/sbml/jsbml/xml/test/UnregisterTests.java Modified: trunk/core/src/org/sbml/jsbml/Reaction.java =================================================================== --- trunk/core/src/org/sbml/jsbml/Reaction.java 2012-06-01 09:11:42 UTC (rev 1277) +++ trunk/core/src/org/sbml/jsbml/Reaction.java 2012-06-01 10:58:30 UTC (rev 1278) @@ -140,6 +140,9 @@ } else { reversible = reaction.reversible == null ? null : new Boolean(reaction.reversible.booleanValue()); } + if (reaction.isSetCompartment()) { + setCompartment(reaction.getCompartment()); + } } /** Modified: trunk/core/src/org/sbml/jsbml/Species.java =================================================================== --- trunk/core/src/org/sbml/jsbml/Species.java 2012-06-01 09:11:42 UTC (rev 1277) +++ trunk/core/src/org/sbml/jsbml/Species.java 2012-06-01 10:58:30 UTC (rev 1278) @@ -807,7 +807,7 @@ * * @param boundaryCondition */ - public void setBoundaryCondition(Boolean boundaryCondition) { + public void setBoundaryCondition(boolean boundaryCondition) { Boolean oldBoundaryCondition = this.boundaryCondition; this.boundaryCondition = boundaryCondition; isSetBoundaryCondition = true; Modified: trunk/core/test/org/sbml/jsbml/xml/test/Tests.java =================================================================== --- trunk/core/test/org/sbml/jsbml/xml/test/Tests.java 2012-06-01 09:11:42 UTC (rev 1277) +++ trunk/core/test/org/sbml/jsbml/xml/test/Tests.java 2012-06-01 10:58:30 UTC (rev 1278) @@ -31,7 +31,8 @@ * @version $Rev$ */ @RunWith(value=Suite.class) -@SuiteClasses(value={SBML_L1VxTests.class, SBML_L2V1Test.class, CheckConsistencyTests.class, GetNotesStringTests.class}) +@SuiteClasses(value={SBML_L1VxTests.class, SBML_L2V1Test.class, CheckConsistencyTests.class, GetNotesStringTests.class, + UnregisterTests.class}) public class Tests { } Added: trunk/core/test/org/sbml/jsbml/xml/test/UnregisterTests.java =================================================================== --- trunk/core/test/org/sbml/jsbml/xml/test/UnregisterTests.java (rev 0) +++ trunk/core/test/org/sbml/jsbml/xml/test/UnregisterTests.java 2012-06-01 10:58:30 UTC (rev 1278) @@ -0,0 +1,293 @@ +package org.sbml.jsbml.xml.test; + +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; +import org.sbml.jsbml.Compartment; +import org.sbml.jsbml.IdentifierException; +import org.sbml.jsbml.KineticLaw; +import org.sbml.jsbml.LocalParameter; +import org.sbml.jsbml.Model; +import org.sbml.jsbml.Reaction; +import org.sbml.jsbml.SBMLDocument; +import org.sbml.jsbml.Species; +import org.sbml.jsbml.SpeciesReference; + +public class UnregisterTests { + + SBMLDocument doc; + Model model; + + @BeforeClass public static void initialSetUp() { + + + } + + /** + * + */ + @Before public void setUp() { + doc = new SBMLDocument(2, 4); + model = doc.createModel("model"); + + Compartment comp = model.createCompartment("cell"); + comp.setMetaId("cell"); + + Species s1 = model.createSpecies("S1", comp); + s1.setMetaId("S1"); + + Species s2 = model.createSpecies("S2", comp); + s2.setMetaId("S2"); + + Reaction r1 = model.createReaction("R1"); + r1.setMetaId("R1"); + + SpeciesReference reactant = model.createReactant("SP1"); + reactant.setMetaId("SP1"); + reactant.setSpecies(s1); + + SpeciesReference product = model.createProduct("SP2"); + product.setMetaId("SP2"); + product.setSpecies(s2); + + LocalParameter lp1 = r1.createKineticLaw().createLocalParameter("LP1"); + lp1.setMetaId("LP1"); + + } + + /** + * + */ + @Test public void testRegister() { + + try { + model.createSpecies("R1"); + fail("We should not be able to register twice the same id."); + } catch (IllegalArgumentException e) { + assertTrue(true); + // success + } + + Species s3 = new Species(); + s3.setId("SP1"); + + try { + model.addSpecies(s3); + fail("We should not be able to register twice the same id."); + } catch (IllegalArgumentException e) { + assertTrue(true); + // success + } + assertTrue(model.getSpecies("S3") == null); + + s3.setId("LP1"); + + try { + model.addSpecies(s3); + assertTrue(true); + } catch (IllegalArgumentException e) { + fail("We should be able to register an id that is the same as a local parameter id."); + } + + model.removeSpecies(s3); + assertTrue(model.getSpecies("S3") == null); + + // Testing again after having removed the Species + try { + model.addSpecies(s3); + assertTrue(true); + } catch (IllegalArgumentException e) { + fail("We should be able to register an id that is the same as a local parameter id."); + } + + model.removeSpecies(s3); + assertTrue(model.getSpecies("S3") == null); + + // Setting the same metaid as a SpeciesReference + try { + s3.setMetaId("SP1"); + assertTrue(true); + } catch (IdentifierException e) { + fail("We should be able to put any metaId to a Species removed from a model."); + } + + try { + model.addSpecies(s3); + fail("We should not be able to register twice the same metaid."); + } catch (IllegalArgumentException e) { + assertTrue(true); + // success + } + + assertTrue(model.getSpecies("S3") == null); + + try { + s3.setId("S1"); + assertTrue(true); + } catch (IdentifierException e) { + fail("We should be able to put any id to a Species removed from a model."); + } + + try { + model.addSpecies(s3); + fail("We should not be able to register twice the same id."); + } catch (IllegalArgumentException e) { + assertTrue(true); + // success + } + + assertTrue(model.getSpecies("S3") == null); + + // Setting the same metaid as a LocalParameter + + try { + s3.setMetaId("LP1"); + assertTrue(true); + } catch (IdentifierException e) { + fail("We should be able to put any metaId to a Species not linked to a model."); + } + + try { + model.addSpecies(s3); + fail("We should not be able to register twice the same metaid."); + } catch (IllegalArgumentException e) { + assertTrue(true); + // success + } + + } + + /** + * + */ + @Test public void testRegister2() { + + Species s3 = new Species(); + // Setting the same id as a LocalParameter + s3.setId("LP1"); + + // Setting the same metaid as a LocalParameter + try { + s3.setMetaId("LP1"); + assertTrue(true); + } catch (IdentifierException e) { + fail("We should be able to put any metaId to a Species not linked to a model."); + } + + try { + model.addSpecies(s3); + fail("We should not be able to register twice the same metaid."); + } catch (IllegalArgumentException e) { + assertTrue(true); + // success + } + } + + /** + * + */ + @Test public void testRegister3() { + + Reaction r2 = new Reaction(2,4); + KineticLaw k = r2.createKineticLaw(); + + k.createLocalParameter("LP1"); + + // We should not be allowed to register an other local parameter with the same id + try { + k.createLocalParameter("LP1"); + // fail("We should not be able to add a local parameter with the same id as an other local parameter in the same kineticLaw."); + } catch (IdentifierException e) { + // success + } + + assertTrue(k.getLocalParameterCount() == 1); + + } + + /** + * + */ + @Test public void testRegister4() { + + assertTrue(model.getId().equals("model")); + assertTrue(model.getNumSpecies() == 2); + + // We should be allowed to change an id ! + model.setId("newModelID"); + + try { + // fail("We should not be able to add a local parameter with the same id as an other local parameter in the same kineticLaw."); + } catch (IdentifierException e) { + // success + } + + assertTrue(model.getId().equals("newModelID")); + + } + + + /** + * + */ + @Test public void testUnRegister() { + + + Reaction r1 = model.removeReaction("R1"); + + assertTrue(model.getReaction("R1") == null); + assertTrue(model.getReaction(0) == null); + assertTrue(model.findNamedSBase("SP1") == null); + assertTrue(model.findNamedSBase("SP2") == null); + // assertTrue(model.findNamedSBase("LP1") == null); + assertTrue(doc.findSBase("SP1") == null); + assertTrue(doc.findSBase("R1") == null); + assertTrue(doc.findSBase("LP1") == null); + + Species s3 = new Species(); + + // Setting the same id as a removed SpeciesReference + s3.setId("SP1"); + + // Setting the same metaid as a removed LocalParameter + try { + s3.setMetaId("LP1"); + assertTrue(true); + } catch (IdentifierException e) { + fail("We should be able to put any metaId to a Species not linked to a model."); + } + + try { + model.addSpecies(s3); + assertTrue(true); + } catch (IllegalArgumentException e) { + fail("We should be able to register an id or metaid from a removed element."); + // success + } + + try { + SpeciesReference reactant = r1.createReactant("S1"); + reactant.setMetaId("S1"); + } catch (IllegalArgumentException e) { + fail("We should be able to put any id to an element removed from a model."); + } catch (IdentifierException e) { + fail("We should be able to put any id to an element removed from a model."); + } + } + + /** + * + */ + @Test public void testUnRegister2() { + + Reaction r1 = model.removeReaction("R1"); + + assertTrue(r1.getReactant("SP1") != null); + + assertTrue(model.findNamedSBase("LP1") == null); + } + +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nik...@us...> - 2012-06-01 09:11:51
|
Revision: 1277 http://jsbml.svn.sourceforge.net/jsbml/?rev=1277&view=rev Author: niko-rodrigue Date: 2012-06-01 09:11:42 +0000 (Fri, 01 Jun 2012) Log Message: ----------- corrected the parser to be able to read invalid notes, anything inside the notes element will be read even if not in the html namespace Modified Paths: -------------- trunk/core/src/org/sbml/jsbml/xml/parsers/StringParser.java trunk/core/src/org/sbml/jsbml/xml/stax/SBMLReader.java Modified: trunk/core/src/org/sbml/jsbml/xml/parsers/StringParser.java =================================================================== --- trunk/core/src/org/sbml/jsbml/xml/parsers/StringParser.java 2012-06-01 07:09:43 UTC (rev 1276) +++ trunk/core/src/org/sbml/jsbml/xml/parsers/StringParser.java 2012-06-01 09:11:42 UTC (rev 1277) @@ -194,6 +194,13 @@ { logger.debug("processStartElement : element name = " + elementName); + if (elementName.equals("notes") + && (contextObject instanceof SBase)) { + SBase sbase = (SBase) contextObject; + sbase.setNotes(new XMLNode(new XMLTriple("notes", null, null), new XMLAttributes())); + return contextObject; + } + // Creating a StartElement XMLNode !! XMLNode xmlNode = new XMLNode(new XMLTriple(elementName, null, prefix), new XMLAttributes(), new XMLNamespaces()); Modified: trunk/core/src/org/sbml/jsbml/xml/stax/SBMLReader.java =================================================================== --- trunk/core/src/org/sbml/jsbml/xml/stax/SBMLReader.java 2012-06-01 07:09:43 UTC (rev 1276) +++ trunk/core/src/org/sbml/jsbml/xml/stax/SBMLReader.java 2012-06-01 09:11:42 UTC (rev 1277) @@ -665,7 +665,8 @@ logger.debug("startElement : isRDFSBMLSpecificAnnotation = " + isRDFSBMLSpecificAnnotation); } - parser = processStartElement(startElement, currentNode, isHTML, sbmlElements, annotationDeepness, isRDFSBMLSpecificAnnotation); + parser = processStartElement(startElement, currentNode, isHTML, sbmlElements, + isInsideNotes, annotationDeepness, isRDFSBMLSpecificAnnotation); lastElement = sbmlElements.peek(); } @@ -765,7 +766,8 @@ } SBMLDocument sbmlDocument = processEndElement(currentNode, isNested, isText, isHTML, - level, version, parser, sbmlElements, annotationDeepness, isRDFSBMLSpecificAnnotation); + level, version, parser, sbmlElements, isInsideNotes, annotationDeepness, + isRDFSBMLSpecificAnnotation); if (sbmlDocument != null) { return sbmlDocument; @@ -845,7 +847,8 @@ * @return */ private ReadingParser processStartElement(StartElement startElement, QName currentNode, - Boolean isHTML, Stack<Object> sbmlElements, int annotationDeepness, boolean isRDFSBMLspecificAnnotation) + Boolean isHTML, Stack<Object> sbmlElements, boolean isInsideNotes, + int annotationDeepness, boolean isRDFSBMLspecificAnnotation) { Logger logger = Logger.getLogger(SBMLReader.class); ReadingParser parser = null; @@ -909,6 +912,13 @@ parser = initializedParsers.get("anyAnnotation"); } + // Whatever is the namespace, if we are inside notes + // we send the element to the HTML parser. + // This allow to read some invalid notes correctly, so that + // we can correct them. + if (isInsideNotes) { + parser = initializedParsers.get(JSBML.URI_XHTML_DEFINITION); + } // All the subNodes of SBML are processed. if (!currentNode.getLocalPart().equals("sbml")) { Object processedElement = parser.processStartElement(currentNode.getLocalPart(), @@ -926,7 +936,8 @@ processNamespaces(nam, currentNode,sbmlElements, parser, hasAttributes); // Process the attributes - processAttributes(att, currentNode, sbmlElements, parser, hasAttributes, annotationDeepness, isRDFSBMLspecificAnnotation); + processAttributes(att, currentNode, sbmlElements, parser, hasAttributes, isInsideNotes, + annotationDeepness, isRDFSBMLspecificAnnotation); } else { logger.warn(String.format("Cannot find a parser for the %s namespace", elementNamespace)); @@ -1001,7 +1012,7 @@ */ private void processAttributes(Iterator<Attribute> att, QName currentNode, Stack<Object> sbmlElements, ReadingParser parser, boolean hasAttributes, - int annotationDeepness, boolean isRDFSBMLSpecificAnnotation) + boolean isInsideNotes, int annotationDeepness, boolean isRDFSBMLSpecificAnnotation) { Logger logger = Logger.getLogger(SBMLReader.class); ReadingParser attributeParser = null; @@ -1033,8 +1044,12 @@ { // This is probably a mistake in the annotation // Sending it to the any parser - parser = initializedParsers.get("anyAnnotation"); + attributeParser = initializedParsers.get("anyAnnotation"); } + else if (isInsideNotes) + { + attributeParser = initializedParsers.get(JSBML.URI_XHTML_DEFINITION); + } else { attributeParser = initializedParsers.get(attributeNamespaceURI); @@ -1073,7 +1088,9 @@ */ private SBMLDocument processEndElement(QName currentNode, Boolean isNested, Boolean isText, Boolean isHTML, int level, int version, ReadingParser parser, - Stack<Object> sbmlElements, int annotationDeepness, boolean isRDFSBMLSpecificAnnotation) { + Stack<Object> sbmlElements, boolean isInsideNotes, int annotationDeepness, + boolean isRDFSBMLSpecificAnnotation) + { Logger logger = Logger.getLogger(SBMLReader.class); if (logger.isDebugEnabled()) { @@ -1112,6 +1129,10 @@ { parser = initializedParsers.get("anyAnnotation"); } + if (isInsideNotes) { + parser = initializedParsers.get(JSBML.URI_XHTML_DEFINITION); + } + // if the current node is a notes or message element and // the matching ReadingParser is a StringParser, we need // to reset the typeOfNotes variable of the This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <and...@us...> - 2012-06-01 07:09:55
|
Revision: 1276 http://jsbml.svn.sourceforge.net/jsbml/?rev=1276&view=rev Author: andreas-draeger Date: 2012-06-01 07:09:43 +0000 (Fri, 01 Jun 2012) Log Message: ----------- Minor code corrections. Modified Paths: -------------- trunk/extensions/render/src/org/sbml/jsbml/ext/render/AbstractRenderPlugin.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/ColorDefinition.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/Curve.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/Ellipse.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/ExtendedRenderModel.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/FontFamily.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/FontRenderStyle.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/GlobalRenderInformation.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/GradientBase.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/GradientStop.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/GraphicalPrimitive1D.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/GraphicalPrimitive2D.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/Group.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/Image.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/LineEnding.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/LinearGradient.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/LocalRenderInformation.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/LocalStyle.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/Point3D.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/Polygon.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/RadialGradient.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/Rectangle.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderConstants.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderCubicBezier.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderInformationBase.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderLayoutPlugin.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderModelPlugin.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderPoint.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/Style.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/Text.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/TextAnchor.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/Transformation.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/Transformation2D.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/VTextAnchor.java Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/AbstractRenderPlugin.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/AbstractRenderPlugin.java 2012-05-31 19:16:51 UTC (rev 1275) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/AbstractRenderPlugin.java 2012-06-01 07:09:43 UTC (rev 1276) @@ -24,7 +24,6 @@ import javax.swing.tree.TreeNode; -import org.sbml.jsbml.PropertyUndefinedError; import org.sbml.jsbml.SBase; import org.sbml.jsbml.ext.AbstractSBasePlugin; Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/ColorDefinition.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/ColorDefinition.java 2012-05-31 19:16:51 UTC (rev 1275) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/ColorDefinition.java 2012-06-01 07:09:43 UTC (rev 1276) @@ -87,9 +87,10 @@ } - /** - * clones this class + /* (non-Javadoc) + * @see org.sbml.jsbml.AbstractSBase#clone() */ + //@Override public ColorDefinition clone() { return new ColorDefinition(this); } @@ -157,6 +158,10 @@ return false; } + /* (non-Javadoc) + * @see org.sbml.jsbml.AbstractSBase#toString() + */ + //@Override public String toString() { // TODO Auto-generated method stub return null; Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/Curve.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/Curve.java 2012-05-31 19:16:51 UTC (rev 1275) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/Curve.java 2012-06-01 07:09:43 UTC (rev 1276) @@ -60,16 +60,18 @@ listOfElements = obj.listOfElements; } - /** - * clones this class + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.render.GraphicalPrimitive1D#clone() */ + @Override public Curve clone() { return new Curve(this); } - /** - * Initializes the default values using the namespace. + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.render.GraphicalPrimitive1D#initDefaults() */ + @Override public void initDefaults() { addNamespace(RenderConstants.namespaceURI); } @@ -252,4 +254,5 @@ addElement(element); return element; } + } Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/Ellipse.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/Ellipse.java 2012-05-31 19:16:51 UTC (rev 1275) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/Ellipse.java 2012-06-01 07:09:43 UTC (rev 1276) @@ -462,4 +462,5 @@ } return false; } + } Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/ExtendedRenderModel.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/ExtendedRenderModel.java 2012-05-31 19:16:51 UTC (rev 1275) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/ExtendedRenderModel.java 2012-06-01 07:09:43 UTC (rev 1276) @@ -24,7 +24,6 @@ import java.util.Map; import org.sbml.jsbml.ListOf; -import org.sbml.jsbml.Model; import org.sbml.jsbml.SBase; import org.sbml.jsbml.ext.AbstractSBasePlugin; @@ -51,11 +50,6 @@ protected int versionMinor; /** - * - */ - private Model model; - - /** * Creates an ExtendedRenderModel instance */ public ExtendedRenderModel() { @@ -128,6 +122,7 @@ versionMinor = 0; } + // TODO: Move to RenderConstants public static final int MIN_SBML_LEVEL = 3; public static final int MIN_SBML_VERSION = 1; @@ -401,13 +396,18 @@ return localRenderInformation; } - - - @Override + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.SBasePlugin#getAllowsChildren() + */ + //@Override public boolean getAllowsChildren() { return true; } + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.SBasePlugin#getChildCount() + */ + //@Override public int getChildCount() { int count = 0; @@ -421,6 +421,10 @@ return count; } + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.SBasePlugin#getChildAt(int) + */ + //@Override public SBase getChildAt(int childIndex) { if (childIndex < 0) { throw new IndexOutOfBoundsException(childIndex + " < 0"); @@ -445,16 +449,23 @@ +((int) Math.min(pos, 0)))); } - @Override + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.SBasePlugin#readAttribute(java.lang.String, java.lang.String, java.lang.String) + */ + //@Override public boolean readAttribute(String attributeName, String prefix, String value) { // TODO Auto-generated method stub return false; } - @Override + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.SBasePlugin#writeXMLAttributes() + */ + //@Override public Map<String, String> writeXMLAttributes() { // TODO Auto-generated method stub return null; } + } Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/FontFamily.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/FontFamily.java 2012-05-31 19:16:51 UTC (rev 1275) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/FontFamily.java 2012-06-01 07:09:43 UTC (rev 1276) @@ -28,7 +28,16 @@ * @date 16.05.2012 */ public enum FontFamily { - serif, - sans_serif, - monospace, + /** + * + */ + serif, + /** + * + */ + sans_serif, + /** + * + */ + monospace; } Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/FontRenderStyle.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/FontRenderStyle.java 2012-05-31 19:16:51 UTC (rev 1275) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/FontRenderStyle.java 2012-06-01 07:09:43 UTC (rev 1276) @@ -33,19 +33,16 @@ */ public abstract FontFamily getFontFamily(); - /** * @return whether fontFamily is set */ public abstract boolean isSetFontFamily(); - /** * Set the value of fontFamily */ public abstract void setFontFamily(FontFamily fontFamily); - /** * Unsets the variable fontFamily * @return <code>true</code>, if fontFamily was set before, @@ -53,25 +50,21 @@ */ public abstract boolean unsetFontFamily(); - /** * @return the value of fontSize */ public abstract short getFontSize(); - /** * @return whether fontSize is set */ public abstract boolean isSetFontSize(); - /** * Set the value of fontSize */ public abstract void setFontSize(short fontSize); - /** * Unsets the variable fontSize * @return <code>true</code>, if fontSize was set before, @@ -79,25 +72,21 @@ */ public abstract boolean unsetFontSize(); - /** * @return the value of fontWeightBold */ public abstract boolean isFontWeightBold(); - /** * @return whether fontWeightBold is set */ public abstract boolean isSetFontWeightBold(); - /** * Set the value of fontWeightBold */ public abstract void setFontWeightBold(boolean fontWeightBold); - /** * Unsets the variable fontWeightBold * @return <code>true</code>, if fontWeightBold was set before, @@ -105,25 +94,21 @@ */ public abstract boolean unsetFontWeightBold(); - /** * @return the value of fontStyleItalic */ public abstract boolean isFontStyleItalic(); - /** * @return whether fontStyleItalic is set */ public abstract boolean isSetFontStyleItalic(); - /** * Set the value of fontStyleItalic */ public abstract void setFontStyleItalic(boolean fontStyleItalic); - /** * Unsets the variable fontStyleItalic * @return <code>true</code>, if fontStyleItalic was set before, @@ -131,25 +116,21 @@ */ public abstract boolean unsetFontStyleItalic(); - /** * @return the value of textAnchor */ public abstract TextAnchor getTextAnchor(); - /** * @return whether textAnchor is set */ public abstract boolean isSetTextAnchor(); - /** * Set the value of textAnchor */ public abstract void setTextAnchor(TextAnchor textAnchor); - /** * Unsets the variable textAnchor * @return <code>true</code>, if textAnchor was set before, @@ -157,25 +138,21 @@ */ public abstract boolean unsetTextAnchor(); - /** * @return the value of VTextAnchor */ public abstract VTextAnchor getVTextAnchor(); - /** * @return whether VTextAnchor is set */ public abstract boolean isSetVTextAnchor(); - /** * Set the value of VTextAnchor */ public abstract void setVTextAnchor(VTextAnchor vTextAnchor); - /** * Unsets the variable VTextAnchor * @return <code>true</code>, if VTextAnchor was set before, Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/GlobalRenderInformation.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/GlobalRenderInformation.java 2012-05-31 19:16:51 UTC (rev 1275) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/GlobalRenderInformation.java 2012-06-01 07:09:43 UTC (rev 1276) @@ -36,6 +36,16 @@ // TODO getter, setter, isset public class GlobalRenderInformation extends RenderInformationBase { /** + * + */ + private static final long serialVersionUID = 855680727119080659L; + + /** + * + */ + private ListOf<Style> listOfStyles; + + /** * Creates an GlobalRenderInformation instance */ public GlobalRenderInformation() { @@ -43,18 +53,14 @@ initDefaults(); } - /** - * Creates a GlobalRenderInformation instance with an id. - * - * @param id + * Clone constructor */ - public GlobalRenderInformation(String id) { - super(id); - initDefaults(); + public GlobalRenderInformation(GlobalRenderInformation obj) { + super(obj); + listOfStyles = obj.listOfStyles; } - /** * Creates a GlobalRenderInformation instance with a level and version. * @@ -65,9 +71,18 @@ this(null, null, level, version); } + /** + * Creates a {@link GlobalRenderInformation} instance with an id. + * + * @param id + */ + public GlobalRenderInformation(String id) { + super(id); + initDefaults(); + } /** - * Creates a GlobalRenderInformation instance with an id, level, and version. + * Creates a {@link GlobalRenderInformation} instance with an id, level, and version. * * @param id * @param level @@ -77,9 +92,8 @@ this(id, null, level, version); } - /** - * Creates a GlobalRenderInformation instance with an id, name, level, and version. + * Creates a {@link GlobalRenderInformation} instance with an id, name, level, and version. * * @param id * @param name @@ -95,39 +109,20 @@ initDefaults(); } - - /** - * Clone constructor + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.render.RenderInformationBase#clone() */ - public GlobalRenderInformation(GlobalRenderInformation obj) { - super(obj); - listOfStyles = obj.listOfStyles; - } - - - /** - * clones this class - */ @Override public GlobalRenderInformation clone() { return new GlobalRenderInformation(this); } - - - /** - * Initializes the default values using the namespace. + + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.render.RenderInformationBase#initDefaults() */ @Override public void initDefaults() { addNamespace(RenderConstants.namespaceURI); } - - /** - * - */ - private static final long serialVersionUID = 855680727119080659L; - ListOf<Style> listOfStyles; - - } Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/GradientBase.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/GradientBase.java 2012-05-31 19:16:51 UTC (rev 1275) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/GradientBase.java 2012-06-01 07:09:43 UTC (rev 1276) @@ -44,7 +44,16 @@ */ private static final long serialVersionUID = -3921074024567604440L; - + /** + * + * @author Eugen Netz + * @author Alexander Diamantikos + * @author Jakob Matthes + * @author Jan Rudolph + * @version $Rev$ + * @since 1.0 + * @date 08.05.2012 + */ protected enum Spread { pad, reflect, @@ -54,10 +63,8 @@ protected String id; protected Spread spreadMethod; protected ListOf<GradientStop> listOfGradientStops; + - - - /** * Creates an GradientBase instance */ @@ -66,7 +73,6 @@ initDefaults(); } - /** * Creates a GradientBase instance with an id. * @@ -76,7 +82,7 @@ this.id = id; initDefaults(); this.listOfGradientStops.add(stop); - } + } /** * Creates a GradientBase instance with an id, name, level, and version. @@ -96,13 +102,17 @@ this.listOfGradientStops.add(stop); } - + /* (non-Javadoc) + * @see org.sbml.jsbml.AbstractSBase#getAllowsChildren() + */ @Override public boolean getAllowsChildren() { return false; } - + /* (non-Javadoc) + * @see org.sbml.jsbml.AbstractSBase#getChildCount() + */ @Override public int getChildCount() { int count = 0; @@ -112,7 +122,9 @@ return count; } - + /* (non-Javadoc) + * @see org.sbml.jsbml.AbstractSBase#getChildAt(int) + */ @Override public SBase getChildAt(int childIndex) { if (childIndex < 0) { @@ -140,15 +152,14 @@ this.listOfGradientStops = obj.listOfGradientStops; } - - /** - * clones this class + /* (non-Javadoc) + * @see org.sbml.jsbml.AbstractSBase#clone() */ + //@Override public GradientBase clone() { return new GradientBase(this); } - /** * Initializes the default values using the namespace. */ @@ -158,7 +169,6 @@ this.listOfGradientStops = new ListOf<GradientStop>(); } - /** * @return the value of id */ @@ -175,7 +185,6 @@ firePropertyChange(RenderConstants.id, oldId, this.id); } - /** * @return the value of spreadMethod */ @@ -187,7 +196,6 @@ } } - /** * @return whether spreadMethod is set */ @@ -195,7 +203,6 @@ return this.spreadMethod != null; } - /** * Set the value of spreadMethod */ @@ -205,7 +212,6 @@ firePropertyChange(RenderConstants.spreadMethod, oldSpreadMethod, this.spreadMethod); } - /** * Unsets the variable spreadMethod * @return <code>true</code>, if spreadMethod was set before, @@ -221,12 +227,15 @@ return false; } + /* (non-Javadoc) + * @see org.sbml.jsbml.AbstractSBase#toString() + */ + //@Override public String toString() { // TODO Auto-generated method stub return null; } - - + /** * @return <code>true</code>, if listOfGradientStops contains at least one element, * otherwise <code>false</code> @@ -238,7 +247,6 @@ return true; } - /** * @return the listOfGradientStops */ @@ -252,7 +260,6 @@ return listOfGradientStops; } - /** * @param listOfGradientStops */ @@ -262,7 +269,6 @@ registerChild(this.listOfGradientStops); } - /** * @return <code>true</code>, if listOfGradientStops contained at least one element, * otherwise <code>false</code> @@ -277,7 +283,6 @@ return false; } - /** * @param field */ @@ -285,7 +290,6 @@ return getListOfGradientStops().add(field); } - /** * @param field */ @@ -296,7 +300,6 @@ return false; } - /** * @param i */ @@ -307,7 +310,6 @@ getListOfGradientStops().remove(i); } - /** * create a new GradientStop element and adds it to the ListOfGradientStops list */ @@ -316,4 +318,5 @@ addGradientStop(field); return field; } + } Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/GradientStop.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/GradientStop.java 2012-05-31 19:16:51 UTC (rev 1275) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/GradientStop.java 2012-06-01 07:09:43 UTC (rev 1276) @@ -88,22 +88,25 @@ this.stopColor = obj.stopColor; } - - /** - * clones this class + /* (non-Javadoc) + * @see org.sbml.jsbml.AbstractSBase#clone() */ + //@Override public GradientStop clone() { return new GradientStop(this); } - + /* (non-Javadoc) + * @see org.sbml.jsbml.AbstractSBase#getAllowsChildren() + */ @Override public boolean getAllowsChildren() { return false; } - - + /* (non-Javadoc) + * @see org.sbml.jsbml.AbstractSBase#getChildAt(int) + */ @Override public SBase getChildAt(int childIndex) { if (childIndex < 0) { @@ -115,6 +118,9 @@ +((int) Math.min(pos, 0)))); } + /* (non-Javadoc) + * @see org.sbml.jsbml.AbstractSBase#getChildCount() + */ @Override public int getChildCount() { return 0; @@ -142,7 +148,6 @@ throw new PropertyUndefinedError(RenderConstants.stopColor, this); } - /** * @return whether offset is set */ @@ -190,7 +195,6 @@ return false; } - /** * Unsets the variable stopColor * @return <code>true</code>, if stopColor was set before, @@ -206,7 +210,10 @@ return false; } - @Override + /* (non-Javadoc) + * @see org.sbml.jsbml.AbstractSBase#toString() + */ + //@Override public String toString() { // TODO Auto-generated method stub return null; Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/GraphicalPrimitive1D.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/GraphicalPrimitive1D.java 2012-05-31 19:16:51 UTC (rev 1275) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/GraphicalPrimitive1D.java 2012-06-01 07:09:43 UTC (rev 1276) @@ -40,8 +40,6 @@ * */ private static final long serialVersionUID = 3705246334810811216L; - public static final int MIN_SBML_LEVEL = 3; - public static final int MIN_SBML_VERSION = 1; protected ColorDefinition stroke; protected Short[] strokeDashArray; protected Integer strokeWidth; @@ -100,7 +98,6 @@ initDefaults(); } - /** * Clone constructor */ @@ -111,21 +108,25 @@ strokeDashArray = obj.strokeDashArray; } - - /** - * clones this class + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.render.Transformation2D#clone() */ + @Override public GraphicalPrimitive1D clone() { return new GraphicalPrimitive1D(this); } - + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.render.Transformation#getAllowsChildren() + */ @Override public boolean getAllowsChildren() { return false; } - + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.render.Transformation#getChildAt(int) + */ @Override public SBase getChildAt(int childIndex) { if (childIndex < 0) { @@ -137,13 +138,14 @@ +((int) Math.min(pos, 0)))); } - + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.render.Transformation#getChildCount() + */ @Override public int getChildCount() { return 0; } - /** * @return the value of stroke */ @@ -166,15 +168,14 @@ throw new PropertyUndefinedError(RenderConstants.strokeWidth, this); } - - /** - * Initializes the default values using the namespace. + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.render.Transformation2D#initDefaults() */ + @Override public void initDefaults() { addNamespace(RenderConstants.namespaceURI); } - /** * @return whether stroke is set */ Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/GraphicalPrimitive2D.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/GraphicalPrimitive2D.java 2012-05-31 19:16:51 UTC (rev 1275) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/GraphicalPrimitive2D.java 2012-06-01 07:09:43 UTC (rev 1276) @@ -60,26 +60,23 @@ fill = obj.fill; fillRule = obj.fillRule; } - - /** - * clones this class + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.render.GraphicalPrimitive1D#clone() */ @Override public GraphicalPrimitive2D clone() { return new GraphicalPrimitive2D(this); } - - /** - * Initializes the default values using the namespace. + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.render.GraphicalPrimitive1D#initDefaults() */ @Override public void initDefaults() { addNamespace(RenderConstants.namespaceURI); } - /** * @return the value of fill */ @@ -91,7 +88,6 @@ throw new PropertyUndefinedError(RenderConstants.fill, this); } - /** * @return whether fill is set */ @@ -99,7 +95,6 @@ return this.fill != null; } - /** * Set the value of fill */ @@ -109,7 +104,6 @@ firePropertyChange(RenderConstants.fill, oldFill, this.fill); } - /** * Unsets the variable fill * @return <code>true</code>, if fill was set before, @@ -124,9 +118,7 @@ } return false; } - - - + /** * @return the value of fillRule */ @@ -138,7 +130,6 @@ throw new PropertyUndefinedError(RenderConstants.fillRule, this); } - /** * @return whether fillRule is set */ @@ -146,7 +137,6 @@ return this.fillRule != null; } - /** * Set the value of fillRule */ @@ -156,7 +146,6 @@ firePropertyChange(RenderConstants.fillRule, oldFillRule, this.fillRule); } - /** * Unsets the variable fillRule * @return <code>true</code>, if fillRule was set before, @@ -171,10 +160,5 @@ } return false; } - - - - public static final int MIN_SBML_LEVEL = 3; - public static final int MIN_SBML_VERSION = 1; } Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/Group.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/Group.java 2012-05-31 19:16:51 UTC (rev 1275) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/Group.java 2012-06-01 07:09:43 UTC (rev 1276) @@ -101,8 +101,8 @@ public Group(String id, String name, int level, int version) { super(); this.id = id; - if (getLevelAndVersion().compareTo(Integer.valueOf(MIN_SBML_LEVEL), - Integer.valueOf(MIN_SBML_VERSION)) < 0) { + if (getLevelAndVersion().compareTo(Integer.valueOf(RenderConstants.MIN_SBML_LEVEL), + Integer.valueOf(RenderConstants.MIN_SBML_VERSION)) < 0) { throw new LevelVersionError(getElementName(), level, version); } initDefaults(); @@ -124,35 +124,43 @@ this.endHead = obj.endHead; } - /** - * clones this class + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.render.GraphicalPrimitive2D#clone() */ + @Override public Group clone() { return new Group(this); } - /** - * Initializes the default values using the namespace. + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.render.GraphicalPrimitive2D#initDefaults() */ + @Override public void initDefaults() { addNamespace(RenderConstants.namespaceURI); } - public static final int MIN_SBML_LEVEL = 3; - public static final int MIN_SBML_VERSION = 1; - - - + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.render.GraphicalPrimitive1D#getAllowsChildren() + */ @Override public boolean getAllowsChildren() { return false; } + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.render.GraphicalPrimitive1D#getChildCount() + */ + @Override public int getChildCount() { int count = 0; return count; } + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.render.GraphicalPrimitive1D#getChildAt(int) + */ + @Override public SBase getChildAt(int childIndex) { if (childIndex < 0) { throw new IndexOutOfBoundsException(childIndex + " < 0"); @@ -162,7 +170,6 @@ "Index {0,number,integer} >= {1,number,integer}", childIndex, +((int) Math.min(pos, 0)))); } - /** * @return the value of id @@ -205,8 +212,7 @@ } return false; } - - + /** * @return the value of fontFamily */ @@ -248,8 +254,7 @@ } return false; } - - + /** * @return the value of fontSize */ @@ -291,8 +296,7 @@ } return false; } - - + /** * @return the value of fontWeightBold */ @@ -334,8 +338,7 @@ } return false; } - - + /** * @return the value of fontStyleItalic */ @@ -377,8 +380,7 @@ } return false; } - - + /** * @return the value of startHead */ @@ -420,8 +422,7 @@ } return false; } - - + /** * @return the value of endHead */ @@ -464,7 +465,6 @@ return false; } - /** * @return the value of textAnchor */ @@ -506,8 +506,7 @@ } return false; } - - + /** * @return the value of vTextAnchor */ @@ -549,4 +548,5 @@ } return false; } + } Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/Image.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/Image.java 2012-05-31 19:16:51 UTC (rev 1275) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/Image.java 2012-06-01 07:09:43 UTC (rev 1276) @@ -82,37 +82,43 @@ z = obj.z; } - /** - * clones this class + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.render.Transformation2D#clone() */ + @Override public Image clone() { return new Image(this); } - /** - * Initializes the default values using the namespace. + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.render.Transformation2D#initDefaults() */ + @Override public void initDefaults() { addNamespace(RenderConstants.namespaceURI); z = 0d; } - public static final int MIN_SBML_LEVEL = 3; - public static final int MIN_SBML_VERSION = 1; - - - + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.render.Transformation#getAllowsChildren() + */ @Override public boolean getAllowsChildren() { return false; } - + + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.render.Transformation#getChildCount() + */ @Override public int getChildCount() { int count = 0; return count; } + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.render.Transformation#getChildAt(int) + */ @Override public SBase getChildAt(int childIndex) { if (childIndex < 0) { @@ -124,7 +130,6 @@ +((int) Math.min(pos, 0)))); } - /** * @return the value of absoluteHeight */ @@ -208,8 +213,7 @@ } return false; } - - + /** * @return the value of absoluteX */ @@ -251,8 +255,7 @@ } return false; } - - + /** * @return the value of absoluteY */ @@ -294,8 +297,7 @@ } return false; } - - + /** * @return the value of absoluteZ */ @@ -337,8 +339,7 @@ } return false; } - - + /** * @return the value of height */ @@ -380,8 +381,7 @@ } return false; } - - + /** * @return the value of href */ @@ -423,8 +423,7 @@ } return false; } - - + /** * @return the value of width */ @@ -466,8 +465,7 @@ } return false; } - - + /** * @return the value of x */ @@ -509,8 +507,7 @@ } return false; } - - + /** * @return the value of y */ @@ -552,8 +549,7 @@ } return false; } - - + /** * @return the value of z */ @@ -595,4 +591,5 @@ } return false; } + } Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/LineEnding.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/LineEnding.java 2012-05-31 19:16:51 UTC (rev 1275) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/LineEnding.java 2012-06-01 07:09:43 UTC (rev 1276) @@ -63,16 +63,16 @@ group = obj.group; } - /** - * clones this class + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.render.GraphicalPrimitive2D#clone() */ @Override public LineEnding clone() { return new LineEnding(this); } - /** - * Initializes the default values using the namespace. + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.render.GraphicalPrimitive2D#initDefaults() */ @Override public void initDefaults() { @@ -80,20 +80,26 @@ enableRotationMapping = true; } - public static final int MIN_SBML_LEVEL = 3; - public static final int MIN_SBML_VERSION = 1; - - - + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.render.GraphicalPrimitive1D#getAllowsChildren() + */ @Override public boolean getAllowsChildren() { return false; } + + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.render.GraphicalPrimitive1D#getChildCount() + */ @Override public int getChildCount() { int count = 0; return count; } + + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.render.GraphicalPrimitive1D#getChildAt(int) + */ @Override public SBase getChildAt(int childIndex) { if (childIndex < 0) { @@ -104,8 +110,7 @@ "Index {0,number,integer} >= {1,number,integer}", childIndex, +((int) Math.min(pos, 0)))); } - - + /** * @return the value of boundingBox */ @@ -147,8 +152,7 @@ } return false; } - - + /** * @return the value of group */ @@ -190,8 +194,7 @@ } return false; } - - + /** * @return the value of enableRotationMapping */ @@ -220,7 +223,7 @@ } /** - * Unsets the variable enableRotationMapping + * Unsets the variable {@link #enableRotationMapping} * @return <code>true</code>, if enableRotationMapping was set before, * otherwise <code>false</code> */ @@ -233,4 +236,5 @@ } return false; } + } Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/LinearGradient.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/LinearGradient.java 2012-05-31 19:16:51 UTC (rev 1275) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/LinearGradient.java 2012-06-01 07:09:43 UTC (rev 1276) @@ -63,16 +63,16 @@ z2 = obj.z2; } - /** - * clones this class + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.render.GradientBase#clone() */ @Override public LinearGradient clone() { return new LinearGradient(this); } - /** - * Initializes the default values using the namespace. + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.render.GradientBase#initDefaults() */ @Override public void initDefaults() { @@ -85,22 +85,26 @@ z2 = 1d; } - public static final int MIN_SBML_LEVEL = 3; - public static final int MIN_SBML_VERSION = 1; - - - + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.render.GradientBase#getAllowsChildren() + */ @Override public boolean getAllowsChildren() { return false; } + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.render.GradientBase#getChildCount() + */ @Override public int getChildCount() { int count = 0; return count; } + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.render.GradientBase#getChildAt(int) + */ @Override public SBase getChildAt(int childIndex) { if (childIndex < 0) { @@ -112,7 +116,6 @@ +((int) Math.min(pos, 0)))); } - /** * @return the value of x1 */ @@ -154,8 +157,7 @@ } return false; } - - + /** * @return the value of x2 */ @@ -197,8 +199,7 @@ } return false; } - - + /** * @return the value of y1 */ @@ -241,7 +242,6 @@ return false; } - /** * @return the value of y2 */ @@ -283,8 +283,7 @@ } return false; } - - + /** * @return the value of z1 */ @@ -326,8 +325,7 @@ } return false; } - - + /** * @return the value of z2 */ @@ -369,4 +367,5 @@ } return false; } + } Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/LocalRenderInformation.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/LocalRenderInformation.java 2012-05-31 19:16:51 UTC (rev 1275) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/LocalRenderInformation.java 2012-06-01 07:09:43 UTC (rev 1276) @@ -49,7 +49,6 @@ initDefaults(); } - /** * Creates a LocalRenderInformation instance with an id. * @@ -60,7 +59,6 @@ initDefaults(); } - /** * Creates a LocalRenderInformation instance with a level and version. * @@ -71,7 +69,6 @@ this(null, null, level, version); } - /** * Creates a LocalRenderInformation instance with an id, level, and version. * @@ -83,7 +80,6 @@ this(id, null, level, version); } - /** * Creates a LocalRenderInformation instance with an id, name, level, and version. * @@ -101,7 +97,6 @@ initDefaults(); } - /** * Clone constructor */ @@ -110,25 +105,24 @@ this.listOfLocalStyles = obj.listOfLocalStyles; } - - /** - * clones this class + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.render.RenderInformationBase#clone() */ + @Override public LocalRenderInformation clone() { return new LocalRenderInformation(this); } - - /** - * Initializes the default values using the namespace. + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.render.RenderInformationBase#initDefaults() */ + @Override public void initDefaults() { //TODO //addNamespace(constant_class.namespaceURI); this.listOfLocalStyles = null; } - /** * @return <code>true</code>, if listOfLocalStyles contains at least one element, * otherwise <code>false</code> @@ -140,7 +134,6 @@ return true; } - /** * @return the listOfLocalStyles */ @@ -155,7 +148,6 @@ return listOfLocalStyles; } - /** * @param listOfLocalStyles */ @@ -165,7 +157,6 @@ registerChild(this.listOfLocalStyles); } - /** * @return <code>true</code>, if listOfLocalStyles contained at least one element, * otherwise <code>false</code> @@ -180,7 +171,6 @@ return false; } - /** * @param localStyle */ @@ -188,7 +178,6 @@ return getListOfLocalStyles().add(localStyle); } - /** * @param localStyle */ @@ -199,7 +188,6 @@ return false; } - /** * @param index */ @@ -210,10 +198,9 @@ getListOfLocalStyles().remove(i); } - - /** - * create a new LocalStyle element and adds it to the ListOfLocalStyles list - */ + //** + //* create a new LocalStyle element and adds it to the ListOfLocalStyles list + //*/ //TODO A Style needs a group /* public LocalStyle createLocalStyle(String id) { @@ -222,4 +209,5 @@ return field; } */ + } Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/LocalStyle.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/LocalStyle.java 2012-05-31 19:16:51 UTC (rev 1275) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/LocalStyle.java 2012-06-01 07:09:43 UTC (rev 1276) @@ -63,8 +63,7 @@ this.idList = new ArrayList<String>(); } - - /** + /** * Creates a LocalStyle instance with an id, name, level, and version. * * @param id @@ -77,14 +76,13 @@ this.idList = new ArrayList<String>(); } - /** * @return the value of idList */ public List<String> getIdList(){ return this.idList; } - + /** * Set the value of idList */ @@ -94,5 +92,5 @@ //TODO //firePropertyChange(constant_class.idList, oldIdList, this.idList); } - + } Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/Point3D.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/Point3D.java 2012-05-31 19:16:51 UTC (rev 1275) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/Point3D.java 2012-06-01 07:09:43 UTC (rev 1276) @@ -33,109 +33,91 @@ */ public abstract boolean isAbsoluteY(); - /** * @return the value of absoluteZ */ public abstract boolean isAbsoluteZ(); - /** * @return the value of x */ public abstract double getX(); - /** * @return the value of y */ public abstract double getY(); - /** * @return the value of z */ public abstract double getZ(); - /** * @return the value of absoluteX */ public abstract boolean isAbsoluteX(); - /** * @return whether absoluteX is set */ public abstract boolean isSetAbsoluteX(); - /** * @return whether absoluteY is set */ public abstract boolean isSetAbsoluteY(); - /** * @return whether absoluteZ is set */ public abstract boolean isSetAbsoluteZ(); - /** * @return whether x is set */ public abstract boolean isSetX(); - /** * @return whether y is set */ public abstract boolean isSetY(); - /** * @return whether z is set */ public abstract boolean isSetZ(); - /** * Set the value of absoluteX */ public abstract void setAbsoluteX(Boolean absoluteX); - /** * Set the value of absoluteY */ public abstract void setAbsoluteY(Boolean absoluteY); - /** * Set the value of absoluteZ */ public abstract void setAbsoluteZ(Boolean absoluteZ); - /** * Set the value of x */ public abstract void setX(Double x); - /** * Set the value of y */ public abstract void setY(Double y); - /** * Set the value of z */ public abstract void setZ(Double z); - /** * Unsets the variable absoluteX * @return <code>true</code>, if absoluteX was set before, @@ -143,7 +125,6 @@ */ public abstract boolean unsetAbsoluteX(); - /** * Unsets the variable absoluteY * @return <code>true</code>, if absoluteY was set before, @@ -151,7 +132,6 @@ */ public abstract boolean unsetAbsoluteY(); - /** * Unsets the variable absoluteZ * @return <code>true</code>, if absoluteZ was set before, @@ -159,7 +139,6 @@ */ public abstract boolean unsetAbsoluteZ(); - /** * Unsets the variable x * @return <code>true</code>, if x was set before, @@ -167,7 +146,6 @@ */ public abstract boolean unsetX(); - /** * Unsets the variable y * @return <code>true</code>, if y was set before, @@ -175,7 +153,6 @@ */ public abstract boolean unsetY(); - /** * Unsets the variable z * @return <code>true</code>, if z was set before, Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/Polygon.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/Polygon.java 2012-05-31 19:16:51 UTC (rev 1275) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/Polygon.java 2012-06-01 07:09:43 UTC (rev 1276) @@ -42,13 +42,11 @@ */ private static final long serialVersionUID = 9207043017589271103L; - public static final int MIN_SBML_LEVEL = 3; - - public static final int MIN_SBML_VERSION = 1; - + /** + * + */ private ListOf<RenderPoint> listOfElements; - /** * */ @@ -63,7 +61,6 @@ initDefaults(); } - /** * Clone constructor */ @@ -72,7 +69,6 @@ listOfElements = obj.listOfElements; } - /** * @param renderPoint */ @@ -80,21 +76,26 @@ return getListOfRenderPoints().add(renderPoint); } - - /** - * clones this class + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.render.GraphicalPrimitive2D#clone() */ + @Override public Polygon clone() { return new Polygon(this); } - + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.render.GraphicalPrimitive1D#getAllowsChildren() + */ @Override public boolean getAllowsChildren() { return true; } - + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.render.GraphicalPrimitive1D#getChildAt(int) + */ + @Override public SBase getChildAt(int childIndex) { if (childIndex < 0) { throw new IndexOutOfBoundsException(childIndex + " < 0"); @@ -111,7 +112,10 @@ +((int) Math.min(pos, 0)))); } - + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.render.GraphicalPrimitive1D#getChildCount() + */ + @Override public int getChildCount() { int count = 0; if (isSetListOfElements()) { @@ -120,7 +124,6 @@ return count; } - /** * @return the value of listOfElements */ @@ -132,7 +135,6 @@ throw new PropertyUndefinedError(RenderConstants.listOfElements, this); } - /** * @return the listOfRenderPoints */ @@ -146,15 +148,14 @@ return listOfRenderPoints; } - - /** - * Initializes the default values using the namespace. + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.render.GraphicalPrimitive2D#initDefaults() */ + @Override public void initDefaults() { addNamespace(RenderConstants.namespaceURI); } - /** * @return whether listOfElements is set */ @@ -162,7 +163,6 @@ return this.listOfElements != null; } - /** * @return <code>true</code>, if listOfRenderPoints contains at least one element, * otherwise <code>false</code> @@ -174,7 +174,6 @@ return true; } - /** * @param i */ @@ -204,7 +203,6 @@ firePropertyChange(RenderConstants.listOfElements, oldListOfElements, this.listOfElements); } - /** * @param listOfRenderPoints */ @@ -228,6 +226,7 @@ } return false; } + /** * @return <code>true</code>, if listOfRenderPoints contained at least one element, * otherwise <code>false</code> @@ -241,4 +240,5 @@ } return false; } + } Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/RadialGradient.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/RadialGradient.java 2012-05-31 19:16:51 UTC (rev 1275) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/RadialGradient.java 2012-06-01 07:09:43 UTC (rev 1276) @@ -38,8 +38,6 @@ * */ private static final long serialVersionUID = -6976786676644704255L; - public static final int MIN_SBML_LEVEL = 3; - public static final int MIN_SBML_VERSION = 1; private Boolean absoluteCx, absoluteCy, absoluteCz, absoluteR; private Boolean absoluteFx, absoluteFy, absoluteFz; @@ -55,7 +53,6 @@ initDefaults(); } - /** * Clone constructor */ @@ -77,15 +74,14 @@ absoluteFz = obj.absoluteFz; } - - /** - * clones this class + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.render.GradientBase#clone() */ + @Override public RadialGradient clone() { return new RadialGradient(this); } - /** * @return the value of cx */ @@ -97,7 +93,6 @@ throw new PropertyUndefinedError(RenderConstants.cx, this); } - /** * @return the value of cy */ @@ -109,7 +104,6 @@ throw new PropertyUndefinedError(RenderConstants.cy, this); } - /** * @return the value of cz */ @@ -121,7 +115,6 @@ throw new PropertyUndefinedError(RenderConstants.cz, this); } - /** * @return the value of fx */ @@ -133,7 +126,6 @@ throw new PropertyUndefinedError(RenderConstants.fx, this); } - /** * @return the value of fy */ @@ -145,7 +137,6 @@ throw new PropertyUndefinedError(RenderConstants.fy, this); } - /** * @return the value of fz */ @@ -157,7 +148,6 @@ throw new PropertyUndefinedError(RenderConstants.fz, this); } - /** * @return the value of r */ @@ -169,10 +159,10 @@ throw new PropertyUndefinedError(RenderConstants.r, this); } - - /** - * Initializes the default values using the namespace. + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.render.GradientBase#initDefaults() */ + @Override public void initDefaults() { addNamespace(RenderConstants.namespaceURI); cx = 0.5d; @@ -191,7 +181,6 @@ absoluteFz = false; } - /** * @return the value of absoluteCx */ @@ -203,7 +192,6 @@ throw new PropertyUndefinedError(RenderConstants.absoluteCx, this); } - /** * @return the value of absoluteCy */ @@ -215,7 +203,6 @@ throw new PropertyUndefinedError(RenderConstants.absoluteCy, this); } - /** * @return the value of absoluteCz */ @@ -227,7 +214,6 @@ throw new PropertyUndefinedError(RenderConstants.absoluteCz, this); } - /** * @return the value of absoluteFx */ @@ -239,7 +225,6 @@ throw new PropertyUndefinedError(RenderConstants.absoluteFx, this); } - /** * @return the value of absoluteFy */ @@ -251,7 +236,6 @@ throw new PropertyUndefinedError(RenderConstants.absoluteFy, this); } - /** * @return the value of absoluteFz */ @@ -263,7 +247,6 @@ throw new PropertyUndefinedError(RenderConstants.absoluteFz, this); } - /** * @return the value of absoluteR */ @@ -275,7 +258,6 @@ throw new PropertyUndefinedError(RenderConstants.absoluteR, this); } - /** * @return whether absoluteCx is set */ @@ -283,7 +265,6 @@ return this.absoluteCx != null; } - /** * @return whether absoluteCy is set */ @@ -291,7 +272,6 @@ return this.absoluteCy != null; } - /** * @return whether absoluteCz is set */ @@ -299,7 +279,6 @@ return this.absoluteCz != null; } - /** * @return whether absoluteFx is set */ @@ -307,7 +286,6 @@ return this.absoluteFx != null; } - /** * @return whether absoluteFy is set */ @@ -315,7 +293,6 @@ return this.absoluteFy != null; } - /** * @return whether absoluteFz is set */ @@ -323,7 +300,6 @@ return this.absoluteFz != null; } - /** * @return whether absoluteR is set */ @@ -331,15 +307,13 @@ return this.absoluteR != null; } - /** * @return whether cx is set */ public boolean isSetCx() { return this.cx != null; } - - + /** * @return whether cy is set */ @@ -347,7 +321,6 @@ return this.cy != null; } - /** * @return whether cz is set */ @@ -355,7 +328,6 @@ return this.cz != null; } - /** * @return whether fx is set */ @@ -363,7 +335,6 @@ return this.fx != null; } - /** * @return whether fy is set */ @@ -371,7 +342,6 @@ return this.fy != null; } - /** * @return whether fz is set */ @@ -379,7 +349,6 @@ return this.fz != null; } - /** * @return whether r is set */ @@ -387,7 +356,6 @@ return this.r != null; } - /** * Set the value of absoluteCx */ @@ -397,7 +365,6 @@ firePropertyChange(RenderConstants.absoluteCx, oldAbsoluteCx, this.absoluteCx); } - /** * Set the value of absoluteCy */ @@ -406,8 +373,7 @@ this.absoluteCy = absoluteCy; firePropertyChange(RenderConstants.absoluteCy, oldAbsoluteCy, this.absoluteCy); } - - + /** * Set the value of absoluteCz */ @@ -417,7 +383,6 @@ firePropertyChange(RenderConstants.absoluteCz, oldAbsoluteCz, this.absoluteCz); } - /** * Set the value of absoluteFx */ @@ -427,7 +392,6 @@ firePropertyChange(RenderConstants.absoluteFx, oldAbsoluteFx, this.absoluteFx); } - /** * Set the value of absoluteFy */ @@ -437,7 +401,6 @@ firePropertyChange(RenderConstants.absoluteFy, oldAbsoluteFy, this.absoluteFy); } - /** * Set the value of absoluteFz */ @@ -446,8 +409,7 @@ this.absoluteFz = absoluteFz; firePropertyChange(RenderConstants.absoluteFz, oldAbsoluteFz, this.absoluteFz); } - - + /** * Set the value of absoluteR */ @@ -457,7 +419,6 @@ firePropertyChange(RenderConstants.absoluteR, oldAbsoluteR, this.absoluteR); } - /** * Set the value of cx */ @@ -467,7 +428,6 @@ firePropertyChange(RenderConstants.cx, oldCx, this.cx); } - /** * Set the value of cy */ @@ -477,7 +437,6 @@ firePropertyChange(RenderConstants.cy, oldCy, this.cy); } - /** * Set the value of cz */ @@ -487,7 +446,6 @@ firePropertyChange(RenderConstants.cz, oldCz, this.cz); } - /** * Set the value of fx */ @@ -497,7 +455,6 @@ firePropertyChange(RenderConstants.fx, oldFx, this.fx); } - /** * Set the value of fy */ @@ -507,7 +464,6 @@ firePropertyChange(RenderConstants.fy, oldFy, this.fy); } - /** * Set the value of fz */ @@ -517,7 +473,6 @@ firePropertyChange(RenderConstants.fz, oldFz, this.fz); } - /** * Set the value of r */ @@ -527,7 +482,6 @@ firePropertyChange(RenderConstants.r, oldR, this.r); } - /** * Unsets the variable absoluteCx * @return <code>true</code>, if absoluteCx was set before, @@ -543,7 +497,6 @@ return false; } - /** * Unsets the variable absoluteCy * @return <code>true</code>, if absoluteCy was set before, @@ -559,7 +512,6 @@ return false; } - /** * Unsets the variable absoluteCz * @return <code>true</code>, if absoluteCz was set before, @@ -575,7 +527,6 @@ return false; } - /** * Unsets the variable absoluteFx * @return <code>true</code>, if absoluteFx was set before, @@ -591,7 +542,6 @@ return false; } - /** * Unsets the variable absoluteFy * @return <code>true</code>, if absoluteFy was set before, @@ -607,7 +557,6 @@ return false; } - /** * Unsets the variable absoluteFz * @return <code>true</code>, if absoluteFz was set before, @@ -623,7 +572,6 @@ return false; } - /** * Unsets the variable absoluteR * @return <code>true</code>, if absoluteR was set before, @@ -639,7 +587,6 @@ return false; } - /** * Unsets the variable cx * @return <code>true</code>, if cx was set before, @@ -655,7 +602,6 @@ return false; } - /** * Unsets the variable cy * @return <code>true</code>, if cy was set before, @@ -671,7 +617,6 @@ return false; } - /** * Unsets the variable cz * @return <code>true</code>, if cz was set before, @@ -687,7 +632,6 @@ return false; } - /** * Unsets the variable fx * @return <code>true</code>, if fx was set before, @@ -703,7 +647,6 @@ return false; } - /** * Unsets the variable fy * @return <code>true</code>, if fy was set before, @@ -733,6 +676,7 @@ } return false; } + /** * Unsets the variable r * @return <code>true</code>, if r was set before, @@ -747,4 +691,5 @@ } return false; } + } Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/Rectangle.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/Rectangle.java 2012-05-31 19:16:51 UTC (rev 1275) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/Rectangle.java 2012-06-01 07:09:43 UTC (rev 1276) @@ -46,9 +46,7 @@ private Boolean absoluteWidth, absoluteHeight; private Double rx, ry; private Boolean absoluteRx, absoluteRy; - - - + /** * @return the value of rx */ @@ -60,7 +58,6 @@ throw new PropertyUndefinedError(RenderConstants.rx, this); } - /** * @return whether rx is set */ @@ -68,7 +65,6 @@ return this.rx != null; } - /** * Set the value of rx */ @@ -78,7 +74,6 @@ firePropertyChange(RenderConstants.rx, oldRx, this.rx); } - /** * Unsets the variable rx * @return <code>true</code>, if rx was set before, @@ -94,7 +89,6 @@ return false; } - /** * @return the value of ry */ @@ -106,7 +100,6 @@ throw new PropertyUndefinedError(RenderConstants.ry, this); } - /** * @return whether ry is set */ @@ -114,7 +107,6 @@ return this.ry != null; } - /** * Set the value of ry */ @@ -124,9 +116,10 @@ firePropertyChange(RenderConstants.ry, oldRy, this.ry); } - /** - * @return the value of absoluteX + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.render.Point3D#isAbsoluteX() */ + //@Override public boolean isAbsoluteX() { if (isSetAbsoluteX()) { return absoluteX; @@ -135,30 +128,30 @@ throw new PropertyUndefinedError(RenderConstants.absoluteX, this); } - /** * @return whether absoluteX is set */ + //@Override public boolean isSetAbsoluteX() { return this.absoluteX != null; } - /** * Set the value of absoluteX */ + //@Override public void setAbsoluteX(Boolean absoluteX) { Boolean oldAbsoluteX = this.absoluteX; this.absoluteX = absoluteX; firePropertyChange(RenderConstants.absoluteX, oldAbsoluteX, this.absoluteX); } - /** * Unsets the variable absoluteX * @return <code>true</code>, if absoluteX was set before, * otherwise <code>false</code> */ + //@Override public boolean unsetAbsoluteX() { if (isSetAbsoluteX()) { Boolean oldAbsoluteX = this.absoluteX; @@ -169,10 +162,10 @@ return false; } - /** * @return the value of absoluteY */ + //@Override public boolean isAbsoluteY() { if (isSetAbsoluteY()) { return absoluteY; @@ -181,30 +174,30 @@ throw new PropertyUndefinedError(RenderConstants.absoluteY, this); } - /** * @return whether absoluteY is set */ + //@Override public boolean isSetAbsoluteY() { return this.absoluteY != null; } - /** * Set the value of absoluteY */ + //@Override public void setAbsoluteY(Boolean absoluteY) { Boolean oldAbsoluteY = this.absoluteY; this.absoluteY = absoluteY; firePropertyChange(RenderConstants.absoluteY, oldAbsoluteY, this.absoluteY); } - /** * Unsets the variable absoluteY * @return <code>true</code>, if absoluteY was set before, * otherwise <code>false</code> */ + //@Override public boolean unsetAbsoluteY() { if (isSetAbsoluteY()) { Boolean oldAbsoluteY = this.absoluteY; @@ -215,10 +208,10 @@ return false; } - /** * @return the value of absoluteZ */ + //@Override public boolean isAbsoluteZ() { if (isSetAbsoluteZ()) { return absoluteZ; @@ -227,30 +220,30 @@ throw new PropertyUndefinedError(RenderConstants.absoluteZ, this); } - /** * @return whether absoluteZ is set */ + //@Override public boolean isSetAbsoluteZ() { return this.absoluteZ != null; } - /** * Set the value of absoluteZ */ + //@Override public void setAbsoluteZ(Boolean absoluteZ) { Boolean oldAbsoluteZ = this.absoluteZ; this.absoluteZ = absoluteZ; firePropertyChange(RenderConstants.absoluteZ, oldAbsoluteZ, this.absoluteZ); } - /** * Unsets the variable absoluteZ * @return <code>true</code>, if absoluteZ was set before, * otherwise <code>false</code> */ + //@Override public boolean unsetAbsoluteZ() { if (isSetAbsoluteZ()) { Boolean oldAbsoluteZ = this.absoluteZ; @@ -260,9 +253,7 @@ } return false; } - - /** * @return the value of absoluteRx */ @@ -274,7 +265,6 @@ throw new PropertyUndefinedError(RenderConstants.absoluteRx, this); } - /** * @return whether absoluteRx is set */ @@ -282,7 +272,6 @@ return this.absoluteRx != null; } - /** * Set the value of absoluteRx */ @@ -292,7 +281,6 @@ firePropertyChange(RenderConstants.absoluteRx, oldAbsoluteRx, this.absoluteRx); } - /** * Unsets the variable absoluteRx * @return <code>true</code>, if absoluteRx was set before, @@ -308,8 +296,6 @@ return false; } - - /** * @return the value of absoluteRy */ @@ -321,7 +307,6 @@ throw new PropertyUndefinedError(RenderConstants.absoluteRy, this); } - /** * @return whether absoluteRy is set */ @@ -329,7 +314,6 @@ return this.absoluteRy != null; } - /** * Set the value of absoluteRy */ @@ -339,7 +323,6 @@ firePropertyChange(RenderConstants.absoluteRy, oldAbsoluteRy, this.absoluteRy); } - /** * Unsets the variable absoluteRy * @return <code>true</code>, if absoluteRy was set before, @@ -354,9 +337,7 @@ } return false; } - - /** * @return the value of absoluteHeight */ @@ -368,7 +349,6 @@ throw new PropertyUndefinedError(RenderConstants.absoluteHeight, this); } - /** * @return whether absoluteHeight is set */ @@ -376,7 +356,6 @@ return this.absoluteHeight != null; } - /** * Set the value of absoluteHeight */ @@ -386,7 +365,6 @@ firePropertyChange(RenderConstants.absoluteHeight, oldAbsoluteHeight, this.absoluteHeight); } - /** * Unsets the variable absoluteHeight * @return <code>true</code>, if absoluteHeight was set before, @@ -401,7 +379,6 @@ } return false; } - /** * @return the value of absoluteWidth @@ -414,7 +391,6 @@ throw new PropertyUndefinedError(RenderConstants.absoluteWidth, this); } - /** * @return whether absoluteWidth is set */ @@ -422,7 +398,6 @@ return this.absoluteWidth != nul... [truncated message content] |
From: <jak...@us...> - 2012-05-31 19:16:58
|
Revision: 1275 http://jsbml.svn.sourceforge.net/jsbml/?rev=1275&view=rev Author: jakobmatthes Date: 2012-05-31 19:16:51 +0000 (Thu, 31 May 2012) Log Message: ----------- fix TODOs: move constants to RenderConstants class Modified Paths: -------------- trunk/extensions/render/src/org/sbml/jsbml/ext/render/AbstractRenderPlugin.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/ColorDefinition.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/Curve.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/FontFamily.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/FontRenderStyle.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/GlobalRenderInformation.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/GradientBase.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/GradientStop.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/Image.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/LocalRenderInformation.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/Point3D.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/Rectangle.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderConstants.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderCubicBezier.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderLayoutPlugin.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderModelPlugin.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderPoint.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/Style.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/TextAnchor.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/Transformation2D.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/VTextAnchor.java Property Changed: ---------------- trunk/extensions/render/src/org/sbml/jsbml/ext/render/AbstractRenderPlugin.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/ColorDefinition.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/Curve.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/Ellipse.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/ExtendedRenderModel.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/FontFamily.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/FontRenderStyle.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/GlobalRenderInformation.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/GradientBase.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/GradientStop.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/GraphicalPrimitive1D.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/GraphicalPrimitive2D.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/Group.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/Image.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/LineEnding.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/LinearGradient.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/LocalRenderInformation.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/LocalStyle.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/Point3D.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/Polygon.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/RadialGradient.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/Rectangle.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderConstants.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderCubicBezier.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderInformationBase.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderLayoutPlugin.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderModelPlugin.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderPoint.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/Style.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/Text.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/TextAnchor.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/Transformation.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/Transformation2D.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/VTextAnchor.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/package.html Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/AbstractRenderPlugin.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/AbstractRenderPlugin.java 2012-05-23 11:39:49 UTC (rev 1274) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/AbstractRenderPlugin.java 2012-05-31 19:16:51 UTC (rev 1275) @@ -24,6 +24,7 @@ import javax.swing.tree.TreeNode; +import org.sbml.jsbml.PropertyUndefinedError; import org.sbml.jsbml.SBase; import org.sbml.jsbml.ext.AbstractSBasePlugin; @@ -111,15 +112,11 @@ * Initializes the default values using the namespace. */ public void initDefaults() { - //addNamespace(RenderConstants.namespaceURI); + // TODO addNamespace(RenderConstants.namespaceURI); versionMajor = 0; versionMinor = 0; } - // TODO: Move to RenderConstants - public static final int MIN_SBML_LEVEL = 3; - public static final int MIN_SBML_VERSION = 1; - /** * @return the value of versionMinor */ @@ -128,7 +125,7 @@ return versionMinor; } return null; - //FIXME throw new PropertyUndefinedError(RenderConstants.versionMinor, this); + // TODO throw new PropertyUndefinedError(RenderConstants.versionMinor, this); } /** @@ -144,7 +141,7 @@ public void setVersionMinor(Short versionMinor) { Short oldVersionMinor = this.versionMinor; this.versionMinor = versionMinor; - //FIXME firePropertyChange(RenderConstants.versionMinor, oldVersionMinor, this.versionMinor); + // TODO firePropertyChange(RenderConstants.versionMinor, oldVersionMinor, this.versionMinor); } /** Property changes on: trunk/extensions/render/src/org/sbml/jsbml/ext/render/AbstractRenderPlugin.java ___________________________________________________________________ Modified: svn:keywords - Id Rev URL + Rev Id URL Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/ColorDefinition.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/ColorDefinition.java 2012-05-23 11:39:49 UTC (rev 1274) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/ColorDefinition.java 2012-05-31 19:16:51 UTC (rev 1275) @@ -68,8 +68,8 @@ */ public ColorDefinition(String id, Color value, int level, int version) { super(level, version); - if (getLevelAndVersion().compareTo(Integer.valueOf(MIN_SBML_LEVEL), - Integer.valueOf(MIN_SBML_VERSION)) < 0) { + if (getLevelAndVersion().compareTo(Integer.valueOf(RenderConstants.MIN_SBML_LEVEL), + Integer.valueOf(RenderConstants.MIN_SBML_VERSION)) < 0) { throw new LevelVersionError(getElementName(), level, version); } this.id = id; @@ -82,8 +82,6 @@ */ public ColorDefinition(ColorDefinition obj) { super(obj); - // TODO: copy all class attributes, e.g.: - // bar = obj.bar; this.id = obj.id; this.value = obj.value; } @@ -107,10 +105,9 @@ * Set the value of id */ public void setId(String id){ - //String oldId = this.id; + String oldId = this.id; this.id = id; - //TODO - //firePropertyChange(constant_class.id, oldId, this.id); + firePropertyChange(RenderConstants.id, oldId, this.id); } @@ -139,10 +136,9 @@ * Set the value of value */ public void setValue(Color value) { - //Integer oldValue = this.value; + Color oldValue = this.value; this.value = value; - //TODO - //firePropertyChange(constant_class.value, oldValue, this.value); + firePropertyChange(RenderConstants.value, oldValue, this.value); } @@ -153,19 +149,14 @@ */ public boolean unsetValue() { if (isSetValue()) { - //Integer oldValue = this.value; + Color oldValue = this.value; this.value = null; - //TODO - //firePropertyChange(constant_class.value, oldValue, this.value); + firePropertyChange(RenderConstants.value, oldValue, this.value); return true; } return false; } - // TODO: Move to RenderConstants - public static final int MIN_SBML_LEVEL = 3; - public static final int MIN_SBML_VERSION = 1; - public String toString() { // TODO Auto-generated method stub return null; Property changes on: trunk/extensions/render/src/org/sbml/jsbml/ext/render/ColorDefinition.java ___________________________________________________________________ Modified: svn:keywords - Id Rev URL + Rev Id URL Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/Curve.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/Curve.java 2012-05-23 11:39:49 UTC (rev 1274) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/Curve.java 2012-05-31 19:16:51 UTC (rev 1275) @@ -74,10 +74,6 @@ addNamespace(RenderConstants.namespaceURI); } - public static final int MIN_SBML_LEVEL = 3; - public static final int MIN_SBML_VERSION = 1; - - /** * @return the value of startHead */ Property changes on: trunk/extensions/render/src/org/sbml/jsbml/ext/render/Curve.java ___________________________________________________________________ Modified: svn:keywords - Id Rev URL + Rev Id URL Property changes on: trunk/extensions/render/src/org/sbml/jsbml/ext/render/Ellipse.java ___________________________________________________________________ Modified: svn:keywords - Id Rev URL + Rev Id URL Property changes on: trunk/extensions/render/src/org/sbml/jsbml/ext/render/ExtendedRenderModel.java ___________________________________________________________________ Modified: svn:keywords - Id Rev URL + Rev Id URL Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/FontFamily.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/FontFamily.java 2012-05-23 11:39:49 UTC (rev 1274) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/FontFamily.java 2012-05-31 19:16:51 UTC (rev 1275) @@ -27,7 +27,6 @@ * @since 1.0 * @date 16.05.2012 */ -//TODO: Set SVN properties. public enum FontFamily { serif, sans_serif, Property changes on: trunk/extensions/render/src/org/sbml/jsbml/ext/render/FontFamily.java ___________________________________________________________________ Modified: svn:keywords - Id Rev URL + Rev Id URL Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/FontRenderStyle.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/FontRenderStyle.java 2012-05-23 11:39:49 UTC (rev 1274) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/FontRenderStyle.java 2012-05-31 19:16:51 UTC (rev 1275) @@ -26,7 +26,6 @@ * @since 1.0 * @date 16.05.2012 */ -//TODO: Set SVN properties. public interface FontRenderStyle { /** Property changes on: trunk/extensions/render/src/org/sbml/jsbml/ext/render/FontRenderStyle.java ___________________________________________________________________ Modified: svn:keywords - Id Rev URL + Rev Id URL Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/GlobalRenderInformation.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/GlobalRenderInformation.java 2012-05-23 11:39:49 UTC (rev 1274) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/GlobalRenderInformation.java 2012-05-31 19:16:51 UTC (rev 1275) @@ -33,6 +33,7 @@ * @since 1.0 * @date 08.05.2012 */ +// TODO getter, setter, isset public class GlobalRenderInformation extends RenderInformationBase { /** * Creates an GlobalRenderInformation instance @@ -100,8 +101,7 @@ */ public GlobalRenderInformation(GlobalRenderInformation obj) { super(obj); - // TODO: copy all class attributes, e.g.: - // bar = obj.bar; + listOfStyles = obj.listOfStyles; } @@ -120,21 +120,13 @@ @Override public void initDefaults() { addNamespace(RenderConstants.namespaceURI); - // TODO: init default values here if necessary, e.g.: - // bar = null; } - // TODO: Move to RenderConstants - public static final int MIN_SBML_LEVEL = 3; - public static final int MIN_SBML_VERSION = 1; - /** * */ private static final long serialVersionUID = 855680727119080659L; - //TODO The same as LocalRenderInformation, but with class GlobalStyle - //GlobalStyle equals Style? ListOf<Style> listOfStyles; Property changes on: trunk/extensions/render/src/org/sbml/jsbml/ext/render/GlobalRenderInformation.java ___________________________________________________________________ Modified: svn:keywords - Id Rev URL + Rev Id URL Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/GradientBase.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/GradientBase.java 2012-05-23 11:39:49 UTC (rev 1274) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/GradientBase.java 2012-05-31 19:16:51 UTC (rev 1275) @@ -88,8 +88,8 @@ */ public GradientBase(String id, GradientStop stop, int level, int version) { super(level, version); - if (getLevelAndVersion().compareTo(Integer.valueOf(MIN_SBML_LEVEL), - Integer.valueOf(MIN_SBML_VERSION)) < 0) { + if (getLevelAndVersion().compareTo(Integer.valueOf(RenderConstants.MIN_SBML_LEVEL), + Integer.valueOf(RenderConstants.MIN_SBML_VERSION)) < 0) { throw new LevelVersionError(getElementName(), level, version); } initDefaults(); @@ -170,8 +170,9 @@ * Set the value of id */ public void setId(String id){ + String oldId = this.id; this.id = id; - //TODO firePropertyChange(constant_class.id, oldId, this.id); + firePropertyChange(RenderConstants.id, oldId, this.id); } @@ -199,8 +200,9 @@ * Set the value of spreadMethod */ public void setSpreadMethod(Spread spreadMethod) { + Spread oldSpreadMethod = this.spreadMethod; this.spreadMethod = spreadMethod; - //TODO firePropertyChange(constant_class.spreadMethod, oldSpreadMethod, this.spreadMethod); + firePropertyChange(RenderConstants.spreadMethod, oldSpreadMethod, this.spreadMethod); } @@ -211,16 +213,14 @@ */ public boolean unsetSpreadMethod() { if (isSetSpreadMethod()) { + Spread oldSpreadMethod = this.spreadMethod; this.spreadMethod = null; - //TODO firePropertyChange(constant_class.spreadMethod, oldSpreadMethod, this.spreadMethod); + firePropertyChange(RenderConstants.spreadMethod, oldSpreadMethod, this.spreadMethod); return true; } return false; } - public static final int MIN_SBML_LEVEL = 3; - public static final int MIN_SBML_VERSION = 1; - public String toString() { // TODO Auto-generated method stub return null; @@ -245,9 +245,9 @@ public ListOf<GradientStop> getListOfGradientStops() { if (!isSetListOfGradientStops()) { listOfGradientStops = new ListOf<GradientStop>(getLevel(), getVersion()); - //TODO listOfGradientStops.addNamespace(constant_class.namespaceURI); + listOfGradientStops.addNamespace(RenderConstants.namespaceURI); listOfGradientStops.setSBaseListType(ListOf.Type.other); - //TODO registerChild(listOfGradientStops); + registerChild(listOfGradientStops); } return listOfGradientStops; } Property changes on: trunk/extensions/render/src/org/sbml/jsbml/ext/render/GradientBase.java ___________________________________________________________________ Modified: svn:keywords - Id Rev URL + Rev Id URL Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/GradientStop.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/GradientStop.java 2012-05-23 11:39:49 UTC (rev 1274) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/GradientStop.java 2012-05-31 19:16:51 UTC (rev 1275) @@ -71,8 +71,8 @@ */ public GradientStop(Double offset, ColorDefinition stopColor, int level, int version) { super(level, version); - if (getLevelAndVersion().compareTo(Integer.valueOf(MIN_SBML_LEVEL), - Integer.valueOf(MIN_SBML_VERSION)) < 0) { + if (getLevelAndVersion().compareTo(Integer.valueOf(RenderConstants.MIN_SBML_LEVEL), + Integer.valueOf(RenderConstants.MIN_SBML_VERSION)) < 0) { throw new LevelVersionError(getElementName(), level, version); } this.offset = offset; @@ -206,11 +206,6 @@ return false; } - // TODO: Move to RenderConstants - public static final int MIN_SBML_LEVEL = 3; - public static final int MIN_SBML_VERSION = 1; - - @Override public String toString() { // TODO Auto-generated method stub Property changes on: trunk/extensions/render/src/org/sbml/jsbml/ext/render/GradientStop.java ___________________________________________________________________ Modified: svn:keywords - Id Rev URL + Rev Id URL Property changes on: trunk/extensions/render/src/org/sbml/jsbml/ext/render/GraphicalPrimitive1D.java ___________________________________________________________________ Modified: svn:keywords - Id Rev URL + Rev Id URL Property changes on: trunk/extensions/render/src/org/sbml/jsbml/ext/render/GraphicalPrimitive2D.java ___________________________________________________________________ Modified: svn:keywords - Id Rev URL + Rev Id URL Property changes on: trunk/extensions/render/src/org/sbml/jsbml/ext/render/Group.java ___________________________________________________________________ Modified: svn:keywords - Id Rev URL + Rev Id URL Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/Image.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/Image.java 2012-05-23 11:39:49 UTC (rev 1274) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/Image.java 2012-05-31 19:16:51 UTC (rev 1275) @@ -94,8 +94,7 @@ */ public void initDefaults() { addNamespace(RenderConstants.namespaceURI); - // TODO: init default values here if necessary, e.g.: - // bar = null; + z = 0d; } public static final int MIN_SBML_LEVEL = 3; Property changes on: trunk/extensions/render/src/org/sbml/jsbml/ext/render/Image.java ___________________________________________________________________ Modified: svn:keywords - Id Rev URL + Rev Id URL Property changes on: trunk/extensions/render/src/org/sbml/jsbml/ext/render/LineEnding.java ___________________________________________________________________ Modified: svn:keywords - Id Rev URL + Rev Id URL Property changes on: trunk/extensions/render/src/org/sbml/jsbml/ext/render/LinearGradient.java ___________________________________________________________________ Modified: svn:keywords - Id Rev URL + Rev Id URL Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/LocalRenderInformation.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/LocalRenderInformation.java 2012-05-23 11:39:49 UTC (rev 1274) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/LocalRenderInformation.java 2012-05-31 19:16:51 UTC (rev 1275) @@ -222,20 +222,4 @@ return field; } */ - - /** - * TODO: optionally, create additional create methods with more - * variables, for instance "bar" variable - */ - // public LocalStyle createLocalStyle(String id, int bar) { - // LocalStyle field = createLocalStyle(id); - // field.setBar(bar); - // return field; - // } - /** - * - */ - // TODO: Move to RenderConstants - public static final int MIN_SBML_LEVEL = 3; - public static final int MIN_SBML_VERSION = 1; } Property changes on: trunk/extensions/render/src/org/sbml/jsbml/ext/render/LocalRenderInformation.java ___________________________________________________________________ Modified: svn:keywords - Id Rev URL + Rev Id URL Property changes on: trunk/extensions/render/src/org/sbml/jsbml/ext/render/LocalStyle.java ___________________________________________________________________ Modified: svn:keywords - Id Rev URL + Rev Id URL Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/Point3D.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/Point3D.java 2012-05-23 11:39:49 UTC (rev 1274) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/Point3D.java 2012-05-31 19:16:51 UTC (rev 1275) @@ -26,7 +26,6 @@ * @since 1.0 * @date 16.05.2012 */ -//TODO: Set SVN properties. public interface Point3D { /** Property changes on: trunk/extensions/render/src/org/sbml/jsbml/ext/render/Point3D.java ___________________________________________________________________ Modified: svn:keywords - Id Rev URL + Rev Id URL Property changes on: trunk/extensions/render/src/org/sbml/jsbml/ext/render/Polygon.java ___________________________________________________________________ Modified: svn:keywords - Id Rev URL + Rev Id URL Property changes on: trunk/extensions/render/src/org/sbml/jsbml/ext/render/RadialGradient.java ___________________________________________________________________ Modified: svn:keywords - Id Rev URL + Rev Id URL Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/Rectangle.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/Rectangle.java 2012-05-23 11:39:49 UTC (rev 1274) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/Rectangle.java 2012-05-31 19:16:51 UTC (rev 1275) @@ -746,10 +746,6 @@ ry = 0d; } - // TODO: Move to RenderConstants - public static final int MIN_SBML_LEVEL = 3; - public static final int MIN_SBML_VERSION = 1; - /* (non-Javadoc) * @see org.sbml.jsbml.ext.render.GraphicalPrimitive1D#getAllowsChildren() */ Property changes on: trunk/extensions/render/src/org/sbml/jsbml/ext/render/Rectangle.java ___________________________________________________________________ Modified: svn:keywords - Id Rev URL + Rev Id URL Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderConstants.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderConstants.java 2012-05-23 11:39:49 UTC (rev 1274) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderConstants.java 2012-05-31 19:16:51 UTC (rev 1275) @@ -31,6 +31,8 @@ * @date 08.05.2012 */ public interface RenderConstants { + public static final int MIN_SBML_LEVEL = 3; + public static final int MIN_SBML_VERSION = 1; public static final String namespaceURI = "http://www.sbml.org/sbml/level3/version1/render/version1"; public static final String fontFamily = "font-family"; public static final String fontSize = "font-size"; @@ -96,4 +98,8 @@ public static final String transform = "trasform"; public static final Object versionMinor = "version-minor"; public static final Object versionMajor = "version-major"; + public static final String spreadMethod = "spreadMethod"; + public static final String typeList = "typeList"; + public static final String roleList = "roleList"; + public static final String value = "value"; } \ No newline at end of file Property changes on: trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderConstants.java ___________________________________________________________________ Modified: svn:keywords - Id Rev URL + Rev Id URL Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderCubicBezier.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderCubicBezier.java 2012-05-23 11:39:49 UTC (rev 1274) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderCubicBezier.java 2012-05-31 19:16:51 UTC (rev 1275) @@ -37,9 +37,6 @@ */ public class RenderCubicBezier extends RenderPoint { - // TODO: Move to RenderConstants - public static final int MIN_SBML_LEVEL = 3; - public static final int MIN_SBML_VERSION = 1; /** * */ @@ -118,7 +115,7 @@ throw new PropertyUndefinedError(RenderConstants.x1, this); } - + /** * @return the value of x2 */ Property changes on: trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderCubicBezier.java ___________________________________________________________________ Modified: svn:keywords - Id Rev URL + Rev Id URL Property changes on: trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderInformationBase.java ___________________________________________________________________ Modified: svn:keywords - Id Rev URL + Rev Id URL Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderLayoutPlugin.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderLayoutPlugin.java 2012-05-23 11:39:49 UTC (rev 1274) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderLayoutPlugin.java 2012-05-31 19:16:51 UTC (rev 1275) @@ -76,9 +76,6 @@ // bar = null; } - // TODO: Move to RenderConstants - public static final int MIN_SBML_LEVEL = 3; - public static final int MIN_SBML_VERSION = 1; @Override public boolean getAllowsChildren() { @@ -230,15 +227,4 @@ addLocalRenderInformation(field); return field; } - - /** - * TODO: optionally, create additional create methods with more - * variables, for instance "bar" variable - */ - // public LocalRenderInformation createLocalRenderInformation(String id, int bar) { - // LocalRenderInformation field = createLocalRenderInformation(id); - // field.setBar(bar); - // return field; - // } - } Property changes on: trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderLayoutPlugin.java ___________________________________________________________________ Modified: svn:keywords - Id Rev URL + Rev Id URL Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderModelPlugin.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderModelPlugin.java 2012-05-23 11:39:49 UTC (rev 1274) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderModelPlugin.java 2012-05-31 19:16:51 UTC (rev 1275) @@ -35,10 +35,6 @@ */ public class RenderModelPlugin extends AbstractRenderPlugin { - // TODO: Move to RenderConstants - public static final int MIN_SBML_LEVEL = 3; - public static final int MIN_SBML_VERSION = 1; - /** * */ @@ -223,14 +219,4 @@ } return false; } - - /** - * TODO: optionally, create additional create methods with more - * variables, for instance "bar" variable - */ - // public GlobalRenderInformation createGlobalRenderInformation(String id, int bar) { - // GlobalRenderInformation field = createGlobalRenderInformation(id); - // field.setBar(bar); - // return field; - // } } Property changes on: trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderModelPlugin.java ___________________________________________________________________ Modified: svn:keywords - Id Rev URL + Rev Id URL Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderPoint.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderPoint.java 2012-05-23 11:39:49 UTC (rev 1274) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderPoint.java 2012-05-31 19:16:51 UTC (rev 1275) @@ -38,10 +38,6 @@ */ public class RenderPoint extends AbstractSBase implements Point3D { - // TODO: Move to RenderConstants - public static final int MIN_SBML_LEVEL = 3; - public static final int MIN_SBML_VERSION = 1; - /** * */ @@ -64,8 +60,12 @@ */ public RenderPoint(RenderPoint obj) { super(obj); - // TODO: copy all class attributes, e.g.: - // bar = obj.bar; + absoluteX = obj.absoluteX; + absoluteY = obj.absoluteY; + absoluteZ = obj.absoluteZ; + x = obj.x; + y = obj.y; + z = obj.z; } Property changes on: trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderPoint.java ___________________________________________________________________ Modified: svn:keywords - Id Rev URL + Rev Id URL Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/Style.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/Style.java 2012-05-23 11:39:49 UTC (rev 1274) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/Style.java 2012-05-31 19:16:51 UTC (rev 1275) @@ -35,6 +35,7 @@ * @since 1.0 * @date 08.05.2012 */ +// TODO Getter, Setter, isSet public class Style extends AbstractSBase { /** * @@ -82,8 +83,8 @@ */ public Style(String id, int level, int version, Group group) { super(level, version); - if (getLevelAndVersion().compareTo(Integer.valueOf(MIN_SBML_LEVEL), - Integer.valueOf(MIN_SBML_VERSION)) < 0) { + if (getLevelAndVersion().compareTo(Integer.valueOf(RenderConstants.MIN_SBML_LEVEL), + Integer.valueOf(RenderConstants.MIN_SBML_VERSION)) < 0) { throw new LevelVersionError(getElementName(), level, version); } this.id = id; @@ -116,17 +117,11 @@ * Initializes the default values using the namespace. */ public void initDefaults() { - //TODO - //addNamespace(constant_class.namespaceURI); + addNamespace(RenderConstants.namespaceURI); this.roleList = null; this.typeList = null; } - // TODO: Move to RenderConstants - public static final int MIN_SBML_LEVEL = 3; - public static final int MIN_SBML_VERSION = 1; - - public String toString() { // TODO Auto-generated method stub return null; @@ -144,61 +139,56 @@ * Set the value of id */ public void setId(String id) { - //String oldId = this.id; + String oldId = this.id; this.id = id; - //TODO - //firePropertyChange(constant_class.id, oldId, this.id); + firePropertyChange(RenderConstants.id, oldId, this.id); } /** * @return the value of group */ - public Group getGroup(){ + public Group getGroup() { return this.group; } /** * Set the value of group */ - public void setGroup(Group group){ - //Group olGroup = this.group; + public void setGroup(Group group) { + Group oldGroup = this.group; this.group = group; - //TODO - //firePropertyChange(constant_class.group, oldGroup, this.Group); + firePropertyChange(RenderConstants .group, oldGroup, this.group); } /** * @return the value of typeList */ - //TODO Whole list or elements? - public List<String> getTypeList(){ + public List<String> getTypeList() { return this.typeList; } /** * Set the value of typeList */ - public void setTypeList(ArrayList<String> typeList){ - //ArrayList<String> oldTypeList = this.typeList; + public void setTypeList(List<String> typeList) { + List<String> oldTypeList = this.typeList; this.typeList = typeList; - //TODO - //firePropertyChange(constant_class.typeList, oldTypeList, this.typeList); + firePropertyChange(RenderConstants.typeList, oldTypeList, this.typeList); } /** * @return the value of roleList */ - public List<String> getRoleList(){ + public List<String> getRoleList() { return this.roleList; } /** * Set the value of roleList */ - public void setRoleList(ArrayList<String> roleList){ - //ArrayList<String> oldRoleList = this.roleList; + public void setRoleList(ArrayList<String> roleList) { + List<String> oldRoleList = this.roleList; this.roleList = roleList; - //TODO - //firePropertyChange(constant_class.roleList, oldRoleList, this.roleList); + firePropertyChange(RenderConstants.roleList, oldRoleList, this.roleList); } } Property changes on: trunk/extensions/render/src/org/sbml/jsbml/ext/render/Style.java ___________________________________________________________________ Modified: svn:keywords - Id Rev URL + Rev Id URL Property changes on: trunk/extensions/render/src/org/sbml/jsbml/ext/render/Text.java ___________________________________________________________________ Modified: svn:keywords - Id Rev URL + Rev Id URL Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/TextAnchor.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/TextAnchor.java 2012-05-23 11:39:49 UTC (rev 1274) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/TextAnchor.java 2012-05-31 19:16:51 UTC (rev 1275) @@ -30,7 +30,6 @@ * @since 1.0 * @date 16.05.2012 */ -// TODO: Set SVN properties. public enum TextAnchor { start, middle, Property changes on: trunk/extensions/render/src/org/sbml/jsbml/ext/render/TextAnchor.java ___________________________________________________________________ Modified: svn:keywords - Id Rev URL + Rev Id URL Property changes on: trunk/extensions/render/src/org/sbml/jsbml/ext/render/Transformation.java ___________________________________________________________________ Modified: svn:keywords - Id Rev URL + Rev Id URL Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/Transformation2D.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/Transformation2D.java 2012-05-23 11:39:49 UTC (rev 1274) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/Transformation2D.java 2012-05-31 19:16:51 UTC (rev 1275) @@ -39,11 +39,6 @@ private static final long serialVersionUID = -1737694519381619398L; - public static final int MIN_SBML_LEVEL = 3; - - - public static final int MIN_SBML_VERSION = 1; - protected Double[] transform = new Double[6]; /** Property changes on: trunk/extensions/render/src/org/sbml/jsbml/ext/render/Transformation2D.java ___________________________________________________________________ Modified: svn:keywords - Id Rev URL + Rev Id URL Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/VTextAnchor.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/VTextAnchor.java 2012-05-23 11:39:49 UTC (rev 1274) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/VTextAnchor.java 2012-05-31 19:16:51 UTC (rev 1275) @@ -30,7 +30,6 @@ * @since 1.0 * @date 16.05.2012 */ -// TODO: Set SVN properties. public enum VTextAnchor { top, middle, Property changes on: trunk/extensions/render/src/org/sbml/jsbml/ext/render/VTextAnchor.java ___________________________________________________________________ Modified: svn:keywords - Id Rev URL + Rev Id URL Property changes on: trunk/extensions/render/src/org/sbml/jsbml/ext/render/package.html ___________________________________________________________________ Modified: svn:keywords - Id Rev URL + Rev Id URL This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jak...@us...> - 2012-05-23 11:39:57
|
Revision: 1274 http://jsbml.svn.sourceforge.net/jsbml/?rev=1274&view=rev Author: jakobmatthes Date: 2012-05-23 11:39:49 +0000 (Wed, 23 May 2012) Log Message: ----------- Render extension: Transformation, Transformation2D, Gradient*, RenderConstants Modified Paths: -------------- trunk/extensions/render/src/org/sbml/jsbml/ext/render/ExtendedRenderModel.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/FontFamily.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/FontRenderStyle.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/GradientBase.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/GradientStop.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/GraphicalPrimitive2D.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/Point3D.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/Polygon.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/RadialGradient.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderConstants.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/TextAnchor.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/Transformation.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/Transformation2D.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/VTextAnchor.java Property Changed: ---------------- trunk/extensions/render/src/org/sbml/jsbml/ext/render/FontFamily.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/FontRenderStyle.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/Point3D.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/TextAnchor.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/VTextAnchor.java Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/ExtendedRenderModel.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/ExtendedRenderModel.java 2012-05-23 10:17:36 UTC (rev 1273) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/ExtendedRenderModel.java 2012-05-23 11:39:49 UTC (rev 1274) @@ -151,7 +151,7 @@ public void setVersionMinor(int versionMinor) { int oldVersionMinor = this.versionMinor; this.versionMinor = versionMinor; - //FIXME firePropertyChange(RenderConstants.versionMinor, oldVersionMinor, this.versionMinor); + // FIXME firePropertyChange(RenderConstants.versionMinor, oldVersionMinor, this.versionMinor); } /** @@ -162,7 +162,7 @@ public boolean unsetVersionMinor() { if (isSetVersionMinor()) { int oldVersionMinor = this.versionMinor; - //FIME firePropertyChange(RenderConstants.versionMinor, oldVersionMinor, this.versionMinor); + //FIXME firePropertyChange(RenderConstants.versionMinor, oldVersionMinor, this.versionMinor); return true; } return false; Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/FontFamily.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/FontFamily.java 2012-05-23 10:17:36 UTC (rev 1273) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/FontFamily.java 2012-05-23 11:39:49 UTC (rev 1274) @@ -1,6 +1,6 @@ /* - * $Id: FontFamily.java 16:25:26 jakob $ - * $URL: FontFamily.java $ + * $Id$ + * $URL$ * * ---------------------------------------------------------------------------- * This file is part of JSBML. Please visit <http://sbml.org/Software/JSBML> Property changes on: trunk/extensions/render/src/org/sbml/jsbml/ext/render/FontFamily.java ___________________________________________________________________ Added: svn:keywords + Id Rev URL Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/FontRenderStyle.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/FontRenderStyle.java 2012-05-23 10:17:36 UTC (rev 1273) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/FontRenderStyle.java 2012-05-23 11:39:49 UTC (rev 1274) @@ -1,6 +1,6 @@ /* - * $Id: FontRenderStyle.java 16:51:02 jakob $ - * $URL: FontRenderStyle.java $ + * $Id$ + * $URL$ * ---------------------------------------------------------------------------- * This file is part of JSBML. Please visit <http://sbml.org/Software/JSBML> * for the latest version of JSBML and more information about SBML. Property changes on: trunk/extensions/render/src/org/sbml/jsbml/ext/render/FontRenderStyle.java ___________________________________________________________________ Added: svn:keywords + Id Rev URL Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/GradientBase.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/GradientBase.java 2012-05-23 10:17:36 UTC (rev 1273) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/GradientBase.java 2012-05-23 11:39:49 UTC (rev 1274) @@ -20,9 +20,12 @@ */ package org.sbml.jsbml.ext.render; +import java.text.MessageFormat; + import org.sbml.jsbml.AbstractSBase; import org.sbml.jsbml.LevelVersionError; import org.sbml.jsbml.ListOf; +import org.sbml.jsbml.SBase; /** @@ -52,6 +55,9 @@ protected Spread spreadMethod; protected ListOf<GradientStop> listOfGradientStops; + + + /** * Creates an GradientBase instance */ @@ -90,7 +96,40 @@ this.listOfGradientStops.add(stop); } + + @Override + public boolean getAllowsChildren() { + return false; + } + + @Override + public int getChildCount() { + int count = 0; + if (isSetListOfGradientStops()) { + count++; + } + return count; + } + + + @Override + public SBase getChildAt(int childIndex) { + if (childIndex < 0) { + throw new IndexOutOfBoundsException(childIndex + " < 0"); + } + int pos = 0; + if (isSetListOfGradientStops()) { + if (pos == childIndex) { + return getListOfGradientStops(); + } + pos++; + } + throw new IndexOutOfBoundsException(MessageFormat.format( + "Index {0,number,integer} >= {1,number,integer}", childIndex, + +((int) Math.min(pos, 0)))); + } + /** * Clone constructor */ Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/GradientStop.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/GradientStop.java 2012-05-23 10:17:36 UTC (rev 1273) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/GradientStop.java 2012-05-23 11:39:49 UTC (rev 1274) @@ -20,9 +20,12 @@ */ package org.sbml.jsbml.ext.render; +import java.text.MessageFormat; + import org.sbml.jsbml.AbstractSBase; import org.sbml.jsbml.LevelVersionError; import org.sbml.jsbml.PropertyUndefinedError; +import org.sbml.jsbml.SBase; /** @@ -40,11 +43,14 @@ */ private static final long serialVersionUID = 7400974339251884133L; + private Double offset; - private ColorDefinition stopColor; + + private ColorDefinition stopColor; - /** + + /** * Creates a GradientStop instance with an offset and a color. * * @param offset @@ -55,8 +61,7 @@ this.stopColor = stopColor; } - - /** + /** * Creates a GradientStop instance with an offset, color, level, and version. * * @param offset @@ -74,7 +79,6 @@ this.stopColor = stopColor; } - /** * Clone constructor */ @@ -93,7 +97,29 @@ } + @Override + public boolean getAllowsChildren() { + return false; + } + + + @Override + public SBase getChildAt(int childIndex) { + if (childIndex < 0) { + throw new IndexOutOfBoundsException(childIndex + " < 0"); + } + int pos = 0; + throw new IndexOutOfBoundsException(MessageFormat.format( + "Index {0,number,integer} >= {1,number,integer}", childIndex, + +((int) Math.min(pos, 0)))); + } + + @Override + public int getChildCount() { + return 0; + } + /** * @return the value of offset */ @@ -106,6 +132,18 @@ } /** + * @return the value of stopColor + */ + public ColorDefinition getStopColor() { + if (isSetStopColor()) { + return stopColor; + } + // This is necessary if we cannot return null here. + throw new PropertyUndefinedError(RenderConstants.stopColor, this); + } + + + /** * @return whether offset is set */ public boolean isSetOffset() { @@ -113,6 +151,13 @@ } /** + * @return whether stopColor is set + */ + public boolean isSetStopColor() { + return this.stopColor != null; + } + + /** * Set the value of offset */ public void setOffset(Double offset) { @@ -122,6 +167,15 @@ } /** + * Set the value of stopColor + */ + public void setStopColor(ColorDefinition stopColor) { + ColorDefinition oldStopColor = this.stopColor; + this.stopColor = stopColor; + firePropertyChange(RenderConstants.stopColor, oldStopColor, this.stopColor); + } + + /** * Unsets the variable offset * @return <code>true</code>, if offset was set before, * otherwise <code>false</code> @@ -135,36 +189,9 @@ } return false; } - - - /** - * @return the value of stopColor - */ - public ColorDefinition getStopColor() { - if (isSetStopColor()) { - return stopColor; - } - // This is necessary if we cannot return null here. - throw new PropertyUndefinedError(RenderConstants.stopColor, this); - } - /** - * @return whether stopColor is set - */ - public boolean isSetStopColor() { - return this.stopColor != null; - } /** - * Set the value of stopColor - */ - public void setStopColor(ColorDefinition stopColor) { - ColorDefinition oldStopColor = this.stopColor; - this.stopColor = stopColor; - firePropertyChange(RenderConstants.stopColor, oldStopColor, this.stopColor); - } - - /** * Unsets the variable stopColor * @return <code>true</code>, if stopColor was set before, * otherwise <code>false</code> Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/GraphicalPrimitive2D.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/GraphicalPrimitive2D.java 2012-05-23 10:17:36 UTC (rev 1273) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/GraphicalPrimitive2D.java 2012-05-23 11:39:49 UTC (rev 1274) @@ -74,10 +74,9 @@ /** * Initializes the default values using the namespace. */ + @Override public void initDefaults() { addNamespace(RenderConstants.namespaceURI); - // TODO: init default values here if necessary, e.g.: - // bar = null; } Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/Point3D.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/Point3D.java 2012-05-23 10:17:36 UTC (rev 1273) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/Point3D.java 2012-05-23 11:39:49 UTC (rev 1274) @@ -1,6 +1,6 @@ /* - * $Id: Point3D.java 17:06:27 jakob $ - * $URL: Point3D.java $ + * $Id$ + * $URL$ * ---------------------------------------------------------------------------- * This file is part of JSBML. Please visit <http://sbml.org/Software/JSBML> * for the latest version of JSBML and more information about SBML. Property changes on: trunk/extensions/render/src/org/sbml/jsbml/ext/render/Point3D.java ___________________________________________________________________ Added: svn:keywords + Id Rev URL Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/Polygon.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/Polygon.java 2012-05-23 10:17:36 UTC (rev 1273) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/Polygon.java 2012-05-23 11:39:49 UTC (rev 1274) @@ -20,7 +20,11 @@ */ package org.sbml.jsbml.ext.render; +import java.text.MessageFormat; + import org.sbml.jsbml.ListOf; +import org.sbml.jsbml.PropertyUndefinedError; +import org.sbml.jsbml.SBase; /** @@ -33,5 +37,208 @@ * @date 08.05.2012 */ public class Polygon extends GraphicalPrimitive2D { - private ListOf<RenderPoint> listOfElements; + /** + * + */ + private static final long serialVersionUID = 9207043017589271103L; + + public static final int MIN_SBML_LEVEL = 3; + + public static final int MIN_SBML_VERSION = 1; + + private ListOf<RenderPoint> listOfElements; + + + /** + * + */ + private ListOf<RenderPoint> listOfRenderPoints; + + + /** + * Creates an Polygon instance + */ + public Polygon() { + super(); + initDefaults(); + } + + + /** + * Clone constructor + */ + public Polygon(Polygon obj) { + super(obj); + listOfElements = obj.listOfElements; + } + + + /** + * @param renderPoint + */ + public boolean addRenderPoint(RenderPoint renderPoint) { + return getListOfRenderPoints().add(renderPoint); + } + + + /** + * clones this class + */ + public Polygon clone() { + return new Polygon(this); + } + + + @Override + public boolean getAllowsChildren() { + return true; + } + + + public SBase getChildAt(int childIndex) { + if (childIndex < 0) { + throw new IndexOutOfBoundsException(childIndex + " < 0"); + } + int pos = 0; + if (isSetListOfElements()) { + if (pos == childIndex) { + return getListOfElements(); + } + pos++; + } + throw new IndexOutOfBoundsException(MessageFormat.format( + "Index {0,number,integer} >= {1,number,integer}", childIndex, + +((int) Math.min(pos, 0)))); + } + + + public int getChildCount() { + int count = 0; + if (isSetListOfElements()) { + count++; + } + return count; + } + + + /** + * @return the value of listOfElements + */ + public ListOf<RenderPoint> getListOfElements() { + if (isSetListOfElements()) { + return listOfElements; + } + // This is necessary if we cannot return null here. + throw new PropertyUndefinedError(RenderConstants.listOfElements, this); + } + + + /** + * @return the listOfRenderPoints + */ + public ListOf<RenderPoint> getListOfRenderPoints() { + if (!isSetListOfRenderPoints()) { + listOfRenderPoints = new ListOf<RenderPoint>(getLevel(), getVersion()); + listOfRenderPoints.addNamespace(RenderConstants.namespaceURI); + listOfRenderPoints.setSBaseListType(ListOf.Type.other); + registerChild(listOfRenderPoints); + } + return listOfRenderPoints; + } + + + /** + * Initializes the default values using the namespace. + */ + public void initDefaults() { + addNamespace(RenderConstants.namespaceURI); + } + + + /** + * @return whether listOfElements is set + */ + public boolean isSetListOfElements() { + return this.listOfElements != null; + } + + + /** + * @return <code>true</code>, if listOfRenderPoints contains at least one element, + * otherwise <code>false</code> + */ + public boolean isSetListOfRenderPoints() { + if ((listOfRenderPoints == null) || listOfRenderPoints.isEmpty()) { + return false; + } + return true; + } + + + /** + * @param i + */ + public void removeRenderPoint(int i) { + if (!isSetListOfRenderPoints()) { + throw new IndexOutOfBoundsException(Integer.toString(i)); + } + getListOfRenderPoints().remove(i); + } + + /** + * @param renderPoint + */ + public boolean removeRenderPoint(RenderPoint renderPoint) { + if (isSetListOfRenderPoints()) { + return getListOfRenderPoints().remove(renderPoint); + } + return false; + } + + /** + * Set the value of listOfElements + */ + public void setListOfElements(ListOf<RenderPoint> listOfElements) { + ListOf<RenderPoint> oldListOfElements = this.listOfElements; + this.listOfElements = listOfElements; + firePropertyChange(RenderConstants.listOfElements, oldListOfElements, this.listOfElements); + } + + + /** + * @param listOfRenderPoints + */ + public void setListOfRenderPoints(ListOf<RenderPoint> listOfRenderPoints) { + unsetListOfRenderPoints(); + this.listOfRenderPoints = listOfRenderPoints; + registerChild(this.listOfRenderPoints); + } + + /** + * Unsets the variable listOfElements + * @return <code>true</code>, if listOfElements was set before, + * otherwise <code>false</code> + */ + public boolean unsetListOfElements() { + if (isSetListOfElements()) { + ListOf<RenderPoint> oldListOfElements = this.listOfElements; + this.listOfElements = null; + firePropertyChange(RenderConstants.listOfElements, oldListOfElements, this.listOfElements); + return true; + } + return false; + } + /** + * @return <code>true</code>, if listOfRenderPoints contained at least one element, + * otherwise <code>false</code> + */ + public boolean unsetListOfRenderPoints() { + if (isSetListOfRenderPoints()) { + ListOf<RenderPoint> oldRenderPoints = this.listOfRenderPoints; + this.listOfRenderPoints = null; + oldRenderPoints.fireNodeRemovedEvent(); + return true; + } + return false; + } } Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/RadialGradient.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/RadialGradient.java 2012-05-23 10:17:36 UTC (rev 1273) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/RadialGradient.java 2012-05-23 11:39:49 UTC (rev 1274) @@ -20,7 +20,10 @@ */ package org.sbml.jsbml.ext.render; +import org.sbml.jsbml.PropertyUndefinedError; + + /** * @author Eugen Netz * @author Alexander Diamantikos @@ -31,7 +34,717 @@ * @date 08.05.2012 */ public class RadialGradient extends GradientBase { - // FIXME absolute vs. relative, use a Point class? - private Boolean absolute; - private Integer cx, cy, cz, r, fx, fy, fz; + /** + * + */ + private static final long serialVersionUID = -6976786676644704255L; + public static final int MIN_SBML_LEVEL = 3; + public static final int MIN_SBML_VERSION = 1; + private Boolean absoluteCx, absoluteCy, absoluteCz, absoluteR; + + private Boolean absoluteFx, absoluteFy, absoluteFz; + + private Double cx, cy, cz, r, fx, fy, fz; + + + /** + * Creates an RadialGradient instance + */ + public RadialGradient() { + super(); + initDefaults(); + } + + + /** + * Clone constructor + */ + public RadialGradient(RadialGradient obj) { + super(obj); + cx = obj.cx; + cy = obj.cy; + cz = obj.cz; + fx = obj.fx; + fy = obj.fy; + fz = obj.fz; + r = obj.r; + absoluteCx = obj.absoluteCx; + absoluteCy = obj.absoluteCy; + absoluteCz = obj.absoluteCz; + absoluteR = obj.absoluteR; + absoluteFx = obj.absoluteFx; + absoluteFy = obj.absoluteFy; + absoluteFz = obj.absoluteFz; + } + + + /** + * clones this class + */ + public RadialGradient clone() { + return new RadialGradient(this); + } + + + /** + * @return the value of cx + */ + public double getCx() { + if (isSetCx()) { + return cx; + } + // This is necessary if we cannot return null here. + throw new PropertyUndefinedError(RenderConstants.cx, this); + } + + + /** + * @return the value of cy + */ + public double getCy() { + if (isSetCy()) { + return cy; + } + // This is necessary if we cannot return null here. + throw new PropertyUndefinedError(RenderConstants.cy, this); + } + + + /** + * @return the value of cz + */ + public double getCz() { + if (isSetCz()) { + return cz; + } + // This is necessary if we cannot return null here. + throw new PropertyUndefinedError(RenderConstants.cz, this); + } + + + /** + * @return the value of fx + */ + public double getFx() { + if (isSetFx()) { + return fx; + } + // This is necessary if we cannot return null here. + throw new PropertyUndefinedError(RenderConstants.fx, this); + } + + + /** + * @return the value of fy + */ + public double getFy() { + if (isSetFy()) { + return fy; + } + // This is necessary if we cannot return null here. + throw new PropertyUndefinedError(RenderConstants.fy, this); + } + + + /** + * @return the value of fz + */ + public double getFz() { + if (isSetFz()) { + return fz; + } + // This is necessary if we cannot return null here. + throw new PropertyUndefinedError(RenderConstants.fz, this); + } + + + /** + * @return the value of r + */ + public double getR() { + if (isSetR()) { + return r; + } + // This is necessary if we cannot return null here. + throw new PropertyUndefinedError(RenderConstants.r, this); + } + + + /** + * Initializes the default values using the namespace. + */ + public void initDefaults() { + addNamespace(RenderConstants.namespaceURI); + cx = 0.5d; + cy = 0.5d; + cz = 0.5d; + r = 0.5d; + fx = cx; + fy = cy; + fz = cz; + absoluteCx = false; + absoluteCy = false; + absoluteCz = false; + absoluteR = false; + absoluteFx = false; + absoluteFy = false; + absoluteFz = false; + } + + + /** + * @return the value of absoluteCx + */ + public boolean isAbsoluteCx() { + if (isSetAbsoluteCx()) { + return absoluteCx; + } + // This is necessary if we cannot return null here. + throw new PropertyUndefinedError(RenderConstants.absoluteCx, this); + } + + + /** + * @return the value of absoluteCy + */ + public boolean isAbsoluteCy() { + if (isSetAbsoluteCy()) { + return absoluteCy; + } + // This is necessary if we cannot return null here. + throw new PropertyUndefinedError(RenderConstants.absoluteCy, this); + } + + + /** + * @return the value of absoluteCz + */ + public boolean isAbsoluteCz() { + if (isSetAbsoluteCz()) { + return absoluteCz; + } + // This is necessary if we cannot return null here. + throw new PropertyUndefinedError(RenderConstants.absoluteCz, this); + } + + + /** + * @return the value of absoluteFx + */ + public boolean isAbsoluteFx() { + if (isSetAbsoluteFx()) { + return absoluteFx; + } + // This is necessary if we cannot return null here. + throw new PropertyUndefinedError(RenderConstants.absoluteFx, this); + } + + + /** + * @return the value of absoluteFy + */ + public boolean isAbsoluteFy() { + if (isSetAbsoluteFy()) { + return absoluteFy; + } + // This is necessary if we cannot return null here. + throw new PropertyUndefinedError(RenderConstants.absoluteFy, this); + } + + + /** + * @return the value of absoluteFz + */ + public boolean isAbsoluteFz() { + if (isSetAbsoluteFz()) { + return absoluteFz; + } + // This is necessary if we cannot return null here. + throw new PropertyUndefinedError(RenderConstants.absoluteFz, this); + } + + + /** + * @return the value of absoluteR + */ + public boolean isAbsoluteR() { + if (isSetAbsoluteR()) { + return absoluteR; + } + // This is necessary if we cannot return null here. + throw new PropertyUndefinedError(RenderConstants.absoluteR, this); + } + + + /** + * @return whether absoluteCx is set + */ + public boolean isSetAbsoluteCx() { + return this.absoluteCx != null; + } + + + /** + * @return whether absoluteCy is set + */ + public boolean isSetAbsoluteCy() { + return this.absoluteCy != null; + } + + + /** + * @return whether absoluteCz is set + */ + public boolean isSetAbsoluteCz() { + return this.absoluteCz != null; + } + + + /** + * @return whether absoluteFx is set + */ + public boolean isSetAbsoluteFx() { + return this.absoluteFx != null; + } + + + /** + * @return whether absoluteFy is set + */ + public boolean isSetAbsoluteFy() { + return this.absoluteFy != null; + } + + + /** + * @return whether absoluteFz is set + */ + public boolean isSetAbsoluteFz() { + return this.absoluteFz != null; + } + + + /** + * @return whether absoluteR is set + */ + public boolean isSetAbsoluteR() { + return this.absoluteR != null; + } + + + /** + * @return whether cx is set + */ + public boolean isSetCx() { + return this.cx != null; + } + + + /** + * @return whether cy is set + */ + public boolean isSetCy() { + return this.cy != null; + } + + + /** + * @return whether cz is set + */ + public boolean isSetCz() { + return this.cz != null; + } + + + /** + * @return whether fx is set + */ + public boolean isSetFx() { + return this.fx != null; + } + + + /** + * @return whether fy is set + */ + public boolean isSetFy() { + return this.fy != null; + } + + + /** + * @return whether fz is set + */ + public boolean isSetFz() { + return this.fz != null; + } + + + /** + * @return whether r is set + */ + public boolean isSetR() { + return this.r != null; + } + + + /** + * Set the value of absoluteCx + */ + public void setAbsoluteCx(Boolean absoluteCx) { + Boolean oldAbsoluteCx = this.absoluteCx; + this.absoluteCx = absoluteCx; + firePropertyChange(RenderConstants.absoluteCx, oldAbsoluteCx, this.absoluteCx); + } + + + /** + * Set the value of absoluteCy + */ + public void setAbsoluteCy(Boolean absoluteCy) { + Boolean oldAbsoluteCy = this.absoluteCy; + this.absoluteCy = absoluteCy; + firePropertyChange(RenderConstants.absoluteCy, oldAbsoluteCy, this.absoluteCy); + } + + + /** + * Set the value of absoluteCz + */ + public void setAbsoluteCz(Boolean absoluteCz) { + Boolean oldAbsoluteCz = this.absoluteCz; + this.absoluteCz = absoluteCz; + firePropertyChange(RenderConstants.absoluteCz, oldAbsoluteCz, this.absoluteCz); + } + + + /** + * Set the value of absoluteFx + */ + public void setAbsoluteFx(Boolean absoluteFx) { + Boolean oldAbsoluteFx = this.absoluteFx; + this.absoluteFx = absoluteFx; + firePropertyChange(RenderConstants.absoluteFx, oldAbsoluteFx, this.absoluteFx); + } + + + /** + * Set the value of absoluteFy + */ + public void setAbsoluteFy(Boolean absoluteFy) { + Boolean oldAbsoluteFy = this.absoluteFy; + this.absoluteFy = absoluteFy; + firePropertyChange(RenderConstants.absoluteFy, oldAbsoluteFy, this.absoluteFy); + } + + + /** + * Set the value of absoluteFz + */ + public void setAbsoluteFz(Boolean absoluteFz) { + Boolean oldAbsoluteFz = this.absoluteFz; + this.absoluteFz = absoluteFz; + firePropertyChange(RenderConstants.absoluteFz, oldAbsoluteFz, this.absoluteFz); + } + + + /** + * Set the value of absoluteR + */ + public void setAbsoluteR(Boolean absoluteR) { + Boolean oldAbsoluteR = this.absoluteR; + this.absoluteR = absoluteR; + firePropertyChange(RenderConstants.absoluteR, oldAbsoluteR, this.absoluteR); + } + + + /** + * Set the value of cx + */ + public void setCx(Double cx) { + Double oldCx = this.cx; + this.cx = cx; + firePropertyChange(RenderConstants.cx, oldCx, this.cx); + } + + + /** + * Set the value of cy + */ + public void setCy(Double cy) { + Double oldCy = this.cy; + this.cy = cy; + firePropertyChange(RenderConstants.cy, oldCy, this.cy); + } + + + /** + * Set the value of cz + */ + public void setCz(Double cz) { + Double oldCz = this.cz; + this.cz = cz; + firePropertyChange(RenderConstants.cz, oldCz, this.cz); + } + + + /** + * Set the value of fx + */ + public void setFx(Double fx) { + Double oldFx = this.fx; + this.fx = fx; + firePropertyChange(RenderConstants.fx, oldFx, this.fx); + } + + + /** + * Set the value of fy + */ + public void setFy(Double fy) { + Double oldFy = this.fy; + this.fy = fy; + firePropertyChange(RenderConstants.fy, oldFy, this.fy); + } + + + /** + * Set the value of fz + */ + public void setFz(Double fz) { + Double oldFz = this.fz; + this.fz = fz; + firePropertyChange(RenderConstants.fz, oldFz, this.fz); + } + + + /** + * Set the value of r + */ + public void setR(Double r) { + Double oldR = this.r; + this.r = r; + firePropertyChange(RenderConstants.r, oldR, this.r); + } + + + /** + * Unsets the variable absoluteCx + * @return <code>true</code>, if absoluteCx was set before, + * otherwise <code>false</code> + */ + public boolean unsetAbsoluteCx() { + if (isSetAbsoluteCx()) { + Boolean oldAbsoluteCx = this.absoluteCx; + this.absoluteCx = null; + firePropertyChange(RenderConstants.absoluteCx, oldAbsoluteCx, this.absoluteCx); + return true; + } + return false; + } + + + /** + * Unsets the variable absoluteCy + * @return <code>true</code>, if absoluteCy was set before, + * otherwise <code>false</code> + */ + public boolean unsetAbsoluteCy() { + if (isSetAbsoluteCy()) { + Boolean oldAbsoluteCy = this.absoluteCy; + this.absoluteCy = null; + firePropertyChange(RenderConstants.absoluteCy, oldAbsoluteCy, this.absoluteCy); + return true; + } + return false; + } + + + /** + * Unsets the variable absoluteCz + * @return <code>true</code>, if absoluteCz was set before, + * otherwise <code>false</code> + */ + public boolean unsetAbsoluteCz() { + if (isSetAbsoluteCz()) { + Boolean oldAbsoluteCz = this.absoluteCz; + this.absoluteCz = null; + firePropertyChange(RenderConstants.absoluteCz, oldAbsoluteCz, this.absoluteCz); + return true; + } + return false; + } + + + /** + * Unsets the variable absoluteFx + * @return <code>true</code>, if absoluteFx was set before, + * otherwise <code>false</code> + */ + public boolean unsetAbsoluteFx() { + if (isSetAbsoluteFx()) { + Boolean oldAbsoluteFx = this.absoluteFx; + this.absoluteFx = null; + firePropertyChange(RenderConstants.absoluteFx, oldAbsoluteFx, this.absoluteFx); + return true; + } + return false; + } + + + /** + * Unsets the variable absoluteFy + * @return <code>true</code>, if absoluteFy was set before, + * otherwise <code>false</code> + */ + public boolean unsetAbsoluteFy() { + if (isSetAbsoluteFy()) { + Boolean oldAbsoluteFy = this.absoluteFy; + this.absoluteFy = null; + firePropertyChange(RenderConstants.absoluteFy, oldAbsoluteFy, this.absoluteFy); + return true; + } + return false; + } + + + /** + * Unsets the variable absoluteFz + * @return <code>true</code>, if absoluteFz was set before, + * otherwise <code>false</code> + */ + public boolean unsetAbsoluteFz() { + if (isSetAbsoluteFz()) { + Boolean oldAbsoluteFz = this.absoluteFz; + this.absoluteFz = null; + firePropertyChange(RenderConstants.absoluteFz, oldAbsoluteFz, this.absoluteFz); + return true; + } + return false; + } + + + /** + * Unsets the variable absoluteR + * @return <code>true</code>, if absoluteR was set before, + * otherwise <code>false</code> + */ + public boolean unsetAbsoluteR() { + if (isSetAbsoluteR()) { + Boolean oldAbsoluteR = this.absoluteR; + this.absoluteR = null; + firePropertyChange(RenderConstants.absoluteR, oldAbsoluteR, this.absoluteR); + return true; + } + return false; + } + + + /** + * Unsets the variable cx + * @return <code>true</code>, if cx was set before, + * otherwise <code>false</code> + */ + public boolean unsetCx() { + if (isSetCx()) { + Double oldCx = this.cx; + this.cx = null; + firePropertyChange(RenderConstants.cx, oldCx, this.cx); + return true; + } + return false; + } + + + /** + * Unsets the variable cy + * @return <code>true</code>, if cy was set before, + * otherwise <code>false</code> + */ + public boolean unsetCy() { + if (isSetCy()) { + Double oldCy = this.cy; + this.cy = null; + firePropertyChange(RenderConstants.cy, oldCy, this.cy); + return true; + } + return false; + } + + + /** + * Unsets the variable cz + * @return <code>true</code>, if cz was set before, + * otherwise <code>false</code> + */ + public boolean unsetCz() { + if (isSetCz()) { + Double oldCz = this.cz; + this.cz = null; + firePropertyChange(RenderConstants.cz, oldCz, this.cz); + return true; + } + return false; + } + + + /** + * Unsets the variable fx + * @return <code>true</code>, if fx was set before, + * otherwise <code>false</code> + */ + public boolean unsetFx() { + if (isSetFx()) { + Double oldFx = this.fx; + this.fx = null; + firePropertyChange(RenderConstants.fx, oldFx, this.fx); + return true; + } + return false; + } + + + /** + * Unsets the variable fy + * @return <code>true</code>, if fy was set before, + * otherwise <code>false</code> + */ + public boolean unsetFy() { + if (isSetFy()) { + Double oldFy = this.fy; + this.fy = null; + firePropertyChange(RenderConstants.fy, oldFy, this.fy); + return true; + } + return false; + } + + /** + * Unsets the variable fz + * @return <code>true</code>, if fz was set before, + * otherwise <code>false</code> + */ + public boolean unsetFz() { + if (isSetFz()) { + Double oldFz = this.fz; + this.fz = null; + firePropertyChange(RenderConstants.fz, oldFz, this.fz); + return true; + } + return false; + } + /** + * Unsets the variable r + * @return <code>true</code>, if r was set before, + * otherwise <code>false</code> + */ + public boolean unsetR() { + if (isSetR()) { + Double oldR = this.r; + this.r = null; + firePropertyChange(RenderConstants.r, oldR, this.r); + return true; + } + return false; + } } Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderConstants.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderConstants.java 2012-05-23 10:17:36 UTC (rev 1273) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderConstants.java 2012-05-23 11:39:49 UTC (rev 1274) @@ -74,15 +74,26 @@ public static final String cx = "cx"; public static final String cy = "cy"; public static final String cz = "cz"; + public static final String fx = "fx"; + public static final String fy = "fy"; + public static final String fz = "fz"; + public static final String r = "r"; public static final String absoluteCy = "absolute-cx"; public static final String absoluteCx = "absolute-cy"; public static final String absoluteCz = "absolute-cz"; public static final String stopColor = "stop-color"; public static final String offset = "offset"; + public static final String absoluteR = "absolute-r"; + public static final String absoluteFx = "absolute-fx"; + public static final String absoluteFy = "absolute-fy"; + public static final String absoluteFz = "absolute-fz"; + public static final String listOfElements = "list-of-elements"; public static final String id = "SId"; public static final String href = "href"; public static final String enableRotationMapping = "enable-rotation-mapping"; public static final String group = "g"; public static final String boundingBox = "bounding-box"; - + public static final String transform = "trasform"; + public static final Object versionMinor = "version-minor"; + public static final Object versionMajor = "version-major"; } \ No newline at end of file Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/TextAnchor.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/TextAnchor.java 2012-05-23 10:17:36 UTC (rev 1273) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/TextAnchor.java 2012-05-23 11:39:49 UTC (rev 1274) @@ -1,6 +1,6 @@ /* - * $Id: TextAnchor.java 16:26:33 jakob $ - * $URL: TextAnchor.java $ + * $Id$ + * $URL$ * * ---------------------------------------------------------------------------- * This file is part of JSBML. Please visit <http://sbml.org/Software/JSBML> Property changes on: trunk/extensions/render/src/org/sbml/jsbml/ext/render/TextAnchor.java ___________________________________________________________________ Added: svn:keywords + Id Rev URL Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/Transformation.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/Transformation.java 2012-05-23 10:17:36 UTC (rev 1273) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/Transformation.java 2012-05-23 11:39:49 UTC (rev 1274) @@ -20,7 +20,10 @@ */ package org.sbml.jsbml.ext.render; +import java.text.MessageFormat; + import org.sbml.jsbml.AbstractSBase; +import org.sbml.jsbml.SBase; /** @@ -33,18 +36,64 @@ * @date 08.05.2012 */ public class Transformation extends AbstractSBase { - + /** + * + */ + private static final long serialVersionUID = 1845276761656867150L; protected Double[] transform = new Double[12]; - /* (non-Javadoc) - * @see org.sbml.jsbml.AbstractSBase#clone() + /** + * Creates an Transformation instance */ + public Transformation() { + super(); + initDefaults(); + } + + + /** + * Clone constructor + */ + public Transformation(Transformation obj) { + super(obj); + transform = obj.transform; + } + + + /** + * clones this class + */ + public Transformation clone() { + return new Transformation(this); + } + @Override - public AbstractSBase clone() { - // TODO Auto-generated method stub - return null; + public boolean getAllowsChildren() { + return false; } + @Override + public SBase getChildAt(int childIndex) { + if (childIndex < 0) { + throw new IndexOutOfBoundsException(childIndex + " < 0"); + } + int pos = 0; + throw new IndexOutOfBoundsException(MessageFormat.format( + "Index {0,number,integer} >= {1,number,integer}", childIndex, + +((int) Math.min(pos, 0)))); + } + @Override + public int getChildCount() { + return 0; + } + + /** + * Initializes the default values using the namespace. + */ + public void initDefaults() { + addNamespace(RenderConstants.namespaceURI); + } + /* (non-Javadoc) * @see org.sbml.jsbml.AbstractSBase#toString() */ Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/Transformation2D.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/Transformation2D.java 2012-05-23 10:17:36 UTC (rev 1273) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/Transformation2D.java 2012-05-23 11:39:49 UTC (rev 1274) @@ -20,7 +20,9 @@ */ package org.sbml.jsbml.ext.render; +import org.sbml.jsbml.PropertyUndefinedError; + /** * @author Eugen Netz * @author Alexander Diamantikos @@ -31,5 +33,91 @@ * @date 08.05.2012 */ public class Transformation2D extends Transformation { - protected Double[] transform = new Double[6]; + /** + * + */ + private static final long serialVersionUID = -1737694519381619398L; + + + public static final int MIN_SBML_LEVEL = 3; + + + public static final int MIN_SBML_VERSION = 1; + + protected Double[] transform = new Double[6]; + + /** + * Creates an Transformation2D instance + */ + public Transformation2D() { + super(); + initDefaults(); + } + + /** + * Clone constructor + */ + public Transformation2D(Transformation2D obj) { + super(obj); + transform = obj.transform; + } + + + /** + * clones this class + */ + public Transformation2D clone() { + return new Transformation2D(this); + } + + + /** + * @return the value of transform + */ + public Double[] getTransform() { + if (isSetTransform()) { + return transform; + } + // This is necessary if we cannot return null here. + throw new PropertyUndefinedError(RenderConstants.transform, this); + } + + + /** + * Initializes the default values using the namespace. + */ + public void initDefaults() { + addNamespace(RenderConstants.namespaceURI); + } + + + /** + * @return whether transform is set + */ + public boolean isSetTransform() { + return this.transform != null; + } + + /** + * Set the value of transform + */ + public void setTransform(Double[] transform) { + Double[] oldTransform = this.transform; + this.transform = transform; + firePropertyChange(RenderConstants.transform, oldTransform, this.transform); + } + /** + * Unsets the variable transform + * @return <code>true</code>, if transform was set before, + * otherwise <code>false</code> + */ + public boolean unsetTransform() { + if (isSetTransform()) { + Double[] oldTransform = this.transform; + this.transform = null; + firePropertyChange(RenderConstants.transform, oldTransform, this.transform); + return true; + } + return false; + } } Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/VTextAnchor.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/VTextAnchor.java 2012-05-23 10:17:36 UTC (rev 1273) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/VTextAnchor.java 2012-05-23 11:39:49 UTC (rev 1274) @@ -1,6 +1,6 @@ /* - * $Id: VTextAnchor.java 16:27:35 jakob $ - * $URL: VTextAnchor.java $ + * $Id$ + * $URL$ * * ---------------------------------------------------------------------------- * This file is part of JSBML. Please visit <http://sbml.org/Software/JSBML> Property changes on: trunk/extensions/render/src/org/sbml/jsbml/ext/render/VTextAnchor.java ___________________________________________________________________ Added: svn:keywords + Id Rev URL This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <and...@us...> - 2012-05-23 10:17:47
|
Revision: 1273 http://jsbml.svn.sourceforge.net/jsbml/?rev=1273&view=rev Author: andreas-draeger Date: 2012-05-23 10:17:36 +0000 (Wed, 23 May 2012) Log Message: ----------- Removed override tags where these caused compilation problems with 1.5. Modified Paths: -------------- trunk/core/src/org/sbml/jsbml/xml/XMLNode.java trunk/core/src/org/sbml/jsbml/xml/XMLToken.java trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/Position.java trunk/extensions/qual/src/org/sbml/jsbml/xml/parsers/QualParser.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/AbstractRenderPlugin.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/ColorDefinition.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/FontFamily.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/FontRenderStyle.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/GlobalRenderInformation.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/GradientStop.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/LocalRenderInformation.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/Point3D.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/Rectangle.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderCubicBezier.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderInformationBase.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderLayoutPlugin.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderModelPlugin.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderPoint.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/Style.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/Text.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/TextAnchor.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/Transformation.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/VTextAnchor.java trunk/modules/libSBMLio/test/org/sbml/jsbml/libsbmlio/SimpleApplication.java trunk/modules/libSBMLio/test/org/sbml/jsbml/test/LibSBMLioTest.java Property Changed: ---------------- trunk/modules/libSBMLio/test/org/sbml/jsbml/libsbmlio/SimpleApplication.java trunk/modules/libSBMLio/test/org/sbml/jsbml/test/LibSBMLioTest.java Modified: trunk/core/src/org/sbml/jsbml/xml/XMLNode.java =================================================================== --- trunk/core/src/org/sbml/jsbml/xml/XMLNode.java 2012-05-23 10:05:40 UTC (rev 1272) +++ trunk/core/src/org/sbml/jsbml/xml/XMLNode.java 2012-05-23 10:17:36 UTC (rev 1273) @@ -262,7 +262,7 @@ * @param orig the {@link XMLNode} instance to copy. */ public XMLNode(XMLNode orig) { - super((XMLToken) orig); + super(orig); if (orig.childrenElements.size() > 0) { for (XMLNode origchildren : orig.childrenElements) { @@ -454,8 +454,7 @@ return OPERATION_SUCCESS; } - /* - * (non-Javadoc) + /* (non-Javadoc) * @see org.sbml.jsbml.xml.XMLToken#clone() */ public XMLNode clone() { Modified: trunk/core/src/org/sbml/jsbml/xml/XMLToken.java =================================================================== --- trunk/core/src/org/sbml/jsbml/xml/XMLToken.java 2012-05-23 10:05:40 UTC (rev 1272) +++ trunk/core/src/org/sbml/jsbml/xml/XMLToken.java 2012-05-23 10:17:36 UTC (rev 1273) @@ -30,7 +30,7 @@ * Representation of a token in an XML stream. * <p> * <em style='color: #555'> - * This class of objects is defined by jsbml only and has no direct + * This class of objects is defined by JSBML only and has no direct * equivalent in terms of SBML components. This class is not prescribed by * the SBML specifications, although it is used to implement features * defined in SBML. @@ -542,16 +542,14 @@ } - /* - * (non-Javadoc) + /* (non-Javadoc) * @see java.lang.Object#clone() */ @Override public abstract XMLToken clone(); - /* - * (non-Javadoc) + /* (non-Javadoc) * @see org.sbml.jsbml.AbstractTreeNode#equals(java.lang.Object) */ @Override @@ -1524,8 +1522,7 @@ } - /* - * (non-Javadoc) + /* (non-Javadoc) * @see java.lang.Object#toString() */ @Override Modified: trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/Position.java =================================================================== --- trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/Position.java 2012-05-23 10:05:40 UTC (rev 1272) +++ trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/Position.java 2012-05-23 10:17:36 UTC (rev 1273) @@ -42,9 +42,9 @@ clonePointAttributes(point, this); } -@Override + @Override public Position clone() { - return new Position(this); + return new Position(this); } } Modified: trunk/extensions/qual/src/org/sbml/jsbml/xml/parsers/QualParser.java =================================================================== --- trunk/extensions/qual/src/org/sbml/jsbml/xml/parsers/QualParser.java 2012-05-23 10:05:40 UTC (rev 1272) +++ trunk/extensions/qual/src/org/sbml/jsbml/xml/parsers/QualParser.java 2012-05-23 10:17:36 UTC (rev 1273) @@ -273,6 +273,7 @@ /* (non-Javadoc) * @see org.sbml.jsbml.xml.parsers.AbstractReaderWriter#writeElement(org.sbml.jsbml.xml.stax.SBMLObjectForXML, java.lang.Object) */ + @Override public void writeElement(SBMLObjectForXML xmlObject, Object sbmlElementToWrite) { @@ -282,7 +283,7 @@ logger.debug("writeElement : " + sbmlElementToWrite.getClass().getSimpleName()); } - if (sbmlElementToWrite instanceof FunctionTerm && + if ((sbmlElementToWrite instanceof FunctionTerm) && ((FunctionTerm) sbmlElementToWrite).isDefaultTerm()) { xmlObject.setName("defaultTerm"); Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/AbstractRenderPlugin.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/AbstractRenderPlugin.java 2012-05-23 10:05:40 UTC (rev 1272) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/AbstractRenderPlugin.java 2012-05-23 10:17:36 UTC (rev 1273) @@ -116,6 +116,7 @@ versionMinor = 0; } + // TODO: Move to RenderConstants public static final int MIN_SBML_LEVEL = 3; public static final int MIN_SBML_VERSION = 1; @@ -249,34 +250,50 @@ return false; } - @Override + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.SBasePlugin#readAttribute(java.lang.String, java.lang.String, java.lang.String) + */ + // @Override public boolean readAttribute(String attributeName, String prefix, String value) { // TODO Auto-generated method stub return false; } - @Override + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.SBasePlugin#getChildAt(int) + */ + // @Override public TreeNode getChildAt(int childIndex) { // TODO Auto-generated method stub return null; } - @Override + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.SBasePlugin#getChildCount() + */ + // @Override public int getChildCount() { // TODO Auto-generated method stub return 0; } - @Override + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.SBasePlugin#getAllowsChildren() + */ + // @Override public boolean getAllowsChildren() { // TODO Auto-generated method stub return false; } - @Override + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.SBasePlugin#writeXMLAttributes() + */ + // @Override public Map<String, String> writeXMLAttributes() { // TODO Auto-generated method stub return null; } + } Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/ColorDefinition.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/ColorDefinition.java 2012-05-23 10:05:40 UTC (rev 1272) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/ColorDefinition.java 2012-05-23 10:17:36 UTC (rev 1273) @@ -162,7 +162,7 @@ return false; } - + // TODO: Move to RenderConstants public static final int MIN_SBML_LEVEL = 3; public static final int MIN_SBML_VERSION = 1; Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/FontFamily.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/FontFamily.java 2012-05-23 10:05:40 UTC (rev 1272) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/FontFamily.java 2012-05-23 10:17:36 UTC (rev 1273) @@ -27,6 +27,7 @@ * @since 1.0 * @date 16.05.2012 */ +//TODO: Set SVN properties. public enum FontFamily { serif, sans_serif, Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/FontRenderStyle.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/FontRenderStyle.java 2012-05-23 10:05:40 UTC (rev 1272) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/FontRenderStyle.java 2012-05-23 10:17:36 UTC (rev 1273) @@ -26,6 +26,7 @@ * @since 1.0 * @date 16.05.2012 */ +//TODO: Set SVN properties. public interface FontRenderStyle { /** @@ -182,4 +183,5 @@ * otherwise <code>false</code> */ public abstract boolean unsetVTextAnchor(); + } Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/GlobalRenderInformation.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/GlobalRenderInformation.java 2012-05-23 10:05:40 UTC (rev 1272) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/GlobalRenderInformation.java 2012-05-23 10:17:36 UTC (rev 1273) @@ -108,6 +108,7 @@ /** * clones this class */ + @Override public GlobalRenderInformation clone() { return new GlobalRenderInformation(this); } @@ -116,12 +117,14 @@ /** * Initializes the default values using the namespace. */ + @Override public void initDefaults() { addNamespace(RenderConstants.namespaceURI); // TODO: init default values here if necessary, e.g.: // bar = null; } + // TODO: Move to RenderConstants public static final int MIN_SBML_LEVEL = 3; public static final int MIN_SBML_VERSION = 1; Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/GradientStop.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/GradientStop.java 2012-05-23 10:05:40 UTC (rev 1272) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/GradientStop.java 2012-05-23 10:17:36 UTC (rev 1273) @@ -179,6 +179,7 @@ return false; } + // TODO: Move to RenderConstants public static final int MIN_SBML_LEVEL = 3; public static final int MIN_SBML_VERSION = 1; Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/LocalRenderInformation.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/LocalRenderInformation.java 2012-05-23 10:05:40 UTC (rev 1272) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/LocalRenderInformation.java 2012-05-23 10:17:36 UTC (rev 1273) @@ -235,7 +235,7 @@ /** * */ - + // TODO: Move to RenderConstants public static final int MIN_SBML_LEVEL = 3; public static final int MIN_SBML_VERSION = 1; } Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/Point3D.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/Point3D.java 2012-05-23 10:05:40 UTC (rev 1272) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/Point3D.java 2012-05-23 10:17:36 UTC (rev 1273) @@ -26,6 +26,7 @@ * @since 1.0 * @date 16.05.2012 */ +//TODO: Set SVN properties. public interface Point3D { /** @@ -182,4 +183,5 @@ * otherwise <code>false</code> */ public abstract boolean unsetZ(); + } Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/Rectangle.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/Rectangle.java 2012-05-23 10:05:40 UTC (rev 1272) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/Rectangle.java 2012-05-23 10:17:36 UTC (rev 1273) @@ -746,19 +746,29 @@ ry = 0d; } + // TODO: Move to RenderConstants public static final int MIN_SBML_LEVEL = 3; public static final int MIN_SBML_VERSION = 1; + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.render.GraphicalPrimitive1D#getAllowsChildren() + */ @Override public boolean getAllowsChildren() { return false; } + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.render.GraphicalPrimitive1D#getChildCount() + */ @Override public int getChildCount() { return 0; } + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.render.GraphicalPrimitive1D#getChildAt(int) + */ @Override public SBase getChildAt(int childIndex) { if (childIndex < 0) { Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderCubicBezier.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderCubicBezier.java 2012-05-23 10:05:40 UTC (rev 1272) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderCubicBezier.java 2012-05-23 10:17:36 UTC (rev 1273) @@ -36,6 +36,8 @@ * @date 08.05.2012 */ public class RenderCubicBezier extends RenderPoint { + + // TODO: Move to RenderConstants public static final int MIN_SBML_LEVEL = 3; public static final int MIN_SBML_VERSION = 1; /** Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderInformationBase.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderInformationBase.java 2012-05-23 10:05:40 UTC (rev 1272) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderInformationBase.java 2012-05-23 10:17:36 UTC (rev 1273) @@ -530,7 +530,7 @@ } - + // TODO: Move to RenderConstants public static final int MIN_SBML_LEVEL = 3; public static final int MIN_SBML_VERSION = 1; Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderLayoutPlugin.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderLayoutPlugin.java 2012-05-23 10:05:40 UTC (rev 1272) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderLayoutPlugin.java 2012-05-23 10:17:36 UTC (rev 1273) @@ -76,6 +76,7 @@ // bar = null; } + // TODO: Move to RenderConstants public static final int MIN_SBML_LEVEL = 3; public static final int MIN_SBML_VERSION = 1; Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderModelPlugin.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderModelPlugin.java 2012-05-23 10:05:40 UTC (rev 1272) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderModelPlugin.java 2012-05-23 10:17:36 UTC (rev 1273) @@ -35,6 +35,7 @@ */ public class RenderModelPlugin extends AbstractRenderPlugin { + // TODO: Move to RenderConstants public static final int MIN_SBML_LEVEL = 3; public static final int MIN_SBML_VERSION = 1; Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderPoint.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderPoint.java 2012-05-23 10:05:40 UTC (rev 1272) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderPoint.java 2012-05-23 10:17:36 UTC (rev 1273) @@ -37,8 +37,11 @@ * @date 08.05.2012 */ public class RenderPoint extends AbstractSBase implements Point3D { + + // TODO: Move to RenderConstants public static final int MIN_SBML_LEVEL = 3; public static final int MIN_SBML_VERSION = 1; + /** * */ Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/Style.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/Style.java 2012-05-23 10:05:40 UTC (rev 1272) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/Style.java 2012-05-23 10:17:36 UTC (rev 1273) @@ -122,6 +122,7 @@ this.typeList = null; } + // TODO: Move to RenderConstants public static final int MIN_SBML_LEVEL = 3; public static final int MIN_SBML_VERSION = 1; Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/Text.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/Text.java 2012-05-23 10:05:40 UTC (rev 1272) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/Text.java 2012-05-23 10:17:36 UTC (rev 1273) @@ -562,4 +562,5 @@ } return false; } + } Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/TextAnchor.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/TextAnchor.java 2012-05-23 10:05:40 UTC (rev 1272) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/TextAnchor.java 2012-05-23 10:17:36 UTC (rev 1273) @@ -30,6 +30,7 @@ * @since 1.0 * @date 16.05.2012 */ +// TODO: Set SVN properties. public enum TextAnchor { start, middle, Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/Transformation.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/Transformation.java 2012-05-23 10:05:40 UTC (rev 1272) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/Transformation.java 2012-05-23 10:17:36 UTC (rev 1273) @@ -33,6 +33,7 @@ * @date 08.05.2012 */ public class Transformation extends AbstractSBase { + protected Double[] transform = new Double[12]; /* (non-Javadoc) @@ -52,4 +53,5 @@ // TODO Auto-generated method stub return null; } + } Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/VTextAnchor.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/VTextAnchor.java 2012-05-23 10:05:40 UTC (rev 1272) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/VTextAnchor.java 2012-05-23 10:17:36 UTC (rev 1273) @@ -30,6 +30,7 @@ * @since 1.0 * @date 16.05.2012 */ +// TODO: Set SVN properties. public enum VTextAnchor { top, middle, Modified: trunk/modules/libSBMLio/test/org/sbml/jsbml/libsbmlio/SimpleApplication.java =================================================================== --- trunk/modules/libSBMLio/test/org/sbml/jsbml/libsbmlio/SimpleApplication.java 2012-05-23 10:05:40 UTC (rev 1272) +++ trunk/modules/libSBMLio/test/org/sbml/jsbml/libsbmlio/SimpleApplication.java 2012-05-23 10:17:36 UTC (rev 1273) @@ -1,6 +1,6 @@ /* - * $Id: FormulaTest.java 102 2009-12-13 19:52:50Z andreas-draeger $ - * $URL: https://jsbml.svn.sourceforge.net/svnroot/jsbml/trunk/src/org/sbml/jsbml/io/FormulaTest.java $ + * $Id$ + * $URL$ * ---------------------------------------------------------------------------- * This file is part of JSBML. Please visit <http://sbml.org/Software/JSBML> * for the latest version of JSBML and more information about SBML. Property changes on: trunk/modules/libSBMLio/test/org/sbml/jsbml/libsbmlio/SimpleApplication.java ___________________________________________________________________ Added: svn:keywords + Id URL Rev Modified: trunk/modules/libSBMLio/test/org/sbml/jsbml/test/LibSBMLioTest.java =================================================================== --- trunk/modules/libSBMLio/test/org/sbml/jsbml/test/LibSBMLioTest.java 2012-05-23 10:05:40 UTC (rev 1272) +++ trunk/modules/libSBMLio/test/org/sbml/jsbml/test/LibSBMLioTest.java 2012-05-23 10:17:36 UTC (rev 1273) @@ -1,6 +1,6 @@ /* - * $Id: FormulaTest.java 102 2009-12-13 19:52:50Z andreas-draeger $ - * $URL: https://jsbml.svn.sourceforge.net/svnroot/jsbml/trunk/src/org/sbml/jsbml/io/FormulaTest.java $ + * $Id$ + * $URL$ * ---------------------------------------------------------------------------- * This file is part of JSBML. Please visit <http://sbml.org/Software/JSBML> * for the latest version of JSBML and more information about SBML. Property changes on: trunk/modules/libSBMLio/test/org/sbml/jsbml/test/LibSBMLioTest.java ___________________________________________________________________ Added: svn:keywords + Id URL Rev This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rud...@us...> - 2012-05-23 10:05:51
|
Revision: 1272 http://jsbml.svn.sourceforge.net/jsbml/?rev=1272&view=rev Author: rudolph-jan Date: 2012-05-23 10:05:40 +0000 (Wed, 23 May 2012) Log Message: ----------- render extension: filled classes: Group, Image, LineEnding, LinearGradient added necessary RenderConstants Modified Paths: -------------- trunk/extensions/render/src/org/sbml/jsbml/ext/render/Group.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/Image.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/LineEnding.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/LinearGradient.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderConstants.java Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/Group.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/Group.java 2012-05-23 09:09:52 UTC (rev 1271) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/Group.java 2012-05-23 10:05:40 UTC (rev 1272) @@ -20,7 +20,13 @@ */ package org.sbml.jsbml.ext.render; +import java.text.MessageFormat; +import org.sbml.jsbml.LevelVersionError; +import org.sbml.jsbml.PropertyUndefinedError; +import org.sbml.jsbml.SBase; + + /** * @author Eugen Netz * @author Alexander Diamantikos @@ -31,8 +37,516 @@ * @date 08.05.2012 */ public class Group extends GraphicalPrimitive2D { - protected String iD; - protected FontRenderStyle text; //FIXME text hast to many fields (coordinates) - protected String startHead; - protected String endHead; + /** + * + */ + private static final long serialVersionUID = 2302368129571619877L; + private String id; + private FontFamily fontFamily; + private Short fontSize; + private Boolean fontWeightBold, fontStyleItalic; + private TextAnchor textAnchor; + private VTextAnchor vTextAnchor; + private String startHead; + private String endHead; + + /** + * Creates an Group instance + */ + public Group() { + super(); + initDefaults(); + } + + /** + * Creates a Group instance with an id. + * + * @param id + */ + public Group(String id) { + super(); + this.id = id; + initDefaults(); + } + + /** + * Creates a Group instance with a level and version. + * + * @param level + * @param version + */ + public Group(int level, int version) { + this(null, null, level, version); + } + + /** + * Creates a Group instance with an id, level, and version. + * + * @param id + * @param level + * @param version + */ + public Group(String id, int level, int version) { + this(id, null, level, version); + } + + /** + * Creates a Group instance with an id, name, level, and version. + * + * @param id + * @param name + * @param level + * @param version + */ + public Group(String id, String name, int level, int version) { + super(); + this.id = id; + if (getLevelAndVersion().compareTo(Integer.valueOf(MIN_SBML_LEVEL), + Integer.valueOf(MIN_SBML_VERSION)) < 0) { + throw new LevelVersionError(getElementName(), level, version); + } + initDefaults(); + } + + /** + * Clone constructor + */ + public Group(Group obj) { + super(obj); + this.id = obj.id; + this.fontFamily = obj.fontFamily; + this.fontSize = obj.fontSize; + this.fontStyleItalic = obj.fontStyleItalic; + this.fontWeightBold = obj.fontWeightBold; + this.textAnchor = obj.textAnchor; + this.vTextAnchor = obj.vTextAnchor; + this.startHead = obj.startHead; + this.endHead = obj.endHead; + } + + /** + * clones this class + */ + public Group clone() { + return new Group(this); + } + + /** + * Initializes the default values using the namespace. + */ + public void initDefaults() { + addNamespace(RenderConstants.namespaceURI); + } + + public static final int MIN_SBML_LEVEL = 3; + public static final int MIN_SBML_VERSION = 1; + + + + @Override + public boolean getAllowsChildren() { + return false; + } + + public int getChildCount() { + int count = 0; + return count; + } + + public SBase getChildAt(int childIndex) { + if (childIndex < 0) { + throw new IndexOutOfBoundsException(childIndex + " < 0"); + } + int pos = 0; + throw new IndexOutOfBoundsException(MessageFormat.format( + "Index {0,number,integer} >= {1,number,integer}", childIndex, + +((int) Math.min(pos, 0)))); + } + + + /** + * @return the value of id + */ + public String getId() { + if (isSetId()) { + return id; + } + // This is necessary if we cannot return null here. + throw new PropertyUndefinedError(RenderConstants.id, this); + } + + /** + * @return whether id is set + */ + public boolean isSetId() { + return this.id != null; + } + + /** + * Set the value of id + */ + public void setId(String id) { + String oldId = this.id; + this.id = id; + firePropertyChange(RenderConstants.id, oldId, this.id); + } + + /** + * Unsets the variable id + * @return <code>true</code>, if id was set before, + * otherwise <code>false</code> + */ + public boolean unsetId() { + if (isSetId()) { + String oldId = this.id; + this.id = null; + firePropertyChange(RenderConstants.id, oldId, this.id); + return true; + } + return false; + } + + + /** + * @return the value of fontFamily + */ + public FontFamily getFontFamily() { + if (isSetFontFamily()) { + return fontFamily; + } + // This is necessary if we cannot return null here. + throw new PropertyUndefinedError(RenderConstants.fontFamily, this); + } + + /** + * @return whether fontFamily is set + */ + public boolean isSetFontFamily() { + return this.fontFamily != null; + } + + /** + * Set the value of fontFamily + */ + public void setFontFamily(FontFamily fontFamily) { + FontFamily oldFontFamily = this.fontFamily; + this.fontFamily = fontFamily; + firePropertyChange(RenderConstants.fontFamily, oldFontFamily, this.fontFamily); + } + + /** + * Unsets the variable fontFamily + * @return <code>true</code>, if fontFamily was set before, + * otherwise <code>false</code> + */ + public boolean unsetFontFamily() { + if (isSetFontFamily()) { + FontFamily oldFontFamily = this.fontFamily; + this.fontFamily = null; + firePropertyChange(RenderConstants.fontFamily, oldFontFamily, this.fontFamily); + return true; + } + return false; + } + + + /** + * @return the value of fontSize + */ + public Short getFontSize() { + if (isSetFontSize()) { + return fontSize; + } + // This is necessary if we cannot return null here. + throw new PropertyUndefinedError(RenderConstants.fontSize, this); + } + + /** + * @return whether fontSize is set + */ + public boolean isSetFontSize() { + return this.fontSize != null; + } + + /** + * Set the value of fontSize + */ + public void setFontSize(Short fontSize) { + Short oldFontSize = this.fontSize; + this.fontSize = fontSize; + firePropertyChange(RenderConstants.fontSize, oldFontSize, this.fontSize); + } + + /** + * Unsets the variable fontSize + * @return <code>true</code>, if fontSize was set before, + * otherwise <code>false</code> + */ + public boolean unsetFontSize() { + if (isSetFontSize()) { + short oldFontSize = this.fontSize; + this.fontSize = null; + firePropertyChange(RenderConstants.fontSize, oldFontSize, this.fontSize); + return true; + } + return false; + } + + + /** + * @return the value of fontWeightBold + */ + public boolean isFontWeightBold() { + if (isSetFontWeightBold()) { + return fontWeightBold; + } + // This is necessary if we cannot return null here. + throw new PropertyUndefinedError(RenderConstants.fontWeightBold, this); + } + + /** + * @return whether fontWeightBold is set + */ + public boolean isSetFontWeightBold() { + return this.fontWeightBold != null; + } + + /** + * Set the value of fontWeightBold + */ + public void setFontWeightBold(Boolean fontWeightBold) { + Boolean oldFontWeightBold = this.fontWeightBold; + this.fontWeightBold = fontWeightBold; + firePropertyChange(RenderConstants.fontWeightBold, oldFontWeightBold, this.fontWeightBold); + } + + /** + * Unsets the variable fontWeightBold + * @return <code>true</code>, if fontWeightBold was set before, + * otherwise <code>false</code> + */ + public boolean unsetFontWeightBold() { + if (isSetFontWeightBold()) { + Boolean oldFontWeightBold = this.fontWeightBold; + this.fontWeightBold = null; + firePropertyChange(RenderConstants.fontWeightBold, oldFontWeightBold, this.fontWeightBold); + return true; + } + return false; + } + + + /** + * @return the value of fontStyleItalic + */ + public boolean isFontStyleItalic() { + if (isSetFontStyleItalic()) { + return fontStyleItalic; + } + // This is necessary if we cannot return null here. + throw new PropertyUndefinedError(RenderConstants.fontStyleItalic, this); + } + + /** + * @return whether fontStyleItalic is set + */ + public boolean isSetFontStyleItalic() { + return this.fontStyleItalic != null; + } + + /** + * Set the value of fontStyleItalic + */ + public void setFontStyleItalic(Boolean fontStyleItalic) { + Boolean oldFontStyleItalic = this.fontStyleItalic; + this.fontStyleItalic = fontStyleItalic; + firePropertyChange(RenderConstants.fontStyleItalic, oldFontStyleItalic, this.fontStyleItalic); + } + + /** + * Unsets the variable fontStyleItalic + * @return <code>true</code>, if fontStyleItalic was set before, + * otherwise <code>false</code> + */ + public boolean unsetFontStyleItalic() { + if (isSetFontStyleItalic()) { + Boolean oldFontStyleItalic = this.fontStyleItalic; + this.fontStyleItalic = null; + firePropertyChange(RenderConstants.fontStyleItalic, oldFontStyleItalic, this.fontStyleItalic); + return true; + } + return false; + } + + + /** + * @return the value of startHead + */ + public String getStartHead() { + if (isSetStartHead()) { + return startHead; + } + // This is necessary if we cannot return null here. + throw new PropertyUndefinedError(RenderConstants.startHead, this); + } + + /** + * @return whether startHead is set + */ + public boolean isSetStartHead() { + return this.startHead != null; + } + + /** + * Set the value of startHead + */ + public void setStartHead(String startHead) { + String oldStartHead = this.startHead; + this.startHead = startHead; + firePropertyChange(RenderConstants.startHead, oldStartHead, this.startHead); + } + + /** + * Unsets the variable startHead + * @return <code>true</code>, if startHead was set before, + * otherwise <code>false</code> + */ + public boolean unsetStartHead() { + if (isSetStartHead()) { + String oldStartHead = this.startHead; + this.startHead = null; + firePropertyChange(RenderConstants.startHead, oldStartHead, this.startHead); + return true; + } + return false; + } + + + /** + * @return the value of endHead + */ + public String getEndHead() { + if (isSetEndHead()) { + return endHead; + } + // This is necessary if we cannot return null here. + throw new PropertyUndefinedError(RenderConstants.endHead, this); + } + + /** + * @return whether endHead is set + */ + public boolean isSetEndHead() { + return this.endHead != null; + } + + /** + * Set the value of endHead + */ + public void setEndHead(String endHead) { + String oldEndHead = this.endHead; + this.endHead = endHead; + firePropertyChange(RenderConstants.endHead, oldEndHead, this.endHead); + } + + /** + * Unsets the variable endHead + * @return <code>true</code>, if endHead was set before, + * otherwise <code>false</code> + */ + public boolean unsetEndHead() { + if (isSetEndHead()) { + String oldEndHead = this.endHead; + this.endHead = null; + firePropertyChange(RenderConstants.endHead, oldEndHead, this.endHead); + return true; + } + return false; + } + + + /** + * @return the value of textAnchor + */ + public TextAnchor getTextAnchor() { + if (isSetTextAnchor()) { + return textAnchor; + } + // This is necessary if we cannot return null here. + throw new PropertyUndefinedError(RenderConstants.textAnchor, this); + } + + /** + * @return whether textAnchor is set + */ + public boolean isSetTextAnchor() { + return this.textAnchor != null; + } + + /** + * Set the value of textAnchor + */ + public void setTextAnchor(TextAnchor textAnchor) { + TextAnchor oldTextAnchor = this.textAnchor; + this.textAnchor = textAnchor; + firePropertyChange(RenderConstants.textAnchor, oldTextAnchor, this.textAnchor); + } + + /** + * Unsets the variable textAnchor + * @return <code>true</code>, if textAnchor was set before, + * otherwise <code>false</code> + */ + public boolean unsetTextAnchor() { + if (isSetTextAnchor()) { + TextAnchor oldTextAnchor = this.textAnchor; + this.textAnchor = null; + firePropertyChange(RenderConstants.textAnchor, oldTextAnchor, this.textAnchor); + return true; + } + return false; + } + + + /** + * @return the value of vTextAnchor + */ + public VTextAnchor getVTextAnchor() { + if (isSetVTextAnchor()) { + return vTextAnchor; + } + // This is necessary if we cannot return null here. + throw new PropertyUndefinedError(RenderConstants.vTextAnchor, this); + } + + /** + * @return whether vTextAnchor is set + */ + public boolean isSetVTextAnchor() { + return this.vTextAnchor != null; + } + + /** + * Set the value of vTextAnchor + */ + public void setVTextAnchor(VTextAnchor vTextAnchor) { + VTextAnchor oldVTextAnchor = this.vTextAnchor; + this.vTextAnchor = vTextAnchor; + firePropertyChange(RenderConstants.vTextAnchor, oldVTextAnchor, this.vTextAnchor); + } + + /** + * Unsets the variable vTextAnchor + * @return <code>true</code>, if vTextAnchor was set before, + * otherwise <code>false</code> + */ + public boolean unsetVTextAnchor() { + if (isSetVTextAnchor()) { + VTextAnchor oldVTextAnchor = this.vTextAnchor; + this.vTextAnchor = null; + firePropertyChange(RenderConstants.vTextAnchor, oldVTextAnchor, this.vTextAnchor); + return true; + } + return false; + } } Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/Image.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/Image.java 2012-05-23 09:09:52 UTC (rev 1271) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/Image.java 2012-05-23 10:05:40 UTC (rev 1272) @@ -20,7 +20,12 @@ */ package org.sbml.jsbml.ext.render; +import java.text.MessageFormat; +import org.sbml.jsbml.PropertyUndefinedError; +import org.sbml.jsbml.SBase; + + /** * @author Eugen Netz * @author Alexander Diamantikos @@ -31,9 +36,564 @@ * @date 08.05.2012 */ public class Image extends Transformation2D { + /** + * + */ + private static final long serialVersionUID = 6031110715160806863L; private Double x, y, z; private Double width, height; private Boolean absoluteX, absoluteY, absoluteZ; private Boolean absoluteWidth, absoluteHeight; private String href; + + /** + * Creates an Image instance + */ + public Image() { + super(); + initDefaults(); + } + + /** + * Creates a Image instance with an id. + * + * @param id + */ + public Image(String id) { + super(); + initDefaults(); + } + + /** + * Clone constructor + */ + public Image(Image obj) { + super(); + absoluteHeight = obj.absoluteHeight; + absoluteWidth = obj.absoluteWidth; + absoluteX = obj.absoluteX; + absoluteY = obj.absoluteY; + absoluteZ = obj.absoluteZ; + height = obj.height; + href = obj.href; + width = obj.width; + x = obj.x; + y = obj.y; + z = obj.z; + } + + /** + * clones this class + */ + public Image clone() { + return new Image(this); + } + + /** + * Initializes the default values using the namespace. + */ + public void initDefaults() { + addNamespace(RenderConstants.namespaceURI); + // TODO: init default values here if necessary, e.g.: + // bar = null; + } + + public static final int MIN_SBML_LEVEL = 3; + public static final int MIN_SBML_VERSION = 1; + + + + @Override + public boolean getAllowsChildren() { + return false; + } + + @Override + public int getChildCount() { + int count = 0; + return count; + } + + @Override + public SBase getChildAt(int childIndex) { + if (childIndex < 0) { + throw new IndexOutOfBoundsException(childIndex + " < 0"); + } + int pos = 0; + throw new IndexOutOfBoundsException(MessageFormat.format( + "Index {0,number,integer} >= {1,number,integer}", childIndex, + +((int) Math.min(pos, 0)))); + } + + + /** + * @return the value of absoluteHeight + */ + public boolean isAbsoluteHeight() { + if (isSetAbsoluteHeight()) { + return absoluteHeight; + } + // This is necessary if we cannot return null here. + throw new PropertyUndefinedError(RenderConstants.absoluteHeight, this); + } + + /** + * @return whether absoluteHeight is set + */ + public boolean isSetAbsoluteHeight() { + return this.absoluteHeight != null; + } + + /** + * Set the value of absoluteHeight + */ + public void setAbsoluteHeight(Boolean absoluteHeight) { + Boolean oldAbsoluteHeight = this.absoluteHeight; + this.absoluteHeight = absoluteHeight; + firePropertyChange(RenderConstants.absoluteHeight, oldAbsoluteHeight, this.absoluteHeight); + } + + /** + * Unsets the variable absoluteHeight + * @return <code>true</code>, if absoluteHeight was set before, + * otherwise <code>false</code> + */ + public boolean unsetAbsoluteHeight() { + if (isSetAbsoluteHeight()) { + Boolean oldAbsoluteHeight = this.absoluteHeight; + this.absoluteHeight = null; + firePropertyChange(RenderConstants.absoluteHeight, oldAbsoluteHeight, this.absoluteHeight); + return true; + } + return false; + } + + /** + * @return the value of absoluteWidth + */ + public boolean isAbsoluteWidth() { + if (isSetAbsoluteWidth()) { + return absoluteWidth; + } + // This is necessary if we cannot return null here. + throw new PropertyUndefinedError(RenderConstants.absoluteWidth, this); + } + + /** + * @return whether absoluteWidth is set + */ + public boolean isSetAbsoluteWidth() { + return this.absoluteWidth != null; + } + + /** + * Set the value of absoluteWidth + */ + public void setAbsoluteWidth(Boolean absoluteWidth) { + Boolean oldAbsoluteWidth = this.absoluteWidth; + this.absoluteWidth = absoluteWidth; + firePropertyChange(RenderConstants.absoluteWidth, oldAbsoluteWidth, this.absoluteWidth); + } + + /** + * Unsets the variable absoluteWidth + * @return <code>true</code>, if absoluteWidth was set before, + * otherwise <code>false</code> + */ + public boolean unsetAbsoluteWidth() { + if (isSetAbsoluteWidth()) { + Boolean oldAbsoluteWidth = this.absoluteWidth; + this.absoluteWidth = null; + firePropertyChange(RenderConstants.absoluteWidth, oldAbsoluteWidth, this.absoluteWidth); + return true; + } + return false; + } + + + /** + * @return the value of absoluteX + */ + public boolean isAbsoluteX() { + if (isSetAbsoluteX()) { + return absoluteX; + } + // This is necessary if we cannot return null here. + throw new PropertyUndefinedError(RenderConstants.absoluteX, this); + } + + /** + * @return whether absoluteX is set + */ + public boolean isSetAbsoluteX() { + return this.absoluteX != null; + } + + /** + * Set the value of absoluteX + */ + public void setAbsoluteX(Boolean absoluteX) { + Boolean oldAbsoluteX = this.absoluteX; + this.absoluteX = absoluteX; + firePropertyChange(RenderConstants.absoluteX, oldAbsoluteX, this.absoluteX); + } + + /** + * Unsets the variable absoluteX + * @return <code>true</code>, if absoluteX was set before, + * otherwise <code>false</code> + */ + public boolean unsetAbsoluteX() { + if (isSetAbsoluteX()) { + Boolean oldAbsoluteX = this.absoluteX; + this.absoluteX = null; + firePropertyChange(RenderConstants.absoluteX, oldAbsoluteX, this.absoluteX); + return true; + } + return false; + } + + + /** + * @return the value of absoluteY + */ + public boolean isAbsoluteY() { + if (isSetAbsoluteY()) { + return absoluteY; + } + // This is necessary if we cannot return null here. + throw new PropertyUndefinedError(RenderConstants.absoluteY, this); + } + + /** + * @return whether absoluteY is set + */ + public boolean isSetAbsoluteY() { + return this.absoluteY != null; + } + + /** + * Set the value of absoluteY + */ + public void setAbsoluteY(Boolean absoluteY) { + Boolean oldAbsoluteY = this.absoluteY; + this.absoluteY = absoluteY; + firePropertyChange(RenderConstants.absoluteY, oldAbsoluteY, this.absoluteY); + } + + /** + * Unsets the variable absoluteY + * @return <code>true</code>, if absoluteY was set before, + * otherwise <code>false</code> + */ + public boolean unsetAbsoluteY() { + if (isSetAbsoluteY()) { + Boolean oldAbsoluteY = this.absoluteY; + this.absoluteY = null; + firePropertyChange(RenderConstants.absoluteY, oldAbsoluteY, this.absoluteY); + return true; + } + return false; + } + + + /** + * @return the value of absoluteZ + */ + public boolean isAbsoluteZ() { + if (isSetAbsoluteZ()) { + return absoluteZ; + } + // This is necessary if we cannot return null here. + throw new PropertyUndefinedError(RenderConstants.absoluteZ, this); + } + + /** + * @return whether absoluteZ is set + */ + public boolean isSetAbsoluteZ() { + return this.absoluteZ != null; + } + + /** + * Set the value of absoluteZ + */ + public void setAbsoluteZ(Boolean absoluteZ) { + Boolean oldAbsoluteZ = this.absoluteZ; + this.absoluteZ = absoluteZ; + firePropertyChange(RenderConstants.absoluteZ, oldAbsoluteZ, this.absoluteZ); + } + + /** + * Unsets the variable absoluteZ + * @return <code>true</code>, if absoluteZ was set before, + * otherwise <code>false</code> + */ + public boolean unsetAbsoluteZ() { + if (isSetAbsoluteZ()) { + Boolean oldAbsoluteZ = this.absoluteZ; + this.absoluteZ = null; + firePropertyChange(RenderConstants.absoluteZ, oldAbsoluteZ, this.absoluteZ); + return true; + } + return false; + } + + + /** + * @return the value of height + */ + public double getHeight() { + if (isSetHeight()) { + return height; + } + // This is necessary if we cannot return null here. + throw new PropertyUndefinedError(RenderConstants.height, this); + } + + /** + * @return whether height is set + */ + public boolean isSetHeight() { + return this.height != null; + } + + /** + * Set the value of height + */ + public void setHeight(Double height) { + Double oldHeight = this.height; + this.height = height; + firePropertyChange(RenderConstants.height, oldHeight, this.height); + } + + /** + * Unsets the variable height + * @return <code>true</code>, if height was set before, + * otherwise <code>false</code> + */ + public boolean unsetHeight() { + if (isSetHeight()) { + Double oldHeight = this.height; + this.height = null; + firePropertyChange(RenderConstants.height, oldHeight, this.height); + return true; + } + return false; + } + + + /** + * @return the value of href + */ + public String getHref() { + if (isSetHref()) { + return href; + } + // This is necessary if we cannot return null here. + throw new PropertyUndefinedError(RenderConstants.href, this); + } + + /** + * @return whether href is set + */ + public boolean isSetHref() { + return this.href != null; + } + + /** + * Set the value of href + */ + public void setHref(String href) { + String oldHref = this.href; + this.href = href; + firePropertyChange(RenderConstants.href, oldHref, this.href); + } + + /** + * Unsets the variable href + * @return <code>true</code>, if href was set before, + * otherwise <code>false</code> + */ + public boolean unsetHref() { + if (isSetHref()) { + String oldHref = this.href; + this.href = null; + firePropertyChange(RenderConstants.href, oldHref, this.href); + return true; + } + return false; + } + + + /** + * @return the value of width + */ + public double getWidth() { + if (isSetWidth()) { + return width; + } + // This is necessary if we cannot return null here. + throw new PropertyUndefinedError(RenderConstants.width, this); + } + + /** + * @return whether width is set + */ + public boolean isSetWidth() { + return this.width != null; + } + + /** + * Set the value of width + */ + public void setWidth(Double width) { + Double oldWidth = this.width; + this.width = width; + firePropertyChange(RenderConstants.width, oldWidth, this.width); + } + + /** + * Unsets the variable width + * @return <code>true</code>, if width was set before, + * otherwise <code>false</code> + */ + public boolean unsetWidth() { + if (isSetWidth()) { + Double oldWidth = this.width; + this.width = null; + firePropertyChange(RenderConstants.width, oldWidth, this.width); + return true; + } + return false; + } + + + /** + * @return the value of x + */ + public double getX() { + if (isSetX()) { + return x; + } + // This is necessary if we cannot return null here. + throw new PropertyUndefinedError(RenderConstants.x, this); + } + + /** + * @return whether x is set + */ + public boolean isSetX() { + return this.x != null; + } + + /** + * Set the value of x + */ + public void setX(Double x) { + Double oldX = this.x; + this.x = x; + firePropertyChange(RenderConstants.x, oldX, this.x); + } + + /** + * Unsets the variable x + * @return <code>true</code>, if x was set before, + * otherwise <code>false</code> + */ + public boolean unsetX() { + if (isSetX()) { + Double oldX = this.x; + this.x = null; + firePropertyChange(RenderConstants.x, oldX, this.x); + return true; + } + return false; + } + + + /** + * @return the value of y + */ + public double getY() { + if (isSetY()) { + return y; + } + // This is necessary if we cannot return null here. + throw new PropertyUndefinedError(RenderConstants.y, this); + } + + /** + * @return whether y is set + */ + public boolean isSetY() { + return this.y != null; + } + + /** + * Set the value of y + */ + public void setY(Double y) { + Double oldY = this.y; + this.y = y; + firePropertyChange(RenderConstants.y, oldY, this.y); + } + + /** + * Unsets the variable y + * @return <code>true</code>, if y was set before, + * otherwise <code>false</code> + */ + public boolean unsetY() { + if (isSetY()) { + Double oldY = this.y; + this.y = null; + firePropertyChange(RenderConstants.y, oldY, this.y); + return true; + } + return false; + } + + + /** + * @return the value of z + */ + public double getZ() { + if (isSetZ()) { + return z; + } + // This is necessary if we cannot return null here. + throw new PropertyUndefinedError(RenderConstants.z, this); + } + + /** + * @return whether z is set + */ + public boolean isSetZ() { + return this.z != null; + } + + /** + * Set the value of z + */ + public void setZ(Double z) { + Double oldZ = this.z; + this.z = z; + firePropertyChange(RenderConstants.z, oldZ, this.z); + } + + /** + * Unsets the variable z + * @return <code>true</code>, if z was set before, + * otherwise <code>false</code> + */ + public boolean unsetZ() { + if (isSetZ()) { + Double oldZ = this.z; + this.z = null; + firePropertyChange(RenderConstants.z, oldZ, this.z); + return true; + } + return false; + } } Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/LineEnding.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/LineEnding.java 2012-05-23 09:09:52 UTC (rev 1271) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/LineEnding.java 2012-05-23 10:05:40 UTC (rev 1272) @@ -20,6 +20,10 @@ */ package org.sbml.jsbml.ext.render; +import java.text.MessageFormat; + +import org.sbml.jsbml.PropertyUndefinedError; +import org.sbml.jsbml.SBase; import org.sbml.jsbml.ext.layout.BoundingBox; @@ -33,7 +37,200 @@ * @date 08.05.2012 */ public class LineEnding extends GraphicalPrimitive2D { - protected Boolean enableRotationMapping = true; - protected BoundingBox boundingBox; - protected Group group; + /** + * + */ + private static final long serialVersionUID = 938880502591638386L; + private Boolean enableRotationMapping; + private BoundingBox boundingBox; + private Group group; + + /** + * Creates an LineEnding instance + */ + public LineEnding() { + super(); + initDefaults(); + } + + /** + * Clone constructor + */ + public LineEnding(LineEnding obj) { + super(obj); + boundingBox = obj.boundingBox; + enableRotationMapping = obj.enableRotationMapping; + group = obj.group; + } + + /** + * clones this class + */ + @Override + public LineEnding clone() { + return new LineEnding(this); + } + + /** + * Initializes the default values using the namespace. + */ + @Override + public void initDefaults() { + addNamespace(RenderConstants.namespaceURI); + enableRotationMapping = true; + } + + public static final int MIN_SBML_LEVEL = 3; + public static final int MIN_SBML_VERSION = 1; + + + + @Override + public boolean getAllowsChildren() { + return false; + } + @Override + public int getChildCount() { + int count = 0; + return count; + } + @Override + public SBase getChildAt(int childIndex) { + if (childIndex < 0) { + throw new IndexOutOfBoundsException(childIndex + " < 0"); + } + int pos = 0; + throw new IndexOutOfBoundsException(MessageFormat.format( + "Index {0,number,integer} >= {1,number,integer}", childIndex, + +((int) Math.min(pos, 0)))); + } + + + /** + * @return the value of boundingBox + */ + public BoundingBox getBoundingBox() { + if (isSetBoundingBox()) { + return boundingBox; + } + // This is necessary if we cannot return null here. + throw new PropertyUndefinedError(RenderConstants.boundingBox, this); + } + + /** + * @return whether boundingBox is set + */ + public boolean isSetBoundingBox() { + return this.boundingBox != null; + } + + /** + * Set the value of boundingBox + */ + public void setBoundingBox(BoundingBox boundingBox) { + BoundingBox oldBoundingBox = this.boundingBox; + this.boundingBox = boundingBox; + firePropertyChange(RenderConstants.boundingBox, oldBoundingBox, this.boundingBox); + } + + /** + * Unsets the variable boundingBox + * @return <code>true</code>, if boundingBox was set before, + * otherwise <code>false</code> + */ + public boolean unsetBoundingBox() { + if (isSetBoundingBox()) { + BoundingBox oldBoundingBox = this.boundingBox; + this.boundingBox = null; + firePropertyChange(RenderConstants.boundingBox, oldBoundingBox, this.boundingBox); + return true; + } + return false; + } + + + /** + * @return the value of group + */ + public Group getGroup() { + if (isSetGroup()) { + return group; + } + // This is necessary if we cannot return null here. + throw new PropertyUndefinedError(RenderConstants.group, this); + } + + /** + * @return whether group is set + */ + public boolean isSetGroup() { + return this.group != null; + } + + /** + * Set the value of group + */ + public void setGroup(Group group) { + Group oldGroup = this.group; + this.group = group; + firePropertyChange(RenderConstants.group, oldGroup, this.group); + } + + /** + * Unsets the variable group + * @return <code>true</code>, if group was set before, + * otherwise <code>false</code> + */ + public boolean unsetGroup() { + if (isSetGroup()) { + Group oldGroup = this.group; + this.group = null; + firePropertyChange(RenderConstants.group, oldGroup, this.group); + return true; + } + return false; + } + + + /** + * @return the value of enableRotationMapping + */ + public boolean isEnableRotationMapping() { + if (isSetEnableRotationMapping()) { + return enableRotationMapping; + } + // This is necessary if we cannot return null here. + throw new PropertyUndefinedError(RenderConstants.enableRotationMapping, this); + } + + /** + * @return whether enableRotationMapping is set + */ + public boolean isSetEnableRotationMapping() { + return this.enableRotationMapping != null; + } + + /** + * Set the value of enableRotationMapping + */ + public void setEnableRotationMapping(Boolean enableRotationMapping) { + Boolean oldEnableRotationMapping = this.enableRotationMapping; + this.enableRotationMapping = enableRotationMapping; + firePropertyChange(RenderConstants.enableRotationMapping, oldEnableRotationMapping, this.enableRotationMapping); + } + + /** + * Unsets the variable enableRotationMapping + * @return <code>true</code>, if enableRotationMapping was set before, + * otherwise <code>false</code> + */ + public boolean unsetEnableRotationMapping() { + if (isSetEnableRotationMapping()) { + Boolean oldEnableRotationMapping = this.enableRotationMapping; + this.enableRotationMapping = null; + firePropertyChange(RenderConstants.enableRotationMapping, oldEnableRotationMapping, this.enableRotationMapping); + return true; + } + return false; + } } Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/LinearGradient.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/LinearGradient.java 2012-05-23 09:09:52 UTC (rev 1271) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/LinearGradient.java 2012-05-23 10:05:40 UTC (rev 1272) @@ -20,7 +20,12 @@ */ package org.sbml.jsbml.ext.render; +import java.text.MessageFormat; +import org.sbml.jsbml.PropertyUndefinedError; +import org.sbml.jsbml.SBase; + + /** * @author Eugen Netz * @author Alexander Diamantikos @@ -31,7 +36,337 @@ * @date 08.05.2012 */ public class LinearGradient extends GradientBase { - //TODO use a Point class? - private Integer x1, y1, z1, x2, y2, z2; + /** + * + */ + private static final long serialVersionUID = 825789189989621388L; + private Double x1, y1, z1, x2, y2, z2; + /** + * Creates an LinearGradient instance + */ + public LinearGradient() { + super(); + initDefaults(); + } + + /** + * Clone constructor + */ + public LinearGradient(LinearGradient obj) { + super(obj); + x1 = obj.x1; + x2 = obj.x2; + y1 = obj.y1; + y2 = obj.y2; + z1 = obj.z1; + z2 = obj.z2; + } + + /** + * clones this class + */ + @Override + public LinearGradient clone() { + return new LinearGradient(this); + } + + /** + * Initializes the default values using the namespace. + */ + @Override + public void initDefaults() { + addNamespace(RenderConstants.namespaceURI); + x1 = 0d; + y1 = 0d; + z1 = 0d; + x2 = 1d; + y2 = 1d; + z2 = 1d; + } + + public static final int MIN_SBML_LEVEL = 3; + public static final int MIN_SBML_VERSION = 1; + + + + @Override + public boolean getAllowsChildren() { + return false; + } + + @Override + public int getChildCount() { + int count = 0; + return count; + } + + @Override + public SBase getChildAt(int childIndex) { + if (childIndex < 0) { + throw new IndexOutOfBoundsException(childIndex + " < 0"); + } + int pos = 0; + throw new IndexOutOfBoundsException(MessageFormat.format( + "Index {0,number,integer} >= {1,number,integer}", childIndex, + +((int) Math.min(pos, 0)))); + } + + + /** + * @return the value of x1 + */ + public double getX1() { + if (isSetX1()) { + return x1; + } + // This is necessary if we cannot return null here. + throw new PropertyUndefinedError(RenderConstants.x1, this); + } + + /** + * @return whether x1 is set + */ + public boolean isSetX1() { + return this.x1 != null; + } + + /** + * Set the value of x1 + */ + public void setX1(Double x1) { + Double oldX1 = this.x1; + this.x1 = x1; + firePropertyChange(RenderConstants.x1, oldX1, this.x1); + } + + /** + * Unsets the variable x1 + * @return <code>true</code>, if x1 was set before, + * otherwise <code>false</code> + */ + public boolean unsetX1() { + if (isSetX1()) { + Double oldX1 = this.x1; + this.x1 = null; + firePropertyChange(RenderConstants.x1, oldX1, this.x1); + return true; + } + return false; + } + + + /** + * @return the value of x2 + */ + public double getX2() { + if (isSetX2()) { + return x2; + } + // This is necessary if we cannot return null here. + throw new PropertyUndefinedError(RenderConstants.x2, this); + } + + /** + * @return whether x2 is set + */ + public boolean isSetX2() { + return this.x2 != null; + } + + /** + * Set the value of x2 + */ + public void setX2(Double x2) { + Double oldX2 = this.x2; + this.x2 = x2; + firePropertyChange(RenderConstants.x2, oldX2, this.x2); + } + + /** + * Unsets the variable x2 + * @return <code>true</code>, if x2 was set before, + * otherwise <code>false</code> + */ + public boolean unsetX2() { + if (isSetX2()) { + Double oldX2 = this.x2; + this.x2 = null; + firePropertyChange(RenderConstants.x2, oldX2, this.x2); + return true; + } + return false; + } + + + /** + * @return the value of y1 + */ + public double getY1() { + if (isSetY1()) { + return y1; + } + // This is necessary if we cannot return null here. + throw new PropertyUndefinedError(RenderConstants.y1, this); + } + + /** + * @return whether y1 is set + */ + public boolean isSetY1() { + return this.y1 != null; + } + + /** + * Set the value of y1 + */ + public void setY1(Double y1) { + Double oldY1 = this.y1; + this.y1 = y1; + firePropertyChange(RenderConstants.y1, oldY1, this.y1); + } + + /** + * Unsets the variable y1 + * @return <code>true</code>, if y1 was set before, + * otherwise <code>false</code> + */ + public boolean unsetY1() { + if (isSetY1()) { + Double oldY1 = this.y1; + this.y1 = null; + firePropertyChange(RenderConstants.y1, oldY1, this.y1); + return true; + } + return false; + } + + + /** + * @return the value of y2 + */ + public double getY2() { + if (isSetY2()) { + return y2; + } + // This is necessary if we cannot return null here. + throw new PropertyUndefinedError(RenderConstants.y2, this); + } + + /** + * @return whether y2 is set + */ + public boolean isSetY2() { + return this.y2 != null; + } + + /** + * Set the value of y2 + */ + public void setY2(Double y2) { + Double oldY2 = this.y2; + this.y2 = y2; + firePropertyChange(RenderConstants.y2, oldY2, this.y2); + } + + /** + * Unsets the variable y2 + * @return <code>true</code>, if y2 was set before, + * otherwise <code>false</code> + */ + public boolean unsetY2() { + if (isSetY2()) { + Double oldY2 = this.y2; + this.y2 = null; + firePropertyChange(RenderConstants.y2, oldY2, this.y2); + return true; + } + return false; + } + + + /** + * @return the value of z1 + */ + public double getZ1() { + if (isSetZ1()) { + return z1; + } + // This is necessary if we cannot return null here. + throw new PropertyUndefinedError(RenderConstants.z1, this); + } + + /** + * @return whether z1 is set + */ + public boolean isSetZ1() { + return this.z1 != null; + } + + /** + * Set the value of z1 + */ + public void setZ1(Double z1) { + Double oldZ1 = this.z1; + this.z1 = z1; + firePropertyChange(RenderConstants.z1, oldZ1, this.z1); + } + + /** + * Unsets the variable z1 + * @return <code>true</code>, if z1 was set before, + * otherwise <code>false</code> + */ + public boolean unsetZ1() { + if (isSetZ1()) { + Double oldZ1 = this.z1; + this.z1 = null; + firePropertyChange(RenderConstants.z1, oldZ1, this.z1); + return true; + } + return false; + } + + + /** + * @return the value of z2 + */ + public double getZ2() { + if (isSetZ2()) { + return z2; + } + // This is necessary if we cannot return null here. + throw new PropertyUndefinedError(RenderConstants.z2, this); + } + + /** + * @return whether z2 is set + */ + public boolean isSetZ2() { + return this.z2 != null; + } + + /** + * Set the value of z2 + */ + public void setZ2(Double z2) { + Double oldZ2 = this.z2; + this.z2 = z2; + firePropertyChange(RenderConstants.z2, oldZ2, this.z2); + } + + /** + * Unsets the variable z2 + * @return <code>true</code>, if z2 was set before, + * otherwise <code>false</code> + */ + public boolean unsetZ2() { + if (isSetZ2()) { + Double oldZ2 = this.z2; + this.z2 = null; + firePropertyChange(RenderConstants.z2, oldZ2, this.z2); + return true; + } + return false; + } } Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderConstants.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderConstants.java 2012-05-23 09:09:52 UTC (rev 1271) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderConstants.java 2012-05-23 10:05:40 UTC (rev 1272) @@ -79,5 +79,10 @@ public static final String absoluteCz = "absolute-cz"; public static final String stopColor = "stop-color"; public static final String offset = "offset"; + public static final String id = "SId"; + public static final String href = "href"; + public static final String enableRotationMapping = "enable-rotation-mapping"; + public static final String group = "g"; + public static final String boundingBox = "bounding-box"; } \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jak...@us...> - 2012-05-23 09:10:03
|
Revision: 1271 http://jsbml.svn.sourceforge.net/jsbml/?rev=1271&view=rev Author: jakobmatthes Date: 2012-05-23 09:09:52 +0000 (Wed, 23 May 2012) Log Message: ----------- Render extension: added serial ids Modified Paths: -------------- trunk/extensions/render/src/org/sbml/jsbml/ext/render/Curve.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/Ellipse.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/ExtendedRenderModel.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/GradientBase.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/GraphicalPrimitive1D.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/GraphicalPrimitive2D.java Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/Curve.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/Curve.java 2012-05-23 08:59:39 UTC (rev 1270) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/Curve.java 2012-05-23 09:09:52 UTC (rev 1271) @@ -34,7 +34,11 @@ * @date 08.05.2012 */ public class Curve extends GraphicalPrimitive1D { - protected String startHead; + /** + * + */ + private static final long serialVersionUID = -1941713884972334826L; + protected String startHead; protected String endHead; protected ListOf<RenderPoint> listOfElements; Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/Ellipse.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/Ellipse.java 2012-05-23 08:59:39 UTC (rev 1270) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/Ellipse.java 2012-05-23 09:09:52 UTC (rev 1271) @@ -33,7 +33,11 @@ * @date 08.05.2012 */ public class Ellipse extends GraphicalPrimitive2D { - protected Double cx, cy, cz, rx, ry; + /** + * + */ + private static final long serialVersionUID = -7679215241987476130L; + protected Double cx, cy, cz, rx, ry; protected Boolean absoluteCx, absoluteCy, absoluteCz, absoluteRx, absoluteRy; Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/ExtendedRenderModel.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/ExtendedRenderModel.java 2012-05-23 08:59:39 UTC (rev 1270) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/ExtendedRenderModel.java 2012-05-23 09:09:52 UTC (rev 1271) @@ -23,14 +23,10 @@ import java.text.MessageFormat; import java.util.Map; -import javax.swing.tree.TreeNode; - import org.sbml.jsbml.ListOf; import org.sbml.jsbml.Model; -import org.sbml.jsbml.PropertyUndefinedError; import org.sbml.jsbml.SBase; import org.sbml.jsbml.ext.AbstractSBasePlugin; -import org.sbml.jsbml.ext.SBasePlugin; /** Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/GradientBase.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/GradientBase.java 2012-05-23 08:59:39 UTC (rev 1270) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/GradientBase.java 2012-05-23 09:09:52 UTC (rev 1271) @@ -20,8 +20,6 @@ */ package org.sbml.jsbml.ext.render; -import java.util.List; - import org.sbml.jsbml.AbstractSBase; import org.sbml.jsbml.LevelVersionError; import org.sbml.jsbml.ListOf; Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/GraphicalPrimitive1D.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/GraphicalPrimitive1D.java 2012-05-23 08:59:39 UTC (rev 1270) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/GraphicalPrimitive1D.java 2012-05-23 09:09:52 UTC (rev 1271) @@ -36,7 +36,11 @@ * @date 08.05.2012 */ public class GraphicalPrimitive1D extends Transformation2D { - public static final int MIN_SBML_LEVEL = 3; + /** + * + */ + private static final long serialVersionUID = 3705246334810811216L; + public static final int MIN_SBML_LEVEL = 3; public static final int MIN_SBML_VERSION = 1; protected ColorDefinition stroke; protected Short[] strokeDashArray; Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/GraphicalPrimitive2D.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/GraphicalPrimitive2D.java 2012-05-23 08:59:39 UTC (rev 1270) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/GraphicalPrimitive2D.java 2012-05-23 09:09:52 UTC (rev 1271) @@ -33,7 +33,11 @@ * @date 08.05.2012 */ public class GraphicalPrimitive2D extends GraphicalPrimitive1D { - protected String fill; + /** + * + */ + private static final long serialVersionUID = -5666416071124784541L; + protected String fill; protected enum FillRule { nonzero, evenodd, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rud...@us...> - 2012-05-23 08:59:50
|
Revision: 1270 http://jsbml.svn.sourceforge.net/jsbml/?rev=1270&view=rev Author: rudolph-jan Date: 2012-05-23 08:59:39 +0000 (Wed, 23 May 2012) Log Message: ----------- resolved several typos Modified Paths: -------------- trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderConstants.java Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderConstants.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderConstants.java 2012-05-23 08:04:40 UTC (rev 1269) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderConstants.java 2012-05-23 08:59:39 UTC (rev 1270) @@ -69,14 +69,14 @@ public static final String stroke = "stroke"; public static final String strokeWidth = "stroke-width"; public static final String strokeDashArray = "stroke-dasharray"; - public static final String endHead = "endHead"; - public static final String startHead = "startHead"; + public static final String endHead = "end-head"; + public static final String startHead = "start-head"; public static final String cx = "cx"; public static final String cy = "cy"; public static final String cz = "cz"; - public static final String absoluteCy = "cx"; - public static final String absoluteCx = "cy"; - public static final String absoluteCz = "cz"; + public static final String absoluteCy = "absolute-cx"; + public static final String absoluteCx = "absolute-cy"; + public static final String absoluteCz = "absolute-cz"; public static final String stopColor = "stop-color"; public static final String offset = "offset"; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rud...@us...> - 2012-05-23 08:04:49
|
Revision: 1269 http://jsbml.svn.sourceforge.net/jsbml/?rev=1269&view=rev Author: rudolph-jan Date: 2012-05-23 08:04:40 +0000 (Wed, 23 May 2012) Log Message: ----------- Added constructors, getters, setters, is set... according to templates in following classes: AbstractRenderPlugin ColorDefinition Curve Ellipse ExtendedRenderModel GradientBase GradientStop GraphicalPrimitive1D LocalStyle RenderInformationBase RenderLayoutPlugin RenderModelPlugin Added all necessary constants to RenderConstants Modified Paths: -------------- trunk/extensions/render/src/org/sbml/jsbml/ext/render/AbstractRenderPlugin.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/Curve.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/Ellipse.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/ExtendedRenderModel.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/GradientBase.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/GradientStop.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/GraphicalPrimitive1D.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/LocalStyle.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderConstants.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderInformationBase.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderLayoutPlugin.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderModelPlugin.java Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/AbstractRenderPlugin.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/AbstractRenderPlugin.java 2012-05-22 19:08:41 UTC (rev 1268) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/AbstractRenderPlugin.java 2012-05-23 08:04:40 UTC (rev 1269) @@ -26,7 +26,6 @@ import org.sbml.jsbml.SBase; import org.sbml.jsbml.ext.AbstractSBasePlugin; -import org.sbml.jsbml.ext.SBasePlugin; /** @@ -36,105 +35,248 @@ * @date 16.05.2012 */ public class AbstractRenderPlugin extends AbstractSBasePlugin { - /** - * - */ - private static final long serialVersionUID = -4225426173177528441L; - Short versionMajor; - Short versionMinor; - GlobalRenderInformation renderInformation; - - /** - * Creates an AbstractRenderPlugin instance - */ - public AbstractRenderPlugin() { - super(); - initDefaults(); - } + /** + * + */ + private static final long serialVersionUID = -4225426173177528441L; + private Short versionMajor; + private Short versionMinor; + private GlobalRenderInformation renderInformation; - public AbstractRenderPlugin(SBase extendedElement) { - super(extendedElement); - initDefaults(); - } + /** + * Creates an AbstractRenderPlugin instance + */ + public AbstractRenderPlugin() { + super(); + initDefaults(); + } - /** - * Clone constructor - */ - public AbstractRenderPlugin(AbstractRenderPlugin obj) { - super(); - // TODO: copy all class attributes, e.g.: - // bar = obj.bar; - } + /** + * Creates a AbstractRenderPlugin instance with a level and version. + * + * @param level + * @param version + */ + public AbstractRenderPlugin(int level, int version) { + this(null, null, level, version); + } + /** + * Creates a AbstractRenderPlugin instance with an id, level, and version. + * + * @param id + * @param level + * @param version + */ + public AbstractRenderPlugin(String id, int level, int version) { + this(id, null, level, version); + } - /** - * Initializes the default values using the namespace. - */ - public void initDefaults() { -// addNamespace(RenderConstants.namespaceURI); - // TODO: init default values here if necessary, e.g.: - // bar = null; - } + /** + * Creates a AbstractRenderPlugin instance with an id, name, level, and version. + * + * @param id + * @param name + * @param level + * @param version + */ + public AbstractRenderPlugin(String id, String name, int level, int version) { + super(); + // FIXME getLevelAndVersion, getElementName + /*if (getLevelAndVersion().compareTo(Integer.valueOf(MIN_SBML_LEVEL), + Integer.valueOf(MIN_SBML_VERSION)) < 0) { + throw new LevelVersionError(getElementName(), level, version); + } */ + initDefaults(); + } - public static final int MIN_SBML_LEVEL = 3; - public static final int MIN_SBML_VERSION = 1; - - /* (non-Javadoc) - * @see org.sbml.jsbml.ext.SBasePlugin#readAttribute(java.lang.String, java.lang.String, java.lang.String) - */ - @Override - public boolean readAttribute(String attributeName, String prefix, String value) { - // TODO Auto-generated method stub - return false; - } + /** + * Clone constructor + */ + public AbstractRenderPlugin(AbstractRenderPlugin obj) { + super((SBase) obj); + // TODO: copy all class attributes, e.g.: + // bar = obj.bar; + } - /* (non-Javadoc) - * @see org.sbml.jsbml.ext.SBasePlugin#getChildAt(int) - */ - @Override - public TreeNode getChildAt(int childIndex) { - // TODO Auto-generated method stub - return null; - } + /** + * clones this class + */ + public AbstractRenderPlugin clone() { + return new AbstractRenderPlugin(this); + } + /** + * Initializes the default values using the namespace. + */ + public void initDefaults() { + //addNamespace(RenderConstants.namespaceURI); + versionMajor = 0; + versionMinor = 0; + } - /* (non-Javadoc) - * @see org.sbml.jsbml.ext.SBasePlugin#getChildCount() - */ - @Override - public int getChildCount() { - // TODO Auto-generated method stub - return 0; - } + public static final int MIN_SBML_LEVEL = 3; + public static final int MIN_SBML_VERSION = 1; + /** + * @return the value of versionMinor + */ + public Short getVersionMinor() { + if (isSetVersionMinor()) { + return versionMinor; + } + return null; + //FIXME throw new PropertyUndefinedError(RenderConstants.versionMinor, this); + } - /* (non-Javadoc) - * @see org.sbml.jsbml.ext.SBasePlugin#getAllowsChildren() - */ - @Override - public boolean getAllowsChildren() { - // TODO Auto-generated method stub - return false; - } + /** + * @return whether versionMinor is set + */ + public boolean isSetVersionMinor() { + return this.versionMinor != null; + } + /** + * Set the value of versionMinor + */ + public void setVersionMinor(Short versionMinor) { + Short oldVersionMinor = this.versionMinor; + this.versionMinor = versionMinor; + //FIXME firePropertyChange(RenderConstants.versionMinor, oldVersionMinor, this.versionMinor); + } - /* (non-Javadoc) - * @see org.sbml.jsbml.ext.SBasePlugin#writeXMLAttributes() - */ - @Override - public Map<String, String> writeXMLAttributes() { - // TODO Auto-generated method stub - return null; - } + /** + * Unsets the variable versionMinor + * @return <code>true</code>, if versionMinor was set before, + * otherwise <code>false</code> + */ + public boolean unsetVersionMinor() { + if (isSetVersionMinor()) { + Short oldVersionMinor = this.versionMinor; + this.versionMinor = null; + //FIXME firePropertyChange(RenderConstants.versionMinor, oldVersionMinor, this.versionMinor); + return true; + } + return false; + } + + + /** + * @return the value of versionMajor + */ + public Short getVersionMajor() { + if (isSetVersionMajor()) { + return versionMajor; + } + // This is necessary if we cannot return null here. + return null; + //FIXME throw new PropertyUndefinedError(RenderConstants.versionMajor, this); + } + /** + * @return whether versionMajor is set + */ + public boolean isSetVersionMajor() { + return this.versionMajor != null; + } - /* (non-Javadoc) - * @see org.sbml.jsbml.ext.AbstractSBasePlugin#clone() - */ - @Override - public SBasePlugin clone() { - // TODO Auto-generated method stub - return null; - } + /** + * Set the value of versionMajor + */ + public void setVersionMajor(short versionMajor) { + Short oldVersionMajor = this.versionMajor; + this.versionMajor = versionMajor; + //FIXME firePropertyChange(RenderConstants.versionMajor, oldVersionMajor, this.versionMajor); + } + + /** + * Unsets the variable versionMajor + * @return <code>true</code>, if versionMajor was set before, + * otherwise <code>false</code> + */ + public boolean unsetVersionMajor() { + if (isSetVersionMajor()) { + Short oldVersionMajor = this.versionMajor; + this.versionMajor = null; + //FIXME firePropertyChange(RenderConstants.versionMajor, oldVersionMajor, this.versionMajor); + return true; + } + return false; + } + + + /** + * @return the value of renderInformation + */ + public GlobalRenderInformation getRenderInformation() { + if (isSetRenderInformation()) { + return renderInformation; + } + // This is necessary if we cannot return null here. + return null; + //FIXME throw new PropertyUndefinedError(RenderConstants.renderInformation, this); + } + + /** + * @return whether renderInformation is set + */ + public boolean isSetRenderInformation() { + return this.renderInformation != null; + } + + /** + * Set the value of renderInformation + */ + public void setRenderInformation(GlobalRenderInformation renderInformation) { + GlobalRenderInformation oldRenderInformation = this.renderInformation; + this.renderInformation = renderInformation; + //FIXME firePropertyChange(RenderConstants.renderInformation, oldRenderInformation, this.renderInformation); + } + + /** + * Unsets the variable renderInformation + * @return <code>true</code>, if renderInformation was set before, + * otherwise <code>false</code> + */ + public boolean unsetRenderInformation() { + if (isSetRenderInformation()) { + GlobalRenderInformation oldRenderInformation = this.renderInformation; + this.renderInformation = null; + //FIXME OfirePropertyChange(RenderConstants.renderInformation, oldRenderInformation, this.renderInformation); + return true; + } + return false; + } + + @Override + public boolean readAttribute(String attributeName, String prefix, + String value) { + // TODO Auto-generated method stub + return false; + } + + @Override + public TreeNode getChildAt(int childIndex) { + // TODO Auto-generated method stub + return null; + } + + @Override + public int getChildCount() { + // TODO Auto-generated method stub + return 0; + } + + @Override + public boolean getAllowsChildren() { + // TODO Auto-generated method stub + return false; + } + + @Override + public Map<String, String> writeXMLAttributes() { + // TODO Auto-generated method stub + return null; + } } Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/Curve.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/Curve.java 2012-05-22 19:08:41 UTC (rev 1268) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/Curve.java 2012-05-23 08:04:40 UTC (rev 1269) @@ -21,6 +21,7 @@ package org.sbml.jsbml.ext.render; import org.sbml.jsbml.ListOf; +import org.sbml.jsbml.PropertyUndefinedError; /** @@ -35,7 +36,220 @@ public class Curve extends GraphicalPrimitive1D { protected String startHead; protected String endHead; - // FIXME sollte auch für RenderCubicBezier funktionieren protected ListOf<RenderPoint> listOfElements; + /** + * Creates an Curve instance + */ + public Curve() { + super(); + initDefaults(); + } + + /** + * Clone constructor + */ + public Curve(Curve obj) { + super(); + startHead = obj.startHead; + endHead = obj.endHead; + listOfElements = obj.listOfElements; + } + + /** + * clones this class + */ + public Curve clone() { + return new Curve(this); + } + + /** + * Initializes the default values using the namespace. + */ + public void initDefaults() { + addNamespace(RenderConstants.namespaceURI); + } + + public static final int MIN_SBML_LEVEL = 3; + public static final int MIN_SBML_VERSION = 1; + + + /** + * @return the value of startHead + */ + public String getStartHead() { + if (isSetStartHead()) { + return startHead; + } + // This is necessary if we cannot return null here. + throw new PropertyUndefinedError(RenderConstants.startHead, this); + } + + /** + * @return whether startHead is set + */ + public boolean isSetStartHead() { + return this.startHead != null; + } + + /** + * Set the value of startHead + */ + public void setStartHead(String startHead) { + String oldStartHead = this.startHead; + this.startHead = startHead; + firePropertyChange(RenderConstants.startHead, oldStartHead, this.startHead); + } + + /** + * Unsets the variable startHead + * @return <code>true</code>, if startHead was set before, + * otherwise <code>false</code> + */ + public boolean unsetStartHead() { + if (isSetStartHead()) { + String oldStartHead = this.startHead; + this.startHead = null; + firePropertyChange(RenderConstants.startHead, oldStartHead, this.startHead); + return true; + } + return false; + } + + + /** + * @return the value of endHead + */ + public String getEndHead() { + if (isSetEndHead()) { + return endHead; + } + // This is necessary if we cannot return null here. + throw new PropertyUndefinedError(RenderConstants.endHead, this); + } + + /** + * @return whether endHead is set + */ + public boolean isSetEndHead() { + return this.endHead != null; + } + + /** + * Set the value of endHead + */ + public void setEndHead(String endHead) { + String oldEndHead = this.endHead; + this.endHead = endHead; + firePropertyChange(RenderConstants.endHead, oldEndHead, this.endHead); + } + + /** + * Unsets the variable endHead + * @return <code>true</code>, if endHead was set before, + * otherwise <code>false</code> + */ + public boolean unsetEndHead() { + if (isSetEndHead()) { + String oldEndHead = this.endHead; + this.endHead = null; + firePropertyChange(RenderConstants.endHead, oldEndHead, this.endHead); + return true; + } + return false; + } + + + /** + * @return <code>true</code>, if listOfElements contains at least one element, + * otherwise <code>false</code> + */ + public boolean isSetListOfElements() { + if ((listOfElements == null) || listOfElements.isEmpty()) { + return false; + } + return true; + } + + /** + * @return the listOfElements + */ + public ListOf<RenderPoint> getListOfElements() { + if (!isSetListOfElements()) { + listOfElements = new ListOf<RenderPoint>(getLevel(), getVersion()); + listOfElements.addNamespace(RenderConstants.namespaceURI); + listOfElements.setSBaseListType(ListOf.Type.other); + registerChild(listOfElements); + } + return listOfElements; + } + + /** + * @param listOfElements + */ + public void setListOfElements(ListOf<RenderPoint> listOfElements) { + unsetListOfElements(); + this.listOfElements = listOfElements; + registerChild(this.listOfElements); + } + + /** + * @return <code>true</code>, if listOfElements contained at least one element, + * otherwise <code>false</code> + */ + public boolean unsetListOfElements() { + if (isSetListOfElements()) { + ListOf<RenderPoint> oldElements = this.listOfElements; + this.listOfElements = null; + oldElements.fireNodeRemovedEvent(); + return true; + } + return false; + } + + /** + * @param element + */ + public boolean addElement(RenderPoint element) { + return getListOfElements().add(element); + } + + /** + * @param element + */ + public boolean removeElement(RenderPoint element) { + if (isSetListOfElements()) { + return getListOfElements().remove(element); + } + return false; + } + + /** + * @param i + */ + public void removeElement(int i) { + if (!isSetListOfElements()) { + throw new IndexOutOfBoundsException(Integer.toString(i)); + } + getListOfElements().remove(i); + } + + /** + * create a new Element element and adds it to the ListOfElements list + * <p><b>NOTE:</b> + * only use this method, if ID is not mandatory in Element + * otherwise use @see createElement(String id)!</p> + */ + public RenderPoint createElement() { + return createElement(null); + } + + /** + * create a new Element element and adds it to the ListOfElements list + */ + public RenderPoint createElement(String id) { + RenderPoint element = new RenderPoint(); + addElement(element); + return element; + } } Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/Ellipse.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/Ellipse.java 2012-05-22 19:08:41 UTC (rev 1268) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/Ellipse.java 2012-05-23 08:04:40 UTC (rev 1269) @@ -20,7 +20,9 @@ */ package org.sbml.jsbml.ext.render; +import org.sbml.jsbml.PropertyUndefinedError; + /** * @author Eugen Netz * @author Alexander Diamantikos @@ -32,5 +34,428 @@ */ public class Ellipse extends GraphicalPrimitive2D { protected Double cx, cy, cz, rx, ry; - //FIXME absolute booleans + protected Boolean absoluteCx, absoluteCy, absoluteCz, absoluteRx, absoluteRy; + + + /** + * @return the value of cx + */ + public double getCx() { + if (isSetCx()) { + return cx; + } + // This is necessary if we cannot return null here. + throw new PropertyUndefinedError(RenderConstants.cx, this); + } + + /** + * @return whether cx is set + */ + public boolean isSetCx() { + return this.cx != null; + } + + /** + * Set the value of cx + */ + public void setCx(double cx) { + double oldCx = this.cx; + this.cx = cx; + firePropertyChange(RenderConstants.cx, oldCx, this.cx); + } + + /** + * Unsets the variable cx + * @return <code>true</code>, if cx was set before, + * otherwise <code>false</code> + */ + public boolean unsetCx() { + if (isSetCx()) { + double oldCx = this.cx; + this.cx = null; + firePropertyChange(RenderConstants.cx, oldCx, this.cx); + return true; + } + return false; + } + + /** + * @return the value of cy + */ + public double getCy() { + if (isSetCy()) { + return cy; + } + // This is necessary if we cannot return null here. + throw new PropertyUndefinedError(RenderConstants.cy, this); + } + + /** + * @return whether cy is set + */ + public boolean isSetCy() { + return this.cy != null; + } + + /** + * Set the value of cy + */ + public void setCy(Double cy) { + Double oldCy = this.cy; + this.cy = cy; + firePropertyChange(RenderConstants.cy, oldCy, this.cy); + } + + /** + * Unsets the variable cy + * @return <code>true</code>, if cy was set before, + * otherwise <code>false</code> + */ + public boolean unsetCy() { + if (isSetCy()) { + Double oldCy = this.cy; + this.cy = null; + firePropertyChange(RenderConstants.cy, oldCy, this.cy); + return true; + } + return false; + } + + /** + * @return the value of cz + */ + public double getCz() { + if (isSetCz()) { + return cz; + } + // This is necessary if we cannot return null here. + throw new PropertyUndefinedError(RenderConstants.cz, this); + } + + /** + * @return whether cz is set + */ + public boolean isSetCz() { + return this.cz != null; + } + + /** + * Set the value of cz + */ + public void setCz(Double cz) { + Double oldCz = this.cz; + this.cz = cz; + firePropertyChange(RenderConstants.cz, oldCz, this.cz); + } + + /** + * Unsets the variable cz + * @return <code>true</code>, if cz was set before, + * otherwise <code>false</code> + */ + public boolean unsetCz() { + if (isSetCz()) { + Double oldCz = this.cz; + this.cz = null; + firePropertyChange(RenderConstants.cz, oldCz, this.cz); + return true; + } + return false; + } + + /** + * @return the value of rx + */ + public double getRx() { + if (isSetRx()) { + return rx; + } + // This is necessary if we cannot return null here. + throw new PropertyUndefinedError(RenderConstants.rx, this); + } + + /** + * @return whether rx is set + */ + public boolean isSetRx() { + return this.rx != null; + } + + /** + * Set the value of rx + */ + public void setRx(Double rx) { + Double oldRx = this.rx; + this.rx = rx; + firePropertyChange(RenderConstants.rx, oldRx, this.rx); + } + + /** + * Unsets the variable rx + * @return <code>true</code>, if rx was set before, + * otherwise <code>false</code> + */ + public boolean unsetRx() { + if (isSetRx()) { + Double oldRx = this.rx; + this.rx = null; + firePropertyChange(RenderConstants.rx, oldRx, this.rx); + return true; + } + return false; + } + + /** + * @return the value of ry + */ + public double getRy() { + if (isSetRy()) { + return ry; + } + // This is necessary if we cannot return null here. + throw new PropertyUndefinedError(RenderConstants.ry, this); + } + + /** + * @return whether ry is set + */ + public boolean isSetRy() { + return this.ry != null; + } + + /** + * Set the value of ry + */ + public void setRy(Double ry) { + Double oldRy = this.ry; + this.ry = ry; + firePropertyChange(RenderConstants.ry, oldRy, this.ry); + } + + /** + * Unsets the variable ry + * @return <code>true</code>, if ry was set before, + * otherwise <code>false</code> + */ + public boolean unsetRy() { + if (isSetRy()) { + Double oldRy = this.ry; + this.ry = null; + firePropertyChange(RenderConstants.ry, oldRy, this.ry); + return true; + } + return false; + } + + /** + * @return the value of absoluteCx + */ + public boolean isAbsoluteCx() { + if (isSetAbsoluteCx()) { + return absoluteCx; + } + // This is necessary if we cannot return null here. + throw new PropertyUndefinedError(RenderConstants.absoluteCx, this); + } + + /** + * @return whether absoluteCx is set + */ + public boolean isSetAbsoluteCx() { + return this.absoluteCx != null; + } + + /** + * Set the value of absoluteCx + */ + public void setAbsoluteCx(boolean absoluteCx) { + Boolean oldAbsoluteCx = this.absoluteCx; + this.absoluteCx = absoluteCx; + firePropertyChange(RenderConstants.absoluteCx, oldAbsoluteCx, this.absoluteCx); + } + + /** + * Unsets the variable absoluteCx + * @return <code>true</code>, if absoluteCx was set before, + * otherwise <code>false</code> + */ + public boolean unsetAbsoluteCx() { + if (isSetAbsoluteCx()) { + Boolean oldAbsoluteCx = this.absoluteCx; + this.absoluteCx = null; + firePropertyChange(RenderConstants.absoluteCx, oldAbsoluteCx, this.absoluteCx); + return true; + } + return false; + } + + /** + * @return the value of absoluteCy + */ + public boolean isAbsoluteCy() { + if (isSetAbsoluteCy()) { + return absoluteCy; + } + // This is necessary if we cannot return null here. + throw new PropertyUndefinedError(RenderConstants.absoluteCy, this); + } + + /** + * @return whether absoluteCy is set + */ + public boolean isSetAbsoluteCy() { + return this.absoluteCy != null; + } + + /** + * Set the value of absoluteCy + */ + public void setAbsoluteCy(boolean absoluteCy) { + Boolean oldAbsoluteCy = this.absoluteCy; + this.absoluteCy = absoluteCy; + firePropertyChange(RenderConstants.absoluteCy, oldAbsoluteCy, this.absoluteCy); + } + + /** + * Unsets the variable absoluteCy + * @return <code>true</code>, if absoluteCy was set before, + * otherwise <code>false</code> + */ + public boolean unsetAbsoluteCy() { + if (isSetAbsoluteCy()) { + Boolean oldAbsoluteCy = this.absoluteCy; + this.absoluteCy = null; + firePropertyChange(RenderConstants.absoluteCy, oldAbsoluteCy, this.absoluteCy); + return true; + } + return false; + } + + /** + * @return the value of absoluteCz + */ + public boolean isAbsoluteCz() { + if (isSetAbsoluteCz()) { + return absoluteCz; + } + // This is necessary if we cannot return null here. + throw new PropertyUndefinedError(RenderConstants.absoluteCz, this); + } + + /** + * @return whether absoluteCz is set + */ + public boolean isSetAbsoluteCz() { + return this.absoluteCz != null; + } + + /** + * Set the value of absoluteCz + */ + public void setAbsoluteCz(boolean absoluteCz) { + Boolean oldAbsoluteCz = this.absoluteCz; + this.absoluteCz = absoluteCz; + firePropertyChange(RenderConstants.absoluteCz, oldAbsoluteCz, this.absoluteCz); + } + + /** + * Unsets the variable absoluteCz + * @return <code>true</code>, if absoluteCz was set before, + * otherwise <code>false</code> + */ + public boolean unsetAbsoluteCz() { + if (isSetAbsoluteCz()) { + Boolean oldAbsoluteCz = this.absoluteCz; + this.absoluteCz = null; + firePropertyChange(RenderConstants.absoluteCz, oldAbsoluteCz, this.absoluteCz); + return true; + } + return false; + } + + + /** + * @return the value of absoluteRx + */ + public boolean isAbsoluteRx() { + if (isSetAbsoluteRx()) { + return absoluteRx; + } + // This is necessary if we cannot return null here. + throw new PropertyUndefinedError(RenderConstants.absoluteRx, this); + } + + /** + * @return whether absoluteRx is set + */ + public boolean isSetAbsoluteRx() { + return this.absoluteRx != null; + } + + /** + * Set the value of absoluteRx + */ + public void setAbsoluteRx(boolean absoluteRx) { + Boolean oldAbsoluteRx = this.absoluteRx; + this.absoluteRx = absoluteRx; + firePropertyChange(RenderConstants.absoluteRx, oldAbsoluteRx, this.absoluteRx); + } + + /** + * Unsets the variable absoluteRx + * @return <code>true</code>, if absoluteRx was set before, + * otherwise <code>false</code> + */ + public boolean unsetAbsoluteRx() { + if (isSetAbsoluteRx()) { + Boolean oldAbsoluteRx = this.absoluteRx; + this.absoluteRx = null; + firePropertyChange(RenderConstants.absoluteRx, oldAbsoluteRx, this.absoluteRx); + return true; + } + return false; + } + + + /** + * @return the value of absoluteRy + */ + public boolean isAbsoluteRy() { + if (isSetAbsoluteRy()) { + return absoluteRy; + } + // This is necessary if we cannot return null here. + throw new PropertyUndefinedError(RenderConstants.absoluteRy, this); + } + + /** + * @return whether absoluteRy is set + */ + public boolean isSetAbsoluteRy() { + return this.absoluteRy != null; + } + + /** + * Set the value of absoluteRy + */ + public void setAbsoluteRy(boolean absoluteRy) { + Boolean oldAbsoluteRy = this.absoluteRy; + this.absoluteRy = absoluteRy; + firePropertyChange(RenderConstants.absoluteRy, oldAbsoluteRy, this.absoluteRy); + } + + /** + * Unsets the variable absoluteRy + * @return <code>true</code>, if absoluteRy was set before, + * otherwise <code>false</code> + */ + public boolean unsetAbsoluteRy() { + if (isSetAbsoluteRy()) { + Boolean oldAbsoluteRy = this.absoluteRy; + this.absoluteRy = null; + firePropertyChange(RenderConstants.absoluteRy, oldAbsoluteRy, this.absoluteRy); + return true; + } + return false; + } } Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/ExtendedRenderModel.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/ExtendedRenderModel.java 2012-05-22 19:08:41 UTC (rev 1268) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/ExtendedRenderModel.java 2012-05-23 08:04:40 UTC (rev 1269) @@ -20,12 +20,15 @@ */ package org.sbml.jsbml.ext.render; +import java.text.MessageFormat; import java.util.Map; import javax.swing.tree.TreeNode; import org.sbml.jsbml.ListOf; import org.sbml.jsbml.Model; +import org.sbml.jsbml.PropertyUndefinedError; +import org.sbml.jsbml.SBase; import org.sbml.jsbml.ext.AbstractSBasePlugin; import org.sbml.jsbml.ext.SBasePlugin; @@ -40,85 +43,422 @@ * @date 14.05.2012 */ public class ExtendedRenderModel extends AbstractSBasePlugin { - - /** - * - */ - private static final long serialVersionUID = 7654047378880104537L; - - - protected ListOf<LocalRenderInformation> listOfLocalRenderInformation; - protected ListOf<GlobalRenderInformation> listOfGlobalRenderInformation; - // TODO unclear if Integer or int - protected int versionMajor; - protected int versionMinor; + /** + * + */ + private static final long serialVersionUID = -7046023464349980639L; + + protected ListOf<LocalRenderInformation> listOfLocalRenderInformation; + protected ListOf<GlobalRenderInformation> listOfGlobalRenderInformation; + // TODO unclear if Integer or int + protected int versionMajor; + protected int versionMinor; - /** - * - */ - private Model model; - - public ExtendedRenderModel(Model model) { - super(model); + /** + * + */ + private Model model; - this.model = model; - createListOfLocalRenderInformation(); - createListOfGlobalRenderInformation(); - } - - private void createListOfLocalRenderInformation() { - listOfLocalRenderInformation = new ListOf<LocalRenderInformation>(); - //TODO - //listOfLocalRenderInformation.addNamespace(RenderConstant.namespaceURI); - listOfLocalRenderInformation.setSBaseListType(ListOf.Type.other); - model.registerChild(listOfLocalRenderInformation); - } - - private void createListOfGlobalRenderInformation(){ - listOfGlobalRenderInformation = new ListOf<GlobalRenderInformation>(); - //TODO - //listOfGlobalRenderInformation.addNamespace(RenderConstant.namespaceURI); - listOfGlobalRenderInformation.setSBaseListType(ListOf.Type.other); - model.registerChild(listOfGlobalRenderInformation); - } + /** + * Creates an ExtendedRenderModel instance + */ + public ExtendedRenderModel() { + super(); + initDefaults(); + } - public static final int MIN_SBML_LEVEL = 3; - public static final int MIN_SBML_VERSION = 1; + /** + * Creates a ExtendedRenderModel instance with a level and version. + * + * @param level + * @param version + */ + public ExtendedRenderModel(int level, int version) { + this(null, null, level, version); + } - //TODO - public SBasePlugin clone() { - // TODO Auto-generated method stub - return null; - } + /** + * Creates a ExtendedRenderModel instance with an id, level, and version. + * + * @param id + * @param level + * @param version + */ + public ExtendedRenderModel(String id, int level, int version) { + this(id, null, level, version); + } - //TODO - public boolean getAllowsChildren() { - // TODO Auto-generated method stub - return false; - } + /** + * Creates a ExtendedRenderModel instance with an id, name, level, and version. + * + * @param id + * @param name + * @param level + * @param version + */ + public ExtendedRenderModel(String id, String name, int level, int version) { + super(); + /*if (getLevelAndVersion().compareTo(Integer.valueOf(MIN_SBML_LEVEL), + Integer.valueOf(MIN_SBML_VERSION)) < 0) { + throw new LevelVersionError(getElementName(), level, version); + } */ + initDefaults(); + } - //TODO - public TreeNode getChildAt(int childIndex) { - // TODO Auto-generated method stub - return null; - } + /** + * Clone constructor + */ + public ExtendedRenderModel(ExtendedRenderModel obj) { + super(); + versionMajor = obj.versionMajor; + versionMinor = obj.versionMinor; + listOfGlobalRenderInformation = obj.listOfGlobalRenderInformation; + listOfLocalRenderInformation = obj.listOfLocalRenderInformation; + } - //TODO - public int getChildCount() { - // TODO Auto-generated method stub - return 0; - } + /** + * clones this class + */ + public ExtendedRenderModel clone() { + return new ExtendedRenderModel(this); + } - //TODO - public boolean readAttribute(String attributeName, String prefix, String value) { - // TODO Auto-generated method stub - return false; - } + /** + * Initializes the default values using the namespace. + */ + public void initDefaults() { + //addNamespace(RenderConstants.namespaceURI); + versionMajor = 0; + versionMinor = 0; + } - //TODO - public Map<String, String> writeXMLAttributes() { - // TODO Auto-generated method stub - return null; - } + public static final int MIN_SBML_LEVEL = 3; + public static final int MIN_SBML_VERSION = 1; + + /** + * @return the value of versionMinor + */ + public int getVersionMinor() { + return versionMinor; + } + /** + * @return whether versionMinor is set + */ + public boolean isSetVersionMinor() { + return true; + } + + /** + * Set the value of versionMinor + */ + public void setVersionMinor(int versionMinor) { + int oldVersionMinor = this.versionMinor; + this.versionMinor = versionMinor; + //FIXME firePropertyChange(RenderConstants.versionMinor, oldVersionMinor, this.versionMinor); + } + + /** + * Unsets the variable versionMinor + * @return <code>true</code>, if versionMinor was set before, + * otherwise <code>false</code> + */ + public boolean unsetVersionMinor() { + if (isSetVersionMinor()) { + int oldVersionMinor = this.versionMinor; + //FIME firePropertyChange(RenderConstants.versionMinor, oldVersionMinor, this.versionMinor); + return true; + } + return false; + } + + + /** + * @return the value of versionMajor + */ + public int getVersionMajor() { + return versionMajor; + } + + /** + * @return whether versionMajor is set + */ + public boolean isSetVersionMajor() { + return true; + } + + /** + * Set the value of versionMajor + */ + public void setVersionMajor(int versionMajor) { + int oldVersionMajor = this.versionMajor; + this.versionMajor = versionMajor; + //firePropertyChange(RenderConstants.versionMajor, oldVersionMajor, this.versionMajor); + } + + /** + * Unsets the variable versionMajor + * @return <code>true</code>, if versionMajor was set before, + * otherwise <code>false</code> + */ + public boolean unsetVersionMajor() { + if (isSetVersionMajor()) { + int oldVersionMajor = this.versionMajor; + //firePropertyChange(RenderConstants.versionMajor, oldVersionMajor, this.versionMajor); + return true; + } + return false; + } + + + /** + * @return <code>true</code>, if listOfGlobalRenderInformation contains at least one element, + * otherwise <code>false</code> + */ + public boolean isSetListOfGlobalRenderInformation() { + if ((listOfGlobalRenderInformation == null) || listOfGlobalRenderInformation.isEmpty()) { + return false; + } + return true; + } + + /** + * @return the listOfGlobalRenderInformation + */ + public ListOf<GlobalRenderInformation> getListOfGlobalRenderInformation() { + if (!isSetListOfGlobalRenderInformation()) { + listOfGlobalRenderInformation = new ListOf<GlobalRenderInformation>(); + listOfGlobalRenderInformation.addNamespace(RenderConstants.namespaceURI); + listOfGlobalRenderInformation.setSBaseListType(ListOf.Type.other); + //FIXME registerChild(listOfGlobalRenderInformation); + } + return listOfGlobalRenderInformation; + } + + /** + * @param listOfGlobalRenderInformation + */ + public void setListOfGlobalRenderInformation(ListOf<GlobalRenderInformation> listOfGlobalRenderInformation) { + unsetListOfGlobalRenderInformation(); + this.listOfGlobalRenderInformation = listOfGlobalRenderInformation; + //FIXME registerChild(this.listOfGlobalRenderInformation); + } + + /** + * @return <code>true</code>, if listOfGlobalRenderInformation contained at least one element, + * otherwise <code>false</code> + */ + public boolean unsetListOfGlobalRenderInformation() { + if (isSetListOfGlobalRenderInformation()) { + ListOf<GlobalRenderInformation> oldGlobalRenderInformation = this.listOfGlobalRenderInformation; + this.listOfGlobalRenderInformation = null; + oldGlobalRenderInformation.fireNodeRemovedEvent(); + return true; + } + return false; + } + + /** + * @param globalRenderInformation + */ + public boolean addGlobalRenderInformation(GlobalRenderInformation globalRenderInformation) { + return getListOfGlobalRenderInformation().add(globalRenderInformation); + } + + /** + * @param globalRenderInformation + */ + public boolean removeGlobalRenderInformation(GlobalRenderInformation globalRenderInformation) { + if (isSetListOfGlobalRenderInformation()) { + return getListOfGlobalRenderInformation().remove(globalRenderInformation); + } + return false; + } + + /** + * @param i + */ + public void removeGlobalRenderInformation(int i) { + if (!isSetListOfGlobalRenderInformation()) { + throw new IndexOutOfBoundsException(Integer.toString(i)); + } + getListOfGlobalRenderInformation().remove(i); + } + + /** + * TODO: if the ID is mandatory for GlobalRenderInformation objects, + * one should also add this methods + */ + //public void removeGlobalRenderInformation(String id) { + // getListOfGlobalRenderInformation().removeFirst(new NameFilter(id)); + //} + + /** + * create a new GlobalRenderInformation element and adds it to the ListOfGlobalRenderInformation list + * <p><b>NOTE:</b> + * only use this method, if ID is not mandatory in GlobalRenderInformation + * otherwise use @see createGlobalRenderInformation(String id)!</p> + */ + public GlobalRenderInformation createGlobalRenderInformation() { + return createGlobalRenderInformation(null); + } + + /** + * create a new GlobalRenderInformation element and adds it to the ListOfGlobalRenderInformation list + */ + public GlobalRenderInformation createGlobalRenderInformation(String id) { + GlobalRenderInformation globalRenderInformation = new GlobalRenderInformation(id); + addGlobalRenderInformation(globalRenderInformation); + return globalRenderInformation; + } + + /** + * @return <code>true</code>, if listOfLocalRenderInformation contains at least one element, + * otherwise <code>false</code> + */ + public boolean isSetListOfLocalRenderInformation() { + if ((listOfLocalRenderInformation == null) || listOfLocalRenderInformation.isEmpty()) { + return false; + } + return true; + } + + /** + * @return the listOfLocalRenderInformation + */ + public ListOf<LocalRenderInformation> getListOfLocalRenderInformation() { + if (!isSetListOfLocalRenderInformation()) { + listOfLocalRenderInformation = new ListOf<LocalRenderInformation>(); + listOfLocalRenderInformation.addNamespace(RenderConstants.namespaceURI); + listOfLocalRenderInformation.setSBaseListType(ListOf.Type.other); + //FIXME registerChild(listOfLocalRenderInformation); + } + return listOfLocalRenderInformation; + } + + /** + * @param listOfLocalRenderInformation + */ + public void setListOfLocalRenderInformation(ListOf<LocalRenderInformation> listOfLocalRenderInformation) { + unsetListOfLocalRenderInformation(); + this.listOfLocalRenderInformation = listOfLocalRenderInformation; + // FIXME registerChild(this.listOfLocalRenderInformation); + } + + /** + * @return <code>true</code>, if listOfLocalRenderInformation contained at least one element, + * otherwise <code>false</code> + */ + public boolean unsetListOfLocalRenderInformation() { + if (isSetListOfLocalRenderInformation()) { + ListOf<LocalRenderInformation> oldLocalRenderInformation = this.listOfLocalRenderInformation; + this.listOfLocalRenderInformation = null; + oldLocalRenderInformation.fireNodeRemovedEvent(); + return true; + } + return false; + } + + /** + * @param localRenderInformation + */ + public boolean addLocalRenderInformation(LocalRenderInformation localRenderInformation) { + return getListOfLocalRenderInformation().add(localRenderInformation); + } + + /** + * @param localRenderInformation + */ + public boolean removeLocalRenderInformation(LocalRenderInformation localRenderInformation) { + if (isSetListOfLocalRenderInformation()) { + return getListOfLocalRenderInformation().remove(localRenderInformation); + } + return false; + } + + /** + * @param i + */ + public void removeLocalRenderInformation(int i) { + if (!isSetListOfLocalRenderInformation()) { + throw new IndexOutOfBoundsException(Integer.toString(i)); + } + getListOfLocalRenderInformation().remove(i); + } + + /** + * create a new LocalRenderInformation element and adds it to the ListOfLocalRenderInformation list + * <p><b>NOTE:</b> + * only use this method, if ID is not mandatory in LocalRenderInformation + * otherwise use @see createLocalRenderInformation(String id)!</p> + */ + public LocalRenderInformation createLocalRenderInformation() { + return createLocalRenderInformation(null); + } + + /** + * create a new LocalRenderInformation element and adds it to the ListOfLocalRenderInformation list + */ + public LocalRenderInformation createLocalRenderInformation(String id) { + LocalRenderInformation localRenderInformation = new LocalRenderInformation(id); + addLocalRenderInformation(localRenderInformation); + return localRenderInformation; + } + + + + @Override + public boolean getAllowsChildren() { + return true; + } + + public int getChildCount() { + int count = 0; + + if (isSetListOfGlobalRenderInformation()) { + count++; + } + if (isSetListOfLocalRenderInformation()) { + count++; + } + + return count; + } + + public SBase getChildAt(int childIndex) { + if (childIndex < 0) { + throw new IndexOutOfBoundsException(childIndex + " < 0"); + } + + int pos = 0; + if (isSetListOfGlobalRenderInformation()) { + if (pos == childIndex) { + return getListOfLocalRenderInformation(); + } + pos++; + } + if (isSetListOfLocalRenderInformation()) { + if (pos == childIndex) { + return getListOfLocalRenderInformation(); + } + pos++; + } + + throw new IndexOutOfBoundsException(MessageFormat.format( + "Index {0,number,integer} >= {1,number,integer}", childIndex, + +((int) Math.min(pos, 0)))); + } + + @Override + public boolean readAttribute(String attributeName, String prefix, + String value) { + // TODO Auto-generated method stub + return false; + } + + @Override + public Map<String, String> writeXMLAttributes() { + // TODO Auto-generated method stub + return null; + } } Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/GradientBase.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/GradientBase.java 2012-05-22 19:08:41 UTC (rev 1268) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/GradientBase.java 2012-05-23 08:04:40 UTC (rev 1269) @@ -52,7 +52,7 @@ protected String id; protected Spread spreadMethod; - protected List<GradientStop> listOfGradientStops; + protected ListOf<GradientStop> listOfGradientStops; /** * Creates an GradientBase instance @@ -117,7 +117,7 @@ */ public void initDefaults() { //addNamespace(constant_class.namespaceURI); - this.spreadMethod = Spread.PAD; + this.spreadMethod = Spread.pad; this.listOfGradientStops = new ListOf<GradientStop>(); } @@ -133,10 +133,8 @@ * Set the value of id */ public void setId(String id){ - //String oldId = this.id; this.id = id; - //TODO - //firePropertyChange(constant_class.id, oldId, this.id); + //TODO firePropertyChange(constant_class.id, oldId, this.id); } @@ -144,8 +142,6 @@ * @return the value of spreadMethod */ public Spread getSpreadMethod() { - //TODO: if variable is boolean, create an additional "isVar" - //TODO: return primitive data type if possible (e.g. int instead of Integer) if (isSetSpreadMethod()) { return spreadMethod; } else { @@ -166,10 +162,8 @@ * Set the value of spreadMethod */ public void setSpreadMethod(Spread spreadMethod) { - //Spread oldSpreadMethod = this.spreadMethod; this.spreadMethod = spreadMethod; - //TODO - //firePropertyChange(constant_class.spreadMethod, oldSpreadMethod, this.spreadMethod); + //TODO firePropertyChange(constant_class.spreadMethod, oldSpreadMethod, this.spreadMethod); } @@ -180,10 +174,8 @@ */ public boolean unsetSpreadMethod() { if (isSetSpreadMethod()) { - //Spread oldSpreadMethod = this.spreadMethod; this.spreadMethod = null; - //TODO - //firePropertyChange(constant_class.spreadMethod, oldSpreadMethod, this.spreadMethod); + //TODO firePropertyChange(constant_class.spreadMethod, oldSpreadMethod, this.spreadMethod); return true; } return false; @@ -216,10 +208,9 @@ public ListOf<GradientStop> getListOfGradientStops() { if (!isSetListOfGradientStops()) { listOfGradientStops = new ListOf<GradientStop>(getLevel(), getVersion()); - //TODO - //listOfGradientStops.addNamespace(constant_class.namespaceURI); + //TODO listOfGradientStops.addNamespace(constant_class.namespaceURI); listOfGradientStops.setSBaseListType(ListOf.Type.other); - registerChild(listOfGradientStops); + //TODO registerChild(listOfGradientStops); } return listOfGradientStops; } @@ -283,7 +274,7 @@ /** * create a new GradientStop element and adds it to the ListOfGradientStops list */ - public GradientStop createGradientStop(int offset, ColorDefinition stopColor) { + public GradientStop createGradientStop(double offset, ColorDefinition stopColor) { GradientStop field = new GradientStop(offset, stopColor, getLevel(), getVersion()); addGradientStop(field); return field; Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/GradientStop.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/GradientStop.java 2012-05-22 19:08:41 UTC (rev 1268) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/GradientStop.java 2012-05-23 08:04:40 UTC (rev 1269) @@ -22,6 +22,7 @@ import org.sbml.jsbml.AbstractSBase; import org.sbml.jsbml.LevelVersionError; +import org.sbml.jsbml.PropertyUndefinedError; /** @@ -34,105 +35,158 @@ * @date 08.05.2012 */ public class GradientStop extends AbstractSBase { - /** - * - */ - private static final long serialVersionUID = 7400974339251884133L; - - private Double offset; - private ColorDefinition stopColor; + /** + * + */ + private static final long serialVersionUID = 7400974339251884133L; + private Double offset; + private ColorDefinition stopColor; - /** - * Creates a GradientStop instance with an offset and a color. - * - * @param offset - * @param color - */ - public GradientStop(Double offset, ColorDefinition stopColor) { - this.offset = offset; - this.stopColor = stopColor; - } + /** + * Creates a GradientStop instance with an offset and a color. + * + * @param offset + * @param color + */ + public GradientStop(Double offset, ColorDefinition stopColor) { + this.offset = offset; + this.stopColor = stopColor; + } - /** - * Creates a GradientStop instance with an offset, color, level, and version. - * - * @param offset - * @param color - * @param level - * @param version - */ - public GradientStop(Double offset, ColorDefinition stopColor, int level, int version) { - super(level, version); - if (getLevelAndVersion().compareTo(Integer.valueOf(MIN_SBML_LEVEL), - Integer.valueOf(MIN_SBML_VERSION)) < 0) { - throw new LevelVersionError(getElementName(), level, version); - } - this.offset = offset; - this.stopColor = stopColor; - } + /** + * Creates a GradientStop instance with an offset, color, level, and version. + * + * @param offset + * @param color + * @param level + * @param version + */ + public GradientStop(Double offset, ColorDefinition stopColor, int level, int version) { + super(level, version); + if (getLevelAndVersion().compareTo(Integer.valueOf(MIN_SBML_LEVEL), + Integer.valueOf(MIN_SBML_VERSION)) < 0) { + throw new LevelVersionError(getElementName(), level, version); + } + this.offset = offset; + this.stopColor = stopColor; + } - /** - * Clone constructor - */ - public GradientStop(GradientStop obj) { - super(obj); - this.offset = obj.offset; - this.stopColor = obj.stopColor; - } + /** + * Clone constructor + */ + public GradientStop(GradientStop obj) { + super(obj); + this.offset = obj.offset; + this.stopColor = obj.stopColor; + } - /** - * clones this class - */ - public GradientStop clone() { - return new GradientStop(this); - } - - - /** - * @return the value of offset - */ - public Double getOffset() { - return offset; - } + /** + * clones this class + */ + public GradientStop clone() { + return new GradientStop(this); + } - /** - * Set the value of offset - */ - public void setOffset(Double offset) { - //int oldOffset = this.offset; - this.offset = offset; - //TODO - //firePropertyChange(constant_class.offset, oldOffset, this.offset); - } - - - /** - * @return the value of stopColor - */ - public ColorDefinition getStopColor() { - return stopColor; - } - /** - * Set the value of stopColor - */ - public void setStopColor(ColorDefinition stopColor) { - //ColorDefinition oldStopColor = this.stopColor; - this.stopColor = stopColor; - //TODO - //firePropertyChange(constant_class.stopColor, oldStopColor, this.stopColor); - } + + /** + * @return the value of offset + */ + public double getOffset() { + if (isSetOffset()) { + return offset; + } + // This is necessary if we cannot return null here. + throw new PropertyUndefinedError(RenderConstants.offset, this); + } - public static final int MIN_SBML_LEVEL = 3; - public static final int MIN_SBML_VERSION = 1; + /** + * @return whether offset is set + */ + public boolean isSetOffset() { + return this.offset != null; + } + /** + * Set the value of offset + */ + public void setOffset(Double offset) { + Double oldOffset = this.offset; + this.offset = offset; + firePropertyChange(RenderConstants.offset, oldOffset, this.offset); + } + + /** + * Unsets the variable offset + * @return <code>true</code>, if offset was set before, + * otherwise <code>false</code> + */ + public boolean unsetOffset() { + if (isSetOffset()) { + Double oldOffset = this.offset; + this.offset = null; + firePropertyChange(RenderConstants.offset, oldOffset, this.offset); + return true; + } + return false; + } + + + /** + * @return the value of stopColor + */ + public ColorDefinition getStopColor() { + if (isSetStopColor()) { + return stopColor; + } + // This is necessary if we cannot return null here. + throw new PropertyUndefinedError(RenderConstants.stopColor, this); + } + + /** + * @return whether stopColor is set + */ + public boolean isSetStopColor() { + return this.stopColor != null; + } + + /** + * Set the value of stopColor + */ + public void setStopColor(ColorDefinition stopColor) { + ColorDefinition oldStopColor = this.stopColor; + this.stopColor = stopColor; + firePropertyChange(RenderConstants.stopColor, oldStopColor, this.stopColor); + } + + /** + * Unsets the variable stopColor + * @return <code>true</code>, if stopColor was set before, + * otherwise <code>false</code> + */ + public boolean unsetStopColor() { + if (isSetStopColor()) { + ColorDefinition oldStopColor = this.stopColor; + this.stopColor = null; + firePropertyChange(RenderConstants.stopColor, oldStopColor, this.stopColor); + return true; + } + return false; + } + + public static final int MIN_SBML_LEVEL = 3; + public static final int MIN_SBML_VERSION = 1; + + + @Override public String toString() { // TODO Auto-generated method stub return null; } + } Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/GraphicalPrimitive1D.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/GraphicalPrimitive1D.java 2012-05-22 19:08:41 UTC (rev 1268) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/GraphicalPrimitive1D.java 2012-05-23 08:04:40 UTC (rev 1269) @@ -101,7 +101,7 @@ * Clone constructor */ public GraphicalPrimitive1D(GraphicalPrimitive1D obj) { - super(obj); + super(); stroke = obj.stroke; strokeWidth = obj.strokeWidth; strokeDashArray = obj.strokeDashArray; Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/LocalStyle.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/LocalStyle.java 2012-05-22 19:08:41 UTC (rev 1268) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/LocalStyle.java 2012-05-23 08:04:40 UTC (rev 1269) @@ -81,7 +81,7 @@ /** * @return the value of idList */ - public ArrayList<String> getIdList(){ + public List<String> getIdList(){ return this.idList; } Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderConstants.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderConstants.java 2012-05-22 19:08:41 UTC (rev 1268) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderConstants.java 2012-05-23 08:04:40 UTC (rev 1269) @@ -69,4 +69,15 @@ public static final String stroke = "stroke"; public static final String strokeWidth = "stroke-width"; public static final String strokeDashArray = "stroke-dasharray"; + public static final String endHead = "endHead"; + public static final String startHead = "startHead"; + public static final String cx = "cx"; + public static final String cy = "cy"; + public static final String cz = "cz"; + public static final String absoluteCy = "cx"; + public static final String absoluteCx = "cy"; + public static final String absoluteCz = "cz"; + public static final String stopColor = "stop-color"; + public static final String offset = "offset"; + } \ No newline at end of file Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderInformationBase.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderInformationBase.java 2012-05-22 19:08:41 UTC (rev 1268) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderInformationBase.java 2012-05-23 08:04:40 UTC (rev 1269) @@ -39,538 +39,503 @@ */ public class RenderInformationBase extends AbstractNamedSBase { - /** - * - */ - private static final long serialVersionUID = -9096154126197866584L; - - protected String programName; - protected String programVersion; //TODO int better? - protected String referenceRenderInformation; - protected Color backgroundColor; - protected ListOf<ColorDefinition> listOfColorDefinitions; - // TODO maybe wrong class for linear and radial gradients - protected ListOf<GradientBase> listOfGradientBases; - protected ListOf<LineEnding> listofLineEndings; - - /** - * Creates an RenderInformationBase instance - */ - public RenderInformationBase() { - super(); - initDefaults(); - } + /** + * + */ + private static final long serialVersionUID = -9096154126197866584L; + protected String programName; + protected String programVersion; //TODO int better? + protected String referenceRenderInformation; + protected Color backgroundColor; + protected ListOf<ColorDefinition> listOfColorDefinitions; + // TODO maybe wrong class for linear and radial gradients + protected ListOf<GradientBase> listOfGradientBases; + protected ListOf<LineEnding> listofLineEndings; - /** - * Creates a RenderInformationBase instance with an id. - * - * @param id - */ - public RenderInformationBase(String id) { - super(id); - initDefaults(); - } + /** + * Creates an RenderInformationBase instance + */ + public RenderInformationBase() { + super(); + initDefaults(); + } - /** - * Creates a RenderInformationBase instance with a level and version. - * - * @param level - * @param version - */ - public RenderInformationBase(int level, int version) { - this(null, null, level, version); - } + /** + * Creates a RenderInformationBase instance with an id. + * + * @param id + */ + public RenderInformationBase(String id) { + super(id); + initDefaults(); + } - /** - * Creates a RenderInformationBase instance with an id, level, and version. - * - * @param id - * @param level - * @param version - */ - public RenderInformationBase(String id, int level, int version) { - this(id, null, level, version); - } - + /** + * Creates a RenderInformationBase instance with a level and version. + * + * @param level + * @param version + */ + public RenderInformationBase(int level, int version) { + this(null, null, level, version); + } - /** - * Creates a RenderInformationBase instance with an id, name, level, and version. - * - * @param id - * @param name - * @param level - * @param version - */ - public RenderInformationBase(String id, String name, int level, int version) { - super(id, name, level, version); - if (getLevelAndVersion().compareTo(Integer.valueOf(MIN_SBML_LEVEL), - Integer.valueOf(MIN_SBML_VERSION)) < 0) { - throw new LevelVersionError(getElementName(), level, version); - } - initDefaults(); - } + /** + * Creates a RenderInformationBase instance with an id, level, and version. + * + * @param id + * @param level + * @param version + */ + public RenderInformationBase(String id, int level, int version) { + this(id, null, level, version); + } - /** - * Clone constructor - */ - public RenderInformationBase(RenderInformationBase obj) { - super(obj); - this.programName = obj.programName; - this.programVersion = obj.programVersion; - this.referenceRenderInformation = obj.referenceRenderInformation; - this.backgroundColor = obj.backgroundColor; - this.listOfColorDefinitions = obj.listOfColorDefinitions; - this.listOfGradientBases = obj.listOfGradientBases; - this.listofLineEndings = obj.listofLineEndings; - } + /** + * Creates a RenderInformationBase instance with an id, name, level, and version. + * + * @param id + * @param name + * @param level + * @param version + */ + public RenderInformationBase(String id, String name, int level, int version) { + super(id, name, level, version); + if (getLevelAndVersion().compareTo(Integer.valueOf(MIN_SBML_LEVEL), + Integer.valueOf(MIN_SBML_VERSION)) < 0) { + throw new LevelVersionError(getElementName(), level, version); + } + initDefaults(); + } - /** - * clones this class - */ - public RenderInformationBase clone() { - return new RenderInformationBase(this); - } + /** + * Clone constructor + */ + public RenderInformationBase(RenderInformationBase obj) { + super(obj); + this.programName = obj.programName; + this.programVersion = obj.programVersion; + this.referenceRenderInformation = obj.referenceRenderInformation; + this.backgroundColor = obj.backgroundColor; + this.listOfColorDefinitions = obj.listOfColorDefinitions; + this.listOfGradientBases = obj.listOfGradientBases; + this.listofLineEndings = obj.listofLineEndings; + } - /** - * Initializes the default values using the namespace. - */ - public void initDefaults() { - //TODO - //addNamespace(.namespaceURI); - this.backgroundColor = 0xFFFFFFFF; - this.programName = null; - this.programVersion = null; - this.referenceRenderInformation = null; - this.listOfColorDefinitions = null; - this.listOfGradientBases = null; - this.listofLineEndings = null; - } - - -/** - * @return the value of programName - */ -public String getProgramName() { - - if (isSetProgramName()) { - return this.programName; - } else { - return null; - } - //TODO Create a Constants class? - // This is necessary if we cannot return null here. - //throw new PropertyUndefinedError("programmName", this); -} + /** + * clones this class + */ + public RenderInformationBase clone() { + return new RenderInformationBase(this); + } -/** - * @return whether programmName is set - */ -public boolean isSetProgramName() { - return this.programName != null; -} + /** + * Initializes the default values using the namespace. + */ + public void initDefaults() { + //TODO addNamespace(.namespaceURI); + this.backgroundColor = new Color(0, 0, 0); + this.programName = null; + this.programVersion = null; + this.referenceRenderInformation = null; + this.listOfColorDefinitions = null; + this.listOfGradientBases = null; + this.listofLineEndings = null; + } -/** - * Set the value of programmName - */ -public void setProgramName(String programName) { - String oldProgramName = this.programName; - this.programName = programName; - firePropertyChange("programName", oldProgramName, this.programName); -} + /** + * @... [truncated message content] |
From: <jak...@us...> - 2012-05-22 19:08:49
|
Revision: 1268 http://jsbml.svn.sourceforge.net/jsbml/?rev=1268&view=rev Author: jakobmatthes Date: 2012-05-22 19:08:41 +0000 (Tue, 22 May 2012) Log Message: ----------- Render extension: GrpahicalPrimitive1D, GrpahicalPrimitive2D, Rectangle, RenderCubicBezier, RenderPoint, Style, Text, Transformation, Transformation2D, add constants in RenderConstants Modified Paths: -------------- trunk/extensions/render/src/org/sbml/jsbml/ext/render/GraphicalPrimitive1D.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/GraphicalPrimitive2D.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/Rectangle.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderConstants.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderCubicBezier.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderPoint.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/Style.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/Text.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/Transformation.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/Transformation2D.java Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/GraphicalPrimitive1D.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/GraphicalPrimitive1D.java 2012-05-20 14:30:42 UTC (rev 1267) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/GraphicalPrimitive1D.java 2012-05-22 19:08:41 UTC (rev 1268) @@ -20,9 +20,12 @@ */ package org.sbml.jsbml.ext.render; -import java.util.List; +import java.text.MessageFormat; +import org.sbml.jsbml.PropertyUndefinedError; +import org.sbml.jsbml.SBase; + /** * @author Eugen Netz * @author Alexander Diamantikos @@ -33,8 +36,200 @@ * @date 08.05.2012 */ public class GraphicalPrimitive1D extends Transformation2D { + public static final int MIN_SBML_LEVEL = 3; + public static final int MIN_SBML_VERSION = 1; protected ColorDefinition stroke; - protected Integer strokeWidth; - protected List<Integer> strokeDashArray; + protected Short[] strokeDashArray; + protected Integer strokeWidth; + + + /** + * @return the value of strokeDashArray + */ + public Short[] getStrokeDashArray() { + if (isSetStrokeDashArray()) { + return strokeDashArray; + } + // This is necessary if we cannot return null here. + throw new PropertyUndefinedError(RenderConstants.strokeDashArray, this); + } + + + /** + * @return whether strokeDashArray is set + */ + public boolean isSetStrokeDashArray() { + return this.strokeDashArray != null; + } + + + /** + * Set the value of strokeDashArray + */ + public void setStrokeDashArray(Short[] strokeDashArray) { + Short[] oldStrokeDashArray = this.strokeDashArray; + this.strokeDashArray = strokeDashArray; + firePropertyChange(RenderConstants.strokeDashArray, oldStrokeDashArray, this.strokeDashArray); + } + + + /** + * Unsets the variable strokeDashArray + * @return <code>true</code>, if strokeDashArray was set before, + * otherwise <code>false</code> + */ + public boolean unsetStrokeDashArray() { + if (isSetStrokeDashArray()) { + Short[] oldStrokeDashArray = this.strokeDashArray; + this.strokeDashArray = null; + firePropertyChange(RenderConstants.strokeDashArray, oldStrokeDashArray, this.strokeDashArray); + return true; + } + return false; + } + + /** + * Creates an GraphicalPrimitive1D instance + */ + public GraphicalPrimitive1D() { + super(); + initDefaults(); + } + + + /** + * Clone constructor + */ + public GraphicalPrimitive1D(GraphicalPrimitive1D obj) { + super(obj); + stroke = obj.stroke; + strokeWidth = obj.strokeWidth; + strokeDashArray = obj.strokeDashArray; + } + + + /** + * clones this class + */ + public GraphicalPrimitive1D clone() { + return new GraphicalPrimitive1D(this); + } + + + @Override + public boolean getAllowsChildren() { + return false; + } + + + @Override + public SBase getChildAt(int childIndex) { + if (childIndex < 0) { + throw new IndexOutOfBoundsException(childIndex + " < 0"); + } + int pos = 0; + throw new IndexOutOfBoundsException(MessageFormat.format( + "Index {0,number,integer} >= {1,number,integer}", childIndex, + +((int) Math.min(pos, 0)))); + } + + + @Override + public int getChildCount() { + return 0; + } + + + /** + * @return the value of stroke + */ + public ColorDefinition getStroke() { + if (isSetStroke()) { + return stroke; + } + // This is necessary if we cannot return null here. + throw new PropertyUndefinedError(RenderConstants.stroke, this); + } + + /** + * @return the value of strokeWidth + */ + public int getStrokeWidth() { + if (isSetStrokeWidth()) { + return strokeWidth; + } + // This is necessary if we cannot return null here. + throw new PropertyUndefinedError(RenderConstants.strokeWidth, this); + } + + + /** + * Initializes the default values using the namespace. + */ + public void initDefaults() { + addNamespace(RenderConstants.namespaceURI); + } + + + /** + * @return whether stroke is set + */ + public boolean isSetStroke() { + return this.stroke != null; + } + + /** + * @return whether strokeWidth is set + */ + public boolean isSetStrokeWidth() { + return this.strokeWidth != null; + } + /** + * Set the value of stroke + */ + public void setStroke(ColorDefinition stroke) { + ColorDefinition oldStroke = this.stroke; + this.stroke = stroke; + firePropertyChange(RenderConstants.stroke, oldStroke, this.stroke); + } + /** + * Set the value of strokeWidth + */ + public void setStrokeWidth(Integer strokeWidth) { + Integer oldStrokeWidth = this.strokeWidth; + this.strokeWidth = strokeWidth; + firePropertyChange(RenderConstants.strokeWidth, oldStrokeWidth, this.strokeWidth); + } + + /** + * Unsets the variable stroke + * @return <code>true</code>, if stroke was set before, + * otherwise <code>false</code> + */ + public boolean unsetStroke() { + if (isSetStroke()) { + ColorDefinition oldStroke = this.stroke; + this.stroke = null; + firePropertyChange(RenderConstants.stroke, oldStroke, this.stroke); + return true; + } + return false; + } + + /** + * Unsets the variable strokeWidth + * @return <code>true</code>, if strokeWidth was set before, + * otherwise <code>false</code> + */ + public boolean unsetStrokeWidth() { + if (isSetStrokeWidth()) { + Integer oldStrokeWidth = this.strokeWidth; + this.strokeWidth = null; + firePropertyChange(RenderConstants.strokeWidth, oldStrokeWidth, this.strokeWidth); + return true; + } + return false; + } + } Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/GraphicalPrimitive2D.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/GraphicalPrimitive2D.java 2012-05-20 14:30:42 UTC (rev 1267) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/GraphicalPrimitive2D.java 2012-05-22 19:08:41 UTC (rev 1268) @@ -20,7 +20,9 @@ */ package org.sbml.jsbml.ext.render; +import org.sbml.jsbml.PropertyUndefinedError; + /** * @author Eugen Netz * @author Alexander Diamantikos @@ -37,4 +39,139 @@ evenodd, } protected FillRule fillRule; + + /** + * Creates an GraphicalPrimitive2D instance + */ + public GraphicalPrimitive2D() { + super(); + initDefaults(); + } + + /** + * Clone constructor + */ + public GraphicalPrimitive2D(GraphicalPrimitive2D obj) { + super(obj); + fill = obj.fill; + fillRule = obj.fillRule; + } + + + /** + * clones this class + */ + @Override + public GraphicalPrimitive2D clone() { + return new GraphicalPrimitive2D(this); + } + + + /** + * Initializes the default values using the namespace. + */ + public void initDefaults() { + addNamespace(RenderConstants.namespaceURI); + // TODO: init default values here if necessary, e.g.: + // bar = null; + } + + + /** + * @return the value of fill + */ + public String getFill() { + if (isSetFill()) { + return fill; + } + // This is necessary if we cannot return null here. + throw new PropertyUndefinedError(RenderConstants.fill, this); + } + + + /** + * @return whether fill is set + */ + public boolean isSetFill() { + return this.fill != null; + } + + + /** + * Set the value of fill + */ + public void setFill(String fill) { + String oldFill = this.fill; + this.fill = fill; + firePropertyChange(RenderConstants.fill, oldFill, this.fill); + } + + + /** + * Unsets the variable fill + * @return <code>true</code>, if fill was set before, + * otherwise <code>false</code> + */ + public boolean unsetFill() { + if (isSetFill()) { + String oldFill = this.fill; + this.fill = null; + firePropertyChange(RenderConstants.fill, oldFill, this.fill); + return true; + } + return false; + } + + + + /** + * @return the value of fillRule + */ + public FillRule getFillRule() { + if (isSetFillRule()) { + return fillRule; + } + // This is necessary if we cannot return null here. + throw new PropertyUndefinedError(RenderConstants.fillRule, this); + } + + + /** + * @return whether fillRule is set + */ + public boolean isSetFillRule() { + return this.fillRule != null; + } + + + /** + * Set the value of fillRule + */ + public void setFillRule(FillRule fillRule) { + FillRule oldFillRule = this.fillRule; + this.fillRule = fillRule; + firePropertyChange(RenderConstants.fillRule, oldFillRule, this.fillRule); + } + + + /** + * Unsets the variable fillRule + * @return <code>true</code>, if fillRule was set before, + * otherwise <code>false</code> + */ + public boolean unsetFillRule() { + if (isSetFillRule()) { + FillRule oldFillRule = this.fillRule; + this.fillRule = null; + firePropertyChange(RenderConstants.fillRule, oldFillRule, this.fillRule); + return true; + } + return false; + } + + + + + public static final int MIN_SBML_LEVEL = 3; + public static final int MIN_SBML_VERSION = 1; } Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/Rectangle.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/Rectangle.java 2012-05-20 14:30:42 UTC (rev 1267) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/Rectangle.java 2012-05-22 19:08:41 UTC (rev 1268) @@ -20,7 +20,12 @@ */ package org.sbml.jsbml.ext.render; +import java.text.MessageFormat; +import org.sbml.jsbml.PropertyUndefinedError; +import org.sbml.jsbml.SBase; + + /** * @author Eugen Netz * @author Alexander Diamantikos @@ -30,11 +35,739 @@ * @since 1.0 * @date 08.05.2012 */ -public class Rectangle extends GraphicalPrimitive2D { +public class Rectangle extends GraphicalPrimitive2D implements Point3D { + /** + * + */ + private static final long serialVersionUID = -4314411828208615411L; private Double x, y, z; private Double width, height; private Boolean absoluteX, absoluteY, absoluteZ; private Boolean absoluteWidth, absoluteHeight; private Double rx, ry; private Boolean absoluteRx, absoluteRy; + + + + /** + * @return the value of rx + */ + public double getRx() { + if (isSetRx()) { + return rx; + } + // This is necessary if we cannot return null here. + throw new PropertyUndefinedError(RenderConstants.rx, this); + } + + + /** + * @return whether rx is set + */ + public boolean isSetRx() { + return this.rx != null; + } + + + /** + * Set the value of rx + */ + public void setRx(Double rx) { + Double oldRx = this.rx; + this.rx = rx; + firePropertyChange(RenderConstants.rx, oldRx, this.rx); + } + + + /** + * Unsets the variable rx + * @return <code>true</code>, if rx was set before, + * otherwise <code>false</code> + */ + public boolean unsetRx() { + if (isSetRx()) { + Double oldRx = this.rx; + this.rx = null; + firePropertyChange(RenderConstants.rx, oldRx, this.rx); + return true; + } + return false; + } + + + /** + * @return the value of ry + */ + public double getRy() { + if (isSetRy()) { + return ry; + } + // This is necessary if we cannot return null here. + throw new PropertyUndefinedError(RenderConstants.ry, this); + } + + + /** + * @return whether ry is set + */ + public boolean isSetRy() { + return this.ry != null; + } + + + /** + * Set the value of ry + */ + public void setRy(Double ry) { + Double oldRy = this.ry; + this.ry = ry; + firePropertyChange(RenderConstants.ry, oldRy, this.ry); + } + + /** + * @return the value of absoluteX + */ + public boolean isAbsoluteX() { + if (isSetAbsoluteX()) { + return absoluteX; + } + // This is necessary if we cannot return null here. + throw new PropertyUndefinedError(RenderConstants.absoluteX, this); + } + + + /** + * @return whether absoluteX is set + */ + public boolean isSetAbsoluteX() { + return this.absoluteX != null; + } + + + /** + * Set the value of absoluteX + */ + public void setAbsoluteX(Boolean absoluteX) { + Boolean oldAbsoluteX = this.absoluteX; + this.absoluteX = absoluteX; + firePropertyChange(RenderConstants.absoluteX, oldAbsoluteX, this.absoluteX); + } + + + /** + * Unsets the variable absoluteX + * @return <code>true</code>, if absoluteX was set before, + * otherwise <code>false</code> + */ + public boolean unsetAbsoluteX() { + if (isSetAbsoluteX()) { + Boolean oldAbsoluteX = this.absoluteX; + this.absoluteX = null; + firePropertyChange(RenderConstants.absoluteX, oldAbsoluteX, this.absoluteX); + return true; + } + return false; + } + + + /** + * @return the value of absoluteY + */ + public boolean isAbsoluteY() { + if (isSetAbsoluteY()) { + return absoluteY; + } + // This is necessary if we cannot return null here. + throw new PropertyUndefinedError(RenderConstants.absoluteY, this); + } + + + /** + * @return whether absoluteY is set + */ + public boolean isSetAbsoluteY() { + return this.absoluteY != null; + } + + + /** + * Set the value of absoluteY + */ + public void setAbsoluteY(Boolean absoluteY) { + Boolean oldAbsoluteY = this.absoluteY; + this.absoluteY = absoluteY; + firePropertyChange(RenderConstants.absoluteY, oldAbsoluteY, this.absoluteY); + } + + + /** + * Unsets the variable absoluteY + * @return <code>true</code>, if absoluteY was set before, + * otherwise <code>false</code> + */ + public boolean unsetAbsoluteY() { + if (isSetAbsoluteY()) { + Boolean oldAbsoluteY = this.absoluteY; + this.absoluteY = null; + firePropertyChange(RenderConstants.absoluteY, oldAbsoluteY, this.absoluteY); + return true; + } + return false; + } + + + /** + * @return the value of absoluteZ + */ + public boolean isAbsoluteZ() { + if (isSetAbsoluteZ()) { + return absoluteZ; + } + // This is necessary if we cannot return null here. + throw new PropertyUndefinedError(RenderConstants.absoluteZ, this); + } + + + /** + * @return whether absoluteZ is set + */ + public boolean isSetAbsoluteZ() { + return this.absoluteZ != null; + } + + + /** + * Set the value of absoluteZ + */ + public void setAbsoluteZ(Boolean absoluteZ) { + Boolean oldAbsoluteZ = this.absoluteZ; + this.absoluteZ = absoluteZ; + firePropertyChange(RenderConstants.absoluteZ, oldAbsoluteZ, this.absoluteZ); + } + + + /** + * Unsets the variable absoluteZ + * @return <code>true</code>, if absoluteZ was set before, + * otherwise <code>false</code> + */ + public boolean unsetAbsoluteZ() { + if (isSetAbsoluteZ()) { + Boolean oldAbsoluteZ = this.absoluteZ; + this.absoluteZ = null; + firePropertyChange(RenderConstants.absoluteZ, oldAbsoluteZ, this.absoluteZ); + return true; + } + return false; + } + + + + /** + * @return the value of absoluteRx + */ + public boolean isAbsoluteRx() { + if (isSetAbsoluteRx()) { + return absoluteRx; + } + // This is necessary if we cannot return null here. + throw new PropertyUndefinedError(RenderConstants.absoluteRx, this); + } + + + /** + * @return whether absoluteRx is set + */ + public boolean isSetAbsoluteRx() { + return this.absoluteRx != null; + } + + + /** + * Set the value of absoluteRx + */ + public void setAbsoluteRx(Boolean absoluteRx) { + Boolean oldAbsoluteRx = this.absoluteRx; + this.absoluteRx = absoluteRx; + firePropertyChange(RenderConstants.absoluteRx, oldAbsoluteRx, this.absoluteRx); + } + + + /** + * Unsets the variable absoluteRx + * @return <code>true</code>, if absoluteRx was set before, + * otherwise <code>false</code> + */ + public boolean unsetAbsoluteRx() { + if (isSetAbsoluteRx()) { + Boolean oldAbsoluteRx = this.absoluteRx; + this.absoluteRx = null; + firePropertyChange(RenderConstants.absoluteRx, oldAbsoluteRx, this.absoluteRx); + return true; + } + return false; + } + + + + /** + * @return the value of absoluteRy + */ + public boolean isAbsoluteRy() { + if (isSetAbsoluteRy()) { + return absoluteRy; + } + // This is necessary if we cannot return null here. + throw new PropertyUndefinedError(RenderConstants.absoluteRy, this); + } + + + /** + * @return whether absoluteRy is set + */ + public boolean isSetAbsoluteRy() { + return this.absoluteRy != null; + } + + + /** + * Set the value of absoluteRy + */ + public void setAbsoluteRy(Boolean absoluteRy) { + Boolean oldAbsoluteRy = this.absoluteRy; + this.absoluteRy = absoluteRy; + firePropertyChange(RenderConstants.absoluteRy, oldAbsoluteRy, this.absoluteRy); + } + + + /** + * Unsets the variable absoluteRy + * @return <code>true</code>, if absoluteRy was set before, + * otherwise <code>false</code> + */ + public boolean unsetAbsoluteRy() { + if (isSetAbsoluteRy()) { + Boolean oldAbsoluteRy = this.absoluteRy; + this.absoluteRy = null; + firePropertyChange(RenderConstants.absoluteRy, oldAbsoluteRy, this.absoluteRy); + return true; + } + return false; + } + + + + /** + * @return the value of absoluteHeight + */ + public boolean isAbsoluteHeight() { + if (isSetAbsoluteHeight()) { + return absoluteHeight; + } + // This is necessary if we cannot return null here. + throw new PropertyUndefinedError(RenderConstants.absoluteHeight, this); + } + + + /** + * @return whether absoluteHeight is set + */ + public boolean isSetAbsoluteHeight() { + return this.absoluteHeight != null; + } + + + /** + * Set the value of absoluteHeight + */ + public void setAbsoluteHeight(Boolean absoluteHeight) { + Boolean oldAbsoluteHeight = this.absoluteHeight; + this.absoluteHeight = absoluteHeight; + firePropertyChange(RenderConstants.absoluteHeight, oldAbsoluteHeight, this.absoluteHeight); + } + + + /** + * Unsets the variable absoluteHeight + * @return <code>true</code>, if absoluteHeight was set before, + * otherwise <code>false</code> + */ + public boolean unsetAbsoluteHeight() { + if (isSetAbsoluteHeight()) { + Boolean oldAbsoluteHeight = this.absoluteHeight; + this.absoluteHeight = null; + firePropertyChange(RenderConstants.absoluteHeight, oldAbsoluteHeight, this.absoluteHeight); + return true; + } + return false; + } + + + /** + * @return the value of absoluteWidth + */ + public boolean isAbsoluteWidth() { + if (isSetAbsoluteWidth()) { + return absoluteWidth; + } + // This is necessary if we cannot return null here. + throw new PropertyUndefinedError(RenderConstants.absoluteWidth, this); + } + + + /** + * @return whether absoluteWidth is set + */ + public boolean isSetAbsoluteWidth() { + return this.absoluteWidth != null; + } + + + /** + * Set the value of absoluteWidth + */ + public void setAbsoluteWidth(Boolean absoluteWidth) { + Boolean oldAbsoluteWidth = this.absoluteWidth; + this.absoluteWidth = absoluteWidth; + firePropertyChange(RenderConstants.absoluteWidth, oldAbsoluteWidth, this.absoluteWidth); + } + + + /** + * Unsets the variable absoluteWidth + * @return <code>true</code>, if absoluteWidth was set before, + * otherwise <code>false</code> + */ + public boolean unsetAbsoluteWidth() { + if (isSetAbsoluteWidth()) { + Boolean oldAbsoluteWidth = this.absoluteWidth; + this.absoluteWidth = null; + firePropertyChange(RenderConstants.absoluteWidth, oldAbsoluteWidth, this.absoluteWidth); + return true; + } + return false; + } + + /** + * Unsets the variable ry + * @return <code>true</code>, if ry was set before, + * otherwise <code>false</code> + */ + public boolean unsetRy() { + if (isSetRy()) { + Double oldRy = this.ry; + this.ry = null; + firePropertyChange(RenderConstants.ry, oldRy, this.ry); + return true; + } + return false; + } + + + /** + * @return the value of x + */ + public double getX() { + if (isSetX()) { + return x; + } + // This is necessary if we cannot return null here. + throw new PropertyUndefinedError(RenderConstants.x, this); + } + + + /** + * @return whether x is set + */ + public boolean isSetX() { + return this.x != null; + } + + + /** + * Set the value of x + */ + public void setX(Double x) { + Double oldX = this.x; + this.x = x; + firePropertyChange(RenderConstants.x, oldX, this.x); + } + + + /** + * Unsets the variable x + * @return <code>true</code>, if x was set before, + * otherwise <code>false</code> + */ + public boolean unsetX() { + if (isSetX()) { + Double oldX = this.x; + this.x = null; + firePropertyChange(RenderConstants.x, oldX, this.x); + return true; + } + return false; + } + + + /** + * @return the value of y + */ + public double getY() { + if (isSetY()) { + return y; + } + // This is necessary if we cannot return null here. + throw new PropertyUndefinedError(RenderConstants.y, this); + } + + + /** + * @return whether y is set + */ + public boolean isSetY() { + return this.y != null; + } + + + /** + * Set the value of y + */ + public void setY(Double y) { + Double oldY = this.y; + this.y = y; + firePropertyChange(RenderConstants.y, oldY, this.y); + } + + + /** + * Unsets the variable y + * @return <code>true</code>, if y was set before, + * otherwise <code>false</code> + */ + public boolean unsetY() { + if (isSetY()) { + Double oldY = this.y; + this.y = null; + firePropertyChange(RenderConstants.y, oldY, this.y); + return true; + } + return false; + } + + + /** + * @return the value of z + */ + public double getZ() { + if (isSetZ()) { + return z; + } + // This is necessary if we cannot return null here. + throw new PropertyUndefinedError(RenderConstants.z, this); + } + + + /** + * @return whether z is set + */ + public boolean isSetZ() { + return this.z != null; + } + + + /** + * Set the value of z + */ + public void setZ(Double z) { + Double oldZ = this.z; + this.z = z; + firePropertyChange(RenderConstants.z, oldZ, this.z); + } + + + /** + * Unsets the variable z + * @return <code>true</code>, if z was set before, + * otherwise <code>false</code> + */ + public boolean unsetZ() { + if (isSetZ()) { + Double oldZ = this.z; + this.z = null; + firePropertyChange(RenderConstants.z, oldZ, this.z); + return true; + } + return false; + } + + + /** + * @return the value of height + */ + public double getHeight() { + if (isSetHeight()) { + return height; + } + // This is necessary if we cannot return null here. + throw new PropertyUndefinedError(RenderConstants.height, this); + } + + + /** + * @return whether height is set + */ + public boolean isSetHeight() { + return this.height != null; + } + + + /** + * Set the value of height + */ + public void setHeight(Double height) { + Double oldHeight = this.height; + this.height = height; + firePropertyChange(RenderConstants.height, oldHeight, this.height); + } + + + /** + * Unsets the variable height + * @return <code>true</code>, if height was set before, + * otherwise <code>false</code> + */ + public boolean unsetHeight() { + if (isSetHeight()) { + Double oldHeight = this.height; + this.height = null; + firePropertyChange(RenderConstants.height, oldHeight, this.height); + return true; + } + return false; + } + + + /** + * @return the value of width + */ + public double getWidth() { + if (isSetWidth()) { + return width; + } + // This is necessary if we cannot return null here. + throw new PropertyUndefinedError(RenderConstants.width, this); + } + + + /** + * @return whether width is set + */ + public boolean isSetWidth() { + return this.width != null; + } + + + /** + * Set the value of width + */ + public void setWidth(Double width) { + Double oldWidth = this.width; + this.width = width; + firePropertyChange(RenderConstants.width, oldWidth, this.width); + } + + + /** + * Unsets the variable width + * @return <code>true</code>, if width was set before, + * otherwise <code>false</code> + */ + public boolean unsetWidth() { + if (isSetWidth()) { + Double oldWidth = this.width; + this.width = null; + firePropertyChange(RenderConstants.width, oldWidth, this.width); + return true; + } + return false; + } + + + + + /** + * Creates an Rectangle instance + */ + public Rectangle() { + super(); + initDefaults(); + } + + + + /** + * Clone constructor + */ + public Rectangle(Rectangle obj) { + super(obj); + x = obj.x; + y = obj.y; + z = obj.z; + rx = obj.rx; + ry = obj.ry; + height = obj.height; + width = obj.width; + absoluteX = obj.absoluteX; + absoluteY = obj.absoluteY; + absoluteZ = obj.absoluteZ; + absoluteHeight = obj.absoluteHeight; + absoluteWidth = obj.absoluteWidth; + absoluteRx = obj.absoluteRx; + absoluteRy = obj.absoluteRy; + } + + + /** + * clones this class + */ + public Rectangle clone() { + return new Rectangle(this); + } + + + /** + * Initializes the default values using the namespace. + */ + public void initDefaults() { + addNamespace(RenderConstants.namespaceURI); + z = 0d; + rx = 0d; + ry = 0d; + } + + public static final int MIN_SBML_LEVEL = 3; + public static final int MIN_SBML_VERSION = 1; + + @Override + public boolean getAllowsChildren() { + return false; + } + + @Override + public int getChildCount() { + return 0; + } + + @Override + public SBase getChildAt(int childIndex) { + if (childIndex < 0) { + throw new IndexOutOfBoundsException(childIndex + " < 0"); + } + int pos = 0; + throw new IndexOutOfBoundsException(MessageFormat.format( + "Index {0,number,integer} >= {1,number,integer}", childIndex, + +((int) Math.min(pos, 0)))); + } + } Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderConstants.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderConstants.java 2012-05-20 14:30:42 UTC (rev 1267) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderConstants.java 2012-05-22 19:08:41 UTC (rev 1268) @@ -31,7 +31,6 @@ * @date 08.05.2012 */ public interface RenderConstants { - public static final String namespaceURI = "http://www.sbml.org/sbml/level3/version1/render/version1"; public static final String fontFamily = "font-family"; public static final String fontSize = "font-size"; @@ -45,4 +44,29 @@ public static final String absoluteX = "absolute-x"; public static final String absoluteY = "absolute-y"; public static final String absoluteZ = "absolute-z"; + public static final String absoluteX1 = "absolute-x1"; + public static final String absoluteY1 = "absolute-y1"; + public static final String absoluteZ1 = "absolute-z1"; + public static final String absoluteX2 = "absolute-x2"; + public static final String absoluteY2 = "absolute-y2"; + public static final String absoluteZ2 = "absolute-z2"; + public static final String x1 = "x1"; + public static final String y1 = "y1"; + public static final String z1 = "z1"; + public static final String x2 = "x2"; + public static final String y2 = "y2"; + public static final String z2 = "z2"; + public static final String width = "width"; + public static final String height = "height"; + public static final String ry = "ry"; + public static final String rx = "rx"; + public static final String absoluteWidth = "absolute-width"; + public static final String absoluteHeight = "absolute-height"; + public static final String absoluteRx = "absolute-rx"; + public static final String absoluteRy = "absolute-ry"; + public static final String fill = "fill"; + public static final String fillRule = "fill-rule"; + public static final String stroke = "stroke"; + public static final String strokeWidth = "stroke-width"; + public static final String strokeDashArray = "stroke-dasharray"; } \ No newline at end of file Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderCubicBezier.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderCubicBezier.java 2012-05-20 14:30:42 UTC (rev 1267) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderCubicBezier.java 2012-05-22 19:08:41 UTC (rev 1268) @@ -20,7 +20,12 @@ */ package org.sbml.jsbml.ext.render; +import java.text.MessageFormat; +import org.sbml.jsbml.PropertyUndefinedError; +import org.sbml.jsbml.SBase; + + /** * @author Eugen Netz * @author Alexander Diamantikos @@ -31,8 +36,633 @@ * @date 08.05.2012 */ public class RenderCubicBezier extends RenderPoint { + public static final int MIN_SBML_LEVEL = 3; + public static final int MIN_SBML_VERSION = 1; + /** + * + */ + private static final long serialVersionUID = -2426257418589249467L; + private Boolean absoluteX1, absoluteY1, absoluteZ1; + private Boolean absoluteX2, absoluteY2, absoluteZ2; private Double x1, y1, z1; private Double x2, y2, z2; - private Boolean absoluteX1, absoluteY1, absoluteZ1; - private Boolean absoluteX2, absoluteY2, absoluteZ2; + + /** + * Creates an RenderCubicBezier instance + */ + public RenderCubicBezier() { + super(); + initDefaults(); + } + + /** + * Clone constructor + */ + public RenderCubicBezier(RenderCubicBezier obj) { + super(obj); + absoluteX1 = obj.absoluteX1; + absoluteY1 = obj.absoluteY1; + absoluteZ2 = obj.absoluteZ2; + absoluteX2 = obj.absoluteX2; + absoluteY2 = obj.absoluteY2; + absoluteZ2 = obj.absoluteZ2; + x1 = obj.x1; + y1 = obj.y1; + z1 = obj.z1; + x2 = obj.x2; + y2 = obj.y2; + z2 = obj.z2; + } + + /** + * clones this class + */ + public RenderCubicBezier clone() { + return new RenderCubicBezier(this); + } + + + @Override + public boolean getAllowsChildren() { + return false; + } + + + @Override + public SBase getChildAt(int childIndex) { + if (childIndex < 0) { + throw new IndexOutOfBoundsException(childIndex + " < 0"); + } + int pos = 0; + throw new IndexOutOfBoundsException(MessageFormat.format( + "Index {0,number,integer} >= {1,number,integer}", childIndex, + +((int) Math.min(pos, 0)))); + } + + @Override + public int getChildCount() { + return 0; + } + + + /** + * @return the value of x1 + */ + public double getX1() { + if (isSetX1()) { + return x1; + } + // This is necessary if we cannot return null here. + throw new PropertyUndefinedError(RenderConstants.x1, this); + } + + + /** + * @return the value of x2 + */ + public double getX2() { + if (isSetX2()) { + return x2; + } + // This is necessary if we cannot return null here. + throw new PropertyUndefinedError(RenderConstants.x2, this); + } + + + /** + * @return the value of y1 + */ + public double getY1() { + if (isSetY1()) { + return y1; + } + // This is necessary if we cannot return null here. + throw new PropertyUndefinedError(RenderConstants.y1, this); + } + + + /** + * @return the value of y2 + */ + public double getY2() { + if (isSetY2()) { + return y2; + } + // This is necessary if we cannot return null here. + throw new PropertyUndefinedError(RenderConstants.y2, this); + } + + + /** + * @return the value of z1 + */ + public double getZ1() { + if (isSetZ1()) { + return z1; + } + // This is necessary if we cannot return null here. + throw new PropertyUndefinedError(RenderConstants.z1, this); + } + + + /** + * @return the value of z2 + */ + public double getZ2() { + if (isSetZ2()) { + return z2; + } + // This is necessary if we cannot return null here. + throw new PropertyUndefinedError(RenderConstants.z2, this); + } + + + /** + * Initializes the default values using the namespace. + */ + public void initDefaults() { + addNamespace(RenderConstants.namespaceURI); + z1 = 0d; + z2 = 0d; + } + + + /** + * @return the value of absoluteX1 + */ + public boolean isAbsoluteX1() { + if (isSetAbsoluteX1()) { + return absoluteX1; + } + // This is necessary if we cannot return null here. + throw new PropertyUndefinedError(RenderConstants.absoluteX1, this); + } + + + /** + * @return the value of absoluteX2 + */ + public boolean isAbsoluteX2() { + if (isSetAbsoluteX2()) { + return absoluteX2; + } + // This is necessary if we cannot return null here. + throw new PropertyUndefinedError(RenderConstants.absoluteX2, this); + } + + + /** + * @return the value of absoluteY1 + */ + public boolean isAbsoluteY1() { + if (isSetAbsoluteY1()) { + return absoluteY1; + } + // This is necessary if we cannot return null here. + throw new PropertyUndefinedError(RenderConstants.absoluteY1, this); + } + + + /** + * @return the value of absoluteY2 + */ + public boolean isAbsoluteY2() { + if (isSetAbsoluteY2()) { + return absoluteY2; + } + // This is necessary if we cannot return null here. + throw new PropertyUndefinedError(RenderConstants.absoluteY2, this); + } + + + /** + * @return the value of absoluteZ1 + */ + public boolean isAbsoluteZ1() { + if (isSetAbsoluteZ1()) { + return absoluteZ1; + } + // This is necessary if we cannot return null here. + throw new PropertyUndefinedError(RenderConstants.absoluteZ1, this); + } + + + /** + * @return the value of absoluteZ2 + */ + public boolean isAbsoluteZ2() { + if (isSetAbsoluteZ2()) { + return absoluteZ2; + } + // This is necessary if we cannot return null here. + throw new PropertyUndefinedError(RenderConstants.absoluteZ2, this); + } + + + /** + * @return whether absoluteX1 is set + */ + public boolean isSetAbsoluteX1() { + return this.absoluteX1 != null; + } + + + /** + * @return whether absoluteX2 is set + */ + public boolean isSetAbsoluteX2() { + return this.absoluteX2 != null; + } + + + /** + * @return whether absoluteY1 is set + */ + public boolean isSetAbsoluteY1() { + return this.absoluteY1 != null; + } + + + /** + * @return whether absoluteY2 is set + */ + public boolean isSetAbsoluteY2() { + return this.absoluteY2 != null; + } + + + /** + * @return whether absoluteZ1 is set + */ + public boolean isSetAbsoluteZ1() { + return this.absoluteZ1 != null; + } + + + /** + * @return whether absoluteZ2 is set + */ + public boolean isSetAbsoluteZ2() { + return this.absoluteZ2 != null; + } + + + /** + * @return whether x1 is set + */ + public boolean isSetX1() { + return this.x1 != null; + } + + + /** + * @return whether x2 is set + */ + public boolean isSetX2() { + return this.x2 != null; + } + + + /** + * @return whether y1 is set + */ + public boolean isSetY1() { + return this.y1 != null; + } + + + /** + * @return whether y2 is set + */ + public boolean isSetY2() { + return this.y2 != null; + } + + + /** + * @return whether z1 is set + */ + public boolean isSetZ1() { + return this.z1 != null; + } + + + /** + * @return whether z2 is set + */ + public boolean isSetZ2() { + return this.z2 != null; + } + + + /** + * Set the value of absoluteX1 + */ + public void setAbsoluteX1(boolean absoluteX1) { + Boolean oldAbsoluteX1 = this.absoluteX1; + this.absoluteX1 = absoluteX1; + firePropertyChange(RenderConstants.absoluteX1, oldAbsoluteX1, this.absoluteX1); + } + + + /** + * Set the value of absoluteX2 + */ + public void setAbsoluteX2(boolean absoluteX2) { + Boolean oldAbsoluteX2 = this.absoluteX2; + this.absoluteX2 = absoluteX2; + firePropertyChange(RenderConstants.absoluteX2, oldAbsoluteX2, this.absoluteX2); + } + + + /** + * Set the value of absoluteY1 + */ + public void setAbsoluteY1(boolean absoluteY1) { + Boolean oldAbsoluteY1 = this.absoluteY1; + this.absoluteY1 = absoluteY1; + firePropertyChange(RenderConstants.absoluteY1, oldAbsoluteY1, this.absoluteY1); + } + + + /** + * Set the value of absoluteY2 + */ + public void setAbsoluteY2(boolean absoluteY2) { + Boolean oldAbsoluteY2 = this.absoluteY2; + this.absoluteY2 = absoluteY2; + firePropertyChange(RenderConstants.absoluteY2, oldAbsoluteY2, this.absoluteY2); + } + + + /** + * Set the value of absoluteZ1 + */ + public void setAbsoluteZ1(boolean absoluteZ1) { + Boolean oldAbsoluteZ1 = this.absoluteZ1; + this.absoluteZ1 = absoluteZ1; + firePropertyChange(RenderConstants.absoluteZ1, oldAbsoluteZ1, this.absoluteZ1); + } + + + /** + * Set the value of absoluteZ2 + */ + public void setAbsoluteZ2(boolean absoluteZ2) { + Boolean oldAbsoluteZ2 = this.absoluteZ2; + this.absoluteZ2 = absoluteZ2; + firePropertyChange(RenderConstants.absoluteZ2, oldAbsoluteZ2, this.absoluteZ2); + } + + + /** + * Set the value of x1 + */ + public void setX1(Double x1) { + Double oldX1 = this.x1; + this.x1 = x1; + firePropertyChange(RenderConstants.x1, oldX1, this.x1); + } + + + /** + * Set the value of x2 + */ + public void setX2(Double x2) { + Double oldX2 = this.x2; + this.x2 = x2; + firePropertyChange(RenderConstants.x2, oldX2, this.x2); + } + + + /** + * Set the value of y1 + */ + public void setY1(Double y1) { + Double oldY1 = this.y1; + this.y1 = y1; + firePropertyChange(RenderConstants.y1, oldY1, this.y1); + } + + + /** + * Set the value of y2 + */ + public void setY2(Double y2) { + Double oldY2 = this.y2; + this.y2 = y2; + firePropertyChange(RenderConstants.y2, oldY2, this.y2); + } + + + /** + * Set the value of z1 + */ + public void setZ1(Double z1) { + Double oldZ1 = this.z1; + this.z1 = z1; + firePropertyChange(RenderConstants.z1, oldZ1, this.z1); + } + + + /** + * Set the value of z2 + */ + public void setZ2(Double z2) { + Double oldZ2 = this.z2; + this.z2 = z2; + firePropertyChange(RenderConstants.z2, oldZ2, this.z2); + } + + + /** + * Unsets the variable absoluteX1 + * @return <code>true</code>, if absoluteX1 was set before, + * otherwise <code>false</code> + */ + public boolean unsetAbsoluteX1() { + if (isSetAbsoluteX1()) { + Boolean oldAbsoluteX1 = this.absoluteX1; + this.absoluteX1 = null; + firePropertyChange(RenderConstants.absoluteX1, oldAbsoluteX1, this.absoluteX1); + return true; + } + return false; + } + + + /** + * Unsets the variable absoluteX2 + * @return <code>true</code>, if absoluteX2 was set before, + * otherwise <code>false</code> + */ + public boolean unsetAbsoluteX2() { + if (isSetAbsoluteX2()) { + Boolean oldAbsoluteX2 = this.absoluteX2; + this.absoluteX2 = null; + firePropertyChange(RenderConstants.absoluteX2, oldAbsoluteX2, this.absoluteX2); + return true; + } + return false; + } + + + /** + * Unsets the variable absoluteY1 + * @return <code>true</code>, if absoluteY1 was set before, + * otherwise <code>false</code> + */ + public boolean unsetAbsoluteY1() { + if (isSetAbsoluteY1()) { + Boolean oldAbsoluteY1 = this.absoluteY1; + this.absoluteY1 = null; + firePropertyChange(RenderConstants.absoluteY1, oldAbsoluteY1, this.absoluteY1); + return true; + } + return false; + } + + + /** + * Unsets the variable absoluteY2 + * @return <code>true</code>, if absoluteY2 was set before, + * otherwise <code>false</code> + */ + public boolean unsetAbsoluteY2() { + if (isSetAbsoluteY2()) { + Boolean oldAbsoluteY2 = this.absoluteY2; + this.absoluteY2 = null; + firePropertyChange(RenderConstants.absoluteY2, oldAbsoluteY2, this.absoluteY2); + return true; + } + return false; + } + + + /** + * Unsets the variable absoluteZ1 + * @return <code>true</code>, if absoluteZ1 was set before, + * otherwise <code>false</code> + */ + public boolean unsetAbsoluteZ1() { + if (isSetAbsoluteZ1()) { + Boolean oldAbsoluteZ1 = this.absoluteZ1; + this.absoluteZ1 = null; + firePropertyChange(RenderConstants.absoluteZ1, oldAbsoluteZ1, this.absoluteZ1); + return true; + } + return false; + } + + + /** + * Unsets the variable absoluteZ2 + * @return <code>true</code>, if absoluteZ2 was set before, + * otherwise <code>false</code> + */ + public boolean unsetAbsoluteZ2() { + if (isSetAbsoluteZ2()) { + Boolean oldAbsoluteZ2 = this.absoluteZ2; + this.absoluteZ2 = null; + firePropertyChange(RenderConstants.absoluteZ2, oldAbsoluteZ2, this.absoluteZ2); + return true; + } + return false; + } + + + /** + * Unsets the variable x1 + * @return <code>true</code>, if x1 was set before, + * otherwise <code>false</code> + */ + public boolean unsetX1() { + if (isSetX1()) { + Double oldX1 = this.x1; + this.x1 = null; + firePropertyChange(RenderConstants.x1, oldX1, this.x1); + return true; + } + return false; + } + + + /** + * Unsets the variable x2 + * @return <code>true</code>, if x2 was set before, + * otherwise <code>false</code> + */ + public boolean unsetX2() { + if (isSetX2()) { + Double oldX2 = this.x2; + this.x2 = null; + firePropertyChange(RenderConstants.x2, oldX2, this.x2); + return true; + } + return false; + } + + + /** + * Unsets the variable y1 + * @return <code>true</code>, if y1 was set before, + * otherwise <code>false</code> + */ + public boolean unsetY1() { + if (isSetY1()) { + Double oldY1 = this.y1; + this.y1 = null; + firePropertyChange(RenderConstants.y1, oldY1, this.y1); + return true; + } + return false; + } + + + /** + * Unsets the variable y2 + * @return <code>true</code>, if y2 was set before, + * otherwise <code>false</code> + */ + public boolean unsetY2() { + if (isSetY2()) { + Double oldY2 = this.y2; + this.y2 = null; + firePropertyChange(RenderConstants.y2, oldY2, this.y2); + return true; + } + return false; + } + + + /** + * Unsets the variable z1 + * @return <code>true</code>, if z1 was set before, + * otherwise <code>false</code> + */ + public boolean unsetZ1() { + if (isSetZ1()) { + Double oldZ1 = this.z1; + this.z1 = null; + firePropertyChange(RenderConstants.z1, oldZ1, this.z1); + return true; + } + return false; + } + + + /** + * Unsets the variable z2 + * @return <code>true</code>, if z2 was set before, + * otherwise <code>false</code> + */ + public boolean unsetZ2() { + if (isSetZ2()) { + Double oldZ2 = this.z2; + this.z2 = null; + firePropertyChange(RenderConstants.z2, oldZ2, this.z2); + return true; + } + return false; + } } Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderPoint.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderPoint.java 2012-05-20 14:30:42 UTC (rev 1267) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderPoint.java 2012-05-22 19:08:41 UTC (rev 1268) @@ -20,7 +20,11 @@ */ package org.sbml.jsbml.ext.render; +import java.text.MessageFormat; + import org.sbml.jsbml.AbstractSBase; +import org.sbml.jsbml.PropertyUndefinedError; +import org.sbml.jsbml.SBase; /** @@ -32,17 +36,330 @@ * @since 1.0 * @date 08.05.2012 */ -public class RenderPoint extends AbstractSBase { +public class RenderPoint extends AbstractSBase implements Point3D { + public static final int MIN_SBML_LEVEL = 3; + public static final int MIN_SBML_VERSION = 1; + /** + * + */ + private static final long serialVersionUID = 6792387139122188270L; + + private Boolean absoluteX, absoluteY, absoluteZ; + private Double x, y, z; - private Boolean absoluteX, absoluteY, absoluteZ; - - public AbstractSBase clone() { + + /** + * Creates an RenderPoint instance + */ + public RenderPoint() { + super(); + initDefaults(); + } + + /** + * Clone constructor + */ + public RenderPoint(RenderPoint obj) { + super(obj); + // TODO: copy all class attributes, e.g.: + // bar = obj.bar; + } + + + public AbstractSBase clone() { // TODO Auto-generated method stub return null; } - public String toString() { + + @Override + public boolean getAllowsChildren() { + return false; + } + + + @Override + public SBase getChildAt(int childIndex) { + if (childIndex < 0) { + throw new IndexOutOfBoundsException(childIndex + " < 0"); + } + int pos = 0; + throw new IndexOutOfBoundsException(MessageFormat.format( + "Index {0,number,integer} >= {1,number,integer}", childIndex, + +((int) Math.min(pos, 0)))); + } + + @Override + public int getChildCount() { + return 0; + } + + + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.render.RenderPoint#getX() + */ + public double getX() { + if (isSetX()) { + return x; + } + // This is necessary if we cannot return null here. + throw new PropertyUndefinedError(RenderConstants.x, this); + } + + + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.render.RenderPoint#getY() + */ + public double getY() { + if (isSetY()) { + return y; + } + // This is necessary if we cannot return null here. + throw new PropertyUndefinedError(RenderConstants.y, this); + } + + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.render.RenderPoint#getZ() + */ + public double getZ() { + if (isSetZ()) { + return z; + } + // This is necessary if we cannot return null here. + throw new PropertyUndefinedError(RenderConstants.z, this); + } + + /** + * Initializes the default values using the namespace. + */ + public void initDefaults() { + addNamespace(RenderConstants.namespaceURI); + z = 0d; + } + + + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.render.RenderPoint#isAbsoluteX() + */ + public boolean isAbsoluteX() { + if (isSetAbsoluteX()) { + return absoluteX; + } + // This is necessary if we cannot return null here. + throw new PropertyUndefinedError(RenderConstants.absoluteX, this); + } + + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.render.RenderPoint#isAbsoluteY() + */ + public boolean isAbsoluteY() { + if (isSetAbsoluteY()) { + return absoluteY; + } + // This is necessary if we cannot return null here. + throw new PropertyUndefinedError(RenderConstants.absoluteY, this); + } + + + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.render.RenderPoint#isAbsoluteZ() + */ + public boolean isAbsoluteZ() { + if (isSetAbsoluteZ()) { + return absoluteZ; + } + // This is necessary if we cannot return null here. + throw new PropertyUndefinedError(RenderConstants.absoluteZ, this); + } + + + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.render.RenderPoint#isSetAbsoluteX() + */ + public boolean isSetAbsoluteX() { + return this.absoluteX != null; + } + + + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.render.RenderPoint#isSetAbsoluteY() + */ + public boolean isSetAbsoluteY() { + return this.absoluteY != null; + } + + + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.render.RenderPoint#isSetAbsoluteZ() + */ + public boolean isSetAbsoluteZ() { + return this.absoluteZ != null; + } + + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.render.RenderPoint#isSetX() + */ + public boolean isSetX() { + return this.x != null; + } + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.render.RenderPoint#isSetY() + */ + public boolean isSetY() { + return this.y != null; + } + + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.render.RenderPoint#isSetZ() + */ + public boolean isSetZ() { + return this.z != null; + } + + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.render.RenderPoint#setAbsoluteX(java.lang.Boolean) + */ + public void setAbsoluteX(Boolean absoluteX) { + Boolean oldAbsoluteX = this.absoluteX; + this.absoluteX = absoluteX; + firePropertyChange(RenderConstants.absoluteX, oldAbsoluteX, this.absoluteX); + } + + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.render.RenderPoint#setAbsoluteY(java.lang.Boolean) + */ + public void setAbsoluteY(Boolean absoluteY) { + Boolean oldAbsoluteY = this.absoluteY; + this.absoluteY = absoluteY; + firePropertyChange(RenderConstants.absoluteY, oldAbsoluteY, this.absoluteY); + } + + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.render.RenderPoint#setAbsoluteZ(java.lang.Boolean) + */ + public void setAbsoluteZ(Boolean absoluteZ) { + Boolean oldAbsoluteZ = this.absoluteZ; + this.absoluteZ = absoluteZ; + firePropertyChange(RenderConstants.absoluteZ, oldAbsoluteZ, this.absoluteZ); + } + + + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.render.RenderPoint#setX(java.lang.Double) + */ + public void setX(Double x) { + Double oldX = this.x; + this.x = x; + firePropertyChange(RenderConstants.x, oldX, this.x); + } + + + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.render.RenderPoint#setY(java.lang.Double) + */ + public void setY(Double y) { + Double oldY = this.y; + this.y = y; + firePropertyChange(RenderConstants.y, oldY, this.y); + } + + + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.render.RenderPoint#setZ(java.lang.Double) + */ + public void setZ(Double z) { + Double oldZ = this.z; + this.z = z; + firePropertyChange(RenderConstants.z, oldZ, this.z); + } + + + public String toString() { // TODO Auto-generated method stub return null; } + + + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.render.RenderPoint#unsetAbsoluteX() + */ + public boolean unsetAbsoluteX() { + if (isSetAbsoluteX()) { + Boolean oldAbsoluteX = this.absoluteX; + this.absoluteX = null; + firePropertyChange(RenderConstants.absoluteX, oldAbsoluteX, this.absoluteX); + return true; + } + return false; + } + + + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.render.RenderPoint#unsetAbsoluteY() + */ + public boolean unsetAbsoluteY() { + if (isSetAbsoluteY()) { + Boolean oldAbsoluteY = this.absoluteY; + this.absoluteY = null; + firePropertyChange(RenderConstants.absoluteY, oldAbsoluteY, this.absoluteY); + return true; + } + return false; + } + + + + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.render.RenderPoint#unsetAbsoluteZ() + */ + public boolean unsetAbsoluteZ() { + if (isSetAbsoluteZ()) { + Boolean oldAbsoluteZ = this.absoluteZ; + this.absoluteZ = null; + firePropertyChange(RenderConstants.absoluteZ, oldAbsoluteZ, this.absoluteZ); + return true; + } + return false; + } + + + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.render.RenderPoint#unsetX() + */ + public boolean unsetX() { + if (isSetX()) { + Double oldX = this.x; + this.x = null; + firePropertyChange(RenderConstants.x, oldX, this.x); + return true; + } + return false; + } + + + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.render.RenderPoint#unsetY() + */ + public boolean unsetY() { + if (isSetY()) { + Double oldY = this.y; + this.y = null; + firePropertyChange(RenderConstants.y, oldY, this.y); + return true; + } + return false; + } + + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.render.RenderPoint#unsetZ() + */ + public boolean unsetZ() { + if (isSetZ()) { + Double oldZ = this.z; + this.z = null; + firePropertyChange(RenderConstants.z, oldZ, this.z); + return true; + } + return false; + } } Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/Style.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/Style.java 2012-05-20 14:30:42 UTC (rev 1267) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/Style.java 2012-05-22 19:08:41 UTC (rev 1268) @@ -43,7 +43,6 @@ protected String id; - //TODO right List class? setters, getters for List or elements? add, remove for Lists protected List<String> typeList; protected List<String> roleList; protected Group group; Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/Text.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/Text.java 2012-05-20 14:30:42 UTC (rev 1267) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/Text.java 2012-05-22 19:08:41 UTC (rev 1268) @@ -47,30 +47,6 @@ /* (non-Javadoc) - * @see org.sbml.jsbml.ext.render.Point3D#isAbsoluteY() - */ - public boolean isAbsoluteY() { - if (isSetAbsoluteY()) { - return absoluteY; - } - // This is necessary if we cannot return null here. - throw new PropertyUndefinedError(RenderConstants.absoluteY, this); - } - - - /* (non-Javadoc) - * @see org.sbml.jsbml.ext.render.Point3D#isAbsoluteZ() - */ - public boolean isAbsoluteZ() { - if (isSetAbsoluteZ()) { - return absoluteZ; - } - // This is necessary if we cannot return null here. - throw new PropertyUndefinedError(RenderConstants.absoluteZ, this); - } - - - /* (non-Javadoc) * @see org.sbml.jsbml.ext.render.FontRenderStyle#getFontFamily() */ public FontFamily getFontFamily() { @@ -81,6 +57,7 @@ throw new PropertyUndefinedError(RenderConstants.fontFamily, this); } + /* (non-Javadoc) * @see org.sbml.jsbml.ext.render.FontRenderStyle#getFontSize() */ @@ -104,7 +81,6 @@ throw new PropertyUndefinedError(RenderConstants.textAnchor, this); } - /* (non-Javadoc) * @see org.sbml.jsbml.ext.render.FontRenderStyle#getVTextAnchor() */ @@ -116,6 +92,7 @@ throw new PropertyUndefinedError(RenderConstants.vTextAnchor, this); } + /* (non-Javadoc) * @see org.sbml.jsbml.ext.render.Point3D#getX() */ @@ -139,7 +116,6 @@ throw new PropertyUndefinedError(RenderConstants.y, this); } - /* (non-Javadoc) * @see org.sbml.jsbml.ext.render.Point3D#getZ() */ @@ -165,6 +141,30 @@ /* (non-Javadoc) + * @see org.sbml.jsbml.ext.render.Point3D#isAbsoluteY() + */ + public boolean isAbsoluteY() { + if (isSetAbsoluteY()) { + return absoluteY; + } + // This is necessary if we cannot return null here. + throw new PropertyUndefinedError(RenderConstants.absoluteY, this); + } + + + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.render.Point3D#isAbsoluteZ() + */ + public boolean isAbsoluteZ() { + if (isSetAbsoluteZ()) { + return absoluteZ; + } + // This is necessary if we cannot return null here. + throw new PropertyUndefinedError(RenderConstants.absoluteZ, this); + } + + + /* (non-Javadoc) * @see org.sbml.jsbml.ext.render.FontRenderStyle#isFontStyleItalic() */ public boolean isFontStyleItalic() { Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/Transformation.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/Transformation.java 2012-05-20 14:30:42 UTC (rev 1267) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/Transformation.java 2012-05-22 19:08:41 UTC (rev 1268) @@ -33,14 +33,23 @@ * @date 08.05.2012 */ public class Transformation extends AbstractSBase { - protected Double[] transform; //initialize with size 12 - public AbstractSBase clone() { - // TODO Auto-generated method stub - return null; - } + protected Double[] transform = new Double[12]; - public String toString() { - // TODO Auto-generated method stub - return null; - } + /* (non-Javadoc) + * @see org.sbml.jsbml.AbstractSBase#clone() + */ + @Override + public AbstractSBase clone() { + // TODO Auto-generated method stub + return null; + } + + /* (non-Javadoc) + * @see org.sbml.jsbml.AbstractSBase#toString() + */ + @Override + public String toString() { + // TODO Auto-generated method stub + return null; + } } Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/Transformation2D.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/Transformation2D.java 2012-05-20 14:30:42 UTC (rev 1267) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/Transformation2D.java 2012-05-22 19:08:41 UTC (rev 1268) @@ -31,5 +31,5 @@ * @date 08.05.2012 */ public class Transformation2D extends Transformation { - protected Double[] transform; //use first 6 fields of superclass + protected Double[] transform = new Double[6]; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jak...@us...> - 2012-05-20 14:30:49
|
Revision: 1267 http://jsbml.svn.sourceforge.net/jsbml/?rev=1267&view=rev Author: jakobmatthes Date: 2012-05-20 14:30:42 +0000 (Sun, 20 May 2012) Log Message: ----------- fix some file headers, fix various class fields Modified Paths: -------------- trunk/extensions/render/src/org/sbml/jsbml/ext/render/GraphicalPrimitive1D.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/Image.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/Rectangle.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderConstants.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderCubicBezier.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderPoint.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/TextAnchor.java Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/GraphicalPrimitive1D.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/GraphicalPrimitive1D.java 2012-05-18 08:56:03 UTC (rev 1266) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/GraphicalPrimitive1D.java 2012-05-20 14:30:42 UTC (rev 1267) @@ -20,7 +20,7 @@ */ package org.sbml.jsbml.ext.render; -import java.util.ArrayList; +import java.util.List; /** @@ -35,6 +35,6 @@ public class GraphicalPrimitive1D extends Transformation2D { protected ColorDefinition stroke; protected Integer strokeWidth; - protected ArrayList<Integer> strokeDashArray; + protected List<Integer> strokeDashArray; } Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/Image.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/Image.java 2012-05-18 08:56:03 UTC (rev 1266) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/Image.java 2012-05-20 14:30:42 UTC (rev 1267) @@ -31,7 +31,9 @@ * @date 08.05.2012 */ public class Image extends Transformation2D { - protected Double x, y, z, width, height; - protected Boolean positionAbsolute, sizeAbsolute; // FIXME booleans for rel or abs - protected String href; + private Double x, y, z; + private Double width, height; + private Boolean absoluteX, absoluteY, absoluteZ; + private Boolean absoluteWidth, absoluteHeight; + private String href; } Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/Rectangle.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/Rectangle.java 2012-05-18 08:56:03 UTC (rev 1266) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/Rectangle.java 2012-05-20 14:30:42 UTC (rev 1267) @@ -31,6 +31,10 @@ * @date 08.05.2012 */ public class Rectangle extends GraphicalPrimitive2D { - private Double x, y, z, width, height, rx, ry; - private Boolean sizeAbsolute; //FIXME more booleans needed + private Double x, y, z; + private Double width, height; + private Boolean absoluteX, absoluteY, absoluteZ; + private Boolean absoluteWidth, absoluteHeight; + private Double rx, ry; + private Boolean absoluteRx, absoluteRy; } Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderConstants.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderConstants.java 2012-05-18 08:56:03 UTC (rev 1266) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderConstants.java 2012-05-20 14:30:42 UTC (rev 1267) @@ -1,5 +1,35 @@ +/* + * $Id$ + * $URL$ + * + * ---------------------------------------------------------------------------- + * This file is part of JSBML. Please visit <http://sbml.org/Software/JSBML> + * for the latest version of JSBML and more information about SBML. + * + * Copyright (C) 2009-2012 jointly by the following organizations: + * 1. The University of Tuebingen, Germany + * 2. EMBL European Bioinformatics Institute (EBML-EBI), Hinxton, UK + * 3. The California Institute of Technology, Pasadena, CA, USA + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation. A copy of the license agreement is provided + * in the file named "LICENSE.txt" included with this software distribution + * and also available online as <http://sbml.org/Software/JSBML/License>. + * ---------------------------------------------------------------------------- + */ package org.sbml.jsbml.ext.render; + +/** + * @author Eugen Netz + * @author Alexander Diamantikos + * @author Jakob Matthes + * @author Jan Rudolph + * @version $Rev$ + * @since 1.0 + * @date 08.05.2012 + */ public interface RenderConstants { public static final String namespaceURI = "http://www.sbml.org/sbml/level3/version1/render/version1"; Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderCubicBezier.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderCubicBezier.java 2012-05-18 08:56:03 UTC (rev 1266) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderCubicBezier.java 2012-05-20 14:30:42 UTC (rev 1267) @@ -31,7 +31,8 @@ * @date 08.05.2012 */ public class RenderCubicBezier extends RenderPoint { - private Double x1, y1, z1, x2, y2, z2; - // abs or relative - + private Double x1, y1, z1; + private Double x2, y2, z2; + private Boolean absoluteX1, absoluteY1, absoluteZ1; + private Boolean absoluteX2, absoluteY2, absoluteZ2; } Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderPoint.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderPoint.java 2012-05-18 08:56:03 UTC (rev 1266) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderPoint.java 2012-05-20 14:30:42 UTC (rev 1267) @@ -33,8 +33,8 @@ * @date 08.05.2012 */ public class RenderPoint extends AbstractSBase { - private Double x, y, z; - // booleans abs or relative + private Double x, y, z; + private Boolean absoluteX, absoluteY, absoluteZ; public AbstractSBase clone() { // TODO Auto-generated method stub Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/TextAnchor.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/TextAnchor.java 2012-05-18 08:56:03 UTC (rev 1266) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/TextAnchor.java 2012-05-20 14:30:42 UTC (rev 1267) @@ -22,7 +22,10 @@ /** + * @author Eugen Netz + * @author Alexander Diamantikos * @author Jakob Matthes + * @author Jan Rudolph * @version $Rev$ * @since 1.0 * @date 16.05.2012 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jak...@us...> - 2012-05-18 08:56:15
|
Revision: 1266 http://jsbml.svn.sourceforge.net/jsbml/?rev=1266&view=rev Author: jakobmatthes Date: 2012-05-18 08:56:03 +0000 (Fri, 18 May 2012) Log Message: ----------- various TODO markers, implement RenderLayoutPlugin and RenderModelPlugin Modified Paths: -------------- trunk/extensions/render/src/org/sbml/jsbml/ext/render/ColorDefinition.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/Curve.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/Ellipse.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/GlobalRenderInformation.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/GradientBase.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/GradientStop.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/GraphicalPrimitive2D.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/Group.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/Image.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/LineEnding.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/LocalStyle.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/Polygon.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/Rectangle.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderCubicBezier.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderInformationBase.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderPoint.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/Style.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/Text.java Added Paths: ----------- trunk/extensions/render/src/org/sbml/jsbml/ext/render/AbstractRenderPlugin.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/FontFamily.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/FontRenderStyle.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/Point3D.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderConstants.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderLayoutPlugin.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderModelPlugin.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/TextAnchor.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/VTextAnchor.java Removed Paths: ------------- trunk/extensions/render/src/org/sbml/jsbml/ext/render/GlobalStyle.java Property Changed: ---------------- trunk/extensions/render/src/org/sbml/jsbml/ext/render/ColorDefinition.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/Curve.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/Ellipse.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/ExtendedRenderModel.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/GlobalRenderInformation.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/GradientBase.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/GradientStop.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/GraphicalPrimitive1D.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/GraphicalPrimitive2D.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/Group.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/Image.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/LineEnding.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/LinearGradient.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/LocalRenderInformation.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/LocalStyle.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/Polygon.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/RadialGradient.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/Rectangle.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderCubicBezier.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderInformationBase.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderPoint.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/Style.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/Text.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/Transformation.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/Transformation2D.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/package.html Added: trunk/extensions/render/src/org/sbml/jsbml/ext/render/AbstractRenderPlugin.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/AbstractRenderPlugin.java (rev 0) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/AbstractRenderPlugin.java 2012-05-18 08:56:03 UTC (rev 1266) @@ -0,0 +1,140 @@ +/* + * $Id$ + * $URL$ + * + * ---------------------------------------------------------------------------- + * This file is part of JSBML. Please visit <http://sbml.org/Software/JSBML> + * for the latest version of JSBML and more information about SBML. + * + * Copyright (C) 2009-2012 jointly by the following organizations: + * 1. The University of Tuebingen, Germany + * 2. EMBL European Bioinformatics Institute (EBML-EBI), Hinxton, UK + * 3. The California Institute of Technology, Pasadena, CA, USA + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation. A copy of the license agreement is provided + * in the file named "LICENSE.txt" included with this software distribution + * and also available online as <http://sbml.org/Software/JSBML/License>. + * ---------------------------------------------------------------------------- + */ +package org.sbml.jsbml.ext.render; + +import java.util.Map; + +import javax.swing.tree.TreeNode; + +import org.sbml.jsbml.SBase; +import org.sbml.jsbml.ext.AbstractSBasePlugin; +import org.sbml.jsbml.ext.SBasePlugin; + + +/** + * @author Jakob Matthes + * @version $Rev$ + * @since 1.0 + * @date 16.05.2012 + */ +public class AbstractRenderPlugin extends AbstractSBasePlugin { + /** + * + */ + private static final long serialVersionUID = -4225426173177528441L; + Short versionMajor; + Short versionMinor; + GlobalRenderInformation renderInformation; + + /** + * Creates an AbstractRenderPlugin instance + */ + public AbstractRenderPlugin() { + super(); + initDefaults(); + } + + public AbstractRenderPlugin(SBase extendedElement) { + super(extendedElement); + initDefaults(); + } + + /** + * Clone constructor + */ + public AbstractRenderPlugin(AbstractRenderPlugin obj) { + super(); + // TODO: copy all class attributes, e.g.: + // bar = obj.bar; + } + + + /** + * Initializes the default values using the namespace. + */ + public void initDefaults() { +// addNamespace(RenderConstants.namespaceURI); + // TODO: init default values here if necessary, e.g.: + // bar = null; + } + + public static final int MIN_SBML_LEVEL = 3; + public static final int MIN_SBML_VERSION = 1; + + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.SBasePlugin#readAttribute(java.lang.String, java.lang.String, java.lang.String) + */ + @Override + public boolean readAttribute(String attributeName, String prefix, String value) { + // TODO Auto-generated method stub + return false; + } + + + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.SBasePlugin#getChildAt(int) + */ + @Override + public TreeNode getChildAt(int childIndex) { + // TODO Auto-generated method stub + return null; + } + + + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.SBasePlugin#getChildCount() + */ + @Override + public int getChildCount() { + // TODO Auto-generated method stub + return 0; + } + + + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.SBasePlugin#getAllowsChildren() + */ + @Override + public boolean getAllowsChildren() { + // TODO Auto-generated method stub + return false; + } + + + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.SBasePlugin#writeXMLAttributes() + */ + @Override + public Map<String, String> writeXMLAttributes() { + // TODO Auto-generated method stub + return null; + } + + + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.AbstractSBasePlugin#clone() + */ + @Override + public SBasePlugin clone() { + // TODO Auto-generated method stub + return null; + } +} Property changes on: trunk/extensions/render/src/org/sbml/jsbml/ext/render/AbstractRenderPlugin.java ___________________________________________________________________ Added: svn:keywords + Id Rev URL Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/ColorDefinition.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/ColorDefinition.java 2012-05-16 16:07:50 UTC (rev 1265) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/ColorDefinition.java 2012-05-18 08:56:03 UTC (rev 1266) @@ -20,6 +20,8 @@ */ package org.sbml.jsbml.ext.render; +import java.awt.Color; + import org.sbml.jsbml.AbstractSBase; import org.sbml.jsbml.LevelVersionError; @@ -40,8 +42,8 @@ */ private static final long serialVersionUID = 8904459123022343452L; - String id; - Integer value; + private String id; + private Color value; /** @@ -50,7 +52,7 @@ * @param id * @param value */ - public ColorDefinition(String id, int value) { + public ColorDefinition(String id, Color value) { this.id = id; this.value = value; } @@ -64,7 +66,7 @@ * @param level * @param version */ - public ColorDefinition(String id, int value, int level, int version) { + public ColorDefinition(String id, Color value, int level, int version) { super(level, version); if (getLevelAndVersion().compareTo(Integer.valueOf(MIN_SBML_LEVEL), Integer.valueOf(MIN_SBML_VERSION)) < 0) { @@ -115,9 +117,9 @@ /** * @return the value of value */ - public Integer getValue() { + public Color getValue() { if (isSetValue()) { - int val = value; + Color val = value; return val; } else { return null; @@ -136,7 +138,7 @@ /** * Set the value of value */ - public void setValue(int value) { + public void setValue(Color value) { //Integer oldValue = this.value; this.value = value; //TODO Property changes on: trunk/extensions/render/src/org/sbml/jsbml/ext/render/ColorDefinition.java ___________________________________________________________________ Modified: svn:keywords - Rev Id URL + Id Rev URL Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/Curve.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/Curve.java 2012-05-16 16:07:50 UTC (rev 1265) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/Curve.java 2012-05-18 08:56:03 UTC (rev 1266) @@ -20,7 +20,7 @@ */ package org.sbml.jsbml.ext.render; -import java.util.ArrayList; +import org.sbml.jsbml.ListOf; /** @@ -33,9 +33,9 @@ * @date 08.05.2012 */ public class Curve extends GraphicalPrimitive1D { - protected LineEnding startHead; - protected LineEnding endHead; + protected String startHead; + protected String endHead; // FIXME sollte auch für RenderCubicBezier funktionieren - protected ArrayList<RenderPoint> listOfElements; + protected ListOf<RenderPoint> listOfElements; } Property changes on: trunk/extensions/render/src/org/sbml/jsbml/ext/render/Curve.java ___________________________________________________________________ Modified: svn:keywords - Rev Id URL + Id Rev URL Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/Ellipse.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/Ellipse.java 2012-05-16 16:07:50 UTC (rev 1265) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/Ellipse.java 2012-05-18 08:56:03 UTC (rev 1266) @@ -31,5 +31,6 @@ * @date 08.05.2012 */ public class Ellipse extends GraphicalPrimitive2D { - protected Integer cx, cy, cz, rx, ry; + protected Double cx, cy, cz, rx, ry; + //FIXME absolute booleans } Property changes on: trunk/extensions/render/src/org/sbml/jsbml/ext/render/Ellipse.java ___________________________________________________________________ Modified: svn:keywords - Rev Id URL + Id Rev URL Property changes on: trunk/extensions/render/src/org/sbml/jsbml/ext/render/ExtendedRenderModel.java ___________________________________________________________________ Modified: svn:keywords - Rev Id URL + Id Rev URL Added: trunk/extensions/render/src/org/sbml/jsbml/ext/render/FontFamily.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/FontFamily.java (rev 0) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/FontFamily.java 2012-05-18 08:56:03 UTC (rev 1266) @@ -0,0 +1,34 @@ +/* + * $Id: FontFamily.java 16:25:26 jakob $ + * $URL: FontFamily.java $ + * + * ---------------------------------------------------------------------------- + * This file is part of JSBML. Please visit <http://sbml.org/Software/JSBML> + * for the latest version of JSBML and more information about SBML. + * + * Copyright (C) 2009-2012 jointly by the following organizations: + * 1. The University of Tuebingen, Germany + * 2. EMBL European Bioinformatics Institute (EBML-EBI), Hinxton, UK + * 3. The California Institute of Technology, Pasadena, CA, USA + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation. A copy of the license agreement is provided + * in the file named "LICENSE.txt" included with this software distribution + * and also available online as <http://sbml.org/Software/JSBML/License>. + * ---------------------------------------------------------------------------- + */ +package org.sbml.jsbml.ext.render; + + +/** + * @author Jakob Matthes + * @version $Rev$ + * @since 1.0 + * @date 16.05.2012 + */ +public enum FontFamily { + serif, + sans_serif, + monospace, +} Added: trunk/extensions/render/src/org/sbml/jsbml/ext/render/FontRenderStyle.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/FontRenderStyle.java (rev 0) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/FontRenderStyle.java 2012-05-18 08:56:03 UTC (rev 1266) @@ -0,0 +1,185 @@ +/* + * $Id: FontRenderStyle.java 16:51:02 jakob $ + * $URL: FontRenderStyle.java $ + * ---------------------------------------------------------------------------- + * This file is part of JSBML. Please visit <http://sbml.org/Software/JSBML> + * for the latest version of JSBML and more information about SBML. + * Copyright (C) 2009-2012 jointly by the following organizations: + * 1. The University of Tuebingen, Germany + * 2. EMBL European Bioinformatics Institute (EBML-EBI), Hinxton, UK + * 3. The California Institute of Technology, Pasadena, CA, USA + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation. A copy of the license agreement is provided + * in the file named "LICENSE.txt" included with this software distribution + * and also available online as <http://sbml.org/Software/JSBML/License>. + * ---------------------------------------------------------------------------- + */ +package org.sbml.jsbml.ext.render; + +/** + * @author Alexander Diamantikos + * @author Jakob Matthes + * @author Eugen Netz + * @author Jan Rudolph + * @version $Rev$ + * @since 1.0 + * @date 16.05.2012 + */ +public interface FontRenderStyle { + + /** + * @return the value of fontFamily + */ + public abstract FontFamily getFontFamily(); + + + /** + * @return whether fontFamily is set + */ + public abstract boolean isSetFontFamily(); + + + /** + * Set the value of fontFamily + */ + public abstract void setFontFamily(FontFamily fontFamily); + + + /** + * Unsets the variable fontFamily + * @return <code>true</code>, if fontFamily was set before, + * otherwise <code>false</code> + */ + public abstract boolean unsetFontFamily(); + + + /** + * @return the value of fontSize + */ + public abstract short getFontSize(); + + + /** + * @return whether fontSize is set + */ + public abstract boolean isSetFontSize(); + + + /** + * Set the value of fontSize + */ + public abstract void setFontSize(short fontSize); + + + /** + * Unsets the variable fontSize + * @return <code>true</code>, if fontSize was set before, + * otherwise <code>false</code> + */ + public abstract boolean unsetFontSize(); + + + /** + * @return the value of fontWeightBold + */ + public abstract boolean isFontWeightBold(); + + + /** + * @return whether fontWeightBold is set + */ + public abstract boolean isSetFontWeightBold(); + + + /** + * Set the value of fontWeightBold + */ + public abstract void setFontWeightBold(boolean fontWeightBold); + + + /** + * Unsets the variable fontWeightBold + * @return <code>true</code>, if fontWeightBold was set before, + * otherwise <code>false</code> + */ + public abstract boolean unsetFontWeightBold(); + + + /** + * @return the value of fontStyleItalic + */ + public abstract boolean isFontStyleItalic(); + + + /** + * @return whether fontStyleItalic is set + */ + public abstract boolean isSetFontStyleItalic(); + + + /** + * Set the value of fontStyleItalic + */ + public abstract void setFontStyleItalic(boolean fontStyleItalic); + + + /** + * Unsets the variable fontStyleItalic + * @return <code>true</code>, if fontStyleItalic was set before, + * otherwise <code>false</code> + */ + public abstract boolean unsetFontStyleItalic(); + + + /** + * @return the value of textAnchor + */ + public abstract TextAnchor getTextAnchor(); + + + /** + * @return whether textAnchor is set + */ + public abstract boolean isSetTextAnchor(); + + + /** + * Set the value of textAnchor + */ + public abstract void setTextAnchor(TextAnchor textAnchor); + + + /** + * Unsets the variable textAnchor + * @return <code>true</code>, if textAnchor was set before, + * otherwise <code>false</code> + */ + public abstract boolean unsetTextAnchor(); + + + /** + * @return the value of VTextAnchor + */ + public abstract VTextAnchor getVTextAnchor(); + + + /** + * @return whether VTextAnchor is set + */ + public abstract boolean isSetVTextAnchor(); + + + /** + * Set the value of VTextAnchor + */ + public abstract void setVTextAnchor(VTextAnchor vTextAnchor); + + + /** + * Unsets the variable VTextAnchor + * @return <code>true</code>, if VTextAnchor was set before, + * otherwise <code>false</code> + */ + public abstract boolean unsetVTextAnchor(); +} Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/GlobalRenderInformation.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/GlobalRenderInformation.java 2012-05-16 16:07:50 UTC (rev 1265) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/GlobalRenderInformation.java 2012-05-18 08:56:03 UTC (rev 1266) @@ -20,6 +20,7 @@ */ package org.sbml.jsbml.ext.render; +import org.sbml.jsbml.LevelVersionError; import org.sbml.jsbml.ListOf; @@ -34,8 +35,99 @@ */ public class GlobalRenderInformation extends RenderInformationBase { /** + * Creates an GlobalRenderInformation instance + */ + public GlobalRenderInformation() { + super(); + initDefaults(); + } + + + /** + * Creates a GlobalRenderInformation instance with an id. * + * @param id */ + public GlobalRenderInformation(String id) { + super(id); + initDefaults(); + } + + + /** + * Creates a GlobalRenderInformation instance with a level and version. + * + * @param level + * @param version + */ + public GlobalRenderInformation(int level, int version) { + this(null, null, level, version); + } + + + /** + * Creates a GlobalRenderInformation instance with an id, level, and version. + * + * @param id + * @param level + * @param version + */ + public GlobalRenderInformation(String id, int level, int version) { + this(id, null, level, version); + } + + + /** + * Creates a GlobalRenderInformation instance with an id, name, level, and version. + * + * @param id + * @param name + * @param level + * @param version + */ + public GlobalRenderInformation(String id, String name, int level, int version) { + super(id, name, level, version); + if (getLevelAndVersion().compareTo(Integer.valueOf(MIN_SBML_LEVEL), + Integer.valueOf(MIN_SBML_VERSION)) < 0) { + throw new LevelVersionError(getElementName(), level, version); + } + initDefaults(); + } + + + /** + * Clone constructor + */ + public GlobalRenderInformation(GlobalRenderInformation obj) { + super(obj); + // TODO: copy all class attributes, e.g.: + // bar = obj.bar; + } + + + /** + * clones this class + */ + public GlobalRenderInformation clone() { + return new GlobalRenderInformation(this); + } + + + /** + * Initializes the default values using the namespace. + */ + public void initDefaults() { + addNamespace(RenderConstants.namespaceURI); + // TODO: init default values here if necessary, e.g.: + // bar = null; + } + + public static final int MIN_SBML_LEVEL = 3; + public static final int MIN_SBML_VERSION = 1; + + /** + * + */ private static final long serialVersionUID = 855680727119080659L; //TODO The same as LocalRenderInformation, but with class GlobalStyle Property changes on: trunk/extensions/render/src/org/sbml/jsbml/ext/render/GlobalRenderInformation.java ___________________________________________________________________ Modified: svn:keywords - Rev Id URL + Id Rev URL Deleted: trunk/extensions/render/src/org/sbml/jsbml/ext/render/GlobalStyle.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/GlobalStyle.java 2012-05-16 16:07:50 UTC (rev 1265) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/GlobalStyle.java 2012-05-18 08:56:03 UTC (rev 1266) @@ -1,33 +0,0 @@ -/* - * $Id$ - * $URL$ - * - * ---------------------------------------------------------------------------- - * This file is part of JSBML. Please visit <http://sbml.org/Software/JSBML> - * for the latest version of JSBML and more information about SBML. - * - * Copyright (C) 2009-2012 jointly by the following organizations: - * 1. The University of Tuebingen, Germany - * 2. EMBL European Bioinformatics Institute (EBML-EBI), Hinxton, UK - * 3. The California Institute of Technology, Pasadena, CA, USA - * - * This library is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation. A copy of the license agreement is provided - * in the file named "LICENSE.txt" included with this software distribution - * and also available online as <http://sbml.org/Software/JSBML/License>. - * ---------------------------------------------------------------------------- - */ -package org.sbml.jsbml.ext.render; - - - -/** - * @author ??? - * @version $Rev$ - * @since 1.0 - * @date 14.05.2012 - */ -public class GlobalStyle extends Style { - - } Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/GradientBase.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/GradientBase.java 2012-05-16 16:07:50 UTC (rev 1265) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/GradientBase.java 2012-05-18 08:56:03 UTC (rev 1266) @@ -20,6 +20,8 @@ */ package org.sbml.jsbml.ext.render; +import java.util.List; + import org.sbml.jsbml.AbstractSBase; import org.sbml.jsbml.LevelVersionError; import org.sbml.jsbml.ListOf; @@ -43,14 +45,14 @@ protected enum Spread { - PAD, - REFLECT, - REPEAT, + pad, + reflect, + repeat, } protected String id; protected Spread spreadMethod; - protected ListOf<GradientStop> listOfGradientStops; + protected List<GradientStop> listOfGradientStops; /** * Creates an GradientBase instance Property changes on: trunk/extensions/render/src/org/sbml/jsbml/ext/render/GradientBase.java ___________________________________________________________________ Modified: svn:keywords - Rev Id URL + Id Rev URL Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/GradientStop.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/GradientStop.java 2012-05-16 16:07:50 UTC (rev 1265) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/GradientStop.java 2012-05-18 08:56:03 UTC (rev 1266) @@ -39,8 +39,8 @@ */ private static final long serialVersionUID = 7400974339251884133L; - private int offset; - private ColorDefinition stopColor; + private Double offset; + private ColorDefinition stopColor; /** @@ -49,7 +49,7 @@ * @param offset * @param color */ - public GradientStop(int offset, ColorDefinition stopColor) { + public GradientStop(Double offset, ColorDefinition stopColor) { this.offset = offset; this.stopColor = stopColor; } @@ -63,7 +63,7 @@ * @param level * @param version */ - public GradientStop(int offset, ColorDefinition stopColor, int level, int version) { + public GradientStop(Double offset, ColorDefinition stopColor, int level, int version) { super(level, version); if (getLevelAndVersion().compareTo(Integer.valueOf(MIN_SBML_LEVEL), Integer.valueOf(MIN_SBML_VERSION)) < 0) { @@ -95,7 +95,7 @@ /** * @return the value of offset */ - public int getOffset() { + public Double getOffset() { return offset; } @@ -103,7 +103,7 @@ /** * Set the value of offset */ - public void setOffset(int offset) { + public void setOffset(Double offset) { //int oldOffset = this.offset; this.offset = offset; //TODO Property changes on: trunk/extensions/render/src/org/sbml/jsbml/ext/render/GradientStop.java ___________________________________________________________________ Modified: svn:keywords - Rev Id URL + Id Rev URL Property changes on: trunk/extensions/render/src/org/sbml/jsbml/ext/render/GraphicalPrimitive1D.java ___________________________________________________________________ Modified: svn:keywords - Rev Id URL + Id Rev URL Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/GraphicalPrimitive2D.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/GraphicalPrimitive2D.java 2012-05-16 16:07:50 UTC (rev 1265) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/GraphicalPrimitive2D.java 2012-05-18 08:56:03 UTC (rev 1266) @@ -31,11 +31,10 @@ * @date 08.05.2012 */ public class GraphicalPrimitive2D extends GraphicalPrimitive1D { - //FIXME sollte auch gradient unterstützen - protected ColorDefinition fill; + protected String fill; protected enum FillRule { - NONZERO, - EVENODD, + nonzero, + evenodd, } protected FillRule fillRule; } Property changes on: trunk/extensions/render/src/org/sbml/jsbml/ext/render/GraphicalPrimitive2D.java ___________________________________________________________________ Modified: svn:keywords - Rev Id URL + Id Rev URL Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/Group.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/Group.java 2012-05-16 16:07:50 UTC (rev 1265) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/Group.java 2012-05-18 08:56:03 UTC (rev 1266) @@ -31,8 +31,8 @@ * @date 08.05.2012 */ public class Group extends GraphicalPrimitive2D { - protected Integer iD; - protected Text text; - protected LineEnding startHead; - protected LineEnding endHead; + protected String iD; + protected FontRenderStyle text; //FIXME text hast to many fields (coordinates) + protected String startHead; + protected String endHead; } Property changes on: trunk/extensions/render/src/org/sbml/jsbml/ext/render/Group.java ___________________________________________________________________ Modified: svn:keywords - Rev Id URL + Id Rev URL Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/Image.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/Image.java 2012-05-16 16:07:50 UTC (rev 1265) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/Image.java 2012-05-18 08:56:03 UTC (rev 1266) @@ -31,7 +31,7 @@ * @date 08.05.2012 */ public class Image extends Transformation2D { - protected Integer x, y, z, widht, height; - protected Boolean positionAbsolute, sizeAbsolute; + protected Double x, y, z, width, height; + protected Boolean positionAbsolute, sizeAbsolute; // FIXME booleans for rel or abs protected String href; } Property changes on: trunk/extensions/render/src/org/sbml/jsbml/ext/render/Image.java ___________________________________________________________________ Modified: svn:keywords - Rev Id URL + Id Rev URL Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/LineEnding.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/LineEnding.java 2012-05-16 16:07:50 UTC (rev 1265) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/LineEnding.java 2012-05-18 08:56:03 UTC (rev 1266) @@ -33,7 +33,7 @@ * @date 08.05.2012 */ public class LineEnding extends GraphicalPrimitive2D { - protected Boolean enableRotationMapping; + protected Boolean enableRotationMapping = true; protected BoundingBox boundingBox; protected Group group; } Property changes on: trunk/extensions/render/src/org/sbml/jsbml/ext/render/LineEnding.java ___________________________________________________________________ Modified: svn:keywords - Rev Id URL + Id Rev URL Property changes on: trunk/extensions/render/src/org/sbml/jsbml/ext/render/LinearGradient.java ___________________________________________________________________ Modified: svn:keywords - Rev Id URL + Id Rev URL Property changes on: trunk/extensions/render/src/org/sbml/jsbml/ext/render/LocalRenderInformation.java ___________________________________________________________________ Modified: svn:keywords - Rev Id URL + Id Rev URL Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/LocalStyle.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/LocalStyle.java 2012-05-16 16:07:50 UTC (rev 1265) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/LocalStyle.java 2012-05-18 08:56:03 UTC (rev 1266) @@ -21,6 +21,7 @@ package org.sbml.jsbml.ext.render; import java.util.ArrayList; +import java.util.List; /** @@ -39,7 +40,7 @@ private static final long serialVersionUID = 4976081641247006722L; // TODO List of ids or layouts? Type, setters and getters, add, remove - ArrayList<String> idList; + private List<String> idList; /** * Creates a LocalStyle instance with a group Property changes on: trunk/extensions/render/src/org/sbml/jsbml/ext/render/LocalStyle.java ___________________________________________________________________ Modified: svn:keywords - Rev Id URL + Id Rev URL Added: trunk/extensions/render/src/org/sbml/jsbml/ext/render/Point3D.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/Point3D.java (rev 0) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/Point3D.java 2012-05-18 08:56:03 UTC (rev 1266) @@ -0,0 +1,185 @@ +/* + * $Id: Point3D.java 17:06:27 jakob $ + * $URL: Point3D.java $ + * ---------------------------------------------------------------------------- + * This file is part of JSBML. Please visit <http://sbml.org/Software/JSBML> + * for the latest version of JSBML and more information about SBML. + * Copyright (C) 2009-2012 jointly by the following organizations: + * 1. The University of Tuebingen, Germany + * 2. EMBL European Bioinformatics Institute (EBML-EBI), Hinxton, UK + * 3. The California Institute of Technology, Pasadena, CA, USA + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation. A copy of the license agreement is provided + * in the file named "LICENSE.txt" included with this software distribution + * and also available online as <http://sbml.org/Software/JSBML/License>. + * ---------------------------------------------------------------------------- + */ +package org.sbml.jsbml.ext.render; + +/** + * @author Alexander Diamantikos + * @author Jakob Matthes + * @author Eugen Netz + * @author Jan Rudolph + * @version $Rev$ + * @since 1.0 + * @date 16.05.2012 + */ +public interface Point3D { + + /** + * @return the value of absoluteY + */ + public abstract boolean isAbsoluteY(); + + + /** + * @return the value of absoluteZ + */ + public abstract boolean isAbsoluteZ(); + + + /** + * @return the value of x + */ + public abstract double getX(); + + + /** + * @return the value of y + */ + public abstract double getY(); + + + /** + * @return the value of z + */ + public abstract double getZ(); + + + /** + * @return the value of absoluteX + */ + public abstract boolean isAbsoluteX(); + + + /** + * @return whether absoluteX is set + */ + public abstract boolean isSetAbsoluteX(); + + + /** + * @return whether absoluteY is set + */ + public abstract boolean isSetAbsoluteY(); + + + /** + * @return whether absoluteZ is set + */ + public abstract boolean isSetAbsoluteZ(); + + + /** + * @return whether x is set + */ + public abstract boolean isSetX(); + + + /** + * @return whether y is set + */ + public abstract boolean isSetY(); + + + /** + * @return whether z is set + */ + public abstract boolean isSetZ(); + + + /** + * Set the value of absoluteX + */ + public abstract void setAbsoluteX(Boolean absoluteX); + + + /** + * Set the value of absoluteY + */ + public abstract void setAbsoluteY(Boolean absoluteY); + + + /** + * Set the value of absoluteZ + */ + public abstract void setAbsoluteZ(Boolean absoluteZ); + + + /** + * Set the value of x + */ + public abstract void setX(Double x); + + + /** + * Set the value of y + */ + public abstract void setY(Double y); + + + /** + * Set the value of z + */ + public abstract void setZ(Double z); + + + /** + * Unsets the variable absoluteX + * @return <code>true</code>, if absoluteX was set before, + * otherwise <code>false</code> + */ + public abstract boolean unsetAbsoluteX(); + + + /** + * Unsets the variable absoluteY + * @return <code>true</code>, if absoluteY was set before, + * otherwise <code>false</code> + */ + public abstract boolean unsetAbsoluteY(); + + + /** + * Unsets the variable absoluteZ + * @return <code>true</code>, if absoluteZ was set before, + * otherwise <code>false</code> + */ + public abstract boolean unsetAbsoluteZ(); + + + /** + * Unsets the variable x + * @return <code>true</code>, if x was set before, + * otherwise <code>false</code> + */ + public abstract boolean unsetX(); + + + /** + * Unsets the variable y + * @return <code>true</code>, if y was set before, + * otherwise <code>false</code> + */ + public abstract boolean unsetY(); + + + /** + * Unsets the variable z + * @return <code>true</code>, if z was set before, + * otherwise <code>false</code> + */ + public abstract boolean unsetZ(); +} Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/Polygon.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/Polygon.java 2012-05-16 16:07:50 UTC (rev 1265) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/Polygon.java 2012-05-18 08:56:03 UTC (rev 1266) @@ -20,7 +20,7 @@ */ package org.sbml.jsbml.ext.render; -import java.util.ArrayList; +import org.sbml.jsbml.ListOf; /** @@ -33,6 +33,5 @@ * @date 08.05.2012 */ public class Polygon extends GraphicalPrimitive2D { - // FIXME auch RenderCubicBezier erlaubt? - private ArrayList<RenderPoint> ListOfElements; + private ListOf<RenderPoint> listOfElements; } Property changes on: trunk/extensions/render/src/org/sbml/jsbml/ext/render/Polygon.java ___________________________________________________________________ Modified: svn:keywords - Rev Id URL + Id Rev URL Property changes on: trunk/extensions/render/src/org/sbml/jsbml/ext/render/RadialGradient.java ___________________________________________________________________ Modified: svn:keywords - Rev Id URL + Id Rev URL Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/Rectangle.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/Rectangle.java 2012-05-16 16:07:50 UTC (rev 1265) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/Rectangle.java 2012-05-18 08:56:03 UTC (rev 1266) @@ -31,6 +31,6 @@ * @date 08.05.2012 */ public class Rectangle extends GraphicalPrimitive2D { - protected Integer x, y, z, width, height, rx, ry; - protected Boolean sizeAbsolute; + private Double x, y, z, width, height, rx, ry; + private Boolean sizeAbsolute; //FIXME more booleans needed } Property changes on: trunk/extensions/render/src/org/sbml/jsbml/ext/render/Rectangle.java ___________________________________________________________________ Modified: svn:keywords - Rev Id URL + Id Rev URL Added: trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderConstants.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderConstants.java (rev 0) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderConstants.java 2012-05-18 08:56:03 UTC (rev 1266) @@ -0,0 +1,18 @@ +package org.sbml.jsbml.ext.render; + +public interface RenderConstants { + + public static final String namespaceURI = "http://www.sbml.org/sbml/level3/version1/render/version1"; + public static final String fontFamily = "font-family"; + public static final String fontSize = "font-size"; + public static final String fontWeightBold = "font-weight"; + public static final String fontStyleItalic = "font-style"; + public static final String textAnchor = "text-anchor"; + public static final String vTextAnchor = "vtext-anchor"; + public static final String x = "x"; + public static final String y = "y"; + public static final String z = "z"; + public static final String absoluteX = "absolute-x"; + public static final String absoluteY = "absolute-y"; + public static final String absoluteZ = "absolute-z"; +} \ No newline at end of file Property changes on: trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderConstants.java ___________________________________________________________________ Added: svn:keywords + Id Rev URL Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderCubicBezier.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderCubicBezier.java 2012-05-16 16:07:50 UTC (rev 1265) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderCubicBezier.java 2012-05-18 08:56:03 UTC (rev 1266) @@ -31,6 +31,7 @@ * @date 08.05.2012 */ public class RenderCubicBezier extends RenderPoint { - private Integer x1, y1, z1, x2, y2, z2; + private Double x1, y1, z1, x2, y2, z2; + // abs or relative } Property changes on: trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderCubicBezier.java ___________________________________________________________________ Modified: svn:keywords - Rev Id URL + Id Rev URL Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderInformationBase.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderInformationBase.java 2012-05-16 16:07:50 UTC (rev 1265) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderInformationBase.java 2012-05-18 08:56:03 UTC (rev 1266) @@ -20,6 +20,8 @@ */ package org.sbml.jsbml.ext.render; +import java.awt.Color; + import org.sbml.jsbml.AbstractNamedSBase; import org.sbml.jsbml.LevelVersionError; import org.sbml.jsbml.ListOf; @@ -45,8 +47,7 @@ protected String programName; protected String programVersion; //TODO int better? protected String referenceRenderInformation; - //TODO null -> "none", rgba , default 0xFFFFFFFF - protected Integer backgroundColor; + protected Color backgroundColor; protected ListOf<ColorDefinition> listOfColorDefinitions; // TODO maybe wrong class for linear and radial gradients protected ListOf<GradientBase> listOfGradientBases; Property changes on: trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderInformationBase.java ___________________________________________________________________ Modified: svn:keywords - Rev Id URL + Id Rev URL Added: trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderLayoutPlugin.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderLayoutPlugin.java (rev 0) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderLayoutPlugin.java 2012-05-18 08:56:03 UTC (rev 1266) @@ -0,0 +1,243 @@ +/* + * $Id$ + * $URL$ + * + * ---------------------------------------------------------------------------- + * This file is part of JSBML. Please visit <http://sbml.org/Software/JSBML> + * for the latest version of JSBML and more information about SBML. + * + * Copyright (C) 2009-2012 jointly by the following organizations: + * 1. The University of Tuebingen, Germany + * 2. EMBL European Bioinformatics Institute (EBML-EBI), Hinxton, UK + * 3. The California Institute of Technology, Pasadena, CA, USA + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation. A copy of the license agreement is provided + * in the file named "LICENSE.txt" included with this software distribution + * and also available online as <http://sbml.org/Software/JSBML/License>. + * ---------------------------------------------------------------------------- + */ +package org.sbml.jsbml.ext.render; + +import java.text.MessageFormat; + +import org.sbml.jsbml.ListOf; +import org.sbml.jsbml.SBase; +import org.sbml.jsbml.ext.layout.Layout; + + +/** + * @author Jakob Matthes + * @version $Rev$ + * @since 1.0 + * @date 16.05.2012 + */ +public class RenderLayoutPlugin extends AbstractRenderPlugin { + /** + * + */ + private static final long serialVersionUID = 6636572993878851570L; + private ListOf<LocalRenderInformation> listOfLocalRenderInformation; + + /** + * Creates an RenderLayoutPlugin instance + */ + public RenderLayoutPlugin(Layout layout) { + super(layout); + initDefaults(); + } + + + /** + * Clone constructor + */ + public RenderLayoutPlugin(RenderLayoutPlugin obj) { + super(obj); + // TODO: copy all class attributes, e.g.: + // bar = obj.bar; + } + + + /** + * clones this class + */ + public RenderLayoutPlugin clone() { + return new RenderLayoutPlugin(this); + } + + + /** + * Initializes the default values using the namespace. + */ + public void initDefaults() { +// addNamespace(RenderConstants.namespaceURI); + // TODO: init default values here if necessary, e.g.: + // bar = null; + } + + public static final int MIN_SBML_LEVEL = 3; + public static final int MIN_SBML_VERSION = 1; + + @Override + public boolean getAllowsChildren() { + return true; + } + + @Override + public int getChildCount() { + int count = super.getChildCount(); + if (isSetListOfLocalRenderInformation()) { + count++; + } + return count; + } + + @Override + public SBase getChildAt(int childIndex) { + if (childIndex < 0) { + throw new IndexOutOfBoundsException(childIndex + " < 0"); + } + int pos = 0; + if (isSetListOfLocalRenderInformation()) { + if (pos == childIndex) { + return getListOfLocalRenderInformation(); + } + pos++; + } + throw new IndexOutOfBoundsException(MessageFormat.format( + "Index {0,number,integer} >= {1,number,integer}", childIndex, + +((int) Math.min(pos, 0)))); + } + + + /** + * @return <code>true</code>, if listOfLocalRenderInformation contains at least one element, + * otherwise <code>false</code> + */ + public boolean isSetListOfLocalRenderInformation() { + if ((listOfLocalRenderInformation == null) || listOfLocalRenderInformation.isEmpty()) { + return false; + } + return true; + } + + + /** + * @return the listOfLocalRenderInformation + */ + public ListOf<LocalRenderInformation> getListOfLocalRenderInformation() { + if (!isSetListOfLocalRenderInformation()) { + SBase sBase = getExtendedSBase(); + listOfLocalRenderInformation = new ListOf<LocalRenderInformation>(sBase.getLevel(), sBase.getVersion()); + listOfLocalRenderInformation.addNamespace(RenderConstants.namespaceURI); + listOfLocalRenderInformation.setSBaseListType(ListOf.Type.other); + sBase.registerChild(listOfLocalRenderInformation); + } + return listOfLocalRenderInformation; + } + + /** + * + * @param i + * @return + */ + public LocalRenderInformation getLocalRenderInformation(int i) { + return getListOfLocalRenderInformation().get(i); + } + + + /** + * @param listOfLocalRenderInformation + */ + public void setListOfLocalRenderInformation(ListOf<LocalRenderInformation> listOfLocalRenderInformation) { + unsetListOfLocalRenderInformation(); + this.listOfLocalRenderInformation = listOfLocalRenderInformation; + getExtendedSBase().registerChild(this.listOfLocalRenderInformation); + } + + + /** + * @return <code>true</code>, if listOfLocalRenderInformation contained at least one element, + * otherwise <code>false</code> + */ + public boolean unsetListOfLocalRenderInformation() { + if (isSetListOfLocalRenderInformation()) { + ListOf<LocalRenderInformation> oldLocalRenderInformation = this.listOfLocalRenderInformation; + this.listOfLocalRenderInformation = null; + oldLocalRenderInformation.fireNodeRemovedEvent(); + return true; + } + return false; + } + + + /** + * @param field + */ + public boolean addLocalRenderInformation(LocalRenderInformation field) { + return getListOfLocalRenderInformation().add(field); + } + + + /** + * @param field + */ + public boolean removeLocalRenderInformation(LocalRenderInformation field) { + if (isSetListOfLocalRenderInformation()) { + return getListOfLocalRenderInformation().remove(field); + } + return false; + } + + + /** + * @param i + */ + public void removeLocalRenderInformation(int i) { + if (!isSetListOfLocalRenderInformation()) { + throw new IndexOutOfBoundsException(Integer.toString(i)); + } + getListOfLocalRenderInformation().remove(i); + } + + + /** + * TODO: if the ID is mandatory for LocalRenderInformation objects, + * one should also add this methods + */ + //public void removeLocalRenderInformation(String id) { + // getListOfLocalRenderInformation().removeFirst(new NameFilter(id)); + //} + /** + * create a new LocalRenderInformation element and adds it to the ListOfLocalRenderInformation list + * <p><b>NOTE:</b> + * only use this method, if ID is not mandatory in LocalRenderInformation + * otherwise use @see createLocalRenderInformation(String id)!</p> + */ + public LocalRenderInformation createLocalRenderInformation() { + return createLocalRenderInformation(null); + } + + + /** + * create a new LocalRenderInformation element and adds it to the ListOfLocalRenderInformation list + */ + public LocalRenderInformation createLocalRenderInformation(String id) { + SBase sBase = getExtendedSBase(); + LocalRenderInformation field = new LocalRenderInformation(id, sBase.getLevel(), sBase.getVersion()); + addLocalRenderInformation(field); + return field; + } + + /** + * TODO: optionally, create additional create methods with more + * variables, for instance "bar" variable + */ + // public LocalRenderInformation createLocalRenderInformation(String id, int bar) { + // LocalRenderInformation field = createLocalRenderInformation(id); + // field.setBar(bar); + // return field; + // } + +} Property changes on: trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderLayoutPlugin.java ___________________________________________________________________ Added: svn:keywords + Id Rev URL Added: trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderModelPlugin.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderModelPlugin.java (rev 0) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderModelPlugin.java 2012-05-18 08:56:03 UTC (rev 1266) @@ -0,0 +1,237 @@ +/* + * $Id$ + * $URL$ + * + * ---------------------------------------------------------------------------- + * This file is part of JSBML. Please visit <http://sbml.org/Software/JSBML> + * for the latest version of JSBML and more information about SBML. + * + * Copyright (C) 2009-2012 jointly by the following organizations: + * 1. The University of Tuebingen, Germany + * 2. EMBL European Bioinformatics Institute (EBML-EBI), Hinxton, UK + * 3. The California Institute of Technology, Pasadena, CA, USA + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation. A copy of the license agreement is provided + * in the file named "LICENSE.txt" included with this software distribution + * and also available online as <http://sbml.org/Software/JSBML/License>. + * ---------------------------------------------------------------------------- + */ +package org.sbml.jsbml.ext.render; + +import java.text.MessageFormat; + +import org.sbml.jsbml.ListOf; +import org.sbml.jsbml.SBase; +import org.sbml.jsbml.ext.layout.Layout; + + +/** + * @author Jakob Matthes + * @version $Rev$ + * @since 1.0 + * @date 16.05.2012 + */ +public class RenderModelPlugin extends AbstractRenderPlugin { + + public static final int MIN_SBML_LEVEL = 3; + public static final int MIN_SBML_VERSION = 1; + + /** + * + */ + private static final long serialVersionUID = -4727110538908666931L; + + + + /** + * + */ + private ListOf<GlobalRenderInformation> listOfGlobalRenderInformation; + + + /** + * Creates an RenderModelPlugin instance + */ + public RenderModelPlugin(ListOf<Layout> listOfLayouts) { + super(listOfLayouts); + initDefaults(); + } + + /** + * Clone constructor + */ + public RenderModelPlugin(RenderModelPlugin obj) { + super(obj); + // TODO: copy all class attributes, e.g.: + // bar = obj.bar; + } + + + /** + * @param field + */ + public boolean addGlobalRenderInformation(GlobalRenderInformation field) { + return getListOfGlobalRenderInformation().add(field); + } + + /** + * clones this class + */ + public RenderModelPlugin clone() { + return new RenderModelPlugin(this); + } + + + /** + * create a new GlobalRenderInformation element and adds it to the ListOfGlobalRenderInformation list + * <p><b>NOTE:</b> + * only use this method, if ID is not mandatory in GlobalRenderInformation + * otherwise use @see createGlobalRenderInformation(String id)!</p> + */ + public GlobalRenderInformation createGlobalRenderInformation() { + return createGlobalRenderInformation(null); + } + + /** + * create a new GlobalRenderInformation element and adds it to the ListOfGlobalRenderInformation list + */ + public GlobalRenderInformation createGlobalRenderInformation(String id) { + SBase sBase = getExtendedSBase(); + GlobalRenderInformation field = new GlobalRenderInformation(id, sBase.getLevel(), sBase.getVersion()); + addGlobalRenderInformation(field); + return field; + } + @Override + public boolean getAllowsChildren() { + return true; + } + + public SBase getChildAt(int childIndex) { + if (childIndex < 0) { + throw new IndexOutOfBoundsException(childIndex + " < 0"); + } + int pos = 0; + if (isSetListOfGlobalRenderInformation()) { + if (pos == childIndex) { + return getListOfGlobalRenderInformation(); + } + pos++; + } + throw new IndexOutOfBoundsException(MessageFormat.format( + "Index {0,number,integer} >= {1,number,integer}", childIndex, + +((int) Math.min(pos, 0)))); + } + + + @Override + public int getChildCount() { + int count = super.getChildCount(); + if (isSetListOfGlobalRenderInformation()) { + count++; + } + return count; + } + + + /** + * @return the listOfGlobalRenderInformation + */ + public ListOf<GlobalRenderInformation> getListOfGlobalRenderInformation() { + if (!isSetListOfGlobalRenderInformation()) { + SBase sBase = getExtendedSBase(); + listOfGlobalRenderInformation = new ListOf<GlobalRenderInformation>(sBase.getLevel(), sBase.getVersion()); + listOfGlobalRenderInformation.addNamespace(RenderConstants.namespaceURI); + listOfGlobalRenderInformation.setSBaseListType(ListOf.Type.other); + sBase.registerChild(listOfGlobalRenderInformation); + } + return listOfGlobalRenderInformation; + } + + + /** + * Initializes the default values using the namespace. + */ + public void initDefaults() { +// addNamespace(RenderConstants.namespaceURI); + // TODO: init default values here if necessary, e.g.: + // bar = null; + } + + + /** + * @return <code>true</code>, if listOfGlobalRenderInformation contains at least one element, + * otherwise <code>false</code> + */ + public boolean isSetListOfGlobalRenderInformation() { + if ((listOfGlobalRenderInformation == null) || listOfGlobalRenderInformation.isEmpty()) { + return false; + } + return true; + } + + + /** + * @param field + */ + public boolean removeGlobalRenderInformation(GlobalRenderInformation field) { + if (isSetListOfGlobalRenderInformation()) { + return getListOfGlobalRenderInformation().remove(field); + } + return false; + } + + + /** + * @param i + */ + public void removeGlobalRenderInformation(int i) { + if (!isSetListOfGlobalRenderInformation()) { + throw new IndexOutOfBoundsException(Integer.toString(i)); + } + getListOfGlobalRenderInformation().remove(i); + } + + + /** + * TODO: if the ID is mandatory for GlobalRenderInformation objects, + * one should also add this methods + */ + //public void removeGlobalRenderInformation(String id) { + // getListOfGlobalRenderInformation().removeFirst(new NameFilter(id)); + //} + /** + * @param listOfGlobalRenderInformation + */ + public void setListOfGlobalRenderInformation(ListOf<GlobalRenderInformation> listOfGlobalRenderInformation) { + unsetListOfGlobalRenderInformation(); + this.listOfGlobalRenderInformation = listOfGlobalRenderInformation; + getExtendedSBase().registerChild(this.listOfGlobalRenderInformation); + } + + + /** + * @return <code>true</code>, if listOfGlobalRenderInformation contained at least one element, + * otherwise <code>false</code> + */ + public boolean unsetListOfGlobalRenderInformation() { + if (isSetListOfGlobalRenderInformation()) { + ListOf<GlobalRenderInformation> oldGlobalRenderInformation = this.listOfGlobalRenderInformation; + this.listOfGlobalRenderInformation = null; + oldGlobalRenderInformation.fireNodeRemovedEvent(); + return true; + } + return false; + } + + /** + * TODO: optionally, create additional create methods with more + * variables, for instance "bar" variable + */ + // public GlobalRenderInformation createGlobalRenderInformation(String id, int bar) { + // GlobalRenderInformation field = createGlobalRenderInformation(id); + // field.setBar(bar); + // return field; + // } +} Property changes on: trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderModelPlugin.java ___________________________________________________________________ Added: svn:keywords + Id Rev URL Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderPoint.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderPoint.java 2012-05-16 16:07:50 UTC (rev 1265) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderPoint.java 2012-05-18 08:56:03 UTC (rev 1266) @@ -33,8 +33,8 @@ * @date 08.05.2012 */ public class RenderPoint extends AbstractSBase { - // TODO Punkte als eigene Klasse? Point aus Layout? - private Integer x, y, z; + private Double x, y, z; + // booleans abs or relative public AbstractSBase clone() { // TODO Auto-generated method stub Property changes on: trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderPoint.java ___________________________________________________________________ Modified: svn:keywords - Rev Id URL + Id Rev URL Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/Style.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/Style.java 2012-05-16 16:07:50 UTC (rev 1265) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/Style.java 2012-05-18 08:56:03 UTC (rev 1266) @@ -21,6 +21,7 @@ package org.sbml.jsbml.ext.render; import java.util.ArrayList; +import java.util.List; import org.sbml.jsbml.AbstractSBase; import org.sbml.jsbml.LevelVersionError; @@ -43,8 +44,8 @@ protected String id; //TODO right List class? setters, getters for List or elements? add, remove for Lists - protected ArrayList<String> typeList; - protected ArrayList<String> roleList; + protected List<String> typeList; + protected List<String> roleList; protected Group group; @@ -170,7 +171,7 @@ * @return the value of typeList */ //TODO Whole list or elements? - public ArrayList<String> getTypeList(){ + public List<String> getTypeList(){ return this.typeList; } @@ -187,7 +188,7 @@ /** * @return the value of roleList */ - public ArrayList<String> getRoleList(){ + public List<String> getRoleList(){ return this.roleList; } Property changes on: trunk/extensions/render/src/org/sbml/jsbml/ext/render/Style.java ___________________________________________________________________ Modified: svn:keywords - Rev Id URL + Id Rev URL Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/Text.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/Text.java 2012-05-16 16:07:50 UTC (rev 1265) +++ trunk/extensions/render/src/org/sbm... [truncated message content] |
From: <nik...@us...> - 2012-05-16 16:08:01
|
Revision: 1265 http://jsbml.svn.sourceforge.net/jsbml/?rev=1265&view=rev Author: niko-rodrigue Date: 2012-05-16 16:07:50 +0000 (Wed, 16 May 2012) Log Message: ----------- added a test to check the registration of local parameters Modified Paths: -------------- branches/jsbml-0.8/test/org/sbml/jsbml/xml/test/UnregisterTests.java Modified: branches/jsbml-0.8/test/org/sbml/jsbml/xml/test/UnregisterTests.java =================================================================== --- branches/jsbml-0.8/test/org/sbml/jsbml/xml/test/UnregisterTests.java 2012-05-16 11:55:00 UTC (rev 1264) +++ branches/jsbml-0.8/test/org/sbml/jsbml/xml/test/UnregisterTests.java 2012-05-16 16:07:50 UTC (rev 1265) @@ -8,6 +8,7 @@ import org.junit.Test; import org.sbml.jsbml.Compartment; import org.sbml.jsbml.IdentifierException; +import org.sbml.jsbml.KineticLaw; import org.sbml.jsbml.LocalParameter; import org.sbml.jsbml.Model; import org.sbml.jsbml.Reaction; @@ -184,6 +185,29 @@ // success } } + + /** + * + */ + @Test public void testRegister3() { + + Reaction r2 = new Reaction(2,4); + KineticLaw k = r2.createKineticLaw(); + + k.createLocalParameter("LP1"); + + // We should not be allowed to register an other local parameter with the same id + try { + k.createLocalParameter("LP1"); + // fail("We should not be able to add a local parameter with the same id as an other local parameter in the same kineticLaw."); + } catch (IdentifierException e) { + // success + } + + assertTrue(k.getLocalParameterCount() == 1); + + } + /** * This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |