Skip to content
Snippets Groups Projects
Commit ceba0b37 authored by Ludovic Apvrille's avatar Ludovic Apvrille
Browse files

Adding handling of countermeasure and attack description saving and loading

parent ad8fd416
No related branches found
No related tags found
No related merge requests found
......@@ -42,6 +42,7 @@ package ui.atd;
import myutil.Conversion;
import myutil.GraphicLib;
import myutil.TraceManager;
import org.apache.batik.anim.timing.Trace;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
......@@ -365,7 +366,7 @@ CanBeDisabled*/ {
@Override
protected String translateExtraParam() {
StringBuffer sb = new StringBuffer("<extraparam>\n");
sb.append("<info description=\"" + description);
sb.append("<info description=\"" + description.replaceAll("\n", "&#10;"));
sb.append("\" root=\"" + isRootAttack);
sb.append("\" cost=\"" + attackCost);
sb.append("\" experience=\"" + attackExperience);
......@@ -403,6 +404,7 @@ CanBeDisabled*/ {
experience = elt.getAttribute("experience");
}
if (sdescription != null) {
TraceManager.addDev("Description of attack: " + sdescription);
description = sdescription;
}
if (isRoot != null) {
......
......@@ -68,7 +68,6 @@ public class ATDCountermeasure extends TGCScalableWithInternalComponent implemen
protected String oldValue = "";
protected String description = "";
protected String[] descriptions;
private String stereotype = "countermeasure";
private static double percentageDecPar = 0.15;
......@@ -205,10 +204,7 @@ public class ATDCountermeasure extends TGCScalableWithInternalComponent implemen
g.setFont(fold);
}
public void makeValue() {
descriptions = Conversion.wrapText(description);
}
private Polygon getMyPolygon() {
Polygon p = new Polygon();
......@@ -287,7 +283,6 @@ public class ATDCountermeasure extends TGCScalableWithInternalComponent implemen
if (dialog.getDescription() != null) {
description = dialog.getDescription();
makeValue();
}
if (error) {
......@@ -365,20 +360,11 @@ public class ATDCountermeasure extends TGCScalableWithInternalComponent implemen
throw new MalformedModelingException();
}
makeValue();
}
protected String translateExtraParam() {
StringBuffer sb = new StringBuffer("<extraparam>\n");
// if (descriptions != null) {
// for (int i = 0; i < descriptions.length; i++) {
// sb.append("<textline data=\"");
// sb.append(GTURTLEModeling.transformString(descriptions[i]));
// sb.append("\" />\n");
// }
// }
sb.append("<info description=\"" + description);
sb.append("<info description=\"" + description.replaceAll("\n", "&#10;"));
sb.append("\" />\n");
sb.append("</extraparam>\n");
return new String(sb);
......
......@@ -42,6 +42,7 @@
package ui.window;
import attacktrees.Attack;
import myutil.TraceManager;
import ui.util.IconManager;
import ui.atd.ATDAttack;
......@@ -130,6 +131,7 @@ public class JDialogAttack extends JDialogBase implements ActionListener {
panel2.add(new JLabel("Description:"), c2);
c1.gridwidth = GridBagConstraints.REMAINDER; //end row
description = new JTextArea(4, 20);
TraceManager.addDev("Description=" + attack.getDescription());
description.setText(attack.getDescription());
JScrollPane scrollPane = new JScrollPane(description);
scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment