Browse Source

Pull request #11453: REPORT-83259 & REPORT-83263 【最强控件】控件样式跟随主题&开放自定义

Merge in DESIGN/design from ~BRUCE.DENG/design:feature/x to feature/x

* commit '12e1c1489fecdea9b25c8ea4024de4780b6aea1f':
  REPORT-83259 & REPORT-83263 【最强控件】控件样式跟随主题&开放自定义
  REPORT-83259 & REPORT-83263 【最强控件】控件样式跟随主题&开放自定义
  REPORT-83259 & REPORT-83263 【最强控件】控件样式跟随主题&开放自定义
feature/x
Bruce.Deng-邓铖臻 2 years ago
parent
commit
7778c4f8d2
  1. 35
      designer-base/src/main/java/com/fr/design/fun/TemplateThemePaneProvider.java
  2. 26
      designer-base/src/main/java/com/fr/design/fun/impl/AbstractTemplateThemePaneProvider.java
  3. 9
      designer-base/src/main/java/com/fr/design/mainframe/theme/FormThemeProfilePane.java
  4. 10
      designer-base/src/main/java/com/fr/design/mainframe/theme/ReportThemeProfilePane.java
  5. 47
      designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeEditorPane.java
  6. 23
      designer-base/src/main/java/com/fr/design/mainframe/theme/processor/AbstractThemePreviewPaneProcessor.java
  7. 35
      designer-base/src/main/java/com/fr/design/mainframe/theme/processor/ThemePreviewPaneProcessor.java
  8. 42
      designer-form/src/main/java/com/fr/design/fun/WidgetAdvancedPaneProvider.java
  9. 26
      designer-form/src/main/java/com/fr/design/fun/impl/AbstractWidgetAdvancedPaneProvider.java
  10. 91
      designer-form/src/main/java/com/fr/design/parameter/RootDesignDefinePane.java
  11. 65
      designer-form/src/main/java/com/fr/design/widget/ui/designer/FieldEditorDefinePane.java
  12. 3
      designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java

35
designer-base/src/main/java/com/fr/design/fun/TemplateThemePaneProvider.java

@ -0,0 +1,35 @@
package com.fr.design.fun;
import com.fr.design.beans.BasicBeanPane;
import com.fr.stable.fun.mark.Mutable;
/**
* 设计器模板主题管理-细节定制部分,支持添加tab
*
* @author Bruce.Deng
* @version 11.0
* Created by Bruce.Deng on 2023/2/7
*/
public interface TemplateThemePaneProvider<T> extends Mutable {
String XML_TAG = "TemplateThemePaneProvider";
int CURRENT_LEVEL = 1;
/**
* 插入tab的位置
*
* @param total 已插入的tab数
* @return 插入位置如果想放到最后则返回-1
*/
int getInsertPosition(int total);
/**
* 获取tab对象
*
* @return tab对象
*/
BasicBeanPane<T> getTab();
}

26
designer-base/src/main/java/com/fr/design/fun/impl/AbstractTemplateThemePaneProvider.java

@ -0,0 +1,26 @@
package com.fr.design.fun.impl;
import com.fr.design.fun.TemplateThemePaneProvider;
import com.fr.stable.fun.impl.AbstractProvider;
import com.fr.stable.fun.mark.API;
/**
* @author Bruce.Deng
* @version 11.0
* @see TemplateThemePaneProvider
* Created by Bruce.Deng on 2023/2/7
*/
@API(level = TemplateThemePaneProvider.CURRENT_LEVEL)
public abstract class AbstractTemplateThemePaneProvider<T> extends AbstractProvider implements TemplateThemePaneProvider<T> {
@Override
public int currentAPILevel() {
return CURRENT_LEVEL;
}
@Override
public String mark4Provider() {
return getClass().getName();
}
}

9
designer-base/src/main/java/com/fr/design/mainframe/theme/FormThemeProfilePane.java

