Commit bfa13b51 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

comparison of colors for elements added

parent 45625dc6
......@@ -55,6 +55,8 @@ public class LayerText implements Serializable, Drawable {
*/
private Color backgroundColor = Color.LIGHT_GRAY;
private Color borderColor = Color.LIGHT_GRAY;
/**
* X coordinate of text start point.
*/
......@@ -137,6 +139,8 @@ public class LayerText implements Serializable, Drawable {
if (layerText.getGlyph() != null) {
setGlyph(new Glyph(layerText.getGlyph()));
}
setBackgroundColor(layerText.getBackgroundColor());
setBorderColor(layerText.getBorderColor());
}
/**
......@@ -392,4 +396,12 @@ public class LayerText implements Serializable, Drawable {
this.glyph = glyph;
}
public Color getBorderColor() {
return borderColor;
}
public void setBorderColor(Color borderColor) {
this.borderColor = borderColor;
}
}
......@@ -284,6 +284,7 @@ public abstract class Element implements BioEntity, Serializable, SbmlArgument {
if (original.getGlyph() != null) {
setGlyph(new Glyph(original.getGlyph()));
}
setBorderColor(original.getBorderColor());
}
/**
......
......@@ -111,6 +111,16 @@ public class ElementComparator extends Comparator<Element> {
return colorComparator.compare(arg0.getFillColor(), arg1.getFillColor());
}
if (colorComparator.compare(arg0.getBorderColor(), arg1.getBorderColor()) != 0) {
logger.debug("Border Color different: " + arg0.getBorderColor() + ", " + arg1.getBorderColor());
return colorComparator.compare(arg0.getBorderColor(), arg1.getBorderColor());
}
if (colorComparator.compare(arg0.getFontColor(), arg1.getFontColor()) != 0) {
logger.debug("Border Font different: " + arg0.getFontColor() + ", " + arg1.getFontColor());
return colorComparator.compare(arg0.getFontColor(), arg1.getFontColor());
}
// this should be somehow modified, because it can create a situation where
// comparison will fall into infinite loop (in cyclic submodels)
ElementSubmodelConnectionComparator ascc = new ElementSubmodelConnectionComparator(epsilon);
......
......@@ -92,6 +92,26 @@ public class ElementComparatorTest extends ModelTestFunctions {
assertTrue(comparator.compare(element2, element1) != 0);
}
@Test
public void testDifferentBorderColor() throws Exception {
Element element1 = createElement();
Element element2 = createElement();
element1.setBorderColor(Color.YELLOW);
assertTrue(comparator.compare(element1, element2) != 0);
assertTrue(comparator.compare(element2, element1) != 0);
}
@Test
public void testDifferentFontColor() throws Exception {
Element element1 = createElement();
Element element2 = createElement();
element1.setFontColor(Color.YELLOW);
assertTrue(comparator.compare(element1, element2) != 0);
assertTrue(comparator.compare(element2, element1) != 0);
}
private Element createElement() {
Element result = new GenericProtein("id2");
ElementSubmodelConnection submodel = new ElementSubmodelConnection(getModel(), SubmodelType.DOWNSTREAM_TARGETS);
......
Markdown is supported
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