Browse Source

Merge pull request #1036 in BA/design from ~KERRY/design:9.0 to 9.0

* commit 'a98db3ce166ba130981fd12165bc235300e1f895':
  提交国际化
  解决冲突
  REPORT-3293 界面各个控件调整
  代码修改
  国际化
  国际化
  REPORT-3293 9.0设计器控件设置重画
master
kerry 7 years ago
parent
commit
e0c965f5ea
  1. 2
      designer/src/com/fr/design/mainframe/CellWidgetPropertyPane.java
  2. 8
      designer/src/com/fr/design/widget/CellWidgetCardPane.java
  3. 154
      designer_base/src/com/fr/design/gui/frpane/RegPane.java
  4. 10
      designer_base/src/com/fr/design/locale/designer.properties
  5. 5
      designer_base/src/com/fr/design/locale/designer_en_US.properties
  6. 5
      designer_base/src/com/fr/design/locale/designer_ja_JP.properties
  7. 5
      designer_base/src/com/fr/design/locale/designer_ko_KR.properties
  8. 10
      designer_base/src/com/fr/design/locale/designer_zh_CN.properties
  9. 5
      designer_base/src/com/fr/design/locale/designer_zh_TW.properties
  10. 21
      designer_base/src/com/fr/design/widget/DataModify.java
  11. 11
      designer_base/src/com/fr/design/widget/Operator.java
  12. 69
      designer_base/src/com/fr/design/widget/btn/ButtonWithHotkeysDetailPane.java
  13. 4
      designer_form/src/com/fr/design/designer/creator/XBorderStyleWidgetCreator.java
  14. 16
      designer_form/src/com/fr/design/designer/creator/XCreator.java
  15. 4
      designer_form/src/com/fr/design/designer/creator/XWScaleLayout.java
  16. 77
      designer_form/src/com/fr/design/mainframe/WidgetPropertyPane.java
  17. 56
      designer_form/src/com/fr/design/mainframe/widget/ui/FormBasicPropertyPane.java
  18. 48
      designer_form/src/com/fr/design/mainframe/widget/ui/FormBasicWidgetPropertyPane.java
  19. 214
      designer_form/src/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java
  20. 117
      designer_form/src/com/fr/design/parameter/RootDesignDefinePane.java
  21. 106
      designer_form/src/com/fr/design/widget/FormWidgetDefinePaneFactoryBase.java
  22. 34
      designer_form/src/com/fr/design/widget/ui/designer/AbstractDataModify.java
  23. 60
      designer_form/src/com/fr/design/widget/ui/designer/ButtonDefinePane.java
  24. 51
      designer_form/src/com/fr/design/widget/ui/designer/ButtonGroupDictPane.java
  25. 62
      designer_form/src/com/fr/design/widget/ui/designer/CheckBoxDefinePane.java
  26. 93
      designer_form/src/com/fr/design/widget/ui/designer/CheckBoxDictPane.java
  27. 78
      designer_form/src/com/fr/design/widget/ui/designer/CheckBoxGroupDefinePane.java
  28. 44
      designer_form/src/com/fr/design/widget/ui/designer/ComboBoxDefinePane.java
  29. 91
      designer_form/src/com/fr/design/widget/ui/designer/ComboCheckBoxDefinePane.java
  30. 1
      designer_form/src/com/fr/design/widget/ui/designer/CustomWritableRepeatEditorPane.java
  31. 245
      designer_form/src/com/fr/design/widget/ui/designer/DateEditorDefinePane.java
  32. 94
      designer_form/src/com/fr/design/widget/ui/designer/DirectWriteEditorDefinePane.java
  33. 140
      designer_form/src/com/fr/design/widget/ui/designer/FieldEditorDefinePane.java
  34. 83
      designer_form/src/com/fr/design/widget/ui/designer/IframeEditorDefinePane.java
  35. 79
      designer_form/src/com/fr/design/widget/ui/designer/LabelDefinePane.java
  36. 60
      designer_form/src/com/fr/design/widget/ui/designer/ListEditorDefinePane.java
  37. 91
      designer_form/src/com/fr/design/widget/ui/designer/MultiFileEditorPane.java
  38. 25
      designer_form/src/com/fr/design/widget/ui/designer/NoneWidgetDefinePane.java
  39. 313
      designer_form/src/com/fr/design/widget/ui/designer/NumberEditorDefinePane.java
  40. 179
      designer_form/src/com/fr/design/widget/ui/designer/ParameterTreeComboBox.java
  41. 23
      designer_form/src/com/fr/design/widget/ui/designer/PasswordDefinePane.java
  42. 44
      designer_form/src/com/fr/design/widget/ui/designer/RadioDefinePane.java
  43. 48
      designer_form/src/com/fr/design/widget/ui/designer/RadioGroupDefinePane.java
  44. 21
      designer_form/src/com/fr/design/widget/ui/designer/TextAreaDefinePane.java
  45. 128
      designer_form/src/com/fr/design/widget/ui/designer/TextFieldEditorDefinePane.java
  46. 78
      designer_form/src/com/fr/design/widget/ui/designer/TreeComboBoxEditorDefinePane.java
  47. 104
      designer_form/src/com/fr/design/widget/ui/designer/TreeEditorDefinePane.java
  48. 46
      designer_form/src/com/fr/design/widget/ui/designer/UserEditorDefinePane.java
  49. 29
      designer_form/src/com/fr/design/widget/ui/designer/WaterMarkDictPane.java
  50. 26
      designer_form/src/com/fr/design/widget/ui/designer/WritableRepeatEditorPane.java
  51. 51
      designer_form/src/com/fr/design/widget/ui/designer/WriteUnableRepeatEditorPane.java
  52. 64
      designer_form/src/com/fr/design/widget/ui/designer/btn/ButtonDetailPaneFactory.java
  53. 93
      designer_form/src/com/fr/design/widget/ui/designer/btn/ButtonGroupDefinePane.java
  54. 143
      designer_form/src/com/fr/design/widget/ui/designer/btn/ButtonSytleDefinedPane.java
  55. 30
      designer_form/src/com/fr/design/widget/ui/designer/btn/DefaultButtonDetailPane.java
  56. 56
      designer_form/src/com/fr/design/widget/ui/designer/btn/DefaultButtonStylePane.java
  57. 40
      designer_form/src/com/fr/design/widget/ui/designer/btn/FreeButtonDetailPane.java
  58. 82
      designer_form/src/com/fr/design/widget/ui/designer/component/BackgroundCompPane.java
  59. 56
      designer_form/src/com/fr/design/widget/ui/designer/component/FormWidgetValuePane.java
  60. 69
      designer_form/src/com/fr/design/widget/ui/designer/component/PaddingBoundPane.java
  61. 81
      designer_form/src/com/fr/design/widget/ui/designer/component/WidgetAbsoluteBoundPane.java
  62. 77
      designer_form/src/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java
  63. 40
      designer_form/src/com/fr/design/widget/ui/designer/custom/WidgetValueField.java
  64. 33
      designer_form/src/com/fr/design/widget/ui/designer/custom/WidgetValueFormula.java
  65. 17
      designer_form/src/com/fr/design/widget/ui/designer/custom/WidgetValuePane.java
  66. 33
      designer_form/src/com/fr/design/widget/ui/designer/custom/WidgetValueString.java
  67. 219
      designer_form/src/com/fr/design/widget/ui/designer/layout/FRAbsoluteBodyLayoutDefinePane.java
  68. 113
      designer_form/src/com/fr/design/widget/ui/designer/layout/FRAbsoluteLayoutDefinePane.java
  69. 171
      designer_form/src/com/fr/design/widget/ui/designer/layout/FRFitLayoutDefinePane.java
  70. 39
      designer_form/src/com/fr/design/widget/ui/designer/layout/WCardMainLayoutDefinePane.java
  71. 46
      designer_form/src/com/fr/design/widget/ui/designer/layout/WTabFitLayoutDefinePane.java
  72. 55
      designer_form/src/com/fr/design/widget/ui/designer/layout/WTitleLayoutDefinePane.java

2
designer/src/com/fr/design/mainframe/CellWidgetPropertyPane.java

