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

Adding TPT logo to AVATAR documentation

parent 2e56d847
No related branches found
No related tags found
No related merge requests found
File added
...@@ -50,6 +50,7 @@ import ui.*; ...@@ -50,6 +50,7 @@ import ui.*;
import ui.avatarsmd.AvatarSMDPanel; import ui.avatarsmd.AvatarSMDPanel;
import ui.util.IconManager; import ui.util.IconManager;
import ui.window.JDialogAvatarBlock; import ui.window.JDialogAvatarBlock;
import ui.window.JDialogIDAndStereotype;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;
...@@ -185,7 +186,8 @@ public class AvatarBDBlock extends TGCScalableWithInternalComponent implements S ...@@ -185,7 +186,8 @@ public class AvatarBDBlock extends TGCScalableWithInternalComponent implements S
graph.drawRect(this.x, this.y, this.width, this.height); graph.drawRect(this.x, this.y, this.width, this.height);
// Draw inner rectangle // Draw inner rectangle
graph.setColor(ColorManager.AVATAR_BLOCK); //graph.setColor(ColorManager.AVATAR_BLOCK);
graph.setColor(BLOCK_TYPE_COLOR.get(typeStereotype));
graph.fillRect(this.x + 1, this.y + 1, this.width - 1, this.height - 1); graph.fillRect(this.x + 1, this.y + 1, this.width - 1, this.height - 1);
graph.setColor(c); graph.setColor(c);
...@@ -209,11 +211,8 @@ public class AvatarBDBlock extends TGCScalableWithInternalComponent implements S ...@@ -209,11 +211,8 @@ public class AvatarBDBlock extends TGCScalableWithInternalComponent implements S
Font font = graph.getFont(); Font font = graph.getFont();
String ster;
if (!this.isCryptoBlock()) String ster = BLOCK_TYPE_STR.get(typeStereotype);
ster = "<<" + stereotype + ">>";
else
ster = "<<" + stereotypeCrypto + ">>";
if (this.rescaled && !this.tdp.isScaled()) { if (this.rescaled && !this.tdp.isScaled()) {
this.rescaled = false; this.rescaled = false;
...@@ -574,45 +573,84 @@ public class AvatarBDBlock extends TGCScalableWithInternalComponent implements S ...@@ -574,45 +573,84 @@ public class AvatarBDBlock extends TGCScalableWithInternalComponent implements S
} }
// On the name ? // On the name ?
if ((limitName == -1 && _y <= y + 2 * currentFontSize) || _y < limitName) { if ((limitName == -1 && _y <= y + 2 * currentFontSize) || _y < limitName) {
JDialogIDAndStereotype dialog = new JDialogIDAndStereotype(frame, "Setting Block ID", BLOCK_TYPE_STR.toArray(new String[0]), getValue
(), typeStereotype, BLOCK_TYPE_COLOR.toArray(new Color[0]), ColorManager.AVATAR_BLOCK);
//dialog.setSize(400, 300);
GraphicLib.centerOnParent(dialog, 400, 300);
// dialog.show(); // blocked until dialog has been closed
oldValue = value; oldValue = value;
dialog.setVisible(true);
if (dialog.hasBeenCancelled()) {
return false;
}
//String text = getName() + ": "; String s = dialog.getName();
String s = (String) JOptionPane.showInputDialog(frame, "Block name",
"setting value", JOptionPane.PLAIN_MESSAGE, IconManager.imgic101,
null,
getValue());
if ((s != null) && (s.length() > 0) && (!s.equals(oldValue))) { if ((s != null) && (s.length() > 0)){
//boolean b; //boolean b;
if (!TAttribute.isAValidId(s, false, false)) { if (!s.equals(oldValue)) {
if (!TAttribute.isAValidId(s, false, false)) {
JOptionPane.showMessageDialog(frame,
"Could not change the name of the Block: the new name is not a valid name",
"Error",
JOptionPane.INFORMATION_MESSAGE);
return false;
}
if (!tdp.isAvatarBlockNameUnique(s)) {
JOptionPane.showMessageDialog(frame,
"Could not change the name of the Block: the new name is already in use",
"Error",
JOptionPane.INFORMATION_MESSAGE);
return false;
}
setValue(s);
recalculateSize();
}
/*if (!(tdp.actionOnDoubleClick(this))) {
JOptionPane.showMessageDialog(frame, JOptionPane.showMessageDialog(frame,
"Could not change the name of the Block: the new name is not a valid name", "Could not change the name of the Requirement: this name is already in use",
"Error", "Error",
JOptionPane.INFORMATION_MESSAGE); JOptionPane.INFORMATION_MESSAGE);
setValue(oldValue);
return false; return false;
} }*/
// Setting stereotype
s = dialog.getStereotype().trim();
if (!tdp.isAvatarBlockNameUnique(s)) { if (!TAttribute.isAValidId(s, false, false)) {
JOptionPane.showMessageDialog(frame, JOptionPane.showMessageDialog(frame,
"Could not change the name of the Block: the new name is already in use", "Could not use the new stereotype: the new stereotype name is not valid",
"Error", "Error",
JOptionPane.INFORMATION_MESSAGE); JOptionPane.INFORMATION_MESSAGE);
return false; return false;
} }
setValue(s); int rgb = dialog.getColor();
recalculateSize();
if (tdp.actionOnDoubleClick(this)) { TraceManager.addDev("RGBColor:" + rgb + " vs default color:" + ColorManager.AVATAR_BLOCK.getRGB());
return true;
addStereotype(s, rgb);
TraceManager.addDev("My stereotype=" + BLOCK_TYPE_STR.get(typeStereotype) + " color=" + BLOCK_TYPE_COLOR.get(typeStereotype).getRGB());
if (isCryptoBlock()) {
addCryptoElements();
} else { } else {
JOptionPane.showMessageDialog(frame, removeCryptoElements();
"Could not change the name of the Block: frame error",
"Error",
JOptionPane.INFORMATION_MESSAGE);
setValue(oldValue);
} }
return true;
} }
return false; return false;
} }
...@@ -809,7 +847,7 @@ public class AvatarBDBlock extends TGCScalableWithInternalComponent implements S ...@@ -809,7 +847,7 @@ public class AvatarBDBlock extends TGCScalableWithInternalComponent implements S
protected String translateExtraParam() { protected String translateExtraParam() {
StringBuffer sb = new StringBuffer("<extraparam>\n"); StringBuffer sb = new StringBuffer("<extraparam>\n");
sb.append("<reqType data=\""); sb.append("<blockType data=\"");
sb.append(BLOCK_TYPE_STR.get(typeStereotype)); sb.append(BLOCK_TYPE_STR.get(typeStereotype));
sb.append("\" color=\""); sb.append("\" color=\"");
sb.append(BLOCK_TYPE_COLOR.get(typeStereotype).getRGB()); sb.append(BLOCK_TYPE_COLOR.get(typeStereotype).getRGB());
...@@ -921,10 +959,11 @@ public class AvatarBDBlock extends TGCScalableWithInternalComponent implements S ...@@ -921,10 +959,11 @@ public class AvatarBDBlock extends TGCScalableWithInternalComponent implements S
this.myAttributes.add(ta); this.myAttributes.add(ta);
} }
} }
if (elt.getTagName().equals("reqType")) { if (elt.getTagName().equals("blockType")) {
// //
s = elt.getAttribute("data"); s = elt.getAttribute("data");
String tmp3 = elt.getAttribute("color"); String tmp3 = elt.getAttribute("color");
TraceManager.addDev("stereotype=" + s + " color=" + tmp3);
int rgb = ColorManager.AVATAR_REQUIREMENT_TOP.getRGB(); int rgb = ColorManager.AVATAR_REQUIREMENT_TOP.getRGB();
try { try {
rgb = Integer.decode(tmp3).intValue(); rgb = Integer.decode(tmp3).intValue();
...@@ -1025,6 +1064,7 @@ public class AvatarBDBlock extends TGCScalableWithInternalComponent implements S ...@@ -1025,6 +1064,7 @@ public class AvatarBDBlock extends TGCScalableWithInternalComponent implements S
} }
public boolean addStereotype(String s, int rgb) { public boolean addStereotype(String s, int rgb) {
TraceManager.addDev("Adding stereotype for " + s + " with color " + rgb);
int index = -1; int index = -1;
String sLower = s.toLowerCase(); String sLower = s.toLowerCase();
for (int i=0; i<BLOCK_TYPE_STR.size(); i++) { for (int i=0; i<BLOCK_TYPE_STR.size(); i++) {
......
...@@ -397,7 +397,7 @@ public class AvatarRDRequirement extends TGCScalableWithInternalComponent implem ...@@ -397,7 +397,7 @@ public class AvatarRDRequirement extends TGCScalableWithInternalComponent implem
getValue());*/ getValue());*/
JDialogIDAndStereotype dialog = new JDialogIDAndStereotype(frame, "Setting Requirement ID", REQ_TYPE_STR.toArray(new String[0]), getValue JDialogIDAndStereotype dialog = new JDialogIDAndStereotype(frame, "Setting Requirement ID", REQ_TYPE_STR.toArray(new String[0]), getValue
(), reqType, REQ_TYPE_COLOR.toArray(new Color[0])); (), reqType, REQ_TYPE_COLOR.toArray(new Color[0]),ColorManager.AVATAR_REQUIREMENT_TOP);
//dialog.setSize(400, 300); //dialog.setSize(400, 300);
GraphicLib.centerOnParent(dialog, 400, 300); GraphicLib.centerOnParent(dialog, 400, 300);
// dialog.show(); // blocked until dialog has been closed // dialog.show(); // blocked until dialog has been closed
......
...@@ -67,6 +67,7 @@ public class JDialogIDAndStereotype extends JDialogBase implements ActionListene ...@@ -67,6 +67,7 @@ public class JDialogIDAndStereotype extends JDialogBase implements ActionListene
private Color[] colors; private Color[] colors;
private String currentName; private String currentName;
private int currentStereotype; private int currentStereotype;
private Color defaultColor;
private JPanel panel1; private JPanel panel1;
...@@ -84,7 +85,7 @@ public class JDialogIDAndStereotype extends JDialogBase implements ActionListene ...@@ -84,7 +85,7 @@ public class JDialogIDAndStereotype extends JDialogBase implements ActionListene
/** Creates new form */ /** Creates new form */
public JDialogIDAndStereotype(Frame _f, String _title, public JDialogIDAndStereotype(Frame _f, String _title,
String[] _availableStereotypes, String _currentName, String[] _availableStereotypes, String _currentName,
int _currentStereotype, Color[] _colors) { int _currentStereotype, Color[] _colors, Color _defaultColor) {
super(_f, _title, true); super(_f, _title, true);
...@@ -92,6 +93,7 @@ public class JDialogIDAndStereotype extends JDialogBase implements ActionListene ...@@ -92,6 +93,7 @@ public class JDialogIDAndStereotype extends JDialogBase implements ActionListene
colors = _colors; colors = _colors;
currentName = _currentName; currentName = _currentName;
currentStereotype = _currentStereotype; currentStereotype = _currentStereotype;
defaultColor = _defaultColor;
initComponents(); initComponents();
myInitComponents(); myInitComponents();
...@@ -158,7 +160,7 @@ public class JDialogIDAndStereotype extends JDialogBase implements ActionListene ...@@ -158,7 +160,7 @@ public class JDialogIDAndStereotype extends JDialogBase implements ActionListene
panel1.add(colorButton, c1); panel1.add(colorButton, c1);
useDefaultColor = new JButton("Use default color"); useDefaultColor = new JButton("Use default color");
useDefaultColor.setBackground(ColorManager.AVATAR_REQUIREMENT_TOP); useDefaultColor.setBackground(defaultColor);
useDefaultColor.addActionListener(this); useDefaultColor.addActionListener(this);
panel1.add(useDefaultColor, c1); panel1.add(useDefaultColor, c1);
//panel1.setEditable(true); //panel1.setEditable(true);
...@@ -200,7 +202,7 @@ public class JDialogIDAndStereotype extends JDialogBase implements ActionListene ...@@ -200,7 +202,7 @@ public class JDialogIDAndStereotype extends JDialogBase implements ActionListene
} }
public void selectDefaultColor() { public void selectDefaultColor() {
colorButton.setBackground(ColorManager.AVATAR_REQUIREMENT_TOP); colorButton.setBackground(defaultColor);
} }
public void selectStereotype() { public void selectStereotype() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment