Browse Source

Merging in latest from upstream (BA/design:refs/heads/9.0)

* commit '72c8a02c11a486138be98e0a9fcfc956bc6d5305': (36 commits)
  merge
  代码修改
  REPORT-3293 9.0设计器控件设置重画
  REPORT-3163 合作开发9.0设计器=>聚合报表=》代码规范
  REPORT-3163 合作开发9.0设计器=>聚合报表=》点击报表块内的单元格时,替换控件设置tab页
  REPORT-3163 合作开发9.0设计器=>聚合报表=》去掉无用import
  REPORT-3163 合作开发9.0设计器=>聚合报表=》国际化;边距调整
  REPORT-3163 合作开发9.0设计器=>聚合报表=》控件名称面板
  REPORT-3163 合作开发9.0设计器=>聚合报表=》坐标尺寸
  tree background
  代码上传
  解决冲突
  解决冲突
  REPORT-3293 9.0设计器控件设置重画
  REPORT-2897 9.0设计器修改 去掉空格,放个空的uilabel做对齐
  fix
  REPORT-2897 9.0设计器修改 视觉微调
  REPORT-2897 9.0设计器修改 去掉空格,放个空的uilabel做对齐
  REPORT-2897 9.0设计器修改 去掉空格,放个空的uilabel做对齐
  REPORT-3410
  ...
master
yaoh.wu 7 years ago
parent
commit
51f89068c4
  1. 115
      designer/src/com/fr/design/expand/ExpandFatherPane.java
  2. 2
      designer/src/com/fr/design/mainframe/CellElementPropertyPane.java
  3. 11
      designer/src/com/fr/design/mainframe/CellWidgetPropertyPane.java
  4. 15
      designer/src/com/fr/design/mainframe/JWorkBook.java
  5. 9
      designer/src/com/fr/design/mainframe/ReportFloatPane.java
  6. 4
      designer/src/com/fr/design/mainframe/SheetNameTabPane.java
  7. 13
      designer/src/com/fr/design/mainframe/cell/CellElementEditPane.java
  8. 431
      designer/src/com/fr/design/mainframe/cell/settingpane/CellExpandAttrPane.java
  9. 204
      designer/src/com/fr/design/mainframe/cell/settingpane/CellStylePane.java
  10. 2
      designer/src/com/fr/design/mainframe/cell/settingpane/style/CustomStylePane.java
  11. 2
      designer/src/com/fr/design/mainframe/cell/settingpane/style/PredefinedStylePane.java
  12. 8
      designer/src/com/fr/design/present/PresentPane.java
  13. 14
      designer/src/com/fr/design/widget/CellWidgetCardPane.java
  14. 31
      designer/src/com/fr/design/widget/WidgetPane.java
  15. 36
      designer/src/com/fr/design/widget/ui/BasicWidgetPropertySettingPane.java
  16. 42
      designer/src/com/fr/design/widget/ui/FieldEditorDefinePane.java
  17. 85
      designer/src/com/fr/design/widget/ui/WaterMarkDictPane.java
  18. 7
      designer/src/com/fr/grid/selection/CellSelection.java
  19. 5
      designer/src/com/fr/grid/selection/FloatSelection.java
  20. 2
      designer/src/com/fr/grid/selection/Selection.java
  21. 94
      designer/src/com/fr/poly/PolyBlockProperTable.java
  22. 7
      designer/src/com/fr/poly/PolyDesigner.java
  23. 8
      designer/src/com/fr/poly/creator/ChartBlockEditor.java
  24. 2
      designer/src/com/fr/poly/creator/ECBlockEditor.java
  25. 2
      designer/src/com/fr/quickeditor/floatquick/FloatImageQuickEditor.java
  26. 3
      designer/src/com/fr/quickeditor/floatquick/FloatStringQuickEditor.java
  27. 14
      designer_base/src/com/fr/design/constants/UIConstants.java
  28. 2
      designer_base/src/com/fr/design/data/datapane/TableDataTree.java
  29. 31
      designer_base/src/com/fr/design/foldablepane/HeaderPane.java
  30. 3
      designer_base/src/com/fr/design/foldablepane/UIExpandablePane.java
  31. 20
      designer_base/src/com/fr/design/formula/TinyFormulaPane.java
  32. 8
      designer_base/src/com/fr/design/gui/controlpane/UIControlPane.java
  33. 1028
      designer_base/src/com/fr/design/gui/frpane/RegPane.java
  34. 3
      designer_base/src/com/fr/design/gui/frpane/UIComboBoxPane.java
  35. 2
      designer_base/src/com/fr/design/gui/frpane/UITabbedPaneUI.java
  36. 2
      designer_base/src/com/fr/design/gui/ibutton/UIRadioButton.java
  37. 7
      designer_base/src/com/fr/design/gui/style/FormatPane.java
  38. BIN
      designer_base/src/com/fr/design/images/buttonicon/downSelected.png
  39. BIN
      designer_base/src/com/fr/design/images/buttonicon/leftNormal.png
  40. BIN
      designer_base/src/com/fr/design/images/control/edit_white.png
  41. 13
      designer_base/src/com/fr/design/locale/designer.properties
  42. 14
      designer_base/src/com/fr/design/locale/designer_en_US.properties
  43. 8
      designer_base/src/com/fr/design/locale/designer_ja_JP.properties
  44. 8
      designer_base/src/com/fr/design/locale/designer_ko_KR.properties
  45. 19
      designer_base/src/com/fr/design/locale/designer_zh_CN.properties
  46. 8
      designer_base/src/com/fr/design/locale/designer_zh_TW.properties
  47. 2
      designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java
  48. 50
      designer_base/src/com/fr/design/mainframe/widget/BasicPropertyPane.java
  49. 6
      designer_base/src/com/fr/design/mainframe/widget/editors/DataBindingEditor.java
  50. 21
      designer_base/src/com/fr/design/widget/DataModify.java
  51. 11
      designer_base/src/com/fr/design/widget/Operator.java
  52. 52
      designer_base/src/com/fr/design/widget/WidgetBoundsPaneFactory.java
  53. 40
      designer_base/src/com/fr/design/widget/btn/ButtonWithHotkeysDetailPane.java
  54. 4
      designer_form/src/com/fr/design/designer/creator/XBorderStyleWidgetCreator.java
  55. 16
      designer_form/src/com/fr/design/designer/creator/XCreator.java
  56. 4
      designer_form/src/com/fr/design/designer/creator/XWScaleLayout.java
  57. 6
      designer_form/src/com/fr/design/designer/creator/XWTitleLayout.java
  58. 6
      designer_form/src/com/fr/design/form/parameter/FormParaDesigner.java
  59. 239
      designer_form/src/com/fr/design/mainframe/FormHierarchyTreePane.java
  60. 265
      designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java
  61. 9
      designer_form/src/com/fr/design/mainframe/JForm.java
  62. 79
      designer_form/src/com/fr/design/mainframe/WidgetPropertyPane.java
  63. 20
      designer_form/src/com/fr/design/mainframe/widget/UITreeComboBox.java
  64. 19
      designer_form/src/com/fr/design/mainframe/widget/ui/FormBasicPropertyPane.java
  65. 48
      designer_form/src/com/fr/design/mainframe/widget/ui/FormBasicWidgetPropertyPane.java
  66. 224
      designer_form/src/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java
  67. 47
      designer_form/src/com/fr/design/parameter/ParameterPropertyPane.java
  68. 4
      designer_form/src/com/fr/design/parameter/ParameterToolBarPane.java
  69. 121
      designer_form/src/com/fr/design/parameter/RootDesignDefinePane.java
  70. 106
      designer_form/src/com/fr/design/widget/FormWidgetDefinePaneFactoryBase.java
  71. 34
      designer_form/src/com/fr/design/widget/ui/designer/AbstractDataModify.java
  72. 92
      designer_form/src/com/fr/design/widget/ui/designer/ButtonDefinePane.java
  73. 51
      designer_form/src/com/fr/design/widget/ui/designer/ButtonGroupDictPane.java
  74. 70
      designer_form/src/com/fr/design/widget/ui/designer/CheckBoxDefinePane.java
  75. 93
      designer_form/src/com/fr/design/widget/ui/designer/CheckBoxDictPane.java
  76. 97
      designer_form/src/com/fr/design/widget/ui/designer/CheckBoxGroupDefinePane.java
  77. 53
      designer_form/src/com/fr/design/widget/ui/designer/ComboBoxDefinePane.java
  78. 100
      designer_form/src/com/fr/design/widget/ui/designer/ComboCheckBoxDefinePane.java
  79. 56
      designer_form/src/com/fr/design/widget/ui/designer/CustomWritableRepeatEditorPane.java
  80. 265
      designer_form/src/com/fr/design/widget/ui/designer/DateEditorDefinePane.java
  81. 47
      designer_form/src/com/fr/design/widget/ui/designer/DictEditorDefinePane.java
  82. 100
      designer_form/src/com/fr/design/widget/ui/designer/DirectWriteEditorDefinePane.java
  83. 140
      designer_form/src/com/fr/design/widget/ui/designer/FieldEditorDefinePane.java
  84. 56
      designer_form/src/com/fr/design/widget/ui/designer/FreeButtonDefinePane.java
  85. 83
      designer_form/src/com/fr/design/widget/ui/designer/IframeEditorDefinePane.java
  86. 100
      designer_form/src/com/fr/design/widget/ui/designer/LabelDefinePane.java
  87. 93
      designer_form/src/com/fr/design/widget/ui/designer/MultiFileEditorPane.java
  88. 25
      designer_form/src/com/fr/design/widget/ui/designer/NoneWidgetDefinePane.java
  89. 312
      designer_form/src/com/fr/design/widget/ui/designer/NumberEditorDefinePane.java
  90. 179
      designer_form/src/com/fr/design/widget/ui/designer/ParameterTreeComboBox.java
  91. 23
      designer_form/src/com/fr/design/widget/ui/designer/PasswordDefinePane.java
  92. 44
      designer_form/src/com/fr/design/widget/ui/designer/RadioDefinePane.java
  93. 48
      designer_form/src/com/fr/design/widget/ui/designer/RadioGroupDefinePane.java
  94. 21
      designer_form/src/com/fr/design/widget/ui/designer/TextAreaDefinePane.java
  95. 122
      designer_form/src/com/fr/design/widget/ui/designer/TextFieldEditorDefinePane.java
  96. 49
      designer_form/src/com/fr/design/widget/ui/designer/TreeComboBoxEditorDefinePane.java
  97. 87
      designer_form/src/com/fr/design/widget/ui/designer/TreeEditorDefinePane.java
  98. 46
      designer_form/src/com/fr/design/widget/ui/designer/UserEditorDefinePane.java
  99. 29
      designer_form/src/com/fr/design/widget/ui/designer/WaterMarkDictPane.java
  100. 26
      designer_form/src/com/fr/design/widget/ui/designer/WritableRepeatEditorPane.java
  101. Some files were not shown because too many files have changed in this diff Show More

115
designer/src/com/fr/design/expand/ExpandFatherPane.java

@ -7,13 +7,13 @@ import com.fr.design.event.GlobalNameObserver;
import com.fr.design.gui.columnrow.ColumnRowPane; import com.fr.design.gui.columnrow.ColumnRowPane;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.general.Inter;
import com.fr.design.mainframe.ElementCasePane; import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.selection.SelectionEvent;
import com.fr.design.selection.SelectionListener;
import com.fr.general.Inter;
import com.fr.grid.selection.CellSelection; import com.fr.grid.selection.CellSelection;
import com.fr.grid.selection.Selection; import com.fr.grid.selection.Selection;
import com.fr.report.cell.cellattr.CellExpandAttr; import com.fr.report.cell.cellattr.CellExpandAttr;
import com.fr.design.selection.SelectionEvent;
import com.fr.design.selection.SelectionListener;
import com.fr.stable.ColumnRow; import com.fr.stable.ColumnRow;
import javax.swing.*; import javax.swing.*;
@ -22,12 +22,10 @@ import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.awt.event.ItemEvent; import java.awt.event.ItemEvent;
import java.awt.event.ItemListener; import java.awt.event.ItemListener;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
public abstract class ExpandFatherPane extends JPanel implements GlobalNameObserver { public abstract class ExpandFatherPane extends JPanel implements GlobalNameObserver {
private UIComboBox comboBox; public UIComboBox comboBox;
private ColumnRowPane customParentColumnRowPane; private ColumnRowPane customParentColumnRowPane;
private ElementCasePane ePane; private ElementCasePane ePane;
private SelectionListener gridSelectionChangeListener; private SelectionListener gridSelectionChangeListener;
@ -35,7 +33,8 @@ public abstract class ExpandFatherPane extends JPanel implements GlobalNameObser
private String expandFatherName = ""; private String expandFatherName = "";
private GlobalNameListener globalNameListener = null; private GlobalNameListener globalNameListener = null;
private boolean isAlreadyAddListener = false; private boolean isAlreadyAddListener = false;
private final JPanel customPane; public JPanel customPane;
private CardLayout cardLayout;
public ExpandFatherPane() { public ExpandFatherPane() {
this.setLayout(new BorderLayout(0, LayoutConstants.VGAP_SMALL)); this.setLayout(new BorderLayout(0, LayoutConstants.VGAP_SMALL));
@ -43,7 +42,7 @@ public abstract class ExpandFatherPane extends JPanel implements GlobalNameObser
Inter.getLocText("FR-Designer_None"), Inter.getLocText("FR-Designer_None"),
Inter.getLocText("FR-Designer_DEFAULT"), Inter.getLocText("FR-Designer_DEFAULT"),
Inter.getLocText("FR-Designer_Custom")}); Inter.getLocText("FR-Designer_Custom")});
final CardLayout cardLayout = new CardLayout(); cardLayout = new CardLayout();
customPane = new JPanel(cardLayout); customPane = new JPanel(cardLayout);
customParentColumnRowPane = new ColumnRowPane() { customParentColumnRowPane = new ColumnRowPane() {
@ -66,7 +65,7 @@ public abstract class ExpandFatherPane extends JPanel implements GlobalNameObser
cc.add(imageButton, BorderLayout.EAST); cc.add(imageButton, BorderLayout.EAST);
customPane.add(cc, "content"); customPane.add(cc, "content");
customPane.add(new JPanel(), "none"); customPane.add(new JPanel(), "none");
customPane.setPreferredSize(new Dimension(0, 0) ); customPane.setPreferredSize(new Dimension(0, 0));
this.add(comboBox, BorderLayout.NORTH); this.add(comboBox, BorderLayout.NORTH);
this.add(customPane, BorderLayout.CENTER); this.add(customPane, BorderLayout.CENTER);
@ -74,12 +73,12 @@ public abstract class ExpandFatherPane extends JPanel implements GlobalNameObser
@Override @Override
public void itemStateChanged(ItemEvent e) { public void itemStateChanged(ItemEvent e) {
if(comboBox.getSelectedIndex() == 2){ if (comboBox.getSelectedIndex() == 2) {
customPane.setPreferredSize(new Dimension(100, 20) ); customPane.setPreferredSize(new Dimension(100, 20));
cardLayout.show(customPane,"content"); cardLayout.show(customPane, "content");
}else { } else {
cardLayout.show(customPane,"none"); cardLayout.show(customPane, "none");
customPane.setPreferredSize(new Dimension(0, 0) ); customPane.setPreferredSize(new Dimension(0, 0));
} }
// cardLayout.show(customPane, comboBox.getSelectedIndex() == 2 ? "content" : "none"); // cardLayout.show(customPane, comboBox.getSelectedIndex() == 2 ? "content" : "none");
if (globalNameListener != null && shouldResponseNameListener()) { if (globalNameListener != null && shouldResponseNameListener()) {
@ -87,43 +86,61 @@ public abstract class ExpandFatherPane extends JPanel implements GlobalNameObser
} }
} }
}); });
imageButton.addActionListener(new ActionListener() { imageButton.addActionListener(imageActionListener);
comboBox.setSelectedIndex(1);
}
@Override ItemListener comboBoxItemListener = new ItemListener() {
public void actionPerformed(ActionEvent e) { @Override
public void itemStateChanged(ItemEvent e) {
if (comboBox.getSelectedIndex() == 2) {
customPane.setPreferredSize(new Dimension(100, 20));
cardLayout.show(customPane, "content");
} else {
cardLayout.show(customPane, "none");
customPane.setPreferredSize(new Dimension(0, 0));
}
// cardLayout.show(customPane, comboBox.getSelectedIndex() == 2 ? "content" : "none");
if (globalNameListener != null && shouldResponseNameListener()) {
globalNameListener.setGlobalName(expandFatherName);
}
}
};
if (ePane == null || isAlreadyAddListener) { ActionListener imageActionListener = new ActionListener() {
return; @Override
} public void actionPerformed(ActionEvent e) {
oldSelection = (CellSelection) ePane.getSelection(); if (ePane == null || isAlreadyAddListener) {
ePane.getGrid().setNotShowingTableSelectPane(false); return;
ePane.setEditable(false);
ePane.repaint(10);
gridSelectionChangeListener = new SelectionListener() {
@Override
public void selectionChanged(SelectionEvent e) {
Selection selection = ePane.getSelection();
if (selection instanceof CellSelection) {
CellSelection cellselection = (CellSelection) selection;
ColumnRow cr = ColumnRow.valueOf(cellselection.getColumn(), cellselection.getRow());
ePane.setOldSelecton(oldSelection);
customParentColumnRowPane.setColumnRow(cr);
}
ePane.removeSelectionChangeListener(gridSelectionChangeListener);
isAlreadyAddListener = false;
ePane.getGrid().setNotShowingTableSelectPane(true);
ePane.setEditable(true);
ePane.repaint();
}
};
ePane.addSelectionChangeListener(gridSelectionChangeListener);
isAlreadyAddListener = true;
} }
}); oldSelection = (CellSelection) ePane.getSelection();
comboBox.setSelectedIndex(1); ePane.getGrid().setNotShowingTableSelectPane(false);
} ePane.setEditable(false);
ePane.repaint(10);
gridSelectionChangeListener = new SelectionListener() {
@Override
public void selectionChanged(SelectionEvent e) {
Selection selection = ePane.getSelection();
if (selection instanceof CellSelection) {
CellSelection cellselection = (CellSelection) selection;
ColumnRow cr = ColumnRow.valueOf(cellselection.getColumn(), cellselection.getRow());
ePane.setOldSelecton(oldSelection);
customParentColumnRowPane.setColumnRow(cr);
}
ePane.removeSelectionChangeListener(gridSelectionChangeListener);
isAlreadyAddListener = false;
ePane.getGrid().setNotShowingTableSelectPane(true);
ePane.setEditable(true);
ePane.repaint();
}
};
ePane.addSelectionChangeListener(gridSelectionChangeListener);
isAlreadyAddListener = true;
}
};
/** /**
* @param listener 观察者监听事件 * @param listener 观察者监听事件

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

@ -101,7 +101,7 @@ public class CellElementPropertyPane extends DockingView {
title.setHorizontalAlignment(SwingConstants.CENTER); title.setHorizontalAlignment(SwingConstants.CENTER);
title.setVerticalAlignment(SwingConstants.CENTER); title.setVerticalAlignment(SwingConstants.CENTER);
titlePane.add(title, BorderLayout.CENTER); titlePane.add(title, BorderLayout.CENTER);
titlePane.setBorder(BorderFactory.createEmptyBorder(0,0,1,0)); titlePane.setBorder(BorderFactory.createEmptyBorder(10,0,1,0));
// this.add(titlePane, BorderLayout.NORTH); // this.add(titlePane, BorderLayout.NORTH);
this.add(cellElementEditPane, BorderLayout.CENTER); this.add(cellElementEditPane, BorderLayout.CENTER);

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

@ -12,6 +12,7 @@ import com.fr.form.ui.Widget;
import com.fr.general.FRLogger; import com.fr.general.FRLogger;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.grid.selection.CellSelection; import com.fr.grid.selection.CellSelection;
import com.fr.grid.selection.FloatSelection;
import com.fr.grid.selection.Selection; import com.fr.grid.selection.Selection;
import com.fr.privilege.finegrain.WidgetPrivilegeControl; import com.fr.privilege.finegrain.WidgetPrivilegeControl;
import com.fr.report.cell.DefaultTemplateCellElement; import com.fr.report.cell.DefaultTemplateCellElement;
@ -85,10 +86,9 @@ public class CellWidgetPropertyPane extends BasicPane {
} }
public void populate(ElementCasePane ePane) { public void reInit(ElementCasePane ePane){
cellEditorDefPane = new WidgetPane(ePane); cellEditorDefPane = new WidgetPane(ePane);
this.removeAll();
this.add(cellEditorDefPane, BorderLayout.CENTER); this.add(cellEditorDefPane, BorderLayout.CENTER);
CellSelection cs = (CellSelection) ePane.getSelection(); CellSelection cs = (CellSelection) ePane.getSelection();
@ -102,6 +102,11 @@ public class CellWidgetPropertyPane extends BasicPane {
this.populate(editCellElement); this.populate(editCellElement);
} }
public void populate(ElementCasePane ePane) {
Selection editingSelection = ePane.getSelection();
editingSelection.populateWidgetPropertyPane(ePane);
}
public void update() { public void update() {
if (cellElement == null) {// 利用默认的CellElement. if (cellElement == null) {// 利用默认的CellElement.
return; return;

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.ReportHelper;
import com.fr.report.elementcase.ElementCase; import com.fr.report.elementcase.ElementCase;
import com.fr.report.elementcase.TemplateElementCase; import com.fr.report.elementcase.TemplateElementCase;
import com.fr.report.poly.PolyWorkSheet;
import com.fr.report.worksheet.WorkSheet; import com.fr.report.worksheet.WorkSheet;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
@ -109,9 +110,17 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
@Override @Override
public void refreshEastPropertiesPane() { public void refreshEastPropertiesPane() {
EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.REPORT); if (isEditingPolySheet()) {
EastRegionContainerPane.getInstance().replaceCellElementPane(getEastUpPane()); EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.POLY);
EastRegionContainerPane.getInstance().replaceCellAttrPane(getEastDownPane()); } 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 @Override

9
designer/src/com/fr/design/mainframe/ReportFloatPane.java

@ -43,17 +43,18 @@ public class ReportFloatPane extends JPanel {
topToolBar.setLayout(new BorderLayout()); topToolBar.setLayout(new BorderLayout());
insertFloatMenu = createInsertToolBar(); insertFloatMenu = createInsertToolBar();
topToolBar.add(createButtonUI()); topToolBar.add(createButtonUI());
topToolBar.setBorder(BorderFactory.createEmptyBorder(2, 10, 2, 0)); UILabel emptyLabel = new UILabel();
emptyLabel.setBorder(BorderFactory.createEmptyBorder(0, 4, 0, 0));
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double f = TableLayout.FILL; double f = TableLayout.FILL;
double[] columnSize = {p, f}; double[] columnSize = {p, p, p, f};
double[] rowSize = {p}; double[] rowSize = {p};
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{new UILabel(" " + Inter.getLocText("FR-Designer_Add_FloatElement")), topToolBar}, new Component[]{new UILabel(), new UILabel(Inter.getLocText("FR-Designer_Add_FloatElement")), emptyLabel, topToolBar},
}; };
JPanel leftTopPane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); JPanel leftTopPane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
leftTopPane.setBorder(BorderFactory.createEmptyBorder(0, 4, 0, 10)); leftTopPane.setBorder(BorderFactory.createEmptyBorder(10, 4, 0, 13));
this.add(leftTopPane, BorderLayout.NORTH); this.add(leftTopPane, BorderLayout.NORTH);
} }

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.base.GraphHelper;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.menu.MenuDef; import com.fr.design.menu.MenuDef;
import com.fr.design.menu.SeparatorDef; 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++) { for (int i = scrollIndex; i <= lastOneIndex; i++) {
int textWidth = widthArray[i]; int textWidth = widthArray[i];
if (evtX >= textX && evtX < textX + textWidth) { if (evtX >= textX && evtX < textX + textWidth) {
if (getSelectedIndex() != i) {
HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().refreshEastPropertiesPane();
}
setSelectedIndex(i); setSelectedIndex(i);
isBlank = false; isBlank = false;
reportComposite.setComposite(); reportComposite.setComposite();

13
designer/src/com/fr/design/mainframe/cell/CellElementEditPane.java

@ -10,6 +10,7 @@ import com.fr.design.gui.itabpane.TitleChangeListener;
import com.fr.design.mainframe.ElementCasePane; import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.mainframe.cell.settingpane.*; import com.fr.design.mainframe.cell.settingpane.*;
import com.fr.design.utils.DesignUtils; import com.fr.design.utils.DesignUtils;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.grid.selection.CellSelection; import com.fr.grid.selection.CellSelection;
@ -49,6 +50,17 @@ public class CellElementEditPane extends BasicPane {
private CellAttributeProvider cellAttributeProvider = null; private CellAttributeProvider cellAttributeProvider = null;
public static void main(String[] args){
JFrame jf = new JFrame("test");
jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JPanel content = (JPanel) jf.getContentPane();
content.setLayout(new BorderLayout());
content.add(new CellElementEditPane(), BorderLayout.CENTER);
GUICoreUtils.centerWindow(jf);
jf.setSize(290, 400);
jf.setVisible(true);
}
public CellElementEditPane() { public CellElementEditPane() {
setLayout(new BorderLayout()); setLayout(new BorderLayout());
initPaneList(); initPaneList();
@ -77,6 +89,7 @@ public class CellElementEditPane extends BasicPane {
downTitle = new JPanel(); downTitle = new JPanel();
downTitle.setLayout(new BorderLayout()); downTitle.setLayout(new BorderLayout());
downTitle.add(tabsHeaderIconPane, BorderLayout.NORTH); downTitle.add(tabsHeaderIconPane, BorderLayout.NORTH);
center.setBorder(BorderFactory.createEmptyBorder(0, -10, 0, -10));
downTitle.add(center, BorderLayout.CENTER); downTitle.add(center, BorderLayout.CENTER);
this.add(downTitle, BorderLayout.CENTER); this.add(downTitle, BorderLayout.CENTER);

431
designer/src/com/fr/design/mainframe/cell/settingpane/CellExpandAttrPane.java

@ -5,12 +5,12 @@ import com.fr.design.constants.LayoutConstants;
import com.fr.design.expand.ExpandLeftFatherPane; import com.fr.design.expand.ExpandLeftFatherPane;
import com.fr.design.expand.ExpandUpFatherPane; import com.fr.design.expand.ExpandUpFatherPane;
import com.fr.design.expand.SortExpandAttrPane; import com.fr.design.expand.SortExpandAttrPane;
import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
@ -27,216 +27,227 @@ import java.awt.*;
* 单元格扩展属性面板是属性表面板的一个种类 * 单元格扩展属性面板是属性表面板的一个种类
*/ */
public class CellExpandAttrPane extends AbstractCellAttrPane { public class CellExpandAttrPane extends AbstractCellAttrPane {
private UIButtonGroup<Byte> expandDirectionButton; private static final int SENIOR_HORIZONTAL_GAP = 12;
private ExpandLeftFatherPane leftFatherPane; private static final int BASIC_HORIZONTAL_GAP = 20;
private ExpandUpFatherPane rightFatherPane; private UIButtonGroup<Byte> expandDirectionButton;
private UICheckBox horizontalExpandableCheckBox; private ExpandLeftFatherPane leftFatherPane;
private UICheckBox verticalExpandableCheckBox; private ExpandUpFatherPane rightFatherPane;
private SortExpandAttrPane sortAfterExpand; private UICheckBox horizontalExpandableCheckBox;
private JPanel layoutPane; private UICheckBox verticalExpandableCheckBox;
private JPanel basicPane; private SortExpandAttrPane sortAfterExpand;
private JPanel seniorPane; private JPanel layoutPane;
private JPanel basicPane;
/** private JPanel seniorPane;
*
* @return /**
*/ * @return
public JPanel createContentPane() { */
String[] nameArray = {Inter.getLocText("ExpandD-Not_Expand"), Inter.getLocText("Utils-Top_to_Bottom"), Inter.getLocText("Utils-Left_to_Right")}; public JPanel createContentPane() {
Icon[] iconArray = { String[] nameArray = {Inter.getLocText("ExpandD-Not_Expand"), Inter.getLocText("Utils-Top_to_Bottom"), Inter.getLocText("Utils-Left_to_Right")};
BaseUtils.readIcon("/com/fr/design/images/expand/none16x16.png"), Icon[] iconArray = {
BaseUtils.readIcon("/com/fr/design/images/expand/vertical.png"), BaseUtils.readIcon("/com/fr/design/images/expand/none16x16.png"),
BaseUtils.readIcon("/com/fr/design/images/expand/landspace.png") BaseUtils.readIcon("/com/fr/design/images/expand/vertical.png"),
}; BaseUtils.readIcon("/com/fr/design/images/expand/landspace.png")
Byte[] valueArray = {Constants.NONE, Constants.TOP_TO_BOTTOM, Constants.LEFT_TO_RIGHT}; };
expandDirectionButton = new UIButtonGroup<Byte>(iconArray, valueArray); Byte[] valueArray = {Constants.NONE, Constants.TOP_TO_BOTTOM, Constants.LEFT_TO_RIGHT};
expandDirectionButton.setAllToolTips(nameArray); expandDirectionButton = new UIButtonGroup<Byte>(iconArray, valueArray);
leftFatherPane = new ExpandLeftFatherPane(); expandDirectionButton.setAllToolTips(nameArray);
rightFatherPane = new ExpandUpFatherPane(); leftFatherPane = new ExpandLeftFatherPane();
horizontalExpandableCheckBox = new UICheckBox(Inter.getLocText("ExpandD-Horizontal_Extendable")); rightFatherPane = new ExpandUpFatherPane();
verticalExpandableCheckBox = new UICheckBox(Inter.getLocText("ExpandD-Vertical_Extendable")); horizontalExpandableCheckBox = new UICheckBox(Inter.getLocText("ExpandD-Horizontal_Extendable"));
sortAfterExpand = new SortExpandAttrPane(); verticalExpandableCheckBox = new UICheckBox(Inter.getLocText("ExpandD-Vertical_Extendable"));
initAllNames(); sortAfterExpand = new SortExpandAttrPane();
return layoutPane(); initAllNames();
} return layoutPane();
}
public static void main(String[] args){
// JFrame jf = new JFrame("test"); public static void main(String[] args) {
// jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JFrame jf = new JFrame("test");
// JPanel content = (JPanel) jf.getContentPane(); jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
// content.setLayout(new BorderLayout()); JPanel content = (JPanel) jf.getContentPane();
// content.add(new CellExpandAttrPane().layoutPane(), BorderLayout.CENTER); content.setLayout(new BorderLayout());
// GUICoreUtils.centerWindow(jf); content.add(new CellExpandAttrPane().layoutPane(), BorderLayout.CENTER);
// jf.setSize(290, 400); GUICoreUtils.centerWindow(jf);
// jf.setVisible(true); jf.setSize(290, 400);
} jf.setVisible(true);
}
private void initAllNames() {
expandDirectionButton.setGlobalName(Inter.getLocText("FR-Designer_ExpandD_Expand_Direction")); private void initAllNames() {
leftFatherPane.setGlobalName(Inter.getLocText("FR-Designer_LeftParent")); expandDirectionButton.setGlobalName(Inter.getLocText("FR-Designer_ExpandD_Expand_Direction"));
rightFatherPane.setGlobalName(Inter.getLocText("FR-Designer_ExpandD_Up_Father_Cell")); leftFatherPane.setGlobalName(Inter.getLocText("FR-Designer_LeftParent"));
horizontalExpandableCheckBox.setGlobalName(Inter.getLocText("FR-Designer_ExpandD_Expandable")); rightFatherPane.setGlobalName(Inter.getLocText("FR-Designer_ExpandD_Up_Father_Cell"));
verticalExpandableCheckBox.setGlobalName(Inter.getLocText("FR-Designer_ExpandD_Expandable")); horizontalExpandableCheckBox.setGlobalName(Inter.getLocText("FR-Designer_ExpandD_Expandable"));
} verticalExpandableCheckBox.setGlobalName(Inter.getLocText("FR-Designer_ExpandD_Expandable"));
}
private JPanel layoutPane() {
layoutPane = new JPanel(new BorderLayout()); private JPanel layoutPane() {
basicPane = new JPanel(); layoutPane = new JPanel(new BorderLayout());
seniorPane = new JPanel(); basicPane = new JPanel();
basicPane = new UIExpandablePane(Inter.getLocText("FR-Designer_Basic"),290,24,basicPane()); seniorPane = new JPanel();
seniorPane = new UIExpandablePane(Inter.getLocText("FR-Designer_Advanced"),290,24,seniorPane()); basicPane = new UIExpandablePane(Inter.getLocText("FR-Designer_Basic"), 290, 24, basicPane());
layoutPane.add(basicPane,BorderLayout.NORTH); seniorPane = new UIExpandablePane(Inter.getLocText("FR-Designer_Advanced"), 290, 24, seniorPane());
layoutPane.add(seniorPane,BorderLayout.CENTER); layoutPane.add(basicPane, BorderLayout.NORTH);
return layoutPane; layoutPane.add(seniorPane, BorderLayout.CENTER);
} return layoutPane;
}
private JPanel basicPane(){
double f = TableLayout.FILL; private JPanel basicPane() {
double p = TableLayout.PREFERRED; double f = TableLayout.FILL;
Component[][] components = new Component[][]{ double p = TableLayout.PREFERRED;
new Component[]{null,null}, UILabel direction = new UILabel(Inter.getLocText("FR-Designer_ExpandD_Expand_Direction"), SwingConstants.LEFT);
new Component[]{new UILabel(" "+Inter.getLocText("FR-Designer_ExpandD_Expand_Direction")+" ", SwingConstants.LEFT), expandDirectionButton}, // JPanel directionPane = new JPanel(new BorderLayout());
new Component[]{new UILabel(" "+Inter.getLocText("FR-Designer_LeftParent"), SwingConstants.LEFT), leftFatherPane}, // directionPane.add(direction, BorderLayout.NORTH);
new Component[]{new UILabel(" "+Inter.getLocText("FR-Designer_ExpandD_Up_Father_Cell"), SwingConstants.LEFT), rightFatherPane}, UILabel left = new UILabel(Inter.getLocText("FR-Designer_LeftParent"), SwingConstants.LEFT);
}; JPanel leftPane = new JPanel(new BorderLayout());
double[] rowSize = {p, p, p, p, p, p}; leftPane.add(left, BorderLayout.NORTH);
double[] columnSize = {p, f}; UILabel up = new UILabel(Inter.getLocText("FR-Designer_ExpandD_Up_Father_Cell"), SwingConstants.LEFT);
int[][] rowCount = {{1, 1},{1, 1}, {1, 3}, {1, 3}}; JPanel upPane = new JPanel(new BorderLayout());
return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_MEDIUM, LayoutConstants.VGAP_MEDIUM); upPane.add(up, BorderLayout.NORTH);
} Component[][] components = new Component[][]{
new Component[]{null, null},
private JPanel seniorPane() { new Component[]{direction, expandDirectionButton},
double f = TableLayout.FILL; new Component[]{leftPane, leftFatherPane},
double p = TableLayout.PREFERRED; new Component[]{upPane, rightFatherPane},
Component[][] components = new Component[][]{ };
new Component[]{null,null}, double[] rowSize = {p, p, p, p, p};
new Component[]{horizontalExpandableCheckBox, null}, double[] columnSize = {p, f};
new Component[]{verticalExpandableCheckBox, null}, int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}};
new Component[]{new UILabel(" "+Inter.getLocText("FR-Designer_ExpendSort"), SwingConstants.RIGHT), sortAfterExpand}, return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, BASIC_HORIZONTAL_GAP, LayoutConstants.VGAP_LARGE);
}; }
double[] rowSize = {p, p, p, p, p, p, p, p};
double[] columnSize = {p, f}; private JPanel seniorPane() {
int[][] rowCount = {{1, 1}, {1, 1}, {1, 3}, {1, 3}}; double f = TableLayout.FILL;
return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_MEDIUM, LayoutConstants.VGAP_MEDIUM); double p = TableLayout.PREFERRED;
} UILabel expendSort = new UILabel(Inter.getLocText("FR-Designer_ExpendSort"), SwingConstants.LEFT);
JPanel expendSortPane = new JPanel(new BorderLayout());
expendSortPane.add(expendSort, BorderLayout.NORTH);
Component[][] components = new Component[][]{
@Override new Component[]{null, null},
protected void populateBean() { new Component[]{horizontalExpandableCheckBox, null},
this.leftFatherPane.setElementCasePane(elementCasePane); new Component[]{verticalExpandableCheckBox, null},
this.rightFatherPane.setElementCasePane(elementCasePane); new Component[]{expendSortPane, sortAfterExpand},
CellExpandAttr cellExpandAttr = cellElement.getCellExpandAttr(); };
if (cellExpandAttr == null) { double[] rowSize = {p, p, p, p, p, p, p, p};
cellExpandAttr = new CellExpandAttr(); double[] columnSize = {p, f};
cellElement.setCellExpandAttr(cellExpandAttr); int[][] rowCount = {{1, 1}, {1, 1}, {1, 3}, {1, 3}};
} return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, SENIOR_HORIZONTAL_GAP, LayoutConstants.VGAP_LARGE);
expandDirectionButton.setSelectedItem(cellExpandAttr.getDirection()); }
this.leftFatherPane.populate(cellExpandAttr);
this.rightFatherPane.populate(cellExpandAttr);
switch (cellExpandAttr.getExtendable()) { @Override
case CellExpandAttr.Both_EXTENDABLE: protected void populateBean() {
horizontalExpandableCheckBox.setSelected(true); this.leftFatherPane.setElementCasePane(elementCasePane);
verticalExpandableCheckBox.setSelected(true); this.rightFatherPane.setElementCasePane(elementCasePane);
break; CellExpandAttr cellExpandAttr = cellElement.getCellExpandAttr();
case CellExpandAttr.Vertical_EXTENDABLE: if (cellExpandAttr == null) {
horizontalExpandableCheckBox.setSelected(false); cellExpandAttr = new CellExpandAttr();
verticalExpandableCheckBox.setSelected(true); cellElement.setCellExpandAttr(cellExpandAttr);
break; }
case CellExpandAttr.Horizontal_EXTENDABLE: expandDirectionButton.setSelectedItem(cellExpandAttr.getDirection());
horizontalExpandableCheckBox.setSelected(true); this.leftFatherPane.populate(cellExpandAttr);
verticalExpandableCheckBox.setSelected(false); this.rightFatherPane.populate(cellExpandAttr);
break; switch (cellExpandAttr.getExtendable()) {
default: { case CellExpandAttr.Both_EXTENDABLE:
horizontalExpandableCheckBox.setSelected(false); horizontalExpandableCheckBox.setSelected(true);
verticalExpandableCheckBox.setSelected(false); verticalExpandableCheckBox.setSelected(true);
} break;
} case CellExpandAttr.Vertical_EXTENDABLE:
horizontalExpandableCheckBox.setSelected(false);
sortAfterExpand.populate(cellExpandAttr); verticalExpandableCheckBox.setSelected(true);
} break;
case CellExpandAttr.Horizontal_EXTENDABLE:
horizontalExpandableCheckBox.setSelected(true);
@Override verticalExpandableCheckBox.setSelected(false);
public String getIconPath() { break;
default: {
horizontalExpandableCheckBox.setSelected(false);
verticalExpandableCheckBox.setSelected(false);
}
}
sortAfterExpand.populate(cellExpandAttr);
}
@Override
public String getIconPath() {
// return "com/fr/design/images/expand/cellAttr.gif"; // return "com/fr/design/images/expand/cellAttr.gif";
return Inter.getLocText("FR-Designer_Expand"); return Inter.getLocText("FR-Designer_Expand");
} }
@Override @Override
public void updateBean(TemplateCellElement cellElement) { public void updateBean(TemplateCellElement cellElement) {
CellExpandAttr cellExpandAttr = cellElement.getCellExpandAttr(); CellExpandAttr cellExpandAttr = cellElement.getCellExpandAttr();
if (cellExpandAttr == null) { if (cellExpandAttr == null) {
cellExpandAttr = new CellExpandAttr(); cellExpandAttr = new CellExpandAttr();
cellElement.setCellExpandAttr(cellExpandAttr); cellElement.setCellExpandAttr(cellExpandAttr);
} }
if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_ExpandD_Expand_Direction"))) { if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_ExpandD_Expand_Direction"))) {
cellExpandAttr.setDirection(expandDirectionButton.getSelectedItem()); cellExpandAttr.setDirection(expandDirectionButton.getSelectedItem());
} }
if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_LeftParent"))) { if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_LeftParent"))) {
this.leftFatherPane.update(cellExpandAttr); this.leftFatherPane.update(cellExpandAttr);
} }
if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_ExpandD_Up_Father_Cell"))) { if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_ExpandD_Up_Father_Cell"))) {
this.rightFatherPane.update(cellExpandAttr); this.rightFatherPane.update(cellExpandAttr);
} }
// extendable // extendable
if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_ExpandD-Expandable"))) { if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_ExpandD-Expandable"))) {
if (horizontalExpandableCheckBox.isSelected()) { if (horizontalExpandableCheckBox.isSelected()) {
if (verticalExpandableCheckBox.isSelected()) { if (verticalExpandableCheckBox.isSelected()) {
cellExpandAttr.setExtendable(CellExpandAttr.Both_EXTENDABLE); cellExpandAttr.setExtendable(CellExpandAttr.Both_EXTENDABLE);
} else { } else {
cellExpandAttr.setExtendable(CellExpandAttr.Horizontal_EXTENDABLE); cellExpandAttr.setExtendable(CellExpandAttr.Horizontal_EXTENDABLE);
} }
} else { } else {
if (verticalExpandableCheckBox.isSelected()) { if (verticalExpandableCheckBox.isSelected()) {
cellExpandAttr.setExtendable(CellExpandAttr.Vertical_EXTENDABLE); cellExpandAttr.setExtendable(CellExpandAttr.Vertical_EXTENDABLE);
} else { } else {
cellExpandAttr.setExtendable(CellExpandAttr.None_EXTENDABLE); cellExpandAttr.setExtendable(CellExpandAttr.None_EXTENDABLE);
} }
} }
} }
if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("ExpandD-Sort_After_Expand"))) { if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("ExpandD-Sort_After_Expand"))) {
sortAfterExpand.update(cellExpandAttr); sortAfterExpand.update(cellExpandAttr);
} }
} }
/** /**
* *
*/ */
public void updateBeans() { public void updateBeans() {
TemplateElementCase elementCase = elementCasePane.getEditingElementCase(); TemplateElementCase elementCase = elementCasePane.getEditingElementCase();
int cellRectangleCount = cs.getCellRectangleCount(); int cellRectangleCount = cs.getCellRectangleCount();
for (int rect = 0; rect < cellRectangleCount; rect++) { for (int rect = 0; rect < cellRectangleCount; rect++) {
Rectangle cellRectangle = cs.getCellRectangle(rect); Rectangle cellRectangle = cs.getCellRectangle(rect);
// 需要先行后列地增加新元素。 // 需要先行后列地增加新元素。
for (int j = 0; j < cellRectangle.height; j++) { for (int j = 0; j < cellRectangle.height; j++) {
for (int i = 0; i < cellRectangle.width; i++) { for (int i = 0; i < cellRectangle.width; i++) {
int column = i + cellRectangle.x; int column = i + cellRectangle.x;
int row = j + cellRectangle.y; int row = j + cellRectangle.y;
TemplateCellElement cellElement = elementCase.getTemplateCellElement(column, row); TemplateCellElement cellElement = elementCase.getTemplateCellElement(column, row);
if (cellElement == null) { if (cellElement == null) {
cellElement = new DefaultTemplateCellElement(column, row); cellElement = new DefaultTemplateCellElement(column, row);
elementCase.addCellElement(cellElement); elementCase.addCellElement(cellElement);
} }
updateBean(cellElement); updateBean(cellElement);
} }
} }
} }
} }
/** /**
* * @return
* @return */
*/ public String title4PopupWindow() {
public String title4PopupWindow() { return Inter.getLocText("ExpandD-Expand_Attribute");
return Inter.getLocText("ExpandD-Expand_Attribute"); }
}
} }

204
designer/src/com/fr/design/mainframe/cell/settingpane/CellStylePane.java

@ -1,11 +1,5 @@
package com.fr.design.mainframe.cell.settingpane; package com.fr.design.mainframe.cell.settingpane;
import java.awt.*;
import javax.swing.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import com.fr.base.Style; import com.fr.base.Style;
import com.fr.design.mainframe.cell.settingpane.style.StylePane; import com.fr.design.mainframe.cell.settingpane.style.StylePane;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
@ -14,117 +8,123 @@ import com.fr.report.cell.DefaultTemplateCellElement;
import com.fr.report.cell.TemplateCellElement; import com.fr.report.cell.TemplateCellElement;
import com.fr.report.elementcase.TemplateElementCase; import com.fr.report.elementcase.TemplateElementCase;
import javax.swing.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.*;
/** /**
* @author zhou * @author zhou
* @since 2012-5-11下午3:59:39 * @since 2012-5-11下午3:59:39
*/ */
public class CellStylePane extends AbstractCellAttrPane { public class CellStylePane extends AbstractCellAttrPane {
private StylePane stylePane; private StylePane stylePane;
@Override @Override
public JPanel createContentPane() { public JPanel createContentPane() {
JPanel content = new JPanel(new BorderLayout()); JPanel content = new JPanel(new BorderLayout());
stylePane = new StylePane(); stylePane = new StylePane();
content.add(stylePane, BorderLayout.CENTER); content.add(stylePane, BorderLayout.CENTER);
stylePane.addPredefinedChangeListener(new ChangeListener() { stylePane.addPredefinedChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent e) { public void stateChanged(ChangeEvent e) {
attributeChanged(); attributeChanged();
} }
}); });
stylePane.addCustomTabChangeListener(new ChangeListener() { stylePane.addCustomTabChangeListener(new ChangeListener() {
@Override @Override
public void stateChanged(ChangeEvent e) { public void stateChanged(ChangeEvent e) {
adjustValues();// 里面的Tab切换后要及时调整滚动条,因为一些界面可能不需要滚动条 adjustValues();// 里面的Tab切换后要及时调整滚动条,因为一些界面可能不需要滚动条
} }
}); });
return content; // content.setBorder(UIConstants.CELL_ATTR_NORMALBORDER);
} return content;
}
public static void main(String[] args){ public static void main(String[] args) {
// JFrame jf = new JFrame("test"); JFrame jf = new JFrame("test");
// jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
// JPanel content = (JPanel) jf.getContentPane(); JPanel content = (JPanel) jf.getContentPane();
// content.setLayout(new BorderLayout()); content.setLayout(new BorderLayout());
// content.add(new CellStylePane().createContentPane(), BorderLayout.CENTER); content.add(new CellStylePane().createContentPane(), BorderLayout.CENTER);
// GUICoreUtils.centerWindow(jf); GUICoreUtils.centerWindow(jf);
// jf.setSize(290, 400); jf.setSize(290, 400);
// jf.setVisible(true); jf.setVisible(true);
} }
@Override @Override
public String getIconPath() { public String getIconPath() {
// return "com/fr/design/images/m_format/cell.png"; // return "com/fr/design/images/m_format/cell.png";
return Inter.getLocText("FR-Designer_Style"); return Inter.getLocText("FR-Designer_Style");
} }
@Override @Override
public void updateBean(TemplateCellElement cellElement) { public void updateBean(TemplateCellElement cellElement) {
cellElement.setStyle(stylePane.updateBean()); cellElement.setStyle(stylePane.updateBean());
} }
@Override @Override
public void updateBeans() { public void updateBeans() {
if (stylePane.getSelectedIndex() == 1) { if (stylePane.getSelectedIndex() == 1) {
Style s = stylePane.updateBean(); Style s = stylePane.updateBean();
TemplateElementCase elementCase = elementCasePane.getEditingElementCase(); TemplateElementCase elementCase = elementCasePane.getEditingElementCase();
int cellRectangleCount = cs.getCellRectangleCount(); int cellRectangleCount = cs.getCellRectangleCount();
for (int rect = 0; rect < cellRectangleCount; rect++) { for (int rect = 0; rect < cellRectangleCount; rect++) {
Rectangle cellRectangle = cs.getCellRectangle(rect); Rectangle cellRectangle = cs.getCellRectangle(rect);
for (int j = 0; j < cellRectangle.height; j++) { for (int j = 0; j < cellRectangle.height; j++) {
for (int i = 0; i < cellRectangle.width; i++) { for (int i = 0; i < cellRectangle.width; i++) {
int column = i + cellRectangle.x; int column = i + cellRectangle.x;
int row = j + cellRectangle.y; int row = j + cellRectangle.y;
TemplateCellElement cellElement = elementCase.getTemplateCellElement(column, row); TemplateCellElement cellElement = elementCase.getTemplateCellElement(column, row);
if (cellElement == null) { if (cellElement == null) {
cellElement = new DefaultTemplateCellElement(column, row); cellElement = new DefaultTemplateCellElement(column, row);
elementCase.addCellElement(cellElement); elementCase.addCellElement(cellElement);
} }
cellElement.setStyle(s); cellElement.setStyle(s);
} }
} }
} }
} else { } else {
TemplateElementCase elementCase = elementCasePane.getEditingElementCase(); TemplateElementCase elementCase = elementCasePane.getEditingElementCase();
int cellRectangleCount = cs.getCellRectangleCount(); int cellRectangleCount = cs.getCellRectangleCount();
for (int rect = 0; rect < cellRectangleCount; rect++) { for (int rect = 0; rect < cellRectangleCount; rect++) {
Rectangle cellRectangle = cs.getCellRectangle(rect); Rectangle cellRectangle = cs.getCellRectangle(rect);
for (int j = 0; j < cellRectangle.height; j++) { for (int j = 0; j < cellRectangle.height; j++) {
for (int i = 0; i < cellRectangle.width; i++) { for (int i = 0; i < cellRectangle.width; i++) {
int column = i + cellRectangle.x; int column = i + cellRectangle.x;
int row = j + cellRectangle.y; int row = j + cellRectangle.y;
TemplateCellElement cellElement = elementCase.getTemplateCellElement(column, row); TemplateCellElement cellElement = elementCase.getTemplateCellElement(column, row);
if (cellElement == null) { if (cellElement == null) {
cellElement = new DefaultTemplateCellElement(column, row); cellElement = new DefaultTemplateCellElement(column, row);
elementCase.addCellElement(cellElement); elementCase.addCellElement(cellElement);
} }
Style style = cellElement.getStyle(); Style style = cellElement.getStyle();
if (style == null) { if (style == null) {
style = style.DEFAULT_STYLE; style = style.DEFAULT_STYLE;
} }
style = stylePane.updateStyle(style); style = stylePane.updateStyle(style);
cellElement.setStyle(style); cellElement.setStyle(style);
} }
} }
} }
stylePane.updateBorder();// border必须特别处理 stylePane.updateBorder();// border必须特别处理
} }
} }
@Override @Override
protected void populateBean() { protected void populateBean() {
stylePane.populateBean(cellElement.getStyle()); stylePane.populateBean(cellElement.getStyle());
stylePane.dealWithBorder(elementCasePane); stylePane.dealWithBorder(elementCasePane);
} }
@Override @Override
public String title4PopupWindow() { public String title4PopupWindow() {
return Inter.getLocText(Inter.getLocText("FR-Designer_Style")); return Inter.getLocText(Inter.getLocText("FR-Designer_Style"));
} }
public void setSelectedByIds(int level, String... id) { public void setSelectedByIds(int level, String... id) {
stylePane.setSelctedByName(id[level]); stylePane.setSelctedByName(id[level]);
} }
} }

2
designer/src/com/fr/design/mainframe/cell/settingpane/style/CustomStylePane.java

@ -50,7 +50,7 @@ public class CustomStylePane extends MultiTabPane<Style> {
content.setLayout(new BorderLayout()); content.setLayout(new BorderLayout());
content.add(new CustomStylePane(), BorderLayout.CENTER); content.add(new CustomStylePane(), BorderLayout.CENTER);
GUICoreUtils.centerWindow(jf); GUICoreUtils.centerWindow(jf);
jf.setSize(290, 400); jf.setSize(250, 400);
jf.setVisible(true); jf.setVisible(true);
} }

2
designer/src/com/fr/design/mainframe/cell/settingpane/style/PredefinedStylePane.java

@ -5,6 +5,7 @@ import com.fr.base.NameStyle;
import com.fr.base.ScreenResolution; import com.fr.base.ScreenResolution;
import com.fr.base.Style; import com.fr.base.Style;
import com.fr.design.beans.FurtherBasicBeanPane; import com.fr.design.beans.FurtherBasicBeanPane;
import com.fr.design.constants.UIConstants;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.DesignerBean; import com.fr.design.mainframe.DesignerBean;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
@ -64,6 +65,7 @@ public class PredefinedStylePane extends FurtherBasicBeanPane<NameStyle> impleme
styleList.setCellRenderer(render); styleList.setCellRenderer(render);
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.add(styleList, BorderLayout.CENTER); this.add(styleList, BorderLayout.CENTER);
this.setBorder(UIConstants.CELL_ATTR_NORMALBORDER);
styleList.addMouseListener(new MouseAdapter() { styleList.addMouseListener(new MouseAdapter() {
@Override @Override

8
designer/src/com/fr/design/present/PresentPane.java

@ -5,6 +5,7 @@ import com.fr.base.present.FormulaPresent;
import com.fr.base.present.Present; import com.fr.base.present.Present;
import com.fr.design.ExtraDesignClassManager; import com.fr.design.ExtraDesignClassManager;
import com.fr.design.beans.FurtherBasicBeanPane; import com.fr.design.beans.FurtherBasicBeanPane;
import com.fr.design.constants.UIConstants;
import com.fr.design.fun.PresentKindProvider; import com.fr.design.fun.PresentKindProvider;
import com.fr.design.gui.frpane.UIComboBoxPane; import com.fr.design.gui.frpane.UIComboBoxPane;
import com.fr.design.gui.icombobox.DictionaryComboBox; import com.fr.design.gui.icombobox.DictionaryComboBox;
@ -68,21 +69,26 @@ public class PresentPane extends UIComboBoxPane<Present> {
keys.add("NOPRESENT"); keys.add("NOPRESENT");
displays.add(none.title4PopupWindow()); displays.add(none.title4PopupWindow());
paneList.add(dictPresentPane = new DictPresentPane()); dictPresentPane = new DictPresentPane();
dictPresentPane.setBorder(UIConstants.CELL_ATTR_NORMALBORDER);
paneList.add(dictPresentPane);
keys.add(DictPresent.class.getName()); keys.add(DictPresent.class.getName());
displays.add(dictPresentPane.title4PopupWindow()); displays.add(dictPresentPane.title4PopupWindow());
FurtherBasicBeanPane<BarcodePresent> bar = new BarCodePane(); FurtherBasicBeanPane<BarcodePresent> bar = new BarCodePane();
bar.setBorder(UIConstants.CELL_ATTR_NORMALBORDER);
paneList.add(bar); paneList.add(bar);
keys.add(BarcodePresent.class.getName()); keys.add(BarcodePresent.class.getName());
displays.add(bar.title4PopupWindow()); displays.add(bar.title4PopupWindow());
FurtherBasicBeanPane<FormulaPresent> formula = new FormulaPresentPane(); FurtherBasicBeanPane<FormulaPresent> formula = new FormulaPresentPane();
formula.setBorder(UIConstants.CELL_ATTR_NORMALBORDER);
paneList.add(formula); paneList.add(formula);
keys.add(FormulaPresent.class.getName()); keys.add(FormulaPresent.class.getName());
displays.add(formula.title4PopupWindow()); displays.add(formula.title4PopupWindow());
FurtherBasicBeanPane<CurrencyLinePresent> currency = new CurrencyLinePane(); FurtherBasicBeanPane<CurrencyLinePresent> currency = new CurrencyLinePane();
currency.setBorder(UIConstants.CELL_ATTR_NORMALBORDER);
paneList.add(currency); paneList.add(currency);
keys.add(CurrencyLinePresent.class.getName()); keys.add(CurrencyLinePresent.class.getName());
displays.add(currency.title4PopupWindow()); displays.add(currency.title4PopupWindow());

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

@ -55,16 +55,17 @@ public class CellWidgetCardPane extends BasicPane {
// this.initComponents(pane); // this.initComponents(pane);
} }
public BasicWidgetPropertySettingPane initBasicWidgetPropertyPane(){ public BasicWidgetPropertySettingPane initBasicWidgetPropertyPane() {
return new BasicWidgetPropertySettingPane(); return new BasicWidgetPropertySettingPane();
} }
private void initComponents(ElementCasePane pane) { private void initComponents(ElementCasePane pane) {
this.removeAll();
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
//k //k
tabbedPane = new CardLayout(); tabbedPane = new CardLayout();
center = new JPanel(tabbedPane); center = new JPanel(tabbedPane);
this.add(center, BorderLayout.CENTER); this.add(center, BorderLayout.CENTER);
@ -76,7 +77,7 @@ public class CellWidgetCardPane extends BasicPane {
//k //k
center.add(attriTabPane, Inter.getLocText("FR-Designer_Attribute")); center.add(attriTabPane, Inter.getLocText("FR-Designer_Attribute"));
center.add(eventTabPane, Inter.getLocText("FR-Designer_Form_Editing_Listeners")); center.add(eventTabPane, Inter.getLocText("FR-Designer_Form_Editing_Listeners"));
final String [] tabTitles = new String[]{Inter.getLocText("FR-Designer_Attribute"), Inter.getLocText("FR-Designer_Form_Editing_Listeners")}; final String[] tabTitles = new String[]{Inter.getLocText("FR-Designer_Attribute"), Inter.getLocText("FR-Designer_Form_Editing_Listeners")};
tabsHeaderIconPane = new UIHeadGroup(tabTitles) { tabsHeaderIconPane = new UIHeadGroup(tabTitles) {
@Override @Override
@ -99,8 +100,9 @@ public class CellWidgetCardPane extends BasicPane {
widgetPropertyPane = new BasicWidgetPropertySettingPane(); widgetPropertyPane = new BasicWidgetPropertySettingPane();
UIExpandablePane uiExpandablePane = new UIExpandablePane("基本", 280, 20, widgetPropertyPane); UIExpandablePane uiExpandablePane = new UIExpandablePane(Inter.getLocText("FR-Designer_Basic"), 280, 24, widgetPropertyPane);
attriTabPane.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
attriTabPane.add(uiExpandablePane, BorderLayout.NORTH); attriTabPane.add(uiExpandablePane, BorderLayout.NORTH);
attriCardPane = FRGUIPaneFactory.createCardLayout_S_Pane(); attriCardPane = FRGUIPaneFactory.createCardLayout_S_Pane();
@ -109,7 +111,7 @@ public class CellWidgetCardPane extends BasicPane {
this.setPreferredSize(new Dimension(600, 450)); this.setPreferredSize(new Dimension(600, 450));
} }
private void initPaneList(){ private void initPaneList() {
paneList = new ArrayList<JPanel>(); paneList = new ArrayList<JPanel>();
paneList.add(attriTabPane); paneList.add(attriTabPane);
paneList.add(eventPane); paneList.add(eventPane);
@ -220,7 +222,7 @@ public class CellWidgetCardPane extends BasicPane {
center.remove(this.treeTabPane); center.remove(this.treeTabPane);
} }
private void reInitHeaderPane(JPanel jPanel){ private void reInitHeaderPane(JPanel jPanel) {
paneList.add(jPanel); paneList.add(jPanel);
// tabsHeaderIconPane = new // tabsHeaderIconPane = new
} }

31
designer/src/com/fr/design/widget/WidgetPane.java

@ -9,9 +9,11 @@ import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.icombobox.UIComboBoxRenderer; import com.fr.design.gui.icombobox.UIComboBoxRenderer;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.CellWidgetPropertyPane;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.ElementCasePane; import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.mainframe.CellWidgetPropertyPane;
import com.fr.design.widget.btn.ButtonConstants; import com.fr.design.widget.btn.ButtonConstants;
import com.fr.form.ui.Button; import com.fr.form.ui.Button;
import com.fr.form.ui.*; import com.fr.form.ui.*;
@ -49,14 +51,25 @@ public class WidgetPane extends AbstractAttrNoScrollPane implements ItemListener
protected void initComponents(ElementCasePane pane) { protected void initComponents(ElementCasePane pane) {
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); this.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
northPane = FRGUIPaneFactory.createNormalFlowInnerContainer_M_Pane();
this.add(northPane, BorderLayout.NORTH);
northPane.add(new UILabel(Inter.getLocText("FR-Designer_Type") + ":"));
editorTypeComboBox = new EditorTypeComboBox(pane != null); editorTypeComboBox = new EditorTypeComboBox(pane != null);
editorTypeComboBox.setPreferredSize(new Dimension(150, 30)); editorTypeComboBox.setPreferredSize(new Dimension(155, 30));
editorTypeComboBox.setMaximumRowCount(16); editorTypeComboBox.setMaximumRowCount(16);
northPane.add(editorTypeComboBox);
UILabel emptyLabel = new UILabel();
emptyLabel.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0));
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] columnSize = {p, p, f};
double[] rowSize = {p};
Component[][] components = new Component[][]{
new Component[]{new UILabel(Inter.getLocText(new String[]{"FR-Designer_Selection", "FR-Designer_Widget"})), emptyLabel, editorTypeComboBox},
};
northPane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
northPane.setBorder(BorderFactory.createEmptyBorder(12, 10, 10, 15));
this.add(northPane, BorderLayout.NORTH);
editorTypeComboBox.addItemListener(this); editorTypeComboBox.addItemListener(this);
cellEditorCardPane = new CellWidgetCardPane(pane); cellEditorCardPane = new CellWidgetCardPane(pane);
@ -64,12 +77,11 @@ public class WidgetPane extends AbstractAttrNoScrollPane implements ItemListener
this.addAttributeChangeListener(listener); this.addAttributeChangeListener(listener);
} }
protected JPanel createContentPane(){ protected JPanel createContentPane() {
return new JPanel(); return new JPanel();
} }
AttributeChangeListener listener = new AttributeChangeListener() { AttributeChangeListener listener = new AttributeChangeListener() {
@Override @Override
public void attributeChange() { public void attributeChange() {
@ -267,7 +279,8 @@ public class WidgetPane extends AbstractAttrNoScrollPane implements ItemListener
&& ComparatorUtils.equals(((Item) o).name, name); && ComparatorUtils.equals(((Item) o).name, name);
} }
} }
public String getIconPath(){
public String getIconPath() {
return ""; return "";
} }

36
designer/src/com/fr/design/widget/ui/BasicWidgetPropertySettingPane.java

@ -1,9 +1,12 @@
package com.fr.design.widget.ui; package com.fr.design.widget.ui;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.form.ui.NoneWidget; import com.fr.form.ui.NoneWidget;
import com.fr.form.ui.Widget; import com.fr.form.ui.Widget;
import com.fr.general.Inter; import com.fr.general.Inter;
@ -19,24 +22,25 @@ public class BasicWidgetPropertySettingPane extends BasicPane {
private Widget widget; private Widget widget;
public BasicWidgetPropertySettingPane() { public BasicWidgetPropertySettingPane() {
this.setLayout(FRGUIPaneFactory.createLabelFlowLayout()); this.setLayout(new BorderLayout());
JPanel pane1 = FRGUIPaneFactory.createBorderLayout_S_Pane(); enableCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_Visible"), true);
pane1.setBorder(BorderFactory.createEmptyBorder(0, -2, 0, 0)); visibleCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_Widget-Visible"), true);
this.add(pane1);
JPanel pane2 = FRGUIPaneFactory.createMediumHGapFlowInnerContainer_M_Pane();
enableCheckBox = new UICheckBox(Inter.getLocText("Enabled"), true);
pane2.add(enableCheckBox);
visibleCheckBox = new UICheckBox(Inter.getLocText("Widget-Visible"), true);
pane2.add(visibleCheckBox);
pane1.add(pane2, BorderLayout.NORTH);
JPanel pane3 = FRGUIPaneFactory.createMediumHGapFlowInnerContainer_M_Pane();
widgetNameComboBox = new ParameterTreeComboBox(); widgetNameComboBox = new ParameterTreeComboBox();
widgetNameComboBox.refreshTree(); widgetNameComboBox.refreshTree();
pane3.add(new UILabel(Inter.getLocText("Form-Widget_Name") + ":")); double f = TableLayout.FILL;
pane3.add(widgetNameComboBox); double p = TableLayout.PREFERRED;
pane1.add(pane3, BorderLayout.CENTER); Component[][] components = new Component[][]{
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Form-Widget_Name") + " "), widgetNameComboBox},
new Component[]{enableCheckBox, null},
new Component[]{visibleCheckBox, null},
};
double[] rowSize = {p, p, p};
double[] columnSize = {p, f};
int[][] rowCount = {{1, 1},{1, 1},{1, 1},{1, 1}};
JPanel pane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_LARGE, LayoutConstants.VGAP_LARGE);
pane.setBorder(BorderFactory.createEmptyBorder(10,0,10,0));
this.add(pane, BorderLayout.CENTER);
} }

42
designer/src/com/fr/design/widget/ui/FieldEditorDefinePane.java

@ -1,20 +1,10 @@
package com.fr.design.widget.ui; package com.fr.design.widget.ui;
import java.awt.*;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import javax.swing.*;
import com.fr.base.GraphHelper; import com.fr.base.GraphHelper;
import com.fr.design.constants.LayoutConstants; import com.fr.design.constants.LayoutConstants;
import com.fr.design.foldablepane.UIExpandablePane; import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.gui.ilable.UILabel;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
@ -22,6 +12,13 @@ import com.fr.design.layout.TableLayoutHelper;
import com.fr.form.ui.FieldEditor; import com.fr.form.ui.FieldEditor;
import com.fr.general.Inter; 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;
public abstract class FieldEditorDefinePane<T extends FieldEditor> extends AbstractDataModify<T> { 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_WIDTH = GraphHelper.getLocTextWidth("FR-Designer_Allow_Null") + 30;
private static final int ALLOW_BLANK_CHECK_BOX_HEIGHT = 30; private static final int ALLOW_BLANK_CHECK_BOX_HEIGHT = 30;
@ -39,7 +36,7 @@ public abstract class FieldEditorDefinePane<T extends FieldEditor> extends Abstr
initErrorMsgPane(); initErrorMsgPane();
JPanel contentPane = this.setFirstContentPane(); JPanel contentPane = this.setFirstContentPane();
if (contentPane != null) { if (contentPane != null) {
UIExpandablePane uiExpandablePane = new UIExpandablePane(Inter.getLocText("FR-Designer_Advanced"), 280, 20, contentPane); UIExpandablePane uiExpandablePane = new UIExpandablePane(Inter.getLocText("FR-Designer_Advanced"), 280, 24, contentPane);
this.add(uiExpandablePane, BorderLayout.NORTH); this.add(uiExpandablePane, BorderLayout.NORTH);
} }
this.addValidatePane(); this.addValidatePane();
@ -101,8 +98,8 @@ public abstract class FieldEditorDefinePane<T extends FieldEditor> extends Abstr
protected void addValidatePane() { protected void addValidatePane() {
validatePane = FRGUIPaneFactory.createBorderLayout_S_Pane(); validatePane = FRGUIPaneFactory.createBorderLayout_S_Pane();
final UILabel uiLabel = new UILabel(Inter.getLocText(new String[]{"Error", "Tooltips"}) + ":"); final UILabel uiLabel = new UILabel(Inter.getLocText(new String[]{"FR-Designer_Error", "FR-Designer_Tooltips"}));
errorMsgTextField = new UITextField(10); errorMsgTextField = new UITextField(10);
allowBlankCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_Allow_Null")); allowBlankCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_Allow_Null"));
allowBlankCheckBox.setBorder(BorderFactory.createEmptyBorder(5, 5, 0, 5)); allowBlankCheckBox.setBorder(BorderFactory.createEmptyBorder(5, 5, 0, 5));
allowBlankCheckBox.setPreferredSize(new Dimension(ALLOW_BLANK_CHECK_BOX_WIDTH, ALLOW_BLANK_CHECK_BOX_HEIGHT)); allowBlankCheckBox.setPreferredSize(new Dimension(ALLOW_BLANK_CHECK_BOX_WIDTH, ALLOW_BLANK_CHECK_BOX_HEIGHT));
@ -113,10 +110,10 @@ public abstract class FieldEditorDefinePane<T extends FieldEditor> extends Abstr
boolean isSelected = allowBlankCheckBox.isSelected(); boolean isSelected = allowBlankCheckBox.isSelected();
uiLabel.setVisible(!isSelected); uiLabel.setVisible(!isSelected);
errorMsgTextField.setVisible(!isSelected); errorMsgTextField.setVisible(!isSelected);
if(isSelected){ if (isSelected) {
uiLabel.setPreferredSize(new Dimension(0, 0)); uiLabel.setPreferredSize(new Dimension(0, 0));
errorMsgTextField.setPreferredSize(new Dimension(0, 0)); errorMsgTextField.setPreferredSize(new Dimension(0, 0));
}else{ } else {
uiLabel.setPreferredSize(new Dimension(66, 20)); uiLabel.setPreferredSize(new Dimension(66, 20));
errorMsgTextField.setPreferredSize(new Dimension(150, 20)); errorMsgTextField.setPreferredSize(new Dimension(150, 20));
} }
@ -127,13 +124,13 @@ public abstract class FieldEditorDefinePane<T extends FieldEditor> extends Abstr
double f = TableLayout.FILL; double f = TableLayout.FILL;
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{allowBlankCheckBox, null }, new Component[]{allowBlankCheckBox, null},
new Component[]{uiLabel, errorMsgTextField}, new Component[]{uiLabel, errorMsgTextField},
}; };
double[] rowSize = {p, p}; double[] rowSize = {p, p};
double[] columnSize = {p,f}; double[] columnSize = {p, f};
int[][] rowCount = {{1, 1},{1, 1}}; int[][] rowCount = {{1, 1}, {1, 1}};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_SMALL, 1); JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_SMALL, 1);
validatePane.add(panel, BorderLayout.NORTH); validatePane.add(panel, BorderLayout.NORTH);
JPanel contentPane = this.setValidatePane(); JPanel contentPane = this.setValidatePane();
@ -142,7 +139,7 @@ public abstract class FieldEditorDefinePane<T extends FieldEditor> extends Abstr
} }
UIExpandablePane uiExpandablePane = new UIExpandablePane(Inter.getLocText("FR-Designer_Validate"), 280, 20, validatePane); UIExpandablePane uiExpandablePane = new UIExpandablePane(Inter.getLocText("FR-Designer_Validate"), 280, 24, validatePane);
this.add(uiExpandablePane, BorderLayout.CENTER); this.add(uiExpandablePane, BorderLayout.CENTER);
// JPanel firstPane = GUICoreUtils.createFlowPane(new JComponent[]{allowBlankCheckBox}, FlowLayout.LEFT, 5); // JPanel firstPane = GUICoreUtils.createFlowPane(new JComponent[]{allowBlankCheckBox}, FlowLayout.LEFT, 5);
@ -155,10 +152,9 @@ public abstract class FieldEditorDefinePane<T extends FieldEditor> extends Abstr
// validatePane.add(secondPane); // validatePane.add(secondPane);
} }
public JPanel setValidatePane(){ public JPanel setValidatePane() {
return null; return null;
} }
} }