@ -87,8 +87,8 @@ public class CellWidgetPropertyPane extends BasicPane {
public void populate(ElementCasePane ePane) { public void populate(ElementCasePane ePane) {
cellEditorDefPane = new WidgetPane(ePane); cellEditorDefPane = new WidgetPane(ePane);
this.removeAll();
this.add(cellEditorDefPane, BorderLayout.CENTER); this.add(cellEditorDefPane, BorderLayout.CENTER);
CellSelection cs = (CellSelection) ePane.getSelection(); CellSelection cs = (CellSelection) ePane.getSelection();

8
designer/src/com/fr/design/widget/CellWidgetCardPane.java

@ -52,16 +52,10 @@ public class CellWidgetCardPane extends BasicPane {
public CellWidgetCardPane(ElementCasePane pane) { public CellWidgetCardPane(ElementCasePane pane) {
this.pane = pane; this.pane = pane;
// this.initComponents(pane);
} }
public BasicWidgetPropertySettingPane initBasicWidgetPropertyPane(){
return new BasicWidgetPropertySettingPane();
}
private void initComponents(ElementCasePane pane) { private void initComponents(ElementCasePane pane) {
this.removeAll();
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
//k //k
tabbedPane = new CardLayout(); tabbedPane = new CardLayout();

154
designer_base/src/com/fr/design/gui/frpane/RegPane.java

@ -1,20 +1,6 @@
package com.fr.design.gui.frpane; package com.fr.design.gui.frpane;
import java.awt.CardLayout; import com.fr.design.constants.LayoutConstants;
import java.awt.Component;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.util.EventListener;
import java.util.EventObject;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.ListCellRenderer;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.icombobox.UIComboBoxRenderer; import com.fr.design.gui.icombobox.UIComboBoxRenderer;
@ -22,19 +8,24 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UISpinner; import com.fr.design.gui.ispinner.UISpinner;
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.form.ui.reg.CustomReg; import com.fr.design.layout.TableLayout;
import com.fr.form.ui.reg.IDCardReg; import com.fr.design.layout.TableLayoutHelper;
import com.fr.form.ui.reg.LengthReg; import com.fr.form.ui.reg.*;
import com.fr.form.ui.reg.MailReg;
import com.fr.form.ui.reg.MobileReg;
import com.fr.form.ui.reg.NoneReg;
import com.fr.form.ui.reg.PhoneReg;
import com.fr.form.ui.reg.PostCardReg;
import com.fr.form.ui.reg.RegExp;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.*;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.util.EventListener;
import java.util.EventObject;
public class RegPane extends BasicPane { public class RegPane extends BasicPane {
public static final RegExp[] ALL_REG_TYPE = { public static final RegExp[] ALL_REG_TYPE = {
new NoneReg(), new NoneReg(),
@ -64,6 +55,7 @@ public class RegPane extends BasicPane {
private RegPhonePane regPhonePane; private RegPhonePane regPhonePane;
private DefaultRegPane defaultRegPane; private DefaultRegPane defaultRegPane;
private CustomRegRexPane customRegRexPane; private CustomRegRexPane customRegRexPane;
protected RegErrorMsgPane regErrorMsgPane;
public UIComboBox getRegComboBox(){ public UIComboBox getRegComboBox(){
@ -80,14 +72,20 @@ public class RegPane extends BasicPane {
} }
private void initComponents(){ private void initComponents(){
this.setLayout(FRGUIPaneFactory.createLabelFlowLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
JPanel contentPane = FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane(); JPanel contentPane = FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane();
this.add(contentPane); this.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
contentPane.add(new UILabel(Inter.getLocText("FR-Designer_Input_Rule") + ":")); this.add(contentPane, BorderLayout.NORTH);
contentPane.add(new UILabel(Inter.getLocText("FR-Designer_Input_Rule")));
regComboBox = new UIComboBox(regType); regComboBox = new UIComboBox(regType);
regComboBox.setPreferredSize(new Dimension(140, 20));
regComboBox.setRenderer(listCellRender); regComboBox.setRenderer(listCellRender);
UILabel uiLabel = new UILabel();
uiLabel.setPreferredSize(new Dimension(20, 20));
contentPane.add(uiLabel);
contentPane.add(regComboBox); contentPane.add(regComboBox);
regErrorMsgPane = new RegErrorMsgPane();
final JPanel cardPane = FRGUIPaneFactory.createCardLayout_S_Pane(); final JPanel cardPane = FRGUIPaneFactory.createCardLayout_S_Pane();
detailedCardLayout = new CardLayout(); detailedCardLayout = new CardLayout();
cardPane.setLayout(detailedCardLayout); cardPane.setLayout(detailedCardLayout);
@ -95,27 +93,35 @@ public class RegPane extends BasicPane {
cardPane.add((regLengthPane = new RegLengthPane()), "Length"); cardPane.add((regLengthPane = new RegLengthPane()), "Length");
cardPane.add((regPhonePane = new RegPhonePane()), "Phone"); cardPane.add((regPhonePane = new RegPhonePane()), "Phone");
cardPane.add((customRegRexPane = new CustomRegRexPane()), "Custom"); cardPane.add((customRegRexPane = new CustomRegRexPane()), "Custom");
this.add(cardPane, BorderLayout.CENTER);
this.add(cardPane); this.add(regErrorMsgPane, BorderLayout.SOUTH);
regComboBox.addActionListener(new ActionListener(){ regComboBox.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
RegExp regExp = (RegExp)regComboBox.getSelectedItem(); RegExp regExp = (RegExp)regComboBox.getSelectedItem();
if(regExp instanceof PhoneReg) { if(regExp instanceof PhoneReg) {
cardPane.setPreferredSize(new Dimension(220, 30));
Object selectItem = regPhonePane.dataTypeComboBox.getSelectedItem(); Object selectItem = regPhonePane.dataTypeComboBox.getSelectedItem();
String regString = selectItem == null ? StringUtils.EMPTY : selectItem.toString(); String regString = selectItem == null ? StringUtils.EMPTY : selectItem.toString();
firePhoneRegAction(regString); firePhoneRegAction(regString);
detailedCardLayout.show(cardPane, "Phone"); detailedCardLayout.show(cardPane, "Phone");
} } else {
else {
if (regExp instanceof LengthReg){ if (regExp instanceof LengthReg){
cardPane.setPreferredSize(new Dimension(220, 60));
detailedCardLayout.show(cardPane, "Length"); detailedCardLayout.show(cardPane, "Length");
} else if (regExp instanceof CustomReg){ } else if (regExp instanceof CustomReg){
cardPane.setPreferredSize(new Dimension(220, 30));
detailedCardLayout.show(cardPane, "Custom"); detailedCardLayout.show(cardPane, "Custom");
} else { } else {
cardPane.setPreferredSize(new Dimension(0,0 ));
detailedCardLayout.show(cardPane, "Default"); detailedCardLayout.show(cardPane, "Default");
} }
fireRegChangeAction(); fireRegChangeAction();
} }
if(regExp instanceof NoneReg){
regErrorMsgPane.setVisible(false);
return;
}
regErrorMsgPane.setVisible(true);
} }
}); });
} }
@ -148,11 +154,12 @@ public class RegPane extends BasicPane {
} else { } else {
defaultRegPane.populate(regex); defaultRegPane.populate(regex);
} }
regErrorMsgPane.populate(regex);
} }
public RegExp update(){ public RegExp update(){
RegExp regExp = (RegExp)regComboBox.getSelectedItem(); RegExp regExp = (RegExp)regComboBox.getSelectedItem();
regErrorMsgPane.update();
if (regExp instanceof LengthReg){ if (regExp instanceof LengthReg){
return regLengthPane.update(); return regLengthPane.update();
} else if(regExp instanceof PhoneReg) { } else if(regExp instanceof PhoneReg) {
@ -334,6 +341,7 @@ public class RegPane extends BasicPane {
private final String[] dataType = {EMB_REG1, EMB_REG2, EMB_REG3, Inter.getLocText("FR-Designer_Custom")}; private final String[] dataType = {EMB_REG1, EMB_REG2, EMB_REG3, Inter.getLocText("FR-Designer_Custom")};
DefaultComboBoxModel DefaultComboBoxModel= new DefaultComboBoxModel(dataType); DefaultComboBoxModel DefaultComboBoxModel= new DefaultComboBoxModel(dataType);
public RegPhonePane() { public RegPhonePane() {
this.setBorder(BorderFactory.createEmptyBorder(5, 10, 5, 5));
this.setLayout(FRGUIPaneFactory.createLabelFlowLayout()); this.setLayout(FRGUIPaneFactory.createLabelFlowLayout());
this.add(new UILabel(Inter.getLocText("FR-Designer_Data_Type") + ":")); this.add(new UILabel(Inter.getLocText("FR-Designer_Data_Type") + ":"));
dataTypeComboBox = new UIComboBox(DefaultComboBoxModel); dataTypeComboBox = new UIComboBox(DefaultComboBoxModel);
@ -394,13 +402,30 @@ public class RegPane extends BasicPane {
private UISpinner maxLenSpinner; private UISpinner maxLenSpinner;
public RegLengthPane(){ public RegLengthPane(){
this.setLayout(FRGUIPaneFactory.createLabelFlowLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.add(new UILabel(Inter.getLocText("FR-Designer_Reg_Min_Length") + ":")); this.setBorder(BorderFactory.createEmptyBorder(5, 10, 5, 5));
this.setPreferredSize(new Dimension(210, 56));
// this.add(new UILabel(Inter.getLocText("FR-Designer_Reg_Min_Length") + ":"));
minLenSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, 0); minLenSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, 0);
this.add(minLenSpinner); // this.add(minLenSpinner);
this.add(new UILabel(Inter.getLocText("FR-Designer_Reg_Max_Length") + ":")); // this.add(new UILabel(Inter.getLocText("FR-Designer_Reg_Max_Length") + ":"));
maxLenSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, 0); maxLenSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, 0);
this.add(maxLenSpinner); // this.add(maxLenSpinner);
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
Component[][] components = new Component[][]{
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Reg_Min_Length") + ":"), minLenSpinner },
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Reg_Max_Length") + ":"), maxLenSpinner},
};
double[] rowSize = {p, p};
double[] columnSize = {p,f};
int[][] rowCount = {{1, 1},{1, 1}};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_SMALL, LayoutConstants.VGAP_MEDIUM);
this.add(panel);
} }
@Override @Override
@ -437,8 +462,9 @@ public class RegPane extends BasicPane {
public CustomRegRexPane(){ public CustomRegRexPane(){
this.setLayout(FRGUIPaneFactory.createLabelFlowLayout()); this.setLayout(FRGUIPaneFactory.createLabelFlowLayout());
this.setBorder(BorderFactory.createEmptyBorder(5, 10, 5, 5));
this.add(new UILabel(Inter.getLocText("FR-Designer_Reg_Expressions") + ":")); this.add(new UILabel(Inter.getLocText("FR-Designer_Reg_Expressions") + ":"));
regTextField = new UITextField(20); regTextField = new UITextField(10);
this.add(regTextField); this.add(regTextField);
} }
@ -465,6 +491,58 @@ public class RegPane extends BasicPane {
} }
} }
private static class RegErrorMsgPane extends DisplayPane{
private UITextField regErrorMsgField;
public RegErrorMsgPane(){
this.setLayout(FRGUIPaneFactory.createLabelFlowLayout());
initRegErrorMsgField();
// this.setBorder(BorderFactory.createEmptyBorder(5, 10, 5, 5));
this.add(new UILabel(Inter.getLocText("FR-Designer_Widget_Error_Tip") + ":"));
regErrorMsgField = new UITextField(10);
this.add(regErrorMsgField);
}
private void initRegErrorMsgField(){
regErrorMsgField = new UITextField(13);
regErrorMsgField.getDocument().addDocumentListener(new DocumentListener() {
public void changedUpdate(DocumentEvent e) {
regErrorMsgField.setToolTipText(regErrorMsgField.getText());
}
public void insertUpdate(DocumentEvent e) {
regErrorMsgField.setToolTipText(regErrorMsgField.getText());
}
public void removeUpdate(DocumentEvent e) {
regErrorMsgField.setToolTipText(regErrorMsgField.getText());
}
});
}
@Override
protected String title4PopupWindow() {
return "CUSTOM";
}
@Override
public void populate(RegExp regRex) {
if (!(regRex instanceof CustomReg)){
return;
}
regErrorMsgField.setText(regRex.toRegText());
}
@Override
public RegExp update() {
return new CustomReg(regErrorMsgField.getText());
}
public boolean isEmpty() {
return StringUtils.isEmpty(regErrorMsgField.getText());
}
}
ListCellRenderer listCellRender = new UIComboBoxRenderer(){ ListCellRenderer listCellRender = new UIComboBoxRenderer(){
@Override @Override
public Component getListCellRendererComponent(JList list, Object value, public Component getListCellRendererComponent(JList list, Object value,

10
designer_base/src/com/fr/design/locale/designer.properties

@ -2106,3 +2106,13 @@ FR-Designer_Double=Double
FR-Designer_Add_Event=Add Event FR-Designer_Add_Event=Add Event
FR-Designer_Not_Support_Authority_Edit=this element does not support authority edit FR-Designer_Not_Support_Authority_Edit=this element does not support authority edit
FR-Designer_Remove_Item=Remove Item FR-Designer_Remove_Item=Remove Item
FR-Designer_Widget_Position=widget Position
FR-Designer_Widget_Field=field
FR-Designer_Widget_Formula=formula
FR-Designer_Widget_String=String
FR-Designer_Widget_Display_Report_Tool=display report tool
FR-Designer_Widget_No_Repeat=no repeat
FR-Designer_Widget_Error_Tip=error tip
FR-Designer_Widget_Return_Leaf=return leaf
FR-Designer_Widget_Return_Path=return path
FR-Designer_Widget_Display_Position=Display Position

5
designer_base/src/com/fr/design/locale/designer_en_US.properties

@ -2107,3 +2107,8 @@ FR-Designer_Scale_Grade=Scale_Grade
FR-Designer_Add_Event=Add Event FR-Designer_Add_Event=Add Event
FR-Designer_Not_Support_Authority_Edit=this element does not support authority edit FR-Designer_Not_Support_Authority_Edit=this element does not support authority edit
FR-Designer_Remove_Item=Remove Item FR-Designer_Remove_Item=Remove Item
FR-Designer_Widget_No_Repeat=no repeat
FR-Designer_Widget_Error_Tip=error tip
FR-Designer_Widget_Return_Leaf=return leaf
FR-Designer_Widget_Return_Path=return path
FR-Designer_Widget_Display_Position=Display Position

5
designer_base/src/com/fr/design/locale/designer_ja_JP.properties

@ -2110,3 +2110,8 @@ FR-Designer_Label_Name=
FR-Designer_Insert_Formula= FR-Designer_Insert_Formula=
FR-Designer_Not_Support_Authority_Edit=\u3053\u306E\u8981\u7D20\u306F\u6A29\u9650\u5236\u5FA1\u3092\u30B5\u30DD\u30FC\u30C8\u3057\u3066\u3044\u307E\u305B\u3093 FR-Designer_Not_Support_Authority_Edit=\u3053\u306E\u8981\u7D20\u306F\u6A29\u9650\u5236\u5FA1\u3092\u30B5\u30DD\u30FC\u30C8\u3057\u3066\u3044\u307E\u305B\u3093
FR-Designer_Remove_Item= FR-Designer_Remove_Item=
FR-Designer_Widget_No_Repeat=
FR-Designer_Widget_Error_Tip=
FR-Designer_Widget_Return_Leaf=
FR-Designer_Widget_Return_Path=
FR-Designer_Widget_Display_Position=

5
designer_base/src/com/fr/design/locale/designer_ko_KR.properties

@ -2110,3 +2110,8 @@ FR-Designer_Label_Name=
FR-Designer_Add_Event= FR-Designer_Add_Event=
FR-Designer_Not_Support_Authority_Edit=\uD574\uB2F9\uC694\uC18C\uB294\uAD8C\uD55C\uCEE8\uD2B8\uB864\uC744\uC9C0\uC6D0\uD558\uC9C0\uC54A\uC2B5\uB2C8\uB2E4. FR-Designer_Not_Support_Authority_Edit=\uD574\uB2F9\uC694\uC18C\uB294\uAD8C\uD55C\uCEE8\uD2B8\uB864\uC744\uC9C0\uC6D0\uD558\uC9C0\uC54A\uC2B5\uB2C8\uB2E4.
FR-Designer_Remove_Item= FR-Designer_Remove_Item=
FR-Designer_Widget_No_Repeat=
FR-Designer_Widget_Error_Tip=
FR-Designer_Widget_Return_Leaf=
FR-Designer_Widget_Return_Path=
FR-Designer_Widget_Display_Position=

10
designer_base/src/com/fr/design/locale/designer_zh_CN.properties

@ -2113,3 +2113,13 @@ FR-Designer_Scale_Slider=\u7F29\u653E\u6ED1\u5757
FR-Designer_Scale_Grade=\u7F29\u653E\u7EA7\u522B\uFF0C\u5355\u51FB\u540E\u8C03\u8282\u663E\u793A\u6BD4\u4F8B\u3002 FR-Designer_Scale_Grade=\u7F29\u653E\u7EA7\u522B\uFF0C\u5355\u51FB\u540E\u8C03\u8282\u663E\u793A\u6BD4\u4F8B\u3002
FR-Designer_Not_Support_Authority_Edit=\u8BE5\u5143\u7D20\u4E0D\u652F\u6301\u6743\u9650\u63A7\u5236 FR-Designer_Not_Support_Authority_Edit=\u8BE5\u5143\u7D20\u4E0D\u652F\u6301\u6743\u9650\u63A7\u5236
FR-Designer_Remove_Item=\u5220\u9664\u9009\u4E2D FR-Designer_Remove_Item=\u5220\u9664\u9009\u4E2D
FR-Designer_Widget_Position=\u63A7\u4EF6\u4F4D\u7F6E
FR-Designer_Widget_Field=\u5B57\u6BB5
FR-Designer_Widget_Formula=\u516C\u5F0F
FR-Designer_Widget_String=\u5B57\u7B26\u4E32
FR-Designer_Widget_Display_Report_Tool=\u663E\u793A\u62A5\u8868\u5757\u5DE5\u5177\u680F
FR-Designer_Widget_No_Repeat=\u53BB\u9664\u91CD\u590D\u9879
FR-Designer_Widget_Error_Tip=\u9519\u8BEF\u63D0\u793A
FR-Designer_Widget_Return_Leaf=\u7ED3\u679C\u8FD4\u56DE\u53F6\u5B50\u8282\u70B9
FR-Designer_Widget_Return_Path=\u7ED3\u679C\u8FD4\u56DE\u5B8C\u6574\u5C42\u6B21\u8DEF\u5F84
FR-Designer_Widget_Display_Position=\u663E\u793A\u4F4D\u7F6E

5
designer_base/src/com/fr/design/locale/designer_zh_TW.properties

@ -2110,3 +2110,8 @@ FR-Designer_Label_Name=
FR-Designer_Add_Event= FR-Designer_Add_Event=
FR-Designer_Not_Support_Authority_Edit=\u8A72\u5143\u7D20\u4E0D\u652F\u63F4\u8A31\u53EF\u6B0A\u63A7\u5236 FR-Designer_Not_Support_Authority_Edit=\u8A72\u5143\u7D20\u4E0D\u652F\u63F4\u8A31\u53EF\u6B0A\u63A7\u5236
FR-Designer_Remove_Item= FR-Designer_Remove_Item=
FR-Designer_Widget_No_Repeat=
FR-Designer_Widget_Error_Tip=
FR-Designer_Widget_Return_Leaf=
FR-Designer_Widget_Return_Path=
FR-Designer_Widget_Display_Position=

21
designer_base/src/com/fr/design/widget/DataModify.java

@ -0,0 +1,21 @@
package com.fr.design.widget;
import com.fr.design.data.DataCreatorUI;
import com.fr.design.gui.frpane.TreeSettingPane;
import com.fr.design.present.dict.DictionaryPane;
import com.fr.form.ui.Widget;
import javax.swing.*;
public interface DataModify<T> {
void populateBean(T ob);
T updateBean();
void checkValid() throws Exception;
DataCreatorUI dataUI();
JComponent toSwingComponent();
}

11
designer_base/src/com/fr/design/widget/Operator.java

@ -0,0 +1,11 @@
package com.fr.design.widget;
import com.fr.design.data.DataCreatorUI;
/**
* Created by richie on 15/11/16.
*/
public interface Operator {
void did(DataCreatorUI ui, String cardName);
}

69
designer_base/src/com/fr/design/widget/btn/ButtonWithHotkeysDetailPane.java

@ -1,9 +1,7 @@
package com.fr.design.widget.btn; package com.fr.design.widget.btn;
import java.awt.*; import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.gui.frpane.AttributeChangeListener;
import javax.swing.*;
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;
@ -14,6 +12,11 @@ import com.fr.form.ui.Button;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import javax.swing.*;
import java.awt.*;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
/** /**
* Created by IntelliJ IDEA. * Created by IntelliJ IDEA.
* Author : Richer * Author : Richer
@ -25,39 +28,62 @@ public abstract class ButtonWithHotkeysDetailPane<T extends Button> extends Butt
private UITextField hotkeysTextField; private UITextField hotkeysTextField;
private UITextField buttonNameTextField; private UITextField buttonNameTextField;
private IconDefinePane iconPane; private IconDefinePane iconPane;
private AttributeChangeListener listener;
public ButtonWithHotkeysDetailPane() { public ButtonWithHotkeysDetailPane() {
initComponents(); initComponents();
} }
private void initComponents() { private void initComponents() {
// creator.
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
JPanel advancedPane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("FR-Designer_Advanced")); // JPanel advancedPane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("FR-Designer_Advanced"));
advancedPane.setPreferredSize(new Dimension(600, 341)); JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane();
// advancedPane.setPreferredSize(new Dimension(600, 341));
JPanel attrPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel attrPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
attrPane.setBorder(BorderFactory.createEmptyBorder(0, 4, 0, 4)); attrPane.setBorder(BorderFactory.createEmptyBorder(0, 4, 0, 4));
this.add(advancedPane);
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double rowSize[] = {p, p, p, p}; double f = TableLayout.FILL;
double columnSize[] = {p, p}; double rowSize[] = {p, p, p, p, p, p, p};
double columnSize[] = {p, f};
int[][] rowCount = {{1, 1}, {1, 1}, {1, 3}, {1, 1}, {1, 1}};
JPanel labelPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); JPanel labelPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
iconPane = new IconDefinePane(); iconPane = new IconDefinePane();
labelPane.add(iconPane); labelPane.add(iconPane);
Component[][] n_components = { Component[][] n_components = {
{new UILabel(Inter.getLocText("FR-Designer_Button-Name") + ":"), buttonNameTextField = new UITextField(16)}, {new UILabel(Inter.getLocText("FR-Designer_Button-Name") + ":"), buttonNameTextField = new UITextField()},
{new UILabel(Inter.getLocText("FR-Designer_Button-Icon") + ":"), labelPane}, {new UILabel("背景" + ":"), new UITextField()},
{new UILabel(Inter.getLocText("FR-Designer_Button-Type") + ":"), createButtonTypeComboBox()}, {new UILabel("字体" + ":"), new UITextField()},
{new UILabel(Inter.getLocText("FR-Designer_Button-Hotkeys") + ":"), hotkeysTextField = new UITextField(16)} {new UILabel("图标" + ":"), new UITextField()},
{new UILabel(Inter.getLocText("FR-Designer_Button-Hotkeys") + ":"), hotkeysTextField = new UITextField()}
}; };
buttonNameTextField.addFocusListener(new FocusListener() {
@Override
public void focusGained(FocusEvent e) {
}
@Override
public void focusLost(FocusEvent e) {
// creator.getWidget().set
}
});
hotkeysTextField.setToolTipText(StableUtils.join(ButtonConstants.HOTKEYS, ",")); hotkeysTextField.setToolTipText(StableUtils.join(ButtonConstants.HOTKEYS, ","));
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(n_components, rowSize, columnSize, 0, 8); JPanel panel = TableLayoutHelper.createGapTableLayoutPane(n_components, rowSize, columnSize, rowCount, 10, 8);
advancedPane.add(panel,BorderLayout.NORTH); panel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
Component comp = createCenterPane(); jPanel.add(panel, BorderLayout.CENTER);
if(comp != null ) { UIExpandablePane advancedPane = new UIExpandablePane("高级", 280, 20, jPanel);
advancedPane.add(comp,BorderLayout.CENTER); this.add(advancedPane);
} }
//add By kerry
public void addAttributeChangeListener(AttributeChangeListener listener) {
this.listener = listener;
} }
protected abstract Component createCenterPane(); protected abstract Component createCenterPane();
@Override @Override
@ -78,4 +104,11 @@ public abstract class ButtonWithHotkeysDetailPane<T extends Button> extends Butt
button.setHotkeys(hotkeysTextField.getText()); button.setHotkeys(hotkeysTextField.getText());
return button; return button;
} }
public void updateBean(Button ob) {
ob.setIconName(iconPane.update());
ob.setText(buttonNameTextField.getText());
ob.setHotkeys(hotkeysTextField.getText());
}
} }

4
designer_form/src/com/fr/design/designer/creator/XBorderStyleWidgetCreator.java

@ -145,4 +145,8 @@ public class XBorderStyleWidgetCreator extends XWidgetCreator{
return new Insets(padding.getTop(), padding.getLeft(), padding.getBottom(), padding.getRight()); return new Insets(padding.getTop(), padding.getLeft(), padding.getBottom(), padding.getRight());
} }
public boolean supportSetVisibleOrEnable(){
return false;
}
} }

16
designer_form/src/com/fr/design/designer/creator/XCreator.java

@ -626,4 +626,20 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo
return; return;
} }
/**
* 是否支持设置可见和可用
* return boolean
*/
public boolean supportSetVisibleOrEnable(){
return true;
}
/**
* 重新设置data
*
*/
public void resetData(Widget data){
this.data = data;
}
} }

4
designer_form/src/com/fr/design/designer/creator/XWScaleLayout.java

@ -157,4 +157,8 @@ public class XWScaleLayout extends DedicateLayoutContainer {
child.setSize(getWidth(), minHeight); child.setSize(getWidth(), minHeight);
} }
public boolean supportSetVisibleOrEnable(){
return true;
}
} }

77
designer_form/src/com/fr/design/mainframe/WidgetPropertyPane.java

@ -6,12 +6,12 @@ import com.fr.design.designer.beans.events.DesignerEditListener;
import com.fr.design.designer.beans.events.DesignerEvent; import com.fr.design.designer.beans.events.DesignerEvent;
import com.fr.design.designer.creator.*; import com.fr.design.designer.creator.*;
import com.fr.design.designer.properties.EventPropertyTable; import com.fr.design.designer.properties.EventPropertyTable;
import com.fr.design.designer.properties.WidgetPropertyTable;
import com.fr.design.fun.WidgetPropertyUIProvider; import com.fr.design.fun.WidgetPropertyUIProvider;
import com.fr.design.gui.frpane.UITabbedPane; import com.fr.design.gui.ibutton.UIHeadGroup;
import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.itable.AbstractPropertyTable; import com.fr.design.gui.itable.AbstractPropertyTable;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.widget.ui.FormWidgetCardPane;
import com.fr.form.ui.Widget; import com.fr.form.ui.Widget;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
@ -32,7 +32,7 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetProper
private static final String PARA = "para"; private static final String PARA = "para";
private static final String BODY = "body"; private static final String BODY = "body";
private WidgetPropertyTable propertyTable; // 控件的属性表 private FormWidgetCardPane formWidgetCardPane; // 控件的属性表
private EventPropertyTable eventTable; // 控件的事件表 private EventPropertyTable eventTable; // 控件的事件表
private List<AbstractPropertyTable> widgetPropertyTables; // 这个变量应该是保存控件拓展的属性tab private List<AbstractPropertyTable> widgetPropertyTables; // 这个变量应该是保存控件拓展的属性tab
private FormDesigner designer; // 当前designer private FormDesigner designer; // 当前designer
@ -45,6 +45,8 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetProper
private JPanel centerPane; // 此centerPane采用的是cardLayout布局,装载着mobileWidgetTable和mobileBodyWidgetTable private JPanel centerPane; // 此centerPane采用的是cardLayout布局,装载着mobileWidgetTable和mobileBodyWidgetTable
private CardLayout cardLayout; // 卡片布局,选中参数面板时显示mobileWidgetTable,选中body时显示mobileBodyWidgetTable private CardLayout cardLayout; // 卡片布局,选中参数面板时显示mobileWidgetTable,选中body时显示mobileBodyWidgetTable
private JTableHeader header;//把表头单独get出来作为一个组件 private JTableHeader header;//把表头单独get出来作为一个组件
private UIHeadGroup tabsHeaderIconPane;
public static WidgetPropertyPane getInstance() { public static WidgetPropertyPane getInstance() {
if (HOLDER.singleton == null) { if (HOLDER.singleton == null) {
@ -67,6 +69,12 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetProper
setLayout(FRGUIPaneFactory.createBorderLayout()); setLayout(FRGUIPaneFactory.createBorderLayout());
} }
@Override
protected String title4PopupWindow() {
return Inter.getLocText("FR-Designer-Widget_Settings");
}
@Override @Override
public String getViewTitle() { public String getViewTitle() {
return Inter.getLocText("Form-Widget_Property_Table"); return Inter.getLocText("Form-Widget_Property_Table");
@ -103,7 +111,7 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetProper
* 初始化属性表事件表移动端拓展的属性表 * 初始化属性表事件表移动端拓展的属性表
*/ */
private void initTables() { private void initTables() {
propertyTable.initPropertyGroups(null); formWidgetCardPane.populate();
eventTable.refresh(); eventTable.refresh();
for (AbstractPropertyTable propertyTable : widgetPropertyTables) { for (AbstractPropertyTable propertyTable : widgetPropertyTables) {
propertyTable.initPropertyGroups(designer); propertyTable.initPropertyGroups(designer);
@ -114,10 +122,11 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetProper
* 创建属性表table * 创建属性表table
*/ */
private void createPropertyTable() { private void createPropertyTable() {
propertyTable = new WidgetPropertyTable(designer); formWidgetCardPane = new FormWidgetCardPane(designer);
designer.addDesignerEditListener(new WidgetPropertyDesignerAdapter(propertyTable));
propertyTable.setBorder(null); designer.addDesignerEditListener(new WidgetPropertyDesignerAdapter(formWidgetCardPane));
psp = new UIScrollPane(propertyTable); // 用来装载属性表table
psp = new UIScrollPane(formWidgetCardPane); // 用来装载属性表table
psp.setBorder(null); psp.setBorder(null);
} }
@ -170,9 +179,7 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetProper
* 将属性表事件表移动端控件列表整合到TabPane里面去 * 将属性表事件表移动端控件列表整合到TabPane里面去
*/ */
private void createTabPane() { private void createTabPane() {
UITabbedPane tabbedPane = new UITabbedPane(); // tab选项卡容器 initTabPane();
initTabPane(tabbedPane);
add(tabbedPane, BorderLayout.CENTER);
} }
/** /**
@ -206,7 +213,8 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetProper
for (WidgetPropertyUIProvider widgetAttrProvider : widgetAttrProviders) { for (WidgetPropertyUIProvider widgetAttrProvider : widgetAttrProviders) {
AbstractPropertyTable propertyTable = widgetAttrProvider.createWidgetAttrTable(); AbstractPropertyTable propertyTable = widgetAttrProvider.createWidgetAttrTable();
widgetPropertyTables.add(propertyTable); widgetPropertyTables.add(propertyTable);
designer.addDesignerEditListener(new WidgetPropertyDesignerAdapter(propertyTable)); designer.addDesignerEditListener(new WidgetPropertyDesignerAdapter(formWidgetCardPane));
UIScrollPane uiScrollPane = new UIScrollPane(getExtraBodyTable(propertyTable)); UIScrollPane uiScrollPane = new UIScrollPane(getExtraBodyTable(propertyTable));
wsp.add(uiScrollPane); wsp.add(uiScrollPane);
} }
@ -231,13 +239,27 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetProper
return abstractPropertyTable; return abstractPropertyTable;
} }
private void initTabPane(UITabbedPane tabbedPane) { private void initTabPane() {
tabbedPane.setOpaque(true); final String[] tabTitles = new String[]{
tabbedPane.setBorder(null); Inter.getLocText("FR-Designer_Properties"),
tabbedPane.setTabPlacement(SwingConstants.BOTTOM); Inter.getLocText("FR-Designer_Event"),
tabbedPane.addTab(Inter.getLocText("FR-Designer_Properties"), psp); Inter.getLocText("FR-Widget_Mobile_Terminal")
tabbedPane.addTab(Inter.getLocText("FR-Designer_Event"), eventTable); };
tabbedPane.addTab(Inter.getLocText("FR-Widget_Mobile_Terminal"), wsp); final CardLayout tabbedPane = new CardLayout();
final JPanel center = new JPanel(tabbedPane);
center.add(formWidgetCardPane, Inter.getLocText("FR-Designer_Properties"));
center.add(eventTable, Inter.getLocText("FR-Designer_Event"));
center.add(wsp, Inter.getLocText("FR-Widget_Mobile_Terminal"));
this.add(center, BorderLayout.CENTER);
tabsHeaderIconPane = new UIHeadGroup(tabTitles) {
@Override
public void tabChanged(int index) {
tabbedPane.show(center, tabTitles[index]);
}
};
tabsHeaderIconPane.setNeedLeftRightOutLine(false);
this.add(tabsHeaderIconPane, BorderLayout.NORTH);
} }
@ -266,7 +288,7 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetProper
} }
private void clearDockingView() { private void clearDockingView() {
propertyTable = null; formWidgetCardPane = null;
eventTable = null; eventTable = null;
if (widgetPropertyTables != null) { if (widgetPropertyTables != null) {
widgetPropertyTables.clear(); widgetPropertyTables.clear();
@ -280,26 +302,25 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetProper
* 属性表监听界面事件(编辑删除选中改变大小) * 属性表监听界面事件(编辑删除选中改变大小)
*/ */
private class WidgetPropertyDesignerAdapter implements DesignerEditListener { private class WidgetPropertyDesignerAdapter implements DesignerEditListener {
AbstractPropertyTable propertyTable; FormWidgetCardPane formWidgetCardPane;
WidgetPropertyDesignerAdapter(AbstractPropertyTable propertyTable) { WidgetPropertyDesignerAdapter(FormWidgetCardPane formWidgetCardPane) {
this.propertyTable = propertyTable; this.formWidgetCardPane = formWidgetCardPane;
} }
@Override @Override
public void fireCreatorModified(DesignerEvent evt) { public void fireCreatorModified(DesignerEvent evt) {
if (evt.getCreatorEventID() == DesignerEvent.CREATOR_EDITED if (evt.getCreatorEventID() == DesignerEvent.CREATOR_EDITED
|| evt.getCreatorEventID() == DesignerEvent.CREATOR_DELETED || evt.getCreatorEventID() == DesignerEvent.CREATOR_DELETED
|| evt.getCreatorEventID() == DesignerEvent.CREATOR_SELECTED) { || evt.getCreatorEventID() == DesignerEvent.CREATOR_SELECTED
propertyTable.initPropertyGroups(designer); || evt.getCreatorEventID() == DesignerEvent.CREATOR_RESIZED) {
} else if (evt.getCreatorEventID() == DesignerEvent.CREATOR_RESIZED) { formWidgetCardPane.populate();
repaint();
} }
} }
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
return o instanceof WidgetPropertyDesignerAdapter && ((WidgetPropertyDesignerAdapter) o).propertyTable == this.propertyTable; return o instanceof WidgetPropertyDesignerAdapter && ((WidgetPropertyDesignerAdapter) o).formWidgetCardPane == this.formWidgetCardPane;
} }
} }

56
designer_form/src/com/fr/design/mainframe/widget/ui/FormBasicPropertyPane.java

@ -0,0 +1,56 @@
package com.fr.design.mainframe.widget.ui;
import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.form.ui.Widget;
import com.fr.general.Inter;
import javax.swing.*;
import java.awt.*;
/**
* Created by ibm on 2017/8/4.
*/
public class FormBasicPropertyPane extends BasicPane {
private UITextField widgetName;
public FormBasicPropertyPane(){
initContentPane();
}
protected void initContentPane() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
widgetName = new UITextField();
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
double[] rowSize = {p};
double[] columnSize = {p, f};
int[][] rowCount = {{1, 1}};
Component[][] components = new Component[][]{
new Component[]{new UILabel(Inter.getLocText("Form-Widget_Name") + ":"), widgetName},
};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 20, 7);
panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
this.add(panel, BorderLayout.NORTH);
}
@Override
public String title4PopupWindow() {
return "basicProperty";
}
public void populate(Widget widget) {
widgetName.setText(widget.getWidgetName());
}
public void update(Widget widget) {
widget.setWidgetName(widgetName.getText());
}
}

48
designer_form/src/com/fr/design/mainframe/widget/ui/FormBasicWidgetPropertyPane.java

@ -0,0 +1,48 @@
package com.fr.design.mainframe.widget.ui;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.form.ui.Widget;
import com.fr.general.Inter;
import javax.swing.*;
import java.awt.*;
/**
* Created by ibm on 2017/7/26.
*/
public class FormBasicWidgetPropertyPane extends FormBasicPropertyPane {
private UICheckBox enableCheckBox;
private UICheckBox visibleCheckBox;
public FormBasicWidgetPropertyPane (){
initOtherPane();
}
protected void initOtherPane() {
JPanel pane2 = FRGUIPaneFactory.createY_AXISBoxInnerContainer_M_Pane();
enableCheckBox = new UICheckBox(Inter.getLocText("Enabled"), true);
pane2.add(enableCheckBox);
visibleCheckBox = new UICheckBox(Inter.getLocText("Widget-Visible"), true);
pane2.add(visibleCheckBox);
this.add(pane2, BorderLayout.CENTER);
}
@Override
public String title4PopupWindow() {
return "basicProperty";
}
public void populate(Widget widget) {
super.populate(widget);
enableCheckBox.setSelected(widget.isEnabled());
visibleCheckBox.setSelected(widget.isVisible());
}
public void update(Widget widget) {
super.update(widget);
widget.setEnabled(enableCheckBox.isSelected());
widget.setEnabled(visibleCheckBox.isSelected());
}
}

214
designer_form/src/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java

@ -0,0 +1,214 @@
package com.fr.design.mainframe.widget.ui;
import com.fr.design.data.DataCreatorUI;
import com.fr.design.designer.creator.*;
import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.gui.frpane.AbstractAttrNoScrollPane;
import com.fr.design.gui.frpane.AttributeChangeListener;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.FormDesigner;
import com.fr.design.widget.DataModify;
import com.fr.design.widget.Operator;
import com.fr.design.widget.FormWidgetDefinePaneFactoryBase;
import com.fr.design.widget.ui.designer.component.WidgetAbsoluteBoundPane;
import com.fr.design.widget.ui.designer.component.WidgetBoundPane;
import com.fr.form.ui.Widget;
import com.fr.form.ui.container.WScaleLayout;
import com.fr.form.ui.widget.CRBoundsWidget;
import javax.swing.*;
import java.awt.*;
/**
* Created by ibm on 2017/7/25.
*/
public class FormWidgetCardPane extends AbstractAttrNoScrollPane {
private AttributeChangeListener listener2;
private FormDesigner designer;
//当前的编辑器属性定义面板
private DataModify<Widget> currentEditorDefinePane;
private FormBasicPropertyPane widgetPropertyPane;
private JPanel attriCardPane;
private XCreator xCreator;
private WidgetBoundPane widgetBoundPane;
public FormWidgetCardPane(FormDesigner designer) {
super();
this.xCreator = findXcreator(designer);
this.designer = designer;
initComponents();
initDefinePane();
widgetBoundPane = createWidgetBoundPane(xCreator);
if (widgetBoundPane != null) {
attriCardPane.add(widgetBoundPane, BorderLayout.CENTER);
}
}
public XLayoutContainer getParent(XCreator source) {
XLayoutContainer container = XCreatorUtils.getParentXLayoutContainer(source);
if (source.acceptType(XWFitLayout.class) || source.acceptType(XWParameterLayout.class)) {
container = null;
}
return container;
}
public WidgetBoundPane createWidgetBoundPane(XCreator xCreator) {
XLayoutContainer xLayoutContainer = getParent(xCreator);
if (xLayoutContainer == null || xCreator instanceof XWParameterLayout || xCreator instanceof XWAbsoluteLayout) {
return null;
} else if (xLayoutContainer instanceof XWAbsoluteLayout) {
return new WidgetAbsoluteBoundPane(xCreator);
}
return new WidgetBoundPane(xCreator);
}
protected JPanel createContentPane() {
return null;
}
public XCreator findXcreator(FormDesigner designer) {
int size = designer.getSelectionModel().getSelection().size();
if (size == 0 || size == 1) {
XCreator creator = size == 0 ? designer.getRootComponent() : designer.getSelectionModel().getSelection()
.getSelectedCreator();
return creator;
} else {
return null;
}
}
/**
* 后台初始化所有事件.
*/
public void initAllListeners() {
}
/**
* 后台初始化所有事件.
*/
public void reinitAllListeners() {
initListener(this);
}
protected void initContentPane() {
}
private void initComponents() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
if (xCreator.supportSetVisibleOrEnable()) {
widgetPropertyPane = new FormBasicWidgetPropertyPane();
} else {
widgetPropertyPane = new FormBasicPropertyPane();
}
UIExpandablePane uiExpandablePane = new UIExpandablePane("基本", 280, 20, widgetPropertyPane);
this.add(uiExpandablePane, BorderLayout.NORTH);
attriCardPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
this.add(attriCardPane, BorderLayout.CENTER);
this.listener2 = new AttributeChangeListener() {
@Override
public void attributeChange() {
updateCreator();
}
};
}
private void initDefinePane() {
currentEditorDefinePane = null;
XCreator creator = xCreator;
if (xCreator instanceof XWScaleLayout) {
if (xCreator.acceptType(XWScaleLayout.class)) {
if (xCreator.getComponentCount() > 0 && ((XCreator) xCreator.getComponent(0)).shouldScaleCreator()) {
creator = (XCreator) xCreator.getComponent(0);
}
}
}
FormWidgetDefinePaneFactoryBase.RN rn = FormWidgetDefinePaneFactoryBase.createWidgetDefinePane(creator, creator.toData(), new Operator() {
@Override
public void did(DataCreatorUI ui, String cardName) {
}
});
DataModify<Widget> definePane = rn.getDefinePane();
JComponent jComponent = definePane.toSwingComponent();
attriCardPane.add(jComponent, BorderLayout.NORTH);
currentEditorDefinePane = definePane;
}
@Override
public String title4PopupWindow() {
return "Widget";
}
public void populate() {
//populate之前先移除所有的监听
removeAttributeChangeListener();
Widget cellWidget = xCreator.toData();
if (widgetBoundPane != null) {
widgetBoundPane.populate();
}
if (cellWidget instanceof WScaleLayout) {
Widget crBoundsWidget = ((WScaleLayout) cellWidget).getBoundsWidget();
currentEditorDefinePane.populateBean(((CRBoundsWidget) crBoundsWidget).getWidget());
} else {
currentEditorDefinePane.populateBean(cellWidget);
}
widgetPropertyPane.populate(cellWidget);
reinitAllListeners();
this.addAttributeChangeListener(listener2);
}
public void updateCreator() {
Widget widget = currentEditorDefinePane.updateBean();
widgetPropertyPane.update(widget);
if (widgetBoundPane != null) {
widgetBoundPane.update();
}
fireValueChanged();
if (xCreator instanceof XWScaleLayout) {
XCreator xCreator1 = xCreator.getEditingChildCreator();
xCreator1.resetData(widget);
xCreator.removeAll();
xCreator.add(xCreator1);
} else {
xCreator.resetData(widget);
}
}
@Override
/**
*检查
*/
public void checkValid() throws Exception {
currentEditorDefinePane.checkValid();
}
public void fireValueChanged() {
designer.repaint();
}
public String getIconPath() {
return "";
}
}

117
designer_form/src/com/fr/design/parameter/RootDesignDefinePane.java

@ -0,0 +1,117 @@
package com.fr.design.parameter;
import com.fr.design.data.DataCreatorUI;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XWAbsoluteBodyLayout;
import com.fr.design.designer.creator.XWParameterLayout;
import com.fr.design.designer.properties.items.FRLayoutTypeItems;
import com.fr.design.designer.properties.items.Item;
import com.fr.design.designer.properties.items.ItemProvider;
import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.design.widget.ui.designer.AbstractDataModify;
import com.fr.form.ui.container.WAbsoluteBodyLayout;
import com.fr.form.ui.container.WBodyLayoutType;
import com.fr.form.ui.container.WParameterLayout;
import com.fr.general.Inter;
import javax.swing.*;
import java.awt.*;
/**
* Created by ibm on 2017/8/2.
*/
public class RootDesignDefinePane extends AbstractDataModify<WParameterLayout> {
private XWParameterLayout root;
private UISpinner designerWidth;
private UICheckBox displayReport;
private UITextField background;
private UITextField displayPosition;
public RootDesignDefinePane(XCreator xCreator) {
super(xCreator);
this.root = (XWParameterLayout) xCreator;
initComponent();
}
public void initComponent() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
designerWidth = new UISpinner(1, 1000, 1);
JPanel advancePane = createAdvancePane();
UIExpandablePane advanceExpandablePane = new UIExpandablePane(Inter.getLocText("FR-Designer_Advanced"), 280, 20, advancePane);
this.add(advanceExpandablePane, BorderLayout.NORTH);
JPanel layoutPane = createBoundsPane();
// layoutPane.setLayout(FRGUIPaneFactory.createBorderLayout());
// layoutPane.add(GUICoreUtils.createFlowPane(new JComponent[]{new UILabel("设计宽度"), designerWidth}, FlowLayout.LEFT, 4));
UIExpandablePane layoutExpandablePane = new UIExpandablePane(Inter.getLocText("Size"), 280, 20, layoutPane);
this.add(layoutExpandablePane, BorderLayout.CENTER);
}
public JPanel createBoundsPane(){
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
double[] rowSize = {p};
double[] columnSize = {p, f};
int[][] rowCount = {{1, 1}};
Component[][] components = new Component[][]{
new Component[]{new UILabel(Inter.getLocText("Form-Desin_Width")), designerWidth},
};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 20, 7);
panel.setBorder(BorderFactory.createEmptyBorder(5, 5,5,5));
return panel;
}
public JPanel createAdvancePane(){
displayReport = new UICheckBox(Inter.getLocText("FR-Designer_DisplayNothingBeforeQuery"));
background = new UITextField();
displayPosition = new UITextField();
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
double[] rowSize = {p,p, p};
double[] columnSize = {p, f};
int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}};
Component[][] components = new Component[][]{
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Background")), background},
new Component[]{displayReport, null },
new Component[]{new UILabel(Inter.getLocText("FR-Designer_WidgetDisplyPosition")), displayPosition}
};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 20, 7);
panel.setBorder(BorderFactory.createEmptyBorder(5, 5,5,5));
return panel;
}
@Override
public String title4PopupWindow() {
return "parameter";
}
@Override
public void populateBean(WParameterLayout ob) {
displayReport.setSelected(ob.isDelayDisplayContent());
designerWidth.setValue(ob.getDesignWidth());
}
@Override
public WParameterLayout updateBean() {
WParameterLayout wParameterLayout = (WParameterLayout) creator.toData();
wParameterLayout.setDesignWidth((int) designerWidth.getValue());
wParameterLayout.setDelayDisplayContent(displayReport.isSelected());
return wParameterLayout;
}
@Override
public DataCreatorUI dataUI() {
return null;
}
}

106
designer_form/src/com/fr/design/widget/FormWidgetDefinePaneFactoryBase.java

@ -0,0 +1,106 @@
package com.fr.design.widget;
import com.fr.base.FRContext;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.gui.core.WidgetConstants;
import com.fr.design.parameter.RootDesignDefinePane;
import com.fr.design.widget.ui.designer.*;
import com.fr.design.widget.ui.designer.layout.*;
import com.fr.form.ui.*;
import com.fr.form.ui.container.*;
import com.fr.form.ui.container.cardlayout.WCardMainBorderLayout;
import com.fr.form.ui.container.cardlayout.WTabFitLayout;
import com.fr.general.Inter;
import com.fr.stable.bridge.BridgeMark;
import com.fr.stable.bridge.StableFactory;
import java.lang.reflect.Constructor;
import java.util.HashMap;
import java.util.Map;
/**
* Created by IntelliJ IDEA.
* Author : Richer
* Version: 6.5.6
* Date : 11-11-14
* Time : 上午11:17
*/
public class FormWidgetDefinePaneFactoryBase {
private static Map<Class<? extends Widget>, Appearance> defineMap = new HashMap<Class<? extends Widget>, Appearance>();
static {
defineMap.put(NumberEditor.class, new Appearance(NumberEditorDefinePane.class, WidgetConstants.NUMBER + ""));
defineMap.put(DateEditor.class, new Appearance(DateEditorDefinePane.class, WidgetConstants.DATE + ""));
defineMap.put(ComboCheckBox.class, new Appearance(ComboCheckBoxDefinePane.class, WidgetConstants.COMBOCHECKBOX + ""));
defineMap.put(Radio.class, new Appearance(RadioDefinePane.class, WidgetConstants.RADIO + ""));
defineMap.put(CheckBox.class, new Appearance(CheckBoxDefinePane.class, WidgetConstants.CHECKBOX + ""));
defineMap.put(TreeComboBoxEditor.class, new Appearance(TreeComboBoxEditorDefinePane.class, WidgetConstants.TREECOMBOBOX + ""));
defineMap.put(TreeEditor.class, new Appearance(TreeEditorDefinePane.class, WidgetConstants.TREE + ""));
defineMap.put(MultiFileEditor.class, new Appearance(MultiFileEditorPane.class, WidgetConstants.MULTI_FILE + ""));
defineMap.put(TextArea.class, new Appearance(TextAreaDefinePane.class, WidgetConstants.TEXTAREA + ""));
defineMap.put(Password.class, new Appearance(PasswordDefinePane.class, WidgetConstants.PASSWORD + ""));
defineMap.put(IframeEditor.class, new Appearance(IframeEditorDefinePane.class, WidgetConstants.IFRAME + ""));
defineMap.put(TextEditor.class, new Appearance(TextFieldEditorDefinePane.class, WidgetConstants.TEXT + ""));
defineMap.put(NameWidget.class, new Appearance(UserEditorDefinePane.class, "UserDefine"));
defineMap.put(ComboCheckBox.class, new Appearance(ComboCheckBoxDefinePane.class, WidgetConstants.COMBOCHECKBOX + ""));
defineMap.put(ListEditor.class, new Appearance(ListEditorDefinePane.class, WidgetConstants.LIST + ""));
defineMap.put(ComboBox.class, new Appearance(ComboBoxDefinePane.class, WidgetConstants.COMBOBOX + ""));
defineMap.put(RadioGroup.class, new Appearance(RadioGroupDefinePane.class, WidgetConstants.RADIOGROUP + ""));
defineMap.put(CheckBoxGroup.class, new Appearance(CheckBoxGroupDefinePane.class, WidgetConstants.CHECKBOXGROUP + ""));
defineMap.put(NoneWidget.class, new Appearance(NoneWidgetDefinePane.class, WidgetConstants.NONE + ""));
defineMap.put(Button.class, new Appearance(ButtonDefinePane.class, WidgetConstants.BUTTON + ""));
defineMap.put(FreeButton.class, new Appearance(ButtonDefinePane.class, WidgetConstants.BUTTON + ""));
defineMap.put(WFitLayout.class, new Appearance(FRFitLayoutDefinePane.class, Inter.getLocText("FR-Designer-Layout_Adaptive_Layout")));
defineMap.put(WCardMainBorderLayout.class, new Appearance(WCardMainLayoutDefinePane.class, Inter.getLocText("WLayout-Card-ToolTips")));
if (StableFactory.getMarkedClass(BridgeMark.SUBMIT_BUTTON, Widget.class) != null) {
defineMap.put(StableFactory.getMarkedClass(BridgeMark.SUBMIT_BUTTON, Widget.class), new Appearance(ButtonDefinePane.class, WidgetConstants.BUTTON + ""));
}
defineMap.put(WAbsoluteLayout.class, new Appearance(FRAbsoluteLayoutDefinePane.class, Inter.getLocText("FR-Designer_AbsoluteLayout")));
defineMap.put(WAbsoluteBodyLayout.class, new Appearance(FRAbsoluteBodyLayoutDefinePane.class, Inter.getLocText("FR-Designer-Layout_Adaptive_Layout")));
defineMap.put(WParameterLayout.class, new Appearance(RootDesignDefinePane.class, Inter.getLocText("FR-Designer_Para-Body")));
defineMap.put(WCardMainBorderLayout.class, new Appearance(WCardMainLayoutDefinePane.class, "tab"));
defineMap.put(WTitleLayout.class, new Appearance(WTitleLayoutDefinePane.class, "tab"));
defineMap.put(Label.class, new Appearance(LabelDefinePane.class, "label"));
defineMap.put(WTabFitLayout.class, new Appearance(WTabFitLayoutDefinePane.class, "label"));
defineMap.putAll(ExtraDesignClassManager.getInstance().getCellWidgetOptionsMap());
}
private FormWidgetDefinePaneFactoryBase() {
}
public static RN createWidgetDefinePane(XCreator creator, Widget widget, Operator operator) {
Appearance dn = defineMap.get(widget.getClass());
DataModify<Widget> definePane = null;
try {
Constructor con = dn.getDefineClass().getConstructor(XCreator.class);
definePane = (DataModify)con.newInstance(creator);
operator.did(definePane.dataUI(), dn.getDisplayName());
} catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e);
}
return new RN(definePane, dn.getDisplayName());
}
public static class RN {
private DataModify<Widget> definePane;
private String cardName;
public RN(DataModify<Widget> definePane, String cardName) {
this.definePane = definePane;
this.cardName = cardName;
}
public DataModify<Widget> getDefinePane() {
return definePane;
}
public String getCardName() {
return cardName;
}
}
}

34
designer_form/src/com/fr/design/widget/ui/designer/AbstractDataModify.java

@ -0,0 +1,34 @@
package com.fr.design.widget.ui.designer;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.data.DataCreatorUI;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.widget.DataModify;
import javax.swing.*;
/**
* Created by kerry on 17/07/28.
*/
public abstract class AbstractDataModify<T> extends BasicBeanPane<T> implements DataModify<T> {
protected XCreator creator;
public AbstractDataModify(){
}
public AbstractDataModify(XCreator xCreator){
this.creator = xCreator;
}
@Override
public DataCreatorUI dataUI() {
return null;
}
@Override
public JComponent toSwingComponent() {
return this;
}
}

60
designer_form/src/com/fr/design/widget/ui/designer/ButtonDefinePane.java

@ -0,0 +1,60 @@
package com.fr.design.widget.ui.designer;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.widget.btn.ButtonDetailPane;
import com.fr.design.widget.ui.designer.btn.ButtonDetailPaneFactory;
import com.fr.form.ui.Button;
import com.fr.form.ui.FreeButton;
import javax.swing.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.*;
public class ButtonDefinePane extends AbstractDataModify<Button> {
private ButtonDetailPane detailPane;
public ButtonDefinePane(XCreator creator){
super(creator);
this.initComponent();
}
private void initComponent() {
setLayout(FRGUIPaneFactory.createBorderLayout());
setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
}
@Override
public String title4PopupWindow() {
return "Button";
}
private void resetDetailPane(Button btn, Class cls) {
if (detailPane != null) {
remove(detailPane);
}
detailPane = ButtonDetailPaneFactory.createButtonDetailPane(cls, btn);
add(detailPane, BorderLayout.CENTER);
detailPane.addTypeChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
resetDetailPane(null, (Class) e.getSource());
}
});
this.updateUI();
}
@Override
public void populateBean(Button btn) {
resetDetailPane(btn, btn instanceof FreeButton && !((FreeButton) btn).isCustomStyle() ? Button.class : null);
}
@Override
public Button updateBean() {
// resetDetailPane(btn, btn instanceof FreeButton && !((FreeButton) btn).isCustomStyle() ? Button.class : null);
return new Button();
}
}

51
designer_form/src/com/fr/design/widget/ui/designer/ButtonGroupDictPane.java

@ -0,0 +1,51 @@
package com.fr.design.widget.ui.designer;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UIBasicSpinner;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.form.ui.ButtonGroup;
import com.fr.general.Inter;
import javax.swing.*;
public class ButtonGroupDictPane extends JPanel {
private UIBasicSpinner columnSpinner;
private UICheckBox adaptiveCheckbox;
private UILabel columnLabel;
public ButtonGroupDictPane() {
this.initComponents();
}
/**
*
*/
public void initComponents() {
this.setLayout(FRGUIPaneFactory.createLabelFlowLayout());
adaptiveCheckbox = new UICheckBox(Inter.getLocText("Adaptive"), true);
this.add(adaptiveCheckbox);
this.columnLabel = new UILabel(Inter.getLocText("Button-Group-Display-Columns") + ":");
this.add(columnLabel);
columnSpinner = new UIBasicSpinner(new SpinnerNumberModel(0, 0, Integer.MAX_VALUE, 1));
this.add(columnSpinner);
}
public void populate(ButtonGroup buttonGroup) {
adaptiveCheckbox.setSelected(buttonGroup.isAdaptive());
columnSpinner.setVisible(!adaptiveCheckbox.isSelected());
columnLabel.setVisible(!adaptiveCheckbox.isSelected());
columnSpinner.setValue(buttonGroup.getColumnsInRow());
}
public void update(ButtonGroup buttonGroup) {
columnSpinner.setVisible(!adaptiveCheckbox.isSelected());
columnLabel.setVisible(!adaptiveCheckbox.isSelected());
buttonGroup.setAdaptive(adaptiveCheckbox.isSelected());
buttonGroup.setColumnsInRow((Integer)(columnSpinner.getValue()));
}
}

62
designer_form/src/com/fr/design/widget/ui/designer/CheckBoxDefinePane.java

@ -0,0 +1,62 @@
package com.fr.design.widget.ui.designer;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.widget.ui.designer.component.FormWidgetValuePane;
import com.fr.form.ui.CheckBox;
import com.fr.general.Inter;
import javax.swing.*;
import java.awt.*;
public class CheckBoxDefinePane extends AbstractDataModify<CheckBox> {
private UITextField text;
private UITextField fontSizePane;
public CheckBoxDefinePane(XCreator xCreator) {
super(xCreator);
iniComoponents();
}
private void iniComoponents() {
text = new UITextField();
fontSizePane = new UITextField();
FormWidgetValuePane formWidgetValuePane = new FormWidgetValuePane();
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
Component[][] components = new Component[][]{
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Text")), text },
new Component[]{new UILabel(Inter.getLocText("FR-Designer-Estate_Widget_Value")), formWidgetValuePane },
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Font-Size")), fontSizePane},
};
double[] rowSize = {p, p, p, p, p};
double[] columnSize = {p, f};
int[][] rowCount = {{1, 1},{1, 3},{1, 1}};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 10, 7);
panel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
UIExpandablePane uiExpandablePane = new UIExpandablePane(Inter.getLocText("FR-Designer_Advanced"), 280, 20, panel);
this.add(uiExpandablePane);
}
@Override
public String title4PopupWindow() {
return "CheckBox";
}
@Override
public void populateBean(CheckBox check) {
// text.setText(check.getText());
}
@Override
public CheckBox updateBean() {
CheckBox box = new CheckBox();
box.setText(text.getText());
return box;
}
}

