From 386446f865c490cae243d0ea8f12b7cd89d5cd18 Mon Sep 17 00:00:00 2001 From: kerry Date: Wed, 13 May 2020 10:11:21 +0800 Subject: [PATCH 1/3] =?UTF-8?q?REPORT-31399=20&&=20REPORT-30691=20?= =?UTF-8?q?=E6=96=B0=E8=87=AA=E9=80=82=E5=BA=94-=E8=A1=A8=E5=8D=95-web?= =?UTF-8?q?=E7=AB=AF=E5=B1=95=E7=A4=BA-=E6=8F=92=E4=BB=B6=E5=90=AF?= =?UTF-8?q?=E7=94=A8=E5=92=8C=E7=A6=81=E7=94=A8;=E3=80=90=E6=A8=A1?= =?UTF-8?q?=E6=9D=BF=E5=88=B6=E4=BD=9C=E4=BC=98=E5=8C=96=E3=80=91@kerry?= =?UTF-8?q?=EF=BC=8Ccpt=E6=A8=A1=E6=9D=BF=E6=B7=BB=E5=8A=A0=E5=9B=BE?= =?UTF-8?q?=E8=A1=A8=E6=97=B6=EF=BC=8C=E5=8F=91=E7=8E=B0=E6=B2=A1=E6=9C=89?= =?UTF-8?q?=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/designer/creator/XWAbsoluteLayout.java | 4 ++-- .../com/fr/design/designer/creator/XWFitLayout.java | 4 ++-- .../com/fr/design/mainframe/CoverReportPane.java | 2 +- .../main/java/com/fr/design/mainframe/FormArea.java | 2 +- .../template/info/JWorkBookProcessInfo.java | 13 ++++++++----- 5 files changed, 14 insertions(+), 11 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteLayout.java b/designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteLayout.java index 22d702dfd5..7c852f2820 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteLayout.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteLayout.java @@ -111,7 +111,7 @@ public class XWAbsoluteLayout extends XLayoutContainer { private void initPercent(WAbsoluteLayout widget) { Toolkit toolkit = Toolkit.getDefaultToolkit(); Dimension scrnsize = toolkit.getScreenSize(); - double screenValue = FRScreen.getByDimension(scrnsize).getValue(); + double screenValue = FRScreen.getDesignScreenByDimension(scrnsize).getValue(); if (!AssistUtils.equals(screenValue, FormArea.DEFAULT_SLIDER)) { this.setContainerPercent(screenValue / FormArea.DEFAULT_SLIDER); } @@ -247,7 +247,7 @@ public class XWAbsoluteLayout extends XLayoutContainer { */ @Override public void updateChildBound(int minHeight) { - double prevContainerPercent = FRScreen.getByDimension(toData().getDesigningResolution()).getValue() / FormArea.DEFAULT_SLIDER; + double prevContainerPercent = FRScreen.getDesignScreenByDimension(toData().getDesigningResolution()).getValue() / FormArea.DEFAULT_SLIDER; if (toData().getCompState() == 0 && !AssistUtils.equals(containerPercent, prevContainerPercent)) { for (int i = 0; i < this.getComponentCount(); i++) { XCreator creator = getXCreator(i); diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XWFitLayout.java b/designer-form/src/main/java/com/fr/design/designer/creator/XWFitLayout.java index 3fb0b5f969..352899bcbb 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XWFitLayout.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XWFitLayout.java @@ -72,7 +72,7 @@ public class XWFitLayout extends XLayoutContainer { private void initPercent(){ Toolkit toolkit = Toolkit.getDefaultToolkit(); Dimension scrnsize = toolkit.getScreenSize(); - double screenValue = FRScreen.getByDimension(scrnsize).getValue(); + double screenValue = FRScreen.getDesignScreenByDimension(scrnsize).getValue(); if (!AssistUtils.equals(FormArea.DEFAULT_SLIDER, screenValue)) { this.setContainerPercent(screenValue / FormArea.DEFAULT_SLIDER); } @@ -1331,4 +1331,4 @@ public class XWFitLayout extends XLayoutContainer { } } } -} \ No newline at end of file +} diff --git a/designer-form/src/main/java/com/fr/design/mainframe/CoverReportPane.java b/designer-form/src/main/java/com/fr/design/mainframe/CoverReportPane.java index a6ec28abb3..d976691c6e 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/CoverReportPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/CoverReportPane.java @@ -63,7 +63,7 @@ public class CoverReportPane extends CoverPane implements HelpDialogHandler{ // controlMode = IOUtils.readIcon(IconPathConstants.TD_EL_SHARE_CLOSE_ICON_PATH); controlButton.setVisible(false); helpDialog = new WidgetHelpDialog(DesignerContext.getDesignerFrame(), helpMsg); - double screenValue = FRScreen.getByDimension(Toolkit.getDefaultToolkit().getScreenSize()).getValue(); + double screenValue = FRScreen.getDesignScreenByDimension(Toolkit.getDefaultToolkit().getScreenSize()).getValue(); int offsetX = 0; if (screenValue < FormArea.DEFAULT_SLIDER) { offsetX = (int) ((1 - screenValue / FormArea.DEFAULT_SLIDER) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormArea.java b/designer-form/src/main/java/com/fr/design/mainframe/FormArea.java index ee1b1976cd..fe692388b9 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormArea.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormArea.java @@ -220,7 +220,7 @@ public class FormArea extends JComponent implements ScrollRulerComponent { private void initCalculateSize() { Toolkit toolkit = Toolkit.getDefaultToolkit(); Dimension scrnsize = toolkit.getScreenSize(); - this.screenValue = FRScreen.getByDimension(scrnsize).getValue(); + this.screenValue = FRScreen.getDesignScreenByDimension(scrnsize).getValue(); XLayoutContainer root = FormArea.this.designer.getRootComponent(); // 7.1.1不放缩放滑块,但表单大小仍按屏幕分辨率调整 // slidePane.populateBean(screenValue); diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/template/info/JWorkBookProcessInfo.java b/designer-realize/src/main/java/com/fr/design/mainframe/template/info/JWorkBookProcessInfo.java index 6f589b0011..c23a03f1c3 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/template/info/JWorkBookProcessInfo.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/template/info/JWorkBookProcessInfo.java @@ -101,6 +101,9 @@ public class JWorkBookProcessInfo extends TemplateProcessInfo { for (int i = 0; i < columnLength; i++) { for (int j = 0; j < rowLength; j++) { TemplateCellElement templateCellElement = templateElementCase.getTemplateCellElement(i, j); + if (templateCellElement == null) { + continue; + } Object value = templateCellElement.getValue(); if (isTestCell(value, templateCellElement.getStyle())) { return true; @@ -129,20 +132,20 @@ public class JWorkBookProcessInfo extends TemplateProcessInfo { } return parameterAttr.getParameterUI() != null; } - - + + @Override public JSONArray getComponentsInfo() { return new JSONArray(); } - + @Override public JSONArray getReuseCmpList() { return JSONArray.create(); } - + @Override public void updateTemplateOperationInfo(TemplateOperate templateOption) { - + } } From 4317149adfefa7475808b62fdcaf12b8f3b5bc4c Mon Sep 17 00:00:00 2001 From: kerry Date: Wed, 13 May 2020 15:20:33 +0800 Subject: [PATCH 2/3] =?UTF-8?q?REPORT-31267=20&&=20=20REPORT-31413=20?= =?UTF-8?q?=E3=80=90=E6=A8=A1=E6=9D=BF=E5=88=B6=E4=BD=9C=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E3=80=91@kerry=EF=BC=8C=E5=86=B3=E7=AD=96=E6=8A=A5=E8=A1=A8?= =?UTF-8?q?=E5=88=B6=E4=BD=9C=E8=87=AA=E9=80=82=E5=BA=94=E5=B8=83=E5=B1=80?= =?UTF-8?q?=E4=B8=8B=EF=BC=8C=E5=9F=8B=E7=82=B9=E7=9A=84widget=5Fcount?= =?UTF-8?q?=E4=B8=80=E5=BC=80=E5=A7=8B=E6=98=BE=E7=A4=BA1=EF=BC=8C?= =?UTF-8?q?=E5=90=8E=E9=9D=A2=E5=8A=A0=E4=B8=80=E4=B8=AA=E6=8E=A7=E4=BB=B6?= =?UTF-8?q?=E6=98=BE=E7=A4=BA2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../burying/point/AbstractPointCollector.java | 17 +++++++++- .../chart/info/ChartInfoCollector.java | 17 ++-------- .../template/info/TemplateInfoCollector.java | 20 +++++------- .../template/info/ComponentOperate.java | 19 ++++++++++- .../template/info/JFormProcessInfo.java | 32 ++++++++++++------- .../info/ComponentCreateOperateTest.java | 15 +++++++++ .../template/info/JFormProcessInfoTest.java | 26 +++++++++++++++ 7 files changed, 106 insertions(+), 40 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/burying/point/AbstractPointCollector.java b/designer-base/src/main/java/com/fr/design/mainframe/burying/point/AbstractPointCollector.java index a3665b77bd..d9ab7cf9bc 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/burying/point/AbstractPointCollector.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/burying/point/AbstractPointCollector.java @@ -5,6 +5,8 @@ import com.fr.base.io.XMLReadHelper; import com.fr.design.DesignerEnvManager; import com.fr.design.mainframe.template.info.SendHelper; import com.fr.log.FineLoggerFactory; +import com.fr.stable.ProductConstants; +import com.fr.stable.StableUtils; import com.fr.stable.xml.XMLPrintWriter; import com.fr.stable.xml.XMLTools; import com.fr.stable.xml.XMLableReader; @@ -121,10 +123,23 @@ public abstract class AbstractPointCollector implem } } + + private File getInfoFile() { + File file = new File(StableUtils.pathJoin(ProductConstants.getEnvHome(), getInfoFilePath())); + try { + if (!file.exists()) { + file.createNewFile(); + } + } catch (Exception ex) { + FineLoggerFactory.getLogger().error(ex.getMessage(), ex); + } + return file; + } + /** * 获取缓存文件存放路径 */ - protected abstract File getInfoFile(); + protected abstract String getInfoFilePath(); protected abstract void addIdleDayCount(); } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/chart/info/ChartInfoCollector.java b/designer-base/src/main/java/com/fr/design/mainframe/chart/info/ChartInfoCollector.java index 04c4c80d3c..87dc8ca40f 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/chart/info/ChartInfoCollector.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/chart/info/ChartInfoCollector.java @@ -8,15 +8,10 @@ import com.fr.design.mainframe.burying.point.AbstractPointCollector; import com.fr.design.mainframe.template.info.TemplateInfo; import com.fr.design.mainframe.template.info.TemplateProcessInfo; import com.fr.general.ComparatorUtils; -import com.fr.log.FineLoggerFactory; -import com.fr.stable.ProductConstants; -import com.fr.stable.StableUtils; import com.fr.stable.StringUtils; import com.fr.stable.xml.XMLPrintWriter; import com.fr.stable.xml.XMLableReader; import com.fr.third.joda.time.DateTime; - -import java.io.File; import java.util.HashMap; import java.util.Map; @@ -235,16 +230,8 @@ public class ChartInfoCollector extends AbstractPointCollector { * 获取缓存文件存放路径 */ @Override - protected File getInfoFile() { - File file = new File(StableUtils.pathJoin(ProductConstants.getEnvHome(), XML_FILE_NAME)); - try { - if (!file.exists()) { - file.createNewFile(); - } - } catch (Exception ex) { - FineLoggerFactory.getLogger().error(ex.getMessage(), ex); - } - return file; + protected String getInfoFilePath() { + return XML_FILE_NAME; } @Override diff --git a/designer-base/src/main/java/com/fr/design/mainframe/template/info/TemplateInfoCollector.java b/designer-base/src/main/java/com/fr/design/mainframe/template/info/TemplateInfoCollector.java index 42e7acce6b..23c07ea3a5 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/template/info/TemplateInfoCollector.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/template/info/TemplateInfoCollector.java @@ -5,13 +5,10 @@ import com.fr.design.mainframe.burying.point.AbstractPointInfo; import com.fr.json.JSON; import com.fr.json.JSONFactory; import com.fr.json.JSONObject; -import com.fr.stable.ProductConstants; -import com.fr.stable.StableUtils; import com.fr.stable.StringUtils; import com.fr.stable.xml.XMLPrintWriter; import com.fr.stable.xml.XMLableReader; -import java.io.File; import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -26,7 +23,7 @@ public class TemplateInfoCollector extends AbstractPointCollector private static final String XML_TEMPLATE_INFO_LIST = "TemplateInfoList"; private static final String XML_FILE_NAME = "tpl.info"; private static TemplateInfoCollector instance; - private DesignerOpenHistory designerOpenHistory; + private DesignerOpenHistory designerOpenHistory = DesignerOpenHistory.getInstance(); //记录指定模板最新的模板耗时信息ID private Map latestTemplateInfo; @@ -99,14 +96,6 @@ public class TemplateInfoCollector extends AbstractPointCollector return latestTemplateInfo.getTemplateCreateTime(); } - /** - * 获取缓存文件存放路径 - */ - @Override - protected File getInfoFile() { - return new File(StableUtils.pathJoin(ProductConstants.getEnvHome(), XML_FILE_NAME)); - } - /** * 更新 day_count:打开设计器却未编辑模板的连续日子 */ @@ -172,6 +161,13 @@ public class TemplateInfoCollector extends AbstractPointCollector writer.end(); } + /** + * 获取缓存文件存放路径 + */ + @Override + protected String getInfoFilePath() { + return XML_FILE_NAME; + } @Override public void sendPointInfo() { diff --git a/designer-form/src/main/java/com/fr/design/mainframe/template/info/ComponentOperate.java b/designer-form/src/main/java/com/fr/design/mainframe/template/info/ComponentOperate.java index 9ca2cdba92..d82bc16889 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/template/info/ComponentOperate.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/template/info/ComponentOperate.java @@ -1,10 +1,13 @@ package com.fr.design.mainframe.template.info; +import com.fr.design.gui.core.WidgetOption; import com.fr.form.ui.ChartEditor; import com.fr.form.ui.ElementCaseEditor; import com.fr.form.ui.Widget; +import com.fr.form.ui.container.WAbsoluteBodyLayout; import com.fr.form.ui.container.WAbsoluteLayout; import com.fr.form.ui.container.WCardLayout; +import com.fr.general.ComparatorUtils; import com.fr.json.JSONObject; /** @@ -50,6 +53,11 @@ public abstract class ComponentOperate implements TemplateOperate { Widget { @Override protected boolean acceptType(Widget widget) { + for (WidgetOption widgetOption : WidgetOption.getFormWidgetIntance()) { + if (ComparatorUtils.equals(widget.getClass(), widgetOption.widgetClass())) { + return true; + } + } return false; } }, @@ -62,7 +70,7 @@ public abstract class ComponentOperate implements TemplateOperate { Absolute { @Override protected boolean acceptType(Widget widget) { - return widget.acceptType(WAbsoluteLayout.class); + return widget.acceptType(WAbsoluteLayout.class) && !widget.acceptType(WAbsoluteBodyLayout.class); } }; @@ -76,5 +84,14 @@ public abstract class ComponentOperate implements TemplateOperate { } return Widget; } + + public static boolean supportComponent(Widget widget) { + for (ComponentType componentType : values()) { + if (componentType.acceptType(widget)) { + return true; + } + } + return false; + } } } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/template/info/JFormProcessInfo.java b/designer-form/src/main/java/com/fr/design/mainframe/template/info/JFormProcessInfo.java index da64e78e44..344bdab091 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/template/info/JFormProcessInfo.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/template/info/JFormProcessInfo.java @@ -1,6 +1,7 @@ package com.fr.design.mainframe.template.info; import com.fr.base.iofile.attr.ExtendSharableAttrMark; + import com.fr.chart.chartattr.ChartCollection; import com.fr.form.FormElementCaseProvider; import com.fr.form.main.Form; @@ -61,12 +62,21 @@ public class JFormProcessInfo extends TemplateProcessInfo
{ // 获取模板控件数 public int getWidgetCount() { - int widgetCount = 0; - for (int i = 0; i < template.getContainer().getWidgetCount(); i++) { - WLayout wl = (WLayout) template.getContainer().getWidget(i); - widgetCount += wl.getWidgetCount(); - } - return widgetCount; + final int[] widgetCount = {0}; + Form.traversalWidget(this.template.getContainer(), new WidgetGather() { + @Override + public void dealWith(Widget widget) { + if (ComponentOperate.ComponentType.supportComponent(widget)) { + widgetCount[0]++; + } + } + + @Override + public boolean dealWithAllCards() { + return true; + } + }, null); + return widgetCount[0]; } @Override @@ -167,7 +177,7 @@ public class JFormProcessInfo extends TemplateProcessInfo { public boolean useParaPane() { return this.template.getParaContainer() != null; } - + @Override public JSONArray getComponentsInfo() { JSONArray ja = new JSONArray(); @@ -177,10 +187,10 @@ public class JFormProcessInfo extends TemplateProcessInfo { this.componentProcessInfoMap.clear(); return ja; } - + @Override public JSONArray getReuseCmpList() { - + final JSONArray jo = JSONArray.create(); WLayout container = this.template.getContainer(); WidgetUtil.bfsTraversalWidget(container, new WidgetUtil.BfsWidgetGather() { @@ -197,7 +207,7 @@ public class JFormProcessInfo extends TemplateProcessInfo { }, AbstractBorderStyleWidget.class); return jo; } - + @Override public void updateTemplateOperationInfo(TemplateOperate templateOperate) { if (ComparatorUtils.equals(ComponentCreateOperate.OPERATE_TYPE, templateOperate.getOperateType())) { @@ -207,7 +217,7 @@ public class JFormProcessInfo extends TemplateProcessInfo { addComponentRemoveInfo(templateOperate.toJSONObject()); } } - + private void addComponentCreateInfo(JSONObject jsonObject) { String componentID = jsonObject.getString("componentID"); componentProcessInfoMap.put(componentID, jsonObject); diff --git a/designer-form/src/test/java/com/fr/design/mainframe/template/info/ComponentCreateOperateTest.java b/designer-form/src/test/java/com/fr/design/mainframe/template/info/ComponentCreateOperateTest.java index 1bebd0be77..2a6ec4ba6c 100644 --- a/designer-form/src/test/java/com/fr/design/mainframe/template/info/ComponentCreateOperateTest.java +++ b/designer-form/src/test/java/com/fr/design/mainframe/template/info/ComponentCreateOperateTest.java @@ -1,9 +1,12 @@ package com.fr.design.mainframe.template.info; +import com.fr.form.ui.CardAddButton; +import com.fr.form.ui.CardSwitchButton; import com.fr.form.ui.ChartEditor; import com.fr.form.ui.ElementCaseEditor; import com.fr.form.ui.FreeButton; import com.fr.form.ui.Widget; +import com.fr.form.ui.container.WAbsoluteBodyLayout; import com.fr.form.ui.container.WAbsoluteLayout; import com.fr.form.ui.container.WCardLayout; import com.fr.json.JSONObject; @@ -35,4 +38,16 @@ public class ComponentCreateOperateTest { Assert.assertEquals(ComponentOperate.ComponentType.Absolute, ComponentOperate.ComponentType.parseType(new WAbsoluteLayout())); Assert.assertEquals(ComponentOperate.ComponentType.TabLayout, ComponentOperate.ComponentType.parseType(new WCardLayout())); } + + @Test + public void testSupportComponent() { + Assert.assertTrue(ComponentOperate.ComponentType.supportComponent(new FreeButton())); + Assert.assertTrue(ComponentOperate.ComponentType.supportComponent(new ElementCaseEditor())); + Assert.assertTrue(ComponentOperate.ComponentType.supportComponent(new ChartEditor())); + Assert.assertTrue(ComponentOperate.ComponentType.supportComponent(new WAbsoluteLayout())); + Assert.assertTrue(ComponentOperate.ComponentType.supportComponent(new WCardLayout())); + Assert.assertFalse(ComponentOperate.ComponentType.supportComponent(new CardSwitchButton())); + Assert.assertFalse(ComponentOperate.ComponentType.supportComponent(new CardAddButton())); + Assert.assertFalse(ComponentOperate.ComponentType.supportComponent(new WAbsoluteBodyLayout())); + } } diff --git a/designer-form/src/test/java/com/fr/design/mainframe/template/info/JFormProcessInfoTest.java b/designer-form/src/test/java/com/fr/design/mainframe/template/info/JFormProcessInfoTest.java index 4db78a2711..2d25c64c9f 100644 --- a/designer-form/src/test/java/com/fr/design/mainframe/template/info/JFormProcessInfoTest.java +++ b/designer-form/src/test/java/com/fr/design/mainframe/template/info/JFormProcessInfoTest.java @@ -6,6 +6,7 @@ import com.fr.form.ui.CardSwitchButton; import com.fr.form.ui.ChartEditor; import com.fr.form.ui.ElementCaseEditor; import com.fr.form.ui.FreeButton; +import com.fr.form.ui.container.WAbsoluteBodyLayout; import com.fr.form.ui.container.WAbsoluteLayout; import com.fr.form.ui.container.WBorderLayout; import com.fr.form.ui.container.WCardLayout; @@ -146,4 +147,29 @@ public class JFormProcessInfoTest { ja = jFormProcessInfo.getComponentsInfo(); Assert.assertEquals(0, ja.size()); } + + @Test + public void testGetWidgetCount() { + Form form = new Form(); + WBorderLayout borderLayout = new WBorderLayout(); + form.setContainer(borderLayout); + WFitLayout fitLayout = new WFitLayout(); + borderLayout.addCenter(fitLayout); + fitLayout.addWidget(new FreeButton()); + fitLayout.addWidget(new ElementCaseEditor()); + JFormProcessInfo jFormProcessInfo = new JFormProcessInfo(form); + Assert.assertEquals(2, jFormProcessInfo.getWidgetCount()); + + fitLayout.addWidget(new ChartEditor()); + Assert.assertEquals(3, jFormProcessInfo.getWidgetCount()); + + fitLayout.addWidget(new WAbsoluteBodyLayout()); + Assert.assertEquals(3, jFormProcessInfo.getWidgetCount()); + + fitLayout.addWidget(new CardSwitchButton()); + Assert.assertEquals(3, jFormProcessInfo.getWidgetCount()); + + fitLayout.addWidget(new ChartEditor()); + Assert.assertEquals(4, jFormProcessInfo.getWidgetCount()); + } } From 449969f7c38629707dddeddbe3b12edd79cce58f Mon Sep 17 00:00:00 2001 From: kerry Date: Wed, 13 May 2020 17:28:05 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/burying/point/AbstractPointCollector.java | 2 +- .../design/mainframe/template/info/JFormProcessInfo.java | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/burying/point/AbstractPointCollector.java b/designer-base/src/main/java/com/fr/design/mainframe/burying/point/AbstractPointCollector.java index d9ab7cf9bc..15291211cb 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/burying/point/AbstractPointCollector.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/burying/point/AbstractPointCollector.java @@ -128,7 +128,7 @@ public abstract class AbstractPointCollector implem File file = new File(StableUtils.pathJoin(ProductConstants.getEnvHome(), getInfoFilePath())); try { if (!file.exists()) { - file.createNewFile(); + StableUtils.makesureFileExist(file); } } catch (Exception ex) { FineLoggerFactory.getLogger().error(ex.getMessage(), ex); diff --git a/designer-form/src/main/java/com/fr/design/mainframe/template/info/JFormProcessInfo.java b/designer-form/src/main/java/com/fr/design/mainframe/template/info/JFormProcessInfo.java index 344bdab091..c9f7d761ea 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/template/info/JFormProcessInfo.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/template/info/JFormProcessInfo.java @@ -22,6 +22,7 @@ import com.fr.report.cell.DefaultTemplateCellElement; import java.util.Iterator; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.atomic.AtomicInteger; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -62,12 +63,12 @@ public class JFormProcessInfo extends TemplateProcessInfo { // 获取模板控件数 public int getWidgetCount() { - final int[] widgetCount = {0}; + final AtomicInteger widgetCount = new AtomicInteger(); Form.traversalWidget(this.template.getContainer(), new WidgetGather() { @Override public void dealWith(Widget widget) { if (ComponentOperate.ComponentType.supportComponent(widget)) { - widgetCount[0]++; + widgetCount.incrementAndGet(); } } @@ -76,7 +77,7 @@ public class JFormProcessInfo extends TemplateProcessInfo { return true; } }, null); - return widgetCount[0]; + return widgetCount.get(); } @Override