Browse Source

无JIRA任务 sonar问题修复

research/11.0
Lanlan 5 years ago
parent
commit
1bb196feb5
  1. 9
      designer-base/src/main/java/com/fr/design/icon/BorderIcon.java
  2. 2
      designer-base/src/main/java/com/fr/design/icon/LockIcon.java
  3. 2
      designer-base/src/main/java/com/fr/design/icon/WarningIcon.java
  4. 5
      designer-base/src/main/java/com/fr/design/layout/FRGUIPaneFactory.java
  5. 25
      designer-base/src/main/java/com/fr/design/layout/TableLayout.java

9
designer-base/src/main/java/com/fr/design/icon/BorderIcon.java

@ -1,5 +1,6 @@
package com.fr.design.icon;
import com.fr.stable.AssistUtils;
import java.awt.Color;
import java.awt.Component;
import java.awt.Graphics;
@ -43,13 +44,13 @@ public class BorderIcon implements Icon {
if (lineStyle == Constants.LINE_MEDIUM
|| lineStyle == Constants.LINE_THICK) {
lineStyle = Constants.LINE_MEDIUM;
if (x1 == x2) {
if (x1 == y1) {
if (AssistUtils.equals(x1, x2)) {
if (AssistUtils.equals(x1, y1)) {
GraphHelper.drawLine(g, x1, y1 - 1, x2, y2 + 1, lineStyle);
} else {
GraphHelper.drawLine(g, x1, y1, x2, y2 + 1, lineStyle);
}
} else if (y1 == y2) {
} else if (AssistUtils.equals(y1, y2)) {
GraphHelper.drawLine(g, x1, y1, x2 + 1, y2, lineStyle);
}
} else if (lineStyle == Constants.LINE_THIN
@ -57,7 +58,7 @@ public class BorderIcon implements Icon {
GraphHelper.drawLine(g, x1, y1, x2, y2, lineStyle);
} else {
lineStyle = Constants.LINE_DOT;
if (y1 == x2 && x2 == y2) {
if (AssistUtils.equals(y1, x2) && AssistUtils.equals(x2, y2)) {
GraphHelper.drawLine(g, x1, y1, x2 + 1, y2, lineStyle);
} else {
GraphHelper.drawLine(g, x1, y1, x2, y2, lineStyle);

2
designer-base/src/main/java/com/fr/design/icon/LockIcon.java

@ -35,7 +35,7 @@ public class LockIcon extends ImageIcon {
}
@Override
public void paintIcon(Component c, Graphics g, int x, int y) {
public synchronized void paintIcon(Component c, Graphics g, int x, int y) {
if (mainImage != null) {
g.drawImage(mainImage, x, y, c);
}

2
designer-base/src/main/java/com/fr/design/icon/WarningIcon.java

@ -37,7 +37,7 @@ public class WarningIcon extends ImageIcon {
}
@Override
public void paintIcon(Component c, Graphics g, int x, int y) {
public synchronized void paintIcon(Component c, Graphics g, int x, int y) {
if (mainImage != null) {
g.drawImage(mainImage, x, y, c);
}

5
designer-base/src/main/java/com/fr/design/layout/FRGUIPaneFactory.java

@ -3,6 +3,7 @@ package com.fr.design.layout;
import com.fr.design.border.UITitledBorder;
import com.fr.design.gui.ilable.UILabel;
import com.fr.stable.AssistUtils;
import javax.swing.BorderFactory;
import javax.swing.BoxLayout;
import javax.swing.Icon;
@ -562,9 +563,9 @@ public class FRGUIPaneFactory {
float i = Math.abs((((int) m + (int) (m + 1)) / WIDTHABS_PARA_F) - m);
float j = Math.abs((((int) n + (int) (n + 1)) / WIDTHABS_PARA_F) - n);
float x = i > j ? i : j;
if (x == i) {
if (AssistUtils.equals(x, i)) {
w = Math.round(m) * WIDTH_PARA_INT - WIDTH_OFFSET_M;
} else if (x == j) {
} else if (AssistUtils.equals(x, j)) {
w = Math.round(n) * WIDTH_PARA_INT - WIDTH_OFFSET_N;
}
return w;

25
designer-base/src/main/java/com/fr/design/layout/TableLayout.java

@ -1,6 +1,7 @@
package com.fr.design.layout;
import com.fr.stable.AssistUtils;
import java.awt.Component;
import java.awt.ComponentOrientation;
import java.awt.Container;
@ -399,17 +400,17 @@ public class TableLayout implements LayoutManager2, Serializable {
// Make sure rows and columns are valid
for (int counter = 0; counter < crSpec[C].length; counter++)
if ((crSpec[C][counter] < 0.0) &&
(crSpec[C][counter] != FILL) &&
(crSpec[C][counter] != PREFERRED) &&
(crSpec[C][counter] != MINIMUM)) {
!AssistUtils.equals(crSpec[C][counter], FILL) &&
!AssistUtils.equals(crSpec[C][counter], PREFERRED) &&
!AssistUtils.equals(crSpec[C][counter], MINIMUM)) {
crSpec[C][counter] = 0.0;
}
for (int counter = 0; counter < crSpec[R].length; counter++)
if ((crSpec[R][counter] < 0.0) &&
(crSpec[R][counter] != FILL) &&
(crSpec[R][counter] != PREFERRED) &&
(crSpec[R][counter] != MINIMUM)) {
!AssistUtils.equals(crSpec[R][counter], FILL) &&
!AssistUtils.equals(crSpec[R][counter], PREFERRED) &&
!AssistUtils.equals(crSpec[R][counter], MINIMUM)) {
crSpec[R][counter] = 0.0;
}
@ -556,9 +557,9 @@ public class TableLayout implements LayoutManager2, Serializable {
// Make sure rows are valid
for (int counter = 0; counter < crSpec[z].length; counter++)
if ((crSpec[z][counter] < 0.0) &&
(crSpec[z][counter] != FILL) &&
(crSpec[z][counter] != PREFERRED) &&
(crSpec[z][counter] != MINIMUM)) {
!AssistUtils.equals(crSpec[z][counter], FILL) &&
!AssistUtils.equals(crSpec[z][counter], PREFERRED) &&
!AssistUtils.equals(crSpec[z][counter], MINIMUM)) {
crSpec[z][counter] = 0.0;
}
@ -641,9 +642,9 @@ public class TableLayout implements LayoutManager2, Serializable {
protected void setCr(int z, int i, double size) {
// Make sure size is valid
if ((size < 0.0) &&
(size != FILL) &&
(size != PREFERRED) &&
(size != MINIMUM)) {
!AssistUtils.equals(size, FILL) &&
!AssistUtils.equals(size, PREFERRED) &&
!AssistUtils.equals(size, MINIMUM)) {
size = 0.0;
}

Loading…
Cancel
Save