93
designer_form/src/com/fr/design/widget/ui/designer/CheckBoxDictPane.java

@ -0,0 +1,93 @@
package com.fr.design.widget.ui.designer;
import com.fr.design.gui.icombobox.DictionaryComboBox;
import com.fr.design.gui.icombobox.DictionaryConstants;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.form.ui.CheckBoxGroup;
import com.fr.form.ui.ComboCheckBox;
import com.fr.general.Inter;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class CheckBoxDictPane extends JPanel {
private DictionaryComboBox delimiterComboBox;
private UIComboBox returnTypeComboBox;
private DictionaryComboBox startComboBox;
private DictionaryComboBox endComboBox;
private JPanel delimiterPane;
private JPanel startPane;
private JPanel endPane;
public CheckBoxDictPane() {
JPanel returnTypePane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
returnTypePane.add(new UILabel(Inter.getLocText("Widget-Date_Selector_Return_Type") + ":"), BorderLayout.WEST);
returnTypeComboBox = new UIComboBox(new String[]{Inter.getLocText("Widget-Array"), Inter.getLocText("String")});
returnTypePane.add(returnTypeComboBox, BorderLayout.CENTER);
this.add(returnTypePane);
delimiterPane =FRGUIPaneFactory.createBorderLayout_S_Pane();
UILabel label = new UILabel(Inter.getLocText("Form-Delimiter") + ":");
delimiterPane.add(label, BorderLayout.WEST);
delimiterPane.add(delimiterComboBox = new DictionaryComboBox(DictionaryConstants.delimiters, DictionaryConstants.delimiterDisplays), BorderLayout.CENTER);
delimiterComboBox.setEditable(true);
this.add(delimiterPane);
startPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
startPane.add(new UILabel(Inter.getLocText("ComboCheckBox-Start_Symbol") + ":"), BorderLayout.WEST);
startPane.add(startComboBox = new DictionaryComboBox(DictionaryConstants.symbols, DictionaryConstants.symbolDisplays), BorderLayout.CENTER);
startComboBox.setEditable(true);
this.add(startPane);
endPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
endPane.add(new UILabel(Inter.getLocText("ComboCheckBox-End_Symbol") + ":"), BorderLayout.WEST);
endPane.add(endComboBox = new DictionaryComboBox(DictionaryConstants.symbols, DictionaryConstants.symbolDisplays), BorderLayout.CENTER);
endComboBox.setEditable(true);
this.add(endPane);
returnTypeComboBox.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e) {
checkVisible();
}
});
}
private void checkVisible(){
delimiterPane.setVisible(returnTypeComboBox.getSelectedIndex() == 1);
startPane.setVisible(returnTypeComboBox.getSelectedIndex() == 1);
endPane.setVisible(returnTypeComboBox.getSelectedIndex() == 1);
}
public void populate(ComboCheckBox comboCheckBox) {
this.delimiterComboBox.setSelectedItem(comboCheckBox.getDelimiter());
this.returnTypeComboBox.setSelectedIndex(comboCheckBox.isReturnString() ? 1 : 0);
this.startComboBox.setSelectedItem(comboCheckBox.getStartSymbol());
this.endComboBox.setSelectedItem(comboCheckBox.getEndSymbol());
checkVisible();
}
public void update(ComboCheckBox comboCheckBox) {
comboCheckBox.setDelimiter((String)this.delimiterComboBox.getSelectedItem());
comboCheckBox.setReturnString(this.returnTypeComboBox.getSelectedIndex() != 0);
comboCheckBox.setStartSymbol((String)this.startComboBox.getSelectedItem());
comboCheckBox.setEndSymbol((String)this.endComboBox.getSelectedItem());
}
public void populate(CheckBoxGroup checkBoxGroup) {
this.delimiterComboBox.setSelectedItem(checkBoxGroup.getDelimiter());
this.returnTypeComboBox.setSelectedIndex(checkBoxGroup.isReturnString() ? 1 : 0);
this.startComboBox.setSelectedItem(checkBoxGroup.getStartSymbol());
this.endComboBox.setSelectedItem(checkBoxGroup.getEndSymbol());
checkVisible();
}
public void update(CheckBoxGroup checkBoxGroup) {
checkBoxGroup.setDelimiter((String)this.delimiterComboBox.getSelectedItem());
checkBoxGroup.setReturnString(this.returnTypeComboBox.getSelectedIndex() != 0);
checkBoxGroup.setStartSymbol((String)this.startComboBox.getSelectedItem());
checkBoxGroup.setEndSymbol((String)this.endComboBox.getSelectedItem());
}
}