85
designer/src/com/fr/design/widget/ui/WaterMarkDictPane.java

@ -1,45 +1,70 @@
package com.fr.design.widget.ui; package com.fr.design.widget.ui;
import java.awt.*;
import java.awt.event.KeyListener; import java.awt.event.KeyListener;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import javax.swing.*; import javax.swing.*;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.form.ui.WaterMark; import com.fr.form.ui.WaterMark;
import com.fr.general.Inter; import com.fr.general.Inter;
public class WaterMarkDictPane extends JPanel{ public class WaterMarkDictPane extends JPanel {
private UITextField waterMarkTextField; private UITextField waterMarkTextField;
public WaterMarkDictPane() { public WaterMarkDictPane() {
this.setLayout(FRGUIPaneFactory.createLabelFlowLayout()); this.setLayout(new BorderLayout());
this.setBorder(BorderFactory.createEmptyBorder(2,2,2,2));
this.add(new UILabel(Inter.getLocText("WaterMark") + ":")); // this.setBorder(BorderFactory.createEmptyBorder(2,2,2,2));
waterMarkTextField = new UITextField(13); // this.add(new UILabel(Inter.getLocText("WaterMark") + ":"));
this.add(waterMarkTextField); waterMarkTextField = new UITextField(13);
}
UILabel emptyLabel = new UILabel();
public void populate(WaterMark waterMark) { emptyLabel.setBorder(BorderFactory.createEmptyBorder(0, 33, 0, 0));
this.waterMarkTextField.setText(waterMark.getWaterMark());
} double f = TableLayout.FILL;
public void addInputKeyListener(KeyListener kl) { double p = TableLayout.PREFERRED;
this.waterMarkTextField.addKeyListener(kl); Component[][] components = new Component[][]{
} new Component[]{new UILabel(Inter.getLocText("FR-Designer_WaterMark")), emptyLabel, waterMarkTextField},
public void removeInputKeyListener(KeyListener kl) { };
this.waterMarkTextField.removeKeyListener(kl); double[] rowSize = {p};
} double[] columnSize = {p, p, f};
public void update(WaterMark waterMark) { int[][] rowCount = {{1, 1}};
waterMark.setWaterMark(this.waterMarkTextField.getText()); JPanel panel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
} // JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_LARGE, LayoutConstants.VGAP_MEDIUM);
public void setWaterMark(String waterMark) { panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 5, 0));
this.waterMarkTextField.setText(waterMark); this.add(panel, BorderLayout.CENTER);
} }
public String getWaterMark() {
return this.waterMarkTextField.getText(); public void populate(WaterMark waterMark) {
} this.waterMarkTextField.setText(waterMark.getWaterMark());
}
public void addInputKeyListener(KeyListener kl) {
this.waterMarkTextField.addKeyListener(kl);
}
public void removeInputKeyListener(KeyListener kl) {
this.waterMarkTextField.removeKeyListener(kl);
}
public void update(WaterMark waterMark) {
waterMark.setWaterMark(this.waterMarkTextField.getText());
}
public void setWaterMark(String waterMark) {
this.waterMarkTextField.setText(waterMark);
}
public String getWaterMark() {
return this.waterMarkTextField.getText();
}
} }

7
designer/src/com/fr/grid/selection/CellSelection.java

@ -18,12 +18,14 @@ import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.gui.imenu.UIMenu; import com.fr.design.gui.imenu.UIMenu;
import com.fr.design.gui.imenu.UIPopupMenu; import com.fr.design.gui.imenu.UIPopupMenu;
import com.fr.design.mainframe.CellElementPropertyPane; import com.fr.design.mainframe.CellElementPropertyPane;
import com.fr.design.mainframe.CellWidgetPropertyPane;
import com.fr.design.mainframe.ElementCasePane; import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.mainframe.ElementCasePane.Clear; import com.fr.design.mainframe.ElementCasePane.Clear;
import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplate;
import com.fr.design.menu.KeySetUtils; import com.fr.design.menu.KeySetUtils;
import com.fr.design.report.RowColumnPane; import com.fr.design.report.RowColumnPane;
import com.fr.design.selection.QuickEditor; import com.fr.design.selection.QuickEditor;
import com.fr.form.ui.CellWidget;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.grid.GridUtils; import com.fr.grid.GridUtils;
import com.fr.report.cell.CellElement; import com.fr.report.cell.CellElement;
@ -687,4 +689,9 @@ public class CellSelection extends Selection {
public void populatePropertyPane(ElementCasePane ePane) { public void populatePropertyPane(ElementCasePane ePane) {
CellElementPropertyPane.getInstance().reInit(ePane); CellElementPropertyPane.getInstance().reInit(ePane);
} }
public void populateWidgetPropertyPane(ElementCasePane ePane){
CellWidgetPropertyPane.getInstance().reInit(ePane);
}
} }

5
designer/src/com/fr/grid/selection/FloatSelection.java

@ -234,4 +234,9 @@ public class FloatSelection extends Selection {
public void populatePropertyPane(ElementCasePane ePane) { public void populatePropertyPane(ElementCasePane ePane) {
CellElementPropertyPane.getInstance().removeAll(); CellElementPropertyPane.getInstance().removeAll();
} }
public void populateWidgetPropertyPane(ElementCasePane ePane){
return;
}
} }

2
designer/src/com/fr/grid/selection/Selection.java

@ -90,6 +90,8 @@ public abstract class Selection implements FCloneable, Serializable , Selectable
public abstract void populatePropertyPane(ElementCasePane ePane); public abstract void populatePropertyPane(ElementCasePane ePane);
public abstract void populateWidgetPropertyPane(ElementCasePane ePane);
@Override @Override
public Selection clone() throws CloneNotSupportedException { public Selection clone() throws CloneNotSupportedException {

94
designer/src/com/fr/poly/PolyBlockProperTable.java

@ -1,17 +1,66 @@
package com.fr.poly; package com.fr.poly;
import java.util.ArrayList; import com.fr.design.event.UIObserver;
import com.fr.design.event.UIObserverListener;
import javax.swing.table.TableModel; import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.gui.itable.AbstractPropertyTable; import com.fr.design.mainframe.widget.BasicPropertyPane;
import com.fr.design.gui.itable.PropertyGroup; import com.fr.design.widget.WidgetBoundsPaneFactory;
import com.fr.general.Inter;
import com.fr.poly.group.PolyBoundsGroup; import com.fr.poly.group.PolyBoundsGroup;
import com.fr.poly.group.PolyNameGroup;
import com.fr.report.poly.TemplateBlock; import com.fr.report.poly.TemplateBlock;
public class PolyBlockProperTable extends AbstractPropertyTable { import javax.swing.*;
import java.awt.*;
public class PolyBlockProperTable extends JPanel {
private PolyDesigner designer; private PolyDesigner designer;
private UISpinner x;
private UISpinner y;
private UISpinner width;
private UISpinner height;
private BasicPropertyPane blockPropertyPane;
private boolean isPopulating = false;
private static final int MAX_SPINNER_VALUE = 10000;
public PolyBlockProperTable() {
initPropertyPane();
initListener(this);
}
private void initPropertyPane() {
this.setLayout(new BorderLayout());
blockPropertyPane = new BasicPropertyPane();
UIExpandablePane basicPane = new UIExpandablePane(Inter.getLocText("FR-Designer_Basic"), 280, 24, blockPropertyPane);
this.add(basicPane, BorderLayout.NORTH);
x = new UISpinner(0, MAX_SPINNER_VALUE, 1);
y = new UISpinner(0, MAX_SPINNER_VALUE, 1);
width = new UISpinner(0, MAX_SPINNER_VALUE, 1);
height = new UISpinner(0, MAX_SPINNER_VALUE, 1);
UIExpandablePane boundsPane = WidgetBoundsPaneFactory.createAbsoluteBoundsPane(x, y, width, height);
this.add(boundsPane, BorderLayout.CENTER);
}
private void initListener(Container parentComponent) {
for (int i = 0; i < parentComponent.getComponentCount(); i++) {
Component tmpComp = parentComponent.getComponent(i);
if (tmpComp instanceof Container) {
initListener((Container) tmpComp);
}
if (tmpComp instanceof UIObserver) {
((UIObserver) tmpComp).registerChangeListener(new UIObserverListener() {
@Override
public void doChange() {
update();
}
});
}
}
}
/** /**
* 初始化属性表 * 初始化属性表
@ -20,16 +69,16 @@ public class PolyBlockProperTable extends AbstractPropertyTable {
* *
*/ */
public void initPropertyGroups(Object source) { public void initPropertyGroups(Object source) {
groups = new ArrayList<PropertyGroup>();
if (source instanceof TemplateBlock) { if (source instanceof TemplateBlock) {
TemplateBlock block = (TemplateBlock) source; TemplateBlock block = (TemplateBlock) source;
PolyNameGroup namegroup = new PolyNameGroup(block); blockPropertyPane.getWidgetNameField().setText(block.getBlockName());
groups.add(new PropertyGroup(namegroup)); final PolyBoundsGroup boundsgroup = new PolyBoundsGroup(block, designer.getTarget());
PolyBoundsGroup boundsgroup = new PolyBoundsGroup(block, designer.getTarget());
groups.add(new PropertyGroup(boundsgroup)); x.setValue((int)boundsgroup.getValue(0, 1));
y.setValue((int)boundsgroup.getValue(1, 1));
width.setValue((int)boundsgroup.getValue(2, 1));
height.setValue((int)boundsgroup.getValue(3, 1));
} }
TableModel model = new BeanTableModel();
setModel(model);
this.repaint(); this.repaint();
} }
@ -42,8 +91,23 @@ public class PolyBlockProperTable extends AbstractPropertyTable {
} }
public void populate(PolyDesigner designer) { public void populate(PolyDesigner designer) {
isPopulating = true;
this.designer = designer; this.designer = designer;
initPropertyGroups(this.designer.getEditingTarget()); initPropertyGroups(this.designer.getEditingTarget());
isPopulating = false;
} }
public void update() {
TemplateBlock block = this.designer.getEditingTarget();
if (isPopulating || block == null) {
return;
}
block.setBlockName(blockPropertyPane.getWidgetNameField().getText());
PolyBoundsGroup boundsgroup = new PolyBoundsGroup(block, designer.getTarget());
boundsgroup.setValue(x.getValue(), 0, 1);
boundsgroup.setValue(y.getValue(), 1, 1);
boundsgroup.setValue(width.getValue(), 2, 1);
boundsgroup.setValue(height.getValue(), 3, 1);
firePropertyEdit();
}
} }

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

@ -72,8 +72,8 @@ public class PolyDesigner extends ReportComponent<PolyWorkSheet, PolyElementCase
/** /**
* 选中的类型--1.什么都没选中2.选中一个聚合块内部的内容3.选中聚合块本省 * 选中的类型--1.什么都没选中2.选中一个聚合块内部的内容3.选中聚合块本省
*/ */
public static enum SelectionType { public enum SelectionType {
NONE, INNER, BLOCK NONE, INNER, BLOCK, CHART_INNER
} }
public JComponent polyArea; public JComponent polyArea;
@ -892,6 +892,9 @@ public class PolyDesigner extends ReportComponent<PolyWorkSheet, PolyElementCase
} else if (isChooseBlock()) { } else if (isChooseBlock()) {
EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.POLY_CHART); EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.POLY_CHART);
EastRegionContainerPane.getInstance().replaceWidgetSettingsPane(PolyBlockProperPane.getInstance(PolyDesigner.this)); 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) { } else if (type != SelectionType.NONE) {
EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.POLY_REPORT); EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.POLY_REPORT);
EastRegionContainerPane.getInstance().replaceCellAttrPane(CellElementPropertyPane.getInstance()); 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() { protected MiddleChartComponent createEffective() {
if (editComponent == null) { if (editComponent == null) {
initEffective(creator.getValue().getChartCollection()); initEffective(creator.getValue().getChartCollection());
editComponent.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
designer.setChooseType(SelectionType.CHART_INNER);
}
});
} }
return editComponent; return editComponent;
} }
@ -266,7 +272,7 @@ public class ChartBlockEditor extends BlockEditor<MiddleChartComponent, PolyChar
* 刷新选中状态.日EC * 刷新选中状态.日EC
*/ */
public void resetSelectionAndChooseState() { public void resetSelectionAndChooseState() {
designer.setChooseType(SelectionType.BLOCK); designer.setChooseType(SelectionType.CHART_INNER);
// refreshChartComponent();// 选中之后 刷新下图表编辑层 // refreshChartComponent();// 选中之后 刷新下图表编辑层
if (BaseUtils.isAuthorityEditing()) { if (BaseUtils.isAuthorityEditing()) {
JTemplate jTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); JTemplate jTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();

2
designer/src/com/fr/poly/creator/ECBlockEditor.java

@ -143,6 +143,7 @@ public class ECBlockEditor extends BlockEditor<ECBlockPane, PolyECBlock> {
} }
QuickEditorRegion.getInstance().populate(editComponent.getCurrentEditor()); QuickEditorRegion.getInstance().populate(editComponent.getCurrentEditor());
CellElementPropertyPane.getInstance().populate(editComponent); CellElementPropertyPane.getInstance().populate(editComponent);
CellWidgetPropertyPane.getInstance().populate(editComponent);
Selection Selection = ((JWorkBook) (HistoryTemplateListPane.getInstance().getCurrentEditingTemplate())).getEditingElementCasePane().getSelection(); Selection Selection = ((JWorkBook) (HistoryTemplateListPane.getInstance().getCurrentEditingTemplate())).getEditingElementCasePane().getSelection();
if (Selection instanceof FloatSelection) { if (Selection instanceof FloatSelection) {
EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.REPORT_FLOAT); EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.REPORT_FLOAT);
@ -155,6 +156,7 @@ public class ECBlockEditor extends BlockEditor<ECBlockPane, PolyECBlock> {
EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.REPORT); EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.REPORT);
EastRegionContainerPane.getInstance().replaceCellAttrPane(CellElementPropertyPane.getInstance()); EastRegionContainerPane.getInstance().replaceCellAttrPane(CellElementPropertyPane.getInstance());
EastRegionContainerPane.getInstance().replaceCellElementPane(QuickEditorRegion.getInstance()); EastRegionContainerPane.getInstance().replaceCellElementPane(QuickEditorRegion.getInstance());
EastRegionContainerPane.getInstance().replaceWidgetSettingsPane(CellWidgetPropertyPane.getInstance());
} }
EastRegionContainerPane.getInstance().replaceCellAttrPane(CellElementPropertyPane.getInstance()); EastRegionContainerPane.getInstance().replaceCellAttrPane(CellElementPropertyPane.getInstance());

2
designer/src/com/fr/quickeditor/floatquick/FloatImageQuickEditor.java

@ -42,7 +42,7 @@ public class FloatImageQuickEditor extends FloatQuickEditor {
JPanel pane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); JPanel pane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
this.setBorder(BorderFactory.createEmptyBorder(10, 74, 10, 10)); this.setBorder(BorderFactory.createEmptyBorder(10, 78, 10, 17));
this.add(pane, BorderLayout.CENTER); this.add(pane, BorderLayout.CENTER);

3
designer/src/com/fr/quickeditor/floatquick/FloatStringQuickEditor.java

