Browse Source

消除PMD错误

master
fanglei 8 years ago
parent
commit
821ef73086
  1. 5
      designer_base/src/com/fr/design/beans/location/MoveUtils.java
  2. 4
      designer_form/src/com/fr/design/mainframe/ConnectorHelper.java

5
designer_base/src/com/fr/design/beans/location/MoveUtils.java

@ -16,6 +16,7 @@ import java.util.ArrayList;
public class MoveUtils {
public static final int SORPTION_UNIT = 5;
private static final int EQUIDISTANTLINE_UNIT = 4;
public static WidgetForbidWindow widgetForbidWindow = new WidgetForbidWindow();
@ -479,10 +480,10 @@ public class MoveUtils {
}
private static void processEquidistantLinesList(PlacePointing pEquidistantX, PlacePointing pEquidistantY, Rectangle operatingRectangle){
EquidistantLine[] equidistantLines1 = new EquidistantLine[4];
EquidistantLine[] equidistantLines1 = new EquidistantLine[EQUIDISTANTLINE_UNIT];
//先按方向处理,只保留四个方向上距离最近
for(int count = 0; count < equidistantLines.size(); count++){
for (int direction = 0; direction < 4; direction++){
for (int direction = 0; direction < EQUIDISTANTLINE_UNIT; direction++){
if(equidistantLines.get(count).getDirection() == (direction + 1)){//direction 1,2,3,4 分别对应top,left,bottom,right
if(equidistantLines1[direction] != null
&& equidistantLines1[direction].getDistance() > equidistantLines.get(count).getDistance()

4
designer_form/src/com/fr/design/mainframe/ConnectorHelper.java

@ -20,7 +20,7 @@ public class ConnectorHelper {
public static final int NEAR = 5;
private static double ratio = 0.5;
// TODO 为了消除魔术数错误,我不清楚这个15代表什么,先这样命名了,原作者看到了请改一下
private final static int magicNumber1 = 15;
private final static int MAGICNUMBER = 15;
private ArrayList<Point> drawingPoint;
private FormDesigner designer;
private boolean drawing;
@ -88,7 +88,7 @@ public class ConnectorHelper {
public void createDefalutLine() {
if (drawingPoint != null
&& drawingPoint.size() > 1
&& ConnectorCreator.getMinimumDistance(drawingPoint.get(0), drawingPoint.get(drawingPoint.size() - 1)) > magicNumber1) {
&& ConnectorCreator.getMinimumDistance(drawingPoint.get(0), drawingPoint.get(drawingPoint.size() - 1)) > MAGICNUMBER) {
((XWAbsoluteLayout) designer.getRootComponent()).addConnector(new Connector().addAll(drawingPoint));
}
drawingPoint = null;

Loading…
Cancel
Save