From 370ac70ae5b6b64789694d1f5c8619e8961ddaa9 Mon Sep 17 00:00:00 2001 From: hades Date: Thu, 6 Jan 2022 18:17:04 +0800 Subject: [PATCH 1/5] =?UTF-8?q?REPORT-61615=20=E8=AE=BE=E8=AE=A1=E5=99=A8?= =?UTF-8?q?=E6=9C=AA=E5=AE=89=E8=A3=85=E6=95=B0=E6=8D=AE=E9=9B=86/?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E8=BF=9E=E6=8E=A5=E6=8F=92=E4=BB=B6=20?= =?UTF-8?q?=E4=BD=86=E6=9C=8D=E5=8A=A1=E5=99=A8=E5=AE=89=E8=A3=85=E4=BA=86?= =?UTF-8?q?=20=E8=AE=BE=E8=AE=A1=E5=99=A8=E7=AB=AF=E4=BF=9D=E5=AD=98?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E9=9B=86/=E6=95=B0=E6=8D=AE=E8=BF=9E?= =?UTF-8?q?=E6=8E=A5=E4=BC=9A=E9=80=A0=E6=88=90=E8=BF=9E=E6=8E=A5=E4=B8=A2?= =?UTF-8?q?=E5=A4=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data/datapane/TableDataPaneListPane.java | 20 ++++++++++++++++++- .../datapane/connect/ConnectionListPane.java | 19 +++++++++++++++++- 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/TableDataPaneListPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/TableDataPaneListPane.java index 07d7abfb72..87e322b266 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/TableDataPaneListPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/TableDataPaneListPane.java @@ -17,9 +17,12 @@ import com.fr.event.EventDispatcher; import com.fr.file.ProcedureConfig; import com.fr.file.TableDataConfig; import com.fr.file.TableDataOperator; +import com.fr.file.TableDataOperatorImpl; import com.fr.general.ComparatorUtils; import com.fr.general.NameObject; import com.fr.log.FineLoggerFactory; +import com.fr.rpc.ExceptionHandler; +import com.fr.rpc.RPCInvokerExceptionInfo; import com.fr.stable.ArrayUtils; import com.fr.stable.Nameable; import com.fr.stable.StringUtils; @@ -246,7 +249,13 @@ public class TableDataPaneListPane extends JListControlPane implements TableData tableDataBeans.add(new TableDataBean(nameObject.getName(), oldName, (TableData) nameObject.getObject())); } try { - WorkContext.getCurrent().get(TableDataOperator.class).saveTableData(tableDataBeans); + WorkContext.getCurrent().get(TableDataOperator.class, new ExceptionHandler() { + @Override + public Object callHandler(RPCInvokerExceptionInfo exceptionInfo) { + // 走老的方式 + return saveByOldWay(tableDataBeans); + } + }).saveTableData(new ArrayList<>(tableDataConfig.getTableDatas().keySet()), tableDataBeans); if (!WorkContext.getCurrent().isLocal()) { EventDispatcher.fire(RemoteConfigEvent.EDIT, TableDataConfig.getInstance().getNameSpace()); } @@ -255,6 +264,15 @@ public class TableDataPaneListPane extends JListControlPane implements TableData } } + private boolean saveByOldWay(List tableDataBean) { + try { + return TableDataOperatorImpl.getInstance().saveTableData(tableDataBean); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + return false; + } + } + @Override public void update(TableDataSource tds) { tds.clearAllTableData(); diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java index 0c1967ef96..1566395edb 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java @@ -16,8 +16,11 @@ import com.fr.design.i18n.Toolkit; import com.fr.event.EventDispatcher; import com.fr.file.ConnectionConfig; import com.fr.file.ConnectionOperator; +import com.fr.file.ConnectionOperatorImpl; import com.fr.general.NameObject; import com.fr.log.FineLoggerFactory; +import com.fr.rpc.ExceptionHandler; +import com.fr.rpc.RPCInvokerExceptionInfo; import com.fr.stable.ArrayUtils; import com.fr.stable.Nameable; import com.fr.stable.StringUtils; @@ -170,7 +173,12 @@ public class ConnectionListPane extends JListControlPane implements ConnectionSh connectionBeans.add(new ConnectionBean(nameObject.getName(), oldName, (Connection) nameObject.getObject())); } try { - WorkContext.getCurrent().get(ConnectionOperator.class).saveConnection(connectionBeans); + WorkContext.getCurrent().get(ConnectionOperator.class, new ExceptionHandler() { + @Override + public Object callHandler(RPCInvokerExceptionInfo exceptionInfo) { + return saveByOldWay(connectionBeans); + } + }).saveConnection(new ArrayList<>(connectionConfig.getConnections().keySet()), connectionBeans); if (!WorkContext.getCurrent().isLocal()) { EventDispatcher.fire(RemoteConfigEvent.EDIT, ConnectionConfig.getInstance().getNameSpace()); } @@ -179,6 +187,15 @@ public class ConnectionListPane extends JListControlPane implements ConnectionSh } } + private boolean saveByOldWay(List connectionBeans) { + try { + return ConnectionOperatorImpl.getInstance().saveConnection(connectionBeans); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + return false; + } + } + public static void showDialog(Window parent) { final ConnectionConfig connectionConfig = ConnectionConfig.getInstance(); final ConnectionManagerPane connectionManagerPane = new ConnectionManagerPane() { From b28f91667833550fd852868c0d0a5c54148b16a9 Mon Sep 17 00:00:00 2001 From: Hoky <303455184@qq.com> Date: Fri, 7 Jan 2022 09:51:25 +0800 Subject: [PATCH 2/5] =?UTF-8?q?REPORT-65515=E3=80=90=E7=A8=B3=E5=AE=9A?= =?UTF-8?q?=E5=85=B1=E5=88=9B=E3=80=91=E5=85=AC=E5=BC=8F=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E5=99=A8-=E5=AD=98=E5=9C=A8=E6=8F=92=E4=BB=B6=E5=87=BD?= =?UTF-8?q?=E6=95=B0=E6=97=B6=EF=BC=8C=E9=80=89=E6=8B=A9=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E9=9B=86=E5=8F=82=E6=95=B0=E5=87=BD=E6=95=B0=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E8=B7=B3=E8=BD=AC=E6=98=BE=E7=A4=BA=E6=9C=89=E9=97=AE=E9=A2=98?= =?UTF-8?q?=201.=E9=80=89=E6=8B=A9=E5=8F=82=E6=95=B0=E7=9A=84=E6=97=B6?= =?UTF-8?q?=E5=80=99=E8=BF=94=E5=9B=9E=E9=BB=98=E8=AE=A4=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/design/formula/FormulaPane.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java b/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java index 904cdf00b0..a4354ee9d1 100644 --- a/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java +++ b/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java @@ -555,6 +555,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { private void fixFunctionNameList(String functionName) { int signOfContinue = 1; int indexOfFunction = 0; + boolean found = false; for (int i = 0; i < functionTypeListModel.size(); i++) { int signOfType = 0; FunctionGroup functionType = (FunctionGroup) functionTypeListModel.getElementAt(i); @@ -568,6 +569,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { signOfType = 1; signOfContinue = 0; indexOfFunction = k; + found = true; } } @@ -577,8 +579,12 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { } } } - functionNameList.setSelectedIndex(indexOfFunction); - functionNameList.ensureIndexIsVisible(indexOfFunction); + if (found) { + functionNameList.setSelectedIndex(indexOfFunction); + functionNameList.ensureIndexIsVisible(indexOfFunction); + } else { + functionTypeList.setSelectedIndex(0); + } } private int getBeginPosition() { From bb26dd08041630faea295b8535554341b9f26738 Mon Sep 17 00:00:00 2001 From: Starryi Date: Fri, 7 Jan 2022 10:35:45 +0800 Subject: [PATCH 3/5] =?UTF-8?q?REPORT-65576=20=E6=A1=86=E9=80=89=E5=8D=95?= =?UTF-8?q?=E5=85=83=E6=A0=BC=EF=BC=8C=E5=88=87=E6=8D=A2=E4=B8=BB=E9=A2=98?= =?UTF-8?q?=EF=BC=8C=E4=BC=9A=E5=BD=B1=E5=93=8D=E5=8D=95=E5=85=83=E6=A0=BC?= =?UTF-8?q?=E5=86=85=E5=AE=B9=E7=9A=84=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 格式面板从单元格样式面板中移除后,所以不能通过样式面板配置项修改格式。 这就要求修改样式面板中的设置项,产生新的样式对象,需要保留旧的样式对象中格式配置, 保证格式不变 【改动思路】 同上 --- .../fr/design/mainframe/cell/settingpane/CellStylePane.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellStylePane.java b/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellStylePane.java index ec3c1bd05c..3bdd034c68 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellStylePane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellStylePane.java @@ -11,7 +11,6 @@ import com.fr.design.mainframe.theme.utils.DefaultThemedTemplateCellElementCase; import com.fr.design.style.BorderUtils; import com.fr.design.utils.gui.AdjustWorkBookDefaultStyleUtils; import com.fr.design.utils.gui.GUICoreUtils; -import com.fr.report.cell.DefaultTemplateCellElement; import com.fr.report.cell.TemplateCellElement; import com.fr.report.elementcase.TemplateElementCase; @@ -20,7 +19,7 @@ import javax.swing.JPanel; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import java.awt.BorderLayout; -import java.awt.Rectangle; +import java.text.Format; /** * @author zhou @@ -118,7 +117,10 @@ public class CellStylePane extends AbstractCellAttrPane { AdjustWorkBookDefaultStyleUtils.adjustCellElement(cellElement); elementCase.addCellElement(cellElement); } + Format format = cellElement.getStyle().getFormat(); Style style = stylePane.updateBean(); + // 格式不能通过样式面板中的配置项修改,因此需要保留 + style = style.deriveFormat(format); cellElement.setStyle(style); } }); From 346bd67c91665b512379e25b50c1e9d1a05f25db Mon Sep 17 00:00:00 2001 From: Hoky <303455184@qq.com> Date: Fri, 7 Jan 2022 10:40:25 +0800 Subject: [PATCH 4/5] =?UTF-8?q?REPORT-65290=20=E8=AE=BE=E8=AE=A1=E5=99=A8-?= =?UTF-8?q?=E6=B0=B4=E5=8D=B0=EF=BC=8C=E5=B9=B3=E5=8F=B0=E6=94=B9=E5=8F=98?= =?UTF-8?q?=E6=B0=B4=E5=8D=B0=E5=BC=80=E5=85=B3=EF=BC=8C=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=E6=B0=B4=E5=8D=B0=E5=8F=98=E6=88=90=E4=BA=86=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=E5=8D=95=E7=8B=AC=E8=AE=BE=E7=BD=AE=201.=E5=88=A4=E6=96=AD?= =?UTF-8?q?=E6=B0=B4=E5=8D=B0=E7=9A=84=E6=9C=89=E6=95=88=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/report/WatermarkSettingPane.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/report/WatermarkSettingPane.java b/designer-base/src/main/java/com/fr/design/report/WatermarkSettingPane.java index e79bfcf6b8..f3de6eef96 100644 --- a/designer-base/src/main/java/com/fr/design/report/WatermarkSettingPane.java +++ b/designer-base/src/main/java/com/fr/design/report/WatermarkSettingPane.java @@ -34,6 +34,7 @@ public class WatermarkSettingPane extends AbstractTemplateServerSettingPane { @Override protected void populateServerSettings() { WatermarkAttr watermarkAttr = ReportUtils.getWatermarkAttrFromServerConfig(); + watermarkAttr.setValid(true); watermarkPane.populate(watermarkAttr); } @@ -55,8 +56,9 @@ public class WatermarkSettingPane extends AbstractTemplateServerSettingPane { public WatermarkAttr update() { WatermarkAttr watermark = watermarkPane.update(); - if (isUsingServerSettings()) { - watermark.setValid(false); + if (!isUsingServerSettings()) { + watermark.setValid(true); + watermark.setWaterMarkProvider(WaterMarkProvideConstant.TEMPLATE); } return watermark; } From 48d530678876a50dcd90f3970e0f73890893898d Mon Sep 17 00:00:00 2001 From: pengda Date: Fri, 7 Jan 2022 11:01:42 +0800 Subject: [PATCH 5/5] =?UTF-8?q?REPORT-65502=20=E3=80=90=E5=A4=96=E5=8C=85?= =?UTF-8?q?=E9=AA=8C=E6=94=B6=E3=80=91=E5=88=86=E9=A1=B5=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?-=E6=8C=89=E8=A1=8C=E5=88=86=E9=A1=B5=EF=BC=8C=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE=E8=B6=85=E8=BF=87500=E6=97=B6=E5=80=BC=E4=BC=9A?= =?UTF-8?q?=E4=BF=9D=E5=AD=98=E4=B8=BA=E7=A9=BA=E8=80=8C=E4=B8=8D=E6=98=AF?= =?UTF-8?q?1=E6=88=96500?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/webattr/PageToolBarPane.java | 17 ++++++++++------- .../fr/design/webattr/PageWebSettingPane.java | 17 ++++++++++------- 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/webattr/PageToolBarPane.java b/designer-realize/src/main/java/com/fr/design/webattr/PageToolBarPane.java index 48fb0c8ddb..783bc0e6a3 100644 --- a/designer-realize/src/main/java/com/fr/design/webattr/PageToolBarPane.java +++ b/designer-realize/src/main/java/com/fr/design/webattr/PageToolBarPane.java @@ -60,7 +60,7 @@ public class PageToolBarPane extends AbstractEditToolBarPane { private UICheckBox isPageFixedRowBox; private UITextField pageFixedRowCountTextField; private static final Color TIPS_FONT_COLOR = new Color(0x8f8f92); - private static final Pattern ROW_COUNT = Pattern.compile("^[1-9][\\d]{0,2}$"); + private static final Pattern ROW_COUNT = Pattern.compile("^[1-9][\\d]*$|^0"); //固定行数分页,每页最多500行,最少1行数据 private static final int MAX_ROW_COUNT = 500; @@ -275,18 +275,21 @@ public class PageToolBarPane extends AbstractEditToolBarPane { @Override public void keyReleased(KeyEvent e) { String rowCount = pageFixedRowCountTextField.getText(); - if (!isRowCountValid(rowCount)) { - pageFixedRowCountTextField.setText(StringUtils.EMPTY); - } + pageFixedRowCountTextField.setText(convert2ValidRowCount(rowCount)); } }; - private boolean isRowCountValid(String rowCount) { + private String convert2ValidRowCount(String rowCount) { Matcher matcher = ROW_COUNT.matcher(rowCount); if (matcher.find()) { int count = Integer.parseInt(matcher.group()); - return count >= MIN_ROW_COUNT && count <= MAX_ROW_COUNT; + if (count > MAX_ROW_COUNT) { + count = MAX_ROW_COUNT; + } else if (count < MIN_ROW_COUNT) { + count = MIN_ROW_COUNT; + } + return String.valueOf(count); } - return false; + return StringUtils.EMPTY; } } diff --git a/designer-realize/src/main/java/com/fr/design/webattr/PageWebSettingPane.java b/designer-realize/src/main/java/com/fr/design/webattr/PageWebSettingPane.java index 98890f6d8c..1a3d323e9f 100644 --- a/designer-realize/src/main/java/com/fr/design/webattr/PageWebSettingPane.java +++ b/designer-realize/src/main/java/com/fr/design/webattr/PageWebSettingPane.java @@ -41,7 +41,7 @@ public class PageWebSettingPane extends WebSettingPane { private UICheckBox isPageFixedRowBox; private UITextField pageFixedRowCountTextField; private static final Color TIPS_FONT_COLOR = new Color(0x8f8f92); - private static final Pattern ROW_COUNT = Pattern.compile("^[1-9][\\d]{0,2}$"); + private static final Pattern ROW_COUNT = Pattern.compile("^[1-9][\\d]*$|^0"); private static final String DEFAULT_ROW_COUNT = "30"; //固定行数分页,每页最多500行,最少1行数据 @@ -82,9 +82,7 @@ public class PageWebSettingPane extends WebSettingPane { @Override public void keyReleased(KeyEvent e) { String rowCount = pageFixedRowCountTextField.getText(); - if (!isRowCountValid(rowCount)) { - pageFixedRowCountTextField.setText(StringUtils.EMPTY); - } + pageFixedRowCountTextField.setText(convert2ValidRowCount(rowCount)); } }); pageFixedRowCountTextField.addInputMethodListener(new InputMethodListener() { @@ -207,12 +205,17 @@ public class PageWebSettingPane extends WebSettingPane { reportWebAttr.setWebPage(webContent); } - private boolean isRowCountValid(String rowCount) { + private String convert2ValidRowCount(String rowCount) { Matcher matcher = ROW_COUNT.matcher(rowCount); if (matcher.find()) { int count = Integer.parseInt(matcher.group()); - return count >= MIN_ROW_COUNT && count <= MAX_ROW_COUNT; + if (count > MAX_ROW_COUNT) { + count = MAX_ROW_COUNT; + } else if (count < MIN_ROW_COUNT) { + count = MIN_ROW_COUNT; + } + return String.valueOf(count); } - return false; + return StringUtils.EMPTY; } }