Browse Source

REPORT-55553 【组件背景分离】组件复用-现在组件右侧设置面板的层次效果和视觉稿不一样,层次间隔不清晰

【问题原因】
1.windows上边框线没显示出来
2.变动下层级结构,突出背景只作用于控件主体
【改动思路】
1. 绘制边框线时,边框线的大小应该是thickness的2倍
2. 修改Body样式面板的效果,去除多余的文字标签
3. 修改层级结构
final/10.0
Starryi 3 years ago
parent
commit
f90fa77a28
  1. 89
      designer-form/src/main/java/com/fr/design/gui/xpane/LayoutStylePane.java

89
designer-form/src/main/java/com/fr/design/gui/xpane/LayoutStylePane.java

@ -1,10 +1,8 @@
package com.fr.design.gui.xpane; package com.fr.design.gui.xpane;
import com.fr.base.GraphHelper;
import com.fr.base.Utils; import com.fr.base.Utils;
import com.fr.base.svg.IconUtils; import com.fr.base.svg.IconUtils;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
import com.fr.design.constants.UIConstants;
import com.fr.design.designer.IntervalConstants; import com.fr.design.designer.IntervalConstants;
import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.formula.TinyFormulaPane; import com.fr.design.formula.TinyFormulaPane;
@ -13,7 +11,6 @@ import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.ibutton.UIColorButton; import com.fr.design.gui.ibutton.UIColorButton;
import com.fr.design.gui.ibutton.UIToggleButton; import com.fr.design.gui.ibutton.UIToggleButton;
import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.icombobox.LineComboBox;
import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UISpinner; import com.fr.design.gui.ispinner.UISpinner;
@ -105,42 +102,46 @@ public class LayoutStylePane extends BasicBeanPane<LayoutBorderStyle> {
boolean currentIsRootLayout = currentEditingTemplate != null && !currentEditingTemplate.isJWorkBook() && ((JForm)currentEditingTemplate).isSelectRootPane(); boolean currentIsRootLayout = currentEditingTemplate != null && !currentEditingTemplate.isJWorkBook() && ((JForm)currentEditingTemplate).isSelectRootPane();
JPanel titlePane = createTitleStylePane(); JPanel titlePane = createTitleStylePane();
JPanel bodyContentPane = currentIsRootLayout ? createBodyContentPane4RootLayout() : createBodyContentPane();
JPanel backgroundPane = createBackgroundStylePane();
if (titlePane != null) { if (titlePane != null) {
container.add(titlePane, BorderLayout.NORTH); container.add(titlePane, BorderLayout.NORTH);
if (currentIsRootLayout) { if (currentIsRootLayout) {
titlePane.setVisible(false); titlePane.setVisible(false);
} }
} }
JPanel nextContainerPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
container.add(nextContainerPane, BorderLayout.CENTER);
//界面上表单主体只有背景和透明度可以设置 if (bodyContentPane != null) {
JPanel mainStylePane = currentIsRootLayout ? createMainStylePane4RootLayout() : createMainStylePane4WidgetLayout(); //界面上表单主体只有背景和透明度可以设置
if (mainStylePane != null) { nextContainerPane.add(bodyContentPane, BorderLayout.NORTH);
container.add(mainStylePane, BorderLayout.CENTER); }
if (backgroundPane != null) {
nextContainerPane.add(backgroundPane, BorderLayout.CENTER);
if (currentIsRootLayout) {
backgroundPane.setVisible(false);
}
} }
this.add(container, BorderLayout.CENTER); this.add(container, BorderLayout.CENTER);
} }
protected void initMainComponents() { protected JPanel createBackgroundStylePane() {
borderStyleCombo = new UIComboBox(BORDER_STYLE); borderStyleCombo = new UIComboBox(BORDER_STYLE);
borderLineAndImagePane = new BorderLineAndImagePane(); borderLineAndImagePane = new BorderLineAndImagePane();
cornerSpinner = new UISpinner(0,1000,1,0); cornerSpinner = new UISpinner(0,1000,1,0);
backgroundPane = new LayoutBackgroundSpecialPane();
backgroundOpacityPane = new UIPercentDragPane();
}
protected JPanel createMainStylePane4WidgetLayout() {
initMainComponents();
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double f = TableLayout.FILL; double f = TableLayout.FILL;
double[] rowSize = {p, p, p, p, p}; double[] rowSize = {p, p, p, p};
double[] columnSize = {SETTING_LABEL_WIDTH, f}; double[] columnSize = {SETTING_LABEL_WIDTH, f};
JPanel contentPane = TableLayoutHelper.createGapTableLayoutPane(new JComponent[][]{ JPanel contentPane = TableLayoutHelper.createGapTableLayoutPane(new JComponent[][]{
{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style_Frame_Style")), null}, {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget-Style_Background_Style")), null},
{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style_Render_Style")), borderStyleCombo}, {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style_Render_Style")), borderStyleCombo},
{this.borderLineAndImagePane, null}, {this.borderLineAndImagePane, null},
{this.createMainBackgroundAndOpacityPane(), null},
{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Radius")), cornerSpinner}, {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Radius")), cornerSpinner},
}, },
rowSize, columnSize, IntervalConstants.INTERVAL_L1, IntervalConstants.INTERVAL_L1); rowSize, columnSize, IntervalConstants.INTERVAL_L1, IntervalConstants.INTERVAL_L1);
@ -153,16 +154,23 @@ public class LayoutStylePane extends BasicBeanPane<LayoutBorderStyle> {
return container; return container;
} }
protected JPanel createMainStylePane4RootLayout() { protected JPanel createBodyContentPane() {
initMainComponents(); backgroundPane = new LayoutBackgroundSpecialPane();
backgroundOpacityPane = new UIPercentDragPane();
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double f = TableLayout.FILL; double f = TableLayout.FILL;
double[] rowSize = {p, p}; double[] rowSize = {p, p};
double[] columnSize = {SETTING_LABEL_WIDTH, f}; double[] columnSize = {SETTING_LABEL_WIDTH, f};
JPanel bodyBackground = createBackgroundAndOpacityPane(
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget-Style_Body_Fill"),
this.backgroundPane,
this.backgroundOpacityPane);
JPanel contentPane = TableLayoutHelper.createGapTableLayoutPane(new JComponent[][]{ JPanel contentPane = TableLayoutHelper.createGapTableLayoutPane(new JComponent[][]{
{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style_Frame_Style")), null}, {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget-Style_Body_Content")), null},
{this.createMainBackgroundAndOpacityPane(), null}, {bodyBackground, null},
}, },
rowSize, columnSize, IntervalConstants.INTERVAL_L1, IntervalConstants.INTERVAL_L1); rowSize, columnSize, IntervalConstants.INTERVAL_L1, IntervalConstants.INTERVAL_L1);
contentPane.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0)); contentPane.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0));
@ -174,11 +182,31 @@ public class LayoutStylePane extends BasicBeanPane<LayoutBorderStyle> {
return container; return container;
} }
protected JPanel createMainBackgroundAndOpacityPane() { protected JPanel createBodyContentPane4RootLayout() {
return createBackgroundAndOpacityPane( backgroundPane = new LayoutBackgroundSpecialPane();
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget-Style_Body_Background"), backgroundOpacityPane = new UIPercentDragPane();
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] rowSize = {p};
double[] columnSize = {SETTING_LABEL_WIDTH, f};
JPanel bodyBackground = createBackgroundAndOpacityPane(
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget-Style_Body_Fill"),
this.backgroundPane, this.backgroundPane,
this.backgroundOpacityPane); this.backgroundOpacityPane);
JPanel contentPane = TableLayoutHelper.createGapTableLayoutPane(new JComponent[][]{
{bodyBackground, null},
},
rowSize, columnSize, IntervalConstants.INTERVAL_L1, IntervalConstants.INTERVAL_L1);
contentPane.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0));
JPanel container = FRGUIPaneFactory.createBorderLayout_S_Pane();
container.setBorder(new BottomLineBorder());
container.add(contentPane, BorderLayout.NORTH);
return container;
} }
protected void initTitleComponents() { protected void initTitleComponents() {
@ -489,16 +517,25 @@ public class LayoutStylePane extends BasicBeanPane<LayoutBorderStyle> {
protected static class BottomLineBorder extends LineBorder { protected static class BottomLineBorder extends LineBorder {
public BottomLineBorder() { public BottomLineBorder() {
super(Color.lightGray, 1); super(new Color(217, 218, 221), 1);
} }
@Override @Override
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) { public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
Graphics2D g2d = (Graphics2D) g; Graphics2D g2d = (Graphics2D) g;
Color oldColor = g2d.getColor(); Color oldColor = g2d.getColor();
g2d.setColor(this.lineColor); Stroke oldStroke = g2d.getStroke();
GraphHelper.drawLine(g, 0, height, width, height, 1);
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2d.setColor(getLineColor());
g2d.setStroke(new BasicStroke(getThickness() * 2));
g2d.drawLine(0, height, width, height);
g2d.setStroke(oldStroke);
g2d.setColor(oldColor); g2d.setColor(oldColor);
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
} }
} }

Loading…
Cancel
Save