Browse Source

Merge branch '9.0' into design

master
hzzz 7 years ago
parent
commit
d1bdc77824
  1. 2
      designer/src/com/fr/design/mainframe/CellWidgetPropertyPane.java
  2. 15
      designer/src/com/fr/design/mainframe/JWorkBook.java
  3. 4
      designer/src/com/fr/design/mainframe/SheetNameTabPane.java
  4. 8
      designer/src/com/fr/design/widget/CellWidgetCardPane.java
  5. 7
      designer/src/com/fr/poly/PolyDesigner.java
  6. 8
      designer/src/com/fr/poly/creator/ChartBlockEditor.java
  7. 5
      designer_base/src/com/fr/design/constants/UIConstants.java
  8. 8
      designer_base/src/com/fr/design/gui/controlpane/UIControlPane.java
  9. 154
      designer_base/src/com/fr/design/gui/frpane/RegPane.java
  10. BIN
      designer_base/src/com/fr/design/images/control/edit_white.png
  11. 11
      designer_base/src/com/fr/design/locale/designer.properties
  12. 12
      designer_base/src/com/fr/design/locale/designer_en_US.properties
  13. 6
      designer_base/src/com/fr/design/locale/designer_ja_JP.properties
  14. 6
      designer_base/src/com/fr/design/locale/designer_ko_KR.properties
  15. 17
      designer_base/src/com/fr/design/locale/designer_zh_CN.properties
  16. 6
      designer_base/src/com/fr/design/locale/designer_zh_TW.properties
  17. 2
      designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java
  18. 21
      designer_base/src/com/fr/design/widget/DataModify.java
  19. 11
      designer_base/src/com/fr/design/widget/Operator.java
  20. 91
      designer_base/src/com/fr/design/widget/btn/ButtonWithHotkeysDetailPane.java
  21. 4
      designer_form/src/com/fr/design/designer/creator/XBorderStyleWidgetCreator.java
  22. 16
      designer_form/src/com/fr/design/designer/creator/XCreator.java
  23. 6
      designer_form/src/com/fr/design/designer/creator/XWScaleLayout.java
  24. 6
      designer_form/src/com/fr/design/form/parameter/FormParaDesigner.java
  25. 239
      designer_form/src/com/fr/design/mainframe/FormHierarchyTreePane.java
  26. 265
      designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java
  27. 9
      designer_form/src/com/fr/design/mainframe/JForm.java
  28. 79
      designer_form/src/com/fr/design/mainframe/WidgetPropertyPane.java
  29. 15
      designer_form/src/com/fr/design/mainframe/widget/UITreeComboBox.java
  30. 56
      designer_form/src/com/fr/design/mainframe/widget/ui/FormBasicPropertyPane.java
  31. 48
      designer_form/src/com/fr/design/mainframe/widget/ui/FormBasicWidgetPropertyPane.java
  32. 214
      designer_form/src/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java
  33. 47
      designer_form/src/com/fr/design/parameter/ParameterPropertyPane.java
  34. 4
      designer_form/src/com/fr/design/parameter/ParameterToolBarPane.java
  35. 117
      designer_form/src/com/fr/design/parameter/RootDesignDefinePane.java
  36. 106
      designer_form/src/com/fr/design/widget/FormWidgetDefinePaneFactoryBase.java
  37. 34
      designer_form/src/com/fr/design/widget/ui/designer/AbstractDataModify.java
  38. 60
      designer_form/src/com/fr/design/widget/ui/designer/ButtonDefinePane.java
  39. 51
      designer_form/src/com/fr/design/widget/ui/designer/ButtonGroupDictPane.java
  40. 62
      designer_form/src/com/fr/design/widget/ui/designer/CheckBoxDefinePane.java
  41. 93
      designer_form/src/com/fr/design/widget/ui/designer/CheckBoxDictPane.java
  42. 78
      designer_form/src/com/fr/design/widget/ui/designer/CheckBoxGroupDefinePane.java
  43. 44
      designer_form/src/com/fr/design/widget/ui/designer/ComboBoxDefinePane.java
  44. 91
      designer_form/src/com/fr/design/widget/ui/designer/ComboCheckBoxDefinePane.java
  45. 1
      designer_form/src/com/fr/design/widget/ui/designer/CustomWritableRepeatEditorPane.java
  46. 245
      designer_form/src/com/fr/design/widget/ui/designer/DateEditorDefinePane.java
  47. 94
      designer_form/src/com/fr/design/widget/ui/designer/DirectWriteEditorDefinePane.java
  48. 140
      designer_form/src/com/fr/design/widget/ui/designer/FieldEditorDefinePane.java
  49. 83
      designer_form/src/com/fr/design/widget/ui/designer/IframeEditorDefinePane.java
  50. 79
      designer_form/src/com/fr/design/widget/ui/designer/LabelDefinePane.java
  51. 60
      designer_form/src/com/fr/design/widget/ui/designer/ListEditorDefinePane.java
  52. 91
      designer_form/src/com/fr/design/widget/ui/designer/MultiFileEditorPane.java
  53. 25
      designer_form/src/com/fr/design/widget/ui/designer/NoneWidgetDefinePane.java
  54. 313
      designer_form/src/com/fr/design/widget/ui/designer/NumberEditorDefinePane.java
  55. 179
      designer_form/src/com/fr/design/widget/ui/designer/ParameterTreeComboBox.java
  56. 23
      designer_form/src/com/fr/design/widget/ui/designer/PasswordDefinePane.java
  57. 44
      designer_form/src/com/fr/design/widget/ui/designer/RadioDefinePane.java
  58. 48
      designer_form/src/com/fr/design/widget/ui/designer/RadioGroupDefinePane.java
  59. 21
      designer_form/src/com/fr/design/widget/ui/designer/TextAreaDefinePane.java
  60. 128
      designer_form/src/com/fr/design/widget/ui/designer/TextFieldEditorDefinePane.java
  61. 78
      designer_form/src/com/fr/design/widget/ui/designer/TreeComboBoxEditorDefinePane.java
  62. 104
      designer_form/src/com/fr/design/widget/ui/designer/TreeEditorDefinePane.java
  63. 46
      designer_form/src/com/fr/design/widget/ui/designer/UserEditorDefinePane.java
  64. 29
      designer_form/src/com/fr/design/widget/ui/designer/WaterMarkDictPane.java
  65. 26
      designer_form/src/com/fr/design/widget/ui/designer/WritableRepeatEditorPane.java
  66. 51
      designer_form/src/com/fr/design/widget/ui/designer/WriteUnableRepeatEditorPane.java
  67. 64
      designer_form/src/com/fr/design/widget/ui/designer/btn/ButtonDetailPaneFactory.java
  68. 93
      designer_form/src/com/fr/design/widget/ui/designer/btn/ButtonGroupDefinePane.java
  69. 143
      designer_form/src/com/fr/design/widget/ui/designer/btn/ButtonSytleDefinedPane.java
  70. 30
      designer_form/src/com/fr/design/widget/ui/designer/btn/DefaultButtonDetailPane.java
  71. 56
      designer_form/src/com/fr/design/widget/ui/designer/btn/DefaultButtonStylePane.java
  72. 40
      designer_form/src/com/fr/design/widget/ui/designer/btn/FreeButtonDetailPane.java
  73. 82
      designer_form/src/com/fr/design/widget/ui/designer/component/BackgroundCompPane.java
  74. 56
      designer_form/src/com/fr/design/widget/ui/designer/component/FormWidgetValuePane.java
  75. 69
      designer_form/src/com/fr/design/widget/ui/designer/component/PaddingBoundPane.java
  76. 81
      designer_form/src/com/fr/design/widget/ui/designer/component/WidgetAbsoluteBoundPane.java
  77. 77
      designer_form/src/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java
  78. 40
      designer_form/src/com/fr/design/widget/ui/designer/custom/WidgetValueField.java
  79. 33
      designer_form/src/com/fr/design/widget/ui/designer/custom/WidgetValueFormula.java
  80. 17
      designer_form/src/com/fr/design/widget/ui/designer/custom/WidgetValuePane.java
  81. 33
      designer_form/src/com/fr/design/widget/ui/designer/custom/WidgetValueString.java
  82. 219
      designer_form/src/com/fr/design/widget/ui/designer/layout/FRAbsoluteBodyLayoutDefinePane.java
  83. 113
      designer_form/src/com/fr/design/widget/ui/designer/layout/FRAbsoluteLayoutDefinePane.java
  84. 171
      designer_form/src/com/fr/design/widget/ui/designer/layout/FRFitLayoutDefinePane.java
  85. 39
      designer_form/src/com/fr/design/widget/ui/designer/layout/WCardMainLayoutDefinePane.java
  86. 46
      designer_form/src/com/fr/design/widget/ui/designer/layout/WTabFitLayoutDefinePane.java
  87. 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) {
cellEditorDefPane = new WidgetPane(ePane);
this.removeAll();
this.add(cellEditorDefPane, BorderLayout.CENTER);
CellSelection cs = (CellSelection) ePane.getSelection();

15
designer/src/com/fr/design/mainframe/JWorkBook.java

@ -64,6 +64,7 @@ import com.fr.privilege.finegrain.WorkSheetPrivilegeControl;
import com.fr.report.ReportHelper;
import com.fr.report.elementcase.ElementCase;
import com.fr.report.elementcase.TemplateElementCase;
import com.fr.report.poly.PolyWorkSheet;
import com.fr.report.worksheet.WorkSheet;
import com.fr.stable.ArrayUtils;
import com.fr.stable.StableUtils;
@ -109,9 +110,17 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
@Override
public void refreshEastPropertiesPane() {
EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.REPORT);
EastRegionContainerPane.getInstance().replaceCellElementPane(getEastUpPane());
EastRegionContainerPane.getInstance().replaceCellAttrPane(getEastDownPane());
if (isEditingPolySheet()) {
EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.POLY);
} else {
EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.REPORT);
EastRegionContainerPane.getInstance().replaceCellElementPane(getEastUpPane());
EastRegionContainerPane.getInstance().replaceCellAttrPane(getEastDownPane());
}
}
private boolean isEditingPolySheet() {
return template.getReport(getEditingReportIndex()) instanceof PolyWorkSheet;
}
@Override

4
designer/src/com/fr/design/mainframe/SheetNameTabPane.java

@ -23,6 +23,7 @@ import com.fr.base.BaseUtils;
import com.fr.base.GraphHelper;
import com.fr.design.actions.UpdateAction;
import com.fr.design.constants.UIConstants;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.menu.MenuDef;
import com.fr.design.menu.SeparatorDef;
@ -553,6 +554,9 @@ public class SheetNameTabPane extends JComponent implements MouseListener, Mouse
for (int i = scrollIndex; i <= lastOneIndex; i++) {
int textWidth = widthArray[i];
if (evtX >= textX && evtX < textX + textWidth) {
if (getSelectedIndex() != i) {
HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().refreshEastPropertiesPane();
}
setSelectedIndex(i);
isBlank = false;
reportComposite.setComposite();

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

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

7
designer/src/com/fr/poly/PolyDesigner.java

@ -72,8 +72,8 @@ public class PolyDesigner extends ReportComponent<PolyWorkSheet, PolyElementCase
/**
* 选中的类型--1.什么都没选中2.选中一个聚合块内部的内容3.选中聚合块本省
*/
public static enum SelectionType {
NONE, INNER, BLOCK
public enum SelectionType {
NONE, INNER, BLOCK, CHART_INNER
}
public JComponent polyArea;
@ -892,6 +892,9 @@ public class PolyDesigner extends ReportComponent<PolyWorkSheet, PolyElementCase
} else if (isChooseBlock()) {
EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.POLY_CHART);
EastRegionContainerPane.getInstance().replaceWidgetSettingsPane(PolyBlockProperPane.getInstance(PolyDesigner.this));
} else if (type == SelectionType.CHART_INNER) {
EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.POLY_CHART);
EastRegionContainerPane.getInstance().replaceWidgetSettingsPane(getEastUpPane());
} else if (type != SelectionType.NONE) {
EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.POLY_REPORT);
EastRegionContainerPane.getInstance().replaceCellAttrPane(CellElementPropertyPane.getInstance());

8
designer/src/com/fr/poly/creator/ChartBlockEditor.java

