Commit 8373beb0 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

when copying element fon't forget about glyph

parent 3f299d06
...@@ -60,6 +60,22 @@ public class Glyph implements Serializable { ...@@ -60,6 +60,22 @@ public class Glyph implements Serializable {
@ManyToOne(fetch = FetchType.LAZY, optional = false) @ManyToOne(fetch = FetchType.LAZY, optional = false)
private Project project; private Project project;
/**
* Default constructor.
*/
public Glyph() {
}
/**
* Constructor that creates copy of the element.
*
* @param original element to be copied
*/
public Glyph(Glyph original) {
// we should reference to the same file
setFile(file);
}
public UploadedFileEntry getFile() { public UploadedFileEntry getFile() {
return file; return file;
} }
......
...@@ -302,6 +302,7 @@ public abstract class Element implements BioEntity, Serializable, SbmlArgument { ...@@ -302,6 +302,7 @@ public abstract class Element implements BioEntity, Serializable, SbmlArgument {
this.formula = original.getFormula(); this.formula = original.getFormula();
setVisibilityLevel(original.getVisibilityLevel()); setVisibilityLevel(original.getVisibilityLevel());
setTransparencyLevel(original.getTransparencyLevel()); setTransparencyLevel(original.getTransparencyLevel());
setGlyph(new Glyph(original.getGlyph()));
} }
/** /**
......
...@@ -25,6 +25,7 @@ import lcsb.mapviewer.model.map.MiriamData; ...@@ -25,6 +25,7 @@ import lcsb.mapviewer.model.map.MiriamData;
import lcsb.mapviewer.model.map.MiriamType; import lcsb.mapviewer.model.map.MiriamType;
import lcsb.mapviewer.model.map.SearchIndex; import lcsb.mapviewer.model.map.SearchIndex;
import lcsb.mapviewer.model.map.compartment.Compartment; import lcsb.mapviewer.model.map.compartment.Compartment;
import lcsb.mapviewer.model.map.layout.graphics.Glyph;
import lcsb.mapviewer.model.map.layout.graphics.LayerText; import lcsb.mapviewer.model.map.layout.graphics.LayerText;
import lcsb.mapviewer.model.map.model.ElementSubmodelConnection; import lcsb.mapviewer.model.map.model.ElementSubmodelConnection;
import lcsb.mapviewer.model.map.model.Model; import lcsb.mapviewer.model.map.model.Model;
...@@ -112,6 +113,23 @@ public class ElementTest extends ModelTestFunctions { ...@@ -112,6 +113,23 @@ public class ElementTest extends ModelTestFunctions {
} }
} }
@Test
public void testCopyGlyph() {
try {
GenericProtein protein = new GenericProtein();
protein.addSearchIndex(new SearchIndex());
protein.setSubmodel(new ElementSubmodelConnection());
protein.setGlyph(new Glyph());
Element copy = new GenericProtein(protein);
assertNotNull(copy.getGlyph());
ElementComparator comparator = new ElementComparator();
assertEquals(0, comparator.compare(copy, protein));
} catch (Exception e) {
e.printStackTrace();
throw e;
}
}
@Test @Test
public void testIncreaseBorder() { public void testIncreaseBorder() {
try { try {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment