Browse Source

Merge pull request #1388 in DESIGN/design from ~KERRY/design_10.0:feature/10.0 to feature/10.0

* commit '3fa4f8a0737eb8ca6dee83fb7df6e5bfa60612f0':
  REPORT-20327 sonar问题修复
research/11.0
kerry 5 years ago
parent
commit
f2f0ddce00
  1. 10
      designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XCardSwitchButton.java

10
designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XCardSwitchButton.java

@ -61,6 +61,8 @@ public class XCardSwitchButton extends XButton {
private static final int MIN_SIZE = 1;
private static final int HALF_NUMBER = 2;
// 删除按钮识别区域偏移量
private static final int CLOSE_ICON_RIGHT_OFFSET = 15;
private static final int CLOSE_ICON_TOP_OFFSET = 15;
@ -455,7 +457,8 @@ public class XCardSwitchButton extends XButton {
StringBuilder titleStringBuf = new StringBuilder();
TitlePacker title = getWidgetTitle();
FRFont font = title.getFrFont();
FRFont newFont = FRFont.getInstance(font.getName(), font.getStyle(), font.getSize() + FONT_SIZE_ADJUST);
int fontSize = font.getSize() + FONT_SIZE_ADJUST;
FRFont newFont = FRFont.getInstance(font.getName(), font.getStyle(), fontSize);
FontMetrics fm = GraphHelper.getFontMetrics(newFont);
for (int i = 0; i < titleText.length(); i++) {
titleStringBuf.append(titleText.charAt(i));
@ -469,12 +472,13 @@ public class XCardSwitchButton extends XButton {
for (int i = 0; i < verticalTextList.size(); i++) {
String paint_str = (String) verticalTextList.get(i);
GraphHelper.drawString(g2d, paint_str, (width - fm.stringWidth(paint_str)) / 2, textY);
GraphHelper.drawString(g2d, paint_str,
(width - fm.stringWidth(paint_str)) / (HALF_NUMBER * 1.0D), textY);
textY += textHeight;
textY += PT.pt2pix(0, RESLUTION);
if (textY > height - textHeight && i < verticalTextList.size() - 1) {
textY -= DOTS_HEIGHT;
paintDots(g2d, textY, (width - fm.stringWidth(paint_str)) / 2);
paintDots(g2d, textY, (width - fm.stringWidth(paint_str)) / HALF_NUMBER);
break;
}
}

Loading…
Cancel
Save