From f59955689a27ae611b34d9659afaeacf720d479a Mon Sep 17 00:00:00 2001 From: kerry Date: Wed, 9 Sep 2020 12:41:32 +0800 Subject: [PATCH 1/2] =?UTF-8?q?REPORT-35149=20=E6=89=93=E5=8C=85=E5=A4=B1?= =?UTF-8?q?=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/designer/creator/XCreator.java | 6 ++ .../design/designer/creator/XElementCase.java | 13 ++++ .../creator/XWAbsoluteBodyLayout.java | 9 +++ .../design/designer/creator/XWFitLayout.java | 9 +++ .../creator/cardlayout/XWTabFitLayout.java | 9 +++ .../fr/design/mainframe/ToolBarButton.java | 1 + .../AccessibleWLayoutBorderStyleEditor.java | 77 +++---------------- 7 files changed, 59 insertions(+), 65 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java b/designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java index 20f2788117..085ca7c52e 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java @@ -838,6 +838,12 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo return image; } + /** + * 初始化组件的预定义信息 + */ + public void initWidgetPredefinedInfo(){ + + } } diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XElementCase.java b/designer-form/src/main/java/com/fr/design/designer/creator/XElementCase.java index d84fd2e0cd..c624386c00 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XElementCase.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XElementCase.java @@ -21,9 +21,12 @@ import com.fr.form.FormProvider; import com.fr.form.ui.ElementCaseEditor; import com.fr.form.ui.ElementCaseEditorProvider; +import com.fr.form.ui.NameLayoutBorderStyle; +import com.fr.form.ui.NamePaddingMargin; import com.fr.report.fit.ReportFitAttr; import com.fr.stable.ArrayUtils; import com.fr.stable.CoreGraphHelper; +import com.fr.stable.StringUtils; import com.fr.stable.core.PropertyChangeAdapter; import com.fr.report.fit.FitProvider; @@ -389,4 +392,14 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme } } + /** + * 初始化组件的预定义信息 + */ + public void initWidgetPredefinedInfo(){ + this.toData().setNameMargin(NamePaddingMargin.createPredefinedStyle(StringUtils.EMPTY)); + this.toData().setNameBorderStyle(NameLayoutBorderStyle.createPredefinedStyle(StringUtils.EMPTY)); + + } + + } diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteBodyLayout.java b/designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteBodyLayout.java index 5db000e189..0d98e86937 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteBodyLayout.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteBodyLayout.java @@ -8,8 +8,10 @@ import com.fr.design.fun.WidgetPropertyUIProvider; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.widget.editors.WLayoutBorderStyleEditor; import com.fr.design.mainframe.widget.topxcreator.BasicTopXCreator; +import com.fr.form.ui.NameFormBackground; import com.fr.form.ui.container.WAbsoluteBodyLayout; +import com.fr.stable.StringUtils; import com.fr.stable.core.PropertyChangeAdapter; import java.awt.Component; @@ -136,4 +138,11 @@ public class XWAbsoluteBodyLayout extends XWAbsoluteLayout { public BasicTopXCreator getTopXCreator() { return null; } + + /** + * 初始化组件的预定义信息 + */ + public void initWidgetPredefinedInfo(){ + this.toData().setNameBackground(NameFormBackground.createPredefinedStyle(StringUtils.EMPTY)); + } } diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XWFitLayout.java b/designer-form/src/main/java/com/fr/design/designer/creator/XWFitLayout.java index 06aca3c1b3..c9462b60d3 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XWFitLayout.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XWFitLayout.java @@ -12,6 +12,7 @@ import com.fr.design.mainframe.FormArea; import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.WidgetPropertyPane; import com.fr.design.utils.gui.LayoutUtils; +import com.fr.form.ui.NameFormBackground; import com.fr.form.ui.PaddingMargin; import com.fr.form.ui.Widget; import com.fr.form.ui.container.WAbsoluteLayout.BoundsWidget; @@ -23,6 +24,7 @@ import com.fr.general.FRLogger; import com.fr.general.FRScreen; import com.fr.stable.ArrayUtils; import com.fr.stable.AssistUtils; +import com.fr.stable.StringUtils; import javax.swing.JOptionPane; import java.awt.Component; @@ -1337,4 +1339,11 @@ public class XWFitLayout extends XLayoutContainer { } } } + /** + * 初始化组件的预定义信息 + */ + public void initWidgetPredefinedInfo(){ + this.toData().setNameBackground(NameFormBackground.createPredefinedStyle(StringUtils.EMPTY)); + } + } diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWTabFitLayout.java b/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWTabFitLayout.java index 8d5d232fa6..86a816d9af 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWTabFitLayout.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWTabFitLayout.java @@ -21,12 +21,14 @@ import com.fr.design.mainframe.widget.editors.ButtonTypeEditor; import com.fr.design.mainframe.widget.editors.ImgBackgroundEditor; import com.fr.design.utils.gui.LayoutUtils; import com.fr.form.ui.CardSwitchButton; +import com.fr.form.ui.NameFormBackground; import com.fr.form.ui.container.WAbsoluteLayout.BoundsWidget; import com.fr.form.ui.container.cardlayout.WCardTagLayout; import com.fr.form.ui.container.cardlayout.WTabFitLayout; import com.fr.general.Background; import com.fr.stable.ArrayUtils; +import com.fr.stable.StringUtils; import com.fr.stable.core.PropertyChangeAdapter; import javax.swing.border.Border; @@ -639,4 +641,11 @@ public class XWTabFitLayout extends XWFitLayout { checkVisible(); } + /** + * 初始化组件的预定义信息 + */ + public void initWidgetPredefinedInfo(){ + this.toData().setNameBackground(NameFormBackground.createCustomStyleWithBackground(null)); + } + } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/ToolBarButton.java b/designer-form/src/main/java/com/fr/design/mainframe/ToolBarButton.java index f7558b07f1..ad0f5c86bb 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/ToolBarButton.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/ToolBarButton.java @@ -94,6 +94,7 @@ public class ToolBarButton extends UIButton implements MouseListener, MouseMotio } if (creatorSource != null) { XCreator xCreator = XCreatorUtils.createXCreator(creatorSource); + xCreator.initWidgetPredefinedInfo(); WidgetToolBarPane.getTarget().startDraggingBean(xCreator); FormDesignerUtils.addWidgetProcessInfo(xCreator.toData()); lastPressEvent = null; diff --git a/designer-form/src/main/java/com/fr/design/mainframe/widget/accessibles/AccessibleWLayoutBorderStyleEditor.java b/designer-form/src/main/java/com/fr/design/mainframe/widget/accessibles/AccessibleWLayoutBorderStyleEditor.java index 03e667bce6..628c65c8ef 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/widget/accessibles/AccessibleWLayoutBorderStyleEditor.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/widget/accessibles/AccessibleWLayoutBorderStyleEditor.java @@ -4,35 +4,33 @@ package com.fr.design.mainframe.widget.accessibles; -import com.fr.design.Exception.ValidationException; -import com.fr.design.designer.properties.Decoder; -import com.fr.design.designer.properties.Encoder; -import com.fr.design.gui.xpane.PredefinedComponentStyleSettingPane; import com.fr.design.mainframe.widget.editors.ITextComponent; -import com.fr.design.mainframe.widget.renderer.EncoderCellRenderer; +import com.fr.design.mainframe.widget.renderer.LayoutBorderStyleRenderer; +import com.fr.design.mainframe.widget.wrappers.LayoutBorderStyleWrapper; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.DialogActionAdapter; -import com.fr.design.widget.ui.designer.layout.ComponentStyle; +import com.fr.design.gui.xpane.LayoutBorderPane; +import com.fr.form.ui.LayoutBorderStyle; -import javax.swing.SwingUtilities; -import java.awt.Dimension; +import javax.swing.*; +import java.awt.*; public class AccessibleWLayoutBorderStyleEditor extends UneditableAccessibleEditor { - private PredefinedComponentStyleSettingPane borderPane; + private LayoutBorderPane borderPane; public AccessibleWLayoutBorderStyleEditor() { - super(new ComponentStyleWrapper()); + super(new LayoutBorderStyleWrapper()); } @Override protected ITextComponent createTextField() { - return new RendererField(new ComponentStyleRenderer()); + return new RendererField(new LayoutBorderStyleRenderer()); } @Override protected void showEditorPane() { if (borderPane == null) { - borderPane = new PredefinedComponentStyleSettingPane(); + borderPane = new LayoutBorderPane(); borderPane.setPreferredSize(new Dimension(600, 400)); } BasicDialog dlg = borderPane.showWindow(SwingUtilities.getWindowAncestor(this)); @@ -40,62 +38,11 @@ public class AccessibleWLayoutBorderStyleEditor extends UneditableAccessibleEdit @Override public void doOk() { - setValue(borderPane.updateBean()); + setValue(borderPane.update()); fireStateChanged(); } }); - borderPane.populateBean((ComponentStyle) getValue()); + borderPane.populate((LayoutBorderStyle)getValue()); dlg.setVisible(true); } - - - private static class ComponentStyleWrapper implements Encoder, Decoder { - public ComponentStyleWrapper() { - - } - - /** - * 将属性转化成字符串 - * - * @param v 属性对象 - * @return 字符串 - */ - public String encode(Object v) { - if (v == null) { - return null; - } - ComponentStyle style = (ComponentStyle) v; - //todo - return "标准"; - } - - /** - * 将字符串转化成属性 - * - * @param txt 字符串 - * @return 属性对象 - */ - public Object decode(String txt) { - return null; - } - - /** - * 符合规则 - * - * @param txt 字符串 - * @throws ValidationException 抛错 - */ - public void validate(String txt) throws ValidationException { - - } - - } - - private static class ComponentStyleRenderer extends EncoderCellRenderer { - - public ComponentStyleRenderer() { - super(new ComponentStyleWrapper()); - } - - } } From 5a8b0ac6a27e6a7ddf4a95c36904e12cb06e1f3b Mon Sep 17 00:00:00 2001 From: kerry Date: Wed, 9 Sep 2020 14:23:31 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=8D=95=E5=85=83=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/mainframe/JWorkBook.java | 18 +++++++++++++++--- .../report/ReportPredefinedBackgroundPane.java | 5 +++-- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java b/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java index a21be8c6f9..7d26f076da 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java @@ -2,6 +2,7 @@ package com.fr.design.mainframe; import com.fr.base.BaseUtils; import com.fr.base.DynamicUnitList; +import com.fr.form.ui.NameBackground; import com.fr.base.Parameter; import com.fr.base.ScreenResolution; import com.fr.base.extension.FileExtension; @@ -93,6 +94,8 @@ import com.fr.report.cell.cellattr.CellImage; import com.fr.report.cell.painter.CellImagePainter; import com.fr.report.elementcase.TemplateElementCase; import com.fr.report.poly.PolyWorkSheet; +import com.fr.report.report.Report; +import com.fr.report.stable.ReportSettings; import com.fr.report.worksheet.WorkSheet; import com.fr.stable.ArrayUtils; import com.fr.stable.AssistUtils; @@ -135,9 +138,21 @@ public class JWorkBook extends JTemplate { public JWorkBook() { super(new WorkBook(new WorkSheet()), DEFAULT_WB_FILE_PREFIX); + initPredefinedInfo(); populateReportParameterAttr(); } + private void initPredefinedInfo() { + WorkBook workBook = this.getTarget(); + for (int i = 0; i < workBook.getReportCount(); i++) { + Report report = workBook.getReport(i); + if (report != null) { + NameBackground initBackground = NameBackground.createPredefinedStyle(StringUtils.EMPTY); + ((ReportSettings) report.getReportSettings()).setNameBackground(initBackground); + } + } + } + public JWorkBook(WorkBookX workBookX) { super(new WorkBookAdapter(workBookX), DEFAULT_WBX_FILE_PREFIX); populateReportParameterAttr(); @@ -153,9 +168,6 @@ public class JWorkBook extends JTemplate { populateReportParameterAttr(); } - public void resetPreferenceStyle(){ - - } @Override protected void addPane(PropertyItemPaneProvider provider) { diff --git a/designer-realize/src/main/java/com/fr/design/report/ReportPredefinedBackgroundPane.java b/designer-realize/src/main/java/com/fr/design/report/ReportPredefinedBackgroundPane.java index 5aac2674a3..7594befd51 100644 --- a/designer-realize/src/main/java/com/fr/design/report/ReportPredefinedBackgroundPane.java +++ b/designer-realize/src/main/java/com/fr/design/report/ReportPredefinedBackgroundPane.java @@ -1,6 +1,7 @@ package com.fr.design.report; -import com.fr.base.NameBackground; +import com.fr.config.predefined.PredefinedNameStyleProvider; +import com.fr.form.ui.NameBackground; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.predefined.ui.PredefinedStyleSettingPane; @@ -66,7 +67,7 @@ public class ReportPredefinedBackgroundPane extends PredefinedStyleSettingPane