Browse Source

REPORT-91591 单元格控件的自定义样式设置

feature/x
John.Ying-应志浩 2 years ago
parent
commit
d92939c0b5
  1. 8
      designer-form/src/main/java/com/fr/design/fun/WidgetAdvancedPaneProvider.java
  2. 74
      designer-realize/src/main/java/com/fr/design/widget/ui/CheckBoxDefinePane.java
  3. 41
      designer-realize/src/main/java/com/fr/design/widget/ui/CheckBoxGroupDefinePane.java
  4. 24
      designer-realize/src/main/java/com/fr/design/widget/ui/ComboBoxDefinePane.java
  5. 23
      designer-realize/src/main/java/com/fr/design/widget/ui/ComboCheckBoxDefinePane.java
  6. 31
      designer-realize/src/main/java/com/fr/design/widget/ui/DateEditorDefinePane.java
  7. 18
      designer-realize/src/main/java/com/fr/design/widget/ui/DirectWriteEditorDefinePane.java
  8. 52
      designer-realize/src/main/java/com/fr/design/widget/ui/FieldEditorDefinePane.java
  9. 50
      designer-realize/src/main/java/com/fr/design/widget/ui/NumberEditorDefinePane.java
  10. 25
      designer-realize/src/main/java/com/fr/design/widget/ui/PasswordDefinePane.java
  11. 52
      designer-realize/src/main/java/com/fr/design/widget/ui/RadioGroupDefinePane.java
  12. 26
      designer-realize/src/main/java/com/fr/design/widget/ui/TextAreaDefinePane.java
  13. 36
      designer-realize/src/main/java/com/fr/design/widget/ui/TextFieldEditorDefinePane.java
  14. 23
      designer-realize/src/main/java/com/fr/design/widget/ui/TreeComboBoxEditorDefinePane.java
  15. 35
      designer-realize/src/main/java/com/fr/design/widget/ui/TreeEditorDefinePane.java

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

@ -33,6 +33,14 @@ public interface WidgetAdvancedPaneProvider<T> extends Mutable {
*/ */
boolean accept(XCreator creator); boolean accept(XCreator creator);
/**
* 根据Class判断是否需要处理
*
* @param creator
* @return true:需要处理;false:不处理
*/
boolean accept(Class creator);
/** /**
* 创建控件高级设置项的追加面板 * 创建控件高级设置项的追加面板
* *

74
designer-realize/src/main/java/com/fr/design/widget/ui/CheckBoxDefinePane.java

@ -1,21 +1,34 @@
package com.fr.design.widget.ui; package com.fr.design.widget.ui;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.designer.IntervalConstants; import com.fr.design.designer.IntervalConstants;
import com.fr.design.foldablepane.UIExpandablePane; import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.fun.WidgetAdvancedPaneProvider;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.form.ui.CheckBox; import com.fr.form.ui.CheckBox;
import com.fr.general.GeneralContext;
import com.fr.plugin.observer.PluginEvent;
import com.fr.plugin.observer.PluginEventListener;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
public class CheckBoxDefinePane extends AbstractDataModify<CheckBox> { public class CheckBoxDefinePane extends AbstractDataModify<CheckBox> {
private UITextField text; private UITextField text;
protected final List<BasicBeanPane<CheckBox>> extraPaneList = new ArrayList<>();
protected JPanel extraPane;
protected static double F = TableLayout.FILL;
protected static double P = TableLayout.PREFERRED;
public CheckBoxDefinePane() { public CheckBoxDefinePane() {
this.iniComponents(); this.iniComponents();
} }
@ -23,14 +36,14 @@ public class CheckBoxDefinePane extends AbstractDataModify<CheckBox> {
private void iniComponents() { private void iniComponents() {
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
text = new UITextField(); text = new UITextField();
double f = TableLayout.FILL; initExtraPane();
double p = TableLayout.PREFERRED;
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Text")), text}, new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Text")), text},
new Component[]{extraPane, null},
}; };
double[] rowSize = {p}; double[] rowSize = {P,P};
double[] columnSize = {p, f}; double[] columnSize = {P, F};
int[][] rowCount = {{1, 1}}; int[][] rowCount = {{1, 1}, {1, 1}};
JPanel pane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W3, IntervalConstants.INTERVAL_L1); JPanel pane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W3, IntervalConstants.INTERVAL_L1);
UIExpandablePane uiExpandablePane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Advanced"), 280, 24, pane); UIExpandablePane uiExpandablePane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Advanced"), 280, 24, pane);
@ -39,6 +52,51 @@ public class CheckBoxDefinePane extends AbstractDataModify<CheckBox> {
this.add(uiExpandablePane); this.add(uiExpandablePane);
} }
protected void initExtraPane() {
initPluginListener();
refreshExtraAdvancedPane();
}
protected void refreshExtraAdvancedPane() {
extraPaneList.clear();
boolean containsExtraPane = false;
Set<WidgetAdvancedPaneProvider<CheckBox>> providers = ExtraDesignClassManager.getInstance().getArray(WidgetAdvancedPaneProvider.XML_TAG);
for (WidgetAdvancedPaneProvider<CheckBox> provider : providers) {
if (!provider.accept(CheckBox.class)) {
continue;
}
insertShortCut(provider.getInsertPosition(extraPaneList.size()), provider.createExtraAdvancedPane());
containsExtraPane = true;
}
if (containsExtraPane) {
extraPane = FRGUIPaneFactory.createYBoxEmptyBorderPane();
for (BasicBeanPane<CheckBox> pane : extraPaneList) {
extraPane.add(pane);
}
}
}
protected void initPluginListener() {
GeneralContext.listenPluginRunningChanged(new PluginEventListener() {
@Override
public void on(PluginEvent event) {
refreshExtraAdvancedPane();
}
}, pluginContext -> pluginContext.getRuntime().contain(WidgetAdvancedPaneProvider.XML_TAG));
}
/**
* 插入配置项面板
*
* @param index 插入的位置
* @param pane 配置项面板
*/
protected void insertShortCut(int index, BasicBeanPane<CheckBox> pane) {
int size = extraPaneList.size();
index = Math.min(index, size);
extraPaneList.add(index, pane);
}
@Override @Override
protected String title4PopupWindow() { protected String title4PopupWindow() {
return "CheckBox"; return "CheckBox";
@ -47,12 +105,18 @@ public class CheckBoxDefinePane extends AbstractDataModify<CheckBox> {
@Override @Override
public void populateBean(CheckBox check) { public void populateBean(CheckBox check) {
text.setText(check.getText()); text.setText(check.getText());
for (BasicBeanPane<CheckBox> pane : extraPaneList) {
pane.populateBean(check);
}
} }
@Override @Override
public CheckBox updateBean() { public CheckBox updateBean() {
CheckBox box = new CheckBox(); CheckBox box = new CheckBox();
box.setText(text.getText()); box.setText(text.getText());
for (BasicBeanPane<CheckBox> pane : extraPaneList) {
pane.updateBean(box);
}
return box; return box;
} }
} }

41
designer-realize/src/main/java/com/fr/design/widget/ui/CheckBoxGroupDefinePane.java

@ -1,11 +1,19 @@
package com.fr.design.widget.ui; package com.fr.design.widget.ui;
import java.awt.*; import java.awt.*;
import java.util.Set;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.SwingConstants;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.data.DataCreatorUI; import com.fr.design.data.DataCreatorUI;
import com.fr.design.designer.IntervalConstants;
import com.fr.design.fun.WidgetAdvancedPaneProvider;
import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
@ -43,21 +51,50 @@ public class CheckBoxGroupDefinePane extends FieldEditorDefinePane<CheckBoxGroup
returnTypePane = new ReturnTypePane(); returnTypePane = new ReturnTypePane();
double f = TableLayout.FILL; double f = TableLayout.FILL;
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
initExtraPane();
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{buttonGroupDictPane, null }, new Component[]{buttonGroupDictPane, null },
new Component[]{checkbox, null }, new Component[]{checkbox, null },
new Component[]{returnTypePane, null }, new Component[]{returnTypePane, null },
new Component[]{extraPane, null}
}; };
double[] rowSize = {p, p, p, p}; double[] rowSize = {p, p, p, p, p};
double[] columnSize = {p, f}; double[] columnSize = {p, f};
int[][] rowCount = {{1, 1},{1, 1},{1,1},{1,1}}; int[][] rowCount = {{1, 1},{1, 1},{1,1},{1,1},{1,1}};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 10, 7); JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 10, 7);
advancePane.add(panel); advancePane.add(panel);
return advancePane; return advancePane;
} }
protected void refreshExtraAdvancedPane() {
extraPaneList.clear();
boolean containsExtraPane = false;
Set<WidgetAdvancedPaneProvider<CheckBoxGroup>> providers = ExtraDesignClassManager.getInstance().getArray(WidgetAdvancedPaneProvider.XML_TAG);
for (WidgetAdvancedPaneProvider<CheckBoxGroup> provider : providers) {
if (!provider.accept(CheckBoxGroup.class)) {
continue;
}
insertShortCut(provider.getInsertPosition(extraPaneList.size()), provider.createExtraAdvancedPane());
containsExtraPane = true;
}
if (containsExtraPane) {
extraPane = FRGUIPaneFactory.createYBoxEmptyBorderPane();
for (BasicBeanPane<CheckBoxGroup> pane : extraPaneList) {
extraPane.add(pane);
}
} else {
Component[][] components = new Component[][]{
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Font_Size"), SwingConstants.LEFT)}
};
double[] rowSize = {P};
double[] columnSize = {P, F};
int[][] rowCount = {{1, 1}};
extraPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1);
}
}
@Override @Override
protected void populateSubFieldEditorBean(CheckBoxGroup ob) { protected void populateSubFieldEditorBean(CheckBoxGroup ob) {
returnTypePane.populate(ob); returnTypePane.populate(ob);

24
designer-realize/src/main/java/com/fr/design/widget/ui/ComboBoxDefinePane.java

@ -3,15 +3,20 @@ package com.fr.design.widget.ui;
import javax.swing.*; import javax.swing.*;
import com.fr.data.Dictionary; import com.fr.data.Dictionary;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.data.DataCreatorUI; import com.fr.design.data.DataCreatorUI;
import com.fr.design.designer.IntervalConstants; import com.fr.design.designer.IntervalConstants;
import com.fr.design.fun.WidgetAdvancedPaneProvider;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.widget.accessibles.AccessibleDictionaryEditor; import com.fr.design.mainframe.widget.accessibles.AccessibleDictionaryEditor;
import com.fr.form.ui.ComboBox; import com.fr.form.ui.ComboBox;
import java.awt.*; import java.awt.*;
import java.util.Set;
public class ComboBoxDefinePane extends CustomWritableRepeatEditorPane<ComboBox> { public class ComboBoxDefinePane extends CustomWritableRepeatEditorPane<ComboBox> {
protected AccessibleDictionaryEditor dictPane; protected AccessibleDictionaryEditor dictPane;
@ -33,6 +38,25 @@ public class ComboBoxDefinePane extends CustomWritableRepeatEditorPane<ComboBox>
return jPanel; return jPanel;
} }
protected void refreshExtraAdvancedPane() {
extraPaneList.clear();
boolean containsExtraPane = false;
Set<WidgetAdvancedPaneProvider<ComboBox>> providers = ExtraDesignClassManager.getInstance().getArray(WidgetAdvancedPaneProvider.XML_TAG);
for (WidgetAdvancedPaneProvider<ComboBox> provider : providers) {
if (!provider.accept(ComboBox.class)) {
continue;
}
insertShortCut(provider.getInsertPosition(extraPaneList.size()), provider.createExtraAdvancedPane());
containsExtraPane = true;
}
if (containsExtraPane) {
extraPane = FRGUIPaneFactory.createYBoxEmptyBorderPane();
for (BasicBeanPane<ComboBox> pane : extraPaneList) {
extraPane.add(pane);
}
}
}
protected void populateSubCustomWritableRepeatEditorBean(ComboBox e) { protected void populateSubCustomWritableRepeatEditorBean(ComboBox e) {
this.dictPane.setValue(e.getDictionary()); this.dictPane.setValue(e.getDictionary());
} }

23
designer-realize/src/main/java/com/fr/design/widget/ui/ComboCheckBoxDefinePane.java

@ -1,8 +1,11 @@
package com.fr.design.widget.ui; package com.fr.design.widget.ui;
import com.fr.data.Dictionary; import com.fr.data.Dictionary;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.data.DataCreatorUI; import com.fr.design.data.DataCreatorUI;
import com.fr.design.designer.IntervalConstants; import com.fr.design.designer.IntervalConstants;
import com.fr.design.fun.WidgetAdvancedPaneProvider;
import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
@ -15,6 +18,7 @@ import com.fr.form.ui.ComboCheckBox;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;
import java.util.Set;
public class ComboCheckBoxDefinePane extends CustomWritableRepeatEditorPane<ComboCheckBox> { public class ComboCheckBoxDefinePane extends CustomWritableRepeatEditorPane<ComboCheckBox> {
private ReturnTypePane returnTypePane; private ReturnTypePane returnTypePane;
@ -49,6 +53,25 @@ public class ComboCheckBoxDefinePane extends CustomWritableRepeatEditorPane<Comb
return advancePane; return advancePane;
} }
protected void refreshExtraAdvancedPane() {
extraPaneList.clear();
boolean containsExtraPane = false;
Set<WidgetAdvancedPaneProvider<ComboCheckBox>> providers = ExtraDesignClassManager.getInstance().getArray(WidgetAdvancedPaneProvider.XML_TAG);
for (WidgetAdvancedPaneProvider<ComboCheckBox> provider : providers) {
if (!provider.accept(ComboCheckBox.class)) {
continue;
}
insertShortCut(provider.getInsertPosition(extraPaneList.size()), provider.createExtraAdvancedPane());
containsExtraPane = true;
}
if (containsExtraPane) {
extraPane = FRGUIPaneFactory.createYBoxEmptyBorderPane();
for (BasicBeanPane<ComboCheckBox> pane : extraPaneList) {
extraPane.add(pane);
}
}
}
@Override @Override
protected void populateSubCustomWritableRepeatEditorBean(ComboCheckBox e) { protected void populateSubCustomWritableRepeatEditorBean(ComboCheckBox e) {
this.dictPane.setValue(e.getDictionary()); this.dictPane.setValue(e.getDictionary());

31
designer-realize/src/main/java/com/fr/design/widget/ui/DateEditorDefinePane.java

@ -2,9 +2,12 @@ package com.fr.design.widget.ui;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.data.core.FormatField; import com.fr.data.core.FormatField;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.border.UIRoundedBorder; import com.fr.design.border.UIRoundedBorder;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.designer.IntervalConstants; import com.fr.design.designer.IntervalConstants;
import com.fr.design.fun.WidgetAdvancedPaneProvider;
import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ibutton.UIButtonGroup;
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;
@ -28,6 +31,7 @@ import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
import java.util.Set;
public class DateEditorDefinePane extends DirectWriteEditorDefinePane<DateEditor> { public class DateEditorDefinePane extends DirectWriteEditorDefinePane<DateEditor> {
private UIButtonGroup returnTypeComboBox; private UIButtonGroup returnTypeComboBox;
@ -53,10 +57,8 @@ public class DateEditorDefinePane extends DirectWriteEditorDefinePane<DateEditor
protected JPanel setSecondContentPane() { protected JPanel setSecondContentPane() {
returnTypeComboBox = new UIButtonGroup<>(new String[] {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Date") , com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_String")}); returnTypeComboBox = new UIButtonGroup<>(new String[] {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Date") , com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_String")});
JPanel formatHead = createFormatHead(); JPanel formatHead = createFormatHead();
startDv = new DateValuePane(); startDv = new DateValuePane();
endDv = new DateValuePane(); endDv = new DateValuePane();
double f = TableLayout.FILL; double f = TableLayout.FILL;
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
UILabel formatLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Engine_Format")); UILabel formatLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Engine_Format"));
@ -65,23 +67,42 @@ public class DateEditorDefinePane extends DirectWriteEditorDefinePane<DateEditor
startDateLabel.setVerticalAlignment(SwingConstants.TOP); startDateLabel.setVerticalAlignment(SwingConstants.TOP);
UILabel endDateLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_FS_End_Date")); UILabel endDateLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_FS_End_Date"));
endDateLabel.setVerticalAlignment(SwingConstants.TOP); endDateLabel.setVerticalAlignment(SwingConstants.TOP);
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{formatLabel, formatHead}, new Component[]{formatLabel, formatHead},
new Component[]{startDateLabel, startDv}, new Component[]{startDateLabel, startDv},
new Component[]{endDateLabel, endDv}, new Component[]{endDateLabel, endDv},
new Component[]{waterMarkDictPane, null}, new Component[]{waterMarkDictPane, null},
new Component[]{extraPane, null},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Date_Selector_Return_Type")), returnTypeComboBox } new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Date_Selector_Return_Type")), returnTypeComboBox }
}; };
double[] rowSize = {p, p, p, p, p, p, p}; double[] rowSize = {p, p, p, p, p, p, p, p};
double[] columnSize = {p, f}; double[] columnSize = {p, f};
int[][] rowCount = {{1, 3},{1, 1},{1, 1},{1, 1},{1, 1}}; int[][] rowCount = {{1, 3},{1, 1},{1, 1},{1, 1},{1, 1}, {1, 1}};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_L2, IntervalConstants.INTERVAL_L1); JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_L2, IntervalConstants.INTERVAL_L1);
return panel; return panel;
} }
protected void refreshExtraAdvancedPane() {
extraPaneList.clear();
boolean containsExtraPane = false;
Set<WidgetAdvancedPaneProvider<DateEditor>> providers = ExtraDesignClassManager.getInstance().getArray(WidgetAdvancedPaneProvider.XML_TAG);
for (WidgetAdvancedPaneProvider<DateEditor> provider : providers) {
if (!provider.accept(DateEditor.class)) {
continue;
}
insertShortCut(provider.getInsertPosition(extraPaneList.size()), provider.createExtraAdvancedPane());
containsExtraPane = true;
}
if (containsExtraPane) {
extraPane = FRGUIPaneFactory.createYBoxEmptyBorderPane();
for (BasicBeanPane<DateEditor> pane : extraPaneList) {
extraPane.add(pane);
}
}
}
private JPanel createFormatPane(UIComboBox formatComboBox, UILabel sampleLabel){ private JPanel createFormatPane(UIComboBox formatComboBox, UILabel sampleLabel){
JPanel previewPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel previewPane = FRGUIPaneFactory.createBorderLayout_S_Pane();

18
designer-realize/src/main/java/com/fr/design/widget/ui/DirectWriteEditorDefinePane.java

@ -1,7 +1,10 @@
package com.fr.design.widget.ui; package com.fr.design.widget.ui;
import com.fr.design.designer.IntervalConstants;
import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.form.ui.DirectWriteEditor; import com.fr.form.ui.DirectWriteEditor;
@ -9,6 +12,7 @@ import com.fr.form.ui.DirectWriteEditor;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;
//richer:需要提供能否直接编辑的控件设置面板——下拉框、复选框、时间、日期、下拉树 //richer:需要提供能否直接编辑的控件设置面板——下拉框、复选框、时间、日期、下拉树
public abstract class DirectWriteEditorDefinePane<T extends DirectWriteEditor> extends FieldEditorDefinePane<T> { public abstract class DirectWriteEditorDefinePane<T extends DirectWriteEditor> extends FieldEditorDefinePane<T> {
public UICheckBox directWriteCheckBox; public UICheckBox directWriteCheckBox;
@ -25,9 +29,17 @@ public abstract class DirectWriteEditorDefinePane<T extends DirectWriteEditor> e
contentPane.setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 0)); contentPane.setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 0));
directWriteCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Allow_Edit"), false); directWriteCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Allow_Edit"), false);
directWriteCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); directWriteCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
waterMarkDictPane = new WaterMarkDictPane(); waterMarkDictPane = new WaterMarkDictPane();
contentPane.add(waterMarkDictPane, BorderLayout.NORTH); initExtraPane();
Component[][] components = new Component[][]{
new Component[]{waterMarkDictPane, null},
new Component[]{extraPane, null},
};
double[] rowSize = {P, P};
double[] columnSize = {P, F};
int[][] rowCount = {{1, 1}, {1, 1}};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_L2, IntervalConstants.INTERVAL_L1);
contentPane.add(panel, BorderLayout.NORTH);
JPanel otherContentPane = this.setSecondContentPane(); JPanel otherContentPane = this.setSecondContentPane();
if (otherContentPane != null) { if (otherContentPane != null) {
contentPane.add(otherContentPane, BorderLayout.CENTER); contentPane.add(otherContentPane, BorderLayout.CENTER);
@ -35,8 +47,6 @@ public abstract class DirectWriteEditorDefinePane<T extends DirectWriteEditor> e
return contentPane; return contentPane;
} }
public JPanel setValidatePane(){ public JPanel setValidatePane(){
JPanel otherContentPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel otherContentPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
JPanel jPanel = GUICoreUtils.createFlowPane(new JComponent[]{directWriteCheckBox}, FlowLayout.LEFT, 0); JPanel jPanel = GUICoreUtils.createFlowPane(new JComponent[]{directWriteCheckBox}, FlowLayout.LEFT, 0);

52
designer-realize/src/main/java/com/fr/design/widget/ui/FieldEditorDefinePane.java

@ -1,18 +1,24 @@
package com.fr.design.widget.ui; package com.fr.design.widget.ui;
import com.fr.design.ExtraDesignClassManager; import com.fr.design.ExtraDesignClassManager;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.beans.ErrorMsgTextFieldAdapter; import com.fr.design.beans.ErrorMsgTextFieldAdapter;
import com.fr.design.beans.UITextFieldAdapter; import com.fr.design.beans.UITextFieldAdapter;
import com.fr.design.constants.LayoutConstants; import com.fr.design.constants.LayoutConstants;
import com.fr.design.designer.IntervalConstants; import com.fr.design.designer.IntervalConstants;
import com.fr.design.foldablepane.UIExpandablePane; import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.fun.TextFieldAdapterProvider; import com.fr.design.fun.TextFieldAdapterProvider;
import com.fr.design.fun.WidgetAdvancedPaneProvider;
import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.form.ui.FieldEditor; import com.fr.form.ui.FieldEditor;
import com.fr.general.GeneralContext;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.plugin.observer.PluginEvent;
import com.fr.plugin.observer.PluginEventListener;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.JPanel; import javax.swing.JPanel;
@ -20,6 +26,8 @@ import java.awt.BorderLayout;
import java.awt.Component; import java.awt.Component;
import java.awt.event.ItemEvent; import java.awt.event.ItemEvent;
import java.awt.event.ItemListener; import java.awt.event.ItemListener;
import java.util.ArrayList;
import java.util.List;
public abstract class FieldEditorDefinePane<T extends FieldEditor> extends AbstractDataModify<T> { public abstract class FieldEditorDefinePane<T extends FieldEditor> extends AbstractDataModify<T> {
protected UICheckBox allowBlankCheckBox; protected UICheckBox allowBlankCheckBox;
@ -27,6 +35,11 @@ public abstract class FieldEditorDefinePane<T extends FieldEditor> extends Abstr
protected ErrorMsgTextFieldAdapter errorMsgTextField; protected ErrorMsgTextFieldAdapter errorMsgTextField;
protected JPanel validatePane; protected JPanel validatePane;
protected final List<BasicBeanPane<T>> extraPaneList = new ArrayList<>();
protected JPanel extraPane;
protected static double F = TableLayout.FILL;
protected static double P = TableLayout.PREFERRED;
public FieldEditorDefinePane() { public FieldEditorDefinePane() {
this.initComponents(); this.initComponents();
} }
@ -60,11 +73,23 @@ public abstract class FieldEditorDefinePane<T extends FieldEditor> extends Abstr
} }
} }
protected void initExtraPane() {
initPluginListener();
refreshExtraAdvancedPane();
}
protected void refreshExtraAdvancedPane() {
// do nothing
}
@Override @Override
public void populateBean(T ob) { public void populateBean(T ob) {
this.allowBlankCheckBox.setSelected(ob.isAllowBlank()); this.allowBlankCheckBox.setSelected(ob.isAllowBlank());
this.errorMsgTextField.setText(ob.getErrorMessage()); this.errorMsgTextField.setText(ob.getErrorMessage());
for (BasicBeanPane<T> pane : extraPaneList) {
pane.populateBean(ob);
}
populateSubFieldEditorBean(ob); populateSubFieldEditorBean(ob);
} }
@ -76,7 +101,9 @@ public abstract class FieldEditorDefinePane<T extends FieldEditor> extends Abstr
e.setAllowBlank(this.allowBlankCheckBox.isSelected()); e.setAllowBlank(this.allowBlankCheckBox.isSelected());
e.setErrorMessage(this.errorMsgTextField.getText()); e.setErrorMessage(this.errorMsgTextField.getText());
for (BasicBeanPane<T> pane : extraPaneList) {
pane.updateBean(e);
}
return e; return e;
} }
@ -131,5 +158,26 @@ public abstract class FieldEditorDefinePane<T extends FieldEditor> extends Abstr
return null; return null;
} }
/**
* 插入配置项面板
*
* @param index 插入的位置
* @param pane 配置项面板
*/
protected void insertShortCut(int index, BasicBeanPane<T> pane) {
int size = extraPaneList.size();
index = Math.min(index, size);
extraPaneList.add(index, pane);
}
protected void initPluginListener() {
GeneralContext.listenPluginRunningChanged(new PluginEventListener() {
@Override
public void on(PluginEvent event) {
refreshExtraAdvancedPane();
}
}, pluginContext -> pluginContext.getRuntime().contain(WidgetAdvancedPaneProvider.XML_TAG));
}
} }

