Skip to content

Commit

Permalink
making picto more resilient against images
Browse files Browse the repository at this point in the history
  • Loading branch information
beatrizsanchez committed Feb 10, 2021
1 parent e51fce9 commit 87b6723
Showing 1 changed file with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,11 @@ operation Any label() : String {
//var javascript = "javascript:top.showView(['Model', 'Classes', '" + self.name + "'])";
var name = self.name;
if (not self.isTypeOf(DerivedResource)){
label += "<tr><td align='right' valign='middle'><img src='" + self.getIcon()+ "'></img></td>" +
"<td align='left' valign='middle'> " + self.definition + " </td></tr>";
label += "<tr><td align='right' valign='middle'>";
if (self.getIcon() <> null){
label += "<img src='" + self.getIcon()+ "'></img>";
}
label += "</td><td align='left' valign='middle'> " + self.definition + " </td></tr>";
} else {
name = self.name.split("\\.").at(1);
}
Expand All @@ -34,16 +37,17 @@ operation Any label() : String {
operation Sequence edgeLabel(){
// TODOreturn self.name.replace("://", "-");
}
operation Any getIcon() {
operation Any getIcon() : String{
var icon = "icons/" + self.definition.split(":").at(1) + ".png";
var found = getImage(icon);
if (found <> icon){
return found;
} else {
found = "icons/" + self.definition.split(":").at(1) + ".gif";
if (found <> icon.replace("\\.png", ".gif")){
var newIcon = "icons/" + self.definition.split(":").at(1) + ".gif";
found = getImage(newIcon);
if (found <> newIcon){
return found;
}
return getImage("icons/icon.png");
return null;
}
}

0 comments on commit 87b6723

Please sign in to comment.