From ff2ec80f57b2cc2fcc4fab731140e042d73d915e Mon Sep 17 00:00:00 2001 From: Piotr Gawron <piotr.gawron@uni.lu> Date: Wed, 23 Oct 2019 13:20:19 +0200 Subject: [PATCH] copy method implemented for structural state --- .../java/lcsb/mapviewer/model/map/species/Species.java | 4 +++- .../model/map/species/field/StructuralState.java | 8 ++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/model/src/main/java/lcsb/mapviewer/model/map/species/Species.java b/model/src/main/java/lcsb/mapviewer/model/map/species/Species.java index ed26df150f..8d39fb32d1 100644 --- a/model/src/main/java/lcsb/mapviewer/model/map/species/Species.java +++ b/model/src/main/java/lcsb/mapviewer/model/map/species/Species.java @@ -199,7 +199,9 @@ public abstract class Species extends Element { substanceUnitRawType = original.substanceUnitRawType; uniprots = original.getUniprots(); - structuralState = original.structuralState; + if (original.structuralState != null) { + setStructuralState(original.structuralState.copy()); + } // don't copy reaction nodes } diff --git a/model/src/main/java/lcsb/mapviewer/model/map/species/field/StructuralState.java b/model/src/main/java/lcsb/mapviewer/model/map/species/field/StructuralState.java index 6e292ef3c7..bc8637150d 100644 --- a/model/src/main/java/lcsb/mapviewer/model/map/species/field/StructuralState.java +++ b/model/src/main/java/lcsb/mapviewer/model/map/species/field/StructuralState.java @@ -8,11 +8,8 @@ import javax.persistence.*; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.hibernate.annotations.Cascade; -import org.hibernate.annotations.CascadeType; import org.hibernate.annotations.Type; -import lcsb.mapviewer.common.exception.NotImplementedException; import lcsb.mapviewer.model.map.species.Species; /** @@ -65,6 +62,9 @@ public class StructuralState implements Serializable { public StructuralState(StructuralState mr) { this.value = mr.getValue(); this.position = mr.position; + this.width = mr.getWidth(); + this.height = mr.getHeight(); + this.fontSize = mr.getFontSize(); } public Species getSpecies() { @@ -84,7 +84,7 @@ public class StructuralState implements Serializable { } public StructuralState copy() { - throw new NotImplementedException(); + return new StructuralState(this); } public String getValue() { -- GitLab