78
designer_form/src/com/fr/design/widget/ui/designer/CheckBoxGroupDefinePane.java

@ -0,0 +1,78 @@
package com.fr.design.widget.ui.designer;
import com.fr.design.data.DataCreatorUI;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.present.dict.DictionaryPane;
import com.fr.design.widget.ui.designer.btn.ButtonGroupDefinePane;
import com.fr.form.ui.CheckBoxGroup;
import com.fr.general.Inter;
import javax.swing.*;
import java.awt.*;
public class CheckBoxGroupDefinePane extends ButtonGroupDefinePane<CheckBoxGroup> {
private DictionaryPane dictPane;
private UICheckBox checkbox;
public CheckBoxGroupDefinePane(XCreator xCreator) {
super(xCreator);
}
@Override
protected void initComponents() {
super.initComponents();
dictPane = new DictionaryPane();
}
@Override
public String title4PopupWindow() {
return "CheckBoxGroup";
}
public JPanel createOtherPane(){
checkbox = new UICheckBox(Inter.getLocText(new String[]{"Provide", "Choose_All"}));
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
Component[][] components = new Component[][]{
new Component[]{checkbox, null },
new Component[]{new UILabel(Inter.getLocText("Widget-Date_Selector_Return_Type")), new UITextField()},
};
double[] rowSize = {p, p};
double[] columnSize = {p, f};
int[][] rowCount = {{1, 1},{1, 1}};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 10, 7);
panel.setBorder(BorderFactory.createEmptyBorder(0,5,5,5));
return panel;
}
@Override
protected void populateSubButtonGroupBean(CheckBoxGroup ob) {
this.dictPane.populateBean(ob.getDictionary());
checkbox.setSelected(ob.isChooseAll());
}
@Override
protected CheckBoxGroup updateSubButtonGroupBean() {
CheckBoxGroup ob = (CheckBoxGroup) creator.toData();
ob.setDictionary(this.dictPane.updateBean());
ob.setChooseAll(checkbox.isSelected());
return ob;
}
@Override
public DataCreatorUI dataUI() {
return dictPane;
}
}

44
designer_form/src/com/fr/design/widget/ui/designer/ComboBoxDefinePane.java

@ -0,0 +1,44 @@
package com.fr.design.widget.ui.designer;
import com.fr.design.data.DataCreatorUI;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.present.dict.DictionaryPane;
import com.fr.form.ui.ComboBox;
import javax.swing.*;
public class ComboBoxDefinePane extends CustomWritableRepeatEditorPane<ComboBox> {
protected DictionaryPane dictPane;
public ComboBoxDefinePane(XCreator xCreator) {
super(xCreator);
dictPane = new DictionaryPane();
}
protected JPanel setForthContentPane () {
return null;
}
protected void populateSubCustomWritableRepeatEditorBean(ComboBox e) {
removeRepeatCheckBox.setSelected(e.isRemoveRepeat());
this.dictPane.populateBean(e.getDictionary());
}
protected ComboBox updateSubCustomWritableRepeatEditorBean() {
ComboBox combo = new ComboBox();
combo.setDictionary(this.dictPane.updateBean());
combo.setRemoveRepeat(removeRepeatCheckBox.isSelected());
return combo;
}
@Override
public String title4PopupWindow() {
return "ComboBox";
}
@Override
public DataCreatorUI dataUI() {
return dictPane;
}
}

91
designer_form/src/com/fr/design/widget/ui/designer/ComboCheckBoxDefinePane.java

@ -0,0 +1,91 @@
package com.fr.design.widget.ui.designer;
import com.fr.design.data.DataCreatorUI;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.present.dict.DictionaryPane;
import com.fr.form.ui.ComboCheckBox;
import com.fr.general.Inter;
import javax.swing.*;
import java.awt.*;
public class ComboCheckBoxDefinePane extends CustomWritableRepeatEditorPane<ComboCheckBox> {
private CheckBoxDictPane checkBoxDictPane;
private DictionaryPane dictPane;
private UICheckBox supportTagCheckBox;
public ComboCheckBoxDefinePane(XCreator xCreator) {
super(xCreator);
dictPane = new DictionaryPane();
checkBoxDictPane = new CheckBoxDictPane();
supportTagCheckBox = new UICheckBox(Inter.getLocText("Form-SupportTag"), true);
}
@Override
protected JPanel setForthContentPane() {
JPanel attrPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_S_Pane();
attrPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
JPanel contenter = FRGUIPaneFactory.createBorderLayout_L_Pane();
contenter.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
attrPane.add(contenter);
//是否以标签形式显示
JPanel tagPane = FRGUIPaneFactory.createMediumHGapFlowInnerContainer_M_Pane();
tagPane.add(supportTagCheckBox);
contenter.add(tagPane, BorderLayout.NORTH);
contenter.add(checkBoxDictPane, BorderLayout.WEST);
return attrPane;
}
@Override
protected void populateSubCustomWritableRepeatEditorBean(ComboCheckBox e) {
this.dictPane.populateBean(e.getDictionary());
this.checkBoxDictPane.populate(e);
this.supportTagCheckBox.setSelected(e.isSupportTag());
this.removeRepeatCheckBox.setSelected(e.isRemoveRepeat());
}
public JPanel createOtherPane(){
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
Component[][] components = new Component[][]{
new Component[]{new UICheckBox(Inter.getLocText("Form-SupportTag")), null },
new Component[]{new UILabel(Inter.getLocText("Widget-Date_Selector_Return_Type")), new UITextField()},
};
double[] rowSize = {p, p};
double[] columnSize = {p, f};
int[][] rowCount = {{1, 1},{1, 1}};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 10, 7);
panel.setBorder(BorderFactory.createEmptyBorder(0,5,5,5));
return panel;
}
@Override
protected ComboCheckBox updateSubCustomWritableRepeatEditorBean() {
ComboCheckBox combo = new ComboCheckBox();
combo.setSupportTag(this.supportTagCheckBox.isSelected());
combo.setDictionary(this.dictPane.updateBean());
checkBoxDictPane.update(combo);
combo.setRemoveRepeat(removeRepeatCheckBox.isSelected());
return combo;
}
@Override
public DataCreatorUI dataUI() {
return dictPane;
}
@Override
public String title4PopupWindow() {
return "ComboCheckBox";
}
}

1
designer_form/src/com/fr/design/widget/ui/designer/CustomWritableRepeatEditorPane.java

@ -0,0 +1 @@
package com.fr.design.widget.ui.designer; import com.fr.base.GraphHelper; import com.fr.design.designer.creator.XCreator; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.form.ui.CustomWriteAbleRepeatEditor; import com.fr.general.Inter; import javax.swing.*; import java.awt.*; /** * Author : Shockway * Date: 13-9-18 * Time: 下午2:17 */ public abstract class CustomWritableRepeatEditorPane<T extends CustomWriteAbleRepeatEditor> extends WritableRepeatEditorPane<T> { private UICheckBox customDataCheckBox; private static final int CUSTOM_DATA_CHECK_BOX_WIDTH = GraphHelper.getLocTextWidth("Form-Allow_CustomData") + 30; private static final int CUSTOM_DATA_CHECK_BOX_HEIGHT = 30; public CustomWritableRepeatEditorPane(XCreator xCreator) { super(xCreator); } // @Override // protected JPanel setThirdContentPane() { // JPanel contentPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); // contentPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); // JPanel otherContentPane = this.setForthContentPane(); // if (otherContentPane != null) { // contentPane.add(otherContentPane,BorderLayout.CENTER); // } // return contentPane; // } public JPanel setValidatePane(){ this.customDataCheckBox = new UICheckBox(Inter.getLocText("Form-Allow_CustomData"), false); this.customDataCheckBox.setPreferredSize( new Dimension(CUSTOM_DATA_CHECK_BOX_WIDTH, CUSTOM_DATA_CHECK_BOX_HEIGHT)); JPanel otherContentPane = super.setValidatePane(); otherContentPane.add(GUICoreUtils.createFlowPane(new JComponent[]{customDataCheckBox}, FlowLayout.LEFT, 5)); return otherContentPane; } protected abstract JPanel setForthContentPane(); protected void populateSubWritableRepeatEditorBean(T e) { this.customDataCheckBox.setSelected(e.isCustomData()); populateSubCustomWritableRepeatEditorBean(e); } protected abstract void populateSubCustomWritableRepeatEditorBean(T e); protected T updateSubWritableRepeatEditorBean() { T e = updateSubCustomWritableRepeatEditorBean(); e.setCustomData(this.customDataCheckBox.isSelected()); return e; } protected abstract T updateSubCustomWritableRepeatEditorBean(); }

245
designer_form/src/com/fr/design/widget/ui/designer/DateEditorDefinePane.java

@ -0,0 +1,245 @@
package com.fr.design.widget.ui.designer;
import com.fr.base.FRContext;
import com.fr.base.Formula;
import com.fr.data.core.FormatField;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.editor.ValueEditorPane;
import com.fr.design.editor.ValueEditorPaneFactory;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.form.ui.DateEditor;
import com.fr.general.DateUtils;
import com.fr.general.Inter;
import com.fr.script.Calculator;
import com.fr.stable.ArrayUtils;
import com.fr.stable.StringUtils;
import com.fr.stable.UtilEvalError;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.text.SimpleDateFormat;
import java.util.Date;
public class DateEditorDefinePane extends DirectWriteEditorDefinePane<DateEditor> {
private UIComboBox returnTypeComboBox;
private UILabel sampleLabel;// preview
private UIComboBox dateFormatComboBox;
private ValueEditorPane startDv;
private ValueEditorPane endDv;
public DateEditorDefinePane(XCreator xCreator) {
super(xCreator);
}
@Override
public String title4PopupWindow() {
return "Date";
}
@Override
protected JPanel setFirstContentPane() {
waterMarkDictPane = new WaterMarkDictPane();
JPanel returnTypePane = FRGUIPaneFactory.createBorderLayout_S_Pane();
returnTypePane.add(new UILabel(Inter.getLocText("Widget-Date_Selector_Return_Type") + ":"), BorderLayout.WEST);
returnTypeComboBox = new UIComboBox(new String[] { Inter.getLocText("String"), Inter.getLocText("Date") });
returnTypeComboBox.setPreferredSize(new Dimension(70, 20));
// sample pane
sampleLabel = new UILabel("");
sampleLabel.setBorder(BorderFactory.createEmptyBorder(2, 4, 4, 4));
sampleLabel.setHorizontalAlignment(SwingConstants.CENTER);
sampleLabel.setFont(FRContext.getDefaultValues().getFRFont());
// content pane
String[] arr = getDateFormateArray();
dateFormatComboBox = new UIComboBox(arr);
dateFormatComboBox.setPreferredSize(new Dimension(150,20));
dateFormatComboBox.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
refreshPreviewLabel();
}
});
JPanel secondPanel = GUICoreUtils.createFlowPane(new JComponent[]{new UILabel(Inter.getLocText("FR-Engine_Format") + ":"),dateFormatComboBox,sampleLabel}, FlowLayout.LEFT, 5);
secondPanel.setPreferredSize(new Dimension(220,30));
startDv = ValueEditorPaneFactory.createDateValueEditorPane(null, null);
endDv = ValueEditorPaneFactory.createDateValueEditorPane(null, null);
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
Component[][] components = new Component[][]{
new Component[]{new UILabel(Inter.getLocText("Widget-Date_Selector_Return_Type") + ":"), returnTypeComboBox },
new Component[]{new UILabel(Inter.getLocText("FR-Engine_Format") + ":"), dateFormatComboBox},
new Component[]{null, sampleLabel},
new Component[]{new UILabel(Inter.getLocText("FS_Start_Date") + ":"), startDv},
new Component[]{new UILabel(Inter.getLocText("FS_End_Date") + ":"), endDv},
};
double[] rowSize = {p, p,p,p,p};
double[] columnSize = {p,f};
int[][] rowCount = {{1, 1},{1, 1},{1, 1},{1, 1},{1, 1}};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_SMALL, 1);
return panel;
}
protected JPanel setSecondContentPane(){
return null;
}
private String[] getDateFormateArray() {
return FormatField.getInstance().getDateFormatArray();
}
protected JPanel initStartEndDatePane() {
JPanel rangePane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
rangePane.add(new UILabel(Inter.getLocText("FS_Start_Date") + ":"));
startDv = ValueEditorPaneFactory.createDateValueEditorPane(null, null);
rangePane.add(startDv);
rangePane.add(new UILabel(Inter.getLocText("FS_End_Date") + ":"));
endDv = ValueEditorPaneFactory.createDateValueEditorPane(null, null);
rangePane.add(endDv);
return rangePane;
}
private void refreshPreviewLabel() {
String text = (String) dateFormatComboBox.getSelectedItem();
if (text != null && text.length() > 0) {
try {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(text);
String sample = simpleDateFormat.format(new Date());
Color c = Color.black;
if (!ArrayUtils.contains(FormatField.getInstance().getDateFormatArray(), text)) {
sample += " " + Inter.getLocText("DateFormat-Custom_Warning");
c = Color.red;
}
this.sampleLabel.setText(sample);
this.sampleLabel.setForeground(c);
} catch (Exception exp) {
this.sampleLabel.setForeground(Color.red);
this.sampleLabel.setText(exp.getMessage());
}
} else {
this.sampleLabel.setText(new Date().toString());
}
}
@Override
protected void populateSubDirectWriteEditorBean(DateEditor e) {
String formatText = e.getFormatText();
// dateFormatComboBox.setSelectedItem(formatText);
//
// returnTypeComboBox.setSelectedIndex(e.isReturnDate() ? 1 : 0);
populateStartEnd(e);
}
@Override
protected DateEditor updateSubDirectWriteEditorBean() {
DateEditor ob = new DateEditor();
ob.setFormatText(this.getSimpleDateFormat().toPattern());
ob.setReturnDate(returnTypeComboBox.getSelectedIndex() == 1);
updateStartEnd(ob);
return ob;
}
/**
* 初始起止日期
* @param dateWidgetEditor 日期控件
*/
public void populateStartEnd(DateEditor dateWidgetEditor) {
Formula startFM = dateWidgetEditor.getStartDateFM();
Formula endFM = dateWidgetEditor.getEndDateFM();
if (startFM != null) {
startDv.populate(startFM);
} else {
String startStr = dateWidgetEditor.getStartText();
startDv.populate(StringUtils.isEmpty(startStr) ? null : DateUtils.string2Date(startStr, true));
}
if (endFM != null) {
endDv.populate(endFM);
} else {
String endStr = dateWidgetEditor.getEndText();
endDv.populate(StringUtils.isEmpty(endStr) ? null : DateUtils.string2Date(endStr, true));
}
}
/**
* 更新日期控件的起止日期
* @param dateWidgetEditor 日期控件
*/
public void updateStartEnd(DateEditor dateWidgetEditor) {
Object startObject = startDv.update();
Object endObject = endDv.update();
// wei : 对公式的处理
Calculator cal = null;
if (startObject instanceof Formula) {
cal = Calculator.createCalculator();
Formula startFormula = (Formula) startObject;
try {
startFormula.setResult(cal.evalValue(startFormula.getContent()));
} catch (UtilEvalError e) {
FRContext.getLogger().error(e.getMessage(), e);
}
startObject = startFormula.getResult();
dateWidgetEditor.setStartDateFM(startFormula);
dateWidgetEditor.setStartText(null);
} else {
try {
dateWidgetEditor.setStartText(startObject == null ? "" : DateUtils.getDate2Str("MM/dd/yyyy", (Date)startObject));
} catch(ClassCastException e) {
//wei : TODO 说明应用的公式不能转化成日期格式,应该做些处理。
}
}
if (endObject instanceof Formula) {
cal = Calculator.createCalculator();
Formula endFormula = (Formula) endObject;
try {
endFormula.setResult(cal.evalValue(endFormula.getContent()));
} catch (UtilEvalError e) {
FRContext.getLogger().error(e.getMessage(), e);
}
endObject = endFormula.getResult();
dateWidgetEditor.setEndDateFM(endFormula);
dateWidgetEditor.setEndText(null);
} else {
try {
dateWidgetEditor.setEndText(endObject == null ? "" : DateUtils.getDate2Str("MM/dd/yyyy", (Date)endObject));
} catch(ClassCastException e) {
}
}
}
private SimpleDateFormat getSimpleDateFormat() {
String text = (String) dateFormatComboBox.getSelectedItem();
SimpleDateFormat simpleDateFormat;
if (text != null && text.length() > 0) {
try {
simpleDateFormat = new SimpleDateFormat(text);
this.sampleLabel.setText(simpleDateFormat.format(new Date()));
} catch (Exception exp) {
simpleDateFormat = new SimpleDateFormat("");
}
} else {
simpleDateFormat = new SimpleDateFormat("");
}
return simpleDateFormat;
}
}

94
designer_form/src/com/fr/design/widget/ui/designer/DirectWriteEditorDefinePane.java

@ -0,0 +1,94 @@
package com.fr.design.widget.ui.designer;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.design.widget.ui.designer.component.FormWidgetValuePane;
import com.fr.form.ui.DirectWriteEditor;
import com.fr.general.Inter;
import javax.swing.*;
import java.awt.*;
//richer:需要提供能否直接编辑的控件设置面板——下拉框、复选框、时间、日期、下拉树
public abstract class DirectWriteEditorDefinePane<T extends DirectWriteEditor> extends FieldEditorDefinePane<T> {
public UICheckBox directWriteCheckBox;
protected WaterMarkDictPane waterMarkDictPane;
protected UICheckBox removeRepeatCheckBox;
public DirectWriteEditorDefinePane(XCreator xCreator) {
super(xCreator);
}
@Override
protected JPanel setFirstContentPane() {
JPanel advancePane = FRGUIPaneFactory.createBorderLayout_S_Pane();
waterMarkDictPane = new WaterMarkDictPane();
removeRepeatCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_Widget_No_Repeat"));
FormWidgetValuePane formWidgetValuePane = new FormWidgetValuePane();
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
Component[][] components = new Component[][]{
new Component[]{new UILabel(Inter.getLocText("FR-Designer-Estate_Widget_Value")), formWidgetValuePane },
new Component[]{new UILabel(Inter.getLocText("FR-Designer_DS-Dictionary")), new UITextField()},
new Component[]{removeRepeatCheckBox, null},
new Component[]{new UILabel(Inter.getLocText("FR-Designer_WaterMark")), waterMarkDictPane},
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Font-Size")), fontSizePane}
};
double[] rowSize = {p, p, p, p, p, p,p};
double[] columnSize = {p, f};
int[][] rowCount = {{1, 3},{1, 1},{1, 1},{1,1},{1,1}};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 10, 7);
panel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
advancePane.add(panel, BorderLayout.NORTH);
JPanel otherPane = createOtherPane();
if(otherPane != null){
advancePane.add(otherPane, BorderLayout.CENTER);
}
return advancePane;
}
public JPanel createOtherPane(){
return null;
}
public JPanel setValidatePane(){
directWriteCheckBox = new UICheckBox(Inter.getLocText("Form-Allow_Edit"), false);
JPanel otherContentPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_S_Pane();
otherContentPane.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0));
JPanel jPanel = GUICoreUtils.createFlowPane(new JComponent[]{directWriteCheckBox}, FlowLayout.LEFT, 5);
jPanel.setPreferredSize(new Dimension(220, 30));
otherContentPane.add(jPanel);
return otherContentPane;
}
@Override
protected void populateSubFieldEditorBean(T e) {
this.directWriteCheckBox.setSelected(e.isDirectEdit());
this.waterMarkDictPane.populate(e);
removeRepeatCheckBox.setSelected(e.isChartRelated());
populateSubDirectWriteEditorBean(e);
}
protected abstract void populateSubDirectWriteEditorBean(T e);
@Override
protected T updateSubFieldEditorBean() {
T e = updateSubDirectWriteEditorBean();
e.setDirectEdit(directWriteCheckBox.isSelected());
this.waterMarkDictPane.update(e);
return e;
}
protected abstract T updateSubDirectWriteEditorBean();
}

140
designer_form/src/com/fr/design/widget/ui/designer/FieldEditorDefinePane.java

