Skip to content
Snippets Groups Projects
Commit 8ee5b8ac authored by Moemoea Fierin's avatar Moemoea Fierin
Browse files

[ZOOM] On Diplodocus TML task Diagram: Issue #31 Fixed Title zoom

- on my way to fix zooms on attributes: just need an element to follow
the last attribute position. If none, need to use the cpt previously
used
parent e10d45d9
No related branches found
No related tags found
1 merge request!287Resolve "Zoom on all diagrams"
...@@ -62,10 +62,11 @@ import java.util.Vector; ...@@ -62,10 +62,11 @@ import java.util.Vector;
* @version 1.0 12/03/2008 * @version 1.0 12/03/2008
*/ */
public class TMLCPrimitiveComponent extends TGCScalableWithInternalComponent implements SwallowTGComponent, SwallowedTGComponent, WithAttributes { public class TMLCPrimitiveComponent extends TGCScalableWithInternalComponent implements SwallowTGComponent, SwallowedTGComponent, WithAttributes {
private int maxFontSize = 14; // #FIXME Debugging
private int maxFontSize = 14;
private int minFontSize = 4; private int minFontSize = 4;
private int currentFontSize = -1; private int currentFontSize = -1;
//private boolean displayText = true; //private boolean displayText = true;
// private int spacePt = 3; // private int spacePt = 3;
private Color myColor; private Color myColor;
...@@ -93,8 +94,10 @@ public class TMLCPrimitiveComponent extends TGCScalableWithInternalComponent imp ...@@ -93,8 +94,10 @@ public class TMLCPrimitiveComponent extends TGCScalableWithInternalComponent imp
super(_x, _y, _minX, _maxX, _minY, _maxY, _pos, _father, _tdp); super(_x, _y, _minX, _maxX, _minY, _maxY, _pos, _father, _tdp);
// Issue #31 // Issue #31
minWidth = 1; //minWidth = 1;
minHeight = 1; //minHeight = 1;
minWidth = 150;
minHeight = 100;
initScaling(200, 150); initScaling(200, 150);
// Issue #31 // Issue #31
...@@ -125,7 +128,58 @@ public class TMLCPrimitiveComponent extends TGCScalableWithInternalComponent imp ...@@ -125,7 +128,58 @@ public class TMLCPrimitiveComponent extends TGCScalableWithInternalComponent imp
actionOnAdd(); actionOnAdd();
} }
/*
private Color choosingColor()
{
if (ColorManager.TML_COMPOSITE_COMPONENT == Color.white)
return Color.white;
else
return new Color(201, 243, 188 - (getMyDepth() * 10), 200);
}*/
@Override
public void internalDrawing(Graphics g)
{
//rectangle + Filling color
Color c = g.getColor();
if (myColor == null) {
if (ColorManager.TML_COMPOSITE_COMPONENT == Color.white)
myColor = Color.white;
else
myColor = new Color(201, 243, 188 - (getMyDepth() * 10), 200);
}
g.drawRect(x, y, width, height);
g.setColor(myColor);
g.fill3DRect(x, y, width, height, true);
g.setColor(c);
//String
int stringWidth = g.getFontMetrics().stringWidth(value);
int centerOfBox = (width - stringWidth) / 2;
g.drawString(value, x + centerOfBox, y + currentFontSize + textY);
// Icon
g.drawImage(scale(IconManager.imgic1200.getImage()), x + width - scale(iconSize) - textX, y + textX, null);
if (isAttacker)
g.drawImage(scale(IconManager.imgic7008.getImage()), x + width - scale(2 * iconSize) - textX, y + 2 * textX, null);
// Attributes
if (tdp.areAttributesVisible())
{
TAttribute attribute;
String attributeStr;
for (int i = 0; i < myAttributes.size(); i++)
{
attribute = myAttributes.get(i);
attributeStr = attribute.toString();
g.drawString(attributeStr, x + textX, y + currentFontSize + textY);
//g.drawString(attributeStr, x + textX, y + currentFontSize);
drawVerification(g, x + textX, y + currentFontSize, attribute.getConfidentialityVerification());
}
}
}
/*
@Override @Override
public void internalDrawing(Graphics g) { public void internalDrawing(Graphics g) {
int w; int w;
...@@ -251,7 +305,7 @@ public class TMLCPrimitiveComponent extends TGCScalableWithInternalComponent imp ...@@ -251,7 +305,7 @@ public class TMLCPrimitiveComponent extends TGCScalableWithInternalComponent imp
} }
g.setFont(fold); g.setFont(fold);
} }*/
public void drawVerification(Graphics g, int x, int y, int checkConfStatus) { public void drawVerification(Graphics g, int x, int y, int checkConfStatus) {
Color c = g.getColor(); Color c = g.getColor();
......
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