From 512cd4b120d75829e8d3fbf008d7deb63bd1344f Mon Sep 17 00:00:00 2001 From: kuangshuai Date: Tue, 26 May 2020 23:30:32 +0800 Subject: [PATCH 01/15] =?UTF-8?q?MOBILE-27220=20=E5=9C=A8=E8=A1=A8?= =?UTF-8?q?=E5=8D=95=E7=A7=BB=E5=8A=A8=E7=AB=AF=E5=B1=9E=E6=80=A7=E5=8A=A0?= =?UTF-8?q?=E4=B8=80=E4=B8=AA=E2=80=9C=E9=BB=98=E8=AE=A4=E2=80=9D=E5=92=8C?= =?UTF-8?q?=E2=80=9C=E8=87=AA=E5=AE=9A=E4=B9=89=E6=A0=B7=E5=BC=8F=E2=80=9D?= =?UTF-8?q?=E5=BC=80=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mobile/ui/MobileStyleDefinePane.java | 39 +++++++++++++++---- .../mobile/ui/MobileStyleFontConfigPane.java | 21 +++++----- 2 files changed, 41 insertions(+), 19 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileStyleDefinePane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileStyleDefinePane.java index 5f11e46db0..3ae82f9265 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileStyleDefinePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileStyleDefinePane.java @@ -5,6 +5,7 @@ import com.fr.design.beans.BasicBeanPane; import com.fr.design.constants.LayoutConstants; import com.fr.design.designer.IntervalConstants; import com.fr.design.gui.icombobox.LineComboBox; +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.i18n.Toolkit; @@ -21,14 +22,14 @@ import com.fr.stable.Constants; import javax.swing.JPanel; import javax.swing.border.TitledBorder; -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Component; import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.Font; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; public class MobileStyleDefinePane extends BasicBeanPane { @@ -42,6 +43,8 @@ public class MobileStyleDefinePane extends BasicBeanPane { private Widget widget; private MobileStyleCustomDefinePane customBeanPane; private Class mobileStyleClazz; + private UIComboBox customCombo; + private JPanel settingPane; private ColorSelectBox colorSelectBox; private Color titleColor = new Color(47, 142, 241); private JPanel commomPane; @@ -62,6 +65,8 @@ public class MobileStyleDefinePane extends BasicBeanPane { @Override public void populateBean(MobileStyle ob) { this.customBeanPane.populateBean(ob); + + customCombo.setSelectedIndex(ob.isCommonCustom() ? 1 : 0); if(ob.getBackground() != null) { colorSelectBox.setSelectObject(((ColorBackground)ob.getBackground()).getColor()); } @@ -83,6 +88,7 @@ public class MobileStyleDefinePane extends BasicBeanPane { MobileStyle mobileStyle = Reflect.on(mobileStyleClazz).create().get(); this.widget.setMobileStyle(mobileStyle); this.customBeanPane.updateBean(); + mobileStyle.setCommonCustom(customCombo.getSelectedIndex() == 1); mobileStyle.setBackground(ColorBackground.getInstance(colorSelectBox.getSelectObject())); mobileStyle.setBorderType(borderType.getSelectedLineStyle()); mobileStyle.setBorderColor(borderColor.getSelectObject()); @@ -126,6 +132,22 @@ public class MobileStyleDefinePane extends BasicBeanPane { commomPane.setBorder(titledBorder); this.add(commomPane, BorderLayout.NORTH); + customCombo = new UIComboBox(new String[]{Toolkit.i18nText("Fine-Design_Mobile_Default"), Toolkit.i18nText("FIne-Design_Mobile_Custom")}); + customCombo.setSelectedIndex(0); + customCombo.setPreferredSize(new Dimension(NORMAL_COMBO_WIDTH + 15, 20)); + customCombo.addItemListener(new ItemListener() { + @Override + public void itemStateChanged(ItemEvent e) { + boolean custom = customCombo.getSelectedIndex() == 1; + settingPane.setVisible(custom); + } + }); + commomPane.add(createLeftRightComponentsPane(createConfigLabel(Toolkit.i18nText("Fine-Design_Mobile_Attribute_Settings")), customCombo)); + + settingPane = FRGUIPaneFactory.createVerticalFlowLayout_Pane(true, FlowLayout.LEADING, 0, 10); + settingPane.setVisible(false); + commomPane.add(settingPane); + createBackgroundPane(); createBorderPane(); createIconSettingPane(); @@ -136,7 +158,7 @@ public class MobileStyleDefinePane extends BasicBeanPane { colorSelectBox = new ColorSelectBox(NORMAL_COMBO_WIDTH); JPanel backgroundPane = createLeftRightComponentsPane(createConfigLabel(Toolkit.i18nText("Fine-Design_Mobile_Widget_Background")), colorSelectBox); - commomPane.add(backgroundPane); + settingPane.add(backgroundPane); } private void createBorderPane() { @@ -146,19 +168,20 @@ public class MobileStyleDefinePane extends BasicBeanPane { borderColor = new NewColorSelectBox(NORMAL_COMBO_WIDTH); borderRadius = new UISpinner(0, Integer.MAX_VALUE, 1, 2); borderRadius.setPreferredSize(new Dimension(NORMAL_COMBO_WIDTH + 20, 20)); - commomPane.add(createLeftRightComponentsPane(createConfigLabel(Toolkit.i18nText("Fine-Design_Mobile_Widget_BorderType")), borderType)); - commomPane.add(createLeftRightComponentsPane(createConfigLabel(Toolkit.i18nText("Fine-Design_Mobile_Widget_BorderColor")), borderColor)); - commomPane.add(createLeftRightComponentsPane(createConfigLabel(Toolkit.i18nText("Fine-Design_Mobile_Widget_BorderRadius")), borderRadius)); + settingPane.add(createLeftRightComponentsPane(createConfigLabel(Toolkit.i18nText("Fine-Design_Mobile_Widget_BorderType")), borderType)); + settingPane.add(createLeftRightComponentsPane(createConfigLabel(Toolkit.i18nText("Fine-Design_Mobile_Widget_BorderColor")), borderColor)); + settingPane.add(createLeftRightComponentsPane(createConfigLabel(Toolkit.i18nText("Fine-Design_Mobile_Widget_BorderRadius")), borderRadius)); } private void createIconSettingPane() { iconColor = new NewColorSelectBox(NORMAL_COMBO_WIDTH); - commomPane.add(createLeftRightComponentsPane(createConfigLabel(Toolkit.i18nText("Fine-Design_Mobile_Widget_Icon_Color")), iconColor)); + iconColor.setSelectObject(new Color(31,173,229)); + settingPane.add(createLeftRightComponentsPane(createConfigLabel(Toolkit.i18nText("Fine-Design_Mobile_Widget_Icon_Color")), iconColor)); } private void createFontPane() { fontConfigPane = new MobileStyleFontConfigPane(); - commomPane.add(createLeftRightComponentsPane(createConfigLabel(Toolkit.i18nText("Fine-Design_Mobile_Widget_Font")), fontConfigPane)); + settingPane.add(createLeftRightComponentsPane(createConfigLabel(Toolkit.i18nText("Fine-Design_Mobile_Widget_Font")), fontConfigPane)); } private void createCustomPane() { diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileStyleFontConfigPane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileStyleFontConfigPane.java index f765e25845..3c756db09b 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileStyleFontConfigPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileStyleFontConfigPane.java @@ -2,6 +2,7 @@ package com.fr.design.mainframe.mobile.ui; import com.fr.base.BaseUtils; import com.fr.design.constants.LayoutConstants; +import com.fr.design.gui.ibutton.UIColorButton; import com.fr.design.gui.ibutton.UIToggleButton; import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIComboBoxRenderer; @@ -16,7 +17,6 @@ import javax.swing.JLabel; import javax.swing.JList; import javax.swing.JPanel; import java.awt.BorderLayout; -import java.awt.Color; import java.awt.Component; import java.awt.Dimension; import java.awt.FlowLayout; @@ -31,7 +31,6 @@ public class MobileStyleFontConfigPane extends JPanel { public static Vector getFontSizes() { Vector FONT_SIZES = new Vector(); - FONT_SIZES.add(FONT_NONE); for (int i = MIN_FONT_SIZE; i <= MAX_FONT_SIZE; i++) { FONT_SIZES.add(i); } @@ -39,7 +38,7 @@ public class MobileStyleFontConfigPane extends JPanel { } private UIComboBox fontSizeComboBox; - private UIToggleButton underline; + private UIColorButton color; private UIToggleButton italic; private UIToggleButton bold; @@ -51,10 +50,10 @@ public class MobileStyleFontConfigPane extends JPanel { fontSizeComboBox = new UIComboBox(); fontSizeComboBox.setModel(new DefaultComboBoxModel(getFontSizes())); - fontSizeComboBox.setSelectedItem(0); + fontSizeComboBox.setSelectedItem(16); fontSizeComboBox.setPreferredSize(new Dimension(60, 20)); fontSizeComboBox.setRenderer(new LineCellRenderer()); - underline = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/underline.png")); + color = new UIColorButton(); italic = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/italic.png")); bold = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/bold.png")); @@ -62,7 +61,7 @@ public class MobileStyleFontConfigPane extends JPanel { this.setButtonsSize(BUTTON_SIZE); Component[] components_font = new Component[]{ - fontSizeComboBox, underline, italic, bold + fontSizeComboBox, color, italic, bold }; JPanel buttonPane = new JPanel(new BorderLayout()); @@ -73,13 +72,13 @@ public class MobileStyleFontConfigPane extends JPanel { } private void setButtonsTips() { - underline.setToolTipText(Toolkit.i18nText("Fine-Design_Report_Underline")); + color.setToolTipText(Toolkit.i18nText("Fine-Design_Report_Foreground")); italic.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Italic")); bold.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Bold")); } private void setButtonsSize(Dimension size) { - underline.setPreferredSize(size); + color.setPreferredSize(size); italic.setPreferredSize(size); bold.setPreferredSize(size); } @@ -87,9 +86,9 @@ public class MobileStyleFontConfigPane extends JPanel { public void populateBean(FRFont frFont) { fontSizeComboBox.setSelectedItem(frFont.getSize()); + color.setColor(frFont.getForeground()); bold.setSelected(frFont.isBold()); italic.setSelected(frFont.isItalic()); - underline.setSelected(frFont.getUnderline() != Constants.LINE_NONE); } public FRFont updateBean() { @@ -100,8 +99,8 @@ public class MobileStyleFontConfigPane extends JPanel { FRFont.DEFAULT_FONTNAME, style, Float.parseFloat(fontSizeComboBox.getSelectedItem().toString()), - Color.BLACK, - underline.isSelected() ? Constants.LINE_THIN : Constants.LINE_NONE + color.getColor(), + Constants.LINE_NONE ); } From 66fd4cc702d7ee72beb0b0d2e909d7b1237924f8 Mon Sep 17 00:00:00 2001 From: kuangshuai Date: Tue, 26 May 2020 23:38:11 +0800 Subject: [PATCH 02/15] =?UTF-8?q?=E6=8B=BC=E5=86=99=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/mainframe/mobile/ui/MobileStyleDefinePane.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileStyleDefinePane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileStyleDefinePane.java index 3ae82f9265..9d08a4d4e0 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileStyleDefinePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileStyleDefinePane.java @@ -132,7 +132,7 @@ public class MobileStyleDefinePane extends BasicBeanPane { commomPane.setBorder(titledBorder); this.add(commomPane, BorderLayout.NORTH); - customCombo = new UIComboBox(new String[]{Toolkit.i18nText("Fine-Design_Mobile_Default"), Toolkit.i18nText("FIne-Design_Mobile_Custom")}); + customCombo = new UIComboBox(new String[]{Toolkit.i18nText("Fine-Design_Mobile_Default"), Toolkit.i18nText("Fine-Design_Mobile_Custom")}); customCombo.setSelectedIndex(0); customCombo.setPreferredSize(new Dimension(NORMAL_COMBO_WIDTH + 15, 20)); customCombo.addItemListener(new ItemListener() { From 9018c51a45ac44d0d2fb795875f205d9dd400a11 Mon Sep 17 00:00:00 2001 From: hades Date: Wed, 3 Jun 2020 22:30:42 +0800 Subject: [PATCH 03/15] =?UTF-8?q?REPORT-32939=20=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E6=AD=A3=E5=B8=B82g=E7=9B=AE=E5=89=8D=E7=BB=8F?= =?UTF-8?q?=E5=B8=B8=E5=87=BA=E7=8E=B0=E6=8E=92=E9=98=9F=E7=8E=B0=E8=B1=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/file/HistoryTemplateListCache.java | 36 +++++++++++++++++++ .../fr/design/mainframe/DesignerFrame.java | 16 ++++++++- 2 files changed, 51 insertions(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java b/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java index cb68bb6e47..4375693485 100644 --- a/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java +++ b/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java @@ -42,6 +42,14 @@ public class HistoryTemplateListCache implements CallbackEvent { private List> historyList; private JTemplate editingTemplate; + /** + * 当设计器打开的模板数大于模板缓存对象个数时,会产生JVirtualTemplate(个数=打开的总模板数 - 缓存模板数) + * 每次点击切换模板时,当切换到JVirtualTemplate,会创建真实的JTemplate,但是该JTemplate创建后不会释放掉,需要调用whenClose主动释放 + * 该变量对JVirtualTemplate创建真实的JTemplate管理 + */ + private JTemplate currentVirtualReplaceTemplate; + + public static HistoryTemplateListCache getInstance() { return Holder.INSTANCE; } @@ -112,6 +120,14 @@ public class HistoryTemplateListCache implements CallbackEvent { * @see DesignerFrameFileDealerPane#setCurrentEditingTemplate(JTemplate) */ public void setCurrentEditingTemplate(JTemplate jt) { + + // 模板之间切换 如果存在上次JVirtualTemplate创建的真实模板 需要在此关闭,并释放掉 + boolean canReleaseVirtualReplaceTemplate = this.currentVirtualReplaceTemplate != null && jt != null + && !ComparatorUtils.equals(this.currentVirtualReplaceTemplate.getEditingFILE(), jt.getEditingFILE()); + if (canReleaseVirtualReplaceTemplate) { + HistoryTemplateListCache.getInstance().releaseVirtualReplaceTemplate(); + } + this.editingTemplate = jt; //如果当前历史面板中没有 @@ -423,4 +439,24 @@ public class HistoryTemplateListCache implements CallbackEvent { } } + + public void setCurrentVirtualReplaceTemplate(JTemplate currentVirtualReplaceTemplate) { + // 保证先释放 + releaseVirtualReplaceTemplate(); + this.currentVirtualReplaceTemplate = currentVirtualReplaceTemplate; + } + + public JTemplate getCurrentVirtualReplaceTemplate() { + return currentVirtualReplaceTemplate; + } + + /** + * 释放JVirtualTemplate创建的真实模板JTemplate + */ + private void releaseVirtualReplaceTemplate() { + if (this.currentVirtualReplaceTemplate != null) { + this.currentVirtualReplaceTemplate.whenClose(); + this.currentVirtualReplaceTemplate = null; + } + } } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java index 2cf8d8c350..e5b8e8b7e0 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java @@ -1101,11 +1101,19 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta */ private void openFile(FILE tplFile) { + boolean virtualTemplate = false; if (tplFile != null) { int index = HistoryTemplateListCache.getInstance().contains(tplFile); if (index != -1) { JTemplate jt = HistoryTemplateListCache.getInstance().getHistoryList().get(index); - if (!(jt instanceof JVirtualTemplate)) { + if (jt instanceof JVirtualTemplate) { + JTemplate currentVirtualReplaceTemplate = HistoryTemplateListCache.getInstance().getCurrentVirtualReplaceTemplate(); + if (currentVirtualReplaceTemplate != null && ComparatorUtils.equals(currentVirtualReplaceTemplate.getEditingFILE(), jt.getEditingFILE())) { + currentVirtualReplaceTemplate.activeOldJTemplate(); + return; + } + virtualTemplate = true; + } else { jt.activeOldJTemplate(); return; } @@ -1116,6 +1124,12 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta if (jt == null) { return; } + + // 将JVirtualTemplate创建的真实模板管理起来 + if (virtualTemplate) { + HistoryTemplateListCache.getInstance().setCurrentVirtualReplaceTemplate(jt); + } + // 新的form不往前兼容 if (inValidDesigner(jt)) { this.addAndActivateJTemplate(); From 838183e165e8c864ef7a66c30cdee5cf635d6ac2 Mon Sep 17 00:00:00 2001 From: hades Date: Wed, 3 Jun 2020 22:37:06 +0800 Subject: [PATCH 04/15] REPORT-32939 add comment --- .../src/main/java/com/fr/design/mainframe/DesignerFrame.java | 1 + 1 file changed, 1 insertion(+) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java index e5b8e8b7e0..2cfd36687b 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java @@ -1109,6 +1109,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta if (jt instanceof JVirtualTemplate) { JTemplate currentVirtualReplaceTemplate = HistoryTemplateListCache.getInstance().getCurrentVirtualReplaceTemplate(); if (currentVirtualReplaceTemplate != null && ComparatorUtils.equals(currentVirtualReplaceTemplate.getEditingFILE(), jt.getEditingFILE())) { + // 防止在打开了模板的情况下 去双击目录树对应的模板重复创建JTemplate currentVirtualReplaceTemplate.activeOldJTemplate(); return; } From 0b3aac756a2d086bd96c00a7d21d7fc337cffa48 Mon Sep 17 00:00:00 2001 From: hades Date: Thu, 4 Jun 2020 11:26:59 +0800 Subject: [PATCH 05/15] =?UTF-8?q?REPORT-33018=20=20fix=20=E6=B2=BF?= =?UTF-8?q?=E7=94=A8=E4=B9=8B=E5=89=8D=E7=9A=84=E6=96=B9=E6=A1=88=E9=80=BB?= =?UTF-8?q?=E8=BE=91=20=E9=98=B2=E6=AD=A2=E4=BA=A7=E7=94=9F=E5=81=87?= =?UTF-8?q?=E4=BF=9D=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/file/HistoryTemplateListCache.java | 37 ------------------- .../fr/design/mainframe/DesignerFrame.java | 19 ++++------ 2 files changed, 7 insertions(+), 49 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java b/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java index 4375693485..466e919b72 100644 --- a/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java +++ b/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java @@ -42,14 +42,6 @@ public class HistoryTemplateListCache implements CallbackEvent { private List> historyList; private JTemplate editingTemplate; - /** - * 当设计器打开的模板数大于模板缓存对象个数时,会产生JVirtualTemplate(个数=打开的总模板数 - 缓存模板数) - * 每次点击切换模板时,当切换到JVirtualTemplate,会创建真实的JTemplate,但是该JTemplate创建后不会释放掉,需要调用whenClose主动释放 - * 该变量对JVirtualTemplate创建真实的JTemplate管理 - */ - private JTemplate currentVirtualReplaceTemplate; - - public static HistoryTemplateListCache getInstance() { return Holder.INSTANCE; } @@ -120,14 +112,6 @@ public class HistoryTemplateListCache implements CallbackEvent { * @see DesignerFrameFileDealerPane#setCurrentEditingTemplate(JTemplate) */ public void setCurrentEditingTemplate(JTemplate jt) { - - // 模板之间切换 如果存在上次JVirtualTemplate创建的真实模板 需要在此关闭,并释放掉 - boolean canReleaseVirtualReplaceTemplate = this.currentVirtualReplaceTemplate != null && jt != null - && !ComparatorUtils.equals(this.currentVirtualReplaceTemplate.getEditingFILE(), jt.getEditingFILE()); - if (canReleaseVirtualReplaceTemplate) { - HistoryTemplateListCache.getInstance().releaseVirtualReplaceTemplate(); - } - this.editingTemplate = jt; //如果当前历史面板中没有 @@ -438,25 +422,4 @@ public class HistoryTemplateListCache implements CallbackEvent { jt.refreshResource(); } } - - - public void setCurrentVirtualReplaceTemplate(JTemplate currentVirtualReplaceTemplate) { - // 保证先释放 - releaseVirtualReplaceTemplate(); - this.currentVirtualReplaceTemplate = currentVirtualReplaceTemplate; - } - - public JTemplate getCurrentVirtualReplaceTemplate() { - return currentVirtualReplaceTemplate; - } - - /** - * 释放JVirtualTemplate创建的真实模板JTemplate - */ - private void releaseVirtualReplaceTemplate() { - if (this.currentVirtualReplaceTemplate != null) { - this.currentVirtualReplaceTemplate.whenClose(); - this.currentVirtualReplaceTemplate = null; - } - } } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java index 2cfd36687b..e52d4333fd 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java @@ -1101,19 +1101,20 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta */ private void openFile(FILE tplFile) { - boolean virtualTemplate = false; if (tplFile != null) { int index = HistoryTemplateListCache.getInstance().contains(tplFile); if (index != -1) { JTemplate jt = HistoryTemplateListCache.getInstance().getHistoryList().get(index); if (jt instanceof JVirtualTemplate) { - JTemplate currentVirtualReplaceTemplate = HistoryTemplateListCache.getInstance().getCurrentVirtualReplaceTemplate(); - if (currentVirtualReplaceTemplate != null && ComparatorUtils.equals(currentVirtualReplaceTemplate.getEditingFILE(), jt.getEditingFILE())) { - // 防止在打开了模板的情况下 去双击目录树对应的模板重复创建JTemplate - currentVirtualReplaceTemplate.activeOldJTemplate(); + // 如果是JVirtualTemplate 创建真实JTemplate + JTemplate realJTemplate = JTemplateFactory.createJTemplate(tplFile); + if (realJTemplate == null) { return; } - virtualTemplate = true; + // 由JVirtualTemplate激活真实JTemplate 本质在historyList中进行替换 + // 同时 realJTemplate被管理起来 不需要主动释放 关闭时会自动释放 + jt.activeJTemplate(index, realJTemplate); + return; } else { jt.activeOldJTemplate(); return; @@ -1125,12 +1126,6 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta if (jt == null) { return; } - - // 将JVirtualTemplate创建的真实模板管理起来 - if (virtualTemplate) { - HistoryTemplateListCache.getInstance().setCurrentVirtualReplaceTemplate(jt); - } - // 新的form不往前兼容 if (inValidDesigner(jt)) { this.addAndActivateJTemplate(); From e811e5846f888d2081ec5d1bc38b337fa0d31c39 Mon Sep 17 00:00:00 2001 From: "Henry.Wang" Date: Wed, 24 Jun 2020 15:04:58 +0800 Subject: [PATCH 06/15] =?UTF-8?q?REPORT-34127=20=E7=AD=9B=E9=80=89?= =?UTF-8?q?=E6=9D=A1=E4=BB=B6=EF=BC=8C=E6=94=B9=E4=BA=86=E5=90=8E=E9=9D=A2?= =?UTF-8?q?=E5=8D=95=E5=85=83=E6=A0=BC=E6=9D=A1=E4=BB=B6=E4=B9=8B=E5=90=8E?= =?UTF-8?q?=EF=BC=8C=E5=89=8D=E9=9D=A2=E5=8D=95=E5=85=83=E6=A0=BC=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E8=B7=9F=E7=9D=80=E4=BF=AE=E6=94=B9=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/grid/IntelliElements.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/grid/IntelliElements.java b/designer-realize/src/main/java/com/fr/grid/IntelliElements.java index 7c15b8629e..ca1ed55d8a 100644 --- a/designer-realize/src/main/java/com/fr/grid/IntelliElements.java +++ b/designer-realize/src/main/java/com/fr/grid/IntelliElements.java @@ -194,8 +194,12 @@ public class IntelliElements { TemplateCellElement newCellElement = new DefaultTemplateCellElement(colIndex, rowIndex); applyStyle(newCellElement, sourceCellElement);//style if (sourceCellElement.getValue() instanceof DSColumn) { - DSColumn dsColumn = (DSColumn) sourceCellElement.getValue(); - newCellElement.setValue(dsColumn); + try{ + DSColumn dsColumn = (DSColumn)((DSColumn) sourceCellElement.getValue()).clone(); + newCellElement.setValue(dsColumn); + }catch (CloneNotSupportedException e){ + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } newCellElement.setCellExpandAttr(sourceCellElement.getCellExpandAttr()); } else if (sourceCellElement.getValue() instanceof Number) { newCellElement.setValue(processNumber((Number) sourceCellElement.getValue())); From 151a8bb5ca78c66a0894f76223ba64458b5a38ce Mon Sep 17 00:00:00 2001 From: hades Date: Wed, 24 Jun 2020 15:34:13 +0800 Subject: [PATCH 07/15] =?UTF-8?q?REPORT-34222=20=E6=8A=A5=E8=A1=A8?= =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E5=99=A8=E7=BB=99=E5=AE=B9=E5=99=A8=E6=8F=92?= =?UTF-8?q?=E4=BB=B6=E5=BC=80=E4=B8=AA=E5=A4=8D=E5=88=B6=E7=B2=98=E8=B4=B4?= =?UTF-8?q?=E7=9A=84=E6=8E=A5=E5=8F=A3=20=E5=90=8C=E6=AD=A5=E5=88=B0final?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/fun/FormWidgetOptionProvider.java | 7 +++++ .../AbstractFormWidgetOptionProvider.java | 5 ++++ .../designer/beans/models/SelectionModel.java | 26 +++++++++++++++++++ 3 files changed, 38 insertions(+) diff --git a/designer-base/src/main/java/com/fr/design/fun/FormWidgetOptionProvider.java b/designer-base/src/main/java/com/fr/design/fun/FormWidgetOptionProvider.java index bfc32f4e9e..9f033d6dc6 100644 --- a/designer-base/src/main/java/com/fr/design/fun/FormWidgetOptionProvider.java +++ b/designer-base/src/main/java/com/fr/design/fun/FormWidgetOptionProvider.java @@ -16,4 +16,11 @@ public interface FormWidgetOptionProvider extends ParameterWidgetOptionProvider */ boolean isContainer(); + /** + * 如果是布局容器要实现粘贴到容器中的操作 + * @param t + * @param 泛型参数 表示选中的组件 一般为FormSelection + */ + void paste2Container(T t); + } \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/fun/impl/AbstractFormWidgetOptionProvider.java b/designer-base/src/main/java/com/fr/design/fun/impl/AbstractFormWidgetOptionProvider.java index 43cab95143..537a49d018 100644 --- a/designer-base/src/main/java/com/fr/design/fun/impl/AbstractFormWidgetOptionProvider.java +++ b/designer-base/src/main/java/com/fr/design/fun/impl/AbstractFormWidgetOptionProvider.java @@ -25,4 +25,9 @@ public abstract class AbstractFormWidgetOptionProvider extends AbstractProvider public boolean isContainer() { return false; } + + @Override + public void paste2Container(T t) { + // do nothing + } } \ No newline at end of file diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/models/SelectionModel.java b/designer-form/src/main/java/com/fr/design/designer/beans/models/SelectionModel.java index dd964e4ab5..9f5f36f660 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/models/SelectionModel.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/models/SelectionModel.java @@ -1,6 +1,7 @@ package com.fr.design.designer.beans.models; import com.fr.common.inputevent.InputEventBaseOnOS; +import com.fr.design.ExtraDesignClassManager; import com.fr.design.base.clipboard.ClipboardFilter; import com.fr.design.designer.beans.AdapterBus; import com.fr.design.designer.beans.LayoutAdapter; @@ -19,11 +20,13 @@ import com.fr.design.designer.creator.cardlayout.XWCardMainBorderLayout; import com.fr.design.designer.creator.cardlayout.XWTabFitLayout; import com.fr.design.form.util.FormDesignerUtils; import com.fr.design.form.util.XCreatorConstants; +import com.fr.design.fun.FormWidgetOptionProvider; import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.FormSelection; import com.fr.design.mainframe.FormSelectionUtils; import com.fr.design.utils.ComponentUtils; import com.fr.design.utils.gui.LayoutUtils; +import com.fr.general.ComparatorUtils; import com.fr.stable.ArrayUtils; import java.awt.LayoutManager; @@ -31,6 +34,7 @@ import java.awt.Rectangle; import java.awt.Toolkit; import java.awt.event.MouseEvent; import java.util.ArrayList; +import java.util.Set; /** * 该model保存当前选择的组件和剪切版信息 @@ -43,6 +47,7 @@ public class SelectionModel { private FormDesigner designer; private FormSelection selection; private Rectangle hotspotBounds; + private FormWidgetOptionProvider provider; public SelectionModel(FormDesigner designer) { this.designer = designer; @@ -256,9 +261,30 @@ public class SelectionModel { //绝对布局 Rectangle rec = selection.getSelctionBounds(); FormSelectionUtils.paste2Container(designer, container, clipboard, rec.x + DELTA_X_Y, rec.y + DELTA_X_Y); + } else if (isExtraContainer(container)) { + provider.paste2Container(selection); } } + + /** + * 扩展的容器布局 + * @param container + * @return + */ + private boolean isExtraContainer(XLayoutContainer container) { + if (container != null) { + Set set = ExtraDesignClassManager.getInstance().getArray(FormWidgetOptionProvider.XML_TAG); + for (FormWidgetOptionProvider provider : set) { + if (provider.isContainer() && ComparatorUtils.equals(provider.appearanceForWidget(), selection.getSelectedCreator().getParent().getClass())) { + this.provider = provider; + return true; + } + } + } + return false; + } + /** * 删除当前所有选择的组件 */ From 56c61a0c16bb17d1c6fd117014a5475614116b67 Mon Sep 17 00:00:00 2001 From: "Qinghui.Liu" Date: Thu, 25 Jun 2020 14:32:57 +0800 Subject: [PATCH 08/15] =?UTF-8?q?CHART-14399=20=E5=9D=90=E6=A0=87=E8=BD=B4?= =?UTF-8?q?=E5=88=87=E6=8D=A2=E7=B1=BB=E5=9E=8B=E6=97=B6=EF=BC=8C=E4=BF=9D?= =?UTF-8?q?=E7=95=99=E7=BD=91=E6=A0=BC=E7=BA=BF=E7=B1=BB=E5=9E=8B=E5=92=8C?= =?UTF-8?q?=E9=A2=9C=E8=89=B2=09=E5=90=8C=E6=AD=A5=E5=88=B0final?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../style/axis/VanChartAxisScrollPaneWithTypeSelect.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartAxisScrollPaneWithTypeSelect.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartAxisScrollPaneWithTypeSelect.java index 830bebf643..ef042e0f2a 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartAxisScrollPaneWithTypeSelect.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartAxisScrollPaneWithTypeSelect.java @@ -102,21 +102,21 @@ public class VanChartAxisScrollPaneWithTypeSelect extends AbstractVanChartScroll if(ComparatorUtils.equals(axis.getAxisType(), AxisType.AXIS_CATEGORY)){ textAxisPane.updateBean(axis); } else { - axis = new VanChartAxis(axis.getAxisName(), axis.getPosition(), axis.getGridLineType()); + axis = new VanChartAxis(axis.getAxisName(), axis.getPosition(), axis.getGridLineType(), axis.getMainGridColor()); textAxisPane.updateBean(axis); } } else if(ComparatorUtils.equals(index, AxisType.AXIS_TIME.ordinal())){ if(ComparatorUtils.equals(axis.getAxisType(), AxisType.AXIS_TIME)){ timeAxisPane.updateBean(axis); } else { - axis = new VanChartTimeAxis(axis.getAxisName(), axis.getPosition(), axis.getGridLineType()); + axis = new VanChartTimeAxis(axis.getAxisName(), axis.getPosition(), axis.getGridLineType(), axis.getMainGridColor()); timeAxisPane.updateBean(axis); } } else if(ComparatorUtils.equals(index, AxisType.AXIS_VALUE.ordinal())){ if(ComparatorUtils.equals(axis.getAxisType(), AxisType.AXIS_VALUE)){ valueAxisPane.updateBean(axis); } else { - axis = new VanChartValueAxis(axis.getAxisName(), axis.getPosition(), axis.getGridLineType()); + axis = new VanChartValueAxis(axis.getAxisName(), axis.getPosition(), axis.getGridLineType(), axis.getMainGridColor()); valueAxisPane.updateBean(axis); } } From ed82eca8c98c75ba507514b96385c2a9bd0b4a8b Mon Sep 17 00:00:00 2001 From: "Henry.Wang" Date: Sun, 28 Jun 2020 19:56:31 +0800 Subject: [PATCH 09/15] =?UTF-8?q?REPORT-33944=20=E9=A1=B5=E8=BE=B9?= =?UTF-8?q?=E8=B7=9D=E4=B8=BA0=EF=BC=8C=E8=AE=BE=E8=AE=A1=E5=99=A8?= =?UTF-8?q?=E8=99=9A=E7=BA=BF=E5=92=8C=E5=AE=9E=E9=99=85=E6=9C=891?= =?UTF-8?q?=E7=9A=84=E8=AF=AF=E5=B7=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/grid/GridUI.java | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/grid/GridUI.java b/designer-realize/src/main/java/com/fr/grid/GridUI.java index ff027af084..36b81ea686 100644 --- a/designer-realize/src/main/java/com/fr/grid/GridUI.java +++ b/designer-realize/src/main/java/com/fr/grid/GridUI.java @@ -315,7 +315,7 @@ public class GridUI extends ComponentUI { } protected void iterateStart2End(Graphics2D g2d) { - float tmpSize = 0, paperSumSize = 0, sumSize = 0; + double tmpSize = 0, paperSumSize = 0, sumSize = 0; for (int i = 0; i <= endIndex; i++) { // denny: 开始 if (i == 0) { @@ -323,7 +323,7 @@ public class GridUI extends ComponentUI { // denny: 增加从0到Grid左边被hide的列宽 for (int k = 0; k < startIndex; k++) { - tmpSize = sizeList.get(k).toPixF(resolution); + tmpSize = sizeList.get(k).toPixD(resolution); paperSumSize += tmpSize; if (paperSumSize >= paperPaintSize) { @@ -333,7 +333,7 @@ public class GridUI extends ComponentUI { } // adjust height. - tmpSize = sizeList.get(i).toPixF(resolution); + tmpSize = sizeList.get(i).toPixD(resolution); paperSumSize += tmpSize; if (showGridLine) {// paint line. @@ -342,7 +342,7 @@ public class GridUI extends ComponentUI { } // paint paper margin line. - if (showPaginateLine && paperSumSize >= paperPaintSize) { + if (showPaginateLine && (float)paperSumSize > (float) paperPaintSize) { paginateLineList.add(getPaginateLine2D((int) sumSize)); paperSumSize = tmpSize; } @@ -497,8 +497,8 @@ public class GridUI extends ComponentUI { paintCellElementRectangleList.add(this.tmpRectangle.clone()); - double cellWidth = this.tmpRectangle.getWidth(); - double cellHeight = this.tmpRectangle.getHeight(); + double cellWidth = this.tmpRectangle.getWidth(); + double cellHeight = this.tmpRectangle.getHeight(); // denny_Grid: 画Grid中单元格的内容(包括单元格的背景Content + Background), 不包括边框 painter.paintBackground(g2d, report, tmpCellElement, cellWidth - 1, cellHeight - 1); @@ -625,10 +625,10 @@ public class GridUI extends ComponentUI { tmpLine2D = (Line2D) paginateLineList.get(j);// 直接强制转换,因为List中肯定都是Line2D型的 for (int k = j + 1; k < paginateLineList.size(); k++) { tmpLine2D2 = (Line2D) paginateLineList.get(k); - if (AssistUtils.equals(tmpLine2D2.getX1() ,tmpLine2D.getX1()) - && AssistUtils.equals(tmpLine2D2.getX2() , tmpLine2D.getX2()) - && AssistUtils.equals(tmpLine2D2.getY1() , tmpLine2D.getY1()) - && AssistUtils.equals(tmpLine2D2.getY2() , tmpLine2D.getY2())) { + if (AssistUtils.equals(tmpLine2D2.getX1(), tmpLine2D.getX1()) + && AssistUtils.equals(tmpLine2D2.getX2(), tmpLine2D.getX2()) + && AssistUtils.equals(tmpLine2D2.getY1(), tmpLine2D.getY1()) + && AssistUtils.equals(tmpLine2D2.getY2(), tmpLine2D.getY2())) { paginateLineList.remove(k); } } From a6648211e945261b7273b109d1dc479efa7777a5 Mon Sep 17 00:00:00 2001 From: "Henry.Wang" Date: Mon, 29 Jun 2020 14:41:13 +0800 Subject: [PATCH 10/15] =?UTF-8?q?REPORT-33944=20=E5=A4=A7=E4=BA=8E?= =?UTF-8?q?=E5=85=81=E8=AE=B8=E7=9A=84=E7=B2=BE=E5=BA=A6=E4=B9=8B=E5=A4=96?= =?UTF-8?q?=E6=89=8D=E6=98=AF=E5=A4=A7=E4=BA=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer-realize/src/main/java/com/fr/grid/GridUI.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-realize/src/main/java/com/fr/grid/GridUI.java b/designer-realize/src/main/java/com/fr/grid/GridUI.java index 36b81ea686..3ca89fc016 100644 --- a/designer-realize/src/main/java/com/fr/grid/GridUI.java +++ b/designer-realize/src/main/java/com/fr/grid/GridUI.java @@ -342,7 +342,7 @@ public class GridUI extends ComponentUI { } // paint paper margin line. - if (showPaginateLine && (float)paperSumSize > (float) paperPaintSize) { + if (showPaginateLine && paperSumSize - paperPaintSize > 1.0E-7D) { paginateLineList.add(getPaginateLine2D((int) sumSize)); paperSumSize = tmpSize; } From c1d29e61697a5997eaadeb53751620158efe06be Mon Sep 17 00:00:00 2001 From: "Henry.Wang" Date: Mon, 29 Jun 2020 17:28:01 +0800 Subject: [PATCH 11/15] =?UTF-8?q?REPORT-33944=20=E6=94=B9=E4=B8=BA?= =?UTF-8?q?=E5=B8=B8=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer-realize/src/main/java/com/fr/grid/GridUI.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/grid/GridUI.java b/designer-realize/src/main/java/com/fr/grid/GridUI.java index 3ca89fc016..62927647aa 100644 --- a/designer-realize/src/main/java/com/fr/grid/GridUI.java +++ b/designer-realize/src/main/java/com/fr/grid/GridUI.java @@ -300,6 +300,8 @@ public class GridUI extends ComponentUI { private int resolution; + private static final double THRESHOLD = 1.0E-4D; + DrawLineHelper(int startIndex, int endIndex, boolean showGridLine, boolean showPaginateLine, DynamicUnitList sizeList, double paperPaintSize, List paginateLineList, int resolution) { @@ -315,7 +317,7 @@ public class GridUI extends ComponentUI { } protected void iterateStart2End(Graphics2D g2d) { - double tmpSize = 0, paperSumSize = 0, sumSize = 0; + float tmpSize = 0, paperSumSize = 0, sumSize = 0; for (int i = 0; i <= endIndex; i++) { // denny: 开始 if (i == 0) { @@ -323,7 +325,7 @@ public class GridUI extends ComponentUI { // denny: 增加从0到Grid左边被hide的列宽 for (int k = 0; k < startIndex; k++) { - tmpSize = sizeList.get(k).toPixD(resolution); + tmpSize = sizeList.get(k).toPixF(resolution); paperSumSize += tmpSize; if (paperSumSize >= paperPaintSize) { @@ -333,7 +335,7 @@ public class GridUI extends ComponentUI { } // adjust height. - tmpSize = sizeList.get(i).toPixD(resolution); + tmpSize = sizeList.get(i).toPixF(resolution); paperSumSize += tmpSize; if (showGridLine) {// paint line. @@ -342,7 +344,7 @@ public class GridUI extends ComponentUI { } // paint paper margin line. - if (showPaginateLine && paperSumSize - paperPaintSize > 1.0E-7D) { + if (showPaginateLine && paperSumSize - paperPaintSize > THRESHOLD) { paginateLineList.add(getPaginateLine2D((int) sumSize)); paperSumSize = tmpSize; } From 322f01e340a7c96b8a0667dfca75110fd2868d00 Mon Sep 17 00:00:00 2001 From: assassion <1536296691@qq.com> Date: Tue, 30 Jun 2020 14:26:13 +0800 Subject: [PATCH 12/15] =?UTF-8?q?REPORT-32520=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E8=AE=BE=E7=BD=AE=E8=B6=85=E8=BF=872000?= =?UTF-8?q?=E5=90=8E=E9=A2=84=E8=A7=88=E4=B8=8D=E8=83=BD=E6=AD=A3=E5=B8=B8?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E5=AE=BD=E5=92=8C=E9=AB=98=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/report/PageSetupPane.java | 32 ++++++++++++------- 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/report/PageSetupPane.java b/designer-realize/src/main/java/com/fr/design/report/PageSetupPane.java index 20beaa5643..591cd461a2 100644 --- a/designer-realize/src/main/java/com/fr/design/report/PageSetupPane.java +++ b/designer-realize/src/main/java/com/fr/design/report/PageSetupPane.java @@ -19,25 +19,20 @@ import java.awt.event.FocusEvent; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; -import javax.swing.BorderFactory; -import javax.swing.Box; -import javax.swing.ButtonGroup; -import javax.swing.Icon; +import javax.swing.*; +import com.fr.design.gui.ispinner.ColumnRowSpinner; import com.fr.page.PaperSettingProvider; import com.fr.page.ReportSettingsProvider; import com.fr.design.gui.frpane.UITabbedPane; import com.fr.design.gui.ibutton.UIRadioButton; import com.fr.design.gui.ilable.UILabel; -import javax.swing.JList; -import javax.swing.JPanel; -import javax.swing.JSpinner; -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.NumberFormatter; import com.fr.base.BaseUtils; import com.fr.base.Margin; @@ -212,6 +207,13 @@ public class PageSetupPane extends BasicPane { ((JSpinner.DefaultEditor) paperWidthSpinner.getEditor()).getTextField().setColumns(7); paperHeightSpinner = new UIBasicSpinner(new SpinnerNumberModel(0.0, 0.0, Double.MAX_VALUE, 1.0)); ((JSpinner.DefaultEditor) paperHeightSpinner.getEditor()).getTextField().setColumns(7); + + JFormattedTextField txt = ((JSpinner.NumberEditor) paperWidthSpinner.getEditor()).getTextField(); + ((NumberFormatter) txt.getFormatter()).setAllowsInvalid(false); + txt = ((JSpinner.NumberEditor) paperHeightSpinner.getEditor()).getTextField(); + ((NumberFormatter) txt.getFormatter()).setAllowsInvalid(false); + + unitLabel = new UnitFieldPane.UnitLabel(Constants.UNIT_MM, paperHeightSpinner.getPreferredSize().height); String[] inch = {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Unit_MM"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Unit_INCH")}; @@ -738,8 +740,8 @@ public class PageSetupPane extends BasicPane { return; } // 最大2000,以免画的时候超边 - this.paper_width = Math.min(paper_width, 2000); - this.paper_height = Math.min(paper_height, 2000); + this.paper_width = Math.min(paper_width, Double.MAX_VALUE); + this.paper_height = Math.min(paper_height, Double.MAX_VALUE); this.paper_orientation = paper_orientation; length_scale = !useLocale ? NUM_3 : NUM_POINT_3; } @@ -766,18 +768,24 @@ public class PageSetupPane extends BasicPane { FontMetrics fm = g2d.getFontMetrics(); // 横向的长度 String w_str = "" + paper_width; - if (w_str.indexOf(CoreConstants.DOT) > 0) { + if (!w_str.contains("E")&&w_str.indexOf(CoreConstants.DOT) > 0) { w_str = w_str.substring(0, w_str.indexOf(CoreConstants.DOT) + 2); } int w_length = fm.stringWidth(w_str); paint_width = Math.max(paint_width, w_length + 26); // 纵向的长度 String h_str = "" + paper_height; - if (h_str.indexOf(".") > 0) { + //使用科学计数法显示长度的时候,限制纵向显示长度为9位 + if (h_str.contains("E")){ + String str1=h_str.substring(h_str.indexOf("E")); + String str2=h_str.substring(0,9-str1.length()); + h_str = str2+str1; + }else if(h_str.indexOf(".") > 0) { h_str = h_str.substring(0, h_str.indexOf(".") + 2); } int h_length = fm.stringWidth(h_str); paint_height = Math.max(paint_height, h_length + 26); + paint_height = Math.min(paint_height, 75); double startX = (pane_width - paint_width) / 2; double startY = (pane_height - paint_height) / 2; g2d.translate(startX, startY); From 900d1f688382b3aaabfae034b44f250517136b66 Mon Sep 17 00:00:00 2001 From: "Yuan.Wang" <1536296691@qq.com> Date: Tue, 30 Jun 2020 15:19:47 +0800 Subject: [PATCH 13/15] =?UTF-8?q?REPORT-32520=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E8=A7=84=E8=8C=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/report/PageSetupPane.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/report/PageSetupPane.java b/designer-realize/src/main/java/com/fr/design/report/PageSetupPane.java index 591cd461a2..8dadbe7cc9 100644 --- a/designer-realize/src/main/java/com/fr/design/report/PageSetupPane.java +++ b/designer-realize/src/main/java/com/fr/design/report/PageSetupPane.java @@ -67,6 +67,7 @@ public class PageSetupPane extends BasicPane { private PagePane pagePane; private OtherPane otherPane; private UILabel zeroMarginWarn; + private static final String E = "E"; public PageSetupPane() { this.initComponents(); @@ -768,7 +769,7 @@ public class PageSetupPane extends BasicPane { FontMetrics fm = g2d.getFontMetrics(); // 横向的长度 String w_str = "" + paper_width; - if (!w_str.contains("E")&&w_str.indexOf(CoreConstants.DOT) > 0) { + if (!w_str.contains(E) && w_str.indexOf(CoreConstants.DOT) > 0) { w_str = w_str.substring(0, w_str.indexOf(CoreConstants.DOT) + 2); } int w_length = fm.stringWidth(w_str); @@ -776,16 +777,16 @@ public class PageSetupPane extends BasicPane { // 纵向的长度 String h_str = "" + paper_height; //使用科学计数法显示长度的时候,限制纵向显示长度为9位 - if (h_str.contains("E")){ - String str1=h_str.substring(h_str.indexOf("E")); + if (h_str.contains(E)){ + String str1=h_str.substring(h_str.indexOf(E)); String str2=h_str.substring(0,9-str1.length()); h_str = str2+str1; - }else if(h_str.indexOf(".") > 0) { - h_str = h_str.substring(0, h_str.indexOf(".") + 2); + }else if(h_str.indexOf(CoreConstants.DOT) > 0) { + h_str = h_str.substring(0, h_str.indexOf(CoreConstants.DOT) + 2); } int h_length = fm.stringWidth(h_str); paint_height = Math.max(paint_height, h_length + 26); - paint_height = Math.min(paint_height, 75); + paint_height = Math.min(paint_height, 74); double startX = (pane_width - paint_width) / 2; double startY = (pane_height - paint_height) / 2; g2d.translate(startX, startY); From 1f3781c3442bbc773acaa88f8fd7630ac98853e5 Mon Sep 17 00:00:00 2001 From: "Yuan.Wang" <1536296691@qq.com> Date: Tue, 30 Jun 2020 15:34:20 +0800 Subject: [PATCH 14/15] =?UTF-8?q?REPORT-32520=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E8=A7=84=E8=8C=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/report/PageSetupPane.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/report/PageSetupPane.java b/designer-realize/src/main/java/com/fr/design/report/PageSetupPane.java index 8dadbe7cc9..668700a95e 100644 --- a/designer-realize/src/main/java/com/fr/design/report/PageSetupPane.java +++ b/designer-realize/src/main/java/com/fr/design/report/PageSetupPane.java @@ -777,11 +777,11 @@ public class PageSetupPane extends BasicPane { // 纵向的长度 String h_str = "" + paper_height; //使用科学计数法显示长度的时候,限制纵向显示长度为9位 - if (h_str.contains(E)){ - String str1=h_str.substring(h_str.indexOf(E)); - String str2=h_str.substring(0,9-str1.length()); - h_str = str2+str1; - }else if(h_str.indexOf(CoreConstants.DOT) > 0) { + if (h_str.contains(E)) { + String str1 = h_str.substring(h_str.indexOf(E)); + String str2 = h_str.substring(0, 9 - str1.length()); + h_str = str2 + str1; + } else if (h_str.indexOf(CoreConstants.DOT) > 0) { h_str = h_str.substring(0, h_str.indexOf(CoreConstants.DOT) + 2); } int h_length = fm.stringWidth(h_str); @@ -790,7 +790,7 @@ public class PageSetupPane extends BasicPane { double startX = (pane_width - paint_width) / 2; double startY = (pane_height - paint_height) / 2; g2d.translate(startX, startY); - g2d = getG2d(paint_width, paint_height,g2d,w_str,h_str,w_length,h_length); + g2d = getG2d(paint_width, paint_height, g2d, w_str, h_str, w_length, h_length); if (paper_orientation == ReportConstants.PORTRAIT) { g2d.drawImage(img, (int) ((paint_width - img.getWidth(null)) / 2), (int) ((paint_height - img.getHeight(null)) / 2), null); From 7946d9ddfbe510883e2d75fdd750dfdc8cf7d360 Mon Sep 17 00:00:00 2001 From: hades Date: Thu, 2 Jul 2020 17:38:14 +0800 Subject: [PATCH 15/15] =?UTF-8?q?REPORT-32997=20=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=E5=88=97=E5=AE=BD=E4=BF=AE=E6=94=B9=E4=BD=86=E6=98=AF=E5=80=BC?= =?UTF-8?q?=E4=B8=8D=E5=8F=98=E5=87=BA=E7=8E=B0=E4=BA=86=E7=BC=A9=E8=BF=9B?= =?UTF-8?q?=20=E8=BD=AC=E4=B8=93=E4=BA=BA=E6=9C=8D=E5=8A=A1-Cafu?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../actions/columnrow/ColumnRowSizingAction.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/actions/columnrow/ColumnRowSizingAction.java b/designer-realize/src/main/java/com/fr/design/actions/columnrow/ColumnRowSizingAction.java index f7e86d2c03..0903323b80 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/columnrow/ColumnRowSizingAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/columnrow/ColumnRowSizingAction.java @@ -13,6 +13,7 @@ import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.mainframe.ElementCasePane; import com.fr.design.fun.ReportLengthUNITProvider; import com.fr.design.unit.UnitConvertUtil; +import com.fr.general.ComparatorUtils; import com.fr.grid.selection.CellSelection; import com.fr.report.elementcase.ElementCase; import com.fr.stable.ArrayUtils; @@ -39,8 +40,8 @@ public abstract class ColumnRowSizingAction extends AbstractColumnRowIndexAction return ColumnRowSizingAction.this.title4UnitInputPane(); } }; - UNIT len = getShowLen(report, cs); - populateNumberDialog(uPane, len); + final UNIT oldLen = getShowLen(report, cs); + populateNumberDialog(uPane, oldLen); final CellSelection finalCS = cs; uPane.showSmallWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { @@ -51,8 +52,10 @@ public abstract class ColumnRowSizingAction extends AbstractColumnRowIndexAction float newHeight = (float) uPane.update(); int unitType = DesignerEnvManager.getEnvManager().getReportLengthUnit(); ReportLengthUNITProvider lengthUNIT = UnitConvertUtil.parseLengthUNIT(unitType); - UNIT len = lengthUNIT.float2UNIT(newHeight); - updateAction(report, len, finalCS); + UNIT newLen = lengthUNIT.float2UNIT(newHeight); + if (!ComparatorUtils.equals(oldLen, newLen)) { + updateAction(report, newLen, finalCS); + } } catch (ValueNotChangeException e) { // nothing }