@ -0,0 +1,140 @@
package com.fr.design.widget.ui.designer;
import com.fr.base.GraphHelper;
import com.fr.design.designer.creator.*;
import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.form.ui.FieldEditor;
import com.fr.general.Inter;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
public abstract class FieldEditorDefinePane<T extends FieldEditor> extends AbstractDataModify<T> {
private static final int ALLOW_BLANK_CHECK_BOX_WIDTH = GraphHelper.getLocTextWidth("FR-Designer_Allow_Null") + 30;
private static final int ALLOW_BLANK_CHECK_BOX_HEIGHT = 30;
protected UICheckBox allowBlankCheckBox;
// richer:错误信息,是所有控件共有的属性,所以放到这里来
protected UITextField errorMsgTextField;
protected JPanel validatePane;
protected UISpinner fontSizePane;
public FieldEditorDefinePane(XCreator xCreator) {
super(xCreator);
this.initComponents();
}
public FieldEditorDefinePane() {
this.initComponents();
}
protected void initComponents() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
allowBlankCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_Allow_Null"));
allowBlankCheckBox.setBorder(BorderFactory.createEmptyBorder(5, 5, 0, 5));
allowBlankCheckBox.setPreferredSize(new Dimension(ALLOW_BLANK_CHECK_BOX_WIDTH, ALLOW_BLANK_CHECK_BOX_HEIGHT));
fontSizePane = new UISpinner(0, 20, 1, 0);
errorMsgTextField = new UITextField();
JPanel contentPane = this.setFirstContentPane();
if (contentPane != null) {
UIExpandablePane uiExpandablePane = new UIExpandablePane("高级", 280, 20, contentPane);
this.add(uiExpandablePane, BorderLayout.NORTH);
}
this.addValidatePane();
}
@Override
public void populateBean(T ob) {
this.allowBlankCheckBox.setSelected(ob.isAllowBlank());
this.errorMsgTextField.setText(ob.getErrorMessage());
this.fontSizePane.setValue(ob.getFontSize());
populateSubFieldEditorBean(ob);
}
protected abstract void populateSubFieldEditorBean(T ob);
@Override
public T updateBean() {
T e = updateSubFieldEditorBean();
e.setAllowBlank(this.allowBlankCheckBox.isSelected());
e.setErrorMessage(this.errorMsgTextField.getText());
e.setFontSize((int)fontSizePane.getValue());
return e;
}
protected abstract T updateSubFieldEditorBean();
protected abstract JPanel setFirstContentPane();
@Override
public void checkValid() throws Exception {
}
protected void addValidatePane() {
validatePane = FRGUIPaneFactory.createBorderLayout_S_Pane();
final UILabel uiLabel = new UILabel(Inter.getLocText("FR-Designer_Widget_Error_Tip"));
allowBlankCheckBox.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
boolean isSelected = allowBlankCheckBox.isSelected();
uiLabel.setVisible(!isSelected);
errorMsgTextField.setVisible(!isSelected);
if (isSelected) {
uiLabel.setPreferredSize(new Dimension(0, 0));
errorMsgTextField.setPreferredSize(new Dimension(0, 0));
} else {
uiLabel.setPreferredSize(new Dimension(66, 20));
errorMsgTextField.setPreferredSize(new Dimension(150, 20));
}
}
});
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
Component[][] components = new Component[][]{
new Component[]{allowBlankCheckBox, null},
new Component[]{uiLabel, errorMsgTextField},
};
double[] rowSize = {p, p};
double[] columnSize = {p, f};
int[][] rowCount = {{1, 1}, {1, 1}};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 7, 2);
panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
validatePane.add(panel, BorderLayout.NORTH);
JPanel contentPane = this.setValidatePane();
if (contentPane != null) {
validatePane.add(contentPane, BorderLayout.CENTER);
}
UIExpandablePane uiExpandablePane = new UIExpandablePane(Inter.getLocText("FR-Designer_Validate"), 280, 20, validatePane);
this.add(uiExpandablePane, BorderLayout.CENTER);
}
public XLayoutContainer getParent(XCreator source) {
XLayoutContainer container = XCreatorUtils.getParentXLayoutContainer(source);
if (source.acceptType(XWFitLayout.class) || source.acceptType(XWParameterLayout.class)) {
container = null;
}
return container;
}
public JPanel setValidatePane() {
return null;
}
}

83
designer_form/src/com/fr/design/widget/ui/designer/IframeEditorDefinePane.java

@ -0,0 +1,83 @@
package com.fr.design.widget.ui.designer;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.gui.frpane.ReportletParameterViewPane;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.form.ui.IframeEditor;
import com.fr.general.Inter;
import com.fr.stable.ParameterProvider;
import javax.swing.*;
import java.awt.*;
import java.util.List;
public class IframeEditorDefinePane extends AbstractDataModify<IframeEditor> {
private UITextField srcTextField;
private ReportletParameterViewPane parameterViewPane;
private UICheckBox horizontalCheck;
private UICheckBox verticalCheck;
public IframeEditorDefinePane() {
this.initComponents();
}
private void initComponents() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
JPanel contentPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane();
contentPane.setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 0));
JPanel attr = FRGUIPaneFactory.createNormalFlowInnerContainer_M_Pane();
attr.add(horizontalCheck = new UICheckBox(Inter.getLocText("Preference-Horizontal_Scroll_Bar_Visible")));
attr.add(verticalCheck = new UICheckBox(Inter.getLocText("Preference-Vertical_Scroll_Bar_Visible")));
contentPane.add(attr);
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] rowSize = { p, p, p, p };
double[] columnSize = { p, f };
Component[][] coms = {
{ horizontalCheck, null },
{ verticalCheck, null },
{ new UILabel(Inter.getLocText("Form-Url") + ":"), srcTextField = new UITextField() },
{ new UILabel(Inter.getLocText("Parameter") + ":"), parameterViewPane = new ReportletParameterViewPane() } };
int[][] rowCount = {{1, 1},{1, 1},{1, 1}, {1, 1}};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(coms, rowSize, columnSize, rowCount, LayoutConstants.VGAP_SMALL, 5);
contentPane.add(panel);
UIExpandablePane uiExpandablePane = new UIExpandablePane(Inter.getLocText("FR-Designer_Advanced"), 280, 20, contentPane);
this.add(uiExpandablePane, BorderLayout.NORTH);
}
@Override
public String title4PopupWindow() {
return "iframe";
}
@Override
public void populateBean(IframeEditor e) {
srcTextField.setText(e.getSrc());
parameterViewPane.populate(e.getParameters());
this.horizontalCheck.setSelected(e.isOverflowx());
this.verticalCheck.setSelected(e.isOverflowy());
}
@Override
public IframeEditor updateBean() {
IframeEditor ob = new IframeEditor();
ob.setSrc(srcTextField.getText());
List<ParameterProvider> parameterList = parameterViewPane.update();
ob.setParameters(parameterList.toArray(new ParameterProvider[parameterList.size()]));
ob.setOverflowx(this.horizontalCheck.isSelected());
ob.setOverflowy(this.verticalCheck.isSelected());
return ob;
}
}

79
designer_form/src/com/fr/design/widget/ui/designer/LabelDefinePane.java

@ -0,0 +1,79 @@
package com.fr.design.widget.ui.designer;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.widget.ui.designer.component.FormWidgetValuePane;
import com.fr.form.ui.Label;
import com.fr.general.Inter;
import javax.swing.*;
import java.awt.*;
/**
* Created by ibm on 2017/8/3.
*/
public class LabelDefinePane extends AbstractDataModify<Label> {
private FormWidgetValuePane formWidgetValuePane;
private UICheckBox isPageSetupVertically;
private UICheckBox isStyleAlignmentWrapText;
public LabelDefinePane(XCreator xCreator) {
super(xCreator);
initComponent();
}
public void initComponent() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
JPanel advancePane = createAdvancePane();
UIExpandablePane advanceExpandablePane = new UIExpandablePane(Inter.getLocText("FR-Designer_Advanced"), 280, 20, advancePane);
this.add(advanceExpandablePane, BorderLayout.CENTER);
}
public JPanel createAdvancePane() {
formWidgetValuePane = new FormWidgetValuePane();
isPageSetupVertically = new UICheckBox(Inter.getLocText("FR-Designer_PageSetup-Vertically"));
isStyleAlignmentWrapText = new UICheckBox(Inter.getLocText("FR-Designer_StyleAlignment-Wrap_Text"));
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
double[] rowSize = {p, p, p, p, p, p, p};
double[] columnSize = {p, f};
int[][] rowCount = {{1, 3}, {1, 1}, {1, 1}, {1, 1}, {1, 1}};
Component[][] components = new Component[][]{
new Component[]{new UILabel(Inter.getLocText("FR-Designer-Estate_Widget_Value")), formWidgetValuePane},
new Component[]{isStyleAlignmentWrapText, null},
new Component[]{isPageSetupVertically, null},
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Widget_Display_Position")), new UITextField()},
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Font-Size")), new UITextField()},
};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 20, 7);
panel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
return panel;
}
@Override
public String title4PopupWindow() {
return "label";
}
@Override
public void populateBean(Label ob) {
isStyleAlignmentWrapText.setSelected(ob.isAutoLine());
isPageSetupVertically.setSelected(ob.isVerticalCenter());
}
@Override
public Label updateBean() {
Label layout = (Label) creator.toData();
layout.setAutoLine(isStyleAlignmentWrapText.isSelected());
layout.setVerticalCenter(isPageSetupVertically.isSelected());
return layout;
}
}

60
designer_form/src/com/fr/design/widget/ui/designer/ListEditorDefinePane.java

@ -0,0 +1,60 @@
package com.fr.design.widget.ui.designer;
import com.fr.design.data.DataCreatorUI;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.present.dict.DictionaryPane;
import com.fr.form.ui.ListEditor;
import com.fr.general.Inter;
import javax.swing.*;
public class ListEditorDefinePane extends WriteUnableRepeatEditorPane<ListEditor> {
private UICheckBox needHeadCheckBox;
private DictionaryPane dictPane;
public ListEditorDefinePane() {
this.initComponents();
}
@Override
protected void initComponents() {
super.initComponents();
dictPane = new DictionaryPane();
}
@Override
protected JPanel setThirdContentPane() {
JPanel contenter = FRGUIPaneFactory.createBorderLayout_S_Pane();
JPanel centerPane = FRGUIPaneFactory.createMediumHGapFlowInnerContainer_M_Pane();
centerPane.add(needHeadCheckBox = new UICheckBox(Inter.getLocText("List-Need_Head")));
contenter.add(centerPane);
return contenter;
}
@Override
public String title4PopupWindow() {
return "List";
}
@Override
protected void populateSubWriteUnableRepeatBean(ListEditor e) {
needHeadCheckBox.setSelected(e.isNeedHead());
this.dictPane.populateBean(e.getDictionary());
}
@Override
protected ListEditor updateSubWriteUnableRepeatBean() {
ListEditor ob = new ListEditor();
ob.setNeedHead(needHeadCheckBox.isSelected());
ob.setDictionary(this.dictPane.updateBean());
return ob;
}
@Override
public DataCreatorUI dataUI() {
return dictPane;
}
}

91
designer_form/src/com/fr/design/widget/ui/designer/MultiFileEditorPane.java

@ -0,0 +1,91 @@
package com.fr.design.widget.ui.designer;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.icombobox.DictionaryComboBox;
import com.fr.design.gui.icombobox.DictionaryConstants;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UINumberField;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.form.ui.MultiFileEditor;
import com.fr.general.Inter;
import javax.swing.*;
import java.awt.*;
public class MultiFileEditorPane extends FieldEditorDefinePane<MultiFileEditor> {
private DictionaryComboBox acceptType;
private UICheckBox singleFileCheckBox;
private UINumberField fileSizeField;
private UITextField fontSizeField;
public MultiFileEditorPane(XCreator xCreator) {
super(xCreator);
}
@Override
public String title4PopupWindow() {
return "file";
}
@Override
protected JPanel setFirstContentPane() {
acceptType = new DictionaryComboBox(DictionaryConstants.acceptTypes, DictionaryConstants.fileTypeDisplays);
singleFileCheckBox = new UICheckBox(Inter.getLocText("SINGLE_FILE_UPLOAD"));
fileSizeField = new UINumberField();
fontSizeField = new UITextField();
JPanel singleFilePane = FRGUIPaneFactory.createNormalFlowInnerContainer_M_Pane();
singleFilePane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
singleFilePane.add(singleFileCheckBox);
JPanel allowTypePane = FRGUIPaneFactory.createNormalFlowInnerContainer_M_Pane();
allowTypePane.setLayout(FRGUIPaneFactory.createLabelFlowLayout());
allowTypePane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
allowTypePane.add(new UILabel(" " + Inter.getLocText("File-Allow_Upload_Files") + ":"));
allowTypePane.add(acceptType);
JPanel fileSizePane = FRGUIPaneFactory.createNormalFlowInnerContainer_M_Pane();
fileSizePane.add(new UILabel(" " + Inter.getLocText("File-File_Size_Limit") + ":"));
fileSizePane.add(fileSizeField);
fileSizePane.add(new UILabel(" KB"));
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
Component[][] components = new Component[][]{
new Component[]{singleFileCheckBox, null },
new Component[]{new UILabel(Inter.getLocText("File-Allow_Upload_Files") + ":"), acceptType},
new Component[]{new UILabel( Inter.getLocText("File-File_Size_Limit") + ":"), fileSizeField},
new Component[]{new UILabel( Inter.getLocText("FR-Designer_Font-Size")), fontSizeField}
};
double[] rowSize = {p, p,p,p};
double[] columnSize = {p,f};
int[][] rowCount = {{1, 1},{1, 1},{1, 1},{1, 1}};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 10, 7);
panel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
return panel;
}
@Override
protected void populateSubFieldEditorBean(MultiFileEditor e) {
// 这里存在兼容问题 getAccept可能没在待选项目中
acceptType.setSelectedItem(e.getAccept());
singleFileCheckBox.setSelected(e.isSingleFile());
fileSizeField.setValue(e.getMaxSize());
}
@Override
protected MultiFileEditor updateSubFieldEditorBean() {
MultiFileEditor ob = new MultiFileEditor();
ob.setAccept((String) acceptType.getSelectedItem());
ob.setSingleFile(singleFileCheckBox.isSelected());
ob.setMaxSize(fileSizeField.getValue());
return ob;
}
}

25
designer_form/src/com/fr/design/widget/ui/designer/NoneWidgetDefinePane.java

@ -0,0 +1,25 @@
package com.fr.design.widget.ui.designer;
import com.fr.form.ui.NoneWidget;
/**
*
* @author Administrator
* 用于处理没有控件的情况
*/
public class NoneWidgetDefinePane extends AbstractDataModify<NoneWidget> {
@Override
public String title4PopupWindow() {
return "none";
}
@Override
public void populateBean(NoneWidget w) {
}
@Override
public NoneWidget updateBean() {
return new NoneWidget();
}
}

313
designer_form/src/com/fr/design/widget/ui/designer/NumberEditorDefinePane.java

@ -0,0 +1,313 @@
package com.fr.design.widget.ui.designer;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UIBasicSpinner;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.widget.ui.designer.component.FormWidgetValuePane;
import com.fr.form.ui.NumberEditor;
import com.fr.general.Inter;
import javax.swing.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.text.DefaultFormatter;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class NumberEditorDefinePane extends FieldEditorDefinePane<NumberEditor> {
public NumberEditorDefinePane(XCreator xCreator){
super(xCreator);
}
/**
*
*/
private static final long serialVersionUID = 8011242951911686805L;
private UICheckBox allowDecimalsCheckBox;
private UICheckBox allowNegativeCheckBox;
private UICheckBox setMaxValueCheckBox;
private UICheckBox setMinValueCheckBox;
private UIBasicSpinner maxValueSpinner;
private SpinnerNumberModel maxValueModel;
private UIBasicSpinner minValueSpinner;
private SpinnerNumberModel minValueModel;
private com.fr.design.editor.editor.IntegerEditor decimalLength;
private JPanel limitNumberPane;
private WaterMarkDictPane waterMarkDictPane;
private ActionListener actionListener1 = new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (allowDecimalsCheckBox.isSelected()) {
limitNumberPane.setVisible(true);
} else {
limitNumberPane.setVisible(false);
}
}
};
private ActionListener actionListener2 = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (allowNegativeCheckBox.isSelected()) {
minValueModel.setMinimum(-Double.MAX_VALUE);
if (!setMinValueCheckBox.isSelected()) {
maxValueModel.setMinimum(-Double.MAX_VALUE);
}
} else {
minValueModel.setMinimum(0.0);
if (!setMinValueCheckBox.isSelected()) {
maxValueModel.setMinimum(0.0);
}
Double minValue = Double.parseDouble("" + minValueSpinner.getValue());
Double maxValue = Double.parseDouble("" + maxValueSpinner.getValue());
if (minValue < 0.0) {
minValueSpinner.setValue(0.0);
}
if (maxValue < 0.0) {
maxValueSpinner.setValue(0.0);
}
}
}
};
private ActionListener actionListener3 = new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (setMaxValueCheckBox.isSelected()) {
maxValueSpinner.setEnabled(true);
Double value = new Double(0);
if (setMinValueCheckBox.isSelected()) {
Double minValue = Double.parseDouble("" + minValueSpinner.getValue());
if (minValue > value) {
value = minValue;
}
}
maxValueSpinner.setValue(value);
} else {
maxValueSpinner.setEnabled(false);
minValueModel.setMaximum(Double.MAX_VALUE);
}
}
};
private ActionListener actionListener4 = new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (setMinValueCheckBox.isSelected()) {
minValueSpinner.setEnabled(true);
Double value = new Double(0);
if (setMaxValueCheckBox.isSelected()) {
Double maxValue = Double.parseDouble("" + maxValueSpinner.getValue());
if (maxValue < value) {
value = maxValue;
}
}
minValueSpinner.setValue(value);
} else {
minValueSpinner.setEnabled(false);
maxValueModel.setMinimum(allowNegativeCheckBox.isSelected() ? (-Double.MAX_VALUE) : new Double(0));
}
}
};
private ChangeListener changeListener1 = new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
if (setMaxValueCheckBox.isSelected()) {
if (setMinValueCheckBox.isSelected()) {
minValueModel.setMaximum(Double.parseDouble("" + maxValueSpinner.getValue()));
}
}
}
};
private ChangeListener changeListener2 = new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
if (setMinValueCheckBox.isSelected()) {
if (setMaxValueCheckBox.isSelected()) {
maxValueModel.setMinimum(Double.parseDouble("" + minValueSpinner.getValue()));
}
}
}
};
public NumberEditorDefinePane() {
super();
}
@Override
public String title4PopupWindow() {
return "number";
}
@Override
protected JPanel setFirstContentPane() {
// richer:数字的允许直接编辑没有意义
waterMarkDictPane = new WaterMarkDictPane();
FormWidgetValuePane formWidgetValuePane = new FormWidgetValuePane();
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
Component[][] components = new Component[][]{
new Component[]{new UILabel("控件值"), formWidgetValuePane},
new Component[]{new UILabel("水印"), waterMarkDictPane},
new Component[]{new UILabel("字体大小"), new UITextField()}
};
double[] rowSize = {p, p, p, p, p};
double[] columnSize = {p,f};
int[][] rowCount = {{1, 3},{1, 1},{1, 1}};
JPanel advancePane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 10, 7);
advancePane.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
return advancePane;
}
public JPanel setValidatePane() {
// super.addValidatePane();
this.allowDecimalsCheckBox = new UICheckBox(Inter.getLocText("Allow_Decimals"));
this.decimalLength = new com.fr.design.editor.editor.IntegerEditor();
this.decimalLength.setColumns(4);
this.allowDecimalsCheckBox.addActionListener(actionListener1);
this.allowNegativeCheckBox = new UICheckBox(Inter.getLocText("Allow_Negative"));
this.allowNegativeCheckBox.addActionListener(actionListener2);
this.setMaxValueCheckBox = new UICheckBox(Inter.getLocText("Need_Max_Value"), false);
this.maxValueSpinner = new UIBasicSpinner(maxValueModel = new SpinnerNumberModel(0D, -Double.MAX_VALUE, Double.MAX_VALUE, 1D));
maxValueSpinner.setPreferredSize(new Dimension(120, 20));
setNotAllowsInvalid(this.maxValueSpinner);
this.setMaxValueCheckBox.addActionListener(actionListener3);
this.maxValueSpinner.addChangeListener(changeListener1);
this.setMinValueCheckBox = new UICheckBox(Inter.getLocText("Need_Min_Value"), false);
this.minValueSpinner = new UIBasicSpinner(minValueModel = new SpinnerNumberModel(0D, -Double.MAX_VALUE, Double.MAX_VALUE, 1D));
minValueSpinner.setPreferredSize(new Dimension(120, 20));
setNotAllowsInvalid(this.minValueSpinner);
this.setMinValueCheckBox.addActionListener(actionListener4);
this.minValueSpinner.addChangeListener(changeListener2);
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
Component[][] components = new Component[][]{
new Component[]{allowDecimalsCheckBox, null },
new Component[]{new UILabel(Inter.getLocText(new String[]{"Double", "Numbers"})), decimalLength },
new Component[]{allowNegativeCheckBox, null},
new Component[]{setMaxValueCheckBox, maxValueSpinner},
new Component[]{setMinValueCheckBox, minValueSpinner},
};
double[] rowSize = {p, p, p, p, p};
double[] columnSize = {p,f};
int[][] rowCount = {{1, 1},{1, 1},{1, 1},{1, 1},{1, 1}};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 10, 3);
return panel;
}
@Override
protected void populateSubFieldEditorBean(NumberEditor e) {
allowDecimalsCheckBox.setSelected(e.isAllowDecimals());
if (e.isAllowDecimals()) {
this.decimalLength.setValue(e.getMaxDecimalLength());
} else {
this.limitNumberPane.setVisible(false);
}
allowNegativeCheckBox.setSelected(e.isAllowNegative());
if (e.getMaxValue() == Double.MAX_VALUE) {
setMaxValueCheckBox.setSelected(false);
maxValueSpinner.setValue(new Double(Double.MAX_VALUE));
maxValueSpinner.setEnabled(false);
} else {
setMaxValueCheckBox.setSelected(true);
maxValueSpinner.setEnabled(true);
maxValueSpinner.setValue(new Double(e.getMaxValue()));
}
if (e.getMinValue() == -Double.MAX_VALUE) {
setMinValueCheckBox.setSelected(false);
minValueSpinner.setValue(new Double(-Double.MAX_VALUE));
minValueSpinner.setEnabled(false);
} else {
setMinValueCheckBox.setSelected(true);
minValueSpinner.setEnabled(true);
minValueSpinner.setValue(new Double(e.getMinValue()));
}
// this.regErrorMsgTextField.setText(e.getRegErrorMessage());
this.waterMarkDictPane.populate(e);
}
@Override
protected NumberEditor updateSubFieldEditorBean() {
NumberEditor ob = new NumberEditor();
ob.setAllowDecimals(allowDecimalsCheckBox.isSelected());
if (allowDecimalsCheckBox.isSelected()) {
ob.setMaxDecimalLength(this.decimalLength.getValue());
}
ob.setAllowNegative(allowNegativeCheckBox.isSelected());
if (setMaxValueCheckBox.isSelected()) {
ob.setMaxValue(Double.parseDouble("" + maxValueSpinner.getValue()));
} else {
ob.setMaxValue(Double.MAX_VALUE);
}
if (setMinValueCheckBox.isSelected()) {
ob.setMinValue(Double.parseDouble("" + minValueSpinner.getValue()));
} else {
ob.setMinValue(-Double.MAX_VALUE);
}
this.waterMarkDictPane.update(ob);
// ob.setRegErrorMessage(this.regErrorMsgTextField.getText());
return ob;
}
private void checkVisible() {
if (setMinValueCheckBox.isSelected()) {
minValueSpinner.setEnabled(true);
} else {
minValueSpinner.setEnabled(false);
}
if (setMinValueCheckBox.isSelected()) {
minValueSpinner.setEnabled(true);
} else {
minValueSpinner.setEnabled(false);
}
}
private void setNotAllowsInvalid(UIBasicSpinner jspinner) {
JComponent editor = jspinner.getEditor();
if (editor instanceof UIBasicSpinner.DefaultEditor) {
JFormattedTextField ftf = ((UIBasicSpinner.DefaultEditor) editor).getTextField();
ftf.setColumns(10);
JFormattedTextField.AbstractFormatter formatter = ftf.getFormatter();
DefaultFormatter df = (DefaultFormatter) formatter;
df.setAllowsInvalid(false);
}
}
}

179
designer_form/src/com/fr/design/widget/ui/designer/ParameterTreeComboBox.java