@ -37,6 +37,7 @@ public class FloatStringQuickEditor extends FloatQuickEditor {
JPanel pane = new JPanel(new BorderLayout(5, 0)); JPanel pane = new JPanel(new BorderLayout(5, 0));
pane.add(stringTextField, BorderLayout.CENTER); pane.add(stringTextField, BorderLayout.CENTER);
pane.add(formulaButton, BorderLayout.EAST); pane.add(formulaButton, BorderLayout.EAST);
pane.setBorder(BorderFactory.createEmptyBorder(0,0,0,7));
formulaButton.setVisible(false); formulaButton.setVisible(false);
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
this.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); this.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
@ -72,7 +73,7 @@ public class FloatStringQuickEditor extends FloatQuickEditor {
Formula formula = (Formula) value; Formula formula = (Formula) value;
str = formula.getContent(); str = formula.getContent();
stringTextField.setLineWrap(false); stringTextField.setLineWrap(false);
this.setBorder(BorderFactory.createEmptyBorder(10, 74, 10, 10)); this.setBorder(BorderFactory.createEmptyBorder(10, 78, 10, 10));
reserveInResult = formula.isReserveInResult(); reserveInResult = formula.isReserveInResult();
reserveOnWriteOrAnaly = formula.isReserveOnWriteOrAnaly(); reserveOnWriteOrAnaly = formula.isReserveOnWriteOrAnaly();
} else { } else {

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

@ -8,6 +8,7 @@ import com.fr.general.Inter;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import javax.swing.*; import javax.swing.*;
import javax.swing.border.Border;
import java.awt.*; import java.awt.*;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
@ -18,10 +19,14 @@ public interface UIConstants {
public static final Icon BLACK_ICON = BaseUtils.readIcon("/com/fr/base/images/cell/blank.gif"); public static final Icon BLACK_ICON = BaseUtils.readIcon("/com/fr/base/images/cell/blank.gif");
public static final Border CELL_ATTR_EMPTYBORDER = BorderFactory.createEmptyBorder(0 ,10, 0, 0);
public static final Border CELL_ATTR_NORMALBORDER = BorderFactory.createEmptyBorder(0 ,10, 0, 15);
public static final int SIZE = 17; public static final int SIZE = 17;
public static final int GAP_NORMAL = 10; // 10px
/** /**
* Cell default cursor. * Cell default cursor.
*/ */
@ -81,7 +86,8 @@ public interface UIConstants {
public static final Color AUTHORITY_SHEET_DARK = new Color(86, 120, 143); public static final Color AUTHORITY_SHEET_DARK = new Color(86, 120, 143);
public static final Color AUTHORITY_SHEET_LIGHT = new Color(156, 204, 238); public static final Color AUTHORITY_SHEET_LIGHT = new Color(156, 204, 238);
public static final Color AUTHORITY_SHEET_UNSELECTED = new Color(146, 192, 225); public static final Color AUTHORITY_SHEET_UNSELECTED = new Color(146, 192, 225);
public static final Color ATTRIBUTE_PRESS = new Color(0xD8F2FD); public static final Color ATTRIBUTE_PRESS = new Color(0x419BF9);
public static final Color NORMAL_BLUE = new Color(0x419BF9);
public static final Color ATTRIBUTE_NORMAL = new Color(0xDADADD); public static final Color ATTRIBUTE_NORMAL = new Color(0xDADADD);
public static final Color ATTRIBUTE_HOVER = new Color(0xC9C9CD); public static final Color ATTRIBUTE_HOVER = new Color(0xC9C9CD);
public static final Color CHECKBOX_HOVER_SELECTED = new Color(0x3394f0); public static final Color CHECKBOX_HOVER_SELECTED = new Color(0x3394f0);
@ -93,6 +99,7 @@ public interface UIConstants {
public static final Color RULER_LINE_COLOR = new Color(0xababab); public static final Color RULER_LINE_COLOR = new Color(0xababab);
public static final Color RULER_SCALE_COLOR = new Color(0x4e504f); public static final Color RULER_SCALE_COLOR = new Color(0x4e504f);
public static final Color PROPERTY_PANE_BACKGROUND = new Color(0xdadadd); 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"); public static final BufferedImage DRAG_BAR = BaseUtils.readImage("com/fr/design/images/control/bar.png");
@ -110,6 +117,8 @@ public interface UIConstants {
public static final BufferedImage DRAG_DOT_VERTICAL = BaseUtils.readImage("com/fr/design/images/control/dotv.png"); public static final BufferedImage DRAG_DOT_VERTICAL = BaseUtils.readImage("com/fr/design/images/control/dotv.png");
public static final BufferedImage POP_BUTTON_DOWN = BaseUtils.readImage("com/fr/design/images/buttonicon/popdownarrow.png"); public static final BufferedImage POP_BUTTON_DOWN = BaseUtils.readImage("com/fr/design/images/buttonicon/popdownarrow.png");
public static final BufferedImage POP_BUTTON_UP = BaseUtils.readImage("com/fr/design/images/buttonicon/popuparrow.png"); public static final BufferedImage POP_BUTTON_UP = BaseUtils.readImage("com/fr/design/images/buttonicon/popuparrow.png");
public static final BufferedImage DRAG_DOWN_SELECTED_SMALL = BaseUtils.readImage("com/fr/design/images/buttonicon/downSelected.png");
public static final BufferedImage DRAG_LEFT_NORMAL_SMALL = BaseUtils.readImage("com/fr/design/images/buttonicon/leftNormal.png");
public static final int MODEL_NORMAL = 0; public static final int MODEL_NORMAL = 0;
public static final int MODEL_PRESS = 1; public static final int MODEL_PRESS = 1;
public static final Icon ARROW_DOWN_ICON = BaseUtils.readIcon("com/fr/design/images/buttonicon/arrowdown.png"); public static final Icon ARROW_DOWN_ICON = BaseUtils.readIcon("com/fr/design/images/buttonicon/arrowdown.png");
@ -139,10 +148,11 @@ public interface UIConstants {
public static final Icon SEARCH_ICON = BaseUtils.readIcon("/com/fr/design/images/data/search.png"); 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 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_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 PRESSED_DARK_GRAY = new Color(127, 127, 127);
public static final Color GRDIENT_DARK_GRAY = new Color(45, 45, 45); public static final Color GRDIENT_DARK_GRAY = new Color(45, 45, 45);
public static final Color BARNOMAL = new Color(232, 232, 233); public static final Color BARNOMAL = new Color(232, 232, 233);
public static final Color COMPONENT_BACKGROUND_COLOR = new Color(237,237,238);
public static final int ARC = 0; public static final int ARC = 0;
public static final int BUTTON_GROUP_ARC = 6; public static final int BUTTON_GROUP_ARC = 6;
public static final int LARGEARC = 6; public static final int LARGEARC = 6;

2
designer_base/src/com/fr/design/data/datapane/TableDataTree.java

@ -74,7 +74,7 @@ public class TableDataTree extends UserObjectRefreshJTree<TableDataSourceOP> {
dim.height += 2; dim.height += 2;
this.setSize(dim); this.setSize(dim);
this.setPreferredSize(dim); this.setPreferredSize(dim);
this.setBackgroundNonSelectionColor(UIConstants.NORMAL_BACKGROUND); this.setBackgroundNonSelectionColor(UIConstants.TREE_BACKGROUND);
this.setForeground(UIConstants.FONT_COLOR); this.setForeground(UIConstants.FONT_COLOR);
this.setBackgroundSelectionColor(UIConstants.FLESH_BLUE); this.setBackgroundSelectionColor(UIConstants.FLESH_BLUE);
return this; return this;

31
designer_base/src/com/fr/design/foldablepane/HeaderPane.java

@ -11,6 +11,9 @@ import java.awt.image.BufferedImage;
*/ */
public class HeaderPane extends JPanel { public class HeaderPane extends JPanel {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private static final int TITLE_X = 9;
private static final int LEFT_X = 221;
private static final int LEFT_Y = 6;
private int headWidth = 280; private int headWidth = 280;
private int headHeight = 25; private int headHeight = 25;
private Color bgColor; private Color bgColor;
@ -52,19 +55,19 @@ public class HeaderPane extends JPanel {
private BufferedImage createPanelImage() { private BufferedImage createPanelImage() {
BufferedImage panelImage = new BufferedImage(getWidth(), headHeight, BufferedImage.TYPE_INT_ARGB); BufferedImage panelImage = new BufferedImage(getWidth(), headHeight, BufferedImage.TYPE_INT_ARGB);
Graphics2D g2d = panelImage.createGraphics(); Graphics2D g2d = panelImage.createGraphics();
g2d.setColor(UIConstants.COMPONENT_BACKGROUND_COLOR);
g2d.fillRect(0, 0, headWidth, headHeight); g2d.fillRect(0, 0, headWidth, headHeight);
g2d.drawImage(UIConstants.DRAG_BAR, 0, 0, headWidth, headHeight, null); // g2d.drawImage(UIConstants.DRAG_BAR, 0, 0, headWidth, headHeight, null);
g2d.setFont(new Font("SimSun", 0, fontSize)); g2d.setFont(new Font("SimSun", 0, fontSize));
g2d.setPaint(bgColor); g2d.setPaint(bgColor);
// g2d.drawString(this.title, fontSize/2, headHeight-fontSize/3); // g2d.drawString(this.title, fontSize/2, headHeight-fontSize/3);
g2d.drawString(this.title, 0, headHeight - fontSize / 2 - 1); g2d.drawString(this.title, TITLE_X, headHeight - fontSize / 2 - 1);
if (this.isShow) { if (this.isShow) {
image = UIConstants.DRAG_DOWN_PRESS; image = UIConstants.DRAG_DOWN_SELECTED_SMALL;
g2d.drawImage(image, title.length() * fontSize, headHeight / 2 - 1, null); g2d.drawImage(image, LEFT_X, LEFT_Y, null);
} else { } else {
image = UIConstants.DRAG_RIGHT_PRESS; image = UIConstants.DRAG_LEFT_NORMAL_SMALL;
g2d.drawImage(image, title.length() * fontSize, headHeight / 3, null); g2d.drawImage(image, LEFT_X, LEFT_Y , null);
} }
@ -95,13 +98,13 @@ public class HeaderPane extends JPanel {
} }
public static void main(String[] args) { public static void main(String[] args) {
// JFrame mainFrame = new JFrame("UI Demo - Gloomyfish"); JFrame mainFrame = new JFrame("UI Demo - Gloomyfish");
// mainFrame.getContentPane().setLayout(new BorderLayout()); mainFrame.getContentPane().setLayout(new BorderLayout());
// mainFrame.getContentPane().add(new HeaderPane(Color.black, "基本", 280, 24), BorderLayout.CENTER); mainFrame.getContentPane().add(new HeaderPane(Color.black, "基本", 280, 24), BorderLayout.CENTER);
// mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
// mainFrame.pack(); mainFrame.pack();
// mainFrame.setSize(280, 400); mainFrame.setSize(250, 400);
// mainFrame.setVisible(true); mainFrame.setVisible(true);
} }
} }

3
designer_base/src/com/fr/design/foldablepane/UIExpandablePane.java

@ -1,5 +1,7 @@
package com.fr.design.foldablepane; package com.fr.design.foldablepane;
import com.fr.design.constants.UIConstants;
import java.awt.*; import java.awt.*;
import java.awt.event.MouseAdapter; import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
@ -35,6 +37,7 @@ public class UIExpandablePane extends JPanel {
headerPanel = new HeaderPane(color, title,headWidth,headHeight); headerPanel = new HeaderPane(color, title,headWidth,headHeight);
headerPanel.addMouseListener(new PanelAction()); headerPanel.addMouseListener(new PanelAction());
contentPanel.setBorder(UIConstants.CELL_ATTR_NORMALBORDER);
this.add(headerPanel, BorderLayout.NORTH); this.add(headerPanel, BorderLayout.NORTH);
this.add(contentPanel, BorderLayout.CENTER); this.add(contentPanel, BorderLayout.CENTER);
setOpaque(false); setOpaque(false);

20
designer_base/src/com/fr/design/formula/TinyFormulaPane.java

@ -76,23 +76,15 @@ public class TinyFormulaPane extends BasicBeanPane<String> implements UIObserver
protected void initLayout() { protected void initLayout() {
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double f = TableLayout.FILL; double f = TableLayout.FILL;
double[] columnSize = {f };
double[] rowSize = { p };
Component[] components1 = new Component[]{
formulaTextFieldButton
} ;
JPanel pane = new JPanel(new BorderLayout(0,0)); JPanel pane = new JPanel(new BorderLayout(0,0));
pane.add(formulaTextField,BorderLayout.CENTER); JPanel pane1 = new JPanel(new BorderLayout(0,0));
pane.add(GUICoreUtils.createFlowPane(components1,FlowLayout.LEFT, LayoutConstants.HGAP_LARGE),BorderLayout.EAST); pane1.add(formulaTextField, BorderLayout.NORTH);
pane1.setBorder(BorderFactory.createEmptyBorder(0,0,0,5));
Component[][] components2 = new Component[][]{ pane.add(pane1,BorderLayout.CENTER);
new Component[]{pane} pane.add(formulaTextFieldButton,BorderLayout.EAST);
};
JPanel panel= TableLayoutHelper.createTableLayoutPane(components2,rowSize,columnSize) ;
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
this.add(panel,BorderLayout.CENTER) ; this.add(pane,BorderLayout.NORTH) ;
} }
/** /**

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

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

File diff suppressed because it is too large Load Diff

3
designer_base/src/com/fr/design/gui/frpane/UIComboBoxPane.java

@ -2,6 +2,7 @@ package com.fr.design.gui.frpane;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
import com.fr.design.beans.FurtherBasicBeanPane; import com.fr.design.beans.FurtherBasicBeanPane;
import com.fr.design.constants.UIConstants;
import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIComboBox;
import javax.swing.*; import javax.swing.*;
@ -52,7 +53,6 @@ public abstract class UIComboBoxPane<T> extends BasicBeanPane<T> {
addItemChangeEvent(); addItemChangeEvent();
initLayout(); initLayout();
jcb.setSelectedIndex(0); jcb.setSelectedIndex(0);
} }
@ -98,6 +98,7 @@ public abstract class UIComboBoxPane<T> extends BasicBeanPane<T> {
JPanel northPane = new JPanel(new BorderLayout()); JPanel northPane = new JPanel(new BorderLayout());
northPane.add(jcb, BorderLayout.CENTER); northPane.add(jcb, BorderLayout.CENTER);
this.add(northPane, BorderLayout.NORTH); this.add(northPane, BorderLayout.NORTH);
northPane.setBorder(UIConstants.CELL_ATTR_NORMALBORDER);
this.add(cardPane, BorderLayout.CENTER); this.add(cardPane, BorderLayout.CENTER);
} }

2
designer_base/src/com/fr/design/gui/frpane/UITabbedPaneUI.java

@ -30,7 +30,7 @@ public class UITabbedPaneUI extends BasicTabbedPaneUI {
private int addY = -1; private int addY = -1;
private int rollover = -1; private int rollover = -1;
private Color tabBorderColor = new Color(143, 160, 183); private Color tabBorderColor = new Color(143, 160, 183);
private Color[] tabSelectedColor = {new Color(255, 199, 59), new Color(187, 142, 33), new Color(214, 191, 137)}; private Color[] tabSelectedColor = {UIConstants.NORMAL_BLUE, new Color(187, 142, 33), new Color(214, 191, 137)};
/** /**
* 创建UI对象 * 创建UI对象

2
designer_base/src/com/fr/design/gui/ibutton/UIRadioButton.java

@ -43,6 +43,4 @@ public class UIRadioButton extends JRadioButton {
public UIRadioButton(String text, Icon icon, boolean selected) { public UIRadioButton(String text, Icon icon, boolean selected) {
super(text, icon, selected); super(text, icon, selected);
} }
} }

7
designer_base/src/com/fr/design/gui/style/FormatPane.java

@ -67,6 +67,7 @@ public class FormatPane extends AbstractBasicStylePane {
*/ */
public FormatPane() { public FormatPane() {
this.initComponents(TYPES); this.initComponents(TYPES);
this.setBorder(UIConstants.CELL_ATTR_NORMALBORDER);
} }
protected void initComponents(Integer[] types) { protected void initComponents(Integer[] types) {
@ -97,13 +98,17 @@ public class FormatPane extends AbstractBasicStylePane {
textField.setEditable(true); textField.setEditable(true);
txtCenterPane.add(textField, BorderLayout.NORTH); txtCenterPane.add(textField, BorderLayout.NORTH);
frFontPane = new FRFontPane(); frFontPane = new FRFontPane();
UILabel font = new UILabel(Inter.getLocText("FR-Designer_FRFont"), SwingConstants.LEFT);
JPanel fontPane = new JPanel(new BorderLayout());
fontPane.add(font, BorderLayout.NORTH);
double f = TableLayout.FILL; double f = TableLayout.FILL;
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{null, null}, new Component[]{null, null},
new Component[]{new UILabel(Inter.getLocText("FR-Base_Format") + " ", SwingConstants.LEFT), typeComboBox}, new Component[]{new UILabel(Inter.getLocText("FR-Base_Format") + " ", SwingConstants.LEFT), typeComboBox},
new Component[]{null, centerPane}, new Component[]{null, centerPane},
new Component[]{new UILabel(Inter.getLocText("FR-Designer_FRFont"), SwingConstants.LEFT), frFontPane}, new Component[]{fontPane, frFontPane},
new Component[]{null, null} new Component[]{null, null}
}; };
double[] rowSize = {p, p, p, p, p}; double[] rowSize = {p, p, p, p, p};

BIN
designer_base/src/com/fr/design/images/buttonicon/downSelected.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 177 B

BIN
designer_base/src/com/fr/design/images/buttonicon/leftNormal.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 165 B

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 250 B

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

@ -2105,3 +2105,16 @@ FR-Designer_Insert_Text=Insert_Text
FR-Designer_Double=Double FR-Designer_Double=Double
FR-Designer_Add_Event=Add Event FR-Designer_Add_Event=Add Event
FR-Designer_Not_Support_Authority_Edit=this element does not support authority edit FR-Designer_Not_Support_Authority_Edit=this element does not support authority edit
FR-Designer_Remove_Item=Remove Item
FR-Designer_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
FR-Designer_Widget_Name=Widget Name
FR-Designer_Coords_And_Size=Coords & Size

14
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-Selected_Widget=Selected widget
FR-Designer_LocalWidget=Local component library FR-Designer_LocalWidget=Local component library
FR-Designer_AllCategories=All categories FR-Designer_AllCategories=All categories
FR-Designer_Download_Template=Download components FR-Designer_Download_Template=Download
FR-Designer_Install_Template=Install components FR-Designer_Install_Template=Install
FR-Designer_Delete_Template=Delete components FR-Designer_Delete_Template=Delete
FR-Designer_Mobile-Refresh=Refresh FR-Designer_Mobile-Refresh=Refresh
FR-Designer_Mobile-ToolBar=Toolbar FR-Designer_Mobile-ToolBar=Toolbar
FR-Designer_WLayout-Absolute-ToolTips=Freestyle layout, add control in any position of the layout FR-Designer_WLayout-Absolute-ToolTips=Freestyle layout, add control in any position of the layout
@ -2106,3 +2106,11 @@ FR-Designer_Scale_Slider=Scale_Slider
FR-Designer_Scale_Grade=Scale_Grade FR-Designer_Scale_Grade=Scale_Grade
FR-Designer_Add_Event=Add Event FR-Designer_Add_Event=Add Event
FR-Designer_Not_Support_Authority_Edit=this element does not support authority edit FR-Designer_Not_Support_Authority_Edit=this element does not support authority edit
FR-Designer_Remove_Item=Remove Item
FR-Designer_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
FR-Designer_Widget_Name=Widget Name
FR-Designer_Coords_And_Size=Coords & Size

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

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

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

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

19
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_SimpleDetail_Report=\u7B80\u5355\u660E\u7EC6\u8868
FR-Designer_SimpleCross_Report=\u7B80\u5355\u4EA4\u53C9\u8868 FR-Designer_SimpleCross_Report=\u7B80\u5355\u4EA4\u53C9\u8868
FR-Designer_DoubleLayer_Report=\u53CC\u5C42\u8868\u5934 FR-Designer_DoubleLayer_Report=\u53CC\u5C42\u8868\u5934
FR-Designer_Download_Template=\u4E0B\u8F7D\u7EC4\u4EF6 FR-Designer_Download_Template=\u4E0B\u8F7D
FR-Designer_Install_Template=\u5B89\u88C5\u7EC4\u4EF6 FR-Designer_Install_Template=\u5B89\u88C5
FR-Designer_Delete_Template=\u5220\u9664\u7EC4\u4EF6 FR-Designer_Delete_Template=\u5220\u9664
FR-Designer_Mobile-ToolBar=\u5DE5\u5177\u680F FR-Designer_Mobile-ToolBar=\u5DE5\u5177\u680F
FR-Designer_Mobile-Refresh=\u5237\u65B0 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 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,16 @@ FR-Designer_Scale_Up=\u653E\u5927
FR-Designer_Scale_Slider=\u7F29\u653E\u6ED1\u5757 FR-Designer_Scale_Slider=\u7F29\u653E\u6ED1\u5757
FR-Designer_Scale_Grade=\u7F29\u653E\u7EA7\u522B\uFF0C\u5355\u51FB\u540E\u8C03\u8282\u663E\u793A\u6BD4\u4F8B\u3002 FR-Designer_Scale_Grade=\u7F29\u653E\u7EA7\u522B\uFF0C\u5355\u51FB\u540E\u8C03\u8282\u663E\u793A\u6BD4\u4F8B\u3002
FR-Designer_Not_Support_Authority_Edit=\u8BE5\u5143\u7D20\u4E0D\u652F\u6301\u6743\u9650\u63A7\u5236 FR-Designer_Not_Support_Authority_Edit=\u8BE5\u5143\u7D20\u4E0D\u652F\u6301\u6743\u9650\u63A7\u5236
FR-Designer_Remove_Item=\u5220\u9664\u9009\u4E2D
FR-Designer_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
FR-Designer_Widget_Name=\u63A7\u4EF6\u540D\u79F0
FR-Designer_Coords_And_Size=\u5750\u6807\u00B7\u5C3A\u5BF8

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

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

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

@ -28,7 +28,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
private JPanel leftPane; private JPanel leftPane;
private JPanel rightPane; private JPanel rightPane;
private FixedPopupPane currentPopupPane; 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_WIDTH = 38;
private static final int TAB_BUTTON_WIDTH = 32; private static final int TAB_BUTTON_WIDTH = 32;
private static final int TAB_BUTTON_HEIGHT = 28; private static final int TAB_BUTTON_HEIGHT = 28;

50
designer_base/src/com/fr/design/mainframe/widget/BasicPropertyPane.java

@ -0,0 +1,50 @@
package com.fr.design.mainframe.widget;
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.general.Inter;
import javax.swing.*;
import java.awt.*;
/**
* Created by plough on 2017/8/7.
*/
public class BasicPropertyPane extends BasicPane {
protected UITextField widgetName;
public BasicPropertyPane(){
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("FR-Designer_Widget_Name")), widgetName},
};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 20, 7);
panel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 15));
this.add(panel, BorderLayout.NORTH);
}
public UITextField getWidgetNameField() {
return widgetName;
}
@Override
public String title4PopupWindow() {
return "basicProperty";
}
}

6
designer_base/src/com/fr/design/mainframe/widget/editors/DataBindingEditor.java

@ -27,6 +27,8 @@ import com.fr.general.Inter;
* @since 2012-3-29下午5:26:28 * @since 2012-3-29下午5:26:28
*/ */
public class DataBindingEditor extends Editor<DataBinding> { public class DataBindingEditor extends Editor<DataBinding> {
private final static int HORI_GAP = 1;
private final static int VER_GAP = 7;
private TableDataComboBox tableDataComboBox; private TableDataComboBox tableDataComboBox;
private LazyComboBox columnNameComboBox; private LazyComboBox columnNameComboBox;
@ -61,7 +63,7 @@ public class DataBindingEditor extends Editor<DataBinding> {
private void initCompontents() { private void initCompontents() {
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(new BorderLayout(HORI_GAP, VER_GAP));
tableDataComboBox = new TableDataComboBox(getTableDataSource()); tableDataComboBox = new TableDataComboBox(getTableDataSource());
tableDataComboBox.setPreferredSize(new Dimension(55, 20)); tableDataComboBox.setPreferredSize(new Dimension(55, 20));
tableDataComboBox.addItemListener(tableDataComboBoxListener); tableDataComboBox.addItemListener(tableDataComboBoxListener);
@ -86,7 +88,7 @@ public class DataBindingEditor extends Editor<DataBinding> {
} }
}); });
columnNameComboBox.setEditable(true); columnNameComboBox.setEditable(true);
this.add(tableDataComboBox, BorderLayout.WEST); this.add(tableDataComboBox, BorderLayout.NORTH);
this.add(columnNameComboBox, BorderLayout.CENTER); this.add(columnNameComboBox, BorderLayout.CENTER);
columnNameComboBox.addItemListener(columnNameComboboxListener); columnNameComboBox.addItemListener(columnNameComboboxListener);
} }

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

52
designer_base/src/com/fr/design/widget/WidgetBoundsPaneFactory.java

@ -0,0 +1,52 @@
package com.fr.design.widget;
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.general.Inter;
import javax.swing.*;
import java.awt.*;
/**
* Created by plough on 2017/8/7.
*/
public class WidgetBoundsPaneFactory {
public static UIExpandablePane createBoundsPane(UISpinner width, UISpinner height) {
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
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, 15));
return new UIExpandablePane(Inter.getLocText("FR-Designer_Coords_And_Size"), 280, 24, panel);
}
public static UIExpandablePane createAbsoluteBoundsPane(UISpinner x, UISpinner y, UISpinner width, UISpinner height) {
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
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, 15));
return new UIExpandablePane(Inter.getLocText("FR-Designer_Coords_And_Size"), 230, 24, panel);
}
}

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

