Browse Source

Merge remote-tracking branch 'origin/9.0' into 9.0

master
juhaoyu 7 years ago
parent
commit
357ba1a65d
  1. 9
      designer/src/com/fr/design/mainframe/CellWidgetPropertyPane.java
  2. 7
      designer/src/com/fr/grid/selection/CellSelection.java
  3. 5
      designer/src/com/fr/grid/selection/FloatSelection.java
  4. 2
      designer/src/com/fr/grid/selection/Selection.java
  5. 94
      designer/src/com/fr/poly/PolyBlockProperTable.java
  6. 2
      designer/src/com/fr/poly/creator/ECBlockEditor.java
  7. 3
      designer_base/src/com/fr/design/constants/UIConstants.java
  8. 2
      designer_base/src/com/fr/design/data/datapane/TableDataTree.java
  9. 263
      designer_base/src/com/fr/design/gui/frpane/RegPane.java
  10. 2
      designer_base/src/com/fr/design/gui/frpane/UITabbedPaneUI.java
  11. 2
      designer_base/src/com/fr/design/gui/ibutton/UIRadioButton.java
  12. 2
      designer_base/src/com/fr/design/locale/designer.properties
  13. 4
      designer_base/src/com/fr/design/locale/designer_en_US.properties
  14. 2
      designer_base/src/com/fr/design/locale/designer_ja_JP.properties
  15. 2
      designer_base/src/com/fr/design/locale/designer_ko_KR.properties
  16. 2
      designer_base/src/com/fr/design/locale/designer_zh_CN.properties
  17. 4
      designer_base/src/com/fr/design/locale/designer_zh_TW.properties
  18. 50
      designer_base/src/com/fr/design/mainframe/widget/BasicPropertyPane.java
  19. 6
      designer_base/src/com/fr/design/mainframe/widget/editors/DataBindingEditor.java
  20. 52
      designer_base/src/com/fr/design/widget/WidgetBoundsPaneFactory.java
  21. 71
      designer_base/src/com/fr/design/widget/btn/ButtonWithHotkeysDetailPane.java
  22. 6
      designer_form/src/com/fr/design/designer/creator/XWTitleLayout.java
  23. 5
      designer_form/src/com/fr/design/mainframe/widget/UITreeComboBox.java
  24. 41
      designer_form/src/com/fr/design/mainframe/widget/ui/FormBasicPropertyPane.java
  25. 22
      designer_form/src/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java
  26. 48
      designer_form/src/com/fr/design/parameter/RootDesignDefinePane.java
  27. 14
      designer_form/src/com/fr/design/widget/FormWidgetDefinePaneFactoryBase.java
  28. 88
      designer_form/src/com/fr/design/widget/ui/designer/ButtonDefinePane.java
  29. 18
      designer_form/src/com/fr/design/widget/ui/designer/CheckBoxDefinePane.java
  30. 27
      designer_form/src/com/fr/design/widget/ui/designer/CheckBoxGroupDefinePane.java
  31. 39
      designer_form/src/com/fr/design/widget/ui/designer/ComboBoxDefinePane.java
  32. 87
      designer_form/src/com/fr/design/widget/ui/designer/ComboCheckBoxDefinePane.java
  33. 57
      designer_form/src/com/fr/design/widget/ui/designer/CustomWritableRepeatEditorPane.java
  34. 444
      designer_form/src/com/fr/design/widget/ui/designer/DateEditorDefinePane.java
  35. 47
      designer_form/src/com/fr/design/widget/ui/designer/DictEditorDefinePane.java
  36. 34
      designer_form/src/com/fr/design/widget/ui/designer/DirectWriteEditorDefinePane.java
  37. 56
      designer_form/src/com/fr/design/widget/ui/designer/FreeButtonDefinePane.java
  38. 31
      designer_form/src/com/fr/design/widget/ui/designer/LabelDefinePane.java
  39. 60
      designer_form/src/com/fr/design/widget/ui/designer/ListEditorDefinePane.java
  40. 8
      designer_form/src/com/fr/design/widget/ui/designer/MultiFileEditorPane.java
  41. 15
      designer_form/src/com/fr/design/widget/ui/designer/NumberEditorDefinePane.java
  42. 10
      designer_form/src/com/fr/design/widget/ui/designer/TextFieldEditorDefinePane.java
  43. 67
      designer_form/src/com/fr/design/widget/ui/designer/TreeComboBoxEditorDefinePane.java
  44. 129
      designer_form/src/com/fr/design/widget/ui/designer/TreeEditorDefinePane.java
  45. 30
      designer_form/src/com/fr/design/widget/ui/designer/btn/ButtonGroupDefinePane.java
  46. 19
      designer_form/src/com/fr/design/widget/ui/designer/component/BackgroundCompPane.java
  47. 119
      designer_form/src/com/fr/design/widget/ui/designer/component/FormWidgetValuePane.java
  48. 43
      designer_form/src/com/fr/design/widget/ui/designer/component/MouseActionBackground.java
  49. 27
      designer_form/src/com/fr/design/widget/ui/designer/component/WidgetAbsoluteBoundPane.java
  50. 24
      designer_form/src/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java
  51. 58
      designer_form/src/com/fr/design/widget/ui/designer/layout/ElementEditorDefinePane.java
  52. 10
      designer_form/src/com/fr/design/widget/ui/designer/layout/FRFitLayoutDefinePane.java
  53. 85
      designer_form/src/com/fr/design/widget/ui/designer/layout/WCardLayoutDefinePane.java
  54. 38
      designer_form/src/com/fr/design/widget/ui/designer/layout/WTabFitLayoutDefinePane.java
  55. 56
      designer_form/src/com/fr/design/widget/ui/designer/layout/WTitleLayoutDefinePane.java

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

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.UIPopupMenu;
import com.fr.design.mainframe.CellElementPropertyPane;
import com.fr.design.mainframe.CellWidgetPropertyPane;
import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.mainframe.ElementCasePane.Clear;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.menu.KeySetUtils;
import com.fr.design.report.RowColumnPane;
import com.fr.design.selection.QuickEditor;
import com.fr.form.ui.CellWidget;
import com.fr.general.Inter;
import com.fr.grid.GridUtils;
import com.fr.report.cell.CellElement;
@ -687,4 +689,9 @@ public class CellSelection extends Selection {
public void populatePropertyPane(ElementCasePane 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) {
CellElementPropertyPane.getInstance().removeAll();
}
public void populateWidgetPropertyPane(ElementCasePane ePane){
return;
}
}

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

@ -89,6 +89,8 @@ public abstract class Selection implements FCloneable, Serializable , Selectable
public abstract boolean containsColumnRow(ColumnRow cr);
public abstract void populatePropertyPane(ElementCasePane ePane);
public abstract void populateWidgetPropertyPane(ElementCasePane ePane);
@Override

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

@ -1,17 +1,66 @@
package com.fr.poly;
import java.util.ArrayList;
import javax.swing.table.TableModel;
import com.fr.design.gui.itable.AbstractPropertyTable;
import com.fr.design.gui.itable.PropertyGroup;
import com.fr.design.event.UIObserver;
import com.fr.design.event.UIObserverListener;
import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.mainframe.widget.BasicPropertyPane;
import com.fr.design.widget.WidgetBoundsPaneFactory;
import com.fr.general.Inter;
import com.fr.poly.group.PolyBoundsGroup;
import com.fr.poly.group.PolyNameGroup;
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 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) {
groups = new ArrayList<PropertyGroup>();
if (source instanceof TemplateBlock) {
TemplateBlock block = (TemplateBlock) source;
PolyNameGroup namegroup = new PolyNameGroup(block);
groups.add(new PropertyGroup(namegroup));
PolyBoundsGroup boundsgroup = new PolyBoundsGroup(block, designer.getTarget());
groups.add(new PropertyGroup(boundsgroup));
blockPropertyPane.getWidgetNameField().setText(block.getBlockName());
final PolyBoundsGroup boundsgroup = new PolyBoundsGroup(block, designer.getTarget());
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();
}
@ -42,8 +91,23 @@ public class PolyBlockProperTable extends AbstractPropertyTable {
}
public void populate(PolyDesigner designer) {
isPopulating = true;
this.designer = designer;
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();
}
}

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());
CellElementPropertyPane.getInstance().populate(editComponent);
CellWidgetPropertyPane.getInstance().populate(editComponent);
Selection Selection = ((JWorkBook) (HistoryTemplateListPane.getInstance().getCurrentEditingTemplate())).getEditingElementCasePane().getSelection();
if (Selection instanceof FloatSelection) {
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().replaceCellAttrPane(CellElementPropertyPane.getInstance());
EastRegionContainerPane.getInstance().replaceCellElementPane(QuickEditorRegion.getInstance());
EastRegionContainerPane.getInstance().replaceWidgetSettingsPane(CellWidgetPropertyPane.getInstance());
}
EastRegionContainerPane.getInstance().replaceCellAttrPane(CellElementPropertyPane.getInstance());

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

@ -86,7 +86,8 @@ public interface UIConstants {
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_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_HOVER = new Color(0xC9C9CD);
public static final Color CHECKBOX_HOVER_SELECTED = new Color(0x3394f0);

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

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

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

@ -16,6 +16,8 @@ import com.fr.general.Inter;
import com.fr.stable.StringUtils;
import javax.swing.*;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
@ -53,9 +55,10 @@ public class RegPane extends BasicPane {
private RegPhonePane regPhonePane;
private DefaultRegPane defaultRegPane;
private CustomRegRexPane customRegRexPane;
protected RegErrorMsgPane regErrorMsgPane;
public UIComboBox getRegComboBox() {
public UIComboBox getRegComboBox(){
return regComboBox;
}
@ -68,25 +71,20 @@ public class RegPane extends BasicPane {
this.initComponents();
}
private void initComponents() {
this.setLayout(new BorderLayout());
private void initComponents(){
this.setLayout(FRGUIPaneFactory.createBorderLayout());
JPanel contentPane = FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane();
this.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
this.add(contentPane, BorderLayout.NORTH);
contentPane.add(new UILabel(Inter.getLocText("FR-Designer_Input_Rule")));
regComboBox = new UIComboBox(regType);
regComboBox.setPreferredSize(new Dimension(140, 20));
regComboBox.setRenderer(listCellRender);
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
Component[][] components = new Component[][]{
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Input_Rule") + " "), regComboBox},
};
double[] rowSize = {p};
double[] columnSize = {p, f};
int[][] rowCount = {{1, 1}};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_LARGE, LayoutConstants.VGAP_LARGE);
panel.setBorder(BorderFactory.createEmptyBorder(8, 0, 0, 0));
this.add(panel, BorderLayout.NORTH);
UILabel uiLabel = new UILabel();
uiLabel.setPreferredSize(new Dimension(20, 20));
contentPane.add(uiLabel);
contentPane.add(regComboBox);
regErrorMsgPane = new RegErrorMsgPane();
final JPanel cardPane = FRGUIPaneFactory.createCardLayout_S_Pane();
detailedCardLayout = new CardLayout();
cardPane.setLayout(detailedCardLayout);
@ -94,26 +92,35 @@ public class RegPane extends BasicPane {
cardPane.add((regLengthPane = new RegLengthPane()), "Length");
cardPane.add((regPhonePane = new RegPhonePane()), "Phone");
cardPane.add((customRegRexPane = new CustomRegRexPane()), "Custom");
cardPane.setBorder(BorderFactory.createEmptyBorder(8, 12, 0, 0));
this.add(cardPane, BorderLayout.CENTER);
regComboBox.addActionListener(new ActionListener() {
this.add(regErrorMsgPane, BorderLayout.SOUTH);
regComboBox.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e) {
RegExp regExp = (RegExp) regComboBox.getSelectedItem();
if (regExp instanceof PhoneReg) {
RegExp regExp = (RegExp)regComboBox.getSelectedItem();
if(regExp instanceof PhoneReg) {
cardPane.setPreferredSize(new Dimension(220, 30));
Object selectItem = regPhonePane.dataTypeComboBox.getSelectedItem();
String regString = selectItem == null ? StringUtils.EMPTY : selectItem.toString();
firePhoneRegAction(regString);
detailedCardLayout.show(cardPane, "Phone");
} else {
if (regExp instanceof LengthReg) {
if (regExp instanceof LengthReg){
cardPane.setPreferredSize(new Dimension(220, 60));
detailedCardLayout.show(cardPane, "Length");
} else if (regExp instanceof CustomReg) {
} else if (regExp instanceof CustomReg){
cardPane.setPreferredSize(new Dimension(220, 30));
detailedCardLayout.show(cardPane, "Custom");
} else {
cardPane.setPreferredSize(new Dimension(0,0 ));
detailedCardLayout.show(cardPane, "Default");
}
fireRegChangeAction();
}
if(regExp instanceof NoneReg){
regErrorMsgPane.setVisible(false);
return;
}
regErrorMsgPane.setVisible(true);
}
});
}
@ -146,19 +153,21 @@ public class RegPane extends BasicPane {
} else {
defaultRegPane.populate(regex);
}
regErrorMsgPane.populate(regex);
}
public RegExp update() {
RegExp regExp = (RegExp) regComboBox.getSelectedItem();
if (regExp instanceof LengthReg) {
public RegExp update(){
RegExp regExp = (RegExp)regComboBox.getSelectedItem();
regErrorMsgPane.update();
if (regExp instanceof LengthReg){
return regLengthPane.update();
} else if (regExp instanceof PhoneReg) {
} else if(regExp instanceof PhoneReg) {
return regPhonePane.update();
} else if (regExp instanceof NoneReg || regExp instanceof MailReg || regExp instanceof IDCardReg
} else if(regExp instanceof NoneReg || regExp instanceof MailReg || regExp instanceof IDCardReg
|| regExp instanceof PostCardReg || regExp instanceof PhoneReg || regExp instanceof MobileReg) {
return regExp;
} else if (regExp instanceof CustomReg) {
}
else if (regExp instanceof CustomReg){
if (customRegRexPane.isEmpty()) {
return new NoneReg();
}
@ -177,7 +186,7 @@ public class RegPane extends BasicPane {
private static class DefaultRegPane extends DisplayPane {
public RegExp regRex;
public DefaultRegPane() {
public DefaultRegPane(){
}
@ -203,7 +212,10 @@ public class RegPane extends BasicPane {
* 添加电话规则监听器
*
* @param listener 监听器
*
*
* @date 2014-12-3-下午7:30:55
*
*/
public void addPhoneRegListener(PhoneRegListener listener) {
this.listenerList.add(PhoneRegListener.class, listener);
@ -213,7 +225,10 @@ public class RegPane extends BasicPane {
* 移除电话规则监听器
*
* @param listener 监听器
*
*
* @date 2014-12-3-下午7:30:55
*
*/
public void removePhoneRegListener(PhoneRegListener listener) {
this.listenerList.remove(PhoneRegListener.class, listener);
@ -223,7 +238,10 @@ public class RegPane extends BasicPane {
* 添加正则监听器
*
* @param listener 监听器
*
*
* @date 2014-12-3-下午7:29:48
*
*/
public void addRegChangeListener(RegChangeListener listener) {
this.listenerList.add(RegChangeListener.class, listener);
@ -233,7 +251,10 @@ public class RegPane extends BasicPane {
* 移除正则监听器
*
* @param listener 监听器
*
*
* @date 2014-12-3-下午7:29:48
*
*/
public void removeRegChangeListener(RegChangeListener listener) {
this.listenerList.remove(RegChangeListener.class, listener);
@ -241,45 +262,41 @@ public class RegPane extends BasicPane {
public class PhoneRegEvent extends EventObject {
private String phoneRegString;
public PhoneRegEvent(Object source, String phoneRegString) {
super(source);
this.setPhoneRegString(phoneRegString);
}
public void setPhoneRegString(String phoneRegString) {
this.phoneRegString = phoneRegString;
}
public String getPhoneRegString() {
return phoneRegString;
}
}
public class RegChangeEvent extends EventObject {
private String regString;
public RegChangeEvent(Object source, String regString) {
super(source);
this.setRegString(regString);
}
public void setRegString(String regString) {
this.regString = regString;
}
public String getRegString() {
return regString;
}
}
public interface PhoneRegListener extends EventListener {
public interface PhoneRegListener extends EventListener{
/**
* 电话规则变化监听
*
* @param e 变化事件
*
*
* @date 2014-12-3-下午7:29:01
*
*/
void phoneRegChangeAction(PhoneRegEvent e);
@ -290,29 +307,28 @@ public class RegPane extends BasicPane {
/**
* 正则表达规则变化监听
*
*
* @date 2014-12-3-下午7:29:01
*
*/
void regChangeAction();
}
protected void firePhoneRegAction(String phoneReg) {
Object[] listeners = listenerList.getListenerList();
for (int i = listeners.length - 2; i >= 0; i -= 2) {
if (listeners[i] == PhoneRegListener.class) {
((PhoneRegListener) listeners[i + 1]).phoneRegChangeAction(new PhoneRegEvent(this, phoneReg));
for (int i = listeners.length-2; i>=0; i-=2) {
if (listeners[i]==PhoneRegListener.class) {
((PhoneRegListener)listeners[i+1]).phoneRegChangeAction(new PhoneRegEvent(this , phoneReg));
}
}
}
protected void fireRegChangeAction() {
Object[] listeners = listenerList.getListenerList();
for (int i = listeners.length - 2; i >= 0; i -= 2) {
if (listeners[i] == RegChangeListener.class) {
((RegChangeListener) listeners[i + 1]).regChangeAction();
for (int i = listeners.length-2; i>=0; i-=2) {
if (listeners[i]==RegChangeListener.class) {
((RegChangeListener)listeners[i+1]).regChangeAction();
}
}
}
private class RegPhonePane extends DisplayPane {
private static final String EMB_REG1 = "025-85679591";
private static final String EMB_REG2 = "02585679591";
@ -322,19 +338,20 @@ public class RegPane extends BasicPane {
private UIComboBox dataTypeComboBox;
private final String[] dataType = {EMB_REG1, EMB_REG2, EMB_REG3, Inter.getLocText("FR-Designer_Custom")};
DefaultComboBoxModel DefaultComboBoxModel = new DefaultComboBoxModel(dataType);
DefaultComboBoxModel DefaultComboBoxModel= new DefaultComboBoxModel(dataType);
public RegPhonePane() {
this.setLayout(FRGUIPaneFactory.createLabelFlowLayout());
this.add(new UILabel(Inter.getLocText("FR-Designer_Data_Type") + ":"));
this.setBorder(BorderFactory.createEmptyBorder(5, 10, 5, 5));
this.setLayout(FRGUIPaneFactory.createBorderLayout());
dataTypeComboBox = new UIComboBox(DefaultComboBoxModel);
JTextField editFiled = (JTextField) (dataTypeComboBox.getEditor().getEditorComponent());
JTextField editFiled = (JTextField)(dataTypeComboBox.getEditor().getEditorComponent());
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{new UILabel(Inter.getLocText("FR-Designer_Data_Type")), dataTypeComboBox}}, TableLayoutHelper.FILL_LASTCOLUMN, 18, 7);
this.add(panel);
editFiled.setDocument(new LimitedDocument(LIMIT_LENGTH, REG_PATTERN));
dataTypeComboBox.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
if (e.getStateChange() == ItemEvent.SELECTED) {
if (ComparatorUtils.equals(e.getItem(), dataType[3])) {
if(e.getStateChange() == ItemEvent.SELECTED) {
if(ComparatorUtils.equals(e.getItem(), dataType[3])) {
dataTypeComboBox.setSelectedItem(null);
dataTypeComboBox.setEditable(true);
firePhoneRegAction(EMB_REG1);
@ -347,9 +364,7 @@ public class RegPane extends BasicPane {
});
dataTypeComboBox.setSelectedIndex(0);
firePhoneRegAction(dataTypeComboBox.getSelectedItem().toString());
this.add(dataTypeComboBox);
}
@Override
protected String title4PopupWindow() {
return "PHONE";
@ -357,17 +372,17 @@ public class RegPane extends BasicPane {
@Override
public void populate(RegExp regRex) {
if (!(regRex instanceof PhoneReg)) {
return;
if(!(regRex instanceof PhoneReg)) {
return ;
}
String regstr = ((PhoneReg) regRex).getRegString();
if (checkEmbedded(regstr)) {
String regstr = ((PhoneReg)regRex).getRegString();
if (checkEmbedded(regstr)){
DefaultComboBoxModel.addElement(regstr);
}
dataTypeComboBox.setSelectedItem(((PhoneReg) regRex).getRegString());
dataTypeComboBox.setSelectedItem(((PhoneReg)regRex).getRegString());
}
private boolean checkEmbedded(String regstr) {
private boolean checkEmbedded(String regstr){
return !ComparatorUtils.equals(EMB_REG1, regstr) &&
!ComparatorUtils.equals(EMB_REG2, regstr) &&
!ComparatorUtils.equals(EMB_REG3, regstr);
@ -376,7 +391,7 @@ public class RegPane extends BasicPane {
@Override
public RegExp update() {
PhoneReg regRex = new PhoneReg();
regRex.setRegString((String) (dataTypeComboBox.getSelectedItem()));
regRex.setRegString((String)(dataTypeComboBox.getSelectedItem()));
return regRex;
}
}
@ -385,22 +400,25 @@ public class RegPane extends BasicPane {
private UISpinner minLenSpinner;
private UISpinner maxLenSpinner;
public RegLengthPane() {
this.setLayout(new BorderLayout());
public RegLengthPane(){
this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.setBorder(BorderFactory.createEmptyBorder(5, 10, 5, 5));
this.setPreferredSize(new Dimension(210, 56));
minLenSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, 0);
maxLenSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, 0);
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
Component[][] components = new Component[][]{
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Reg_Min_Length")), minLenSpinner},
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Reg_Max_Length")), maxLenSpinner},
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Reg_Min_Length") + ":"), minLenSpinner },
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Reg_Max_Length") + ":"), maxLenSpinner},
};
double[] rowSize = {p, p};
double[] columnSize = {p, f};
int[][] rowCount = {{1, 1}, {1, 1}};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 8, 5);
double[] columnSize = {p,f};
int[][] rowCount = {{1, 1},{1, 1}};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_SMALL, LayoutConstants.VGAP_MEDIUM);
this.add(panel);
this.add(panel, BorderLayout.CENTER);
}
@Override
@ -410,20 +428,20 @@ public class RegPane extends BasicPane {
@Override
public void populate(RegExp regRex) {
if (!(regRex instanceof LengthReg)) {
if (!(regRex instanceof LengthReg)){
return;
}
int minLength = ((LengthReg) regRex).getMinLen();
int maxLength = ((LengthReg) regRex).getMaxLen();
int minLength = ((LengthReg)regRex).getMinLen();
int maxLength = ((LengthReg)regRex).getMaxLen();
minLenSpinner.setValue(minLength);
maxLenSpinner.setValue(maxLength);
}
@Override
public RegExp update() {
int startLength = ((Number) minLenSpinner.getValue()).intValue();
int endLength = ((Number) maxLenSpinner.getValue()).intValue();
int startLength = ((Number)minLenSpinner.getValue()).intValue();
int endLength = ((Number)maxLenSpinner.getValue()).intValue();
LengthReg regRex = new LengthReg();
regRex.setMinLen(startLength);
regRex.setMaxLen(endLength);
@ -432,22 +450,14 @@ public class RegPane extends BasicPane {
}
}
private static class CustomRegRexPane extends DisplayPane {
private static class CustomRegRexPane extends DisplayPane{
private UITextField regTextField;
public CustomRegRexPane() {
this.setLayout(new BorderLayout());
regTextField = new UITextField(12);
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
Component[][] components = new Component[][]{
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Reg_Expressions")), regTextField},
};
double[] rowSize = {p};
double[] columnSize = {p, f};
int[][] rowCount = {{1, 1}};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 2, 1);
public CustomRegRexPane(){
this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.setBorder(BorderFactory.createEmptyBorder(5, 10, 5, 5));
regTextField = new UITextField();
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{new UILabel(Inter.getLocText("FR-Designer_Reg_Expressions")), regTextField}}, TableLayoutHelper.FILL_LASTCOLUMN, 18, 7);
this.add(panel);
}
@ -458,7 +468,7 @@ public class RegPane extends BasicPane {
@Override
public void populate(RegExp regRex) {
if (!(regRex instanceof CustomReg)) {
if (!(regRex instanceof CustomReg)){
return;
}
regTextField.setText(regRex.toRegText());
@ -474,26 +484,77 @@ public class RegPane extends BasicPane {
}
}
ListCellRenderer listCellRender = new UIComboBoxRenderer() {
private static class RegErrorMsgPane extends DisplayPane{
private UITextField regErrorMsgField;
public RegErrorMsgPane(){
this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.setBorder(BorderFactory.createEmptyBorder(5,0,0,0));
initRegErrorMsgField();
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{new UILabel(Inter.getLocText("FR-Designer_Widget_Error_Tip")), regErrorMsgField}}, TableLayoutHelper.FILL_LASTCOLUMN, 18, 7);
this.add(panel);
}
private void initRegErrorMsgField(){
regErrorMsgField = new UITextField();
regErrorMsgField.getDocument().addDocumentListener(new DocumentListener() {
public void changedUpdate(DocumentEvent e) {
regErrorMsgField.setToolTipText(regErrorMsgField.getText());
}
public void insertUpdate(DocumentEvent e) {
regErrorMsgField.setToolTipText(regErrorMsgField.getText());
}
public void removeUpdate(DocumentEvent e) {
regErrorMsgField.setToolTipText(regErrorMsgField.getText());
}
});
}
@Override
protected String title4PopupWindow() {
return "CUSTOM";
}
@Override
public void populate(RegExp regRex) {
if (!(regRex instanceof CustomReg)){
return;
}
regErrorMsgField.setText(regRex.toRegText());
}
@Override
public RegExp update() {
return new CustomReg(regErrorMsgField.getText());
}
public boolean isEmpty() {
return StringUtils.isEmpty(regErrorMsgField.getText());
}
}
ListCellRenderer listCellRender = new UIComboBoxRenderer(){
@Override
public Component getListCellRendererComponent(JList list, Object value,
int index, boolean isSelected, boolean cellHasFocus) {
super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
if (value instanceof NoneReg) {
if (value instanceof NoneReg){
this.setText(Inter.getLocText("FR-Designer_None"));
} else if (value instanceof LengthReg) {
} else if (value instanceof LengthReg){
this.setText(Inter.getLocText("FR-Designer_Length"));
} else if (value instanceof MailReg) {
} else if (value instanceof MailReg){
this.setText(Inter.getLocText("FR-Designer_Email"));
} else if (value instanceof PhoneReg) {
} else if (value instanceof PhoneReg){
this.setText(Inter.getLocText("FR-Designer_Phone"));
} else if (value instanceof MobileReg) {
this.setText(Inter.getLocText("FR-Designer_MobilePhone"));
} else if (value instanceof IDCardReg) {
} else if (value instanceof IDCardReg){
this.setText(Inter.getLocText("FR-Designer_IDCard"));
} else if (value instanceof PostCardReg) {
} else if (value instanceof PostCardReg){
this.setText(Inter.getLocText("FR-Designer_PostCode"));
} else if (value instanceof CustomReg) {
} else if (value instanceof CustomReg){
this.setText(Inter.getLocText("FR-Designer_Custom"));
}
return this;

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 rollover = -1;
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对象

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) {
super(text, icon, selected);
}
}

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

@ -2116,3 +2116,5 @@ 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

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

@ -2111,4 +2111,6 @@ 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_Display_Position=Display Position
FR-Designer_Widget_Name=Widget Name
FR-Designer_Coords_And_Size=Coords & Size

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

@ -2115,3 +2115,5 @@ 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/locale/designer_ko_KR.properties

@ -2115,3 +2115,5 @@ 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/locale/designer_zh_CN.properties

@ -2123,3 +2123,5 @@ 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

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

@ -2114,4 +2114,6 @@ 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_Display_Position=
FR-Designer_Widget_Name=
FR-Designer_Coords_And_Size=

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
*/
public class DataBindingEditor extends Editor<DataBinding> {
private final static int HORI_GAP = 1;
private final static int VER_GAP = 7;
private TableDataComboBox tableDataComboBox;
private LazyComboBox columnNameComboBox;
@ -61,7 +63,7 @@ public class DataBindingEditor extends Editor<DataBinding> {
private void initCompontents() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.setLayout(new BorderLayout(HORI_GAP, VER_GAP));
tableDataComboBox = new TableDataComboBox(getTableDataSource());
tableDataComboBox.setPreferredSize(new Dimension(55, 20));
tableDataComboBox.addItemListener(tableDataComboBoxListener);
@ -86,7 +88,7 @@ public class DataBindingEditor extends Editor<DataBinding> {
}
});
columnNameComboBox.setEditable(true);
this.add(tableDataComboBox, BorderLayout.WEST);
this.add(tableDataComboBox, BorderLayout.NORTH);
this.add(columnNameComboBox, BorderLayout.CENTER);
columnNameComboBox.addItemListener(columnNameComboboxListener);
}

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

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

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

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 int INDEX = 0;
public XWTitleLayout() {
super(new WTitleLayout("titlePane"), new Dimension());
}
@ -59,6 +61,10 @@ public class XWTitleLayout extends DedicateLayoutContainer {
return new FRTitleLayoutAdapter(this);
}
public XCreator getEditingChildCreator(){
return getXCreator(INDEX);
}
/**
* 返回容器对应的wlayout
*

5
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.tree.*;
import com.fr.design.constants.UIConstants;
import com.fr.design.designer.beans.*;
import com.fr.design.designer.beans.events.DesignerEditListener;
import com.fr.design.designer.beans.events.DesignerEvent;
@ -221,7 +222,7 @@ class TreePopup extends JPopupMenu implements ComboPopup{
JTree tree = this.comboBox.getTree();
if(tree != null){
scrollPane = new UIScrollPane(tree);
scrollPane.setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 0));
scrollPane.setBorder(null);
add(scrollPane, BorderLayout.CENTER);
}
}
@ -230,6 +231,8 @@ class TreePopup extends JPopupMenu implements ComboPopup{
updatePopup();
show(comboBox, 0, comboBox.getHeight());
comboBox.getTree().requestFocus();
comboBox.getTree().setBackground(UIConstants.TREE_BACKGROUND);
comboBox.getTree().setOpaque(true);
}
public void hide(){

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

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

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

@ -14,6 +14,7 @@ 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.*;
@ -129,13 +130,14 @@ public class FormWidgetCardPane extends AbstractAttrNoScrollPane {
private void initDefinePane() {
currentEditorDefinePane = null;
XCreator creator = xCreator;
if (xCreator instanceof XWScaleLayout) {
if (xCreator.acceptType(XWScaleLayout.class)) {
if (xCreator.getComponentCount() > 0 && ((XCreator) xCreator.getComponent(0)).shouldScaleCreator()) {
creator = (XCreator) xCreator.getComponent(0);
}
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) {
@ -166,7 +168,10 @@ public class FormWidgetCardPane extends AbstractAttrNoScrollPane {
if (cellWidget instanceof WScaleLayout) {
Widget crBoundsWidget = ((WScaleLayout) cellWidget).getBoundsWidget();
currentEditorDefinePane.populateBean(((CRBoundsWidget) crBoundsWidget).getWidget());
} else {
} else if(cellWidget instanceof WTitleLayout){
CRBoundsWidget crBoundsWidget = ((WTitleLayout) cellWidget).getBodyBoundsWidget();
currentEditorDefinePane.populateBean(crBoundsWidget.getWidget());
}else{
currentEditorDefinePane.populateBean(cellWidget);
}
widgetPropertyPane.populate(cellWidget);
@ -188,6 +193,11 @@ public class FormWidgetCardPane extends AbstractAttrNoScrollPane {
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);
}

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

@ -1,27 +1,22 @@
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.XWAbsoluteBodyLayout;
import com.fr.design.designer.creator.XWParameterLayout;
import com.fr.design.designer.properties.items.FRLayoutTypeItems;
import com.fr.design.designer.properties.items.Item;
import com.fr.design.designer.properties.items.ItemProvider;
import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.design.mainframe.widget.accessibles.AccessibleBackgroundEditor;
import com.fr.design.widget.ui.designer.AbstractDataModify;
import com.fr.form.ui.container.WAbsoluteBodyLayout;
import com.fr.form.ui.container.WBodyLayoutType;
import com.fr.form.ui.container.WParameterLayout;
import com.fr.general.Inter;
import com.fr.stable.Constants;
import javax.swing.*;
import java.awt.*;
@ -33,8 +28,8 @@ public class RootDesignDefinePane extends AbstractDataModify<WParameterLayout> {
private XWParameterLayout root;
private UISpinner designerWidth;
private UICheckBox displayReport;
private UITextField background;
private UITextField displayPosition;
private AccessibleBackgroundEditor background;
private UIButtonGroup hAlignmentPane;
public RootDesignDefinePane(XCreator xCreator) {
super(xCreator);
@ -50,13 +45,12 @@ public class RootDesignDefinePane extends AbstractDataModify<WParameterLayout> {
UIExpandablePane advanceExpandablePane = new UIExpandablePane(Inter.getLocText("FR-Designer_Advanced"), 280, 20, advancePane);
this.add(advanceExpandablePane, BorderLayout.NORTH);
JPanel layoutPane = createBoundsPane();
// layoutPane.setLayout(FRGUIPaneFactory.createBorderLayout());
// layoutPane.add(GUICoreUtils.createFlowPane(new JComponent[]{new UILabel("设计宽度"), designerWidth}, FlowLayout.LEFT, 4));
UIExpandablePane layoutExpandablePane = new UIExpandablePane(Inter.getLocText("Size"), 280, 20, layoutPane);
this.add(layoutExpandablePane, BorderLayout.CENTER);
}
public JPanel createBoundsPane(){
public JPanel createBoundsPane() {
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
double[] rowSize = {p};
@ -66,26 +60,32 @@ public class RootDesignDefinePane extends AbstractDataModify<WParameterLayout> {
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));
panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
return panel;
}
public JPanel createAdvancePane(){
public JPanel createAdvancePane() {
displayReport = new UICheckBox(Inter.getLocText("FR-Designer_DisplayNothingBeforeQuery"));
background = new UITextField();
displayPosition = new UITextField();
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[] rowSize = {p, p, p};
double[] columnSize = {p, f};
int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}};
Component[][] components = new Component[][]{
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Background")), background},
new Component[]{displayReport, null },
new Component[]{new UILabel(Inter.getLocText("FR-Designer_WidgetDisplyPosition")), displayPosition}
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));
panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
return panel;
}
@ -96,8 +96,10 @@ public class RootDesignDefinePane extends AbstractDataModify<WParameterLayout> {
@Override
public void populateBean(WParameterLayout ob) {
background.setValue(ob.getBackground());
displayReport.setSelected(ob.isDelayDisplayContent());
designerWidth.setValue(ob.getDesignWidth());
hAlignmentPane.setSelectedIndex(ob.getPosition());
}
@ -106,6 +108,8 @@ public class RootDesignDefinePane extends AbstractDataModify<WParameterLayout> {
WParameterLayout wParameterLayout = (WParameterLayout) creator.toData();
wParameterLayout.setDesignWidth((int) designerWidth.getValue());
wParameterLayout.setDelayDisplayContent(displayReport.isSelected());
wParameterLayout.setBackground(wParameterLayout.getBackground());
wParameterLayout.setPosition(hAlignmentPane.getSelectedIndex());
return wParameterLayout;
}

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

@ -44,25 +44,25 @@ public class FormWidgetDefinePaneFactoryBase {
defineMap.put(TextEditor.class, new Appearance(TextFieldEditorDefinePane.class, WidgetConstants.TEXT + ""));
defineMap.put(NameWidget.class, new Appearance(UserEditorDefinePane.class, "UserDefine"));
defineMap.put(ComboCheckBox.class, new Appearance(ComboCheckBoxDefinePane.class, WidgetConstants.COMBOCHECKBOX + ""));
defineMap.put(ListEditor.class, new Appearance(ListEditorDefinePane.class, WidgetConstants.LIST + ""));
defineMap.put(ComboBox.class, new Appearance(ComboBoxDefinePane.class, WidgetConstants.COMBOBOX + ""));
defineMap.put(RadioGroup.class, new Appearance(RadioGroupDefinePane.class, WidgetConstants.RADIOGROUP + ""));
defineMap.put(CheckBoxGroup.class, new Appearance(CheckBoxGroupDefinePane.class, WidgetConstants.CHECKBOXGROUP + ""));
defineMap.put(NoneWidget.class, new Appearance(NoneWidgetDefinePane.class, WidgetConstants.NONE + ""));
defineMap.put(Button.class, new Appearance(ButtonDefinePane.class, WidgetConstants.BUTTON + ""));
defineMap.put(FreeButton.class, new Appearance(ButtonDefinePane.class, WidgetConstants.BUTTON + ""));
defineMap.put(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 + ""));
}
// 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(WTitleLayout.class, new Appearance(WTitleLayoutDefinePane.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());

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

@ -1,19 +1,26 @@
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.widget.btn.ButtonDetailPane;
import com.fr.design.widget.ui.designer.btn.ButtonDetailPaneFactory;
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.form.ui.FreeButton;
import com.fr.general.Inter;
import com.fr.stable.StableUtils;
import javax.swing.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.*;
public class ButtonDefinePane extends AbstractDataModify<Button> {
private ButtonDetailPane detailPane;
public abstract class ButtonDefinePane<T extends Button> extends AbstractDataModify<T> {
private UITextField hotkeysTextField;
private UITextField buttonNameTextField;
private AccessibleIconEditor iconPane;
public ButtonDefinePane(XCreator creator){
super(creator);
@ -21,8 +28,31 @@ public class ButtonDefinePane extends AbstractDataModify<Button> {
}
private void initComponent() {
setLayout(FRGUIPaneFactory.createBorderLayout());
setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
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
@ -30,31 +60,33 @@ public class ButtonDefinePane extends AbstractDataModify<Button> {
return "Button";
}
private void resetDetailPane(Button btn, Class cls) {
if (detailPane != null) {
remove(detailPane);
}
detailPane = ButtonDetailPaneFactory.createButtonDetailPane(cls, btn);
add(detailPane, BorderLayout.CENTER);
detailPane.addTypeChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
resetDetailPane(null, (Class) e.getSource());
}
});
this.updateUI();
public Component[] createBackgroundComp(){
return new Component[]{null, null};
}
@Override
public void populateBean(Button btn) {
resetDetailPane(btn, btn instanceof FreeButton && !((FreeButton) btn).isCustomStyle() ? Button.class : null);
public Component[] createFontPane(){
return new Component[]{null, null};
}
@Override
public Button updateBean() {
public void populateBean(T btn) {
hotkeysTextField.setText(btn.getHotkeys());
buttonNameTextField.setText(btn.getLabelName());
iconPane.setValue(btn.getIconName());
populateSubButtonPane(btn);
}
// resetDetailPane(btn, btn instanceof FreeButton && !((FreeButton) btn).isCustomStyle() ? Button.class : null);
return new Button();
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;
}
}

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

@ -3,7 +3,9 @@ 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;
@ -15,7 +17,8 @@ import java.awt.*;
public class CheckBoxDefinePane extends AbstractDataModify<CheckBox> {
private UITextField text;
private UITextField fontSizePane;
private UISpinner fontSizePane;
private FormWidgetValuePane formWidgetValuePane;
public CheckBoxDefinePane(XCreator xCreator) {
super(xCreator);
@ -23,9 +26,10 @@ public class CheckBoxDefinePane extends AbstractDataModify<CheckBox> {
}
private void iniComoponents() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
text = new UITextField();
fontSizePane = new UITextField();
FormWidgetValuePane formWidgetValuePane = new FormWidgetValuePane();
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[][]{
@ -50,13 +54,17 @@ public class CheckBoxDefinePane extends AbstractDataModify<CheckBox> {
@Override
public void populateBean(CheckBox check) {
// text.setText(check.getText());
text.setText(check.getText());
fontSizePane.setValue(check.getFontSize());
formWidgetValuePane.populate(check);
}
@Override
public CheckBox updateBean() {
CheckBox box = new CheckBox();
CheckBox box = (CheckBox)creator.toData();
box.setText(text.getText());
box.setFontSize((int)fontSizePane.getValue());
formWidgetValuePane.update(box);
return box;
}
}

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

@ -2,9 +2,9 @@ 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.design.present.dict.DictionaryPane;
@ -17,7 +17,7 @@ import java.awt.*;
public class CheckBoxGroupDefinePane extends ButtonGroupDefinePane<CheckBoxGroup> {
private DictionaryPane dictPane;
private UIHeadGroup returnType;
private UICheckBox checkbox;
public CheckBoxGroupDefinePane(XCreator xCreator) {
@ -40,11 +40,26 @@ public class CheckBoxGroupDefinePane extends ButtonGroupDefinePane<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")), new UITextField()},
new Component[]{new UILabel(Inter.getLocText("Widget-Date_Selector_Return_Type")), returnType},
};
double[] rowSize = {p, p};
double[] columnSize = {p, f};
@ -56,6 +71,11 @@ public class CheckBoxGroupDefinePane extends ButtonGroupDefinePane<CheckBoxGroup
@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());
}
@ -65,7 +85,6 @@ public class CheckBoxGroupDefinePane extends ButtonGroupDefinePane<CheckBoxGroup
@Override
protected CheckBoxGroup updateSubButtonGroupBean() {
CheckBoxGroup ob = (CheckBoxGroup) creator.toData();
ob.setDictionary(this.dictPane.updateBean());
ob.setChooseAll(checkbox.isSelected());
return ob;

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

@ -2,36 +2,45 @@ 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.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 javax.swing.*;
public class ComboBoxDefinePane extends CustomWritableRepeatEditorPane<ComboBox> {
protected DictionaryPane dictPane;
import java.awt.*;
public class ComboBoxDefinePane extends DictEditorDefinePane<ComboBox> {
private UICheckBox removeRepeatCheckBox;
private UITextField waterMarkField;
public ComboBoxDefinePane(XCreator xCreator) {
super(xCreator);
dictPane = new DictionaryPane();
}
protected JPanel setForthContentPane () {
return null;
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 populateSubCustomWritableRepeatEditorBean(ComboBox e) {
removeRepeatCheckBox.setSelected(e.isRemoveRepeat());
this.dictPane.populateBean(e.getDictionary());
protected void populateSubDictionaryEditorBean(ComboBox ob){
removeRepeatCheckBox.setSelected(ob.isRemoveRepeat());
formWidgetValuePane.populate(ob);
}
protected ComboBox updateSubCustomWritableRepeatEditorBean() {
ComboBox combo = new ComboBox();
combo.setDictionary(this.dictPane.updateBean());
protected ComboBox updateSubDictionaryEditorBean(){
ComboBox combo = (ComboBox) creator.toData();
combo.setRemoveRepeat(removeRepeatCheckBox.isSelected());
formWidgetValuePane.update(combo);
return combo;
}
@Override
public String title4PopupWindow() {
return "ComboBox";
@ -39,6 +48,6 @@ public class ComboBoxDefinePane extends CustomWritableRepeatEditorPane<ComboBox>
@Override
public DataCreatorUI dataUI() {
return dictPane;
return null;
}
}

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

@ -2,63 +2,61 @@ 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.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.present.dict.DictionaryPane;
import com.fr.form.ui.ComboCheckBox;
import com.fr.general.Inter;
import javax.swing.*;
import java.awt.*;
public class ComboCheckBoxDefinePane extends CustomWritableRepeatEditorPane<ComboCheckBox> {
private CheckBoxDictPane checkBoxDictPane;
private DictionaryPane dictPane;
public class ComboCheckBoxDefinePane extends DictEditorDefinePane<ComboCheckBox> {
private UICheckBox supportTagCheckBox;
private UIHeadGroup returnType;
private UITextField waterMarkDictPane;
private UICheckBox removeRepeatCheckBox;
public ComboCheckBoxDefinePane(XCreator xCreator) {
super(xCreator);
dictPane = new DictionaryPane();
checkBoxDictPane = new CheckBoxDictPane();
supportTagCheckBox = new UICheckBox(Inter.getLocText("Form-SupportTag"), true);
}
@Override
protected JPanel setForthContentPane() {
JPanel attrPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_S_Pane();
attrPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
JPanel contenter = FRGUIPaneFactory.createBorderLayout_L_Pane();
contenter.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
attrPane.add(contenter);
//是否以标签形式显示
JPanel tagPane = FRGUIPaneFactory.createMediumHGapFlowInnerContainer_M_Pane();
tagPane.add(supportTagCheckBox);
contenter.add(tagPane, BorderLayout.NORTH);
contenter.add(checkBoxDictPane, BorderLayout.WEST);
return attrPane;
public UICheckBox createRepeatCheckBox(){
removeRepeatCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_Widget_No_Repeat"));
return removeRepeatCheckBox;
}
@Override
protected void populateSubCustomWritableRepeatEditorBean(ComboCheckBox e) {
this.dictPane.populateBean(e.getDictionary());
this.checkBoxDictPane.populate(e);
this.supportTagCheckBox.setSelected(e.isSupportTag());
this.removeRepeatCheckBox.setSelected(e.isRemoveRepeat());
public 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[]{new UICheckBox(Inter.getLocText("Form-SupportTag")), null },
new Component[]{new UILabel(Inter.getLocText("Widget-Date_Selector_Return_Type")), new UITextField()},
new Component[]{supportTagCheckBox, null },
new Component[]{new UILabel(Inter.getLocText("Widget-Date_Selector_Return_Type")), returnType},
};
double[] rowSize = {p, p};
double[] columnSize = {p, f};
@ -68,19 +66,30 @@ public class ComboCheckBoxDefinePane extends CustomWritableRepeatEditorPane<Comb
return panel;
}
@Override
protected ComboCheckBox updateSubCustomWritableRepeatEditorBean() {
ComboCheckBox combo = new ComboCheckBox();
combo.setSupportTag(this.supportTagCheckBox.isSelected());
combo.setDictionary(this.dictPane.updateBean());
checkBoxDictPane.update(combo);
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 dictPane;
return null;
}
@Override

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

@ -1 +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); } // @Override // protected JPanel setThirdContentPane() { // JPanel contentPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); // contentPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); // JPanel otherContentPane = this.setForthContentPane(); // if (otherContentPane != null) { // contentPane.add(otherContentPane,BorderLayout.CENTER); // } // return contentPane; // } public JPanel setValidatePane(){ this.customDataCheckBox = new UICheckBox(Inter.getLocText("Form-Allow_CustomData"), false); this.customDataCheckBox.setPreferredSize( new Dimension(CUSTOM_DATA_CHECK_BOX_WIDTH, CUSTOM_DATA_CHECK_BOX_HEIGHT)); JPanel otherContentPane = super.setValidatePane(); otherContentPane.add(GUICoreUtils.createFlowPane(new JComponent[]{customDataCheckBox}, FlowLayout.LEFT, 5)); return otherContentPane; } protected abstract JPanel setForthContentPane(); protected void populateSubWritableRepeatEditorBean(T e) { this.customDataCheckBox.setSelected(e.isCustomData()); populateSubCustomWritableRepeatEditorBean(e); } protected abstract void populateSubCustomWritableRepeatEditorBean(T e); protected T updateSubWritableRepeatEditorBean() { T e = updateSubCustomWritableRepeatEditorBean(); e.setCustomData(this.customDataCheckBox.isSelected()); return e; } protected abstract T updateSubCustomWritableRepeatEditorBean(); }
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();
}

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

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

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

@ -3,7 +3,6 @@ package com.fr.design.widget.ui.designer;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
@ -18,8 +17,7 @@ import java.awt.*;
//richer:需要提供能否直接编辑的控件设置面板——下拉框、复选框、时间、日期、下拉树
public abstract class DirectWriteEditorDefinePane<T extends DirectWriteEditor> extends FieldEditorDefinePane<T> {
public UICheckBox directWriteCheckBox;
protected WaterMarkDictPane waterMarkDictPane;
protected UICheckBox removeRepeatCheckBox;
protected FormWidgetValuePane formWidgetValuePane;
public DirectWriteEditorDefinePane(XCreator xCreator) {
super(xCreator);
@ -29,17 +27,17 @@ public abstract class DirectWriteEditorDefinePane<T extends DirectWriteEditor> e
@Override
protected JPanel setFirstContentPane() {
JPanel advancePane = FRGUIPaneFactory.createBorderLayout_S_Pane();
waterMarkDictPane = new WaterMarkDictPane();
removeRepeatCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_Widget_No_Repeat"));
FormWidgetValuePane formWidgetValuePane = new FormWidgetValuePane();
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 },
new Component[]{new UILabel(Inter.getLocText("FR-Designer_DS-Dictionary")), new UITextField()},
new Component[]{removeRepeatCheckBox, null},
new Component[]{new UILabel(Inter.getLocText("FR-Designer_WaterMark")), waterMarkDictPane},
dicPane,
removeRepeatPane,
waterMarkComponent,
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Font-Size")), fontSizePane}
};
double[] rowSize = {p, p, p, p, p, p,p};
@ -56,6 +54,18 @@ public abstract class DirectWriteEditorDefinePane<T extends DirectWriteEditor> e
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;
}
@ -73,8 +83,6 @@ public abstract class DirectWriteEditorDefinePane<T extends DirectWriteEditor> e
@Override
protected void populateSubFieldEditorBean(T e) {
this.directWriteCheckBox.setSelected(e.isDirectEdit());
this.waterMarkDictPane.populate(e);
removeRepeatCheckBox.setSelected(e.isChartRelated());
populateSubDirectWriteEditorBean(e);
}
@ -83,9 +91,7 @@ public abstract class DirectWriteEditorDefinePane<T extends DirectWriteEditor> e
@Override
protected T updateSubFieldEditorBean() {
T e = updateSubDirectWriteEditorBean();
e.setDirectEdit(directWriteCheckBox.isSelected());
this.waterMarkDictPane.update(e);
return e;
}

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

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

@ -1,16 +1,19 @@
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.itextfield.UITextField;
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.*;
@ -23,6 +26,8 @@ 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);
@ -37,23 +42,33 @@ public class LabelDefinePane extends AbstractDataModify<Label> {
}
public JPanel createAdvancePane() {
formWidgetValuePane = new FormWidgetValuePane();
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")), new UITextField()},
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Font-Size")), new UITextField()},
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));
panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
return panel;
}
@ -64,16 +79,22 @@ public class LabelDefinePane extends AbstractDataModify<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;
}
}

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

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

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

@ -5,8 +5,8 @@ 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.gui.itextfield.UITextField;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
@ -20,7 +20,7 @@ public class MultiFileEditorPane extends FieldEditorDefinePane<MultiFileEditor>
private DictionaryComboBox acceptType;
private UICheckBox singleFileCheckBox;
private UINumberField fileSizeField;
private UITextField fontSizeField;
private UISpinner fontSizeField;
public MultiFileEditorPane(XCreator xCreator) {
super(xCreator);
@ -37,7 +37,7 @@ public class MultiFileEditorPane extends FieldEditorDefinePane<MultiFileEditor>
acceptType = new DictionaryComboBox(DictionaryConstants.acceptTypes, DictionaryConstants.fileTypeDisplays);
singleFileCheckBox = new UICheckBox(Inter.getLocText("SINGLE_FILE_UPLOAD"));
fileSizeField = new UINumberField();
fontSizeField = new UITextField();
fontSizeField = new UISpinner(0, 20, 1, 0);
JPanel singleFilePane = FRGUIPaneFactory.createNormalFlowInnerContainer_M_Pane();
singleFilePane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
@ -77,6 +77,7 @@ public class MultiFileEditorPane extends FieldEditorDefinePane<MultiFileEditor>
acceptType.setSelectedItem(e.getAccept());
singleFileCheckBox.setSelected(e.isSingleFile());
fileSizeField.setValue(e.getMaxSize());
fontSizeField.setValue(e.getFontSize());
}
@Override
@ -85,6 +86,7 @@ public class MultiFileEditorPane extends FieldEditorDefinePane<MultiFileEditor>
ob.setAccept((String) acceptType.getSelectedItem());
ob.setSingleFile(singleFileCheckBox.isSelected());
ob.setMaxSize(fileSizeField.getValue());
ob.setFontSize((int)fontSizeField.getValue());
return ob;
}

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

@ -4,7 +4,6 @@ import com.fr.design.designer.creator.XCreator;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UIBasicSpinner;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.widget.ui.designer.component.FormWidgetValuePane;
@ -23,7 +22,7 @@ public class NumberEditorDefinePane extends FieldEditorDefinePane<NumberEditor>
public NumberEditorDefinePane(XCreator xCreator){
super(xCreator);
}
private FormWidgetValuePane formWidgetValuePane;
/**
*
*/
@ -154,13 +153,13 @@ public class NumberEditorDefinePane extends FieldEditorDefinePane<NumberEditor>
protected JPanel setFirstContentPane() {
// richer:数字的允许直接编辑没有意义
waterMarkDictPane = new WaterMarkDictPane();
FormWidgetValuePane formWidgetValuePane = new FormWidgetValuePane();
formWidgetValuePane = new FormWidgetValuePane(creator.toData(), false);
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
Component[][] components = new Component[][]{
new Component[]{new UILabel("控件值"), formWidgetValuePane},
new Component[]{new UILabel("水印"), waterMarkDictPane},
new Component[]{new UILabel("字体大小"), new UITextField()}
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};
@ -217,7 +216,6 @@ public class NumberEditorDefinePane extends FieldEditorDefinePane<NumberEditor>
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 10, 3);
return panel;
}
@ -252,6 +250,7 @@ public class NumberEditorDefinePane extends FieldEditorDefinePane<NumberEditor>
minValueSpinner.setEnabled(true);
minValueSpinner.setValue(new Double(e.getMinValue()));
}
formWidgetValuePane.populate(e);
// this.regErrorMsgTextField.setText(e.getRegErrorMessage());
this.waterMarkDictPane.populate(e);
}
@ -260,6 +259,7 @@ public class NumberEditorDefinePane extends FieldEditorDefinePane<NumberEditor>
protected NumberEditor updateSubFieldEditorBean() {
NumberEditor ob = new NumberEditor();
formWidgetValuePane.update(ob);
ob.setAllowDecimals(allowDecimalsCheckBox.isSelected());
if (allowDecimalsCheckBox.isSelected()) {
ob.setMaxDecimalLength(this.decimalLength.getValue());
@ -280,7 +280,6 @@ public class NumberEditorDefinePane extends FieldEditorDefinePane<NumberEditor>
this.waterMarkDictPane.update(ob);
// ob.setRegErrorMessage(this.regErrorMsgTextField.getText());
return ob;
}

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

@ -8,13 +8,10 @@ import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.widget.ui.designer.component.FormWidgetValuePane;
import com.fr.form.ui.TextEditor;
import com.fr.form.ui.reg.RegExp;
import com.fr.general.Inter;
import com.fr.stable.StringUtils;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
@ -34,7 +31,6 @@ public class TextFieldEditorDefinePane extends FieldEditorDefinePane<TextEditor>
@Override
protected JPanel setFirstContentPane() {
// fontSizePane = new UISpinner(0,20,1);
regPane = createRegPane();
final RegPane.RegChangeListener rl = new RegPane.RegChangeListener() {
@ -72,7 +68,7 @@ public class TextFieldEditorDefinePane extends FieldEditorDefinePane<TextEditor>
// });
formWidgetValuePane = new FormWidgetValuePane();
formWidgetValuePane = new FormWidgetValuePane(creator.toData(), false);
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
Component[][] components = new Component[][]{
@ -106,18 +102,16 @@ public class TextFieldEditorDefinePane extends FieldEditorDefinePane<TextEditor>
@Override
protected void populateSubFieldEditorBean(TextEditor e) {
this.regPane.populate(e.getRegex());
// regErrorMsgTextField.setText(e.getRegErrorMessage());
waterMarkDictPane.setText(e.getWaterMark());
formWidgetValuePane.populate(e);
}
@Override
protected TextEditor updateSubFieldEditorBean() {
TextEditor ob = newTextEditorInstance();
// ob.setRegErrorMessage(this.regErrorMsgTextField.getText());
ob.setRegex(this.regPane.update());
ob.setWaterMark(waterMarkDictPane.getText());
formWidgetValuePane.update(ob);
// ob.setFontSize((int)fontSizePane.getValue());
return ob;
}

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

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

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

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

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

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

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

@ -7,8 +7,6 @@ import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.widget.accessibles.AccessibleBackgroundEditor;
import com.fr.form.ui.*;
import com.fr.form.ui.Button;
import com.fr.general.Background;
import com.fr.general.Inter;
@ -34,7 +32,7 @@ public class BackgroundCompPane extends BasicPane {
initalBackgroundEditor = new AccessibleBackgroundEditor();
overBackgroundEditor = new AccessibleBackgroundEditor();
clickBackgroundEditor = new AccessibleBackgroundEditor();
String [] titles = new String[]{"默认", "自定义"};
String [] titles = new String[]{Inter.getLocText("FR-Designer_DEFAULT"), Inter.getLocText("FR-Designer_Custom")};
double f = TableLayout.FILL;
final double p = TableLayout.PREFERRED;
@ -64,19 +62,18 @@ public class BackgroundCompPane extends BasicPane {
}
public void update(FreeButton btn) {
btn.setInitialBackground((Background) initalBackgroundEditor.getValue());
btn.setOverBackground((Background) overBackgroundEditor.getValue());
btn.setClickBackground((Background) clickBackgroundEditor.getValue());
public MouseActionBackground update() {
MouseActionBackground mouseActionBackground = new MouseActionBackground((Background) initalBackgroundEditor.getValue(), (Background) overBackgroundEditor.getValue(), (Background) clickBackgroundEditor.getValue());
return mouseActionBackground;
}
protected String title4PopupWindow() {
return "";
}
public void populate(FreeButton btn) {
initalBackgroundEditor.setValue(btn.getInitialBackground());
overBackgroundEditor.setValue(btn.getOverBackground());
clickBackgroundEditor.setValue(btn.getClickBackground());
public void populate(MouseActionBackground background) {
initalBackgroundEditor.setValue(background.getInitialBackground());
overBackgroundEditor.setValue(background.getOverBackground());
clickBackgroundEditor.setValue(background.getClickBackground());
}
}

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

@ -1,9 +1,16 @@
package com.fr.design.widget.ui.designer.component;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.editor.editor.*;
import com.fr.design.gui.ibutton.UIHeadGroup;
import com.fr.design.widget.ui.designer.custom.*;
import com.fr.form.ui.TextEditor;
import com.fr.design.mainframe.widget.editors.DataBindingEditor;
import com.fr.design.mainframe.widget.editors.DataTableEditor;
import com.fr.design.mainframe.widget.editors.ServerDataBindingEditor;
import com.fr.design.mainframe.widget.editors.ServerDataTableEditor;
import com.fr.form.ui.DataControl;
import com.fr.form.ui.WidgetValue;
import com.fr.general.ComparatorUtils;
import com.fr.general.Inter;
import javax.swing.*;
import java.awt.*;
@ -13,29 +20,25 @@ import java.awt.*;
*/
public class FormWidgetValuePane extends JPanel {
private UIHeadGroup widgetValueHead;
private Editor[] editor;
public FormWidgetValuePane() {
WidgetValuePane StringPane = new WidgetValueString();
WidgetValuePane FormulaPane = new WidgetValueFormula();
WidgetValuePane FieldPane = new WidgetValueField();
public FormWidgetValuePane(Object o, boolean onlyServer) {
DataControl widget = (DataControl) o;
editor = createWidgetValueEditor(widget, onlyServer);
this.setLayout(new BorderLayout(0, LayoutConstants.VGAP_SMALL));
final CardLayout cardLayout = new CardLayout();
final JPanel customPane = new JPanel(cardLayout);
customPane.add(StringPane.createWidgetValuePane(), StringPane.markTitle());
customPane.add(FormulaPane.createWidgetValuePane(), FormulaPane.markTitle());
customPane.add(FieldPane.createWidgetValuePane(), FieldPane.markTitle());
final String[] tabTitles = new String[]{StringPane.markTitle(), FormulaPane.markTitle(), FieldPane.markTitle()};
final String [] tabTitles = new String[editor.length];
for(int i = 0; i < editor.length; i++){
customPane.add(editor[i], editor[i].getName());
tabTitles[i] = editor[i].getName();
}
widgetValueHead = new UIHeadGroup(tabTitles) {
@Override
public void tabChanged(int index) {
//todo
if (index == 2) {
customPane.setPreferredSize(new Dimension(100, 50));
} else {
customPane.setPreferredSize(new Dimension(100, 20));
}
cardLayout.show(customPane, tabTitles[index]);
attributeChange(index, customPane, cardLayout, tabTitles);
}
};
this.add(widgetValueHead, BorderLayout.NORTH);
@ -43,14 +46,88 @@ public class FormWidgetValuePane extends JPanel {
}
public void update(TextEditor ob) {
//todo
public void attributeChange(int index, JPanel customPane, CardLayout cardLayout, String[] tabTitles){
if (ComparatorUtils.equals(tabTitles[index], Inter.getLocText("FieldBinding"))) {
customPane.setPreferredSize(new Dimension(100, 50));
} else {
customPane.setPreferredSize(new Dimension(100, 20));
}
cardLayout.show(customPane, tabTitles[index]);
}
/**
* 根据类型创建
* @param type 类型
* @param onlyServer 是否是服务器
* @return 编辑器
*/
public static Editor createWidgetValueEditorByType(int type, boolean onlyServer) {
switch (type) {
case DataControl.TYPE_NUMBER:
return new DoubleEditor();
case DataControl.TYPE_FORMULA:
return new FormulaEditor(Inter.getLocText("Parameter-Formula"));
case DataControl.TYPE_DATABINDING:
return onlyServer ? new ServerDataBindingEditor() : new DataBindingEditor();
case DataControl.TYPE_STRING:
return new com.fr.design.editor.editor.TextEditor();
case DataControl.TYPE_BOOLEAN:
return new BooleanEditor(false);
case DataControl.TYPE_DATE:
return new DateEditor(true, Inter.getLocText("Date"));
case DataControl.TYPE_TABLEDATA:
return onlyServer ? new ServerDataTableEditor() : new DataTableEditor();
default:
return null;
}
}
public void populate(TextEditor ob) {
//todo
/**
* 用DataControl构建
* @param data 数据
* @param onlyServer 是否是服务器
* @return 编辑器
*/
public static Editor[] createWidgetValueEditor(DataControl data, boolean onlyServer) {
int types[] = data.getValueType();
Editor[] editor = new Editor[types.length ];
for (int i = 0; i < types.length; i++) {
editor[i] = createWidgetValueEditorByType(types[i], onlyServer);
}
return editor;
}
public void update(DataControl ob) {
int index = widgetValueHead.getSelectedIndex();
Editor e = editor[index];
Object value = e.getValue();
ob.setWidgetValue(new WidgetValue(value));
}
public void populate(DataControl ob) {
WidgetValue widgetValue = ob.getWidgetValue();
for (int i = 0; i < editor.length; i++) {
if (editor[i].accept(widgetValue)) {
setCardValue(i, widgetValue);
break;
}
}
}
private void setCardValue(int i, Object object){
widgetValueHead.setSelectedIndex(i);
editor[i].setValue(object);
// kunsnat: bug7861 所有的Editor值都要跟随改变, 因为populate的editor 从""
// 一定是最后的Editor哦.
for (int j = 0; j < editor.length; j++) {
if (i == j) {
continue;
}
this.editor[j].setValue(null);
}
}
}

43
designer_form/src/com/fr/design/widget/ui/designer/component/MouseActionBackground.java

@ -0,0 +1,43 @@
package com.fr.design.widget.ui.designer.component;
import com.fr.general.Background;
/**
* Created by ibm on 2017/8/7.
*/
public class MouseActionBackground {
private Background initialBackground;
private Background overBackground;
private Background clickBackground;
public MouseActionBackground(Background initialBackground, Background overBackground, Background clickBackground){
this.initialBackground = initialBackground;
this.overBackground = overBackground;
this.clickBackground = clickBackground;
}
public Background getInitialBackground() {
return initialBackground;
}
public void setInitialBackground(Background initialBackground) {
this.initialBackground = initialBackground;
}
public Background getOverBackground() {
return overBackground;
}
public void setOverBackground(Background overBackground) {
this.overBackground = overBackground;
}
public Background getClickBackground() {
return clickBackground;
}
public void setClickBackground(Background clickBackground) {
this.clickBackground = clickBackground;
}
}

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

@ -3,15 +3,10 @@ package com.fr.design.widget.ui.designer.component;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.designer.creator.XWAbsoluteLayout;
import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.widget.WidgetBoundsPaneFactory;
import com.fr.form.ui.container.WAbsoluteLayout;
import com.fr.general.Inter;
import javax.swing.*;
import java.awt.*;
/**
@ -26,32 +21,14 @@ public class WidgetAbsoluteBoundPane extends WidgetBoundPane {
super(source);
XLayoutContainer xLayoutContainer = getParent(source);
this.parent = (XWAbsoluteLayout) xLayoutContainer;
}
public void initBoundPane() {
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
x = new UISpinner(0, 1200, 1);
y = new UISpinner(0, 1200, 1);
width = new UISpinner(0, 1200, 1);
height = new UISpinner(0, 1200, 1);
Component[][] components = new Component[][]{
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Widget_Position")), x, y},
new Component[]{null, new UILabel(Inter.getLocText("FR-Designer_X_Coordinate"), SwingConstants.CENTER), new UILabel(Inter.getLocText("FR-Designer_Y_Coordinate"), SwingConstants.CENTER)},
new Component[]{new UILabel(Inter.getLocText("FR-Designer-Widget_Size")), width, height},
new Component[]{null, new UILabel(Inter.getLocText("FR-Designer-Tree_Width"), SwingConstants.CENTER), new UILabel(Inter.getLocText("FR-Designer-Tree_Height"), SwingConstants.CENTER)},
};
double[] rowSize = {p, p, p, p};
double[] columnSize = {p, f, f};
int[][] rowCount = {{1, 1, 1}, {1, 1, 1}, {1, 1, 1}, {1, 1, 1}};
final JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 8, 5);
panel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
UIExpandablePane uiExpandablePane = new UIExpandablePane(Inter.getLocText("Form-Component_Bounds"), 280, 20, panel);
this.add(uiExpandablePane);
this.add(WidgetBoundsPaneFactory.createAbsoluteBoundsPane(x, y, width, height));
}

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

@ -2,15 +2,10 @@ package com.fr.design.widget.ui.designer.component;
import com.fr.design.designer.creator.*;
import com.fr.design.dialog.BasicPane;
import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.general.Inter;
import com.fr.design.widget.WidgetBoundsPaneFactory;
import javax.swing.*;
import java.awt.*;
/**
@ -36,25 +31,10 @@ public class WidgetBoundPane extends BasicPane {
return container;
}
public void initBoundPane() {
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
width = new UISpinner(0, 1200, 1);
height = new UISpinner(0, 1200, 1);
Component[][] components = new Component[][]{
new Component[]{new UILabel(Inter.getLocText("FR-Designer-Widget_Size")), width, height},
new Component[]{null, new UILabel(Inter.getLocText("FR-Designer-Tree_Width"), SwingConstants.CENTER), new UILabel(Inter.getLocText("FR-Designer-Tree_Height"), SwingConstants.CENTER)},
};
double[] rowSize = {p, p};
double[] columnSize = {p, f, f};
int[][] rowCount = {{1, 1, 1}, {1, 1, 1}};
final JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 8, 5);
panel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
UIExpandablePane uiExpandablePane = new UIExpandablePane("尺寸", 280, 20, panel);
this.add(uiExpandablePane);
this.add(WidgetBoundsPaneFactory.createBoundsPane(width, height));
}

58
designer_form/src/com/fr/design/widget/ui/designer/layout/ElementEditorDefinePane.java

@ -0,0 +1,58 @@
package com.fr.design.widget.ui.designer.layout;
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.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.widget.accessibles.AccessibleElementCaseToolBarEditor;
import com.fr.design.widget.ui.designer.component.PaddingBoundPane;
import com.fr.form.ui.ElementCaseEditor;
import com.fr.form.web.FormToolBarManager;
import com.fr.general.Inter;
import javax.swing.*;
import java.awt.*;
/**
* Created by ibm on 2017/8/7.
*/
public class ElementEditorDefinePane extends WTitleLayoutDefinePane<ElementCaseEditor> {
private PaddingBoundPane paddingBoundPane;
private AccessibleElementCaseToolBarEditor elementCaseToolBarEditor;
public ElementEditorDefinePane(XCreator xCreator){
super(xCreator);
}
protected JPanel createCenterPane(){
paddingBoundPane = new PaddingBoundPane();
elementCaseToolBarEditor = new AccessibleElementCaseToolBarEditor();
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
double[] rowSize = {p, p};
double[] columnSize = {p, f};
int[][] rowCount = {{1, 1}, {1, 1}};
Component[][] components = new Component[][]{
new Component[]{paddingBoundPane, null},
new Component[]{new UILabel("报表块工具栏"), elementCaseToolBarEditor}
};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 20, 7);
panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
return panel;
}
protected ElementCaseEditor updateSubBean(){
ElementCaseEditor elementCaseEditor = (ElementCaseEditor)creator.toData();
paddingBoundPane.update(elementCaseEditor);
elementCaseEditor.setToolBars((FormToolBarManager[])elementCaseToolBarEditor.getValue());
return elementCaseEditor;
}
protected void populateSubBean(ElementCaseEditor ob){
paddingBoundPane.populate(ob);
elementCaseToolBarEditor.setValue(ob.getToolBars());
}
}

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

@ -12,15 +12,16 @@ import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.FormSelectionUtils;
import com.fr.design.mainframe.WidgetPropertyPane;
import com.fr.design.mainframe.widget.accessibles.AccessibleWLayoutBorderStyleEditor;
import com.fr.design.widget.ui.designer.AbstractDataModify;
import com.fr.design.widget.ui.designer.component.PaddingBoundPane;
import com.fr.form.ui.LayoutBorderStyle;
import com.fr.form.ui.Widget;
import com.fr.form.ui.container.WAbsoluteBodyLayout;
import com.fr.form.ui.container.WAbsoluteLayout;
@ -42,7 +43,7 @@ public class FRFitLayoutDefinePane extends AbstractDataModify<WFitLayout> {
private UIComboBox adaptComboBox;
private UISpinner componentIntervel;
private PaddingBoundPane paddingBound;
private UITextField background;
private AccessibleWLayoutBorderStyleEditor background;
public FRFitLayoutDefinePane(XCreator xCreator) {
super(xCreator);
@ -63,7 +64,7 @@ public class FRFitLayoutDefinePane extends AbstractDataModify<WFitLayout> {
public JPanel createAdvancePane() {
JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane();
background = new UITextField();
background = new AccessibleWLayoutBorderStyleEditor();
paddingBound = new PaddingBoundPane();
JPanel jp2 = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{new UILabel(Inter.getLocText("FR-Designer_Background")), background}}, TableLayoutHelper.FILL_LASTCOLUMN, 18, 7);
jp2.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
@ -111,11 +112,11 @@ public class FRFitLayoutDefinePane extends AbstractDataModify<WFitLayout> {
@Override
public void populateBean(WFitLayout ob) {
background.setText("test");
paddingBound.populate(ob);
layoutComboBox.setSelectedIndex(ob.getBodyLayoutType().getTypeValue());
adaptComboBox.setSelectedIndex(ob.getCompState());
componentIntervel.setValue(ob.getCompInterval());
background.setValue(ob.getBackground());
}
@ -123,6 +124,7 @@ public class FRFitLayoutDefinePane extends AbstractDataModify<WFitLayout> {
public WFitLayout updateBean() {
WFitLayout layout = (WFitLayout) creator.toData();
paddingBound.update(layout);
layout.setBorderStyle((LayoutBorderStyle) background.getValue());
Item item = (Item) layoutComboBox.getSelectedItem();
Object value = item.getValue();
int state = 0;

85
designer_form/src/com/fr/design/widget/ui/designer/layout/WCardLayoutDefinePane.java

@ -0,0 +1,85 @@
package com.fr.design.widget.ui.designer.layout;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.widget.accessibles.AccessibleCardTagWLayoutBorderStyleEditor;
import com.fr.design.widget.ui.designer.AbstractDataModify;
import com.fr.form.ui.LayoutBorderStyle;
import com.fr.form.ui.container.WCardLayout;
import com.fr.general.Inter;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
/**
* Created by ibm on 2017/8/7.
*/
public class WCardLayoutDefinePane extends AbstractDataModify<WCardLayout> {
private AccessibleCardTagWLayoutBorderStyleEditor accessibleCardTagWLayoutBorderStyleEditor;
private UICheckBox setCarousel;
private UISpinner carouselInterval;
private JPanel IntervalPane;
public WCardLayoutDefinePane(XCreator xCreator) {
super(xCreator);
initComponent();
}
public void initComponent() {
carouselInterval = new UISpinner(0, 20, 1, 0);
accessibleCardTagWLayoutBorderStyleEditor = new AccessibleCardTagWLayoutBorderStyleEditor();
accessibleCardTagWLayoutBorderStyleEditor.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
JPanel accessibleCardlayout = FRGUIPaneFactory.createBorderLayout_S_Pane();
accessibleCardlayout.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
accessibleCardlayout.add(accessibleCardTagWLayoutBorderStyleEditor, BorderLayout.CENTER);
this.setLayout(FRGUIPaneFactory.createBorderLayout());
UIExpandablePane advanceExpandablePane = new UIExpandablePane(Inter.getLocText("FR-Designer_Advanced"), 280, 20, accessibleCardlayout);
final JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane();
jPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
setCarousel = new UICheckBox(Inter.getLocText("FR-Designer_setCarousel"));
IntervalPane = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{new UILabel(Inter.getLocText("FR-Designer_carouselInterval")), carouselInterval}}, TableLayoutHelper.FILL_LASTCOLUMN, 18, 7);
IntervalPane.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
jPanel.add(setCarousel, BorderLayout.NORTH);
jPanel.add(IntervalPane, BorderLayout.CENTER);
setCarousel.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
IntervalPane.setVisible(setCarousel.isSelected());
}
});
UIExpandablePane setCarouselPane = new UIExpandablePane(Inter.getLocText("FR-Designer_Tab_carousel"), 280, 20, jPanel);
this.add(advanceExpandablePane, BorderLayout.NORTH);
this.add(setCarouselPane, BorderLayout.CENTER);
}
@Override
public String title4PopupWindow() {
return "tabFitLayout";
}
@Override
public void populateBean(WCardLayout ob) {
accessibleCardTagWLayoutBorderStyleEditor.setValue(ob.getBorderStyle());
setCarousel.setSelected(ob.isCarousel());
IntervalPane.setVisible(ob.isCarousel());
carouselInterval.setValue(ob.getCarouselInterval());
}
@Override
public WCardLayout updateBean() {
WCardLayout layout = (WCardLayout) creator.toData();
layout.setBorderStyle((LayoutBorderStyle) accessibleCardTagWLayoutBorderStyleEditor.getValue());
layout.setCarousel(setCarousel.isSelected());
layout.setCarouselInterval((int)carouselInterval.getValue());
return layout;
}
}

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

@ -1,12 +1,19 @@
package com.fr.design.widget.ui.designer.layout;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.foldablepane.UIExpandablePane;;
import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.widget.ui.designer.AbstractDataModify;
import com.fr.design.widget.ui.designer.component.BackgroundCompPane;
import com.fr.design.widget.ui.designer.component.MouseActionBackground;
import com.fr.design.widget.ui.designer.component.PaddingBoundPane;
import com.fr.form.ui.container.cardlayout.WTabFitLayout;
import com.fr.general.Inter;
import javax.swing.*;
import java.awt.*;
/**
@ -14,6 +21,8 @@ import java.awt.*;
*/
public class WTabFitLayoutDefinePane extends AbstractDataModify<WTabFitLayout> {
private PaddingBoundPane paddingBoundPane;
private BackgroundCompPane borderStyle;
private UISpinner componentInterval;
public WTabFitLayoutDefinePane(XCreator xCreator) {
super(xCreator);
@ -21,10 +30,22 @@ public class WTabFitLayoutDefinePane extends AbstractDataModify<WTabFitLayout> {
}
public void initComponent() {
JPanel advancePane = FRGUIPaneFactory.createBorderLayout_S_Pane();
paddingBoundPane = new PaddingBoundPane();
borderStyle = new BackgroundCompPane();
JPanel jPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{new UILabel(Inter.getLocText("FR-Designer_Style")), borderStyle}}, TableLayoutHelper.FILL_LASTCOLUMN, 18, 7);
advancePane.add(jPanel, BorderLayout.NORTH);
advancePane.add(paddingBoundPane, BorderLayout.CENTER);
this.setLayout(FRGUIPaneFactory.createBorderLayout());
UIExpandablePane advanceExpandablePane = new UIExpandablePane(Inter.getLocText("FR-Designer_Advanced"), 280, 20, paddingBoundPane);
this.add(advanceExpandablePane, BorderLayout.CENTER);
UIExpandablePane advanceExpandablePane = new UIExpandablePane(Inter.getLocText("FR-Designer_Advanced"), 280, 20, advancePane);
this.add(advanceExpandablePane, BorderLayout.NORTH);
initLayoutComponent();
}
public void initLayoutComponent(){
componentInterval = new UISpinner(0, 100, 1, 0);
JPanel jPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{new UILabel(Inter.getLocText("FR-Designer_Component_Interval")), componentInterval}}, TableLayoutHelper.FILL_LASTCOLUMN, 18, 7);
this.add(jPanel, BorderLayout.CENTER);
}
@Override
@ -34,13 +55,22 @@ public class WTabFitLayoutDefinePane extends AbstractDataModify<WTabFitLayout> {
@Override
public void populateBean(WTabFitLayout ob) {
MouseActionBackground mouseActionBackground = new MouseActionBackground(ob.getInitialBackground(), ob.getOverBackground(), ob.getClickBackground());
borderStyle.populate(mouseActionBackground);
paddingBoundPane.populate(ob);
componentInterval.setValue(ob.getCompInterval());
}
@Override
public WTabFitLayout updateBean() {
WTabFitLayout layout = (WTabFitLayout) creator.toData();
MouseActionBackground mouseActionBackground = borderStyle.update();
layout.setInitialBackground(mouseActionBackground.getInitialBackground());
layout.setOverBackground(mouseActionBackground.getOverBackground());
layout.setClickBackground(mouseActionBackground.getClickBackground());
paddingBoundPane.update(layout);
layout.setCompInterval((int)componentInterval.getValue());
return layout;
}
}

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

@ -3,9 +3,14 @@ package com.fr.design.widget.ui.designer.layout;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.widget.accessibles.AccessibleWLayoutBorderStyleEditor;
import com.fr.design.widget.ui.designer.AbstractDataModify;
import com.fr.design.widget.ui.designer.component.PaddingBoundPane;
import com.fr.form.ui.*;
import com.fr.form.ui.container.WTitleLayout;
import com.fr.general.Inter;
@ -15,9 +20,9 @@ import java.awt.*;
/**
* Created by ibm on 2017/8/3.
*/
public class WTitleLayoutDefinePane extends AbstractDataModify<WTitleLayout> {
private PaddingBoundPane paddingBoundPane;
private UICheckBox displayECToolBar;
public abstract class WTitleLayoutDefinePane<T extends AbstractBorderStyleWidget> extends AbstractDataModify<T> {
private AccessibleWLayoutBorderStyleEditor borderStyleEditor;
public WTitleLayoutDefinePane(XCreator xCreator) {
super(xCreator);
initComponent();
@ -26,30 +31,55 @@ public class WTitleLayoutDefinePane extends AbstractDataModify<WTitleLayout> {
public void initComponent() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
JPanel advancePane = FRGUIPaneFactory.createBorderLayout_S_Pane();
borderStyleEditor = new AccessibleWLayoutBorderStyleEditor();
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_Style")), borderStyleEditor}
};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 20, 7);
panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
advancePane.add(panel, BorderLayout.NORTH);
JPanel centerPane = createCenterPane();
if(centerPane!=null){
advancePane.add(centerPane, BorderLayout.CENTER);
}
UIExpandablePane advanceExpandablePane = new UIExpandablePane(Inter.getLocText("FR-Designer_Advanced"), 280, 20, advancePane);
paddingBoundPane = new PaddingBoundPane();
displayECToolBar = new UICheckBox(Inter.getLocText("FR-Designer_Widget_Display_Report_Tool"));
advancePane.add(paddingBoundPane, BorderLayout.NORTH);
advancePane.add(displayECToolBar, BorderLayout.CENTER);
this.add(advanceExpandablePane);
}
protected JPanel createCenterPane(){
return null;
}
@Override
public String title4PopupWindow() {
return "titleLayout";
}
@Override
public void populateBean(WTitleLayout ob) {
paddingBoundPane.populate(ob);
// displayECToolBar.setSelected(ob.ds);
public void populateBean(T ob) {
populateSubBean(ob);
borderStyleEditor.setValue(ob.getBorderStyle());
}
@Override
public WTitleLayout updateBean() {
WTitleLayout layout = (WTitleLayout)creator.toData();
return layout;
public T updateBean() {
T e = updateSubBean();
e.setBorderStyle((LayoutBorderStyle) borderStyleEditor.getValue());
return e;
}
protected abstract T updateSubBean();
protected abstract void populateSubBean(T ob);
}

Loading…
Cancel
Save