@ -0,0 +1,179 @@
package com.fr.design.widget.ui.designer;
import com.fr.base.BaseUtils;
import com.fr.base.ConfigManager;
import com.fr.base.Parameter;
import com.fr.base.TableData;
import com.fr.design.DesignModelAdapter;
import com.fr.design.gui.icombobox.FRTreeComboBox;
import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode;
import com.fr.design.parameter.ParameterGroup;
import com.fr.file.DatasourceManager;
import com.fr.file.DatasourceManagerProvider;
import com.fr.general.ComparatorUtils;
import com.fr.general.Inter;
import com.fr.script.Calculator;
import com.fr.stable.ArrayUtils;
import com.fr.stable.ParameterProvider;
import javax.swing.*;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeCellRenderer;
import javax.swing.tree.DefaultTreeModel;
import javax.swing.tree.TreePath;
import java.awt.*;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
/**
* 控件设置面板的控件名下拉框里面是所有参数的名字
*
* @author zhou
*
*/
public class ParameterTreeComboBox extends FRTreeComboBox {
public ParameterTreeComboBox() {
super(new JTree(), new DefaultTreeCellRenderer() {
@Override
public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus) {
super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);
if (value instanceof DefaultMutableTreeNode) {
DefaultMutableTreeNode node = (DefaultMutableTreeNode)value;
Object userObj = node.getUserObject();
if (userObj instanceof String) {
this.setIcon(BaseUtils.readIcon("com/fr/design/images/m_insert/expandCell.gif"));
} else if (userObj instanceof Parameter) {
Parameter parameter = (Parameter)userObj;
this.setText(parameter.getName());
}
}
return this;
}
});
this.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
if (e.getStateChange() == ItemEvent.SELECTED) {
if (e.getItem() instanceof TreePath) {
DefaultMutableTreeNode node = (DefaultMutableTreeNode)((TreePath)e.getItem()).getLastPathComponent();
if (node.getUserObject() instanceof Parameter) {
ParameterTreeComboBox.this.getEditor().setItem(((Parameter)node.getUserObject()).getName());
} else {
ParameterTreeComboBox.this.getEditor().setItem(null);
}
}
}
}
});
this.setEditable(true);
}
public String getSelectedParameterName() {
Object obj = this.getSelectedItem();
if (obj instanceof TreePath) {
return ((Parameter)((ExpandMutableTreeNode)((TreePath)obj).getLastPathComponent()).getUserObject()).getName();
}
return (String)obj;
}
@Override
public void setSelectedItem(Object o) {
if (o instanceof String) {
this.setSelectedItemString((String)o);
return;
}
this.tree.setSelectionPath((TreePath)o);
this.getModel().setSelectedItem(o);
}
public void setSelectedParameterName(String name) {
DefaultTreeModel treeModel = (DefaultTreeModel)tree.getModel();
DefaultMutableTreeNode rootTreeNode = (DefaultMutableTreeNode)tree.getModel().getRoot();
DefaultMutableTreeNode leaf = rootTreeNode.getFirstLeaf();
do {
if (leaf.getUserObject() instanceof Parameter) {
if (ComparatorUtils.equals(((Parameter) leaf.getUserObject()).getName(), name)) {
TreePath visiblePath = new TreePath(treeModel.getPathToRoot(leaf));
tree.setSelectionPath(visiblePath);
this.setSelectedItem(visiblePath);
break;
}
}
} while ((leaf = leaf.getNextLeaf()) != null);
if (this.getSelectedItem() == null) {
((ComboBoxModel)treeModel).setSelectedItem(name);
}
}
/**
* 刷新目录树
*/
public void refreshTree() {
DefaultMutableTreeNode rootTreeNode = (DefaultMutableTreeNode)tree.getModel().getRoot();
rootTreeNode.removeAllChildren();
addParameterTreeNode(rootTreeNode);
DefaultTreeModel treeModel = (DefaultTreeModel)tree.getModel();
if (treeModel != null) {
treeModel.reload();
}
}
private void addParameterTreeNode(DefaultMutableTreeNode rootTreeNode) {
ParameterGroup[] groups = getParameterGroup();
for (ParameterGroup group : groups) {
ExpandMutableTreeNode paraTreeNode = new ExpandMutableTreeNode(group.getGroupName());
rootTreeNode.add(paraTreeNode);
for (Parameter parameter : group.getParameter()) {
if (parameter != null) {
ExpandMutableTreeNode childTreeNode = new ExpandMutableTreeNode(parameter);
paraTreeNode.add(childTreeNode);
}
}
}
}
private ParameterGroup[] getParameterGroup() {
List<ParameterGroup> groupList = new ArrayList<ParameterGroup>();
Parameter[] parameters;
DesignModelAdapter<?,?> model = DesignModelAdapter.getCurrentModelAdapter();
if (model != null) {
// 报表参数
parameters = model.getReportParameters();
if (!ArrayUtils.isEmpty(parameters)) {
groupList.add(new ParameterGroup(Inter.getLocText("ParameterD-Report_Parameter"), parameters));
}
// 数据源参数
parameters = model.getTableDataParameters();
if (!ArrayUtils.isEmpty(parameters)) {
groupList.add(new ParameterGroup(Inter.getLocText("FR-Designer_Datasource-Parameter"), parameters));
}
}
// 全局参数
parameters = ConfigManager.getProviderInstance().getGlobal_Parameters();
if (!ArrayUtils.isEmpty(parameters)) {
groupList.add(new ParameterGroup(Inter.getLocText("M_Server-Global_Parameters"), parameters));
}
// 全局数据源参数
parameters = new Parameter[0];
Calculator c = Calculator.createCalculator();
DatasourceManagerProvider datasourceManager = DatasourceManager.getProviderInstance();
Iterator<String> nameIt = datasourceManager.getTableDataNameIterator();
while (nameIt.hasNext()) {
TableData tableData = datasourceManager.getTableData(nameIt.next());
ParameterProvider[] ps = tableData.getParameters(c);
if (!ArrayUtils.isEmpty(ps)) {
parameters = (Parameter[])ArrayUtils.addAll(parameters, ps);
}
}
if (!ArrayUtils.isEmpty(parameters)) {
groupList.add(new ParameterGroup(Inter.getLocText(new String[]{"Server", "Datasource-Datasource", "Parameter"}), parameters));
}
return groupList.toArray(new ParameterGroup[0]);
}
}

23
designer_form/src/com/fr/design/widget/ui/designer/PasswordDefinePane.java

@ -0,0 +1,23 @@
package com.fr.design.widget.ui.designer;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.gui.frpane.RegPane;
import com.fr.form.ui.Password;
import com.fr.form.ui.TextEditor;
public class PasswordDefinePane extends TextFieldEditorDefinePane {
public PasswordDefinePane(XCreator xCreator) {
super(xCreator);
}
private static final long serialVersionUID = 4737910705071750562L;
@Override
protected TextEditor newTextEditorInstance() {
return new Password();
}
protected RegPane createRegPane() {
return new RegPane(RegPane.PASSWORD_REG_TYPE);
}
}

44
designer_form/src/com/fr/design/widget/ui/designer/RadioDefinePane.java

@ -0,0 +1,44 @@
package com.fr.design.widget.ui.designer;
import com.fr.base.FRContext;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.form.ui.Radio;
import com.fr.general.FRFont;
import com.fr.general.Inter;
import javax.swing.*;
import java.awt.*;
public class RadioDefinePane extends AbstractDataModify<Radio> {
public RadioDefinePane() {
this.iniComoponents();
}
private void iniComoponents() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
UILabel infoLabel = new UILabel();
FRFont frFont = FRContext.getDefaultValues().getFRFont();
infoLabel.setFont(new Font(frFont.getFamily(), Font.BOLD, 24));
infoLabel.setText(Inter.getLocText(
"No_Editor_Property_Definition") + ".");
infoLabel.setHorizontalAlignment(SwingConstants.CENTER);
this.add(infoLabel, BorderLayout.CENTER);
}
@Override
public String title4PopupWindow() {
return "radio";
}
@Override
public void populateBean(Radio cellWidget) {
}
@Override
public Radio updateBean() {
return new Radio();
}
}

48
designer_form/src/com/fr/design/widget/ui/designer/RadioGroupDefinePane.java

@ -0,0 +1,48 @@
package com.fr.design.widget.ui.designer;
import com.fr.design.data.DataCreatorUI;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.present.dict.DictionaryPane;
import com.fr.design.widget.ui.designer.btn.ButtonGroupDefinePane;
import com.fr.form.ui.RadioGroup;
public class RadioGroupDefinePane extends ButtonGroupDefinePane<RadioGroup> {
private DictionaryPane dictPane;
public RadioGroupDefinePane(XCreator xCreator) {
super(xCreator);
}
@Override
protected void initComponents() {
super.initComponents();
dictPane = new DictionaryPane();
}
@Override
protected RadioGroup updateSubButtonGroupBean() {
RadioGroup ob = (RadioGroup)creator.toData();
ob.setDictionary(this.dictPane.updateBean());
return ob;
}
@Override
public String title4PopupWindow() {
return "radiogroup";
}
@Override
protected void populateSubButtonGroupBean(RadioGroup ob) {
this.dictPane.populateBean(ob.getDictionary());
}
@Override
public DataCreatorUI dataUI() {
return dictPane;
}
}

21
designer_form/src/com/fr/design/widget/ui/designer/TextAreaDefinePane.java

@ -0,0 +1,21 @@
package com.fr.design.widget.ui.designer;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.gui.frpane.RegPane;
import com.fr.form.ui.TextArea;
import com.fr.form.ui.TextEditor;
public class TextAreaDefinePane extends TextFieldEditorDefinePane {
public TextAreaDefinePane(XCreator xCreator) {
super(xCreator);
}
@Override
protected TextEditor newTextEditorInstance() {
return new TextArea();
}
protected RegPane createRegPane() {
return new RegPane(RegPane.TEXTAREA_REG_TYPE);
}
}

128
designer_form/src/com/fr/design/widget/ui/designer/TextFieldEditorDefinePane.java

@ -0,0 +1,128 @@
package com.fr.design.widget.ui.designer;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.gui.frpane.RegPane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.widget.ui.designer.component.FormWidgetValuePane;
import com.fr.form.ui.TextEditor;
import com.fr.form.ui.reg.RegExp;
import com.fr.general.Inter;
import com.fr.stable.StringUtils;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
public class TextFieldEditorDefinePane extends FieldEditorDefinePane<TextEditor> {
protected RegPane regPane;
private UITextField waterMarkDictPane;
FormWidgetValuePane formWidgetValuePane;
public TextFieldEditorDefinePane(XCreator xCreator) {
super(xCreator);
}
public TextFieldEditorDefinePane() {
super();
}
@Override
protected JPanel setFirstContentPane() {
// fontSizePane = new UISpinner(0,20,1);
regPane = createRegPane();
final RegPane.RegChangeListener rl = new RegPane.RegChangeListener() {
@Override
public void regChangeAction() {
waterMarkDictPane.setText("");
regPane.removeRegChangeListener(this);
}
};
final RegPane.PhoneRegListener pl = new RegPane.PhoneRegListener() {
public void phoneRegChangeAction(RegPane.PhoneRegEvent e) {
if (StringUtils.isNotEmpty(e.getPhoneRegString())
&& StringUtils.isEmpty(waterMarkDictPane.getText())) {
waterMarkDictPane.setText(Inter.getLocText("Example") + ":" + e.getPhoneRegString());
regPane.addRegChangeListener(rl);
}
}
};
regPane.addPhoneRegListener(pl);
waterMarkDictPane = new UITextField(13);
waterMarkDictPane.addKeyListener(new KeyAdapter() {
public void keyTyped(KeyEvent e) {
regPane.removePhoneRegListener(pl);
regPane.removeRegChangeListener(rl);
waterMarkDictPane.removeKeyListener(this);
}
});
//监听填写规则下拉框的值的变化
// regPane.getRegComboBox().addActionListener(new ActionListener() {
// public void actionPerformed(ActionEvent e) {
// RegExp regExp = (RegExp) regPane.getRegComboBox().getSelectedItem();
//// regErrorMsgTextField.setEnabled(regExp.errorMessageEditable());
//
// }
// });
formWidgetValuePane = new FormWidgetValuePane();
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
Component[][] components = new Component[][]{
new Component[]{new UILabel(Inter.getLocText("FR-Designer-Estate_Widget_Value"), SwingConstants.LEFT), formWidgetValuePane},
new Component[]{new UILabel(Inter.getLocText("FR-Designer_WaterMark"), SwingConstants.LEFT), waterMarkDictPane},
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Font-Size"), SwingConstants.LEFT), fontSizePane}
};
double[] rowSize = {p, p, p, p, p};
double[] columnSize = {p,f};
int[][] rowCount = {{1, 3},{1, 1},{1, 1}};
final JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 10, 7);
panel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
return panel;
}
public JPanel setValidatePane(){
return regPane;
}
protected RegPane createRegPane() {
return new RegPane();
}
@Override
public String title4PopupWindow() {
return "text";
}
@Override
protected void populateSubFieldEditorBean(TextEditor e) {
this.regPane.populate(e.getRegex());
// regErrorMsgTextField.setText(e.getRegErrorMessage());
waterMarkDictPane.setText(e.getWaterMark());
}
@Override
protected TextEditor updateSubFieldEditorBean() {
TextEditor ob = newTextEditorInstance();
// ob.setRegErrorMessage(this.regErrorMsgTextField.getText());
ob.setRegex(this.regPane.update());
ob.setWaterMark(waterMarkDictPane.getText());
formWidgetValuePane.update(ob);
// ob.setFontSize((int)fontSizePane.getValue());
return ob;
}
protected TextEditor newTextEditorInstance() {
return new TextEditor();
}
}

78
designer_form/src/com/fr/design/widget/ui/designer/TreeComboBoxEditorDefinePane.java

@ -0,0 +1,78 @@
package com.fr.design.widget.ui.designer;
import com.fr.design.data.DataCreatorUI;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.gui.frpane.TreeSettingPane;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.itree.refreshabletree.TreeRootPane;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.form.ui.TreeComboBoxEditor;
import com.fr.form.ui.TreeEditor;
import com.fr.general.Inter;
import javax.swing.*;
import java.awt.*;
public class TreeComboBoxEditorDefinePane extends CustomWritableRepeatEditorPane<TreeEditor> {
protected TreeSettingPane treeSettingPane;
protected TreeRootPane treeRootPane;
public TreeComboBoxEditorDefinePane(XCreator xCreator) {
super(xCreator);
}
@Override
protected JPanel setForthContentPane() {
JPanel content = FRGUIPaneFactory.createBorderLayout_L_Pane();
content.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
treeRootPane = new TreeRootPane();
content.add(treeRootPane, BorderLayout.NORTH);
treeSettingPane = new TreeSettingPane(true);
return content;
}
public JPanel createOtherPane(){
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
Component[][] components = new Component[][]{
new Component[]{new UICheckBox(Inter.getLocText("Tree-Mutiple_Selection_Or_Not"))},
new Component[]{new UICheckBox(Inter.getLocText("Widget-Load_By_Async"))},
new Component[]{new UICheckBox(Inter.getLocText("FR-Designer_Widget_Return_Leaf"))},
new Component[]{new UICheckBox(Inter.getLocText("FR-Designer_Widget_Return_Path"))}
};
double[] rowSize = {p, p,p,p};
double[] columnSize = {p};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 10, 7);
panel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
return panel;
}
@Override
public String title4PopupWindow() {
return "treecombobox";
}
@Override
protected void populateSubCustomWritableRepeatEditorBean(TreeEditor e) {
// treeSettingPane.populate(e);
// treeRootPane.populate(e.getTreeAttr());
}
@Override
protected TreeComboBoxEditor updateSubCustomWritableRepeatEditorBean() {
TreeComboBoxEditor editor = (TreeComboBoxEditor)creator.toData();
editor.setTreeAttr(treeRootPane.update());
return editor;
}
@Override
public DataCreatorUI dataUI() {
return treeSettingPane;
}
}

104
designer_form/src/com/fr/design/widget/ui/designer/TreeEditorDefinePane.java

@ -0,0 +1,104 @@
package com.fr.design.widget.ui.designer;
import com.fr.design.data.DataCreatorUI;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.gui.frpane.TreeSettingPane;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.gui.itree.refreshabletree.TreeRootPane;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.widget.ui.designer.component.FormWidgetValuePane;
import com.fr.form.ui.TreeEditor;
import com.fr.general.Inter;
import javax.swing.*;
import java.awt.*;
/*
* richer:tree editor
*/
public class TreeEditorDefinePane extends FieldEditorDefinePane<TreeEditor> {
protected TreeSettingPane treeSettingPane;
protected TreeRootPane treeRootPane;
private FormWidgetValuePane formWidgetValuePane;
private UICheckBox removeRepeatCheckBox;
public TreeEditorDefinePane(XCreator xCreator){
super(xCreator);
}
@Override
protected void populateSubFieldEditorBean(TreeEditor e) {
this.treeSettingPane.populate(e);
treeRootPane.populate(e.getTreeAttr());
if (this.removeRepeatCheckBox != null) {
this.removeRepeatCheckBox.setSelected(e.isRemoveRepeat());
}
}
@Override
protected TreeEditor updateSubFieldEditorBean() {
TreeEditor editor = treeSettingPane.updateTreeEditor();
editor.setTreeAttr(treeRootPane.update());
if (this.removeRepeatCheckBox != null) {
editor.setRemoveRepeat(this.removeRepeatCheckBox.isSelected());
}
return editor;
}
@Override
protected JPanel setFirstContentPane() {
JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane();
treeRootPane = new TreeRootPane();
treeSettingPane = new TreeSettingPane(true);
formWidgetValuePane = new FormWidgetValuePane();
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
Component[][] components = new Component[][]{
new Component[]{new UILabel(Inter.getLocText("FR-Designer-Estate_Widget_Value")), formWidgetValuePane },
new Component[]{new UILabel(Inter.getLocText("FR-Designer_DS-Dictionary")), new UITextField()},
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Font-Size")), fontSizePane}
};
double[] rowSize = {p, p,p};
double[] columnSize = {p,f};
int[][] rowCount = {{1, 1},{1, 1},{1, 1}};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 10, 7);
panel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
jPanel.add(panel, BorderLayout.NORTH);
JPanel otherContentPane = this.createOtherPane();
jPanel.add(otherContentPane,BorderLayout.CENTER);
return jPanel;
}
public JPanel createOtherPane(){
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
Component[][] components = new Component[][]{
new Component[]{new UICheckBox(Inter.getLocText("Tree-Mutiple_Selection_Or_Not"))},
new Component[]{new UICheckBox(Inter.getLocText("Widget-Load_By_Async"))},
new Component[]{new UICheckBox(Inter.getLocText("FR-Designer_Widget_Return_Leaf"))},
new Component[]{new UICheckBox(Inter.getLocText("FR-Designer_Widget_Return_Path"))}
};
double[] rowSize = {p, p,p,p};
double[] columnSize = {p};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 10, 7);
panel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
return panel;
}
@Override
public String title4PopupWindow() {
return "tree";
}
@Override
public DataCreatorUI dataUI() {
return treeSettingPane;
}
}

46
designer_form/src/com/fr/design/widget/ui/designer/UserEditorDefinePane.java

@ -0,0 +1,46 @@
package com.fr.design.widget.ui.designer;
import com.fr.base.FRContext;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.form.ui.NameWidget;
import com.fr.general.FRFont;
import com.fr.general.Inter;
import javax.swing.*;
import java.awt.*;
public class UserEditorDefinePane extends AbstractDataModify<NameWidget> {
private NameWidget nWidget;
public UserEditorDefinePane() {
this.initComponents();
}
private void initComponents() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
UILabel infoLabel = new UILabel();
FRFont frFont = FRContext.getDefaultValues().getFRFont();
infoLabel.setFont(new Font(frFont.getFamily(), Font.BOLD, 24));
infoLabel.setText(Inter.getLocText(
"Widget-User_Defined_Editor") + ".");
infoLabel.setHorizontalAlignment(SwingConstants.CENTER);
this.add(infoLabel, BorderLayout.CENTER);
}
@Override
public String title4PopupWindow() {
return "name";
}
@Override
public void populateBean(NameWidget cellWidget) {
nWidget = cellWidget;
}
@Override
public NameWidget updateBean() {
return nWidget;
}
}

29
designer_form/src/com/fr/design/widget/ui/designer/WaterMarkDictPane.java

@ -0,0 +1,29 @@
package com.fr.design.widget.ui.designer;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.form.ui.WaterMark;
import javax.swing.*;
public class WaterMarkDictPane extends JPanel{
private UITextField waterMarkTextField;
public WaterMarkDictPane() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.setBorder(BorderFactory.createEmptyBorder(0,0,0,0));
waterMarkTextField = new UITextField();
this.add(waterMarkTextField);
}
public void populate(WaterMark waterMark) {
this.waterMarkTextField.setText(waterMark.getWaterMark());
}
public void update(WaterMark waterMark) {
waterMark.setWaterMark(this.waterMarkTextField.getText());
}
}

26
designer_form/src/com/fr/design/widget/ui/designer/WritableRepeatEditorPane.java

@ -0,0 +1,26 @@
package com.fr.design.widget.ui.designer;
import com.fr.design.designer.creator.XCreator;
import com.fr.form.ui.WriteAbleRepeatEditor;
public abstract class WritableRepeatEditorPane<E extends WriteAbleRepeatEditor> extends DirectWriteEditorDefinePane<E> {
public WritableRepeatEditorPane(XCreator xCreator) {
super(xCreator);
}
@Override
protected void populateSubDirectWriteEditorBean(E e) {
populateSubWritableRepeatEditorBean(e);
}
protected abstract void populateSubWritableRepeatEditorBean(E e);
@Override
protected E updateSubDirectWriteEditorBean() {
return updateSubWritableRepeatEditorBean();
}
protected abstract E updateSubWritableRepeatEditorBean();
}

51
designer_form/src/com/fr/design/widget/ui/designer/WriteUnableRepeatEditorPane.java

@ -0,0 +1,51 @@
package com.fr.design.widget.ui.designer;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.form.ui.WriteUnableRepeatEditor;
import com.fr.general.Inter;
import javax.swing.*;
import java.awt.*;
public abstract class WriteUnableRepeatEditorPane<E extends WriteUnableRepeatEditor> extends FieldEditorDefinePane<WriteUnableRepeatEditor> {
// richer:是否去除重复的值
protected UICheckBox removeRepeatCheckBox;
public WriteUnableRepeatEditorPane(){
this.initComponents();
}
@Override
protected JPanel setFirstContentPane() {
JPanel contentPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane();
contentPane.setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 0));
JPanel contenter=FRGUIPaneFactory.createMediumHGapFlowInnerContainer_M_Pane();
removeRepeatCheckBox = new UICheckBox(Inter.getLocText("Form-Remove_Repeat_Data"), false);
contentPane.add(contenter);
contenter.add(removeRepeatCheckBox);
JPanel otherContentPane = this.setThirdContentPane();
if (otherContentPane != null)
contentPane.add(otherContentPane,BorderLayout.CENTER);
return contentPane;
}
protected abstract JPanel setThirdContentPane();
@Override
protected void populateSubFieldEditorBean(WriteUnableRepeatEditor e) {
removeRepeatCheckBox.setSelected(e.isRemoveRepeat());
populateSubWriteUnableRepeatBean((E)e);
}
protected abstract void populateSubWriteUnableRepeatBean(E e);
@Override
protected WriteUnableRepeatEditor updateSubFieldEditorBean() {
WriteUnableRepeatEditor ob = updateSubWriteUnableRepeatBean();
ob.setRemoveRepeat(removeRepeatCheckBox.isSelected());
return ob;
}
protected abstract E updateSubWriteUnableRepeatBean();
}

64
designer_form/src/com/fr/design/widget/ui/designer/btn/ButtonDetailPaneFactory.java