@ -30,38 +30,38 @@ public abstract class ButtonWithHotkeysDetailPane<T extends Button> extends Butt
initComponents(); initComponents();
} }
private void initComponents() { private void initComponents() {
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
JPanel advancedPane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("FR-Designer_Advanced")); JPanel advancedPane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("FR-Designer_Advanced"));
advancedPane.setPreferredSize(new Dimension(600, 341)); advancedPane.setPreferredSize(new Dimension(600, 341));
JPanel attrPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel attrPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
attrPane.setBorder(BorderFactory.createEmptyBorder(0, 4, 0, 4)); attrPane.setBorder(BorderFactory.createEmptyBorder(0, 4, 0, 4));
this.add(advancedPane); this.add(advancedPane);
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double rowSize[] = {p, p, p, p}; double rowSize[] = {p, p, p, p};
double columnSize[] = {p, p}; double columnSize[] = {p, p};
JPanel labelPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); JPanel labelPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
iconPane = new IconDefinePane(); iconPane = new IconDefinePane();
labelPane.add(iconPane); labelPane.add(iconPane);
Component[][] n_components = { Component[][] n_components = {
{new UILabel(Inter.getLocText("FR-Designer_Button-Name") + ":"), buttonNameTextField = new UITextField(16)}, {new UILabel(Inter.getLocText("FR-Designer_Button-Name") + ":"), buttonNameTextField = new UITextField(16)},
{new UILabel(Inter.getLocText("FR-Designer_Button-Icon") + ":"), labelPane}, {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-Type") + ":"), createButtonTypeComboBox()},
{new UILabel(Inter.getLocText("FR-Designer_Button-Hotkeys") + ":"), hotkeysTextField = new UITextField(16)} {new UILabel(Inter.getLocText("FR-Designer_Button-Hotkeys") + ":"), hotkeysTextField = new UITextField(16)}
}; };
hotkeysTextField.setToolTipText(StableUtils.join(ButtonConstants.HOTKEYS, ",")); hotkeysTextField.setToolTipText(StableUtils.join(ButtonConstants.HOTKEYS, ","));
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(n_components, rowSize, columnSize, 0, 8); JPanel panel = TableLayoutHelper.createGapTableLayoutPane(n_components, rowSize, columnSize, 0, 8);
advancedPane.add(panel,BorderLayout.NORTH); advancedPane.add(panel,BorderLayout.NORTH);
Component comp = createCenterPane(); Component comp = createCenterPane();
if(comp != null ) { if(comp != null ) {
advancedPane.add(comp,BorderLayout.CENTER); advancedPane.add(comp,BorderLayout.CENTER);
} }
} }
protected abstract Component createCenterPane(); protected abstract Component createCenterPane();
@Override @Override
public void populate(Button button) { public void populate(Button button) {
if (button == null) { if (button == null) {
return; return;
} }
@ -71,7 +71,7 @@ public abstract class ButtonWithHotkeysDetailPane<T extends Button> extends Butt
} }
@Override @Override
public T update() { public T update() {
T button = createButton(); T button = createButton();
button.setIconName(iconPane.update()); button.setIconName(iconPane.update());
button.setText(buttonNameTextField.getText()); button.setText(buttonNameTextField.getText());

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

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

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

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

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

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

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

@ -29,6 +29,8 @@ public class XWTitleLayout extends DedicateLayoutContainer {
*/ */
private static final long serialVersionUID = 5274572473978467325L; private static final long serialVersionUID = 5274572473978467325L;
private static final int INDEX = 0;
public XWTitleLayout() { public XWTitleLayout() {
super(new WTitleLayout("titlePane"), new Dimension()); super(new WTitleLayout("titlePane"), new Dimension());
} }
@ -59,6 +61,10 @@ public class XWTitleLayout extends DedicateLayoutContainer {
return new FRTitleLayoutAdapter(this); return new FRTitleLayoutAdapter(this);
} }
public XCreator getEditingChildCreator(){
return getXCreator(INDEX);
}
/** /**
* 返回容器对应的wlayout * 返回容器对应的wlayout
* *

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( EastRegionContainerPane.getInstance().replaceWidgetLibPane(
FormWidgetDetailPane.getInstance(this)); FormWidgetDetailPane.getInstance(this));
if (!BaseUtils.isAuthorityEditing()) { if (!BaseUtils.isAuthorityEditing()) {
EastRegionContainerPane.getInstance().addParameterPane(ParameterPropertyPane.getInstance(this)); ParameterPropertyPane parameterPropertyPane = ParameterPropertyPane.getInstance(this);
EastRegionContainerPane.getInstance().setParameterHeight(ParameterPropertyPane.getInstance(this).getPreferredSize().height); parameterPropertyPane.setAddParaPaneVisible(true);
EastRegionContainerPane.getInstance().addParameterPane(parameterPropertyPane);
EastRegionContainerPane.getInstance().setParameterHeight(parameterPropertyPane.getPreferredSize().height);
EastRegionContainerPane.getInstance().replaceWidgetSettingsPane( EastRegionContainerPane.getInstance().replaceWidgetSettingsPane(
WidgetPropertyPane.getInstance(this)); WidgetPropertyPane.getInstance(this));
} else { } else {

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

@ -1,12 +1,24 @@
package com.fr.design.mainframe; package com.fr.design.mainframe;
import java.awt.*; import java.awt.*;
import java.awt.event.ActionEvent;
import java.util.ArrayList;
import javax.swing.BorderFactory; import javax.swing.*;
import javax.swing.Icon;
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.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.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.parameter.HierarchyTreePane;
import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XWParameterLayout; 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 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.base.BaseUtils;
import com.fr.general.Inter; 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 PARA = 0;
public static final int BODY = 1; public static final int BODY = 1;
private ShortCut4JControlPane[] shorts;
private ComponentTree componentTree; private ComponentTree componentTree;
private UITreeComboBox treeComboBox; private UITreeComboBox treeComboBox;
// richer:搜寻树节点的的文本框 private ChangeNameAction changeVarNameAction;
// private UITextField searchTextField;
// private SearchResultPane searchResult;
public static FormHierarchyTreePane getInstance() { public static FormHierarchyTreePane getInstance() {
return HOLDER.singleton; return HOLDER.singleton;
@ -77,9 +83,6 @@ public class FormHierarchyTreePane extends FormDockView implements HierarchyTree
*/ */
public void clearDockingView() { public void clearDockingView() {
this.componentTree = null; this.componentTree = null;
// this.searchTextField = null;
// this.searchResult = null;
// add(new JScrollPane(), BorderLayout.CENTER);
} }
@Override @Override
@ -108,51 +111,60 @@ public class FormHierarchyTreePane extends FormDockView implements HierarchyTree
if(childCount == NODE_LENGTH){ if(childCount == NODE_LENGTH){
adjustPosition(treeModel, formDesigner); adjustPosition(treeModel, formDesigner);
} }
add(getWidgetPane(), BorderLayout.CENTER);
}
private JPanel getWidgetPane() {
shorts = createShortcuts();
JPanel widgetPane = new JPanel(); JPanel widgetPane = new JPanel();
widgetPane.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0)); widgetPane.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0));
widgetPane.setLayout(FRGUIPaneFactory.createBorderLayout()); 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); SwingConstants.HORIZONTAL), BorderLayout.WEST);
headPane.add(getToolBarPane(), BorderLayout.EAST);
widgetPane.add(headPane, BorderLayout.CENTER);
treeComboBox = new UITreeComboBox(componentTree); treeComboBox = new UITreeComboBox(componentTree);
widgetPane.add(treeComboBox, BorderLayout.CENTER); widgetPane.add(treeComboBox, BorderLayout.SOUTH);
add(widgetPane, BorderLayout.CENTER); return widgetPane;
}
// UIScrollPane scrollPane = new UIScrollPane(componentTree); private JPanel getToolBarPane() {
// scrollPane.setBorder(null); ToolBarDef toolbarDef = new ToolBarDef();
// add(scrollPane, BorderLayout.CENTER); for (ShortCut4JControlPane sj : shorts) {
// JPanel searchPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); toolbarDef.addShortCut(sj.getShortCut());
// add(searchPane, BorderLayout.NORTH); }
// searchPane.add(new UILabel(Inter.getLocText("FR-Designer_Search") + ":", UIToolbar toolBar = ToolBarDef.createJToolBar();
// SwingConstants.HORIZONTAL), BorderLayout.WEST); toolBar.setUI(new UIToolBarUI(){
// searchTextField = new UITextField(); @Override
// searchPane.add(searchTextField, BorderLayout.CENTER); public void paint(Graphics g, JComponent c) {
// searchTextField.getDocument().addDocumentListener(new DocumentListener() { Graphics2D g2 = (Graphics2D) g;
// @Override g2.setColor(new Color(245, 245, 247));
// public void insertUpdate(DocumentEvent e) { g2.fillRect(0, 0, c.getWidth(), c.getHeight());
// search(); }
// } });
// toolbarDef.updateToolBar(toolBar);
// @Override JPanel toolBarPane = new JPanel(new BorderLayout());
// public void removeUpdate(DocumentEvent e) { toolBarPane.add(toolBar, BorderLayout.CENTER);
// search(); return toolBarPane;
// } }
//
// @Override protected ShortCut4JControlPane[] createShortcuts() {
// public void changedUpdate(DocumentEvent e) { ArrayList<ShortCut4JControlPane> shortCutList = new ArrayList<>();
// search(); FormDesigner designer = getEditingFormDesigner();
// } if (changeVarNameAction == null) {
// changeVarNameAction = new ChangeNameAction(designer);
// private void search() { }
// String text = searchTextField.getText(); shortCutList.add(new WidgetEnableShortCut(changeVarNameAction));
// if (StringUtils.isEmpty(text)) { for (Action action : designer.getActions()) {
// removeSearchResult(); shortCutList.add(new WidgetEnableShortCut((UndoableAction)action));
// } else { }
// populate(componentTree.search(text));
// } return shortCutList.toArray(new ShortCut4JControlPane[shortCutList.size()]);
// }
// });
} }
/** /**
@ -188,113 +200,6 @@ public class FormHierarchyTreePane extends FormDockView implements HierarchyTree
componentTree.refreshTreeRoot(); 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 @Override
/** /**
* 位置 * 位置
@ -304,4 +209,18 @@ public class FormHierarchyTreePane extends FormDockView implements HierarchyTree
public Location preferredLocation() { public Location preferredLocation() {
return Location.WEST_BELOW; 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.base.FRContext;
import com.fr.design.gui.frpane.UITabbedPane; import com.fr.design.gui.frpane.UITabbedPane;
import com.fr.design.gui.ibutton.UIButton; 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.icombobox.UIComboBox;
import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.imenu.UIMenuItem; import com.fr.design.gui.imenu.UIMenuItem;
import com.fr.design.gui.imenu.UIPopupMenu; import com.fr.design.gui.imenu.UIPopupMenu;
import com.fr.design.icon.IconPathConstants;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.form.share.ShareLoader; import com.fr.form.share.ShareLoader;
@ -40,7 +42,7 @@ import java.net.URISyntaxException;
*/ */
public class FormWidgetDetailPane extends FormDockView{ public class FormWidgetDetailPane extends FormDockView{
private UITabbedPane tabbedPane; private JPanel tabbedPane;
private UIScrollPane downPane; private UIScrollPane downPane;
private JPanel reuWidgetPanel; private JPanel reuWidgetPanel;
private UIComboBox comboBox; private UIComboBox comboBox;
@ -50,11 +52,16 @@ public class FormWidgetDetailPane extends FormDockView{
private JPanel editPanel; private JPanel editPanel;
private JPanel resetPanel; private JPanel resetPanel;
private JPanel menutPanel; private JPanel menutPanel;
private JPanel menutPanelNorthPane;
private static final int OFFSET_X = 140; private static final int OFFSET_X = 140;
private static final int OFFSET_Y = 26; private static final int OFFSET_Y = 26;
private SwingWorker sw; private SwingWorker sw;
//组件面板是否可以编辑 //组件面板是否可以编辑
private boolean isEdit; 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() { public static FormWidgetDetailPane getInstance() {
if (HOLDER.singleton == null) { if (HOLDER.singleton == null) {
@ -115,12 +122,21 @@ public class FormWidgetDetailPane extends FormDockView{
} }
initReuWidgetPanel(); initReuWidgetPanel();
initMenuPanel(); initMenuPanel();
tabbedPane = new UITabbedPane();
tabbedPane.setOpaque(true); card = new CardLayout();
tabbedPane.setBorder(null); tabbedPane = new JPanel();
tabbedPane.setTabPlacement(SwingConstants.BOTTOM); tabbedPane.setLayout(card);
tabbedPane.addTab(Inter.getLocText("FR-Engine_Report"), reuWidgetPanel); tabbedPane.add(REPORT_TAB, reuWidgetPanel);
tabbedPane.addTab(Inter.getLocText("FR-Designer-Form-ToolBar_Chart"), new JPanel()); 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); add(tabbedPane, BorderLayout.CENTER);
} }
@ -140,17 +156,20 @@ public class FormWidgetDetailPane extends FormDockView{
private void initMenuPanel() { private void initMenuPanel() {
menutPanel = new JPanel(); menutPanel = new JPanel();
menutPanel.setLayout(FRGUIPaneFactory.createBorderLayout()); menutPanel.setLayout(FRGUIPaneFactory.createBorderLayout());
menutPanel.setBorder(BorderFactory.createEmptyBorder(3, 8, 3, 3)); menutPanel.setBorder(BorderFactory.createEmptyBorder(3, 10, 10, 15));
menutPanel.setPreferredSize(new Dimension(240, 48)); // menutPanel.setPreferredSize(new Dimension(240, 48));
menutPanel.add(new UILabel(Inter.getLocText("FR-Designer_LocalWidget"),
menutPanelNorthPane = new JPanel(new BorderLayout());
menutPanelNorthPane.add(new UILabel(Inter.getLocText("FR-Designer_LocalWidget"),
SwingConstants.HORIZONTAL), BorderLayout.WEST); SwingConstants.HORIZONTAL), BorderLayout.WEST);
menutPanelNorthPane.add(initEditButtonPane(), BorderLayout.EAST);
menutPanelNorthPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 0));
menutPanel.add(initEditButtonPane(), BorderLayout.EAST); menutPanel.add(menutPanelNorthPane, BorderLayout.NORTH);
menutPanel.add(new JPanel(), BorderLayout.CENTER);
comboBox = new UIComboBox(getFormCategories()); comboBox = new UIComboBox(getFormCategories());
comboBox.setPreferredSize(new Dimension(240, 30)); comboBox.setPreferredSize(new Dimension(240, comboBox.getPreferredSize().height));
initComboBoxSelectedListener(); initComboBoxSelectedListener();
menutPanel.add(comboBox, BorderLayout.SOUTH); menutPanel.add(comboBox, BorderLayout.CENTER);
reuWidgetPanel.add(menutPanel, BorderLayout.NORTH); reuWidgetPanel.add(menutPanel, BorderLayout.NORTH);
} }
@ -159,10 +178,13 @@ public class FormWidgetDetailPane extends FormDockView{
* 创建菜单栏按钮面板 * 创建菜单栏按钮面板
*/ */
private JPanel initEditButtonPane() { private JPanel initEditButtonPane() {
editPanel = new JPanel(); editPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT, 0, 0));
editPanel.setLayout(FRGUIPaneFactory.createBorderLayout());
editPanel.add(createRefreshButton(), BorderLayout.WEST); editPanel.add(createRefreshButton());
editPanel.add(createDownloadButton(), BorderLayout.EAST); editPanel.add(createDownloadButton());
editPanel.add(createInstallButton());
editPanel.add(createDeleteButton());
return editPanel; return editPanel;
} }
@ -185,8 +207,38 @@ public class FormWidgetDetailPane extends FormDockView{
reuWidgetPanel.remove(deleteButton); 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.setLayout(FRGUIPaneFactory.createBorderLayout());
resetPanel.add(resetButton, BorderLayout.CENTER); resetPanel.add(resetButton, BorderLayout.CENTER);
resetPanel.add(deletePane, BorderLayout.WEST);
refreshDownPanel(true);
return resetPanel; 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() { private UIButton createRefreshButton() {
UIButton refreshButton = new UIButton(); return createToolButton(
refreshButton.setIcon(BaseUtils.readIcon("/com/fr/design/form/images/refresh.png")); BaseUtils.readIcon("/com/fr/design/form/images/refresh.png"),
refreshButton.setToolTipText(Inter.getLocText("FR-Designer_Refresh")); Inter.getLocText("FR-Designer_Refresh"),
refreshButton.set4ToolbarButton(); new ActionListener() {
refreshButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (sw != null) {
sw.cancel(true);
}
sw = new SwingWorker() {
@Override @Override
protected Object doInBackground() throws Exception { public void actionPerformed(ActionEvent e) {
ShareLoader.getLoader().refreshModule(); if (sw != null) {
elCaseBindInfoList = ShareLoader.getLoader().getAllBindInfoList(); sw.cancel(true);
refreshComboxData(); }
refreshDownPanel(false); sw = new SwingWorker() {
return null; @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() { private void refreshComboxData() {
@ -251,30 +314,10 @@ public class FormWidgetDetailPane extends FormDockView{
*/ */
private UIButton createDownloadButton() { private UIButton createDownloadButton() {
UIButton downloadButton = new UIButton(); 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.set4ToolbarButton();
downloadButton.setToolTipText(Inter.getLocText("FR-Designer_Download_Template")); downloadButton.setToolTipText(Inter.getLocText("FR-Designer_Download_Template"));
downloadButton.addActionListener(new ActionListener() { 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 @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
String url = SiteCenter.getInstance().acquireUrlByKind("reuse.url"); String url = SiteCenter.getInstance().acquireUrlByKind("reuse.url");
@ -295,68 +338,58 @@ public class FormWidgetDetailPane extends FormDockView{
} }
} }
}); });
installItem.addActionListener(new ActionListener() { return downloadButton;
@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);
} }
private void deleteFromDiskZipFile() { /**
deleteButton = new UIButton(Inter.getLocText("FR-Designer-CommitTab_Remove")); * 创建安装模板的按钮
deleteButton.setBackground(Color.red); */
deleteButton.repaint(); private UIButton createInstallButton() {
deleteButton.setPreferredSize(new Dimension(240, 40)); return createToolButton(
reuWidgetPanel.add(deleteButton, BorderLayout.SOUTH); BaseUtils.readIcon("/com/fr/design/form/images/install icon.png"),
deleteButton.addActionListener(new ActionListener() { Inter.getLocText("FR-Designer_Install_Template"),
@Override new ActionListener() {
public void actionPerformed(ActionEvent e) { @Override
if (ShareLoader.getLoader().removeModulesFromList()) { public void actionPerformed(ActionEvent e) {
refreshShareMoudule(); JFileChooser fileChooser = new JFileChooser();
reuWidgetPanel.remove(deleteButton); fileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
elCaseBindInfoList = ShareLoader.getLoader().getAllBindInfoList(); fileChooser.setFileFilter(new FileNameExtensionFilter(".reu", "reu"));
JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Share_Module_Removed_Successful")); int returnValue = fileChooser.showDialog(new UILabel(), Inter.getLocText("FR-Designer_Select"));
refreshDownPanel(false); if (returnValue == JFileChooser.APPROVE_OPTION) {
replaceButtonPanel(false); final File chosenFile = fileChooser.getSelectedFile();
refreshComboxData(); installFromDiskZipFile(chosenFile);
} else { }
JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Share_Module_Removed_Failed")); }
} }
);
}
} /**
}); * 创建删除模板的按钮
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) { private void replaceButtonPanel(boolean isEdit) {
this.isEdit = isEdit; this.isEdit = isEdit;
if (isEdit) { if (isEdit) {
menutPanel.remove(editPanel); menutPanelNorthPane.remove(editPanel);
menutPanel.add(initResetButtonPane(), BorderLayout.EAST); menutPanelNorthPane.add(initResetButtonPane(), BorderLayout.EAST);
} else { } else {
menutPanel.remove(resetPanel); menutPanelNorthPane.remove(resetPanel);
menutPanel.add(initEditButtonPane(), BorderLayout.EAST); menutPanelNorthPane.add(initEditButtonPane(), BorderLayout.EAST);
ShareLoader.getLoader().resetRemovedModuleList(); ShareLoader.getLoader().resetRemovedModuleList();
} }
} }
private void installFromDiskZipFile(File chosenFile) { 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()); return ArrayUtils.addAll(new String[] {Inter.getLocText("FR-Designer_AllCategories")}, ShareLoader.getLoader().getModuleCategory());
} }
public void refreshDownPanel(boolean isEdit) { public void refreshDownPanel(boolean isEdit) {
reuWidgetPanel.remove(downPane); reuWidgetPanel.remove(downPane);
downPane = new UIScrollPane(new ShareWidgetPane(elCaseBindInfoList, isEdit)); downPane = new UIScrollPane(new ShareWidgetPane(elCaseBindInfoList, isEdit));
@ -409,12 +440,6 @@ public class FormWidgetDetailPane extends FormDockView{
revalidate(); 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) { private void setPropertyPaneChange(XComponent comp) {
if (comp == null) { if (comp == null) {
ParameterPropertyPane.getInstance().setAddParaPaneVisible(false);
return; return;
} }
ParameterPropertyPane.getInstance().setAddParaPaneVisible(comp instanceof XWParameterLayout);
editingComponent = comp.createToolPane(this, formDesign); editingComponent = comp.createToolPane(this, formDesign);
EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.FORM); EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.FORM);
if (BaseUtils.isAuthorityEditing()) { if (BaseUtils.isAuthorityEditing()) {
@ -677,8 +679,11 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm {
EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.FORM); EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.FORM);
EastRegionContainerPane.getInstance().replaceWidgetSettingsPane(WidgetPropertyPane.getInstance(formDesign)); EastRegionContainerPane.getInstance().replaceWidgetSettingsPane(WidgetPropertyPane.getInstance(formDesign));
EastRegionContainerPane.getInstance().addParameterPane(ParameterPropertyPane.getInstance(formDesign)); ParameterPropertyPane parameterPropertyPane = ParameterPropertyPane.getInstance(formDesign);
EastRegionContainerPane.getInstance().setParameterHeight(ParameterPropertyPane.getInstance(formDesign).getPreferredSize().height); parameterPropertyPane.setAddParaPaneVisible(false);
EastRegionContainerPane.getInstance().addParameterPane(parameterPropertyPane);
EastRegionContainerPane.getInstance().setParameterHeight(parameterPropertyPane.getPreferredSize().height);
if (EastRegionContainerPane.getInstance().getWidgetLibPane() == null) { if (EastRegionContainerPane.getInstance().getWidgetLibPane() == null) {
new Thread() { new Thread() {
public void run() { 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.beans.events.DesignerEvent;
import com.fr.design.designer.creator.*; import com.fr.design.designer.creator.*;
import com.fr.design.designer.properties.EventPropertyTable; import com.fr.design.designer.properties.EventPropertyTable;
import com.fr.design.designer.properties.WidgetPropertyTable;
import com.fr.design.fun.WidgetPropertyUIProvider; import com.fr.design.fun.WidgetPropertyUIProvider;
import com.fr.design.gui.frpane.UITabbedPane; import com.fr.design.gui.ibutton.UIHeadGroup;
import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.itable.AbstractPropertyTable; import com.fr.design.gui.itable.AbstractPropertyTable;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.widget.ui.FormWidgetCardPane;
import com.fr.form.ui.Widget; import com.fr.form.ui.Widget;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
@ -28,11 +28,11 @@ import java.util.Set;
* 控件属性表绘制 * 控件属性表绘制
* Modified by fanglei * 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 PARA = "para";
private static final String BODY = "body"; private static final String BODY = "body";
private WidgetPropertyTable propertyTable; // 控件的属性表 private FormWidgetCardPane formWidgetCardPane; // 控件的属性表
private EventPropertyTable eventTable; // 控件的事件表 private EventPropertyTable eventTable; // 控件的事件表
private List<AbstractPropertyTable> widgetPropertyTables; // 这个变量应该是保存控件拓展的属性tab private List<AbstractPropertyTable> widgetPropertyTables; // 这个变量应该是保存控件拓展的属性tab
private FormDesigner designer; // 当前designer private FormDesigner designer; // 当前designer
@ -45,6 +45,8 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetProper
private JPanel centerPane; // 此centerPane采用的是cardLayout布局,装载着mobileWidgetTable和mobileBodyWidgetTable private JPanel centerPane; // 此centerPane采用的是cardLayout布局,装载着mobileWidgetTable和mobileBodyWidgetTable
private CardLayout cardLayout; // 卡片布局,选中参数面板时显示mobileWidgetTable,选中body时显示mobileBodyWidgetTable private CardLayout cardLayout; // 卡片布局,选中参数面板时显示mobileWidgetTable,选中body时显示mobileBodyWidgetTable
private JTableHeader header;//把表头单独get出来作为一个组件 private JTableHeader header;//把表头单独get出来作为一个组件
private UIHeadGroup tabsHeaderIconPane;
public static WidgetPropertyPane getInstance() { public static WidgetPropertyPane getInstance() {
if (HOLDER.singleton == null) { if (HOLDER.singleton == null) {
@ -67,6 +69,12 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetProper
setLayout(FRGUIPaneFactory.createBorderLayout()); setLayout(FRGUIPaneFactory.createBorderLayout());
} }
@Override
protected String title4PopupWindow() {
return Inter.getLocText("FR-Designer-Widget_Settings");
}
@Override @Override
public String getViewTitle() { public String getViewTitle() {
return Inter.getLocText("Form-Widget_Property_Table"); return Inter.getLocText("Form-Widget_Property_Table");
@ -103,7 +111,7 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetProper
* 初始化属性表事件表移动端拓展的属性表 * 初始化属性表事件表移动端拓展的属性表
*/ */
private void initTables() { private void initTables() {
propertyTable.initPropertyGroups(null); formWidgetCardPane.populate();
eventTable.refresh(); eventTable.refresh();
for (AbstractPropertyTable propertyTable : widgetPropertyTables) { for (AbstractPropertyTable propertyTable : widgetPropertyTables) {
propertyTable.initPropertyGroups(designer); propertyTable.initPropertyGroups(designer);
@ -114,10 +122,11 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetProper
* 创建属性表table * 创建属性表table
*/ */
private void createPropertyTable() { private void createPropertyTable() {
propertyTable = new WidgetPropertyTable(designer); formWidgetCardPane = new FormWidgetCardPane(designer);
designer.addDesignerEditListener(new WidgetPropertyDesignerAdapter(propertyTable));
propertyTable.setBorder(null); designer.addDesignerEditListener(new WidgetPropertyDesignerAdapter(formWidgetCardPane));
psp = new UIScrollPane(propertyTable); // 用来装载属性表table
psp = new UIScrollPane(formWidgetCardPane); // 用来装载属性表table
psp.setBorder(null); psp.setBorder(null);
} }
@ -170,9 +179,7 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetProper
* 将属性表事件表移动端控件列表整合到TabPane里面去 * 将属性表事件表移动端控件列表整合到TabPane里面去
*/ */
private void createTabPane() { private void createTabPane() {
UITabbedPane tabbedPane = new UITabbedPane(); // tab选项卡容器 initTabPane();
initTabPane(tabbedPane);
add(tabbedPane, BorderLayout.CENTER);
} }
/** /**
@ -206,7 +213,8 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetProper
for (WidgetPropertyUIProvider widgetAttrProvider : widgetAttrProviders) { for (WidgetPropertyUIProvider widgetAttrProvider : widgetAttrProviders) {
AbstractPropertyTable propertyTable = widgetAttrProvider.createWidgetAttrTable(); AbstractPropertyTable propertyTable = widgetAttrProvider.createWidgetAttrTable();
widgetPropertyTables.add(propertyTable); widgetPropertyTables.add(propertyTable);
designer.addDesignerEditListener(new WidgetPropertyDesignerAdapter(propertyTable)); designer.addDesignerEditListener(new WidgetPropertyDesignerAdapter(formWidgetCardPane));
UIScrollPane uiScrollPane = new UIScrollPane(getExtraBodyTable(propertyTable)); UIScrollPane uiScrollPane = new UIScrollPane(getExtraBodyTable(propertyTable));
wsp.add(uiScrollPane); wsp.add(uiScrollPane);
} }
@ -231,13 +239,27 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetProper
return abstractPropertyTable; return abstractPropertyTable;
} }
private void initTabPane(UITabbedPane tabbedPane) { private void initTabPane() {
tabbedPane.setOpaque(true); final String[] tabTitles = new String[]{
tabbedPane.setBorder(null); Inter.getLocText("FR-Designer_Properties"),
tabbedPane.setTabPlacement(SwingConstants.BOTTOM); Inter.getLocText("FR-Designer_Event"),
tabbedPane.addTab(Inter.getLocText("FR-Designer_Properties"), psp); Inter.getLocText("FR-Widget_Mobile_Terminal")
tabbedPane.addTab(Inter.getLocText("FR-Designer_Event"), eventTable); };
tabbedPane.addTab(Inter.getLocText("FR-Widget_Mobile_Terminal"), wsp); final CardLayout tabbedPane = new CardLayout();
final JPanel center = new JPanel(tabbedPane);
center.add(formWidgetCardPane, Inter.getLocText("FR-Designer_Properties"));
center.add(eventTable, Inter.getLocText("FR-Designer_Event"));
center.add(wsp, Inter.getLocText("FR-Widget_Mobile_Terminal"));
this.add(center, BorderLayout.CENTER);
tabsHeaderIconPane = new UIHeadGroup(tabTitles) {
@Override
public void tabChanged(int index) {
tabbedPane.show(center, tabTitles[index]);
}
};
tabsHeaderIconPane.setNeedLeftRightOutLine(false);
this.add(tabsHeaderIconPane, BorderLayout.NORTH);
} }
@ -266,7 +288,7 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetProper
} }
private void clearDockingView() { private void clearDockingView() {
propertyTable = null; formWidgetCardPane = null;
eventTable = null; eventTable = null;
if (widgetPropertyTables != null) { if (widgetPropertyTables != null) {
widgetPropertyTables.clear(); widgetPropertyTables.clear();
@ -280,26 +302,25 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetProper
* 属性表监听界面事件(编辑删除选中改变大小) * 属性表监听界面事件(编辑删除选中改变大小)
*/ */
private class WidgetPropertyDesignerAdapter implements DesignerEditListener { private class WidgetPropertyDesignerAdapter implements DesignerEditListener {
AbstractPropertyTable propertyTable; FormWidgetCardPane formWidgetCardPane;
WidgetPropertyDesignerAdapter(AbstractPropertyTable propertyTable) { WidgetPropertyDesignerAdapter(FormWidgetCardPane formWidgetCardPane) {
this.propertyTable = propertyTable; this.formWidgetCardPane = formWidgetCardPane;
} }
@Override @Override
public void fireCreatorModified(DesignerEvent evt) { public void fireCreatorModified(DesignerEvent evt) {
if (evt.getCreatorEventID() == DesignerEvent.CREATOR_EDITED if (evt.getCreatorEventID() == DesignerEvent.CREATOR_EDITED
|| evt.getCreatorEventID() == DesignerEvent.CREATOR_DELETED || evt.getCreatorEventID() == DesignerEvent.CREATOR_DELETED
|| evt.getCreatorEventID() == DesignerEvent.CREATOR_SELECTED) { || evt.getCreatorEventID() == DesignerEvent.CREATOR_SELECTED
propertyTable.initPropertyGroups(designer); || evt.getCreatorEventID() == DesignerEvent.CREATOR_RESIZED) {
} else if (evt.getCreatorEventID() == DesignerEvent.CREATOR_RESIZED) { formWidgetCardPane.populate();
repaint();
} }
} }
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
return o instanceof WidgetPropertyDesignerAdapter && ((WidgetPropertyDesignerAdapter) o).propertyTable == this.propertyTable; return o instanceof WidgetPropertyDesignerAdapter && ((WidgetPropertyDesignerAdapter) o).formWidgetCardPane == this.formWidgetCardPane;
} }
} }

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

@ -11,6 +11,7 @@ import javax.swing.plaf.basic.*;
import javax.swing.plaf.metal.*; import javax.swing.plaf.metal.*;
import javax.swing.tree.*; import javax.swing.tree.*;
import com.fr.design.constants.UIConstants;
import com.fr.design.designer.beans.*; import com.fr.design.designer.beans.*;
import com.fr.design.designer.beans.events.DesignerEditListener; import com.fr.design.designer.beans.events.DesignerEditListener;
import com.fr.design.designer.beans.events.DesignerEvent; import com.fr.design.designer.beans.events.DesignerEvent;
@ -80,6 +81,19 @@ public class UITreeComboBox extends JComboBox{
setUI(cui); 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 // UI Inner classes -- one for each supported Look and Feel
class MetalJTreeComboBoxUI extends MetalComboBoxUI{ class MetalJTreeComboBoxUI extends MetalComboBoxUI{
protected ComboPopup createPopup() { protected ComboPopup createPopup() {
@ -152,7 +166,7 @@ public class UITreeComboBox extends JComboBox{
tree.refreshUI(); tree.refreshUI();
repaint(); repaint();
} }
refreshShortCuts();
} }
@Override @Override
@ -208,7 +222,7 @@ class TreePopup extends JPopupMenu implements ComboPopup{
JTree tree = this.comboBox.getTree(); JTree tree = this.comboBox.getTree();
if(tree != null){ if(tree != null){
scrollPane = new UIScrollPane(tree); scrollPane = new UIScrollPane(tree);
scrollPane.setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 0)); scrollPane.setBorder(null);
add(scrollPane, BorderLayout.CENTER); add(scrollPane, BorderLayout.CENTER);
} }
} }
@ -217,6 +231,8 @@ class TreePopup extends JPopupMenu implements ComboPopup{
updatePopup(); updatePopup();
show(comboBox, 0, comboBox.getHeight()); show(comboBox, 0, comboBox.getHeight());
comboBox.getTree().requestFocus(); comboBox.getTree().requestFocus();
comboBox.getTree().setBackground(UIConstants.TREE_BACKGROUND);
comboBox.getTree().setOpaque(true);
} }
public void hide(){ public void hide(){

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

@ -0,0 +1,19 @@
package com.fr.design.mainframe.widget.ui;
import com.fr.design.mainframe.widget.BasicPropertyPane;
import com.fr.form.ui.Widget;
/**
* Created by ibm on 2017/8/4.
*/
public class FormBasicPropertyPane extends BasicPropertyPane {
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());
}
}

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

@ -0,0 +1,224 @@
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.container.WTitleLayout;
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.acceptType(XWScaleLayout.class)) {
if (xCreator.getComponentCount() > 0 && ((XCreator) xCreator.getComponent(0)).shouldScaleCreator()) {
creator = (XCreator) xCreator.getComponent(0);
}
}
if(xCreator.acceptType(XWTitleLayout.class)){
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 if(cellWidget instanceof WTitleLayout){
CRBoundsWidget crBoundsWidget = ((WTitleLayout) cellWidget).getBodyBoundsWidget();
currentEditorDefinePane.populateBean(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 if(xCreator instanceof XWTitleLayout){
XCreator xCreator1 = ((XWTitleLayout) xCreator).getXCreator(0);
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; package com.fr.design.parameter;
import com.fr.design.constants.UIConstants;
import com.fr.design.dialog.BasicScrollPane; import com.fr.design.dialog.BasicScrollPane;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.FormDesigner;
@ -14,11 +15,14 @@ import java.awt.event.MouseEvent;
public class ParameterPropertyPane extends JPanel{ public class ParameterPropertyPane extends JPanel{
private ParameterToolBarPane toolbarPane; private ParameterToolBarPane toolbarPane;
private BasicScrollPane basicScrollPane;
private ParaDefinitePane paraPane; private ParaDefinitePane paraPane;
private JPanel formHierarchyTreePaneWrapper; // 封装一层,加边框
private JPanel addParaPane;
public static ParameterPropertyPane THIS;
private static ParameterPropertyPane THIS;
private boolean isEditing = false; private boolean isEditing = false;
private static final int HIDE_HEIGHT = 40;
public static final ParameterPropertyPane getInstance() { public static final ParameterPropertyPane getInstance() {
if(THIS == null) { if(THIS == null) {
@ -43,7 +47,7 @@ public class ParameterPropertyPane extends JPanel{
public ParameterPropertyPane() { public ParameterPropertyPane() {
toolbarPane = new ParameterToolBarPane(); toolbarPane = new ParameterToolBarPane();
basicScrollPane = new BasicScrollPane() { BasicScrollPane basicScrollPane = new BasicScrollPane() {
@Override @Override
protected JPanel createContentPane() { protected JPanel createContentPane() {
return toolbarPane; return toolbarPane;
@ -59,15 +63,42 @@ public class ParameterPropertyPane extends JPanel{
return null; 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.setLayout(new BorderLayout(0, 6));
this.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); this.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0));
this.add(basicScrollPane, BorderLayout.CENTER); 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) { private void setEditor(FormDesigner editor) {
this.remove(FormHierarchyTreePane.getInstance()); if (formHierarchyTreePaneWrapper == null) {
this.add(FormHierarchyTreePane.getInstance(editor), BorderLayout.NORTH); 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() { 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 @Override
protected String title4PopupWindow() { protected String title4PopupWindow() {
return null; return null;

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

@ -0,0 +1,121 @@
package com.fr.design.parameter;
import com.fr.base.BaseUtils;
import com.fr.design.data.DataCreatorUI;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XWParameterLayout;
import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.gui.ibutton.UIButtonGroup;
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.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.design.widget.ui.designer.AbstractDataModify;
import com.fr.form.ui.container.WParameterLayout;
import com.fr.general.Inter;
import com.fr.stable.Constants;
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 AccessibleBackgroundEditor background;
private UIButtonGroup hAlignmentPane;
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();
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 AccessibleBackgroundEditor();
Icon[] hAlignmentIconArray = {BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_left_normal.png"),
BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_center_normal.png"),
BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_right_normal.png"),};
Integer[] hAlignment = new Integer[]{Constants.LEFT, Constants.CENTER, Constants.RIGHT};
hAlignmentPane = new UIButtonGroup<Integer>(hAlignmentIconArray, hAlignment);
hAlignmentPane.setAllToolTips(new String[]{Inter.getLocText("FR-Designer-StyleAlignment_Left")
, Inter.getLocText("FR-Designer-StyleAlignment_Center"), Inter.getLocText("FR-Designer-StyleAlignment_Right")});
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")), hAlignmentPane}
};
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) {
background.setValue(ob.getBackground());
displayReport.setSelected(ob.isDelayDisplayContent());
designerWidth.setValue(ob.getDesignWidth());
hAlignmentPane.setSelectedIndex(ob.getPosition());
}
@Override
public WParameterLayout updateBean() {
WParameterLayout wParameterLayout = (WParameterLayout) creator.toData();
wParameterLayout.setDesignWidth((int) designerWidth.getValue());
wParameterLayout.setDelayDisplayContent(displayReport.isSelected());
wParameterLayout.setBackground(wParameterLayout.getBackground());
wParameterLayout.setPosition(hAlignmentPane.getSelectedIndex());
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(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(FreeButtonDefinePane.class, WidgetConstants.BUTTON + ""));
defineMap.put(FreeButton.class, new Appearance(FreeButtonDefinePane.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(ElementCaseEditor.class, new Appearance(ElementEditorDefinePane.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(WCardLayout.class, new Appearance(WCardLayoutDefinePane.class, "tablayout"));
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;
}
}

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

@ -0,0 +1,92 @@
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.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.widget.accessibles.AccessibleIconEditor;
import com.fr.design.widget.btn.ButtonConstants;
import com.fr.form.ui.Button;
import com.fr.general.Inter;
import com.fr.stable.StableUtils;
import javax.swing.*;
import java.awt.*;
public abstract class ButtonDefinePane<T extends Button> extends AbstractDataModify<T> {
private UITextField hotkeysTextField;
private UITextField buttonNameTextField;
private AccessibleIconEditor iconPane;
public ButtonDefinePane(XCreator creator){
super(creator);
this.initComponent();
}
private void initComponent() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
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, 1}, {1, 1}, {1, 1}};
iconPane = new AccessibleIconEditor();
hotkeysTextField = new UITextField();
buttonNameTextField = new UITextField();
Component[] backgroundCompPane = createBackgroundComp();
Component[] frFont = createFontPane();
UILabel backgroundLabel = new UILabel(Inter.getLocText("FR-Designer_Background"));
backgroundLabel.setVerticalAlignment(SwingConstants.TOP);
Component[][] n_components = {
{new UILabel(Inter.getLocText("FR-Designer_Button-Name") + ":"), buttonNameTextField},
backgroundCompPane,
frFont,
{new UILabel(Inter.getLocText("FR-Designer_Icon" + ":")), iconPane},
{new UILabel(Inter.getLocText("FR-Designer_Button-Hotkeys") + ":"), hotkeysTextField}
};
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));
UIExpandablePane advancedPane = new UIExpandablePane(Inter.getLocText("FR-Designer_Advanced"), 280, 20, panel);
this.add(advancedPane);
}
@Override
public String title4PopupWindow() {
return "Button";
}
public Component[] createBackgroundComp(){
return new Component[]{null, null};
}
public Component[] createFontPane(){
return new Component[]{null, null};
}
@Override
public void populateBean(T btn) {
hotkeysTextField.setText(btn.getHotkeys());
buttonNameTextField.setText(btn.getLabelName());
iconPane.setValue(btn.getIconName());
populateSubButtonPane(btn);
}
public abstract void populateSubButtonPane(T e);
public abstract T updateSubButtonPane();
@Override
public T updateBean() {
T btn = updateSubButtonPane();
btn.setHotkeys(hotkeysTextField.getText());
btn.setLabelName(buttonNameTextField.getText());
btn.setIconName((String)iconPane.getValue());
return btn;
}
}

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

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

@ -0,0 +1,70 @@
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.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.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 UISpinner fontSizePane;
private FormWidgetValuePane formWidgetValuePane;
public CheckBoxDefinePane(XCreator xCreator) {
super(xCreator);
iniComoponents();
}
private void iniComoponents() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
text = new UITextField();
fontSizePane = new UISpinner(0, 20, 1, 0);
formWidgetValuePane = new FormWidgetValuePane(creator.toData(), false);
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());
fontSizePane.setValue(check.getFontSize());
formWidgetValuePane.populate(check);
}
@Override
public CheckBox updateBean() {
CheckBox box = (CheckBox)creator.toData();
box.setText(text.getText());
box.setFontSize((int)fontSizePane.getValue());
formWidgetValuePane.update(box);
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());
}
}

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

@ -0,0 +1,97 @@
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.ibutton.UIHeadGroup;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel;
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 UIHeadGroup returnType;
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"}));
final String[] tabTitles = new String[]{Inter.getLocText("Widget-Array"), Inter.getLocText("String")};
returnType = new UIHeadGroup(tabTitles) {
@Override
public void tabChanged(int index) {
CheckBoxGroup combo = (CheckBoxGroup) creator.toData();
//todo
if (index == 1) {
combo.setReturnString(true);
} else {
combo.setReturnString(false);
}
}
};
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")), returnType},
};
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) {
if (ob.isReturnString()) {
returnType.setSelectedIndex(1);
} else {
returnType.setSelectedIndex(0);
}
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;
}
}

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

@ -0,0 +1,53 @@
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.form.ui.ComboBox;
import com.fr.general.Inter;
import java.awt.*;
public class ComboBoxDefinePane extends DictEditorDefinePane<ComboBox> {
private UICheckBox removeRepeatCheckBox;
private UITextField waterMarkField;
public ComboBoxDefinePane(XCreator xCreator) {
super(xCreator);
}
public UICheckBox createRepeatCheckBox(){
removeRepeatCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_Widget_No_Repeat"));
return removeRepeatCheckBox;
}
public Component[] createWaterMarkPane() {
waterMarkField = new UITextField();
return new Component[]{new UILabel(Inter.getLocText("FR-Designer_WaterMark")), waterMarkField};
}
protected void populateSubDictionaryEditorBean(ComboBox ob){
removeRepeatCheckBox.setSelected(ob.isRemoveRepeat());
formWidgetValuePane.populate(ob);
}
protected ComboBox updateSubDictionaryEditorBean(){
ComboBox combo = (ComboBox) creator.toData();
combo.setRemoveRepeat(removeRepeatCheckBox.isSelected());
formWidgetValuePane.update(combo);
return combo;
}
@Override
public String title4PopupWindow() {
return "ComboBox";
}
@Override
public DataCreatorUI dataUI() {
return null;
}
}

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

@ -0,0 +1,100 @@
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.ibutton.UIHeadGroup;
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.form.ui.ComboCheckBox;
import com.fr.general.Inter;
import javax.swing.*;
import java.awt.*;
public class ComboCheckBoxDefinePane extends DictEditorDefinePane<ComboCheckBox> {
private UICheckBox supportTagCheckBox;
private UIHeadGroup returnType;
private UITextField waterMarkDictPane;
private UICheckBox removeRepeatCheckBox;
public ComboCheckBoxDefinePane(XCreator xCreator) {
super(xCreator);
}
public UICheckBox createRepeatCheckBox(){
removeRepeatCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_Widget_No_Repeat"));
return removeRepeatCheckBox;
}
public Component[] createWaterMarkPane() {
waterMarkDictPane = new UITextField();
return new Component[]{new UILabel(Inter.getLocText("FR-Designer_WaterMark")), waterMarkDictPane};
}
public JPanel createOtherPane(){
supportTagCheckBox = new UICheckBox(Inter.getLocText("Form-SupportTag"), true);
final String[] tabTitles = new String[]{Inter.getLocText("Widget-Array"), Inter.getLocText("String")};
returnType = new UIHeadGroup(tabTitles) {
@Override
public void tabChanged(int index) {
ComboCheckBox combo = (ComboCheckBox) creator.toData();
//todo
if (index == 1) {
combo.setReturnString(true);
} else {
combo.setReturnString(false);
}
}
};
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
Component[][] components = new Component[][]{
new Component[]{supportTagCheckBox, null },
new Component[]{new UILabel(Inter.getLocText("Widget-Date_Selector_Return_Type")), returnType},
};
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;
}
protected void populateSubDictionaryEditorBean(ComboCheckBox ob){
if (ob.isReturnString()) {
returnType.setSelectedIndex(1);
} else {
returnType.setSelectedIndex(0);
}
waterMarkDictPane.setText(ob.getWaterMark());
formWidgetValuePane.populate(ob);
this.supportTagCheckBox.setSelected(ob.isSupportTag());
this.removeRepeatCheckBox.setSelected(ob.isRemoveRepeat());
}
protected ComboCheckBox updateSubDictionaryEditorBean(){
ComboCheckBox combo = (ComboCheckBox) creator.toData();
formWidgetValuePane.update(combo);
combo.setWaterMark(waterMarkDictPane.getText());
combo.setSupportTag(this.supportTagCheckBox.isSelected());
combo.setRemoveRepeat(removeRepeatCheckBox.isSelected());
return combo;
}
@Override
public DataCreatorUI dataUI() {
return null;
}
@Override
public String title4PopupWindow() {
return "ComboCheckBox";
}
}

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

@ -0,0 +1,56 @@
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);
}
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 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();
}

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

@ -0,0 +1,265 @@
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.ibutton.UIHeadGroup;
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.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.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;
private WaterMarkDictPane waterMarkDictPane;
private FormWidgetValuePane formWidgetValuePane;
private UISpinner fontSizePane;
private UIHeadGroup formatHeader;
public DateEditorDefinePane(XCreator xCreator) {
super(xCreator);
}
@Override
public String title4PopupWindow() {
return "Date";
}
@Override
protected JPanel setFirstContentPane() {
waterMarkDictPane = new WaterMarkDictPane();
formWidgetValuePane = new FormWidgetValuePane(creator.toData(), false);
fontSizePane = new UISpinner(0, 20, 1, 0);
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());
JPanel previewPane = FRGUIPaneFactory.createTitledBorderPane("示例");
previewPane.add(sampleLabel);
// 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();
}
});
startDv = ValueEditorPaneFactory.createDateValueEditorPane(null, null);
endDv = ValueEditorPaneFactory.createDateValueEditorPane(null, null);
initFormatHeader();
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-Engine_Format") + ":"), dateFormatComboBox},
new Component[]{null, previewPane},
new Component[]{new UILabel(Inter.getLocText("FS_Start_Date") + ":"), startDv},
new Component[]{new UILabel(Inter.getLocText("FS_End_Date") + ":"), endDv},
new Component[]{new UILabel(Inter.getLocText("FR-Designer_WaterMark") + ":"), waterMarkDictPane},
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Font-Size")), fontSizePane},
new Component[]{new UILabel(Inter.getLocText("Widget-Date_Selector_Return_Type") + ":"), returnTypeComboBox}
};
double[] rowSize = {p, p, p, p, p, p, p, p, p, p};
double[] columnSize = {p, f};
int[][] rowCount = {{1, 3}, {1, 1}, {1, 1}, {1, 1}, {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;
}
protected void initFormatHeader() {
String [] tabTitles = getDateFormateArray();
formatHeader = new UIHeadGroup(tabTitles){
protected void tabChanged(int newSelectedIndex) {
}
};
}
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);
formWidgetValuePane.populate(e);
populateStartEnd(e);
}
@Override
protected DateEditor updateSubDirectWriteEditorBean() {
DateEditor ob = new DateEditor();
ob.setFormatText(this.getSimpleDateFormat().toPattern());
ob.setReturnDate(returnTypeComboBox.getSelectedIndex() == 1);
formWidgetValuePane.update(ob);
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;
}
}

47
designer_form/src/com/fr/design/widget/ui/designer/DictEditorDefinePane.java

@ -0,0 +1,47 @@
package com.fr.design.widget.ui.designer;
import com.fr.data.Dictionary;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.mainframe.widget.accessibles.AccessibleDictionaryEditor;
import com.fr.form.ui.DictContainedCustomWriteAbleEditor;
import com.fr.general.Inter;
import java.awt.*;
/**
* Created by ibm on 2017/8/6.
*/
public abstract class DictEditorDefinePane<T extends DictContainedCustomWriteAbleEditor> extends CustomWritableRepeatEditorPane<T> {
private AccessibleDictionaryEditor dictionaryEditor;
public DictEditorDefinePane(XCreator xCreator) {
super(xCreator);
}
protected Component[] createDictPane(){
dictionaryEditor = new AccessibleDictionaryEditor();
return new Component[]{new UILabel(Inter.getLocText("FR-Designer_DS-Dictionary")), dictionaryEditor};
}
@Override
protected void populateSubCustomWritableRepeatEditorBean(T e) {
populateSubDictionaryEditorBean(e);
dictionaryEditor.setValue(e.getDictionary());
}
@Override
protected T updateSubCustomWritableRepeatEditorBean() {
T e = updateSubDictionaryEditorBean();
e.setDictionary((Dictionary) dictionaryEditor.getValue());
return e;
}
protected abstract void populateSubDictionaryEditorBean(T e);
protected abstract T updateSubDictionaryEditorBean();
}

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

@ -0,0 +1,100 @@
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.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 FormWidgetValuePane formWidgetValuePane;
public DirectWriteEditorDefinePane(XCreator xCreator) {
super(xCreator);
}
@Override
protected JPanel setFirstContentPane() {
JPanel advancePane = FRGUIPaneFactory.createBorderLayout_S_Pane();
formWidgetValuePane = new FormWidgetValuePane(creator.toData(), false);
Component[] removeRepeatPane = new Component[]{createRepeatCheckBox(), null};
Component[] dicPane = createDictPane();
Component[] waterMarkComponent = createWaterMarkPane();
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
Component[][] components = new Component[][]{
new Component[]{new UILabel(Inter.getLocText("FR-Designer-Estate_Widget_Value")), formWidgetValuePane },
dicPane,
removeRepeatPane,
waterMarkComponent,
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 UICheckBox createRepeatCheckBox(){
return null;
}
public Component[] createWaterMarkPane() {
return new Component[]{null, null};
}
protected Component[] createDictPane(){
return new Component[]{null, null};
}
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());
populateSubDirectWriteEditorBean(e);
}
protected abstract void populateSubDirectWriteEditorBean(T e);
@Override
protected T updateSubFieldEditorBean() {
T e = updateSubDirectWriteEditorBean();
e.setDirectEdit(directWriteCheckBox.isSelected());
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;
}
}

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

@ -0,0 +1,56 @@
package com.fr.design.widget.ui.designer;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.style.FRFontPane;
import com.fr.design.widget.ui.designer.component.BackgroundCompPane;
import com.fr.design.widget.ui.designer.component.MouseActionBackground;
import com.fr.form.ui.FreeButton;
import com.fr.general.FRFont;
import com.fr.general.Inter;
import javax.swing.*;
import java.awt.*;
/**
* Created by ibm on 2017/8/6.
*/
public class FreeButtonDefinePane extends ButtonDefinePane<FreeButton> {
private BackgroundCompPane backgroundCompPane;
private FRFontPane frFontPane;
public FreeButtonDefinePane(XCreator xcreator) {
super(xcreator);
}
public Component[] createBackgroundComp() {
backgroundCompPane = new BackgroundCompPane();
return new Component[]{new UILabel(Inter.getLocText("FR-Designer_Background") + ":"), backgroundCompPane};
}
public Component[] createFontPane() {
UILabel fontLabel = new UILabel(Inter.getLocText("FR-Designer_Font"));
fontLabel.setVerticalAlignment(SwingConstants.TOP);
frFontPane = new FRFontPane();
return new Component[]{fontLabel, frFontPane};
}
public void populateSubButtonPane(FreeButton e) {
MouseActionBackground mouseActionBackground = new MouseActionBackground(e.getInitialBackground(), e.getOverBackground(), e.getClickBackground());
backgroundCompPane.populate(mouseActionBackground);
FRFont frFont = e.getFont();
if (frFont != null) {
frFontPane.populateBean(e.getFont());
}
}
public FreeButton updateSubButtonPane() {
FreeButton freeButton = (FreeButton) creator.toData();
MouseActionBackground mouseActionBackground = backgroundCompPane.update();
freeButton.setInitialBackground(mouseActionBackground.getInitialBackground());
freeButton.setOverBackground(mouseActionBackground.getOverBackground());
freeButton.setClickBackground(mouseActionBackground.getClickBackground());
frFontPane.update(freeButton.getFont());
return freeButton;
}
}

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

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

@ -0,0 +1,100 @@
package com.fr.design.widget.ui.designer;
import com.fr.base.BaseUtils;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.style.FRFontPane;
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 com.fr.stable.Constants;
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;
private UIButtonGroup hAlignmentPane;
private FRFontPane frFontPane;
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(creator.toData(), false);
isPageSetupVertically = new UICheckBox(Inter.getLocText("FR-Designer_PageSetup-Vertically"));
isStyleAlignmentWrapText = new UICheckBox(Inter.getLocText("FR-Designer_StyleAlignment-Wrap_Text"));
Icon[] hAlignmentIconArray = {BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_left_normal.png"),
BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_center_normal.png"),
BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_right_normal.png"),};
Integer[] hAlignment = new Integer[]{Constants.LEFT, Constants.CENTER, Constants.RIGHT};
hAlignmentPane = new UIButtonGroup<Integer>(hAlignmentIconArray, hAlignment);
hAlignmentPane.setAllToolTips(new String[]{Inter.getLocText("FR-Designer-StyleAlignment_Left")
, Inter.getLocText("FR-Designer-StyleAlignment_Center"), Inter.getLocText("FR-Designer-StyleAlignment_Right")});
frFontPane = new FRFontPane();
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}};
UILabel fontLabel = new UILabel(Inter.getLocText("FR-Designer_Font-Size"));
fontLabel.setVerticalAlignment(SwingConstants.TOP);
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")), hAlignmentPane},
new Component[]{fontLabel, frFontPane},
};
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) {
formWidgetValuePane.populate(ob);
isStyleAlignmentWrapText.setSelected(ob.isAutoLine());
isPageSetupVertically.setSelected(ob.isVerticalCenter());
hAlignmentPane.setSelectedIndex(ob.getTextalign());
frFontPane.populateBean(ob.getFont());
}
@Override
public Label updateBean() {
Label layout = (Label) creator.toData();
formWidgetValuePane.update(layout);
layout.setAutoLine(isStyleAlignmentWrapText.isSelected());
layout.setVerticalCenter(isPageSetupVertically.isSelected());
layout.setTextalign(hAlignmentPane.getSelectedIndex());
layout.setFont(frFontPane.update(layout.getFont()));
return layout;
}
}

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

@ -0,0 +1,93 @@
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.ispinner.UISpinner;
import com.fr.design.gui.itextfield.UINumberField;
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 UISpinner 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 UISpinner(0, 20, 1, 0);
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());
fontSizeField.setValue(e.getFontSize());
}
@Override
protected MultiFileEditor updateSubFieldEditorBean() {
MultiFileEditor ob = new MultiFileEditor();
ob.setAccept((String) acceptType.getSelectedItem());
ob.setSingleFile(singleFileCheckBox.isSelected());
ob.setMaxSize(fileSizeField.getValue());
ob.setFontSize((int)fontSizeField.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();
}
}

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

@ -0,0 +1,312 @@
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.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 FormWidgetValuePane formWidgetValuePane;
/**
*
*/
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 = new FormWidgetValuePane(creator.toData(), false);
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_WaterMark")), waterMarkDictPane},
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, 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()));
}
formWidgetValuePane.populate(e);
// this.regErrorMsgTextField.setText(e.getRegErrorMessage());
this.waterMarkDictPane.populate(e);
}
@Override
protected NumberEditor updateSubFieldEditorBean() {
NumberEditor ob = new NumberEditor();
formWidgetValuePane.update(ob);
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);
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);
}
}

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

@ -0,0 +1,122 @@
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.general.Inter;
import com.fr.stable.StringUtils;
import javax.swing.*;
import java.awt.*;
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() {
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(creator.toData(), false);
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());
waterMarkDictPane.setText(e.getWaterMark());
formWidgetValuePane.populate(e);
}
@Override
protected TextEditor updateSubFieldEditorBean() {
TextEditor ob = newTextEditorInstance();
ob.setRegex(this.regPane.update());
ob.setWaterMark(waterMarkDictPane.getText());
formWidgetValuePane.update(ob);
return ob;
}
protected TextEditor newTextEditorInstance() {
return new TextEditor();
}
}

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

@ -0,0 +1,49 @@
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.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.form.ui.TreeEditor;
import com.fr.general.Inter;
import java.awt.*;
public class TreeComboBoxEditorDefinePane extends TreeEditorDefinePane {
protected UITextField waterMarkDictPane;
public TreeComboBoxEditorDefinePane(XCreator xCreator) {
super(xCreator);
}
public Component[] createWaterMarkPane(){
waterMarkDictPane = new UITextField();
return new Component[]{new UILabel(Inter.getLocText("FR-Designer_WaterMark")), waterMarkDictPane};
}
@Override
public String title4PopupWindow() {
return "treecombobox";
}
protected void populateSubDictionaryEditorBean(TreeEditor ob){
super.populateSubDictionaryEditorBean(ob);
formWidgetValuePane.populate(ob);
waterMarkDictPane.setText(ob.getWaterMark());
}
protected TreeEditor updateSubDictionaryEditorBean(){
TreeEditor editor = super.updateSubDictionaryEditorBean();
formWidgetValuePane.update(editor);
editor.setWaterMark(waterMarkDictPane.getText());
return editor;
}
@Override
public DataCreatorUI dataUI() {
return treeSettingPane;
}
}

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