50
designer-realize/src/main/java/com/fr/design/widget/ui/NumberEditorDefinePane.java

@ -1,11 +1,19 @@
package com.fr.design.widget.ui; package com.fr.design.widget.ui;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.SwingConstants;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.designer.IntervalConstants;
import com.fr.design.fun.WidgetAdvancedPaneProvider;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.widget.component.NumberEditorValidatePane; import com.fr.design.widget.component.NumberEditorValidatePane;
import com.fr.form.ui.NumberEditor; import com.fr.form.ui.NumberEditor;
import java.awt.Component;
import java.awt.BorderLayout; import java.util.Set;
public class NumberEditorDefinePane extends FieldEditorDefinePane<NumberEditor> { public class NumberEditorDefinePane extends FieldEditorDefinePane<NumberEditor> {
/** /**
@ -29,10 +37,46 @@ public class NumberEditorDefinePane extends FieldEditorDefinePane<NumberEditor>
protected JPanel setFirstContentPane() { protected JPanel setFirstContentPane() {
JPanel content = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel content = FRGUIPaneFactory.createBorderLayout_S_Pane();
waterMarkDictPane = new WaterMarkDictPane(); waterMarkDictPane = new WaterMarkDictPane();
content.add(waterMarkDictPane, BorderLayout.CENTER); initExtraPane();
Component[][] components = new Component[][]{
new Component[]{waterMarkDictPane, null},
new Component[]{extraPane, null}
};
double[] rowSize = {P, P};
double[] columnSize = {P, F};
int[][] rowCount = {{1, 1}, {1, 1}};
final JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1);
content.add(panel);
return content; return content;
} }
protected void refreshExtraAdvancedPane() {
extraPaneList.clear();
boolean containsExtraPane = false;
Set<WidgetAdvancedPaneProvider<NumberEditor>> providers = ExtraDesignClassManager.getInstance().getArray(WidgetAdvancedPaneProvider.XML_TAG);
for (WidgetAdvancedPaneProvider<NumberEditor> provider : providers) {
if (!provider.accept(NumberEditor.class)) {
continue;
}
insertShortCut(provider.getInsertPosition(extraPaneList.size()), provider.createExtraAdvancedPane());
containsExtraPane = true;
}
if (containsExtraPane) {
extraPane = FRGUIPaneFactory.createYBoxEmptyBorderPane();
for (BasicBeanPane<NumberEditor> pane : extraPaneList) {
extraPane.add(pane);
}
} else {
Component[][] components = new Component[][]{
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Font_Size"), SwingConstants.LEFT)}
};
double[] rowSize = {P};
double[] columnSize = {P, F};
int[][] rowCount = {{1, 1}};
extraPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1);
}
}
public JPanel setValidatePane() { public JPanel setValidatePane() {
numberEditorValidatePane = new NumberEditorValidatePane(); numberEditorValidatePane = new NumberEditorValidatePane();
return numberEditorValidatePane; return numberEditorValidatePane;

25
designer-realize/src/main/java/com/fr/design/widget/ui/PasswordDefinePane.java

@ -1,10 +1,16 @@
package com.fr.design.widget.ui; package com.fr.design.widget.ui;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.fun.WidgetAdvancedPaneProvider;
import com.fr.design.gui.frpane.RegFieldPane; import com.fr.design.gui.frpane.RegFieldPane;
import com.fr.design.gui.frpane.RegPane; import com.fr.design.gui.frpane.RegPane;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.form.ui.Password; import com.fr.form.ui.Password;
import com.fr.form.ui.TextEditor; import com.fr.form.ui.TextEditor;
import java.util.Set;
public class PasswordDefinePane extends TextFieldEditorDefinePane { public class PasswordDefinePane extends TextFieldEditorDefinePane {
private static final long serialVersionUID = 4737910705071750562L; private static final long serialVersionUID = 4737910705071750562L;
@ -16,4 +22,23 @@ public class PasswordDefinePane extends TextFieldEditorDefinePane {
protected RegFieldPane createRegPane() { protected RegFieldPane createRegPane() {
return new RegFieldPane(RegPane.PASSWORD_REG_TYPE); return new RegFieldPane(RegPane.PASSWORD_REG_TYPE);
} }
protected void refreshExtraAdvancedPane() {
extraPaneList.clear();
boolean containsExtraPane = false;
Set<WidgetAdvancedPaneProvider<TextEditor>> providers = ExtraDesignClassManager.getInstance().getArray(WidgetAdvancedPaneProvider.XML_TAG);
for (WidgetAdvancedPaneProvider<TextEditor> provider : providers) {
if (!provider.accept(Password.class)) {
continue;
}
insertShortCut(provider.getInsertPosition(extraPaneList.size()), provider.createExtraAdvancedPane());
containsExtraPane = true;
}
if (containsExtraPane) {
extraPane = FRGUIPaneFactory.createYBoxEmptyBorderPane();
for (BasicBeanPane<TextEditor> pane : extraPaneList) {
extraPane.add(pane);
}
}
}
} }

52
designer-realize/src/main/java/com/fr/design/widget/ui/RadioGroupDefinePane.java

@ -1,9 +1,21 @@
package com.fr.design.widget.ui; package com.fr.design.widget.ui;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.SwingConstants;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.data.DataCreatorUI; import com.fr.design.data.DataCreatorUI;
import com.fr.design.designer.IntervalConstants;
import com.fr.design.fun.WidgetAdvancedPaneProvider;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.form.ui.RadioGroup; import com.fr.form.ui.RadioGroup;
import java.awt.Component;
import java.util.Set;
public class RadioGroupDefinePane extends FieldEditorDefinePane<RadioGroup> { public class RadioGroupDefinePane extends FieldEditorDefinePane<RadioGroup> {
private ButtonGroupDictPane buttonGroupDictPane; private ButtonGroupDictPane buttonGroupDictPane;
@ -21,7 +33,45 @@ public class RadioGroupDefinePane extends FieldEditorDefinePane<RadioGroup> {
@Override @Override
protected JPanel setFirstContentPane() { protected JPanel setFirstContentPane() {
buttonGroupDictPane = new ButtonGroupDictPane(); buttonGroupDictPane = new ButtonGroupDictPane();
return buttonGroupDictPane; initExtraPane();
Component[][] components = new Component[][]{
new Component[]{buttonGroupDictPane, null},
new Component[]{extraPane, null}
};
double[] rowSize = {P, P, P, P};
double[] columnSize = {P, F};
int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}};
final JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1);
JPanel content = FRGUIPaneFactory.createBorderLayout_S_Pane();
content.add(panel);
return content;
}
protected void refreshExtraAdvancedPane() {
extraPaneList.clear();
boolean containsExtraPane = false;
Set<WidgetAdvancedPaneProvider<RadioGroup>> providers = ExtraDesignClassManager.getInstance().getArray(WidgetAdvancedPaneProvider.XML_TAG);
for (WidgetAdvancedPaneProvider<RadioGroup> provider : providers) {
if (!provider.accept(RadioGroup.class)) {
continue;
}
insertShortCut(provider.getInsertPosition(extraPaneList.size()), provider.createExtraAdvancedPane());
containsExtraPane = true;
}
if (containsExtraPane) {
extraPane = FRGUIPaneFactory.createYBoxEmptyBorderPane();
for (BasicBeanPane<RadioGroup> pane : extraPaneList) {
extraPane.add(pane);
}
} else {
Component[][] components = new Component[][]{
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Font_Size"), SwingConstants.LEFT)}
};
double[] rowSize = {P};
double[] columnSize = {P, F};
int[][] rowCount = {{1, 1}};
extraPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1);
}
} }
@Override @Override

26
designer-realize/src/main/java/com/fr/design/widget/ui/TextAreaDefinePane.java

@ -1,11 +1,18 @@
package com.fr.design.widget.ui; package com.fr.design.widget.ui;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.fun.WidgetAdvancedPaneProvider;
import com.fr.design.gui.frpane.RegFieldPane; import com.fr.design.gui.frpane.RegFieldPane;
import com.fr.design.gui.frpane.RegPane; import com.fr.design.gui.frpane.RegPane;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.form.ui.TextArea; import com.fr.form.ui.TextArea;
import com.fr.form.ui.TextEditor; import com.fr.form.ui.TextEditor;
import java.util.Set;
public class TextAreaDefinePane extends TextFieldEditorDefinePane { public class TextAreaDefinePane extends TextFieldEditorDefinePane {
@Override @Override
@ -16,4 +23,23 @@ public class TextAreaDefinePane extends TextFieldEditorDefinePane {
protected RegFieldPane createRegPane() { protected RegFieldPane createRegPane() {
return new RegFieldPane(RegPane.TEXTAREA_REG_TYPE); return new RegFieldPane(RegPane.TEXTAREA_REG_TYPE);
} }
protected void refreshExtraAdvancedPane() {
extraPaneList.clear();
boolean containsExtraPane = false;
Set<WidgetAdvancedPaneProvider<TextEditor>> providers = ExtraDesignClassManager.getInstance().getArray(WidgetAdvancedPaneProvider.XML_TAG);
for (WidgetAdvancedPaneProvider<TextEditor> provider : providers) {
if (!provider.accept(TextArea.class)) {
continue;
}
insertShortCut(provider.getInsertPosition(extraPaneList.size()), provider.createExtraAdvancedPane());
containsExtraPane = true;
}
if (containsExtraPane) {
extraPane = FRGUIPaneFactory.createYBoxEmptyBorderPane();
for (BasicBeanPane<TextEditor> pane : extraPaneList) {
extraPane.add(pane);
}
}
}
} }

36
designer-realize/src/main/java/com/fr/design/widget/ui/TextFieldEditorDefinePane.java

@ -1,18 +1,23 @@
package com.fr.design.widget.ui; package com.fr.design.widget.ui;
import com.fr.design.ExtraDesignClassManager; import com.fr.design.ExtraDesignClassManager;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.designer.IntervalConstants;
import com.fr.design.fun.RegPaneProvider; import com.fr.design.fun.RegPaneProvider;
import com.fr.design.fun.WidgetAdvancedPaneProvider;
import com.fr.design.gui.frpane.RegFieldPane; import com.fr.design.gui.frpane.RegFieldPane;
import com.fr.design.gui.frpane.RegPane; import com.fr.design.gui.frpane.RegPane;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.form.ui.TextEditor; import com.fr.form.ui.TextEditor;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.awt.BorderLayout; import java.awt.Component;
import java.awt.event.KeyAdapter; import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent; import java.awt.event.KeyEvent;
import java.util.Set;
public class TextFieldEditorDefinePane extends FieldEditorDefinePane<TextEditor> { public class TextFieldEditorDefinePane extends FieldEditorDefinePane<TextEditor> {
protected RegFieldPane regPane; protected RegFieldPane regPane;
@ -51,8 +56,17 @@ public class TextFieldEditorDefinePane extends FieldEditorDefinePane<TextEditor>
waterMarkDictPane.removeInputKeyListener(this); waterMarkDictPane.removeInputKeyListener(this);
} }
}); });
initExtraPane();
Component[][] components = new Component[][]{
new Component[]{waterMarkDictPane, null},
new Component[]{extraPane, null}
};
double[] rowSize = {P, P};
double[] columnSize = {P, F};
int[][] rowCount = {{1, 1}, {1, 1}};
final JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1);
JPanel content = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel content = FRGUIPaneFactory.createBorderLayout_S_Pane();
content.add(waterMarkDictPane, BorderLayout.CENTER); content.add(panel);
return content; return content;
} }
@ -60,6 +74,24 @@ public class TextFieldEditorDefinePane extends FieldEditorDefinePane<TextEditor>
return regPane; return regPane;
} }
protected void refreshExtraAdvancedPane() {
extraPaneList.clear();
boolean containsExtraPane = false;
Set<WidgetAdvancedPaneProvider<TextEditor>> providers = ExtraDesignClassManager.getInstance().getArray(WidgetAdvancedPaneProvider.XML_TAG);
for (WidgetAdvancedPaneProvider<TextEditor> provider : providers) {
if (!provider.accept(TextEditor.class)) {
continue;
}
insertShortCut(provider.getInsertPosition(extraPaneList.size()), provider.createExtraAdvancedPane());
containsExtraPane = true;
}
if (containsExtraPane) {
extraPane = FRGUIPaneFactory.createYBoxEmptyBorderPane();
for (BasicBeanPane<TextEditor> pane : extraPaneList) {
extraPane.add(pane);
}
}
}
protected RegFieldPane createRegPane() { protected RegFieldPane createRegPane() {
RegPaneProvider provider = ExtraDesignClassManager.getInstance().getSingle(RegPaneProvider.XML_TAG); RegPaneProvider provider = ExtraDesignClassManager.getInstance().getSingle(RegPaneProvider.XML_TAG);

23
designer-realize/src/main/java/com/fr/design/widget/ui/TreeComboBoxEditorDefinePane.java

@ -1,12 +1,16 @@
package com.fr.design.widget.ui; package com.fr.design.widget.ui;
import java.awt.*; import java.awt.*;
import java.util.Set;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.JPanel; import javax.swing.JPanel;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.data.DataCreatorUI; import com.fr.design.data.DataCreatorUI;
import com.fr.design.designer.IntervalConstants; import com.fr.design.designer.IntervalConstants;
import com.fr.design.fun.WidgetAdvancedPaneProvider;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itree.refreshabletree.TreeRootPane; import com.fr.design.gui.itree.refreshabletree.TreeRootPane;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
@ -60,6 +64,25 @@ public class TreeComboBoxEditorDefinePane extends CustomWritableRepeatEditorPane
return jPanel; return jPanel;
} }
protected void refreshExtraAdvancedPane() {
extraPaneList.clear();
boolean containsExtraPane = false;
Set<WidgetAdvancedPaneProvider<TreeEditor>> providers = ExtraDesignClassManager.getInstance().getArray(WidgetAdvancedPaneProvider.XML_TAG);
for (WidgetAdvancedPaneProvider<TreeEditor> provider : providers) {
if (!provider.accept(TreeComboBoxEditor.class)) {
continue;
}
insertShortCut(provider.getInsertPosition(extraPaneList.size()), provider.createExtraAdvancedPane());
containsExtraPane = true;
}
if (containsExtraPane) {
extraPane = FRGUIPaneFactory.createYBoxEmptyBorderPane();
for (BasicBeanPane<TreeEditor> pane : extraPaneList) {
extraPane.add(pane);
}
}
}
@Override @Override
protected String title4PopupWindow() { protected String title4PopupWindow() {

35
designer-realize/src/main/java/com/fr/design/widget/ui/TreeEditorDefinePane.java

@ -1,7 +1,10 @@
package com.fr.design.widget.ui; package com.fr.design.widget.ui;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.data.DataCreatorUI; import com.fr.design.data.DataCreatorUI;
import com.fr.design.designer.IntervalConstants; import com.fr.design.designer.IntervalConstants;
import com.fr.design.fun.WidgetAdvancedPaneProvider;
import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itree.refreshabletree.TreeRootPane; import com.fr.design.gui.itree.refreshabletree.TreeRootPane;
@ -14,6 +17,7 @@ import com.fr.form.ui.TreeEditor;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;
import java.util.Set;
/* /*
@ -65,11 +69,19 @@ public class TreeEditorDefinePane extends FieldEditorDefinePane<TreeEditor> {
createTree.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0)); createTree.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0));
JPanel contentPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); JPanel contentPane = FRGUIPaneFactory.createBorderLayout_L_Pane();
JPanel contenter = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel contenter = FRGUIPaneFactory.createBorderLayout_S_Pane();
initExtraPane();
double[] rowSize = {P, P};
double[] columnSize = {P, F};
int[][] rowCount = {{1, 1},{1, 1}};
Component[][] components = new Component[][]{
new Component[]{createTree, null},
new Component[]{extraPane, null},
};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_L2, IntervalConstants.INTERVAL_L1);
contentPane.add(contenter,BorderLayout.NORTH); contentPane.add(contenter,BorderLayout.NORTH);
removeRepeatCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Remove_Repeat_Data"), false); removeRepeatCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Remove_Repeat_Data"), false);
removeRepeatCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); removeRepeatCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
contenter.add(createTree, BorderLayout.NORTH); contenter.add(panel, BorderLayout.NORTH);
contenter.add(removeRepeatCheckBox, BorderLayout.CENTER); contenter.add(removeRepeatCheckBox, BorderLayout.CENTER);
JPanel otherContentPane = this.setThirdContentPane(); JPanel otherContentPane = this.setThirdContentPane();
if (otherContentPane != null) { if (otherContentPane != null) {
@ -78,6 +90,25 @@ public class TreeEditorDefinePane extends FieldEditorDefinePane<TreeEditor> {
return contentPane; return contentPane;
} }
protected void refreshExtraAdvancedPane() {
extraPaneList.clear();
boolean containsExtraPane = false;
Set<WidgetAdvancedPaneProvider<TreeEditor>> providers = ExtraDesignClassManager.getInstance().getArray(WidgetAdvancedPaneProvider.XML_TAG);
for (WidgetAdvancedPaneProvider<TreeEditor> provider : providers) {
if (!provider.accept(TreeEditor.class)) {
continue;
}
insertShortCut(provider.getInsertPosition(extraPaneList.size()), provider.createExtraAdvancedPane());
containsExtraPane = true;
}
if (containsExtraPane) {
extraPane = FRGUIPaneFactory.createYBoxEmptyBorderPane();
for (BasicBeanPane<TreeEditor> pane : extraPaneList) {
extraPane.add(pane);
}
}
}
protected JPanel setThirdContentPane() { protected JPanel setThirdContentPane() {
JPanel content = FRGUIPaneFactory.createBorderLayout_L_Pane(); JPanel content = FRGUIPaneFactory.createBorderLayout_L_Pane();
treeRootPane = new TreeRootPane(); treeRootPane = new TreeRootPane();

Loading…
Cancel
Save