@ -0,0 +1,64 @@
package com.fr.design.widget.ui.designer.btn;
import com.fr.base.FRContext;
import com.fr.design.module.DesignModuleFactory;
import com.fr.design.widget.btn.ButtonDetailPane;
import com.fr.form.ui.Button;
import com.fr.form.ui.FreeButton;
import com.fr.form.ui.Widget;
import com.fr.stable.bridge.BridgeMark;
import com.fr.stable.bridge.StableFactory;
import java.util.HashMap;
import java.util.Map;
/**
* Created by IntelliJ IDEA.
* Author : Richer
* Version: 6.5.6
* Date : 11-11-15
* Time : 下午6:29
*/
public class ButtonDetailPaneFactory {
private static Map<String, Class> detailMap = new HashMap<String, Class>();
static {
detailMap.put(Button.class.getName(), DefaultButtonDetailPane.class);
detailMap.put(FreeButton.class.getName(), FreeButtonDetailPane.class);
if (StableFactory.getMarkedClass(BridgeMark.SUBMIT_BUTTON, Widget.class) != null) {
detailMap.put(StableFactory.getMarkedClass(BridgeMark.SUBMIT_BUTTON, Widget.class).getName(), DesignModuleFactory.getButtonDetailPaneClass());
}
}
public static ButtonDetailPane<Button> createButtonDetailPane(Button button) {
Class cls = detailMap.get(button.getClass().getName());
ButtonDetailPane<Button> detailPane = null;
if (cls != null) {
try {
detailPane = (ButtonDetailPane) cls.newInstance();
detailPane.populate(button);
} catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e);
}
}
return detailPane;
}
public static ButtonDetailPane<Button> createButtonDetailPane(Class cls, Button button) {
if (cls == null) {
return createButtonDetailPane(button);
}
Class aa = detailMap.get(cls.getName());
ButtonDetailPane<Button> detailPane = null;
if (aa != null) {
try {
detailPane = (ButtonDetailPane) aa.newInstance();
detailPane.populate(button == null ? detailPane.createButton() : button);
} catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e);
}
}
return detailPane;
}
}

93
designer_form/src/com/fr/design/widget/ui/designer/btn/ButtonGroupDefinePane.java

@ -0,0 +1,93 @@
package com.fr.design.widget.ui.designer.btn;
import com.fr.design.designer.creator.*;
import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.widget.ui.designer.AbstractDataModify;
import com.fr.design.widget.ui.designer.ButtonGroupDictPane;
import com.fr.design.widget.ui.designer.FieldEditorDefinePane;
import com.fr.design.widget.ui.designer.WaterMarkDictPane;
import com.fr.design.widget.ui.designer.component.FormWidgetValuePane;
import com.fr.form.ui.ButtonGroup;
import com.fr.general.Inter;
import javax.swing.*;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import java.awt.*;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
/**
* Created by ibm on 2017/8/5.
*/
public abstract class ButtonGroupDefinePane<T extends ButtonGroup> extends FieldEditorDefinePane<T> {
private ButtonGroupDictPane buttonGroupDictPane;
public ButtonGroupDefinePane(XCreator xCreator) {
super(xCreator);
this.initComponents();
}
@Override
protected JPanel setFirstContentPane() {
JPanel advancePane = FRGUIPaneFactory.createBorderLayout_S_Pane();
buttonGroupDictPane = new ButtonGroupDictPane();
FormWidgetValuePane formWidgetValuePane = new FormWidgetValuePane();
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
Component[][] components = new Component[][]{
new Component[]{new UILabel(Inter.getLocText("FR-Designer-Estate_Widget_Value")), formWidgetValuePane },
new Component[]{new UILabel(Inter.getLocText("FR-Designer_DS-Dictionary")), new UITextField()},
new Component[]{new UILabel(Inter.getLocText("FR-Designer_FRFont")), fontSizePane},
new Component[]{buttonGroupDictPane, null}
};
double[] rowSize = {p, p, p, p, p, p};
double[] columnSize = {p, f};
int[][] rowCount = {{1, 3},{1, 1},{1, 1},{1, 1}};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 10, 7);
panel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
advancePane.add(panel, BorderLayout.NORTH);
JPanel otherPane = createOtherPane();
if(otherPane != null){
advancePane.add(otherPane, BorderLayout.CENTER);
}
return advancePane;
}
public JPanel createOtherPane(){
return null;
}
@Override
protected void populateSubFieldEditorBean(T e) {
this.buttonGroupDictPane.populate(e);
populateSubButtonGroupBean(e);
}
protected abstract void populateSubButtonGroupBean(T e);
protected abstract T updateSubButtonGroupBean();
@Override
protected T updateSubFieldEditorBean() {
T e = updateSubButtonGroupBean();
this.buttonGroupDictPane.update(e);
return e;
}
@Override
public void checkValid() throws Exception {
}
}

143
designer_form/src/com/fr/design/widget/ui/designer/btn/ButtonSytleDefinedPane.java

@ -0,0 +1,143 @@
package com.fr.design.widget.ui.designer.btn;
import com.fr.base.background.ColorBackground;
import com.fr.base.background.ImageBackground;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.style.background.BackgroundButtonPane;
import com.fr.form.ui.FreeButton;
import com.fr.general.Background;
import com.fr.general.Inter;
import javax.swing.*;
import javax.swing.border.TitledBorder;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class ButtonSytleDefinedPane extends BasicPane {
// private UIComboBox buttonStyleComboBox;
// private JPanel card;
// private CardLayout cardLayout;
private BackgroundPane initBackgroundPane;
private BackgroundPane overBackgroundPane;
private BackgroundPane clickBackgroundPane;
private Background initBackground;
private Background overBackground;
private Background clickBackground;
public ButtonSytleDefinedPane() {
this.initComponents();
}
protected void initComponents() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
JPanel buttonStylePane = new JPanel();
buttonStylePane.setLayout(new BorderLayout());
initBackgroundPane = new BackgroundPane(Inter.getLocText("FR-Designer_Background-Initial") + ":", Inter.getLocText("FR-Designer_Initial_Background_Tips"));
overBackgroundPane = new BackgroundPane(Inter.getLocText("FR-Designer_Background-Over") + ":", Inter.getLocText("FR-Designer_Mouse_Move_Tips"));
clickBackgroundPane = new BackgroundPane(Inter.getLocText("FR-Designer_Background-Click") + ":", Inter.getLocText("FR-Designer_Mouse_Click_Tips"));
JPanel table = FRGUIPaneFactory.createYBoxEmptyBorderPane();
table.setBorder(new TitledBorder(Inter.getLocText(new String[]{"Custom", "Form-Button", "Style"})));
table.add(initBackgroundPane);
table.add(overBackgroundPane);
table.add(clickBackgroundPane);
buttonStylePane.add(table, BorderLayout.WEST);
this.add(buttonStylePane, BorderLayout.CENTER);
}
public void populate(FreeButton button) {
if (button == null) {
return;
}
initBackgroundPane.populate(button.getInitialBackground());
overBackgroundPane.populate(button.getOverBackground());
clickBackgroundPane.populate(button.getClickBackground());
}
public FreeButton update(FreeButton button) {
button.setCustomStyle(true);
button.setInitialBackground(initBackgroundPane.update());
button.setOverBackground(overBackgroundPane.update());
button.setClickBackground(clickBackgroundPane.update());
return button;
}
@Override
protected String title4PopupWindow() {
return null;
}
class BackgroundPane extends JPanel {
private UIButton editButton;
private BackgroundButtonPane choosePane;
private Background background;
private UILabel ImagePreviewPane;
BackgroundPane(String text, String ToolTips) {
this.setLayout(FRGUIPaneFactory.createLabelFlowLayout());
this.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 150));
UILabel label = new UILabel(text);
label.setToolTipText(ToolTips);
label.setPreferredSize(new Dimension(100, 20));
this.add(label);
ImagePreviewPane = new UILabel();
ImagePreviewPane.setPreferredSize(new Dimension(100, 20));
this.add(ImagePreviewPane);
editButton = new UIButton(Inter.getLocText("FR-Designer_Edit"));
editButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
choosePane = new BackgroundButtonPane();
BasicDialog dlg = choosePane.showWindow(SwingUtilities
.getWindowAncestor(ButtonSytleDefinedPane.this));
dlg.addDialogActionListener(new DialogActionAdapter() {
@Override
public void doOk() {
populate(choosePane.update());
}
});
if(BackgroundPane.this.background == null){
BackgroundPane.this.background = new ColorBackground();
}
choosePane.populate((Background) BackgroundPane.this.background);
dlg.setVisible(true);
}
});
this.add(editButton);
}
public void populate(Background background) {
this.background = background;
if (background instanceof ImageBackground && ((ImageBackground) background).getImage() != null) {
ImagePreviewPane.setIcon(new ImageIcon(((ImageBackground) background).getImage()));
} else if(background instanceof ColorBackground && ((ColorBackground) background).getColor() != null){
ImagePreviewPane.setIcon(null);
ImagePreviewPane.setOpaque(true);
ImagePreviewPane.setBackground(((ColorBackground) background).getColor());
}else{
ImagePreviewPane.setIcon(null);
ImagePreviewPane.setOpaque(false);
ImagePreviewPane.setBackground(null);
}
}
public Background update() {
return background;
}
}
}

30
designer_form/src/com/fr/design/widget/ui/designer/btn/DefaultButtonDetailPane.java

@ -0,0 +1,30 @@
package com.fr.design.widget.ui.designer.btn;
import com.fr.design.widget.btn.ButtonWithHotkeysDetailPane;
import com.fr.form.ui.Button;
import com.fr.form.ui.FreeButton;
import java.awt.*;
/**
* Created by IntelliJ IDEA. Author : Richer Version: 6.5.6 Date : 11-11-15 Time
* : 下午6:24
*/
public class DefaultButtonDetailPane extends ButtonWithHotkeysDetailPane<Button> {
@Override
protected Component createCenterPane() {
return null;
}
@Override
public FreeButton createButton() {
return new FreeButton();
}
@Override
public Class classType() {
return Button.class;
}
}

56
designer_form/src/com/fr/design/widget/ui/designer/btn/DefaultButtonStylePane.java

@ -0,0 +1,56 @@
package com.fr.design.widget.ui.designer.btn;
import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.widget.IconDefinePane;
import com.fr.form.ui.Button;
import com.fr.general.Inter;
import javax.swing.*;
import java.awt.*;
public class DefaultButtonStylePane extends BasicPane {
private UITextField buttonNameTextField;
private IconDefinePane iconPane;
private UIComboBox buttonStyleComboBox;
public DefaultButtonStylePane() {
this.initComponents();
}
protected void initComponents() {
this.setLayout(new BorderLayout());
JPanel labelPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
iconPane = new IconDefinePane();
labelPane.add(iconPane);
Component[][] n_components = {
{ new UILabel(Inter.getLocText("Text") + ":"), buttonNameTextField = new UITextField(20) },
{ new UILabel(Inter.getLocText("Icon") + ":"), labelPane } };
JPanel panel = TableLayoutHelper.createTableLayoutPane(n_components, new double[]{-2, -2}, new double[]{-2, -2});
this.add(panel,BorderLayout.CENTER);
}
public void populate(Button button) {
buttonNameTextField.setText(button.getText());
iconPane.populate(button.getIconName());
}
public Button update(Button button) {
button.setText(buttonNameTextField.getText());
button.setIconName(iconPane.update());
return button;
}
@Override
protected String title4PopupWindow() {
return "default";
}
}

40
designer_form/src/com/fr/design/widget/ui/designer/btn/FreeButtonDetailPane.java

@ -0,0 +1,40 @@
package com.fr.design.widget.ui.designer.btn;
import com.fr.design.widget.btn.ButtonWithHotkeysDetailPane;
import com.fr.form.ui.Button;
import com.fr.form.ui.FreeButton;
import java.awt.*;
public class FreeButtonDetailPane extends ButtonWithHotkeysDetailPane<FreeButton> {
private ButtonSytleDefinedPane stylePane;
@Override
protected Component createCenterPane() {
return stylePane = new ButtonSytleDefinedPane();
}
@Override
public FreeButton createButton() {
return new FreeButton();
}
@Override
public void populate(Button button) {
super.populate(button);
if(button instanceof FreeButton) {
stylePane.populate((FreeButton) button);
}
}
@Override
public FreeButton update() {
FreeButton button = super.update();
return stylePane.update(button);
}
@Override
public Class classType() {
return FreeButton.class;
}
}

82
designer_form/src/com/fr/design/widget/ui/designer/component/BackgroundCompPane.java

@ -0,0 +1,82 @@
package com.fr.design.widget.ui.designer.component;
import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.ibutton.UIHeadGroup;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.widget.accessibles.AccessibleBackgroundEditor;
import com.fr.form.ui.*;
import com.fr.form.ui.Button;
import com.fr.general.Background;
import com.fr.general.Inter;
import javax.swing.*;
import java.awt.*;
/**
* Created by ibm on 2017/8/6.
*/
public class BackgroundCompPane extends BasicPane {
private UIHeadGroup backgroundHead;
private AccessibleBackgroundEditor initalBackgroundEditor;
private AccessibleBackgroundEditor overBackgroundEditor;
private AccessibleBackgroundEditor clickBackgroundEditor;
public BackgroundCompPane() {
initComponent();
}
public void initComponent() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
initalBackgroundEditor = new AccessibleBackgroundEditor();
overBackgroundEditor = new AccessibleBackgroundEditor();
clickBackgroundEditor = new AccessibleBackgroundEditor();
String [] titles = new String[]{"默认", "自定义"};
double f = TableLayout.FILL;
final double p = TableLayout.PREFERRED;
double[] rowSize = {p, p, p};
double[] columnSize = {p, f};
int[][] rowCount = {{1, 1},{1, 1},{1, 1}};
Component[][] components = new Component[][]{
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Background-Initial")), initalBackgroundEditor},
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Background-Over")), overBackgroundEditor},
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Background-Click")), clickBackgroundEditor},
};
final JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 7, 7);
panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
backgroundHead = new UIHeadGroup(titles){
@Override
public void tabChanged(int index) {
//todo
if (index == 1) {
panel.setVisible(true);
}else{
panel.setVisible(false);
}
}
};
this.add(backgroundHead, BorderLayout.NORTH);
this.add(panel, BorderLayout.CENTER);
}
public void update(FreeButton btn) {
btn.setInitialBackground((Background) initalBackgroundEditor.getValue());
btn.setOverBackground((Background) overBackgroundEditor.getValue());
btn.setClickBackground((Background) clickBackgroundEditor.getValue());
}
protected String title4PopupWindow() {
return "";
}
public void populate(FreeButton btn) {
initalBackgroundEditor.setValue(btn.getInitialBackground());
overBackgroundEditor.setValue(btn.getOverBackground());
clickBackgroundEditor.setValue(btn.getClickBackground());
}
}

56
designer_form/src/com/fr/design/widget/ui/designer/component/FormWidgetValuePane.java

@ -0,0 +1,56 @@
package com.fr.design.widget.ui.designer.component;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.gui.ibutton.UIHeadGroup;
import com.fr.design.widget.ui.designer.custom.*;
import com.fr.form.ui.TextEditor;
import javax.swing.*;
import java.awt.*;
/**
* Created by ibm on 2017/7/27.
*/
public class FormWidgetValuePane extends JPanel {
private UIHeadGroup widgetValueHead;
public FormWidgetValuePane() {
WidgetValuePane StringPane = new WidgetValueString();
WidgetValuePane FormulaPane = new WidgetValueFormula();
WidgetValuePane FieldPane = new WidgetValueField();
this.setLayout(new BorderLayout(0, LayoutConstants.VGAP_SMALL));
final CardLayout cardLayout = new CardLayout();
final JPanel customPane = new JPanel(cardLayout);
customPane.add(StringPane.createWidgetValuePane(), StringPane.markTitle());
customPane.add(FormulaPane.createWidgetValuePane(), FormulaPane.markTitle());
customPane.add(FieldPane.createWidgetValuePane(), FieldPane.markTitle());
final String[] tabTitles = new String[]{StringPane.markTitle(), FormulaPane.markTitle(), FieldPane.markTitle()};
widgetValueHead = new UIHeadGroup(tabTitles) {
@Override
public void tabChanged(int index) {
//todo
if (index == 2) {
customPane.setPreferredSize(new Dimension(100, 50));
} else {
customPane.setPreferredSize(new Dimension(100, 20));
}
cardLayout.show(customPane, tabTitles[index]);
}
};
this.add(widgetValueHead, BorderLayout.NORTH);
this.add(customPane, BorderLayout.CENTER);
}
public void update(TextEditor ob) {
//todo
}
public void populate(TextEditor ob) {
//todo
}
}

69
designer_form/src/com/fr/design/widget/ui/designer/component/PaddingBoundPane.java

@ -0,0 +1,69 @@
package com.fr.design.widget.ui.designer.component;
import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.form.ui.AbstractMarginWidget;
import com.fr.form.ui.PaddingMargin;
import com.fr.general.Inter;
import javax.swing.*;
import java.awt.*;
/**
* Created by ibm on 2017/8/3.
*/
public class PaddingBoundPane extends BasicPane {
protected UISpinner top;
protected UISpinner bottom;
protected UISpinner left;
protected UISpinner right;
public PaddingBoundPane() {
initBoundPane();
}
public void initBoundPane() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
top = new UISpinner(0, 1000, 1, 0);
bottom = new UISpinner(0, 1000, 1, 0);
left = new UISpinner(0, 1000, 1, 0);
right = new UISpinner(0, 1000, 1, 0);
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
double[] rowSize = {p, p, p, p};
double[] columnSize = {p, f, f};
int[][] rowCount = {{1, 1, 1}, {1, 1, 1}, {1, 1, 1}, {1, 1, 1}};
Component[][] components = new Component[][]{
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Layout-Padding")), top, bottom},
new Component[]{null, new UILabel(Inter.getLocText("FR-Designer_Top"), SwingConstants.CENTER), new UILabel(Inter.getLocText("FR-Designer_Bottom"), SwingConstants.CENTER)},
new Component[]{null, left, right},
new Component[]{null, new UILabel(Inter.getLocText("FR-Designer_Left"), SwingConstants.CENTER), new UILabel(Inter.getLocText("FR-Designer_Right"), SwingConstants.CENTER)},
};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 7, 7);
panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
this.add(panel);
}
public void update(AbstractMarginWidget marginWidget) {
marginWidget.setMargin(new PaddingMargin((int)top.getValue(), (int)left.getValue(), (int)bottom.getValue(), (int)right.getValue() ));
}
protected String title4PopupWindow() {
return "";
}
public void populate(AbstractMarginWidget marginWidget) {
PaddingMargin paddingMargin = marginWidget.getMargin();
top.setValue(paddingMargin.getTop());
bottom.setValue(paddingMargin.getBottom());
left.setValue(paddingMargin.getLeft());
right.setValue(paddingMargin.getRight());
}
}

81
designer_form/src/com/fr/design/widget/ui/designer/component/WidgetAbsoluteBoundPane.java

@ -0,0 +1,81 @@
package com.fr.design.widget.ui.designer.component;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.designer.creator.XWAbsoluteLayout;
import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.form.ui.container.WAbsoluteLayout;
import com.fr.general.Inter;
import javax.swing.*;
import java.awt.*;
/**
* Created by ibm on 2017/8/3.
*/
public class WidgetAbsoluteBoundPane extends WidgetBoundPane {
protected XWAbsoluteLayout parent;
private UISpinner x;
private UISpinner y;
public WidgetAbsoluteBoundPane(XCreator source){
super(source);
XLayoutContainer xLayoutContainer = getParent(source);
this.parent = (XWAbsoluteLayout) xLayoutContainer;
}
public void initBoundPane() {
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
x = new UISpinner(0, 1200, 1);
y = new UISpinner(0, 1200, 1);
width = new UISpinner(0, 1200, 1);
height = new UISpinner(0, 1200, 1);
Component[][] components = new Component[][]{
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Widget_Position")), x, y},
new Component[]{null, new UILabel(Inter.getLocText("FR-Designer_X_Coordinate"), SwingConstants.CENTER), new UILabel(Inter.getLocText("FR-Designer_Y_Coordinate"), SwingConstants.CENTER)},
new Component[]{new UILabel(Inter.getLocText("FR-Designer-Widget_Size")), width, height},
new Component[]{null, new UILabel(Inter.getLocText("FR-Designer-Tree_Width"), SwingConstants.CENTER), new UILabel(Inter.getLocText("FR-Designer-Tree_Height"), SwingConstants.CENTER)},
};
double[] rowSize = {p, p, p, p};
double[] columnSize = {p, f, f};
int[][] rowCount = {{1, 1, 1}, {1, 1, 1}, {1, 1, 1}, {1, 1, 1}};
final JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 8, 5);
panel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
UIExpandablePane uiExpandablePane = new UIExpandablePane(Inter.getLocText("Form-Component_Bounds"), 280, 20, panel);
this.add(uiExpandablePane);
}
public void update() {
super.update();
Rectangle bounds = new Rectangle(creator.getBounds());
bounds.x = (int) x.getValue();
bounds.y = (int) y.getValue();
if (parent == null) {
return;
}
WAbsoluteLayout wabs = parent.toData();
wabs.setBounds(creator.toData(), bounds);
creator.setBounds(bounds);
}
protected String title4PopupWindow() {
return "";
}
public void populate() {
super.populate();
Rectangle bounds = new Rectangle(creator.getBounds());
x.setValue(bounds.x);
y.setValue(bounds.y);
}
}

77
designer_form/src/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java

@ -0,0 +1,77 @@
package com.fr.design.widget.ui.designer.component;
import com.fr.design.designer.creator.*;
import com.fr.design.dialog.BasicPane;
import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.general.Inter;
import javax.swing.*;
import java.awt.*;
/**
* Created by ibm on 2017/7/30.
*/
public class WidgetBoundPane extends BasicPane {
protected XCreator creator;
protected UISpinner width;
protected UISpinner height;
public WidgetBoundPane(XCreator source) {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.creator = source;
initBoundPane();
}
public XLayoutContainer getParent(XCreator source) {
XLayoutContainer container = XCreatorUtils.getParentXLayoutContainer(source);
if (source.acceptType(XWFitLayout.class) || source.acceptType(XWParameterLayout.class)) {
container = null;
}
return container;
}
public void initBoundPane() {
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
width = new UISpinner(0, 1200, 1);
height = new UISpinner(0, 1200, 1);
Component[][] components = new Component[][]{
new Component[]{new UILabel(Inter.getLocText("FR-Designer-Widget_Size")), width, height},
new Component[]{null, new UILabel(Inter.getLocText("FR-Designer-Tree_Width"), SwingConstants.CENTER), new UILabel(Inter.getLocText("FR-Designer-Tree_Height"), SwingConstants.CENTER)},
};
double[] rowSize = {p, p};
double[] columnSize = {p, f, f};
int[][] rowCount = {{1, 1, 1}, {1, 1, 1}};
final JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 8, 5);
panel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
UIExpandablePane uiExpandablePane = new UIExpandablePane("尺寸", 280, 20, panel);
this.add(uiExpandablePane);
}
public void update() {
Rectangle bounds = new Rectangle(creator.getBounds());
bounds.width = (int) width.getValue();
bounds.height = (int) height.getValue();
creator.setBounds(bounds);
}
protected String title4PopupWindow() {
return "";
}
public void populate() {
Rectangle bounds = new Rectangle(creator.getBounds());
width.setValue(bounds.width);
height.setValue(bounds.height);
}
}

40
designer_form/src/com/fr/design/widget/ui/designer/custom/WidgetValueField.java

