Browse Source

无JIRA任务 sonar问题修复

research/11.0
Lanlan 5 years ago
parent
commit
d58cb4991c
  1. 4
      designer-base/src/main/java/com/fr/design/gui/icombobox/UIComboBoxButton.java
  2. 2
      designer-base/src/main/java/com/fr/design/gui/icontainer/UIModeControlContainer.java
  3. 42
      designer-base/src/main/java/com/fr/design/gui/imenu/UIBasicMenuItemUI.java
  4. 3
      designer-base/src/main/java/com/fr/design/gui/imenutable/UIMenuTable.java
  5. 2
      designer-base/src/main/java/com/fr/design/gui/iprogressbar/UIProgressBorder.java
  6. 44
      designer-base/src/main/java/com/fr/design/gui/iscrollbar/UIBasicScrollBarUI.java
  7. 1
      designer-base/src/main/java/com/fr/design/gui/iscrollbar/UISBChooser.java

4
designer-base/src/main/java/com/fr/design/gui/icombobox/UIComboBoxButton.java

@ -172,11 +172,9 @@ public class UIComboBoxButton extends JButton {
} }
c.setBackground(UIManager.getColor("ComboBox.focusBackground")); c.setBackground(UIManager.getColor("ComboBox.focusBackground"));
if (c instanceof JComponent) { if (c instanceof JComponent) {
mustResetOpaque = true;
JComponent jc = (JComponent) c; JComponent jc = (JComponent) c;
savedOpaque = jc.isOpaque(); jc.isOpaque();
jc.setOpaque(true); jc.setOpaque(true);
paintFocus = true;
} }
} else { } else {
c.setForeground(comboBox.getForeground()); c.setForeground(comboBox.getForeground());

2
designer-base/src/main/java/com/fr/design/gui/icontainer/UIModeControlContainer.java

@ -46,7 +46,7 @@ public class UIModeControlContainer extends JLayeredPane {
private boolean isHideMode = false; private boolean isHideMode = false;
private boolean isSheeetCovered = false; private boolean isSheeetCovered = false;
private AlphaComposite composite = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 30 / 100.0F); private AlphaComposite composite = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.3f);
public UIModeControlContainer() { public UIModeControlContainer() {
this(new JPanel(), new JPanel()); this(new JPanel(), new JPanel());

42
designer-base/src/main/java/com/fr/design/gui/imenu/UIBasicMenuItemUI.java

@ -287,7 +287,7 @@ public class UIBasicMenuItemUI extends MenuItemUI {
View v = (View) c.getClientProperty(BasicHTML.propertyKey); View v = (View) c.getClientProperty(BasicHTML.propertyKey);
if (v != null) { if (v != null) {
d = getPreferredSize(c); d = getPreferredSize(c);
d.width -= v.getPreferredSpan(View.X_AXIS) - v.getMinimumSpan(View.X_AXIS); d.width -= (double) v.getPreferredSpan(View.X_AXIS) - (double) v.getMinimumSpan(View.X_AXIS);
} }
return d; return d;
} }
@ -345,7 +345,7 @@ public class UIBasicMenuItemUI extends MenuItemUI {
View v = (View) c.getClientProperty(BasicHTML.propertyKey); View v = (View) c.getClientProperty(BasicHTML.propertyKey);
if (v != null) { if (v != null) {
d = getPreferredSize(c); d = getPreferredSize(c);
d.width += v.getMaximumSpan(View.X_AXIS) - v.getPreferredSpan(View.X_AXIS); d.width += (double) v.getMaximumSpan(View.X_AXIS) - (double) v.getPreferredSpan(View.X_AXIS);
} }
return d; return d;
} }
@ -816,7 +816,6 @@ public class UIBasicMenuItemUI extends MenuItemUI {
// get Accelerator text // get Accelerator text
KeyStroke accelerator = b.getAccelerator(); KeyStroke accelerator = b.getAccelerator();
String acceleratorText = ""; String acceleratorText = "";
drawMenu(acceleratorText, accelerator, c, ic, maxValue, offset, paintIcon, b);
String text = layoutMenuItem(fm, b.getText(), fmAccel, acceleratorText, ic, null, String text = layoutMenuItem(fm, b.getText(), fmAccel, acceleratorText, ic, null,
arrowIcon, b.getVerticalAlignment(), b.getHorizontalAlignment(), arrowIcon, b.getVerticalAlignment(), b.getHorizontalAlignment(),
b.getVerticalTextPosition(), b.getHorizontalTextPosition(), viewRect, b.getVerticalTextPosition(), b.getHorizontalTextPosition(), viewRect,
@ -834,43 +833,6 @@ public class UIBasicMenuItemUI extends MenuItemUI {
g.setFont(holdf); g.setFont(holdf);
} }
private void drawMenu(String acceleratorText, KeyStroke accelerator, JComponent c,
Icon ic, int maxValue, int offset, Icon paintIcon, JMenuItem b) {
if (accelerator != null) {
int modifiers = accelerator.getModifiers();
if (modifiers > 0) {
acceleratorText = KeyEvent.getKeyModifiersText(modifiers);
//acceleratorText += "-";
acceleratorText += acceleratorDelimiter;
}
int keyCode = accelerator.getKeyCode();
if (keyCode != 0) {
acceleratorText += KeyEvent.getKeyText(keyCode);
} else {
acceleratorText += accelerator.getKeyChar();
}
}
if (!isTopLevelMenu()) {
if (c instanceof JCheckBoxMenuItem || c instanceof JRadioButtonMenuItem) {
ic = checkIcon;
if (checkIcon.getIconWidth() < maxValue) {
ic = new EmptyIcon(maxValue, checkIcon.getIconHeight());
offset = (maxValue - checkIcon.getIconWidth()) / 2;
}
paintIcon = null;
} else if (c instanceof JMenuItem) {
if (ic == null || ic.getIconWidth() < maxValue) {
int height = (ic == null) ? 2 : b.getIcon().getIconHeight();
int width = (ic == null) ? 2 : b.getIcon().getIconWidth();
offset = (maxValue - width) / 2;
ic = new EmptyIcon(maxValue, height);
}
}
}
}
private void drawAccText(String acceleratorText, Graphics g, JComponent p, ButtonModel model, FontMetrics fmAccel, JComponent c) { private void drawAccText(String acceleratorText, Graphics g, JComponent p, ButtonModel model, FontMetrics fmAccel, JComponent c) {
if (acceleratorText != null && !ComparatorUtils.equals(acceleratorText, "")) { if (acceleratorText != null && !ComparatorUtils.equals(acceleratorText, "")) {
//Get the maxAccWidth from the parent to calculate the offset. //Get the maxAccWidth from the parent to calculate the offset.

3
designer-base/src/main/java/com/fr/design/gui/imenutable/UIMenuTable.java

@ -157,8 +157,7 @@ public class UIMenuTable extends JTable {
@Override @Override
public TableCellRenderer getDefaultRenderer(Class<?> columnClass) { public TableCellRenderer getDefaultRenderer(Class<?> columnClass) {
columnClass = UITable.class; return super.getDefaultRenderer(UITable.class);
return super.getDefaultRenderer(columnClass);
} }
private class UITableRender implements TableCellRenderer { private class UITableRender implements TableCellRenderer {

2
designer-base/src/main/java/com/fr/design/gui/iprogressbar/UIProgressBorder.java

@ -72,6 +72,7 @@ public class UIProgressBorder extends UIRoundedBorder {
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
} }
@SuppressWarnings("squid:S2164")
private void paintBorderShadow(Graphics2D g2, int shadowWidth, int x, int y, int width, int height) { private void paintBorderShadow(Graphics2D g2, int shadowWidth, int x, int y, int width, int height) {
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
shadowWidth = Math.max(shadowWidth, 2); shadowWidth = Math.max(shadowWidth, 2);
@ -85,6 +86,7 @@ public class UIProgressBorder extends UIRoundedBorder {
} }
} }
@SuppressWarnings("squid:S2164")
private static Color getMixedColor(Color c1, float pct1, Color c2, float pct2) { private static Color getMixedColor(Color c1, float pct1, Color c2, float pct2) {
float[] clr1 = c1.getComponents(null); float[] clr1 = c1.getComponents(null);
float[] clr2 = c2.getComponents(null); float[] clr2 = c2.getComponents(null);

44
designer-base/src/main/java/com/fr/design/gui/iscrollbar/UIBasicScrollBarUI.java

@ -165,50 +165,6 @@ public class UIBasicScrollBarUI extends BasicScrollBarUI {
// drawColorAndLength(g, t, x2, y2, color); // drawColorAndLength(g, t, x2, y2, color);
} }
private void drawColorAndLength(Graphics g, Rectangle t, int x2, int y2, Color color) {
if (scrollbar.getOrientation() == JScrollBar.VERTICAL) {
int y1 = t.y + (t.height) / 2 - 4;
y2 = Math.min(y1 + 8, t.y + t.height - 5);
int y = y1;
// we take only saturation & brightness and apply them
// to the background color (normal/rollover/pressed)
g.setColor(UISBChooser.getAdjustedColor(color, 0, 71));
while (y < y2) {
g.drawLine(5, y, 11, y);
y += 2;
}
y = y1 + 1;
g.setColor(UISBChooser.getAdjustedColor(color, 0, -13));
while (y < y2) {
g.drawLine(6, y, 12, y);
y += 2;
}
} else {
int x1 = t.x + (t.width) / 2 - 4;
x2 = Math.min(x1 + 8, t.x + t.width - 5);
int x = x1 + 1;
// we take only saturation & brightness and apply them
// to the background color (normal/rollover/pressed)
g.setColor(UISBChooser.getAdjustedColor(color, 0, 71));
while (x < x2) {
g.drawLine(x, 5, x, 11);
x += 2;
}
x = x1;
g.setColor(UISBChooser.getAdjustedColor(color, 0, -13));
while (x < x2) {
g.drawLine(x, 6, x, 12);
x += 2;
}
}
}
private void drawVertical(Graphics g, Rectangle t, int xs, int ys, int x2, private void drawVertical(Graphics g, Rectangle t, int xs, int ys, int x2,
Color pressedColor, Color rolloverColor, Color pressedColor, Color rolloverColor,
Color normalColor) { Color normalColor) {

1
designer-base/src/main/java/com/fr/design/gui/iscrollbar/UISBChooser.java

@ -90,6 +90,7 @@ public class UISBChooser extends JDialog {
(frame.getHeight() - getSize().height) / 2); (frame.getHeight() - getSize().height) / 2);
} }
@SuppressWarnings("squid:S1226")
private void initP3(JPanel p3, JPanel p1) { private void initP3(JPanel p3, JPanel p1) {
p3 = new JPanel(new FlowLayout(FlowLayout.LEFT, 3, 8)); p3 = new JPanel(new FlowLayout(FlowLayout.LEFT, 3, 8));
p3.add(new JLabel("R:")); p3.add(new JLabel("R:"));

Loading…
Cancel
Save