From 24e281ad15c455b89b6ec4de28d6bbfbf7ae4afd Mon Sep 17 00:00:00 2001 From: Moemoea Fierin <moemoea.fierin@epita.fr> Date: Thu, 3 Oct 2019 17:50:39 +0200 Subject: [PATCH] [ZOOM] Small fixes: function name, overrides --- .../AvatarMADBelongsToCompositionConnector.java | 3 ++- .../ui/avatarmad/AvatarMADCompositionConnector.java | 1 + src/main/java/ui/avatarmad/AvatarMADConnector.java | 5 +++-- .../AvatarMethodologyDiagramName.java | 10 +++++----- src/main/java/ui/avatarrd/AvatarRDCopyConnector.java | 5 +++-- src/main/java/ui/avatarrd/AvatarRDDeriveConnector.java | 9 ++++++--- 6 files changed, 20 insertions(+), 13 deletions(-) diff --git a/src/main/java/ui/avatarmad/AvatarMADBelongsToCompositionConnector.java b/src/main/java/ui/avatarmad/AvatarMADBelongsToCompositionConnector.java index f6265b4493..841eb99fad 100644 --- a/src/main/java/ui/avatarmad/AvatarMADBelongsToCompositionConnector.java +++ b/src/main/java/ui/avatarmad/AvatarMADBelongsToCompositionConnector.java @@ -71,7 +71,8 @@ public class AvatarMADBelongsToCompositionConnector extends TGConnectorWithComm // oldScaleFactor = tdp.getZoom(); // rescaled = true; } - + + @Override protected void drawLastSegment(Graphics g, int x1, int y1, int x2, int y2) { if ((p == null) || (rescaled) || (xp1 != x1) || (xp2 != x2) || (yp1 != y1) || (yp2 != y2)){ p = new Polygon(); diff --git a/src/main/java/ui/avatarmad/AvatarMADCompositionConnector.java b/src/main/java/ui/avatarmad/AvatarMADCompositionConnector.java index 8708601a6c..8ad78918ce 100644 --- a/src/main/java/ui/avatarmad/AvatarMADCompositionConnector.java +++ b/src/main/java/ui/avatarmad/AvatarMADCompositionConnector.java @@ -115,6 +115,7 @@ public class AvatarMADCompositionConnector extends TGConnectorWithCommentConnec return null; }*/ + @Override public int getType() { return TGComponentManager.AVATARMAD_COMPOSITION_CONNECTOR; } diff --git a/src/main/java/ui/avatarmad/AvatarMADConnector.java b/src/main/java/ui/avatarmad/AvatarMADConnector.java index 30b549c3bb..8f8389c186 100644 --- a/src/main/java/ui/avatarmad/AvatarMADConnector.java +++ b/src/main/java/ui/avatarmad/AvatarMADConnector.java @@ -52,7 +52,7 @@ public abstract class AvatarMADConnector extends TGConnectorWithCommentConnectio return null; } - /* + /** * Issue #69 * @return */ @@ -68,9 +68,10 @@ public abstract class AvatarMADConnector extends TGConnectorWithCommentConnectio return visitor.isCanBeDisabled(); } - /* Issue #69 + /** Issue #69 * @return */ + @Override public boolean isEnabled( boolean checkBranch ) { if ( checkBranch && p2 != null ) { final ForwardComponentsEnabledVisitor visitor = new ForwardComponentsEnabledVisitor(); diff --git a/src/main/java/ui/avatarmethodology/AvatarMethodologyDiagramName.java b/src/main/java/ui/avatarmethodology/AvatarMethodologyDiagramName.java index ff56e0cc54..ccbcdb82d2 100755 --- a/src/main/java/ui/avatarmethodology/AvatarMethodologyDiagramName.java +++ b/src/main/java/ui/avatarmethodology/AvatarMethodologyDiagramName.java @@ -136,7 +136,7 @@ public class AvatarMethodologyDiagramName extends TGCScalableWithoutInternalComp g.setFont(font.deriveFont(fontStyle)); } - private void GestionOfValidations(Graphics g, Font font) + private void manageValidations(Graphics g, Font font) { int widthText = g.getFontMetrics().stringWidth(value); int widthFather = getFather().getWidth(); @@ -194,8 +194,8 @@ public class AvatarMethodologyDiagramName extends TGCScalableWithoutInternalComp protected boolean canTextGoInTheBox(Graphics g, int fontSize, String text, int iconSize) { myHeight = g.getFontMetrics().getHeight(); - int txtWidth = g.getFontMetrics().stringWidth(text) + (X_MARGIN * 2); - int spaceTakenByIcon = iconSize + X_MARGIN; + //int txtWidth = g.getFontMetrics().stringWidth(text) + (X_MARGIN * 2); + //int spaceTakenByIcon = iconSize + X_MARGIN; return (fontSize + (Y_MARGIN * 2) < myHeight); // enough space in height //&& (txtWidth + spaceTakenByIcon < myWidth) // enough space in width //; @@ -210,7 +210,7 @@ public class AvatarMethodologyDiagramName extends TGCScalableWithoutInternalComp { // Strings String textDiagramRef = value; - int fontSize = g.getFont().getSize(); + //int fontSize = g.getFont().getSize(); //boolean tooBig = !canTextGoInTheBox(g, fontSize, textDiagramRef, 0); if (!isTextReadable(g) /*|| canTextGoInTheBox(g, fontSize, textDiagramRef, 0)*/) return; @@ -218,7 +218,7 @@ public class AvatarMethodologyDiagramName extends TGCScalableWithoutInternalComp g.drawString(textDiagramRef, x, y); //validation and String - GestionOfValidations(g, f); + manageValidations(g, f); } /* @Override diff --git a/src/main/java/ui/avatarrd/AvatarRDCopyConnector.java b/src/main/java/ui/avatarrd/AvatarRDCopyConnector.java index 67a9b3fe50..77f21d9ab2 100755 --- a/src/main/java/ui/avatarrd/AvatarRDCopyConnector.java +++ b/src/main/java/ui/avatarrd/AvatarRDCopyConnector.java @@ -67,7 +67,7 @@ public class AvatarRDCopyConnector extends TGConnectorWithCommentConnectionPoin myImageIcon = IconManager.imgic1010; } - + @Override protected void drawLastSegment(Graphics g, int x1, int y1, int x2, int y2){ //g.drawLine(x1, y1, x2, y2); @@ -87,7 +87,7 @@ public class AvatarRDCopyConnector extends TGConnectorWithCommentConnectionPoin g.drawString(value, (x1 + x2 - w) / 2, (y1 + y2)/2); g.setFont(old); } - + @Override public TGComponent extraIsOnOnlyMe(int x1, int y1) { if (GraphicLib.isInRectangle(x1, y1, (p1.getX() + p2.getX() - w) / 2, (p1.getY() + p2.getY())/2 - h, w, h)) { return this; @@ -95,6 +95,7 @@ public class AvatarRDCopyConnector extends TGConnectorWithCommentConnectionPoin return null; } + @Override public int getType() { return TGComponentManager.AVATARRD_COPY_CONNECTOR; } diff --git a/src/main/java/ui/avatarrd/AvatarRDDeriveConnector.java b/src/main/java/ui/avatarrd/AvatarRDDeriveConnector.java index d583b4f745..7df892e6ba 100755 --- a/src/main/java/ui/avatarrd/AvatarRDDeriveConnector.java +++ b/src/main/java/ui/avatarrd/AvatarRDDeriveConnector.java @@ -67,7 +67,7 @@ public class AvatarRDDeriveConnector extends TGConnectorWithCommentConnectionPo myImageIcon = IconManager.imgic1008; } - + @Override protected void drawLastSegment(Graphics g, int x1, int y1, int x2, int y2){ //g.drawLine(x1, y1, x2, y2); @@ -87,14 +87,17 @@ public class AvatarRDDeriveConnector extends TGConnectorWithCommentConnectionPo g.drawString(value, (x1 + x2 - w) / 2, (y1 + y2)/2); g.setFont(old); } - + + @Override public TGComponent extraIsOnOnlyMe(int x1, int y1) { if (GraphicLib.isInRectangle(x1, y1, (p1.getX() + p2.getX() - w) / 2, (p1.getY() + p2.getY())/2 - h, w, h)) { return this; } + return null; } - + + @Override public int getType() { return TGComponentManager.AVATARRD_DERIVE_CONNECTOR; } -- GitLab