@ -0,0 +1,40 @@
package com.fr.design.widget.ui.designer.custom;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.general.Inter;
import javax.swing.*;
import java.awt.*;
/**
* Created by ibm on 2017/8/1.
*/
public class WidgetValueField implements WidgetValuePane{
private UITextField dataSource;
private UITextField field;
public WidgetValueField(){
dataSource = new UITextField();
field = new UITextField();
}
public JComponent createWidgetValuePane(){
JPanel jPanel = new JPanel();
jPanel.setLayout(new BorderLayout(1,7));
jPanel.add(dataSource, BorderLayout.NORTH);
jPanel.add(field, BorderLayout.CENTER);
return jPanel;
}
public String markTitle(){
return Inter.getLocText("FR-Designer_Widget_Field");
}
public void update(){
//todo
}
public void populate(){
//todo
}
}

33
designer_form/src/com/fr/design/widget/ui/designer/custom/WidgetValueFormula.java

@ -0,0 +1,33 @@
package com.fr.design.widget.ui.designer.custom;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.general.Inter;
import javax.swing.*;
/**
* Created by ibm on 2017/8/1.
*/
public class WidgetValueFormula implements WidgetValuePane{
private UITextField uiTextField;
public WidgetValueFormula(){
uiTextField = new UITextField();
}
public JComponent createWidgetValuePane(){
return uiTextField;
}
public String markTitle(){
return Inter.getLocText("FR-Designer_Widget_Formula");
}
public void update(){
}
public void populate(){
}
}

17
designer_form/src/com/fr/design/widget/ui/designer/custom/WidgetValuePane.java

@ -0,0 +1,17 @@
package com.fr.design.widget.ui.designer.custom;
import javax.swing.*;
/**
* Created by ibm on 2017/8/1.
*/
public interface WidgetValuePane{
JComponent createWidgetValuePane();
String markTitle();
void update();
void populate();
}

33
designer_form/src/com/fr/design/widget/ui/designer/custom/WidgetValueString.java

@ -0,0 +1,33 @@
package com.fr.design.widget.ui.designer.custom;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.general.Inter;
import javax.swing.*;
/**
* Created by ibm on 2017/8/1.
*/
public class WidgetValueString implements WidgetValuePane{
private UITextField uiTextField;
public WidgetValueString(){
uiTextField = new UITextField();
}
public JComponent createWidgetValuePane(){
return uiTextField;
}
public String markTitle(){
return Inter.getLocText("FR-Designer_Widget_String");
}
public void update(){
}
public void populate(){
}
}

219
designer_form/src/com/fr/design/widget/ui/designer/layout/FRAbsoluteBodyLayoutDefinePane.java

@ -0,0 +1,219 @@
package com.fr.design.widget.ui.designer.layout;
import com.fr.design.data.DataCreatorUI;
import com.fr.design.designer.creator.*;
import com.fr.design.designer.creator.cardlayout.XWCardMainBorderLayout;
import com.fr.design.designer.properties.items.FRLayoutTypeItems;
import com.fr.design.designer.properties.items.Item;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.WidgetPropertyPane;
import com.fr.form.ui.container.WAbsoluteBodyLayout;
import com.fr.form.ui.container.WAbsoluteLayout;
import com.fr.form.ui.container.WBodyLayoutType;
import com.fr.general.FRLogger;
import com.fr.general.Inter;
import javax.swing.*;
import java.awt.*;
import java.util.Arrays;
import java.util.Comparator;
/**
* Created by ibm on 2017/8/2.
*/
public class FRAbsoluteBodyLayoutDefinePane extends FRAbsoluteLayoutDefinePane {
private XWAbsoluteBodyLayout xwAbsoluteBodyLayout;
private WAbsoluteBodyLayout wAbsoluteBodyLayout;
private UIComboBox layoutCombox;
private WBodyLayoutType layoutType = WBodyLayoutType.ABSOLUTE;
private static final int EACH_ROW_COUNT = 4;
public FRAbsoluteBodyLayoutDefinePane(XCreator xCreator) {
super(xCreator);
this.xwAbsoluteBodyLayout = (XWAbsoluteBodyLayout) xCreator;
wAbsoluteBodyLayout = xwAbsoluteBodyLayout.toData();
}
public JPanel createThirdPane() {
initLayoutComboBox();
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
double[] rowSize = {p, p};
double[] columnSize = {p, f};
int[][] rowCount = {{1, 1}, {1, 1}};
Component[][] components = new Component[][]{
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Attr_Layout_Type")), layoutCombox},
new Component[]{new UILabel(Inter.getLocText("FR-Designer-Widget_Scaling_Mode")), comboBox},
};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 20, 7);
panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
return panel;
}
public void initLayoutComboBox() {
Item[] items = FRLayoutTypeItems.ITEMS;
DefaultComboBoxModel model = new DefaultComboBoxModel();
for (Item item : items) {
model.addElement(item);
}
layoutCombox = new UIComboBox(model);
layoutCombox.setSelectedIndex(1);
}
@Override
public String title4PopupWindow() {
return "absoluteBodyLayout";
}
public void populateSubPane(WAbsoluteLayout ob) {
// WAbsoluteBodyLayout layout = (WAbsoluteBodyLayout) ob;
layoutCombox.setSelectedIndex(1);
}
public WAbsoluteBodyLayout updateSubPane() {
WAbsoluteBodyLayout layout = (WAbsoluteBodyLayout) creator.toData();
Item item = (Item) layoutCombox.getSelectedItem();
Object value = item.getValue();
int state = 0;
if (value instanceof Integer) {
state = (Integer) value;
}
if (layoutType == WBodyLayoutType.ABSOLUTE) {
if (state == WBodyLayoutType.FIT.getTypeValue()) {
switch2FitBodyLayout();
}
}
return layout;
}
@Override
public DataCreatorUI dataUI() {
return null;
}
private boolean switch2FitBodyLayout() {
try {
XWFitLayout xfl = (XWFitLayout) creator.getBackupParent();
//备份一下组件间隔
int compInterval = xfl.toData().getCompInterval();
Component[] components = creator.getComponents();
Arrays.sort(components, new ComparatorComponentLocation());
xfl.getLayoutAdapter().removeBean(creator, creator.getWidth(), creator.getHeight());
xfl.remove(creator);
for (Component comp : components) {
XCreator xCreator = (XCreator) comp;
if (xCreator.shouldScaleCreator()) {
XLayoutContainer parentPanel = xCreator.initCreatorWrapper(xCreator.getHeight());
xfl.add(parentPanel, xCreator.toData().getWidgetName());
parentPanel.updateChildBound(xfl.getActualMinHeight());
continue;
}
xfl.add(xCreator);
}
//这边计算的时候会先把组件间隔去掉
moveComponents2FitLayout(xfl);
FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner();
formDesigner.getSelectionModel().setSelectedCreator(xfl);
for (int i = 0; i < components.length; i++) {
Component comp = xfl.getComponent(i);
XCreator creator = (XCreator) comp;
creator.setBackupBound(components[i].getBounds());
}
//把组件间隔加上
if (xfl.toData().getCompInterval() != compInterval) {
xfl.moveContainerMargin();
xfl.moveCompInterval(xfl.getAcualInterval());
xfl.toData().setCompInterval(compInterval);
xfl.addCompInterval(xfl.getAcualInterval());
}
xfl.toData().setLayoutType(WBodyLayoutType.FIT);
return true;
} catch (Exception e) {
FRLogger.getLogger().error(e.getMessage());
return false;
}
}
// 把绝对布局中的元素按规则移动到自适应布局中
// 规则:各元素按顺序放置,其中每行最多4个元素,超出则换行,各元素均分body的高度和宽度
private void moveComponents2FitLayout(XWFitLayout xwFitLayout) {
Component[] components = xwFitLayout.getComponents();
if (components.length == 0) {
xwFitLayout.updateBoundsWidget();
return;
}
int layoutWidth = xwFitLayout.getWidth() - xwFitLayout.toData().getMargin().getLeft() - xwFitLayout.toData().getMargin().getRight();
int layoutHeight = xwFitLayout.getHeight() - xwFitLayout.toData().getMargin().getTop() - xwFitLayout.toData().getMargin().getBottom();
int leftMargin = xwFitLayout.toData().getMargin().getLeft();
int topMargin = xwFitLayout.toData().getMargin().getTop();
xwFitLayout.toData().setCompInterval(0);
int row = (components.length / EACH_ROW_COUNT) + (components.length % EACH_ROW_COUNT == 0 ? 0 : 1);
//最后一行的列数不定
int column = components.length % EACH_ROW_COUNT == 0 ? EACH_ROW_COUNT : components.length % EACH_ROW_COUNT;
int componentWidth = layoutWidth / EACH_ROW_COUNT;
int componentHeight = layoutHeight / row;
for (int i = 0; i < row - 1; i++) {
for (int j = 0; j < EACH_ROW_COUNT; j++) {
components[EACH_ROW_COUNT * i + j].setBounds(
leftMargin + componentWidth * j,
topMargin + componentHeight * i,
j == EACH_ROW_COUNT - 1 ? layoutWidth - componentWidth * (EACH_ROW_COUNT - 1) : componentWidth,
componentHeight
);
}
}
//最后一行列数是特殊的,要单独处理
int lastRowWidth = layoutWidth / column;
int lastRowHeight = layoutHeight - componentHeight * (row - 1);
for (int i = 0; i < column; i++) {
components[EACH_ROW_COUNT * (row - 1) + i].setBounds(
leftMargin + lastRowWidth * i,
topMargin + componentHeight * (row - 1),
i == column - 1 ? layoutWidth - lastRowWidth * (column - 1) : lastRowWidth,
lastRowHeight
);
}
for (int i = 0; i < components.length; i++) {
if (components[i] instanceof XWCardMainBorderLayout) {
((XWCardMainBorderLayout) components[i]).recalculateChildWidth(components[i].getWidth());
((XWCardMainBorderLayout) components[i]).recalculateChildHeight(components[i].getHeight());
}
xwFitLayout.dealDirections((XCreator) components[i], false);
}
xwFitLayout.updateBoundsWidget();
}
//以组件的位置来确定先后顺序,y小的在前,x小的在前
private class ComparatorComponentLocation implements Comparator {
@Override
public int compare(Object o1, Object o2) {
if (((Component) o1).getY() < ((Component) o2).getY()) {
return -1;
} else if (((Component) o1).getY() > ((Component) o2).getY()) {
return 1;
} else {
if (((Component) o1).getX() < ((Component) o2).getX()) {
return -1;
} else if (((Component) o1).getX() > ((Component) o2).getX()) {
return 1;
} else {
return 0;
}
}
}
}
}

113
designer_form/src/com/fr/design/widget/ui/designer/layout/FRAbsoluteLayoutDefinePane.java

@ -0,0 +1,113 @@
package com.fr.design.widget.ui.designer.layout;
import com.fr.design.data.DataCreatorUI;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XWAbsoluteLayout;
import com.fr.design.designer.properties.items.FRAbsoluteConstraintsItems;
import com.fr.design.designer.properties.items.Item;
import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.widget.ui.designer.AbstractDataModify;
import com.fr.design.widget.ui.designer.component.WidgetBoundPane;
import com.fr.form.ui.container.WAbsoluteLayout;
import com.fr.form.ui.container.WBodyLayoutType;
import com.fr.general.Inter;
import javax.swing.*;
import java.awt.*;
/**
* Created by ibm on 2017/8/2.
*/
public class FRAbsoluteLayoutDefinePane extends AbstractDataModify<WAbsoluteLayout> {
private XWAbsoluteLayout xwAbsoluteLayout;
private WAbsoluteLayout wAbsoluteLayout;
protected UIComboBox comboBox;
private WBodyLayoutType layoutType = WBodyLayoutType.ABSOLUTE;
private WidgetBoundPane boundPane;
public FRAbsoluteLayoutDefinePane(XCreator xCreator) {
super(xCreator);
this.xwAbsoluteLayout = (XWAbsoluteLayout) xCreator;
wAbsoluteLayout = xwAbsoluteLayout.toData();
initComponent();
}
public void initComponent() {
boundPane = new WidgetBoundPane(creator);
this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.add(boundPane, BorderLayout.NORTH);
initUIComboBox();
UIExpandablePane layoutExpandablePane = new UIExpandablePane(Inter.getLocText("FR-Designer-Widget_Area_Scaling"), 280, 20, createThirdPane());
this.add(layoutExpandablePane, BorderLayout.CENTER);
}
public JPanel createThirdPane() {
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
double[] rowSize = {p};
double[] columnSize = {p, f};
int[][] rowCount = {{1, 1}};
Component[][] components = new Component[][]{
new Component[]{new UILabel(Inter.getLocText("FR-Designer-Widget_Scaling_Mode")), comboBox},
};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 20, 7);
panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
return panel;
}
public void initUIComboBox() {
Item[] items = FRAbsoluteConstraintsItems.ITEMS;
DefaultComboBoxModel model = new DefaultComboBoxModel();
for (Item item : items) {
model.addElement(item);
}
comboBox = new UIComboBox(model);
}
@Override
public String title4PopupWindow() {
return "absoluteLayout";
}
@Override
public void populateBean(WAbsoluteLayout ob) {
populateSubPane(ob);
comboBox.setSelectedIndex(ob.getCompState());
boundPane.populate();
}
@Override
public WAbsoluteLayout updateBean() {
WAbsoluteLayout wAbsoluteLayout = updateSubPane();
wAbsoluteLayout.setCompState(comboBox.getSelectedIndex());
boundPane.update();
return wAbsoluteLayout;
}
public WAbsoluteLayout updateSubPane() {
return new WAbsoluteLayout();
}
public void populateSubPane(WAbsoluteLayout ob) {
}
@Override
public DataCreatorUI dataUI() {
return null;
}
}

171
designer_form/src/com/fr/design/widget/ui/designer/layout/FRFitLayoutDefinePane.java

@ -0,0 +1,171 @@
package com.fr.design.widget.ui.designer.layout;
import com.fr.design.data.DataCreatorUI;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XWAbsoluteBodyLayout;
import com.fr.design.designer.creator.XWFitLayout;
import com.fr.design.designer.creator.XWScaleLayout;
import com.fr.design.designer.properties.items.FRFitConstraintsItems;
import com.fr.design.designer.properties.items.FRLayoutTypeItems;
import com.fr.design.designer.properties.items.Item;
import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.FormSelectionUtils;
import com.fr.design.mainframe.WidgetPropertyPane;
import com.fr.design.widget.ui.designer.AbstractDataModify;
import com.fr.design.widget.ui.designer.component.PaddingBoundPane;
import com.fr.form.ui.Widget;
import com.fr.form.ui.container.WAbsoluteBodyLayout;
import com.fr.form.ui.container.WAbsoluteLayout;
import com.fr.form.ui.container.WBodyLayoutType;
import com.fr.form.ui.container.WFitLayout;
import com.fr.general.FRLogger;
import com.fr.general.Inter;
import javax.swing.*;
import java.awt.*;
/**
* Created by ibm on 2017/8/2.
*/
public class FRFitLayoutDefinePane extends AbstractDataModify<WFitLayout> {
private XWFitLayout xWFitLayout;
private WFitLayout wFitLayout;
private UIComboBox layoutComboBox;
private UIComboBox adaptComboBox;
private UISpinner componentIntervel;
private PaddingBoundPane paddingBound;
private UITextField background;
public FRFitLayoutDefinePane(XCreator xCreator) {
super(xCreator);
this.xWFitLayout = (XWFitLayout) xCreator;
wFitLayout = xWFitLayout.toData();
initComponent();
}
public void initComponent() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
JPanel advancePane = createAdvancePane();
UIExpandablePane advanceExpandablePane = new UIExpandablePane(Inter.getLocText("FR-Designer_Advanced"), 280, 20, advancePane);
this.add(advanceExpandablePane, BorderLayout.NORTH);
UIExpandablePane layoutExpandablePane = new UIExpandablePane(Inter.getLocText("FR-Designer_Layout"), 280, 20, createLayoutPane());
this.add(layoutExpandablePane, BorderLayout.CENTER);
}
public JPanel createAdvancePane() {
JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane();
background = new UITextField();
paddingBound = new PaddingBoundPane();
JPanel jp2 = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{new UILabel(Inter.getLocText("FR-Designer_Background")), background}}, TableLayoutHelper.FILL_LASTCOLUMN, 18, 7);
jp2.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
jPanel.add(paddingBound, BorderLayout.CENTER);
jPanel.add(jp2, BorderLayout.NORTH);
return jPanel;
}
public JPanel createLayoutPane() {
JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane();
layoutComboBox = initUIComboBox(FRLayoutTypeItems.ITEMS);
adaptComboBox = initUIComboBox(FRFitConstraintsItems.ITEMS);
componentIntervel = new UISpinner(0, 100, 1, 0);
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
double[] rowSize = {p, p, p};
double[] columnSize = {p, f};
int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}};
Component[][] components = new Component[][]{
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Attr_Layout_Type")), layoutComboBox},
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Component_Scale")), adaptComboBox},
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Component_Interval")), componentIntervel}
};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 20, 7);
panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
jPanel.add(panel, BorderLayout.CENTER);
return jPanel;
}
public UIComboBox initUIComboBox(Item[] items) {
DefaultComboBoxModel model = new DefaultComboBoxModel();
for (Item item : items) {
model.addElement(item);
}
return new UIComboBox(model);
}
@Override
public String title4PopupWindow() {
return "fitLayout";
}
@Override
public void populateBean(WFitLayout ob) {
background.setText("test");
paddingBound.populate(ob);
layoutComboBox.setSelectedIndex(ob.getBodyLayoutType().getTypeValue());
adaptComboBox.setSelectedIndex(ob.getCompState());
componentIntervel.setValue(ob.getCompInterval());
}
@Override
public WFitLayout updateBean() {
WFitLayout layout = (WFitLayout) creator.toData();
paddingBound.update(layout);
Item item = (Item) layoutComboBox.getSelectedItem();
Object value = item.getValue();
int state = 0;
if (value instanceof Integer) {
state = (Integer) value;
}
try {
if (state == WBodyLayoutType.ABSOLUTE.getTypeValue()) {
WAbsoluteBodyLayout wAbsoluteBodyLayout = new WAbsoluteBodyLayout("body");
wAbsoluteBodyLayout.setCompState(WAbsoluteLayout.STATE_FIXED);
Component[] components = xWFitLayout.getComponents();
xWFitLayout.removeAll();
XWAbsoluteBodyLayout xwAbsoluteBodyLayout = new XWAbsoluteBodyLayout(wAbsoluteBodyLayout, new Dimension(0, 0));
xWFitLayout.getLayoutAdapter().addBean(xwAbsoluteBodyLayout, 0, 0);
for (Component component : components) {
XCreator xCreator = (XCreator) component;
//部分控件被ScaleLayout包裹着,绝对布局里面要放出来
if (xCreator.acceptType(XWScaleLayout.class)) {
if (xCreator.getComponentCount() > 0 && ((XCreator) xCreator.getComponent(0)).shouldScaleCreator()) {
component = xCreator.getComponent(0);
component.setBounds(xCreator.getBounds());
}
}
xwAbsoluteBodyLayout.add(component);
}
FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner();
formDesigner.getSelectionModel().setSelectedCreators(
FormSelectionUtils.rebuildSelection(xWFitLayout, new Widget[]{wAbsoluteBodyLayout}));
}
} catch (Exception e) {
FRLogger.getLogger().error(e.getMessage());
}
//todo 验证下
layout.setLayoutType(WBodyLayoutType.parse(state));
layout.setCompState(adaptComboBox.getSelectedIndex());
layout.setCompInterval((int)componentIntervel.getValue());
return layout;
}
@Override
public DataCreatorUI dataUI() {
return null;
}
}

39
designer_form/src/com/fr/design/widget/ui/designer/layout/WCardMainLayoutDefinePane.java

@ -0,0 +1,39 @@
package com.fr.design.widget.ui.designer.layout;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.widget.ui.designer.AbstractDataModify;
import com.fr.form.ui.container.cardlayout.WCardMainBorderLayout;
import java.awt.*;
/**
* Created by ibm on 2017/8/2.
*/
public class WCardMainLayoutDefinePane extends AbstractDataModify<WCardMainBorderLayout> {
public WCardMainLayoutDefinePane(XCreator xCreator) {
super(xCreator);
this.setPreferredSize(new Dimension(0,0));
}
public void initComponent() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
}
@Override
public String title4PopupWindow() {
return "cardMainLayout";
}
@Override
public void populateBean(WCardMainBorderLayout ob) {
}
@Override
public WCardMainBorderLayout updateBean() {
WCardMainBorderLayout layout = (WCardMainBorderLayout)creator.toData();
return layout;
}
}

46
designer_form/src/com/fr/design/widget/ui/designer/layout/WTabFitLayoutDefinePane.java

@ -0,0 +1,46 @@
package com.fr.design.widget.ui.designer.layout;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.foldablepane.UIExpandablePane;;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.widget.ui.designer.AbstractDataModify;
import com.fr.design.widget.ui.designer.component.PaddingBoundPane;
import com.fr.form.ui.container.cardlayout.WTabFitLayout;
import com.fr.general.Inter;
import java.awt.*;
/**
* Created by ibm on 2017/8/5.
*/
public class WTabFitLayoutDefinePane extends AbstractDataModify<WTabFitLayout> {
private PaddingBoundPane paddingBoundPane;
public WTabFitLayoutDefinePane(XCreator xCreator) {
super(xCreator);
initComponent();
}
public void initComponent() {
paddingBoundPane = new PaddingBoundPane();
this.setLayout(FRGUIPaneFactory.createBorderLayout());
UIExpandablePane advanceExpandablePane = new UIExpandablePane(Inter.getLocText("FR-Designer_Advanced"), 280, 20, paddingBoundPane);
this.add(advanceExpandablePane, BorderLayout.CENTER);
}
@Override
public String title4PopupWindow() {
return "tabFitLayout";
}
@Override
public void populateBean(WTabFitLayout ob) {
}
@Override
public WTabFitLayout updateBean() {
WTabFitLayout layout = (WTabFitLayout) creator.toData();
return layout;
}
}

55
designer_form/src/com/fr/design/widget/ui/designer/layout/WTitleLayoutDefinePane.java

@ -0,0 +1,55 @@
package com.fr.design.widget.ui.designer.layout;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.widget.ui.designer.AbstractDataModify;
import com.fr.design.widget.ui.designer.component.PaddingBoundPane;
import com.fr.form.ui.container.WTitleLayout;
import com.fr.general.Inter;
import javax.swing.*;
import java.awt.*;
/**
* Created by ibm on 2017/8/3.
*/
public class WTitleLayoutDefinePane extends AbstractDataModify<WTitleLayout> {
private PaddingBoundPane paddingBoundPane;
private UICheckBox displayECToolBar;
public WTitleLayoutDefinePane(XCreator xCreator) {
super(xCreator);
initComponent();
}
public void initComponent() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
JPanel advancePane = FRGUIPaneFactory.createBorderLayout_S_Pane();
UIExpandablePane advanceExpandablePane = new UIExpandablePane(Inter.getLocText("FR-Designer_Advanced"), 280, 20, advancePane);
paddingBoundPane = new PaddingBoundPane();
displayECToolBar = new UICheckBox(Inter.getLocText("FR-Designer_Widget_Display_Report_Tool"));
advancePane.add(paddingBoundPane, BorderLayout.NORTH);
advancePane.add(displayECToolBar, BorderLayout.CENTER);
this.add(advanceExpandablePane);
}
@Override
public String title4PopupWindow() {
return "titleLayout";
}
@Override
public void populateBean(WTitleLayout ob) {
paddingBoundPane.populate(ob);
// displayECToolBar.setSelected(ob.ds);
}
@Override
public WTitleLayout updateBean() {
WTitleLayout layout = (WTitleLayout)creator.toData();
return layout;
}
}
Loading…
Cancel
Save