From 0ecd214c014ba5532628510c3993f2f4dff69b75 Mon Sep 17 00:00:00 2001 From: Yvan Date: Wed, 9 Dec 2020 21:17:44 +0800 Subject: [PATCH 01/10] =?UTF-8?q?REPORT-44714=20=E3=80=9010.0.12=E5=86=92?= =?UTF-8?q?=E7=83=9F=E3=80=91=E8=AE=BE=E8=AE=A1=E5=99=A8=E7=BC=93=E5=AD=98?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E8=AE=B0=E5=BD=95=E8=AE=BE=E8=AE=A1=E5=99=A8?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E5=A4=B1=E6=95=88=20=E3=80=90=E9=97=AE?= =?UTF-8?q?=E9=A2=98=E5=8E=9F=E5=9B=A0=E3=80=91=E5=AE=9E=E9=99=85=E4=B8=8A?= =?UTF-8?q?=E7=BC=93=E5=AD=98=E6=96=87=E4=BB=B6=E7=9A=84=E5=AD=98=E5=8F=96?= =?UTF-8?q?=E6=B2=A1=E6=9C=89=E9=97=AE=E9=A2=98=EF=BC=8C=E4=BD=86=E6=98=AF?= =?UTF-8?q?=E5=9B=A0=E4=B8=BA=E6=AD=A4=E5=89=8D=E7=BC=93=E5=AD=98=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E4=B8=AD=E8=AE=B0=E5=BD=95=E7=9A=84=E6=98=AF=E4=B8=8A?= =?UTF-8?q?=E5=AD=90=E9=9D=A2=E6=9D=BF=E7=9A=84=E9=AB=98=E5=BA=A6=E5=80=BC?= =?UTF-8?q?=EF=BC=8C=E8=80=8C=E5=9C=A8=E8=AE=BE=E8=AE=A1=E5=99=A8=E7=9A=84?= =?UTF-8?q?=E6=89=93=E5=BC=80=E8=BF=87=E7=A8=8B=E4=B8=AD=EF=BC=8C=E7=88=B6?= =?UTF-8?q?=E5=AE=B9=E5=99=A8=E7=9A=84=E9=AB=98=E5=BA=A6=E4=BC=9A=E5=8F=98?= =?UTF-8?q?=E5=8C=96(=E4=B8=94=E6=9C=89=E6=97=B6=E5=80=99=E5=8F=98?= =?UTF-8?q?=E4=B8=BA=E8=B4=9F=E6=95=B0)=EF=BC=8C=E5=AF=BC=E8=87=B4?= =?UTF-8?q?=E4=BA=86=E5=85=B3=E9=97=AD=E8=AE=BE=E8=AE=A1=E5=99=A8=E5=89=8D?= =?UTF-8?q?=EF=BC=8C=E4=B8=8A=E5=AD=90=E9=9D=A2=E6=9D=BF=E7=9B=B8=E5=AF=B9?= =?UTF-8?q?=E4=BA=8E=E7=88=B6=E5=AE=B9=E5=99=A8=E9=AB=98=E5=BA=A6=E7=9A=84?= =?UTF-8?q?=E6=AF=94=E4=BE=8B=E4=B8=8E=E6=89=93=E5=BC=80=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E4=B9=8B=E5=90=8E=E7=9A=84=E6=AF=94=E4=BE=8B=E4=B8=8D?= =?UTF-8?q?=E5=90=8C=EF=BC=8C=E8=A7=86=E8=A7=89=E4=B8=8A=E5=B0=B1=E5=87=BA?= =?UTF-8?q?=E7=8E=B0=E4=BA=86=E9=9D=A2=E6=9D=BF=E9=AB=98=E5=BA=A6=E7=9A=84?= =?UTF-8?q?=E5=81=8F=E5=B7=AE=20=E3=80=90=E6=94=B9=E5=8A=A8=E6=80=9D?= =?UTF-8?q?=E8=B7=AF=E3=80=91=E5=B0=86=E4=B9=8B=E5=89=8D=E7=9A=84=E6=80=9D?= =?UTF-8?q?=E8=B7=AF=E4=BF=AE=E6=94=B9=E4=B8=BA=EF=BC=8C=E5=9C=A8=E5=AE=B9?= =?UTF-8?q?=E5=99=A8=E9=AB=98=E5=BA=A6=E5=8F=91=E7=94=9F=E5=8F=98=E5=8C=96?= =?UTF-8?q?=E6=97=B6=EF=BC=8C=E6=A0=B9=E6=8D=AE=E4=B8=8A=E5=AD=90=E9=9D=A2?= =?UTF-8?q?=E6=9D=BF=E5=8D=A0=E5=AE=B9=E5=99=A8=E9=AB=98=E5=BA=A6=E7=9A=84?= =?UTF-8?q?=E6=AF=94=E4=BE=8B=E5=8E=BB=E8=B0=83=E6=95=B4=E4=B8=8A=E5=AD=90?= =?UTF-8?q?=E9=9D=A2=E6=9D=BF=E7=9A=84=E9=AB=98=E5=BA=A6=EF=BC=8C=E4=B8=94?= =?UTF-8?q?=E5=B0=86=E7=BC=93=E5=AD=98=E6=96=87=E4=BB=B6=E4=B8=AD=E5=AD=98?= =?UTF-8?q?=E5=82=A8=E4=B8=8A=E5=AD=90=E9=9D=A2=E6=9D=BF=E9=AB=98=E5=BA=A6?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=BA=E5=AD=98=E5=82=A8=E6=AF=94=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/DesignerEnvManager.java | 27 ++++++------- .../gui/icontainer/UIResizableContainer.java | 38 +++++++++++++------ .../fr/design/mainframe/DesignerFrame.java | 4 +- .../mainframe/WestRegionContainerPane.java | 16 ++++---- 4 files changed, 49 insertions(+), 36 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java b/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java index c6488d330..8d7c53645 100644 --- a/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java +++ b/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java @@ -141,8 +141,8 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { private int eastRegionToolPaneY = 300; private int eastRegionContainerWidth = 260; - private int westRegionToolPaneY = 300; private int westRegionContainerWidth = 240; + private double westRegionToolPaneYRate = 0.5; private String encryptionKey; private String jdkHome; @@ -440,14 +440,12 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { this.lastOpenFilePath = lastOpenFilePath; } - /** - * 得到西面板的上下子面板的高度区分 - * + * 获取东面板的上子面板的高度占容器总高度的比例 * @return */ - public int getLastWestRegionToolPaneY() { - return this.westRegionToolPaneY; + public double getLastWestRegionToolPaneYRate() { + return westRegionToolPaneYRate; } /** @@ -460,12 +458,11 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { } /** - * 设置西面板的上下子面板的高度区分 - * - * @param toolPaneY + * 设置关闭设计器前,东面板的上子面板的高度占容器总高度的比例 + * @param westRegionToolPaneYRate */ - public void setLastWestRegionToolPaneY(int toolPaneY) { - this.westRegionToolPaneY = toolPaneY; + public void setLastWestRegionToolPaneYRate(double westRegionToolPaneYRate) { + this.westRegionToolPaneYRate = westRegionToolPaneYRate; } /** @@ -1610,8 +1607,8 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { private void readLastWestRegionLayout(XMLableReader reader) { String tmpVal; - if ((tmpVal = reader.getAttrAsString("toolPaneY", null)) != null) { - this.setLastWestRegionToolPaneY(Integer.parseInt(tmpVal)); + if ((tmpVal = reader.getAttrAsString("toolPaneYRate", null)) != null) { + this.setLastWestRegionToolPaneYRate(Double.parseDouble(tmpVal)); } if ((tmpVal = reader.getAttrAsString("containerWidth", null)) != null) { this.setLastWestRegionContainerWidth(Integer.parseInt(tmpVal)); @@ -1934,8 +1931,8 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { private void writeLastWestRegionLayout(XMLPrintWriter writer) { writer.startTAG("LastWestRegionLayout"); - if (this.getLastWestRegionToolPaneY() >= 0) { - writer.attr("toolPaneY ", this.getLastWestRegionToolPaneY()); + if (this.getLastWestRegionToolPaneYRate() >= 0) { + writer.attr("toolPaneYRate", this.getLastWestRegionToolPaneYRate()); } if (this.getLastWestRegionContainerWidth() >= 0) { writer.attr("containerWidth", this.getLastWestRegionContainerWidth()); diff --git a/designer-base/src/main/java/com/fr/design/gui/icontainer/UIResizableContainer.java b/designer-base/src/main/java/com/fr/design/gui/icontainer/UIResizableContainer.java index 4f4ac9e3b..cc1067eb7 100644 --- a/designer-base/src/main/java/com/fr/design/gui/icontainer/UIResizableContainer.java +++ b/designer-base/src/main/java/com/fr/design/gui/icontainer/UIResizableContainer.java @@ -1,12 +1,10 @@ package com.fr.design.gui.icontainer; -import com.fr.base.BaseUtils; import com.fr.base.vcs.DesignerMode; import com.fr.design.constants.UIConstants; import com.fr.design.mainframe.DesignerContext; import com.fr.stable.Constants; import com.fr.design.utils.gui.GUICoreUtils; -import com.fr.stable.collections.utils.MathUtils; import javax.swing.*; import java.awt.*; @@ -46,6 +44,7 @@ public class UIResizableContainer extends JPanel { private boolean isDownPaneVisible = true ; private int paraHeight; private int parentHeight = -1; + private double toolPaneYRate; public UIResizableContainer(int direction) { this(new JPanel(), new JPanel(), direction); @@ -159,12 +158,19 @@ public class UIResizableContainer extends JPanel { } /** - * 设置关闭设计器前最后一次上下子面板的高度 - * - * @param toolPaneY + * 获取上子面板高度占容器总高度的比例 + * @return + */ + public double getToolPaneYRate() { + return toolPaneYRate; + } + + /** + * 设置关闭设计器前最新的上子面板的高度比例 + * @param toolPaneYRate */ - public void setLastToolPaneY(int toolPaneY) { - this.toolPaneY = toolPaneY; + public void setLastToolPaneYRate(double toolPaneYRate) { + this.toolPaneYRate = toolPaneYRate; } /** @@ -242,12 +248,12 @@ public class UIResizableContainer extends JPanel { if (parentHeight == -1) { // 初始化下parentheight,存一下当前的父容器height parentHeight = parent.getHeight(); - } else if (parentHeight != parent.getHeight()) { - // parentHeight与父容器height不等时,代表用户调整分辨率或者dpi了,此时调整toolPaneY - toolPaneY = toolPaneY * parent.getHeight() / parentHeight; - toolPaneY = Math.min(toolPaneY, (parent.getHeight() - toolPaneHeight)); + } else if (parentHeight != parent.getHeight() && parent.getHeight() > 0) { + // parentHeight与父容器height不等时,代表用户调整分辨率或者dpi或者容器高度发生变化了,此时调整toolPaneY + toolPaneY = Math.min((int) (parent.getHeight() * toolPaneYRate), (parent.getHeight() - toolPaneHeight)); parentHeight = parent.getHeight(); } + System.out.println("toolPaneY:" + toolPaneY + ", rate:" + toolPaneYRate); } @Override @@ -371,6 +377,7 @@ public class UIResizableContainer extends JPanel { toolPaneY = e.getYOnScreen() - UIResizableContainer.this.getLocationOnScreen().y; toolPaneY = toolPaneY < 0 ? 0 : toolPaneY; toolPaneY = toolPaneY > UIResizableContainer.this.getHeight() - toolPaneHeight ? UIResizableContainer.this.getHeight() - toolPaneHeight - getParameterPaneHeight() : toolPaneY - getParameterPaneHeight(); + adjustToolPaneYRate(); refreshContainer(); } }); @@ -392,8 +399,10 @@ public class UIResizableContainer extends JPanel { public void mouseClicked(MouseEvent e) { if (e.getX() <= ARROW_RANGE) { toolPaneY = 0; + UIResizableContainer.this.adjustToolPaneYRate(); } else if (e.getX() >= getWidth() - ARROW_RANGE) { toolPaneY = UIResizableContainer.this.getHeight() - toolPaneHeight - getParameterPaneHeight(); + UIResizableContainer.this.adjustToolPaneYRate(); } else { return; } @@ -554,4 +563,11 @@ public class UIResizableContainer extends JPanel { jf.setSize(500, 500); jf.setVisible(true); } + + /** + * 当toolPaneY发生变化时,也需要调整toolPaneYRate + */ + private void adjustToolPaneYRate() { + this.toolPaneYRate = ((double) toolPaneY) / this.getHeight(); + } } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java index 490b4e7e9..a5eafa0c0 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java @@ -1170,8 +1170,8 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta DesignerEnvManager.getEnvManager().setLastOpenFile(jt.getEditingFILE().getPath()); } - DesignerEnvManager.getEnvManager().setLastWestRegionToolPaneY( - WestRegionContainerPane.getInstance().getToolPaneY()); + DesignerEnvManager.getEnvManager().setLastWestRegionToolPaneYRate( + WestRegionContainerPane.getInstance().getToolPaneYRate()); DesignerEnvManager.getEnvManager().setLastWestRegionContainerWidth( WestRegionContainerPane.getInstance().getContainerWidth()); DesignerEnvManager.getEnvManager().setLastEastRegionToolPaneY( diff --git a/designer-base/src/main/java/com/fr/design/mainframe/WestRegionContainerPane.java b/designer-base/src/main/java/com/fr/design/mainframe/WestRegionContainerPane.java index 23c642dbd..358fba411 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/WestRegionContainerPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/WestRegionContainerPane.java @@ -24,7 +24,7 @@ public class WestRegionContainerPane extends UIResizableContainer { public static final WestRegionContainerPane getInstance() { if (THIS == null) { THIS = new WestRegionContainerPane(); - THIS.setLastToolPaneY(DesignerEnvManager.getEnvManager().getLastWestRegionToolPaneY()); + THIS.setLastToolPaneYRate(DesignerEnvManager.getEnvManager().getLastWestRegionToolPaneYRate()); THIS.setLastContainerWidth(DesignerEnvManager.getEnvManager().getLastWestRegionContainerWidth()); } return THIS; @@ -32,11 +32,11 @@ public class WestRegionContainerPane extends UIResizableContainer { public WestRegionContainerPane() { super(DesignerFrameFileDealerPane.getInstance(), Constants.RIGHT); - + setDownPane(TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter())); - + GeneralContext.listenPluginRunningChanged(new PluginEventListener(TableDataTreePane.PLUGIN_LISTENER_PRIORITY - 1) { - + @Override public void on(PluginEvent event) { @@ -47,15 +47,15 @@ public class WestRegionContainerPane extends UIResizableContainer { } } }, new PluginFilter() { - + @Override public boolean accept(PluginContext context) { - + return context.contain(PluginModule.ExtraDesign); } }); - + setContainerWidth(165); setBackground(UIConstants.TREE_BACKGROUND); } -} \ No newline at end of file +} From e575d3a4ef9eb28b0b938a1777b72db774b8e0f3 Mon Sep 17 00:00:00 2001 From: Yvan Date: Thu, 10 Dec 2020 09:00:43 +0800 Subject: [PATCH 02/10] =?UTF-8?q?REPORT-44714=20=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E8=B0=83=E8=AF=95=E8=AF=AD=E5=8F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/gui/icontainer/UIResizableContainer.java | 1 - 1 file changed, 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/icontainer/UIResizableContainer.java b/designer-base/src/main/java/com/fr/design/gui/icontainer/UIResizableContainer.java index cc1067eb7..b48950485 100644 --- a/designer-base/src/main/java/com/fr/design/gui/icontainer/UIResizableContainer.java +++ b/designer-base/src/main/java/com/fr/design/gui/icontainer/UIResizableContainer.java @@ -253,7 +253,6 @@ public class UIResizableContainer extends JPanel { toolPaneY = Math.min((int) (parent.getHeight() * toolPaneYRate), (parent.getHeight() - toolPaneHeight)); parentHeight = parent.getHeight(); } - System.out.println("toolPaneY:" + toolPaneY + ", rate:" + toolPaneYRate); } @Override From 51289b43fafb456cc498ca4dd74624511fcb5ce7 Mon Sep 17 00:00:00 2001 From: Yvan Date: Thu, 10 Dec 2020 09:06:42 +0800 Subject: [PATCH 03/10] =?UTF-8?q?REPORT-44714=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E9=94=99=E8=AF=AF=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/DesignerEnvManager.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java b/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java index 8d7c53645..44c0eba84 100644 --- a/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java +++ b/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java @@ -441,7 +441,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { } /** - * 获取东面板的上子面板的高度占容器总高度的比例 + * 获取西面板的上子面板的高度占容器总高度的比例 * @return */ public double getLastWestRegionToolPaneYRate() { @@ -458,7 +458,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { } /** - * 设置关闭设计器前,东面板的上子面板的高度占容器总高度的比例 + * 设置关闭设计器前,西面板的上子面板的高度占容器总高度的比例 * @param westRegionToolPaneYRate */ public void setLastWestRegionToolPaneYRate(double westRegionToolPaneYRate) { From 10056986e7dabf39361d320b5e4fdea888ef0a85 Mon Sep 17 00:00:00 2001 From: vito Date: Thu, 10 Dec 2020 18:04:43 +0800 Subject: [PATCH 04/10] =?UTF-8?q?REPORT-45095=20=E8=A1=A8=E5=8D=95?= =?UTF-8?q?=E6=8E=A7=E4=BB=B6=E8=AE=BE=E7=BD=AE=E6=8F=90=E4=BA=A4=E4=BA=8B?= =?UTF-8?q?=E4=BB=B6=EF=BC=8C=E6=B7=BB=E5=8A=A0=E5=AD=97=E6=AE=B5=E5=90=8E?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E5=AD=97=E6=AE=B5=EF=BC=8C=E4=BA=8B=E4=BB=B6?= =?UTF-8?q?=E5=BC=B9=E6=A1=86=E6=B6=88=E5=A4=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../write/submit/DBManipulationPane.java | 1749 +++++++++-------- .../submit/SmartInsertDBManipulationPane.java | 6 +- 2 files changed, 898 insertions(+), 857 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/write/submit/DBManipulationPane.java b/designer-base/src/main/java/com/fr/design/write/submit/DBManipulationPane.java index ccf01dd5e..1e1ab1f72 100644 --- a/designer-base/src/main/java/com/fr/design/write/submit/DBManipulationPane.java +++ b/designer-base/src/main/java/com/fr/design/write/submit/DBManipulationPane.java @@ -53,7 +53,6 @@ import javax.swing.BorderFactory; import javax.swing.DefaultCellEditor; import javax.swing.DefaultComboBoxModel; import javax.swing.Icon; -import javax.swing.JFrame; import javax.swing.JList; import javax.swing.JOptionPane; import javax.swing.JPanel; @@ -74,6 +73,7 @@ import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.GridLayout; import java.awt.Image; +import java.awt.Window; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.FocusAdapter; @@ -92,136 +92,133 @@ public class DBManipulationPane extends BasicBeanPane { private static final Image ICODS_IMAGE = BaseUtils.readImage("/com/fr/web/core/css/images/icons.png"); private static final Icon HEIP_ICON = BaseUtils.createIcon(ICODS_IMAGE, 193, 1, 14, 14); private static final int DEFAULT_RETURN_VALUE = 4; - public KeyColumnNameValueTable keyColumnValuesTable; - private UIComboBox columnsComboBox; // 用于编辑ColumnName的Editor + public KeyColumnNameValueTable keyColumnValuesTable; + private UIComboBox columnsComboBox; // 用于编辑ColumnName的Editor private UICheckBox UpdateCheckBox; private JPanel checkBoxUpdatePane; - /* - * 记录当前选取的DS & Table对应的ColumnName[] - * alex:以前每当tableNameComboBox改变就刷新columnsComboBox,这样每输入一个文字就会刷一遍,很不好 - */ - private ColumnName[] currentColumnNames = null; + /* + * 记录当前选取的DS & Table对应的ColumnName[] + * alex:以前每当tableNameComboBox改变就刷新columnsComboBox,这样每输入一个文字就会刷一遍,很不好 + */ + private ColumnName[] currentColumnNames = null; - // 支持公式输入的数据表选择面板 - private ChoosePaneSupportFormula chooseTable; + // 支持公式输入的数据表选择面板 + private ChoosePaneSupportFormula chooseTable; - private UIComboBox dmlConfigComboBox = null; + private UIComboBox dmlConfigComboBox = null; - // 提交事件 - private NameSubmitJob[] jobs = null; + // 提交事件 + private NameSubmitJob[] jobs = null; - // 提交条件 - private Condition condition = null; + // 提交条件 + private Condition condition = null; - private JTree conditionsTree; + private JTree conditionsTree; - private Editor[] v_Types; + private Editor[] v_Types; - protected JavaScriptActionPane parentPane; + protected JavaScriptActionPane parentPane; - private int keyColumnWidth = 100; - private int resizeColumnCount = 4; - private int btnWidth = 110; - private int btnHeight = 20; private String subMitName; - private static final String[] DML_CONFIG_TYPES = new String[] { + private static final String[] DML_CONFIG_TYPES = new String[]{ com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Write_Smart_Submit"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Write_Delete_Submit"), - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Write_Insert_Submit"), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Write_Insert_Submit"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Write_Update_Submit")}; - /** - * 无单元格。没有智能添加单元格等按钮 - * 有单元格的参见其子类SmartInsertDBManipulationPane - */ - public DBManipulationPane() { - this(ValueEditorPaneFactory.extendedCellGroupEditors()); - } + /** + * 无单元格。没有智能添加单元格等按钮 + * 有单元格的参见其子类SmartInsertDBManipulationPane + */ + public DBManipulationPane() { + this(ValueEditorPaneFactory.extendedCellGroupEditors()); + } - public DBManipulationPane(Editor[] v_Types) { - this.setLayout(FRGUIPaneFactory.createBorderLayout()); - this.v_Types = v_Types; + public DBManipulationPane(Editor[] v_Types) { + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + this.v_Types = v_Types; - JPanel northPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - this.add(northPane, BorderLayout.NORTH); + JPanel northPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + this.add(northPane, BorderLayout.NORTH); - dmlConfigComboBox = new UIComboBox(DML_CONFIG_TYPES); + dmlConfigComboBox = new UIComboBox(DML_CONFIG_TYPES); - JPanel typePane = GUICoreUtils.createFlowPane(new Component[] { new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Write_Choose_Submit_Type") + ":"), dmlConfigComboBox }, - FlowLayout.LEFT, 10); - typePane.setBorder(BorderFactory.createTitledBorder(new ModLineBorder(ModLineBorder.TOP), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Write_Submit_Type"))); - northPane.add(typePane, BorderLayout.NORTH); + JPanel typePane = GUICoreUtils.createFlowPane(new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Write_Choose_Submit_Type") + ":"), dmlConfigComboBox}, + FlowLayout.LEFT, 10); + typePane.setBorder(BorderFactory.createTitledBorder(new ModLineBorder(ModLineBorder.TOP), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Write_Submit_Type"))); + northPane.add(typePane, BorderLayout.NORTH); - chooseTable = new ChoosePaneSupportFormula(); - chooseTable.setBorder(BorderFactory.createTitledBorder(new ModLineBorder(ModLineBorder.TOP), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Base_Table"))); - chooseTable.setTableNameComboBoxPopSize(160, 320); + chooseTable = new ChoosePaneSupportFormula(); + chooseTable.setBorder(BorderFactory.createTitledBorder(new ModLineBorder(ModLineBorder.TOP), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Base_Table"))); + chooseTable.setTableNameComboBoxPopSize(160, 320); - northPane.add(chooseTable, BorderLayout.CENTER); + northPane.add(chooseTable, BorderLayout.CENTER); - // peter:编辑的TablePane - JPanel editTablePane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - this.add(editTablePane, BorderLayout.CENTER); - editTablePane.setBorder(BorderFactory.createTitledBorder(new ModLineBorder(ModLineBorder.TOP), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Base_Value"))); + // peter:编辑的TablePane + JPanel editTablePane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + this.add(editTablePane, BorderLayout.CENTER); + editTablePane.setBorder(BorderFactory.createTitledBorder(new ModLineBorder(ModLineBorder.TOP), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Base_Value"))); - keyColumnValuesTable = new KeyColumnNameValueTable(); - editTablePane.add(new JScrollPane(this.keyColumnValuesTable), BorderLayout.CENTER); - keyColumnValuesTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); - keyColumnValuesTable.setPreferredScrollableViewportSize(new Dimension(280, 180)); - keyColumnValuesTable.setShowHorizontalLines(true); + keyColumnValuesTable = new KeyColumnNameValueTable(); + editTablePane.add(new JScrollPane(this.keyColumnValuesTable), BorderLayout.CENTER); + keyColumnValuesTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); + keyColumnValuesTable.setPreferredScrollableViewportSize(new Dimension(280, 180)); + keyColumnValuesTable.setShowHorizontalLines(true); - initJTableColumn(); + initJTableColumn(); - addButtons(editTablePane); + addButtons(editTablePane); - addBottomPane(); + addBottomPane(); - addListeners(); - } + addListeners(); + } - public void setSubMitName(String subMitName){ + public void setSubMitName(String subMitName) { this.subMitName = subMitName; } - public String getSubMitName(){ + public String getSubMitName() { return this.subMitName; } - private void addButtons(JPanel editTablePane) { - // alex:添加操作按钮 - UpdateAction[] actions = this.getActions(); - if (actions != null && actions.length > 0) { - JPanel controlBtnPane = new JPanel(new GridLayout(actions.length + 1, 1, 4, 4)); - editTablePane.add(GUICoreUtils.createBorderPane(controlBtnPane, BorderLayout.NORTH), BorderLayout.EAST); + private void addButtons(JPanel editTablePane) { + // alex:添加操作按钮 + UpdateAction[] actions = this.getActions(); + if (actions != null && actions.length > 0) { + JPanel controlBtnPane = new JPanel(new GridLayout(actions.length + 1, 1, 4, 4)); + editTablePane.add(GUICoreUtils.createBorderPane(controlBtnPane, BorderLayout.NORTH), BorderLayout.EAST); - for (int i = 0; i < actions.length; i++) { - controlBtnPane.add(new UIButton(actions[i])); - } + for (UpdateAction action : actions) { + controlBtnPane.add(new UIButton(action)); + } checkBoxUpdatePane = new JPanel(new BorderLayout(0, 0)); - checkBoxUpdatePane.setPreferredSize(new Dimension(120,20)); + checkBoxUpdatePane.setPreferredSize(new Dimension(120, 20)); controlBtnPane.add(checkBoxUpdatePane); UpdateCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_RWA_NotChange_Unmodified")); - UIButton helpButton = new UIButton(HEIP_ICON); + UIButton helpButton = new UIButton(HEIP_ICON); helpButton.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Base_Help")); helpButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { - FormatExplanationPane formatExplanation = new FormatExplanationPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Base_Help"),com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_RWA_Help"), 12f); + FormatExplanationPane formatExplanation = new FormatExplanationPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Base_Help"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_RWA_Help"), 12f); BasicDialog dlg = formatExplanation.showMediumWindow(SwingUtilities.getWindowAncestor(DBManipulationPane.this), - new DialogActionAdapter(){}); + new DialogActionAdapter() { + }); dlg.setVisible(true); } }); helpButton.set4ToolbarButton(); - checkBoxUpdatePane.add(UpdateCheckBox,BorderLayout.WEST); - checkBoxUpdatePane.add(helpButton,BorderLayout.EAST); - } - } - - protected void updateUpdateCheckBoxEnable(){ - KeyColumnTableModel model = (KeyColumnTableModel)keyColumnValuesTable.getModel(); - if (model.getRowCount() == 0){ + checkBoxUpdatePane.add(UpdateCheckBox, BorderLayout.WEST); + checkBoxUpdatePane.add(helpButton, BorderLayout.EAST); + } + } + + protected void updateUpdateCheckBoxEnable() { + KeyColumnTableModel model = (KeyColumnTableModel) keyColumnValuesTable.getModel(); + if (model.getRowCount() == 0) { setUpdateCheckBoxEnable(false); UpdateCheckBox.setSelected(true); return; @@ -230,9 +227,8 @@ public class DBManipulationPane extends BasicBeanPane { for (int i = 0; i < model.getRowCount(); i++) { columnObjects.add(model.getKeyColumnNameValue(i).cv.getObj()); } - for (int i = 0;i < columnObjects.size();i++){ - Object ob = columnObjects.get(i) ; - if (!( ob instanceof ColumnRow || ob instanceof ColumnRowGroup)){ + for (Object ob : columnObjects) { + if (!(ob instanceof ColumnRow || ob instanceof ColumnRowGroup)) { setUpdateCheckBoxEnable(false); UpdateCheckBox.setSelected(false); return; @@ -241,236 +237,241 @@ public class DBManipulationPane extends BasicBeanPane { setUpdateCheckBoxEnable(true); } - private void setUpdateCheckBoxEnable( boolean b){ + private void setUpdateCheckBoxEnable(boolean b) { UpdateCheckBox.setEnabled(b); } - private void addBottomPane() { - JPanel eventPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); - eventPane.add(addEventButton()); + private void addBottomPane() { + JPanel eventPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); + eventPane.add(addEventButton()); - JPanel conditionPane = this.createConditionPane(); + JPanel conditionPane = this.createConditionPane(); - JPanel btPane =new JPanel( FRGUIPaneFactory.createBorderLayout()); - btPane.add(eventPane,BorderLayout.CENTER); - btPane.add(conditionPane,BorderLayout.NORTH); - this.add(btPane, BorderLayout.SOUTH); - } + JPanel btPane = new JPanel(FRGUIPaneFactory.createBorderLayout()); + btPane.add(eventPane, BorderLayout.CENTER); + btPane.add(conditionPane, BorderLayout.NORTH); + this.add(btPane, BorderLayout.SOUTH); + } - private UIButton addEventButton() { - UIButton addSubmitEventButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Set_Submit_Event")); - addSubmitEventButton.addActionListener(new ActionListener() { + private UIButton addEventButton() { + UIButton addSubmitEventButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Set_Submit_Event")); + addSubmitEventButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - final SubmitJobListPane jobsPane = createSubmitJobListPane(); + @Override + public void actionPerformed(ActionEvent e) { + final SubmitJobListPane jobsPane = createSubmitJobListPane(); - jobsPane.populate(jobs); - BasicDialog dialog = jobsPane.showWindow(SwingUtilities.getWindowAncestor(DBManipulationPane.this), new DialogActionAdapter() { - @Override - public void doOk() { - super.doOk(); - jobs = jobsPane.updateDBManipulation(); - } - }); - dialog.setVisible(true); - } + jobsPane.populate(jobs); + BasicDialog dialog = jobsPane.showWindow(SwingUtilities.getWindowAncestor(DBManipulationPane.this), new DialogActionAdapter() { + @Override + public void doOk() { + super.doOk(); + jobs = jobsPane.updateDBManipulation(); + } + }); + dialog.setVisible(true); + } - }); - return addSubmitEventButton; - } + }); + return addSubmitEventButton; + } - private JPanel createConditionPane() { - JPanel conditionPane = new JPanel(); - conditionPane.setPreferredSize(createConditionPanePreferredSize()); + private JPanel createConditionPane() { + JPanel conditionPane = new JPanel(); + conditionPane.setPreferredSize(createConditionPanePreferredSize()); setBorderAndLayout(conditionPane); - conditionsTree = new JTree(new DefaultTreeModel(new ExpandMutableTreeNode())); - conditionsTree.setRootVisible(false); - conditionsTree.setShowsRootHandles(true); - conditionsTree.setBackground(UIConstants.NORMAL_BACKGROUND); - conditionsTree.setForeground(UIConstants.NORMAL_BACKGROUND); - DefaultTreeCellRenderer cr = (DefaultTreeCellRenderer) conditionsTree.getCellRenderer(); - cr.setForeground(UIConstants.NORMAL_BACKGROUND); - JScrollPane jp = new JScrollPane(conditionsTree); - addComponent(conditionPane,jp); - - UIButton addSubmitConditionButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Set_Submit_Condition")); - addSubmitConditionButton.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - final DSColumnLiteConditionPane conditionPane = new DSColumnLiteConditionPane() { - @Override - protected boolean isNeedDoWithCondition(Condition liteCondition) { - return liteCondition != null; - } - }; - String[] columns = chooseTable.currentColumnNames(); - if (columns != null && columns.length > 0) { - conditionPane.populateColumns(chooseTable.currentColumnNames()); - } - - conditionPane.populateBean(condition); - BasicDialog dialog = conditionPane.showWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { - @Override - public void doOk() { - super.doOk(); - condition = conditionPane.updateBean(); - refreshConditionList(); - } - }); - dialog.setVisible(true); - } - }); - - JPanel controlBtnPane = new JPanel(new GridLayout(1, 1, 4, 4)); + conditionsTree = new JTree(new DefaultTreeModel(new ExpandMutableTreeNode())); + conditionsTree.setRootVisible(false); + conditionsTree.setShowsRootHandles(true); + conditionsTree.setBackground(UIConstants.NORMAL_BACKGROUND); + conditionsTree.setForeground(UIConstants.NORMAL_BACKGROUND); + DefaultTreeCellRenderer cr = (DefaultTreeCellRenderer) conditionsTree.getCellRenderer(); + cr.setForeground(UIConstants.NORMAL_BACKGROUND); + JScrollPane jp = new JScrollPane(conditionsTree); + addComponent(conditionPane, jp); + + UIButton addSubmitConditionButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Set_Submit_Condition")); + addSubmitConditionButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + final DSColumnLiteConditionPane conditionPane = new DSColumnLiteConditionPane() { + @Override + protected boolean isNeedDoWithCondition(Condition liteCondition) { + return liteCondition != null; + } + }; + String[] columns = chooseTable.currentColumnNames(); + if (columns != null && columns.length > 0) { + conditionPane.populateColumns(chooseTable.currentColumnNames()); + } + + conditionPane.populateBean(condition); + BasicDialog dialog = conditionPane.showWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { + @Override + public void doOk() { + super.doOk(); + condition = conditionPane.updateBean(); + refreshConditionList(); + } + }); + dialog.setVisible(true); + } + }); + + JPanel controlBtnPane = new JPanel(new GridLayout(1, 1, 4, 4)); controlBtnPane.setPreferredSize(createControlBtnPanePreferredSize()); - conditionPane.add(GUICoreUtils.createBorderPane(controlBtnPane, BorderLayout.NORTH),setControlBtnPanePosition()); - controlBtnPane.add(addSubmitConditionButton); + conditionPane.add(GUICoreUtils.createBorderPane(controlBtnPane, BorderLayout.NORTH), setControlBtnPanePosition()); + controlBtnPane.add(addSubmitConditionButton); - return conditionPane; - } + return conditionPane; + } - protected void setBorderAndLayout(JPanel jPanel){ + protected void setBorderAndLayout(JPanel jPanel) { jPanel.setLayout(FRGUIPaneFactory.createBorderLayout()); jPanel.setBorder(BorderFactory.createTitledBorder( - new ModLineBorder(ModLineBorder.TOP), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Submit_Condition"))); + new ModLineBorder(ModLineBorder.TOP), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Submit_Condition"))); } - protected void addComponent(JPanel mainPane,JScrollPane addPane){ - mainPane.add(addPane,BorderLayout.CENTER); + protected void addComponent(JPanel mainPane, JScrollPane addPane) { + mainPane.add(addPane, BorderLayout.CENTER); } - protected Dimension createConditionPanePreferredSize(){ + protected Dimension createConditionPanePreferredSize() { return new Dimension(454, 80); } - protected Dimension createControlBtnPanePreferredSize(){ + protected Dimension createControlBtnPanePreferredSize() { return new Dimension(110, 20); } - protected String setControlBtnPanePosition(){ - return BorderLayout.EAST; + protected String setControlBtnPanePosition() { + return BorderLayout.EAST; } - private void refreshConditionList() { - DefaultTreeModel defaultTreeModel = (DefaultTreeModel) conditionsTree.getModel(); - ExpandMutableTreeNode rootTreeNode = (ExpandMutableTreeNode) defaultTreeModel.getRoot(); - rootTreeNode.setUserObject(new JoinCondition(DataConstants.AND, new ListCondition())); - rootTreeNode.removeAllChildren(); - Condition liteCondition = this.condition == null ? new ListCondition() : this.condition; - if (liteCondition instanceof ListCondition) { - ListCondition listCondition = (ListCondition) liteCondition; - int joinConditionCount = listCondition.getJoinConditionCount(); - for (int i = 0; i < joinConditionCount; i++) { - addLiteConditionToListCondition(rootTreeNode, listCondition.getJoinCondition(i)); - } - } else { - ExpandMutableTreeNode newTreeNode = new ExpandMutableTreeNode(new JoinCondition(DataConstants.AND, liteCondition)); - rootTreeNode.add(newTreeNode); - } - defaultTreeModel.reload(rootTreeNode); - rootTreeNode.expandCurrentTreeNode(conditionsTree); - } - - private void addLiteConditionToListCondition(ExpandMutableTreeNode parentTreeNode, JoinCondition joinCondition) { - ExpandMutableTreeNode newTreeNode = new ExpandMutableTreeNode(joinCondition); - parentTreeNode.add(newTreeNode); - Condition liteCondition = joinCondition.getCondition(); - if (liteCondition instanceof ListCondition) { - ListCondition listCondition = (ListCondition) liteCondition; - int joinConditionCount = listCondition.getJoinConditionCount(); - for (int i = 0; i < joinConditionCount; i++) { - addLiteConditionToListCondition(newTreeNode, listCondition.getJoinCondition(i)); - } - } - } - - private void addListeners() { - dmlConfigComboBox.addItemListener(new ItemListener() { - @Override - public void itemStateChanged(ItemEvent e) { - if (e.getStateChange() == ItemEvent.SELECTED) { - Object ob = e.getItem(); - if ((ComparatorUtils.equals(ob, DML_CONFIG_TYPES[0])) || ComparatorUtils.equals(ob, DML_CONFIG_TYPES[3])) { - checkBoxUpdatePane.setVisible(true); - } else if ((ComparatorUtils.equals(ob, DML_CONFIG_TYPES[1])) || ComparatorUtils.equals(ob, DML_CONFIG_TYPES[2])) { - checkBoxUpdatePane.setVisible(false); - } - } - } - }); - - /* - * 当DS & Table改变时要刷新ColumnsComboBox.model,不能用ItemListener, - * 因为tableNameComboBox是可以编辑的,每写一个文字就要连,太频繁了 - * 也不能在tableNameComboBox.focusLost事件时,好像没用 - */ - keyColumnValuesTable.addFocusListener(new FocusAdapter() { - - public void focusGained(FocusEvent e) { - refreshColumnsComboBox(); - } - - }); - } - - protected UpdateAction[] getActions() { - return new UpdateAction[] { new SmartAddFieldsAction(), new AddFieldAction(), new RemoveFieldAction() }; - } - - protected SubmitJobListPane createSubmitJobListPane() { - return new SubmitJobListPane(); - } - - public void setParentJavaScriptActionPane(JavaScriptActionPane jsPane) { - this.parentPane = jsPane; - } - - @Override - protected String title4PopupWindow() { - return "DB"; - } - - protected class SmartAddFieldsAction extends UpdateAction { - public SmartAddFieldsAction() { - this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_RWA_Smart_Add_Fields")); - } - - public void actionPerformed(ActionEvent evt) { - - BasicPane bPane = new BasicPane() { - @Override - protected String title4PopupWindow() { - return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_RWA_Smart_Add_Fields"); - } - }; - bPane.setLayout(FRGUIPaneFactory.createBorderLayout()); - - final CheckBoxList list = new CheckBoxList(currentColumnNames(), CheckBoxList.SelectedState.ALL, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Chart_Field_Name")) { - public String value2Text(Object value) { - if (value instanceof ColumnName) { - return ((ColumnName)value).name; - } - - return super.value2Text(value); - } - }; - bPane.add(new JScrollPane(list), BorderLayout.CENTER); - - BasicDialog dlg = bPane.showSmallWindow(SwingUtilities.getWindowAncestor(DBManipulationPane.this), new DialogActionAdapter() { - public void doOk() { - addFields(list); + private void refreshConditionList() { + DefaultTreeModel defaultTreeModel = (DefaultTreeModel) conditionsTree.getModel(); + ExpandMutableTreeNode rootTreeNode = (ExpandMutableTreeNode) defaultTreeModel.getRoot(); + rootTreeNode.setUserObject(new JoinCondition(DataConstants.AND, new ListCondition())); + rootTreeNode.removeAllChildren(); + Condition liteCondition = this.condition == null ? new ListCondition() : this.condition; + if (liteCondition instanceof ListCondition) { + ListCondition listCondition = (ListCondition) liteCondition; + int joinConditionCount = listCondition.getJoinConditionCount(); + for (int i = 0; i < joinConditionCount; i++) { + addLiteConditionToListCondition(rootTreeNode, listCondition.getJoinCondition(i)); + } + } else { + ExpandMutableTreeNode newTreeNode = new ExpandMutableTreeNode(new JoinCondition(DataConstants.AND, liteCondition)); + rootTreeNode.add(newTreeNode); + } + defaultTreeModel.reload(rootTreeNode); + rootTreeNode.expandCurrentTreeNode(conditionsTree); + } + + private void addLiteConditionToListCondition(ExpandMutableTreeNode parentTreeNode, JoinCondition joinCondition) { + ExpandMutableTreeNode newTreeNode = new ExpandMutableTreeNode(joinCondition); + parentTreeNode.add(newTreeNode); + Condition liteCondition = joinCondition.getCondition(); + if (liteCondition instanceof ListCondition) { + ListCondition listCondition = (ListCondition) liteCondition; + int joinConditionCount = listCondition.getJoinConditionCount(); + for (int i = 0; i < joinConditionCount; i++) { + addLiteConditionToListCondition(newTreeNode, listCondition.getJoinCondition(i)); + } + } + } + + private void addListeners() { + dmlConfigComboBox.addItemListener(new ItemListener() { + @Override + public void itemStateChanged(ItemEvent e) { + if (e.getStateChange() == ItemEvent.SELECTED) { + Object ob = e.getItem(); + if ((ComparatorUtils.equals(ob, DML_CONFIG_TYPES[0])) || ComparatorUtils.equals(ob, DML_CONFIG_TYPES[3])) { + checkBoxUpdatePane.setVisible(true); + } else if ((ComparatorUtils.equals(ob, DML_CONFIG_TYPES[1])) || ComparatorUtils.equals(ob, DML_CONFIG_TYPES[2])) { + checkBoxUpdatePane.setVisible(false); + } + } + } + }); + + /* + * 当DS & Table改变时要刷新ColumnsComboBox.model,不能用ItemListener, + * 因为tableNameComboBox是可以编辑的,每写一个文字就要连,太频繁了 + * 也不能在tableNameComboBox.focusLost事件时,好像没用 + */ + keyColumnValuesTable.addFocusListener(new FocusAdapter() { + + @Override + public void focusGained(FocusEvent e) { + refreshColumnsComboBox(); + } + + }); + } + + protected UpdateAction[] getActions() { + return new UpdateAction[]{new SmartAddFieldsAction(), new AddFieldAction(), new RemoveFieldAction()}; + } + + protected SubmitJobListPane createSubmitJobListPane() { + return new SubmitJobListPane(); + } + + public void setParentJavaScriptActionPane(JavaScriptActionPane jsPane) { + this.parentPane = jsPane; + } + + @Override + protected String title4PopupWindow() { + return "DB"; + } + + protected class SmartAddFieldsAction extends UpdateAction { + public SmartAddFieldsAction() { + this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_RWA_Smart_Add_Fields")); + } + + @Override + public void actionPerformed(ActionEvent evt) { + + BasicPane bPane = new BasicPane() { + @Override + protected String title4PopupWindow() { + return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_RWA_Smart_Add_Fields"); + } + }; + bPane.setLayout(FRGUIPaneFactory.createBorderLayout()); + + final CheckBoxList list = new CheckBoxList(currentColumnNames(), CheckBoxList.SelectedState.ALL, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Chart_Field_Name")) { + @Override + public String value2Text(Object value) { + if (value instanceof ColumnName) { + return ((ColumnName) value).name; + } + + return super.value2Text(value); + } + }; + bPane.add(new JScrollPane(list), BorderLayout.CENTER); + + BasicDialog dlg = bPane.showSmallWindow(SwingUtilities.getWindowAncestor(DBManipulationPane.this), new DialogActionAdapter() { + @Override + public void doOk() { + addFields(list); updateUpdateCheckBoxEnable(); - } - }); - dlg.setVisible(true); - } - } - - private void addFields (CheckBoxList list) { - KeyColumnTableModel model = (KeyColumnTableModel)keyColumnValuesTable.getModel(); + } + }); + dlg.setVisible(true); + } + } + + private void addFields(CheckBoxList list) { + KeyColumnTableModel model = (KeyColumnTableModel) keyColumnValuesTable.getModel(); List keyColumnNameValueList = new ArrayList(); keyColumnNameValueList.clear(); for (int i = 0; i < model.getRowCount(); i++) { @@ -481,28 +482,28 @@ public class DBManipulationPane extends BasicBeanPane { // Richie:用了存储新的KeyColumnNameValue的List. List newKeyColumnNameValueList = new ArrayList(); if (!keyColumnNameValueList.isEmpty()) { - for (int i = 0; i < selected.length; i++) { + for (Object o : selected) { // Richie:先填上空的. - newKeyColumnNameValueList.add(new KeyColumnNameValue(false, (ColumnName)selected[i], new ColumnValue(""), false)); + newKeyColumnNameValueList.add(new KeyColumnNameValue(false, (ColumnName) o, new ColumnValue(""), false)); } } // Richie:初始化 int returnValue = DEFAULT_RETURN_VALUE; int coverNumber = 0; - if (!keyColumnNameValueList.isEmpty()) { - //如果存在先前项,设置状态为5 - returnValue = 5 ; - } + if (!keyColumnNameValueList.isEmpty()) { + //如果存在先前项,设置状态为5 + returnValue = 5; + } for (int i = 0; i < selected.length; i++) { if (returnValue == 0 || returnValue == 3) { break; } - for (int j = 0; j < keyColumnNameValueList.size(); j++) { - if (ComparatorUtils.equals(selected[i], keyColumnNameValueList.get(j).cn)) { - Object[] options = { com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Covered_All"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Base_Yes"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Base_No"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Cover_None") }; + for (KeyColumnNameValue keyColumnNameValue : keyColumnNameValueList) { + if (ComparatorUtils.equals(selected[i], keyColumnNameValue.cn)) { + Object[] options = {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Covered_All"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Base_Yes"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Base_No"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Cover_None")}; returnValue = JOptionPane.showOptionDialog(DBManipulationPane.this, - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Cover_Tips", keyColumnNameValueList.get(j).cn.name), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Cover_Tips", keyColumnNameValue.cn.name), "", JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE, null, options, options[0]); // Richie:全部覆盖 if (returnValue == 0) { @@ -514,7 +515,7 @@ public class DBManipulationPane extends BasicBeanPane { } else if (returnValue == 2) { coverNumber = i; newKeyColumnNameValueList.remove(i); - newKeyColumnNameValueList.add(i, keyColumnNameValueList.get(j)); + newKeyColumnNameValueList.add(i, keyColumnNameValue); // Richie:全部不覆盖 } else if (returnValue == 3) { coverNumber = i; @@ -526,7 +527,7 @@ public class DBManipulationPane extends BasicBeanPane { checkTableModel(returnValue, coverNumber, model, selected, keyColumnNameValueList, newKeyColumnNameValueList); } - private void checkTableModel (int returnValue, int coverNumber, KeyColumnTableModel model, Object[] selected, List keyColumnNameValueList, List newKeyColumnNameValueList) { + private void checkTableModel(int returnValue, int coverNumber, KeyColumnTableModel model, Object[] selected, List keyColumnNameValueList, List newKeyColumnNameValueList) { if (returnValue == 0) { model.removeAllKeyColumnNameValue(); // Richie:全部覆盖,按selected的长度添加默认的行 @@ -538,10 +539,10 @@ public class DBManipulationPane extends BasicBeanPane { model.removeAllKeyColumnNameValue(); // Richie:全部不覆盖,已经存在的就保留,不存在的添加默认行 for (int i = coverNumber; i < selected.length; i++) { - for (int j = 0; j < keyColumnNameValueList.size(); j++) { - if (ComparatorUtils.equals(selected[i], keyColumnNameValueList.get(j).cn)) { + for (KeyColumnNameValue keyColumnNameValue : keyColumnNameValueList) { + if (ComparatorUtils.equals(selected[i], keyColumnNameValue.cn)) { newKeyColumnNameValueList.remove(i); - newKeyColumnNameValueList.add(i, keyColumnNameValueList.get(j)); + newKeyColumnNameValueList.add(i, keyColumnNameValue); } } @@ -552,610 +553,650 @@ public class DBManipulationPane extends BasicBeanPane { } } else if (returnValue == 1 || returnValue == 2) { - for (int i = 0; i < selected.length; i++) { - model.addKeyColumnNameValue(newKeyColumnNameValueList.get(i)); - } - } else if (returnValue == 5){ - //新选项和原来没有重复项的情况,产品确认:只做全量增加,原有的清除 - for (int i = 0; i < selected.length; i++) { - model.addKeyColumnNameValue(newKeyColumnNameValueList.get(i)); - } - } + for (int i = 0; i < selected.length; i++) { + model.addKeyColumnNameValue(newKeyColumnNameValueList.get(i)); + } + } else if (returnValue == 5) { + //新选项和原来没有重复项的情况,产品确认:只做全量增加,原有的清除 + for (int i = 0; i < selected.length; i++) { + model.addKeyColumnNameValue(newKeyColumnNameValueList.get(i)); + } + } // Richie:初始化 if (keyColumnNameValueList.isEmpty()) { model.removeAllKeyColumnNameValue(); - for (int i = 0; i < selected.length; i++) { - model.addKeyColumnNameValue(new KeyColumnNameValue(false, (ColumnName)selected[i], new ColumnValue(""), false)); + for (Object o : selected) { + model.addKeyColumnNameValue(new KeyColumnNameValue(false, (ColumnName) o, new ColumnValue(""), false)); } } - + model.fireTableDataChanged(); keyColumnValuesTable.validate(); } - protected class AddFieldAction extends UpdateAction { - public AddFieldAction() { - this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_RWA_Add_Field")); - } + protected class AddFieldAction extends UpdateAction { + public AddFieldAction() { + this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_RWA_Add_Field")); + } - public void actionPerformed(ActionEvent e) { + @Override + public void actionPerformed(ActionEvent e) { - KeyColumnTableModel model = (KeyColumnTableModel)keyColumnValuesTable.getModel(); + KeyColumnTableModel model = (KeyColumnTableModel) keyColumnValuesTable.getModel(); - model.addKeyColumnNameValue(new KeyColumnNameValue(false, new ColumnName(""), new ColumnValue(""), false)); + model.addKeyColumnNameValue(new KeyColumnNameValue(false, new ColumnName(""), new ColumnValue(""), false)); updateUpdateCheckBoxEnable(); - model.fireTableDataChanged(); - - keyColumnValuesTable.getSelectionModel().setSelectionInterval(model.getRowCount() - 1, model.getRowCount() - 1); - } - } - - protected class RemoveFieldAction extends UpdateAction { - public RemoveFieldAction() { - this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_RWA_Remove_Field")); - } - - public void actionPerformed(ActionEvent evt) { - // DBManipulationPane target = this.getDBManipulationPane(); - - int[] selectedRows = keyColumnValuesTable.getSelectedRows(); - if (selectedRows == null || selectedRows.length == 0) { - return; - } - - int returnVal = FineJOptionPane.showConfirmDialog(SwingUtilities.getWindowAncestor(DBManipulationPane.this), - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Base_sure_remove_item") + "?", com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Base_Remove"), JOptionPane.OK_CANCEL_OPTION, - JOptionPane.QUESTION_MESSAGE); - if (returnVal == JOptionPane.OK_OPTION) { - KeyColumnTableModel keyColumnNameValueTableModel = (KeyColumnTableModel)keyColumnValuesTable.getModel(); - - // 把selectedRows从小到大排个序,先删大的再删小的 - java.util.Arrays.sort(selectedRows); - for (int i = selectedRows.length - 1; i >= 0; i--) { - keyColumnNameValueTableModel.removeKeyColumnNameValue(selectedRows[i]); - } + model.fireTableDataChanged(); + + keyColumnValuesTable.getSelectionModel().setSelectionInterval(model.getRowCount() - 1, model.getRowCount() - 1); + } + } + + protected class RemoveFieldAction extends UpdateAction { + public RemoveFieldAction() { + this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_RWA_Remove_Field")); + } + + @Override + public void actionPerformed(ActionEvent evt) { + // DBManipulationPane target = this.getDBManipulationPane(); + + int[] selectedRows = keyColumnValuesTable.getSelectedRows(); + if (selectedRows == null || selectedRows.length == 0) { + return; + } + + int returnVal = FineJOptionPane.showConfirmDialog(SwingUtilities.getWindowAncestor(DBManipulationPane.this), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Base_sure_remove_item") + "?", com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Base_Remove"), JOptionPane.OK_CANCEL_OPTION, + JOptionPane.QUESTION_MESSAGE); + if (returnVal == JOptionPane.OK_OPTION) { + KeyColumnTableModel keyColumnNameValueTableModel = (KeyColumnTableModel) keyColumnValuesTable.getModel(); + + // 把selectedRows从小到大排个序,先删大的再删小的 + java.util.Arrays.sort(selectedRows); + for (int i = selectedRows.length - 1; i >= 0; i--) { + keyColumnNameValueTableModel.removeKeyColumnNameValue(selectedRows[i]); + } updateUpdateCheckBoxEnable(); - keyColumnNameValueTableModel.fireTableDataChanged(); - - // select other one. - if (keyColumnNameValueTableModel.getRowCount() > selectedRows[0]) { - keyColumnValuesTable.getSelectionModel().setSelectionInterval(selectedRows[0], selectedRows[0]); - } else if (keyColumnNameValueTableModel.getRowCount() > 0) { - keyColumnValuesTable.getSelectionModel().setSelectionInterval(0, 0); - } - } - } - } - - /* - * 刷新columnsComboBox - */ - private void refreshColumnsComboBox() { - DefaultComboBoxModel model = (DefaultComboBoxModel)this.columnsComboBox.getModel(); - model.removeAllElements(); - - ColumnName[] columnNames = currentColumnNames(); - for (int i = 0; i < columnNames.length; i++) { - model.addElement(columnNames[i]); - } - } - - // 得到当前的ColumnName[] - private ColumnName[] currentColumnNames() { - // ben:清除原有的 - if (currentColumnNames != null) { - currentColumnNames = null; - } - String[] colNames = this.chooseTable.currentColumnNames(); - int len = colNames.length; - currentColumnNames = new ColumnName[len]; - for (int i = 0; i < len; i++) { - currentColumnNames[i] = new ColumnName(colNames[i]); - } - return currentColumnNames; - } - - /* - * 设置JTable的Column - */ - private void initJTableColumn() { - TableColumn column0 = this.keyColumnValuesTable.getColumnModel().getColumn(0); - column0.setMaxWidth(50); - - TableColumn column1 = this.keyColumnValuesTable.getColumnModel().getColumn(1); - column1.setCellRenderer(new ColumnNameTableCellRenderer()); - - TableColumn column2 = this.keyColumnValuesTable.getColumnModel().getColumn(2); - column2.setCellRenderer(new ColumnValueTableCellRenderer()); - - // 设置column1的editor - columnsComboBox = new UIComboBox(new DefaultComboBoxModel()); - columnsComboBox.setRenderer(new UIComboBoxRenderer() { - - public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { - super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); - - if (value instanceof ColumnName) { - this.setText(((ColumnName)value).name); - } - - return this; - } - - }); - column1.setCellEditor(new DefaultCellEditor(columnsComboBox) { - public boolean stopCellEditing() { - if (super.stopCellEditing()) { - return true; - } - - return false; - } - }); - ((DefaultCellEditor)column1.getCellEditor()).setClickCountToStart(2); - - //设置Column 2的Editor - column2.setCellEditor(new ColumnValueEditor()); - } - - public void populateBean(DBManipulation dbManipulation) { - if (dbManipulation == null) { - dbManipulation = new DBManipulation(); - } + keyColumnNameValueTableModel.fireTableDataChanged(); + + // select other one. + if (keyColumnNameValueTableModel.getRowCount() > selectedRows[0]) { + keyColumnValuesTable.getSelectionModel().setSelectionInterval(selectedRows[0], selectedRows[0]); + } else if (keyColumnNameValueTableModel.getRowCount() > 0) { + keyColumnValuesTable.getSelectionModel().setSelectionInterval(0, 0); + } + } + } + } + + /* + * 刷新columnsComboBox + */ + private void refreshColumnsComboBox() { + DefaultComboBoxModel model = (DefaultComboBoxModel) this.columnsComboBox.getModel(); + model.removeAllElements(); + + ColumnName[] columnNames = currentColumnNames(); + for (ColumnName columnName : columnNames) { + model.addElement(columnName); + } + } + + // 得到当前的ColumnName[] + private ColumnName[] currentColumnNames() { + // ben:清除原有的 + if (currentColumnNames != null) { + currentColumnNames = null; + } + String[] colNames = this.chooseTable.currentColumnNames(); + int len = colNames.length; + currentColumnNames = new ColumnName[len]; + for (int i = 0; i < len; i++) { + currentColumnNames[i] = new ColumnName(colNames[i]); + } + return currentColumnNames; + } + + /* + * 设置JTable的Column + */ + private void initJTableColumn() { + TableColumn column0 = this.keyColumnValuesTable.getColumnModel().getColumn(0); + column0.setMaxWidth(50); + + TableColumn column1 = this.keyColumnValuesTable.getColumnModel().getColumn(1); + column1.setCellRenderer(new ColumnNameTableCellRenderer()); + + TableColumn column2 = this.keyColumnValuesTable.getColumnModel().getColumn(2); + column2.setCellRenderer(new ColumnValueTableCellRenderer()); + + // 设置column1的editor + columnsComboBox = new UIComboBox(new DefaultComboBoxModel()); + columnsComboBox.setRenderer(new UIComboBoxRenderer() { + + @Override + public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { + super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); + + if (value instanceof ColumnName) { + this.setText(((ColumnName) value).name); + } + + return this; + } + + }); + column1.setCellEditor(new DefaultCellEditor(columnsComboBox) { + @Override + public boolean stopCellEditing() { + return super.stopCellEditing(); + } + }); + ((DefaultCellEditor) column1.getCellEditor()).setClickCountToStart(2); + + //设置Column 2的Editor + column2.setCellEditor(new ColumnValueEditor(DBManipulationPane.this)); + } + + @Override + public void populateBean(DBManipulation dbManipulation) { + if (dbManipulation == null) { + dbManipulation = new DBManipulation(); + } subMitName = dbManipulation.getName(); - DMLConfig dmlConfig = dbManipulation.getDmlConfig(); - - if (dmlConfig != null) { - if (dmlConfig instanceof IntelliDMLConfig) { - dmlConfigComboBox.setSelectedIndex(0); - } else if (dmlConfig instanceof DeleteConfig) { - dmlConfigComboBox.setSelectedIndex(1); - } else if (dmlConfig instanceof InsertConfig) { - dmlConfigComboBox.setSelectedIndex(2); - } else if (dmlConfig instanceof UpdateConfig) { - dmlConfigComboBox.setSelectedIndex(3); - } else { - dmlConfigComboBox.setSelectedIndex(0); - } - jobs = new NameSubmitJob[dmlConfig.getSubmitJobCount()]; - for (int i = 0; i < jobs.length; i++) { - jobs[i] = dmlConfig.getNameSubmitJob(i); - } - condition = dmlConfig.getCondition(); + DMLConfig dmlConfig = dbManipulation.getDmlConfig(); + + if (dmlConfig != null) { + if (dmlConfig instanceof IntelliDMLConfig) { + dmlConfigComboBox.setSelectedIndex(0); + } else if (dmlConfig instanceof DeleteConfig) { + dmlConfigComboBox.setSelectedIndex(1); + } else if (dmlConfig instanceof InsertConfig) { + dmlConfigComboBox.setSelectedIndex(2); + } else if (dmlConfig instanceof UpdateConfig) { + dmlConfigComboBox.setSelectedIndex(3); + } else { + dmlConfigComboBox.setSelectedIndex(0); + } + jobs = new NameSubmitJob[dmlConfig.getSubmitJobCount()]; + for (int i = 0; i < jobs.length; i++) { + jobs[i] = dmlConfig.getNameSubmitJob(i); + } + condition = dmlConfig.getCondition(); UpdateCheckBox.setSelected(dmlConfig.isUpdateSelected()); - } else { - jobs = null; - condition = null; - dmlConfigComboBox.setSelectedIndex(0); + } else { + jobs = null; + condition = null; + dmlConfigComboBox.setSelectedIndex(0); UpdateCheckBox.setSelected(false); - } + } - String schema = null; - String tableName = null; + String schema = null; + String tableName = null; Table table = null; - if (dmlConfig != null && dmlConfig.getOriTable() != null) { + if (dmlConfig != null && dmlConfig.getOriTable() != null) { table = dmlConfig.getOriTable(); if (table != null) { schema = table.getSchema(); tableName = table.getName(); } } - chooseTable.populateBean(new DataBaseItems(dbManipulation.getDBName(), schema, tableName)); + chooseTable.populateBean(new DataBaseItems(dbManipulation.getDBName(), schema, tableName)); - populateKeyColumnValueTable(dmlConfig); + populateKeyColumnValueTable(dmlConfig); updateUpdateCheckBoxEnable(); - refreshConditionList(); - } - - private void populateKeyColumnValueTable(DMLConfig dmlConfig) { - KeyColumnTableModel keyColumnNameValueTableModel = (KeyColumnTableModel)this.keyColumnValuesTable.getModel(); - keyColumnNameValueTableModel.removeAllKeyColumnNameValue(); - - if (dmlConfig != null) { - boolean acceptPara = false; - for (int i = 0; i < v_Types.length; i++) { - if (v_Types[i].accept(new Parameter())) { - acceptPara = true; - break; - } - } - for (int i = 0; i < dmlConfig.getColumnConfigCount(); i++) { - ColumnConfig column = dmlConfig.getColumnConfig(i); - String columnName = column.getColumnName(); - if (!acceptPara && column.getColumnValue() instanceof Parameter) { - // 表单中,将以前的参数转换为公式 - column.setColumnValue(BaseFormula.createFormulaBuilder().build(((Parameter)column.getColumnValue()).getName())); - } - - KeyColumnNameValue newColumnNameValue = new KeyColumnNameValue(column.isKey(), new ColumnName(columnName), new ColumnValue(column.getColumnValue()), - column.isSkipUnmodified()); - keyColumnNameValueTableModel.addKeyColumnNameValue(newColumnNameValue); - } - } - keyColumnNameValueTableModel.fireTableDataChanged(); - - // 选择第一个 - if (keyColumnNameValueTableModel.getRowCount() > 0) { - keyColumnValuesTable.getSelectionModel().setSelectionInterval(0, 0); - } - } - - public DBManipulation updateBean() { - DataBaseItems para = chooseTable.updateBean(true); - DBManipulation dbMani = new DBManipulation(); - dbMani.setName(subMitName); - dbMani.setDBName(para.getDatabaseName()); + refreshConditionList(); + } + + private void populateKeyColumnValueTable(DMLConfig dmlConfig) { + KeyColumnTableModel keyColumnNameValueTableModel = (KeyColumnTableModel) this.keyColumnValuesTable.getModel(); + keyColumnNameValueTableModel.removeAllKeyColumnNameValue(); + + if (dmlConfig != null) { + boolean acceptPara = false; + for (int i = 0; i < v_Types.length; i++) { + if (v_Types[i].accept(new Parameter())) { + acceptPara = true; + break; + } + } + for (int i = 0; i < dmlConfig.getColumnConfigCount(); i++) { + ColumnConfig column = dmlConfig.getColumnConfig(i); + String columnName = column.getColumnName(); + if (!acceptPara && column.getColumnValue() instanceof Parameter) { + // 表单中,将以前的参数转换为公式 + column.setColumnValue(BaseFormula.createFormulaBuilder().build(((Parameter) column.getColumnValue()).getName())); + } + + KeyColumnNameValue newColumnNameValue = new KeyColumnNameValue(column.isKey(), new ColumnName(columnName), new ColumnValue(column.getColumnValue()), + column.isSkipUnmodified()); + keyColumnNameValueTableModel.addKeyColumnNameValue(newColumnNameValue); + } + } + keyColumnNameValueTableModel.fireTableDataChanged(); + + // 选择第一个 + if (keyColumnNameValueTableModel.getRowCount() > 0) { + keyColumnValuesTable.getSelectionModel().setSelectionInterval(0, 0); + } + } - DMLConfig dmlConfig = new IntelliDMLConfig(); - if (dmlConfigComboBox.getSelectedIndex() == 1) { - dmlConfig = new DeleteConfig(); - } else if (dmlConfigComboBox.getSelectedIndex() == 2) { - dmlConfig = new InsertConfig(); - } else if (dmlConfigComboBox.getSelectedIndex() == 3) { - dmlConfig = new UpdateConfig(); - } + @Override + public DBManipulation updateBean() { + DataBaseItems para = chooseTable.updateBean(true); + DBManipulation dbMani = new DBManipulation(); + dbMani.setName(subMitName); + dbMani.setDBName(para.getDatabaseName()); + + DMLConfig dmlConfig = new IntelliDMLConfig(); + if (dmlConfigComboBox.getSelectedIndex() == 1) { + dmlConfig = new DeleteConfig(); + } else if (dmlConfigComboBox.getSelectedIndex() == 2) { + dmlConfig = new InsertConfig(); + } else if (dmlConfigComboBox.getSelectedIndex() == 3) { + dmlConfig = new UpdateConfig(); + } - dbMani.setDmlConfig(dmlConfig); + dbMani.setDmlConfig(dmlConfig); - dmlConfig.setTable(new Table(para.getSchemaName(), para.getTableName())); + dmlConfig.setTable(new Table(para.getSchemaName(), para.getTableName())); - KeyColumnTableModel keyColumnNameValueTableModel = (KeyColumnTableModel)this.keyColumnValuesTable.getModel(); - int rowCount = keyColumnNameValueTableModel.keyColumnNameValueList.size(); - for (int i = 0; i < rowCount; i++) { - KeyColumnNameValue newKeyColumnNameValue = keyColumnNameValueTableModel.keyColumnNameValueList.get(i); - // peter:先添加key column name. + KeyColumnTableModel keyColumnNameValueTableModel = (KeyColumnTableModel) this.keyColumnValuesTable.getModel(); + int rowCount = keyColumnNameValueTableModel.keyColumnNameValueList.size(); + for (int i = 0; i < rowCount; i++) { + KeyColumnNameValue newKeyColumnNameValue = keyColumnNameValueTableModel.keyColumnNameValueList.get(i); + // peter:先添加key column name. - dmlConfig.addColumnConfig(new ColumnConfig(newKeyColumnNameValue.cn.name, newKeyColumnNameValue.cv.obj, newKeyColumnNameValue.isKey,false)); - } + dmlConfig.addColumnConfig(new ColumnConfig(newKeyColumnNameValue.cn.name, newKeyColumnNameValue.cv.obj, newKeyColumnNameValue.isKey, false)); + } dmlConfig.setUpdateSelected(UpdateCheckBox.isSelected()); - if (jobs != null) { - for (int i = 0; i < jobs.length; i++) { - dmlConfig.addSubmitJob(jobs[i]); - } - } - dmlConfig.setCondition(condition); - - return dbMani; - } - - protected class ValuePane extends BasicBeanPane { - ValueEditorPane vPane; - - public ValuePane() { - this(v_Types); - } - - public ValuePane(Editor[] types) { - vPane = new ValueEditorPane(types); - this.setLayout(new FlowLayout(FlowLayout.CENTER, 0, 45)); - this.add(vPane); - vPane.setPreferredSize(new Dimension(220, 25)); - } - - @Override - protected String title4PopupWindow() { - return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Values_Editor"); - } - - public void populateBean(Object object) { - vPane.populate(object); - } - - @Override - public Object updateBean() { - return vPane.update(); - } - - } - - /* - * alex:ColumnValue的编辑器,弹出对话框来编辑...个人觉得不大好 - */ - protected class ColumnValueEditor extends AbstractCellEditor implements TableCellEditor { - /** The Swing component being edited. */ - private UILabel textLabel; - private ValuePane vPane; - private BasicDialog vPaneDLG; - - protected ColumnValueEditor() { - this(v_Types); - } - - protected ColumnValueEditor(Editor[] types) { - textLabel = new UILabel(); - textLabel.addMouseListener(new MouseAdapter() { - public void mousePressed(MouseEvent e) { - vPaneDLG.setAlwaysOnTop(true); - vPaneDLG.setVisible(true); - - } - }); - - vPane = new ValuePane(types); - vPaneDLG = vPane.showSmallWindow(new JFrame(), new DialogActionAdapter() { - public void doOk() { - fireEditingStopped(); // Make the renderer - // reappear. + if (jobs != null) { + for (NameSubmitJob job : jobs) { + dmlConfig.addSubmitJob(job); + } + } + dmlConfig.setCondition(condition); + + return dbMani; + } + + protected class ValuePane extends BasicBeanPane { + ValueEditorPane vPane; + + public ValuePane() { + this(v_Types); + } + + public ValuePane(Editor[] types) { + vPane = new ValueEditorPane(types); + this.setLayout(new FlowLayout(FlowLayout.CENTER, 0, 45)); + this.add(vPane); + vPane.setPreferredSize(new Dimension(220, 25)); + } + + @Override + protected String title4PopupWindow() { + return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Values_Editor"); + } + + @Override + public void populateBean(Object object) { + vPane.populate(object); + } + + @Override + public Object updateBean() { + return vPane.update(); + } + + } + + /* + * alex:ColumnValue的编辑器,弹出对话框来编辑...个人觉得不大好 + */ + protected class ColumnValueEditor extends AbstractCellEditor implements TableCellEditor { + /** + * The Swing component being edited. + */ + private final UILabel textLabel; + private final ValuePane vPane; + private final BasicDialog vPaneDLG; + private Component parent; + + /** + * 列值编辑器 + * + * @param parent 父组件,通过指定父组件启动下一级子窗口 + */ + protected ColumnValueEditor(Component parent) { + this(v_Types, parent); + } + + @Deprecated + protected ColumnValueEditor() { + this(v_Types, null); + } + + /** + * 列值编辑器 + * + * @param types 编辑器类型 + * @param parent 父组件,通过指定父组件启动下一级子窗口 + */ + protected ColumnValueEditor(Editor[] types, Component parent) { + textLabel = new UILabel(); + textLabel.addMouseListener(new MouseAdapter() { + @Override + public void mousePressed(MouseEvent e) { + vPaneDLG.setVisible(true); + } + }); + + vPane = new ValuePane(types); + Window window = parent == null + ? DesignerContext.getDesignerFrame() + : SwingUtilities.getWindowAncestor(parent); + vPaneDLG = vPane.showSmallWindow(window, new DialogActionAdapter() { + @Override + public void doOk() { + fireEditingStopped(); // Make the renderer + // reappear. updateUpdateCheckBoxEnable(); - } - - public void doCancel() { - fireEditingCanceled(); - } - }); - } - - /* - * 双击以编辑 - */ - public boolean isCellEditable(EventObject anEvent) { - if (anEvent instanceof MouseEvent) { - return ((MouseEvent)anEvent).getClickCount() >= 2; - } - return true; - } - - public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) { - if (value instanceof ColumnValue) { - vPane.populateBean(((ColumnValue)value).obj); - - if (((ColumnValue)value).obj != null) { - textLabel.setText(((ColumnValue)value).obj.toString()); - } else { - textLabel.setText(""); - } - } - - return textLabel; - } - - public Object getCellEditorValue() { - return new ColumnValue(vPane.updateBean()); - } - } - - public static class ColumnName { - public String name; - - public ColumnName(String name) { - this.name = name; - } - - public boolean equals(Object obj) { - if (!(obj instanceof ColumnName)) { - return false; - } - - return ComparatorUtils.equals(this.name, ((ColumnName)obj).name); - } - - @Override - protected ColumnName clone() throws CloneNotSupportedException { - return new ColumnName(name); - } - } - - public static class ColumnValue { - public Object obj; - - public ColumnValue(Object obj) { - this.obj = obj; - } - - public Object getObj(){ + } + + @Override + public void doCancel() { + fireEditingCanceled(); + } + }); + } + + /* + * 双击以编辑 + */ + @Override + public boolean isCellEditable(EventObject anEvent) { + if (anEvent instanceof MouseEvent) { + return ((MouseEvent) anEvent).getClickCount() >= 2; + } + return true; + } + + @Override + public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) { + if (value instanceof ColumnValue) { + vPane.populateBean(((ColumnValue) value).obj); + + if (((ColumnValue) value).obj != null) { + textLabel.setText(((ColumnValue) value).obj.toString()); + } else { + textLabel.setText(""); + } + } + + return textLabel; + } + + @Override + public Object getCellEditorValue() { + return new ColumnValue(vPane.updateBean()); + } + } + + public static class ColumnName { + public String name; + + public ColumnName(String name) { + this.name = name; + } + + @Override + public boolean equals(Object obj) { + if (!(obj instanceof ColumnName)) { + return false; + } + + return ComparatorUtils.equals(this.name, ((ColumnName) obj).name); + } + + @Override + protected ColumnName clone() throws CloneNotSupportedException { + return new ColumnName(name); + } + } + + public static class ColumnValue { + public Object obj; + + public ColumnValue(Object obj) { + this.obj = obj; + } + + public Object getObj() { return obj; } - public boolean equals(Object obj) { - if (!(obj instanceof ColumnValue)) { - return false; - } + @Override + public boolean equals(Object obj) { + if (!(obj instanceof ColumnValue)) { + return false; + } - return ComparatorUtils.equals(this.obj, ((ColumnValue)obj).obj); - } + return ComparatorUtils.equals(this.obj, ((ColumnValue) obj).obj); + } - @Override - protected ColumnValue clone() throws CloneNotSupportedException { - return new ColumnValue(obj); - } - } + @Override + protected ColumnValue clone() throws CloneNotSupportedException { + return new ColumnValue(obj); + } + } - protected static class KeyColumnNameValueTable extends JTable { + protected static class KeyColumnNameValueTable extends JTable { - public KeyColumnNameValueTable() { - super(new KeyColumnValueTableModel(null)); - } + public KeyColumnNameValueTable() { + super(new KeyColumnValueTableModel(null)); + } - public KeyColumnTableModel getTableModel4SmartAddCell() { - KeyColumnTableModel clonedTableModel = null; - try { - //智能添加的时候修改clone的配置,不修改原配置,点击确认后覆盖原配置 - clonedTableModel = ((KeyColumnValueTableModel) this.getModel()).clone(); - } catch (CloneNotSupportedException e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); - } - return new KeyColumnValueTableModel(clonedTableModel); - } + public KeyColumnTableModel getTableModel4SmartAddCell() { + KeyColumnTableModel clonedTableModel = null; + try { + //智能添加的时候修改clone的配置,不修改原配置,点击确认后覆盖原配置 + clonedTableModel = ((KeyColumnValueTableModel) this.getModel()).clone(); + } catch (CloneNotSupportedException e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + return new KeyColumnValueTableModel(clonedTableModel); + } - } + } - protected abstract static class KeyColumnTableModel extends AbstractTableModel { + protected abstract static class KeyColumnTableModel extends AbstractTableModel { public static final String RAW_KEY = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Base_RWA_Key"); public static final String COLUMN = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Base_Column"); - public static final String VALUE = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Base_Value"); - - public static final String[] COLUMN_NAMES = new String[]{RAW_KEY, COLUMN, VALUE}; - - protected List keyColumnNameValueList = new ArrayList<>(); - - public KeyColumnTableModel(KeyColumnTableModel model) { - if (model != null) { - this.keyColumnNameValueList.addAll(model.keyColumnNameValueList); - } - } - - public String getColumnName(int col) { - return COLUMN_NAMES[col]; - } - - public int getColumnCount() { - return COLUMN_NAMES.length; - } - - public int getRowCount() { - return keyColumnNameValueList.size(); - } - - public void addKeyColumnNameValue(KeyColumnNameValue keyColumnNameValue) { - this.keyColumnNameValueList.add(keyColumnNameValue); - } - - public void removeKeyColumnNameValue(int index) { - this.keyColumnNameValueList.remove(index); - } - - public KeyColumnNameValue getKeyColumnNameValue(int index) { - return this.keyColumnNameValueList.get(index); - } - - public void removeAllKeyColumnNameValue() { - this.keyColumnNameValueList.clear(); - } - - public void refreshNameValueList(KeyColumnTableModel model) { - if (model != null) { - this.keyColumnNameValueList.clear(); - this.keyColumnNameValueList.addAll(model.keyColumnNameValueList); - } - } - } - - protected static class KeyColumnValueTableModel extends KeyColumnTableModel implements Cloneable{ - - public KeyColumnValueTableModel(KeyColumnTableModel model) { - super(model); - } - - public Object getValueAt(int row, int col) { - KeyColumnNameValue knv = keyColumnNameValueList.get(row); - - switch (col) { - case 0: - return knv.isKey; - case 1: - return knv.cn; - case 2: - return knv.cv; - } - return null; - } - - public void setValueAt(Object value, int row, int col) { - KeyColumnNameValue knv = keyColumnNameValueList.get(row); - - if (col == 0 && value instanceof Boolean) { - knv.isKey = ((Boolean)value).booleanValue(); - } else if (col == 1 && value instanceof ColumnName) { - knv.cn = (ColumnName)value; - } else if (col == 2 && value instanceof ColumnValue) { - knv.cv = (ColumnValue)value; - } - } - - public Class getColumnClass(int c) { - switch (c) { - case 0: - return Boolean.class; - case 1: - return ColumnName.class; - case 2: - return ColumnValue.class; - } - return String.class; - } - - public boolean isCellEditable(int row, int col) { - return true; - } - - @Override - protected KeyColumnValueTableModel clone() throws CloneNotSupportedException { - KeyColumnValueTableModel cloned = (KeyColumnValueTableModel) super.clone(); - cloned.keyColumnNameValueList = new ArrayList<>(); - for (KeyColumnNameValue keyColumnNameValue : keyColumnNameValueList) { - cloned.keyColumnNameValueList.add(keyColumnNameValue.clone()); - } - return cloned; - } - } - - - - public static class KeyColumnNameValue { - private boolean isKey = false; - private ColumnName cn; - public ColumnValue cv; - - public KeyColumnNameValue(boolean isKey, ColumnName cn, ColumnValue cv, boolean skip) { - this.isKey = isKey; - this.cn = cn; - this.cv = cv; - } - - /** - * 字符串 - * - * @return 字符串z - */ - public String toString() { - return (isKey ? "* " : "") + cn + ":" + cv; - } - - @Override - protected KeyColumnNameValue clone() throws CloneNotSupportedException { - return new KeyColumnNameValue(isKey, cn.clone(), cv.clone(), false); - } - } - - /* - * ColumnNameTableCellRenderer - */ - public class ColumnNameTableCellRenderer extends DefaultTableCellRenderer { - public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { - super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); - - if (value instanceof ColumnName) { - this.setText(((ColumnName)value).name); - } - - return this; - } - } - - /* - * ColumnValueTableCellRenderer - */ - private class ColumnValueTableCellRenderer extends DefaultTableCellRenderer { - public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { - super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); - - if (value instanceof ColumnValue) { - if (((ColumnValue)value).obj != null) { - if (((ColumnValue)value).obj instanceof Date) { - this.setText(DateUtils.DATEFORMAT2.format(((ColumnValue)value).obj)); - } else { - this.setText(((ColumnValue)value).obj.toString()); - } - } else { - this.setText(""); - } - } - - return this; - } - } + public static final String VALUE = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Base_Value"); + + public static final String[] COLUMN_NAMES = new String[]{RAW_KEY, COLUMN, VALUE}; + + protected List keyColumnNameValueList = new ArrayList<>(); + + public KeyColumnTableModel(KeyColumnTableModel model) { + if (model != null) { + this.keyColumnNameValueList.addAll(model.keyColumnNameValueList); + } + } + + @Override + public String getColumnName(int col) { + return COLUMN_NAMES[col]; + } + + @Override + public int getColumnCount() { + return COLUMN_NAMES.length; + } + + @Override + public int getRowCount() { + return keyColumnNameValueList.size(); + } + + public void addKeyColumnNameValue(KeyColumnNameValue keyColumnNameValue) { + this.keyColumnNameValueList.add(keyColumnNameValue); + } + + public void removeKeyColumnNameValue(int index) { + this.keyColumnNameValueList.remove(index); + } + + public KeyColumnNameValue getKeyColumnNameValue(int index) { + return this.keyColumnNameValueList.get(index); + } + + public void removeAllKeyColumnNameValue() { + this.keyColumnNameValueList.clear(); + } + + public void refreshNameValueList(KeyColumnTableModel model) { + if (model != null) { + this.keyColumnNameValueList.clear(); + this.keyColumnNameValueList.addAll(model.keyColumnNameValueList); + } + } + } + + protected static class KeyColumnValueTableModel extends KeyColumnTableModel implements Cloneable { + + public KeyColumnValueTableModel(KeyColumnTableModel model) { + super(model); + } + + @Override + public Object getValueAt(int row, int col) { + KeyColumnNameValue knv = keyColumnNameValueList.get(row); + + switch (col) { + case 0: + return knv.isKey; + case 1: + return knv.cn; + case 2: + return knv.cv; + } + return null; + } + + @Override + public void setValueAt(Object value, int row, int col) { + KeyColumnNameValue knv = keyColumnNameValueList.get(row); + + if (col == 0 && value instanceof Boolean) { + knv.isKey = ((Boolean) value).booleanValue(); + } else if (col == 1 && value instanceof ColumnName) { + knv.cn = (ColumnName) value; + } else if (col == 2 && value instanceof ColumnValue) { + knv.cv = (ColumnValue) value; + } + } + + @Override + public Class getColumnClass(int c) { + switch (c) { + case 0: + return Boolean.class; + case 1: + return ColumnName.class; + case 2: + return ColumnValue.class; + } + return String.class; + } + + @Override + public boolean isCellEditable(int row, int col) { + return true; + } + + @Override + protected KeyColumnValueTableModel clone() throws CloneNotSupportedException { + KeyColumnValueTableModel cloned = (KeyColumnValueTableModel) super.clone(); + cloned.keyColumnNameValueList = new ArrayList<>(); + for (KeyColumnNameValue keyColumnNameValue : keyColumnNameValueList) { + cloned.keyColumnNameValueList.add(keyColumnNameValue.clone()); + } + return cloned; + } + } + + + public static class KeyColumnNameValue { + private boolean isKey = false; + private ColumnName cn; + public ColumnValue cv; + + public KeyColumnNameValue(boolean isKey, ColumnName cn, ColumnValue cv, boolean skip) { + this.isKey = isKey; + this.cn = cn; + this.cv = cv; + } + + /** + * 字符串 + * + * @return 字符串z + */ + @Override + public String toString() { + return (isKey ? "* " : "") + cn + ":" + cv; + } + + @Override + protected KeyColumnNameValue clone() throws CloneNotSupportedException { + return new KeyColumnNameValue(isKey, cn.clone(), cv.clone(), false); + } + } + + /* + * ColumnNameTableCellRenderer + */ + public static class ColumnNameTableCellRenderer extends DefaultTableCellRenderer { + @Override + public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { + super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); + + if (value instanceof ColumnName) { + this.setText(((ColumnName) value).name); + } + + return this; + } + } + + /* + * ColumnValueTableCellRenderer + */ + private static class ColumnValueTableCellRenderer extends DefaultTableCellRenderer { + @Override + public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { + super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); + + if (value instanceof ColumnValue) { + if (((ColumnValue) value).obj != null) { + if (((ColumnValue) value).obj instanceof Date) { + this.setText(DateUtils.DATEFORMAT2.format(((ColumnValue) value).obj)); + } else { + this.setText(((ColumnValue) value).obj.toString()); + } + } else { + this.setText(""); + } + } + + return this; + } + } } diff --git a/designer-realize/src/main/java/com/fr/design/write/submit/SmartInsertDBManipulationPane.java b/designer-realize/src/main/java/com/fr/design/write/submit/SmartInsertDBManipulationPane.java index a430faeec..4c283cd71 100644 --- a/designer-realize/src/main/java/com/fr/design/write/submit/SmartInsertDBManipulationPane.java +++ b/designer-realize/src/main/java/com/fr/design/write/submit/SmartInsertDBManipulationPane.java @@ -356,7 +356,7 @@ public class SmartInsertDBManipulationPane extends DBManipulationPane { if (isCellGroup) { column2.setCellRenderer(new ColumnRowGroupCellRenderer2()); - column2.setCellEditor(new ColumnValueEditor(ValueEditorPaneFactory.cellGroupEditor())); + column2.setCellEditor(new ColumnValueEditor(ValueEditorPaneFactory.cellGroupEditor(), this)); } else { column2.setCellRenderer(new SelectedColumnValueTableCellRenderer()); } @@ -456,7 +456,7 @@ public class SmartInsertDBManipulationPane extends DBManipulationPane { newAdd.clear(); for (int i = 0; i < cs; i++) { for (int j = 0; j < rs; j++) { - TemplateCellElement cellElement = ePane.getEditingElementCase().getTemplateCellElement(c + i, r + j ); + TemplateCellElement cellElement = ePane.getEditingElementCase().getTemplateCellElement(c + i, r + j); if (cellElement != null && ((i + c) != 0 || (r + j) != 0)) { String value = cellElement.toString(); if (!newAdd.contains(value) && !allColumnRow.contains(value)) { @@ -512,7 +512,7 @@ public class SmartInsertDBManipulationPane extends DBManipulationPane { private SmartJTablePaneAction a = new AbstractSmartJTablePaneAction(this, SmartInsertDBManipulationPane.this) { @Override public void doOk() { - ((KeyColumnTableModel)keyColumnValuesTable.getModel()).refreshNameValueList((KeyColumnTableModel)model); + ((KeyColumnTableModel) keyColumnValuesTable.getModel()).refreshNameValueList((KeyColumnTableModel) model); } @Override From 9206f6ed83c6956746a3980d779f11859a6ce961 Mon Sep 17 00:00:00 2001 From: "Qinghui.Liu" Date: Wed, 9 Dec 2020 19:46:08 +0800 Subject: [PATCH 05/10] =?UTF-8?q?CHART-17340=20=E5=AF=8C=E6=96=87=E6=9C=AC?= =?UTF-8?q?=E9=A2=9C=E8=89=B2=E7=BB=84=E4=BB=B6=E5=A2=9E=E5=8A=A0=E5=9B=BD?= =?UTF-8?q?=E9=99=85=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/editor/script/i18n.js | 25 +++++++++++++++---- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/designer-chart/src/main/resources/com/fr/design/editor/script/i18n.js b/designer-chart/src/main/resources/com/fr/design/editor/script/i18n.js index 95b4585c9..35acc1ffa 100644 --- a/designer-chart/src/main/resources/com/fr/design/editor/script/i18n.js +++ b/designer-chart/src/main/resources/com/fr/design/editor/script/i18n.js @@ -16,7 +16,10 @@ "BI-Basic_Font_Color": "文字颜色", "BI-Word_Align_Left": "文字居左", "BI-Word_Align_Center": "文字居中", - "BI-Word_Align_Right": "文字居右" + "BI-Word_Align_Right": "文字居右", + "BI-Basic_Cancel": "取消", + "BI-Basic_Save": "保存", + "BI-Basic_More": "更多" }; var taiwan = { @@ -35,7 +38,10 @@ "BI-Basic_Font_Color": "文字顏色", "BI-Word_Align_Left": "文字居左", "BI-Word_Align_Center": "文字居中", - "BI-Word_Align_Right": "文字居右" + "BI-Word_Align_Right": "文字居右", + "BI-Basic_Cancel": "取消", + "BI-Basic_Save": "保存", + "BI-Basic_More": "更多" }; var english = { @@ -54,7 +60,10 @@ "BI-Basic_Font_Color": "Font Color", "BI-Word_Align_Left": "Align Left", "BI-Word_Align_Center": "Align Center", - "BI-Word_Align_Right": "Align Right" + "BI-Word_Align_Right": "Align Right", + "BI-Basic_Cancel": "Cancel", + "BI-Basic_Save": "Save", + "BI-Basic_More": "More" }; var japanese = { @@ -73,7 +82,10 @@ "BI-Basic_Font_Color": "テキストの色", "BI-Word_Align_Left": "左のテキスト", "BI-Word_Align_Center": "テキスト中心", - "BI-Word_Align_Right": "右のテキスト" + "BI-Word_Align_Right": "右のテキスト", + "BI-Basic_Cancel": "キャンセル", + "BI-Basic_Save": "セーブ", + "BI-Basic_More": "もっと" }; var korean = { @@ -92,7 +104,10 @@ "BI-Basic_Font_Color": "텍스트 색상", "BI-Word_Align_Left": "왼쪽 텍스트", "BI-Word_Align_Center": "텍스트 중심", - "BI-Word_Align_Right": "오른쪽 텍스트" + "BI-Word_Align_Right": "오른쪽 텍스트", + "BI-Basic_Cancel": "취소", + "BI-Basic_Save": "저장", + "BI-Basic_More": "더" }; function transformI18n(language) { From 0a647992b2d85eebdfaa1f882fb2f6cdb240594e Mon Sep 17 00:00:00 2001 From: "Qinghui.Liu" Date: Thu, 10 Dec 2020 11:25:17 +0800 Subject: [PATCH 06/10] =?UTF-8?q?CHART-17340=20=E8=A1=A5=E5=85=85=E5=AF=8C?= =?UTF-8?q?=E6=96=87=E6=9C=AC=E5=9B=BD=E9=99=85=E5=8C=96=E7=BF=BB=E8=AF=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/editor/script/i18n.js | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/designer-chart/src/main/resources/com/fr/design/editor/script/i18n.js b/designer-chart/src/main/resources/com/fr/design/editor/script/i18n.js index 35acc1ffa..205117f3c 100644 --- a/designer-chart/src/main/resources/com/fr/design/editor/script/i18n.js +++ b/designer-chart/src/main/resources/com/fr/design/editor/script/i18n.js @@ -19,7 +19,9 @@ "BI-Word_Align_Right": "文字居右", "BI-Basic_Cancel": "取消", "BI-Basic_Save": "保存", - "BI-Basic_More": "更多" + "BI-Basic_More": "更多", + "BI-Custom_Color": "自定义颜色", + "BI-Transparent_Color": "透明" }; var taiwan = { @@ -41,7 +43,9 @@ "BI-Word_Align_Right": "文字居右", "BI-Basic_Cancel": "取消", "BI-Basic_Save": "保存", - "BI-Basic_More": "更多" + "BI-Basic_More": "更多", + "BI-Custom_Color": "自定義顏色", + "BI-Transparent_Color": "透明" }; var english = { @@ -63,7 +67,9 @@ "BI-Word_Align_Right": "Align Right", "BI-Basic_Cancel": "Cancel", "BI-Basic_Save": "Save", - "BI-Basic_More": "More" + "BI-Basic_More": "More", + "BI-Custom_Color": "Custom Color", + "BI-Transparent_Color": "Transparent Color" }; var japanese = { @@ -85,7 +91,9 @@ "BI-Word_Align_Right": "右のテキスト", "BI-Basic_Cancel": "キャンセル", "BI-Basic_Save": "セーブ", - "BI-Basic_More": "もっと" + "BI-Basic_More": "もっと", + "BI-Custom_Color": "カスタムカラー", + "BI-Transparent_Color": "トランスペアレント" }; var korean = { @@ -107,7 +115,9 @@ "BI-Word_Align_Right": "오른쪽 텍스트", "BI-Basic_Cancel": "취소", "BI-Basic_Save": "저장", - "BI-Basic_More": "더" + "BI-Basic_More": "더", + "BI-Custom_Color": "맞춤 색상", + "BI-Transparent_Color": "투명한" }; function transformI18n(language) { From 329b58d8b8bb9c312b22fbacf9a28e36cc845bdd Mon Sep 17 00:00:00 2001 From: Yvan Date: Fri, 11 Dec 2020 11:16:31 +0800 Subject: [PATCH 07/10] =?UTF-8?q?REPORT-44714=20=E3=80=9010.0.12=E5=86=92?= =?UTF-8?q?=E7=83=9F=E3=80=91=E8=AE=BE=E8=AE=A1=E5=99=A8=E7=BC=93=E5=AD=98?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E8=AE=B0=E5=BD=95=E8=AE=BE=E8=AE=A1=E5=99=A8?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E5=A4=B1=E6=95=88=20=E4=B8=8E=E4=BA=A7?= =?UTF-8?q?=E5=93=81=E6=B2=9F=E9=80=9A=E5=90=8E=EF=BC=8C=E7=A1=AE=E8=AE=A4?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=96=B9=E6=A1=88=E4=B8=BA=EF=BC=8C=E5=BD=93?= =?UTF-8?q?=E5=8F=91=E7=94=9F=E4=BA=86=E8=B6=B3=E4=BB=A5=E9=80=A0=E6=88=90?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E9=9B=86=E9=9D=A2=E6=9D=BF=E4=B8=A2=E5=A4=B1?= =?UTF-8?q?=E7=9A=84=E5=AE=B9=E5=99=A8=E9=AB=98=E5=BA=A6=E5=8F=98=E5=8C=96?= =?UTF-8?q?=E6=97=B6=EF=BC=8C=E8=87=B3=E5=B0=91=E4=BF=9D=E8=AF=81=E6=B0=B4?= =?UTF-8?q?=E5=B9=B3=E6=8B=96=E6=8B=BD=E9=9D=A2=E6=9D=BF=E4=B8=8D=E4=B8=A2?= =?UTF-8?q?=E5=A4=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/DesignerEnvManager.java | 45 ++++++++++--------- .../gui/icontainer/UIResizableContainer.java | 32 +++---------- .../fr/design/mainframe/DesignerFrame.java | 4 +- .../mainframe/WestRegionContainerPane.java | 2 +- 4 files changed, 34 insertions(+), 49 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java b/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java index 44c0eba84..83f8133d7 100644 --- a/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java +++ b/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java @@ -141,8 +141,8 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { private int eastRegionToolPaneY = 300; private int eastRegionContainerWidth = 260; + private int westRegionToolPaneY = 300; private int westRegionContainerWidth = 240; - private double westRegionToolPaneYRate = 0.5; private String encryptionKey; private String jdkHome; @@ -240,7 +240,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { String installHome = StableUtils.getInstallHome(); //这里不判断路径是.的情况,放在checkValid方法里面,重新选 if (installHome != null) { - String name = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Engine_DEFAULT"); + String name = Toolkit.i18nText("Fine-Design_Basic_Engine_DEFAULT"); String envPath = designerEnvManager.getDefaultenvPath(installHome); designerEnvManager.putEnv(name, LocalDesignerWorkspaceInfo.create(name, envPath)); designerEnvManager.setCurEnvName(name); @@ -304,8 +304,8 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { String today = calender.get(Calendar.YEAR) + "-" + (calender.get(Calendar.MONTH) + 1) + "-" + calender.get(Calendar.DAY_OF_MONTH); String fileName = StableUtils.pathJoin(logLocation, "fr_" + today + "_%g.log"); - if (!new java.io.File(fileName).exists()) { - StableUtils.makesureFileExist(new java.io.File(fileName)); + if (!new File(fileName).exists()) { + StableUtils.makesureFileExist(new File(fileName)); } Handler handler = new FileHandler(fileName, true); @@ -440,12 +440,14 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { this.lastOpenFilePath = lastOpenFilePath; } + /** - * 获取西面板的上子面板的高度占容器总高度的比例 + * 得到西面板的上下子面板的高度区分 + * * @return */ - public double getLastWestRegionToolPaneYRate() { - return westRegionToolPaneYRate; + public int getLastWestRegionToolPaneY() { + return this.westRegionToolPaneY; } /** @@ -458,11 +460,12 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { } /** - * 设置关闭设计器前,西面板的上子面板的高度占容器总高度的比例 - * @param westRegionToolPaneYRate + * 设置西面板的上下子面板的高度区分 + * + * @param toolPaneY */ - public void setLastWestRegionToolPaneYRate(double westRegionToolPaneYRate) { - this.westRegionToolPaneYRate = westRegionToolPaneYRate; + public void setLastWestRegionToolPaneY(int toolPaneY) { + this.westRegionToolPaneY = toolPaneY; } /** @@ -526,7 +529,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { return env; } } - String name = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Workspace_Default"); + String name = Toolkit.i18nText("Fine-Design_Basic_Workspace_Default"); LocalDesignerWorkspaceInfo newDefaultEnv = LocalDesignerWorkspaceInfo.create(name, defaultenvPath); this.putEnv(name, newDefaultEnv); return newDefaultEnv; @@ -549,7 +552,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { } } } - return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Workspace_Default"); + return Toolkit.i18nText("Fine-Design_Basic_Workspace_Default"); } @@ -1607,8 +1610,8 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { private void readLastWestRegionLayout(XMLableReader reader) { String tmpVal; - if ((tmpVal = reader.getAttrAsString("toolPaneYRate", null)) != null) { - this.setLastWestRegionToolPaneYRate(Double.parseDouble(tmpVal)); + if ((tmpVal = reader.getAttrAsString("toolPaneY", null)) != null) { + this.setLastWestRegionToolPaneY(Integer.parseInt(tmpVal)); } if ((tmpVal = reader.getAttrAsString("containerWidth", null)) != null) { this.setLastWestRegionContainerWidth(Integer.parseInt(tmpVal)); @@ -1640,7 +1643,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { if ((tmpVal = reader.getAttrAsString("webinfLocation", null)) != null) { // marks:兼容6.1的 // marks:设置默认的目录. - String curReportServerName = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Server_Embedded_Server"); + String curReportServerName = Toolkit.i18nText("Fine-Design_Basic_Server_Embedded_Server"); LocalDesignerWorkspaceInfo reportServer = LocalDesignerWorkspaceInfo.create(curReportServerName, tmpVal); this.putEnv(curReportServerName, reportServer); @@ -1931,8 +1934,8 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { private void writeLastWestRegionLayout(XMLPrintWriter writer) { writer.startTAG("LastWestRegionLayout"); - if (this.getLastWestRegionToolPaneYRate() >= 0) { - writer.attr("toolPaneYRate", this.getLastWestRegionToolPaneYRate()); + if (this.getLastWestRegionToolPaneY() >= 0) { + writer.attr("toolPaneY ", this.getLastWestRegionToolPaneY()); } if (this.getLastWestRegionContainerWidth() >= 0) { writer.attr("containerWidth", this.getLastWestRegionContainerWidth()); @@ -2060,9 +2063,9 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { Self; public void handle(Throwable throwable) { ErrorDialog dialog = new ErrorDialog(null, - Toolkit.i18nText("Fine-Design_Error_Start_Apology_Message"), - Toolkit.i18nText("Fine-Design_Error_Start_Report"), - throwable.getMessage()) { + Toolkit.i18nText("Fine-Design_Error_Start_Apology_Message"), + Toolkit.i18nText("Fine-Design_Error_Start_Report"), + throwable.getMessage()) { @Override protected void okEvent() { dispose(); diff --git a/designer-base/src/main/java/com/fr/design/gui/icontainer/UIResizableContainer.java b/designer-base/src/main/java/com/fr/design/gui/icontainer/UIResizableContainer.java index b48950485..f3f45768f 100644 --- a/designer-base/src/main/java/com/fr/design/gui/icontainer/UIResizableContainer.java +++ b/designer-base/src/main/java/com/fr/design/gui/icontainer/UIResizableContainer.java @@ -44,7 +44,6 @@ public class UIResizableContainer extends JPanel { private boolean isDownPaneVisible = true ; private int paraHeight; private int parentHeight = -1; - private double toolPaneYRate; public UIResizableContainer(int direction) { this(new JPanel(), new JPanel(), direction); @@ -157,20 +156,12 @@ public class UIResizableContainer extends JPanel { return this.toolPaneY; } - /** - * 获取上子面板高度占容器总高度的比例 - * @return - */ - public double getToolPaneYRate() { - return toolPaneYRate; - } - /** * 设置关闭设计器前最新的上子面板的高度比例 - * @param toolPaneYRate + * @param toolPaneY */ - public void setLastToolPaneYRate(double toolPaneYRate) { - this.toolPaneYRate = toolPaneYRate; + public void setLastToolPaneY(int toolPaneY) { + this.toolPaneY = toolPaneY; } /** @@ -248,9 +239,10 @@ public class UIResizableContainer extends JPanel { if (parentHeight == -1) { // 初始化下parentheight,存一下当前的父容器height parentHeight = parent.getHeight(); - } else if (parentHeight != parent.getHeight() && parent.getHeight() > 0) { - // parentHeight与父容器height不等时,代表用户调整分辨率或者dpi或者容器高度发生变化了,此时调整toolPaneY - toolPaneY = Math.min((int) (parent.getHeight() * toolPaneYRate), (parent.getHeight() - toolPaneHeight)); + } + if (parentHeight != parent.getHeight() && (parent.getHeight() - toolPaneHeight) >= 0) { + // 调整toolPaneY,保证至少水平的拖拽条horizontToolPane不丢失 + toolPaneY = Math.min(toolPaneY, parent.getHeight() - toolPaneHeight); parentHeight = parent.getHeight(); } } @@ -376,7 +368,6 @@ public class UIResizableContainer extends JPanel { toolPaneY = e.getYOnScreen() - UIResizableContainer.this.getLocationOnScreen().y; toolPaneY = toolPaneY < 0 ? 0 : toolPaneY; toolPaneY = toolPaneY > UIResizableContainer.this.getHeight() - toolPaneHeight ? UIResizableContainer.this.getHeight() - toolPaneHeight - getParameterPaneHeight() : toolPaneY - getParameterPaneHeight(); - adjustToolPaneYRate(); refreshContainer(); } }); @@ -398,10 +389,8 @@ public class UIResizableContainer extends JPanel { public void mouseClicked(MouseEvent e) { if (e.getX() <= ARROW_RANGE) { toolPaneY = 0; - UIResizableContainer.this.adjustToolPaneYRate(); } else if (e.getX() >= getWidth() - ARROW_RANGE) { toolPaneY = UIResizableContainer.this.getHeight() - toolPaneHeight - getParameterPaneHeight(); - UIResizableContainer.this.adjustToolPaneYRate(); } else { return; } @@ -562,11 +551,4 @@ public class UIResizableContainer extends JPanel { jf.setSize(500, 500); jf.setVisible(true); } - - /** - * 当toolPaneY发生变化时,也需要调整toolPaneYRate - */ - private void adjustToolPaneYRate() { - this.toolPaneYRate = ((double) toolPaneY) / this.getHeight(); - } } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java index a5eafa0c0..490b4e7e9 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java @@ -1170,8 +1170,8 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta DesignerEnvManager.getEnvManager().setLastOpenFile(jt.getEditingFILE().getPath()); } - DesignerEnvManager.getEnvManager().setLastWestRegionToolPaneYRate( - WestRegionContainerPane.getInstance().getToolPaneYRate()); + DesignerEnvManager.getEnvManager().setLastWestRegionToolPaneY( + WestRegionContainerPane.getInstance().getToolPaneY()); DesignerEnvManager.getEnvManager().setLastWestRegionContainerWidth( WestRegionContainerPane.getInstance().getContainerWidth()); DesignerEnvManager.getEnvManager().setLastEastRegionToolPaneY( diff --git a/designer-base/src/main/java/com/fr/design/mainframe/WestRegionContainerPane.java b/designer-base/src/main/java/com/fr/design/mainframe/WestRegionContainerPane.java index 358fba411..004fbd55a 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/WestRegionContainerPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/WestRegionContainerPane.java @@ -24,7 +24,7 @@ public class WestRegionContainerPane extends UIResizableContainer { public static final WestRegionContainerPane getInstance() { if (THIS == null) { THIS = new WestRegionContainerPane(); - THIS.setLastToolPaneYRate(DesignerEnvManager.getEnvManager().getLastWestRegionToolPaneYRate()); + THIS.setLastToolPaneY(DesignerEnvManager.getEnvManager().getLastWestRegionToolPaneY()); THIS.setLastContainerWidth(DesignerEnvManager.getEnvManager().getLastWestRegionContainerWidth()); } return THIS; From ff0ded7b125833d461601b16c696a3f84ea80f44 Mon Sep 17 00:00:00 2001 From: Yvan Date: Fri, 11 Dec 2020 11:36:12 +0800 Subject: [PATCH 08/10] =?UTF-8?q?REPORT-44714=20=E3=80=9010.0.12=E5=86=92?= =?UTF-8?q?=E7=83=9F=E3=80=91=E8=AE=BE=E8=AE=A1=E5=99=A8=E7=BC=93=E5=AD=98?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E8=AE=B0=E5=BD=95=E8=AE=BE=E8=AE=A1=E5=99=A8?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E5=A4=B1=E6=95=88=20=E5=B0=86=E5=AF=B9?= =?UTF-8?q?=E4=B8=80=E4=BA=9B=E6=96=87=E4=BB=B6=E7=9A=84=E8=AF=AF=E6=94=B9?= =?UTF-8?q?=E5=8A=A8=E5=9B=9E=E9=80=80=E4=B8=80=E4=B8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/DesignerEnvManager.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java b/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java index 83f8133d7..791d679b3 100644 --- a/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java +++ b/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java @@ -2063,9 +2063,9 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { Self; public void handle(Throwable throwable) { ErrorDialog dialog = new ErrorDialog(null, - Toolkit.i18nText("Fine-Design_Error_Start_Apology_Message"), - Toolkit.i18nText("Fine-Design_Error_Start_Report"), - throwable.getMessage()) { + Toolkit.i18nText("Fine-Design_Error_Start_Apology_Message"), + Toolkit.i18nText("Fine-Design_Error_Start_Report"), + throwable.getMessage()) { @Override protected void okEvent() { dispose(); From f0edaca90666027a2eed9fd04f5363a78f18dc5f Mon Sep 17 00:00:00 2001 From: Yvan Date: Fri, 11 Dec 2020 11:59:01 +0800 Subject: [PATCH 09/10] =?UTF-8?q?REPORT-44714=20=E3=80=9010.0.12=E5=86=92?= =?UTF-8?q?=E7=83=9F=E3=80=91=E8=AE=BE=E8=AE=A1=E5=99=A8=E7=BC=93=E5=AD=98?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E8=AE=B0=E5=BD=95=E8=AE=BE=E8=AE=A1=E5=99=A8?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E5=A4=B1=E6=95=88=20=E3=80=90=E9=97=AE?= =?UTF-8?q?=E9=A2=98=E5=8E=9F=E5=9B=A0=E3=80=91=E9=9C=80=E8=A6=81=E5=9C=A8?= =?UTF-8?q?=E4=B8=AD=E9=97=B4=E7=89=88=E6=9C=AC=E5=8F=91=E5=B8=83=EF=BC=8C?= =?UTF-8?q?=E6=8F=90=E4=B8=80=E4=BB=BD=E5=88=B0final=20=E3=80=90=E6=94=B9?= =?UTF-8?q?=E5=8A=A8=E6=80=9D=E8=B7=AF=E3=80=91=E6=94=B9=E5=8A=A8=E5=B7=B2?= =?UTF-8?q?=E7=BB=8F=E5=9C=A8release=E4=B8=AD=E9=80=9A=E8=BF=87=EF=BC=8C?= =?UTF-8?q?=E6=8F=90=E4=B8=80=E4=BB=BD=E5=88=B0final?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gui/icontainer/UIResizableContainer.java | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/icontainer/UIResizableContainer.java b/designer-base/src/main/java/com/fr/design/gui/icontainer/UIResizableContainer.java index 0a8529abf..54ed4d18a 100644 --- a/designer-base/src/main/java/com/fr/design/gui/icontainer/UIResizableContainer.java +++ b/designer-base/src/main/java/com/fr/design/gui/icontainer/UIResizableContainer.java @@ -45,6 +45,7 @@ public class UIResizableContainer extends JPanel { private boolean isLeftRightDragEnabled = true; private boolean isDownPaneVisible = true ; private int paraHeight; + private int parentHeight = -1; public UIResizableContainer(int direction) { this(new JPanel(), new JPanel(), direction); @@ -207,7 +208,8 @@ public class UIResizableContainer extends JPanel { if (verticalToolPane == null || downPane == null) { return; } - + // REPORT-42913 如果用户修改了分辨率或者dpi,可能造成toolPaneY大于parent.getHeight,整个downPane将丢失,因此这里调整下toolPaneY + adjustToolPaneY(parent); if (direction == Constants.RIGHT) { if(isDownPaneVisible){ upPane.setBounds(0, 0, containerWidth - toolPaneHeight, toolPaneY); @@ -236,6 +238,18 @@ public class UIResizableContainer extends JPanel { } } + private void adjustToolPaneY(Container parent) { + if (parentHeight == -1) { + // 初始化下parentheight,存一下当前的父容器height + parentHeight = parent.getHeight(); + } + if (parentHeight != parent.getHeight() && (parent.getHeight() - toolPaneHeight) >= 0) { + // 调整toolPaneY,保证至少水平的拖拽条horizontToolPane不丢失 + toolPaneY = Math.min(toolPaneY, parent.getHeight() - toolPaneHeight); + parentHeight = parent.getHeight(); + } + } + @Override public void addLayoutComponent(String name, Component comp) { } @@ -540,4 +554,4 @@ public class UIResizableContainer extends JPanel { jf.setSize(500, 500); jf.setVisible(true); } -} \ No newline at end of file +} From 8c138328e230149c1643abb9addac9afb824cd53 Mon Sep 17 00:00:00 2001 From: vito Date: Fri, 11 Dec 2020 16:09:10 +0800 Subject: [PATCH 10/10] =?UTF-8?q?REPORT-45095=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E8=B4=A8=E9=87=8F&=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E4=BC=A0=E9=80=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../write/submit/DBManipulationPane.java | 45 +++++++------------ .../submit/SmartInsertDBManipulationPane.java | 2 +- 2 files changed, 17 insertions(+), 30 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/write/submit/DBManipulationPane.java b/designer-base/src/main/java/com/fr/design/write/submit/DBManipulationPane.java index 1e1ab1f72..46b11d2a8 100644 --- a/designer-base/src/main/java/com/fr/design/write/submit/DBManipulationPane.java +++ b/designer-base/src/main/java/com/fr/design/write/submit/DBManipulationPane.java @@ -697,7 +697,7 @@ public class DBManipulationPane extends BasicBeanPane { ((DefaultCellEditor) column1.getCellEditor()).setClickCountToStart(2); //设置Column 2的Editor - column2.setCellEditor(new ColumnValueEditor(DBManipulationPane.this)); + column2.setCellEditor(new ColumnValueEditor()); } @Override @@ -864,43 +864,19 @@ public class DBManipulationPane extends BasicBeanPane { */ private final UILabel textLabel; private final ValuePane vPane; - private final BasicDialog vPaneDLG; - private Component parent; - /** - * 列值编辑器 - * - * @param parent 父组件,通过指定父组件启动下一级子窗口 - */ - protected ColumnValueEditor(Component parent) { - this(v_Types, parent); - } - - @Deprecated protected ColumnValueEditor() { - this(v_Types, null); + this(v_Types); } /** * 列值编辑器 * - * @param types 编辑器类型 - * @param parent 父组件,通过指定父组件启动下一级子窗口 + * @param types 编辑器类型 */ - protected ColumnValueEditor(Editor[] types, Component parent) { + protected ColumnValueEditor(Editor[] types) { textLabel = new UILabel(); - textLabel.addMouseListener(new MouseAdapter() { - @Override - public void mousePressed(MouseEvent e) { - vPaneDLG.setVisible(true); - } - }); - - vPane = new ValuePane(types); - Window window = parent == null - ? DesignerContext.getDesignerFrame() - : SwingUtilities.getWindowAncestor(parent); - vPaneDLG = vPane.showSmallWindow(window, new DialogActionAdapter() { + DialogActionAdapter adapter = new DialogActionAdapter() { @Override public void doOk() { fireEditingStopped(); // Make the renderer @@ -912,7 +888,18 @@ public class DBManipulationPane extends BasicBeanPane { public void doCancel() { fireEditingCanceled(); } + }; + textLabel.addMouseListener(new MouseAdapter() { + @Override + public void mousePressed(MouseEvent e) { + Window window = e.getComponent() == null + ? DesignerContext.getDesignerFrame() + : SwingUtilities.getWindowAncestor(e.getComponent()); + vPane.showSmallWindow(window, adapter) + .setVisible(true); + } }); + vPane = new ValuePane(types); } /* diff --git a/designer-realize/src/main/java/com/fr/design/write/submit/SmartInsertDBManipulationPane.java b/designer-realize/src/main/java/com/fr/design/write/submit/SmartInsertDBManipulationPane.java index 4c283cd71..d306bb179 100644 --- a/designer-realize/src/main/java/com/fr/design/write/submit/SmartInsertDBManipulationPane.java +++ b/designer-realize/src/main/java/com/fr/design/write/submit/SmartInsertDBManipulationPane.java @@ -356,7 +356,7 @@ public class SmartInsertDBManipulationPane extends DBManipulationPane { if (isCellGroup) { column2.setCellRenderer(new ColumnRowGroupCellRenderer2()); - column2.setCellEditor(new ColumnValueEditor(ValueEditorPaneFactory.cellGroupEditor(), this)); + column2.setCellEditor(new ColumnValueEditor(ValueEditorPaneFactory.cellGroupEditor())); } else { column2.setCellRenderer(new SelectedColumnValueTableCellRenderer()); }