Browse Source

REPORT-60942 视觉优化

bugfix/11.0
kuangshuai 3 years ago
parent
commit
7c26de2df7
  1. 28
      designer-base/src/main/java/com/fr/design/mainframe/guide/ui/BubbleHint.java
  2. 4
      designer-base/src/main/java/com/fr/design/mainframe/guide/ui/ExpandPane.java
  3. 23
      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/GuideManageDialog.java
  5. 11
      designer-base/src/main/java/com/fr/design/mainframe/guide/ui/bubble/BubbleWithClose.java

28
designer-base/src/main/java/com/fr/design/mainframe/guide/ui/BubbleHint.java

@ -17,6 +17,7 @@ import java.awt.event.ActionListener;
public class BubbleHint extends Bubble { public class BubbleHint extends Bubble {
private UIButton confirmButton; private UIButton confirmButton;
private static final Color CONTENT_TEXT_COLOR = new Color(51, 51, 52);
public BubbleHint() { public BubbleHint() {
super(TailDirection.TOP, 0.9f); super(TailDirection.TOP, 0.9f);
@ -38,21 +39,21 @@ public class BubbleHint extends Bubble {
title.setHorizontalAlignment(SwingConstants.CENTER); title.setHorizontalAlignment(SwingConstants.CENTER);
title.setBorder(BorderFactory.createEmptyBorder(0,0,5,0)); title.setBorder(BorderFactory.createEmptyBorder(0,0,5,0));
UILabel content1 = new UILabel(Toolkit.i18nText("Fine-Design_Guide_Tips_Content1")); UILabel content1 = createContentLabel(Toolkit.i18nText("Fine-Design_Guide_Tips_Content1"));
content1.setPreferredSize(new Dimension(190,20));
content1.setHorizontalAlignment(SwingConstants.CENTER);
UILabel content2 = new UILabel(Toolkit.i18nText("Fine-Design_Guide_Tips_Content2")); UILabel content2 = createContentLabel(Toolkit.i18nText("Fine-Design_Guide_Tips_Content2"));
content2.setPreferredSize(new Dimension(190,20));
content2.setHorizontalAlignment(SwingConstants.CENTER);
JPanel buttonContainer= FRGUIPaneFactory.createCenterFlowZeroGapBorderPane(); JPanel buttonContainer= FRGUIPaneFactory.createCenterFlowZeroGapBorderPane();
buttonContainer.setBorder(BorderFactory.createEmptyBorder(20, 0, 0, 0)); buttonContainer.setBorder(BorderFactory.createEmptyBorder(15, 0, 0, 0));
buttonContainer.setPreferredSize(new Dimension(190,40)); buttonContainer.setPreferredSize(new Dimension(190,40));
buttonContainer.setOpaque(false); buttonContainer.setOpaque(false);
confirmButton = new UIButton(Toolkit.i18nText("Fine-Design_Guide_Tips_Know")); confirmButton = new UIButton(Toolkit.i18nText("Fine-Design_Guide_Tips_Know")) {
confirmButton.setPreferredSize(new Dimension(78, 24)); public Dimension getPreferredSize() {
return new Dimension(78, 24);
}
};
buttonContainer.add(confirmButton); buttonContainer.add(confirmButton);
contentPane.add(title); contentPane.add(title);
@ -71,4 +72,13 @@ public class BubbleHint extends Bubble {
confirmButton.removeActionListener(listener); confirmButton.removeActionListener(listener);
} }
private UILabel createContentLabel(String text) {
UILabel content = new UILabel(text);
content.setPreferredSize(new Dimension(190,20));
content.setHorizontalAlignment(SwingConstants.CENTER);
content.setFont(content.getFont().deriveFont(14.0f));
content.setForeground(CONTENT_TEXT_COLOR);
return content;
}
} }

4
designer-base/src/main/java/com/fr/design/mainframe/guide/ui/ExpandPane.java

@ -30,7 +30,7 @@ public class ExpandPane extends JPanel {
} }
private void initComponent() { private void initComponent() {
VerticalFlowLayout layout = new VerticalFlowLayout(VerticalFlowLayout.TOP, 10, 5); VerticalFlowLayout layout = new VerticalFlowLayout(VerticalFlowLayout.TOP, 10, 0);
layout.setAlignLeft(true); layout.setAlignLeft(true);
this.setLayout(layout); this.setLayout(layout);
@ -47,7 +47,7 @@ public class ExpandPane extends JPanel {
private JPanel createHeader() { private JPanel createHeader() {
headerPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); headerPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
headerPane.setPreferredSize(new Dimension(200, 24)); headerPane.setPreferredSize(new Dimension(200, 16));
UILabel headerTitle = new UILabel(this.title); UILabel headerTitle = new UILabel(this.title);
headerTitle.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); headerTitle.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0));
arrow = new UILabel(downIcon); arrow = new UILabel(downIcon);

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

@ -14,7 +14,9 @@ import javax.swing.BorderFactory;
import javax.swing.Icon; import javax.swing.Icon;
import javax.swing.JDialog; import javax.swing.JDialog;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.JTextPane;
import javax.swing.SwingConstants; import javax.swing.SwingConstants;
import javax.swing.text.MutableAttributeSet;
import javax.swing.text.SimpleAttributeSet; import javax.swing.text.SimpleAttributeSet;
import javax.swing.text.StyleConstants; import javax.swing.text.StyleConstants;
import javax.swing.text.StyledDocument; import javax.swing.text.StyledDocument;
@ -22,6 +24,7 @@ import java.awt.BorderLayout;
import java.awt.Color; import java.awt.Color;
import java.awt.Container; import java.awt.Container;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.Font;
import java.awt.Graphics2D; import java.awt.Graphics2D;
import java.awt.Window; import java.awt.Window;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
@ -34,12 +37,16 @@ public class GuideCompleteDialog extends JDialog {
private static final int ICON_HEIGHT = 182; private static final int ICON_HEIGHT = 182;
private static final Color FONT_COLOR = new Color(51, 51, 52); 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 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 GuideCompleteDialog dialog; private static GuideCompleteDialog dialog;
public static GuideCompleteDialog getInstance() { public static GuideCompleteDialog getInstance() {
if (dialog == null) { if (dialog == null) {
dialog = new GuideCompleteDialog(DesignerContext.getDesignerFrame()); dialog = new GuideCompleteDialog(DesignerContext.getDesignerFrame());
} }
dialog = new GuideCompleteDialog(DesignerContext.getDesignerFrame());
return dialog; return dialog;
} }
@ -65,15 +72,16 @@ public class GuideCompleteDialog extends JDialog {
container.setBorder(BorderFactory.createEmptyBorder(15, 52, 25, 52)); container.setBorder(BorderFactory.createEmptyBorder(15, 52, 25, 52));
UILabel title = new UILabel(Toolkit.i18nText("Fine-Design_Guide_Complete_Confirm")); UILabel title = new UILabel(Toolkit.i18nText("Fine-Design_Guide_Complete_Confirm"));
title.setFont(title.getFont().deriveFont(22.0f)); title.setFont(TITLE_FONT);
title.setPreferredSize(new Dimension(190, 30)); title.setPreferredSize(new Dimension(190, 30));
title.setHorizontalAlignment(SwingConstants.CENTER); title.setHorizontalAlignment(SwingConstants.CENTER);
title.setForeground(FONT_COLOR); title.setForeground(FONT_COLOR);
textArea = new UITextPane(); textArea = new UITextPane();
changeLineSpacing(textArea, 0.19f,false);
textArea.setEnabled(false); textArea.setEnabled(false);
textArea.setOpaque(false); textArea.setOpaque(false);
textArea.setFont(textArea.getFont().deriveFont(18.0f)); textArea.setFont(CONTENT_FONT);
textArea.setPreferredSize(new Dimension(236, 52)); textArea.setPreferredSize(new Dimension(236, 52));
textArea.setBorder(null); textArea.setBorder(null);
textArea.setDisabledTextColor(FONT_COLOR); textArea.setDisabledTextColor(FONT_COLOR);
@ -83,7 +91,8 @@ public class GuideCompleteDialog extends JDialog {
doc.setParagraphAttributes(0, doc.getLength(), center, false); doc.setParagraphAttributes(0, doc.getLength(), center, false);
JPanel buttonContainer= FRGUIPaneFactory.createCenterFlowZeroGapBorderPane(); JPanel buttonContainer= FRGUIPaneFactory.createCenterFlowZeroGapBorderPane();
buttonContainer.setPreferredSize(new Dimension(190,38)); buttonContainer.setPreferredSize(new Dimension(190,43));
buttonContainer.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0));
buttonContainer.setOpaque(false); buttonContainer.setOpaque(false);
UIButton button = new UIButton(Toolkit.i18nText("Fine-Design_Guide_Complete_End")){ UIButton button = new UIButton(Toolkit.i18nText("Fine-Design_Guide_Complete_End")){
@ -92,6 +101,7 @@ public class GuideCompleteDialog extends JDialog {
return new Dimension(122, 38); return new Dimension(122, 38);
} }
}; };
button.setFont(BUTTON_FONT);
button.setUI(confirmButtonUI); button.setUI(confirmButtonUI);
button.setRoundBorder(true); button.setRoundBorder(true);
button.setForeground(Color.WHITE); button.setForeground(Color.WHITE);
@ -131,4 +141,11 @@ 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/GuideManageDialog.java

@ -74,7 +74,7 @@ public class GuideManageDialog extends JDialog {
} }
private JPanel createGuideVersionPane(GuideVersion guideVersion) { private JPanel createGuideVersionPane(GuideVersion guideVersion) {
JPanel expandContent = FRGUIPaneFactory.createVerticalFlowLayout_Pane(true, VerticalFlowLayout.TOP, 0, 5); JPanel expandContent = FRGUIPaneFactory.createVerticalFlowLayout_Pane(true, VerticalFlowLayout.TOP, 0, 10);
for (GuideGroup guideGroup : guideVersion.getGuideGroupList()) { for (GuideGroup guideGroup : guideVersion.getGuideGroupList()) {
JPanel guideGroupCard = createGuideGroupCard(guideGroup); JPanel guideGroupCard = createGuideGroupCard(guideGroup);
expandContent.add(guideGroupCard); expandContent.add(guideGroupCard);

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

@ -164,22 +164,23 @@ public class BubbleWithClose extends Bubble {
return new Insets(lineSpace / 2 - 1, 0, lineSpace / 2, 0); return new Insets(lineSpace / 2 - 1, 0, lineSpace / 2, 0);
} }
}; };
changeLineSpacing(textArea, (float) lineSpace / 2 / lineHeight, true); textArea.setFont(font);
textArea.setText(str); changeLineSpacing(textArea, lineHeight, true);
textArea.setEditable(false); textArea.setEditable(false);
textArea.setForeground(foreground); textArea.setForeground(foreground);
textArea.setDisabledTextColor(foreground); textArea.setDisabledTextColor(foreground);
textArea.setBorder(null); textArea.setBorder(null);
textArea.setFont(font);
textArea.setOpaque(false); textArea.setOpaque(false);
textArea.setText(str);
highlightText(textArea); highlightText(textArea);
return textArea; return textArea;
} }
private void changeLineSpacing(JTextPane pane, float factor, boolean replace) { private void changeLineSpacing(JTextPane pane, int lineHeight, boolean replace) {
pane.selectAll(); pane.selectAll();
MutableAttributeSet set = new SimpleAttributeSet(pane.getParagraphAttributes()); MutableAttributeSet set = new SimpleAttributeSet(pane.getParagraphAttributes());
StyleConstants.setLineSpacing(set, factor); FontMetrics fontMetrics = GraphHelper.getFontMetrics(pane.getFont());
StyleConstants.setLineSpacing(set, (float)(lineHeight - fontMetrics.getHeight()) / fontMetrics.getHeight());
pane.setParagraphAttributes(set, replace); pane.setParagraphAttributes(set, replace);
} }

Loading…
Cancel
Save