@ -0,0 +1,87 @@
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.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.form.ui.TreeEditor;
import com.fr.general.Inter;
import javax.swing.*;
import java.awt.*;
/*
* richer:tree editor
*/
public class TreeEditorDefinePane extends DictEditorDefinePane<TreeEditor> {
protected TreeSettingPane treeSettingPane;
protected TreeRootPane treeRootPane;
private UICheckBox mutiSelect;
private UICheckBox loadAsync;
private UICheckBox returnLeaf;
private UICheckBox returnPath;
public TreeEditorDefinePane(XCreator xCreator) {
super(xCreator);
treeRootPane = new TreeRootPane();
treeSettingPane = new TreeSettingPane(true);
}
public JPanel createOtherPane() {
mutiSelect = new UICheckBox(Inter.getLocText("Tree-Mutiple_Selection_Or_Not"));
loadAsync = new UICheckBox(Inter.getLocText("Widget-Load_By_Async"));
returnLeaf = new UICheckBox(Inter.getLocText("FR-Designer_Widget_Return_Leaf"));
returnPath = new UICheckBox(Inter.getLocText("FR-Designer_Widget_Return_Path"));
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
Component[][] components = new Component[][]{
new Component[]{mutiSelect},
new Component[]{loadAsync},
new Component[]{returnLeaf},
new Component[]{returnPath}
};
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";
}
protected void populateSubDictionaryEditorBean(TreeEditor e){
formWidgetValuePane.populate(e);
treeSettingPane.populate(e);
treeRootPane.populate(e.getTreeAttr());
mutiSelect.setSelected(e.isMultipleSelection());
loadAsync.setSelected(e.isAjax());
returnLeaf.setSelected(e.isSelectLeafOnly());
returnPath.setSelected(e.isReturnFullPath());
}
protected TreeEditor updateSubDictionaryEditorBean(){
TreeEditor editor = (TreeEditor)creator.toData();
formWidgetValuePane.update(editor);
editor.setTreeAttr(treeRootPane.update());
editor.setMultipleSelection(mutiSelect.isSelected());
editor.setAjax(loadAsync.isSelected());
editor.setSelectLeafOnly(returnLeaf.isSelected());
editor.setReturnFullPath(returnPath.isSelected());
return editor;
}
@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();
}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save