From a022644992ab8169e837aaa57947e7a334dc80a3 Mon Sep 17 00:00:00 2001 From: zack Date: Fri, 18 Oct 2019 14:02:19 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-20318=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 --- .../design/gui/iscrollbar/UIScrollBarUI.java | 41 ++++++++++--------- .../com/fr/design/layout/TableLayout.java | 6 +-- 2 files changed, 25 insertions(+), 22 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/iscrollbar/UIScrollBarUI.java b/designer-base/src/main/java/com/fr/design/gui/iscrollbar/UIScrollBarUI.java index d3393054ae..949b3958ae 100644 --- a/designer-base/src/main/java/com/fr/design/gui/iscrollbar/UIScrollBarUI.java +++ b/designer-base/src/main/java/com/fr/design/gui/iscrollbar/UIScrollBarUI.java @@ -2,6 +2,25 @@ package com.fr.design.gui.iscrollbar; import com.fr.design.constants.UIConstants; import com.fr.stable.StringUtils; +import sun.swing.DefaultLookup; + +import javax.swing.BoundedRangeModel; +import javax.swing.InputMap; +import javax.swing.JComponent; +import javax.swing.JList; +import javax.swing.JScrollBar; +import javax.swing.JScrollPane; +import javax.swing.JViewport; +import javax.swing.LookAndFeel; +import javax.swing.SwingConstants; +import javax.swing.SwingUtilities; +import javax.swing.Timer; +import javax.swing.UIManager; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import javax.swing.plaf.ComponentUI; +import javax.swing.plaf.ScrollBarUI; +import javax.swing.plaf.UIResource; import java.awt.Color; import java.awt.Component; import java.awt.Container; @@ -22,24 +41,6 @@ import java.awt.event.MouseEvent; import java.awt.event.MouseMotionListener; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; -import javax.swing.BoundedRangeModel; -import javax.swing.InputMap; -import javax.swing.JComponent; -import javax.swing.JList; -import javax.swing.JScrollBar; -import javax.swing.JScrollPane; -import javax.swing.JViewport; -import javax.swing.LookAndFeel; -import javax.swing.SwingConstants; -import javax.swing.SwingUtilities; -import javax.swing.Timer; -import javax.swing.UIManager; -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; -import javax.swing.plaf.ComponentUI; -import javax.swing.plaf.ScrollBarUI; -import javax.swing.plaf.UIResource; -import sun.swing.DefaultLookup; /** * Like BasicScrollBarUI,but without two buttons @@ -590,6 +591,7 @@ public class UIScrollBarUI extends ScrollBarUI implements LayoutManager, SwingCo * will cause a repaint. */ + @SuppressWarnings("squid:S2164") protected void layoutVScrollbar(JScrollBar sb) { Dimension sbSize = sb.getSize(); Insets sbInsets = sb.getInsets(); @@ -672,6 +674,7 @@ public class UIScrollBarUI extends ScrollBarUI implements LayoutManager, SwingCo * Make sure the thumb fits between the buttons. Note that setting the * thumbs bounds causes a repaint. */ + @SuppressWarnings("squid:S2164") protected void layoutHScrollbar(JScrollBar sb) { Dimension sbSize = sb.getSize(); Insets sbInsets = sb.getInsets(); @@ -1080,7 +1083,7 @@ public class UIScrollBarUI extends ScrollBarUI implements LayoutManager, SwingCo scrollbar.repaint(); } - + @SuppressWarnings("squid:S2164") private void setValueFrom(MouseEvent e) { boolean active = isThumbRollover(); BoundedRangeModel model = scrollbar.getModel(); diff --git a/designer-base/src/main/java/com/fr/design/layout/TableLayout.java b/designer-base/src/main/java/com/fr/design/layout/TableLayout.java index f8134be1fd..2cf288da63 100644 --- a/designer-base/src/main/java/com/fr/design/layout/TableLayout.java +++ b/designer-base/src/main/java/com/fr/design/layout/TableLayout.java @@ -1747,7 +1747,7 @@ public class TableLayout implements LayoutManager2, Serializable { for (counter = 0; counter < numCr; counter++) if ((crSpec[z][counter] > 0.0) && (crSpec[z][counter] < 1.0)) fillSizeRatio -= crSpec[z][counter]; - else if (crSpec[z][counter] == FILL) + else if (AssistUtils.equals(crSpec[z][counter], FILL)) numFillSize++; // Adjust fill ratios to reflect number of fill rows/columns @@ -1773,8 +1773,8 @@ public class TableLayout implements LayoutManager2, Serializable { int crPrefMin[] = new int[numCr]; for (counter = 0; counter < numCr; counter++) - if ((crSpec[z][counter] == PREFERRED) || - (crSpec[z][counter] == MINIMUM)) { + if ((AssistUtils.equals(crSpec[z][counter], PREFERRED)) || + (AssistUtils.equals(crSpec[z][counter], MINIMUM))) { crPrefMin[counter] = crSize[z][counter]; }