From 8eb1682f8e25455c1c218632890421ce177ea9a8 Mon Sep 17 00:00:00 2001 From: hzzz Date: Mon, 16 Jul 2018 13:57:41 +0800 Subject: [PATCH 01/33] =?UTF-8?q?REPORT-9723=E3=80=90=E9=98=BB=E5=A1=9E?= =?UTF-8?q?=E3=80=91=E3=80=9010.0=E4=BA=8C=E8=BD=AE=E5=9B=9E=E5=BD=92?= =?UTF-8?q?=E3=80=91=E5=88=87=E6=8D=A2=E8=BF=9C=E7=A8=8B=E5=B7=A5=E4=BD=9C?= =?UTF-8?q?=E7=9B=AE=E5=BD=95=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/actions/file/SwitchExistEnv.java | 9 +-------- .../main/java/com/fr/design/env/RemoteWorkspace.java | 2 +- .../java/com/fr/design/mainframe/TemplatePane.java | 10 +--------- .../action/RemoteDesignAuthorityManagerAction.java | 2 +- .../fr/design/remote/ui/AuthorityListControlPane.java | 2 +- .../java/com/fr/design/remote/ui/UserManagerPane.java | 4 ++-- .../com/fr/design/remote/ui/list/AddedMemberList.java | 3 ++- .../remote/ui/list/AddedMemberListCellRender.java | 2 +- .../com/fr/design/remote/ui/list/AddingMemberList.java | 2 +- .../remote/ui/list/AddingMemberListCellRender.java | 2 +- .../java/com/fr/design/remote/ui/list/MemberList.java | 2 +- .../fr/design/mainframe/socketio/DesignerSocketIO.java | 2 +- 12 files changed, 14 insertions(+), 28 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/actions/file/SwitchExistEnv.java b/designer-base/src/main/java/com/fr/design/actions/file/SwitchExistEnv.java index f378d7f5e..42398263e 100644 --- a/designer-base/src/main/java/com/fr/design/actions/file/SwitchExistEnv.java +++ b/designer-base/src/main/java/com/fr/design/actions/file/SwitchExistEnv.java @@ -115,19 +115,12 @@ public class SwitchExistEnv extends MenuDef { } WorkContext.switchTo(workspace, new WorkContextCallback() { @Override - public void success() { + public void done() { DesignerEnvManager.getEnvManager().setCurEnvName(envName); DesignUtils.refreshDesignerFrame(); HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().refreshToolArea(); fireDSChanged(); } - - @Override - public void fail() { - JOptionPane.showMessageDialog( - DesignerContext.getDesignerFrame(), - Inter.getLocText(new String[]{"M-SwitchWorkspace", "Failed"})); - } }); } } diff --git a/designer-base/src/main/java/com/fr/design/env/RemoteWorkspace.java b/designer-base/src/main/java/com/fr/design/env/RemoteWorkspace.java index a2b8bd94f..acb715919 100644 --- a/designer-base/src/main/java/com/fr/design/env/RemoteWorkspace.java +++ b/designer-base/src/main/java/com/fr/design/env/RemoteWorkspace.java @@ -1,11 +1,11 @@ package com.fr.design.env; -import com.fr.env.operator.decision.DecisionOperator; import com.fr.locale.InterProviderFactory; import com.fr.workspace.WorkContext; import com.fr.workspace.Workspace; import com.fr.workspace.connect.WorkspaceClient; import com.fr.workspace.connect.WorkspaceConnection; +import com.fr.workspace.server.authority.decision.DecisionOperator; /** * Created by juhaoyu on 2018/6/14. diff --git a/designer-base/src/main/java/com/fr/design/mainframe/TemplatePane.java b/designer-base/src/main/java/com/fr/design/mainframe/TemplatePane.java index 4107a0538..31a9489a9 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/TemplatePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/TemplatePane.java @@ -133,16 +133,8 @@ public class TemplatePane extends JPanel implements MouseListener { GeneralContext.fireEnvWillChangeListener(); try { WorkContext.switchTo(DesignerWorkspaceGenerator.generate(selectedEnv), new WorkContextCallback() { - - @Override - public void fail() { - - JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText(new String[]{"M-SwitchWorkspace", "Failed"}), - null, 0, UIManager.getIcon("OptionPane.errorIcon")); - } - @Override - public void success() { + public void done() { DesignerEnvManager.getEnvManager().setCurEnvName(selectedName); DesignUtils.refreshDesignerFrame(); } diff --git a/designer-base/src/main/java/com/fr/design/remote/action/RemoteDesignAuthorityManagerAction.java b/designer-base/src/main/java/com/fr/design/remote/action/RemoteDesignAuthorityManagerAction.java index e8cb2a207..3ad03148e 100644 --- a/designer-base/src/main/java/com/fr/design/remote/action/RemoteDesignAuthorityManagerAction.java +++ b/designer-base/src/main/java/com/fr/design/remote/action/RemoteDesignAuthorityManagerAction.java @@ -6,11 +6,11 @@ import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.mainframe.DesignerContext; import com.fr.design.remote.ui.AuthorityManagerPane; -import com.fr.env.operator.authority.AuthorityOperator; import com.fr.general.Inter; import com.fr.log.FineLoggerFactory; import com.fr.report.DesignAuthority; import com.fr.workspace.WorkContext; +import com.fr.workspace.server.authority.AuthorityOperator; import java.awt.event.ActionEvent; diff --git a/designer-base/src/main/java/com/fr/design/remote/ui/AuthorityListControlPane.java b/designer-base/src/main/java/com/fr/design/remote/ui/AuthorityListControlPane.java index 03e6d4457..40bd04022 100644 --- a/designer-base/src/main/java/com/fr/design/remote/ui/AuthorityListControlPane.java +++ b/designer-base/src/main/java/com/fr/design/remote/ui/AuthorityListControlPane.java @@ -18,12 +18,12 @@ import com.fr.design.remote.RemoteDesignAuthorityCreator; import com.fr.design.remote.ui.list.AuthorityList; import com.fr.design.remote.ui.list.AuthorityListCellRenderer; import com.fr.design.utils.gui.GUICoreUtils; -import com.fr.env.RemoteDesignMember; import com.fr.general.ComparatorUtils; import com.fr.general.Inter; import com.fr.log.FineLoggerFactory; import com.fr.report.DesignAuthority; import com.fr.stable.ArrayUtils; +import com.fr.workspace.server.authority.RemoteDesignMember; import javax.swing.BorderFactory; import javax.swing.DefaultListModel; diff --git a/designer-base/src/main/java/com/fr/design/remote/ui/UserManagerPane.java b/designer-base/src/main/java/com/fr/design/remote/ui/UserManagerPane.java index 781f1cfca..97ffdd3b6 100644 --- a/designer-base/src/main/java/com/fr/design/remote/ui/UserManagerPane.java +++ b/designer-base/src/main/java/com/fr/design/remote/ui/UserManagerPane.java @@ -13,12 +13,12 @@ import com.fr.design.remote.ui.list.AddedMemberListCellRender; import com.fr.design.remote.ui.list.AddingMemberList; import com.fr.design.remote.ui.list.AddingMemberListCellRender; import com.fr.design.remote.ui.list.MemberListSelectedChangeListener; -import com.fr.env.RemoteDesignMember; -import com.fr.env.operator.decision.DecisionOperator; import com.fr.general.Inter; import com.fr.stable.StringUtils; import com.fr.third.guava.collect.ImmutableList; import com.fr.workspace.WorkContext; +import com.fr.workspace.server.authority.RemoteDesignMember; +import com.fr.workspace.server.authority.decision.DecisionOperator; import javax.swing.BorderFactory; import javax.swing.DefaultListModel; diff --git a/designer-base/src/main/java/com/fr/design/remote/ui/list/AddedMemberList.java b/designer-base/src/main/java/com/fr/design/remote/ui/list/AddedMemberList.java index a2631d66f..0bba02316 100644 --- a/designer-base/src/main/java/com/fr/design/remote/ui/list/AddedMemberList.java +++ b/designer-base/src/main/java/com/fr/design/remote/ui/list/AddedMemberList.java @@ -1,6 +1,7 @@ package com.fr.design.remote.ui.list; -import com.fr.env.RemoteDesignMember; + +import com.fr.workspace.server.authority.RemoteDesignMember; import javax.swing.DefaultListModel; import java.awt.Point; diff --git a/designer-base/src/main/java/com/fr/design/remote/ui/list/AddedMemberListCellRender.java b/designer-base/src/main/java/com/fr/design/remote/ui/list/AddedMemberListCellRender.java index 39dd08fb0..64a5a6332 100644 --- a/designer-base/src/main/java/com/fr/design/remote/ui/list/AddedMemberListCellRender.java +++ b/designer-base/src/main/java/com/fr/design/remote/ui/list/AddedMemberListCellRender.java @@ -3,7 +3,7 @@ package com.fr.design.remote.ui.list; import com.fr.base.BaseUtils; import com.fr.design.gui.ilable.UILabel; import com.fr.design.remote.button.IconButton; -import com.fr.env.RemoteDesignMember; +import com.fr.workspace.server.authority.RemoteDesignMember; import javax.swing.BorderFactory; import javax.swing.JList; diff --git a/designer-base/src/main/java/com/fr/design/remote/ui/list/AddingMemberList.java b/designer-base/src/main/java/com/fr/design/remote/ui/list/AddingMemberList.java index 136d77cc1..d1b906d23 100644 --- a/designer-base/src/main/java/com/fr/design/remote/ui/list/AddingMemberList.java +++ b/designer-base/src/main/java/com/fr/design/remote/ui/list/AddingMemberList.java @@ -1,6 +1,6 @@ package com.fr.design.remote.ui.list; -import com.fr.env.RemoteDesignMember; +import com.fr.workspace.server.authority.RemoteDesignMember; import javax.swing.DefaultListModel; import java.awt.Point; diff --git a/designer-base/src/main/java/com/fr/design/remote/ui/list/AddingMemberListCellRender.java b/designer-base/src/main/java/com/fr/design/remote/ui/list/AddingMemberListCellRender.java index 0668d67f1..94749d531 100644 --- a/designer-base/src/main/java/com/fr/design/remote/ui/list/AddingMemberListCellRender.java +++ b/designer-base/src/main/java/com/fr/design/remote/ui/list/AddingMemberListCellRender.java @@ -3,7 +3,7 @@ package com.fr.design.remote.ui.list; import com.fr.base.BaseUtils; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.ilable.UILabel; -import com.fr.env.RemoteDesignMember; +import com.fr.workspace.server.authority.RemoteDesignMember; import javax.swing.BorderFactory; import javax.swing.JList; diff --git a/designer-base/src/main/java/com/fr/design/remote/ui/list/MemberList.java b/designer-base/src/main/java/com/fr/design/remote/ui/list/MemberList.java index 9476c1593..60e44af99 100644 --- a/designer-base/src/main/java/com/fr/design/remote/ui/list/MemberList.java +++ b/designer-base/src/main/java/com/fr/design/remote/ui/list/MemberList.java @@ -1,7 +1,7 @@ package com.fr.design.remote.ui.list; -import com.fr.env.RemoteDesignMember; +import com.fr.workspace.server.authority.RemoteDesignMember; import javax.swing.DefaultListModel; import javax.swing.JList; diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java b/designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java index 8908fb982..fab004301 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java @@ -3,7 +3,6 @@ package com.fr.design.mainframe.socketio; import com.fr.decision.webservice.utils.DecisionServiceConstants; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.loghandler.DesignerLogHandler; -import com.fr.env.operator.socket.SocketInfoOperator; import com.fr.general.Inter; import com.fr.general.LogRecordTime; import com.fr.general.LogUtils; @@ -13,6 +12,7 @@ import com.fr.workspace.WorkContext; import com.fr.workspace.Workspace; import com.fr.workspace.base.WorkspaceConstants; import com.fr.workspace.engine.server.rpc.netty.RemoteCallClient; +import com.fr.workspace.server.socket.SocketInfoOperator; import io.socket.client.IO; import io.socket.client.Socket; import io.socket.emitter.Emitter; From f049e31b9e65580a254f009caf19c605039b3afd Mon Sep 17 00:00:00 2001 From: plough Date: Tue, 17 Jul 2018 09:28:00 +0800 Subject: [PATCH 02/33] =?UTF-8?q?REPORT-9734=20=E5=A1=AB=E6=8A=A5=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E8=AE=BE=E7=BD=AEsheet=E6=A0=87=E7=AD=BE=E9=A1=B5?= =?UTF-8?q?=E5=9B=BD=E9=99=85=E5=8C=96=E6=9C=89=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/webattr/WriteToolBarPane.java | 2 +- .../main/java/com/fr/design/webattr/WriteWebSettingPane.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/webattr/WriteToolBarPane.java b/designer-realize/src/main/java/com/fr/design/webattr/WriteToolBarPane.java index f08f6e0cf..32302e81b 100644 --- a/designer-realize/src/main/java/com/fr/design/webattr/WriteToolBarPane.java +++ b/designer-realize/src/main/java/com/fr/design/webattr/WriteToolBarPane.java @@ -41,7 +41,7 @@ public class WriteToolBarPane extends AbstractEditToolBarPane { private DragToolBarPane dragToolbarPane; private UIRadioButton topRadioButton = new UIRadioButton(Inter.getLocText("FR-Designer_Top")); private UIRadioButton bottomRadioButton = new UIRadioButton(Inter.getLocText("FR-Designer_Bottom")); - private UILabel sheetShowLocationLabel = new UILabel("sheet" + Inter.getLocText(new String[]{"Label", "Page_Number", "Display position"}) + ":"); + private UILabel sheetShowLocationLabel = new UILabel(Inter.getLocText("Fine-Designer_Sheet_Label_Page_Display_Position")); private UIRadioButton centerRadioButton = new UIRadioButton(Inter.getLocText("FR-Designer_Center_Display")); private UIRadioButton leftRadioButton = new UIRadioButton(Inter.getLocText("FR-Designer_Left_Display")); private UILabel rptShowLocationLabel = new UILabel(Inter.getLocText("FR-Designer_Report_Show_Location") + ":", UILabel.LEFT); diff --git a/designer-realize/src/main/java/com/fr/design/webattr/WriteWebSettingPane.java b/designer-realize/src/main/java/com/fr/design/webattr/WriteWebSettingPane.java index b23e4c3b2..6a35fd24b 100644 --- a/designer-realize/src/main/java/com/fr/design/webattr/WriteWebSettingPane.java +++ b/designer-realize/src/main/java/com/fr/design/webattr/WriteWebSettingPane.java @@ -56,7 +56,7 @@ public class WriteWebSettingPane extends WebSettingPane { //sheet标签页显示位置 topRadioButton = new UIRadioButton(Inter.getLocText("FR-Designer_Top")); bottomRadioButton = new UIRadioButton(Inter.getLocText("FR-Designer_Bottom")); - sheetShowLocationLabel = new UILabel("sheet" + Inter.getLocText(new String[]{"Label", "Page_Number", "Display position"}) + ":", UILabel.LEFT); + sheetShowLocationLabel = new UILabel(Inter.getLocText("Fine-Designer_Sheet_Label_Page_Display_Position"), UILabel.LEFT); ButtonGroup buttonGroup = new ButtonGroup(); bottomRadioButton.setSelected(true); buttonGroup.add(topRadioButton); From 4ce8e03c83d2664f629bb1802d4b6ad02be45447 Mon Sep 17 00:00:00 2001 From: hzzz Date: Tue, 17 Jul 2018 10:11:25 +0800 Subject: [PATCH 03/33] . --- .../remote/action/RemoteDesignAuthorityManagerAction.java | 1 - .../com/fr/design/remote/ui/AuthorityListControlPane.java | 1 - .../main/java/com/fr/design/remote/ui/UserManagerPane.java | 5 ----- .../com/fr/design/mainframe/socketio/DesignerSocketIO.java | 1 - 4 files changed, 8 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/remote/action/RemoteDesignAuthorityManagerAction.java b/designer-base/src/main/java/com/fr/design/remote/action/RemoteDesignAuthorityManagerAction.java index 373b45acf..c0834af22 100644 --- a/designer-base/src/main/java/com/fr/design/remote/action/RemoteDesignAuthorityManagerAction.java +++ b/designer-base/src/main/java/com/fr/design/remote/action/RemoteDesignAuthorityManagerAction.java @@ -11,7 +11,6 @@ import com.fr.general.Inter; import com.fr.log.FineLoggerFactory; import com.fr.report.DesignAuthority; import com.fr.workspace.WorkContext; -import com.fr.workspace.server.authority.AuthorityOperator; import java.awt.event.ActionEvent; diff --git a/designer-base/src/main/java/com/fr/design/remote/ui/AuthorityListControlPane.java b/designer-base/src/main/java/com/fr/design/remote/ui/AuthorityListControlPane.java index 728e3e587..40bd04022 100644 --- a/designer-base/src/main/java/com/fr/design/remote/ui/AuthorityListControlPane.java +++ b/designer-base/src/main/java/com/fr/design/remote/ui/AuthorityListControlPane.java @@ -18,7 +18,6 @@ import com.fr.design.remote.RemoteDesignAuthorityCreator; import com.fr.design.remote.ui.list.AuthorityList; import com.fr.design.remote.ui.list.AuthorityListCellRenderer; import com.fr.design.utils.gui.GUICoreUtils; -import com.fr.workspace.server.authority.RemoteDesignMember; import com.fr.general.ComparatorUtils; import com.fr.general.Inter; import com.fr.log.FineLoggerFactory; diff --git a/designer-base/src/main/java/com/fr/design/remote/ui/UserManagerPane.java b/designer-base/src/main/java/com/fr/design/remote/ui/UserManagerPane.java index 0d2a9dcc2..97ffdd3b6 100644 --- a/designer-base/src/main/java/com/fr/design/remote/ui/UserManagerPane.java +++ b/designer-base/src/main/java/com/fr/design/remote/ui/UserManagerPane.java @@ -13,11 +13,6 @@ import com.fr.design.remote.ui.list.AddedMemberListCellRender; import com.fr.design.remote.ui.list.AddingMemberList; import com.fr.design.remote.ui.list.AddingMemberListCellRender; import com.fr.design.remote.ui.list.MemberListSelectedChangeListener; -<<<<<<< HEAD -======= -import com.fr.workspace.server.authority.RemoteDesignMember; -import com.fr.workspace.server.authority.decision.DecisionOperator; ->>>>>>> 8346e043d684a530c688bfed0ed064c99655d1f6 import com.fr.general.Inter; import com.fr.stable.StringUtils; import com.fr.third.guava.collect.ImmutableList; diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java b/designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java index 3668817e1..6116e87cf 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java @@ -4,7 +4,6 @@ import com.fr.config.RemoteConfigEvent; import com.fr.decision.webservice.utils.DecisionServiceConstants; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.loghandler.DesignerLogHandler; -import com.fr.workspace.server.socket.SocketInfoOperator; import com.fr.event.EventDispatcher; import com.fr.general.Inter; import com.fr.general.LogRecordTime; From 80acf12674b07b8b54d530225a93610dc3f13fe1 Mon Sep 17 00:00:00 2001 From: "Mata.Li" Date: Tue, 17 Jul 2018 10:42:40 +0800 Subject: [PATCH 04/33] REPORT-97399 --- .../design/dscolumn/SelectedDataColumnPane.java | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/designer-realize/src/main/java/com/fr/design/dscolumn/SelectedDataColumnPane.java b/designer-realize/src/main/java/com/fr/design/dscolumn/SelectedDataColumnPane.java index aec849e41..76ea00a02 100644 --- a/designer-realize/src/main/java/com/fr/design/dscolumn/SelectedDataColumnPane.java +++ b/designer-realize/src/main/java/com/fr/design/dscolumn/SelectedDataColumnPane.java @@ -88,6 +88,10 @@ public class SelectedDataColumnPane extends BasicPane { private static final Pattern COLUMN_NAME_PATTERN = Pattern.compile("[^\\d]"); + //数据集和数据列上次的名称 + private String oldDsName; + private String oldColumnName; + /** * 数据集下拉框变动后修改数据列下拉框加载状态的监听器 */ @@ -232,10 +236,19 @@ public class SelectedDataColumnPane extends BasicPane { DSColumn dsColumn = (DSColumn) value; String dsName = dsColumn.getDSName(); tableNameComboBox.setSelectedTableDataByName(dsName); - columnNameComboBox.setSelectedItem(TableDataColumn.getColumnName(dsColumn.getColumn())); + //数据列名称 + String dsColumnName = TableDataColumn.getColumnName(dsColumn.getColumn()); + columnNameComboBox.setSelectedItem(dsColumnName); ps = dsColumn.getParameters(); addListener(); + //比较上一次的数据集名称和数据列,不一样的话需要加载 + if(!StringUtils.equals(dsName,oldDsName) || !StringUtils.equals(dsColumnName,oldColumnName)){ + columnNameComboBox.setLoaded(false); + + oldDsName = dsName; + oldColumnName = dsColumnName; + } } /** From e508415a4cfebd0eedb2910168315d78c83b3ec1 Mon Sep 17 00:00:00 2001 From: "Mata.Li" Date: Tue, 17 Jul 2018 11:45:48 +0800 Subject: [PATCH 05/33] REPORT-97399 --- .../com/fr/design/gui/icombobox/LazyComboBox.java | 14 ++++++++++++++ .../design/dscolumn/SelectedDataColumnPane.java | 15 +++++---------- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/icombobox/LazyComboBox.java b/designer-base/src/main/java/com/fr/design/gui/icombobox/LazyComboBox.java index 575ab630b..9ac46a429 100644 --- a/designer-base/src/main/java/com/fr/design/gui/icombobox/LazyComboBox.java +++ b/designer-base/src/main/java/com/fr/design/gui/icombobox/LazyComboBox.java @@ -5,6 +5,7 @@ package com.fr.design.gui.icombobox; import com.fr.log.FineLoggerFactory; import com.fr.general.Inter; +import com.fr.stable.StringUtils; import javax.swing.DefaultComboBoxModel; import javax.swing.SwingWorker; @@ -35,6 +36,10 @@ public abstract class LazyComboBox extends UIComboBox implements PopupMenuListen */ private Object initialSelected = null; + //数据集和模板的名称 + private String oldDsName; + private String oldTemplateName; + protected LazyComboBox() { super(); @@ -53,6 +58,15 @@ public abstract class LazyComboBox extends UIComboBox implements PopupMenuListen */ public abstract Object[] load(); + public void changeLoaded(String dsName, String templateName){ + if (!StringUtils.equals(dsName, oldDsName) || !StringUtils.equals(templateName, oldTemplateName)){ + this.setLoaded(false); + + oldDsName = dsName; + oldTemplateName = templateName; + } + } + @Override public void setSelectedItem(Object anObject) { initialSelected = anObject; diff --git a/designer-realize/src/main/java/com/fr/design/dscolumn/SelectedDataColumnPane.java b/designer-realize/src/main/java/com/fr/design/dscolumn/SelectedDataColumnPane.java index 76ea00a02..181c5fb7f 100644 --- a/designer-realize/src/main/java/com/fr/design/dscolumn/SelectedDataColumnPane.java +++ b/designer-realize/src/main/java/com/fr/design/dscolumn/SelectedDataColumnPane.java @@ -9,6 +9,7 @@ import com.fr.design.data.tabledata.wrapper.TableDataWrapper; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.DialogActionAdapter; +import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.icombobox.LazyComboBox; import com.fr.design.gui.ilable.UILabel; @@ -88,9 +89,6 @@ public class SelectedDataColumnPane extends BasicPane { private static final Pattern COLUMN_NAME_PATTERN = Pattern.compile("[^\\d]"); - //数据集和数据列上次的名称 - private String oldDsName; - private String oldColumnName; /** * 数据集下拉框变动后修改数据列下拉框加载状态的监听器 @@ -240,15 +238,12 @@ public class SelectedDataColumnPane extends BasicPane { String dsColumnName = TableDataColumn.getColumnName(dsColumn.getColumn()); columnNameComboBox.setSelectedItem(dsColumnName); ps = dsColumn.getParameters(); + //模板名称 + String templateName = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getEditingFILE().getName(); addListener(); - //比较上一次的数据集名称和数据列,不一样的话需要加载 - if(!StringUtils.equals(dsName,oldDsName) || !StringUtils.equals(dsColumnName,oldColumnName)){ - columnNameComboBox.setLoaded(false); - - oldDsName = dsName; - oldColumnName = dsColumnName; - } + //比较上一次的数据集名称和模板名称,不一样的话需要加载 + columnNameComboBox.changeLoaded(dsName, templateName); } /** From 37f3c96c58d9c34d58b805e50ee2358fde75fb72 Mon Sep 17 00:00:00 2001 From: "Mata.Li" Date: Tue, 17 Jul 2018 12:43:40 +0800 Subject: [PATCH 06/33] REPORT-97399 --- .../com/fr/design/gui/icombobox/LazyComboBox.java | 13 ------------- .../fr/design/dscolumn/SelectedDataColumnPane.java | 6 ++---- 2 files changed, 2 insertions(+), 17 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/icombobox/LazyComboBox.java b/designer-base/src/main/java/com/fr/design/gui/icombobox/LazyComboBox.java index 9ac46a429..095d3f302 100644 --- a/designer-base/src/main/java/com/fr/design/gui/icombobox/LazyComboBox.java +++ b/designer-base/src/main/java/com/fr/design/gui/icombobox/LazyComboBox.java @@ -36,10 +36,6 @@ public abstract class LazyComboBox extends UIComboBox implements PopupMenuListen */ private Object initialSelected = null; - //数据集和模板的名称 - private String oldDsName; - private String oldTemplateName; - protected LazyComboBox() { super(); @@ -58,15 +54,6 @@ public abstract class LazyComboBox extends UIComboBox implements PopupMenuListen */ public abstract Object[] load(); - public void changeLoaded(String dsName, String templateName){ - if (!StringUtils.equals(dsName, oldDsName) || !StringUtils.equals(templateName, oldTemplateName)){ - this.setLoaded(false); - - oldDsName = dsName; - oldTemplateName = templateName; - } - } - @Override public void setSelectedItem(Object anObject) { initialSelected = anObject; diff --git a/designer-realize/src/main/java/com/fr/design/dscolumn/SelectedDataColumnPane.java b/designer-realize/src/main/java/com/fr/design/dscolumn/SelectedDataColumnPane.java index 181c5fb7f..54aa686b0 100644 --- a/designer-realize/src/main/java/com/fr/design/dscolumn/SelectedDataColumnPane.java +++ b/designer-realize/src/main/java/com/fr/design/dscolumn/SelectedDataColumnPane.java @@ -238,12 +238,10 @@ public class SelectedDataColumnPane extends BasicPane { String dsColumnName = TableDataColumn.getColumnName(dsColumn.getColumn()); columnNameComboBox.setSelectedItem(dsColumnName); ps = dsColumn.getParameters(); - //模板名称 - String templateName = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getEditingFILE().getName(); addListener(); - //比较上一次的数据集名称和模板名称,不一样的话需要加载 - columnNameComboBox.changeLoaded(dsName, templateName); + //重新设置需要加载 + columnNameComboBox.setLoaded(false); } /** From c252a560ad3e406c3fe2502bb439363cc21e21f4 Mon Sep 17 00:00:00 2001 From: "Mata.Li" Date: Tue, 17 Jul 2018 12:45:13 +0800 Subject: [PATCH 07/33] REPORT-97399 --- .../main/java/com/fr/design/gui/icombobox/LazyComboBox.java | 1 - .../java/com/fr/design/dscolumn/SelectedDataColumnPane.java | 5 +---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/icombobox/LazyComboBox.java b/designer-base/src/main/java/com/fr/design/gui/icombobox/LazyComboBox.java index 095d3f302..575ab630b 100644 --- a/designer-base/src/main/java/com/fr/design/gui/icombobox/LazyComboBox.java +++ b/designer-base/src/main/java/com/fr/design/gui/icombobox/LazyComboBox.java @@ -5,7 +5,6 @@ package com.fr.design.gui.icombobox; import com.fr.log.FineLoggerFactory; import com.fr.general.Inter; -import com.fr.stable.StringUtils; import javax.swing.DefaultComboBoxModel; import javax.swing.SwingWorker; diff --git a/designer-realize/src/main/java/com/fr/design/dscolumn/SelectedDataColumnPane.java b/designer-realize/src/main/java/com/fr/design/dscolumn/SelectedDataColumnPane.java index 54aa686b0..fbe7d228a 100644 --- a/designer-realize/src/main/java/com/fr/design/dscolumn/SelectedDataColumnPane.java +++ b/designer-realize/src/main/java/com/fr/design/dscolumn/SelectedDataColumnPane.java @@ -9,7 +9,6 @@ import com.fr.design.data.tabledata.wrapper.TableDataWrapper; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.DialogActionAdapter; -import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.icombobox.LazyComboBox; import com.fr.design.gui.ilable.UILabel; @@ -234,9 +233,7 @@ public class SelectedDataColumnPane extends BasicPane { DSColumn dsColumn = (DSColumn) value; String dsName = dsColumn.getDSName(); tableNameComboBox.setSelectedTableDataByName(dsName); - //数据列名称 - String dsColumnName = TableDataColumn.getColumnName(dsColumn.getColumn()); - columnNameComboBox.setSelectedItem(dsColumnName); + columnNameComboBox.setSelectedItem(TableDataColumn.getColumnName(dsColumn.getColumn())); ps = dsColumn.getParameters(); addListener(); From cc5a71a31a3b3bcd71c8734d56f61a2266ee5d2b Mon Sep 17 00:00:00 2001 From: plough Date: Tue, 17 Jul 2018 14:55:31 +0800 Subject: [PATCH 08/33] =?UTF-8?q?REPORT-9757=20=E3=80=90=E9=98=BB=E5=A1=9E?= =?UTF-8?q?=E3=80=91=E7=A3=81=E7=9B=98=E6=96=87=E4=BB=B6=E9=80=89=E6=8B=A9?= =?UTF-8?q?=E6=A1=86=E7=9A=84=E8=B7=AF=E5=BE=84=E5=B0=91=E4=BA=86=E4=B8=80?= =?UTF-8?q?=E4=B8=AA=E5=AD=97=E6=AF=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/webattr/WebCssPane.java | 2 +- .../src/main/java/com/fr/design/webattr/WebJsPane.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/webattr/WebCssPane.java b/designer-realize/src/main/java/com/fr/design/webattr/WebCssPane.java index cb9909e2e..b4600b753 100644 --- a/designer-realize/src/main/java/com/fr/design/webattr/WebCssPane.java +++ b/designer-realize/src/main/java/com/fr/design/webattr/WebCssPane.java @@ -85,7 +85,7 @@ public class WebCssPane extends BasicPane { if (!"css".equalsIgnoreCase(fileType)) { return; } - localText.setText(file.getPath().substring(1)); + localText.setText(file.getPath().replaceFirst("^/*", "")); // 去掉开头的"/"(如果有的话) centerPane.setAddEnabled(true); } diff --git a/designer-realize/src/main/java/com/fr/design/webattr/WebJsPane.java b/designer-realize/src/main/java/com/fr/design/webattr/WebJsPane.java index ac2217c02..0c92927f6 100644 --- a/designer-realize/src/main/java/com/fr/design/webattr/WebJsPane.java +++ b/designer-realize/src/main/java/com/fr/design/webattr/WebJsPane.java @@ -173,7 +173,7 @@ public class WebJsPane extends BasicPane { if (!"js".equalsIgnoreCase(fileType)) { return; } - localText.setText(file.getPath().substring(1)); + localText.setText(file.getPath().replaceFirst("^/*", "")); // 去掉相对路径开头的"/"(如果有的话) editingPane.setAddEnabled(true); } From dcbd491207618e230123adb6f58c2b946327a69b Mon Sep 17 00:00:00 2001 From: plough Date: Tue, 17 Jul 2018 15:15:31 +0800 Subject: [PATCH 09/33] =?UTF-8?q?REPORT-9757=20=E3=80=90=E9=98=BB=E5=A1=9E?= =?UTF-8?q?=E3=80=91=E7=A3=81=E7=9B=98=E6=96=87=E4=BB=B6=E9=80=89=E6=8B=A9?= =?UTF-8?q?=E6=A1=86=E7=9A=84=E8=B7=AF=E5=BE=84=E5=B0=91=E4=BA=86=E4=B8=80?= =?UTF-8?q?=E4=B8=AA=E5=AD=97=E6=AF=8D=3D>=E8=B0=83=E6=95=B4=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/webattr/WebCssPane.java | 2 +- .../src/main/java/com/fr/design/webattr/WebJsPane.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/webattr/WebCssPane.java b/designer-realize/src/main/java/com/fr/design/webattr/WebCssPane.java index b4600b753..ff90867cb 100644 --- a/designer-realize/src/main/java/com/fr/design/webattr/WebCssPane.java +++ b/designer-realize/src/main/java/com/fr/design/webattr/WebCssPane.java @@ -85,7 +85,7 @@ public class WebCssPane extends BasicPane { if (!"css".equalsIgnoreCase(fileType)) { return; } - localText.setText(file.getPath().replaceFirst("^/*", "")); // 去掉开头的"/"(如果有的话) + localText.setText(file.getPath()); centerPane.setAddEnabled(true); } diff --git a/designer-realize/src/main/java/com/fr/design/webattr/WebJsPane.java b/designer-realize/src/main/java/com/fr/design/webattr/WebJsPane.java index 0c92927f6..7b7d00667 100644 --- a/designer-realize/src/main/java/com/fr/design/webattr/WebJsPane.java +++ b/designer-realize/src/main/java/com/fr/design/webattr/WebJsPane.java @@ -173,7 +173,7 @@ public class WebJsPane extends BasicPane { if (!"js".equalsIgnoreCase(fileType)) { return; } - localText.setText(file.getPath().replaceFirst("^/*", "")); // 去掉相对路径开头的"/"(如果有的话) + localText.setText(file.getPath()); editingPane.setAddEnabled(true); } From e15f0e1bd0f01101e10aa18befafcd75518d40e7 Mon Sep 17 00:00:00 2001 From: ju Date: Tue, 17 Jul 2018 19:28:42 +0800 Subject: [PATCH 10/33] =?UTF-8?q?DEC-3146=20=E6=96=B0=E5=B9=B3=E5=8F=B0?= =?UTF-8?q?=E6=B5=8F=E8=A7=88=E5=99=A8=E8=AE=BE=E7=BD=AE=E6=88=90=E8=8B=B1?= =?UTF-8?q?=E6=96=87=E7=9A=84=E5=90=8E=E5=8F=B0=E4=BC=9A=E6=8A=A5NPE=201?= =?UTF-8?q?=E3=80=81=E6=95=B4=E7=90=86=E6=89=80=E6=9C=89=E5=9B=BD=E9=99=85?= =?UTF-8?q?=E5=8C=96=E5=8A=A0=E8=BD=BD=E7=9B=B8=E5=85=B3=E7=9A=84=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=EF=BC=8C=E7=BB=9F=E4=B8=80=E5=88=B0core=E4=B8=AD?= =?UTF-8?q?=E5=8E=BB=E5=8A=A0=E8=BD=BD=202=E3=80=81=E6=87=92=E5=8A=A0?= =?UTF-8?q?=E8=BD=BD=EF=BC=9ALocale=E6=87=92=E5=8A=A0=E8=BD=BD=EF=BC=8C?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E6=87=92=E5=8A=A0=E8=BD=BD=203=E3=80=81?= =?UTF-8?q?=E5=90=8E=E6=B7=BB=E5=8A=A0=E7=9A=84=E6=96=87=E4=BB=B6=E8=A6=86?= =?UTF-8?q?=E7=9B=96=E5=85=88=E5=8A=A0=E8=BD=BD=E7=9A=84=EF=BC=88=E5=8D=B3?= =?UTF-8?q?=E9=BB=98=E8=AE=A4=E6=8F=92=E4=BB=B6=E7=9A=84=E5=9B=BD=E9=99=85?= =?UTF-8?q?=E5=8C=96=E5=8F=AF=E4=BB=A5=E8=A6=86=E7=9B=96=E5=8E=9F=E5=A7=8B?= =?UTF-8?q?=E7=9A=84=E5=9B=BD=E9=99=85=E5=8C=96=EF=BC=89=204=E3=80=81?= =?UTF-8?q?=E6=94=AF=E6=8C=81remove=E6=93=8D=E4=BD=9C=EF=BC=8C=E7=A6=81?= =?UTF-8?q?=E7=94=A8=E6=8E=89=E6=8F=92=E4=BB=B6=E5=90=8E=E5=9B=BD=E9=99=85?= =?UTF-8?q?=E5=8C=96=E8=87=AA=E5=8A=A8=E6=B8=85=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/actions/file/LocalePane.java | 61 +++++-------------- 1 file changed, 15 insertions(+), 46 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/actions/file/LocalePane.java b/designer-base/src/main/java/com/fr/design/actions/file/LocalePane.java index 8d9715222..76258d8f1 100644 --- a/designer-base/src/main/java/com/fr/design/actions/file/LocalePane.java +++ b/designer-base/src/main/java/com/fr/design/actions/file/LocalePane.java @@ -12,10 +12,10 @@ import com.fr.design.gui.itextfield.UITextField; import com.fr.file.filetree.FileNode; import com.fr.general.GeneralUtils; import com.fr.general.Inter; +import com.fr.locale.InterProviderFactory; import com.fr.log.FineLoggerFactory; import com.fr.stable.ArrayUtils; import com.fr.stable.StableUtils; -import com.fr.stable.bridge.StableFactory; import com.fr.stable.project.ProjectConstants; import com.fr.workspace.WorkContext; import com.fr.workspace.resource.WorkResourceOutputStream; @@ -37,7 +37,6 @@ import java.util.List; import java.util.Locale; import java.util.Map; import java.util.Properties; -import java.util.ResourceBundle; import java.util.Set; import java.util.Vector; @@ -121,43 +120,26 @@ public class LocalePane extends BasicPane { } private void initPredefinedProperties() { - - Map supportLocaleMap = Inter.getSupportLocaleMap(); - - String[] localeFiles = StableFactory.getLocaleFiles(); - - - + + Map supportLocaleMap = InterProviderFactory.getProvider().getSupportLocaleMap(); + + Map map; List sortKeys = new ArrayList(); - - - for (String path : localeFiles) { - ResourceBundle chineseBundle = loadResourceBundle(path, Locale.SIMPLIFIED_CHINESE); - sortKeys.addAll(chineseBundle.keySet()); - } + + + map = InterProviderFactory.getProvider().getLocalBundle(Locale.SIMPLIFIED_CHINESE).getMap(); + sortKeys.addAll(map.keySet()); Collections.sort(sortKeys); - - Map> localeResourceBundleMap = new HashMap>(); - for (Map.Entry entry : supportLocaleMap.entrySet()) { - Locale locale = entry.getKey(); - List list = new ArrayList<>(); - for (String path : localeFiles) { - ResourceBundle chineseBundle = loadResourceBundle(path, locale); - list.add(chineseBundle); - } - localeResourceBundleMap.put(locale, list); - } - + Map> data = new HashMap>(); - for (Map.Entry> entry : localeResourceBundleMap.entrySet()) { + for (Locale locale : supportLocaleMap.keySet()) { Vector column = new Vector(); - List rbs = entry.getValue(); for (String key : sortKeys) { - column.add(readText(rbs, key)); + column.add(InterProviderFactory.getProvider().getLocText(key)); } - data.put(entry.getKey(), column); + data.put(locale, column); + } - Vector keyVector = new Vector(); keyVector.addAll(sortKeys); @@ -167,20 +149,7 @@ public class LocalePane extends BasicPane { predefineTableModel.addColumn(entry.getKey().getDisplayName(), entry.getValue()); } } - - private String readText(List rbs, String key) { - for (ResourceBundle rb : rbs) { - if (rb.containsKey(key)) { - return rb.getString(key); - } - } - return null; - } - - private ResourceBundle loadResourceBundle(String dir, Locale locale) { - return ResourceBundle.getBundle(dir, locale, Inter.class.getClassLoader()); - } - + private void initCustomProperties() throws Exception { FileNode[] fileNodes = FRContext.getFileNodes().list(ProjectConstants.LOCALE_NAME); From 3724be47b6be2d64062c1257db0607fbd371d917 Mon Sep 17 00:00:00 2001 From: richie Date: Tue, 17 Jul 2018 21:56:48 +0800 Subject: [PATCH 11/33] =?UTF-8?q?CORE-113=20Session=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E4=B8=AD=E5=BF=83=E6=94=B9=E8=BF=9B+=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E4=BE=B5=E5=85=A5=E6=80=A7=E5=BC=BA=E7=9A=84=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=EF=BC=8C=E5=BE=85=E9=87=8D=E6=9E=84=EF=BC=8C?= =?UTF-8?q?=E4=B8=8D=E5=BD=B1=E5=93=8D=E5=9F=BA=E6=9C=AC=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/file/FileFILE.java | 24 +++++++++---------- .../errorinfo/ErrorInfoLogAppender.java | 12 +++++----- 2 files changed, 17 insertions(+), 19 deletions(-) diff --git a/designer-base/src/main/java/com/fr/file/FileFILE.java b/designer-base/src/main/java/com/fr/file/FileFILE.java index 4655ae1f3..decf027f0 100644 --- a/designer-base/src/main/java/com/fr/file/FileFILE.java +++ b/designer-base/src/main/java/com/fr/file/FileFILE.java @@ -1,23 +1,22 @@ package com.fr.file; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.util.ArrayList; - -import javax.swing.Icon; -import javax.swing.filechooser.FileSystemView; - import com.fr.base.io.XMLEncryptUtils; import com.fr.design.gui.itree.filetree.FileComparator; import com.fr.design.gui.itree.filetree.FileTreeIcon; import com.fr.general.ComparatorUtils; -import com.fr.general.FRLogManager; +import com.fr.general.SessionLocalManager; import com.fr.stable.StableUtils; import com.fr.stable.project.ProjectConstants; +import javax.swing.*; +import javax.swing.filechooser.FileSystemView; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.util.ArrayList; + public class FileFILE implements FILE { private File file; @@ -199,12 +198,11 @@ public class FileFILE implements FILE { if (file == null || !file.exists()) { return null; } - FRLogManager.declareResourceWriteStart(file.getAbsolutePath()); java.io.OutputStream out = null; try { out = new FileOutputStream(file); } catch (Exception e) { - throw FRLogManager.createLogPackedException(e); + throw SessionLocalManager.createLogPackedException(e); } return out; } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/errorinfo/ErrorInfoLogAppender.java b/designer-realize/src/main/java/com/fr/design/mainframe/errorinfo/ErrorInfoLogAppender.java index 74b36372b..46efc1581 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/errorinfo/ErrorInfoLogAppender.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/errorinfo/ErrorInfoLogAppender.java @@ -4,19 +4,19 @@ import com.fr.base.io.IOFile; import com.fr.base.io.XMLReadHelper; import com.fr.config.MarketConfig; import com.fr.design.DesignerEnvManager; -import com.fr.general.FRLogManager; +import com.fr.general.SessionLocalManager; import com.fr.general.Inter; -import com.fr.general.LogDuration; import com.fr.stable.StableUtils; import com.fr.stable.StringUtils; import com.fr.stable.project.ProjectConstants; +import com.fr.stable.web.SessionProvider; import com.fr.stable.xml.XMLPrintWriter; import com.fr.stable.xml.XMLableReader; import com.fr.third.apache.log4j.AppenderSkeleton; import com.fr.third.apache.log4j.Level; import com.fr.third.apache.log4j.spi.LoggingEvent; -import com.fr.web.core.SessionDealWith; -import com.fr.web.core.SessionIDInfor; +import com.fr.web.core.SessionPoolManager; +import com.fr.web.core.TemplateSessionIDInfo; import com.fr.workspace.WorkContext; import java.io.ByteArrayInputStream; @@ -96,13 +96,13 @@ public class ErrorInfoLogAppender extends AppenderSkeleton { } private String readTemplateID() { - LogDuration logDuration = FRLogManager.getSession(); + SessionProvider logDuration = SessionLocalManager.getSession(); if (logDuration == null) { return StringUtils.EMPTY; } String sessionID = logDuration.getSessionID(); - SessionIDInfor infor = SessionDealWith.getSessionIDInfor(sessionID); + TemplateSessionIDInfo infor = SessionPoolManager.getSessionIDInfor(sessionID, TemplateSessionIDInfo.class); if (infor == null) { return StringUtils.EMPTY; } From f82eb21d59c4124b37bfb5c697ea8f991438648a Mon Sep 17 00:00:00 2001 From: zheng Date: Wed, 18 Jul 2018 10:15:54 +0800 Subject: [PATCH 12/33] =?UTF-8?q?CHART-2521=20=E5=9B=BE=E8=A1=A8=E9=85=8D?= =?UTF-8?q?=E8=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chart/gui/style/ChartFillStylePane.java | 9 +- .../gui/style/ChartPreFillStylePane.java | 187 ++++++++++++------ .../chart/gui/type/AbstractChartTypePane.java | 5 +- .../fr/design/module/ChartPreStyleAction.java | 4 - .../module/ChartPreStyleManagerPane.java | 31 ++- .../fr/design/module/ChartPreStylePane.java | 28 +-- 6 files changed, 174 insertions(+), 90 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartFillStylePane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartFillStylePane.java index f3a9b8a86..7ddd89d52 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartFillStylePane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartFillStylePane.java @@ -1,10 +1,11 @@ package com.fr.design.mainframe.chart.gui.style; +import com.fr.base.ChartColorMatching; import com.fr.base.ChartPreStyleConfig; import com.fr.base.Utils; import com.fr.chart.base.AttrFillStyle; import com.fr.chart.base.ChartConstants; -import com.fr.chart.base.ChartPreStyle; +import com.fr.chart.base.ChartUtils; import com.fr.design.beans.BasicBeanPane; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.icombobox.UIComboBox; @@ -199,9 +200,9 @@ public class ChartFillStylePane extends BasicBeanPane{ } else if(styleSelectBox.getSelectedIndex() < styleSelectBox.getItemCount() - 1){ ChartPreStyleConfig manager = ChartPreStyleConfig.getInstance(); Object preStyle = manager.getPreStyle(styleSelectBox.getSelectedItem()); - if(preStyle instanceof ChartPreStyle) { - AttrFillStyle def = ((ChartPreStyle) preStyle).getAttrFillStyle(); - def.setFillStyleName(Utils.objectToString(styleSelectBox.getSelectedItem())); + if (preStyle instanceof ChartColorMatching) { + AttrFillStyle def = ChartUtils.chartColorMatching2AttrFillStyle((ChartColorMatching) preStyle); + def.setFillStyleName(Utils.objectToString(styleSelectBox.getSelectedItem())); return def; }else{ condition.setColorStyle(ChartConstants.COLOR_DEFAULT); diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartPreFillStylePane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartPreFillStylePane.java index 3e7fc1be0..3d29a56da 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartPreFillStylePane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartPreFillStylePane.java @@ -1,97 +1,170 @@ package com.fr.design.mainframe.chart.gui.style; -import java.awt.*; - -import com.fr.chart.base.AttrFillStyle; +import com.fr.base.ChartColorMatching; import com.fr.chart.base.ChartConstants; +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ilable.UILabel; +import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.style.background.gradient.FixedGradientBar; import com.fr.general.Inter; +import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.CardLayout; +import java.awt.Color; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + + /** - * 预定义的图表配色界面, 其中和属性表中ChartFillStylePane 主要的不同就是标签的位置. + * 预定义的图表配色界面. * @author kunsnat E-mail:kunsnat@gmail.com * @version 创建时间:2013-8-21 下午03:16:27 */ -public class ChartPreFillStylePane extends ChartFillStylePane { - - public ChartPreFillStylePane() { - - } - - protected void initLayout() {// 仅仅是服务器预定 风格界面布局, 和属性表 有所不同. - customPane.setPreferredSize(new Dimension(200, 200)); - colorGradient.setPreferredSize(new Dimension(120, 30)); - - double p = TableLayout.PREFERRED; - double[] columnSize = {p, p }; - double[] rowSize = { p, p, p}; +public class ChartPreFillStylePane extends BasicBeanPane { + + private JPanel changeColorSetPane; + private CardLayout cardLayout; + + private UIButton accButton; + private UIButton gradientButton; + + private ChartAccColorPane colorAcc; + private FixedGradientBar colorGradient; + + private ChartColorMatching chartColorMatching; + + public ChartPreFillStylePane() { + + initComponents(); + + initListener(); + } + + private void initComponents() { + + JPanel customPane = new JPanel(FRGUIPaneFactory.createBorderLayout()); + + JPanel buttonPane = new JPanel(); + buttonPane.setLayout(new FlowLayout(FlowLayout.LEFT)); + buttonPane.add(accButton = new UIButton(Inter.getLocText("FR-Designer_Chart_Acc_Set"))); + buttonPane.add(gradientButton = new UIButton(Inter.getLocText("FR-Designer_Gradient-Color"))); + customPane.add(buttonPane, BorderLayout.NORTH); + + changeColorSetPane = new JPanel(cardLayout = new CardLayout()); + changeColorSetPane.add(colorGradient = new FixedGradientBar(4, 130), "gradient"); + changeColorSetPane.add(colorAcc = new ChartAccColorPane(), "acc"); + cardLayout.show(changeColorSetPane, "acc"); + customPane.add(changeColorSetPane, BorderLayout.CENTER); + + accButton.setSelected(true); + + customPane.setPreferredSize(new Dimension(200, 200)); + colorGradient.setPreferredSize(new Dimension(120, 30)); + + double p = TableLayout.PREFERRED; + double[] columnSize = {p, p}; + double[] rowSize = {p, p, p}; Component[][] components = new Component[][]{ new Component[]{new UILabel(" " + Inter.getLocText("ColorMatch")), null}, new Component[]{null, customPane}, }; - - this.add(TableLayoutHelper.createTableLayoutPane(components,rowSize,columnSize), BorderLayout.WEST); - } - public void populateBean(AttrFillStyle condition) { - styleSelectBox.setSelectedIndex(styleSelectBox.getItemCount()-1); + this.setLayout(new BorderLayout()); + this.add(TableLayoutHelper.createTableLayoutPane(components,rowSize,columnSize), BorderLayout.WEST); + } - if(condition == null || condition.getColorStyle() == ChartConstants.COLOR_DEFAULT) { - colorAcc.populateBean(ChartConstants.CHART_COLOR_ARRAY);// 新建时 保持默认样式 - accButton.setSelected(true); - gradientButton.setSelected(false); - cardLayout.show(changeColorSetPane, "acc"); + private void initListener() { - colorGradient.getSelectColorPointBtnP1().setColorInner(Color.WHITE); - colorGradient.getSelectColorPointBtnP2().setColorInner(Color.black);// 控件中的位置无效. - } else { - int colorStyle = condition.getColorStyle(); - gradientButton.setSelected(colorStyle == ChartConstants.COLOR_GRADIENT); - accButton.setSelected(colorStyle == ChartConstants.COLOR_ACC); + accButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + accButton.setSelected(true); + gradientButton.setSelected(false); + cardLayout.show(changeColorSetPane, "acc"); + } + }); - int colorSize = condition.getColorSize(); - if(colorSize == 2 && gradientButton.isSelected() ) { + gradientButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + gradientButton.setSelected(true); + accButton.setSelected(false); cardLayout.show(changeColorSetPane, "gradient"); + } + }); + } + + @Override + protected String title4PopupWindow() { + return Inter.getLocText("ServerM-Predefined_Styles"); + } + + public void populateBean(ChartColorMatching condition) { + chartColorMatching = condition; + + colorGradient.getSelectColorPointBtnP1().setColorInner(Color.WHITE); + colorGradient.getSelectColorPointBtnP2().setColorInner(Color.black); + colorAcc.populateBean(ChartConstants.CHART_COLOR_ARRAY); + + if (condition == null) { + return; + } - Color endColor = condition.getColorIndex(1); - Color startColor = condition.getColorIndex(0); - colorGradient.getSelectColorPointBtnP1().setColorInner(startColor); - colorGradient.getSelectColorPointBtnP2().setColorInner(endColor); + boolean isGradient = condition.getGradient(); + List colorList = condition.getColorList(); + if (isGradient) { + gradientButton.setSelected(true); + accButton.setSelected(false); + cardLayout.show(changeColorSetPane, "gradient"); + + if (colorList.size() == 2) { + colorGradient.getSelectColorPointBtnP1().setColorInner(colorList.get(0)); + colorGradient.getSelectColorPointBtnP2().setColorInner(colorList.get(1)); colorGradient.repaint(); - } else if(colorSize > 2 && accButton.isSelected()){ - cardLayout.show(changeColorSetPane, "acc"); + } + } else { + accButton.setSelected(true); + gradientButton.setSelected(false); + cardLayout.show(changeColorSetPane, "acc"); - Color[] colors = new Color[colorSize]; - for(int i = 0; i < colorSize; i++) { - colors[i] = condition.getColorIndex(i); - } - colorAcc.populateBean(colors); + if (colorList.size() > 0) { + colorAcc.populateBean(colorList.toArray(new Color[colorList.size()])); } } } @Override - public AttrFillStyle updateBean() { - AttrFillStyle condition = new AttrFillStyle(); - condition.clearColors(); + public ChartColorMatching updateBean() { + chartColorMatching = chartColorMatching == null ? new ChartColorMatching() : chartColorMatching; + + List colorList = new ArrayList(); if(gradientButton.isSelected()) { - condition.setColorStyle(ChartConstants.COLOR_GRADIENT); + chartColorMatching.setGradient(true); + Color start = colorGradient.getSelectColorPointBtnP1().getColorInner(); Color end = colorGradient.getSelectColorPointBtnP2().getColorInner(); - condition.addFillColor(start); - condition.addFillColor(end); + colorList.add(start); + colorList.add(end); } else { - condition.setColorStyle(ChartConstants.COLOR_ACC); + chartColorMatching.setGradient(false); Color[] colors = colorAcc.updateBean(); - for(int i = 0, length = colors.length; i < length; i++) { - condition.addFillColor(colors[i]); - } + colorList = Arrays.asList(colors); } - return condition; + chartColorMatching.setColorList(colorList); + + return chartColorMatching; } } \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/AbstractChartTypePane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/AbstractChartTypePane.java index 590190762..57a9dd143 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/AbstractChartTypePane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/AbstractChartTypePane.java @@ -1,12 +1,13 @@ package com.fr.design.mainframe.chart.gui.type; +import com.fr.base.ChartColorMatching; import com.fr.base.ChartPreStyleConfig; import com.fr.base.FRContext; import com.fr.base.background.ColorBackground; import com.fr.chart.base.AttrContents; import com.fr.chart.base.AttrFillStyle; import com.fr.chart.base.ChartConstants; -import com.fr.chart.base.ChartPreStyle; +import com.fr.chart.base.ChartUtils; import com.fr.chart.base.DataSeriesCondition; import com.fr.chart.base.TextAttr; import com.fr.chart.chartattr.Axis; @@ -243,7 +244,7 @@ public abstract class AbstractChartTypePane extends FurtherBasicBeanPane{ if(preStyle == null){ plot.getPlotFillStyle().setColorStyle(ChartConstants.COLOR_DEFAULT); }else{ - AttrFillStyle fillStyle = ((ChartPreStyle)preStyle).getAttrFillStyle(); + AttrFillStyle fillStyle = ChartUtils.chartColorMatching2AttrFillStyle((ChartColorMatching) preStyle); fillStyle.setFillStyleName(name); plot.setPlotFillStyle(fillStyle); } diff --git a/designer-chart/src/main/java/com/fr/design/module/ChartPreStyleAction.java b/designer-chart/src/main/java/com/fr/design/module/ChartPreStyleAction.java index 70571338f..f964c4534 100644 --- a/designer-chart/src/main/java/com/fr/design/module/ChartPreStyleAction.java +++ b/designer-chart/src/main/java/com/fr/design/module/ChartPreStyleAction.java @@ -39,14 +39,10 @@ public class ChartPreStyleAction extends UpdateAction { @Override public void doOk() { pane.updateBean(); -// ChartPreStyleManagerProvider manager = ChartPreStyleServerManager.getProviderInstance(); -// manager.setStyleEditing(null); } @Override public void doCancel() { -// ChartPreStyleManagerProvider manager = ChartPreStyleServerManager.getProviderInstance(); -// manager.setStyleEditing(null); } }); diff --git a/designer-chart/src/main/java/com/fr/design/module/ChartPreStyleManagerPane.java b/designer-chart/src/main/java/com/fr/design/module/ChartPreStyleManagerPane.java index c25782c4e..573420983 100644 --- a/designer-chart/src/main/java/com/fr/design/module/ChartPreStyleManagerPane.java +++ b/designer-chart/src/main/java/com/fr/design/module/ChartPreStyleManagerPane.java @@ -1,8 +1,8 @@ package com.fr.design.module; +import com.fr.base.ChartColorMatching; import com.fr.base.ChartPreStyleConfig; import com.fr.base.Utils; -import com.fr.chart.base.ChartPreStyle; import com.fr.design.gui.controlpane.JListControlPane; import com.fr.design.gui.controlpane.NameObjectCreator; import com.fr.design.gui.controlpane.NameableCreator; @@ -10,11 +10,11 @@ import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerFrame; import com.fr.general.Inter; import com.fr.general.NameObject; -import com.fr.stable.ListMap; import com.fr.stable.Nameable; import java.util.ArrayList; import java.util.Iterator; +import java.util.LinkedHashMap; /** @@ -32,10 +32,18 @@ public class ChartPreStyleManagerPane extends JListControlPane { public NameableCreator[] createNameableCreators() { return new NameableCreator[]{ new NameObjectCreator(Inter.getLocText("FR-Designer_PreStyle"), - ChartPreStyle.class, ChartPreStylePane.class) + ChartColorMatching.class, ChartPreStylePane.class) }; } + @Override + public void addNameable(Nameable nameable, int index) { + super.addNameable(nameable, index); + if (!ChartPreStyleConfig.getInstance().containsName(nameable.getName())) { + ChartPreStyleConfig.getInstance().putPreStyle(nameable.getName(), ((NameObject) nameable).getObject()); + } + } + @Override protected String title4PopupWindow() { return Inter.getLocText("FR-Designer_Chart-PreStyle"); @@ -49,8 +57,8 @@ public class ChartPreStyleManagerPane extends JListControlPane { Iterator keys = config.names(); while(keys.hasNext()) { Object key = keys.next(); - ChartPreStyle value = (ChartPreStyle)config.getPreStyle(key); - + ChartColorMatching value = (ChartColorMatching) config.getPreStyle(key); + list.add(new NameObject(Utils.objectToString(key), value)); } @@ -65,15 +73,20 @@ public class ChartPreStyleManagerPane extends JListControlPane { public void updateBean() { ChartPreStyleConfig config = ChartPreStyleConfig.getInstance(); - config.setPreStyleMap(new ListMap()); + config.setCurrentStyle(getSelectedName()); Nameable[] values = this.update(); + config.setPreStyleMap(new LinkedHashMap()); - config.setCurrentStyle(getSelectedName()); - for(int i = 0; i < values.length; i++) { Nameable value = values[i]; - config.putPreStyle(value.getName(), ((NameObject)value).getObject()); + ChartColorMatching chartColorMatching = (ChartColorMatching) ((NameObject) value).getObject(); + try { + chartColorMatching = (ChartColorMatching) chartColorMatching.clone(); + } catch (CloneNotSupportedException e) { + //do nothing + } + config.putPreStyle(value.getName(), chartColorMatching); } // 通知报表整个刷新. diff --git a/designer-chart/src/main/java/com/fr/design/module/ChartPreStylePane.java b/designer-chart/src/main/java/com/fr/design/module/ChartPreStylePane.java index d0f4d3136..e7f9111d5 100644 --- a/designer-chart/src/main/java/com/fr/design/module/ChartPreStylePane.java +++ b/designer-chart/src/main/java/com/fr/design/module/ChartPreStylePane.java @@ -1,9 +1,11 @@ package com.fr.design.module; -import com.fr.chart.base.ChartPreStyle; +import com.fr.base.ChartColorMatching; +import com.fr.chart.base.ChartUtils; import com.fr.chart.chartattr.Bar2DPlot; import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.ChartCollection; +import com.fr.chart.chartattr.Plot; import com.fr.design.beans.BasicBeanPane; import com.fr.design.chart.gui.ChartComponent; import com.fr.design.event.UIObserver; @@ -25,8 +27,8 @@ import java.awt.FlowLayout; * @author kunsnat E-mail:kunsnat@gmail.com * @version 创建时间:2013-8-20 下午05:02:00 */ -public class ChartPreStylePane extends BasicBeanPane{ - +public class ChartPreStylePane extends BasicBeanPane { + private ChartPreFillStylePane fillStylePane; private ChartComponent chartComponent; @@ -78,28 +80,26 @@ public class ChartPreStylePane extends BasicBeanPane{ } } } - - private void refreshWhenStyleChange(ChartPreStyle preStyle) { -// ChartPreStyleManagerProvider manager = ChartPreStyleServerManager.getProviderInstance(); -// manager.setStyleEditing(preStyle); + + private void refreshWhenStyleChange(ChartColorMatching preStyle) { if(chartComponent != null) { + Plot plot = (Plot) chartComponent.getEditingChart().getBasePlot(); + plot.setPlotFillStyle(ChartUtils.chartColorMatching2AttrFillStyle(preStyle)); chartComponent.reset(); } } @Override - public void populateBean(ChartPreStyle preStyle) { + public void populateBean(ChartColorMatching preStyle) { + + fillStylePane.populateBean(preStyle); - fillStylePane.populateBean(preStyle.getAttrFillStyle()); - refreshWhenStyleChange(preStyle); } @Override - public ChartPreStyle updateBean() { - ChartPreStyle preStyle = new ChartPreStyle(); - preStyle.setAttrFillStyle(fillStylePane.updateBean()); - return preStyle; + public ChartColorMatching updateBean() { + return fillStylePane.updateBean(); } @Override From fb5086d5f13ae3708947a0c6ffc5f5c0e90f9ae2 Mon Sep 17 00:00:00 2001 From: zheng Date: Wed, 18 Jul 2018 10:35:29 +0800 Subject: [PATCH 13/33] move designer-chart/src/main/java/com/fr/design/module/ChartPreFillStylePane.java --- .../chart/gui/style => module}/ChartPreFillStylePane.java | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename designer-chart/src/main/java/com/fr/design/{mainframe/chart/gui/style => module}/ChartPreFillStylePane.java (100%) diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartPreFillStylePane.java b/designer-chart/src/main/java/com/fr/design/module/ChartPreFillStylePane.java similarity index 100% rename from designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartPreFillStylePane.java rename to designer-chart/src/main/java/com/fr/design/module/ChartPreFillStylePane.java From be2cd9cf2ed9f9fb84434f0dfc7dd07c2abe4ada Mon Sep 17 00:00:00 2001 From: XiaXiang Date: Wed, 18 Jul 2018 11:01:16 +0800 Subject: [PATCH 14/33] =?UTF-8?q?REPORT-9747=20=E3=80=9010.0=E4=BA=8C?= =?UTF-8?q?=E8=BD=AE=E5=9B=9E=E5=BD=92=E3=80=91=E4=BF=AE=E6=94=B9=E4=BB=A5?= =?UTF-8?q?=E5=89=8D=E7=9A=84=E6=A8=A1=E6=9D=BF=E6=97=A0=E6=B3=95=E6=9B=B4?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/design/mainframe/DesignerFrame.java | 3 --- .../src/main/java/com/fr/design/mainframe/JTemplate.java | 8 +++++++- 2 files changed, 7 insertions(+), 4 deletions(-) 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 3636a18da..279f399f8 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 @@ -1010,9 +1010,6 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta private void activeTemplate(FILE tplFile, JTemplate jt) { // 如果该模板已经打开,则进行激活就可以了 String fullName = StableUtils.pathJoin(new String[]{ProjectConstants.REPORTLETS_NAME, tplFile.getName()}); - if (tplFile instanceof FileNodeFILE) { - fullName = ((FileNodeFILE) tplFile).getEnvPath() + "/" + tplFile.getPath(); - } // 如果是从文件夹打开的文件,不是从设计器文件树打开的文件,则直接取path就行 if (tplFile instanceof FileFILE) { fullName = tplFile.getPath(); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java index c683488e8..11edfcb83 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java @@ -49,6 +49,7 @@ import com.fr.log.FineLoggerFactory; import com.fr.report.cell.Elem; import com.fr.report.cell.cellattr.CellImage; import com.fr.stable.ArrayUtils; +import com.fr.stable.OperatingSystem; import com.fr.stable.ProductConstants; import com.fr.stable.StringUtils; import com.fr.stable.core.UUID; @@ -199,7 +200,12 @@ public abstract class JTemplate> } public String getPath() { - return getEditingFILE().getPath(); + String editingFileName = getEditingFILE().getPath(); + if (OperatingSystem.isWindows()) { + return editingFileName.replaceAll("/", "\\\\"); + } else { + return editingFileName.replaceAll("\\\\", "/"); + } } protected abstract JComponent createCenterPane(); From c6d3565aa71f846d08e5df534754e401cd78d5b4 Mon Sep 17 00:00:00 2001 From: hzzz Date: Wed, 18 Jul 2018 11:31:56 +0800 Subject: [PATCH 15/33] . --- .../com/fr/design/mainframe/socketio/DesignerSocketIO.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java b/designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java index 6116e87cf..8a1f6b0ef 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java @@ -29,6 +29,7 @@ import java.net.URL; public class DesignerSocketIO { private static Optional socketIO = Optional.absent(); + public static final String CLIENT_CLOSE = "io client disconnect"; private static final Emitter.Listener printLog = new Emitter.Listener() { @Override @@ -71,8 +72,10 @@ public class DesignerSocketIO { socketIO.get().on(Socket.EVENT_DISCONNECT, new Emitter.Listener() { @Override public void call(Object... objects) { - JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText(new String[]{"Fine-Designer_Basic_Remote_Disconnected"}), - null, 0, UIManager.getIcon("OptionPane.errorIcon")); + if (!CLIENT_CLOSE.equals(objects[0].toString())) { + JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText(new String[]{"Fine-Designer_Basic_Remote_Disconnected"}), + null, 0, UIManager.getIcon("OptionPane.errorIcon")); + } } }); socketIO.get().connect(); From 7caddf7dddb537180d30044263b8743a28c04c90 Mon Sep 17 00:00:00 2001 From: XiaXiang Date: Wed, 18 Jul 2018 11:37:47 +0800 Subject: [PATCH 16/33] =?UTF-8?q?rtREPORT-9747=20=E3=80=9010.0=E4=BA=8C?= =?UTF-8?q?=E8=BD=AE=E5=9B=9E=E5=BD=92=E3=80=91=E4=BF=AE=E6=94=B9=E4=BB=A5?= =?UTF-8?q?=E5=89=8D=E7=9A=84=E6=A8=A1=E6=9D=BF=E6=97=A0=E6=B3=95=E6=9B=B4?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/design/mainframe/DesignerFrame.java | 8 +------- .../src/main/java/com/fr/design/mainframe/JTemplate.java | 7 +------ 2 files changed, 2 insertions(+), 13 deletions(-) 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 279f399f8..0fb838090 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 @@ -1009,13 +1009,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta */ private void activeTemplate(FILE tplFile, JTemplate jt) { // 如果该模板已经打开,则进行激活就可以了 - String fullName = StableUtils.pathJoin(new String[]{ProjectConstants.REPORTLETS_NAME, tplFile.getName()}); - // 如果是从文件夹打开的文件,不是从设计器文件树打开的文件,则直接取path就行 - if (tplFile instanceof FileFILE) { - fullName = tplFile.getPath(); - } - fullName = OperatingSystem.isWindows() ? fullName.replaceAll("/", "\\\\") : fullName.replaceAll("\\\\", "/"); - int index = HistoryTemplateListPane.getInstance().contains(fullName); + int index = HistoryTemplateListPane.getInstance().contains(tplFile.getPath()); List> historyList = HistoryTemplateListPane.getInstance().getHistoryList(); if (index != -1) { historyList.get(index).activeJTemplate(index, jt); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java index 11edfcb83..b694137c1 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java @@ -200,12 +200,7 @@ public abstract class JTemplate> } public String getPath() { - String editingFileName = getEditingFILE().getPath(); - if (OperatingSystem.isWindows()) { - return editingFileName.replaceAll("/", "\\\\"); - } else { - return editingFileName.replaceAll("\\\\", "/"); - } + return getEditingFILE().getPath(); } protected abstract JComponent createCenterPane(); From 762f6b5ad2e80a7df067576f47e568f8a8bb4cde Mon Sep 17 00:00:00 2001 From: XiaXiang Date: Wed, 18 Jul 2018 11:45:28 +0800 Subject: [PATCH 17/33] rt --- .../src/main/java/com/fr/design/mainframe/JTemplate.java | 1 - 1 file changed, 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java index b694137c1..c683488e8 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java @@ -49,7 +49,6 @@ import com.fr.log.FineLoggerFactory; import com.fr.report.cell.Elem; import com.fr.report.cell.cellattr.CellImage; import com.fr.stable.ArrayUtils; -import com.fr.stable.OperatingSystem; import com.fr.stable.ProductConstants; import com.fr.stable.StringUtils; import com.fr.stable.core.UUID; From ac014703c1c78d562c2deb3ad2ba94f1ce3c7318 Mon Sep 17 00:00:00 2001 From: kerry Date: Wed, 18 Jul 2018 12:04:23 +0800 Subject: [PATCH 18/33] =?UTF-8?q?REPORT-9246=20=E8=AE=BE=E8=AE=A1=E5=99=A8?= =?UTF-8?q?=E4=B8=AD=E6=9C=89=E5=A5=BD=E5=A4=9A=E9=85=8D=E7=BD=AE=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E6=93=8D=E4=BD=9C=20=E4=B8=AD=E5=A4=B9=E6=9D=82?= =?UTF-8?q?=E4=BA=86=E5=BE=88=E5=A4=9A=E7=9A=84=E4=B8=9A=E5=8A=A1=E9=80=BB?= =?UTF-8?q?=E8=BE=91=EF=BC=8C=E5=B0=86=E4=B8=9A=E5=8A=A1=E9=80=BB=E8=BE=91?= =?UTF-8?q?=E5=92=8C=E9=85=8D=E7=BD=AE=E4=BF=AE=E6=94=B9=E5=89=A5=E7=A6=BB?= =?UTF-8?q?=E5=87=BA=E6=9D=A5=EF=BC=8CConfigurations.update=E6=93=8D?= =?UTF-8?q?=E4=BD=9C=E4=B8=AD=E5=B0=BD=E9=87=8F=E5=8F=AA=E5=8C=85=E5=90=AB?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=85=8D=E7=BD=AE=E7=9A=84=E6=AD=A5=E9=AA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../actions/server/ConnectionListAction.java | 36 +- .../actions/server/GlobalParameterAction.java | 20 +- .../actions/server/GlobalTableDataAction.java | 42 +- .../actions/server/ProcedureListAction.java | 18 +- .../connect/ConnectionComboBoxPanel.java | 29 +- .../java/com/fr/env/RemoteEnvURLTest.java | 398 +++++++++--------- .../actions/report/ReportWebAttrAction.java | 16 +- .../actions/server/WidgetManagerAction.java | 20 +- 8 files changed, 289 insertions(+), 290 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/actions/server/ConnectionListAction.java b/designer-base/src/main/java/com/fr/design/actions/server/ConnectionListAction.java index e14b22b6d..0be0a7c32 100644 --- a/designer-base/src/main/java/com/fr/design/actions/server/ConnectionListAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/server/ConnectionListAction.java @@ -1,7 +1,6 @@ package com.fr.design.actions.server; -import com.fr.config.Configuration; import com.fr.data.impl.Connection; import com.fr.design.actions.UpdateAction; import com.fr.design.data.datapane.connect.ConnectionManagerPane; @@ -16,10 +15,11 @@ import com.fr.file.ConnectionConfig; import com.fr.general.IOUtils; import com.fr.general.Inter; import com.fr.locale.InterProviderFactory; +import com.fr.transaction.CallBackAdaptor; import com.fr.transaction.Configurations; -import com.fr.transaction.Worker; +import com.fr.transaction.WorkerFacade; -import javax.swing.*; +import javax.swing.KeyStroke; import java.awt.event.ActionEvent; import java.util.Map; @@ -74,26 +74,27 @@ public class ConnectionListAction extends UpdateAction { final BasicDialog databaseListDialog = databaseManagerPane.showLargeWindow(designerFrame, null); databaseListDialog.addDialogActionListener(new DialogActionAdapter() { public void doOk() { - Configurations.update(new Worker() { + if (!databaseManagerPane.isNamePermitted()) { + databaseListDialog.setDoOKSucceed(false); + return; + } + Configurations.modify(new WorkerFacade(ConnectionConfig.class) { @Override public void run() { - if (!databaseManagerPane.isNamePermitted()) { - databaseListDialog.setDoOKSucceed(false); - return; - } - if (!doWithDatasourceManager(datasourceManager, databaseManagerPane, databaseListDialog)) { - //如果更新失败,则不关闭对话框,也不写xml文件,并且将对话框定位在请重命名的那个对象页面 - return; - } - DesignerContext.getDesignerBean("databasename").refreshBeanElement(); + databaseManagerPane.update(datasourceManager); } - + }.addCallBack(new CallBackAdaptor() { @Override - public Class[] targets() { - return new Class[]{ConnectionConfig.class}; + public boolean beforeCommit() { + //如果更新失败,则不关闭对话框,也不写xml文件,并且将对话框定位在请重命名的那个对象页面 + return doWithDatasourceManager(datasourceManager, databaseManagerPane, databaseListDialog); } - }); + @Override + public void afterCommit() { + DesignerContext.getDesignerBean("databasename").refreshBeanElement(); + } + })); } }); databaseListDialog.setVisible(true); @@ -109,7 +110,6 @@ public class ConnectionListAction extends UpdateAction { * @return boolean 是否更新成功 */ public static boolean doWithDatasourceManager(ConnectionConfig datasourceManager, ConnectionShowPane connectionShowPane, BasicDialog databaseListDialog) { - connectionShowPane.update(datasourceManager); boolean isFailed = false; //存在请重命名则不能更新 int index = isConnectionMapContainsRename(datasourceManager); diff --git a/designer-base/src/main/java/com/fr/design/actions/server/GlobalParameterAction.java b/designer-base/src/main/java/com/fr/design/actions/server/GlobalParameterAction.java index d141b3b7b..2e5294f35 100644 --- a/designer-base/src/main/java/com/fr/design/actions/server/GlobalParameterAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/server/GlobalParameterAction.java @@ -5,7 +5,6 @@ package com.fr.design.actions.server; import com.fr.base.BaseUtils; import com.fr.base.ParameterConfig; -import com.fr.config.Configuration; import com.fr.config.ServerPreferenceConfig; import com.fr.design.DesignModelAdapter; import com.fr.design.actions.UpdateAction; @@ -16,10 +15,11 @@ import com.fr.design.mainframe.DesignerFrame; import com.fr.design.menu.MenuKeySet; import com.fr.design.parameter.ParameterManagerPane; import com.fr.general.Inter; +import com.fr.transaction.CallBackAdaptor; import com.fr.transaction.Configurations; -import com.fr.transaction.Worker; +import com.fr.transaction.WorkerFacade; -import javax.swing.*; +import javax.swing.KeyStroke; import java.awt.event.ActionEvent; @@ -49,23 +49,21 @@ public class GlobalParameterAction extends UpdateAction { parameterManagerPane.populate(ParameterConfig.getInstance().getGlobalParameters()); parameterManagerDialog.addDialogActionListener(new DialogActionAdapter() { public void doOk() { - Configurations.update(new Worker() { + Configurations.modify(new WorkerFacade(ServerPreferenceConfig.class) { @Override public void run() { - //apply new parameter list. parameterManagerPane.update(); + } + }.addCallBack(new CallBackAdaptor() { + @Override + public void afterCommit() { DesignModelAdapter model = DesignModelAdapter.getCurrentModelAdapter(); if (model != null) { model.parameterChanged(); } parameterManagerDialog.setDoOKSucceed(!parameterManagerPane.isContainsRename()); } - - @Override - public Class[] targets() { - return new Class[]{ServerPreferenceConfig.class}; - } - }); + })); } }); diff --git a/designer-base/src/main/java/com/fr/design/actions/server/GlobalTableDataAction.java b/designer-base/src/main/java/com/fr/design/actions/server/GlobalTableDataAction.java index b723b9928..2969cf444 100644 --- a/designer-base/src/main/java/com/fr/design/actions/server/GlobalTableDataAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/server/GlobalTableDataAction.java @@ -21,10 +21,12 @@ import com.fr.file.ProcedureConfig; import com.fr.file.TableDataConfig; import com.fr.general.Inter; import com.fr.locale.InterProviderFactory; +import com.fr.transaction.CallBackAdaptor; import com.fr.transaction.Configurations; import com.fr.transaction.Worker; +import com.fr.transaction.WorkerFacade; -import javax.swing.*; +import javax.swing.KeyStroke; import java.awt.event.ActionEvent; import java.util.HashMap; import java.util.Map; @@ -92,33 +94,35 @@ public class GlobalTableDataAction extends UpdateAction implements ResponseDataS globalTableDataDialog.addDialogActionListener(new DialogActionAdapter() { + @Override public void doOk() { - Configurations.update(new Worker() { + if (!globalTableDataPane.isNamePermitted()) { + globalTableDataDialog.setDoOKSucceed(false); + return; + } + + DesignTableDataManager.clearGlobalDs(); + + Configurations.modify(new WorkerFacade(TableDataConfig.class) { @Override public void run() { - if (!globalTableDataPane.isNamePermitted()) { - globalTableDataDialog.setDoOKSucceed(false); - return; - } - - DesignTableDataManager.clearGlobalDs(); globalTableDataPane.update(tableDataConfig); - if (!doWithDatasourceManager(tableDataConfig, globalTableDataPane, globalTableDataDialog)) { - //如果更新失败,则不关闭对话框,也不写xml文件,并且将对话框定位在请重命名的那个对象页面 - return; - } - // 刷新共有数据集 - TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()); - fireDSChanged(globalTableDataPane.getDsChangedNameMap()); } - + }.addCallBack(new CallBackAdaptor() { @Override - public Class[] targets() { - return new Class[]{TableDataConfig.class}; + public boolean beforeCommit() { + //如果更新失败,则不关闭对话框,也不写xml文件,并且将对话框定位在请重命名的那个对象页面 + return doWithDatasourceManager(tableDataConfig, globalTableDataPane, globalTableDataDialog); } - }); + @Override + public void afterCommit() { + // 刷新共有数据集 + TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()); + fireDSChanged(globalTableDataPane.getDsChangedNameMap()); + } + })); } }); globalTableDataDialog.setVisible(true); diff --git a/designer-base/src/main/java/com/fr/design/actions/server/ProcedureListAction.java b/designer-base/src/main/java/com/fr/design/actions/server/ProcedureListAction.java index 53b41097e..60969bd8d 100644 --- a/designer-base/src/main/java/com/fr/design/actions/server/ProcedureListAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/server/ProcedureListAction.java @@ -1,7 +1,6 @@ package com.fr.design.actions.server; import com.fr.base.BaseUtils; -import com.fr.config.Configuration; import com.fr.design.DesignModelAdapter; import com.fr.design.actions.UpdateAction; import com.fr.design.data.DesignTableDataManager; @@ -13,8 +12,9 @@ import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerFrame; import com.fr.file.ProcedureConfig; import com.fr.general.Inter; +import com.fr.transaction.CallBackAdaptor; import com.fr.transaction.Configurations; -import com.fr.transaction.Worker; +import com.fr.transaction.WorkerFacade; import java.awt.event.ActionEvent; @@ -44,20 +44,18 @@ public class ProcedureListAction extends UpdateAction { BasicDialog databaseListDialog = databaseManagerPane.showLargeWindow(designerFrame, null); databaseListDialog.addDialogActionListener(new DialogActionAdapter() { public void doOk() { - Configurations.update(new Worker() { + DesignTableDataManager.clearGlobalDs(); + Configurations.modify(new WorkerFacade(ProcedureConfig.class) { @Override public void run() { - DesignTableDataManager.clearGlobalDs(); databaseManagerPane.update(procedureConfig); - TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()); } - + }.addCallBack(new CallBackAdaptor() { @Override - public Class[] targets() { - return new Class[]{ProcedureConfig.class}; + public void afterCommit() { + TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()); } - }); - + })); } }); databaseListDialog.setVisible(true); diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionComboBoxPanel.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionComboBoxPanel.java index f63b37d6c..68db344fb 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionComboBoxPanel.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionComboBoxPanel.java @@ -1,7 +1,5 @@ package com.fr.design.data.datapane.connect; -import com.fr.base.FRContext; -import com.fr.config.Configuration; import com.fr.data.impl.AbstractDatabaseConnection; import com.fr.data.impl.Connection; import com.fr.data.impl.NameDatabaseConnection; @@ -13,11 +11,12 @@ import com.fr.design.mainframe.DesignerContext; import com.fr.file.ConnectionConfig; import com.fr.general.ComparatorUtils; import com.fr.stable.StringUtils; +import com.fr.transaction.CallBackAdaptor; import com.fr.transaction.Configurations; -import com.fr.transaction.Worker; +import com.fr.transaction.WorkerFacade; import com.fr.workspace.WorkContext; -import javax.swing.*; +import javax.swing.SwingUtilities; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; import java.util.ArrayList; @@ -100,22 +99,24 @@ public class ConnectionComboBoxPanel extends ItemEditableComboBoxPanel { connectionListDialog.setDoOKSucceed(false); return; } - Configurations.update(new Worker() { + + Configurations.modify(new WorkerFacade(ConnectionConfig.class) { @Override public void run() { - if (!ConnectionListAction.doWithDatasourceManager(connectionConfig, connectionListPane, - connectionListDialog)) { - //如果更新失败,则不关闭对话框,也不写xml文件,并且将对话框定位在请重命名的那个对象页面 - return; - } - DesignerContext.getDesignerBean("databasename").refreshBeanElement(); + connectionListPane.update(connectionConfig); + } + }.addCallBack(new CallBackAdaptor() { + @Override + public boolean beforeCommit() { + //如果更新失败,则不关闭对话框,也不写xml文件,并且将对话框定位在请重命名的那个对象页面 + return ConnectionListAction.doWithDatasourceManager(connectionConfig, connectionListPane, connectionListDialog); } @Override - public Class[] targets() { - return new Class[]{ConnectionConfig.class}; + public void afterCommit() { + DesignerContext.getDesignerBean("databasename").refreshBeanElement(); } - }); + })); } }); diff --git a/designer-base/src/test/java/com/fr/env/RemoteEnvURLTest.java b/designer-base/src/test/java/com/fr/env/RemoteEnvURLTest.java index f86720fc8..24dd6a73f 100644 --- a/designer-base/src/test/java/com/fr/env/RemoteEnvURLTest.java +++ b/designer-base/src/test/java/com/fr/env/RemoteEnvURLTest.java @@ -1,199 +1,199 @@ -package com.fr.env; - -import org.junit.Assert; -import org.junit.Test; - -import static org.junit.Assert.assertEquals; - -/** - * @author yaohwu - */ -public class RemoteEnvURLTest { - - @Test - public void testURLParser() { - - String a; - RemoteEnvURL b; - - // https or http begin - a = "www.baidu.com:9090/web/servlet/a"; - b = new RemoteEnvURL(a); - Assert.assertFalse(b.getHttps()); - - a = "http://www.baidu.com:9090/web/servlet/a"; - b = new RemoteEnvURL(a); - Assert.assertFalse(b.getHttps()); - - a = "https://www.baidu.com:9090/web/servlet/a"; - b = new RemoteEnvURL(a); - Assert.assertTrue(b.getHttps()); - // https or http end - - // host begin - a = "https://www.baidu.com/web/servlet/a"; - b = new RemoteEnvURL(a); - assertEquals("www.baidu.com", b.getHost()); - - a = "https://baidu.com/web/servlet/a"; - b = new RemoteEnvURL(a); - assertEquals("baidu.com", b.getHost()); - - a = "https://192.168.1/web/servlet/a"; - b = new RemoteEnvURL(a); - assertEquals("192.168.1", b.getHost()); - - a = "https://中文·o((⊙﹏⊙))o囖/web/servlet/a"; - b = new RemoteEnvURL(a); - assertEquals("中文·o((⊙﹏⊙))o囖", b.getHost()); - - a = "https://a.b.c.d.e.f/web/servlet/a"; - b = new RemoteEnvURL(a); - assertEquals("a.b.c.d.e.f", b.getHost()); - // host end - - //port begin - a = "https://www.baidu.com:9090/web/servlet/a"; - b = new RemoteEnvURL(a); - assertEquals("9090", b.getPort()); - - a = "https://www.baidu.com:/web/servlet/a"; - b = new RemoteEnvURL(a); - assertEquals("", b.getPort()); - - a = "https://www.baidu.com/web/servlet/a"; - b = new RemoteEnvURL(a); - assertEquals("", b.getPort()); - - a = "https://www.baidu.com:kk/web/servlet/a"; - b = new RemoteEnvURL(a); - assertEquals("kk", b.getPort()); - - a = "https://www.baidu.com:中文·o((⊙﹏⊙))o囖/web/servlet/a"; - b = new RemoteEnvURL(a); - assertEquals("中文·o((⊙﹏⊙))o囖", b.getPort()); - - a = "https://www.baidu.com:中文·o((⊙﹏⊙))o囖"; - b = new RemoteEnvURL(a); - assertEquals("中文·o((⊙﹏⊙))o囖", b.getPort()); - - a = "https://www.baidu.com:中文·o((⊙﹏⊙))o囖///////"; - b = new RemoteEnvURL(a); - assertEquals("中文·o((⊙﹏⊙))o囖", b.getPort()); - //port end - - - //web begin - - a = "https://www.baidu.com:9090///"; - b = new RemoteEnvURL(a); - assertEquals("", b.getWeb()); - - a = "https://www.baidu.com:9090"; - b = new RemoteEnvURL(a); - assertEquals("", b.getWeb()); - - a = "https://www.baidu.com:9090/"; - b = new RemoteEnvURL(a); - assertEquals("", b.getWeb()); - - a = "https://www.baidu.com:9090///web///servlet/a"; - b = new RemoteEnvURL(a); - assertEquals("web", b.getWeb()); - - a = "https://www.baidu.com:9090/web/servlet/a"; - b = new RemoteEnvURL(a); - assertEquals("web", b.getWeb()); - - a = "https://www.baidu.com:9090/中文·o((⊙﹏⊙))o囖/servlet/a"; - b = new RemoteEnvURL(a); - assertEquals("中文·o((⊙﹏⊙))o囖", b.getWeb()); - - a = "https://www.baidu.com:9090/web///servlet/a"; - b = new RemoteEnvURL(a); - assertEquals("web", b.getWeb()); - - a = "https://www.baidu.com:9090///web/servlet/a"; - b = new RemoteEnvURL(a); - assertEquals("web", b.getWeb()); - //web end - - //servlet begin - a = "https://www.baidu.com:9090///web////servlet/a"; - b = new RemoteEnvURL(a); - assertEquals("servlet", b.getServlet()); - - a = "https://www.baidu.com:9090"; - b = new RemoteEnvURL(a); - assertEquals("", b.getServlet()); - - a = "https://www.baidu.com:9090/"; - b = new RemoteEnvURL(a); - assertEquals("", b.getServlet()); - - a = "https://www.baidu.com:9090//"; - b = new RemoteEnvURL(a); - assertEquals("", b.getServlet()); - - a = "https://www.baidu.com:9090//web"; - b = new RemoteEnvURL(a); - assertEquals("", b.getServlet()); - - a = "https://www.baidu.com:9090//web//"; - b = new RemoteEnvURL(a); - assertEquals("", b.getServlet()); - - a = "https://www.baidu.com:9090//web/"; - b = new RemoteEnvURL(a); - assertEquals("", b.getServlet()); - - a = "https://www.baidu.com:9090//web//"; - b = new RemoteEnvURL(a); - assertEquals("", b.getServlet()); - - a = "https://www.baidu.com:9090//web/a/"; - b = new RemoteEnvURL(a); - assertEquals("a", b.getServlet()); - - a = "https://www.baidu.com:9090//web/a"; - b = new RemoteEnvURL(a); - assertEquals("a", b.getServlet()); - - - a = "https://www.baidu.com:9090//web/a//"; - b = new RemoteEnvURL(a); - assertEquals("a", b.getServlet()); - - a = "https://www.baidu.com:9090//web/中文·o((⊙﹏⊙))o囖//"; - b = new RemoteEnvURL(a); - assertEquals("中文·o((⊙﹏⊙))o囖", b.getServlet()); - - a = "https://www.baidu.com//web//"; - b = new RemoteEnvURL(a); - assertEquals("", b.getServlet()); - - a = "https://www.baidu.com//web/a/"; - b = new RemoteEnvURL(a); - assertEquals("a", b.getServlet()); - - a = "https://www.baidu.com//web/a"; - b = new RemoteEnvURL(a); - assertEquals("a", b.getServlet()); - - - a = "https://www.baidu.com//web/a//"; - b = new RemoteEnvURL(a); - assertEquals("a", b.getServlet()); - // servlet end - - //others begin - a = "https://www.baidu.com/web/servlet/ahttps://www.baidu.com/web/servlet/a"; - b = new RemoteEnvURL(a); - Assert.assertTrue(b.getHttps()); - assertEquals("www.baidu.com", b.getHost()); - assertEquals("", b.getPort()); - assertEquals("web", b.getWeb()); - assertEquals("servlet", b.getServlet()); - //others begin - } -} +//package com.fr.env; +// +//import org.junit.Assert; +//import org.junit.Test; +// +//import static org.junit.Assert.assertEquals; +// +///** +// * @author yaohwu +// */ +//public class RemoteEnvURLTest { +// +// @Test +// public void testURLParser() { +// +// String a; +// RemoteEnvURL b; +// +// // https or http begin +// a = "www.baidu.com:9090/web/servlet/a"; +// b = new RemoteEnvURL(a); +// Assert.assertFalse(b.getHttps()); +// +// a = "http://www.baidu.com:9090/web/servlet/a"; +// b = new RemoteEnvURL(a); +// Assert.assertFalse(b.getHttps()); +// +// a = "https://www.baidu.com:9090/web/servlet/a"; +// b = new RemoteEnvURL(a); +// Assert.assertTrue(b.getHttps()); +// // https or http end +// +// // host begin +// a = "https://www.baidu.com/web/servlet/a"; +// b = new RemoteEnvURL(a); +// assertEquals("www.baidu.com", b.getHost()); +// +// a = "https://baidu.com/web/servlet/a"; +// b = new RemoteEnvURL(a); +// assertEquals("baidu.com", b.getHost()); +// +// a = "https://192.168.1/web/servlet/a"; +// b = new RemoteEnvURL(a); +// assertEquals("192.168.1", b.getHost()); +// +// a = "https://中文·o((⊙﹏⊙))o囖/web/servlet/a"; +// b = new RemoteEnvURL(a); +// assertEquals("中文·o((⊙﹏⊙))o囖", b.getHost()); +// +// a = "https://a.b.c.d.e.f/web/servlet/a"; +// b = new RemoteEnvURL(a); +// assertEquals("a.b.c.d.e.f", b.getHost()); +// // host end +// +// //port begin +// a = "https://www.baidu.com:9090/web/servlet/a"; +// b = new RemoteEnvURL(a); +// assertEquals("9090", b.getPort()); +// +// a = "https://www.baidu.com:/web/servlet/a"; +// b = new RemoteEnvURL(a); +// assertEquals("", b.getPort()); +// +// a = "https://www.baidu.com/web/servlet/a"; +// b = new RemoteEnvURL(a); +// assertEquals("", b.getPort()); +// +// a = "https://www.baidu.com:kk/web/servlet/a"; +// b = new RemoteEnvURL(a); +// assertEquals("kk", b.getPort()); +// +// a = "https://www.baidu.com:中文·o((⊙﹏⊙))o囖/web/servlet/a"; +// b = new RemoteEnvURL(a); +// assertEquals("中文·o((⊙﹏⊙))o囖", b.getPort()); +// +// a = "https://www.baidu.com:中文·o((⊙﹏⊙))o囖"; +// b = new RemoteEnvURL(a); +// assertEquals("中文·o((⊙﹏⊙))o囖", b.getPort()); +// +// a = "https://www.baidu.com:中文·o((⊙﹏⊙))o囖///////"; +// b = new RemoteEnvURL(a); +// assertEquals("中文·o((⊙﹏⊙))o囖", b.getPort()); +// //port end +// +// +// //web begin +// +// a = "https://www.baidu.com:9090///"; +// b = new RemoteEnvURL(a); +// assertEquals("", b.getWeb()); +// +// a = "https://www.baidu.com:9090"; +// b = new RemoteEnvURL(a); +// assertEquals("", b.getWeb()); +// +// a = "https://www.baidu.com:9090/"; +// b = new RemoteEnvURL(a); +// assertEquals("", b.getWeb()); +// +// a = "https://www.baidu.com:9090///web///servlet/a"; +// b = new RemoteEnvURL(a); +// assertEquals("web", b.getWeb()); +// +// a = "https://www.baidu.com:9090/web/servlet/a"; +// b = new RemoteEnvURL(a); +// assertEquals("web", b.getWeb()); +// +// a = "https://www.baidu.com:9090/中文·o((⊙﹏⊙))o囖/servlet/a"; +// b = new RemoteEnvURL(a); +// assertEquals("中文·o((⊙﹏⊙))o囖", b.getWeb()); +// +// a = "https://www.baidu.com:9090/web///servlet/a"; +// b = new RemoteEnvURL(a); +// assertEquals("web", b.getWeb()); +// +// a = "https://www.baidu.com:9090///web/servlet/a"; +// b = new RemoteEnvURL(a); +// assertEquals("web", b.getWeb()); +// //web end +// +// //servlet begin +// a = "https://www.baidu.com:9090///web////servlet/a"; +// b = new RemoteEnvURL(a); +// assertEquals("servlet", b.getServlet()); +// +// a = "https://www.baidu.com:9090"; +// b = new RemoteEnvURL(a); +// assertEquals("", b.getServlet()); +// +// a = "https://www.baidu.com:9090/"; +// b = new RemoteEnvURL(a); +// assertEquals("", b.getServlet()); +// +// a = "https://www.baidu.com:9090//"; +// b = new RemoteEnvURL(a); +// assertEquals("", b.getServlet()); +// +// a = "https://www.baidu.com:9090//web"; +// b = new RemoteEnvURL(a); +// assertEquals("", b.getServlet()); +// +// a = "https://www.baidu.com:9090//web//"; +// b = new RemoteEnvURL(a); +// assertEquals("", b.getServlet()); +// +// a = "https://www.baidu.com:9090//web/"; +// b = new RemoteEnvURL(a); +// assertEquals("", b.getServlet()); +// +// a = "https://www.baidu.com:9090//web//"; +// b = new RemoteEnvURL(a); +// assertEquals("", b.getServlet()); +// +// a = "https://www.baidu.com:9090//web/a/"; +// b = new RemoteEnvURL(a); +// assertEquals("a", b.getServlet()); +// +// a = "https://www.baidu.com:9090//web/a"; +// b = new RemoteEnvURL(a); +// assertEquals("a", b.getServlet()); +// +// +// a = "https://www.baidu.com:9090//web/a//"; +// b = new RemoteEnvURL(a); +// assertEquals("a", b.getServlet()); +// +// a = "https://www.baidu.com:9090//web/中文·o((⊙﹏⊙))o囖//"; +// b = new RemoteEnvURL(a); +// assertEquals("中文·o((⊙﹏⊙))o囖", b.getServlet()); +// +// a = "https://www.baidu.com//web//"; +// b = new RemoteEnvURL(a); +// assertEquals("", b.getServlet()); +// +// a = "https://www.baidu.com//web/a/"; +// b = new RemoteEnvURL(a); +// assertEquals("a", b.getServlet()); +// +// a = "https://www.baidu.com//web/a"; +// b = new RemoteEnvURL(a); +// assertEquals("a", b.getServlet()); +// +// +// a = "https://www.baidu.com//web/a//"; +// b = new RemoteEnvURL(a); +// assertEquals("a", b.getServlet()); +// // servlet end +// +// //others begin +// a = "https://www.baidu.com/web/servlet/ahttps://www.baidu.com/web/servlet/a"; +// b = new RemoteEnvURL(a); +// Assert.assertTrue(b.getHttps()); +// assertEquals("www.baidu.com", b.getHost()); +// assertEquals("", b.getPort()); +// assertEquals("web", b.getWeb()); +// assertEquals("servlet", b.getServlet()); +// //others begin +// } +//} diff --git a/designer-realize/src/main/java/com/fr/design/actions/report/ReportWebAttrAction.java b/designer-realize/src/main/java/com/fr/design/actions/report/ReportWebAttrAction.java index 1c10ca25b..ef503b8cb 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/report/ReportWebAttrAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/report/ReportWebAttrAction.java @@ -3,7 +3,6 @@ */ package com.fr.design.actions.report; -import com.fr.config.Configuration; import com.fr.design.actions.JWorkBookAction; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.DialogActionAdapter; @@ -13,8 +12,9 @@ import com.fr.design.menu.KeySetUtils; import com.fr.design.webattr.ReportWebAttrPane; import com.fr.general.IOUtils; import com.fr.main.TemplateWorkBook; +import com.fr.transaction.CallBackAdaptor; import com.fr.transaction.Configurations; -import com.fr.transaction.Worker; +import com.fr.transaction.WorkerFacade; import com.fr.web.attr.ReportWebAttr; import java.awt.event.ActionEvent; @@ -56,19 +56,17 @@ public class ReportWebAttrAction extends JWorkBookAction { dialog.addDialogActionListener(new DialogActionAdapter() { @Override public void doOk() { - Configurations.update(new Worker() { + Configurations.modify(new WorkerFacade(ReportWebAttr.class) { @Override public void run() { wbTpl.setReportWebAttr(reportWebAttrPane.update()); - jwb.fireTargetModified(); } - + }.addCallBack(new CallBackAdaptor() { @Override - public Class[] targets() { - return new Class[]{ReportWebAttr.class}; + public void afterCommit() { + jwb.fireTargetModified(); } - }); - + })); } }); diff --git a/designer-realize/src/main/java/com/fr/design/actions/server/WidgetManagerAction.java b/designer-realize/src/main/java/com/fr/design/actions/server/WidgetManagerAction.java index b7cb025e8..f1001eafe 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/server/WidgetManagerAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/server/WidgetManagerAction.java @@ -1,7 +1,6 @@ package com.fr.design.actions.server; import com.fr.base.BaseUtils; -import com.fr.config.Configuration; import com.fr.design.DesignModelAdapter; import com.fr.design.actions.UpdateAction; import com.fr.design.dialog.BasicDialog; @@ -12,10 +11,11 @@ import com.fr.design.menu.MenuKeySet; import com.fr.design.webattr.WidgetManagerPane; import com.fr.form.ui.WidgetInfoConfig; import com.fr.general.Inter; +import com.fr.transaction.CallBackAdaptor; import com.fr.transaction.Configurations; -import com.fr.transaction.Worker; +import com.fr.transaction.WorkerFacade; -import javax.swing.*; +import javax.swing.KeyStroke; import java.awt.event.ActionEvent; public class WidgetManagerAction extends UpdateAction { @@ -45,22 +45,22 @@ public class WidgetManagerAction extends UpdateAction { BasicDialog widgetConfigDialog = widgetManagerPane.showLargeWindow(designerFrame, new DialogActionAdapter() { @Override public void doOk() { - Configurations.update(new Worker() { + + Configurations.modify(new WorkerFacade(WidgetInfoConfig.class) { @Override public void run() { widgetManagerPane.update(widgetManager); + } + }.addCallBack(new CallBackAdaptor() { + @Override + public void afterCommit() { DesignModelAdapter model = DesignModelAdapter.getCurrentModelAdapter(); if (model != null) { model.widgetConfigChanged(); } designerFrame.getSelectedJTemplate().refreshToolArea(); } - - @Override - public Class[] targets() { - return new Class[]{WidgetInfoConfig.class}; - } - }); + })); } }); From 305b3960f4371fe4e91220829df6e1ef2b7a48fd Mon Sep 17 00:00:00 2001 From: richie Date: Wed, 18 Jul 2018 12:08:16 +0800 Subject: [PATCH 19/33] =?UTF-8?q?CORE-116=20fr=5Fusername->fine=5Fusername?= =?UTF-8?q?=E7=AD=89=E5=AF=B9=E5=BA=94=E7=9A=84=E4=BF=AE=E6=94=B9=EF=BC=8C?= =?UTF-8?q?KMS=E4=B8=8A=E8=A1=A5=E5=85=85=E6=96=87=E6=A1=A3=EF=BC=8C?= =?UTF-8?q?=E8=80=81=E7=9A=84=E4=BF=9D=E6=8C=81=E5=85=BC=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../formula/VariableResolverAdapter.java | 132 +++++++++--------- 1 file changed, 67 insertions(+), 65 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/formula/VariableResolverAdapter.java b/designer-base/src/main/java/com/fr/design/formula/VariableResolverAdapter.java index e5d1545b7..e03fa0e18 100644 --- a/designer-base/src/main/java/com/fr/design/formula/VariableResolverAdapter.java +++ b/designer-base/src/main/java/com/fr/design/formula/VariableResolverAdapter.java @@ -3,10 +3,10 @@ package com.fr.design.formula; import com.fr.base.Parameter; import com.fr.base.ParameterConfig; import com.fr.design.DesignModelAdapter; +import com.fr.general.web.ParameterConstants; import com.fr.plugin.ExtraClassManager; import com.fr.script.ScriptConstants; import com.fr.stable.ArrayUtils; -import com.fr.stable.Constants; import com.fr.stable.fun.BuiltInParametersProvider; import com.fr.stable.script.CalculatorProvider; @@ -15,91 +15,93 @@ import java.util.List; import java.util.Set; public abstract class VariableResolverAdapter implements VariableResolver { - private static final int TABLE_DATA_PARA = 0; - private static final int REPORT_DATA_PARA = 1; + private static final int TABLE_DATA_PARA = 0; + private static final int REPORT_DATA_PARA = 1; /** * 获取模板内置的一些参数 * * @return 内置参数 */ - public String[] resolveCurReportVariables() { - String [] variables = new String[] { ScriptConstants.SUMMARY_TAG + "page_number", - ScriptConstants.SUMMARY_TAG + "totalPage_number", - // 下面是权限相关的参数 - ScriptConstants.DETAIL_TAG + Constants.P.PRIVILEGE_USERNAME, ScriptConstants.DETAIL_TAG + Constants.P.PRIVILEGE_AUTHORITY, - ScriptConstants.DETAIL_TAG + Constants.P.PRIVILEGE_DEPARTMETN_AND_POST, - // 空值参数 - "NULL", "NOFILTER", - // request变量 - CalculatorProvider.REPORT_NAME, CalculatorProvider.FORMLET_NAME, CalculatorProvider.SERVLET_URL, CalculatorProvider.SERVER_SCHEMA, CalculatorProvider.SERVER_NAME, - CalculatorProvider.SERVER_PORT, CalculatorProvider.SERVER_URL, CalculatorProvider.CONTEXT_PATH, CalculatorProvider.SESSION_ID - }; - Set set = ExtraClassManager.getInstance().getArray(BuiltInParametersProvider.XML_TAG); - for (BuiltInParametersProvider provider : set) { - return (String[]) ArrayUtils.addAll(variables, new String []{ - ScriptConstants.DETAIL_TAG + provider.getParametersName() - }); - } - return variables; - } - - private Parameter[] getCurrentModeParameters(int type) { - Parameter[] parameters = null; - if(DesignModelAdapter.getCurrentModelAdapter() == null) { - parameters = new Parameter[0]; - } else { - if(type == TABLE_DATA_PARA) { - parameters = DesignModelAdapter.getCurrentModelAdapter().getTableDataParameters(); - } else if(type == REPORT_DATA_PARA){ - parameters = DesignModelAdapter.getCurrentModelAdapter().getReportParameters(); - } - } - return parameters; - } + public String[] resolveCurReportVariables() { + String[] variables = new String[]{ + ScriptConstants.SUMMARY_TAG + "page_number", + ScriptConstants.SUMMARY_TAG + "totalPage_number", + // 下面是权限相关的参数 + ScriptConstants.DETAIL_TAG + ParameterConstants.FINE_USERNAME, + ScriptConstants.DETAIL_TAG + ParameterConstants.FINE_ROLE, + ScriptConstants.DETAIL_TAG + ParameterConstants.FINE_POSITION, + // 空值参数 + "NULL", "NOFILTER", + // request变量 + CalculatorProvider.REPORT_NAME, CalculatorProvider.FORMLET_NAME, CalculatorProvider.SERVLET_URL, CalculatorProvider.SERVER_SCHEMA, CalculatorProvider.SERVER_NAME, + CalculatorProvider.SERVER_PORT, CalculatorProvider.SERVER_URL, CalculatorProvider.CONTEXT_PATH, CalculatorProvider.SESSION_ID + }; + Set set = ExtraClassManager.getInstance().getArray(BuiltInParametersProvider.XML_TAG); + for (BuiltInParametersProvider provider : set) { + return (String[]) ArrayUtils.addAll(variables, new String[]{ + ScriptConstants.DETAIL_TAG + provider.getParametersName() + }); + } + return variables; + } + + private Parameter[] getCurrentModeParameters(int type) { + Parameter[] parameters = null; + if (DesignModelAdapter.getCurrentModelAdapter() == null) { + parameters = new Parameter[0]; + } else { + if (type == TABLE_DATA_PARA) { + parameters = DesignModelAdapter.getCurrentModelAdapter().getTableDataParameters(); + } else if (type == REPORT_DATA_PARA) { + parameters = DesignModelAdapter.getCurrentModelAdapter().getReportParameters(); + } + } + return parameters; + } /** * 获取数据集参数 * * @return 所有参数 */ - public String[] resolveTableDataParameterVariables() { - Parameter[] parameters = getCurrentModeParameters(TABLE_DATA_PARA); - String[] parameterNames = new String[parameters.length]; - for (int i = 0; i < parameters.length; i++) { - parameterNames[i] = ScriptConstants.DETAIL_TAG + parameters[i].getName(); - } - return parameterNames; - } + public String[] resolveTableDataParameterVariables() { + Parameter[] parameters = getCurrentModeParameters(TABLE_DATA_PARA); + String[] parameterNames = new String[parameters.length]; + for (int i = 0; i < parameters.length; i++) { + parameterNames[i] = ScriptConstants.DETAIL_TAG + parameters[i].getName(); + } + return parameterNames; + } /** * 获取模板参数 * * @return 所有参数 */ - public String[] resolveReportParameterVariables() { - Parameter[] parameters = getCurrentModeParameters(REPORT_DATA_PARA); - String[] parameterNames = new String[parameters.length]; - for (int i = 0; i < parameters.length; i++) { - parameterNames[i] = ScriptConstants.DETAIL_TAG + parameters[i].getName(); - } - return parameterNames; - } + public String[] resolveReportParameterVariables() { + Parameter[] parameters = getCurrentModeParameters(REPORT_DATA_PARA); + String[] parameterNames = new String[parameters.length]; + for (int i = 0; i < parameters.length; i++) { + parameterNames[i] = ScriptConstants.DETAIL_TAG + parameters[i].getName(); + } + return parameterNames; + } - /** - * 获取全局参数 + /** + * 获取全局参数 * * @return 所有参数 - */ - public String[] resolveGlobalParameterVariables() { - // 加上全局的参数 - Parameter[] globalParameters = ParameterConfig.getInstance().getGlobalParameters(); + */ + public String[] resolveGlobalParameterVariables() { + // 加上全局的参数 + Parameter[] globalParameters = ParameterConfig.getInstance().getGlobalParameters(); - List variablesList = new ArrayList(); - for (int i = 0; i < (globalParameters == null ? 0 : globalParameters.length); i++) { - variablesList.add(ScriptConstants.DETAIL_TAG + (globalParameters[i]).getName()); - } + List variablesList = new ArrayList(); + for (int i = 0; i < (globalParameters == null ? 0 : globalParameters.length); i++) { + variablesList.add(ScriptConstants.DETAIL_TAG + (globalParameters[i]).getName()); + } - return variablesList.toArray(new String[variablesList.size()]); - } + return variablesList.toArray(new String[variablesList.size()]); + } } \ No newline at end of file From ebcdebb688aa31c76796e0521ab6ff27c4a1080e Mon Sep 17 00:00:00 2001 From: kerry Date: Wed, 18 Jul 2018 12:48:45 +0800 Subject: [PATCH 20/33] =?UTF-8?q?=E6=97=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/env/RemoteEnvURLTest.java | 398 +++++++++--------- 1 file changed, 199 insertions(+), 199 deletions(-) diff --git a/designer-base/src/test/java/com/fr/env/RemoteEnvURLTest.java b/designer-base/src/test/java/com/fr/env/RemoteEnvURLTest.java index 24dd6a73f..f86720fc8 100644 --- a/designer-base/src/test/java/com/fr/env/RemoteEnvURLTest.java +++ b/designer-base/src/test/java/com/fr/env/RemoteEnvURLTest.java @@ -1,199 +1,199 @@ -//package com.fr.env; -// -//import org.junit.Assert; -//import org.junit.Test; -// -//import static org.junit.Assert.assertEquals; -// -///** -// * @author yaohwu -// */ -//public class RemoteEnvURLTest { -// -// @Test -// public void testURLParser() { -// -// String a; -// RemoteEnvURL b; -// -// // https or http begin -// a = "www.baidu.com:9090/web/servlet/a"; -// b = new RemoteEnvURL(a); -// Assert.assertFalse(b.getHttps()); -// -// a = "http://www.baidu.com:9090/web/servlet/a"; -// b = new RemoteEnvURL(a); -// Assert.assertFalse(b.getHttps()); -// -// a = "https://www.baidu.com:9090/web/servlet/a"; -// b = new RemoteEnvURL(a); -// Assert.assertTrue(b.getHttps()); -// // https or http end -// -// // host begin -// a = "https://www.baidu.com/web/servlet/a"; -// b = new RemoteEnvURL(a); -// assertEquals("www.baidu.com", b.getHost()); -// -// a = "https://baidu.com/web/servlet/a"; -// b = new RemoteEnvURL(a); -// assertEquals("baidu.com", b.getHost()); -// -// a = "https://192.168.1/web/servlet/a"; -// b = new RemoteEnvURL(a); -// assertEquals("192.168.1", b.getHost()); -// -// a = "https://中文·o((⊙﹏⊙))o囖/web/servlet/a"; -// b = new RemoteEnvURL(a); -// assertEquals("中文·o((⊙﹏⊙))o囖", b.getHost()); -// -// a = "https://a.b.c.d.e.f/web/servlet/a"; -// b = new RemoteEnvURL(a); -// assertEquals("a.b.c.d.e.f", b.getHost()); -// // host end -// -// //port begin -// a = "https://www.baidu.com:9090/web/servlet/a"; -// b = new RemoteEnvURL(a); -// assertEquals("9090", b.getPort()); -// -// a = "https://www.baidu.com:/web/servlet/a"; -// b = new RemoteEnvURL(a); -// assertEquals("", b.getPort()); -// -// a = "https://www.baidu.com/web/servlet/a"; -// b = new RemoteEnvURL(a); -// assertEquals("", b.getPort()); -// -// a = "https://www.baidu.com:kk/web/servlet/a"; -// b = new RemoteEnvURL(a); -// assertEquals("kk", b.getPort()); -// -// a = "https://www.baidu.com:中文·o((⊙﹏⊙))o囖/web/servlet/a"; -// b = new RemoteEnvURL(a); -// assertEquals("中文·o((⊙﹏⊙))o囖", b.getPort()); -// -// a = "https://www.baidu.com:中文·o((⊙﹏⊙))o囖"; -// b = new RemoteEnvURL(a); -// assertEquals("中文·o((⊙﹏⊙))o囖", b.getPort()); -// -// a = "https://www.baidu.com:中文·o((⊙﹏⊙))o囖///////"; -// b = new RemoteEnvURL(a); -// assertEquals("中文·o((⊙﹏⊙))o囖", b.getPort()); -// //port end -// -// -// //web begin -// -// a = "https://www.baidu.com:9090///"; -// b = new RemoteEnvURL(a); -// assertEquals("", b.getWeb()); -// -// a = "https://www.baidu.com:9090"; -// b = new RemoteEnvURL(a); -// assertEquals("", b.getWeb()); -// -// a = "https://www.baidu.com:9090/"; -// b = new RemoteEnvURL(a); -// assertEquals("", b.getWeb()); -// -// a = "https://www.baidu.com:9090///web///servlet/a"; -// b = new RemoteEnvURL(a); -// assertEquals("web", b.getWeb()); -// -// a = "https://www.baidu.com:9090/web/servlet/a"; -// b = new RemoteEnvURL(a); -// assertEquals("web", b.getWeb()); -// -// a = "https://www.baidu.com:9090/中文·o((⊙﹏⊙))o囖/servlet/a"; -// b = new RemoteEnvURL(a); -// assertEquals("中文·o((⊙﹏⊙))o囖", b.getWeb()); -// -// a = "https://www.baidu.com:9090/web///servlet/a"; -// b = new RemoteEnvURL(a); -// assertEquals("web", b.getWeb()); -// -// a = "https://www.baidu.com:9090///web/servlet/a"; -// b = new RemoteEnvURL(a); -// assertEquals("web", b.getWeb()); -// //web end -// -// //servlet begin -// a = "https://www.baidu.com:9090///web////servlet/a"; -// b = new RemoteEnvURL(a); -// assertEquals("servlet", b.getServlet()); -// -// a = "https://www.baidu.com:9090"; -// b = new RemoteEnvURL(a); -// assertEquals("", b.getServlet()); -// -// a = "https://www.baidu.com:9090/"; -// b = new RemoteEnvURL(a); -// assertEquals("", b.getServlet()); -// -// a = "https://www.baidu.com:9090//"; -// b = new RemoteEnvURL(a); -// assertEquals("", b.getServlet()); -// -// a = "https://www.baidu.com:9090//web"; -// b = new RemoteEnvURL(a); -// assertEquals("", b.getServlet()); -// -// a = "https://www.baidu.com:9090//web//"; -// b = new RemoteEnvURL(a); -// assertEquals("", b.getServlet()); -// -// a = "https://www.baidu.com:9090//web/"; -// b = new RemoteEnvURL(a); -// assertEquals("", b.getServlet()); -// -// a = "https://www.baidu.com:9090//web//"; -// b = new RemoteEnvURL(a); -// assertEquals("", b.getServlet()); -// -// a = "https://www.baidu.com:9090//web/a/"; -// b = new RemoteEnvURL(a); -// assertEquals("a", b.getServlet()); -// -// a = "https://www.baidu.com:9090//web/a"; -// b = new RemoteEnvURL(a); -// assertEquals("a", b.getServlet()); -// -// -// a = "https://www.baidu.com:9090//web/a//"; -// b = new RemoteEnvURL(a); -// assertEquals("a", b.getServlet()); -// -// a = "https://www.baidu.com:9090//web/中文·o((⊙﹏⊙))o囖//"; -// b = new RemoteEnvURL(a); -// assertEquals("中文·o((⊙﹏⊙))o囖", b.getServlet()); -// -// a = "https://www.baidu.com//web//"; -// b = new RemoteEnvURL(a); -// assertEquals("", b.getServlet()); -// -// a = "https://www.baidu.com//web/a/"; -// b = new RemoteEnvURL(a); -// assertEquals("a", b.getServlet()); -// -// a = "https://www.baidu.com//web/a"; -// b = new RemoteEnvURL(a); -// assertEquals("a", b.getServlet()); -// -// -// a = "https://www.baidu.com//web/a//"; -// b = new RemoteEnvURL(a); -// assertEquals("a", b.getServlet()); -// // servlet end -// -// //others begin -// a = "https://www.baidu.com/web/servlet/ahttps://www.baidu.com/web/servlet/a"; -// b = new RemoteEnvURL(a); -// Assert.assertTrue(b.getHttps()); -// assertEquals("www.baidu.com", b.getHost()); -// assertEquals("", b.getPort()); -// assertEquals("web", b.getWeb()); -// assertEquals("servlet", b.getServlet()); -// //others begin -// } -//} +package com.fr.env; + +import org.junit.Assert; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; + +/** + * @author yaohwu + */ +public class RemoteEnvURLTest { + + @Test + public void testURLParser() { + + String a; + RemoteEnvURL b; + + // https or http begin + a = "www.baidu.com:9090/web/servlet/a"; + b = new RemoteEnvURL(a); + Assert.assertFalse(b.getHttps()); + + a = "http://www.baidu.com:9090/web/servlet/a"; + b = new RemoteEnvURL(a); + Assert.assertFalse(b.getHttps()); + + a = "https://www.baidu.com:9090/web/servlet/a"; + b = new RemoteEnvURL(a); + Assert.assertTrue(b.getHttps()); + // https or http end + + // host begin + a = "https://www.baidu.com/web/servlet/a"; + b = new RemoteEnvURL(a); + assertEquals("www.baidu.com", b.getHost()); + + a = "https://baidu.com/web/servlet/a"; + b = new RemoteEnvURL(a); + assertEquals("baidu.com", b.getHost()); + + a = "https://192.168.1/web/servlet/a"; + b = new RemoteEnvURL(a); + assertEquals("192.168.1", b.getHost()); + + a = "https://中文·o((⊙﹏⊙))o囖/web/servlet/a"; + b = new RemoteEnvURL(a); + assertEquals("中文·o((⊙﹏⊙))o囖", b.getHost()); + + a = "https://a.b.c.d.e.f/web/servlet/a"; + b = new RemoteEnvURL(a); + assertEquals("a.b.c.d.e.f", b.getHost()); + // host end + + //port begin + a = "https://www.baidu.com:9090/web/servlet/a"; + b = new RemoteEnvURL(a); + assertEquals("9090", b.getPort()); + + a = "https://www.baidu.com:/web/servlet/a"; + b = new RemoteEnvURL(a); + assertEquals("", b.getPort()); + + a = "https://www.baidu.com/web/servlet/a"; + b = new RemoteEnvURL(a); + assertEquals("", b.getPort()); + + a = "https://www.baidu.com:kk/web/servlet/a"; + b = new RemoteEnvURL(a); + assertEquals("kk", b.getPort()); + + a = "https://www.baidu.com:中文·o((⊙﹏⊙))o囖/web/servlet/a"; + b = new RemoteEnvURL(a); + assertEquals("中文·o((⊙﹏⊙))o囖", b.getPort()); + + a = "https://www.baidu.com:中文·o((⊙﹏⊙))o囖"; + b = new RemoteEnvURL(a); + assertEquals("中文·o((⊙﹏⊙))o囖", b.getPort()); + + a = "https://www.baidu.com:中文·o((⊙﹏⊙))o囖///////"; + b = new RemoteEnvURL(a); + assertEquals("中文·o((⊙﹏⊙))o囖", b.getPort()); + //port end + + + //web begin + + a = "https://www.baidu.com:9090///"; + b = new RemoteEnvURL(a); + assertEquals("", b.getWeb()); + + a = "https://www.baidu.com:9090"; + b = new RemoteEnvURL(a); + assertEquals("", b.getWeb()); + + a = "https://www.baidu.com:9090/"; + b = new RemoteEnvURL(a); + assertEquals("", b.getWeb()); + + a = "https://www.baidu.com:9090///web///servlet/a"; + b = new RemoteEnvURL(a); + assertEquals("web", b.getWeb()); + + a = "https://www.baidu.com:9090/web/servlet/a"; + b = new RemoteEnvURL(a); + assertEquals("web", b.getWeb()); + + a = "https://www.baidu.com:9090/中文·o((⊙﹏⊙))o囖/servlet/a"; + b = new RemoteEnvURL(a); + assertEquals("中文·o((⊙﹏⊙))o囖", b.getWeb()); + + a = "https://www.baidu.com:9090/web///servlet/a"; + b = new RemoteEnvURL(a); + assertEquals("web", b.getWeb()); + + a = "https://www.baidu.com:9090///web/servlet/a"; + b = new RemoteEnvURL(a); + assertEquals("web", b.getWeb()); + //web end + + //servlet begin + a = "https://www.baidu.com:9090///web////servlet/a"; + b = new RemoteEnvURL(a); + assertEquals("servlet", b.getServlet()); + + a = "https://www.baidu.com:9090"; + b = new RemoteEnvURL(a); + assertEquals("", b.getServlet()); + + a = "https://www.baidu.com:9090/"; + b = new RemoteEnvURL(a); + assertEquals("", b.getServlet()); + + a = "https://www.baidu.com:9090//"; + b = new RemoteEnvURL(a); + assertEquals("", b.getServlet()); + + a = "https://www.baidu.com:9090//web"; + b = new RemoteEnvURL(a); + assertEquals("", b.getServlet()); + + a = "https://www.baidu.com:9090//web//"; + b = new RemoteEnvURL(a); + assertEquals("", b.getServlet()); + + a = "https://www.baidu.com:9090//web/"; + b = new RemoteEnvURL(a); + assertEquals("", b.getServlet()); + + a = "https://www.baidu.com:9090//web//"; + b = new RemoteEnvURL(a); + assertEquals("", b.getServlet()); + + a = "https://www.baidu.com:9090//web/a/"; + b = new RemoteEnvURL(a); + assertEquals("a", b.getServlet()); + + a = "https://www.baidu.com:9090//web/a"; + b = new RemoteEnvURL(a); + assertEquals("a", b.getServlet()); + + + a = "https://www.baidu.com:9090//web/a//"; + b = new RemoteEnvURL(a); + assertEquals("a", b.getServlet()); + + a = "https://www.baidu.com:9090//web/中文·o((⊙﹏⊙))o囖//"; + b = new RemoteEnvURL(a); + assertEquals("中文·o((⊙﹏⊙))o囖", b.getServlet()); + + a = "https://www.baidu.com//web//"; + b = new RemoteEnvURL(a); + assertEquals("", b.getServlet()); + + a = "https://www.baidu.com//web/a/"; + b = new RemoteEnvURL(a); + assertEquals("a", b.getServlet()); + + a = "https://www.baidu.com//web/a"; + b = new RemoteEnvURL(a); + assertEquals("a", b.getServlet()); + + + a = "https://www.baidu.com//web/a//"; + b = new RemoteEnvURL(a); + assertEquals("a", b.getServlet()); + // servlet end + + //others begin + a = "https://www.baidu.com/web/servlet/ahttps://www.baidu.com/web/servlet/a"; + b = new RemoteEnvURL(a); + Assert.assertTrue(b.getHttps()); + assertEquals("www.baidu.com", b.getHost()); + assertEquals("", b.getPort()); + assertEquals("web", b.getWeb()); + assertEquals("servlet", b.getServlet()); + //others begin + } +} From 3f69774804c8e7690cfa2b03b33de4ad8010be80 Mon Sep 17 00:00:00 2001 From: hzzz Date: Wed, 18 Jul 2018 13:50:24 +0800 Subject: [PATCH 21/33] . --- .../mainframe/socketio/DesignerSocketIO.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java b/designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java index 8a1f6b0ef..e8f6406ac 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java @@ -28,8 +28,14 @@ import java.net.URL; public class DesignerSocketIO { + enum Status { + Connected, + Disconnected, + Disconnecting + } + private static Optional socketIO = Optional.absent(); - public static final String CLIENT_CLOSE = "io client disconnect"; + public static Status status = Status.Disconnected; private static final Emitter.Listener printLog = new Emitter.Listener() { @Override @@ -47,8 +53,10 @@ public class DesignerSocketIO { public static void close() { if (socketIO.isPresent()) { + status = Status.Disconnecting; socketIO.get().close(); socketIO = Optional.absent(); + status = Status.Disconnected; } } @@ -72,13 +80,15 @@ public class DesignerSocketIO { socketIO.get().on(Socket.EVENT_DISCONNECT, new Emitter.Listener() { @Override public void call(Object... objects) { - if (!CLIENT_CLOSE.equals(objects[0].toString())) { + if (status != Status.Disconnecting) { JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText(new String[]{"Fine-Designer_Basic_Remote_Disconnected"}), null, 0, UIManager.getIcon("OptionPane.errorIcon")); + status = Status.Disconnected; } } }); socketIO.get().connect(); + status = Status.Connected; } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } From b18f35034702e8683b494935c45e1cfeb3741bfa Mon Sep 17 00:00:00 2001 From: richie Date: Wed, 18 Jul 2018 15:11:32 +0800 Subject: [PATCH 22/33] =?UTF-8?q?CORE-116=20=E5=88=A0=E9=99=A4LogRecordTim?= =?UTF-8?q?e=E7=AD=89=E6=97=A0=E7=94=A8=E7=9A=84=E5=AF=B9=E8=B1=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../loghandler/DesignerLogAppender.java | 1 - .../loghandler/DesignerLogHandler.java | 84 +++++++++---------- .../mainframe/loghandler/DesignerLogImpl.java | 46 ---------- .../mainframe/socketio/DesignerSocketIO.java | 23 +++-- .../fr/start/module/DesignerActivator.java | 5 +- 5 files changed, 50 insertions(+), 109 deletions(-) delete mode 100644 designer-base/src/main/java/com/fr/design/mainframe/loghandler/DesignerLogImpl.java diff --git a/designer-base/src/main/java/com/fr/design/mainframe/loghandler/DesignerLogAppender.java b/designer-base/src/main/java/com/fr/design/mainframe/loghandler/DesignerLogAppender.java index 65cbe2b21..118ea2e32 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/loghandler/DesignerLogAppender.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/loghandler/DesignerLogAppender.java @@ -1,7 +1,6 @@ package com.fr.design.mainframe.loghandler; -import com.fr.general.FRLogLevel; import com.fr.third.apache.log4j.AppenderSkeleton; import com.fr.third.apache.log4j.Level; import com.fr.third.apache.log4j.spi.LoggingEvent; diff --git a/designer-base/src/main/java/com/fr/design/mainframe/loghandler/DesignerLogHandler.java b/designer-base/src/main/java/com/fr/design/mainframe/loghandler/DesignerLogHandler.java index d2e149e91..c724f3853 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/loghandler/DesignerLogHandler.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/loghandler/DesignerLogHandler.java @@ -1,17 +1,16 @@ package com.fr.design.mainframe.loghandler; import com.fr.base.BaseUtils; -import com.fr.base.FRContext; import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.imenu.UIMenuItem; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.general.ComparatorUtils; -import com.fr.general.FRLogLevel; import com.fr.general.Inter; -import com.fr.general.LogRecordTime; import com.fr.general.log.Log4jConfig; -import com.fr.stable.xml.LogRecordTimeProvider; +import com.fr.log.FineLoggerFactory; import com.fr.third.apache.log4j.Level; +import com.fr.third.apache.log4j.spi.LoggingEvent; +import com.fr.third.apache.log4j.spi.ThrowableInformation; import javax.swing.*; import javax.swing.text.BadLocationException; @@ -29,11 +28,13 @@ import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.text.SimpleDateFormat; import java.util.Date; -import java.util.logging.LogRecord; import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_MODIFIER; public class DesignerLogHandler { + + private static final SimpleDateFormat LOG_SIMPLE_DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + protected static final int INFO_INT = Level.INFO.toInt(); protected static final int ERROR_INT = Level.ERROR.toInt(); protected static final int WARN_INT = Level.WARN.toInt(); @@ -67,7 +68,6 @@ public class DesignerLogHandler { public void actionPerformed(ActionEvent e) { logHandlerArea.jTextArea.setText(""); caption.clearMessage(); - DesignerLogImpl.getInstance().clear(); } }); caption.addSelectedListener(new ActionListener() { @@ -84,10 +84,6 @@ public class DesignerLogHandler { public void itemStateChanged(ItemEvent e) { logHandlerArea.jTextArea.setText(""); caption.clearMessage(); - LogRecordTimeProvider[] recorders = DesignerLogImpl.getInstance().getRecorders(); - for (LogRecordTimeProvider logRecordTime : recorders) { - logHandlerArea.printStackTrace(logRecordTime); - } } }; showInfo = new JCheckBoxMenuItem(Inter.getLocText(new String[]{"Display", "Normal", "Info"}), true); @@ -101,7 +97,7 @@ public class DesignerLogHandler { @Override public void actionPerformed(ActionEvent e) { JPopupMenu jPopupMenu = new JPopupMenu(); - + int logLevelInt = Log4jConfig.getInstance().getRootLevel().toInt(); if (logLevelInt <= INFO_INT) { jPopupMenu.add(showInfo); @@ -193,55 +189,52 @@ public class DesignerLogHandler { public void actionPerformed(ActionEvent evt) { resultPane.setText(""); caption.clearMessage(); - DesignerLogImpl.getInstance().clear(); } }); return resultPane; } - public void printStackTrace(LogRecordTimeProvider logRecordTime) { - LogRecord logRecord = logRecordTime.getLogRecord(); - Date date = logRecordTime.getDate(); - int logLevelvalue = logRecord.getLevel().intValue(); - if (logLevelvalue == INFO_INT && showInfo.isSelected()) { - printMessage(logRecord.getMessage(), logLevelvalue, date, logRecord.getThrown()); - } else if (logLevelvalue == ERROR_INT && showError.isSelected()) { - printMessage(logRecord.getMessage(), logLevelvalue, date, logRecord.getThrown()); - } else if (logLevelvalue == WARN_INT && showServer.isSelected()) { - printMessage(logRecord.getMessage(), logLevelvalue, date, logRecord.getThrown()); + public void printStackTrace(LoggingEvent event) { + int intLevel = event.getLevel().toInt(); + Date date = new Date(event.getTimeStamp()); + ThrowableInformation information = event.getThrowableInformation(); + if (intLevel == INFO_INT && showInfo.isSelected()) { + printMessage(event.getRenderedMessage(), intLevel, date, information == null ? null : information.getThrowable()); + } else if (intLevel == ERROR_INT && showError.isSelected()) { + printMessage(event.getRenderedMessage(), intLevel, date, information == null ? null : information.getThrowable()); + } else if (intLevel == WARN_INT && showServer.isSelected()) { + printMessage(event.getRenderedMessage(), intLevel, date, information == null ? null : information.getThrowable()); } - } public void printStackTrace(String message, Level level, Date date) { - int logLevelvalue = level.toInt(); - if (logLevelvalue == INFO_INT && showInfo.isSelected()) { - printMessage(message, logLevelvalue, date); - } else if (logLevelvalue == ERROR_INT && showError.isSelected()) { - printMessage(message, logLevelvalue, date); - } else if (logLevelvalue == WARN_INT && showServer.isSelected()) { - printMessage(message, logLevelvalue, date); + int intLevel = level.toInt(); + if (intLevel == INFO_INT && showInfo.isSelected()) { + printMessage(message, intLevel, date); + } else if (intLevel == ERROR_INT && showError.isSelected()) { + printMessage(message, intLevel, date); + } else if (intLevel == WARN_INT && showServer.isSelected()) { + printMessage(message, intLevel, date); } } - private void printMessage(String message, int logLevelvalue, Date date) { - printMessage(message, logLevelvalue, date, null); + private void printMessage(String message, int intLevel, Date date) { + printMessage(message, intLevel, date, null); } - private void printMessage(String messange, int logLevelvalue, Date date, Throwable e) { - SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - this.log(simpleDateFormat.format(date) + "\n", 0); - String message = swithInter(messange, logLevelvalue); - this.log(message, logLevelvalue); - setMessage(message, logLevelvalue); + private void printMessage(String msg, int intLevel, Date date, Throwable e) { + this.log(LOG_SIMPLE_DATE_FORMAT.format(date) + "\n", 0); + String message = appendLocaleMark(msg, intLevel); + this.log(message, intLevel); + setMessage(message, intLevel); if (e == null) { return; } - StackTraceElement[] stacktraceelement = e.getStackTrace(); - for (int i = 0; i < stacktraceelement.length; i++) { - this.log("\t" + "at " + stacktraceelement[i].toString() + "\n", 0); + StackTraceElement[] traceElements = e.getStackTrace(); + for (int i = 0; i < traceElements.length; i++) { + this.log("\t" + "at " + traceElements[i].toString() + "\n", 0); } } @@ -264,11 +257,11 @@ public class DesignerLogHandler { try { doc.insertString(doc.getLength(), str, attrSet); } catch (BadLocationException e) { - FRContext.getLogger().error(e.getMessage()); + FineLoggerFactory.getLogger().error(e.getMessage()); } } - private String swithInter(String str, int style) { + private String appendLocaleMark(String str, int style) { if (style == ERROR_INT) { str = Inter.getLocText("FR-Designer_Alert") + ":" + str + "\n"; } else if (style == WARN_INT) { @@ -318,14 +311,13 @@ public class DesignerLogHandler { } else if (ComparatorUtils.equals(evt.getActionCommand(), LogHandlerArea.this.clear.getText())) { LogHandlerArea.this.jTextArea.setText(""); caption.clearMessage(); - DesignerLogImpl.getInstance().clear(); } } }; } - public void printRemoteLog(LogRecordTime logRecordTime) { - logHandlerArea.printStackTrace(logRecordTime); + public void printLoggingEvent(LoggingEvent event) { + logHandlerArea.printStackTrace(event); } } \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/mainframe/loghandler/DesignerLogImpl.java b/designer-base/src/main/java/com/fr/design/mainframe/loghandler/DesignerLogImpl.java deleted file mode 100644 index 71009a296..000000000 --- a/designer-base/src/main/java/com/fr/design/mainframe/loghandler/DesignerLogImpl.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.fr.design.mainframe.loghandler; - -import com.fr.stable.fun.impl.AbstractLogProvider; -import com.fr.stable.xml.LogRecordTimeProvider; - -import java.util.ArrayList; -import java.util.List; - -/** - * Created by Administrator on 2016/1/11 0011. - */ -public class DesignerLogImpl extends AbstractLogProvider{ - - private static DesignerLogImpl instance = new DesignerLogImpl(); - - public static DesignerLogImpl getInstance(){ - return instance; - } - - private DesignerLogImpl(){ - - } - - private List records = new ArrayList(); - - /** - * 清除内存中的日志记录 - */ - public void clear(){ - records.clear(); - } - - /** - * 获取所有日志信息 - * - * @return 日志信息 - */ - public LogRecordTimeProvider[] getRecorders(){ - return records.toArray(new LogRecordTimeProvider[records.size()]); - } - - @Override - public void record(LogRecordTimeProvider logRecordTime) { - records.add(logRecordTime); - } -} \ No newline at end of file diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java b/designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java index 60631eded..772445695 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java @@ -4,24 +4,23 @@ import com.fr.config.RemoteConfigEvent; import com.fr.decision.webservice.utils.DecisionServiceConstants; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.loghandler.DesignerLogHandler; -import com.fr.workspace.server.socket.SocketInfoOperator; import com.fr.event.EventDispatcher; import com.fr.general.Inter; -import com.fr.general.LogRecordTime; -import com.fr.general.LogUtils; import com.fr.log.FineLoggerFactory; +import com.fr.serialization.SerializerHelper; +import com.fr.stable.ArrayUtils; +import com.fr.third.apache.log4j.spi.LoggingEvent; import com.fr.third.guava.base.Optional; import com.fr.workspace.WorkContext; import com.fr.workspace.Workspace; import com.fr.workspace.base.WorkspaceConstants; import com.fr.workspace.engine.server.rpc.netty.RemoteCallClient; +import com.fr.workspace.server.socket.SocketInfoOperator; import io.socket.client.IO; import io.socket.client.Socket; import io.socket.emitter.Emitter; -import javax.swing.JOptionPane; -import javax.swing.UIManager; -import java.io.ByteArrayInputStream; +import javax.swing.*; import java.io.IOException; import java.net.URI; import java.net.URL; @@ -33,13 +32,13 @@ public class DesignerSocketIO { private static final Emitter.Listener printLog = new Emitter.Listener() { @Override public void call(Object... objects) { - try { - LogRecordTime[] logRecordTimes = LogUtils.readXMLLogRecords(new ByteArrayInputStream((byte[]) objects[0])); - for (LogRecordTime logRecordTime : logRecordTimes) { - DesignerLogHandler.getInstance().printRemoteLog(logRecordTime); + if (ArrayUtils.isNotEmpty(objects)) { + try { + LoggingEvent event = SerializerHelper.deserialize((byte[]) objects[0]); + DesignerLogHandler.getInstance().printLoggingEvent(event); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); } - } catch (Exception e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); } } }; diff --git a/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java b/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java index 12a7e9c05..0b0563adb 100644 --- a/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java +++ b/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java @@ -48,7 +48,6 @@ import com.fr.design.mainframe.form.FormECDesignerProvider; import com.fr.design.mainframe.form.FormElementCaseDesigner; import com.fr.design.mainframe.form.FormReportComponentComposite; import com.fr.design.mainframe.loghandler.DesignerLogAppender; -import com.fr.design.mainframe.loghandler.DesignerLogImpl; import com.fr.design.mainframe.loghandler.LogMessageBar; import com.fr.design.mainframe.socketio.DesignerSocketIO; import com.fr.design.module.DesignModuleFactory; @@ -91,7 +90,6 @@ import com.fr.report.cell.painter.CellImagePainter; import com.fr.stable.ArrayUtils; import com.fr.stable.ParameterProvider; import com.fr.stable.bridge.StableFactory; -import com.fr.stable.fun.LogProvider; import com.fr.stable.plugin.ExtraDesignClassManagerProvider; import com.fr.stable.script.CalculatorProviderContext; import com.fr.stable.script.ValueConverter; @@ -100,7 +98,7 @@ import com.fr.stable.xml.ObjectXMLWriterFinder; import com.fr.start.BBSGuestPaneProvider; import com.fr.xml.ReportXMLUtils; -import java.awt.Image; +import java.awt.*; import java.awt.image.BufferedImage; import java.util.ArrayList; import java.util.List; @@ -165,7 +163,6 @@ public class DesignerActivator extends Activator implements Prepare { InformationCollector.getInstance().collectStartTime(); ExtraDesignClassManager.getInstance().getFeedback().didFeedback(); - StableFactory.registerMarkedObject(LogProvider.MARK_STRING, DesignerLogImpl.getInstance()); } private static void preLoadPane() { From 2f417d813c32af5bdf4982502d532138af3ff3ca Mon Sep 17 00:00:00 2001 From: hzzz Date: Wed, 18 Jul 2018 15:31:09 +0800 Subject: [PATCH 23/33] =?UTF-8?q?REPORT-9741=E3=80=9010.0=E4=BA=8C?= =?UTF-8?q?=E8=BD=AE=E5=9B=9E=E5=BD=92=E3=80=91=E8=AE=BE=E8=AE=A1=E5=99=A8?= =?UTF-8?q?=E8=8F=9C=E5=8D=95=E6=A0=8F-=E6=96=87=E4=BB=B6-=E5=88=87?= =?UTF-8?q?=E6=8D=A2=E8=87=B3=E8=BF=9C=E7=A8=8B=E6=9C=8D=E5=8A=A1=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/actions/file/SwitchExistEnv.java | 13 ++++++------- .../java/com/fr/design/mainframe/TemplatePane.java | 10 +++++----- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/actions/file/SwitchExistEnv.java b/designer-base/src/main/java/com/fr/design/actions/file/SwitchExistEnv.java index 356651d81..a3d940fc3 100644 --- a/designer-base/src/main/java/com/fr/design/actions/file/SwitchExistEnv.java +++ b/designer-base/src/main/java/com/fr/design/actions/file/SwitchExistEnv.java @@ -22,7 +22,8 @@ import com.fr.workspace.WorkContextCallback; import com.fr.workspace.Workspace; import com.fr.workspace.connect.AuthException; -import javax.swing.*; +import javax.swing.JOptionPane; +import javax.swing.UIManager; import java.awt.event.ActionEvent; import java.util.HashMap; import java.util.Iterator; @@ -108,9 +109,8 @@ public class SwitchExistEnv extends MenuDef { try { workspace = DesignerWorkspaceGenerator.generate(selectedEnv); if (workspace == null) { - JOptionPane.showMessageDialog( - DesignerContext.getDesignerFrame(), - Inter.getLocText(new String[]{"FR-Designer_M-SwitchWorkspace", "Failed"})); + JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText(new String[]{"FR-Designer_M-SwitchWorkspace", "Failed"}), + null, 0, UIManager.getIcon("OptionPane.errorIcon")); return; } WorkContext.switchTo(workspace, new WorkContextCallback() { @@ -125,9 +125,8 @@ public class SwitchExistEnv extends MenuDef { } }); } catch (AuthException exception) { - JOptionPane.showMessageDialog( - DesignerContext.getDesignerFrame(), - Inter.getLocText(new String[]{"Fine-Designer_Basic_Remote_Connect_Auth_Failed"})); + JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText(new String[]{"Fine-Designer_Basic_Remote_Connect_Auth_Failed", "Failed"}), + null, 0, UIManager.getIcon("OptionPane.errorIcon")); } } } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/TemplatePane.java b/designer-base/src/main/java/com/fr/design/mainframe/TemplatePane.java index 4b8272130..e9bdce267 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/TemplatePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/TemplatePane.java @@ -20,6 +20,7 @@ import com.fr.stable.EnvChangedListener; import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContextCallback; import com.fr.workspace.Workspace; +import com.fr.workspace.connect.AuthException; import javax.swing.*; import java.awt.*; @@ -135,9 +136,8 @@ public class TemplatePane extends JPanel implements MouseListener { try { Workspace workspace = DesignerWorkspaceGenerator.generate(selectedEnv); if (workspace == null) { - JOptionPane.showMessageDialog( - DesignerContext.getDesignerFrame(), - Inter.getLocText(new String[]{"FR-Designer_M-SwitchWorkspace", "Failed"})); + JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText(new String[]{"FR-Designer_M-SwitchWorkspace", "Failed"}), + null, 0, UIManager.getIcon("OptionPane.errorIcon")); return false; } WorkContext.switchTo(workspace, new WorkContextCallback() { @@ -152,8 +152,8 @@ public class TemplatePane extends JPanel implements MouseListener { template.refreshToolArea(); } setJLabel(selectedName); - } catch (Exception e) { - JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText(new String[]{"M-SwitchWorkspace", "Failed"}), + } catch (AuthException e) { + JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText(new String[]{"Fine-Designer_Basic_Remote_Connect_Auth_Failed", "Failed"}), null, 0, UIManager.getIcon("OptionPane.errorIcon")); return false; } From d3d20ab7230dcbda4c411160308e196d7a321a33 Mon Sep 17 00:00:00 2001 From: hzzz Date: Wed, 18 Jul 2018 15:44:24 +0800 Subject: [PATCH 24/33] =?UTF-8?q?REPORT-9706=20=E5=9C=A8=E8=BF=9C=E7=A8=8B?= =?UTF-8?q?=E7=8E=AF=E5=A2=83=E4=B8=8B=EF=BC=8C=E5=88=87=E6=8D=A2=E6=88=90?= =?UTF-8?q?=E6=9C=AC=E5=9C=B0=E7=9A=84=E6=97=B6=E5=80=99=E5=BC=B9=E5=87=BA?= =?UTF-8?q?=E4=B8=80=E4=B8=AA=E9=94=99=E8=AF=AF=E6=8F=90=E7=A4=BA=E6=A1=86?= =?UTF-8?q?=E5=91=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/mainframe/socketio/DesignerSocketIO.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java b/designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java index e8f6406ac..62b4e1686 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java @@ -56,7 +56,6 @@ public class DesignerSocketIO { status = Status.Disconnecting; socketIO.get().close(); socketIO = Optional.absent(); - status = Status.Disconnected; } } @@ -83,8 +82,8 @@ public class DesignerSocketIO { if (status != Status.Disconnecting) { JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText(new String[]{"Fine-Designer_Basic_Remote_Disconnected"}), null, 0, UIManager.getIcon("OptionPane.errorIcon")); - status = Status.Disconnected; } + status = Status.Disconnected; } }); socketIO.get().connect(); From 3b2abacbd144e1aa15e3bf05a1b250f35cfac70f Mon Sep 17 00:00:00 2001 From: "Mata.Li" Date: Wed, 18 Jul 2018 15:48:37 +0800 Subject: [PATCH 25/33] REPORT-9619 --- .../src/main/java/com/fr/start/module/DesignerStartup.java | 7 +++++-- .../com/fr/start/module/DesignerWorkspaceProvider.java | 4 ---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/start/module/DesignerStartup.java b/designer-realize/src/main/java/com/fr/start/module/DesignerStartup.java index 35e51ff8b..b5155bd91 100644 --- a/designer-realize/src/main/java/com/fr/start/module/DesignerStartup.java +++ b/designer-realize/src/main/java/com/fr/start/module/DesignerStartup.java @@ -31,10 +31,13 @@ public class DesignerStartup extends Activator { startSub(BasicActivator.class); final String[] args = getModule().upFindSingleton(StartupArgs.class).get(); final Designer designer = new Designer(args); + + getRoot().setSingleton(EnvSwitcher.class, new EnvSwitcher()); + //设置好环境即可,具体跟环境有关的模块会自动调用 + getRoot().getSingleton(EnvSwitcher.class).switch2LastEnv(); //启动env - startSub(DesignerWorkspaceProvider.class); startSub(EnvBasedModule.class); - getRoot().getSingleton(EnvSwitcher.class).switch2LastEnv(); + startSub(DesignerWorkspaceProvider.class); ExecutorService service = Executors.newSingleThreadExecutor(); registerEnvListener(); service.submit(new Runnable() { diff --git a/designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceProvider.java b/designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceProvider.java index 3a2229229..cab3868fb 100644 --- a/designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceProvider.java +++ b/designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceProvider.java @@ -27,10 +27,6 @@ public class DesignerWorkspaceProvider extends Activator { } } } - - getRoot().setSingleton(EnvSwitcher.class, new EnvSwitcher()); - //设置好环境即可,具体跟环境有关的模块会自动调用 - getRoot().getSingleton(EnvSwitcher.class).switch2LastEnv(); } From 119b48d47dc975aa8cc152637f20b88719db0efc Mon Sep 17 00:00:00 2001 From: "Mata.Li" Date: Wed, 18 Jul 2018 16:02:03 +0800 Subject: [PATCH 26/33] REPORT-9619 --- .../src/main/java/com/fr/start/module/DesignerStartup.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/start/module/DesignerStartup.java b/designer-realize/src/main/java/com/fr/start/module/DesignerStartup.java index b5155bd91..5f9ec707c 100644 --- a/designer-realize/src/main/java/com/fr/start/module/DesignerStartup.java +++ b/designer-realize/src/main/java/com/fr/start/module/DesignerStartup.java @@ -32,9 +32,10 @@ public class DesignerStartup extends Activator { final String[] args = getModule().upFindSingleton(StartupArgs.class).get(); final Designer designer = new Designer(args); - getRoot().setSingleton(EnvSwitcher.class, new EnvSwitcher()); + EnvSwitcher switcher = new EnvSwitcher(); //设置好环境即可,具体跟环境有关的模块会自动调用 - getRoot().getSingleton(EnvSwitcher.class).switch2LastEnv(); + switcher.switch2LastEnv(); + getRoot().setSingleton(EnvSwitcher.class, switcher); //启动env startSub(EnvBasedModule.class); startSub(DesignerWorkspaceProvider.class); From a8356767abb6ad8d8ac0a234246f30ef419671ad Mon Sep 17 00:00:00 2001 From: "Mata.Li" Date: Wed, 18 Jul 2018 16:25:12 +0800 Subject: [PATCH 27/33] REPORT-9619 --- .../com/fr/start/module/DesignerStartup.java | 20 +++++++++++++------ .../module/DesignerWorkspaceProvider.java | 19 ++++++------------ 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/start/module/DesignerStartup.java b/designer-realize/src/main/java/com/fr/start/module/DesignerStartup.java index 5f9ec707c..9d684a821 100644 --- a/designer-realize/src/main/java/com/fr/start/module/DesignerStartup.java +++ b/designer-realize/src/main/java/com/fr/start/module/DesignerStartup.java @@ -1,14 +1,16 @@ package com.fr.start.module; +import com.fr.design.DesignerEnvManager; import com.fr.design.mainframe.DesignerContext; import com.fr.event.Event; import com.fr.event.Listener; +import com.fr.general.ComparatorUtils; import com.fr.module.Activator; import com.fr.record.analyzer.EnableMetrics; import com.fr.record.analyzer.Metrics; import com.fr.start.Designer; -import com.fr.start.EnvSwitcher; +import com.fr.start.ServerStarter; import com.fr.start.SplashContext; import com.fr.startup.activators.BasicActivator; import com.fr.workspace.Workspace; @@ -32,13 +34,19 @@ public class DesignerStartup extends Activator { final String[] args = getModule().upFindSingleton(StartupArgs.class).get(); final Designer designer = new Designer(args); - EnvSwitcher switcher = new EnvSwitcher(); - //设置好环境即可,具体跟环境有关的模块会自动调用 - switcher.switch2LastEnv(); - getRoot().setSingleton(EnvSwitcher.class, switcher); + startSub(DesignerWorkspaceProvider.class); //启动env startSub(EnvBasedModule.class); - startSub(DesignerWorkspaceProvider.class); + + if (args != null) { + for (String arg : args) { + if (ComparatorUtils.equals(arg, "demo")) { + DesignerEnvManager.getEnvManager().setCurrentEnv2Default(); + ServerStarter.browserDemoURL(); + break; + } + } + } ExecutorService service = Executors.newSingleThreadExecutor(); registerEnvListener(); service.submit(new Runnable() { diff --git a/designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceProvider.java b/designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceProvider.java index cab3868fb..bd8159c6d 100644 --- a/designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceProvider.java +++ b/designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceProvider.java @@ -1,10 +1,9 @@ package com.fr.start.module; import com.fr.design.DesignerEnvManager; -import com.fr.general.ComparatorUtils; + import com.fr.module.Activator; import com.fr.start.EnvSwitcher; -import com.fr.start.ServerStarter; /** * Created by juhaoyu on 2018/1/8. @@ -16,17 +15,11 @@ public class DesignerWorkspaceProvider extends Activator { public void start() { //检查环境 DesignerEnvManager.checkNameEnvMap(); - - String[] args = getModule().upFindSingleton(StartupArgs.class).get(); - if (args != null) { - for (String arg : args) { - if (ComparatorUtils.equals(arg, "demo")) { - DesignerEnvManager.getEnvManager().setCurrentEnv2Default(); - ServerStarter.browserDemoURL(); - break; - } - } - } + + EnvSwitcher switcher = new EnvSwitcher(); + //设置好环境即可,具体跟环境有关的模块会自动调用 + switcher.switch2LastEnv(); + getRoot().setSingleton(EnvSwitcher.class, switcher); } From 3c908ba98563d184b37b9018d48a8a43b363775b Mon Sep 17 00:00:00 2001 From: XiaXiang Date: Wed, 18 Jul 2018 16:27:45 +0800 Subject: [PATCH 28/33] =?UTF-8?q?rtREPORT-9747=20=E3=80=9010.0=E4=BA=8C?= =?UTF-8?q?=E8=BD=AE=E5=9B=9E=E5=BD=92=E3=80=91=E4=BF=AE=E6=94=B9=E4=BB=A5?= =?UTF-8?q?=E5=89=8D=E7=9A=84=E6=A8=A1=E6=9D=BF=E6=97=A0=E6=B3=95=E6=9B=B4?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/mainframe/alphafine/cell/model/FileModel.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/model/FileModel.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/model/FileModel.java index 70d55b872..377c2c8eb 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/model/FileModel.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/model/FileModel.java @@ -22,8 +22,8 @@ public class FileModel extends AlphaCellModel { public FileModel(String name, String filePath) { super(name, null, CellType.FILE); - this.filePath = filePath; - setDescription(AlphaFineHelper.findFolderName(filePath)); + this.filePath = filePath.replaceAll("\\\\", "/"); + setDescription(AlphaFineHelper.findFolderName(this.filePath)); } public String getFilePath() { From 481aaab9ba6e579e854c77bb2e4baf38b5768879 Mon Sep 17 00:00:00 2001 From: hzzz Date: Wed, 18 Jul 2018 16:28:05 +0800 Subject: [PATCH 29/33] =?UTF-8?q?REPORT-9388=20=E8=BF=9C=E7=A8=8B=E8=AE=BE?= =?UTF-8?q?=E8=AE=A1=E9=87=8D=E6=9E=84-=E8=AE=BE=E8=AE=A1=E5=99=A8?= =?UTF-8?q?=E7=9B=AE=E5=BD=95=E6=A0=91-=E5=B7=A5=E5=85=B7=E6=A0=8F-10.0?= =?UTF-8?q?=E8=BF=9C=E7=A8=8B=E4=B8=8B=E6=AF=949.0=E5=A4=9A=E5=87=BA?= =?UTF-8?q?=E4=B8=A4=E4=B8=AA=E5=B7=A5=E5=85=B7=E6=A0=8F=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DesignerFrameFileDealerPane.java | 262 +++++++++--------- 1 file changed, 133 insertions(+), 129 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java index fddf359c5..acaa2850b 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java @@ -36,6 +36,7 @@ import com.fr.io.utils.ResourceIOUtils; import com.fr.stable.CoreConstants; import com.fr.stable.StableUtils; import com.fr.stable.project.ProjectConstants; +import com.fr.workspace.WorkContext; import javax.swing.*; import javax.swing.event.DocumentEvent; @@ -50,35 +51,35 @@ import java.util.Map; import java.util.Set; public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarStateChangeListener, ResponseDataSourceChange { - + private static final String FILE = "file"; - + private static volatile DesignerFrameFileDealerPane THIS; - + private CardLayout card; - + private JPanel cardPane; - + private FileOperations selectedOperation; - + private UIToolbar toolBar; - + private OpenReportAction openReportAction = new OpenReportAction(); - + private RefreshTreeAction refreshTreeAction = new RefreshTreeAction(); - + private OpenFolderAction openFolderAction = new OpenFolderAction(); - + private RenameAction renameAction = new RenameAction(); - + private DelFileAction delFileAction = new DelFileAction(); - - + + /** * 刷新 */ public void refresh() { - + selectedOperation.refresh(); } @@ -93,9 +94,9 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt } return THIS; } - + private DesignerFrameFileDealerPane() { - + setLayout(new BorderLayout()); toolBar = ToolBarDef.createJToolBar(); toolBar.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, UIConstants.TOOLBAR_BORDER_COLOR)); @@ -106,23 +107,23 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt parent.setBorder(BorderFactory.createEmptyBorder(3, 0, 4, 0)); tooBarPane.add(parent, BorderLayout.CENTER); tooBarPane.add(new UIMenuHighLight(), BorderLayout.SOUTH); - + add(tooBarPane, BorderLayout.NORTH); cardPane = new JPanel(card = new CardLayout()); cardPane.add(TemplateTreePane.getInstance(), FILE); - + selectedOperation = TemplateTreePane.getInstance(); card.show(cardPane, FILE); - + TemplateTreePane.getInstance().setToobarStateChangeListener(this); - + add(cardPane, BorderLayout.CENTER); stateChange(); } - - + + public final void setCurrentEditingTemplate(JTemplate jt) { - + DesignModelAdapter.setCurrentModelAdapter(jt == null ? null : jt.getModel()); fireDSChanged(); TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()); @@ -132,37 +133,40 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt if (BaseUtils.isAuthorityEditing()) { RolesAlreadyEditedPane.getInstance().refreshDockingView(); } - + jt.setComposite(); jt.refreshToolArea(); jt.fireJTemplateOpened(); jt.requestFocus(); jt.revert(); - + FRContext.getLogger().info("\"" + jt.getEditingFILE().getName() + "\"" + Inter.getLocText("LOG-Has_Been_Openned") + "!"); } - + /** * 刷新菜单 */ public void refreshDockingView() { - + ToolBarDef toolbarDef = new ToolBarDef(); toolbarDef.addShortCut(openReportAction, refreshTreeAction); - toolbarDef.addShortCut(openFolderAction, renameAction); + if (WorkContext.getCurrent().isLocal()) { + toolbarDef.addShortCut(openFolderAction, renameAction); + } toolbarDef.addShortCut(delFileAction); Set extraShortCuts = ExtraDesignClassManager.getInstance().getExtraShortCuts(); for (ShortCut shortCut : extraShortCuts) { toolbarDef.addShortCut(shortCut); } - + toolbarDef.updateToolBar(toolBar); refreshActions(); + refresh(); } - - + + private void refreshActions() { - + openReportAction.setEnabled(false); refreshTreeAction.setEnabled(true); openFolderAction.setEnabled(false); @@ -170,123 +174,123 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt delFileAction.setEnabled(false); this.repaint(); } - + /** * 响应数据集改变 */ public void fireDSChanged() { - + fireDSChanged(new HashMap()); } - + /** * 响应数据集改变 * * @param map 改变名字的数据集 */ public void fireDSChanged(Map map) { - + DesignTableDataManager.fireDSChanged(map); } - - + + /* * Open Report Action */ private class OpenReportAction extends UpdateAction { - + public OpenReportAction() { - + this.setName(KeySetUtils.OPEN_TEMPLATE.getMenuKeySetName()); this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/buttonicon/open.png")); } - + @Override public void actionPerformed(ActionEvent evt) { - + selectedOperation.openSelectedReport(); } - + } - + private class OpenFolderAction extends UpdateAction { - + public OpenFolderAction() { - + this.setName(Inter.getLocText("FR-Designer_Show_in_Containing_Folder")); this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_file/view_folder.png")); } - + @Override public void actionPerformed(ActionEvent evt) { - + selectedOperation.openContainerFolder(); } } - + /* * 刷新ReportletsTree */ private class RefreshTreeAction extends UpdateAction { - + public RefreshTreeAction() { - + this.setName(Inter.getLocText("FR-Designer_Refresh")); this.setSmallIcon(UIConstants.REFRESH_ICON); } - + @Override public void actionPerformed(ActionEvent evt) { - + selectedOperation.refresh(); stateChange(); } } - + /* * 重命名文件 */ private class RenameAction extends UpdateAction { - + public RenameAction() { - + this.setName(Inter.getLocText("FR-Designer_Rename")); this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/data/source/rename.png")); } - + @Override public void actionPerformed(ActionEvent evt) { - + new RenameDialog(); MutilTempalteTabPane.getInstance().repaint(); } - + } - + /* * 删除指定文件 */ private class DelFileAction extends UpdateAction { - + public DelFileAction() { - + this.setName(Inter.getLocText("FR-Designer_Remove")); this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/data/source/delete.png")); } - + @Override public void actionPerformed(ActionEvent evt) { - + selectedOperation.deleteFile(); } } - + /** * 按钮状态改变 */ @Override public void stateChange() { - + if (selectedOperation.getSelectedTemplatePath() != null) { openReportAction.setEnabled(true); renameAction.setEnabled(true); @@ -297,7 +301,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt delFileAction.setEnabled(false); } openFolderAction.setEnabled(containsFolderNums() + seletedTemplateNums() != 0); - + refreshTreeAction.setEnabled(true); if (containsFolderNums() > 0 && (containsFolderNums() + seletedTemplateNums() > 1)) { refreshActions(); @@ -308,22 +312,22 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt renameAction.setEnabled(false); delFileAction.setEnabled(true); } - + } - + /** * 是否包含文件夹 * * @return */ - + private int containsFolderNums() { - + TemplateFileTree fileTree = TemplateTreePane.getInstance().getTemplateFileTree(); if (fileTree.getSelectionPaths() == null) { return 0; } - + //选择的包含文件和文件夹的数目 if (fileTree.getSelectionPaths().length == 0) { return 0; @@ -331,53 +335,53 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt //所有的num减去模板的num,得到文件夹的num return fileTree.getSelectionPaths().length - fileTree.getSelectedTemplatePaths().length; } - + /** * 是否选择了多个模板 * * @return */ private int seletedTemplateNums() { - + TemplateFileTree fileTree = TemplateTreePane.getInstance().getTemplateFileTree(); if (fileTree.getSelectionPaths() == null) { return 0; } - + return fileTree.getSelectedTemplatePaths().length; } - - + + // js: 重命名对话框,模仿Eclipse的重命名,支持快捷键F2,Enter,ESC private class RenameDialog { - + private UITextField jt; - + private String userInput; - + private String oldName; - + private UILabel hintsLabel; - + private UIButton confirmButton; - + private JDialog jd; - + private String suffix; - + public RenameDialog() { - + final String reportPath = selectedOperation.getSelectedTemplatePath(); if (reportPath == null) { return; } - + final FileNodeFILE nodeFile = new FileNodeFILE(new FileNode(StableUtils.pathJoin(ProjectConstants.REPORTLETS_NAME, reportPath), false)); final String path = nodeFile.getPath(); oldName = nodeFile.getName(); suffix = oldName.substring(oldName.lastIndexOf(CoreConstants.DOT), oldName.length()); oldName = oldName.replaceAll(suffix, ""); - + jd = new JDialog(); jd.setLayout(new GridLayout(2, 2)); jd.setModal(true); @@ -388,14 +392,14 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt jt.getDocument().addDocumentListener(getdoDocumentListener()); jt.selectAll(); jt.setPreferredSize(new Dimension(150, 20)); - + JPanel newNamePanel = new JPanel(); newNamePanel.setLayout(new BoxLayout(newNamePanel, BoxLayout.X_AXIS)); newNamePanel.add(Box.createHorizontalGlue()); newNamePanel.add(newNameLabel); newNamePanel.add(Box.createHorizontalStrut(5)); jd.add(newNamePanel); - + JPanel jtPanel = new JPanel(); jtPanel.setLayout(new BoxLayout(jtPanel, BoxLayout.Y_AXIS)); JPanel containJt = new JPanel(new BorderLayout()); @@ -405,46 +409,46 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt jtPanel.add(containJt); jtPanel.add(Box.createVerticalGlue()); jd.add(jtPanel); - + addUITextFieldListener(nodeFile, path); - + hintsLabel = new UILabel(); hintsLabel.setBounds(20, 50, 250, 30); hintsLabel.setMaximumSize(new Dimension(200, 30)); hintsLabel.setHorizontalAlignment(SwingConstants.RIGHT); hintsLabel.setForeground(Color.RED); hintsLabel.setVisible(false); - + confirmButton = new UIButton(Inter.getLocText("FR-Designer_Confirm")); confirmButton.setPreferredSize(new Dimension(80, 25)); confirmButton.setMinimumSize(new Dimension(80, 25)); confirmButton.setMaximumSize(new Dimension(80, 25)); confirmButton.addActionListener(new ActionListener() { - + public void actionPerformed(ActionEvent e) { - + confirmClose(nodeFile, path); } }); - + UIButton cancelButton = new UIButton(Inter.getLocText("FR-Designer_Cancel")); cancelButton.setPreferredSize(new Dimension(80, 25)); cancelButton.setMinimumSize(new Dimension(80, 25)); cancelButton.setMaximumSize(new Dimension(80, 25)); - + cancelButton.addActionListener(new ActionListener() { - + public void actionPerformed(ActionEvent e) { - + jd.dispose(); } }); - + JPanel hintsPanel = new JPanel(); hintsPanel.setLayout(new BorderLayout()); hintsPanel.add(hintsLabel, BorderLayout.EAST); jd.add(hintsLabel); - + JPanel btPanel = new JPanel(new BorderLayout()); btPanel.setLayout(new BoxLayout(btPanel, BoxLayout.X_AXIS)); btPanel.add(Box.createHorizontalGlue()); @@ -453,7 +457,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt btPanel.add(cancelButton); btPanel.add(Box.createHorizontalStrut(20)); jd.add(btPanel); - + jd.setSize(380, 200); jd.setTitle(Inter.getLocText("FR-Designer_Rename")); jd.setResizable(false); @@ -463,24 +467,24 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt GUICoreUtils.centerWindow(jd); jd.setVisible(true); } - + public void confirmClose(FileNodeFILE nodeFile, String path) { - + userInput = userInput == null ? oldName : userInput; String oldPath = path.replaceAll("/", "\\\\"); String newPath = path.replace(nodeFile.getName(), userInput + suffix); renameTemplateInMemory(nodeFile, userInput + suffix, oldName + suffix); DesignerEnvManager.getEnvManager().replaceRecentOpenedFilePath(oldPath, newPath.replaceAll("/", "\\\\")); - + //模版重命名 ResourceIOUtils.renameTo(path, newPath); selectedOperation.refresh(); DesignerContext.getDesignerFrame().setTitle(); jd.dispose(); } - + private void renameTemplateInMemory(FILE tplFile, String newName, String oldName) { - + JTemplate dPane = getSpecialTemplateByFILE(tplFile); if (dPane == null) { return; @@ -488,24 +492,24 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt FILE renameFile = dPane.getEditingFILE(); renameFile.setPath(renameFile.getPath().replace(oldName, newName)); } - + // 增加enter以及esc快捷键的支持 public void addUITextFieldListener(final FileNodeFILE nodeFile, final String path) { - + jt.addKeyListener(new KeyAdapter() { - + public void keyPressed(KeyEvent e) { - + if (e.getKeyCode() == KeyEvent.VK_ESCAPE) { jd.dispose(); } } }); - + jt.addKeyListener(new KeyAdapter() { - + public void keyPressed(KeyEvent e) { - + if (e.getKeyCode() == KeyEvent.VK_ENTER) { if (confirmButton.isEnabled()) { confirmClose(nodeFile, path); @@ -513,35 +517,35 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt } } }); - + } - + // UITextField的输入监听 public DocumentListener getdoDocumentListener() { - + DocumentListener dl = new DocumentListener() { - + public void changedUpdate(DocumentEvent e) { - + isNameAlreadyExist(); } - + public void insertUpdate(DocumentEvent e) { - + isNameAlreadyExist(); } - + public void removeUpdate(DocumentEvent e) { - + isNameAlreadyExist(); } }; - + return dl; } - + private void isNameAlreadyExist() { - + userInput = jt.getText().trim(); if (selectedOperation.isNameAlreadyExist(userInput, oldName, suffix)) { jt.selectAll(); @@ -555,13 +559,13 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt } } } - + /** * @param tplFile * @return 内存中的template重命名一下 */ private JTemplate getSpecialTemplateByFILE(FILE tplFile) { - + HistoryTemplateListPane historyHandle = HistoryTemplateListPane.getInstance(); if (ComparatorUtils.equals(historyHandle.getCurrentEditingTemplate().getEditingFILE(), tplFile)) { return historyHandle.getCurrentEditingTemplate(); @@ -573,5 +577,5 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt } return null; } - + } \ No newline at end of file From db41d2f32e0d010850e4faf9edf7ba15bc49530c Mon Sep 17 00:00:00 2001 From: richie Date: Wed, 18 Jul 2018 17:21:23 +0800 Subject: [PATCH 30/33] =?UTF-8?q?CORE-113=20=E6=8F=90=E4=BE=9B=E8=87=AA?= =?UTF-8?q?=E5=AE=9A=E4=B9=89AOP=E6=B3=A8=E8=A7=A3=E7=9A=84=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=EF=BC=8C=E5=8F=AF=E4=BB=A5=E5=9C=A8=E5=90=84=E4=B8=AA?= =?UTF-8?q?=E6=A8=A1=E5=9D=97=E8=87=AA=E8=A1=8C=E5=AE=9A=E4=B9=89=E6=96=B9?= =?UTF-8?q?=E4=BE=BF=E6=97=A5=E5=BF=97=E8=AE=B0=E5=BD=95=EF=BC=8C=E6=96=87?= =?UTF-8?q?=E6=A1=A3=E7=A8=8D=E5=90=8E=E8=A1=A5=E5=85=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/start/Designer.java | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/start/Designer.java b/designer-realize/src/main/java/com/fr/start/Designer.java index 1088f5fdc..880a7182b 100644 --- a/designer-realize/src/main/java/com/fr/start/Designer.java +++ b/designer-realize/src/main/java/com/fr/start/Designer.java @@ -42,7 +42,6 @@ import com.fr.general.ComparatorUtils; import com.fr.general.Inter; import com.fr.module.Module; import com.fr.module.ModuleContext; -import com.fr.record.analyzer.FineAnalyzer; import com.fr.stable.BuildContext; import com.fr.stable.OperatingSystem; import com.fr.stable.ProductConstants; @@ -56,14 +55,9 @@ import com.fr.start.preload.ImagePreLoader; import com.fr.start.server.ServerTray; import com.fr.workspace.WorkContext; -import javax.swing.JComponent; -import javax.swing.JPanel; +import javax.swing.*; import javax.swing.border.MatteBorder; -import java.awt.Component; -import java.awt.Cursor; -import java.awt.Dimension; -import java.awt.FlowLayout; -import java.awt.Insets; +import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.File; @@ -96,8 +90,6 @@ public class Designer extends BaseDesigner { */ public static void main(String[] args) { - FineAnalyzer.init(); - BuildContext.setBuildFilePath("/com/fr/stable/build.properties"); @@ -197,7 +189,7 @@ public class Designer extends BaseDesigner { if (!BaseUtils.isAuthorityEditing()) { menuDef.addShortCut(SeparatorDef.DEFAULT); - + if (WorkContext.getCurrent().isRoot()) { menuDef.addShortCut(new ServerConfigManagerAction(), new StyleListAction(), new WidgetManagerAction()); if (ActionFactory.getChartPreStyleAction() != null) { From 57ff79348ff3c633a671a5322ecd4e887743bdfc Mon Sep 17 00:00:00 2001 From: "abel.chen" Date: Thu, 19 Jul 2018 09:35:39 +0800 Subject: [PATCH 31/33] =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E5=99=A8=E5=90=AF?= =?UTF-8?q?=E5=8A=A8=E6=8D=95=E8=8E=B7LifecycleFatalError=EF=BC=8C?= =?UTF-8?q?=E8=BF=9B=E7=A8=8B=E9=80=80=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer-realize/src/main/java/com/fr/start/Designer.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/designer-realize/src/main/java/com/fr/start/Designer.java b/designer-realize/src/main/java/com/fr/start/Designer.java index 880a7182b..d0b1da68f 100644 --- a/designer-realize/src/main/java/com/fr/start/Designer.java +++ b/designer-realize/src/main/java/com/fr/start/Designer.java @@ -47,6 +47,7 @@ import com.fr.stable.OperatingSystem; import com.fr.stable.ProductConstants; import com.fr.stable.StableUtils; import com.fr.stable.StringUtils; +import com.fr.stable.lifecycle.LifecycleFatalError; import com.fr.stable.xml.XMLTools; import com.fr.start.fx.SplashFx; import com.fr.start.jni.SplashMac; @@ -107,7 +108,11 @@ public class Designer extends BaseDesigner { Module designerRoot = ModuleContext.parseRoot("designer-startup.xml"); //传递启动参数 designerRoot.setSingleton(StartupArgs.class, new StartupArgs(args)); - designerRoot.start(); + try { + designerRoot.start(); + } catch (LifecycleFatalError fatal) { + System.exit(0); + } if (WorkContext.getCurrent().isLocal()) { //初始化一下serverTray From dba933367ed73010841f032723018b06f7dfe4eb Mon Sep 17 00:00:00 2001 From: richie Date: Thu, 19 Jul 2018 09:54:37 +0800 Subject: [PATCH 32/33] =?UTF-8?q?CORE-116=20=E8=BF=9B=E4=B8=80=E6=AD=A5?= =?UTF-8?q?=E6=95=B4=E7=90=86Session=E7=AE=A1=E7=90=86=E9=97=AE=E9=A2=98&?= =?UTF-8?q?=E5=8D=95=E5=85=83=E6=B5=8B=E8=AF=95=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/mainframe/errorinfo/ErrorInfoLogAppender.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/errorinfo/ErrorInfoLogAppender.java b/designer-realize/src/main/java/com/fr/design/mainframe/errorinfo/ErrorInfoLogAppender.java index 46efc1581..e3a953277 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/errorinfo/ErrorInfoLogAppender.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/errorinfo/ErrorInfoLogAppender.java @@ -107,7 +107,7 @@ public class ErrorInfoLogAppender extends AppenderSkeleton { return StringUtils.EMPTY; } - String bookPath = infor.getBookPath(); + String bookPath = infor.getRelativePath(); // 这个iofile只读一个templateid, 其他以后有需要再读. IOFile file = new IOFile() { @Override From 1f10444b20ecfe83b53b0916dfa7730a3ebee0fa Mon Sep 17 00:00:00 2001 From: zheng Date: Thu, 19 Jul 2018 11:30:09 +0800 Subject: [PATCH 33/33] =?UTF-8?q?=E9=85=8D=E8=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/module/ChartPreFillStylePane.java | 21 +++---- .../module/ChartPreStyleManagerPane.java | 55 +++++++++---------- .../fr/design/module/ChartPreStylePane.java | 1 - 3 files changed, 34 insertions(+), 43 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/design/module/ChartPreFillStylePane.java b/designer-chart/src/main/java/com/fr/design/module/ChartPreFillStylePane.java index 3d29a56da..0d27409a4 100644 --- a/designer-chart/src/main/java/com/fr/design/module/ChartPreFillStylePane.java +++ b/designer-chart/src/main/java/com/fr/design/module/ChartPreFillStylePane.java @@ -1,13 +1,13 @@ -package com.fr.design.mainframe.chart.gui.style; +package com.fr.design.module; import com.fr.base.ChartColorMatching; -import com.fr.chart.base.ChartConstants; import com.fr.design.beans.BasicBeanPane; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.mainframe.chart.gui.style.ChartAccColorPane; import com.fr.design.style.background.gradient.FixedGradientBar; import com.fr.general.Inter; @@ -21,7 +21,6 @@ import java.awt.FlowLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; @@ -41,8 +40,6 @@ public class ChartPreFillStylePane extends BasicBeanPane { private ChartAccColorPane colorAcc; private FixedGradientBar colorGradient; - private ChartColorMatching chartColorMatching; - public ChartPreFillStylePane() { initComponents(); @@ -70,6 +67,8 @@ public class ChartPreFillStylePane extends BasicBeanPane { customPane.setPreferredSize(new Dimension(200, 200)); colorGradient.setPreferredSize(new Dimension(120, 30)); + colorGradient.getSelectColorPointBtnP1().setColorInner(Color.WHITE); + colorGradient.getSelectColorPointBtnP2().setColorInner(Color.black); double p = TableLayout.PREFERRED; double[] columnSize = {p, p}; @@ -110,12 +109,6 @@ public class ChartPreFillStylePane extends BasicBeanPane { } public void populateBean(ChartColorMatching condition) { - chartColorMatching = condition; - - colorGradient.getSelectColorPointBtnP1().setColorInner(Color.WHITE); - colorGradient.getSelectColorPointBtnP2().setColorInner(Color.black); - colorAcc.populateBean(ChartConstants.CHART_COLOR_ARRAY); - if (condition == null) { return; } @@ -145,7 +138,7 @@ public class ChartPreFillStylePane extends BasicBeanPane { @Override public ChartColorMatching updateBean() { - chartColorMatching = chartColorMatching == null ? new ChartColorMatching() : chartColorMatching; + ChartColorMatching chartColorMatching = new ChartColorMatching(); List colorList = new ArrayList(); @@ -160,7 +153,9 @@ public class ChartPreFillStylePane extends BasicBeanPane { chartColorMatching.setGradient(false); Color[] colors = colorAcc.updateBean(); - colorList = Arrays.asList(colors); + for(Color color : colors) { + colorList.add(color); + } } chartColorMatching.setColorList(colorList); diff --git a/designer-chart/src/main/java/com/fr/design/module/ChartPreStyleManagerPane.java b/designer-chart/src/main/java/com/fr/design/module/ChartPreStyleManagerPane.java index 573420983..e77d17594 100644 --- a/designer-chart/src/main/java/com/fr/design/module/ChartPreStyleManagerPane.java +++ b/designer-chart/src/main/java/com/fr/design/module/ChartPreStyleManagerPane.java @@ -3,6 +3,7 @@ package com.fr.design.module; import com.fr.base.ChartColorMatching; import com.fr.base.ChartPreStyleConfig; import com.fr.base.Utils; +import com.fr.config.Configuration; import com.fr.design.gui.controlpane.JListControlPane; import com.fr.design.gui.controlpane.NameObjectCreator; import com.fr.design.gui.controlpane.NameableCreator; @@ -11,10 +12,11 @@ import com.fr.design.mainframe.DesignerFrame; import com.fr.general.Inter; import com.fr.general.NameObject; import com.fr.stable.Nameable; +import com.fr.transaction.Configurations; +import com.fr.transaction.Worker; import java.util.ArrayList; import java.util.Iterator; -import java.util.LinkedHashMap; /** @@ -36,22 +38,13 @@ public class ChartPreStyleManagerPane extends JListControlPane { }; } - @Override - public void addNameable(Nameable nameable, int index) { - super.addNameable(nameable, index); - if (!ChartPreStyleConfig.getInstance().containsName(nameable.getName())) { - ChartPreStyleConfig.getInstance().putPreStyle(nameable.getName(), ((NameObject) nameable).getObject()); - } - } - @Override protected String title4PopupWindow() { return Inter.getLocText("FR-Designer_Chart-PreStyle"); } public void populateBean() { - ChartPreStyleConfig config = ChartPreStyleConfig.getInstance(); - + ChartPreStyleConfig config = ChartPreStyleConfig.getInstance().mirror(); ArrayList list = new ArrayList(); Iterator keys = config.names(); @@ -71,29 +64,33 @@ public class ChartPreStyleManagerPane extends JListControlPane { } public void updateBean() { - ChartPreStyleConfig config = ChartPreStyleConfig.getInstance(); + Configurations.update(new Worker() { + @Override + public void run() { + ChartPreStyleConfig config = ChartPreStyleConfig.getInstance(); - config.setCurrentStyle(getSelectedName()); + config.setCurrentStyle(getSelectedName()); - Nameable[] values = this.update(); - config.setPreStyleMap(new LinkedHashMap()); + Nameable[] values = update(); + config.clearAllPreStyle(); - for(int i = 0; i < values.length; i++) { - Nameable value = values[i]; - ChartColorMatching chartColorMatching = (ChartColorMatching) ((NameObject) value).getObject(); - try { - chartColorMatching = (ChartColorMatching) chartColorMatching.clone(); - } catch (CloneNotSupportedException e) { - //do nothing + for(Nameable value : values) { + config.putPreStyle(value.getName(), ((NameObject) value).getObject()); + } + + // 通知报表整个刷新. + DesignerFrame frame = DesignerContext.getDesignerFrame(); + if(frame != null) { + frame.repaint(); + } } - config.putPreStyle(value.getName(), chartColorMatching); - } - // 通知报表整个刷新. - DesignerFrame frame = DesignerContext.getDesignerFrame(); - if(frame != null) { - frame.repaint(); - } + @Override + public Class[] targets() { + return new Class[]{ChartPreStyleConfig.class}; + } + }); + } } \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/design/module/ChartPreStylePane.java b/designer-chart/src/main/java/com/fr/design/module/ChartPreStylePane.java index e7f9111d5..1668afcc0 100644 --- a/designer-chart/src/main/java/com/fr/design/module/ChartPreStylePane.java +++ b/designer-chart/src/main/java/com/fr/design/module/ChartPreStylePane.java @@ -12,7 +12,6 @@ import com.fr.design.event.UIObserver; import com.fr.design.event.UIObserverListener; import com.fr.design.gui.ilable.BoldFontTextLabel; import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.mainframe.chart.gui.style.ChartPreFillStylePane; import com.fr.general.Inter; import javax.swing.JPanel;