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()); - } - - } }