Skip to content
Snippets Groups Projects
Commit 19980c87 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

Merge branch '798-elements-font-size-is-not-preserved-during-export' into 'master'

Resolve "Elements font size is not preserved during export"

Closes #798

See merge request !761
parents 42e25bf5 da0a20af
No related branches found
No related tags found
1 merge request!761Resolve "Elements font size is not preserved during export"
Pipeline #10029 passed
......@@ -60,6 +60,7 @@ minerva (12.3.0~alpha.0) unstable; urgency=low
having the aa change information
* Bug fix: plugin contect element width is adjusted when link to tabs are
wrapped in more than one line (#758)
* Bug fix: export to CellDesigner preserve font size (#803)
minerva (12.2.3) stable; urgency=medium
* Bug fix: sorting of entries in "Edit project->overlays" dialog fixed (#790)
......
......@@ -572,7 +572,7 @@ public class LayerXmlParser {
result.append(" y=\"" + layer.getY() + "\" ");
result.append(" w=\"" + layer.getWidth() + "\" ");
result.append(" h=\"" + layer.getHeight() + "\"/>");
result.append("<celldesigner:font size=\"" + layer.getFontSize() + "\"/>");
result.append("<celldesigner:font size=\"" + layer.getFontSize().intValue() + "\"/>");
result.append("</celldesigner:layerSpeciesAlias>\n");
return result.toString();
}
......
......@@ -21,67 +21,71 @@ import lcsb.mapviewer.model.map.species.Element;
*/
public abstract class AbstractAliasXmlParser<T extends Element> {
/**
* Default class logger.
*/
@SuppressWarnings("unused")
private Logger logger = Logger.getLogger(AbstractAliasXmlParser.class.getName());
/**
* Default class logger.
*/
@SuppressWarnings("unused")
private Logger logger = Logger.getLogger(AbstractAliasXmlParser.class.getName());
/**
* Set of common functions used in parsing cell designer xml.
*/
private CommonXmlParser commonParser = new CommonXmlParser();
/**
* Set of common functions used in parsing cell designer xml.
*/
private CommonXmlParser commonParser = new CommonXmlParser();
/**
* Parse object from the xml node.
*
* @param node
* xml node to parse
*
* @return parsed object
* @throws InvalidXmlSchemaException
* thrown when xmlString is invalid
*/
abstract T parseXmlAlias(Node node) throws InvalidXmlSchemaException;
/**
* Parse object from the xml node.
*
* @param node
* xml node to parse
*
* @return parsed object
* @throws InvalidXmlSchemaException
* thrown when xmlString is invalid
*/
abstract T parseXmlAlias(Node node) throws InvalidXmlSchemaException;
/**
* Parse object from the xml string.
*
* @param xmlString
* xml string
* @return parsed object
* @throws InvalidXmlSchemaException
* thrown when xmlString is invalid
*/
public T parseXmlAlias(String xmlString) throws InvalidXmlSchemaException {
Document doc = XmlParser.getXmlDocumentFromString(xmlString);
NodeList root = doc.getChildNodes();
return parseXmlAlias(root.item(0));
/**
* Parse object from the xml string.
*
* @param xmlString
* xml string
* @return parsed object
* @throws InvalidXmlSchemaException
* thrown when xmlString is invalid
*/
public T parseXmlAlias(String xmlString) throws InvalidXmlSchemaException {
Document doc = XmlParser.getXmlDocumentFromString(xmlString);
NodeList root = doc.getChildNodes();
return parseXmlAlias(root.item(0));
}
}
/**
* Method that transform object into CellDesigner xml.
*
* @param alias
* object to be transformed
* @return CellDesigner xml representation of the alias
*/
abstract String toXml(T alias);
/**
* Method that transform object into CellDesigner xml.
*
* @param alias
* object to be transformed
* @return CellDesigner xml representation of the alias
*/
abstract String toXml(T alias);
/**
* @return the commonParser
*/
CommonXmlParser getCommonParser() {
return commonParser;
}
/**
* @return the commonParser
*/
CommonXmlParser getCommonParser() {
return commonParser;
}
/**
* @param commonParser
* the commonParser to set
*/
void setCommonParser(CommonXmlParser commonParser) {
this.commonParser = commonParser;
}
/**
* @param commonParser
* the commonParser to set
*/
void setCommonParser(CommonXmlParser commonParser) {
this.commonParser = commonParser;
}
protected String createFontTag(T alias) {
return "<celldesigner:font size=\"" + alias.getFontSize().intValue() + "\"/>";
}
}
......@@ -239,7 +239,7 @@ public class SpeciesAliasXmlParser extends AbstractAliasXmlParser<Species> {
sb.append("h=\"" + species.getHeight() + "\" ");
sb.append("/>\n");
sb.append("<celldesigner:font size=\"" + species.getFontSize() + "\"/>\n");
sb.append(createFontTag(species));
// TODO to be improved
sb.append("<celldesigner:view state=\"usual\"/>\n");
......
......@@ -57,7 +57,7 @@ public class ComplexAliasXmlParserTest extends CellDesignerTestFunctions {
private Complex createComplex() {
Complex complex = new Complex("id");
complex.setFontSize(13.5);
complex.setFontSize(13);
complex.setHeight(90);
complex.setWidth(80);
complex.setName("112");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment