Browse Source

Merge pull request #1213 in DESIGN/design from ~ZACK/design:feature/10.0 to feature/10.0

* commit 'a022644992ab8169e837aaa57947e7a334dc80a3':
  REPORT-20318 sonar问题修复
research/11.0
zack 5 years ago
parent
commit
eb059e16f6
  1. 41
      designer-base/src/main/java/com/fr/design/gui/iscrollbar/UIScrollBarUI.java
  2. 6
      designer-base/src/main/java/com/fr/design/layout/TableLayout.java

41
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.design.constants.UIConstants;
import com.fr.stable.StringUtils; 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.Color;
import java.awt.Component; import java.awt.Component;
import java.awt.Container; import java.awt.Container;
@ -22,24 +41,6 @@ import java.awt.event.MouseEvent;
import java.awt.event.MouseMotionListener; import java.awt.event.MouseMotionListener;
import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener; 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 * Like BasicScrollBarUI,but without two buttons
@ -590,6 +591,7 @@ public class UIScrollBarUI extends ScrollBarUI implements LayoutManager, SwingCo
* will cause a repaint. * will cause a repaint.
*/ */
@SuppressWarnings("squid:S2164")
protected void layoutVScrollbar(JScrollBar sb) { protected void layoutVScrollbar(JScrollBar sb) {
Dimension sbSize = sb.getSize(); Dimension sbSize = sb.getSize();
Insets sbInsets = sb.getInsets(); 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 * Make sure the thumb fits between the buttons. Note that setting the
* thumbs bounds causes a repaint. * thumbs bounds causes a repaint.
*/ */
@SuppressWarnings("squid:S2164")
protected void layoutHScrollbar(JScrollBar sb) { protected void layoutHScrollbar(JScrollBar sb) {
Dimension sbSize = sb.getSize(); Dimension sbSize = sb.getSize();
Insets sbInsets = sb.getInsets(); Insets sbInsets = sb.getInsets();
@ -1080,7 +1083,7 @@ public class UIScrollBarUI extends ScrollBarUI implements LayoutManager, SwingCo
scrollbar.repaint(); scrollbar.repaint();
} }
@SuppressWarnings("squid:S2164")
private void setValueFrom(MouseEvent e) { private void setValueFrom(MouseEvent e) {
boolean active = isThumbRollover(); boolean active = isThumbRollover();
BoundedRangeModel model = scrollbar.getModel(); BoundedRangeModel model = scrollbar.getModel();

6
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++) for (counter = 0; counter < numCr; counter++)
if ((crSpec[z][counter] > 0.0) && (crSpec[z][counter] < 1.0)) if ((crSpec[z][counter] > 0.0) && (crSpec[z][counter] < 1.0))
fillSizeRatio -= crSpec[z][counter]; fillSizeRatio -= crSpec[z][counter];
else if (crSpec[z][counter] == FILL) else if (AssistUtils.equals(crSpec[z][counter], FILL))
numFillSize++; numFillSize++;
// Adjust fill ratios to reflect number of fill rows/columns // 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]; int crPrefMin[] = new int[numCr];
for (counter = 0; counter < numCr; counter++) for (counter = 0; counter < numCr; counter++)
if ((crSpec[z][counter] == PREFERRED) || if ((AssistUtils.equals(crSpec[z][counter], PREFERRED)) ||
(crSpec[z][counter] == MINIMUM)) { (AssistUtils.equals(crSpec[z][counter], MINIMUM))) {
crPrefMin[counter] = crSize[z][counter]; crPrefMin[counter] = crSize[z][counter];
} }

Loading…
Cancel
Save