@ -4,12 +4,14 @@ import com.fr.base.theme.FormTheme;
import com.fr.base.theme.TemplateThemeConfig;
import com.fr.base.theme.settings.ThemedComponentStyle;
import com.fr.base.theme.settings.ThemedFormBodyStyle;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.theme.edit.ChartStyleFormEditPane;
import com.fr.design.mainframe.theme.edit.ComponentStyleEditPane;
import com.fr.design.mainframe.theme.edit.FormBodyStyleEditPane;
import com.fr.design.mainframe.theme.preview.FormThemePreviewPane;
import com.fr.design.mainframe.theme.processor.ThemePreviewPaneProcessor;
import javax.swing.JPanel;
@ -31,7 +33,11 @@ public class FormThemeProfilePane extends TemplateThemeProfilePane<FormTheme> {
}
@Override
public FormThemePreviewPane createThemePreviewPane() {
public TemplateThemePreviewPane<FormTheme> createThemePreviewPane() {
ThemePreviewPaneProcessor processor = ExtraDesignClassManager.getInstance().getSingle(ThemePreviewPaneProcessor.XML_TAG);
if (processor != null) {
return processor.createFormThemePreviewPane();
}
return new FormThemePreviewPane();
}
@ -61,6 +67,7 @@ public class FormThemeProfilePane extends TemplateThemeProfilePane<FormTheme> {
componentStyleSettingPane = new ComponentStyleEditPane();
addCustomEditorPane(i18nText("Fine-Design_Predefined_Component_Style"), componentStyleSettingPane);
refreshExtraAdvancedPane();
}
@Override

10
designer-base/src/main/java/com/fr/design/mainframe/theme/ReportThemeProfilePane.java

@ -2,10 +2,11 @@ package com.fr.design.mainframe.theme;
import com.fr.base.theme.ReportTheme;
import com.fr.base.theme.TemplateThemeConfig;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.theme.edit.ReportBodyStyleEditPane;
import com.fr.design.mainframe.theme.preview.ReportThemePreviewPane;
import javax.swing.JPanel;
import com.fr.design.mainframe.theme.processor.ThemePreviewPaneProcessor;
/**
* @author Starryi
@ -20,7 +21,11 @@ public class ReportThemeProfilePane extends TemplateThemeProfilePane<ReportTheme
}
@Override
public ReportThemePreviewPane createThemePreviewPane() {
public TemplateThemePreviewPane<ReportTheme> createThemePreviewPane() {
ThemePreviewPaneProcessor processor = ExtraDesignClassManager.getInstance().getSingle(ThemePreviewPaneProcessor.XML_TAG);
if (processor != null) {
return processor.createReportThemePreviewPane();
}
return new ReportThemePreviewPane();
}
@ -44,6 +49,7 @@ public class ReportThemeProfilePane extends TemplateThemeProfilePane<ReportTheme
addCustomEditorPane(Toolkit.i18nText("Fine-Design_Predefined_Template_Background"), reportBodyStyleSettingPane);
addCustomEditorPane(Toolkit.i18nText("Fine-Design_Predefined_Cell_Style"), createCellStyleSettingPane());
addCustomEditorPane(Toolkit.i18nText("Fine-Design_Predefined_Chart_Style"), createChartStyleSettingPane());
refreshExtraAdvancedPane();
}
@Override

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

@ -1,13 +1,14 @@
package com.fr.design.mainframe.theme;
import com.fr.base.theme.FineColorFlushUtils;
import com.fr.base.theme.FineColorManager;
import com.fr.base.theme.FineColorSynchronizer;
import com.fr.base.theme.TemplateTheme;
import com.fr.base.theme.TemplateThemeConfig;
import com.fr.base.theme.settings.ThemedCellStyleList;
import com.fr.base.theme.settings.ThemedColorScheme;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.designer.IntervalConstants;
import com.fr.design.fun.TemplateThemePaneProvider;
import com.fr.design.gui.frpane.AbstractAttrNoScrollPane;
import com.fr.design.gui.frpane.AttributeChangeListener;
import com.fr.design.gui.frpane.UITabbedPane;
@ -23,6 +24,9 @@ import com.fr.design.mainframe.theme.edit.ui.LabelUtils;
import com.fr.design.mainframe.theme.ui.AutoCheckTextField;
import com.fr.design.mainframe.theme.ui.AutoCheckThemeNameTextField;
import com.fr.design.mainframe.theme.ui.BorderUtils;
import com.fr.general.GeneralContext;
import com.fr.plugin.observer.PluginEvent;
import com.fr.plugin.observer.PluginEventListener;
import com.fr.stable.StringUtils;
import javax.swing.BorderFactory;
@ -34,7 +38,9 @@ import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
/**
* @author Starryi
@ -52,6 +58,7 @@ public abstract class TemplateThemeEditorPane<T extends TemplateTheme> extends J
protected ColorListPane colorListPane;
protected CellStyleListEditPane cellStyleSettingPane;
protected ChartStyleEditPane chartStyleSettingPane;
protected final List<BasicBeanPane<T>> extraPaneList = new ArrayList<>();
protected boolean isPopulating = false;
protected UITabbedPane uiTabbedPane;
@ -171,7 +178,7 @@ public abstract class TemplateThemeEditorPane<T extends TemplateTheme> extends J
uiTabbedPane = new UITabbedPane();
uiTabbedPane.setBorder(BorderFactory.createEmptyBorder(10, 5, 10, 1));
container.add(uiTabbedPane, BorderLayout.CENTER);
initPluginListener();
return container;
}
@ -192,6 +199,33 @@ public abstract class TemplateThemeEditorPane<T extends TemplateTheme> extends J
});
uiTabbedPane.addTab(title, settingPane);
}
protected void refreshExtraAdvancedPane() {
extraPaneList.clear();
Set<TemplateThemePaneProvider<T>> providers = ExtraDesignClassManager.getInstance().getArray(TemplateThemePaneProvider.XML_TAG);
for (TemplateThemePaneProvider<T> provider : providers) {
insertShortCut(provider.getInsertPosition(extraPaneList.size()), provider.getTab());
}
for (BasicBeanPane<T> pane : extraPaneList) {
addCustomEditorPane(pane.getTitle(), pane);
}
}
private void insertShortCut(int index, BasicBeanPane<T> pane) {
int size = extraPaneList.size();
index = Math.min(index, size);
extraPaneList.add(index, pane);
}
private void initPluginListener() {
GeneralContext.listenPluginRunningChanged(new PluginEventListener() {
@Override
public void on(PluginEvent event) {
refreshExtraAdvancedPane();
}
}, pluginContext -> pluginContext.getRuntime().contain(TemplateThemePaneProvider.XML_TAG));
}
protected JPanel createCellStyleSettingPane() {
JPanel container = FRGUIPaneFactory.createBorderLayout_S_Pane();
cellStyleSettingPane = new CellStyleListEditPane();
@ -223,6 +257,9 @@ public abstract class TemplateThemeEditorPane<T extends TemplateTheme> extends J
colorListPane.populate(theme.getColorScheme().getColors());
populateBean4CustomEditors(theme);
for (BasicBeanPane<T> pane : extraPaneList) {
pane.populateBean(theme);
}
isPopulating = false;
}
@ -243,7 +280,9 @@ public abstract class TemplateThemeEditorPane<T extends TemplateTheme> extends J
theme.setColorScheme(colorScheme);
updateBean4CustomEditors(theme);
for (BasicBeanPane<T> pane : extraPaneList) {
pane.updateBean(theme);
}
return theme;
}

23
designer-base/src/main/java/com/fr/design/mainframe/theme/processor/AbstractThemePreviewPaneProcessor.java

@ -0,0 +1,23 @@
package com.fr.design.mainframe.theme.processor;
import com.fr.stable.fun.mark.API;
/**
* @author Bruce.Deng
* @version 11.0
* Created by Bruce.Deng on 2023/2/14
*/
@API(level = ThemePreviewPaneProcessor.CURRENT_LEVEL)
public abstract class AbstractThemePreviewPaneProcessor implements ThemePreviewPaneProcessor {
@Override
public int currentAPILevel() {
return CURRENT_LEVEL;
}
@Override
public int layerIndex() {
return DEFAULT_LAYER_INDEX;
}
}

35
designer-base/src/main/java/com/fr/design/mainframe/theme/processor/ThemePreviewPaneProcessor.java

@ -0,0 +1,35 @@
package com.fr.design.mainframe.theme.processor;
import com.fr.base.theme.FormTheme;
import com.fr.base.theme.ReportTheme;
import com.fr.design.mainframe.theme.TemplateThemePreviewPane;
import com.fr.stable.fun.mark.Immutable;
/**
* 主题样式预览界面接口
*
* @author Bruce.Deng
* @version 11.0
* Created by Bruce.Deng on 2023/2/14
*/
public interface ThemePreviewPaneProcessor extends Immutable {
String XML_TAG = "ThemePreviewPaneProcessor";
int CURRENT_LEVEL = 1;
/**
* 创建报表主题样式预览界面
*
* @return 报表主题样式预览界面
*/
TemplateThemePreviewPane<ReportTheme> createReportThemePreviewPane();
/**
* 创建决策报表主题样式预览界面
*
* @return 决策报表主题样式预览界面
*/
TemplateThemePreviewPane<FormTheme> createFormThemePreviewPane();
}

42
designer-form/src/main/java/com/fr/design/fun/WidgetAdvancedPaneProvider.java

@ -0,0 +1,42 @@
package com.fr.design.fun;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.designer.creator.XCreator;
import com.fr.stable.fun.mark.Mutable;
/**
* 设计器控件的属性设置下高级设置项扩展支持追加设置项
*
* @author Bruce.Deng
* @version 11.0
* Created by Bruce.Deng on 2023/2/15
*/
public interface WidgetAdvancedPaneProvider<T> extends Mutable {
String XML_TAG = "WidgetAdvancedPaneProvider";
int CURRENT_LEVEL = 1;
/**
* 获取插入的位置
*
* @param total 已插入的面板数
* @return 插入位置如果想放到最后则返回-1
*/
int getInsertPosition(int total);
/**
* 根据XCreator判断是否需要处理
*
* @param creator
* @return true:需要处理;false:不处理
*/
boolean accept(XCreator creator);
/**
* 创建控件高级设置项的追加面板
*
* @return 高级设置项追加面板
*/
BasicBeanPane<T> createExtraAdvancedPane();
}

26
designer-form/src/main/java/com/fr/design/fun/impl/AbstractWidgetAdvancedPaneProvider.java

@ -0,0 +1,26 @@
package com.fr.design.fun.impl;
import com.fr.design.fun.WidgetAdvancedPaneProvider;
import com.fr.stable.fun.impl.AbstractProvider;
import com.fr.stable.fun.mark.API;
/**
* @author Bruce.Deng
* @version 11.0
* @see WidgetAdvancedPaneProvider
* Created by Bruce.Deng on 2023/2/15
*/
@API(level = WidgetAdvancedPaneProvider.CURRENT_LEVEL)
public abstract class AbstractWidgetAdvancedPaneProvider<T> extends AbstractProvider implements WidgetAdvancedPaneProvider<T> {
@Override
public int currentAPILevel() {
return CURRENT_LEVEL;
}
@Override
public String mark4Provider() {
return getClass().getName();
}
}

91
designer-form/src/main/java/com/fr/design/parameter/RootDesignDefinePane.java

@ -2,6 +2,7 @@ package com.fr.design.parameter;
import com.fr.base.BaseUtils;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.data.DataCreatorUI;
import com.fr.design.designer.IntervalConstants;
import com.fr.design.designer.creator.CRPropertyDescriptor;
@ -13,6 +14,7 @@ import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.fit.common.TemplateTool;
import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.fun.ParameterExpandablePaneUIProvider;
import com.fr.design.fun.WidgetAdvancedPaneProvider;
import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel;
@ -32,6 +34,9 @@ import com.fr.design.widget.ui.designer.AbstractDataModify;
import com.fr.design.widget.ui.designer.component.UIBoundSpinner;
import com.fr.form.ui.container.WParameterLayout;
import com.fr.general.Background;
import com.fr.general.GeneralContext;
import com.fr.plugin.observer.PluginEvent;
import com.fr.plugin.observer.PluginEventListener;
import com.fr.report.stable.FormConstants;
import javax.swing.BorderFactory;
@ -41,6 +46,8 @@ import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Rectangle;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
/**
@ -59,6 +66,8 @@ public class RootDesignDefinePane extends AbstractDataModify<WParameterLayout> {
//是否是新设计模式下决策报表
private boolean newForm;
private PropertyGroupPane extraPropertyGroupPane;
protected final List<BasicBeanPane<WParameterLayout>> extraPaneList = new ArrayList<>();
private JPanel backgroundPane;
public RootDesignDefinePane(XCreator xCreator) {
super(xCreator);
@ -144,7 +153,6 @@ public class RootDesignDefinePane extends AbstractDataModify<WParameterLayout> {
fireAfterEditor.setSelected(false);
}
});
background = new AccessibleBackgroundEditor();
Icon[] hAlignmentIconArray = {BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_left_normal.png"),
BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_center_normal.png"),
BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_right_normal.png"),};
@ -152,6 +160,8 @@ public class RootDesignDefinePane extends AbstractDataModify<WParameterLayout> {
hAlignmentPane = new UIButtonGroup<Integer>(hAlignmentIconArray, hAlignment);
hAlignmentPane.setAllToolTips(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_StyleAlignment_Left")
, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_StyleAlignment_Center"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_StyleAlignment_Right")});
backgroundPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
this.initExtraPane();
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
double[] rowSize = {p, p, p, p, p, p};
@ -159,7 +169,7 @@ public class RootDesignDefinePane extends AbstractDataModify<WParameterLayout> {
int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}};
Component[][] components = new Component[][]{
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Label_Name")), labelNameTextField},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Base_Background")), background},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Base_Background")), backgroundPane},
new Component[]{displayReport, null},
new Component[]{useParamsTemplate, null},
new Component[]{fireAfterEditor, null},
@ -176,6 +186,54 @@ public class RootDesignDefinePane extends AbstractDataModify<WParameterLayout> {
return jPanel;
}
private void initExtraPane() {
initPluginListener();
refreshExtraAdvancedPane();
}
private void initPluginListener() {
GeneralContext.listenPluginRunningChanged(new PluginEventListener() {
@Override
public void on(PluginEvent event) {
refreshExtraAdvancedPane();
}
}, pluginContext -> pluginContext.getRuntime().contain(WidgetAdvancedPaneProvider.XML_TAG));
}
private void refreshExtraAdvancedPane() {
extraPaneList.clear();
backgroundPane.removeAll();
Set<WidgetAdvancedPaneProvider<WParameterLayout>> providers = ExtraDesignClassManager.getInstance().getArray(WidgetAdvancedPaneProvider.XML_TAG);
for (WidgetAdvancedPaneProvider<WParameterLayout> provider : providers) {
if (!provider.accept(creator)) {
continue;
}
insertShortCut(provider.getInsertPosition(extraPaneList.size()), provider.createExtraAdvancedPane());
}
if (extraPaneList.isEmpty()) {
if (background == null) {
background = new AccessibleBackgroundEditor();
}
backgroundPane.add(background);
} else {
for (BasicBeanPane<WParameterLayout> pane : extraPaneList) {
backgroundPane.add(pane);
}
}
}
/**
* 插入配置项面板
*
* @param index 插入的位置
* @param pane 配置项面板
*/
public void insertShortCut(int index, BasicBeanPane<WParameterLayout> pane) {
int size = extraPaneList.size();
index = Math.min(index, size);
extraPaneList.add(index, pane);
}
/**
* @param
* @Description: 获取新决策报表的AdvancePane
@ -199,8 +257,8 @@ public class RootDesignDefinePane extends AbstractDataModify<WParameterLayout> {
fireAfterEditor.setSelected(false);
}
});
background = new AccessibleBackgroundEditor();
backgroundPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
this.initExtraPane();
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
double[] rowSize = {p, p, p, p, p};
@ -208,7 +266,7 @@ public class RootDesignDefinePane extends AbstractDataModify<WParameterLayout> {
int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}};
Component[][] components = new Component[][]{
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Label_Name")), labelNameTextField},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Base_Background")), background},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Base_Background")), backgroundPane},
new Component[]{displayReport, null},
new Component[]{useParamsTemplate, null},
new Component[]{fireAfterEditor, null},
@ -229,7 +287,13 @@ public class RootDesignDefinePane extends AbstractDataModify<WParameterLayout> {
@Override
public void populateBean(WParameterLayout ob) {
labelNameTextField.setText(ob.getLabelName());
background.setValue(ob.getBackground());
if (extraPaneList.isEmpty()) {
background.setValue(ob.getBackground());
} else {
for (BasicBeanPane<WParameterLayout> pane : extraPaneList) {
pane.populateBean(ob);
}
}
displayReport.setSelected(ob.isDelayDisplayContent());
useParamsTemplate.setSelected(ob.isUseParamsTemplate());
fireAfterEditor.setEnabled(ob.isUseParamsTemplate());
@ -277,8 +341,14 @@ public class RootDesignDefinePane extends AbstractDataModify<WParameterLayout> {
wParameterLayout.setParamsFireStopEdit(fireAfterEditor.isSelected());
JTemplate jTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
jTemplate.needAddTemplateIdAttr(useParamsTemplate.isSelected());
wParameterLayout.setBackground((Background) background.getValue());
wParameterLayout.setPosition((Integer) hAlignmentPane.getSelectedItem());
if (extraPaneList.isEmpty()) {
wParameterLayout.setBackground((Background) background.getValue());
} else {
for (BasicBeanPane<WParameterLayout> pane : extraPaneList) {
pane.updateBean(wParameterLayout);
}
}
return wParameterLayout;
}
@ -299,6 +369,13 @@ public class RootDesignDefinePane extends AbstractDataModify<WParameterLayout> {
JTemplate jTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
jTemplate.needAddTemplateIdAttr(useParamsTemplate.isSelected());
wParameterLayout.setBackground((Background) background.getValue());
if (extraPaneList.isEmpty()) {
background.setValue(wParameterLayout.getBackground());
} else {
for (BasicBeanPane<WParameterLayout> pane : extraPaneList) {
pane.populateBean(wParameterLayout);
}
}
//设置参数模板面板的高度
int height = (int) paraHeight.getTextField().getValue();
FormDesigner designer = TemplateTool.getCurrentEditingNewJForm().getFormDesign();

65
designer-form/src/main/java/com/fr/design/widget/ui/designer/FieldEditorDefinePane.java

@ -1,6 +1,7 @@
package com.fr.design.widget.ui.designer;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.beans.ErrorMsgTextFieldAdapter;
import com.fr.design.beans.UITextFieldAdapter;
import com.fr.design.constants.LayoutConstants;
@ -12,6 +13,7 @@ import com.fr.design.designer.creator.XWFitLayout;
import com.fr.design.designer.creator.XWParameterLayout;
import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.fun.TextFieldAdapterProvider;
import com.fr.design.fun.WidgetAdvancedPaneProvider;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField;
@ -19,7 +21,10 @@ import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.widget.ui.designer.component.FontSizeComboPane;
import com.fr.form.ui.FieldEditor;
import com.fr.general.GeneralContext;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.observer.PluginEvent;
import com.fr.plugin.observer.PluginEventListener;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
@ -27,6 +32,9 @@ import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
public abstract class FieldEditorDefinePane<T extends FieldEditor> extends AbstractDataModify<T> {
protected UICheckBox allowBlankCheckBox;
@ -35,7 +43,8 @@ public abstract class FieldEditorDefinePane<T extends FieldEditor> extends Abstr
protected JPanel validatePane;
protected FontSizeComboPane fontSizePane;
protected UITextField labelNameTextField;
private final List<BasicBeanPane<T>> extraPaneList = new ArrayList<>();
private JPanel extraPane;
public FieldEditorDefinePane(XCreator xCreator) {
super(xCreator);
@ -49,8 +58,11 @@ public abstract class FieldEditorDefinePane<T extends FieldEditor> extends Abstr
allowBlankCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
fontSizePane = new FontSizeComboPane();
JPanel contentPane = this.setFirstContentPane();
JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane();
jPanel.add(contentPane, BorderLayout.CENTER);
JPanel jPanel = FRGUIPaneFactory.createYBoxEmptyBorderPane();
jPanel.add(contentPane);
extraPane = FRGUIPaneFactory.createYBoxEmptyBorderPane();
jPanel.add(extraPane);
this.initExtraPane();
contentPane.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0));
if (contentPane != null) {
UIExpandablePane uiExpandablePane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Advanced"), 280, 20, jPanel);
@ -59,12 +71,35 @@ public abstract class FieldEditorDefinePane<T extends FieldEditor> extends Abstr
this.addValidatePane();
}
private void initExtraPane() {
initPluginListener();
refreshExtraAdvancedPane();
}
private void refreshExtraAdvancedPane() {
extraPaneList.clear();
extraPane.removeAll();
Set<WidgetAdvancedPaneProvider<T>> providers = ExtraDesignClassManager.getInstance().getArray(WidgetAdvancedPaneProvider.XML_TAG);
for (WidgetAdvancedPaneProvider<T> provider : providers) {
if (!provider.accept(creator)) {
continue;
}
insertShortCut(provider.getInsertPosition(extraPaneList.size()), provider.createExtraAdvancedPane());
}
for (BasicBeanPane<T> pane : extraPaneList) {
extraPane.add(pane);
}
}
@Override
public void populateBean(T ob) {
this.allowBlankCheckBox.setSelected(ob.isAllowBlank());
this.errorMsgTextField.setText(ob.getErrorMessage());
this.fontSizePane.setValue(ob.getFontSize());
this.labelNameTextField.setText(ob.getLabelName());
for (BasicBeanPane<T> pane : extraPaneList) {
pane.populateBean(ob);
}
populateSubFieldEditorBean(ob);
}
@ -78,6 +113,9 @@ public abstract class FieldEditorDefinePane<T extends FieldEditor> extends Abstr
e.setErrorMessage(this.errorMsgTextField.getText());
e.setFontSize(fontSizePane.getValue());
e.setLabelName(labelNameTextField.getText());
for (BasicBeanPane<T> pane : extraPaneList) {
pane.updateBean(e);
}
return e;
}
@ -152,4 +190,25 @@ public abstract class FieldEditorDefinePane<T extends FieldEditor> extends Abstr
return null;
}
/**
* 插入配置项面板
*
* @param index 插入的位置
* @param pane 配置项面板
*/
private void insertShortCut(int index, BasicBeanPane<T> pane) {
int size = extraPaneList.size();
index = Math.min(index, size);
extraPaneList.add(index, pane);
}
private void initPluginListener() {
GeneralContext.listenPluginRunningChanged(new PluginEventListener() {
@Override
public void on(PluginEvent event) {
refreshExtraAdvancedPane();
}
}, pluginContext -> pluginContext.getRuntime().contain(WidgetAdvancedPaneProvider.XML_TAG));
}
}

3
designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java

@ -1311,6 +1311,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
boolean shouldCreateUndoState = compatible == TemplateThemeCompatible.NONE && !StringUtils.equals(oldTheme.getName(), newTheme.getName());
getTarget().setTemplateTheme(newTheme, compatible);
getTarget().getReportParameterAttr().onTemplateUsingThemeChange(newTheme, compatible);
setTarget((WorkBook) FineColorSynchronizer.flush(getTarget(), newTheme, compatible));
if (HistoryTemplateListCache.getInstance().getCurrentEditingTemplate() == this) {
@ -1318,6 +1319,8 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
reportComposite.setSelectedIndex(reportComposite.getSelectedIndex());
TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()).refreshDockingView();
DesignerContext.getDesignerFrame().resetToolkitByPlus(HistoryTemplateListPane.getInstance().getCurrentEditingTemplate());
// 刷新参数面板界面
populateReportParameterAttr();
}
super.setTemplateTheme(newTheme, compatible);

Loading…
Cancel
Save