diff --git a/designer/src/com/fr/design/widget/CellWidgetCardPane.java b/designer/src/com/fr/design/widget/CellWidgetCardPane.java index b2d206c91..4e8682f1c 100644 --- a/designer/src/com/fr/design/widget/CellWidgetCardPane.java +++ b/designer/src/com/fr/design/widget/CellWidgetCardPane.java @@ -86,7 +86,12 @@ public class CellWidgetCardPane extends BasicPane { attriPane.remove(widgetPropertyPane); widgetPropertyPane = new BasicWidgetPropertySettingPane(); - attriPane.add(widgetPropertyPane, BorderLayout.NORTH); + JPanel northPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + northPane.setBorder(BorderFactory.createEmptyBorder(10, 8, 5, 8)); + JPanel basic = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("Form-Basic_Properties")); + northPane.add(basic); + basic.add(widgetPropertyPane); + attriPane.add(northPane, BorderLayout.NORTH); WidgetDefinePaneFactory.RN rn = WidgetDefinePaneFactory.createWidgetDefinePane(cellWidget, new Operator() { @Override diff --git a/designer/src/com/fr/design/widget/ui/FieldEditorDefinePane.java b/designer/src/com/fr/design/widget/ui/FieldEditorDefinePane.java index 1d1c36d32..eebd9c4f0 100644 --- a/designer/src/com/fr/design/widget/ui/FieldEditorDefinePane.java +++ b/designer/src/com/fr/design/widget/ui/FieldEditorDefinePane.java @@ -8,6 +8,7 @@ import javax.swing.BorderFactory; import com.fr.design.gui.frpane.TreeSettingPane; import com.fr.design.gui.ilable.UILabel; + import javax.swing.JPanel; import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; @@ -22,91 +23,125 @@ import com.fr.general.Inter; import com.fr.design.widget.DataModify; public abstract class FieldEditorDefinePane extends AbstractDataModify { - private UICheckBox allowBlankCheckBox; - // richer:错误信息,是所有控件共有的属性,所以放到这里来 - private UITextField errorMsgTextField; - - public FieldEditorDefinePane() { - this.initComponents(); - } - - protected void initComponents() { - this.setLayout(FRGUIPaneFactory.createBorderLayout()); - JPanel northPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane(); - this.add(northPane, BorderLayout.NORTH); - JPanel firstPanel = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); - firstPanel.setBorder(BorderFactory.createEmptyBorder(0, -2, 0, 0)); - //JPanel firstPanel = FRGUIPaneFactory.createBorderLayout_M_Pane(); - allowBlankCheckBox = new UICheckBox(Inter.getLocText("Allow_Blank")); - // 是否允许为空 - firstPanel.add(allowBlankCheckBox); - allowBlankCheckBox.addItemListener(new ItemListener() { - - @Override - public void itemStateChanged(ItemEvent e) { - errorMsgTextField.setEnabled(!allowBlankCheckBox.isSelected()); - } - }); - - // 错误信息 - JPanel errorMsgPane = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane(); - firstPanel.add(errorMsgPane); - northPane.add(firstPanel); - errorMsgPane.add(new UILabel(Inter.getLocText(new String[]{"Error", "Tooltips"}) + ":")); - errorMsgTextField = new UITextField(16); - errorMsgPane.add(errorMsgTextField); - - // richer:主要为了方便查看比较长的错误信息 - errorMsgTextField.getDocument().addDocumentListener(new DocumentListener() { - - public void changedUpdate(DocumentEvent e) { - errorMsgTextField.setToolTipText(errorMsgTextField.getText()); - } - - public void insertUpdate(DocumentEvent e) { - errorMsgTextField.setToolTipText(errorMsgTextField.getText()); - } - - public void removeUpdate(DocumentEvent e) { - errorMsgTextField.setToolTipText(errorMsgTextField.getText()); - } - }); - JPanel contentPane = this.setFirstContentPane(); - if (contentPane != null) { - //contentPane.add(firstPanel); - this.add(contentPane, BorderLayout.CENTER); - } else { - //this.add(firstPanel, BorderLayout.CENTER); - } - } - - @Override - public void populateBean(T ob) { - this.allowBlankCheckBox.setSelected(ob.isAllowBlank()); - errorMsgTextField.setEnabled(!allowBlankCheckBox.isSelected()); - this.errorMsgTextField.setText(ob.getErrorMessage()); - - populateSubFieldEditorBean(ob); - } - - protected abstract void populateSubFieldEditorBean(T ob); - - @Override - public T updateBean() { - T e = updateSubFieldEditorBean(); - - e.setAllowBlank(this.allowBlankCheckBox.isSelected()); - e.setErrorMessage(this.errorMsgTextField.getText()); - - return e; - } - - protected abstract T updateSubFieldEditorBean(); - - protected abstract JPanel setFirstContentPane(); - - @Override - public void checkValid() throws Exception { - - } + private UICheckBox allowBlankCheckBox; + // richer:错误信息,是所有控件共有的属性,所以放到这里来 + private UITextField errorMsgTextField; + private UITextField regErrorMsgTextField; + + public FieldEditorDefinePane() { + this.initComponents(); + } + + protected void initComponents() { + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + regErrorMsgTextField = new UITextField(16); + regErrorMsgTextField.getDocument().addDocumentListener(new DocumentListener() { + public void changedUpdate(DocumentEvent e) { + regErrorMsgTextField.setToolTipText(regErrorMsgTextField.getText()); + } + + public void insertUpdate(DocumentEvent e) { + regErrorMsgTextField.setToolTipText(regErrorMsgTextField.getText()); + } + + public void removeUpdate(DocumentEvent e) { + regErrorMsgTextField.setToolTipText(regErrorMsgTextField.getText()); + } + }); + + //JPanel firstPanel = FRGUIPaneFactory.createBorderLayout_M_Pane(); + allowBlankCheckBox = new UICheckBox(Inter.getLocText("Allow_Blank")); + + allowBlankCheckBox.addItemListener(new ItemListener() { + + @Override + public void itemStateChanged(ItemEvent e) { + errorMsgTextField.setEnabled(!allowBlankCheckBox.isSelected()); + } + }); + + // 错误信息 + JPanel errorMsgPane = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane(); + //目前只整改了文本、密码、文本域和数字四个控件 + this.addAllowBlankPane(allowBlankCheckBox, errorMsgPane); + errorMsgPane.add(new UILabel(Inter.getLocText(new String[]{"Error", "Tooltips"}) + ":")); + errorMsgTextField = new UITextField(16); + errorMsgPane.add(errorMsgTextField); + + // richer:主要为了方便查看比较长的错误信息 + errorMsgTextField.getDocument().addDocumentListener(new DocumentListener() { + + public void changedUpdate(DocumentEvent e) { + errorMsgTextField.setToolTipText(errorMsgTextField.getText()); + } + + public void insertUpdate(DocumentEvent e) { + errorMsgTextField.setToolTipText(errorMsgTextField.getText()); + } + + public void removeUpdate(DocumentEvent e) { + errorMsgTextField.setToolTipText(errorMsgTextField.getText()); + } + }); + JPanel contentPane = this.setFirstContentPane(); + if (contentPane != null) { + //contentPane.add(firstPanel); + this.add(contentPane, BorderLayout.CENTER); + } else { + //this.add(firstPanel, BorderLayout.CENTER); + } + } + + @Override + public void populateBean(T ob) { + this.allowBlankCheckBox.setSelected(ob.isAllowBlank()); + errorMsgTextField.setEnabled(!allowBlankCheckBox.isSelected()); + this.errorMsgTextField.setText(ob.getErrorMessage()); + + populateSubFieldEditorBean(ob); + } + + protected abstract void populateSubFieldEditorBean(T ob); + + @Override + public T updateBean() { + T e = updateSubFieldEditorBean(); + + e.setAllowBlank(this.allowBlankCheckBox.isSelected()); + e.setErrorMessage(this.errorMsgTextField.getText()); + + return e; + } + + protected abstract T updateSubFieldEditorBean(); + + protected abstract JPanel setFirstContentPane(); + + @Override + public void checkValid() throws Exception { + + } + + public void addAllowBlankPane(UICheckBox allowBlankCheckBox, JPanel errorMsgPane) { + JPanel northPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane(); + this.add(northPane, BorderLayout.NORTH); + JPanel firstPanel = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); + firstPanel.setBorder(BorderFactory.createEmptyBorder(0, -2, 0, 0)); + firstPanel.add(allowBlankCheckBox); + firstPanel.add(errorMsgPane); + northPane.add(firstPanel); + } + + public UICheckBox getAllowBlankCheckBox() { + return allowBlankCheckBox; + } + + public UITextField getErrorMsgTextField() { + return errorMsgTextField; + } + + public UITextField getRegErrorMsgTextField() { + return regErrorMsgTextField; + } + } \ No newline at end of file diff --git a/designer/src/com/fr/design/widget/ui/NumberEditorDefinePane.java b/designer/src/com/fr/design/widget/ui/NumberEditorDefinePane.java index 9837a9a08..26d34065c 100644 --- a/designer/src/com/fr/design/widget/ui/NumberEditorDefinePane.java +++ b/designer/src/com/fr/design/widget/ui/NumberEditorDefinePane.java @@ -14,10 +14,13 @@ import javax.swing.JPanel; import javax.swing.SpinnerNumberModel; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; +import javax.swing.event.DocumentEvent; +import javax.swing.event.DocumentListener; import javax.swing.text.DefaultFormatter; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.ispinner.UIBasicSpinner; +import com.fr.design.gui.itextfield.UITextField; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.form.ui.NumberEditor; import com.fr.general.Inter; @@ -121,9 +124,9 @@ public class NumberEditorDefinePane extends FieldEditorDefinePane @Override public void stateChanged(ChangeEvent e) { if (setMaxValueCheckBox.isSelected()) { - if (setMinValueCheckBox.isSelected()) { - minValueModel.setMaximum(Double.parseDouble("" + maxValueSpinner.getValue())); - } + if (setMinValueCheckBox.isSelected()) { + minValueModel.setMaximum(Double.parseDouble("" + maxValueSpinner.getValue())); + } } } }; @@ -133,9 +136,9 @@ public class NumberEditorDefinePane extends FieldEditorDefinePane @Override public void stateChanged(ChangeEvent e) { if (setMinValueCheckBox.isSelected()) { - if (setMaxValueCheckBox.isSelected()) { - maxValueModel.setMinimum(Double.parseDouble("" + minValueSpinner.getValue())); - } + if (setMaxValueCheckBox.isSelected()) { + maxValueModel.setMinimum(Double.parseDouble("" + minValueSpinner.getValue())); + } } } }; @@ -153,26 +156,34 @@ public class NumberEditorDefinePane extends FieldEditorDefinePane @Override protected JPanel setFirstContentPane() { JPanel content = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane(); - content.setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 0)); + content.setBorder(BorderFactory.createEmptyBorder(0, 8, 0, 8)); content.setLayout(FRGUIPaneFactory.createBorderLayout()); // richer:数字的允许直接编辑没有意义 - JPanel northPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane(); + JPanel northPane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("Advanced")); content.add(northPane, BorderLayout.NORTH); waterMarkDictPane = new WaterMarkDictPane(); northPane.add(waterMarkDictPane); + JPanel centerPane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("FR-Designer_Validate")); + JPanel validatePane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane(); + validatePane.setPreferredSize(new Dimension(400, 200)); + centerPane.add(validatePane); + content.add(northPane, BorderLayout.NORTH); + content.add(centerPane, BorderLayout.CENTER); + validatePane.add(GUICoreUtils.createFlowPane(getAllowBlankCheckBox(), FlowLayout.LEFT)); + validatePane.add(GUICoreUtils.createFlowPane(new JComponent[]{new UILabel(Inter.getLocText(new String[]{"Error", "Tooltips"}) + ":"), getErrorMsgTextField()}, FlowLayout.LEFT, 24)); this.allowDecimalsCheckBox = new UICheckBox(Inter.getLocText("Allow_Decimals")); this.decimalLength = new com.fr.design.editor.editor.IntegerEditor(); this.decimalLength.setColumns(4); limitNumberPane = GUICoreUtils.createFlowPane(new JComponent[]{new UILabel(Inter.getLocText(new String[]{"Double", "Numbers"}) + ":"), this.decimalLength}, FlowLayout.LEFT, 4); - northPane.add(GUICoreUtils.createFlowPane(new JComponent[]{this.allowDecimalsCheckBox, limitNumberPane}, FlowLayout.LEFT, 4)); + validatePane.add(GUICoreUtils.createFlowPane(new JComponent[]{this.allowDecimalsCheckBox, limitNumberPane}, FlowLayout.LEFT, 4)); this.allowDecimalsCheckBox.addActionListener(actionListener1); this.allowNegativeCheckBox = new UICheckBox(Inter.getLocText("Allow_Negative")); - northPane.add(GUICoreUtils.createFlowPane(new JComponent[]{this.allowNegativeCheckBox}, FlowLayout.LEFT, 4)); + validatePane.add(GUICoreUtils.createFlowPane(new JComponent[]{this.allowNegativeCheckBox}, FlowLayout.LEFT, 4)); this.allowNegativeCheckBox.addActionListener(actionListener2); this.setMaxValueCheckBox = new UICheckBox(Inter.getLocText("Need_Max_Value"), false); @@ -180,7 +191,7 @@ public class NumberEditorDefinePane extends FieldEditorDefinePane this.maxValueSpinner = new UIBasicSpinner(maxValueModel = new SpinnerNumberModel(0D, -Double.MAX_VALUE, Double.MAX_VALUE, 1D)); maxValueSpinner.setPreferredSize(new Dimension(120, 20)); setNotAllowsInvalid(this.maxValueSpinner); - northPane.add(GUICoreUtils.createFlowPane(new JComponent[]{this.setMaxValueCheckBox, this.maxValueSpinner}, FlowLayout.LEFT, 4)); + validatePane.add(GUICoreUtils.createFlowPane(new JComponent[]{this.setMaxValueCheckBox, this.maxValueSpinner}, FlowLayout.LEFT, 4)); this.maxValueSpinner.setVisible(false); this.setMaxValueCheckBox.addActionListener(actionListener3); this.maxValueSpinner.addChangeListener(changeListener1); @@ -189,10 +200,12 @@ public class NumberEditorDefinePane extends FieldEditorDefinePane this.minValueSpinner = new UIBasicSpinner(minValueModel = new SpinnerNumberModel(0D, -Double.MAX_VALUE, Double.MAX_VALUE, 1D)); minValueSpinner.setPreferredSize(new Dimension(120, 20)); setNotAllowsInvalid(this.minValueSpinner); - northPane.add(GUICoreUtils.createFlowPane(new JComponent[]{this.setMinValueCheckBox, this.minValueSpinner}, FlowLayout.LEFT, 4)); + validatePane.add(GUICoreUtils.createFlowPane(new JComponent[]{this.setMinValueCheckBox, this.minValueSpinner}, FlowLayout.LEFT, 4)); this.minValueSpinner.setVisible(false); this.setMinValueCheckBox.addActionListener(actionListener4); this.minValueSpinner.addChangeListener(changeListener2); + validatePane.add(GUICoreUtils.createFlowPane(new JComponent[]{new UILabel(Inter.getLocText(new String[]{"Error", "Tooltips"}) + ":"), getRegErrorMsgTextField()}, FlowLayout.LEFT, 24)); + return content; } @@ -227,7 +240,7 @@ public class NumberEditorDefinePane extends FieldEditorDefinePane minValueSpinner.setVisible(true); minValueSpinner.setValue(new Double(e.getMinValue())); } - + this.getRegErrorMsgTextField().setText(e.getRegErrorMessage()); this.waterMarkDictPane.populate(e); } @@ -255,6 +268,8 @@ public class NumberEditorDefinePane extends FieldEditorDefinePane this.waterMarkDictPane.update(ob); + ob.setRegErrorMessage(this.getRegErrorMsgTextField().getText()); + return ob; } @@ -283,4 +298,8 @@ public class NumberEditorDefinePane extends FieldEditorDefinePane } } + @Override + public void addAllowBlankPane(UICheckBox allowBlankCheckBox, JPanel errorMsgPane) { + } + } \ No newline at end of file diff --git a/designer/src/com/fr/design/widget/ui/TextFieldEditorDefinePane.java b/designer/src/com/fr/design/widget/ui/TextFieldEditorDefinePane.java index 28217bf03..2399a90ce 100644 --- a/designer/src/com/fr/design/widget/ui/TextFieldEditorDefinePane.java +++ b/designer/src/com/fr/design/widget/ui/TextFieldEditorDefinePane.java @@ -1,91 +1,128 @@ package com.fr.design.widget.ui; import com.fr.design.gui.frpane.RegPane; +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.utils.gui.GUICoreUtils; import com.fr.form.ui.TextEditor; +import com.fr.form.ui.reg.NoneReg; +import com.fr.form.ui.reg.RegExp; import com.fr.general.Inter; import com.fr.stable.StringUtils; import javax.swing.*; +import javax.swing.event.DocumentEvent; +import javax.swing.event.DocumentListener; import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; public class TextFieldEditorDefinePane extends FieldEditorDefinePane { - protected RegPane regPane; - private WaterMarkDictPane waterMarkDictPane; - - public TextFieldEditorDefinePane() { - this.initComponents(); - } - - @Override - protected JPanel setFirstContentPane() { - JPanel attrPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - attrPane.setBorder(BorderFactory.createEmptyBorder(0, 4, 0, 0)); - JPanel contenter = FRGUIPaneFactory.createBorderLayout_S_Pane(); - contenter.setBorder(BorderFactory.createEmptyBorder(0, 4, 0, 0)); - attrPane.add(contenter, BorderLayout.NORTH); - regPane = createRegPane(); - final RegPane.RegChangeListener rl = new RegPane.RegChangeListener() { - - @Override - public void regChangeAction() { - waterMarkDictPane.setWaterMark(""); - regPane.removeRegChangeListener(this); - } - }; - final RegPane.PhoneRegListener pl = new RegPane.PhoneRegListener() { - public void phoneRegChangeAction(RegPane.PhoneRegEvent e) { - if (StringUtils.isNotEmpty(e.getPhoneRegString()) - && StringUtils.isEmpty(waterMarkDictPane.getWaterMark())) { - waterMarkDictPane.setWaterMark(Inter.getLocText("Example") + ":" + e.getPhoneRegString()); - regPane.addRegChangeListener(rl); - } - } - }; - regPane.addPhoneRegListener(pl); - - waterMarkDictPane = new WaterMarkDictPane(); - waterMarkDictPane.addInputKeyListener(new KeyAdapter() { - public void keyTyped(KeyEvent e) { - regPane.removePhoneRegListener(pl); - regPane.removeRegChangeListener(rl); - waterMarkDictPane.removeInputKeyListener(this); - } - }); - contenter.add(regPane, BorderLayout.NORTH); - contenter.add(waterMarkDictPane, BorderLayout.CENTER); - return attrPane; - } - - protected RegPane createRegPane() { - return new RegPane(); - } - - @Override - protected String title4PopupWindow() { - return "text"; - } - - @Override - protected void populateSubFieldEditorBean(TextEditor e) { - this.regPane.populate(e.getRegex()); - waterMarkDictPane.populate(e); - } - - @Override - protected TextEditor updateSubFieldEditorBean() { - TextEditor ob = newTextEditorInstance(); - - ob.setRegex(this.regPane.update()); - waterMarkDictPane.update(ob); - - return ob; - } - - protected TextEditor newTextEditorInstance() { - return new TextEditor(); - } + protected RegPane regPane; + private WaterMarkDictPane waterMarkDictPane; + + public TextFieldEditorDefinePane() { + this.initComponents(); + } + + @Override + protected JPanel setFirstContentPane() { + JPanel attrPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + attrPane.setBorder(BorderFactory.createEmptyBorder(0, 4, 0, 4)); + JPanel contenter = FRGUIPaneFactory.createBorderLayout_S_Pane(); + contenter.setBorder(BorderFactory.createEmptyBorder(0, 4, 0, 4)); + attrPane.add(contenter); + regPane = createRegPane(); + final RegPane.RegChangeListener rl = new RegPane.RegChangeListener() { + + @Override + public void regChangeAction() { + waterMarkDictPane.setWaterMark(""); + regPane.removeRegChangeListener(this); + } + }; + final RegPane.PhoneRegListener pl = new RegPane.PhoneRegListener() { + public void phoneRegChangeAction(RegPane.PhoneRegEvent e) { + if (StringUtils.isNotEmpty(e.getPhoneRegString()) + && StringUtils.isEmpty(waterMarkDictPane.getWaterMark())) { + waterMarkDictPane.setWaterMark(Inter.getLocText("Example") + ":" + e.getPhoneRegString()); + regPane.addRegChangeListener(rl); + } + } + }; + regPane.addPhoneRegListener(pl); + JPanel basicPane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("FR-Designer_Validate")); + JPanel validateContent = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane(); + getAllowBlankCheckBox().setPreferredSize(new Dimension(444, 40)); + validateContent.add(GUICoreUtils.createFlowPane(getAllowBlankCheckBox(), FlowLayout.LEFT)); + validateContent.add(GUICoreUtils.createFlowPane(new JComponent[]{new UILabel(Inter.getLocText(new String[]{"Error", "Tooltips"}) + ":"), getErrorMsgTextField()}, FlowLayout.LEFT, 24)); + validateContent.add(GUICoreUtils.createFlowPane(regPane, FlowLayout.LEFT)); + validateContent.add(GUICoreUtils.createFlowPane(new JComponent[]{new UILabel(Inter.getLocText(new String[]{"Error", "Tooltips"}) + ":"), getRegErrorMsgTextField()}, FlowLayout.LEFT, 24)); + basicPane.add(validateContent); + JPanel advancedPane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("Advanced")); + waterMarkDictPane = new WaterMarkDictPane(); + waterMarkDictPane.addInputKeyListener(new KeyAdapter() { + public void keyTyped(KeyEvent e) { + regPane.removePhoneRegListener(pl); + regPane.removeRegChangeListener(rl); + waterMarkDictPane.removeInputKeyListener(this); + } + }); + //监听填写规则下拉框的值的变化 + regPane.getRegComboBox().addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + RegExp regExp = (RegExp) regPane.getRegComboBox().getSelectedItem(); + if (!StringUtils.isNotEmpty(regExp.toRegText())) { + getRegErrorMsgTextField().setEnabled(false); + } else { + getRegErrorMsgTextField().setEnabled(true); + } + + } + }); + advancedPane.add(waterMarkDictPane); + contenter.add(advancedPane, BorderLayout.NORTH); + contenter.add(basicPane, BorderLayout.CENTER); + return attrPane; + } + + protected RegPane createRegPane() { + return new RegPane(); + } + + @Override + protected String title4PopupWindow() { + return "text"; + } + + @Override + protected void populateSubFieldEditorBean(TextEditor e) { + this.regPane.populate(e.getRegex()); + getRegErrorMsgTextField().setText(e.getRegErrorMessage()); + waterMarkDictPane.populate(e); + } + + @Override + protected TextEditor updateSubFieldEditorBean() { + TextEditor ob = newTextEditorInstance(); + ob.setRegErrorMessage(this.getRegErrorMsgTextField().getText()); + ob.setRegex(this.regPane.update()); + waterMarkDictPane.update(ob); + + return ob; + } + + protected TextEditor newTextEditorInstance() { + return new TextEditor(); + } + + @Override + public void addAllowBlankPane(UICheckBox allowBlankCheckBox, JPanel errorMsgPane) { + } + } \ No newline at end of file diff --git a/designer_base/src/com/fr/design/gui/frpane/RegPane.java b/designer_base/src/com/fr/design/gui/frpane/RegPane.java index 8e0ae5eff..22ac8863d 100644 --- a/designer_base/src/com/fr/design/gui/frpane/RegPane.java +++ b/designer_base/src/com/fr/design/gui/frpane/RegPane.java @@ -48,15 +48,15 @@ public class RegPane extends BasicPane { new MobileReg(), new CustomReg() }; - + public static final RegExp[] TEXTAREA_REG_TYPE = { new NoneReg(), new LengthReg(), new CustomReg() }; - + public static final RegExp[] PASSWORD_REG_TYPE = TEXTAREA_REG_TYPE; - + private RegExp[] regType; private UIComboBox regComboBox; private CardLayout detailedCardLayout; @@ -64,16 +64,21 @@ public class RegPane extends BasicPane { private RegPhonePane regPhonePane; private DefaultRegPane defaultRegPane; private CustomRegRexPane customRegRexPane; - + + + public UIComboBox getRegComboBox(){ + return regComboBox; + } + public RegPane() { this(ALL_REG_TYPE); } - + public RegPane(RegExp[] types) { this.regType = types; this.initComponents(); } - + private void initComponents(){ this.setLayout(FRGUIPaneFactory.createLabelFlowLayout()); JPanel contentPane = FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane(); @@ -82,7 +87,7 @@ public class RegPane extends BasicPane { regComboBox = new UIComboBox(regType); regComboBox.setRenderer(listCellRender); contentPane.add(regComboBox); - + final JPanel cardPane = FRGUIPaneFactory.createCardLayout_S_Pane(); detailedCardLayout = new CardLayout(); cardPane.setLayout(detailedCardLayout); @@ -90,7 +95,7 @@ public class RegPane extends BasicPane { cardPane.add((regLengthPane = new RegLengthPane()), "Length"); cardPane.add((regPhonePane = new RegPhonePane()), "Phone"); cardPane.add((customRegRexPane = new CustomRegRexPane()), "Custom"); - + this.add(cardPane); regComboBox.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e) { @@ -111,15 +116,15 @@ public class RegPane extends BasicPane { } fireRegChangeAction(); } - } + } }); } - + @Override protected String title4PopupWindow() { return Inter.getLocText("FR-Designer_Input_Rule"); } - + private int getRegTypeIndex(RegExp regex) { if (regex != null) { for (int i = 0; i < regType.length; i++) { @@ -131,7 +136,7 @@ public class RegPane extends BasicPane { return 0; } - + public void populate(RegExp regex) { regComboBox.setSelectedIndex(getRegTypeIndex(regex)); if (regex instanceof LengthReg) { @@ -144,111 +149,111 @@ public class RegPane extends BasicPane { defaultRegPane.populate(regex); } } - + public RegExp update(){ RegExp regExp = (RegExp)regComboBox.getSelectedItem(); - + if (regExp instanceof LengthReg){ return regLengthPane.update(); } else if(regExp instanceof PhoneReg) { return regPhonePane.update(); - } else if(regExp instanceof NoneReg || regExp instanceof MailReg || regExp instanceof IDCardReg - || regExp instanceof PostCardReg || regExp instanceof PhoneReg || regExp instanceof MobileReg) { + } 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){ - if (customRegRexPane.isEmpty()) { - return new NoneReg(); - } + if (customRegRexPane.isEmpty()) { + return new NoneReg(); + } return customRegRexPane.update(); } else { return defaultRegPane.update(); } } - + private static abstract class DisplayPane extends BasicPane { public abstract void populate(RegExp regRex); - + public abstract RegExp update(); } - + private static class DefaultRegPane extends DisplayPane { public RegExp regRex; - + public DefaultRegPane(){ - + } - + @Override protected String title4PopupWindow() { return "Default"; } - + @Override public void populate(RegExp regRex) { - + } @Override public RegExp update() { - + return this.regRex; - } + } } - + /** * 添加电话规则监听器 - * + * * @param listener 监听器 - * + * * * @date 2014-12-3-下午7:30:55 - * + * */ public void addPhoneRegListener(PhoneRegListener listener) { this.listenerList.add(PhoneRegListener.class, listener); } - + /** * 移除电话规则监听器 - * + * * @param listener 监听器 - * + * * * @date 2014-12-3-下午7:30:55 - * + * */ public void removePhoneRegListener(PhoneRegListener listener) { this.listenerList.remove(PhoneRegListener.class, listener); } - + /** * 添加正则监听器 - * + * * @param listener 监听器 - * + * * * @date 2014-12-3-下午7:29:48 - * + * */ public void addRegChangeListener(RegChangeListener listener) { this.listenerList.add(RegChangeListener.class, listener); } - + /** * 移除正则监听器 - * + * * @param listener 监听器 - * + * * * @date 2014-12-3-下午7:29:48 - * + * */ public void removeRegChangeListener(RegChangeListener listener) { this.listenerList.remove(RegChangeListener.class, listener); } - + public class PhoneRegEvent extends EventObject { private String phoneRegString; public PhoneRegEvent(Object source, String phoneRegString) { @@ -275,48 +280,48 @@ public class RegPane extends BasicPane { return regString; } } - + public interface PhoneRegListener extends EventListener{ - + /** * 电话规则变化监听 - * + * * @param e 变化事件 - * + * * * @date 2014-12-3-下午7:29:01 - * + * */ void phoneRegChangeAction(PhoneRegEvent e); - + } - + public interface RegChangeListener extends EventListener { - + /** * 正则表达规则变化监听 - * + * * * @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"; @@ -324,7 +329,7 @@ public class RegPane extends BasicPane { private static final String EMB_REG3 = "025 85679591"; private static final int LIMIT_LENGTH = 20; private static final String REG_PATTERN = "0123456789-*# "; - + private UIComboBox dataTypeComboBox; private final String[] dataType = {EMB_REG1, EMB_REG2, EMB_REG3, Inter.getLocText("FR-Designer_Custom")}; DefaultComboBoxModel DefaultComboBoxModel= new DefaultComboBoxModel(dataType); @@ -357,7 +362,7 @@ public class RegPane extends BasicPane { protected String title4PopupWindow() { return "PHONE"; } - + @Override public void populate(RegExp regRex) { if(!(regRex instanceof PhoneReg)) { @@ -369,13 +374,13 @@ public class RegPane extends BasicPane { } dataTypeComboBox.setSelectedItem(((PhoneReg)regRex).getRegString()); } - + private boolean checkEmbedded(String regstr){ return !ComparatorUtils.equals(EMB_REG1, regstr) && - !ComparatorUtils.equals(EMB_REG2, regstr) && - !ComparatorUtils.equals(EMB_REG3, regstr); + !ComparatorUtils.equals(EMB_REG2, regstr) && + !ComparatorUtils.equals(EMB_REG3, regstr); } - + @Override public RegExp update() { PhoneReg regRex = new PhoneReg(); @@ -383,11 +388,11 @@ public class RegPane extends BasicPane { return regRex; } } - + private static class RegLengthPane extends DisplayPane { private UISpinner minLenSpinner; private UISpinner maxLenSpinner; - + public RegLengthPane(){ this.setLayout(FRGUIPaneFactory.createLabelFlowLayout()); this.add(new UILabel(Inter.getLocText("FR-Designer_Reg_Min_Length") + ":")); @@ -395,9 +400,9 @@ public class RegPane extends BasicPane { this.add(minLenSpinner); this.add(new UILabel(Inter.getLocText("FR-Designer_Reg_Max_Length") + ":")); maxLenSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, 0); - this.add(maxLenSpinner); + this.add(maxLenSpinner); } - + @Override protected String title4PopupWindow() { return "LENGTH"; @@ -408,11 +413,11 @@ public class RegPane extends BasicPane { if (!(regRex instanceof LengthReg)){ return; } - + int minLength = ((LengthReg)regRex).getMinLen(); int maxLength = ((LengthReg)regRex).getMaxLen(); minLenSpinner.setValue(minLength); - maxLenSpinner.setValue(maxLength); + maxLenSpinner.setValue(maxLength); } @Override @@ -422,21 +427,21 @@ public class RegPane extends BasicPane { LengthReg regRex = new LengthReg(); regRex.setMinLen(startLength); regRex.setMaxLen(endLength); - + return regRex; - } + } } - + private static class CustomRegRexPane extends DisplayPane{ private UITextField regTextField; - + public CustomRegRexPane(){ this.setLayout(FRGUIPaneFactory.createLabelFlowLayout()); this.add(new UILabel(Inter.getLocText("FR-Designer_Reg_Expressions") + ":")); regTextField = new UITextField(20); this.add(regTextField); } - + @Override protected String title4PopupWindow() { return "CUSTOM"; @@ -451,19 +456,19 @@ public class RegPane extends BasicPane { } @Override - public RegExp update() { + public RegExp update() { return new CustomReg(regTextField.getText()); } - public boolean isEmpty() { - return StringUtils.isEmpty(regTextField.getText()); - } + public boolean isEmpty() { + return StringUtils.isEmpty(regTextField.getText()); + } } - + ListCellRenderer listCellRender = new UIComboBoxRenderer(){ @Override public Component getListCellRendererComponent(JList list, Object value, - int index, boolean isSelected, boolean cellHasFocus) { + int index, boolean isSelected, boolean cellHasFocus) { super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); if (value instanceof NoneReg){ this.setText(Inter.getLocText("FR-Designer_None")); @@ -484,6 +489,6 @@ public class RegPane extends BasicPane { } return this; } - + }; } \ No newline at end of file diff --git a/designer_form/src/com/fr/design/designer/beans/adapters/component/CompositeComponentAdapter.java b/designer_form/src/com/fr/design/designer/beans/adapters/component/CompositeComponentAdapter.java index 82c939060..e6f607e41 100644 --- a/designer_form/src/com/fr/design/designer/beans/adapters/component/CompositeComponentAdapter.java +++ b/designer_form/src/com/fr/design/designer/beans/adapters/component/CompositeComponentAdapter.java @@ -100,7 +100,10 @@ public class CompositeComponentAdapter implements ComponentAdapter { for (CRPropertyDescriptor property : properties) { String groupName = (String) property.getValue(XCreatorConstants.PROPERTY_CATEGORY); if (StringUtils.isEmpty(groupName)) { - groupName = XCreatorConstants.DEFAULT_GROUP_NAME; + groupName = (String) property.getValue(XCreatorConstants.PROPERTY_VALIDATE); + if(StringUtils.isEmpty(groupName)){ + groupName = XCreatorConstants.DEFAULT_GROUP_NAME; + } } ArrayList groupProperties = maps.get(groupName); if (groupProperties == null) { @@ -110,6 +113,7 @@ public class CompositeComponentAdapter implements ComponentAdapter { } groupProperties.add(property); } + adjustGroupNamesPosition(groupNames); ArrayList groups = new ArrayList(); for (String groupName : groupNames) { ArrayList groupProperties = maps.get(groupName); @@ -120,6 +124,15 @@ public class CompositeComponentAdapter implements ComponentAdapter { return groups; } + public void adjustGroupNamesPosition(ArrayList groupNames){ + for(String groupName : groupNames){ + if(groupName.equals("Form-Basic_Properties")){ + groupNames.remove(groupName); + groupNames.add(0,groupName); + break; + } + } + } @Override public ArrayList getXCreatorPropertyModel() { ArrayList groupModels = new ArrayList(); @@ -130,7 +143,7 @@ public class CompositeComponentAdapter implements ComponentAdapter { groupModels.addAll(groups); return groupModels; } - + /** * 自适应布局中放置文本框等用的scaleLayout和报表块、图表块支持的标题控件用的titleLayout时 * 控件树处只显示父容器,但是控件属性还是为自身的 diff --git a/designer_form/src/com/fr/design/designer/creator/XButton.java b/designer_form/src/com/fr/design/designer/creator/XButton.java index 4e0bd880a..9913c27d0 100644 --- a/designer_form/src/com/fr/design/designer/creator/XButton.java +++ b/designer_form/src/com/fr/design/designer/creator/XButton.java @@ -91,7 +91,7 @@ public class XButton extends XWidgetCreator { protected CRPropertyDescriptor creatNonListenerStyle(int i) throws IntrospectionException{ CRPropertyDescriptor[] crPropertyDescriptors = { new CRPropertyDescriptor("text", this.data.getClass()).setI18NName( - Inter.getLocText(new String[] {"Form-Button", "Name"})), + Inter.getLocText(new String[] {"Form-Button", "Name"})).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"), new CRPropertyDescriptor("customStyle", this.data.getClass()).setI18NName( Inter.getLocText(new String[]{"Form-Button", "Style"})).setEditorClass( ButtonTypeEditor.class).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"), @@ -164,6 +164,7 @@ public class XButton extends XWidgetCreator { return new CRPropertyDescriptor[]{ new CRPropertyDescriptor("text", this.data.getClass()) .setI18NName(Inter.getLocText(new String[] {"Form-Button", "Name"})) + .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced") .setPropertyChangeListener(new PropertyChangeAdapter() { @Override diff --git a/designer_form/src/com/fr/design/designer/creator/XCheckBox.java b/designer_form/src/com/fr/design/designer/creator/XCheckBox.java index 39d41407e..92c09aed7 100644 --- a/designer_form/src/com/fr/design/designer/creator/XCheckBox.java +++ b/designer_form/src/com/fr/design/designer/creator/XCheckBox.java @@ -32,6 +32,7 @@ public class XCheckBox extends XWidgetCreator { public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException { return (CRPropertyDescriptor[]) ArrayUtils.addAll(super.supportedDescriptor(), new CRPropertyDescriptor[] { new CRPropertyDescriptor("text", this.data.getClass()).setI18NName(Inter.getLocText("Text")) + .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced") .setPropertyChangeListener(new PropertyChangeAdapter() { @Override @@ -41,6 +42,7 @@ public class XCheckBox extends XWidgetCreator { }), new CRPropertyDescriptor("widgetValue", this.data.getClass()).setI18NName( Inter.getLocText(new String[]{"Widget", "Value"})).setEditorClass(WidgetValueEditor.class) + .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced") .setPropertyChangeListener(new PropertyChangeAdapter() { @Override diff --git a/designer_form/src/com/fr/design/designer/creator/XCheckBoxGroup.java b/designer_form/src/com/fr/design/designer/creator/XCheckBoxGroup.java index 0aba61dad..a14c9330a 100644 --- a/designer_form/src/com/fr/design/designer/creator/XCheckBoxGroup.java +++ b/designer_form/src/com/fr/design/designer/creator/XCheckBoxGroup.java @@ -34,35 +34,35 @@ public class XCheckBoxGroup extends XFieldEditor { @Override public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException { - return (CRPropertyDescriptor[]) ArrayUtils.addAll(super.supportedDescriptor(), getCRPropertyDescriptor()); - } - - private CRPropertyDescriptor[] getCRPropertyDescriptor() throws IntrospectionException { - CRPropertyDescriptor[] crp = new CRPropertyDescriptor[] { + CRPropertyDescriptor [] sup = (CRPropertyDescriptor[]) ArrayUtils.addAll(new CRPropertyDescriptor[] { new CRPropertyDescriptor("widgetValue", this.data.getClass()).setI18NName( - Inter.getLocText(new String[]{"Widget", "Value"})).setEditorClass(WidgetValueEditor.class), + Inter.getLocText(new String[]{"Widget", "Value"})).setEditorClass(WidgetValueEditor.class) + .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"), new CRPropertyDescriptor("dictionary", this.data.getClass()).setI18NName( Inter.getLocText("DS-Dictionary")).setEditorClass(DictionaryEditor.class).setRendererClass( - DictionaryRenderer.class), + DictionaryRenderer.class).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced")},super.supportedDescriptor()); + CRPropertyDescriptor [] properties = (CRPropertyDescriptor[]) ArrayUtils.addAll(sup,getCRPropertyDescriptor()); + return properties; + } + + private CRPropertyDescriptor[] getCRPropertyDescriptor() throws IntrospectionException { + CRPropertyDescriptor[] crp = new CRPropertyDescriptor[] { new CRPropertyDescriptor("adaptive", this.data.getClass()).setI18NName(Inter.getLocText("Adaptive")) .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced").setEditorClass(InChangeBooleanEditor.class), new CRPropertyDescriptor("chooseAll", this.data.getClass()).setI18NName( Inter.getLocText(new String[]{"Provide", "Choose_All"})).putKeyValue( XCreatorConstants.PROPERTY_CATEGORY, "Advanced"), new CRPropertyDescriptor("returnString", this.data.getClass()).setI18NName( - Inter.getLocText("Return-String")).setEditorClass(InChangeBooleanEditor.class).putKeyValue( - XCreatorConstants.PROPERTY_CATEGORY, "Return-Value") }; + Inter.getLocText("Return-String")).setEditorClass(InChangeBooleanEditor.class) + .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced") }; if (((CheckBoxGroup) this.toData()).isReturnString()) { crp = (CRPropertyDescriptor[]) ArrayUtils.addAll(crp, new CRPropertyDescriptor[] { new CRPropertyDescriptor("delimiter", this.data.getClass()).setI18NName( - Inter.getLocText("Form-Delimiter")).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, - "Return-Value"), + Inter.getLocText("Form-Delimiter")).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"), new CRPropertyDescriptor("startSymbol", this.data.getClass()).setI18NName( - Inter.getLocText("ComboCheckBox-Start_Symbol")).putKeyValue( - XCreatorConstants.PROPERTY_CATEGORY, "Return-Value"), + Inter.getLocText("ComboCheckBox-Start_Symbol")).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"), new CRPropertyDescriptor("endSymbol", this.data.getClass()).setI18NName( - Inter.getLocText("ComboCheckBox-End_Symbol")).putKeyValue( - XCreatorConstants.PROPERTY_CATEGORY, "Return-Value") }); + Inter.getLocText("ComboCheckBox-End_Symbol")).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced") }); } if (!((CheckBoxGroup) this.toData()).isAdaptive()) { crp = (CRPropertyDescriptor[]) ArrayUtils.add(crp, new CRPropertyDescriptor("columnsInRow", this.data diff --git a/designer_form/src/com/fr/design/designer/creator/XComboBox.java b/designer_form/src/com/fr/design/designer/creator/XComboBox.java index b08b6369c..64d379c5a 100644 --- a/designer_form/src/com/fr/design/designer/creator/XComboBox.java +++ b/designer_form/src/com/fr/design/designer/creator/XComboBox.java @@ -10,6 +10,7 @@ import java.beans.IntrospectionException; import javax.swing.JComponent; +import com.fr.design.form.util.XCreatorConstants; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.widget.editors.DictionaryEditor; @@ -38,11 +39,11 @@ public class XComboBox extends XCustomWriteAbleRepeatEditor { @Override public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException { return (CRPropertyDescriptor[]) ArrayUtils.addAll( - super.supportedDescriptor(), - new CRPropertyDescriptor[]{ - new CRPropertyDescriptor("widgetValue", this.data.getClass()).setI18NName(Inter.getLocText(new String[]{"Widget", "Value"})).setEditorClass(WidgetValueEditor.class), - new CRPropertyDescriptor("dictionary", this.data.getClass()).setI18NName(Inter.getLocText("FR-Designer_DS-Dictionary")).setEditorClass(DictionaryEditor.class).setRendererClass(DictionaryRenderer.class) - }); + new CRPropertyDescriptor[]{ + new CRPropertyDescriptor("widgetValue", this.data.getClass()).setI18NName(Inter.getLocText(new String[]{"Widget", "Value"})).setEditorClass(WidgetValueEditor.class).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"), + new CRPropertyDescriptor("dictionary", this.data.getClass()).setI18NName(Inter.getLocText("FR-Designer_DS-Dictionary")).setEditorClass(DictionaryEditor.class).setRendererClass(DictionaryRenderer.class) + .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced") + }, super.supportedDescriptor()); } @Override diff --git a/designer_form/src/com/fr/design/designer/creator/XComboCheckBox.java b/designer_form/src/com/fr/design/designer/creator/XComboCheckBox.java index 482af817b..84869a2c0 100644 --- a/designer_form/src/com/fr/design/designer/creator/XComboCheckBox.java +++ b/designer_form/src/com/fr/design/designer/creator/XComboCheckBox.java @@ -32,20 +32,20 @@ public class XComboCheckBox extends XComboBox { Inter.getLocText("Form-Delimiter")).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"), new CRPropertyDescriptor("returnString", this.data.getClass()).setEditorClass( - InChangeBooleanEditor.class).setI18NName(Inter.getLocText("Return-String")).putKeyValue( - XCreatorConstants.PROPERTY_CATEGORY, "Return-Value") } : new CRPropertyDescriptor[] { + InChangeBooleanEditor.class).setI18NName(Inter.getLocText("Return-String")) + .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced") } : new CRPropertyDescriptor[] { new CRPropertyDescriptor("delimiter", this.data.getClass()).setI18NName( Inter.getLocText("Form-Delimiter")).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"), new CRPropertyDescriptor("returnString", this.data.getClass()).setI18NName( - Inter.getLocText("Return-String")).setEditorClass(InChangeBooleanEditor.class).putKeyValue( - XCreatorConstants.PROPERTY_CATEGORY, "Return-Value"), + Inter.getLocText("Return-String")).setEditorClass(InChangeBooleanEditor.class) + .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"), new CRPropertyDescriptor("startSymbol", this.data.getClass()).setI18NName( - Inter.getLocText("ComboCheckBox-Start_Symbol")).putKeyValue( - XCreatorConstants.PROPERTY_CATEGORY, "Return-Value"), + Inter.getLocText("ComboCheckBox-Start_Symbol")) + .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"), new CRPropertyDescriptor("endSymbol", this.data.getClass()).setI18NName( - Inter.getLocText("ComboCheckBox-End_Symbol")).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, - "Return-Value") }); + Inter.getLocText("ComboCheckBox-End_Symbol")) + .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced") }); } @Override diff --git a/designer_form/src/com/fr/design/designer/creator/XCustomWriteAbleRepeatEditor.java b/designer_form/src/com/fr/design/designer/creator/XCustomWriteAbleRepeatEditor.java index 6166dea95..141ceba08 100644 --- a/designer_form/src/com/fr/design/designer/creator/XCustomWriteAbleRepeatEditor.java +++ b/designer_form/src/com/fr/design/designer/creator/XCustomWriteAbleRepeatEditor.java @@ -1 +1 @@ -package com.fr.design.designer.creator; import com.fr.form.ui.WriteAbleRepeatEditor; import com.fr.general.Inter; import com.fr.stable.ArrayUtils; import java.awt.*; import java.beans.IntrospectionException; /** * Author : Shockway * Date: 13-9-22 * Time: 上午10:40 */ public abstract class XCustomWriteAbleRepeatEditor extends XWriteAbleRepeatEditor { public XCustomWriteAbleRepeatEditor(WriteAbleRepeatEditor widget, Dimension initSize) { super(widget, initSize); } public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException { return (CRPropertyDescriptor[]) ArrayUtils.addAll(super.supportedDescriptor(), new CRPropertyDescriptor[] { new CRPropertyDescriptor("customData", this.data.getClass()).setI18NName(Inter.getLocText("Form-Allow_CustomData"))}); } } \ No newline at end of file +package com.fr.design.designer.creator; import com.fr.design.form.util.XCreatorConstants; import com.fr.form.ui.WriteAbleRepeatEditor; import com.fr.general.Inter; import com.fr.stable.ArrayUtils; import java.awt.*; import java.beans.IntrospectionException; /** * Author : Shockway * Date: 13-9-22 * Time: 上午10:40 */ public abstract class XCustomWriteAbleRepeatEditor extends XWriteAbleRepeatEditor { public XCustomWriteAbleRepeatEditor(WriteAbleRepeatEditor widget, Dimension initSize) { super(widget, initSize); } public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException { return (CRPropertyDescriptor[]) ArrayUtils.addAll(super.supportedDescriptor(), new CRPropertyDescriptor[] { new CRPropertyDescriptor("customData", this.data.getClass()).setI18NName(Inter.getLocText("Form-Allow_CustomData")) .putKeyValue(XCreatorConstants.PROPERTY_VALIDATE, "FR-Designer_Validate")}); } } \ No newline at end of file diff --git a/designer_form/src/com/fr/design/designer/creator/XDateEditor.java b/designer_form/src/com/fr/design/designer/creator/XDateEditor.java index 80efa40fc..2a8f6aedd 100644 --- a/designer_form/src/com/fr/design/designer/creator/XDateEditor.java +++ b/designer_form/src/com/fr/design/designer/creator/XDateEditor.java @@ -46,17 +46,20 @@ public class XDateEditor extends XDirectWriteEditor { */ @Override public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException { - return (CRPropertyDescriptor[]) ArrayUtils.addAll(super.supportedDescriptor(), + CRPropertyDescriptor [] tempt=(CRPropertyDescriptor[]) ArrayUtils.addAll( new CRPropertyDescriptor[] { new CRPropertyDescriptor("widgetValue", this.data.getClass()).setI18NName( Inter.getLocText(new String[]{"Widget", "Value"})).setEditorClass( - WidgetValueEditor.class).setPropertyChangeListener(new PropertyChangeAdapter() { - - @Override - public void propertyChange() { - initFieldText(); - } - }), + WidgetValueEditor.class).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, + "Advanced").setPropertyChangeListener(new PropertyChangeAdapter() { + + @Override + public void propertyChange() { + initFieldText(); + } + })},super.supportedDescriptor()); + return (CRPropertyDescriptor[]) ArrayUtils.addAll(tempt, + new CRPropertyDescriptor[] { new CRPropertyDescriptor("formatText", this.data.getClass()).setI18NName( Inter.getLocText("FR-Engine_Format")).setEditorClass(formatClass()).setRendererClass( DateCellRenderer.class).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"), @@ -66,11 +69,11 @@ public class XDateEditor extends XDirectWriteEditor { new CRPropertyDescriptor("endDate", this.data.getClass()).setI18NName( Inter.getLocText("FR-Designer_End-Date")).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced").setEditorClass(DateRangeEditor.class), - new CRPropertyDescriptor("returnDate", this.data.getClass()).setI18NName( - Inter.getLocText("FR-Designer_Return-Date")).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, - "Return-Value"), new CRPropertyDescriptor("waterMark", this.data.getClass()).setI18NName( Inter.getLocText("FR-Designer_WaterMark")).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, + "Advanced"), + new CRPropertyDescriptor("returnDate", this.data.getClass()).setI18NName( + Inter.getLocText("FR-Designer_Return-Date")).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced") }); } diff --git a/designer_form/src/com/fr/design/designer/creator/XDirectWriteEditor.java b/designer_form/src/com/fr/design/designer/creator/XDirectWriteEditor.java index 80b899380..e1690e506 100644 --- a/designer_form/src/com/fr/design/designer/creator/XDirectWriteEditor.java +++ b/designer_form/src/com/fr/design/designer/creator/XDirectWriteEditor.java @@ -6,6 +6,7 @@ package com.fr.design.designer.creator; import java.awt.Dimension; import java.beans.IntrospectionException; +import com.fr.design.form.util.XCreatorConstants; import com.fr.form.ui.DirectWriteEditor; import com.fr.general.Inter; import com.fr.stable.ArrayUtils; @@ -24,6 +25,7 @@ public abstract class XDirectWriteEditor extends XFieldEditor { public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException { return (CRPropertyDescriptor[]) ArrayUtils.addAll(super.supportedDescriptor(), new CRPropertyDescriptor[] { new CRPropertyDescriptor("directEdit", this.data.getClass()) - .setI18NName(Inter.getLocText("Form-Allow_Edit")) }); + .setI18NName(Inter.getLocText("Form-Allow_Edit")).putKeyValue( + XCreatorConstants.PROPERTY_VALIDATE, "FR-Designer_Validate") }); } } \ No newline at end of file diff --git a/designer_form/src/com/fr/design/designer/creator/XFieldEditor.java b/designer_form/src/com/fr/design/designer/creator/XFieldEditor.java index c5af4a4ae..4b8a0db68 100644 --- a/designer_form/src/com/fr/design/designer/creator/XFieldEditor.java +++ b/designer_form/src/com/fr/design/designer/creator/XFieldEditor.java @@ -6,6 +6,8 @@ package com.fr.design.designer.creator; import java.awt.Color; import java.awt.Dimension; import java.beans.IntrospectionException; +import java.util.ArrayList; +import java.util.List; import javax.swing.BorderFactory; import javax.swing.border.Border; @@ -38,10 +40,10 @@ public abstract class XFieldEditor extends XWidgetCreator { private CRPropertyDescriptor[] getCRPropertyDescriptor() throws IntrospectionException { CRPropertyDescriptor allowBlank = new CRPropertyDescriptor("allowBlank", this.data.getClass()).setI18NName( Inter.getLocText("Allow_Blank")).setEditorClass(InChangeBooleanEditor.class).putKeyValue( - XCreatorConstants.PROPERTY_CATEGORY, "Advanced"); + XCreatorConstants.PROPERTY_VALIDATE, "FR-Designer_Validate"); CRPropertyDescriptor blankErrorMsg = new CRPropertyDescriptor("errorMessage", this.data.getClass()).setI18NName( Inter.getLocText("Verify-Message")) - .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"); + .putKeyValue(XCreatorConstants.PROPERTY_VALIDATE, "FR-Designer_Validate"); CRPropertyDescriptor fontSize = new CRPropertyDescriptor("fontSize", this.data.getClass(), "getFontSize", "setFontSize") .setI18NName(Inter.getLocText(new String[]{"FRFont", "FRFont-Size"})) .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"); diff --git a/designer_form/src/com/fr/design/designer/creator/XLabel.java b/designer_form/src/com/fr/design/designer/creator/XLabel.java index 20491ec39..2a47eb3af 100644 --- a/designer_form/src/com/fr/design/designer/creator/XLabel.java +++ b/designer_form/src/com/fr/design/designer/creator/XLabel.java @@ -59,7 +59,7 @@ public class XLabel extends XWidgetCreator { new CRPropertyDescriptor[] { new CRPropertyDescriptor("widgetValue", this.data.getClass()).setI18NName( Inter.getLocText(new String[]{"FR-Designer_Widget", "Value"})).setEditorClass( - WidgetValueEditor.class), + WidgetValueEditor.class).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"), new CRPropertyDescriptor("wrap", this.data.getClass()).setI18NName( Inter.getLocText("FR-Designer_StyleAlignment-Wrap_Text")).putKeyValue( XCreatorConstants.PROPERTY_CATEGORY, "Advanced"), diff --git a/designer_form/src/com/fr/design/designer/creator/XNumberEditor.java b/designer_form/src/com/fr/design/designer/creator/XNumberEditor.java index a57a90059..3340f4bf6 100644 --- a/designer_form/src/com/fr/design/designer/creator/XNumberEditor.java +++ b/designer_form/src/com/fr/design/designer/creator/XNumberEditor.java @@ -41,31 +41,42 @@ public class XNumberEditor extends XWrapperedFieldEditor { */ @Override public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException { - CRPropertyDescriptor[] sup = super.supportedDescriptor(); + CRPropertyDescriptor[] sup =(CRPropertyDescriptor[]) ArrayUtils.addAll( + new CRPropertyDescriptor[] { + new CRPropertyDescriptor("widgetValue", this.data.getClass()) + .setI18NName(Inter.getLocText(new String[]{"Widget", "Value"})) + .setEditorClass(WidgetValueEditor.class) + .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced")} + ,super.supportedDescriptor()); CRPropertyDescriptor allowDecimal = new CRPropertyDescriptor("allowDecimals", this.data.getClass()) .setEditorClass(InChangeBooleanEditor.class) - .setI18NName(Inter.getLocText("FR-Designer_Allow_Decimals")); + .setI18NName(Inter.getLocText("FR-Designer_Allow_Decimals")) + .putKeyValue(XCreatorConstants.PROPERTY_VALIDATE, "FR-Designer_Validate"); CRPropertyDescriptor decimalLength = new CRPropertyDescriptor("maxDecimalLength", this.data.getClass()) - .setI18NName(Inter.getLocText(new String[]{"Double", "Numbers"})); + .setI18NName(Inter.getLocText(new String[]{"Double", "Numbers"})) + .putKeyValue(XCreatorConstants.PROPERTY_VALIDATE, "FR-Designer_Validate"); sup = (CRPropertyDescriptor[]) ArrayUtils.addAll(sup, ((NumberEditor)this.data).isAllowDecimals() ? new CRPropertyDescriptor[] {allowDecimal, decimalLength} : new CRPropertyDescriptor[] {allowDecimal}); return (CRPropertyDescriptor[]) ArrayUtils.addAll(sup, new CRPropertyDescriptor[] { new CRPropertyDescriptor("allowNegative", this.data.getClass()) .setI18NName(Inter.getLocText("FR-Designer_Allow_Negative")) - .setEditorClass(InChangeBooleanEditor.class), + .setEditorClass(InChangeBooleanEditor.class) + .putKeyValue(XCreatorConstants.PROPERTY_VALIDATE, "FR-Designer_Validate"), new CRPropertyDescriptor("minValue", this.data.getClass()) .setI18NName(Inter.getLocText("FR-Designer_Min_Value")) - .setEditorClass(SpinnerMinNumberEditor.class), + .setEditorClass(SpinnerMinNumberEditor.class) + .putKeyValue(XCreatorConstants.PROPERTY_VALIDATE, "FR-Designer_Validate"), new CRPropertyDescriptor("maxValue", this.data.getClass()) .setI18NName(Inter.getLocText("FR-Designer_Max_Value")) - .setEditorClass(SpinnerMaxNumberEditor.class), - new CRPropertyDescriptor("widgetValue", this.data.getClass()) - .setI18NName(Inter.getLocText(new String[]{"Widget", "Value"})) - .setEditorClass(WidgetValueEditor.class), + .setEditorClass(SpinnerMaxNumberEditor.class) + .putKeyValue(XCreatorConstants.PROPERTY_VALIDATE, "FR-Designer_Validate"), new CRPropertyDescriptor("waterMark", this.data.getClass()) .setI18NName(Inter.getLocText("FR-Designer_WaterMark")) - .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced") + .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"), + new CRPropertyDescriptor("regErrorMessage", this.data.getClass()) + .setI18NName(Inter.getLocText("Verify-Message")) + .putKeyValue(XCreatorConstants.PROPERTY_VALIDATE, "FR-Designer_Validate") }); } diff --git a/designer_form/src/com/fr/design/designer/creator/XPassword.java b/designer_form/src/com/fr/design/designer/creator/XPassword.java index b25d63778..b42c171f0 100644 --- a/designer_form/src/com/fr/design/designer/creator/XPassword.java +++ b/designer_form/src/com/fr/design/designer/creator/XPassword.java @@ -47,16 +47,19 @@ public class XPassword extends XWrapperedFieldEditor { */ @Override public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException { - return (CRPropertyDescriptor[]) ArrayUtils.addAll(super.supportedDescriptor(), + CRPropertyDescriptor[] sup = (CRPropertyDescriptor[]) ArrayUtils.addAll( new CRPropertyDescriptor[] { new CRPropertyDescriptor("widgetValue", this.data.getClass()).setI18NName( Inter.getLocText(new String[]{"Widget", "Value"})).setEditorClass( - WidgetValueEditor.class), + WidgetValueEditor.class).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced")} + , super.supportedDescriptor()); + return (CRPropertyDescriptor[]) ArrayUtils.addAll(sup, + new CRPropertyDescriptor[] { new CRPropertyDescriptor("regex", this.data.getClass()) .setI18NName(Inter.getLocText("FR-Designer_Input_Rule")) .setEditorClass(RegexEditor.RegexEditor4TextArea.class) .putKeyValue("renderer", RegexCellRencerer.class) - .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"), + .putKeyValue(XCreatorConstants.PROPERTY_VALIDATE, "FR-Designer_Validate"), new CRPropertyDescriptor("waterMark", this.data.getClass()) .setI18NName(Inter.getLocText("FR-Designer_WaterMark")) .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced") diff --git a/designer_form/src/com/fr/design/designer/creator/XRadioGroup.java b/designer_form/src/com/fr/design/designer/creator/XRadioGroup.java index d54f12dab..daf2b25e4 100644 --- a/designer_form/src/com/fr/design/designer/creator/XRadioGroup.java +++ b/designer_form/src/com/fr/design/designer/creator/XRadioGroup.java @@ -19,6 +19,7 @@ import com.fr.design.mainframe.widget.editors.WidgetValueEditor; import com.fr.design.mainframe.widget.renderer.DictionaryRenderer; import com.fr.form.ui.RadioGroup; import com.fr.design.form.util.XCreatorConstants; +import com.fr.function.ARRAY; import com.fr.general.Inter; import com.fr.stable.ArrayUtils; @@ -39,16 +40,19 @@ public class XRadioGroup extends XFieldEditor { @Override public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException { - return (CRPropertyDescriptor[]) ArrayUtils.addAll(super.supportedDescriptor(),getCRPropertyDescriptor()); - } - - private CRPropertyDescriptor[] getCRPropertyDescriptor() throws IntrospectionException { - CRPropertyDescriptor[] crp = new CRPropertyDescriptor[] { + CRPropertyDescriptor [] sup = (CRPropertyDescriptor[]) ArrayUtils.addAll(new CRPropertyDescriptor[] { new CRPropertyDescriptor("widgetValue", this.data.getClass()).setI18NName( - Inter.getLocText(new String[]{"Widget", "Value"})).setEditorClass(WidgetValueEditor.class), + Inter.getLocText(new String[]{"Widget", "Value"})).setEditorClass(WidgetValueEditor.class) + .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"), new CRPropertyDescriptor("dictionary", this.data.getClass()).setI18NName( Inter.getLocText("DS-Dictionary")).setEditorClass(DictionaryEditor.class).setRendererClass( - DictionaryRenderer.class), + DictionaryRenderer.class).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced")},super.supportedDescriptor()); + CRPropertyDescriptor [] properties = (CRPropertyDescriptor[]) ArrayUtils.addAll(sup,getCRPropertyDescriptor()); + return properties; + } + + private CRPropertyDescriptor[] getCRPropertyDescriptor() throws IntrospectionException { + CRPropertyDescriptor[] crp = new CRPropertyDescriptor[] { new CRPropertyDescriptor("adaptive", this.data.getClass()).setI18NName(Inter.getLocText("Adaptive")) .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced").setEditorClass(InChangeBooleanEditor.class)}; if (!toData().isAdaptive()) { diff --git a/designer_form/src/com/fr/design/designer/creator/XTextArea.java b/designer_form/src/com/fr/design/designer/creator/XTextArea.java index fbaf1a44e..d91bb97bd 100644 --- a/designer_form/src/com/fr/design/designer/creator/XTextArea.java +++ b/designer_form/src/com/fr/design/designer/creator/XTextArea.java @@ -36,15 +36,16 @@ public class XTextArea extends XFieldEditor { @Override public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException { - return (CRPropertyDescriptor[]) ArrayUtils.addAll(super.supportedDescriptor(), + CRPropertyDescriptor[] sup=(CRPropertyDescriptor[]) ArrayUtils.addAll( + new CRPropertyDescriptor[] { + new CRPropertyDescriptor("widgetValue", this.data.getClass()).setI18NName( + Inter.getLocText(new String[]{"Widget", "Value"})).setEditorClass( + WidgetValueEditor.class).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced")},super.supportedDescriptor()); + return (CRPropertyDescriptor[]) ArrayUtils.addAll(sup, new CRPropertyDescriptor[] { - new CRPropertyDescriptor("widgetValue", this.data.getClass()).setI18NName( - Inter.getLocText(new String[]{"Widget", "Value"})).setEditorClass( - WidgetValueEditor.class), new CRPropertyDescriptor("regex", this.data.getClass()).setI18NName( Inter.getLocText("Input_Rule")).setEditorClass(RegexEditor.RegexEditor4TextArea.class) - .putKeyValue("renderer", RegexCellRencerer.class).putKeyValue( - XCreatorConstants.PROPERTY_CATEGORY, "Advanced"), + .putKeyValue("renderer", RegexCellRencerer.class).putKeyValue(XCreatorConstants.PROPERTY_VALIDATE, "FR-Designer_Validate"), new CRPropertyDescriptor("waterMark", this.data.getClass()).setI18NName( Inter.getLocText("WaterMark")).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"), }); diff --git a/designer_form/src/com/fr/design/designer/creator/XTextEditor.java b/designer_form/src/com/fr/design/designer/creator/XTextEditor.java index 0165b3e18..2d068ccb1 100644 --- a/designer_form/src/com/fr/design/designer/creator/XTextEditor.java +++ b/designer_form/src/com/fr/design/designer/creator/XTextEditor.java @@ -18,10 +18,14 @@ import com.fr.design.mainframe.widget.editors.RegexEditor; import com.fr.design.mainframe.widget.editors.WidgetValueEditor; import com.fr.design.mainframe.widget.renderer.RegexCellRencerer; import com.fr.form.ui.TextEditor; +import com.fr.form.ui.reg.NoneReg; +import com.fr.form.ui.reg.RegExp; import com.fr.general.FRFont; import com.fr.general.Inter; import com.fr.stable.ArrayUtils; import com.fr.stable.Constants; +import com.fr.stable.StringUtils; +import jdk.nashorn.internal.runtime.regexp.joni.Regex; /** * @author richer @@ -35,43 +39,53 @@ public class XTextEditor extends XWrapperedFieldEditor { /** * 控件的属性列表 + * * @return 此控件所用的属性列表 * @throws IntrospectionException 异常 */ @Override - public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException { - return (CRPropertyDescriptor[]) ArrayUtils.addAll(super.supportedDescriptor(), - new CRPropertyDescriptor[] { - new CRPropertyDescriptor("widgetValue", this.data.getClass()).setI18NName( - Inter.getLocText(new String[]{"FR-Designer_Widget", "Value"})).setEditorClass( - WidgetValueEditor.class), - new CRPropertyDescriptor("regex", this.data.getClass()).setI18NName( - Inter.getLocText("FR-Designer_Input_Rule")).setEditorClass(RegexEditor.class).putKeyValue( - "renderer", RegexCellRencerer.class).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, - "Advanced"), - new CRPropertyDescriptor("waterMark", this.data.getClass()).setI18NName( - Inter.getLocText("FR-Designer_WaterMark")).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, - "Advanced"), }); - } - - @Override - public void paintComponent(Graphics g) { - super.paintComponent(g); + public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException { + CRPropertyDescriptor widgetValue = new CRPropertyDescriptor("widgetValue", this.data.getClass()).setI18NName( + Inter.getLocText(new String[]{"FR-Designer_Widget", "Value"})).setEditorClass( + WidgetValueEditor.class).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"); + CRPropertyDescriptor regex = new CRPropertyDescriptor("regex", this.data.getClass()).setI18NName( + Inter.getLocText("FR-Designer_Input_Rule")).setEditorClass(RegexEditor.class).putKeyValue( + "renderer", RegexCellRencerer.class).putKeyValue(XCreatorConstants.PROPERTY_VALIDATE, "FR-Designer_Validate"); + CRPropertyDescriptor regErrorMessage = new CRPropertyDescriptor("regErrorMessage", this.data.getClass()).setI18NName( + Inter.getLocText("Verify-Message")).putKeyValue(XCreatorConstants.PROPERTY_VALIDATE, "FR-Designer_Validate"); + CRPropertyDescriptor waterMark = new CRPropertyDescriptor("waterMark", this.data.getClass()).setI18NName( + Inter.getLocText("FR-Designer_WaterMark")).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, + "Advanced"); + CRPropertyDescriptor[] sup = (CRPropertyDescriptor[]) ArrayUtils.addAll(new CRPropertyDescriptor[]{widgetValue}, super.supportedDescriptor()); + Boolean displayRegField = true; + RegExp reg = ((TextEditor) toData()).getRegex(); + if (reg == null || !StringUtils.isNotEmpty(reg.toRegText())) { - TextEditor area = (TextEditor) data; - if (area.getWidgetValue() != null) { - Graphics2D g2d = (Graphics2D) g.create(); - BaseUtils.drawStringStyleInRotation(g2d, this.getWidth(), this.getHeight(), area.getWidgetValue() - .toString(), Style.getInstance(FRFont.getInstance()).deriveHorizontalAlignment(Constants.LEFT) - .deriveTextStyle(Style.TEXTSTYLE_SINGLELINE), ScreenResolution.getScreenResolution()); - } - } + displayRegField = false; + } + return displayRegField ? (CRPropertyDescriptor[]) ArrayUtils.addAll(sup, + new CRPropertyDescriptor[]{regex, regErrorMessage, waterMark}) : + (CRPropertyDescriptor[]) ArrayUtils.addAll(sup, new CRPropertyDescriptor[]{regex, waterMark}); + } + + @Override + public void paintComponent(Graphics g) { + super.paintComponent(g); + + TextEditor area = (TextEditor) data; + if (area.getWidgetValue() != null) { + Graphics2D g2d = (Graphics2D) g.create(); + BaseUtils.drawStringStyleInRotation(g2d, this.getWidth(), this.getHeight(), area.getWidgetValue() + .toString(), Style.getInstance(FRFont.getInstance()).deriveHorizontalAlignment(Constants.LEFT) + .deriveTextStyle(Style.TEXTSTYLE_SINGLELINE), ScreenResolution.getScreenResolution()); + } + } @Override - protected JComponent initEditor() { - setBorder(FIELDBORDER); - return this; - } + protected JComponent initEditor() { + setBorder(FIELDBORDER); + return this; + } @Override protected String getIconName() { diff --git a/designer_form/src/com/fr/design/designer/creator/XTreeComboBoxEditor.java b/designer_form/src/com/fr/design/designer/creator/XTreeComboBoxEditor.java index 52ec9d7a6..2023215ee 100644 --- a/designer_form/src/com/fr/design/designer/creator/XTreeComboBoxEditor.java +++ b/designer_form/src/com/fr/design/designer/creator/XTreeComboBoxEditor.java @@ -53,13 +53,13 @@ public class XTreeComboBoxEditor extends XTreeEditor { protected CRPropertyDescriptor[] addAllowEdit(CRPropertyDescriptor[] crp) throws IntrospectionException{ return (CRPropertyDescriptor[])ArrayUtils.add(crp, new CRPropertyDescriptor("directEdit", this.data.getClass()) .setI18NName(Inter.getLocText("Form-Allow_Edit")).putKeyValue( - XCreatorConstants.PROPERTY_CATEGORY, "Advanced")); + XCreatorConstants.PROPERTY_VALIDATE, "FR-Designer_Validate")); } protected CRPropertyDescriptor[] addCustomData(CRPropertyDescriptor[] crp) throws IntrospectionException{ return (CRPropertyDescriptor[])ArrayUtils.add(crp, new CRPropertyDescriptor("customData", this.data.getClass()) .setI18NName(Inter.getLocText("Form-Allow_CustomData")).putKeyValue( - XCreatorConstants.PROPERTY_CATEGORY, "Advanced")); + XCreatorConstants.PROPERTY_VALIDATE, "FR-Designer_Validate")); } @Override diff --git a/designer_form/src/com/fr/design/designer/creator/XTreeEditor.java b/designer_form/src/com/fr/design/designer/creator/XTreeEditor.java index 4b36820bc..683843cae 100644 --- a/designer_form/src/com/fr/design/designer/creator/XTreeEditor.java +++ b/designer_form/src/com/fr/design/designer/creator/XTreeEditor.java @@ -41,26 +41,28 @@ public class XTreeEditor extends XWidgetCreator { CRPropertyDescriptor[] crp = !((FieldEditor) toData()).isAllowBlank() ? new CRPropertyDescriptor[]{ new CRPropertyDescriptor("widgetValue", this.data.getClass()).setI18NName( - Inter.getLocText(new String[]{"FR-Designer_Widget", "Value"})).setEditorClass(WidgetValueEditor.class), + Inter.getLocText(new String[]{"FR-Designer_Widget", "Value"})).setEditorClass(WidgetValueEditor.class) + .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"), new CRPropertyDescriptor("model", this.data.getClass(), "getNodeOrDict", "setNodeOrDict").setI18NName( Inter.getLocText("FR-Designer_DS-Dictionary")).setEditorClass(TreeModelEditor.class).setRendererClass( - TreeModelRenderer.class), + TreeModelRenderer.class).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"), new CRPropertyDescriptor("allowBlank", this.data.getClass()).setI18NName( - Inter.getLocText("FR-Designer_Allow_Blank")).setEditorClass(InChangeBooleanEditor.class).putKeyValue( - XCreatorConstants.PROPERTY_CATEGORY, "Advanced"), + Inter.getLocText("FR-Designer_Allow_Blank")).setEditorClass(InChangeBooleanEditor.class) + .putKeyValue(XCreatorConstants.PROPERTY_VALIDATE, "FR-Designer_Validate"), new CRPropertyDescriptor("errorMessage", this.data.getClass()).setI18NName( Inter.getLocText("FR-Designer_Verify-Message")) - .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"), + .putKeyValue(XCreatorConstants.PROPERTY_VALIDATE, "FR-Designer_Validate"), } : new CRPropertyDescriptor[]{ new CRPropertyDescriptor("widgetValue", this.data.getClass()).setI18NName( - Inter.getLocText(new String[]{"FR-Designer_Widget", "Value"})).setEditorClass(WidgetValueEditor.class), + Inter.getLocText(new String[]{"FR-Designer_Widget", "Value"})).setEditorClass(WidgetValueEditor.class) + .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"), new CRPropertyDescriptor("model", this.data.getClass(), "getNodeOrDict", "setNodeOrDict").setI18NName( Inter.getLocText("FR-Designer_DS-Dictionary")).setEditorClass(TreeModelEditor.class).setRendererClass( - TreeModelRenderer.class), + TreeModelRenderer.class).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"), new CRPropertyDescriptor("allowBlank", this.data.getClass()).setI18NName( Inter.getLocText("FR-Designer_Allow_Blank")).setEditorClass(InChangeBooleanEditor.class).putKeyValue( - XCreatorConstants.PROPERTY_CATEGORY, "Advanced"),}; + XCreatorConstants.PROPERTY_VALIDATE, "FR-Designer_Validate"),}; crp = this.addWaterMark(crp); crp = (CRPropertyDescriptor[]) ArrayUtils.add(crp, diff --git a/designer_form/src/com/fr/design/form/util/XCreatorConstants.java b/designer_form/src/com/fr/design/form/util/XCreatorConstants.java index 26bf0a049..acbb520d5 100644 --- a/designer_form/src/com/fr/design/form/util/XCreatorConstants.java +++ b/designer_form/src/com/fr/design/form/util/XCreatorConstants.java @@ -21,6 +21,7 @@ public class XCreatorConstants { // 描述属性的分类 public static final String PROPERTY_CATEGORY = "category"; public static final String DEFAULT_GROUP_NAME = "Form-Basic_Properties"; + public static final String PROPERTY_VALIDATE = "validate"; public static final Color FORM_BG = new Color(252, 252, 254); // 拖拽标识块的大小 public static final int RESIZE_BOX_SIZ = 5; diff --git a/designer_form/src/com/fr/design/mainframe/widget/accessibles/AccessiblePropertyEditor.java b/designer_form/src/com/fr/design/mainframe/widget/accessibles/AccessiblePropertyEditor.java index fc15d746f..45d816590 100644 --- a/designer_form/src/com/fr/design/mainframe/widget/accessibles/AccessiblePropertyEditor.java +++ b/designer_form/src/com/fr/design/mainframe/widget/accessibles/AccessiblePropertyEditor.java @@ -33,6 +33,11 @@ public class AccessiblePropertyEditor extends AbstractPropertyEditor { editor.setValue(value); } + @Override + public boolean refreshInTime() { + return true; + } + @Override public Object getValue() { return editor.getValue();