Browse Source

Pull request #6318: REPORT-61213 部分高亮元素位置有偏差

Merge in DESIGN/design from ~TOMMY/design:final/11.0 to final/11.0

* commit '5f66ff0fec214c6773c5b5c17c6511630669c5d1':
  REPORT-60896 代码还原
  无JIRA任务 引导任务的组件替换下
  REPORT-60896 引导蒙层有残留阴影
  REPORT-61207 引导相关字体显示不对且被截断
  REPORT-61213 mac全屏下部分高亮元素位置有偏差
new-design
Tommy 3 years ago
parent
commit
40402a44d7
  1. 7
      designer-base/src/main/java/com/fr/design/mainframe/guide/base/GuideView.java
  2. 5
      designer-base/src/main/java/com/fr/design/mainframe/guide/scene/AbstractGuideScene.java
  3. 21
      designer-base/src/main/java/com/fr/design/mainframe/guide/ui/GuideCompleteDialog.java
  4. 2
      designer-base/src/main/java/com/fr/design/mainframe/guide/ui/GuideLoadingGlassPane.java
  5. 25
      designer-base/src/main/java/com/fr/design/mainframe/guide/ui/bubble/BubbleWithClose.java
  6. 28
      designer-base/src/main/java/com/fr/design/mainframe/guide/utils/GuideUIUtils.java
  7. 4
      designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/layout/ChangeLayoutComponentGuide.java
  8. 12
      designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/layout/UseLayoutAndComponentGuide.java

7
designer-base/src/main/java/com/fr/design/mainframe/guide/base/GuideView.java

@ -85,7 +85,12 @@ public class GuideView extends JDialog {
updateGuideViewLocation();
this.setVisible(true);
if (scene != null) {
scene.start();
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
scene.start();
}
});
} else {
GuideManager.getInstance().getCurrentGuide().complete();
}

5
designer-base/src/main/java/com/fr/design/mainframe/guide/scene/AbstractGuideScene.java

