Browse Source

REPORT-20327 sonar问题修复

persist/11.0
kerry 5 years ago
parent
commit
dfa8cbe492
  1. 2
      designer-base/src/main/java/com/fr/design/dialog/JWizardPanel.java
  2. 12
      designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java
  3. 40
      designer-base/src/main/java/com/fr/design/style/color/CustomChooserPanel.java
  4. 4
      designer-realize/src/main/java/com/fr/grid/GridUI.java
  5. 2
      designer-realize/src/main/java/com/fr/start/fx/PrismImageLoader2.java

2
designer-base/src/main/java/com/fr/design/dialog/JWizardPanel.java

@ -168,7 +168,7 @@ public class JWizardPanel extends BasicPane {
public void addNotify() { public void addNotify() {
if (firstNotify) { if (firstNotify) {
Font font = stepTitleLabel.getFont(); Font font = stepTitleLabel.getFont();
font = font.deriveFont(Font.BOLD, font.getSize() * 14 / 10.0F); font = font.deriveFont(Font.BOLD, (float) (font.getSize() * 14 / 10.0D));
stepTitleLabel.setFont(font); stepTitleLabel.setFont(font);
firstNotify = false; firstNotify = false;
} }

12
designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java

@ -398,8 +398,8 @@ public class MutilTempalteTabPane extends JComponent {
//画下面的那条线 //画下面的那条线
if (templateStartX < maxWidth) { if (templateStartX < maxWidth) {
GeneralPath generalPath = new GeneralPath(Path2D.WIND_EVEN_ODD, 2); GeneralPath generalPath = new GeneralPath(Path2D.WIND_EVEN_ODD, 2);
generalPath.moveTo((float) templateStartX, getHeight() - 1.0F); generalPath.moveTo((float) templateStartX, (float) (getHeight() - 1.0D));
generalPath.lineTo((float) maxWidth, getHeight() - 1.0F); generalPath.lineTo((float) maxWidth, (float) (getHeight() - 1.0D));
g2d.fill(generalPath); g2d.fill(generalPath);
//TODO hzzz delete //TODO hzzz delete
// g2d.setPaint(UIConstants.LINE_COLOR); // g2d.setPaint(UIConstants.LINE_COLOR);
@ -409,7 +409,7 @@ public class MutilTempalteTabPane extends JComponent {
private void paintDefaultBackground(Graphics2D g2d) { private void paintDefaultBackground(Graphics2D g2d) {
//画默认背景 //画默认背景
g2d.setPaint(new GradientPaint(1, 1, UIConstants.TEMPLATE_TAB_PANE_BACKGROUND, 1, getHeight() - 1.0F, UIConstants.TEMPLATE_TAB_PANE_BACKGROUND)); g2d.setPaint(new GradientPaint(1, 1, UIConstants.TEMPLATE_TAB_PANE_BACKGROUND, 1, (float) (getHeight() - 1.0D), UIConstants.TEMPLATE_TAB_PANE_BACKGROUND));
g2d.fillRect(0, 0, getWidth(), getHeight()); g2d.fillRect(0, 0, getWidth(), getHeight());
} }
@ -535,7 +535,7 @@ public class MutilTempalteTabPane extends JComponent {
double[] x = {templateStartX, templateStartX, templateStartX + realWidth, templateStartX + realWidth, templateStartX}; double[] x = {templateStartX, templateStartX, templateStartX + realWidth, templateStartX + realWidth, templateStartX};
double[] y = {1, getHeight() + 1, getHeight() + 1, 1, 1}; double[] y = {1, getHeight() + 1, getHeight() + 1, 1, 1};
RoundRectangle2D.Double rect1 = new RoundRectangle2D.Double(templateStartX, 1, this.getWidth(), this.getHeight(), 7, 7); RoundRectangle2D.Double rect1 = new RoundRectangle2D.Double(templateStartX, 1, this.getWidth(), this.getHeight(), 7, 7);
g2d.setPaint(new GradientPaint(1, 1, UIConstants.SELECT_TAB, 1, getHeight() - 1.0F, UIConstants.SELECT_TAB)); g2d.setPaint(new GradientPaint(1, 1, UIConstants.SELECT_TAB, 1, (float) (getHeight() - 1.0D), UIConstants.SELECT_TAB));
//选了30度和60度的特殊角度的x,y作为经过的两个点的坐标 //选了30度和60度的特殊角度的x,y作为经过的两个点的坐标
double specialLocation1 = 2.5; double specialLocation1 = 2.5;
double specialLocation2 = 4.330127; double specialLocation2 = 4.330127;
@ -590,9 +590,9 @@ public class MutilTempalteTabPane extends JComponent {
double[] x = {templateStartX, templateStartX, templateStartX + realWidth, templateStartX + realWidth, templateStartX}; double[] x = {templateStartX, templateStartX, templateStartX + realWidth, templateStartX + realWidth, templateStartX};
double[] y = {-1, getHeight() - 1, getHeight() - 1, -1, -1}; double[] y = {-1, getHeight() - 1, getHeight() - 1, -1, -1};
if (selfIndex == mouseOveredIndex) { if (selfIndex == mouseOveredIndex) {
g2d.setPaint(new GradientPaint(1, 1, UIConstants.HOVER_BLUE, 1, getHeight() - 1.0F, UIConstants.HOVER_BLUE)); g2d.setPaint(new GradientPaint(1, 1, UIConstants.HOVER_BLUE, 1, (float) (getHeight() - 1.0D), UIConstants.HOVER_BLUE));
} else { } else {
g2d.setPaint(new GradientPaint(1, 1, UIConstants.SHADOW_GREY, 1, getHeight() - 1.0F, UIConstants.SHADOW_GREY)); g2d.setPaint(new GradientPaint(1, 1, UIConstants.SHADOW_GREY, 1, (float) (getHeight() - 1.0D), UIConstants.SHADOW_GREY));
} }

40
designer-base/src/main/java/com/fr/design/style/color/CustomChooserPanel.java

@ -332,8 +332,8 @@ class CustomChooserPanel extends AbstractColorChooserPanel implements ColorSelec
* @param p The point where the MouseEvent occurred. * @param p The point where the MouseEvent occurred.
*/ */
private void updateS(Point p) { private void updateS(Point p) {
float h = p.x * 1f / IMG_WIDTH; double h = p.x * 1D / IMG_WIDTH;
float b = (IMG_HEIGHT - p.y * 1f) / IMG_HEIGHT; double b = (IMG_HEIGHT - p.y * 1D) / IMG_HEIGHT;
internalChange = true; internalChange = true;
hSpinner.setValue(new Integer((int) (h * H_MAX))); hSpinner.setValue(new Integer((int) (h * H_MAX)));
@ -349,8 +349,8 @@ class CustomChooserPanel extends AbstractColorChooserPanel implements ColorSelec
* @param p The point where the MouseEvent occurred. * @param p The point where the MouseEvent occurred.
*/ */
private void updateB(Point p) { private void updateB(Point p) {
float h = p.x * 1f / IMG_WIDTH; double h = p.x * 1D / IMG_WIDTH;
float s = (IMG_HEIGHT - p.y * 1f) / IMG_HEIGHT; double s = (IMG_HEIGHT - p.y * 1D) / IMG_HEIGHT;
internalChange = true; internalChange = true;
hSpinner.setValue(new Integer((int) (h * H_MAX))); hSpinner.setValue(new Integer((int) (h * H_MAX)));
@ -523,9 +523,9 @@ class CustomChooserPanel extends AbstractColorChooserPanel implements ColorSelec
private void adjustHSLValue(float[] hsbVals) { private void adjustHSLValue(float[] hsbVals) {
if (!spinnerTrigger) { if (!spinnerTrigger) {
hSpinner.setValue(new Integer((int) (hsbVals[0] * HSPINNER_VALUE))); hSpinner.setValue(new Integer((int) ((double) hsbVals[0] * HSPINNER_VALUE)));
sSpinner.setValue(new Integer((int) (hsbVals[1] * SSPINNER_VALUE))); sSpinner.setValue(new Integer((int) ((double) hsbVals[1] * SSPINNER_VALUE)));
bSpinner.setValue(new Integer((int) (hsbVals[2] * LSPINNER_VALUE))); bSpinner.setValue(new Integer((int) ((double) hsbVals[2] * LSPINNER_VALUE)));
} }
switch (locked) { switch (locked) {
case HLOCKED: case HLOCKED:
@ -534,9 +534,9 @@ class CustomChooserPanel extends AbstractColorChooserPanel implements ColorSelec
} }
if (!handlingMouse) { if (!handlingMouse) {
gradientPoint.x = (int) ((1 gradientPoint.x = (int) ((1
- ((Number) sSpinner.getValue()).intValue() / SSPINNER_VALUE) * IMG_WIDTH); - ((Number) sSpinner.getValue()).intValue() / (double) SSPINNER_VALUE) * IMG_WIDTH);
gradientPoint.y = (int) ((1 gradientPoint.y = (int) ((1
- ((Number) bSpinner.getValue()).intValue() / LSPINNER_VALUE) * IMG_HEIGHT); - ((Number) bSpinner.getValue()).intValue() / (double) LSPINNER_VALUE) * IMG_HEIGHT);
} }
break; break;
case SLOCKED: case SLOCKED:
@ -544,9 +544,9 @@ class CustomChooserPanel extends AbstractColorChooserPanel implements ColorSelec
slider.setValue(((Number) sSpinner.getValue()).intValue()); slider.setValue(((Number) sSpinner.getValue()).intValue());
} }
if (!handlingMouse) { if (!handlingMouse) {
gradientPoint.x = (int) (((Number) hSpinner.getValue()).intValue() / HSPINNER_VALUE * IMG_WIDTH); gradientPoint.x = (int) (((Number) hSpinner.getValue()).intValue() / (double) HSPINNER_VALUE * IMG_WIDTH);
gradientPoint.y = (int) ((1 gradientPoint.y = (int) ((1
- ((Number) bSpinner.getValue()).intValue() / LSPINNER_VALUE) * IMG_HEIGHT); - ((Number) bSpinner.getValue()).intValue() / (double) LSPINNER_VALUE) * IMG_HEIGHT);
} }
break; break;
case BLOCKED: case BLOCKED:
@ -554,18 +554,18 @@ class CustomChooserPanel extends AbstractColorChooserPanel implements ColorSelec
slider.setValue(((Number) bSpinner.getValue()).intValue()); slider.setValue(((Number) bSpinner.getValue()).intValue());
} }
if (!handlingMouse) { if (!handlingMouse) {
gradientPoint.x = (int) (((Number) hSpinner.getValue()).intValue() / HSPINNER_VALUE * IMG_WIDTH); gradientPoint.x = (int) (((Number) hSpinner.getValue()).intValue() / (double) HSPINNER_VALUE * IMG_WIDTH);
gradientPoint.y = (int) ((1 gradientPoint.y = (int) ((1
- ((Number) sSpinner.getValue()).intValue() / SSPINNER_VALUE) * IMG_HEIGHT); - ((Number) sSpinner.getValue()).intValue() / (double) SSPINNER_VALUE) * IMG_HEIGHT);
} }
break; break;
} }
} }
private void updateImageAndTrack() { private void updateImageAndTrack() {
float h = ((Number) hSpinner.getValue()).intValue() / HSPINNER_VALUE; float h = (float) (((Number) hSpinner.getValue()).intValue() / (double) HSPINNER_VALUE);
float s = ((Number) sSpinner.getValue()).intValue() / SSPINNER_VALUE; float s = (float) (((Number) sSpinner.getValue()).intValue() / (double) SSPINNER_VALUE);
float b = ((Number) bSpinner.getValue()).intValue() / LSPINNER_VALUE; float b = (float) (((Number) bSpinner.getValue()).intValue() / (double) LSPINNER_VALUE);
spinnerTrigger = true; spinnerTrigger = true;
getColorSelectionModel().setSelectedColor(new Color(Color.HSBtoRGB(h, s, b))); getColorSelectionModel().setSelectedColor(new Color(Color.HSBtoRGB(h, s, b)));
@ -837,12 +837,12 @@ class CustomChooserPanel extends AbstractColorChooserPanel implements ColorSelec
private void updateHLockImage() { private void updateHLockImage() {
int index = 0; int index = 0;
int[] pix = new int[IMG_WIDTH * IMG_HEIGHT]; int[] pix = new int[IMG_WIDTH * IMG_HEIGHT];
float hValue = ((Number) hSpinner.getValue()).intValue() / HSPINNER_VALUE; float hValue = (float)(((Number) hSpinner.getValue()).intValue() / (double) HSPINNER_VALUE );
for (int j = 0; j < IMG_HEIGHT; j++) { for (int j = 0; j < IMG_HEIGHT; j++) {
for (int i = 0; i < IMG_WIDTH; i++) { for (int i = 0; i < IMG_WIDTH; i++) {
pix[index++] = Color.HSBtoRGB(hValue, (IMG_WIDTH - i * 1f) / IMG_WIDTH, pix[index++] = Color.HSBtoRGB(hValue, (float) ((IMG_WIDTH - i * 1D) / IMG_WIDTH),
(IMG_HEIGHT - j * 1f) / IMG_HEIGHT) | (BINARY_FOR_EIGHT << TWENTY_FOUR); (float) ((IMG_HEIGHT - j * 1D) / IMG_HEIGHT)) | (BINARY_FOR_EIGHT << TWENTY_FOUR);
} }
} }
@ -1076,4 +1076,4 @@ class CustomChooserPanel extends AbstractColorChooserPanel implements ColorSelec
public void colorSetted(ColorCell cc) { public void colorSetted(ColorCell cc) {
} }
} }

4
designer-realize/src/main/java/com/fr/grid/GridUI.java

@ -1209,7 +1209,7 @@ public class GridUI extends ComponentUI {
* @return 有效返回true * @return 有效返回true
*/ */
public static boolean validate(Rectangle2D rect) { public static boolean validate(Rectangle2D rect) {
return rect != null && rect.getX() != INVALID_INTEGER; return rect != null && ComparatorUtils.equals(rect.getX(), INVALID_INTEGER);
} }
@ -1268,4 +1268,4 @@ public class GridUI extends ComponentUI {
paginateLineList.add(new Line2D.Double(0, sumHeight, width, sumHeight)); paginateLineList.add(new Line2D.Double(0, sumHeight, width, sumHeight));
} }
} }
} }

2
designer-realize/src/main/java/com/fr/start/fx/PrismImageLoader2.java

@ -141,7 +141,7 @@ class PrismImageLoader2 implements com.sun.javafx.tk.ImageLoader {
ImageFrame imageFrame = loader.load(i, w, h, preserveRatio, smooth); ImageFrame imageFrame = loader.load(i, w, h, preserveRatio, smooth);
images[i] = convert(imageFrame); images[i] = convert(imageFrame);
synchronized (this) { synchronized (this) {
this.notify(); notifyAll();
} }
} }
} catch (ImageStorageException e) { } catch (ImageStorageException e) {

Loading…
Cancel
Save