Browse Source

REPORT-59351 【主题切换】国际化显示问题

【问题原因】
视觉变动,修改主题编辑面板中控件的尺寸和布局

【改动思路】
同上
research/11.0
Starryi 3 years ago
parent
commit
9239e90287
  1. 21
      designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeEditorPane.java
  2. 30
      designer-base/src/main/java/com/fr/design/mainframe/theme/edit/ComponentStyleEditPane.java
  3. 19
      designer-base/src/main/java/com/fr/design/mainframe/theme/edit/ui/LabelUtils.java
  4. 1
      designer-base/src/main/java/com/fr/design/mainframe/theme/edit/ui/TabbedPane.java

21
designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeEditorPane.java

@ -42,13 +42,10 @@ import java.util.List;
* Created by Starryi on 2021/8/13 * Created by Starryi on 2021/8/13
*/ */
public abstract class TemplateThemeEditorPane<T extends TemplateTheme> extends JPanel { public abstract class TemplateThemeEditorPane<T extends TemplateTheme> extends JPanel {
public static final int TITLE_BORDER_FONT = 12;
public static final int LEFT_TITLE_PANE_HEIGHT = 539; public static final int LEFT_TITLE_PANE_HEIGHT = 539;
public static final int RIGHT_PANE_WIDTH = 362; public static final int RIGHT_PANE_WIDTH = 362;
public static final int RIGHT_PANE_HEIGHT = LEFT_TITLE_PANE_HEIGHT; public static final int RIGHT_PANE_HEIGHT = LEFT_TITLE_PANE_HEIGHT;
public static final int COLOR_SCHEME_TITLE_PANE_WIDTH = 298;
public static final int COLOR_SCHEME_TITLE_PANE_HEIGHT = 174 + TITLE_BORDER_FONT / 2;
protected AutoCheckThemeNameTextField<T> nameTextField; protected AutoCheckThemeNameTextField<T> nameTextField;
private UILabel nameErrorLabel; private UILabel nameErrorLabel;
@ -122,12 +119,14 @@ public abstract class TemplateThemeEditorPane<T extends TemplateTheme> extends J
colorListPane = new ColorListPane(); colorListPane = new ColorListPane();
colorListExtendedPane = new ColorListExtendedPane(); colorListExtendedPane = new ColorListExtendedPane();
JPanel extendedContainer = FRGUIPaneFactory.createBorderLayout_S_Pane();
colorListExtendedPane.setBackground(null); colorListExtendedPane.setBackground(null);
colorListExtendedPane.setOpaque(false); colorListExtendedPane.setOpaque(false);
extendedContainer.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); JPanel extendedBackgroundContainer = FRGUIPaneFactory.createBorderLayout_S_Pane();
extendedContainer.setBackground(Color.WHITE); extendedBackgroundContainer.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
extendedContainer.add(colorListExtendedPane); extendedBackgroundContainer.setBackground(Color.WHITE);
extendedBackgroundContainer.add(colorListExtendedPane, BorderLayout.WEST);
JPanel extendedContainer = FRGUIPaneFactory.createBorderLayout_S_Pane();
extendedContainer.add(extendedBackgroundContainer, BorderLayout.WEST);
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double[] rowSize = new double[]{p, p, p}; double[] rowSize = new double[]{p, p, p};
@ -151,12 +150,11 @@ public abstract class TemplateThemeEditorPane<T extends TemplateTheme> extends J
content.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); content.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
JPanel borderContainer = new JPanel(new BorderLayout()); JPanel borderContainer = new JPanel(new BorderLayout());
borderContainer.setPreferredSize(new Dimension(COLOR_SCHEME_TITLE_PANE_WIDTH, COLOR_SCHEME_TITLE_PANE_HEIGHT));
borderContainer.setBorder(BorderUtils.createTitleBorder(Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Edit_Pane_Color_Scheme_Title"))); borderContainer.setBorder(BorderUtils.createTitleBorder(Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Edit_Pane_Color_Scheme_Title")));
borderContainer.add(content); borderContainer.add(content);
JPanel container = new JPanel(new BorderLayout()); JPanel container = new JPanel(new BorderLayout());
container.add(borderContainer, BorderLayout.WEST); container.add(borderContainer, BorderLayout.CENTER);
colorListPane.addColorChangeListener(new ChangeListener() { colorListPane.addColorChangeListener(new ChangeListener() {
@Override @Override
@ -193,18 +191,17 @@ public abstract class TemplateThemeEditorPane<T extends TemplateTheme> extends J
uiTabbedPane = new UITabbedPane(); uiTabbedPane = new UITabbedPane();
uiTabbedPane.setBorder(BorderFactory.createEmptyBorder(10, 5, 10, 1)); uiTabbedPane.setBorder(BorderFactory.createEmptyBorder(10, 5, 10, 1));
container.add(uiTabbedPane, BorderLayout.NORTH); container.add(uiTabbedPane, BorderLayout.CENTER);
return container; return container;
} }
public void addCustomEditorPane(String title, final Component component) { public void addCustomEditorPane(String title, final Component component) {
component.setPreferredSize(new Dimension(317, 239));
AbstractAttrNoScrollPane settingPane = new NoBorderAbstractAttrNoScrollPane() { AbstractAttrNoScrollPane settingPane = new NoBorderAbstractAttrNoScrollPane() {
@Override @Override
protected JPanel createContentPane() { protected JPanel createContentPane() {
JPanel contentPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel contentPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
contentPane.add(component, BorderLayout.NORTH); contentPane.add(component, BorderLayout.CENTER);
return contentPane; return contentPane;
} }
}; };

30
designer-base/src/main/java/com/fr/design/mainframe/theme/edit/ComponentStyleEditPane.java

@ -2,8 +2,7 @@ package com.fr.design.mainframe.theme.edit;
import com.fr.base.theme.settings.ThemedComponentStyle; import com.fr.base.theme.settings.ThemedComponentStyle;
import com.fr.design.designer.IntervalConstants; import com.fr.design.designer.IntervalConstants;
import com.fr.design.dialog.AttrScrollPane; import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.style.ComponentBodyStylePane; import com.fr.design.gui.style.ComponentBodyStylePane;
import com.fr.design.gui.style.ComponentIntegralStylePane; import com.fr.design.gui.style.ComponentIntegralStylePane;
import com.fr.design.gui.style.ComponentTitleStylePane; import com.fr.design.gui.style.ComponentTitleStylePane;
@ -18,10 +17,9 @@ import com.fr.general.act.BorderPacker;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.JComponent; import javax.swing.JComponent;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.JScrollPane; import javax.swing.JTextArea;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Color; import java.awt.Color;
import java.awt.Dimension;
/** /**
* @author Starryi * @author Starryi
@ -50,7 +48,8 @@ public class ComponentStyleEditPane extends JPanel {
}, },
new JComponent[] { createTabContainer(componentTitleStylePane), createTabContainer(componentBodyStylePane), createTabContainer(componentIntegralStylePane) } new JComponent[] { createTabContainer(componentTitleStylePane), createTabContainer(componentBodyStylePane), createTabContainer(componentIntegralStylePane) }
); );
add(content, BorderLayout.NORTH); content.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
add(content, BorderLayout.CENTER);
} }
public void populateBean(ThemedComponentStyle style) { public void populateBean(ThemedComponentStyle style) {
@ -115,21 +114,20 @@ public class ComponentStyleEditPane extends JPanel {
} }
private JComponent createTabContainer(final JPanel component) { private JComponent createTabContainer(final JPanel component) {
JPanel container = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel content = FRGUIPaneFactory.createBorderLayout_S_Pane();
container.setPreferredSize(new Dimension(container.getPreferredSize().width, 220));
JPanel tipLabelPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel tipLabelPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
tipLabelPane.setBorder(BorderFactory.createEmptyBorder(3, 0, 0, 0)); tipLabelPane.setBorder(BorderFactory.createEmptyBorder(3, 0, 0, 0));
UILabel tipLabel = LabelUtils.createLabel(Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Edit_Pane_Component_Style_Tip"), new Color(153, 153, 153)); JTextArea tipLabel = LabelUtils.createAutoWrapLabel(Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Edit_Pane_Component_Style_Tip"), new Color(153, 153, 153));
tipLabelPane.add(tipLabel); tipLabelPane.add(tipLabel);
container.add(tipLabelPane, BorderLayout.NORTH); content.add(tipLabelPane, BorderLayout.NORTH);
content.add(component, BorderLayout.CENTER);
container.add(new AttrScrollPane() {
@Override UIScrollPane scrollPane = new UIScrollPane(content);
protected JPanel createContentPane() { scrollPane.setBorder(BorderFactory.createEmptyBorder());
return component;
} JPanel container = FRGUIPaneFactory.createBorderLayout_S_Pane();
}, BorderLayout.CENTER); container.add(scrollPane, BorderLayout.CENTER);
return container; return container;

19
designer-base/src/main/java/com/fr/design/mainframe/theme/edit/ui/LabelUtils.java

@ -3,6 +3,9 @@ package com.fr.design.mainframe.theme.edit.ui;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.general.FRFont; import com.fr.general.FRFont;
import javax.swing.BorderFactory;
import javax.swing.JTextArea;
import javax.swing.plaf.basic.BasicTextAreaUI;
import java.awt.Color; import java.awt.Color;
import java.awt.Font; import java.awt.Font;
@ -26,4 +29,20 @@ public class LabelUtils {
uiLabel.setFont(newFont); uiLabel.setFont(newFont);
return uiLabel; return uiLabel;
} }
public static JTextArea createAutoWrapLabel(String title, Color color) {
JTextArea tipLabel = new JTextArea();
tipLabel.setUI(new BasicTextAreaUI());
tipLabel.setForeground(color);
Font newFont = FRFont.getInstance(tipLabel.getFont().getFontName(), Font.PLAIN, 12);
tipLabel.setFont(newFont);
tipLabel.setBorder(BorderFactory.createEmptyBorder());
tipLabel.setEnabled(false);
tipLabel.setText(title);
tipLabel.setLineWrap(true);
tipLabel.setWrapStyleWord(true);
tipLabel.setOpaque(false);
tipLabel.setBackground(null);
return tipLabel;
}
} }

1
designer-base/src/main/java/com/fr/design/mainframe/theme/edit/ui/TabbedPane.java

@ -25,7 +25,6 @@ public class TabbedPane extends JPanel {
public TabbedPane(String[] names, JComponent[] panes) { public TabbedPane(String[] names, JComponent[] panes) {
setLayout(FRGUIPaneFactory.createBorderLayout()); setLayout(FRGUIPaneFactory.createBorderLayout());
setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
for (JComponent pane :panes) { for (JComponent pane :panes) {
pane.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); pane.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));

Loading…
Cancel
Save