@ -396,8 +396,9 @@ public abstract class AbstractGuideScene extends JPanel implements GuideScene {
}
public void clear() {
targetList = new ArrayList<>();
highlightList = new ArrayList<>();
targetList.clear();
highlightList.clear();
pointsList.clear();
this.nextButton = null;
if (this.getComponentCount() > 0) {
this.removeAll();

21
designer-base/src/main/java/com/fr/design/mainframe/guide/ui/GuideCompleteDialog.java

@ -7,6 +7,7 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.guide.utils.GuideUIUtils;
import com.fr.design.utils.gui.GUIPaintUtils;
import com.fr.general.IOUtils;
@ -14,9 +15,7 @@ import javax.swing.BorderFactory;
import javax.swing.Icon;
import javax.swing.JDialog;
import javax.swing.JPanel;
import javax.swing.JTextPane;
import javax.swing.SwingConstants;
import javax.swing.text.MutableAttributeSet;
import javax.swing.text.SimpleAttributeSet;
import javax.swing.text.StyleConstants;
import javax.swing.text.StyledDocument;
@ -37,9 +36,9 @@ public class GuideCompleteDialog extends JDialog {
private static final int ICON_HEIGHT = 182;
private static final Color FONT_COLOR = new Color(51, 51, 52);
private static final Color BUTTON_BG_COLOR = new Color(65, 155,249);
private static final Font TITLE_FONT = new Font(Font.SANS_SERIF, Font.BOLD, 22);
private static final Font CONTENT_FONT = new Font(Font.SANS_SERIF, Font.PLAIN, 18);
private static final Font BUTTON_FONT = new Font(Font.SANS_SERIF, Font.BOLD, 14);
private static final Font TITLE_FONT = new Font("Default", Font.BOLD, 22);
private static final Font CONTENT_FONT = new Font("Default", Font.PLAIN, 18);
private static final Font BUTTON_FONT = new Font("Default", Font.BOLD, 14);
private static GuideCompleteDialog dialog;
public static GuideCompleteDialog getInstance() {
@ -78,12 +77,11 @@ public class GuideCompleteDialog extends JDialog {
title.setForeground(FONT_COLOR);
textArea = new UITextPane();
changeLineSpacing(textArea, 0.15f,false);
textArea.setFont(CONTENT_FONT);
GuideUIUtils.setTextPaneLineHeight(textArea, 26);
textArea.setEnabled(false);
textArea.setOpaque(false);
textArea.setFont(CONTENT_FONT);
textArea.setPreferredSize(new Dimension(236, 52));
textArea.setBorder(null);
textArea.setDisabledTextColor(FONT_COLOR);
StyledDocument doc = textArea.getStyledDocument();
SimpleAttributeSet center = new SimpleAttributeSet();
@ -141,11 +139,4 @@ public class GuideCompleteDialog extends JDialog {
}
}
};
private void changeLineSpacing(JTextPane pane, float factor, boolean replace) {
pane.selectAll();
MutableAttributeSet set = new SimpleAttributeSet(pane.getParagraphAttributes());
StyleConstants.setLineSpacing(set, factor);
pane.setParagraphAttributes(set, replace);
}
}

2
designer-base/src/main/java/com/fr/design/mainframe/guide/ui/GuideLoadingGlassPane.java

@ -40,7 +40,7 @@ public class GuideLoadingGlassPane extends JPanel {
imageContainer.add(GuideLoadingPane.getInstance());
UILabel hintLabel = new UILabel(Toolkit.i18nText("Fine-Design_Guide_Loading_Wait"));
hintLabel.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 14));
hintLabel.setFont(new Font("Default", Font.PLAIN, 14));
hintLabel.setHorizontalAlignment(SwingConstants.CENTER);
hintLabel.setForeground(Color.WHITE);

25
designer-base/src/main/java/com/fr/design/mainframe/guide/ui/bubble/BubbleWithClose.java

@ -4,12 +4,12 @@ package com.fr.design.mainframe.guide.ui.bubble;
import com.fr.base.GraphHelper;
import com.fr.design.gui.frpane.UITextPane;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.mainframe.guide.utils.GuideUIUtils;
import com.fr.general.IOUtils;
import com.fr.stable.StringUtils;
import javax.swing.Icon;
import javax.swing.JTextPane;
import javax.swing.text.MutableAttributeSet;
import javax.swing.text.SimpleAttributeSet;
import javax.swing.text.StyleConstants;
import javax.swing.text.StyledDocument;
@ -32,8 +32,8 @@ import java.text.AttributedCharacterIterator;
import java.text.AttributedString;
public class BubbleWithClose extends Bubble {
private static final Font TITLE_FONT = new Font(Font.SANS_SERIF, Font.PLAIN, 14);
private static final Font CONTENT_FONT = new Font(Font.SANS_SERIF, Font.PLAIN, 12);
private static final Font TITLE_FONT = new Font("Default", Font.PLAIN, 14);
private static final Font CONTENT_FONT = new Font("Default", Font.PLAIN, 12);
private static final int TITLE_LINE_HEIGHT = 22;
private static final int CONTENT_LINE_HEIGHT = 18;
@ -157,33 +157,18 @@ public class BubbleWithClose extends Bubble {
}
private UITextPane createTextArea(String str, Font font, int lineHeight, Color foreground) {
int lineSpace = lineHeight - font.getSize();
UITextPane textArea= new UITextPane(){
@Override
public Insets getInsets() {
return new Insets(lineSpace / 2 - 1, 0, lineSpace / 2, 0);
}
};
UITextPane textArea= new UITextPane();
textArea.setFont(font);
changeLineSpacing(textArea, lineHeight, true);
GuideUIUtils.setTextPaneLineHeight(textArea, lineHeight);
textArea.setEditable(false);
textArea.setForeground(foreground);
textArea.setDisabledTextColor(foreground);
textArea.setBorder(null);
textArea.setOpaque(false);
textArea.setText(str);
highlightText(textArea);
return textArea;
}
private void changeLineSpacing(JTextPane pane, int lineHeight, boolean replace) {
pane.selectAll();
MutableAttributeSet set = new SimpleAttributeSet(pane.getParagraphAttributes());
FontMetrics fontMetrics = GraphHelper.getFontMetrics(pane.getFont());
StyleConstants.setLineSpacing(set, (float)(lineHeight - fontMetrics.getHeight()) / fontMetrics.getHeight());
pane.setParagraphAttributes(set, replace);
}
private void highlightText(JTextPane textArea) {
SimpleAttributeSet sas = new SimpleAttributeSet();
StyleConstants.setForeground(sas, HIGHLIGHT_COLOR);

28
designer-base/src/main/java/com/fr/design/mainframe/guide/utils/GuideUIUtils.java

@ -0,0 +1,28 @@
package com.fr.design.mainframe.guide.utils;
import com.fr.base.GraphHelper;
import javax.swing.BorderFactory;
import javax.swing.JTextPane;
import javax.swing.text.MutableAttributeSet;
import javax.swing.text.SimpleAttributeSet;
import javax.swing.text.StyleConstants;
import java.awt.FontMetrics;
import java.awt.Insets;
public class GuideUIUtils {
public static void setTextPaneLineHeight(JTextPane pane, int lineHeight) {
pane.selectAll();
pane.setMargin(new Insets(0,0,0,0));
MutableAttributeSet set = new SimpleAttributeSet(pane.getParagraphAttributes());
FontMetrics fontMetrics = GraphHelper.getFontMetrics(pane.getFont());
int delta = (lineHeight - fontMetrics.getHeight()) / 2 * 2 ;
if (delta > 0) {
StyleConstants.setLineSpacing(set, delta/ 2.0f / fontMetrics.getHeight());
pane.setParagraphAttributes(set, false);
int dis = fontMetrics.getDescent() - fontMetrics.getLeading();
int marginTop = dis > 0 ? ((delta - dis) / 2 + dis) : ((delta - dis) / 2);
pane.setBorder(BorderFactory.createEmptyBorder(marginTop, 0,0,0));
}
}
}

4
designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/layout/ChangeLayoutComponentGuide.java

@ -87,9 +87,11 @@ public class ChangeLayoutComponentGuide {
@Override
public boolean prepared() {
switchButton.getComponentPopupMenu().setVisible(true);
Rectangle popupBounds = GuideCreateUtils.getRelativeBounds(switchButton.getComponentPopupMenu(), switchButton,0, -switchButton.getComponentPopupMenu().getHeight());
switchButton.getComponentPopupMenu().show(scene.getContainer(), popupBounds.x, popupBounds.y);
scene.addCustomTarget(
GuideCreateUtils.createModalTarget(switchButton.getComponentPopupMenu()),
GuideCreateUtils.getRelativeBounds(switchButton.getComponentPopupMenu(), switchButton,0, -switchButton.getComponentPopupMenu().getHeight())
popupBounds
);
scene.addClickTarget(switchButton.getComponentPopupMenu().getComponent(1), ClickScene.ClickType.LEFT, true);
scene.addBubbleTip(Toolkit.i18nText("Fine-Design_Guide_Scene_F001002_Tip_Select_Fix_layout"), null, GuideTip.Direction.RIGHT, 0.5f, 0.8f);

12
designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/layout/UseLayoutAndComponentGuide.java

@ -47,9 +47,9 @@ import java.util.TimerTask;
public class UseLayoutAndComponentGuide {
private static final String[] PRE_INSTALL_COMPONENTS = {
"大屏标题-酷炫蓝.25fcd194-d4db-406f-8a08-210f3c262870.reu",
"散点闪烁地图-酷炫蓝.5e17c2eb-5b18-4b6c-854a-5ffff7f6337a.reu",
"排名明细表.b4dab4f2-7b1a-4540-a2d4-65c3e080334e.reu"
"新功能引导-标题.309634e8-2946-43a7-aea5-1d3fb68c8823.reu",
"新功能引导-左侧组件.76797e8e-1e56-480a-b07c-3acb05b604ca.reu",
"新功能引导-右侧组件.35fbbb73-da84-479d-b387-1da7b05b23e8.reu"
};
private static final String RESOURCE_PATH = "/com/fr/report/guide/component";
private static UIHeadMenu fileHeadMenu;
@ -62,9 +62,9 @@ public class UseLayoutAndComponentGuide {
.nextScene(createScene3())
.nextScene(createScene4())
.nextScene(createScene5())
.nextScene(createScene6("box0","25fcd194-d4db-406f-8a08-210f3c262870"))
.nextScene(createScene6("box1","5e17c2eb-5b18-4b6c-854a-5ffff7f6337a"))
.nextScene(createScene6("box2","b4dab4f2-7b1a-4540-a2d4-65c3e080334e"))
.nextScene(createScene6("box0","309634e8-2946-43a7-aea5-1d3fb68c8823"))
.nextScene(createScene6("box1","76797e8e-1e56-480a-b07c-3acb05b604ca"))
.nextScene(createScene6("box2","35fbbb73-da84-479d-b387-1da7b05b23e8"))
.nextScene(GuideSceneHelper.createFormDesignerBodyDisplayScene())
.nextScene(GuideSceneHelper.createPreviewClickScene());

Loading…
Cancel
Save