@ -122,6 +122,12 @@ public class ChartBlockEditor extends BlockEditor<MiddleChartComponent, PolyChar
protected MiddleChartComponent createEffective() {
if (editComponent == null) {
initEffective(creator.getValue().getChartCollection());
editComponent.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
designer.setChooseType(SelectionType.CHART_INNER);
}
});
}
return editComponent;
}
@ -266,7 +272,7 @@ public class ChartBlockEditor extends BlockEditor<MiddleChartComponent, PolyChar
* 刷新选中状态.日EC
*/
public void resetSelectionAndChooseState() {
designer.setChooseType(SelectionType.BLOCK);
designer.setChooseType(SelectionType.CHART_INNER);
// refreshChartComponent();// 选中之后 刷新下图表编辑层
if (BaseUtils.isAuthorityEditing()) {
JTemplate jTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();

5
designer_base/src/com/fr/design/constants/UIConstants.java

@ -22,6 +22,8 @@ public interface UIConstants {
public static final int SIZE = 17;
public static final int GAP_NORMAL = 10; // 10px
/**
* Cell default cursor.
*/
@ -93,6 +95,7 @@ public interface UIConstants {
public static final Color RULER_LINE_COLOR = new Color(0xababab);
public static final Color RULER_SCALE_COLOR = new Color(0x4e504f);
public static final Color PROPERTY_PANE_BACKGROUND = new Color(0xdadadd);
public static final Color SPLIT_LINE = new Color(201, 198, 184);
public static final BufferedImage DRAG_BAR = BaseUtils.readImage("com/fr/design/images/control/bar.png");
@ -139,7 +142,7 @@ public interface UIConstants {
public static final Icon SEARCH_ICON = BaseUtils.readIcon("/com/fr/design/images/data/search.png");
public static final Icon CLEAR_ICON = BaseUtils.readIcon("/com/fr/design/images/data/source/delete.png");
public static final Icon LIST_EDIT_ICON = BaseUtils.readIcon("/com/fr/design/images/control/edit.png");
public static final Icon LIST_EDIT_WHITE_ICON = BaseUtils.readIcon("/com/fr/design/images/control/edit.png");
public static final Icon LIST_EDIT_WHITE_ICON = BaseUtils.readIcon("/com/fr/design/images/control/edit_white.png");
public static final Color PRESSED_DARK_GRAY = new Color(127, 127, 127);
public static final Color GRDIENT_DARK_GRAY = new Color(45, 45, 45);
public static final Color BARNOMAL = new Color(232, 232, 233);

8
designer_base/src/com/fr/design/gui/controlpane/UIControlPane.java

@ -113,7 +113,7 @@ public abstract class UIControlPane extends BasicPane implements UnrepeatedNameH
// mainSplitPane.setOneTouchExpandable(true);
this.add(getLeftPane(), BorderLayout.CENTER);
this.setBorder(BorderFactory.createEmptyBorder(10, 10, 12, 10));
this.setBorder(BorderFactory.createEmptyBorder(10, 10, 15, 15));
// mainSplitPane.setDividerLocation(getLeftPreferredSize());
this.checkButtonEnabled();
}
@ -161,10 +161,10 @@ public abstract class UIControlPane extends BasicPane implements UnrepeatedNameH
topToolBar.setBorder(BorderFactory.createEmptyBorder(2, 0, 2, 0));
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] columnSize = { p, f };
double[] rowSize = { p};
double[] columnSize = { p, f, 155};
double[] rowSize = {p};
Component[][] components = new Component[][]{
new Component[]{new UILabel(getAddItemText()), topToolBar},
new Component[]{new UILabel(getAddItemText()), null, topToolBar},
};
JPanel leftTopPane = TableLayoutHelper.createTableLayoutPane(components,rowSize,columnSize);
leftTopPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 6, 0));

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

@ -1,20 +1,6 @@
package com.fr.design.gui.frpane;
import java.awt.CardLayout;
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.constants.LayoutConstants;
import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.icombobox.UIComboBox;
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.itextfield.UITextField;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.form.ui.reg.CustomReg;
import com.fr.form.ui.reg.IDCardReg;
import com.fr.form.ui.reg.LengthReg;
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.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.form.ui.reg.*;
import com.fr.general.ComparatorUtils;
import com.fr.general.Inter;
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 static final RegExp[] ALL_REG_TYPE = {
new NoneReg(),
@ -64,6 +55,7 @@ public class RegPane extends BasicPane {
private RegPhonePane regPhonePane;
private DefaultRegPane defaultRegPane;
private CustomRegRexPane customRegRexPane;
protected RegErrorMsgPane regErrorMsgPane;
public UIComboBox getRegComboBox(){
@ -80,14 +72,20 @@ public class RegPane extends BasicPane {
}
private void initComponents(){
this.setLayout(FRGUIPaneFactory.createLabelFlowLayout());
this.setLayout(FRGUIPaneFactory.createBorderLayout());
JPanel contentPane = FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane();
this.add(contentPane);
contentPane.add(new UILabel(Inter.getLocText("FR-Designer_Input_Rule") + ":"));
this.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
this.add(contentPane, BorderLayout.NORTH);
contentPane.add(new UILabel(Inter.getLocText("FR-Designer_Input_Rule")));
regComboBox = new UIComboBox(regType);
regComboBox.setPreferredSize(new Dimension(140, 20));
regComboBox.setRenderer(listCellRender);
UILabel uiLabel = new UILabel();
uiLabel.setPreferredSize(new Dimension(20, 20));
contentPane.add(uiLabel);
contentPane.add(regComboBox);
regErrorMsgPane = new RegErrorMsgPane();
final JPanel cardPane = FRGUIPaneFactory.createCardLayout_S_Pane();
detailedCardLayout = new CardLayout();
cardPane.setLayout(detailedCardLayout);
@ -95,27 +93,35 @@ public class RegPane extends BasicPane {
cardPane.add((regLengthPane = new RegLengthPane()), "Length");
cardPane.add((regPhonePane = new RegPhonePane()), "Phone");
cardPane.add((customRegRexPane = new CustomRegRexPane()), "Custom");
this.add(cardPane);
this.add(cardPane, BorderLayout.CENTER);
this.add(regErrorMsgPane, BorderLayout.SOUTH);
regComboBox.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e) {
RegExp regExp = (RegExp)regComboBox.getSelectedItem();
if(regExp instanceof PhoneReg) {
cardPane.setPreferredSize(new Dimension(220, 30));
Object selectItem = regPhonePane.dataTypeComboBox.getSelectedItem();
String regString = selectItem == null ? StringUtils.EMPTY : selectItem.toString();
firePhoneRegAction(regString);
detailedCardLayout.show(cardPane, "Phone");
}
else {
} else {
if (regExp instanceof LengthReg){
cardPane.setPreferredSize(new Dimension(220, 60));
detailedCardLayout.show(cardPane, "Length");
} else if (regExp instanceof CustomReg){
cardPane.setPreferredSize(new Dimension(220, 30));
detailedCardLayout.show(cardPane, "Custom");
} else {
cardPane.setPreferredSize(new Dimension(0,0 ));
detailedCardLayout.show(cardPane, "Default");
}
fireRegChangeAction();
}
if(regExp instanceof NoneReg){
regErrorMsgPane.setVisible(false);
return;
}
regErrorMsgPane.setVisible(true);
}
});
}
@ -148,11 +154,12 @@ public class RegPane extends BasicPane {
} else {
defaultRegPane.populate(regex);
}
regErrorMsgPane.populate(regex);
}
public RegExp update(){
RegExp regExp = (RegExp)regComboBox.getSelectedItem();
regErrorMsgPane.update();
if (regExp instanceof LengthReg){
return regLengthPane.update();
} 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")};
DefaultComboBoxModel DefaultComboBoxModel= new DefaultComboBoxModel(dataType);
public RegPhonePane() {
this.setBorder(BorderFactory.createEmptyBorder(5, 10, 5, 5));
this.setLayout(FRGUIPaneFactory.createLabelFlowLayout());
this.add(new UILabel(Inter.getLocText("FR-Designer_Data_Type") + ":"));
dataTypeComboBox = new UIComboBox(DefaultComboBoxModel);
@ -394,13 +402,30 @@ public class RegPane extends BasicPane {
private UISpinner maxLenSpinner;
public RegLengthPane(){
this.setLayout(FRGUIPaneFactory.createLabelFlowLayout());
this.add(new UILabel(Inter.getLocText("FR-Designer_Reg_Min_Length") + ":"));
this.setLayout(FRGUIPaneFactory.createBorderLayout());
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);
this.add(minLenSpinner);
this.add(new UILabel(Inter.getLocText("FR-Designer_Reg_Max_Length") + ":"));
// this.add(minLenSpinner);
// this.add(new UILabel(Inter.getLocText("FR-Designer_Reg_Max_Length") + ":"));
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
@ -437,8 +462,9 @@ public class RegPane extends BasicPane {
public CustomRegRexPane(){
this.setLayout(FRGUIPaneFactory.createLabelFlowLayout());
this.setBorder(BorderFactory.createEmptyBorder(5, 10, 5, 5));
this.add(new UILabel(Inter.getLocText("FR-Designer_Reg_Expressions") + ":"));
regTextField = new UITextField(20);
regTextField = new UITextField(10);
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(){
@Override
public Component getListCellRendererComponent(JList list, Object value,

BIN
designer_base/src/com/fr/design/images/control/edit_white.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 250 B

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

@ -2105,3 +2105,14 @@ FR-Designer_Insert_Text=Insert_Text
FR-Designer_Double=Double
FR-Designer_Add_Event=Add Event
FR-Designer_Not_Support_Authority_Edit=this element does not support authority edit
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

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

@ -462,9 +462,9 @@ FR-Designer_Attr_Bidirectional_Adaptive=Bidirectional adaptive
FR-Designer-Selected_Widget=Selected widget
FR-Designer_LocalWidget=Local component library
FR-Designer_AllCategories=All categories
FR-Designer_Download_Template=Download components
FR-Designer_Install_Template=Install components
FR-Designer_Delete_Template=Delete components
FR-Designer_Download_Template=Download
FR-Designer_Install_Template=Install
FR-Designer_Delete_Template=Delete
FR-Designer_Mobile-Refresh=Refresh
FR-Designer_Mobile-ToolBar=Toolbar
FR-Designer_WLayout-Absolute-ToolTips=Freestyle layout, add control in any position of the layout
@ -2106,3 +2106,9 @@ FR-Designer_Scale_Slider=Scale_Slider
FR-Designer_Scale_Grade=Scale_Grade
FR-Designer_Add_Event=Add Event
FR-Designer_Not_Support_Authority_Edit=this element does not support authority edit
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

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

@ -2109,3 +2109,9 @@ FR-Designer_Use_Params_Template=
FR-Designer_Label_Name=
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_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=

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

@ -2109,3 +2109,9 @@ FR-Designer_Use_Params_Template=
FR-Designer_Label_Name=
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_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=

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

@ -467,9 +467,9 @@ FR-Designer_AllCategories=\u6240\u6709\u5206\u7C7B
FR-Designer_SimpleDetail_Report=\u7B80\u5355\u660E\u7EC6\u8868
FR-Designer_SimpleCross_Report=\u7B80\u5355\u4EA4\u53C9\u8868
FR-Designer_DoubleLayer_Report=\u53CC\u5C42\u8868\u5934
FR-Designer_Download_Template=\u4E0B\u8F7D\u7EC4\u4EF6
FR-Designer_Install_Template=\u5B89\u88C5\u7EC4\u4EF6
FR-Designer_Delete_Template=\u5220\u9664\u7EC4\u4EF6
FR-Designer_Download_Template=\u4E0B\u8F7D
FR-Designer_Install_Template=\u5B89\u88C5
FR-Designer_Delete_Template=\u5220\u9664
FR-Designer_Mobile-ToolBar=\u5DE5\u5177\u680F
FR-Designer_Mobile-Refresh=\u5237\u65B0
FR-Designer_WLayout-Absolute-ToolTips=\u81EA\u7531\u5F0F\u5E03\u5C40\uFF0C\u53EF\u4EE5\u5728\u5E03\u5C40\u5185\u4EFB\u610F\u4F4D\u7F6E\u6DFB\u52A0\u63A7\u4EF6
@ -2112,3 +2112,14 @@ FR-Designer_Scale_Up=\u653E\u5927
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_Not_Support_Authority_Edit=\u8BE5\u5143\u7D20\u4E0D\u652F\u6301\u6743\u9650\u63A7\u5236
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

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

@ -2109,3 +2109,9 @@ FR-Designer_Use_Params_Template=
FR-Designer_Label_Name=
FR-Designer_Add_Event=
FR-Designer_Not_Support_Authority_Edit=\u8A72\u5143\u7D20\u4E0D\u652F\u63F4\u8A31\u53EF\u6B0A\u63A7\u5236
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=

2
designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java

@ -28,7 +28,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
private JPanel leftPane;
private JPanel rightPane;
private FixedPopupPane currentPopupPane;
private static final int CONTAINER_WIDTH = 288;
private static final int CONTAINER_WIDTH = 286;
private static final int TAB_WIDTH = 38;
private static final int TAB_BUTTON_WIDTH = 32;
private static final int TAB_BUTTON_HEIGHT = 28;

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

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

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

@ -144,5 +144,9 @@ public class XBorderStyleWidgetCreator extends XWidgetCreator{
}
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 boolean
*/
public boolean supportSetVisibleOrEnable(){
return true;
}
/**
* 重新设置data
*
*/
public void resetData(Widget data){
this.data = data;
}
}

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

@ -156,5 +156,9 @@ public class XWScaleLayout extends DedicateLayoutContainer {
XCreator child = getXCreator(INDEX);
child.setSize(getWidth(), minHeight);
}
public boolean supportSetVisibleOrEnable(){
return true;
}
}

6
designer_form/src/com/fr/design/form/parameter/FormParaDesigner.java

@ -113,8 +113,10 @@ public class FormParaDesigner extends FormDesigner implements ParameterDesignerP
EastRegionContainerPane.getInstance().replaceWidgetLibPane(
FormWidgetDetailPane.getInstance(this));
if (!BaseUtils.isAuthorityEditing()) {
EastRegionContainerPane.getInstance().addParameterPane(ParameterPropertyPane.getInstance(this));
EastRegionContainerPane.getInstance().setParameterHeight(ParameterPropertyPane.getInstance(this).getPreferredSize().height);
ParameterPropertyPane parameterPropertyPane = ParameterPropertyPane.getInstance(this);
parameterPropertyPane.setAddParaPaneVisible(true);
EastRegionContainerPane.getInstance().addParameterPane(parameterPropertyPane);
EastRegionContainerPane.getInstance().setParameterHeight(parameterPropertyPane.getPreferredSize().height);
EastRegionContainerPane.getInstance().replaceWidgetSettingsPane(
WidgetPropertyPane.getInstance(this));
} else {

239
designer_form/src/com/fr/design/mainframe/FormHierarchyTreePane.java

@ -1,12 +1,24 @@
package com.fr.design.mainframe;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.util.ArrayList;
import javax.swing.BorderFactory;
import javax.swing.Icon;
import javax.swing.*;
import com.fr.design.actions.UndoableAction;
import com.fr.design.actions.UpdateAction;
import com.fr.design.designer.beans.actions.ChangeNameAction;
import com.fr.design.designer.beans.actions.FormUndoableAction;
import com.fr.design.designer.creator.XWAbsoluteBodyLayout;
import com.fr.design.gui.controlpane.ShortCut4JControlPane;
import com.fr.design.gui.controlpane.UIListControlPane;
import com.fr.design.gui.itoolbar.UIToolBarUI;
import com.fr.design.gui.itoolbar.UIToolbar;
import com.fr.design.mainframe.widget.UITreeComboBox;
import com.fr.design.menu.ShortCut;
import com.fr.design.menu.ToolBarDef;
import com.fr.design.parameter.HierarchyTreePane;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XWParameterLayout;
@ -14,11 +26,6 @@ import com.fr.design.designer.treeview.ComponentTreeModel;
import com.fr.design.gui.ilable.UILabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.SwingConstants;
import com.fr.base.BaseUtils;
import com.fr.general.Inter;
@ -34,11 +41,10 @@ public class FormHierarchyTreePane extends FormDockView implements HierarchyTree
public static final int PARA = 0;
public static final int BODY = 1;
private ShortCut4JControlPane[] shorts;
private ComponentTree componentTree;
private UITreeComboBox treeComboBox;
// richer:搜寻树节点的的文本框
// private UITextField searchTextField;
// private SearchResultPane searchResult;
private ChangeNameAction changeVarNameAction;
public static FormHierarchyTreePane getInstance() {
return HOLDER.singleton;
@ -77,9 +83,6 @@ public class FormHierarchyTreePane extends FormDockView implements HierarchyTree
*/
public void clearDockingView() {
this.componentTree = null;
// this.searchTextField = null;
// this.searchResult = null;
// add(new JScrollPane(), BorderLayout.CENTER);
}
@Override
@ -108,51 +111,60 @@ public class FormHierarchyTreePane extends FormDockView implements HierarchyTree
if(childCount == NODE_LENGTH){
adjustPosition(treeModel, formDesigner);
}
add(getWidgetPane(), BorderLayout.CENTER);
}
private JPanel getWidgetPane() {
shorts = createShortcuts();
JPanel widgetPane = new JPanel();
widgetPane.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0));
widgetPane.setLayout(FRGUIPaneFactory.createBorderLayout());
add(widgetPane, BorderLayout.NORTH);
widgetPane.add(new UILabel(Inter.getLocText("FR-Designer-Selected_Widget") + " ",
JPanel headPane = new JPanel(new BorderLayout());
headPane.add(new UILabel(Inter.getLocText("FR-Designer-Selected_Widget") + " ",
SwingConstants.HORIZONTAL), BorderLayout.WEST);
headPane.add(getToolBarPane(), BorderLayout.EAST);
widgetPane.add(headPane, BorderLayout.CENTER);
treeComboBox = new UITreeComboBox(componentTree);
widgetPane.add(treeComboBox, BorderLayout.CENTER);
add(widgetPane, BorderLayout.CENTER);
// UIScrollPane scrollPane = new UIScrollPane(componentTree);
// scrollPane.setBorder(null);
// add(scrollPane, BorderLayout.CENTER);
// JPanel searchPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
// add(searchPane, BorderLayout.NORTH);
// searchPane.add(new UILabel(Inter.getLocText("FR-Designer_Search") + ":",
// SwingConstants.HORIZONTAL), BorderLayout.WEST);
// searchTextField = new UITextField();
// searchPane.add(searchTextField, BorderLayout.CENTER);
// searchTextField.getDocument().addDocumentListener(new DocumentListener() {
// @Override
// public void insertUpdate(DocumentEvent e) {
// search();
// }
//
// @Override
// public void removeUpdate(DocumentEvent e) {
// search();
// }
//
// @Override
// public void changedUpdate(DocumentEvent e) {
// search();
// }
//
// private void search() {
// String text = searchTextField.getText();
// if (StringUtils.isEmpty(text)) {
// removeSearchResult();
// } else {
// populate(componentTree.search(text));
// }
// }
// });
widgetPane.add(treeComboBox, BorderLayout.SOUTH);
return widgetPane;
}
private JPanel getToolBarPane() {
ToolBarDef toolbarDef = new ToolBarDef();
for (ShortCut4JControlPane sj : shorts) {
toolbarDef.addShortCut(sj.getShortCut());
}
UIToolbar toolBar = ToolBarDef.createJToolBar();
toolBar.setUI(new UIToolBarUI(){
@Override
public void paint(Graphics g, JComponent c) {
Graphics2D g2 = (Graphics2D) g;
g2.setColor(new Color(245, 245, 247));
g2.fillRect(0, 0, c.getWidth(), c.getHeight());
}
});
toolbarDef.updateToolBar(toolBar);
JPanel toolBarPane = new JPanel(new BorderLayout());
toolBarPane.add(toolBar, BorderLayout.CENTER);
return toolBarPane;
}
protected ShortCut4JControlPane[] createShortcuts() {
ArrayList<ShortCut4JControlPane> shortCutList = new ArrayList<>();
FormDesigner designer = getEditingFormDesigner();
if (changeVarNameAction == null) {
changeVarNameAction = new ChangeNameAction(designer);
}
shortCutList.add(new WidgetEnableShortCut(changeVarNameAction));
for (Action action : designer.getActions()) {
shortCutList.add(new WidgetEnableShortCut((UndoableAction)action));
}
return shortCutList.toArray(new ShortCut4JControlPane[shortCutList.size()]);
}
/**
@ -188,113 +200,6 @@ public class FormHierarchyTreePane extends FormDockView implements HierarchyTree
componentTree.refreshTreeRoot();
}
/**
* 删除搜索结果
*/
// public void removeSearchResult() {
// componentTree.setSelectionPath(null);
// if (searchResult != null) {
// this.remove(searchResult);
// }
// }
//
// public void populate(TreePath[] treepath) {
// if (this.searchResult == null) {
// searchResult = new SearchResultPane();
// }
// if (((BorderLayout) getLayout()).getLayoutComponent(BorderLayout.SOUTH) == null) {
// add(searchResult, BorderLayout.SOUTH);
// }
// searchResult.populate(treepath);
// }
// private class SearchResultPane extends JPanel {
// private UILabel resultLabel = new UILabel();
// private BackAction backAction = new BackAction();
// private ForWardAction forwardAction = new ForWardAction();
// private TreePath[] tree;
// private int number = 0;
//
// SearchResultPane() {
// this.setLayout(FRGUIPaneFactory.createBorderLayout());
// JPanel actionJPanel = FRGUIPaneFactory.createCenterFlowInnerContainer_S_Pane();
// addButtonToJPanel(actionJPanel, backAction.createToolBarComponent());
// addButtonToJPanel(actionJPanel, forwardAction.createToolBarComponent());
//
// this.add(actionJPanel, BorderLayout.EAST);
// this.add(resultLabel, BorderLayout.WEST);
// }
//
// private void addButtonToJPanel(JPanel actionLabel,
// JComponent toolBarComponent) {
// actionLabel.add(toolBarComponent);
// if (toolBarComponent instanceof UIButton) {
// toolBarComponent.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
// }
// }
//
// public void populate(TreePath[] search) {
// tree = search;
// resultLabel.setText(Inter.getLocText("FR-Designer_Total") + ":" + tree.length);
// number = 0;
// check();
// }
//
// public void next() {
// if (number < tree.length - 1) {
// componentTree.setAndScrollSelectionPath(tree[++number]);
// }
// check();
// }
//
// public void last() {
// if (number > 0) {
// componentTree.setAndScrollSelectionPath(tree[--number]);
// }
// check();
// }
//
// public void check() {
// if (tree.length < 1) {
// backAction.setEnabled(false);
// forwardAction.setEnabled(false);
// } else {
// backAction.setEnabled(number > 0);
// forwardAction.setEnabled(number < tree.length - 1);
// }
//
// }
//}
// private class BackAction extends UpdateAction {
//
// public BackAction() {
// this.setName(Inter.getLocText("Form-Hierarchy_Tree_Last"));
// this.setSmallIcon(BaseUtils
// .readIcon("com/fr/design/images/m_help/back.png"));
// this.setEnabled(false);
// }
//
// public void actionPerformed(ActionEvent e) {
// searchResult.last();
// }
// }
//
// private class ForWardAction extends UpdateAction {
//
// public ForWardAction() {
// this.setName(Inter.getLocText("Form-Hierarchy_Tree_Next"));
// this.setSmallIcon(BaseUtils
// .readIcon("com/fr/design/images/m_help/forward.png"));
// this.setEnabled(false);
// }
//
// public void actionPerformed(ActionEvent e) {
// searchResult.next();
// }
// }
@Override
/**
* 位置
@ -304,4 +209,18 @@ public class FormHierarchyTreePane extends FormDockView implements HierarchyTree
public Location preferredLocation() {
return Location.WEST_BELOW;
}
private class WidgetEnableShortCut extends ShortCut4JControlPane {
public WidgetEnableShortCut(ShortCut shortCut) {
this.shortCut = shortCut;
}
/**
* 检查是否可用
*/
@Override
public void checkEnable() {
this.shortCut.setEnabled(false);
}
}
}

265
designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java

@ -4,11 +4,13 @@ import com.fr.base.BaseUtils;
import com.fr.base.FRContext;
import com.fr.design.gui.frpane.UITabbedPane;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ibutton.UIHeadGroup;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.imenu.UIMenuItem;
import com.fr.design.gui.imenu.UIPopupMenu;
import com.fr.design.icon.IconPathConstants;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.form.share.ShareLoader;
@ -40,7 +42,7 @@ import java.net.URISyntaxException;
*/
public class FormWidgetDetailPane extends FormDockView{
private UITabbedPane tabbedPane;
private JPanel tabbedPane;
private UIScrollPane downPane;
private JPanel reuWidgetPanel;
private UIComboBox comboBox;
@ -50,11 +52,16 @@ public class FormWidgetDetailPane extends FormDockView{
private JPanel editPanel;
private JPanel resetPanel;
private JPanel menutPanel;
private JPanel menutPanelNorthPane;
private static final int OFFSET_X = 140;
private static final int OFFSET_Y = 26;
private SwingWorker sw;
//组件面板是否可以编辑
private boolean isEdit;
private CardLayout card;
private static final String REPORT_TAB = Inter.getLocText("FR-Engine_Report");
private static final String CHART_TAB = Inter.getLocText("FR-Designer-Form-ToolBar_Chart");
public static FormWidgetDetailPane getInstance() {
if (HOLDER.singleton == null) {
@ -115,12 +122,21 @@ public class FormWidgetDetailPane extends FormDockView{
}
initReuWidgetPanel();
initMenuPanel();
tabbedPane = new UITabbedPane();
tabbedPane.setOpaque(true);
tabbedPane.setBorder(null);
tabbedPane.setTabPlacement(SwingConstants.BOTTOM);
tabbedPane.addTab(Inter.getLocText("FR-Engine_Report"), reuWidgetPanel);
tabbedPane.addTab(Inter.getLocText("FR-Designer-Form-ToolBar_Chart"), new JPanel());
card = new CardLayout();
tabbedPane = new JPanel();
tabbedPane.setLayout(card);
tabbedPane.add(REPORT_TAB, reuWidgetPanel);
tabbedPane.add(CHART_TAB, new JPanel());
UIHeadGroup tabsHeaderIconPane = new UIHeadGroup(new String[] {REPORT_TAB, CHART_TAB}) {
@Override
public void tabChanged(int index) {
card.show(tabbedPane, labelButtonList.get(index).getText());
}
};
tabsHeaderIconPane.setNeedLeftRightOutLine(false);
add(tabsHeaderIconPane, BorderLayout.NORTH);
add(tabbedPane, BorderLayout.CENTER);
}
@ -140,17 +156,20 @@ public class FormWidgetDetailPane extends FormDockView{
private void initMenuPanel() {
menutPanel = new JPanel();
menutPanel.setLayout(FRGUIPaneFactory.createBorderLayout());
menutPanel.setBorder(BorderFactory.createEmptyBorder(3, 8, 3, 3));
menutPanel.setPreferredSize(new Dimension(240, 48));
menutPanel.add(new UILabel(Inter.getLocText("FR-Designer_LocalWidget"),
menutPanel.setBorder(BorderFactory.createEmptyBorder(3, 10, 10, 15));
// menutPanel.setPreferredSize(new Dimension(240, 48));
menutPanelNorthPane = new JPanel(new BorderLayout());
menutPanelNorthPane.add(new UILabel(Inter.getLocText("FR-Designer_LocalWidget"),
SwingConstants.HORIZONTAL), BorderLayout.WEST);
menutPanelNorthPane.add(initEditButtonPane(), BorderLayout.EAST);
menutPanelNorthPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 0));
menutPanel.add(initEditButtonPane(), BorderLayout.EAST);
menutPanel.add(new JPanel(), BorderLayout.CENTER);
menutPanel.add(menutPanelNorthPane, BorderLayout.NORTH);
comboBox = new UIComboBox(getFormCategories());
comboBox.setPreferredSize(new Dimension(240, 30));
comboBox.setPreferredSize(new Dimension(240, comboBox.getPreferredSize().height));
initComboBoxSelectedListener();
menutPanel.add(comboBox, BorderLayout.SOUTH);
menutPanel.add(comboBox, BorderLayout.CENTER);
reuWidgetPanel.add(menutPanel, BorderLayout.NORTH);
}
@ -159,10 +178,13 @@ public class FormWidgetDetailPane extends FormDockView{
* 创建菜单栏按钮面板
*/
private JPanel initEditButtonPane() {
editPanel = new JPanel();
editPanel.setLayout(FRGUIPaneFactory.createBorderLayout());
editPanel.add(createRefreshButton(), BorderLayout.WEST);
editPanel.add(createDownloadButton(), BorderLayout.EAST);
editPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT, 0, 0));
editPanel.add(createRefreshButton());
editPanel.add(createDownloadButton());
editPanel.add(createInstallButton());
editPanel.add(createDeleteButton());
return editPanel;
}
@ -185,8 +207,38 @@ public class FormWidgetDetailPane extends FormDockView{
reuWidgetPanel.remove(deleteButton);
}
});
deleteButton = new UIButton(Inter.getLocText("FR-Designer_Remove_Item"));
deleteButton.set4ToolbarButton();
deleteButton.setOpaque(true);
deleteButton.setBackground(Color.red);
deleteButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (ShareLoader.getLoader().removeModulesFromList()) {
refreshShareMoudule();
reuWidgetPanel.remove(deleteButton);
elCaseBindInfoList = ShareLoader.getLoader().getAllBindInfoList();
JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Share_Module_Removed_Successful"));
refreshDownPanel(false);
replaceButtonPanel(false);
refreshComboxData();
} else {
JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Share_Module_Removed_Failed"));
}
}
});
JPanel deletePane = new JPanel(new BorderLayout());
deletePane.add(deleteButton, BorderLayout.CENTER);
deletePane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 5));
resetPanel.setLayout(FRGUIPaneFactory.createBorderLayout());
resetPanel.add(resetButton, BorderLayout.CENTER);
resetPanel.add(deletePane, BorderLayout.WEST);
refreshDownPanel(true);
return resetPanel;
}
@ -210,35 +262,46 @@ public class FormWidgetDetailPane extends FormDockView{
});
}
/**
* 创建工具条按钮
*/
private UIButton createToolButton(Icon icon, String toolTip, ActionListener actionListener) {
UIButton toolButton = new UIButton();
toolButton.setIcon(icon);
toolButton.setToolTipText(toolTip);
toolButton.set4ToolbarButton();
toolButton.addActionListener(actionListener);
return toolButton;
}
/**
* 创建刷新按钮
*/
private UIButton createRefreshButton() {
UIButton refreshButton = new UIButton();
refreshButton.setIcon(BaseUtils.readIcon("/com/fr/design/form/images/refresh.png"));
refreshButton.setToolTipText(Inter.getLocText("FR-Designer_Refresh"));
refreshButton.set4ToolbarButton();
refreshButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (sw != null) {
sw.cancel(true);
}
sw = new SwingWorker() {
return createToolButton(
BaseUtils.readIcon("/com/fr/design/form/images/refresh.png"),
Inter.getLocText("FR-Designer_Refresh"),
new ActionListener() {
@Override
protected Object doInBackground() throws Exception {
ShareLoader.getLoader().refreshModule();
elCaseBindInfoList = ShareLoader.getLoader().getAllBindInfoList();
refreshComboxData();
refreshDownPanel(false);
return null;
public void actionPerformed(ActionEvent e) {
if (sw != null) {
sw.cancel(true);
}
sw = new SwingWorker() {
@Override
protected Object doInBackground() throws Exception {
ShareLoader.getLoader().refreshModule();
elCaseBindInfoList = ShareLoader.getLoader().getAllBindInfoList();
refreshComboxData();
refreshDownPanel(false);
return null;
}
};
sw.execute();
}
};
sw.execute();
}
});
return refreshButton;
}
);
}
private void refreshComboxData() {
@ -251,30 +314,10 @@ public class FormWidgetDetailPane extends FormDockView{
*/
private UIButton createDownloadButton() {
UIButton downloadButton = new UIButton();
downloadButton.setIcon(BaseUtils.readIcon("/com/fr/design/form/images/showmenu.png"));
downloadButton.setIcon(BaseUtils.readIcon("/com/fr/design/form/images/download icon.png"));
downloadButton.set4ToolbarButton();
downloadButton.setToolTipText(Inter.getLocText("FR-Designer_Download_Template"));
downloadButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
initPopMenu();
}
});
return downloadButton;
}
/**
* 初始化下拉面板
*/
private void initPopMenu() {
UIPopupMenu menu = new UIPopupMenu();
UIMenuItem downloadItem = new UIMenuItem(Inter.getLocText("FR-Designer_Download_Template"), BaseUtils.readIcon("/com/fr/design/form/images/download icon.png"));
UIMenuItem installItem = new UIMenuItem(Inter.getLocText("FR-Designer_Install_Template"), BaseUtils.readIcon("/com/fr/design/form/images/install icon.png"));
UIMenuItem deleteItem = new UIMenuItem(Inter.getLocText("FR-Designer_Delete_Template"), BaseUtils.readIcon("/com/fr/design/form/images/delete icon.png"));
menu.add(downloadItem);
menu.add(installItem);
menu.add(deleteItem);
downloadItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
String url = SiteCenter.getInstance().acquireUrlByKind("reuse.url");
@ -295,68 +338,58 @@ public class FormWidgetDetailPane extends FormDockView{
}
}
});
installItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
JFileChooser fileChooser = new JFileChooser();
fileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
fileChooser.setFileFilter(new FileNameExtensionFilter(".reu", "reu"));
int returnValue = fileChooser.showDialog(new UILabel(), Inter.getLocText("FR-Designer_Select"));
if (returnValue == JFileChooser.APPROVE_OPTION) {
final File chosenFile = fileChooser.getSelectedFile();
installFromDiskZipFile(chosenFile);
}
}
});
deleteItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
replaceButtonPanel(true);
deleteFromDiskZipFile();
}
});
GUICoreUtils.showPopupMenu(menu, tabbedPane, tabbedPane.getX() + OFFSET_X, OFFSET_Y);
return downloadButton;
}
private void deleteFromDiskZipFile() {
deleteButton = new UIButton(Inter.getLocText("FR-Designer-CommitTab_Remove"));
deleteButton.setBackground(Color.red);
deleteButton.repaint();
deleteButton.setPreferredSize(new Dimension(240, 40));
reuWidgetPanel.add(deleteButton, BorderLayout.SOUTH);
deleteButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (ShareLoader.getLoader().removeModulesFromList()) {
refreshShareMoudule();
reuWidgetPanel.remove(deleteButton);
elCaseBindInfoList = ShareLoader.getLoader().getAllBindInfoList();
JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Share_Module_Removed_Successful"));
refreshDownPanel(false);
replaceButtonPanel(false);
refreshComboxData();
} else {
JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Share_Module_Removed_Failed"));
/**
* 创建安装模板的按钮
*/
private UIButton createInstallButton() {
return createToolButton(
BaseUtils.readIcon("/com/fr/design/form/images/install icon.png"),
Inter.getLocText("FR-Designer_Install_Template"),
new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
JFileChooser fileChooser = new JFileChooser();
fileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
fileChooser.setFileFilter(new FileNameExtensionFilter(".reu", "reu"));
int returnValue = fileChooser.showDialog(new UILabel(), Inter.getLocText("FR-Designer_Select"));
if (returnValue == JFileChooser.APPROVE_OPTION) {
final File chosenFile = fileChooser.getSelectedFile();
installFromDiskZipFile(chosenFile);
}
}
}
);
}
}
});
refreshDownPanel(true);
/**
* 创建删除模板的按钮
*/
private UIButton createDeleteButton() {
return createToolButton(
BaseUtils.readIcon("/com/fr/design/form/images/delete icon.png"),
Inter.getLocText("FR-Designer_Delete_Template"),
new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
replaceButtonPanel(true);
}
}
);
}
private void replaceButtonPanel(boolean isEdit) {
this.isEdit = isEdit;
if (isEdit) {
menutPanel.remove(editPanel);
menutPanel.add(initResetButtonPane(), BorderLayout.EAST);
menutPanelNorthPane.remove(editPanel);
menutPanelNorthPane.add(initResetButtonPane(), BorderLayout.EAST);
} else {
menutPanel.remove(resetPanel);
menutPanel.add(initEditButtonPane(), BorderLayout.EAST);
menutPanelNorthPane.remove(resetPanel);
menutPanelNorthPane.add(initEditButtonPane(), BorderLayout.EAST);
ShareLoader.getLoader().resetRemovedModuleList();
}
}
private void installFromDiskZipFile(File chosenFile) {
@ -393,8 +426,6 @@ public class FormWidgetDetailPane extends FormDockView{
return ArrayUtils.addAll(new String[] {Inter.getLocText("FR-Designer_AllCategories")}, ShareLoader.getLoader().getModuleCategory());
}
public void refreshDownPanel(boolean isEdit) {
reuWidgetPanel.remove(downPane);
downPane = new UIScrollPane(new ShareWidgetPane(elCaseBindInfoList, isEdit));
@ -409,12 +440,6 @@ public class FormWidgetDetailPane extends FormDockView{
revalidate();
}
public void setSelectedIndex(int index){
tabbedPane.setSelectedIndex(index);
}
/**
* 清除数据
*/

9
designer_form/src/com/fr/design/mainframe/JForm.java

@ -300,8 +300,10 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm {
private void setPropertyPaneChange(XComponent comp) {
if (comp == null) {
ParameterPropertyPane.getInstance().setAddParaPaneVisible(false);
return;
}
ParameterPropertyPane.getInstance().setAddParaPaneVisible(comp instanceof XWParameterLayout);
editingComponent = comp.createToolPane(this, formDesign);
EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.FORM);
if (BaseUtils.isAuthorityEditing()) {
@ -677,8 +679,11 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm {
EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.FORM);
EastRegionContainerPane.getInstance().replaceWidgetSettingsPane(WidgetPropertyPane.getInstance(formDesign));
EastRegionContainerPane.getInstance().addParameterPane(ParameterPropertyPane.getInstance(formDesign));
EastRegionContainerPane.getInstance().setParameterHeight(ParameterPropertyPane.getInstance(formDesign).getPreferredSize().height);
ParameterPropertyPane parameterPropertyPane = ParameterPropertyPane.getInstance(formDesign);
parameterPropertyPane.setAddParaPaneVisible(false);
EastRegionContainerPane.getInstance().addParameterPane(parameterPropertyPane);
EastRegionContainerPane.getInstance().setParameterHeight(parameterPropertyPane.getPreferredSize().height);
if (EastRegionContainerPane.getInstance().getWidgetLibPane() == null) {
new Thread() {
public void run() {

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

15
designer_form/src/com/fr/design/mainframe/widget/UITreeComboBox.java

@ -80,6 +80,19 @@ public class UITreeComboBox extends JComboBox{
setUI(cui);
}
private void refreshShortCuts() {
TreePath path = this.getTree().getSelectionPath();
if (path == null) {
return;
}
Component component = (Component) path.getLastPathComponent();
if (!(component instanceof XCreator)) {
return;
}
com.fr.design.designer.beans.ComponentAdapter adapter = AdapterBus.getComponentAdapter(this.getTree().getDesigner(), (XCreator) component);
adapter.getContextPopupMenu(null);
}
// UI Inner classes -- one for each supported Look and Feel
class MetalJTreeComboBoxUI extends MetalComboBoxUI{
protected ComboPopup createPopup() {
@ -152,7 +165,7 @@ public class UITreeComboBox extends JComboBox{
tree.refreshUI();
repaint();
}
refreshShortCuts();
}
@Override

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 "";
}
}

47
designer_form/src/com/fr/design/parameter/ParameterPropertyPane.java

@ -1,5 +1,6 @@
package com.fr.design.parameter;
import com.fr.design.constants.UIConstants;
import com.fr.design.dialog.BasicScrollPane;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.mainframe.FormDesigner;
@ -14,11 +15,14 @@ import java.awt.event.MouseEvent;
public class ParameterPropertyPane extends JPanel{
private ParameterToolBarPane toolbarPane;
private BasicScrollPane basicScrollPane;
private ParaDefinitePane paraPane;
private JPanel formHierarchyTreePaneWrapper; // 封装一层,加边框
private JPanel addParaPane;
public static ParameterPropertyPane THIS;
private static ParameterPropertyPane THIS;
private boolean isEditing = false;
private static final int HIDE_HEIGHT = 40;
public static final ParameterPropertyPane getInstance() {
if(THIS == null) {
@ -43,7 +47,7 @@ public class ParameterPropertyPane extends JPanel{
public ParameterPropertyPane() {
toolbarPane = new ParameterToolBarPane();
basicScrollPane = new BasicScrollPane() {
BasicScrollPane basicScrollPane = new BasicScrollPane() {
@Override
protected JPanel createContentPane() {
return toolbarPane;
@ -59,15 +63,42 @@ public class ParameterPropertyPane extends JPanel{
return null;
}
};
initParameterListener();
JPanel scrollPaneWrapperInner = new JPanel(new BorderLayout());
scrollPaneWrapperInner.setBorder(BorderFactory.createEmptyBorder(0, 10, 10, 5));
scrollPaneWrapperInner.add(basicScrollPane, BorderLayout.CENTER);
addParaPane = new JPanel(new BorderLayout());
addParaPane.add(scrollPaneWrapperInner, BorderLayout.CENTER);
addParaPane.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, UIConstants.SPLIT_LINE));
initParameterListener();
this.setLayout(new BorderLayout(0, 6));
this.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0));
this.add(basicScrollPane, BorderLayout.CENTER);
this.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0));
this.add(addParaPane, BorderLayout.CENTER);
}
public void setAddParaPaneVisible(boolean isVisible) {
if (isVisible == addParaPane.isVisible()) {
return;
}
if (isVisible && toolbarPane.hasSelectedLabelItem()) {
addParaPane.setVisible(true);
this.setPreferredSize(null);
} else {
addParaPane.setVisible(false);
this.setPreferredSize(new Dimension(getWidth(), formHierarchyTreePaneWrapper.getPreferredSize().height + UIConstants.GAP_NORMAL));
}
repaintContainer();
}
private void setEditor(FormDesigner editor) {
this.remove(FormHierarchyTreePane.getInstance());
this.add(FormHierarchyTreePane.getInstance(editor), BorderLayout.NORTH);
if (formHierarchyTreePaneWrapper == null) {
formHierarchyTreePaneWrapper = new JPanel(new BorderLayout());
formHierarchyTreePaneWrapper.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 15));
this.add(formHierarchyTreePaneWrapper, BorderLayout.SOUTH);
}
formHierarchyTreePaneWrapper.remove(FormHierarchyTreePane.getInstance());
formHierarchyTreePaneWrapper.add(FormHierarchyTreePane.getInstance(editor), BorderLayout.CENTER);
}
private void initParameterListener() {

4
designer_form/src/com/fr/design/parameter/ParameterToolBarPane.java

@ -57,6 +57,10 @@ public class ParameterToolBarPane extends BasicBeanPane<Parameter[]> {
}
public boolean hasSelectedLabelItem() {
return !parameterSelectedLabellist.isEmpty();
}
@Override
protected String title4PopupWindow() {
return null;

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