From 8b02cdcdb09f7a53cff52acf663c8eb208004881 Mon Sep 17 00:00:00 2001 From: kerry Date: Fri, 20 Sep 2019 09:50:09 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-20327=20sonar=E9=97=AE=E9=A2=98=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/file/MutilTempalteTabPane.java | 12 ++++++------ .../com/fr/design/gui/borders/UIFrameBorder.java | 16 +++++----------- .../src/main/java/com/fr/poly/PolyUtils.java | 9 ++++++--- .../java/com/fr/start/fx/PrismImageLoader2.java | 1 + 4 files changed, 18 insertions(+), 20 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java b/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java index b06f99050..5a722239c 100644 --- a/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java +++ b/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java @@ -398,8 +398,8 @@ public class MutilTempalteTabPane extends JComponent { //画下面的那条线 if (templateStartX < maxWidth) { GeneralPath generalPath = new GeneralPath(Path2D.WIND_EVEN_ODD, 2); - generalPath.moveTo((float) templateStartX, getHeight() - 1); - generalPath.lineTo((float) maxWidth, getHeight() - 1); + generalPath.moveTo((float) templateStartX, getHeight() - 1.0F); + generalPath.lineTo((float) maxWidth, getHeight() - 1.0F); g2d.fill(generalPath); //TODO hzzz delete // g2d.setPaint(UIConstants.LINE_COLOR); @@ -409,7 +409,7 @@ public class MutilTempalteTabPane extends JComponent { private void paintDefaultBackground(Graphics2D g2d) { //画默认背景 - g2d.setPaint(new GradientPaint(1, 1, UIConstants.TEMPLATE_TAB_PANE_BACKGROUND, 1, getHeight() - 1, UIConstants.TEMPLATE_TAB_PANE_BACKGROUND)); + g2d.setPaint(new GradientPaint(1, 1, UIConstants.TEMPLATE_TAB_PANE_BACKGROUND, 1, getHeight() - 1.0F, UIConstants.TEMPLATE_TAB_PANE_BACKGROUND)); 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[] y = {1, getHeight() + 1, getHeight() + 1, 1, 1}; 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, UIConstants.SELECT_TAB)); + g2d.setPaint(new GradientPaint(1, 1, UIConstants.SELECT_TAB, 1, getHeight() - 1.0F, UIConstants.SELECT_TAB)); //选了30度和60度的特殊角度的x,y作为经过的两个点的坐标 double specialLocation1 = 2.5; double specialLocation2 = 4.330127; @@ -590,9 +590,9 @@ public class MutilTempalteTabPane extends JComponent { double[] x = {templateStartX, templateStartX, templateStartX + realWidth, templateStartX + realWidth, templateStartX}; double[] y = {-1, getHeight() - 1, getHeight() - 1, -1, -1}; if (selfIndex == mouseOveredIndex) { - g2d.setPaint(new GradientPaint(1, 1, UIConstants.HOVER_BLUE, 1, getHeight() - 1, UIConstants.HOVER_BLUE)); + g2d.setPaint(new GradientPaint(1, 1, UIConstants.HOVER_BLUE, 1, getHeight() - 1.0F, UIConstants.HOVER_BLUE)); } else { - g2d.setPaint(new GradientPaint(1, 1, UIConstants.SHADOW_GREY, 1, getHeight() - 1, UIConstants.SHADOW_GREY)); + g2d.setPaint(new GradientPaint(1, 1, UIConstants.SHADOW_GREY, 1, getHeight() - 1.0F, UIConstants.SHADOW_GREY)); } diff --git a/designer-base/src/main/java/com/fr/design/gui/borders/UIFrameBorder.java b/designer-base/src/main/java/com/fr/design/gui/borders/UIFrameBorder.java index d4ff794e8..8e6bc4781 100644 --- a/designer-base/src/main/java/com/fr/design/gui/borders/UIFrameBorder.java +++ b/designer-base/src/main/java/com/fr/design/gui/borders/UIFrameBorder.java @@ -141,8 +141,8 @@ public class UIFrameBorder extends AbstractBorder implements UIResource { int spread1 = ThemeUtils.FRAME_SPREAD_DARK_DISABLED; int spread2 = ThemeUtils.FRAME_SPREAD_LIGHT_DISABLED; int y2 = y; - Color borderColor = null; - drawFirstCaption(g, borderColor, spread1, spread2, x, y2, w); + Color borderColor = isActive ? ThemeUtils.FRAME_BORDER_COLOR : ThemeUtils.FRAME_BORDER_DISABLED_COLOR; + drawFirstCaption(g, borderColor, x, y2, w); Color c2 = ColorRoutines.darken(c, 4 * spread1); drawSecondCaption(g, c2, c, spread2, x, y2, w); c2 = ColorRoutines.darken(c, 6 * spread1); @@ -257,14 +257,8 @@ public class UIFrameBorder extends AbstractBorder implements UIResource { g.drawLine(x + w - 4, y2, x + w - 4, y2); } - private void drawFirstCaption(Graphics g, Color borderColor, int spread1, int spread2, int x, int y2, int w) { - if (isActive) { - borderColor = ThemeUtils.FRAME_BORDER_COLOR; - spread1 = ThemeUtils.FRAME_SPREAD_DARK; - spread2 = ThemeUtils.FRAME_SPREAD_LIGHT; - } else { - borderColor = ThemeUtils.FRAME_BORDER_DISABLED_COLOR; - } + + private void drawFirstCaption(Graphics g, Color borderColor, int x, int y2, int w) { // always paint the semi-transparent parts // 1 // blend @@ -580,4 +574,4 @@ public class UIFrameBorder extends AbstractBorder implements UIResource { } } -} \ No newline at end of file +} diff --git a/designer-realize/src/main/java/com/fr/poly/PolyUtils.java b/designer-realize/src/main/java/com/fr/poly/PolyUtils.java index e297a69ad..3f1f270fd 100644 --- a/designer-realize/src/main/java/com/fr/poly/PolyUtils.java +++ b/designer-realize/src/main/java/com/fr/poly/PolyUtils.java @@ -32,6 +32,9 @@ public class PolyUtils { } public static BlockCreator createCreator(TemplateBlock block) { + if (block == null) { + return null; + } Class cls = block.getClass(); Class clazz = blockMapCls.get(cls); if (clazz == null) { @@ -55,7 +58,7 @@ public class PolyUtils { TemplateBlock block = new PolyChartBlock(cc); return createCreator(block); } - + private static TemplateBlock blockGenerate(Class clazz) { TemplateBlock block = null; try { @@ -85,7 +88,7 @@ public class PolyUtils { public static int converty2Designer(PolyDesigner designer, int y) { return y += designer.getVerticalValue(); } - + /** * 获取所处(x,y)位置的聚合块,如果没有,就返回null * @param designer @@ -110,4 +113,4 @@ public class PolyUtils { } return null; } -} \ No newline at end of file +} diff --git a/designer-realize/src/main/java/com/fr/start/fx/PrismImageLoader2.java b/designer-realize/src/main/java/com/fr/start/fx/PrismImageLoader2.java index e262e917e..89509b994 100644 --- a/designer-realize/src/main/java/com/fr/start/fx/PrismImageLoader2.java +++ b/designer-realize/src/main/java/com/fr/start/fx/PrismImageLoader2.java @@ -127,6 +127,7 @@ class PrismImageLoader2 implements com.sun.javafx.tk.ImageLoader { } + @SuppressWarnings("squid:S244") private void loadAll(InputStream stream, int w, int h, boolean preserveRatio, boolean smooth) { ImageLoadListener listener = new PrismLoadListener();