From 75ecd607cdb2e70b8540de2582c46670f7be222c Mon Sep 17 00:00:00 2001 From: Lee Date: Mon, 13 Jun 2016 17:12:45 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E9=87=8D=E8=BD=BD=E8=BE=93=E5=85=A5?= =?UTF-8?q?=E6=A1=86=E7=9A=84=E5=85=89=E6=A0=87=E4=BA=8B=E4=BB=B6=E6=96=B9?= =?UTF-8?q?=E6=B3=95=EF=BC=8C=E4=B8=8D=E7=AE=A1=E6=98=AF=E5=85=89=E6=A0=87?= =?UTF-8?q?=E7=A7=BB=E5=87=BA=E8=BF=98=E6=98=AF=E6=8C=89=E4=B8=8B=E5=9B=9E?= =?UTF-8?q?=E8=BD=A6=EF=BC=88enter=EF=BC=89=EF=BC=8C=E4=BC=9A=E7=AB=8B?= =?UTF-8?q?=E5=8D=B3=E8=A7=A6=E5=8F=91=E8=A1=A8=E5=8D=95=E7=A7=BB=E5=8A=A8?= =?UTF-8?q?=E7=AB=AF=E9=AB=98=E5=BA=A6=E5=B1=9E=E6=80=A7=E7=9A=84setter?= =?UTF-8?q?=E6=96=B9=E6=B3=95=EF=BC=8C=E5=B9=B6=E7=BB=99=E5=87=BA=E5=BC=B9?= =?UTF-8?q?=E7=AA=97=E6=8F=90=E7=A4=BA=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/mainframe/widget/editors/FormattedEditor.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/designer_base/src/com/fr/design/mainframe/widget/editors/FormattedEditor.java b/designer_base/src/com/fr/design/mainframe/widget/editors/FormattedEditor.java index 942fc902c7..2d92f819c4 100644 --- a/designer_base/src/com/fr/design/mainframe/widget/editors/FormattedEditor.java +++ b/designer_base/src/com/fr/design/mainframe/widget/editors/FormattedEditor.java @@ -36,11 +36,11 @@ public class FormattedEditor extends AbstractPropertyEditor { public void keyReleased(KeyEvent e) { try { - textField.commitEdit(); + textField.commitEdit(); + return; } catch (ParseException e1) { return; } - firePropertyChanged(); } }); } From 758e1f73adc45d24f80cd97518c90d46e3f9556c Mon Sep 17 00:00:00 2001 From: Lee Date: Mon, 13 Jun 2016 23:02:26 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E5=9F=BA=E7=A1=80=E6=8E=A7=E4=BB=B6?= =?UTF-8?q?=E7=B1=BB=E6=8A=BD=E5=8F=96=E9=9C=80=E8=A6=81=E7=9A=84=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E5=8D=95=E7=8B=AC=E4=BD=9C=E4=B8=80=E4=B8=AA=E6=96=B9?= =?UTF-8?q?=E6=B3=95=EF=BC=8C=E5=9C=A8=E5=AD=90=E7=B1=BB=E4=B8=AD=E9=87=8D?= =?UTF-8?q?=E5=86=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../widget/editors/FormattedEditor.java | 21 ++++++++++------- .../widget/editors/DoubleEditor.java | 23 +++++++++++++++++++ 2 files changed, 36 insertions(+), 8 deletions(-) diff --git a/designer_base/src/com/fr/design/mainframe/widget/editors/FormattedEditor.java b/designer_base/src/com/fr/design/mainframe/widget/editors/FormattedEditor.java index 2d92f819c4..2db12f23b8 100644 --- a/designer_base/src/com/fr/design/mainframe/widget/editors/FormattedEditor.java +++ b/designer_base/src/com/fr/design/mainframe/widget/editors/FormattedEditor.java @@ -4,6 +4,7 @@ import java.awt.BorderLayout; import java.awt.Component; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; +import java.awt.event.KeyListener; import java.text.Format; import java.text.ParseException; @@ -32,17 +33,21 @@ public class FormattedEditor extends AbstractPropertyEditor { textField = new JFormattedTextField(format); panel.add(textField, BorderLayout.CENTER); textField.setBorder(null); - textField.addKeyListener(new KeyAdapter() { + textField.addKeyListener(createKeyListener()); + } + + protected KeyListener createKeyListener() { + return new KeyAdapter() { - public void keyReleased(KeyEvent e) { - try { + public void keyReleased(KeyEvent e) { + try { textField.commitEdit(); + } catch (ParseException e1) { return; - } catch (ParseException e1) { - return; - } - } - }); + } + firePropertyChanged(); + } + }; } @Override diff --git a/designer_form/src/com/fr/design/mainframe/widget/editors/DoubleEditor.java b/designer_form/src/com/fr/design/mainframe/widget/editors/DoubleEditor.java index 932338dd34..e88d3cea0a 100644 --- a/designer_form/src/com/fr/design/mainframe/widget/editors/DoubleEditor.java +++ b/designer_form/src/com/fr/design/mainframe/widget/editors/DoubleEditor.java @@ -1,11 +1,34 @@ package com.fr.design.mainframe.widget.editors; +import javax.swing.*; +import java.awt.event.KeyAdapter; +import java.awt.event.KeyEvent; +import java.awt.event.KeyListener; import java.text.NumberFormat; +import java.text.ParseException; public class DoubleEditor extends FormattedEditor { + private JFormattedTextField textField; + public DoubleEditor() { super(NumberFormat.getNumberInstance()); + textField = (JFormattedTextField) super.getCustomEditor(); + } + + @Override + public KeyListener createKeyListener() { + return new KeyAdapter() { + + public void keyReleased(KeyEvent e) { + try { + textField.commitEdit(); + return; + } catch (ParseException e1) { + return; + } + } + }; } @Override From 93c676528fbac2f927e099b961e827cc43209d70 Mon Sep 17 00:00:00 2001 From: Lee Date: Tue, 14 Jun 2016 15:14:35 +0800 Subject: [PATCH 3/4] =?UTF-8?q?1.=20=E9=87=8D=E5=86=99=E4=BA=86=E8=87=AA?= =?UTF-8?q?=E5=B7=B1=E7=9A=84model=E6=9D=A5=E5=9C=A8set=E5=B1=9E=E6=80=A7?= =?UTF-8?q?=E5=80=BC=E4=B9=8B=E5=89=8D=E8=BF=9B=E8=A1=8C=E5=88=A4=E6=96=AD?= =?UTF-8?q?=E5=B9=B6=E7=BB=99=E5=87=BA=E5=BC=B9=E7=AA=97=E6=8F=90=E7=A4=BA?= =?UTF-8?q?;=202.=20=E7=BB=A7=E6=89=BFDoubleEditor=E6=9D=A5=E5=AE=9E?= =?UTF-8?q?=E7=8E=B0=E5=85=BC=E5=AE=B9=E5=BC=B9=E7=AA=97=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E6=95=88=E6=9E=9C=E7=9A=84=E6=8E=A7=E4=BB=B6=EF=BC=8C=E5=A4=8D?= =?UTF-8?q?=E5=8E=9F=E4=B9=8B=E5=89=8D=E5=9F=BA=E7=A1=80=E6=8E=A7=E4=BB=B6?= =?UTF-8?q?=E7=9A=84=E6=89=80=E6=9C=89=E6=9B=B4=E6=94=B9=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mobile/ElementCasePropertyTable.java | 10 +-- .../xtable/ReportAppPropertyGroupModel.java | 67 +++++++++++++++++++ .../widget/editors/DoubleEditor.java | 23 ------- .../widget/editors/RefinedDoubleEditor.java | 31 +++++++++ 4 files changed, 103 insertions(+), 28 deletions(-) create mode 100644 designer_form/src/com/fr/design/gui/xtable/ReportAppPropertyGroupModel.java create mode 100644 designer_form/src/com/fr/design/mainframe/widget/editors/RefinedDoubleEditor.java diff --git a/designer_form/src/com/fr/design/designer/properties/mobile/ElementCasePropertyTable.java b/designer_form/src/com/fr/design/designer/properties/mobile/ElementCasePropertyTable.java index 9d4a14d5b5..85c70f810c 100644 --- a/designer_form/src/com/fr/design/designer/properties/mobile/ElementCasePropertyTable.java +++ b/designer_form/src/com/fr/design/designer/properties/mobile/ElementCasePropertyTable.java @@ -7,11 +7,11 @@ import com.fr.design.designer.creator.XCreator; import com.fr.design.form.util.XCreatorConstants; import com.fr.design.gui.itable.AbstractPropertyTable; import com.fr.design.gui.itable.PropertyGroup; -import com.fr.design.gui.xtable.PropertyGroupModel; +import com.fr.design.gui.xtable.ReportAppPropertyGroupModel; import com.fr.design.mainframe.FormDesigner; -import com.fr.design.mainframe.WidgetPropertyPane; -import com.fr.design.mainframe.widget.editors.DoubleEditor; +import com.fr.design.mainframe.WidgetPropertyPane;; import com.fr.design.mainframe.widget.editors.InChangeBooleanEditor; +import com.fr.design.mainframe.widget.editors.RefinedDoubleEditor; import com.fr.form.ui.ElementCaseEditor; import com.fr.general.Inter; @@ -65,7 +65,7 @@ public class ElementCasePropertyTable extends AbstractPropertyTable{ protected CRPropertyDescriptor[] revealHeightLimit() throws IntrospectionException { CRPropertyDescriptor heightLimitProperty = new CRPropertyDescriptor("heightPercent", this.xCreator.toData().getClass()) - .setEditorClass(DoubleEditor.class) + .setEditorClass(RefinedDoubleEditor.class) .setI18NName(Inter.getLocText("Form-EC_heightpercent")) .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"); ArrayList defaultList = (ArrayList) createNonListenerProperties(); @@ -91,7 +91,7 @@ public class ElementCasePropertyTable extends AbstractPropertyTable{ } - groups.add(new PropertyGroup(new PropertyGroupModel(Inter.getLocText("FR-Designer_Fit-App"), xCreator, propertyTableEditor, designer))); + groups.add(new PropertyGroup(new ReportAppPropertyGroupModel(Inter.getLocText("FR-Designer_Fit-App"), xCreator, propertyTableEditor, designer))); TableModel model = new BeanTableModel(); setModel(model); diff --git a/designer_form/src/com/fr/design/gui/xtable/ReportAppPropertyGroupModel.java b/designer_form/src/com/fr/design/gui/xtable/ReportAppPropertyGroupModel.java new file mode 100644 index 0000000000..eac09aa63e --- /dev/null +++ b/designer_form/src/com/fr/design/gui/xtable/ReportAppPropertyGroupModel.java @@ -0,0 +1,67 @@ +package com.fr.design.gui.xtable; + +import com.fr.base.FRContext; +import com.fr.design.designer.creator.CRPropertyDescriptor; +import com.fr.design.designer.creator.XCreator; +import com.fr.design.mainframe.FormDesigner; +import com.fr.general.Inter; +import java.lang.reflect.Method; +import com.fr.general.ComparatorUtils; +import com.fr.report.stable.FormConstants; + +import javax.swing.*; + +public class ReportAppPropertyGroupModel extends PropertyGroupModel { + + private static final double MAX_HEIGHT = 0.8; + + public ReportAppPropertyGroupModel(String name, XCreator creator, CRPropertyDescriptor[] propArray, + FormDesigner designer) { + super(name, creator, propArray, designer); + } + + @Override + public boolean setValue(Object value, int row, int column) { + double state = 0; + if (column == 0) { + return false; + } + if (value instanceof Double) { + state = (Double) value; + } + + try { + Method m = properties[row].getWriteMethod(); + if (state > MAX_HEIGHT) { + //弹窗提示 + Object[] options = {Inter.getLocText("FR-Designer_Button-OK"), Inter.getLocText("FR-Designer_Button-Cancel")}; + int choice = JOptionPane.showOptionDialog(null, + Inter.getLocText("FR-Designer_Mobile-Warning"), + Inter.getLocText("FR-Designer_Tooltips"), + JOptionPane.OK_CANCEL_OPTION, + JOptionPane.INFORMATION_MESSAGE, + null, + options, + options[0]); + if (choice == JOptionPane.OK_OPTION || choice == JOptionPane.NO_OPTION) { + return false; + } + return false; + } + m.invoke(dealCreatorData(), value); + //属性名称为控件名时,单独处理下 + if(ComparatorUtils.equals(FormConstants.NAME, properties[row].getName())){ + creator.resetCreatorName(value.toString()); + } + properties[row].firePropertyChanged(); + return true; + } catch (Exception e) { + FRContext.getLogger().error(e.getMessage(), e); + return false; + } + } + + private Object dealCreatorData() { + return creator.getPropertyDescriptorCreator().toData(); + } +} \ No newline at end of file diff --git a/designer_form/src/com/fr/design/mainframe/widget/editors/DoubleEditor.java b/designer_form/src/com/fr/design/mainframe/widget/editors/DoubleEditor.java index e88d3cea0a..932338dd34 100644 --- a/designer_form/src/com/fr/design/mainframe/widget/editors/DoubleEditor.java +++ b/designer_form/src/com/fr/design/mainframe/widget/editors/DoubleEditor.java @@ -1,34 +1,11 @@ package com.fr.design.mainframe.widget.editors; -import javax.swing.*; -import java.awt.event.KeyAdapter; -import java.awt.event.KeyEvent; -import java.awt.event.KeyListener; import java.text.NumberFormat; -import java.text.ParseException; public class DoubleEditor extends FormattedEditor { - private JFormattedTextField textField; - public DoubleEditor() { super(NumberFormat.getNumberInstance()); - textField = (JFormattedTextField) super.getCustomEditor(); - } - - @Override - public KeyListener createKeyListener() { - return new KeyAdapter() { - - public void keyReleased(KeyEvent e) { - try { - textField.commitEdit(); - return; - } catch (ParseException e1) { - return; - } - } - }; } @Override diff --git a/designer_form/src/com/fr/design/mainframe/widget/editors/RefinedDoubleEditor.java b/designer_form/src/com/fr/design/mainframe/widget/editors/RefinedDoubleEditor.java new file mode 100644 index 0000000000..0caad975df --- /dev/null +++ b/designer_form/src/com/fr/design/mainframe/widget/editors/RefinedDoubleEditor.java @@ -0,0 +1,31 @@ +package com.fr.design.mainframe.widget.editors; + +import javax.swing.*; +import java.awt.event.KeyAdapter; +import java.awt.event.KeyEvent; +import java.awt.event.KeyListener; +import java.text.ParseException; + +public class RefinedDoubleEditor extends DoubleEditor { + + private JFormattedTextField textField; + + public RefinedDoubleEditor() { + super(); + textField = (JFormattedTextField) super.getCustomEditor(); + } + + @Override + public KeyListener createKeyListener() { + return new KeyAdapter() { + + public void keyReleased(KeyEvent e) { + try { + textField.commitEdit(); + return; + } catch (ParseException e1) { + } + } + }; + } +} \ No newline at end of file From 3449016840c30f15809288f55099bccc9a6921fa Mon Sep 17 00:00:00 2001 From: Lee Date: Tue, 14 Jun 2016 15:39:04 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E6=8F=90=E7=A4=BA=E6=A1=86=E7=AE=80?= =?UTF-8?q?=E5=8C=96=EF=BC=8C=E6=9B=B4=E7=AE=80=E6=B4=81=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xtable/ReportAppPropertyGroupModel.java | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/designer_form/src/com/fr/design/gui/xtable/ReportAppPropertyGroupModel.java b/designer_form/src/com/fr/design/gui/xtable/ReportAppPropertyGroupModel.java index eac09aa63e..3b45260e4b 100644 --- a/designer_form/src/com/fr/design/gui/xtable/ReportAppPropertyGroupModel.java +++ b/designer_form/src/com/fr/design/gui/xtable/ReportAppPropertyGroupModel.java @@ -34,19 +34,11 @@ public class ReportAppPropertyGroupModel extends PropertyGroupModel { Method m = properties[row].getWriteMethod(); if (state > MAX_HEIGHT) { //弹窗提示 - Object[] options = {Inter.getLocText("FR-Designer_Button-OK"), Inter.getLocText("FR-Designer_Button-Cancel")}; - int choice = JOptionPane.showOptionDialog(null, - Inter.getLocText("FR-Designer_Mobile-Warning"), - Inter.getLocText("FR-Designer_Tooltips"), - JOptionPane.OK_CANCEL_OPTION, - JOptionPane.INFORMATION_MESSAGE, - null, - options, - options[0]); - if (choice == JOptionPane.OK_OPTION || choice == JOptionPane.NO_OPTION) { - return false; - } - return false; + JOptionPane.showMessageDialog(null, + Inter.getLocText("FR-Designer_Mobile-Warning"), + Inter.getLocText("FR-Designer_Tooltips"), + JOptionPane.PLAIN_MESSAGE); + return false; } m.invoke(dealCreatorData(), value); //属性名称为控件名时,单独处理下