From 80ea9bb8435ea1e6605afe1701cc8360f43186d0 Mon Sep 17 00:00:00 2001 From: "Henry.Wang" Date: Tue, 7 Jul 2020 11:09:10 +0800 Subject: [PATCH 01/34] =?UTF-8?q?REPORT-32427=20=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E6=93=8D=E4=BD=9C=E5=86=B3=E7=AD=96=E6=8A=A5=E8=A1=A8?= =?UTF-8?q?TAB=E5=9D=97=EF=BC=8C=E5=87=BA=E7=8E=B0=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../adapters/layout/FRFitLayoutAdapter.java | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java index f2156e861e..93da3d04cf 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java @@ -114,6 +114,15 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter { XCreator creator = (XCreator) container.getComponent(i); creator.updateChildBound(minHeight); creator.setBackupBound(creator.getBounds()); + //tab布局用到 + ArrayList childrenList = creator.getTargetChildrenList(); + for (int j = 0; j < childrenList.size(); j++) { + XWTabFitLayout tabLayout = (XWTabFitLayout) childrenList.get(j); + for (int m = 0; m < tabLayout.getComponentCount(); m++) { + XCreator childCreator = tabLayout.getXCreator(m); + childCreator.setBackupBound(childCreator.getBounds()); + } + } } } @@ -1039,15 +1048,22 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter { XWTabFitLayout tabLayout = (XWTabFitLayout) childrenList.get(j); tabLayout.setBackupBound(tabLayout.getBounds()); int refSize = isHor ? tabLayout.getWidth() : tabLayout.getHeight(); - double percent = (double) offset / refSize; + //double percent = (double) offset / refSize; + double percent = offset / (double) (refSize - offset); if (percent < 0 && !tabLayout.canReduce(percent)) { return; } - setAdjustedSize(tabLayout, offset, isHor); + //setAdjustedSize(tabLayout, offset, isHor); +// for (int m = 0; m < tabLayout.getComponentCount(); m++) { +// XCreator childCreator = tabLayout.getXCreator(m); +// WAbsoluteLayout.BoundsWidget wgt = (WAbsoluteLayout.BoundsWidget) tabLayout.toData().getBoundsWidget(childCreator.toData()); +// wgt.setBounds(tabLayout.getComponent(m).getBounds()); +// } for (int m = 0; m < tabLayout.getComponentCount(); m++) { XCreator childCreator = tabLayout.getXCreator(m); WAbsoluteLayout.BoundsWidget wgt = (WAbsoluteLayout.BoundsWidget) tabLayout.toData().getBoundsWidget(childCreator.toData()); - wgt.setBounds(tabLayout.getComponent(m).getBounds()); + wgt.setBounds(childCreator.getBackupBound()); + wgt.setBackupBounds(childCreator.getBackupBound()); } adjustCreatorsSize(percent, tabLayout, isHor); } From f02f80d88f1e6e7701b0be0f56b3d33aeb00836c Mon Sep 17 00:00:00 2001 From: "Henry.Wang" Date: Tue, 7 Jul 2020 11:27:17 +0800 Subject: [PATCH 02/34] =?UTF-8?q?REPORT-32427=20=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E6=93=8D=E4=BD=9C=E5=86=B3=E7=AD=96=E6=8A=A5=E8=A1=A8?= =?UTF-8?q?TAB=E5=9D=97=EF=BC=8C=E5=87=BA=E7=8E=B0=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../designer/beans/adapters/layout/FRFitLayoutAdapter.java | 7 ------- 1 file changed, 7 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java index 93da3d04cf..dfb4d94090 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java @@ -1048,17 +1048,10 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter { XWTabFitLayout tabLayout = (XWTabFitLayout) childrenList.get(j); tabLayout.setBackupBound(tabLayout.getBounds()); int refSize = isHor ? tabLayout.getWidth() : tabLayout.getHeight(); - //double percent = (double) offset / refSize; double percent = offset / (double) (refSize - offset); if (percent < 0 && !tabLayout.canReduce(percent)) { return; } - //setAdjustedSize(tabLayout, offset, isHor); -// for (int m = 0; m < tabLayout.getComponentCount(); m++) { -// XCreator childCreator = tabLayout.getXCreator(m); -// WAbsoluteLayout.BoundsWidget wgt = (WAbsoluteLayout.BoundsWidget) tabLayout.toData().getBoundsWidget(childCreator.toData()); -// wgt.setBounds(tabLayout.getComponent(m).getBounds()); -// } for (int m = 0; m < tabLayout.getComponentCount(); m++) { XCreator childCreator = tabLayout.getXCreator(m); WAbsoluteLayout.BoundsWidget wgt = (WAbsoluteLayout.BoundsWidget) tabLayout.toData().getBoundsWidget(childCreator.toData()); From 197cb420144c5ec4825ff66fb3b8663166670f9d Mon Sep 17 00:00:00 2001 From: hades Date: Wed, 8 Jul 2020 17:37:02 +0800 Subject: [PATCH 03/34] =?UTF-8?q?REPORT-34465=20=E9=A2=84=E8=A7=88?= =?UTF-8?q?=E8=A7=86=E5=9B=BE=E9=A1=B5=E9=9D=A2=E6=97=A0=E6=B3=95=E5=85=B3?= =?UTF-8?q?=E9=97=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../datapane/preview/PreviewTableModel.java | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewTableModel.java b/designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewTableModel.java index 575ba43f5b..46706cf591 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewTableModel.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewTableModel.java @@ -17,6 +17,10 @@ import javax.swing.table.AbstractTableModel; * 这个TableModel主要是预览数据的. 字段TableData必须转化为内置的 */ public class PreviewTableModel extends AbstractTableModel { + + private static final int LEN_LIMIT = 1000; + private static final String THREE_DOT = "..."; + private DataModel dataModel; private String erroMessage = null; @@ -127,11 +131,21 @@ public class PreviewTableModel extends AbstractTableModel { public Object getValueAt(int row, int column) { try { - return dataModel.getValueAt(row, column); + Object value = dataModel.getValueAt(row, column); + if (value != null) { + String strValue = value.toString(); + // 字符长度过长 swing会卡住一会 + // 同时设计器内预览展示也不需要展示太长的字符 + if (strValue.length() > LEN_LIMIT) { + strValue = strValue.substring(0, LEN_LIMIT) + THREE_DOT; + return strValue; + } + } + return value; } catch (TableDataException e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); DesignUtils.errorMessage(e.getMessage()); - return ""; + return StringUtils.EMPTY; } } From 1d6ebdaaaab3eaf5c0c46ce7828274dabbe65088 Mon Sep 17 00:00:00 2001 From: hades Date: Thu, 9 Jul 2020 13:52:45 +0800 Subject: [PATCH 04/34] =?UTF-8?q?REPORT-34962=20=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E9=9B=86=E4=B8=8D=E7=82=B9=E5=87=BB=E5=88=B7=E6=96=B0=E4=B9=9F?= =?UTF-8?q?=E8=83=BD=E6=98=BE=E7=A4=BA=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/data/tabledata/tabledatapane/DBTableDataPane.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java index 6ad281e268..6f0e89ff45 100644 --- a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java +++ b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java @@ -29,7 +29,6 @@ import com.fr.design.gui.itableeditorpane.UITableEditorPane; import com.fr.design.gui.itoolbar.UIToolbar; import com.fr.design.gui.syntax.ui.rsyntaxtextarea.SyntaxConstants; import com.fr.design.gui.syntax.ui.rtextarea.RTextScrollPane; -import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.DesignerContext; import com.fr.design.menu.SeparatorDef; import com.fr.design.menu.ToolBarDef; @@ -316,7 +315,8 @@ public class DBTableDataPane extends AbstractTableDataPane { // com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Connect_SQL_Cannot_Null") + "."); } } - + // 保存前 刷新下参数列表 保证获取到最新的参数 + refresh(); List parameterList = editorPane.update(); Parameter[] parameters = parameterList.toArray(new Parameter[parameterList.size()]); From a634abddfd7ccda7700ee84a0b1cbbd8ded4947d Mon Sep 17 00:00:00 2001 From: "Henry.Wang" Date: Thu, 9 Jul 2020 14:28:00 +0800 Subject: [PATCH 05/34] =?UTF-8?q?REPORT-31546=20=E5=85=AC=E5=BC=8F?= =?UTF-8?q?=E9=9D=A2=E6=9D=BF=E7=9A=84=E8=AF=B4=E6=98=8E=E5=88=87=E6=8D=A2?= =?UTF-8?q?=E5=81=B6=E5=B0=94=E4=BC=9A=E5=A4=B1=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/formula/FormulaPane.java | 97 ++++++++++++------- 1 file changed, 62 insertions(+), 35 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 9259248ac6..305b580d01 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 @@ -246,44 +246,71 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { } public class DoubleClick extends MouseAdapter { + String singlePressContent; + + String doublePressContent; + @Override - public void mouseClicked(MouseEvent e) { + public void mousePressed(MouseEvent e) { int index = tipsList.getSelectedIndex(); if (index != -1) { - String currentLineContent = (String) listModel.getElementAt(index); - if (e.getClickCount() == 2) { - if (ifHasBeenWriten == 0) { - formulaTextArea.setForeground(Color.black); - formulaTextArea.setText(""); + if (e.getClickCount() == 1) { + singlePressContent = (String) listModel.getElementAt(index); + } else if (e.getClickCount() == 2) { + doublePressContent = (String) listModel.getElementAt(index); + } + } + } + + @Override + public void mouseReleased(MouseEvent e) { + int index = tipsList.getSelectedIndex(); + if (index != -1) { + if (e.getClickCount() == 1) { + if (ComparatorUtils.equals((String) listModel.getElementAt(index), singlePressContent)) { + singleClickActuator(singlePressContent); } - formulaTextArea.setForeground(Color.black); - currentPosition = formulaTextArea.getCaretPosition(); - String output = currentLineContent + "()"; - String textAll = formulaTextArea.getText(); - String textReplaced; - int position = 0; - if (insertPosition <= currentPosition) { - textReplaced = textAll.substring(0, insertPosition) + output + textAll.substring(currentPosition); - position = insertPosition + output.length() - 1; - } else { - textReplaced = textAll.substring(0, currentPosition) + output + textAll.substring(insertPosition); - position = currentPosition + output.length() - 1; + } else if (e.getClickCount() == 2) { + if (ComparatorUtils.equals((String) listModel.getElementAt(index), doublePressContent)) { + doubleClickActuator(doublePressContent); } - formulaTextArea.setText(textReplaced); - formulaTextArea.requestFocusInWindow(); - formulaTextArea.setCaretPosition(position); - insertPosition = position; - ifHasBeenWriten = 1; - listModel.removeAllElements(); - } else if (e.getClickCount() == 1) { - refreshDescriptionTextArea(currentLineContent); - - formulaTextArea.requestFocusInWindow(); - fixFunctionNameList(); } } } + + private void singleClickActuator(String currentLineContent) { + refreshDescriptionTextArea(currentLineContent); + + formulaTextArea.requestFocusInWindow(); + fixFunctionNameList(); + } + + private void doubleClickActuator(String currentLineContent) { + if (ifHasBeenWriten == 0) { + formulaTextArea.setForeground(Color.black); + formulaTextArea.setText(""); + } + formulaTextArea.setForeground(Color.black); + currentPosition = formulaTextArea.getCaretPosition(); + String output = currentLineContent + "()"; + String textAll = formulaTextArea.getText(); + String textReplaced; + int position = 0; + if (insertPosition <= currentPosition) { + textReplaced = textAll.substring(0, insertPosition) + output + textAll.substring(currentPosition); + position = insertPosition + output.length() - 1; + } else { + textReplaced = textAll.substring(0, currentPosition) + output + textAll.substring(insertPosition); + position = currentPosition + output.length() - 1; + } + formulaTextArea.setText(textReplaced); + formulaTextArea.requestFocusInWindow(); + formulaTextArea.setCaretPosition(position); + insertPosition = position; + ifHasBeenWriten = 1; + listModel.removeAllElements(); + } } @Override @@ -583,10 +610,10 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { FineJOptionPane.showMessageDialog( FormulaPane.this, /* - * alex:仅仅只需要根据expression是否为null作合法性判断 - * 不需要eval - * TODO 但有个问题,有些函数的参数个数是有规定的,何以判别之 - */ + * alex:仅仅只需要根据expression是否为null作合法性判断 + * 不需要eval + * TODO 但有个问题,有些函数的参数个数是有规定的,何以判别之 + */ (expression != null ? com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Valid_Formula") : com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Invalid_Formula")) + ".", com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"), JOptionPane.INFORMATION_MESSAGE); @@ -780,13 +807,13 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { public void valueChanged(TreeSelectionEvent e) { DefaultMutableTreeNode selectedTreeNode = (DefaultMutableTreeNode) variablesTree.getLastSelectedPathComponent(); Object selectedValue = selectedTreeNode.getUserObject(); - Object selectedParentValue = ((DefaultMutableTreeNode)selectedTreeNode.getParent()).getUserObject(); + Object selectedParentValue = ((DefaultMutableTreeNode) selectedTreeNode.getParent()).getUserObject(); if (selectedValue == null) { return; } - if (selectedValue instanceof TextUserObject) { + if (selectedValue instanceof TextUserObject) { //有公式说明的条件:1.属于TextUserObject 2.parent是系统参数 if (ComparatorUtils.equals(((TextFolderUserObject) selectedParentValue).getText(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaPane_Variables"))) { From 5251ff115566fbd597a28f7f4b5115efa5042c4d Mon Sep 17 00:00:00 2001 From: hades Date: Fri, 10 Jul 2020 10:49:29 +0800 Subject: [PATCH 06/34] =?UTF-8?q?REPORT-34596=20=E8=BF=9C=E7=A8=8B?= =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E6=9C=8D=E5=8A=A1=E5=99=A8=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E9=9B=86=E5=AD=97=E6=AE=B5=E4=BF=AE=E6=94=B9=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/actions/server/GlobalTableDataAction.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/actions/server/GlobalTableDataAction.java b/designer-base/src/main/java/com/fr/design/actions/server/GlobalTableDataAction.java index 0e9db97c7a..627a862fb6 100644 --- a/designer-base/src/main/java/com/fr/design/actions/server/GlobalTableDataAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/server/GlobalTableDataAction.java @@ -5,7 +5,6 @@ package com.fr.design.actions.server; import com.fr.base.BaseUtils; import com.fr.base.TableData; -import com.fr.config.Configuration; import com.fr.design.DesignModelAdapter; import com.fr.design.actions.UpdateAction; import com.fr.design.data.DesignTableDataManager; @@ -18,12 +17,10 @@ import com.fr.design.gui.NameInspector; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerFrame; import com.fr.design.menu.MenuKeySet; -import com.fr.file.ProcedureConfig; import com.fr.file.TableDataConfig; import com.fr.transaction.CallBackAdaptor; import com.fr.transaction.Configurations; -import com.fr.transaction.Worker; import com.fr.transaction.WorkerFacade; import javax.swing.KeyStroke; @@ -95,6 +92,10 @@ public class GlobalTableDataAction extends UpdateAction implements ResponseDataS } DesignTableDataManager.clearGlobalDs(); + // 保存时 移除服务器数据集列名缓存 + for (String name : tableDataConfig.getTableDatas().keySet()) { + DesignTableDataManager.removeSelectedColumnNames(name); + } Configurations.modify(new WorkerFacade(TableDataConfig.class) { @Override From 79c961546ce0cfaea879d0408fce3b1a1c382a44 Mon Sep 17 00:00:00 2001 From: "Yuan.Wang" <1536296691@qq.com> Date: Tue, 14 Jul 2020 11:51:10 +0800 Subject: [PATCH 07/34] =?UTF-8?q?REPORT-33103=20=E5=90=88=E5=B9=B6?= =?UTF-8?q?=E5=8D=95=E5=85=83=E6=A0=BC=E6=97=B6=E5=B0=86=E7=94=A8=E6=9D=A5?= =?UTF-8?q?=E8=A6=86=E7=9B=96=E7=BD=91=E6=A0=BC=E7=9A=84=E7=9F=A9=E5=BD=A2?= =?UTF-8?q?=E7=9A=84height=E5=87=8F=E5=B0=8F0.5?= 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 62927647aa..5f5476511b 100644 --- a/designer-realize/src/main/java/com/fr/grid/GridUI.java +++ b/designer-realize/src/main/java/com/fr/grid/GridUI.java @@ -481,7 +481,7 @@ public class GridUI extends ComponentUI { // peter:tmpRectangle2D_3只是一个临时的Rectangle2D,由于后面不少地方需要用到这个矩形 this.cell_back_rect.setRect(0, 0, this.tmpRectangle.getWidth() - 1, - this.tmpRectangle.getHeight() - 1); + this.tmpRectangle.getHeight() - 1.5); // peter:对于合并的单元格,需要先白色的背景来清除背景. if (tmpCellElement.getColumnSpan() > 1 || tmpCellElement.getRowSpan() > 1) { // REPORT-23492 要看下是否设置了纸张背景 如果设置了按照背景来画 From 4ca1e7cdfb2eda26dfca0523018d0838863caa5d Mon Sep 17 00:00:00 2001 From: pengda Date: Wed, 15 Jul 2020 09:51:04 +0800 Subject: [PATCH 08/34] =?UTF-8?q?REPORT-34737=20=E7=BB=9D=E5=AF=B9?= =?UTF-8?q?=E7=94=BB=E5=B8=83=E4=B8=AD=E7=9A=84=E7=BB=84=E4=BB=B6=E5=8F=AF?= =?UTF-8?q?=E8=A7=86=E7=8A=B6=E6=80=81=E4=B8=8B=E7=A7=BB=E5=88=B0=E4=BE=A7?= =?UTF-8?q?=E8=BE=B9=E5=90=8E=E7=BB=84=E4=BB=B6=E7=A7=BB=E5=87=BA=E7=94=BB?= =?UTF-8?q?=E5=B8=83=E5=8F=AF=E8=A7=81=E5=8C=BA=E5=9F=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../layout/FRAbsoluteLayoutAdapter.java | 5 +- .../layout/FRAbsoluteLayoutAdapterTest.java | 46 +++++++++++++++++++ 2 files changed, 49 insertions(+), 2 deletions(-) create mode 100644 designer-form/src/test/java/com/fr/design/designer/beans/adapters/layout/FRAbsoluteLayoutAdapterTest.java diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRAbsoluteLayoutAdapter.java b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRAbsoluteLayoutAdapter.java index 4bc0f22e49..0c6adeb090 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRAbsoluteLayoutAdapter.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRAbsoluteLayoutAdapter.java @@ -310,14 +310,15 @@ public class FRAbsoluteLayoutAdapter extends FRBodyLayoutAdapter { public void fix(XCreator creator ,int x, int y) { int height = creator.getHeight(); int width = creator.getWidth(); + //坐标小于0时让它还在容器内 if (x < 0) { - x = container.getX(); + x = 0; } else if (x + creator.getWidth() > container.getWidth()) { x = container.getWidth() - width; } if (y < 0) { - y = container.getY(); + y = 0; } else if (y + creator.getHeight() > container.getHeight()) { y = container.getHeight() - height; } diff --git a/designer-form/src/test/java/com/fr/design/designer/beans/adapters/layout/FRAbsoluteLayoutAdapterTest.java b/designer-form/src/test/java/com/fr/design/designer/beans/adapters/layout/FRAbsoluteLayoutAdapterTest.java new file mode 100644 index 0000000000..4d378f6414 --- /dev/null +++ b/designer-form/src/test/java/com/fr/design/designer/beans/adapters/layout/FRAbsoluteLayoutAdapterTest.java @@ -0,0 +1,46 @@ +package com.fr.design.designer.beans.adapters.layout; + +import com.fr.config.dao.DaoContext; +import com.fr.config.dao.impl.LocalClassHelperDao; +import com.fr.config.dao.impl.LocalEntityDao; +import com.fr.config.dao.impl.LocalXmlEntityDao; +import com.fr.design.designer.creator.XButton; +import com.fr.design.designer.creator.XCreator; +import com.fr.design.designer.creator.XWAbsoluteLayout; +import com.fr.form.ui.Button; +import com.fr.form.ui.container.WAbsoluteLayout; +import java.awt.Dimension; +import junit.framework.TestCase; +import org.junit.Assert; + +public class FRAbsoluteLayoutAdapterTest extends TestCase { + @Override + protected void setUp() throws Exception { + DaoContext.setEntityDao(new LocalEntityDao()); + DaoContext.setClassHelperDao(new LocalClassHelperDao()); + DaoContext.setXmlEntityDao(new LocalXmlEntityDao()); + } + + public void testFix(){ + WAbsoluteLayout layout =new WAbsoluteLayout(); + XWAbsoluteLayout container =new XWAbsoluteLayout(layout); + container.setBounds(0,320,400,160); + FRAbsoluteLayoutAdapter frAbsoluteLayoutAdapter = new FRAbsoluteLayoutAdapter(container); + XCreator button = new XButton(new Button(),new Dimension(88,40)); + + frAbsoluteLayoutAdapter.fix(button,-1,-1); + Assert.assertEquals(0,button.getX()); + Assert.assertEquals(0,button.getY()); + + frAbsoluteLayoutAdapter.fix(button,350,200); + Assert.assertEquals(312,button.getX()); + Assert.assertEquals(120,button.getY()); + } + + @Override + protected void tearDown() throws Exception { + DaoContext.setEntityDao(null); + DaoContext.setClassHelperDao(null); + DaoContext.setXmlEntityDao(null); + } +} From 0cf0846a60f34a60221a6c7de9d22b90fef8068d Mon Sep 17 00:00:00 2001 From: "Henry.Wang" Date: Fri, 17 Jul 2020 10:22:48 +0800 Subject: [PATCH 09/34] =?UTF-8?q?REPORT-35259=20=E5=BD=93=E5=8F=82?= =?UTF-8?q?=E6=95=B0=E6=A0=8F=E5=8F=82=E6=95=B0=E8=BF=87=E5=A4=9A=E6=97=B6?= =?UTF-8?q?=E6=98=AF=E5=90=A6=E6=9C=89=E4=B8=8B=E6=8B=89=E6=A1=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer-form/src/main/java/com/fr/design/mainframe/JForm.java | 1 + .../java/com/fr/design/parameter/ParameterPropertyPane.java | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/JForm.java b/designer-form/src/main/java/com/fr/design/mainframe/JForm.java index 2fbccb1cd3..7cdd7fd600 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/JForm.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/JForm.java @@ -371,6 +371,7 @@ public class JForm extends JTemplate implements BaseJForm Date: Fri, 17 Jul 2020 10:34:34 +0800 Subject: [PATCH 10/34] =?UTF-8?q?REPORT-35259=20=E5=BD=93=E5=8F=82?= =?UTF-8?q?=E6=95=B0=E6=A0=8F=E5=8F=82=E6=95=B0=E8=BF=87=E5=A4=9A=E6=97=B6?= =?UTF-8?q?=E6=98=AF=E5=90=A6=E6=9C=89=E4=B8=8B=E6=8B=89=E6=A1=86=20?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=97=A0=E7=94=A8=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/formula/FormulaPane.java | 89 +++++++------------ 1 file changed, 31 insertions(+), 58 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 305b580d01..3631fe3dae 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 @@ -246,70 +246,43 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { } public class DoubleClick extends MouseAdapter { - String singlePressContent; - - String doublePressContent; - @Override - public void mousePressed(MouseEvent e) { + public void mouseClicked(MouseEvent e) { int index = tipsList.getSelectedIndex(); if (index != -1) { - if (e.getClickCount() == 1) { - singlePressContent = (String) listModel.getElementAt(index); - } else if (e.getClickCount() == 2) { - doublePressContent = (String) listModel.getElementAt(index); - } - } - } - - @Override - public void mouseReleased(MouseEvent e) { - int index = tipsList.getSelectedIndex(); - if (index != -1) { - if (e.getClickCount() == 1) { - if (ComparatorUtils.equals((String) listModel.getElementAt(index), singlePressContent)) { - singleClickActuator(singlePressContent); + String currentLineContent = (String) listModel.getElementAt(index); + if (e.getClickCount() == 2) { + if (ifHasBeenWriten == 0) { + formulaTextArea.setForeground(Color.black); + formulaTextArea.setText(""); } - } else if (e.getClickCount() == 2) { - if (ComparatorUtils.equals((String) listModel.getElementAt(index), doublePressContent)) { - doubleClickActuator(doublePressContent); + formulaTextArea.setForeground(Color.black); + currentPosition = formulaTextArea.getCaretPosition(); + String output = currentLineContent + "()"; + String textAll = formulaTextArea.getText(); + String textReplaced; + int position = 0; + if (insertPosition <= currentPosition) { + textReplaced = textAll.substring(0, insertPosition) + output + textAll.substring(currentPosition); + position = insertPosition + output.length() - 1; + } else { + textReplaced = textAll.substring(0, currentPosition) + output + textAll.substring(insertPosition); + position = currentPosition + output.length() - 1; } - } - } - } - - private void singleClickActuator(String currentLineContent) { - refreshDescriptionTextArea(currentLineContent); - - formulaTextArea.requestFocusInWindow(); - fixFunctionNameList(); - } + formulaTextArea.setText(textReplaced); + formulaTextArea.requestFocusInWindow(); + formulaTextArea.setCaretPosition(position); + insertPosition = position; + ifHasBeenWriten = 1; + listModel.removeAllElements(); + } else if (e.getClickCount() == 1) { + refreshDescriptionTextArea(currentLineContent); - private void doubleClickActuator(String currentLineContent) { - if (ifHasBeenWriten == 0) { - formulaTextArea.setForeground(Color.black); - formulaTextArea.setText(""); - } - formulaTextArea.setForeground(Color.black); - currentPosition = formulaTextArea.getCaretPosition(); - String output = currentLineContent + "()"; - String textAll = formulaTextArea.getText(); - String textReplaced; - int position = 0; - if (insertPosition <= currentPosition) { - textReplaced = textAll.substring(0, insertPosition) + output + textAll.substring(currentPosition); - position = insertPosition + output.length() - 1; - } else { - textReplaced = textAll.substring(0, currentPosition) + output + textAll.substring(insertPosition); - position = currentPosition + output.length() - 1; + formulaTextArea.requestFocusInWindow(); + fixFunctionNameList(); + } } - formulaTextArea.setText(textReplaced); - formulaTextArea.requestFocusInWindow(); - formulaTextArea.setCaretPosition(position); - insertPosition = position; - ifHasBeenWriten = 1; - listModel.removeAllElements(); } } @@ -807,13 +780,13 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { public void valueChanged(TreeSelectionEvent e) { DefaultMutableTreeNode selectedTreeNode = (DefaultMutableTreeNode) variablesTree.getLastSelectedPathComponent(); Object selectedValue = selectedTreeNode.getUserObject(); - Object selectedParentValue = ((DefaultMutableTreeNode) selectedTreeNode.getParent()).getUserObject(); + Object selectedParentValue = ((DefaultMutableTreeNode)selectedTreeNode.getParent()).getUserObject(); if (selectedValue == null) { return; } - if (selectedValue instanceof TextUserObject) { + if (selectedValue instanceof TextUserObject) { //有公式说明的条件:1.属于TextUserObject 2.parent是系统参数 if (ComparatorUtils.equals(((TextFolderUserObject) selectedParentValue).getText(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaPane_Variables"))) { From 4e743d189d7f352c97a31e60d973c81c6598825b Mon Sep 17 00:00:00 2001 From: "Henry.Wang" Date: Fri, 17 Jul 2020 10:37:58 +0800 Subject: [PATCH 11/34] =?UTF-8?q?REPORT-35259=20=E5=BD=93=E5=8F=82?= =?UTF-8?q?=E6=95=B0=E6=A0=8F=E5=8F=82=E6=95=B0=E8=BF=87=E5=A4=9A=E6=97=B6?= =?UTF-8?q?=E6=98=AF=E5=90=A6=E6=9C=89=E4=B8=8B=E6=8B=89=E6=A1=86=20?= =?UTF-8?q?=E8=B0=83=E6=95=B4=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/formula/FormulaPane.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 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 3631fe3dae..9259248ac6 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 @@ -583,10 +583,10 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { FineJOptionPane.showMessageDialog( FormulaPane.this, /* - * alex:仅仅只需要根据expression是否为null作合法性判断 - * 不需要eval - * TODO 但有个问题,有些函数的参数个数是有规定的,何以判别之 - */ + * alex:仅仅只需要根据expression是否为null作合法性判断 + * 不需要eval + * TODO 但有个问题,有些函数的参数个数是有规定的,何以判别之 + */ (expression != null ? com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Valid_Formula") : com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Invalid_Formula")) + ".", com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"), JOptionPane.INFORMATION_MESSAGE); From a6fcd2b1a5de05c2c5bf0d62a9ecc33b8481a0fa Mon Sep 17 00:00:00 2001 From: hades Date: Fri, 17 Jul 2020 11:35:24 +0800 Subject: [PATCH 12/34] =?UTF-8?q?REPORT-33194=20sql=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=AD=97=E6=AE=B5=E9=A2=84=E8=A7=88=E6=97=A0?= =?UTF-8?q?=E5=8F=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/actions/TableDataSourceAction.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/designer-base/src/main/java/com/fr/design/actions/TableDataSourceAction.java b/designer-base/src/main/java/com/fr/design/actions/TableDataSourceAction.java index 600f9721ed..a0ca4d9558 100644 --- a/designer-base/src/main/java/com/fr/design/actions/TableDataSourceAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/TableDataSourceAction.java @@ -15,6 +15,7 @@ import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.DialogActionAdapter; import java.util.HashMap; +import java.util.Iterator; import java.util.Map; /* @@ -51,6 +52,10 @@ public class TableDataSourceAction extends TemplateComponentAction iterator = tds.getTableDataNameIterator(); + while (iterator.hasNext()) { + DesignTableDataManager.removeSelectedColumnNames(iterator.next()); + } DesignModelAdapter.getCurrentModelAdapter().renameTableData(tableDataPane.getDsNameChangedMap()); tableDataPane.update(tds); TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()); From ca81c1854a569157135f9538f747ead3bdc72193 Mon Sep 17 00:00:00 2001 From: "Yuan.Wang" <1536296691@qq.com> Date: Fri, 24 Jul 2020 15:38:26 +0800 Subject: [PATCH 13/34] =?UTF-8?q?REPORT-30352=20=E5=9C=A8=E6=96=87?= =?UTF-8?q?=E6=9C=AC=E5=9F=9F=E7=9A=84init=E6=96=B9=E6=B3=95=E9=87=8C?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0setMargin()?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/gui/syntax/ui/rtextarea/RTextAreaBase.java | 1 + 1 file changed, 1 insertion(+) diff --git a/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rtextarea/RTextAreaBase.java b/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rtextarea/RTextAreaBase.java index 01c9238c66..50bec254fd 100644 --- a/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rtextarea/RTextAreaBase.java +++ b/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rtextarea/RTextAreaBase.java @@ -645,6 +645,7 @@ int currentCaretY; // Used to know when to rehighlight current line. setTabsEmulated(false); // Stuff needed by the caret listener below. + setMargin(getInsets()); previousCaretY = currentCaretY = getInsets().top; // Stuff to highlight the current line. From 504e171e1069a15e00072e259ea77aa845109a4a Mon Sep 17 00:00:00 2001 From: "Yuan.Wang" <1536296691@qq.com> Date: Fri, 31 Jul 2020 17:43:52 +0800 Subject: [PATCH 14/34] =?UTF-8?q?REPORT-30352=20=E7=9B=B4=E6=8E=A5?= =?UTF-8?q?=E5=B0=86RTextAreaBase=E7=9A=84border=E7=9A=84=E5=80=BC?= =?UTF-8?q?=E6=94=B9=E4=B8=BA0=EF=BC=8C=E4=BB=A5=E5=92=8C8.0=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E5=A4=96=E8=A7=82=E4=BF=9D=E6=8C=81=E4=B8=80=E8=87=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/gui/syntax/ui/rtextarea/RTextAreaBase.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rtextarea/RTextAreaBase.java b/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rtextarea/RTextAreaBase.java index 50bec254fd..708888dba6 100644 --- a/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rtextarea/RTextAreaBase.java +++ b/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rtextarea/RTextAreaBase.java @@ -22,9 +22,11 @@ import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.awt.event.MouseMotionListener; import javax.swing.JTextArea; +import javax.swing.border.EmptyBorder; import javax.swing.event.CaretEvent; import javax.swing.plaf.ColorUIResource; import javax.swing.plaf.TextUI; +import javax.swing.plaf.basic.BasicBorders; import javax.swing.text.AbstractDocument; import javax.swing.text.BadLocationException; import javax.swing.text.Caret; @@ -645,7 +647,7 @@ int currentCaretY; // Used to know when to rehighlight current line. setTabsEmulated(false); // Stuff needed by the caret listener below. - setMargin(getInsets()); + setBorder(new BasicBorders.MarginBorder()); previousCaretY = currentCaretY = getInsets().top; // Stuff to highlight the current line. From af1a3184ca257795f1acad72f411820a15aab963 Mon Sep 17 00:00:00 2001 From: "Yuan.Wang" <1536296691@qq.com> Date: Fri, 31 Jul 2020 17:46:09 +0800 Subject: [PATCH 15/34] =?UTF-8?q?REPORT-30352=20=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E4=B8=8D=E9=9C=80=E8=A6=81=E7=9A=84import?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/gui/syntax/ui/rtextarea/RTextAreaBase.java | 1 - 1 file changed, 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rtextarea/RTextAreaBase.java b/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rtextarea/RTextAreaBase.java index 708888dba6..985a9527fa 100644 --- a/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rtextarea/RTextAreaBase.java +++ b/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rtextarea/RTextAreaBase.java @@ -22,7 +22,6 @@ import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.awt.event.MouseMotionListener; import javax.swing.JTextArea; -import javax.swing.border.EmptyBorder; import javax.swing.event.CaretEvent; import javax.swing.plaf.ColorUIResource; import javax.swing.plaf.TextUI; From 91fa55de6f802b33bbd10afd5e68dd76f8891d3e Mon Sep 17 00:00:00 2001 From: Harrison Date: Mon, 3 Aug 2020 18:03:06 +0800 Subject: [PATCH 16/34] =?UTF-8?q?REPORT-24268=20=E5=A2=9E=E5=BC=BA?= =?UTF-8?q?=E5=85=AC=E5=BC=8F=E7=BC=96=E8=BE=91=E5=99=A8=E6=8F=92=E4=BB=B6?= =?UTF-8?q?=E9=97=AE=E9=A2=98=20[reason]=20=E7=94=B1=E4=BA=8E=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E9=9B=86=E7=9B=B8=E5=85=B3=E6=B2=A1=E6=9C=89=E4=BF=9D?= =?UTF-8?q?=E5=AD=98=E5=85=AC=E5=BC=8F=E7=9A=84=E5=85=B7=E4=BD=93=E7=B1=BB?= =?UTF-8?q?,=E5=AF=BC=E8=87=B4=E9=87=8D=E6=96=B0=E6=89=93=E5=BC=80?= =?UTF-8?q?=E6=97=B6=EF=BC=8C=20=E9=83=BD=E6=98=AF=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E7=9A=84=E5=85=AC=E5=BC=8F=E5=BD=A2=E6=80=81=E3=80=82=20[solut?= =?UTF-8?q?ion]=20=E7=9B=B4=E6=8E=A5=E4=BF=9D=E5=AD=98=E5=85=AC=E5=BC=8F?= =?UTF-8?q?=E5=BD=A2=E6=80=81=EF=BC=8C=E8=80=8C=E4=B8=8D=E6=98=AF=E5=AD=97?= =?UTF-8?q?=E7=AC=A6=E4=B8=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/formula/FormulaTextField.java | 63 +++++++++++++++ .../fr/design/formula/SortFormulaPane.java | 25 +++--- .../gui/itextfield/DictionaryTextField.java | 41 ++++++++++ .../design/dscolumn/DSColumnAdvancedPane.java | 80 +++++++++++-------- .../cellquick/CellDSColumnEditor.java | 64 ++++++++------- 5 files changed, 199 insertions(+), 74 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/formula/FormulaTextField.java create mode 100644 designer-base/src/main/java/com/fr/design/gui/itextfield/DictionaryTextField.java diff --git a/designer-base/src/main/java/com/fr/design/formula/FormulaTextField.java b/designer-base/src/main/java/com/fr/design/formula/FormulaTextField.java new file mode 100644 index 0000000000..e142662783 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/formula/FormulaTextField.java @@ -0,0 +1,63 @@ +package com.fr.design.formula; + +import com.fr.base.BaseFormula; +import com.fr.design.gui.itextfield.DictionaryTextField; +import com.fr.stable.StringUtils; + +import javax.swing.text.Document; + +/** + * created by Harrison on 2020/08/03 + **/ +public class FormulaTextField extends DictionaryTextField { + + private static final BaseFormula EMPTY_FORMULA = BaseFormula.createFormulaBuilder().build("="); + + public FormulaTextField() { + } + + public FormulaTextField(int columns) { + super(columns); + } + + public FormulaTextField(String text, int columns, BaseFormula value) { + super(text, columns, value); + } + + public FormulaTextField(String text, BaseFormula value) { + super(text, value); + } + + public FormulaTextField(Document doc, String text, int columns, BaseFormula value) { + super(doc, text, columns, value); + } + + @Override + public BaseFormula getValue() { + + if (this.value == null) { + this.value = createDefault(); + } + return this.value; + } + + @Override + public void setValue(BaseFormula value) { + + this.value = value; + if (this.value == null) { + this.value = createDefault(); + } + setText(this.value.getPureContent()); + } + + private BaseFormula createDefault() { + + String text = getText(); + if (StringUtils.isNotEmpty(text)) { + return BaseFormula.createFormulaBuilder().build(text); + } else { + return EMPTY_FORMULA; + } + } +} diff --git a/designer-base/src/main/java/com/fr/design/formula/SortFormulaPane.java b/designer-base/src/main/java/com/fr/design/formula/SortFormulaPane.java index 222aa90fec..4d598a7e25 100644 --- a/designer-base/src/main/java/com/fr/design/formula/SortFormulaPane.java +++ b/designer-base/src/main/java/com/fr/design/formula/SortFormulaPane.java @@ -7,12 +7,13 @@ import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.icombobox.SortOrderComboBox; import com.fr.design.gui.ilable.UILabel; -import com.fr.design.gui.itextfield.UITextField; import com.fr.design.utils.gui.GUICoreUtils; - -import javax.swing.*; -import java.awt.*; +import javax.swing.JComponent; +import javax.swing.JPanel; +import javax.swing.SwingUtilities; +import java.awt.Dimension; +import java.awt.FlowLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -20,7 +21,7 @@ public abstract class SortFormulaPane extends JPanel { protected static final String InsetText = " "; protected SortOrderComboBox sortOrderComboBox; - protected UITextField sortFormulaTextField; + protected FormulaTextField sortFormulaTextField; // 屏蔽掉“自定义比较规则”和“选择”按钮,只显示公式输入文本和公式按钮 protected UIButton sortFormulaTextFieldButton; @@ -35,7 +36,7 @@ public abstract class SortFormulaPane extends JPanel { } }); - sortFormulaTextField = new UITextField(16); + sortFormulaTextField = new FormulaTextField(16); //Lance:添加一公式编辑器按钮 sortFormulaTextFieldButton = new UIButton("..."); sortFormulaTextFieldButton.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Formula") + "..."); @@ -55,17 +56,15 @@ public abstract class SortFormulaPane extends JPanel { public abstract void formulaAction(); public void showFormulaDialog(String[] displayNames) { - String text = sortFormulaTextField.getText(); - final UIFormula formulaPane = FormulaFactory.createFormulaPaneWhenReserveFormula(); - formulaPane.populate(BaseFormula.createFormulaBuilder().build(text), new CustomVariableResolver(displayNames, true)); + BaseFormula value = sortFormulaTextField.getValue(); + final UIFormula formulaPane = FormulaFactory.createFormulaPaneWhenReserveFormula(); + formulaPane.populate(value, new CustomVariableResolver(displayNames, true)); formulaPane.showLargeWindow(SwingUtilities.getWindowAncestor(SortFormulaPane.this), new DialogActionAdapter() { public void doOk() { BaseFormula fm = formulaPane.update(); - if (fm.getContent().length() <= 1) { - sortFormulaTextField.setText(""); - } else { - sortFormulaTextField.setText(fm.getContent().substring(1)); + if (fm != null) { + sortFormulaTextField.setValue(fm); } } }).setVisible(true); diff --git a/designer-base/src/main/java/com/fr/design/gui/itextfield/DictionaryTextField.java b/designer-base/src/main/java/com/fr/design/gui/itextfield/DictionaryTextField.java new file mode 100644 index 0000000000..6d47cd090f --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/gui/itextfield/DictionaryTextField.java @@ -0,0 +1,41 @@ +package com.fr.design.gui.itextfield; + +import javax.swing.text.Document; + +/** + * created by Harrison on 2020/08/03 + **/ +public class DictionaryTextField extends UITextField { + + protected T value; + + public DictionaryTextField() { + } + + public DictionaryTextField(int columns) { + super(columns); + } + + public DictionaryTextField(String text, int columns, T value) { + super(text, columns); + this.value = value; + } + + public DictionaryTextField(String text, T value) { + super(text); + this.value = value; + } + + public DictionaryTextField(Document doc, String text, int columns, T value) { + super(doc, text, columns); + this.value = value; + } + + public T getValue() { + return value; + } + + public void setValue(T value) { + this.value = value; + } +} diff --git a/designer-realize/src/main/java/com/fr/design/dscolumn/DSColumnAdvancedPane.java b/designer-realize/src/main/java/com/fr/design/dscolumn/DSColumnAdvancedPane.java index 0941b4b220..8fd8aaed05 100644 --- a/designer-realize/src/main/java/com/fr/design/dscolumn/DSColumnAdvancedPane.java +++ b/designer-realize/src/main/java/com/fr/design/dscolumn/DSColumnAdvancedPane.java @@ -7,6 +7,7 @@ import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.formula.CustomVariableResolver; import com.fr.design.formula.FormulaFactory; +import com.fr.design.formula.FormulaTextField; import com.fr.design.formula.SortFormulaPane; import com.fr.design.formula.UIFormula; import com.fr.design.gui.ibutton.UIButton; @@ -25,8 +26,17 @@ import com.fr.report.cell.cellattr.CellExpandAttr; import com.fr.report.cell.cellattr.core.group.DSColumn; import com.fr.report.cell.cellattr.core.group.SelectCount; -import javax.swing.*; -import java.awt.*; +import javax.swing.BorderFactory; +import javax.swing.Box; +import javax.swing.JComponent; +import javax.swing.JPanel; +import javax.swing.SwingUtilities; +import java.awt.BorderLayout; +import java.awt.CardLayout; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.Font; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -221,7 +231,7 @@ public class DSColumnAdvancedPane extends BasicPane { return; } Object value = cellElement.getValue(); - if (value == null || !(value instanceof DSColumn)) { + if (!(value instanceof DSColumn)) { return; } @@ -238,7 +248,7 @@ public class DSColumnAdvancedPane extends BasicPane { this.cellElement = cellElement; Object value = cellElement.getValue(); - if (value == null || !(value instanceof DSColumn)) { + if (!(value instanceof DSColumn)) { return; } DSColumn dSColumn = (DSColumn) value; @@ -246,8 +256,8 @@ public class DSColumnAdvancedPane extends BasicPane { int sort = dSColumn.getOrder(); this.sortOrderComboBox.setSortOrder(new SortOrder(sort)); - String sortFormula = dSColumn.getSortFormula(); - sortFormulaTextField.setText(sortFormula); + BaseFormula sortFormulaObject = dSColumn.getSortFormulaObject(); + sortFormulaTextField.setValue(sortFormulaObject); } public void update(CellElement cellElement) { @@ -263,15 +273,7 @@ public class DSColumnAdvancedPane extends BasicPane { dSColumn.setOrder(this.sortOrderComboBox.getSortOrder().getOrder()); //lance:sort formula - String sText = null; - if (!(sortFormulaTextField.getText() == null || sortFormulaTextField.getText().trim().equals("") || sortFormulaTextField.getText().trim().equals("$$$"))) { - sText = new String(sortFormulaTextField.getText()); - } - if (!(sText == null || sText.length() < 1)) { - dSColumn.setSortFormula(sText); - } else { - dSColumn.setSortFormula(null); - } + dSColumn.setSortFormulaObject(sortFormulaTextField.getValue()); } } @@ -367,9 +369,9 @@ public class DSColumnAdvancedPane extends BasicPane { int selectCountType = selectCount.getType(); this.selectCountComboBox.setSelectedIndex(selectCountType); if (selectCountType == TOP.getValue()) { - this.topFormulaPane.populate(selectCount.getFormulaCount()); + this.topFormulaPane.populateFormula(selectCount.getFormulaObject()); } else if (selectCountType == BOTTOM.getValue()) { - this.bottomFormulaPane.populate(selectCount.getFormulaCount()); + this.bottomFormulaPane.populateFormula(selectCount.getFormulaObject()); } else if (selectCountType == SPECIFY.getValue()) { this.serialTextField.setText(selectCount.getSerial()); } @@ -395,9 +397,9 @@ public class DSColumnAdvancedPane extends BasicPane { dSColumn.setSelectCount(selectCount); selectCount.setType(selectCountSelectIndex); if (selectCountSelectIndex == TOP.getValue()) { - selectCount.setFormulaCount(this.topFormulaPane.getFormulaText()); + selectCount.setFormulaObject(this.topFormulaPane.getFormula()); } else if (selectCountSelectIndex == BOTTOM.getValue()) { - selectCount.setFormulaCount(this.bottomFormulaPane.getFormulaText()); + selectCount.setFormulaObject(this.bottomFormulaPane.getFormula()); } else if (selectCountSelectIndex == SPECIFY.getValue()) { selectCount.setSerial(this.serialTextField.getText()); } @@ -407,7 +409,7 @@ public class DSColumnAdvancedPane extends BasicPane { private static class JFormulaField extends JPanel { private CellElement cellElement; - private UITextField formulaTextField; + private FormulaTextField formulaTextField; private String defaultValue; public JFormulaField(String defaultValue) { @@ -417,7 +419,7 @@ public class DSColumnAdvancedPane extends BasicPane { UILabel bottomLabel = new UILabel("="); bottomLabel.setFont(new Font("Dialog", Font.BOLD, 12)); this.add(bottomLabel); - formulaTextField = new UITextField(24); + formulaTextField = new FormulaTextField(24); this.add(formulaTextField); formulaTextField.setText(defaultValue); @@ -439,16 +441,25 @@ public class DSColumnAdvancedPane extends BasicPane { public String getFormulaText() { return this.formulaTextField.getText(); } + + public void populateFormula(BaseFormula baseFormula) { + + this.formulaTextField.setValue(baseFormula); + this.formulaTextField.setText(baseFormula.getPureContent()); + } + + public BaseFormula getFormula() { + + return this.formulaTextField.getValue(); + } private ActionListener formulaButtonActionListener = new ActionListener() { public void actionPerformed(ActionEvent evt) { - BaseFormula valueFormula = BaseFormula.createFormulaBuilder().build(); - String text = formulaTextField.getText(); - if (text == null || text.length() <= 0) { - valueFormula.setContent(defaultValue); - } else { - valueFormula.setContent(text); + + BaseFormula valueFormula = formulaTextField.getValue(); + if (valueFormula == null) { + valueFormula = BaseFormula.createFormulaBuilder().build(); } final UIFormula formulaPane = FormulaFactory.createFormulaPaneWhenReserveFormula(); @@ -457,7 +468,7 @@ public class DSColumnAdvancedPane extends BasicPane { return; } Object value = cellElement.getValue(); - if (value == null || !(value instanceof DSColumn)) { + if (!(value instanceof DSColumn)) { return; } DSColumn dsColumn = (DSColumn) value; @@ -472,7 +483,8 @@ public class DSColumnAdvancedPane extends BasicPane { if (valueFormula.getContent().length() <= 1) { formulaTextField.setText(defaultValue); } else { - formulaTextField.setText(valueFormula.getContent().substring(1)); + formulaTextField.setText(valueFormula.getPureContent()); + formulaTextField.setValue(valueFormula); } } }).setVisible(true); @@ -503,12 +515,12 @@ public class DSColumnAdvancedPane extends BasicPane { DSColumn dSColumn = (DSColumn) value; //formula - String valueFormula = dSColumn.getResult(); + BaseFormula valueFormula = dSColumn.getResultObject(); if (valueFormula == null) { - valueFormula = "$$$"; + valueFormula = BaseFormula.createFormulaBuilder().build("$$$"); } formulaField.populateElement(cellElement); - formulaField.populate(valueFormula); + formulaField.populateFormula(valueFormula); } public void update(CellElement cellElement) { @@ -516,13 +528,13 @@ public class DSColumnAdvancedPane extends BasicPane { return; } Object value = cellElement.getValue(); - if (value == null || !(value instanceof DSColumn)) { + if (!(value instanceof DSColumn)) { return; } DSColumn dSColumn = (DSColumn) (cellElement.getValue()); //formula - dSColumn.setResult(this.formulaField.getFormulaText()); + dSColumn.setResultObject(this.formulaField.getFormula()); } } diff --git a/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellDSColumnEditor.java b/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellDSColumnEditor.java index fb80e8891d..61223f1673 100644 --- a/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellDSColumnEditor.java +++ b/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellDSColumnEditor.java @@ -12,6 +12,7 @@ import com.fr.design.dscolumn.SelectedDataColumnPane; import com.fr.design.event.UIObserverListener; import com.fr.design.formula.CustomVariableResolver; import com.fr.design.formula.FormulaFactory; +import com.fr.design.formula.FormulaTextField; import com.fr.design.formula.UIFormula; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButtonGroup; @@ -645,6 +646,7 @@ public class CellDSColumnEditor extends CellQuickEditor { */ public class ResultSetSortConfigPane extends JPanel { private static final String DEFAULT_VALUE = "="; + private final BaseFormula DEFAULT_FORMULA = BaseFormula.createFormulaBuilder().build(); private JPanel contentPane; private UIButtonGroup sortTypePane; private JFormulaField formulaField; @@ -719,11 +721,11 @@ public class CellDSColumnEditor extends CellQuickEditor { centerPane.setPreferredSize(new Dimension(156, 20)); TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 2, VGAP); } - String sortFormula = dSColumn.getSortFormula(); - if (sortFormula != null && sortFormula.length() >= 1) { - this.formulaField.populate(sortFormula); + BaseFormula baseFormula = dSColumn.getSortFormulaObject(); + if (baseFormula == null) { + this.formulaField.populateFormula(DEFAULT_FORMULA); } else { - this.formulaField.populate(DEFAULT_VALUE); + this.formulaField.populateFormula(baseFormula); } } } @@ -740,7 +742,7 @@ public class CellDSColumnEditor extends CellQuickEditor { if (value instanceof DSColumn) { DSColumn dSColumn = (DSColumn) value; dSColumn.setOrder(this.sortTypePane.getSelectedIndex()); - dSColumn.setSortFormula(this.formulaField.getFormulaText()); + dSColumn.setSortFormulaObject(this.formulaField.getFormula()); } } } @@ -774,6 +776,7 @@ public class CellDSColumnEditor extends CellQuickEditor { */ public class ResultSetFilterConfigPane extends JPanel { private static final String DEFAULT_VALUE = "="; + private final BaseFormula DEFAULT_FORMULA = BaseFormula.createFormulaBuilder().build(DEFAULT_VALUE); private JPanel contentPane; private UIComboBox rsComboBox; @@ -918,8 +921,8 @@ public class CellDSColumnEditor extends CellQuickEditor { CardLayout setCardPaneLayout = (CardLayout) setCardPane.getLayout(); CardLayout tipCardPaneLayout = (CardLayout) tipCardPane.getLayout(); // 重置默认值 - this.topFormulaPane.populate(DEFAULT_VALUE); - this.bottomFormulaPane.populate(DEFAULT_VALUE); + this.topFormulaPane.populateFormula(DEFAULT_FORMULA); + this.bottomFormulaPane.populateFormula(DEFAULT_FORMULA); this.serialTextField.setText(StringUtils.EMPTY); if (selectCount != null) { @@ -927,7 +930,7 @@ public class CellDSColumnEditor extends CellQuickEditor { this.rsComboBox.setSelectedIndex(selectCountType); switch (FilterTypeEnum.getFilterByValue(selectCountType)) { case TOP: - this.topFormulaPane.populate(selectCount.getFormulaCount()); + this.topFormulaPane.populateFormula(selectCount.getFormulaObject()); //前N个 setCardPaneLayout.show(setCardPane, TOP.name()); tipCardPaneLayout.show(tipCardPane, TOP.name()); @@ -938,7 +941,7 @@ public class CellDSColumnEditor extends CellQuickEditor { TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 4, 0); break; case BOTTOM: - this.bottomFormulaPane.populate(selectCount.getFormulaCount()); + this.bottomFormulaPane.populateFormula(selectCount.getFormulaObject()); //后N个 setCardPaneLayout.show(setCardPane, BOTTOM.name()); tipCardPaneLayout.show(tipCardPane, BOTTOM.name()); @@ -1019,9 +1022,9 @@ public class CellDSColumnEditor extends CellQuickEditor { dSColumn.setSelectCount(selectCount); //noinspection Duplicates if (selectedFilterIndex == TOP.getValue()) { - selectCount.setFormulaCount(this.topFormulaPane.getFormulaText()); + selectCount.setFormulaObject(this.topFormulaPane.getFormula()); } else if (selectedFilterIndex == BOTTOM.getValue()) { - selectCount.setFormulaCount(this.bottomFormulaPane.getFormulaText()); + selectCount.setFormulaObject(this.bottomFormulaPane.getFormula()); } else if (selectedFilterIndex == SPECIFY.getValue()) { selectCount.setSerial(this.serialTextField.getText()); } @@ -1060,13 +1063,13 @@ public class CellDSColumnEditor extends CellQuickEditor { */ public class JFormulaField extends JPanel { private CellElement cellElement; - private UITextField formulaTextField; + private FormulaTextField formulaTextField; private String defaultValue; public JFormulaField(String defaultValue) { this.defaultValue = defaultValue; - formulaTextField = new UITextField(); + formulaTextField = new FormulaTextField(); formulaTextField.setText(defaultValue); JPanel textFieldPane = new JPanel(new BorderLayout()); textFieldPane.add(formulaTextField, BorderLayout.CENTER); @@ -1094,6 +1097,17 @@ public class CellDSColumnEditor extends CellQuickEditor { public String getFormulaText() { return this.formulaTextField.getText().trim(); } + + public void populateFormula(BaseFormula baseFormula) { + + this.formulaTextField.setValue(baseFormula); + this.formulaTextField.setText(baseFormula.getContent()); + } + + public BaseFormula getFormula() { + + return this.formulaTextField.getValue(); + } /** * 添加事件监听器 @@ -1114,16 +1128,14 @@ public class CellDSColumnEditor extends CellQuickEditor { private ActionListener formulaButtonActionListener = new ActionListener() { @Override public void actionPerformed(ActionEvent evt) { - BaseFormula valueFormula = BaseFormula.createFormulaBuilder().build(); - String text = formulaTextField.getText(); - if (text == null || text.length() <= 0) { - valueFormula.setContent(defaultValue); - } else { - valueFormula.setContent(text); + + BaseFormula valueFormula = formulaTextField.getValue(); + if (valueFormula == null) { + valueFormula = BaseFormula.createFormulaBuilder().build(); } final UIFormula formulaPane = FormulaFactory.createFormulaPaneWhenReserveFormula(); if (cellElement != null) { - Object value = cellElement.getValue(); + final Object value = cellElement.getValue(); if (value instanceof DSColumn) { DSColumn dsColumn = (DSColumn) value; String[] displayNames = DesignTableDataManager.getSelectedColumnNames(DesignTableDataManager.getEditingTableDataSource(), dsColumn.getDSName()); @@ -1135,7 +1147,8 @@ public class CellDSColumnEditor extends CellQuickEditor { if (valueFormula.getContent().length() <= 1) { formulaTextField.setText(defaultValue); } else { - formulaTextField.setText(valueFormula.getContent()); + formulaTextField.setText(valueFormula.getPureContent()); + formulaTextField.setValue(valueFormula); } } }).setVisible(true); @@ -1171,11 +1184,9 @@ public class CellDSColumnEditor extends CellQuickEditor { if (value instanceof DSColumn) { DSColumn dSColumn = (DSColumn) value; //formula - String valueFormula = dSColumn.getResult(); + BaseFormula valueFormula = dSColumn.getResultObject(); if (valueFormula != null) { - formulaField.populate(valueFormula); - } else { - formulaField.populate(DEFAULT_VALUE); + formulaField.populateFormula(valueFormula); } formulaField.populateElement(cellElement); @@ -1188,8 +1199,7 @@ public class CellDSColumnEditor extends CellQuickEditor { Object value = cellElement.getValue(); if (value instanceof DSColumn) { DSColumn dSColumn = (DSColumn) (cellElement.getValue()); - dSColumn.setResult(StringUtils.isEmpty(this.formulaField.getFormulaText()) ? - null : this.formulaField.getFormulaText()); + dSColumn.setResultObject(this.formulaField.getFormula()); } } } From 2886d3b5d9d73eb90601f593510d25b68daebfde Mon Sep 17 00:00:00 2001 From: Harrison Date: Tue, 4 Aug 2020 19:42:16 +0800 Subject: [PATCH 17/34] =?UTF-8?q?1=E3=80=81=E6=9B=B4=E6=96=B0=E6=B3=A8?= =?UTF-8?q?=E9=87=8A=202=E3=80=81=E4=BC=98=E5=8C=96=E4=B8=80=E4=B8=8B?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/formula/FormulaTextField.java | 10 ++++++++++ .../design/gui/itextfield/DictionaryTextField.java | 4 ++++ .../fr/design/dscolumn/DSColumnAdvancedPane.java | 8 +++----- .../quickeditor/cellquick/CellDSColumnEditor.java | 14 ++++++++------ 4 files changed, 25 insertions(+), 11 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/formula/FormulaTextField.java b/designer-base/src/main/java/com/fr/design/formula/FormulaTextField.java index e142662783..146085e3da 100644 --- a/designer-base/src/main/java/com/fr/design/formula/FormulaTextField.java +++ b/designer-base/src/main/java/com/fr/design/formula/FormulaTextField.java @@ -7,6 +7,11 @@ import com.fr.stable.StringUtils; import javax.swing.text.Document; /** + * 公式展示时使用。 + * 展示 String. + * 但实际保存的是 BaseFormula。 + * 从而保留公式的形态。 + * * created by Harrison on 2020/08/03 **/ public class FormulaTextField extends DictionaryTextField { @@ -41,6 +46,11 @@ public class FormulaTextField extends DictionaryTextField { return this.value; } + /** + * 设置值时,会将展示的公式值一同设置进去 + * + * @param value 公式值 + */ @Override public void setValue(BaseFormula value) { diff --git a/designer-base/src/main/java/com/fr/design/gui/itextfield/DictionaryTextField.java b/designer-base/src/main/java/com/fr/design/gui/itextfield/DictionaryTextField.java index 6d47cd090f..b8805b61dd 100644 --- a/designer-base/src/main/java/com/fr/design/gui/itextfield/DictionaryTextField.java +++ b/designer-base/src/main/java/com/fr/design/gui/itextfield/DictionaryTextField.java @@ -3,6 +3,10 @@ package com.fr.design.gui.itextfield; import javax.swing.text.Document; /** + * 文字 ui. + * 保存实际值,展示值。 + * 允许实际值和展示值不同。 + * * created by Harrison on 2020/08/03 **/ public class DictionaryTextField extends UITextField { diff --git a/designer-realize/src/main/java/com/fr/design/dscolumn/DSColumnAdvancedPane.java b/designer-realize/src/main/java/com/fr/design/dscolumn/DSColumnAdvancedPane.java index 8fd8aaed05..f25d730d0a 100644 --- a/designer-realize/src/main/java/com/fr/design/dscolumn/DSColumnAdvancedPane.java +++ b/designer-realize/src/main/java/com/fr/design/dscolumn/DSColumnAdvancedPane.java @@ -410,17 +410,16 @@ public class DSColumnAdvancedPane extends BasicPane { private static class JFormulaField extends JPanel { private CellElement cellElement; private FormulaTextField formulaTextField; - private String defaultValue; + private BaseFormula defaultFormula; public JFormulaField(String defaultValue) { - this.defaultValue = defaultValue; + this.defaultFormula = BaseFormula.createFormulaBuilder().build(defaultValue); this.setLayout(FRGUIPaneFactory.createBoxFlowLayout()); UILabel bottomLabel = new UILabel("="); bottomLabel.setFont(new Font("Dialog", Font.BOLD, 12)); this.add(bottomLabel); formulaTextField = new FormulaTextField(24); - this.add(formulaTextField); formulaTextField.setText(defaultValue); UIButton bottomFrmulaButton = new UIButton("..."); @@ -481,9 +480,8 @@ public class DSColumnAdvancedPane extends BasicPane { public void doOk() { BaseFormula valueFormula = formulaPane.update(); if (valueFormula.getContent().length() <= 1) { - formulaTextField.setText(defaultValue); + formulaTextField.setValue(defaultFormula); } else { - formulaTextField.setText(valueFormula.getPureContent()); formulaTextField.setValue(valueFormula); } } diff --git a/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellDSColumnEditor.java b/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellDSColumnEditor.java index 61223f1673..983fbb9da7 100644 --- a/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellDSColumnEditor.java +++ b/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellDSColumnEditor.java @@ -1064,13 +1064,14 @@ public class CellDSColumnEditor extends CellQuickEditor { public class JFormulaField extends JPanel { private CellElement cellElement; private FormulaTextField formulaTextField; - private String defaultValue; + private BaseFormula defaultFormula; public JFormulaField(String defaultValue) { - this.defaultValue = defaultValue; + this.defaultFormula = BaseFormula.createFormulaBuilder().build(defaultValue); formulaTextField = new FormulaTextField(); - formulaTextField.setText(defaultValue); + formulaTextField.setValue(defaultFormula); + JPanel textFieldPane = new JPanel(new BorderLayout()); textFieldPane.add(formulaTextField, BorderLayout.CENTER); textFieldPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 5)); @@ -1101,7 +1102,6 @@ public class CellDSColumnEditor extends CellQuickEditor { public void populateFormula(BaseFormula baseFormula) { this.formulaTextField.setValue(baseFormula); - this.formulaTextField.setText(baseFormula.getContent()); } public BaseFormula getFormula() { @@ -1145,9 +1145,8 @@ public class CellDSColumnEditor extends CellQuickEditor { public void doOk() { BaseFormula valueFormula = formulaPane.update(); if (valueFormula.getContent().length() <= 1) { - formulaTextField.setText(defaultValue); + formulaTextField.setValue(defaultFormula); } else { - formulaTextField.setText(valueFormula.getPureContent()); formulaTextField.setValue(valueFormula); } } @@ -1165,6 +1164,7 @@ public class CellDSColumnEditor extends CellQuickEditor { */ public class CustomValuePane extends JPanel { private static final String DEFAULT_VALUE = "=$$$"; + private final BaseFormula DEFAULT_FORMULA = BaseFormula.createFormulaBuilder().build(DEFAULT_VALUE); private JFormulaField formulaField; @@ -1187,6 +1187,8 @@ public class CellDSColumnEditor extends CellQuickEditor { BaseFormula valueFormula = dSColumn.getResultObject(); if (valueFormula != null) { formulaField.populateFormula(valueFormula); + } else { + formulaField.populateFormula(DEFAULT_FORMULA); } formulaField.populateElement(cellElement); From 405197fcb487107a1c879824ebd1ee11735e9a20 Mon Sep 17 00:00:00 2001 From: "Henry.Wang" Date: Tue, 4 Aug 2020 20:50:26 +0800 Subject: [PATCH 18/34] =?UTF-8?q?REPORT-35569=20=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E9=9D=A2=E6=9D=BF=EF=BC=8C=E6=B7=BB=E5=8A=A0=E4=B8=80=E4=B8=AA?= =?UTF-8?q?=E5=8F=82=E6=95=B0=E6=8E=A7=E4=BB=B6=EF=BC=8C=E6=92=A4=E9=94=80?= =?UTF-8?q?=E4=B9=8B=E5=90=8E=EF=BC=8C=E5=86=8D=E6=AC=A1=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E7=9A=84=E6=8E=A7=E4=BB=B6=E4=BC=9A=E7=A9=BA=E4=B8=80=E4=B8=AA?= =?UTF-8?q?=E4=BD=8D=E7=BD=AE=E6=B7=BB=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../parameter/ParameterDesignerProvider.java | 2 +- .../form/parameter/FormParaDesigner.java | 9 ++++--- .../parameter/ParameterDefinitePane.java | 26 ++++++++++++++++--- 3 files changed, 29 insertions(+), 8 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/parameter/ParameterDesignerProvider.java b/designer-base/src/main/java/com/fr/design/parameter/ParameterDesignerProvider.java index abd27f89bf..e0b69fea05 100644 --- a/designer-base/src/main/java/com/fr/design/parameter/ParameterDesignerProvider.java +++ b/designer-base/src/main/java/com/fr/design/parameter/ParameterDesignerProvider.java @@ -48,7 +48,7 @@ public interface ParameterDesignerProvider { boolean addingParameter2EditorWithQueryButton(Parameter parameter, int index); - void addingAllParameter2Editor(Parameter[] parameterArray, int currentIndex); + int addingAllParameter2Editor(Parameter[] parameterArray, int currentIndex); JPanel[] toolbarPanes4Form(); diff --git a/designer-form/src/main/java/com/fr/design/form/parameter/FormParaDesigner.java b/designer-form/src/main/java/com/fr/design/form/parameter/FormParaDesigner.java index c72aa45128..b918850616 100644 --- a/designer-form/src/main/java/com/fr/design/form/parameter/FormParaDesigner.java +++ b/designer-form/src/main/java/com/fr/design/form/parameter/FormParaDesigner.java @@ -74,7 +74,7 @@ import java.util.List; public class FormParaDesigner extends FormDesigner implements ParameterDesignerProvider { private static final int NUM_IN_A_LINE = 4; private static final int H_COMPONENT_GAP = 165; - private static final int V_COMPONENT_GAP = 25; + public static final int V_COMPONENT_GAP = 25; private static final int FIRST_V_LOCATION = 35; private static final int FIRST_H_LOCATION = 90; private static final int SECOND_H_LOCATION = 170; @@ -637,9 +637,9 @@ public class FormParaDesigner extends FormDesigner implements ParameterDesignerP * * @param parameterArray 参数 c * @param currentIndex 位置 w - * @return 是否加入 s + * @return currentIndex的最新值 */ - public void addingAllParameter2Editor(Parameter[] parameterArray, int currentIndex) { + public int addingAllParameter2Editor(Parameter[] parameterArray, int currentIndex) { for (int i = 0; i < parameterArray.length; i++) { com.fr.form.ui.Label label = new com.fr.form.ui.Label(); label.setWidgetName("Label" + parameterArray[i].getName()); @@ -667,9 +667,10 @@ public class FormParaDesigner extends FormDesigner implements ParameterDesignerP XCreator xCreator = XCreatorUtils.createXCreator(formSubmitButton); if (!(this.autoAddComponent(xCreator, H_COMPONENT_GAP * 3 + H_GAP, FIRST_V_LOCATION + V_COMPONENT_GAP * (currentIndex / NUM_IN_A_LINE)))) { - return; + currentIndex = ((int) Math.ceil((currentIndex + 1) / (double) NUM_IN_A_LINE)) * NUM_IN_A_LINE; } } + return currentIndex; } /** diff --git a/designer-realize/src/main/java/com/fr/design/parameter/ParameterDefinitePane.java b/designer-realize/src/main/java/com/fr/design/parameter/ParameterDefinitePane.java index 13d53b5b25..74f1435a4d 100644 --- a/designer-realize/src/main/java/com/fr/design/parameter/ParameterDefinitePane.java +++ b/designer-realize/src/main/java/com/fr/design/parameter/ParameterDefinitePane.java @@ -17,6 +17,7 @@ import com.fr.design.designer.TargetComponent; import com.fr.design.event.TargetModifiedEvent; import com.fr.design.event.TargetModifiedListener; import com.fr.design.file.HistoryTemplateListPane; +import com.fr.design.form.parameter.FormParaDesigner; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.layout.FRGUIPaneFactory; @@ -30,6 +31,10 @@ import com.fr.design.menu.ShortCut; import com.fr.design.menu.ToolBarDef; import com.fr.design.module.DesignModuleFactory; import com.fr.design.style.background.BackgroundPane; +import com.fr.form.main.parameter.FormParameterUI; +import com.fr.form.ui.Widget; +import com.fr.form.ui.container.WAbsoluteLayout; +import com.fr.form.ui.container.WLayout; import com.fr.log.FineLoggerFactory; import com.fr.main.parameter.ReportParameterAttr; import com.fr.main.parameter.TemplateParameterAttr; @@ -46,6 +51,7 @@ import java.awt.Color; import java.awt.Component; import java.awt.Container; import java.awt.Dimension; +import java.awt.Rectangle; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.ItemEvent; @@ -249,6 +255,22 @@ public class ParameterDefinitePane extends JPanel implements ToolBarMenuDockPlus FineLoggerFactory.getLogger().error(e.getMessage(), e); } } + currentIndex = reportParameterAttr.getCurrentIndex(); + //因为以前的版本没有保存currentIndex,所以要计算currentIndex的值 + if (parameterUI != null && parameterUI instanceof FormParameterUI && currentIndex == 0) { + WLayout wLayout = ((FormParameterUI) parameterUI).getContainer(); + int widgetCount = wLayout.getWidgetCount(); + Rectangle endRec = null; + for (int i = 0; i < widgetCount; i++) { + Widget widget = wLayout.getWidget(i); + Rectangle tempRec = ((WAbsoluteLayout.BoundsWidget) widget).getBounds(); + if (endRec == null || tempRec.y > endRec.y) { + endRec = tempRec; + } + } + if (endRec != null) + currentIndex = (int) (Math.ceil(endRec.y / FormParaDesigner.V_COMPONENT_GAP)) * NUM_IN_A_LINE; + } paraDesignEditor.populate(parameterUI); @@ -268,8 +290,6 @@ public class ParameterDefinitePane extends JPanel implements ToolBarMenuDockPlus bridge.setBackground(reportParameterAttr.getBackground()); bridge.setUseParamsTemplate(reportParameterAttr.isUseParamsTemplate()); } - - currentIndex = reportParameterAttr.getCurrentIndex(); } @@ -438,7 +458,7 @@ public class ParameterDefinitePane extends JPanel implements ToolBarMenuDockPlus return; } - paraDesignEditor.addingAllParameter2Editor(parameterArray, currentIndex); + currentIndex = paraDesignEditor.addingAllParameter2Editor(parameterArray, currentIndex); parameterArray = null; refreshParameter(); From 7e7bd9b950b2e3c1aaf4da2f71fe33ff0c71075f Mon Sep 17 00:00:00 2001 From: lucian Date: Wed, 5 Aug 2020 09:15:33 +0800 Subject: [PATCH 19/34] =?UTF-8?q?=E6=97=A0jira=E4=BB=BB=E5=8A=A1=EF=BC=8C?= =?UTF-8?q?=E6=89=93=E5=8C=85=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/env/RemoteWorkspace.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/env/RemoteWorkspace.java b/designer-base/src/main/java/com/fr/design/env/RemoteWorkspace.java index 3d96ea1efc..c9eb2b621a 100644 --- a/designer-base/src/main/java/com/fr/design/env/RemoteWorkspace.java +++ b/designer-base/src/main/java/com/fr/design/env/RemoteWorkspace.java @@ -1,6 +1,6 @@ package com.fr.design.env; -import com.fr.cluster.engine.remote.ClusterOperator; +import com.fr.cluster.engine.rpc.remote.ClusterOperator; import com.fr.design.i18n.Toolkit; import com.fr.base.operator.common.CommonOperator; import com.fr.rpc.ExceptionHandler; From 81cfdf7c0f435f85f5fa5505a621909ff4f73222 Mon Sep 17 00:00:00 2001 From: "Qinghui.Liu" Date: Wed, 5 Aug 2020 10:29:31 +0800 Subject: [PATCH 20/34] =?UTF-8?q?CHART-14924=20=E6=9B=B4=E6=8D=A2icon?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/van/chart/box.images/box.png | Bin 918 -> 1607 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/designer-chart/src/main/resources/com/fr/van/chart/box.images/box.png b/designer-chart/src/main/resources/com/fr/van/chart/box.images/box.png index c0ad22d3cf7a7da3667d2d229b0a885ed433fc58..743024f720d1c44eb2e968afaa4db7e8776f21d8 100755 GIT binary patch literal 1607 zcmV-N2Dtf&P)7%Q6vyA&b&^6Uh0-_`LM?(22_X(hfH>8La^MnyR0xqc6>;E@lr&C4xkC?0oT3m8 zk+^U`qBkTEJjgt_>2=ZDMWJfVS7-%8aMWO-)whhcdfrKQS7%nGymVb zH*aRvVhq0aPGToJ;`J1FeCX)9F%0mR*uf zy;GfI#s$8p0>b40aRZB!4(L(0+A#p z@KA|Lx7r}&3N(X<3Ph5az(XY}!9%rGf`@8LR{sKcsJ@WeW2oMKAs2F)jzjv@+Pnfl z^_9~GTCa$pLQ*pU9r=Ca{u|5OEkeXC7e098-K!$oT}Gh;?avSAohq&rwGvU1nf|P2 zqZF+rm|uRsYxGwyjh9~IM~7YSoNMLM;Ch*gctdwqw4aEMDyGjj{wJl@|0Zny=&g3bpI6^Ily4^55FZe*BVU(9xQF4O*n&h0Ak>A0pwjwg_t3tXku#1C zpy)m(dO!_mW|e@mT6oD>15v!sotE&chCA`^cp1yXINNIjLX>A22* zZ|Fe#^TYos#S>l{OiVAe*z|@@gPqC=u){7YqPM-Y&&yhM=s^4O!zCh`_0nJ>zPH7u z6oBri7e3G{!$x~BJT%~mcOQT{2B&z2+=u{8jsLTf*kga^CG?k9)uTjKcfI{k(;XHe zcZ*;uJ6qhdmp=0Xbfw785LrC{N<^l6Fvd`fp{`EbXdY_1!y@E1S%(Es0CkN(H3m@% zNf<+$tOo-qfVzgHC`BOo7&<YCWQO&n;1j49T*-84;2RUTC)Hjw1$VmLpK#bmh0I+iQu6c;zj8U0<08arO37G#&RB- znkf8xPX{}H*Resfm*%L4*?RNhz`-9~)u}Q-mK$J}o5~jca)QC6T8QXwMSRV{Mp+iU zdihj`)>jPxG(ez@JnME2&A?i2NNc$O>a0M+G1Tx8?Bb=rpn;k?WZ!g_Yx+kLA_LUa z&tRAaYI;bC3{aiyHwfFH78U?B2wH-Brn80hvmWLIrZpx?(Oqow(cG!zFFMx;k;TJ9 zw+K8pwRpsFTDDSps7#eJR$FUtJ)5>lqImw~zIh#(>$U)@tC&yrahjIFLj}+QR3K8E zOaL@av;=hpP=QEsG6B#y(Gt`ZKm{Vj$pk>-L`zUtKY$L*oKBZ2<+>++*Hpo#-l@*9 zbAqbXm|)r>P|XjZf?|9z(FXeb^uqqqQt9#P(%GsUt|%U2#V4!Zw=8S*(%``#e5q-O zH)(F5*|{f5q(ncltcVuA&UCyOA`4%NZfc;uC=|1s0BFpBxm6cH-4u%1=KvZrU~bg~ zP&b7l{CRrv+5@z@cKntso~c6-zd}k)Rljeueg0ymJs+j!XirpoWAtRSbZdQrb{C{{sWDQ0y#l4AB4p002ovPDHLk FV1jTT=o$b3 literal 918 zcmV;H18Mw;P)sRV z6$OT2r1iltXGEujd2k?1KZ?%}V@EgNPaGq_POT}XK`)l9IB?!2X9IyY@AanEY%E(l zRM~8FeX^&x<*m!Qt);bR_R!SF3T87}U75{Bjp{U=LsnOIJ%4MELw6}Gu-Rw<0ME=F znSN7!GPDNm@C60{`R6C%T-XOWcj$iM1bJSP@me9?6&)w@VzgtWTAvi01|6L8B3E)$ zWB?3@*v%Y+ebu&%`6lFDDtb@YxtIY|FN)q3Uhc1EDGjKr83A*VsbLd41Q8Aath%6Z z3N@W8A0ze?Q8%CHCqT;c(-7m2YYba5FaZ}?RsKNBkY?*6JWVtIvhal5>{!=4kMf7a zosBdPBkWuzJ09B>5^T4q>9Wk-ttXd#j4aboiQ5>xghVMkB+E|SEevY%BqJmU;|#DS z#1pd{w`Hc#dG>s)!^{>2tf&AhZ2PEBHwhj{mdnfHovW$1L}aEg$FevU7a0x3Ydmzy z{Ew;D8Pg==%I}OR!AInC){p<~b<+j)oqO%Yl9hO zrW9!WVI4ulbauQuv_P|Mr76pw>^fu>)H~TqTLtx8-^?Pn(r=}e4tn5-R$9X2QjpFs z-U22bes0GfI6%@XX+6nB{xDxz29!!6-ygM6E_=1>YlIOiD746@@026bMz6$9aTVt! z<-+kB=6UG1+SNiyaS%zb6iSG&8Vc?JU}V`2*f&i2iu_5=xnUN_fCDL>ms;uFb!Zu+ s`82}A@E9O(mG(X(jW5fsbd>z+Pl(bHYsk2^^#A|>07*qoM6N<$f=2|7_y7O^ From 4e2c8e2d9b7367215de9cfeb9d4a314533edeb16 Mon Sep 17 00:00:00 2001 From: Harrison Date: Wed, 5 Aug 2020 10:35:53 +0800 Subject: [PATCH 21/34] =?UTF-8?q?REPORT-24268=20=E5=A2=9E=E5=BC=BA?= =?UTF-8?q?=E5=85=AC=E5=BC=8F=E7=BC=96=E8=BE=91=E5=99=A8=E6=8F=92=E4=BB=B6?= =?UTF-8?q?=E9=97=AE=E9=A2=98=20=E6=89=8B=E6=BB=91=EF=BC=8C=E5=88=A0?= =?UTF-8?q?=E5=A4=9A=E4=BA=86=EF=BC=8C=E6=81=A2=E5=A4=8D=E4=B8=80=E4=B8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/design/dscolumn/DSColumnAdvancedPane.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/designer-realize/src/main/java/com/fr/design/dscolumn/DSColumnAdvancedPane.java b/designer-realize/src/main/java/com/fr/design/dscolumn/DSColumnAdvancedPane.java index f25d730d0a..07eefdd2bd 100644 --- a/designer-realize/src/main/java/com/fr/design/dscolumn/DSColumnAdvancedPane.java +++ b/designer-realize/src/main/java/com/fr/design/dscolumn/DSColumnAdvancedPane.java @@ -420,7 +420,8 @@ public class DSColumnAdvancedPane extends BasicPane { bottomLabel.setFont(new Font("Dialog", Font.BOLD, 12)); this.add(bottomLabel); formulaTextField = new FormulaTextField(24); - formulaTextField.setText(defaultValue); + this.add(formulaTextField); + formulaTextField.setValue(defaultFormula); UIButton bottomFrmulaButton = new UIButton("..."); this.add(bottomFrmulaButton); From 807adb2b9db70aeb390f0f9216d9abf3f279db63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E5=B2=B3?= <445798420@qq.com> Date: Wed, 5 Aug 2020 10:38:48 +0800 Subject: [PATCH 22/34] =?UTF-8?q?CHART-12124=20=E5=9B=BE=E4=BE=8B=E5=BD=A2?= =?UTF-8?q?=E6=80=81=E5=92=8C=E7=B3=BB=E5=88=97=E8=89=B2=E5=90=88=E5=B9=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gui/style/series/UIColorPickerPane.java | 18 +- .../bubble/VanChartBubbleSeriesPane.java | 6 +- .../component/VanChartHeatValueColorPane.java | 74 ++++++++ .../component/VanChartValueColorPane.java | 149 ++++++++++++++++ .../style/HeatMapRangeLegendPane.java | 53 ------ .../style/VanChartRangeLegendPane.java | 127 +++++--------- .../series/VanChartColorValueSeriesPane.java | 164 ++++++++++++++++++ .../style/VanChartHeatMapSeriesPane.java | 48 +++-- .../van/chart/map/VanChartMapSeriesPane.java | 19 +- .../range/component/GradualLegendPane.java | 31 +--- .../component/LegendLabelFormatPane.java | 48 ++--- .../SectionIntervalConfigPaneWithOutNum.java | 11 -- .../range/component/SectionLegendPane.java | 51 +++--- .../scatter/VanChartScatterSeriesPane.java | 4 +- .../style/VanChartWordCloudSeriesPane.java | 10 +- 15 files changed, 556 insertions(+), 257 deletions(-) create mode 100644 designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartHeatValueColorPane.java create mode 100644 designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartValueColorPane.java create mode 100644 designer-chart/src/main/java/com/fr/van/chart/designer/style/series/VanChartColorValueSeriesPane.java diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/UIColorPickerPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/UIColorPickerPane.java index c9a6caf80a..25b8760339 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/UIColorPickerPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/UIColorPickerPane.java @@ -18,7 +18,6 @@ import com.fr.design.layout.TableLayoutHelper; import com.fr.design.style.color.ColorControlWindow; import com.fr.design.style.color.ColorSelectBox; import com.fr.design.utils.gui.GUICoreUtils; - import com.fr.stable.StringUtils; import com.fr.van.chart.designer.TableLayout4VanChartHelper; @@ -29,6 +28,8 @@ import javax.swing.JPanel; import javax.swing.SwingConstants; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; +import java.util.ArrayList; +import java.util.List; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Component; @@ -40,8 +41,6 @@ import java.awt.LayoutManager; import java.awt.Point; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; -import java.util.ArrayList; -import java.util.List; public class UIColorPickerPane extends BasicPane implements UIObserver { private static final int MARGIN_TOP = 7; @@ -635,7 +634,7 @@ public class UIColorPickerPane extends BasicPane implements UIObserver { @Override public void layoutContainer(Container parent) { - upControlPane.setBounds(MARGIN_LEFT, MARGIN_TOP, UPCONTROLPANE_WIDTH, upControlPane.getPreferredSize().height); + upControlPane.setBounds(getBoundX(), getBoundY(), getBoundWidth(), upControlPane.getPreferredSize().height); colorGroup.setBounds(COLORGROUP_MARGIN_LEFT, 2 * MARGIN_TOP + upControlPane.getPreferredSize().height + LAYOUR_DET, colorGroup.getPreferredSize().width, colorGroup.getPreferredSize().height + upControlPane.getPreferredSize().height); textGroup.setBounds(colorGroup.getPreferredSize().width + COLORGROUP_MARGIN_LEFT, MARGIN_TOP + upControlPane.getPreferredSize().height + LAYOUR_DET, textGroup.getPreferredSize().width, textGroup.getPreferredSize().height); } @@ -646,6 +645,17 @@ public class UIColorPickerPane extends BasicPane implements UIObserver { } }; + protected int getBoundX() { + return MARGIN_LEFT; + } + + protected int getBoundY() { + return MARGIN_TOP; + } + + protected int getBoundWidth() { + return UPCONTROLPANE_WIDTH; + } /** *刷新颜色选取器 diff --git a/designer-chart/src/main/java/com/fr/van/chart/bubble/VanChartBubbleSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/bubble/VanChartBubbleSeriesPane.java index 3ec2af314c..9a4e9bc795 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/bubble/VanChartBubbleSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/bubble/VanChartBubbleSeriesPane.java @@ -2,8 +2,8 @@ package com.fr.van.chart.bubble; import com.fr.chart.chartattr.Plot; import com.fr.chart.chartglyph.ConditionAttr; -import com.fr.design.i18n.Toolkit; import com.fr.design.beans.BasicBeanPane; +import com.fr.design.i18n.Toolkit; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.chart.gui.ChartStylePane; @@ -12,7 +12,7 @@ import com.fr.plugin.chart.bubble.attr.VanChartAttrBubble; import com.fr.van.chart.bubble.component.VanChartBubblePane; import com.fr.van.chart.custom.component.VanChartCustomAxisConditionPane; import com.fr.van.chart.designer.TableLayout4VanChartHelper; -import com.fr.van.chart.designer.style.series.VanChartAbstractPlotSeriesPane; +import com.fr.van.chart.designer.style.series.VanChartColorValueSeriesPane; import com.fr.van.chart.designer.style.series.VanChartStackedAndAxisListControlPane; import javax.swing.JPanel; @@ -22,7 +22,7 @@ import java.awt.Component; /** * Created by Mitisky on 16/3/31. */ -public class VanChartBubbleSeriesPane extends VanChartAbstractPlotSeriesPane { +public class VanChartBubbleSeriesPane extends VanChartColorValueSeriesPane { private static final long serialVersionUID = 5595016643808487932L; private VanChartBubblePane bubblePane; diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartHeatValueColorPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartHeatValueColorPane.java new file mode 100644 index 0000000000..0241da848e --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartHeatValueColorPane.java @@ -0,0 +1,74 @@ +package com.fr.van.chart.designer.component; + +import com.fr.design.gui.frpane.AbstractAttrNoScrollPane; +import com.fr.design.gui.frpane.UINumberDragPane; +import com.fr.design.gui.ilable.BoldFontTextLabel; +import com.fr.design.i18n.Toolkit; +import com.fr.design.mainframe.chart.gui.ColorSelectBoxWithOutTransparent; +import com.fr.design.mainframe.chart.gui.style.series.MapColorPickerPaneWithFormula; +import com.fr.van.chart.designer.style.VanChartStylePane; +import com.fr.van.chart.designer.style.axis.component.MinMaxValuePaneWithOutTick; +import com.fr.van.chart.range.component.GradualIntervalConfigPane; +import com.fr.van.chart.range.component.GradualLegendPane; +import com.fr.van.chart.range.component.LegendGradientBar; +import com.fr.van.chart.range.component.SectionIntervalConfigPaneWithOutNum; +import com.fr.van.chart.range.component.SectionLegendPane; + +import java.awt.Component; + +/** + * @author Bjorn + * @version 10.0 + * Created by Bjorn on 2020-08-04 + */ +public class VanChartHeatValueColorPane extends VanChartValueColorPane { + + public VanChartHeatValueColorPane(VanChartStylePane parent) { + super(parent); + } + + protected GradualLegendPane createGradualLegendPane() { + return new GradualLegendPane() { + @Override + protected GradualIntervalConfigPane createGradualIntervalConfigPane() { + return new GradualIntervalConfigPane() { + @Override + protected Component[][] getPaneComponents(MinMaxValuePaneWithOutTick minMaxValuePane, ColorSelectBoxWithOutTransparent colorSelectBox, UINumberDragPane numberDragPane, LegendGradientBar legendGradientBar) { + return new Component[][]{ + new Component[]{minMaxValuePane, null}, + new Component[]{new BoldFontTextLabel(Toolkit.i18nText("Fine-Design_Chart_Value_Divided_Stage")), numberDragPane}, + new Component[]{null, legendGradientBar} + }; + } + }; + } + }; + } + + protected SectionLegendPane createSectionLegendPane() { + return new SectionLegendPane(parent) { + @Override + protected MapColorPickerPaneWithFormula createSectionIntervalConfigPane(AbstractAttrNoScrollPane parent) { + return new SectionIntervalConfigPaneWithOutNum(parent) { + private static final int WIDTH = 227; + + @Override + protected int getBoundX() { + return 0; + } + + @Override + protected int getBoundY() { + return 0; + } + + @Override + protected int getBoundWidth() { + return WIDTH; + } + }; + } + }; + } + +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartValueColorPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartValueColorPane.java new file mode 100644 index 0000000000..99b2490f6a --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartValueColorPane.java @@ -0,0 +1,149 @@ +package com.fr.van.chart.designer.component; + +import com.fr.design.dialog.BasicPane; +import com.fr.design.gui.ibutton.UIButtonGroup; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.i18n.Toolkit; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.mainframe.chart.PaneTitleConstants; +import com.fr.design.widget.FRWidgetFactory; +import com.fr.plugin.chart.range.VanChartRangeLegend; +import com.fr.plugin.chart.type.LegendType; +import com.fr.van.chart.designer.TableLayout4VanChartHelper; +import com.fr.van.chart.designer.style.VanChartStylePane; +import com.fr.van.chart.range.component.GradualLegendPane; +import com.fr.van.chart.range.component.SectionLegendPane; + +import javax.swing.BorderFactory; +import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.CardLayout; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +/** + * @author Bjorn + * @version 10.0 + * Created by Bjorn on 2020-08-03 + */ +public class VanChartValueColorPane extends BasicPane { + //颜色类型切换按钮 + private UIButtonGroup valueColorTypeButton; + + //连续渐变面板 + private GradualLegendPane gradualLegendPane; + //区域渐变面板 + private SectionLegendPane sectionLegendPane; + + protected VanChartStylePane parent; + + private JPanel rangeLegendPane; + + public VanChartValueColorPane(VanChartStylePane parent) { + this.parent = parent; + initComponents(); + } + + public void initComponents() { + valueColorTypeButton = createLegendTypeButton(); + valueColorTypeButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + checkCardPane(); + } + }); + valueColorTypeButton.setSelectedIndex(0); + + UILabel label = FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Chart_Color_Type")); + Component[][] labelComponent = new Component[][]{ + new Component[]{label, valueColorTypeButton}, + }; + JPanel legendTypeButtonWithTilePane = TableLayout4VanChartHelper.createGapTableLayoutPane(labelComponent); + legendTypeButtonWithTilePane.setBorder(BorderFactory.createEmptyBorder(10,0,0,0)); + //渐变色图例面板 + gradualLegendPane = createGradualLegendPane(); + //区域段图例面板 + sectionLegendPane = createSectionLegendPane(); + + rangeLegendPane = new JPanel(new CardLayout()) { + @Override + public Dimension getPreferredSize() { + if (valueColorTypeButton.getSelectedItem() == LegendType.GRADUAL) { + return gradualLegendPane.getPreferredSize(); + } else { + return sectionLegendPane.getPreferredSize(); + } + } + }; + + rangeLegendPane.add(gradualLegendPane, LegendType.GRADUAL.getStringType()); + rangeLegendPane.add(sectionLegendPane, LegendType.SECTION.getStringType()); + + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double[] col = {f}; + double[] row = {p, p}; + Component[][] components = new Component[][]{ + new Component[]{legendTypeButtonWithTilePane}, + new Component[]{rangeLegendPane} + }; + JPanel tableLayoutPane = TableLayoutHelper.createTableLayoutPane(components, row, col); + + this.setLayout(new BorderLayout()); + this.add(tableLayoutPane, BorderLayout.CENTER); + } + + private void checkCardPane() { + CardLayout cardLayout = (CardLayout) rangeLegendPane.getLayout(); + cardLayout.show(rangeLegendPane, valueColorTypeButton.getSelectedItem().getStringType()); + this.validate(); + this.repaint(); + } + + private UIButtonGroup createLegendTypeButton() { + return new UIButtonGroup<>(new String[]{ + Toolkit.i18nText("Fine-Design_Chart_Continuous_Gradient"), + Toolkit.i18nText("Fine-Design_Chart_Area_Gradient") + }, new LegendType[]{LegendType.GRADUAL, LegendType.SECTION}); + } + + protected GradualLegendPane createGradualLegendPane() { + return new GradualLegendPane(); + } + + protected SectionLegendPane createSectionLegendPane() { + return new SectionLegendPane(parent); + } + + /** + * 标题 + * + * @return 标题 + */ + public String title4PopupWindow() { + return PaneTitleConstants.CHART_STYLE_SERIES_TITLE; + } + + public void updateBean(VanChartRangeLegend legend) { + LegendType legendType = valueColorTypeButton.getSelectedItem(); + legend.setLegendType(legendType); + if (legendType == LegendType.GRADUAL) { + gradualLegendPane.update(legend.getGradualLegend()); + } else if (legendType == LegendType.SECTION) { + sectionLegendPane.update(legend.getSectionLegend()); + } + } + + public void populateBean(VanChartRangeLegend legend) { + //范围图例部分 + if (legend.getLegendType() != LegendType.ORDINARY) { + valueColorTypeButton.setSelectedItem(legend.getLegendType()); + } + gradualLegendPane.populate(legend.getGradualLegend()); + sectionLegendPane.populate(legend.getSectionLegend()); + checkCardPane(); + } +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/HeatMapRangeLegendPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/HeatMapRangeLegendPane.java index 60c535ceb9..cb316dffeb 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/HeatMapRangeLegendPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/HeatMapRangeLegendPane.java @@ -1,22 +1,6 @@ package com.fr.van.chart.designer.style; -import com.fr.design.gui.frpane.AbstractAttrNoScrollPane; -import com.fr.design.gui.frpane.UINumberDragPane; -import com.fr.design.gui.ibutton.UIButtonGroup; -import com.fr.design.i18n.Toolkit; -import com.fr.design.gui.ilable.BoldFontTextLabel; -import com.fr.design.mainframe.chart.gui.ColorSelectBoxWithOutTransparent; -import com.fr.design.mainframe.chart.gui.style.series.MapColorPickerPaneWithFormula; -import com.fr.plugin.chart.type.LegendType; -import com.fr.van.chart.designer.style.axis.component.MinMaxValuePaneWithOutTick; -import com.fr.van.chart.range.component.GradualIntervalConfigPane; -import com.fr.van.chart.range.component.GradualLegendPane; -import com.fr.van.chart.range.component.LegendGradientBar; -import com.fr.van.chart.range.component.SectionIntervalConfigPaneWithOutNum; -import com.fr.van.chart.range.component.SectionLegendPane; - import javax.swing.JPanel; -import java.awt.Component; /** * Created by Mitisky on 16/10/20. @@ -35,41 +19,4 @@ public class HeatMapRangeLegendPane extends VanChartRangeLegendPane { protected JPanel createCommonLegendPane(){ return this.createLegendPaneWithoutHighlight(); } - - @Override - protected UIButtonGroup createLegendTypeButton(){ - return new UIButtonGroup(new String[]{ - Toolkit.i18nText("Fine-Design_Chart_Legend_Gradual"), - Toolkit.i18nText("Fine-Design_Chart_Legend_Section") - }, new LegendType[]{LegendType.GRADUAL, LegendType.SECTION}); - } - - @Override - protected GradualLegendPane createGradualLegendPane() { - return new GradualLegendPane(){ - @Override - protected GradualIntervalConfigPane createGradualIntervalConfigPane() { - return new GradualIntervalConfigPane(){ - @Override - protected Component[][] getPaneComponents(MinMaxValuePaneWithOutTick minMaxValuePane, ColorSelectBoxWithOutTransparent colorSelectBox, UINumberDragPane numberDragPane, LegendGradientBar legendGradientBar) { - return new Component[][]{ - new Component[]{minMaxValuePane, null}, - new Component[]{new BoldFontTextLabel(Toolkit.i18nText("Fine-Design_Chart_Value_Divided_Stage")), numberDragPane}, - new Component[]{null, legendGradientBar} - }; - } - }; - } - }; - } - - @Override - protected SectionLegendPane createSectionLegendPane() { - return new SectionLegendPane(this.getLegendPaneParent()) { - @Override - protected MapColorPickerPaneWithFormula createSectionIntervalConfigPane(AbstractAttrNoScrollPane parent) { - return new SectionIntervalConfigPaneWithOutNum(parent); - } - }; - } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartRangeLegendPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartRangeLegendPane.java index 25ef2a15b2..837f00dead 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartRangeLegendPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartRangeLegendPane.java @@ -3,22 +3,19 @@ package com.fr.van.chart.designer.style; import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.layout.TableLayout; -import com.fr.design.i18n.Toolkit; import com.fr.design.layout.TableLayoutHelper; import com.fr.plugin.chart.attr.VanChartLegend; +import com.fr.plugin.chart.range.SectionLegend; import com.fr.plugin.chart.range.VanChartRangeLegend; import com.fr.plugin.chart.type.LegendType; -import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.range.component.GradualLegendPane; +import com.fr.van.chart.range.component.LegendLabelFormatPane; import com.fr.van.chart.range.component.SectionLegendPane; -import javax.swing.BorderFactory; import javax.swing.JPanel; import java.awt.CardLayout; import java.awt.Component; import java.awt.Dimension; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; /** @@ -39,75 +36,58 @@ public class VanChartRangeLegendPane extends VanChartPlotLegendPane { //区域段图例面板 private SectionLegendPane sectionLegendPane; + private LegendLabelFormatPane gradualLabelFormPane; + + private LegendLabelFormatPane sectionLabelFormPane; + + private LegendType legendType; + public VanChartRangeLegendPane() { super(); } - public VanChartRangeLegendPane(VanChartStylePane parent){ + + public VanChartRangeLegendPane(VanChartStylePane parent) { super(parent); } + private JPanel createRangeLegendPane() { - //普通图例面板 ordinaryLegendPane = new JPanel(); - //渐变色图例面板 - gradualLegendPane = createGradualLegendPane(); - gradualLegendPane.setParentPane(this.getLegendPaneParent()); - //区域段图例面板 - sectionLegendPane = createSectionLegendPane(); - sectionLegendPane.setParentPane(this.getLegendPaneParent()); - - JPanel panel = new JPanel(new CardLayout()){ + gradualLabelFormPane = new LegendLabelFormatPane(); + gradualLabelFormPane.setParentPane(this.getLegendPaneParent()); + sectionLabelFormPane = new LegendLabelFormatPane() { + @Override + protected void checkCustomLabelText() { + setCustomFormatterText(SectionLegend.DEFAULT_LABEL_FUNCTION); + } + }; + sectionLabelFormPane.setParentPane(this.getLegendPaneParent()); + + JPanel panel = new JPanel(new CardLayout()) { @Override public Dimension getPreferredSize() { - if(legendTypeButton.getSelectedItem() == LegendType.ORDINARY){ + if (legendType == LegendType.ORDINARY) { return new Dimension(ordinaryLegendPane.getWidth(), 0); - } else if (legendTypeButton.getSelectedItem() == LegendType.GRADUAL){ - return gradualLegendPane.getPreferredSize(); - }else{ - return sectionLegendPane.getPreferredSize(); + } else if (legendType == LegendType.GRADUAL) { + return gradualLabelFormPane.getPreferredSize(); + } else { + return sectionLabelFormPane.getPreferredSize(); } } }; panel.add(ordinaryLegendPane, LegendType.ORDINARY.getStringType()); - panel.add(gradualLegendPane, LegendType.GRADUAL.getStringType()); - panel.add(sectionLegendPane, LegendType.SECTION.getStringType()); + panel.add(gradualLabelFormPane, LegendType.GRADUAL.getStringType()); + panel.add(sectionLabelFormPane, LegendType.SECTION.getStringType()); return panel; } - protected GradualLegendPane createGradualLegendPane() { - return new GradualLegendPane(); - } - - protected SectionLegendPane createSectionLegendPane() { - return new SectionLegendPane(this.getLegendPaneParent()); - } - - private JPanel createTableLayoutPaneWithTitle(String title, Component component) { - return TableLayout4VanChartHelper.createGapTableLayoutPane(title, component); - } - - protected UIButtonGroup createLegendTypeButton(){ - return new UIButtonGroup(new String[]{ - Toolkit.i18nText("Fine-Design_Chart_Legend_Ordinary"), - Toolkit.i18nText("Fine-Design_Chart_Legend_Gradual"), - Toolkit.i18nText("Fine-Design_Chart_Legend_Section") - }, new LegendType[]{LegendType.ORDINARY, LegendType.GRADUAL, LegendType.SECTION}); - } - - protected JPanel createCommonLegendPane(){ + protected JPanel createCommonLegendPane() { return super.createLegendPane(); } @Override - protected JPanel createLegendPane(){ - legendTypeButton = createLegendTypeButton(); - - initLegendTypeButtonListener(); - - JPanel legendTypeButtonWithTilePane = createTableLayoutPaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Legend_Form"), legendTypeButton); - legendTypeButtonWithTilePane.setBorder(BorderFactory.createEmptyBorder(0,5,0,0)); - + protected JPanel createLegendPane() { rangeLegendPane = createRangeLegendPane(); //不包含新内容的普通面板内容 @@ -116,28 +96,17 @@ public class VanChartRangeLegendPane extends VanChartPlotLegendPane { double p = TableLayout.PREFERRED; double f = TableLayout.FILL; double[] col = {f}; - double[] row = {p, p, p, p}; + double[] row = {p, p}; Component[][] components = new Component[][]{ - new Component[]{legendTypeButtonWithTilePane}, new Component[]{rangeLegendPane}, new Component[]{commonLegendPane} }; - return TableLayoutHelper.createTableLayoutPane(components,row,col); - } - - private void initLegendTypeButtonListener() { - legendTypeButton.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - checkCardPane(); - checkLayoutPaneVisible(); - } - }); + return TableLayoutHelper.createTableLayoutPane(components, row, col); } private void checkCardPane() { CardLayout cardLayout = (CardLayout) rangeLegendPane.getLayout(); - cardLayout.show(rangeLegendPane, legendTypeButton.getSelectedItem().getStringType()); + cardLayout.show(rangeLegendPane, legendType.getStringType()); } @Override @@ -151,47 +120,41 @@ public class VanChartRangeLegendPane extends VanChartPlotLegendPane { protected boolean isVisibleLayoutPane() { - return super.isVisibleLayoutPane() && legendTypeButton.getSelectedItem() != LegendType.GRADUAL; + return super.isVisibleLayoutPane() && legendType != LegendType.GRADUAL; } - private void checkHighlightVisible(){ + private void checkHighlightVisible() { JPanel highlightPane = this.getHighlightPane(); if (highlightPane != null) { - LegendType legendType = legendTypeButton.getSelectedItem(); highlightPane.setVisible(legendType != LegendType.GRADUAL); } } @Override public void updateBean(VanChartLegend legend) { - if(legend == null) { + if (legend == null) { legend = new VanChartRangeLegend(); } super.updateBean(legend); - VanChartRangeLegend scatterLegend = (VanChartRangeLegend)legend; + VanChartRangeLegend scatterLegend = (VanChartRangeLegend) legend; //范围图例部分 - LegendType legendType = legendTypeButton.getSelectedItem(); - scatterLegend.setLegendType(legendType); if (legendType == LegendType.GRADUAL) { - gradualLegendPane.update(scatterLegend.getGradualLegend()); - }else if (legendType == LegendType.SECTION) { - sectionLegendPane.update(scatterLegend.getSectionLegend()); + gradualLabelFormPane.update(scatterLegend.getGradualLegend().getLegendLabelFormat()); + } else if (legendType == LegendType.SECTION) { + sectionLabelFormPane.update(scatterLegend.getSectionLegend().getLegendLabelFormat()); } - - this.checkHighlightVisible(); } @Override public void populateBean(VanChartLegend legend) { - VanChartRangeLegend scatterLegend = (VanChartRangeLegend)legend; + VanChartRangeLegend scatterLegend = (VanChartRangeLegend) legend; + legendType = scatterLegend.getLegendType(); if (scatterLegend != null) { - //范围图例部分 - legendTypeButton.setSelectedItem(scatterLegend.getLegendType()); - gradualLegendPane.populate(scatterLegend.getGradualLegend()); - sectionLegendPane.populate(scatterLegend.getSectionLegend()); + gradualLabelFormPane.populate(scatterLegend.getGradualLegend().getLegendLabelFormat()); + sectionLabelFormPane.populate(scatterLegend.getSectionLegend().getLegendLabelFormat()); super.populateBean(scatterLegend); } checkAllUse(); diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/series/VanChartColorValueSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/series/VanChartColorValueSeriesPane.java new file mode 100644 index 0000000000..5f0bcedc20 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/series/VanChartColorValueSeriesPane.java @@ -0,0 +1,164 @@ +package com.fr.van.chart.designer.style.series; + +import com.fr.chart.chartattr.Plot; +import com.fr.design.gui.ibutton.UIButtonGroup; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.i18n.Toolkit; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.mainframe.chart.gui.ChartStylePane; +import com.fr.design.widget.FRWidgetFactory; +import com.fr.plugin.chart.range.VanChartRangeLegend; +import com.fr.plugin.chart.type.LegendType; +import com.fr.van.chart.designer.TableLayout4VanChartHelper; +import com.fr.van.chart.designer.component.VanChartBeautyPane; +import com.fr.van.chart.designer.component.VanChartValueColorPane; +import com.fr.van.chart.designer.style.VanChartStylePane; + +import javax.swing.BorderFactory; +import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.CardLayout; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +/** + * @author Bjorn + * @version 10.0 + * Created by Bjorn on 2020-08-03 + */ +public abstract class VanChartColorValueSeriesPane extends VanChartAbstractPlotSeriesPane { + + //颜色划分切换 + private UIButtonGroup colorDivideButton; + + protected VanChartValueColorPane vanChartValueColorPane; + + private JPanel colorDividePane; + + public VanChartColorValueSeriesPane(ChartStylePane parent, Plot plot) { + super(parent, plot); + } + + //获取颜色面板 + protected JPanel getColorPane() { + JPanel panel = new JPanel(new BorderLayout()); + JPanel colorChoosePane = createColorChoosePane(); + if (colorChoosePane != null) { + panel.add(colorChoosePane, BorderLayout.CENTER); + } + + stylePane = createStylePane(); + setColorPaneContent(panel); + JPanel colorPane = TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Color"), panel); + panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 0)); + return panel.getComponentCount() == 0 ? null : colorPane; + } + + protected JPanel createColorChoosePane() { + vanChartFillStylePane = getVanChartFillStylePane(); + if (vanChartFillStylePane != null) { + JPanel divideButtonPane = initDivideButtonPane(); + vanChartValueColorPane = new VanChartValueColorPane((VanChartStylePane) parentPane); + + colorDividePane = new JPanel(new CardLayout()) { + @Override + public Dimension getPreferredSize() { + if (colorDivideButton.getSelectedIndex() == 0) { + return vanChartFillStylePane.getPreferredSize(); + } else { + return vanChartValueColorPane.getPreferredSize(); + } + } + }; + colorDividePane.add(vanChartFillStylePane, "series"); + colorDividePane.add(vanChartValueColorPane, "value"); + + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double[] col = {f}; + double[] row = {p, p, p}; + Component[][] components = new Component[][]{ + new Component[]{divideButtonPane}, + new Component[]{colorDividePane} + }; + return TableLayoutHelper.createCommonTableLayoutPane(components, row, col, 0); + } + return null; + } + + private JPanel initDivideButtonPane() { + colorDivideButton = new UIButtonGroup<>(new String[]{ + Toolkit.i18nText("Fine-Design_Chart_Series"), + Toolkit.i18nText("Fine-Design_Chart_Use_Value") + }, new String[]{"series", "value"}); + colorDivideButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + checkCardPane(); + } + }); + colorDivideButton.setSelectedIndex(0); + UILabel label = FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Chart_Color_Divide")); + Component[][] labelComponent = new Component[][]{ + new Component[]{label, colorDivideButton}, + }; + JPanel gapTableLayoutPane = TableLayout4VanChartHelper.createGapTableLayoutPane(labelComponent); + gapTableLayoutPane.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0)); + return gapTableLayoutPane; + } + + private void checkCardPane() { + CardLayout cardLayout = (CardLayout) colorDividePane.getLayout(); + cardLayout.show(colorDividePane, colorDivideButton.getSelectedItem()); + colorDividePane.validate(); + colorDividePane.repaint(); + } + + //风格 + protected VanChartBeautyPane createStylePane() { + return null; + } + + /** + * 保存 系列界面的属性到Plot + */ + public void updateBean(Plot plot) { + if (plot == null) { + return; + } + super.updateBean(plot); + if (colorDivideButton != null) { + VanChartRangeLegend legend = (VanChartRangeLegend) plot.getLegend(); + int selectedIndex = colorDivideButton.getSelectedIndex(); + if (selectedIndex == 0) { + legend.setLegendType(LegendType.ORDINARY); + } else { + vanChartValueColorPane.updateBean(legend); + } + } + } + + /** + * 更新Plot的属性到系列界面 + */ + public void populateBean(Plot plot) { + if (plot == null) { + return; + } + super.populateBean(plot); + if (colorDivideButton != null) { + VanChartRangeLegend legend = (VanChartRangeLegend) plot.getLegend(); + LegendType legendType = legend.getLegendType(); + if (legendType == LegendType.ORDINARY) { + colorDivideButton.setSelectedIndex(0); + } else { + colorDivideButton.setSelectedIndex(1); + } + vanChartValueColorPane.populateBean(legend); + checkCardPane(); + } + } +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/heatmap/designer/style/VanChartHeatMapSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/heatmap/designer/style/VanChartHeatMapSeriesPane.java index 7c4fa4ad4a..ae1025530a 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/heatmap/designer/style/VanChartHeatMapSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/heatmap/designer/style/VanChartHeatMapSeriesPane.java @@ -6,12 +6,16 @@ import com.fr.design.gui.frpane.UINumberDragPane; import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ispinner.UISpinner; +import com.fr.design.i18n.Toolkit; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.chart.gui.ChartStylePane; import com.fr.plugin.chart.heatmap.VanChartHeatMapPlot; +import com.fr.plugin.chart.range.VanChartRangeLegend; import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.component.VanChartFillStylePane; +import com.fr.van.chart.designer.component.VanChartHeatValueColorPane; +import com.fr.van.chart.designer.style.VanChartStylePane; import com.fr.van.chart.map.VanChartMapSeriesPane; import javax.swing.JPanel; @@ -45,7 +49,7 @@ public class VanChartHeatMapSeriesPane extends VanChartMapSeriesPane { } //设置色彩面板内容 - protected void setColorPaneContent (JPanel panel) { + protected void setColorPaneContent(JPanel panel) { panel.add(createNullValueColorPane(), BorderLayout.NORTH); panel.add(createAlphaPane(), BorderLayout.CENTER); } @@ -66,14 +70,14 @@ public class VanChartHeatMapSeriesPane extends VanChartMapSeriesPane { detailPane.add(heatPointPane, "heatPointPane"); detailPane.add(backgroundAreaPane, "backgroundAreaPane"); - JPanel contentPane = new JPanel(new BorderLayout(0,6)); + JPanel contentPane = new JPanel(new BorderLayout(0, 6)); contentPane.add(group, BorderLayout.NORTH); contentPane.add(detailPane, BorderLayout.CENTER); group.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { - if(group.getSelectedIndex() == 0){ + if (group.getSelectedIndex() == 0) { layout.show(detailPane, "heatPointPane"); } else { layout.show(detailPane, "backgroundAreaPane"); @@ -84,13 +88,14 @@ public class VanChartHeatMapSeriesPane extends VanChartMapSeriesPane { return contentPane; } - private JPanel createHeatPointPane(){ + private JPanel createHeatPointPane() { double p = TableLayout.PREFERRED; double f = TableLayout.FILL; double[] row = {p, p, p, p, p}; double[] col = {f}; Component[][] components = new Component[][]{ + new Component[]{createHeatColorPane()}, new Component[]{createHeatPointStylePane()}, new Component[]{createOpacityPane()} }; @@ -98,9 +103,24 @@ public class VanChartHeatMapSeriesPane extends VanChartMapSeriesPane { return TableLayoutHelper.createTableLayoutPane(components, row, col); } - private JPanel createHeatPointStylePane(){ - radius = new UISpinner(0,Double.MAX_VALUE,1,30); - blur = new UISpinner(0,100,1,30); + private JPanel createHeatColorPane() { + vanChartValueColorPane = new VanChartHeatValueColorPane((VanChartStylePane) parentPane); + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double[] row = {p}; + double[] col = {f}; + + Component[][] components = new Component[][]{ + new Component[]{vanChartValueColorPane}, + }; + + JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components, row, col); + return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Color"), panel); + } + + private JPanel createHeatPointStylePane() { + radius = new UISpinner(0, Double.MAX_VALUE, 1, 30); + blur = new UISpinner(0, 100, 1, 30); double p = TableLayout.PREFERRED; double f = TableLayout.FILL; @@ -121,8 +141,8 @@ public class VanChartHeatMapSeriesPane extends VanChartMapSeriesPane { } private JPanel createOpacityPane() { - maxOpacity = new UINumberDragPane(0,100); - minOpacity = new UINumberDragPane(0,100); + maxOpacity = new UINumberDragPane(0, 100); + minOpacity = new UINumberDragPane(0, 100); double p = TableLayout.PREFERRED; double f = TableLayout.FILL; @@ -146,12 +166,13 @@ public class VanChartHeatMapSeriesPane extends VanChartMapSeriesPane { public void populateBean(Plot plot) { super.populateBean(plot); - if(plot instanceof VanChartHeatMapPlot){ - VanChartHeatMapPlot heatMapPlot = (VanChartHeatMapPlot)plot; + if (plot instanceof VanChartHeatMapPlot) { + VanChartHeatMapPlot heatMapPlot = (VanChartHeatMapPlot) plot; radius.setValue(heatMapPlot.getRadius()); blur.setValue(heatMapPlot.getBlur()); maxOpacity.populateBean(heatMapPlot.getMaxOpacity()); minOpacity.populateBean(heatMapPlot.getMinOpacity()); + vanChartValueColorPane.populateBean((VanChartRangeLegend) plot.getLegend()); } } @@ -163,12 +184,13 @@ public class VanChartHeatMapSeriesPane extends VanChartMapSeriesPane { public void updateBean(Plot plot) { super.updateBean(plot); - if(plot instanceof VanChartHeatMapPlot){ - VanChartHeatMapPlot heatMapPlot = (VanChartHeatMapPlot)plot; + if (plot instanceof VanChartHeatMapPlot) { + VanChartHeatMapPlot heatMapPlot = (VanChartHeatMapPlot) plot; heatMapPlot.setRadius(radius.getValue()); heatMapPlot.setBlur(blur.getValue()); heatMapPlot.setMaxOpacity(maxOpacity.updateBean()); heatMapPlot.setMinOpacity(minOpacity.updateBean()); + vanChartValueColorPane.updateBean((VanChartRangeLegend) plot.getLegend()); } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/VanChartMapSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/VanChartMapSeriesPane.java index b24e8fc33d..ccc2e012e5 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/map/VanChartMapSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/map/VanChartMapSeriesPane.java @@ -31,7 +31,7 @@ import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.component.border.VanChartBorderWithAlphaPane; import com.fr.van.chart.designer.component.marker.VanChartImageMarkerPane; import com.fr.van.chart.designer.other.VanChartInteractivePane; -import com.fr.van.chart.designer.style.series.VanChartAbstractPlotSeriesPane; +import com.fr.van.chart.designer.style.series.VanChartColorValueSeriesPane; import com.fr.van.chart.designer.style.series.VanChartEffectPane; import com.fr.van.chart.map.designer.style.series.VanChartMapScatterMarkerPane; import com.fr.van.chart.map.line.VanChartCurvePane; @@ -52,7 +52,7 @@ import java.awt.event.ItemListener; * Created by Mitisky on 16/5/4. * 地图-系列界面 */ -public class VanChartMapSeriesPane extends VanChartAbstractPlotSeriesPane { +public class VanChartMapSeriesPane extends VanChartColorValueSeriesPane { private static final String AREA_STRING = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Region"); private static final String POINT_STRING = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Point"); private static final String LINE_STRING = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Flow"); @@ -163,9 +163,10 @@ public class VanChartMapSeriesPane extends VanChartAbstractPlotSeriesPane { protected JPanel getContentPane(boolean custom) { JPanel panel = new JPanel(new BorderLayout()); mapType = ((VanChartMapPlot) plot).getAllLayersMapType(); - if(mapType == MapType.CUSTOM || mapType == MapType.DRILL_CUSTOM) { - vanChartFillStylePane = getVanChartFillStylePane(); - panel.add(vanChartFillStylePane, BorderLayout.NORTH); + if (mapType == MapType.CUSTOM || mapType == MapType.DRILL_CUSTOM) { + JPanel pane = createColorChoosePane(); + pane.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); + panel.add(pane, BorderLayout.NORTH); } panel.add(getContentInPlotType(), BorderLayout.CENTER); return panel; @@ -176,10 +177,10 @@ public class VanChartMapSeriesPane extends VanChartAbstractPlotSeriesPane { JPanel panel = new JPanel(new BorderLayout()); stylePane = createStylePane(); mapType = ((VanChartMapPlot) plot).getAllLayersMapType(); - if(mapType != MapType.CUSTOM && mapType != MapType.DRILL_CUSTOM) { - vanChartFillStylePane = getVanChartFillStylePane(); - if (vanChartFillStylePane != null) { - panel.add(vanChartFillStylePane, BorderLayout.NORTH); + if (mapType != MapType.CUSTOM && mapType != MapType.DRILL_CUSTOM) { + JPanel pane = createColorChoosePane(); + if (pane != null) { + panel.add(pane, BorderLayout.NORTH); } } setColorPaneContent(panel, paneType); diff --git a/designer-chart/src/main/java/com/fr/van/chart/range/component/GradualLegendPane.java b/designer-chart/src/main/java/com/fr/van/chart/range/component/GradualLegendPane.java index d1858fb13d..88dd54790c 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/range/component/GradualLegendPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/range/component/GradualLegendPane.java @@ -2,68 +2,51 @@ package com.fr.van.chart.range.component; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; - import com.fr.plugin.chart.range.GradualLegend; -import com.fr.van.chart.designer.TableLayout4VanChartHelper; -import com.fr.van.chart.designer.style.VanChartStylePane; import javax.swing.JPanel; import java.awt.BorderLayout; import java.awt.Component; -public class GradualLegendPane extends JPanel{ +public class GradualLegendPane extends JPanel { private static final long serialVersionUID = 1614283200308877353L; private GradualIntervalConfigPane intervalConfigPane; - private LegendLabelFormatPane labelFormPane; - public GradualLegendPane(){ + public GradualLegendPane() { initComponents(); } - public void setParentPane(VanChartStylePane parent) { - labelFormPane.setParentPane(parent); - } private void initComponents() { intervalConfigPane = createGradualIntervalConfigPane(); - JPanel intervalConfigPaneWithTitle = TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Section_Config"),intervalConfigPane); - labelFormPane = new LegendLabelFormatPane(); double p = TableLayout.PREFERRED; double f = TableLayout.FILL; double[] col = {f}; - double[] row = {p, p, p, p}; + double[] row = {p}; Component[][] components = new Component[][]{ - new Component[]{null}, - new Component[]{intervalConfigPaneWithTitle}, - new Component[]{labelFormPane}, + new Component[]{intervalConfigPane}, }; JPanel panel = TableLayoutHelper.createTableLayoutPane(components, row, col); this.setLayout(new BorderLayout()); - this.add(panel,BorderLayout.CENTER); + this.add(panel, BorderLayout.CENTER); } protected GradualIntervalConfigPane createGradualIntervalConfigPane() { return new GradualIntervalConfigPane(); } - public void populate(GradualLegend gradualLegend){ + public void populate(GradualLegend gradualLegend) { if (intervalConfigPane != null) { intervalConfigPane.populate(gradualLegend.getGradualIntervalConfig()); } - if (labelFormPane != null) { - labelFormPane.populate(gradualLegend.getLegendLabelFormat()); - } } - public void update(GradualLegend gradualLegend){ + public void update(GradualLegend gradualLegend) { if (intervalConfigPane != null) { intervalConfigPane.update(gradualLegend.getGradualIntervalConfig()); } - if (labelFormPane != null) { - labelFormPane.update(gradualLegend.getLegendLabelFormat()); - } } } \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/van/chart/range/component/LegendLabelFormatPane.java b/designer-chart/src/main/java/com/fr/van/chart/range/component/LegendLabelFormatPane.java index 79038cdd79..eec9225f58 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/range/component/LegendLabelFormatPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/range/component/LegendLabelFormatPane.java @@ -21,7 +21,7 @@ import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -public class LegendLabelFormatPane extends JPanel{ +public class LegendLabelFormatPane extends JPanel { private static final long serialVersionUID = 1614283200308877354L; private UIButtonGroup labelFormatStyle; @@ -33,25 +33,33 @@ public class LegendLabelFormatPane extends JPanel{ htmlLabelPane.setParent(parent); } - public LegendLabelFormatPane(){ + public LegendLabelFormatPane() { labelFormatStyle = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Common"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Custom")}); - labelFormat = new FormatPaneWithOutFont(); + labelFormat = new FormatPaneWithOutFont() { + @Override + protected Component[][] getComponent(JPanel fontPane, JPanel centerPane, JPanel typePane) { + typePane.setBorder(BorderFactory.createEmptyBorder()); + return new Component[][]{ + new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Base_Format"), SwingConstants.LEFT), typePane}, + new Component[]{null, centerPane}, + }; + } + }; htmlLabelPane = new VanChartHtmlLabelPaneWithOutWidthAndHeight(); - htmlLabelPane.setBorder(BorderFactory.createEmptyBorder(0, (int)TableLayout4VanChartHelper.DESCRIPTION_AREA_WIDTH + TableLayout4VanChartHelper.COMPONENT_INTERVAL,0,0)); + htmlLabelPane.setBorder(BorderFactory.createEmptyBorder(0, (int) TableLayout4VanChartHelper.DESCRIPTION_AREA_WIDTH + TableLayout4VanChartHelper.COMPONENT_INTERVAL, 0, 0)); - - centerPane = new JPanel(new CardLayout()){ + centerPane = new JPanel(new CardLayout()) { @Override public Dimension getPreferredSize() { - if(labelFormatStyle.getSelectedIndex() == 0){ + if (labelFormatStyle.getSelectedIndex() == 0) { return labelFormat.getPreferredSize(); - }else{ + } else { return htmlLabelPane.getPreferredSize(); } } }; - centerPane.add(labelFormat,com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Common")); + centerPane.add(labelFormat, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Common")); centerPane.add(htmlLabelPane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Custom")); @@ -61,11 +69,11 @@ public class LegendLabelFormatPane extends JPanel{ double[] columnSize = {f, e}; double[] rowSize = {p, p, p}; Component[][] components = new Component[][]{ - new Component[]{null,null}, + new Component[]{null, null}, new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Label_Format"), SwingConstants.LEFT), labelFormatStyle}, - new Component[]{centerPane,null}, + new Component[]{centerPane, null}, }; - JPanel contentPane = TableLayout4VanChartHelper.createGapTableLayoutPane(components,rowSize,columnSize); + JPanel contentPane = TableLayout4VanChartHelper.createGapTableLayoutPane(components, rowSize, columnSize); labelFormatStyle.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { @@ -74,19 +82,19 @@ public class LegendLabelFormatPane extends JPanel{ }); labelFormatStyle.setSelectedIndex(0); - JPanel panel = TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Use_Format"), contentPane); + JPanel panel = TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Use_Format"), contentPane); this.setLayout(new BorderLayout()); - this.add(panel,BorderLayout.CENTER); + this.add(panel, BorderLayout.CENTER); } private void checkCardPane(boolean populate) { - if(centerPane != null && labelFormatStyle != null){ + if (centerPane != null && labelFormatStyle != null) { CardLayout cardLayout = (CardLayout) centerPane.getLayout(); if (labelFormatStyle.getSelectedIndex() == 1) { - if(!populate) { + if (!populate) { checkCustomLabelText(); } - cardLayout.show(centerPane,com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Custom")); + cardLayout.show(centerPane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Custom")); } else { cardLayout.show(centerPane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Common")); } @@ -101,21 +109,21 @@ public class LegendLabelFormatPane extends JPanel{ } /*标签部分的更新和存储数据部分要重写*/ - public void populate(LegendLabelFormat legendLabelFormat){ + public void populate(LegendLabelFormat legendLabelFormat) { if (labelFormatStyle != null) { labelFormatStyle.setSelectedIndex(legendLabelFormat.isCommonValueFormat() ? 0 : 1); } if (labelFormat != null) { labelFormat.populateBean(legendLabelFormat.getFormat()); } - if (htmlLabelPane != null){ + if (htmlLabelPane != null) { htmlLabelPane.populate(legendLabelFormat.getHtmlLabel()); } checkCardPane(true); } - public void update(LegendLabelFormat legendLabelFormat){ + public void update(LegendLabelFormat legendLabelFormat) { if (labelFormatStyle != null) { legendLabelFormat.setCommonValueFormat(labelFormatStyle.getSelectedIndex() == 0); } diff --git a/designer-chart/src/main/java/com/fr/van/chart/range/component/SectionIntervalConfigPaneWithOutNum.java b/designer-chart/src/main/java/com/fr/van/chart/range/component/SectionIntervalConfigPaneWithOutNum.java index cad289f100..a6fc4cfbe8 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/range/component/SectionIntervalConfigPaneWithOutNum.java +++ b/designer-chart/src/main/java/com/fr/van/chart/range/component/SectionIntervalConfigPaneWithOutNum.java @@ -5,9 +5,7 @@ import com.fr.design.gui.frpane.AbstractAttrNoScrollPane; import com.fr.design.gui.ilable.BoldFontTextLabel; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.chart.gui.style.series.MapColorPickerPaneWithFormula; -import com.fr.van.chart.designer.TableLayout4VanChartHelper; -import javax.swing.JPanel; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import java.awt.Component; @@ -38,15 +36,6 @@ public class SectionIntervalConfigPaneWithOutNum extends MapColorPickerPaneWithF }); } - @Override - protected JPanel getUpControlPane(Component[][] components) { - double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; - double d = TableLayout4VanChartHelper.DESCRIPTION_AREA_WIDTH; - double[] columnSize = {d, e}; - JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components, getRowSIze(), columnSize); - return panel; - } - private void setRegionVisible(boolean visible) { getRegionNumPane().setVisible(visible); numLabel.setVisible(visible); diff --git a/designer-chart/src/main/java/com/fr/van/chart/range/component/SectionLegendPane.java b/designer-chart/src/main/java/com/fr/van/chart/range/component/SectionLegendPane.java index 828f40d733..f2da407285 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/range/component/SectionLegendPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/range/component/SectionLegendPane.java @@ -5,18 +5,15 @@ import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.chart.gui.style.series.MapColorPickerPaneWithFormula; import com.fr.plugin.chart.range.SectionLegend; -import com.fr.van.chart.designer.TableLayout4VanChartHelper; -import com.fr.van.chart.designer.style.VanChartStylePane; import javax.swing.JPanel; import java.awt.BorderLayout; import java.awt.Component; -public class SectionLegendPane extends JPanel{ +public class SectionLegendPane extends JPanel { private static final long serialVersionUID = 1614283200308877353L; private MapColorPickerPaneWithFormula intervalConfigPane; - private LegendLabelFormatPane labelFormPane; private AbstractAttrNoScrollPane parent; public SectionLegendPane(AbstractAttrNoScrollPane parent) { @@ -24,28 +21,15 @@ public class SectionLegendPane extends JPanel{ initComponents(); } - public void setParentPane(VanChartStylePane parent){ - labelFormPane.setParentPane(parent); - } - private void initComponents() { intervalConfigPane = createSectionIntervalConfigPane(this.parent); - JPanel intervalConfigPaneWithTitle = TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Section_Config"), intervalConfigPane); - labelFormPane = new LegendLabelFormatPane(){ - @Override - protected void checkCustomLabelText() { - setCustomFormatterText(SectionLegend.DEFAULT_LABEL_FUNCTION); - } - }; double p = TableLayout.PREFERRED; double f = TableLayout.FILL; double[] col = {f}; - double[] row = {p, p, p}; + double[] row = {p}; Component[][] components = new Component[][]{ - new Component[]{null}, - new Component[]{intervalConfigPaneWithTitle}, - new Component[]{labelFormPane}, + new Component[]{intervalConfigPane}, }; JPanel panel = TableLayoutHelper.createTableLayoutPane(components, row, col); @@ -55,24 +39,35 @@ public class SectionLegendPane extends JPanel{ } protected MapColorPickerPaneWithFormula createSectionIntervalConfigPane(AbstractAttrNoScrollPane parent) { - return new SectionIntervalConfigPane(parent); + return new SectionIntervalConfigPane(parent) { + private static final int WIDTH = 225; + + @Override + protected int getBoundX() { + return 0; + } + + @Override + protected int getBoundY() { + return 0; + } + + @Override + protected int getBoundWidth() { + return WIDTH; + } + }; } - public void populate(SectionLegend sectionLegend){ + public void populate(SectionLegend sectionLegend) { if (intervalConfigPane != null) { intervalConfigPane.populateBean(sectionLegend.getMapHotAreaColor()); } - if (labelFormPane != null) { - labelFormPane.populate(sectionLegend.getLegendLabelFormat()); - } } - public void update(SectionLegend sectionLegend){ + public void update(SectionLegend sectionLegend) { if (intervalConfigPane != null) { intervalConfigPane.updateBean(sectionLegend.getMapHotAreaColor()); } - if (labelFormPane != null) { - labelFormPane.update(sectionLegend.getLegendLabelFormat()); - } } } \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterSeriesPane.java index 98c900219f..b462faa811 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterSeriesPane.java @@ -13,7 +13,7 @@ import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.component.VanChartLineTypePane; import com.fr.van.chart.designer.component.VanChartMarkerPane; import com.fr.van.chart.designer.component.marker.VanChartCommonMarkerPane; -import com.fr.van.chart.designer.style.series.VanChartAbstractPlotSeriesPane; +import com.fr.van.chart.designer.style.series.VanChartColorValueSeriesPane; import com.fr.van.chart.designer.style.series.VanChartStackedAndAxisListControlPane; import com.fr.van.chart.scatter.component.VanChartScatterLineTypePane; @@ -24,7 +24,7 @@ import java.awt.Component; /** * 散点图的系列界面 */ -public class VanChartScatterSeriesPane extends VanChartAbstractPlotSeriesPane { +public class VanChartScatterSeriesPane extends VanChartColorValueSeriesPane { private static final long serialVersionUID = 5595016643808487932L; public VanChartScatterSeriesPane(ChartStylePane parent, Plot plot) { diff --git a/designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/style/VanChartWordCloudSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/style/VanChartWordCloudSeriesPane.java index 884e96b330..4e9c612c09 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/style/VanChartWordCloudSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/style/VanChartWordCloudSeriesPane.java @@ -18,8 +18,7 @@ import com.fr.general.IOUtils; import com.fr.plugin.chart.wordcloud.CloudShapeType; import com.fr.plugin.chart.wordcloud.VanChartWordCloudPlot; import com.fr.van.chart.designer.TableLayout4VanChartHelper; -import com.fr.van.chart.designer.component.VanChartBeautyPane; -import com.fr.van.chart.designer.style.series.VanChartAbstractPlotSeriesPane; +import com.fr.van.chart.designer.style.series.VanChartColorValueSeriesPane; import javax.swing.JPanel; import java.awt.BorderLayout; @@ -34,7 +33,7 @@ import java.awt.event.ItemListener; /** * Created by Mitisky on 16/11/29. */ -public class VanChartWordCloudSeriesPane extends VanChartAbstractPlotSeriesPane { +public class VanChartWordCloudSeriesPane extends VanChartColorValueSeriesPane { private static final String AUTO_FONT_SIZE = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Auto"); private static final String CUSTOM_FONT_SIZE = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Define_Size"); private static final double MAX_ROTATION = 90; @@ -228,9 +227,4 @@ public class VanChartWordCloudSeriesPane extends VanChartAbstractPlotSeriesPane } } } - - @Override - protected VanChartBeautyPane createStylePane() { - return null; - } } From d3058022afa23d7e3be40b6db8813d66b5c06ed5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E5=B2=B3?= <445798420@qq.com> Date: Wed, 5 Aug 2020 10:58:09 +0800 Subject: [PATCH 23/34] =?UTF-8?q?CHART-12124=20=E4=BB=A3=E7=A0=81=E8=B4=A8?= =?UTF-8?q?=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../style/VanChartRangeLegendPane.java | 30 +++++++------------ 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartRangeLegendPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartRangeLegendPane.java index 837f00dead..5fa030a287 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartRangeLegendPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartRangeLegendPane.java @@ -1,16 +1,13 @@ package com.fr.van.chart.designer.style; -import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.plugin.chart.attr.VanChartLegend; import com.fr.plugin.chart.range.SectionLegend; import com.fr.plugin.chart.range.VanChartRangeLegend; import com.fr.plugin.chart.type.LegendType; -import com.fr.van.chart.range.component.GradualLegendPane; import com.fr.van.chart.range.component.LegendLabelFormatPane; -import com.fr.van.chart.range.component.SectionLegendPane; import javax.swing.JPanel; import java.awt.CardLayout; @@ -25,16 +22,9 @@ public class VanChartRangeLegendPane extends VanChartPlotLegendPane { private static final long serialVersionUID = 1614283200308877353L; //散点图不同类型面板容器,容器布局管理 - private JPanel rangeLegendPane; - - //图例切换按钮 - private UIButtonGroup legendTypeButton; + private JPanel rangeLabelPane; //普通图例面板(因为普通图例没有新内容,故而为空) - private JPanel ordinaryLegendPane; - //渐变色图例面板 - private GradualLegendPane gradualLegendPane; - //区域段图例面板 - private SectionLegendPane sectionLegendPane; + private JPanel ordinaryLabelPane; private LegendLabelFormatPane gradualLabelFormPane; @@ -50,8 +40,8 @@ public class VanChartRangeLegendPane extends VanChartPlotLegendPane { super(parent); } - private JPanel createRangeLegendPane() { - ordinaryLegendPane = new JPanel(); + private JPanel createRangeLabelPane() { + ordinaryLabelPane = new JPanel(); gradualLabelFormPane = new LegendLabelFormatPane(); gradualLabelFormPane.setParentPane(this.getLegendPaneParent()); sectionLabelFormPane = new LegendLabelFormatPane() { @@ -66,7 +56,7 @@ public class VanChartRangeLegendPane extends VanChartPlotLegendPane { @Override public Dimension getPreferredSize() { if (legendType == LegendType.ORDINARY) { - return new Dimension(ordinaryLegendPane.getWidth(), 0); + return new Dimension(ordinaryLabelPane.getWidth(), 0); } else if (legendType == LegendType.GRADUAL) { return gradualLabelFormPane.getPreferredSize(); } else { @@ -75,7 +65,7 @@ public class VanChartRangeLegendPane extends VanChartPlotLegendPane { } }; - panel.add(ordinaryLegendPane, LegendType.ORDINARY.getStringType()); + panel.add(ordinaryLabelPane, LegendType.ORDINARY.getStringType()); panel.add(gradualLabelFormPane, LegendType.GRADUAL.getStringType()); panel.add(sectionLabelFormPane, LegendType.SECTION.getStringType()); @@ -88,7 +78,7 @@ public class VanChartRangeLegendPane extends VanChartPlotLegendPane { @Override protected JPanel createLegendPane() { - rangeLegendPane = createRangeLegendPane(); + rangeLabelPane = createRangeLabelPane(); //不包含新内容的普通面板内容 JPanel commonLegendPane = this.createCommonLegendPane(); @@ -98,15 +88,15 @@ public class VanChartRangeLegendPane extends VanChartPlotLegendPane { double[] col = {f}; double[] row = {p, p}; Component[][] components = new Component[][]{ - new Component[]{rangeLegendPane}, + new Component[]{rangeLabelPane}, new Component[]{commonLegendPane} }; return TableLayoutHelper.createTableLayoutPane(components, row, col); } private void checkCardPane() { - CardLayout cardLayout = (CardLayout) rangeLegendPane.getLayout(); - cardLayout.show(rangeLegendPane, legendType.getStringType()); + CardLayout cardLayout = (CardLayout) rangeLabelPane.getLayout(); + cardLayout.show(rangeLabelPane, legendType.getStringType()); } @Override From f10c5432c9d69ff0eee3302e70e047b4c4bb0234 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E5=B2=B3?= <445798420@qq.com> Date: Wed, 5 Aug 2020 13:32:54 +0800 Subject: [PATCH 24/34] =?UTF-8?q?CHART-12124=20=E5=9B=BE=E4=BE=8B=E5=BD=A2?= =?UTF-8?q?=E6=80=81=E5=92=8C=E7=B3=BB=E5=88=97=E8=89=B2=E5=90=88=E5=B9=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/van/chart/designer/component/VanChartValueColorPane.java | 2 +- .../designer/style/series/VanChartColorValueSeriesPane.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartValueColorPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartValueColorPane.java index 99b2490f6a..d93957c7f6 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartValueColorPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartValueColorPane.java @@ -38,7 +38,7 @@ public class VanChartValueColorPane extends BasicPane { //区域渐变面板 private SectionLegendPane sectionLegendPane; - protected VanChartStylePane parent; + public VanChartStylePane parent; private JPanel rangeLegendPane; diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/series/VanChartColorValueSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/series/VanChartColorValueSeriesPane.java index 5f0bcedc20..c513666227 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/series/VanChartColorValueSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/series/VanChartColorValueSeriesPane.java @@ -34,7 +34,7 @@ public abstract class VanChartColorValueSeriesPane extends VanChartAbstractPlotS //颜色划分切换 private UIButtonGroup colorDivideButton; - protected VanChartValueColorPane vanChartValueColorPane; + public VanChartValueColorPane vanChartValueColorPane; private JPanel colorDividePane; From 842c3464969a456bc6fc509ef0ff1e605e407813 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E5=B2=B3?= <445798420@qq.com> Date: Wed, 5 Aug 2020 14:26:41 +0800 Subject: [PATCH 25/34] CHART-12124 --- .../component/VanChartHeatValueColorPane.java | 2 +- .../designer/component/VanChartValueColorPane.java | 6 +++++- .../style/series/VanChartColorValueSeriesPane.java | 11 ++++++++++- .../designer/style/VanChartHeatMapSeriesPane.java | 8 ++++---- 4 files changed, 20 insertions(+), 7 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartHeatValueColorPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartHeatValueColorPane.java index 0241da848e..dac55c81c1 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartHeatValueColorPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartHeatValueColorPane.java @@ -46,7 +46,7 @@ public class VanChartHeatValueColorPane extends VanChartValueColorPane { } protected SectionLegendPane createSectionLegendPane() { - return new SectionLegendPane(parent) { + return new SectionLegendPane(getVanChartStylePane()) { @Override protected MapColorPickerPaneWithFormula createSectionIntervalConfigPane(AbstractAttrNoScrollPane parent) { return new SectionIntervalConfigPaneWithOutNum(parent) { diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartValueColorPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartValueColorPane.java index d93957c7f6..c0d2ea7f4f 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartValueColorPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartValueColorPane.java @@ -38,7 +38,7 @@ public class VanChartValueColorPane extends BasicPane { //区域渐变面板 private SectionLegendPane sectionLegendPane; - public VanChartStylePane parent; + private VanChartStylePane parent; private JPanel rangeLegendPane; @@ -47,6 +47,10 @@ public class VanChartValueColorPane extends BasicPane { initComponents(); } + public VanChartStylePane getVanChartStylePane() { + return parent; + } + public void initComponents() { valueColorTypeButton = createLegendTypeButton(); valueColorTypeButton.addActionListener(new ActionListener() { diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/series/VanChartColorValueSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/series/VanChartColorValueSeriesPane.java index c513666227..34f86d0200 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/series/VanChartColorValueSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/series/VanChartColorValueSeriesPane.java @@ -34,7 +34,7 @@ public abstract class VanChartColorValueSeriesPane extends VanChartAbstractPlotS //颜色划分切换 private UIButtonGroup colorDivideButton; - public VanChartValueColorPane vanChartValueColorPane; + private VanChartValueColorPane vanChartValueColorPane; private JPanel colorDividePane; @@ -42,6 +42,15 @@ public abstract class VanChartColorValueSeriesPane extends VanChartAbstractPlotS super(parent, plot); } + + public VanChartValueColorPane getVanChartValueColorPane() { + return vanChartValueColorPane; + } + + public void setVanChartValueColorPane(VanChartValueColorPane vanChartValueColorPane) { + this.vanChartValueColorPane = vanChartValueColorPane; + } + //获取颜色面板 protected JPanel getColorPane() { JPanel panel = new JPanel(new BorderLayout()); diff --git a/designer-chart/src/main/java/com/fr/van/chart/heatmap/designer/style/VanChartHeatMapSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/heatmap/designer/style/VanChartHeatMapSeriesPane.java index ae1025530a..6e4309a870 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/heatmap/designer/style/VanChartHeatMapSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/heatmap/designer/style/VanChartHeatMapSeriesPane.java @@ -104,14 +104,14 @@ public class VanChartHeatMapSeriesPane extends VanChartMapSeriesPane { } private JPanel createHeatColorPane() { - vanChartValueColorPane = new VanChartHeatValueColorPane((VanChartStylePane) parentPane); + setVanChartValueColorPane(new VanChartHeatValueColorPane((VanChartStylePane) parentPane)); double p = TableLayout.PREFERRED; double f = TableLayout.FILL; double[] row = {p}; double[] col = {f}; Component[][] components = new Component[][]{ - new Component[]{vanChartValueColorPane}, + new Component[]{getVanChartFillStylePane()}, }; JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components, row, col); @@ -172,7 +172,7 @@ public class VanChartHeatMapSeriesPane extends VanChartMapSeriesPane { blur.setValue(heatMapPlot.getBlur()); maxOpacity.populateBean(heatMapPlot.getMaxOpacity()); minOpacity.populateBean(heatMapPlot.getMinOpacity()); - vanChartValueColorPane.populateBean((VanChartRangeLegend) plot.getLegend()); + getVanChartValueColorPane().populateBean((VanChartRangeLegend) plot.getLegend()); } } @@ -190,7 +190,7 @@ public class VanChartHeatMapSeriesPane extends VanChartMapSeriesPane { heatMapPlot.setBlur(blur.getValue()); heatMapPlot.setMaxOpacity(maxOpacity.updateBean()); heatMapPlot.setMinOpacity(minOpacity.updateBean()); - vanChartValueColorPane.updateBean((VanChartRangeLegend) plot.getLegend()); + getVanChartValueColorPane().updateBean((VanChartRangeLegend) plot.getLegend()); } } From f9ba3d5093db497027128414a82912e792e45bec Mon Sep 17 00:00:00 2001 From: "Qinghui.Liu" Date: Wed, 5 Aug 2020 14:47:19 +0800 Subject: [PATCH 26/34] =?UTF-8?q?CHART-14936=20=E5=88=9D=E5=A7=8B=E5=8C=96?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E7=B1=BB=E5=9E=8B=E5=88=87=E6=8D=A2button?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../van/chart/box/data/report/BoxPlotReportDataContentPane.java | 2 ++ .../van/chart/box/data/table/BoxPlotTableDataContentPane.java | 1 + 2 files changed, 3 insertions(+) diff --git a/designer-chart/src/main/java/com/fr/van/chart/box/data/report/BoxPlotReportDataContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/box/data/report/BoxPlotReportDataContentPane.java index b43af66908..01da599608 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/box/data/report/BoxPlotReportDataContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/box/data/report/BoxPlotReportDataContentPane.java @@ -37,6 +37,7 @@ public class BoxPlotReportDataContentPane extends AbstractReportDataContentPane this.add(createSeriesPane(parent), BorderLayout.CENTER); initDataTypeListener(); + checkDataPaneVisible(); } private JPanel createDataTypePane() { @@ -52,6 +53,7 @@ public class BoxPlotReportDataContentPane extends AbstractReportDataContentPane }; dataType = new UIButtonGroup(names); + dataType.setSelectedIndex(0); dataType.setPreferredSize(new Dimension(100, 20)); pane.add(GUICoreUtils.createBorderLayoutPane(new Component[]{dataType, null, null, label, null})); diff --git a/designer-chart/src/main/java/com/fr/van/chart/box/data/table/BoxPlotTableDataContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/box/data/table/BoxPlotTableDataContentPane.java index cb2de668a0..2c53109264 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/box/data/table/BoxPlotTableDataContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/box/data/table/BoxPlotTableDataContentPane.java @@ -63,6 +63,7 @@ public class BoxPlotTableDataContentPane extends AbstractTableDataContentPane { }; dataType = new UIButtonGroup(names); + dataType.setSelectedIndex(0); dataType.setPreferredSize(new Dimension(100, 20)); pane.add(GUICoreUtils.createBorderLayoutPane(new Component[]{dataType, null, null, label, null})); From 9d434f6b36d2cb452d10a1187ea5fae7764397c7 Mon Sep 17 00:00:00 2001 From: hades Date: Wed, 5 Aug 2020 15:38:32 +0800 Subject: [PATCH 27/34] =?UTF-8?q?REPORT-36386=20=E8=87=AA=E9=80=82?= =?UTF-8?q?=E5=BA=94=E6=A8=A1=E6=9D=BF=E5=87=BA=E7=8E=B0=E4=B8=8D=E8=87=AA?= =?UTF-8?q?=E9=80=82=E5=BA=94=E6=83=85=E5=86=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/designer/creator/XWFitLayout.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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 2376ecc94a..3b671c2179 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 @@ -19,6 +19,7 @@ import com.fr.form.ui.container.WBodyLayoutType; import com.fr.form.ui.container.WFitLayout; import com.fr.form.ui.container.WLayout; import com.fr.form.ui.widget.CRBoundsWidget; +import com.fr.general.ComparatorUtils; import com.fr.general.FRLogger; import com.fr.general.FRScreen; import com.fr.stable.ArrayUtils; @@ -1125,7 +1126,12 @@ public class XWFitLayout extends XLayoutContainer { public Component getBottomComp(int x, int y, int h) { int val = getAcualInterval(); - return this.getComponentAt(x, y+h+default_Length+val); + Component comp = this.getComponentAt(x, y+h+default_Length+val); + if (ComparatorUtils.equals(this, comp)) { + // 如果获取组件等于自身 说明存在偏移 加上一个默认偏移量 + return this.getComponentAt(x + default_Length, y+h+default_Length+val); + } + return comp; } public Component getRightTopComp(int x, int y, int w) { From bf86c35f277a7a66b0b146c22a713a45f2ecc353 Mon Sep 17 00:00:00 2001 From: hades Date: Wed, 5 Aug 2020 16:22:32 +0800 Subject: [PATCH 28/34] =?UTF-8?q?REPORT-34847=20=E8=BF=9C=E7=A8=8B?= =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E6=9D=83=E9=99=90-=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E5=A4=B9=E6=9D=83=E9=99=90=EF=BC=8C=E9=9C=80=E8=A6=81=E9=87=8D?= =?UTF-8?q?=E6=96=B0=E8=BF=9E=E6=8E=A5=E6=89=8D=E8=83=BD=E7=94=9F=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/file/TemplateTreePane.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java b/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java index 93001bde44..5041cc34a3 100644 --- a/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java +++ b/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java @@ -226,6 +226,8 @@ public class TemplateTreePane extends JPanel implements FileOperations { */ @Override public void refresh() { + // 刷新远程文件夹权限 + NodeAuthProcessor.getInstance().refresh(); reportletsTree.refresh(); FineLoggerFactory.getLogger().info(Toolkit.i18nText("Fine-Design_Basic_Template_File_Tree_Refresh_Successfully") + "!"); } From 64524368490011729f7adcb374ff8814e95bfafe Mon Sep 17 00:00:00 2001 From: "Qinghui.Liu" Date: Wed, 5 Aug 2020 17:17:22 +0800 Subject: [PATCH 29/34] =?UTF-8?q?CHART-14928=20=E6=95=B0=E6=8D=AE=E6=A0=BC?= =?UTF-8?q?=E5=BC=8F=E6=94=B9=E4=B8=BA=E6=95=B0=E6=8D=AE=E5=BD=A2=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../van/chart/box/data/report/BoxPlotReportDataContentPane.java | 2 +- .../van/chart/box/data/table/BoxPlotTableDataContentPane.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/box/data/report/BoxPlotReportDataContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/box/data/report/BoxPlotReportDataContentPane.java index 01da599608..a2cf8628b6 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/box/data/report/BoxPlotReportDataContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/box/data/report/BoxPlotReportDataContentPane.java @@ -44,7 +44,7 @@ public class BoxPlotReportDataContentPane extends AbstractReportDataContentPane JPanel pane = new JPanel(new BorderLayout(4, 0)); pane.setBorder(BorderFactory.createMatteBorder(0, 0, 6, 1, getBackground())); - UILabel label = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Data_Type")); + UILabel label = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Data_Form")); label.setPreferredSize(new Dimension(ChartDataPane.LABEL_WIDTH, ChartDataPane.LABEL_HEIGHT)); String[] names = new String[]{ diff --git a/designer-chart/src/main/java/com/fr/van/chart/box/data/table/BoxPlotTableDataContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/box/data/table/BoxPlotTableDataContentPane.java index 2c53109264..92b554d0d2 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/box/data/table/BoxPlotTableDataContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/box/data/table/BoxPlotTableDataContentPane.java @@ -54,7 +54,7 @@ public class BoxPlotTableDataContentPane extends AbstractTableDataContentPane { JPanel pane = new JPanel(new BorderLayout(4, 0)); pane.setBorder(BorderFactory.createMatteBorder(0, 0, 6, 1, getBackground())); - UILabel label = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Data_Type")); + UILabel label = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Data_Form")); label.setPreferredSize(new Dimension(ChartDataPane.LABEL_WIDTH, ChartDataPane.LABEL_HEIGHT)); String[] names = new String[]{ From 3470b1c3730f4d512e822541b9c0bb935bb5e8ad Mon Sep 17 00:00:00 2001 From: "Henry.Wang" Date: Wed, 5 Aug 2020 20:02:03 +0800 Subject: [PATCH 30/34] =?UTF-8?q?REPORT-35569=20=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E9=9D=A2=E6=9D=BF=EF=BC=8C=E6=B7=BB=E5=8A=A0=E4=B8=80=E4=B8=AA?= =?UTF-8?q?=E5=8F=82=E6=95=B0=E6=8E=A7=E4=BB=B6=EF=BC=8C=E6=92=A4=E9=94=80?= =?UTF-8?q?=E4=B9=8B=E5=90=8E=EF=BC=8C=E5=86=8D=E6=AC=A1=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E7=9A=84=E6=8E=A7=E4=BB=B6=E4=BC=9A=E7=A9=BA=E4=B8=80=E4=B8=AA?= =?UTF-8?q?=E4=BD=8D=E7=BD=AE=E6=B7=BB=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../parameter/ParameterDesignerProvider.java | 6 ++- .../form/parameter/FormParaDesigner.java | 45 ++++++++++++++++++- .../parameter/ParameterDefinitePane.java | 2 +- 3 files changed, 49 insertions(+), 4 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/parameter/ParameterDesignerProvider.java b/designer-base/src/main/java/com/fr/design/parameter/ParameterDesignerProvider.java index e0b69fea05..efafa7cb2e 100644 --- a/designer-base/src/main/java/com/fr/design/parameter/ParameterDesignerProvider.java +++ b/designer-base/src/main/java/com/fr/design/parameter/ParameterDesignerProvider.java @@ -48,7 +48,11 @@ public interface ParameterDesignerProvider { boolean addingParameter2EditorWithQueryButton(Parameter parameter, int index); - int addingAllParameter2Editor(Parameter[] parameterArray, int currentIndex); + void addingAllParameter2Editor(Parameter[] parameterArray, int currentIndex); + + default int addingAllParameter2EditorWithReturnValue(Parameter[] parameterArray, int currentIndex) { + return 0; + } JPanel[] toolbarPanes4Form(); diff --git a/designer-form/src/main/java/com/fr/design/form/parameter/FormParaDesigner.java b/designer-form/src/main/java/com/fr/design/form/parameter/FormParaDesigner.java index b918850616..95fb284589 100644 --- a/designer-form/src/main/java/com/fr/design/form/parameter/FormParaDesigner.java +++ b/designer-form/src/main/java/com/fr/design/form/parameter/FormParaDesigner.java @@ -637,9 +637,50 @@ public class FormParaDesigner extends FormDesigner implements ParameterDesignerP * * @param parameterArray 参数 c * @param currentIndex 位置 w - * @return currentIndex的最新值 + * @return 是否加入 s + */ + public void addingAllParameter2Editor(Parameter[] parameterArray, int currentIndex) { + for (int i = 0; i < parameterArray.length; i++) { + com.fr.form.ui.Label label = new com.fr.form.ui.Label(); + label.setWidgetName("Label" + parameterArray[i].getName()); + label.setWidgetValue(new WidgetValue(parameterArray[i].getName() + ":")); + XCreator xCreator = XCreatorUtils.createXCreator(label); + + if (!(this.autoAddComponent(xCreator, H_COMPONENT_GAP * (currentIndex % NUM_IN_A_LINE) + + FIRST_H_LOCATION, FIRST_V_LOCATION + V_COMPONENT_GAP * (currentIndex / NUM_IN_A_LINE)))) { + break; + } + // 每行显示5组 + EditorHolder editor = new EditorHolder(parameterArray[i]); + editor.setWidgetName(parameterArray[i].getName()); + xCreator = XCreatorUtils.createXCreator(editor); + if (!(this.autoAddComponent(xCreator, H_COMPONENT_GAP * (currentIndex % NUM_IN_A_LINE) + + SECOND_H_LOCATION, FIRST_V_LOCATION + V_COMPONENT_GAP * (currentIndex / NUM_IN_A_LINE)))) { + break; + } + currentIndex++; + } + if (!isWithQueryButton()) { + FormSubmitButton formSubmitButton = new FormSubmitButton(); + formSubmitButton.setWidgetName("Search"); + formSubmitButton.setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Query")); + XCreator xCreator = XCreatorUtils.createXCreator(formSubmitButton); + if (!(this.autoAddComponent(xCreator, H_COMPONENT_GAP * 3 + H_GAP, FIRST_V_LOCATION + + V_COMPONENT_GAP * (currentIndex / NUM_IN_A_LINE)))) { + return; + } + } + } + + /** + * @Description: 添加所有的参数,并返回当前的currentIndex。此方法为addingAllParameter2Editor的兼容方法。 + * @param parameterArray 参数数组 + * @param currentIndex 添加所有参数前的index值 + * @return: 添加所有参数后的index值 + * @Author: Henry.Wang + * @date: 2020/8/5 19:40 */ - public int addingAllParameter2Editor(Parameter[] parameterArray, int currentIndex) { + public int addingAllParameter2EditorWithReturnValue(Parameter[] parameterArray, int currentIndex) { for (int i = 0; i < parameterArray.length; i++) { com.fr.form.ui.Label label = new com.fr.form.ui.Label(); label.setWidgetName("Label" + parameterArray[i].getName()); diff --git a/designer-realize/src/main/java/com/fr/design/parameter/ParameterDefinitePane.java b/designer-realize/src/main/java/com/fr/design/parameter/ParameterDefinitePane.java index 74f1435a4d..11ae412ece 100644 --- a/designer-realize/src/main/java/com/fr/design/parameter/ParameterDefinitePane.java +++ b/designer-realize/src/main/java/com/fr/design/parameter/ParameterDefinitePane.java @@ -458,7 +458,7 @@ public class ParameterDefinitePane extends JPanel implements ToolBarMenuDockPlus return; } - currentIndex = paraDesignEditor.addingAllParameter2Editor(parameterArray, currentIndex); + currentIndex = paraDesignEditor.addingAllParameter2EditorWithReturnValue(parameterArray, currentIndex); parameterArray = null; refreshParameter(); From eb4e56f8e52d1c5a975d126d2b530d0a20270169 Mon Sep 17 00:00:00 2001 From: hades Date: Wed, 5 Aug 2020 20:35:16 +0800 Subject: [PATCH 31/34] =?UTF-8?q?=E6=97=A0jira=20=E7=BC=96=E8=AF=91?= =?UTF-8?q?=E7=AD=89=E7=BA=A7=E8=B0=83=E5=88=B01.8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 407f1fd17b..711751c9fb 100644 --- a/pom.xml +++ b/pom.xml @@ -28,8 +28,8 @@ maven-compiler-plugin 3.1 - 1.7 - 1.7 + 1.8 + 1.8 From d0622eae43b5a8dc64e4c66f82fdf9ffef23317b Mon Sep 17 00:00:00 2001 From: "Henry.Wang" Date: Wed, 5 Aug 2020 22:18:34 +0800 Subject: [PATCH 32/34] =?UTF-8?q?REPORT-35569=20=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E9=9D=A2=E6=9D=BF=EF=BC=8C=E6=B7=BB=E5=8A=A0=E4=B8=80=E4=B8=AA?= =?UTF-8?q?=E5=8F=82=E6=95=B0=E6=8E=A7=E4=BB=B6=EF=BC=8C=E6=92=A4=E9=94=80?= =?UTF-8?q?=E4=B9=8B=E5=90=8E=EF=BC=8C=E5=86=8D=E6=AC=A1=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E7=9A=84=E6=8E=A7=E4=BB=B6=E4=BC=9A=E7=A9=BA=E4=B8=80=E4=B8=AA?= =?UTF-8?q?=E4=BD=8D=E7=BD=AE=E6=B7=BB=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../form/parameter/FormParaDesigner.java | 35 ++----------------- 1 file changed, 3 insertions(+), 32 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/form/parameter/FormParaDesigner.java b/designer-form/src/main/java/com/fr/design/form/parameter/FormParaDesigner.java index 95fb284589..8956125eb3 100644 --- a/designer-form/src/main/java/com/fr/design/form/parameter/FormParaDesigner.java +++ b/designer-form/src/main/java/com/fr/design/form/parameter/FormParaDesigner.java @@ -640,42 +640,13 @@ public class FormParaDesigner extends FormDesigner implements ParameterDesignerP * @return 是否加入 s */ public void addingAllParameter2Editor(Parameter[] parameterArray, int currentIndex) { - for (int i = 0; i < parameterArray.length; i++) { - com.fr.form.ui.Label label = new com.fr.form.ui.Label(); - label.setWidgetName("Label" + parameterArray[i].getName()); - label.setWidgetValue(new WidgetValue(parameterArray[i].getName() + ":")); - XCreator xCreator = XCreatorUtils.createXCreator(label); - - if (!(this.autoAddComponent(xCreator, H_COMPONENT_GAP * (currentIndex % NUM_IN_A_LINE) - + FIRST_H_LOCATION, FIRST_V_LOCATION + V_COMPONENT_GAP * (currentIndex / NUM_IN_A_LINE)))) { - break; - } - // 每行显示5组 - EditorHolder editor = new EditorHolder(parameterArray[i]); - editor.setWidgetName(parameterArray[i].getName()); - xCreator = XCreatorUtils.createXCreator(editor); - if (!(this.autoAddComponent(xCreator, H_COMPONENT_GAP * (currentIndex % NUM_IN_A_LINE) - + SECOND_H_LOCATION, FIRST_V_LOCATION + V_COMPONENT_GAP * (currentIndex / NUM_IN_A_LINE)))) { - break; - } - currentIndex++; - } - if (!isWithQueryButton()) { - FormSubmitButton formSubmitButton = new FormSubmitButton(); - formSubmitButton.setWidgetName("Search"); - formSubmitButton.setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Query")); - XCreator xCreator = XCreatorUtils.createXCreator(formSubmitButton); - if (!(this.autoAddComponent(xCreator, H_COMPONENT_GAP * 3 + H_GAP, FIRST_V_LOCATION - + V_COMPONENT_GAP * (currentIndex / NUM_IN_A_LINE)))) { - return; - } - } + addingAllParameter2EditorWithReturnValue(parameterArray, currentIndex); } /** - * @Description: 添加所有的参数,并返回当前的currentIndex。此方法为addingAllParameter2Editor的兼容方法。 * @param parameterArray 参数数组 - * @param currentIndex 添加所有参数前的index值 + * @param currentIndex 添加所有参数前的index值 + * @Description: 添加所有的参数,并返回当前的currentIndex。此方法为addingAllParameter2Editor的兼容方法。 * @return: 添加所有参数后的index值 * @Author: Henry.Wang * @date: 2020/8/5 19:40 From 0c85389c790c74cb905e4842d40bdb58e4f86cf9 Mon Sep 17 00:00:00 2001 From: Yvan Date: Thu, 6 Aug 2020 10:42:20 +0800 Subject: [PATCH 33/34] =?UTF-8?q?=E4=B8=BB=E8=A6=81=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=EF=BC=9A=20=E4=BF=AE=E6=94=B9=E4=BA=86=E5=AF=B9=E6=90=9C?= =?UTF-8?q?=E7=B4=A2=E7=BB=93=E6=9E=9C=E6=8E=92=E5=BA=8F=E7=9A=84=E6=AF=94?= =?UTF-8?q?=E8=BE=83=E5=99=A8=EF=BC=8C=E5=88=86=E4=B8=BA=E4=BB=A5=E5=85=B3?= =?UTF-8?q?=E9=94=AE=E8=AF=8D=E5=BC=80=E5=A4=B4=E5=92=8C=E4=B8=8D=E4=BB=A5?= =?UTF-8?q?=E5=85=B3=E9=94=AE=E8=AF=8D=E5=BC=80=E5=A4=B4=E4=B8=A4=E9=83=A8?= =?UTF-8?q?=E5=88=86=EF=BC=8C=E5=90=84=E8=87=AA=E4=BB=A5=E5=AD=97=E6=AF=8D?= =?UTF-8?q?=E8=A1=A8=E9=A1=BA=E5=BA=8F=E6=8E=92=E5=88=97=EF=BC=8C=E5=85=B6?= =?UTF-8?q?=E4=B8=AD=E5=9C=A8=E4=BB=A5=E5=85=B3=E9=94=AE=E8=AF=8D=E5=BC=80?= =?UTF-8?q?=E5=A4=B4=E7=9A=84=E9=83=A8=E5=88=86=EF=BC=8C=E6=9C=80=E4=B8=BA?= =?UTF-8?q?=E5=8C=B9=E9=85=8D=E5=85=B3=E9=94=AE=E8=AF=8D=E7=9A=84=E6=94=BE?= =?UTF-8?q?=E5=9C=A8=E7=AC=AC=E4=B8=80=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/formula/FormulaPane.java | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 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 96a82d228f..8b68dcdbe4 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 @@ -1008,15 +1008,23 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { this.searchKey = searchKey.toLowerCase(); } + /** + * 把以关键词开头的和不以关键词开头的分别按照字母表顺序排序 + * @param o1 待比较对象1 + * @param o2 待比较对象2 + * @return 比较结果,1表示 o1 > o2, -1表示 o1 < o2, 0表示 o1 = o2 + */ @Override public int compare(String o1, String o2) { - if (o1.toLowerCase().startsWith(searchKey)) { - return -1; - } - if (o2.toLowerCase().startsWith(searchKey)) { - return 1; + int result; + boolean o1StartWith = o1.toLowerCase().startsWith(searchKey); + boolean o2StartWith = o2.toLowerCase().startsWith(searchKey); + if (o1StartWith) { + result = o2StartWith ? o1.compareTo(o2) : -1; + } else { + result = o2StartWith ? 1 : o1.compareTo(o2); } - return o2.compareTo(o1); + return result; } } From af69f42bd7fd29bce997f9b609a6e7b3d1091d2b Mon Sep 17 00:00:00 2001 From: Yvan Date: Thu, 6 Aug 2020 11:05:10 +0800 Subject: [PATCH 34/34] =?UTF-8?q?=E4=B8=BB=E8=A6=81=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=EF=BC=9A=20=E8=A1=A5=E5=85=85=E4=BA=86=E4=B8=80=E4=B8=AAtest?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/formula/FormulaPaneTest.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/designer-base/src/test/java/com/fr/design/formula/FormulaPaneTest.java b/designer-base/src/test/java/com/fr/design/formula/FormulaPaneTest.java index c82423daa3..4ac71b5ac0 100644 --- a/designer-base/src/test/java/com/fr/design/formula/FormulaPaneTest.java +++ b/designer-base/src/test/java/com/fr/design/formula/FormulaPaneTest.java @@ -22,4 +22,12 @@ public class FormulaPaneTest extends TestCase { Assert.assertArrayEquals(result, strs); } -} \ No newline at end of file + @Test + public void test4SimilarComparator() { + String[] strs = new String[]{"TESTB", "TESTACD", "Ftest", "Gtest", "TEST"}; + String[] result = new String[]{"TEST", "TESTACD", "TESTB", "Ftest", "Gtest"}; + Arrays.sort(strs, new FormulaPane.SimilarComparator("test")); + Assert.assertArrayEquals(result, strs); + } + +}