Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Devrim Gunyel
core
Commits
a933265b
Commit
a933265b
authored
Oct 25, 2019
by
Piotr Gawron
Browse files
border color is considered when creating/exporting pathways
parent
bfa13b51
Changes
3
Hide whitespace changes
Inline
Side-by-side
converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/LayerXmlParser.java
View file @
a933265b
package
lcsb.mapviewer.converter.model.celldesigner
;
import
java.awt.
*
;
import
java.awt.
Color
;
import
java.awt.geom.Point2D
;
import
java.util.*
;
import
java.util.List
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
...
...
@@ -502,6 +501,11 @@ public class LayerXmlParser {
result
.
setBackgroundColor
(
backgroundColor
);
notes
=
removeBackgroundColor
(
notes
);
}
Color
borderColor
=
extractBorderColor
(
notes
);
if
(
borderColor
!=
null
)
{
result
.
setBorderColor
(
borderColor
);
notes
=
removeBorderColor
(
notes
);
}
result
.
setNotes
(
notes
);
}
else
if
(
node
.
getNodeName
().
equalsIgnoreCase
(
"celldesigner:paint"
))
{
result
.
setColor
(
commonParser
.
getColor
(
node
));
...
...
@@ -523,10 +527,18 @@ public class LayerXmlParser {
}
String
removeBackgroundColor
(
String
notes
)
{
return
removeColor
(
notes
,
"BackgroundColor"
);
}
String
removeBorderColor
(
String
notes
)
{
return
removeColor
(
notes
,
"BorderColor"
);
}
private
String
removeColor
(
String
notes
,
String
string
)
{
String
lines
[]
=
notes
.
split
(
"[\n\r]+"
);
StringBuilder
result
=
new
StringBuilder
(
""
);
for
(
String
line
:
lines
)
{
if
(!
line
.
startsWith
(
"BackgroundColor
="
)
&&
!
line
.
startsWith
(
"BackgroundColor
:"
))
{
if
(!
line
.
startsWith
(
string
+
"
="
)
&&
!
line
.
startsWith
(
string
+
"
:"
))
{
result
.
append
(
line
+
"\n"
);
}
}
...
...
@@ -534,10 +546,18 @@ public class LayerXmlParser {
}
Color
extractBackgroundColor
(
String
notes
)
{
return
extractColor
(
notes
,
"BackgroundColor"
);
}
Color
extractBorderColor
(
String
notes
)
{
return
extractColor
(
notes
,
"BorderColor"
);
}
private
Color
extractColor
(
String
notes
,
String
string
)
{
String
lines
[]
=
notes
.
split
(
"[\n\r]+"
);
for
(
String
line
:
lines
)
{
if
(
line
.
startsWith
(
"BackgroundColor
="
)
||
line
.
startsWith
(
"BackgroundColor
:"
))
{
String
colorString
=
line
.
replace
(
"BackgroundColor="
,
""
).
replace
(
"BackgroundColor
:"
,
""
);
if
(
line
.
startsWith
(
string
+
"
="
)
||
line
.
startsWith
(
string
+
"
:"
))
{
String
colorString
=
line
.
replace
(
string
+
"="
,
""
).
replace
(
string
+
"
:"
,
""
);
return
new
ColorParser
().
parse
(
colorString
);
}
}
...
...
@@ -562,6 +582,9 @@ public class LayerXmlParser {
if
(!
layer
.
getBackgroundColor
().
equals
(
Color
.
LIGHT_GRAY
))
{
notes
+=
"\nBackgroundColor:"
+
new
ColorParser
().
colorToHtml
(
layer
.
getBackgroundColor
());
}
if
(!
layer
.
getBorderColor
().
equals
(
Color
.
LIGHT_GRAY
))
{
notes
+=
"\nBorderColor:"
+
new
ColorParser
().
colorToHtml
(
layer
.
getBorderColor
());
}
result
.
append
(
notes
);
result
.
append
(
"\n</celldesigner:layerNotes>"
);
result
.
append
(
"<celldesigner:paint color=\""
+
XmlParser
.
colorToString
(
layer
.
getColor
())
+
"\"/>"
);
...
...
converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/LayerXmlParserTest.java
View file @
a933265b
...
...
@@ -326,8 +326,10 @@ public class LayerXmlParserTest extends CellDesignerTestFunctions {
public
void
testLayerTextToXmlWithCustomDefaultBackgroundColor
()
throws
Exception
{
LayerText
text
=
new
LayerText
();
text
.
setBackgroundColor
(
Color
.
BLUE
);
text
.
setBorderColor
(
Color
.
YELLOW
);
String
xml
=
parser
.
layerTextToXml
(
text
);
assertTrue
(
xml
.
contains
(
"BackgroundColor"
));
assertTrue
(
xml
.
contains
(
"BorderColor"
));
}
}
model-command/src/main/java/lcsb/mapviewer/commands/CreateHierarchyCommand.java
View file @
a933265b
...
...
@@ -169,6 +169,7 @@ public class CreateHierarchyCommand extends ModelCommand {
compartment
.
setHeight
(
text
.
getHeight
());
compartment
.
setFontColor
(
text
.
getColor
());
compartment
.
setFillColor
(
text
.
getBackgroundColor
());
compartment
.
setBorderColor
(
text
.
getBorderColor
());
compartment
.
setName
(
extractNameFromText
(
text
.
getNotes
()));
compartment
.
setNotes
(
extractNotesFromText
(
text
.
getNotes
()));
compartment
.
setZ
(
text
.
getZ
());
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment