Browse Source

Pull request #1657: REPORT-31399 && REPORT-30691 新自适应-表单-web端展示-插件启用和禁用;【模板制作优化】@kerry,cpt模板添加图表时,发现没有记录

Merge in DESIGN/design from ~KERRY/design_10.0:release/10.0 to release/10.0

* commit '449969f7c38629707dddeddbe3b12edd79cce58f':
  代码修改
  REPORT-31267 &&  REPORT-31413 【模板制作优化】@kerry,决策报表制作自适应布局下,埋点的widget_count一开始显示1,后面加一个控件显示2
  REPORT-31399 && REPORT-30691 新自适应-表单-web端展示-插件启用和禁用;【模板制作优化】@kerry,cpt模板添加图表时,发现没有记录
feature/big-screen
kerry 5 years ago
parent
commit
2cc96eef3c
  1. 17
      designer-base/src/main/java/com/fr/design/mainframe/burying/point/AbstractPointCollector.java
  2. 17
      designer-base/src/main/java/com/fr/design/mainframe/chart/info/ChartInfoCollector.java
  3. 20
      designer-base/src/main/java/com/fr/design/mainframe/template/info/TemplateInfoCollector.java
  4. 4
      designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteLayout.java
  5. 2
      designer-form/src/main/java/com/fr/design/designer/creator/XWFitLayout.java
  6. 2
      designer-form/src/main/java/com/fr/design/mainframe/CoverReportPane.java
  7. 2
      designer-form/src/main/java/com/fr/design/mainframe/FormArea.java
  8. 19
      designer-form/src/main/java/com/fr/design/mainframe/template/info/ComponentOperate.java
  9. 23
      designer-form/src/main/java/com/fr/design/mainframe/template/info/JFormProcessInfo.java
  10. 15
      designer-form/src/test/java/com/fr/design/mainframe/template/info/ComponentCreateOperateTest.java
  11. 26
      designer-form/src/test/java/com/fr/design/mainframe/template/info/JFormProcessInfoTest.java
  12. 3
      designer-realize/src/main/java/com/fr/design/mainframe/template/info/JWorkBookProcessInfo.java

17
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.DesignerEnvManager;
import com.fr.design.mainframe.template.info.SendHelper; import com.fr.design.mainframe.template.info.SendHelper;
import com.fr.log.FineLoggerFactory; 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.XMLPrintWriter;
import com.fr.stable.xml.XMLTools; import com.fr.stable.xml.XMLTools;
import com.fr.stable.xml.XMLableReader; import com.fr.stable.xml.XMLableReader;
@ -121,10 +123,23 @@ public abstract class AbstractPointCollector<T extends AbstractPointInfo> implem
} }
} }
private File getInfoFile() {
File file = new File(StableUtils.pathJoin(ProductConstants.getEnvHome(), getInfoFilePath()));
try {
if (!file.exists()) {
StableUtils.makesureFileExist(file);
}
} catch (Exception ex) {
FineLoggerFactory.getLogger().error(ex.getMessage(), ex);
}
return file;
}
/** /**
* 获取缓存文件存放路径 * 获取缓存文件存放路径
*/ */
protected abstract File getInfoFile(); protected abstract String getInfoFilePath();
protected abstract void addIdleDayCount(); protected abstract void addIdleDayCount();
} }

17
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.TemplateInfo;
import com.fr.design.mainframe.template.info.TemplateProcessInfo; import com.fr.design.mainframe.template.info.TemplateProcessInfo;
import com.fr.general.ComparatorUtils; 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.StringUtils;
import com.fr.stable.xml.XMLPrintWriter; import com.fr.stable.xml.XMLPrintWriter;
import com.fr.stable.xml.XMLableReader; import com.fr.stable.xml.XMLableReader;
import com.fr.third.joda.time.DateTime; import com.fr.third.joda.time.DateTime;
import java.io.File;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
@ -235,16 +230,8 @@ public class ChartInfoCollector extends AbstractPointCollector<ChartInfo> {
* 获取缓存文件存放路径 * 获取缓存文件存放路径
*/ */
@Override @Override
protected File getInfoFile() { protected String getInfoFilePath() {
File file = new File(StableUtils.pathJoin(ProductConstants.getEnvHome(), XML_FILE_NAME)); return XML_FILE_NAME;
try {
if (!file.exists()) {
file.createNewFile();
}
} catch (Exception ex) {
FineLoggerFactory.getLogger().error(ex.getMessage(), ex);
}
return file;
} }
@Override @Override

20
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.JSON;
import com.fr.json.JSONFactory; import com.fr.json.JSONFactory;
import com.fr.json.JSONObject; import com.fr.json.JSONObject;
import com.fr.stable.ProductConstants;
import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.xml.XMLPrintWriter; import com.fr.stable.xml.XMLPrintWriter;
import com.fr.stable.xml.XMLableReader; import com.fr.stable.xml.XMLableReader;
import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -26,7 +23,7 @@ public class TemplateInfoCollector extends AbstractPointCollector<TemplateInfo>
private static final String XML_TEMPLATE_INFO_LIST = "TemplateInfoList"; private static final String XML_TEMPLATE_INFO_LIST = "TemplateInfoList";
private static final String XML_FILE_NAME = "tpl.info"; private static final String XML_FILE_NAME = "tpl.info";
private static TemplateInfoCollector instance; private static TemplateInfoCollector instance;
private DesignerOpenHistory designerOpenHistory; private DesignerOpenHistory designerOpenHistory = DesignerOpenHistory.getInstance();
//记录指定模板最新的模板耗时信息ID //记录指定模板最新的模板耗时信息ID
private Map<String, Long> latestTemplateInfo; private Map<String, Long> latestTemplateInfo;
@ -99,14 +96,6 @@ public class TemplateInfoCollector extends AbstractPointCollector<TemplateInfo>
return latestTemplateInfo.getTemplateCreateTime(); return latestTemplateInfo.getTemplateCreateTime();
} }
/**
* 获取缓存文件存放路径
*/
@Override
protected File getInfoFile() {
return new File(StableUtils.pathJoin(ProductConstants.getEnvHome(), XML_FILE_NAME));
}
/** /**
* 更新 day_count打开设计器却未编辑模板的连续日子 * 更新 day_count打开设计器却未编辑模板的连续日子
*/ */
@ -172,6 +161,13 @@ public class TemplateInfoCollector extends AbstractPointCollector<TemplateInfo>
writer.end(); writer.end();
} }
/**
* 获取缓存文件存放路径
*/
@Override
protected String getInfoFilePath() {
return XML_FILE_NAME;
}
@Override @Override
public void sendPointInfo() { public void sendPointInfo() {

4
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) { private void initPercent(WAbsoluteLayout widget) {
Toolkit toolkit = Toolkit.getDefaultToolkit(); Toolkit toolkit = Toolkit.getDefaultToolkit();
Dimension scrnsize = toolkit.getScreenSize(); Dimension scrnsize = toolkit.getScreenSize();
double screenValue = FRScreen.getByDimension(scrnsize).getValue(); double screenValue = FRScreen.getDesignScreenByDimension(scrnsize).getValue();
if (!AssistUtils.equals(screenValue, FormArea.DEFAULT_SLIDER)) { if (!AssistUtils.equals(screenValue, FormArea.DEFAULT_SLIDER)) {
this.setContainerPercent(screenValue / FormArea.DEFAULT_SLIDER); this.setContainerPercent(screenValue / FormArea.DEFAULT_SLIDER);
} }
@ -247,7 +247,7 @@ public class XWAbsoluteLayout extends XLayoutContainer {
*/ */
@Override @Override
public void updateChildBound(int minHeight) { 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)) { if (toData().getCompState() == 0 && !AssistUtils.equals(containerPercent, prevContainerPercent)) {
for (int i = 0; i < this.getComponentCount(); i++) { for (int i = 0; i < this.getComponentCount(); i++) {
XCreator creator = getXCreator(i); XCreator creator = getXCreator(i);

2
designer-form/src/main/java/com/fr/design/designer/creator/XWFitLayout.java

@ -72,7 +72,7 @@ public class XWFitLayout extends XLayoutContainer {
private void initPercent(){ private void initPercent(){
Toolkit toolkit = Toolkit.getDefaultToolkit(); Toolkit toolkit = Toolkit.getDefaultToolkit();
Dimension scrnsize = toolkit.getScreenSize(); Dimension scrnsize = toolkit.getScreenSize();
double screenValue = FRScreen.getByDimension(scrnsize).getValue(); double screenValue = FRScreen.getDesignScreenByDimension(scrnsize).getValue();
if (!AssistUtils.equals(FormArea.DEFAULT_SLIDER, screenValue)) { if (!AssistUtils.equals(FormArea.DEFAULT_SLIDER, screenValue)) {
this.setContainerPercent(screenValue / FormArea.DEFAULT_SLIDER); this.setContainerPercent(screenValue / FormArea.DEFAULT_SLIDER);
} }

2
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); // controlMode = IOUtils.readIcon(IconPathConstants.TD_EL_SHARE_CLOSE_ICON_PATH);
controlButton.setVisible(false); controlButton.setVisible(false);
helpDialog = new WidgetHelpDialog(DesignerContext.getDesignerFrame(), helpMsg); 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; int offsetX = 0;
if (screenValue < FormArea.DEFAULT_SLIDER) { if (screenValue < FormArea.DEFAULT_SLIDER) {
offsetX = (int) ((1 - screenValue / FormArea.DEFAULT_SLIDER) offsetX = (int) ((1 - screenValue / FormArea.DEFAULT_SLIDER)

2
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() { private void initCalculateSize() {
Toolkit toolkit = Toolkit.getDefaultToolkit(); Toolkit toolkit = Toolkit.getDefaultToolkit();
Dimension scrnsize = toolkit.getScreenSize(); Dimension scrnsize = toolkit.getScreenSize();
this.screenValue = FRScreen.getByDimension(scrnsize).getValue(); this.screenValue = FRScreen.getDesignScreenByDimension(scrnsize).getValue();
XLayoutContainer root = FormArea.this.designer.getRootComponent(); XLayoutContainer root = FormArea.this.designer.getRootComponent();
// 7.1.1不放缩放滑块,但表单大小仍按屏幕分辨率调整 // 7.1.1不放缩放滑块,但表单大小仍按屏幕分辨率调整
// slidePane.populateBean(screenValue); // slidePane.populateBean(screenValue);

19
designer-form/src/main/java/com/fr/design/mainframe/template/info/ComponentOperate.java

@ -1,10 +1,13 @@
package com.fr.design.mainframe.template.info; 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.ChartEditor;
import com.fr.form.ui.ElementCaseEditor; import com.fr.form.ui.ElementCaseEditor;
import com.fr.form.ui.Widget; 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.WAbsoluteLayout;
import com.fr.form.ui.container.WCardLayout; import com.fr.form.ui.container.WCardLayout;
import com.fr.general.ComparatorUtils;
import com.fr.json.JSONObject; import com.fr.json.JSONObject;
/** /**
@ -50,6 +53,11 @@ public abstract class ComponentOperate implements TemplateOperate {
Widget { Widget {
@Override @Override
protected boolean acceptType(Widget widget) { protected boolean acceptType(Widget widget) {
for (WidgetOption widgetOption : WidgetOption.getFormWidgetIntance()) {
if (ComparatorUtils.equals(widget.getClass(), widgetOption.widgetClass())) {
return true;
}
}
return false; return false;
} }
}, },
@ -62,7 +70,7 @@ public abstract class ComponentOperate implements TemplateOperate {
Absolute { Absolute {
@Override @Override
protected boolean acceptType(Widget widget) { 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; return Widget;
} }
public static boolean supportComponent(Widget widget) {
for (ComponentType componentType : values()) {
if (componentType.acceptType(widget)) {
return true;
}
}
return false;
}
} }
} }

23
designer-form/src/main/java/com/fr/design/mainframe/template/info/JFormProcessInfo.java

@ -1,6 +1,7 @@
package com.fr.design.mainframe.template.info; package com.fr.design.mainframe.template.info;
import com.fr.base.iofile.attr.ExtendSharableAttrMark; import com.fr.base.iofile.attr.ExtendSharableAttrMark;
import com.fr.chart.chartattr.ChartCollection; import com.fr.chart.chartattr.ChartCollection;
import com.fr.form.FormElementCaseProvider; import com.fr.form.FormElementCaseProvider;
import com.fr.form.main.Form; import com.fr.form.main.Form;
@ -21,6 +22,7 @@ import com.fr.report.cell.DefaultTemplateCellElement;
import java.util.Iterator; import java.util.Iterator;
import java.util.Map; import java.util.Map;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
@ -61,12 +63,21 @@ public class JFormProcessInfo extends TemplateProcessInfo<Form> {
// 获取模板控件数 // 获取模板控件数
public int getWidgetCount() { public int getWidgetCount() {
int widgetCount = 0; final AtomicInteger widgetCount = new AtomicInteger();
for (int i = 0; i < template.getContainer().getWidgetCount(); i++) { Form.traversalWidget(this.template.getContainer(), new WidgetGather() {
WLayout wl = (WLayout) template.getContainer().getWidget(i); @Override
widgetCount += wl.getWidgetCount(); public void dealWith(Widget widget) {
} if (ComponentOperate.ComponentType.supportComponent(widget)) {
return widgetCount; widgetCount.incrementAndGet();
}
}
@Override
public boolean dealWithAllCards() {
return true;
}
}, null);
return widgetCount.get();
} }
@Override @Override

15
designer-form/src/test/java/com/fr/design/mainframe/template/info/ComponentCreateOperateTest.java

@ -1,9 +1,12 @@
package com.fr.design.mainframe.template.info; 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.ChartEditor;
import com.fr.form.ui.ElementCaseEditor; import com.fr.form.ui.ElementCaseEditor;
import com.fr.form.ui.FreeButton; import com.fr.form.ui.FreeButton;
import com.fr.form.ui.Widget; 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.WAbsoluteLayout;
import com.fr.form.ui.container.WCardLayout; import com.fr.form.ui.container.WCardLayout;
import com.fr.json.JSONObject; 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.Absolute, ComponentOperate.ComponentType.parseType(new WAbsoluteLayout()));
Assert.assertEquals(ComponentOperate.ComponentType.TabLayout, ComponentOperate.ComponentType.parseType(new WCardLayout())); 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()));
}
} }

26
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.ChartEditor;
import com.fr.form.ui.ElementCaseEditor; import com.fr.form.ui.ElementCaseEditor;
import com.fr.form.ui.FreeButton; 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.WAbsoluteLayout;
import com.fr.form.ui.container.WBorderLayout; import com.fr.form.ui.container.WBorderLayout;
import com.fr.form.ui.container.WCardLayout; import com.fr.form.ui.container.WCardLayout;
@ -146,4 +147,29 @@ public class JFormProcessInfoTest {
ja = jFormProcessInfo.getComponentsInfo(); ja = jFormProcessInfo.getComponentsInfo();
Assert.assertEquals(0, ja.size()); 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());
}
} }

3
designer-realize/src/main/java/com/fr/design/mainframe/template/info/JWorkBookProcessInfo.java

@ -101,6 +101,9 @@ public class JWorkBookProcessInfo extends TemplateProcessInfo<WorkBook> {
for (int i = 0; i < columnLength; i++) { for (int i = 0; i < columnLength; i++) {
for (int j = 0; j < rowLength; j++) { for (int j = 0; j < rowLength; j++) {
TemplateCellElement templateCellElement = templateElementCase.getTemplateCellElement(i, j); TemplateCellElement templateCellElement = templateElementCase.getTemplateCellElement(i, j);
if (templateCellElement == null) {
continue;
}
Object value = templateCellElement.getValue(); Object value = templateCellElement.getValue();
if (isTestCell(value, templateCellElement.getStyle())) { if (isTestCell(value, templateCellElement.getStyle())) {
return true; return true;

Loading…
Cancel
Save