Commit f67ff800 authored by apvrille's avatar apvrille

Update on icons for countermeasures

parent 05e3c131
This diff is collapsed.
......@@ -154,6 +154,7 @@ public class ColorManager {
public static Color ATD_ATTACK_DISABLED = new Color(214, 206, 198);
public static Color ATD_ROOT_ATTACK = new Color(243, 131, 10);
public static Color ATD_CONSTRAINT = new Color(191, 153, 161);
public static Color ATD_COUNTERMEASURE = new Color(209, 218, 174);
//public static final Color AVATAR_BLOCK = new Color(128, 180, 205);
//public static final Color AVATAR_BLOCK = new Color(158, 218, 227);
......
......@@ -116,7 +116,7 @@ public class IconManager {
// Attack Tree Diagrams
public static ImageIcon imgic1070, imgic1072, imgic1074, imgic1076, imgic1078;
public static ImageIcon imgic1080;
public static ImageIcon imgic1080, imgic1082;
// TMLDD
public static ImageIcon imgic1100, imgic1102, imgic1104, imgic1106, imgic1108;
......@@ -472,6 +472,7 @@ public class IconManager {
private static String icon1076 = "images/atdcomp.gif";
private static String icon1078 = "images/atdcons.gif";
private static String icon1080 = "images/atdlink.gif";
private static String icon1082 = "images/atdcountermeasure.gif";
// DIPLODOCUS architecture
private static String icon1100 = "images/tmlcpunode.gif";
......@@ -889,6 +890,7 @@ public class IconManager {
imgic1076 = getIcon(icon1076);
imgic1078 = getIcon(icon1078);
imgic1080 = getIcon(icon1080);
imgic1082 = getIcon(icon1082);
imgic1100 = getIcon(icon1100);
imgic1102 = getIcon(icon1102);
......
......@@ -1075,7 +1075,7 @@ public class TGUIAction extends AbstractAction {
actions[ATD_ATTACK_CONNECTOR] = new TAction("atd-attack-connector", "Add a connector between attacks /constraints", IconManager.imgic1080, IconManager.imgic1080, "Connector", "Add a connector between attacks / constraints of the currently opened attack tree diagram", 0);
actions[ATD_COMPOSITION_CONNECTOR] = new TAction("atd-composition-connector", "Add a composition connector between blocks", IconManager.imgic1076, IconManager.imgic1076, "Composition connector", "Add a composition between blocks of the currently opened attack tree diagram", 0);
actions[ATD_CONSTRAINT] = new TAction("atd-constraint", "Add an constraint", IconManager.imgic1078, IconManager.imgic1078, "Constraint", "Add a constraint to the currently opened attack tree diagram", 0);
actions[ATD_COUNTERMEASURE] = new TAction("atd-countermeasure", "Add a countermeasure", IconManager.imgic1072, IconManager.imgic1072, "Countermeasure", "Add a countermeasure to the currently opened attack tree diagram", 0);
actions[ATD_COUNTERMEASURE] = new TAction("atd-countermeasure", "Add a countermeasure", IconManager.imgic1082, IconManager.imgic1082, "Countermeasure", "Add a countermeasure to the currently opened attack tree diagram", 0);
actions[ATD_COUNTERMEASURE_CONNECTOR] = new TAction("atd-countermeasure-connector", "Add a connector between attacks / countermeasures", IconManager.imgic1080, IconManager.imgic1080, "Connector", "Add a connector between attacks / countermeasures of the currently opened attack tree diagram", 0);
// TURTLE-OS
......
......@@ -140,7 +140,7 @@ public class ATDCountermeasure extends TGCScalableWithInternalComponent implemen
// Core of the attack
Color c = g.getColor();
g.draw3DRect(x, y, width, height, true);
g.setColor(ColorManager.ATD_ATTACK);
g.setColor(ColorManager.ATD_COUNTERMEASURE);
g.fill3DRect(x+1, y+1, width-1, height-1, true);
......
......@@ -39,7 +39,7 @@
* Class ATDCountermeasureConnector
* Connector used in Attack Tree Diagrams
* Creation: 06/06/2017
* @version 1.0 06/°6/2017
* @version 1.0 06/06/2017
* @author Ludovic APVRILLE
* @see
*/
......@@ -72,117 +72,16 @@ public class ATDCountermeasureConnector extends TGConnectorWithCommentConnectio
oldScaleFactor = tdp.getZoom();
}
protected void drawLastSegment(Graphics g, int x1, int y1, int x2, int y2){
/*if (Point2D.distance(x1, y1, x2, y2) < GraphicLib.longueur * 1.5) {
g.drawLine(x1, y1, x2, y2);
} else {
GraphicLib.arrowWithLine(g, 1, 0, 10, x1, y1, x2, y2, true);
}*/
//g.drawLine(x1, y1, x2, y2);
int cz = (int)(tdp.getZoom() * c);
// white squares only if ATDConstraint
TGConnectingPoint cp = p1;
CDElement comp = cp.getFather();
int decX = 0;
int decY = 0;
// Origin = constraint?
if (comp instanceof ATDConstraint) {
if (comp.getX() == cp.getX()) {
decX = 0;
} else if (comp.getX() + comp.getWidth() == cp.getX()) {
decX = -cz;
} else {
decX = -cz/2;
}
if (comp.getY() == cp.getY()) {
decY = 0;
} else if (comp.getY() + comp.getHeight() == cp.getY()) {
decY = -cz;
} else {
decY = -cz/2;
}
g.drawRect(cp.getX() + decX, cp.getY() + decY, cz, cz);
}
cp = p2;
comp = cp.getFather();
if (comp instanceof ATDConstraint) {
if (comp.getX() == cp.getX()) {
decX = 0;
} else if (comp.getX() + comp.getWidth() == cp.getX()) {
decX = -cz;
} else {
decX = -cz/2;
}
if (comp.getY() == cp.getY()) {
decY = 0;
} else if (comp.getY() + comp.getHeight() == cp.getY()) {
decY = -cz;
} else {
decY = -cz/2;
}
g.drawRect(x2+decX, y2+decY, cz, cz);
}
/*g.fillRect(x2-(cz/2), y2-(cz/2), cz, cz);
g.fillRect(p1.getX()-(cz/2), p1.getY()-(cz/2), cz, cz);*/
Point p = new Point(x2, y2);
if (p == null) {
//System.out.println("null point");
} else {
if (Point2D.distance(x1, y1, p.x, p.y) < GraphicLib.longueur * 1.5) {
//System.out.println("p.x=" + p.x + " x1=" + x1 + "p.y=" + p.y + " y1=" + y1);
if ((p.x != x1) || (p.y != y1)) {
g.drawLine(x1, y1, p.x, p.y);
//System.out.println("drawn");
}
} else {
GraphicLib.arrowWithLine(g, 1, 0, 10, x1, y1, p.x, p.y, true);
}
}
if (value.length() > 0) {
Font f = g.getFont();
if (tdp.getZoom() < 1) {
Font f0 = f.deriveFont((float)(fontSize*tdp.getZoom()));
g.setFont(f0);
}
g.drawString(value, x2+(cz/2)+1, y2);
g.setFont(f);
}
protected void drawLastSegment(Graphics g, int x1, int y1, int x2, int y2){
GraphicLib.dashedLine(g, x1, y1, x2, y2);
}
public boolean editOndoubleClick(JFrame frame) {
String oldValue = value;
String text = getName() + "Connector";
String s = (String)JOptionPane.showInputDialog(frame, text,
"Setting value", JOptionPane.PLAIN_MESSAGE, IconManager.imgic101,
null,
getValue());
if (s != null) {
s = Conversion.removeFirstSpaces(s);
}
//System.out.println("emptytext=" + emptyText);
if ((s != null) && (!s.equals(oldValue))) {
setValue(s);
return true;
}
return false;
protected void drawMiddleSegment(Graphics g, int x1, int y1, int x2, int y2) {
GraphicLib.dashedLine(g, x1, y1, x2, y2);
}
public int getType() {
return TGComponentManager.ATD_COUNTERMEASURE_CONNECTOR;
}
......
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