From 42f0405e0c6f27667820027e9bf24f837612a442 Mon Sep 17 00:00:00 2001 From: plough Date: Wed, 19 Dec 2018 16:04:10 +0800 Subject: [PATCH 01/15] =?UTF-8?q?REPORT-13654=20=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E6=8D=A2=E4=B8=8A12=E5=8F=B7=E7=9A=84release?= =?UTF-8?q?=E5=90=8E=EF=BC=8C=E8=B0=83=E8=89=B2=E6=9D=BF=E5=87=BA=E4=B8=8D?= =?UTF-8?q?=E6=9D=A5=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../style/color/NewColorSelectPane.java | 21 +++++++++++----- .../style/color/PickColorButtonFactory.java | 24 ++++++++++++------- 2 files changed, 31 insertions(+), 14 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/style/color/NewColorSelectPane.java b/designer-base/src/main/java/com/fr/design/style/color/NewColorSelectPane.java index 0f5e629e2..d53232416 100644 --- a/designer-base/src/main/java/com/fr/design/style/color/NewColorSelectPane.java +++ b/designer-base/src/main/java/com/fr/design/style/color/NewColorSelectPane.java @@ -8,11 +8,16 @@ import com.fr.design.gui.ibutton.UIButton; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.DesignerContext; - -import javax.swing.*; +import javax.swing.BorderFactory; +import javax.swing.Box; +import javax.swing.JPanel; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; -import java.awt.*; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Cursor; +import java.awt.Dimension; +import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; @@ -92,11 +97,15 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable { centerPane.add(Box.createVerticalStrut(1)); // mod by anchore 16/11/16 - UIButton customButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_More_Color")); + final UIButton customButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_More_Color")); - customButton.addActionListener(new ActionListener() { + // 不能使用 ActionListener,否则设计器工具栏中的"更多颜色"按钮会有问题(REPORT-13654) + customButton.addMouseListener(new MouseAdapter() { @Override - public void actionPerformed(ActionEvent e) { + public void mousePressed(MouseEvent e) { + if (!customButton.isEnabled()) { + return; + } customButtonPressed(); } }); diff --git a/designer-base/src/main/java/com/fr/design/style/color/PickColorButtonFactory.java b/designer-base/src/main/java/com/fr/design/style/color/PickColorButtonFactory.java index 67d99819d..f394801c8 100644 --- a/designer-base/src/main/java/com/fr/design/style/color/PickColorButtonFactory.java +++ b/designer-base/src/main/java/com/fr/design/style/color/PickColorButtonFactory.java @@ -4,11 +4,15 @@ import com.fr.base.BaseUtils; import com.fr.design.gui.ibutton.SpecialUIButton; import com.fr.design.gui.ibutton.UIBasicButtonUI; -import javax.swing.*; -import javax.swing.plaf.ButtonUI; -import javax.swing.plaf.basic.BasicButtonUI; -import java.awt.*; -import java.awt.event.*; +import javax.swing.JButton; +import javax.swing.JComponent; +import java.awt.Color; +import java.awt.Cursor; +import java.awt.Dimension; +import java.awt.Graphics; +import java.awt.Image; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; /** * Created by plough on 2016/12/22. @@ -28,7 +32,7 @@ class PickColorButtonFactory { * @return SpecialUIButton 屏幕取色按钮 */ static JButton getPickColorButton(final ColorSelectable colorSelectable, IconType iconType, final boolean setColorRealTime) { - SpecialUIButton pickColorButton = new SpecialUIButton(new WhiteButtonUI()); + final SpecialUIButton pickColorButton = new SpecialUIButton(new WhiteButtonUI()); PickColorButtonFactory.iconType = iconType; if (iconType == IconType.ICON16) { @@ -42,9 +46,13 @@ class PickColorButtonFactory { pickColorButton.setPreferredSize(new Dimension(iconSize, iconSize)); pickColorButton.setCursor(new Cursor(Cursor.HAND_CURSOR)); - pickColorButton.addActionListener(new ActionListener() { + // 不能使用 ActionListener,否则设计器工具栏中的取色按钮会有问题(REPORT-13654) + pickColorButton.addMouseListener(new MouseAdapter() { @Override - public void actionPerformed(ActionEvent e) { + public void mousePressed(MouseEvent e) { + if (!pickColorButton.isEnabled()) { + return; + } new ColorPicker(colorSelectable, setColorRealTime); } }); From 6b7bb5b6c3fc4c1e58a41da6fae0ad629e11ab7d Mon Sep 17 00:00:00 2001 From: zack Date: Thu, 20 Dec 2018 09:47:40 +0800 Subject: [PATCH 02/15] =?UTF-8?q?REPORT-10829=20=E5=BC=80=E5=8F=91?= =?UTF-8?q?=E8=80=85=E5=A4=A7=E8=B5=9B=E6=94=AF=E6=92=91,=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E5=90=8C=E6=AD=A510.0=20,=E6=9C=89=E9=81=97=E6=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/grid/selection/CellSelection.java | 4 ++++ .../src/main/java/com/fr/grid/selection/FloatSelection.java | 6 ++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/grid/selection/CellSelection.java b/designer-realize/src/main/java/com/fr/grid/selection/CellSelection.java index e6eb983c6..ee80f22a2 100644 --- a/designer-realize/src/main/java/com/fr/grid/selection/CellSelection.java +++ b/designer-realize/src/main/java/com/fr/grid/selection/CellSelection.java @@ -508,6 +508,10 @@ public class CellSelection extends Selection { popup.add(DeprecatedActionManager.getInsertMenu(ePane)); popup.add(DeprecatedActionManager.getDeleteMenu(ePane)); popup.add(DeprecatedActionManager.getClearMenu(ePane)); + + popup.addSeparator(); + + addExtraMenu(ePane, popup); return popup; } diff --git a/designer-realize/src/main/java/com/fr/grid/selection/FloatSelection.java b/designer-realize/src/main/java/com/fr/grid/selection/FloatSelection.java index c982934a0..6ce0d736f 100644 --- a/designer-realize/src/main/java/com/fr/grid/selection/FloatSelection.java +++ b/designer-realize/src/main/java/com/fr/grid/selection/FloatSelection.java @@ -1,6 +1,5 @@ package com.fr.grid.selection; -import com.fr.base.BaseUtils; import com.fr.base.FRContext; import com.fr.base.vcs.DesignerMode; import com.fr.design.actions.cell.CleanAuthorityAction; @@ -27,7 +26,6 @@ import com.fr.design.mainframe.ElementCasePane.Clear; import com.fr.design.selection.QuickEditor; import com.fr.design.utils.DesignUtils; import com.fr.general.ComparatorUtils; - import com.fr.report.cell.FloatElement; import com.fr.report.elementcase.TemplateElementCase; import com.fr.stable.ColumnRow; @@ -149,6 +147,10 @@ public class FloatSelection extends Selection { popup.add(new EditFloatElementNameAction(ePane).createMenuItem()); + popup.addSeparator(); + + addExtraMenu(ePane, popup); + return popup; } From 553f5172645e30f3f58d1f0d887d1be01e624168 Mon Sep 17 00:00:00 2001 From: "yaoh.wu" Date: Thu, 20 Dec 2018 14:07:10 +0800 Subject: [PATCH 03/15] =?UTF-8?q?REPORT-13717=20=E6=89=93=E5=BC=80?= =?UTF-8?q?=E4=B8=8D=E5=90=8C=E5=B7=A5=E4=BD=9C=E7=9B=AE=E5=BD=95=E4=B8=8B?= =?UTF-8?q?=E7=9A=84=E5=90=8C=E5=90=8D=E6=A8=A1=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/file/HistoryTemplateListCache.java | 3 ++ .../fr/design/file/MutilTempalteTabPane.java | 47 ++++++++----------- .../fr/design/mainframe/DesignerFrame.java | 31 ++++++------ 3 files changed, 39 insertions(+), 42 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java b/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java index e4bd1db95..6d069eba8 100644 --- a/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java +++ b/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java @@ -183,10 +183,13 @@ public class HistoryTemplateListCache implements CallbackEvent { /** * 判断是否打开过该模板 + * 由于切换环境不会关闭模板,可能存在同名的模板,所以该方法不能准确找到所选的模板, * * @param filename 文件名 * @return 文件位置 + * @deprecated use HistoryTemplateListCache#contains(com.fr.design.mainframe.JTemplate) instead */ + @Deprecated public int contains(String filename) { for (int i = 0; i < historyList.size(); i++) { String historyPath = historyList.get(i).getPath(); diff --git a/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java b/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java index ab4f2aae3..65989dfcc 100644 --- a/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java +++ b/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java @@ -18,7 +18,6 @@ import com.fr.log.FineLoggerFactory; import com.fr.stable.Constants; import com.fr.stable.ProductConstants; import com.fr.third.javax.annotation.Nonnull; -import com.fr.third.org.apache.commons.io.FilenameUtils; import com.fr.workspace.WorkContext; import com.fr.workspace.server.lock.TplOperator; @@ -674,9 +673,6 @@ public class MutilTempalteTabPane extends JComponent { return; } - //当前激活的模板 - String filename = openedTemplate.get(selectedIndex).getPath(); - filename = FilenameUtils.standard(filename); if (!specifiedTemplate.isALLSaved() && !DesignerMode.isVcsMode()) { specifiedTemplate.stopEditing(); int returnVal = JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Utils_Would_You_Like_To_Save") + " \"" + specifiedTemplate.getEditingFILE() + "\" ?", @@ -684,20 +680,20 @@ public class MutilTempalteTabPane extends JComponent { if (returnVal == JOptionPane.YES_OPTION) { specifiedTemplate.saveTemplate(); FineLoggerFactory.getLogger().info(Toolkit.i18nText("Fine-Design_Basic_Template_Already_Saved", specifiedTemplate.getEditingFILE().getName())); - closeTpl(specifiedTemplate, filename); + closeTpl(specifiedTemplate); } else if (returnVal == JOptionPane.NO_OPTION) { - closeTpl(specifiedTemplate, filename); + closeTpl(specifiedTemplate); } } else { - closeTpl(specifiedTemplate, filename); + closeTpl(specifiedTemplate); } } - private void closeTpl(@Nonnull JTemplate specifiedTemplate, @Nonnull String fileName) { + private void closeTpl(@Nonnull JTemplate specifiedTemplate) { HistoryTemplateListCache.getInstance().closeSelectedReport(specifiedTemplate); closeAndFreeLock(specifiedTemplate); - activeTemplate(fileName); + activePrevTemplateAfterClose(); } private void closeAndFreeLock(@Nonnull JTemplate template) { @@ -729,11 +725,9 @@ public class MutilTempalteTabPane extends JComponent { } /** - * 关闭掉一个模板之后该激活的Tab - * - * @param fileName 关闭掉一个模板之后该激活的Tab的文件名,绝对路径 + * 关闭掉一个模板之后激活新的待显示模板 */ - private void activeTemplate(String fileName) { + private void activePrevTemplateAfterClose() { if (openedTemplate.isEmpty()) { //新建并激活模板 DesignerContext.getDesignerFrame().addAndActivateJTemplate(); @@ -742,23 +736,20 @@ public class MutilTempalteTabPane extends JComponent { temTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); } else { - //如果关闭的模板是当前选中的模板,则重新激活 - if (closeIconIndex == selectedIndex) { - if (closeIconIndex == maxPaintIndex) { + // 如果关闭的模板是当前选中的模板,则重新激活当前 selectIndex 的模板; + // selectIndex 没有变化,但是对应的模板已经变成了前一张模板 + if (closeIconIndex == selectedIndex || isCloseCurrent) { + // 如果 closeIconIndex 是最后一个被渲染画出的,那么预览上一个,防止数组越界 + if (closeIconIndex >= maxPaintIndex) { + // selectIndex 不会 <0 因为如果关闭的是打开的最后一个模板,那么关闭之后 openedTemplate.isEmpty() = true selectedIndex--; } - } else if (isCloseCurrent) { - //不是通过关闭按钮,而是通过文件关闭菜单关闭的当前模板的,也重新激活 - if (selectedIndex > openedTemplate.size() - 1) { - selectedIndex -= 1; - if (selectedIndex < 0) { - selectedIndex = 0; - } - isCloseCurrent = false; - } - } else { - //如果关闭的模板不是当前选中的模板,则激活的模板不变 - selectedIndex = HistoryTemplateListCache.getInstance().contains(fileName); + isCloseCurrent = false; + } + // 如果关闭的模板不是当前选中的模板,那么重新获取一下当前模板的 index,激活该 index + else { + JTemplate template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); + selectedIndex = HistoryTemplateListCache.getInstance().contains(template); } //如果是已后台关闭的模板,则重新打开文件 openedTemplate.get(selectedIndex).activeOldJTemplate(); 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 5c262da9d..72994fca7 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 @@ -29,6 +29,7 @@ import com.fr.design.gui.imenu.UIMenuHighLight; import com.fr.design.gui.iprogressbar.ProgressDialog; import com.fr.design.gui.iscrollbar.UIScrollBar; import com.fr.design.gui.itoolbar.UIToolbar; +import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.loghandler.LogMessageBar; import com.fr.design.mainframe.toolbar.ToolBarMenuDock; @@ -76,7 +77,6 @@ import java.awt.Graphics; import java.awt.Insets; import java.awt.Point; import java.awt.Rectangle; -import java.awt.Toolkit; import java.awt.datatransfer.DataFlavor; import java.awt.datatransfer.Transferable; import java.awt.dnd.DnDConstants; @@ -160,9 +160,9 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta //用于判断设计器是否打开了 private boolean designerOpened = false; - private int contentWidth = (int) (Toolkit.getDefaultToolkit().getScreenSize().getWidth()); + private int contentWidth = (int) (java.awt.Toolkit.getDefaultToolkit().getScreenSize().getWidth()); - private int contentHeight = (int) (Toolkit.getDefaultToolkit().getScreenSize().getHeight()); + private int contentHeight = (int) (java.awt.Toolkit.getDefaultToolkit().getScreenSize().getHeight()); private WindowAdapter windowAdapter = new WindowAdapter() { @@ -849,18 +849,18 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta editingTemplate.stopEditing(); if (!editingTemplate.getEditingFILE().exists()) { int returnVal = JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Utils_Would_You_Like_To_Save") + " \"" + editingTemplate.getEditingFILE() + Toolkit.i18nText("Fine-Design_Basic_Utils_Would_You_Like_To_Save") + " \"" + editingTemplate.getEditingFILE() + "\" ?", ProductConstants.PRODUCT_NAME, JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); if (returnVal == JOptionPane.YES_OPTION && editingTemplate.saveTemplate()) { editingTemplate.saveTemplate(); - FineLoggerFactory.getLogger().info(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Template_Already_Saved", + FineLoggerFactory.getLogger().info(Toolkit.i18nText("Fine-Design_Basic_Template_Already_Saved", editingTemplate.getEditingFILE().getName())); } } else { if (editingTemplate.saveTemplate()) { editingTemplate.saveTemplate(); - FineLoggerFactory.getLogger().info(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Template_Already_Saved", + FineLoggerFactory.getLogger().info(Toolkit.i18nText("Fine-Design_Basic_Template_Already_Saved", editingTemplate.getEditingFILE().getName())); } } @@ -957,8 +957,12 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta // p:判断一下,如何文件为空或者文件不存在,直接返回. if (tplFile == null || !tplFile.exists()) { - JOptionPane.showMessageDialog(this, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Warning_Template_Do_Not_Exsit"), - ProductConstants.PRODUCT_NAME, JOptionPane.INFORMATION_MESSAGE); + JOptionPane.showMessageDialog( + this, + Toolkit.i18nText("Fine-Design_Basic_Warning_Template_Do_Not_Exsit"), + ProductConstants.PRODUCT_NAME, + JOptionPane.INFORMATION_MESSAGE + ); DesignerFrameFileDealerPane.getInstance().refresh(); return; } @@ -968,7 +972,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta } catch (DecryptTemplateException e) { JOptionPane.showMessageDialog( this, - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Encrypt_Decrypt_Exception"), + Toolkit.i18nText("Fine-Design_Encrypt_Decrypt_Exception"), UIManager.getString("OptionPane.messageDialogTitle"), JOptionPane.WARNING_MESSAGE, UIManager.getIcon("OptionPane.errorIcon") @@ -1027,7 +1031,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta MutilTempalteTabPane.getInstance().setTemTemplate( HistoryTemplateListPane.getInstance().getCurrentEditingTemplate()); } else { - activeTemplate(tplFile, jt); + activeTemplate(jt); } opened = true; break; @@ -1042,13 +1046,12 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta /** * 激活指定的模板 * - * @param tplFile 模板文件 - * @param jt 当前报表 + * @param jt 当前报表 * @date 2014-10-14-下午6:31:23 */ - private void activeTemplate(FILE tplFile, JTemplate jt) { + private void activeTemplate(JTemplate jt) { // 如果该模板已经打开,则进行激活就可以了 - int index = HistoryTemplateListPane.getInstance().contains(tplFile.getPath()); + int index = HistoryTemplateListPane.getInstance().contains(jt); List> historyList = HistoryTemplateListPane.getInstance().getHistoryList(); if (index != -1) { historyList.get(index).activeJTemplate(index, jt); From fcb58a3448c87d95554f99c2dfada0eeda64a693 Mon Sep 17 00:00:00 2001 From: zack Date: Thu, 20 Dec 2018 15:26:44 +0800 Subject: [PATCH 04/15] =?UTF-8?q?REPORT-13018=20=E5=A4=A7=E8=B5=9B?= =?UTF-8?q?=E5=90=8E=E7=BB=AD=E5=BC=80=E4=B8=A4=E4=B8=AA=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/mainframe/loghandler/LogMessageBar.java | 1 + 1 file changed, 1 insertion(+) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogMessageBar.java b/designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogMessageBar.java index 620915243..bf815e1d7 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogMessageBar.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogMessageBar.java @@ -73,5 +73,6 @@ public class LogMessageBar extends JPanel { if (dlg != null) { dlg.dispose(); } + THIS = null; } } \ No newline at end of file From ef2d65581066c301ae265f881e778a63a59a26b9 Mon Sep 17 00:00:00 2001 From: "Mata.Li" Date: Thu, 20 Dec 2018 16:30:52 +0800 Subject: [PATCH 05/15] REPORT-13689 & REPORT-13733 & REPORT-13716 & REPORT-13720 --- .../design/file/HistoryTemplateListCache.java | 5 ++ .../fr/design/mainframe/DesignerFrame.java | 26 ++++--- .../mainframe/EastRegionContainerPane.java | 2 + .../actions/server/StyleListAction.java | 77 ++++++++++--------- .../com/fr/design/present/StyleArrayPane.java | 16 ++-- 5 files changed, 72 insertions(+), 54 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java b/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java index e4bd1db95..b41e15e80 100644 --- a/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java +++ b/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java @@ -2,6 +2,7 @@ package com.fr.design.file; import com.fr.base.chart.chartdata.CallbackEvent; import com.fr.design.DesignerEnvManager; +import com.fr.design.base.mode.DesignModeContext; import com.fr.design.data.DesignTableDataManager; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.DesignerContext; @@ -59,6 +60,10 @@ public class HistoryTemplateListCache implements CallbackEvent { public void closeSelectedReport(JTemplate selected) { DesignModuleFactory.clearChartPropertyPane(); DesignTableDataManager.closeTemplate(selected); + //直接关闭模板的时候退出权限编辑 + if (DesignModeContext.isAuthorityEditing()) { + DesignerContext.getDesignerFrame().closeAuthorityEditing(); + } if (contains(selected) == -1) { return; } 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 5c262da9d..d7c40e6bd 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 @@ -10,6 +10,7 @@ import com.fr.design.DesignState; import com.fr.design.DesignerEnvManager; import com.fr.design.ExtraDesignClassManager; import com.fr.design.actions.core.ActionFactory; +import com.fr.design.base.mode.DesignModeContext; import com.fr.design.constants.UIConstants; import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.datapane.TableDataTreePane; @@ -17,6 +18,7 @@ import com.fr.design.env.DesignerWorkspaceInfo; import com.fr.design.event.DesignerOpenedListener; import com.fr.design.event.TargetModifiedEvent; import com.fr.design.event.TargetModifiedListener; +import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.MutilTempalteTabPane; import com.fr.design.file.NewTemplatePane; @@ -224,16 +226,8 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta } public void mouseReleased(MouseEvent e) { - if (DesignerMode.isAuthorityEditing()) { - DesignerMode.setMode(DesignerMode.NORMAL); - WestRegionContainerPane.getInstance().replaceDownPane( - TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter())); - HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().refreshEastPropertiesPane(); - DesignerContext.getDesignerFrame().resetToolkitByPlus( - HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getToolBarMenuDockPlus()); - needToAddAuhtorityPaint(); - refreshDottedLine(); - fireAuthorityStateToNomal(); + if (DesignModeContext.isAuthorityEditing()) { + closeAuthorityEditing(); } } @@ -332,6 +326,18 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta this.progressDialog = new ProgressDialog(this); } + public void closeAuthorityEditing(){ + DesignModeContext.switchTo(com.fr.design.base.mode.DesignerMode.NORMAL); + WestRegionContainerPane.getInstance().replaceDownPane( + TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter())); + HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().refreshEastPropertiesPane(); + DesignerContext.getDesignerFrame().resetToolkitByPlus( + HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getToolBarMenuDockPlus()); + needToAddAuhtorityPaint(); + refreshDottedLine(); + fireAuthorityStateToNomal(); + } + /** * 注册app. * diff --git a/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java b/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java index a49d66791..97ce22814 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java @@ -412,6 +412,8 @@ public class EastRegionContainerPane extends UIEastResizableContainer { if (propertyItem.isVisible() && propertyItem.isEnabled() && !propertyItem.isPoppedOut()) { propertyCard.show(rightPane, tabName); propertyItem.setTabButtonSelected(); + //从单元格菜单过来也要关闭弹出窗 + hideCurrentPopupPane(); } } diff --git a/designer-realize/src/main/java/com/fr/design/actions/server/StyleListAction.java b/designer-realize/src/main/java/com/fr/design/actions/server/StyleListAction.java index 61276163d..4f57bdc2a 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/server/StyleListAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/server/StyleListAction.java @@ -10,8 +10,11 @@ import com.fr.design.mainframe.DesignerFrame; import com.fr.design.menu.MenuKeySet; import com.fr.general.IOUtils; +import com.fr.transaction.CallBackAdaptor; import com.fr.transaction.Configurations; import com.fr.transaction.Worker; +import com.fr.transaction.WorkerCallBack; +import com.fr.transaction.WorkerFacade; import javax.swing.*; import java.awt.event.ActionEvent; @@ -21,16 +24,17 @@ import java.awt.event.ActionEvent; * StyleList Action */ public class StyleListAction extends UpdateAction { - public StyleListAction() { + public StyleListAction() { this.setMenuKeySet(PREDEFINED_STYLES); - this.setName(getMenuKeySet().getMenuKeySetName()+ "..."); + this.setName(getMenuKeySet().getMenuKeySetName() + "..."); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(IOUtils.readIcon("/com/fr/design/images/m_web/style.png")); - this.generateAndSetSearchText(StyleManagerPane.class.getName()); - } + this.setSmallIcon(IOUtils.readIcon("/com/fr/design/images/m_web/style.png")); + this.generateAndSetSearchText(StyleManagerPane.class.getName()); + } /** * 动作 + * * @param evt 事件 */ public void actionPerformed(ActionEvent evt) { @@ -40,45 +44,44 @@ public class StyleListAction extends UpdateAction { styleListDialog.addDialogActionListener(new DialogActionAdapter() { @Override public void doOk() { - Configurations.update(new Worker() { + Configurations.modify(new WorkerFacade(ServerPreferenceConfig.class) { @Override public void run() { styleListPane.update(ServerPreferenceConfig.getInstance()); } + }.addCallBack(new CallBackAdaptor(){ + @Override + public void afterCommit() { + DesignerContext.getDesignerBean("predefinedStyle").refreshBeanElement(); + } + })); - @Override - public Class[] targets() { - return new Class[]{ServerPreferenceConfig.class}; - } - }); - - } + } }); - ServerPreferenceConfig mirror = ServerPreferenceConfig.getInstance().mirror(); - styleListPane.populate(mirror); - styleListDialog.setVisible(true); - - } - - @Override - public void update() { - this.setEnabled(true); - } + ServerPreferenceConfig mirror = ServerPreferenceConfig.getInstance().mirror(); + styleListPane.populate(mirror); + styleListDialog.setVisible(true); + } + + @Override + public void update() { + this.setEnabled(true); + } - public static final MenuKeySet PREDEFINED_STYLES = new MenuKeySet() { - @Override - public char getMnemonic() { - return 'K'; - } + public static final MenuKeySet PREDEFINED_STYLES = new MenuKeySet() { + @Override + public char getMnemonic() { + return 'K'; + } - @Override - public String getMenuName() { - return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_ServerM_Predefined_Styles"); - } + @Override + public String getMenuName() { + return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_ServerM_Predefined_Styles"); + } - @Override - public KeyStroke getKeyStroke() { - return null; - } - }; + @Override + public KeyStroke getKeyStroke() { + return null; + } + }; } diff --git a/designer-realize/src/main/java/com/fr/design/present/StyleArrayPane.java b/designer-realize/src/main/java/com/fr/design/present/StyleArrayPane.java index bd7602ee7..76c1e7261 100644 --- a/designer-realize/src/main/java/com/fr/design/present/StyleArrayPane.java +++ b/designer-realize/src/main/java/com/fr/design/present/StyleArrayPane.java @@ -2,6 +2,7 @@ package com.fr.design.present; import com.fr.base.Style; import com.fr.config.ServerPreferenceConfig; +import com.fr.config.StyleMap; import com.fr.design.gui.controlpane.AbstractNameableCreator; import com.fr.design.gui.controlpane.JListControlPane; import com.fr.design.gui.controlpane.NameableCreator; @@ -13,6 +14,8 @@ import com.fr.design.style.StylePane; import com.fr.general.NameObject; import com.fr.stable.Nameable; +import com.fr.transaction.Configurations; +import com.fr.transaction.WorkerAdaptor; import java.util.ArrayList; import java.util.Iterator; @@ -90,17 +93,16 @@ public class StyleArrayPane extends JListControlPane { /** * Update. */ - public void update(ServerPreferenceConfig configManager) { - configManager.clearAllStyle(); + public void update(final ServerPreferenceConfig configManager) { + //configManager.clearAllStyle(); // Nameable[]居然不能强转成Parameter[],一定要这么写... Nameable[] nameables = this.update(); - + final StyleMap styleMap = new StyleMap(); for (int i = 0; i < nameables.length; i++) { - configManager.putStyle(((NameObject)nameables[i]).getName(), (Style)((NameObject)nameables[i]).getObject()); + styleMap.put(((NameObject)nameables[i]).getName(), (Style)((NameObject)nameables[i]).getObject()); } - DesignerContext.getDesignerBean("predefinedStyle").refreshBeanElement(); - } - + configManager.setStyleMap(styleMap); + } } From 3ed78faa5143aacd59c59cd984c1a7492fddf72b Mon Sep 17 00:00:00 2001 From: "Wim.Zhai" Date: Thu, 20 Dec 2018 19:11:33 +0800 Subject: [PATCH 06/15] =?UTF-8?q?CHART-3169=20=E6=96=B0=E7=89=B9=E6=80=A7?= =?UTF-8?q?=E5=9B=BE=E8=A1=A8=20=E6=A0=B7=E5=BC=8F=E7=B3=BB=E5=88=97?= =?UTF-8?q?=E9=A2=9C=E8=89=B2=E9=A3=8E=E6=A0=BC=20=E6=94=B9=E4=B8=BA'?= =?UTF-8?q?=E6=B8=90=E5=8F=98'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../van/chart/designer/component/VanChartBeautyPane.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartBeautyPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartBeautyPane.java index 44c0e1a55..f6642bd71 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartBeautyPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartBeautyPane.java @@ -4,6 +4,7 @@ import com.fr.chart.base.ChartConstants; import com.fr.design.beans.BasicBeanPane; import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ilable.UILabel; +import com.fr.design.i18n.Toolkit; import com.fr.design.layout.TableLayout; import com.fr.van.chart.designer.TableLayout4VanChartHelper; @@ -28,7 +29,7 @@ public class VanChartBeautyPane extends BasicBeanPane { double[] columnSize = {f, e}; double[] rowSize = {p}; Component[][] components = new Component[][]{ - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Style")), styleBox}, + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Style")), styleBox}, } ; JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components, rowSize, columnSize); this.setLayout(new BorderLayout()); @@ -36,8 +37,8 @@ public class VanChartBeautyPane extends BasicBeanPane { } protected String[] getNameArray(){ - return new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Default_Name"), - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Top_Down_Shade") + return new String[]{Toolkit.i18nText("Fine-Design_Chart_Default_Name"), + Toolkit.i18nText("Fine-Design_Chart_Style_TopDownShade") }; } @Override From 67ab9101f53ef4b1ae9091623dcdd2c0c39bf3c4 Mon Sep 17 00:00:00 2001 From: "Wim.Zhai" Date: Thu, 20 Dec 2018 19:15:31 +0800 Subject: [PATCH 07/15] =?UTF-8?q?CHART-3573=20=E4=BD=BF=E7=94=A8=E6=96=B0?= =?UTF-8?q?=E7=9A=84key=E6=9D=A5=E5=8C=BA=E5=88=AB=E5=BC=80'=E7=A9=BA?= =?UTF-8?q?=E5=80=BC=E6=96=AD=E5=BC=80'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chart/gui/style/series/CustomDefaultSeriesPane.java | 2 +- .../chart/gui/style/series/CustomTypeConditionSeriesPane.java | 2 +- .../design/mainframe/chart/gui/style/series/LineSeriesPane.java | 2 +- .../mainframe/chart/gui/style/series/RadarSeriesPane.java | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/CustomDefaultSeriesPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/CustomDefaultSeriesPane.java index d31aad3b3..d0507acc0 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/CustomDefaultSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/CustomDefaultSeriesPane.java @@ -240,7 +240,7 @@ public class CustomDefaultSeriesPane extends BasicPane{ isCurve = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Curve_Smooth")); lineStyle = new LineComboBox(CoreConstants.STRIKE_LINE_STYLE_ARRAY_4_CHART); markerPane = new MarkerComboBox(MarkerFactory.getMarkerArray()); - String[] nameArray = {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Null_Value_Break"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Null_Value_Continue")}; + String[] nameArray = {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Break"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Null_Value_Continue")}; Boolean[] valueArray = {true, false}; isNullValueBreak = new UIButtonGroup(nameArray, valueArray); double p = TableLayout.PREFERRED; diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/CustomTypeConditionSeriesPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/CustomTypeConditionSeriesPane.java index 7b6bb3657..3c2f52349 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/CustomTypeConditionSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/CustomTypeConditionSeriesPane.java @@ -449,7 +449,7 @@ public class CustomTypeConditionSeriesPane extends BasicBeanPane{ lineStyle.setPreferredSize(new Dimension(150,20)); markerPane.setPreferredSize(new Dimension(150,20)); - String[] nameArray = {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Null_Value_Break"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Null_Value_Continue")}; + String[] nameArray = {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Break"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Null_Value_Continue")}; Boolean[] valueArray = {true, false}; isNullValueBreak = new UIButtonGroup(nameArray, valueArray); double p = TableLayout.PREFERRED; diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/LineSeriesPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/LineSeriesPane.java index 9fbbb1197..612e89b48 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/LineSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/LineSeriesPane.java @@ -49,7 +49,7 @@ public class LineSeriesPane extends AbstractPlotSeriesPane{ isCurve = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Curve_Smooth")); lineStyle = new LineComboBox(CoreConstants.STRIKE_LINE_STYLE_ARRAY_4_CHART); markerPane = new MarkerComboBox(MarkerFactory.getMarkerArray()); - String[] nameArray = {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Null_Value_Break"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Null_Value_Continue")}; + String[] nameArray = {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Break"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Null_Value_Continue")}; Boolean[] valueArray = {true, false}; isNullValueBreak = new UIButtonGroup(nameArray, valueArray); double p = TableLayout.PREFERRED; diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/RadarSeriesPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/RadarSeriesPane.java index 894347327..a5a3fb4d6 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/RadarSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/RadarSeriesPane.java @@ -45,7 +45,7 @@ public class RadarSeriesPane extends AbstractPlotSeriesPane{ isCurve = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Fill")); lineStyle = new LineComboBox(CoreConstants.STRIKE_LINE_STYLE_ARRAY_4_CHART); markerPane = new MarkerComboBox(MarkerFactory.getMarkerArray()); - String[] nameArray = {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Null_Value_Break"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Null_Value_Continue")}; + String[] nameArray = {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Break"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Null_Value_Continue")}; Boolean[] valueArray = {true, false}; isNullValueBreak = new UIButtonGroup(nameArray, valueArray); From 2dcaaef7ed49bffdd039ffbd5c4daea63aaab0fe Mon Sep 17 00:00:00 2001 From: "Wim.Zhai" Date: Thu, 20 Dec 2018 20:11:23 +0800 Subject: [PATCH 08/15] =?UTF-8?q?CHART-3575=20=E4=BF=AE=E6=94=B9=E4=B8=BA?= =?UTF-8?q?=E9=9C=80=E8=A6=81=E7=9A=84'=E5=88=86=E7=B1=BB=E5=90=8D'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/chart/gui/style/ChartDatapointLabelPane.java | 2 +- .../component/format/CategoryNameFormatPaneWithCheckBox.java | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartDatapointLabelPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartDatapointLabelPane.java index 48585ae5b..8e198ea6c 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartDatapointLabelPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartDatapointLabelPane.java @@ -96,7 +96,7 @@ public class ChartDatapointLabelPane extends BasicPane{ boolean isGuidline = plot.isSupportLeadLine(); if(plot.isSupportCategoryFilter()) { - isCategory = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Style_Format_Category_Name")); + isCategory = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Category_Use_Name")); } isSeries = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Series_Name")); isValue = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Use_Value")); diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/format/CategoryNameFormatPaneWithCheckBox.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/format/CategoryNameFormatPaneWithCheckBox.java index 2e0d55a41..575143a62 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/format/CategoryNameFormatPaneWithCheckBox.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/format/CategoryNameFormatPaneWithCheckBox.java @@ -1,6 +1,7 @@ package com.fr.van.chart.designer.component.format; +import com.fr.design.i18n.Toolkit; import com.fr.van.chart.designer.style.VanChartStylePane; import javax.swing.JPanel; @@ -18,6 +19,7 @@ public class CategoryNameFormatPaneWithCheckBox extends VanChartFormatPaneWithCh @Override protected String getCheckBoxText() { - return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Style_Format_Category_Name"); + //"分类名" 图表(新特性)标签、提示时有用到 + return Toolkit.i18nText("Fine-Design_Chart_Category_Use_Name"); } } From f2d684e167b360eeb42abded516b511611d5eef5 Mon Sep 17 00:00:00 2001 From: "Mata.Li" Date: Fri, 21 Dec 2018 10:37:25 +0800 Subject: [PATCH 09/15] MOBILE-18801 --- .../fr/design/actions/FormMobileAttrAction.java | 16 ++++++++++++++++ .../designer/layout/FRFitLayoutDefinePane.java | 11 +++-------- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/actions/FormMobileAttrAction.java b/designer-form/src/main/java/com/fr/design/actions/FormMobileAttrAction.java index 033ba5ea5..d77078fad 100644 --- a/designer-form/src/main/java/com/fr/design/actions/FormMobileAttrAction.java +++ b/designer-form/src/main/java/com/fr/design/actions/FormMobileAttrAction.java @@ -3,11 +3,15 @@ package com.fr.design.actions; import com.fr.base.BaseUtils; import com.fr.base.iofile.attr.MobileOnlyTemplateAttrMark; import com.fr.design.actions.JTemplateAction; +import com.fr.design.designer.creator.XLayoutContainer; +import com.fr.design.designer.creator.XWAbsoluteBodyLayout; +import com.fr.design.designer.creator.XWFitLayout; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.form.mobile.FormMobileAttrPane; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.FormArea; +import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.JForm; import com.fr.design.mainframe.WidgetPropertyPane; import com.fr.design.menu.MenuKeySet; @@ -73,6 +77,9 @@ public class FormMobileAttrAction extends JTemplateAction { formTpl.setFormMobileAttr(formMobileAttr); // 会调整 body 的自适应布局,放到最后 ((FormArea)jf.getFormDesign().getParent()).onMobileAttrModified(); jf.getFormDesign().getSelectionModel().setSelectedCreator(jf.getFormDesign().getRootComponent()); + //改变布局为自适应布局,只在移动端属性设置保存后改变一次 + doChangeBodyLayout(); + WidgetPropertyPane.getInstance().refreshDockingView(); jf.fireTargetModified(); } @@ -80,6 +87,15 @@ public class FormMobileAttrAction extends JTemplateAction { dialog.setVisible(true); } + private void doChangeBodyLayout(){ + FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner(); + XLayoutContainer rootLayout = formDesigner.getRootComponent(); + if (rootLayout.getComponentCount() == 1 && rootLayout.getXCreator(0).acceptType(XWAbsoluteBodyLayout.class)) { + rootLayout = (XWAbsoluteBodyLayout) rootLayout.getXCreator(0); + } + ((XWFitLayout)formDesigner.getRootComponent()).switch2FitBodyLayout(rootLayout); + } + @Focus(id = "com.fr.mobile.mobile_template_frm", text = "Fine-Design_Function_Mobile_Template_Frm", source = Original.EMBED) private void recordFunction() { // do nothing diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRFitLayoutDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRFitLayoutDefinePane.java index 0f3e0aba0..dd19d7c81 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRFitLayoutDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRFitLayoutDefinePane.java @@ -137,14 +137,9 @@ public class FRFitLayoutDefinePane extends AbstractDataModify { XLayoutContainer rootLayout = selectedBodyLayout(formDesigner); if (rootLayout != formDesigner.getRootComponent() && formDesigner.getSelectionModel().getSelection().getSelectedCreator() == formDesigner.getRootComponent()) { - //原单例面板populate根据当前样式populate属性面板,现加入移动端逻辑:可能需要根据面板属性改变样式 - Form form = formDesigner.getTarget(); - if (form.getFormMobileAttr().isMobileOnly() && form.getFormMobileAttr().isAdaptivePropertyAutoMatch()) { - ((XWFitLayout)formDesigner.getRootComponent()).switch2FitBodyLayout(rootLayout); - } else { - formDesigner.getSelectionModel().setSelectedCreators( - FormSelectionUtils.rebuildSelection(xWFitLayout, new Widget[]{selectedBodyLayout(formDesigner).toData()})); - } + formDesigner.getSelectionModel().setSelectedCreators( + FormSelectionUtils.rebuildSelection(xWFitLayout, new Widget[]{selectedBodyLayout(formDesigner).toData()})); + } paddingBound.populate(ob); layoutComboBox.setSelectedIndex(ob.getBodyLayoutType().getTypeValue()); From ba5b8fe1674e6edb30affd980001ab9254972092 Mon Sep 17 00:00:00 2001 From: Harrison Date: Fri, 21 Dec 2018 10:43:05 +0800 Subject: [PATCH 10/15] =?UTF-8?q?REPORT-13074=20=E8=BF=9C=E7=A8=8B?= =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E5=90=91=E4=B8=8B=E5=85=BC=E5=AE=B9=201.=20?= =?UTF-8?q?=E5=8A=A0=E5=85=A5=E5=BA=8F=E5=88=97=E5=8C=96=E5=BC=82=E5=B8=B8?= =?UTF-8?q?=20SerilizationException=20,=20WorkspaceNoteHitException=202.?= =?UTF-8?q?=20=E5=8A=A0=E5=85=A5=E5=88=87=E6=8D=A2=E8=BF=9C=E7=A8=8B?= =?UTF-8?q?=E8=BF=9E=E6=8E=A5=E7=9A=84=E6=A3=80=E6=B5=8B=EF=BC=8C=E4=BB=A5?= =?UTF-8?q?=E5=8F=8A=E6=B5=8B=E8=AF=95=E8=BF=9C=E7=A8=8B=E8=BF=9E=E6=8E=A5?= =?UTF-8?q?=E7=9A=84=E6=8F=90=E9=86=92=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/EnvChangeEntrance.java | 46 ++++++++++++++++ .../main/java/com/fr/env/RemoteEnvPane.java | 37 ++++++++----- .../java/com/fr/env/TestConnectionResult.java | 55 +++++++++++++++++++ 3 files changed, 125 insertions(+), 13 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/env/TestConnectionResult.java diff --git a/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java b/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java index 76ae52894..725272a15 100644 --- a/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java +++ b/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java @@ -5,6 +5,7 @@ import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.env.DesignerWorkspaceGenerator; import com.fr.design.env.DesignerWorkspaceInfo; +import com.fr.design.env.DesignerWorkspaceType; import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.file.TemplateTreePane; import com.fr.design.i18n.Toolkit; @@ -15,19 +16,25 @@ import com.fr.env.EnvListPane; import com.fr.general.GeneralContext; import com.fr.license.exception.RegistEditionException; import com.fr.log.FineLoggerFactory; +import com.fr.stable.AssistUtils; import com.fr.stable.EnvChangedListener; import com.fr.start.server.ServerTray; import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContextCallback; import com.fr.workspace.Workspace; import com.fr.workspace.connect.AuthException; +import com.fr.workspace.connect.WorkspaceConnectionInfo; +import com.fr.workspace.engine.channel.http.FunctionalHttpRequest; import javax.swing.JOptionPane; import javax.swing.SwingUtilities; import javax.swing.UIManager; +import java.util.ArrayList; import java.util.HashMap; +import java.util.List; import static javax.swing.JOptionPane.ERROR_MESSAGE; +import static javax.swing.JOptionPane.QUESTION_MESSAGE; public class EnvChangeEntrance { @@ -90,6 +97,11 @@ public class EnvChangeEntrance { }); return false; } + + if (versionCheck(selectedEnv)) { + return false; + } + WorkContext.switchTo(workspace, new WorkContextCallback() { @Override public void done() { @@ -138,6 +150,40 @@ public class EnvChangeEntrance { return true; } + /** + * 切换环境之前,进行版本检测,当版本不一致的时候,提示。 + * 当选择 ok 时,才继续。 + * + * @param selectedEnv 选择的环境 + * @return 是否一致 + * @throws Exception 异常 + */ + private boolean versionCheck(DesignerWorkspaceInfo selectedEnv) throws Exception { + + if (selectedEnv.getType() == DesignerWorkspaceType.Remote) { + + WorkspaceConnectionInfo info = selectedEnv.getConnection(); + String serverVersion = new FunctionalHttpRequest(info).getServerVersion(); + + if (!AssistUtils.equals(serverVersion, WorkContext.getVersion())) { + + final List result = new ArrayList<>(1); + PopTipStrategy.NOW.showTip(new PopTip() { + @Override + public void show() { + String[] option = {Toolkit.i18nText("Fine-Design_Report_Yes"), Toolkit.i18nText("Fine-Design_Report_No")}; + int choice = JOptionPane.showOptionDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Version_Inconsistency"), + UIManager.getString("OptionPane.messageDialogTitle"), JOptionPane.YES_NO_OPTION, QUESTION_MESSAGE, UIManager.getIcon("OptionPane.warningIcon"), option, 1); + result.add(choice); + } + }); + + return result.size() != 0 && result.get(0) == 1; + } + } + return false; + } + /** * 编辑items * diff --git a/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java b/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java index 769c843cc..21b5d2b2c 100644 --- a/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java +++ b/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java @@ -511,14 +511,14 @@ public class RemoteEnvPane extends BasicBeanPane { } private void tryConnectRemoteEnv() { + final RemoteDesignerWorkspaceInfo remoteEnv = updateBean(); + final WorkspaceConnectionInfo connection = remoteEnv.getConnection(); + final SwingWorker worker = new SwingWorker() { @Override protected Boolean doInBackground() throws Exception { - final RemoteDesignerWorkspaceInfo remoteEnv = updateBean(); - - WorkspaceConnectionInfo connection = remoteEnv.getConnection(); DesignerEnvManager.getEnvManager().setCertificatePath(connection.getCertPath()); DesignerEnvManager.getEnvManager().setCertificatePass(connection.getCertSecretKey()); try { @@ -532,23 +532,33 @@ public class RemoteEnvPane extends BasicBeanPane { protected void done() { okButton.setEnabled(true); try { - Boolean result = get(); - if (result == null) { + + TestConnectionResult result = TestConnectionResult.parse(get(), connection); + if (result == TestConnectionResult.Fully_Success) { + message.setText(Toolkit.i18nText("Fine-Design_Basic_Remote_Connect_Successful")); + uiLabel.setIcon(UIManager.getIcon("OptionPane.informationIcon")); + } + + if (result == TestConnectionResult.Partly_Sucess) { + message.setText(Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Version_Inconsistency")); + uiLabel.setIcon(UIManager.getIcon("OptionPane.informationIcon")); + } + + if (result == TestConnectionResult.Fully_Failed) { + message.setText(Toolkit.i18nText("Fine-Design_Basic_Remote_Connect_Failed")); + uiLabel.setIcon(UIManager.getIcon("OptionPane.errorIcon")); + } + + if (result == TestConnectionResult.Auth_Failed) { message.setText(Toolkit.i18nText("Fine-Design_Basic_Remote_Connect_Auth_Failed")); uiLabel.setIcon(UIManager.getIcon("OptionPane.errorIcon")); - } else { - if (result) { - message.setText(Toolkit.i18nText("Fine-Design_Basic_Remote_Connect_Successful")); - uiLabel.setIcon(UIManager.getIcon("OptionPane.informationIcon")); - } else { - message.setText(Toolkit.i18nText("Fine-Design_Basic_Remote_Connect_Failed")); - uiLabel.setIcon(UIManager.getIcon("OptionPane.errorIcon")); - } } } catch (InterruptedException | ExecutionException e) { FineLoggerFactory.getLogger().error(e, e.getMessage()); message.setText(Toolkit.i18nText("Fine-Design_Basic_Remote_Connect_Failed")); uiLabel.setIcon(UIManager.getIcon("OptionPane.errorIcon")); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage()); } dialogDownPane.remove(cancelButton); dialogDownPane.revalidate(); @@ -596,6 +606,7 @@ public class RemoteEnvPane extends BasicBeanPane { dialogDownPane = new JPanel(); uiLabel = new UILabel(UIManager.getIcon("OptionPane.informationIcon")); upPane.setLayout(new FlowLayout(FlowLayout.LEFT, 10, 10)); + //upPane.setLayout(new BorderLayout()); upPane.add(uiLabel); upPane.add(message); dialogDownPane.setLayout(new FlowLayout(FlowLayout.CENTER, 6, 0)); diff --git a/designer-base/src/main/java/com/fr/env/TestConnectionResult.java b/designer-base/src/main/java/com/fr/env/TestConnectionResult.java new file mode 100644 index 000000000..3aaf594ec --- /dev/null +++ b/designer-base/src/main/java/com/fr/env/TestConnectionResult.java @@ -0,0 +1,55 @@ +package com.fr.env; + +import com.fr.stable.AssistUtils; +import com.fr.workspace.WorkContext; +import com.fr.workspace.connect.WorkspaceConnectionInfo; +import com.fr.workspace.engine.channel.http.FunctionalHttpRequest; + +/** + * created by Harrison on 2018/12/20 + **/ +public enum TestConnectionResult { + /** + * 完全成功, 版本匹配,测试连接成功。 + */ + Fully_Success(0), + + /** + * 不完全成功,版本不匹配,但测试连接成功。 + */ + Partly_Sucess(1), + + /** + * 完全失败,直接没连上 + */ + Fully_Failed(2), + + /** + * 验证 Token 失败 + */ + Auth_Failed(3); + + private int sign; + + TestConnectionResult(int i) { + this.sign = i; + } + + public static TestConnectionResult parse(Boolean value, WorkspaceConnectionInfo info) throws Exception { + if (value == null) { + return Auth_Failed; + } + + if (!value) { + return Fully_Failed; + } + + String serverVersion = new FunctionalHttpRequest(info).getServerVersion(); + + if (AssistUtils.equals(serverVersion, WorkContext.getVersion())) { + return Fully_Success; + } + + return Partly_Sucess; + } +} From 1380b31b6467f8f0c400e4af279227416df9de12 Mon Sep 17 00:00:00 2001 From: Harrison Date: Fri, 21 Dec 2018 10:58:13 +0800 Subject: [PATCH 11/15] =?UTF-8?q?REPORT-13074=20=E8=BF=9C=E7=A8=8B?= =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E5=90=91=E4=B8=8B=E5=85=BC=E5=AE=B9=201.=20?= =?UTF-8?q?=E8=A1=A5=E5=85=85=E4=B8=80=E4=BA=9B=E6=B3=A8=E9=87=8A=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/env/RemoteEnvPane.java | 4 +- .../java/com/fr/env/TestConnectionResult.java | 37 +++++++++++-------- 2 files changed, 23 insertions(+), 18 deletions(-) diff --git a/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java b/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java index 21b5d2b2c..742b6cc16 100644 --- a/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java +++ b/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java @@ -541,7 +541,7 @@ public class RemoteEnvPane extends BasicBeanPane { if (result == TestConnectionResult.Partly_Sucess) { message.setText(Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Version_Inconsistency")); - uiLabel.setIcon(UIManager.getIcon("OptionPane.informationIcon")); + uiLabel.setIcon(UIManager.getIcon("OptionPane.warningIcon")); } if (result == TestConnectionResult.Fully_Failed) { @@ -557,8 +557,6 @@ public class RemoteEnvPane extends BasicBeanPane { FineLoggerFactory.getLogger().error(e, e.getMessage()); message.setText(Toolkit.i18nText("Fine-Design_Basic_Remote_Connect_Failed")); uiLabel.setIcon(UIManager.getIcon("OptionPane.errorIcon")); - } catch (Exception e) { - FineLoggerFactory.getLogger().error(e.getMessage()); } dialogDownPane.remove(cancelButton); dialogDownPane.revalidate(); diff --git a/designer-base/src/main/java/com/fr/env/TestConnectionResult.java b/designer-base/src/main/java/com/fr/env/TestConnectionResult.java index 3aaf594ec..357d4f38c 100644 --- a/designer-base/src/main/java/com/fr/env/TestConnectionResult.java +++ b/designer-base/src/main/java/com/fr/env/TestConnectionResult.java @@ -1,41 +1,40 @@ package com.fr.env; +import com.fr.log.FineLoggerFactory; import com.fr.stable.AssistUtils; import com.fr.workspace.WorkContext; import com.fr.workspace.connect.WorkspaceConnectionInfo; import com.fr.workspace.engine.channel.http.FunctionalHttpRequest; /** + * 测试连接的结果。 + * 不改变原有逻辑的情况下,加入一层转化。 + * 根据这里的转化结果,判断需要提示哪些内容。 + * * created by Harrison on 2018/12/20 **/ public enum TestConnectionResult { /** * 完全成功, 版本匹配,测试连接成功。 */ - Fully_Success(0), + Fully_Success, /** * 不完全成功,版本不匹配,但测试连接成功。 */ - Partly_Sucess(1), + Partly_Sucess, /** * 完全失败,直接没连上 */ - Fully_Failed(2), + Fully_Failed, /** * 验证 Token 失败 */ - Auth_Failed(3); + Auth_Failed; - private int sign; - - TestConnectionResult(int i) { - this.sign = i; - } - - public static TestConnectionResult parse(Boolean value, WorkspaceConnectionInfo info) throws Exception { + public static TestConnectionResult parse(Boolean value, WorkspaceConnectionInfo info) { if (value == null) { return Auth_Failed; } @@ -43,13 +42,21 @@ public enum TestConnectionResult { if (!value) { return Fully_Failed; } + try { - String serverVersion = new FunctionalHttpRequest(info).getServerVersion(); + String serverVersion = new FunctionalHttpRequest(info).getServerVersion(); + if (AssistUtils.equals(serverVersion, WorkContext.getVersion())) { + return Fully_Success; + } - if (AssistUtils.equals(serverVersion, WorkContext.getVersion())) { - return Fully_Success; + return Partly_Sucess; + } catch (Exception e) { + + // 发生异常,说明没连接上。返回完全失败。 + FineLoggerFactory.getLogger().error(e.getMessage()); + return Fully_Failed; } - return Partly_Sucess; + } } From fcdb68c2fcedd59e37749bef190d8341f640497e Mon Sep 17 00:00:00 2001 From: Harrison Date: Fri, 21 Dec 2018 11:24:24 +0800 Subject: [PATCH 12/15] =?UTF-8?q?REPORT-13074=20=E8=BF=9C=E7=A8=8B?= =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E5=90=91=E4=B8=8B=E5=85=BC=E5=AE=B9=201.=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=B8=80=E4=B8=8B=E9=80=BB=E8=BE=91=E3=80=82?= =?UTF-8?q?=20=E6=9B=B4=E6=96=B9=E4=BE=BF=E7=90=86=E8=A7=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/EnvChangeEntrance.java | 47 ++++++++++++------- 1 file changed, 29 insertions(+), 18 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java b/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java index 725272a15..58f22d1b6 100644 --- a/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java +++ b/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java @@ -98,7 +98,8 @@ public class EnvChangeEntrance { return false; } - if (versionCheck(selectedEnv)) { + // 如果版本不一致,且确认 不继续 连接,这里返回 false. + if (!versionCheckAndConfirm(selectedEnv)) { return false; } @@ -151,37 +152,47 @@ public class EnvChangeEntrance { } /** - * 切换环境之前,进行版本检测,当版本不一致的时候,提示。 - * 当选择 ok 时,才继续。 + * 切换远程环境之前,进行版本检测,当版本不一致的时候,提示。 + * 当用户确认选择 ok 时,才继续。 * * @param selectedEnv 选择的环境 * @return 是否一致 + * 1. 非远程环境 , 返回 true + * 2. 远程环境 + * 2.1 不匹配, + * 2.1.1 当选择 ok , 返回 true + * 2.1.2 当选择 no, 返回 false + * 2.2 匹配, 返回 true * @throws Exception 异常 */ - private boolean versionCheck(DesignerWorkspaceInfo selectedEnv) throws Exception { + private boolean versionCheckAndConfirm(DesignerWorkspaceInfo selectedEnv) throws Exception { if (selectedEnv.getType() == DesignerWorkspaceType.Remote) { WorkspaceConnectionInfo info = selectedEnv.getConnection(); String serverVersion = new FunctionalHttpRequest(info).getServerVersion(); - if (!AssistUtils.equals(serverVersion, WorkContext.getVersion())) { + if (AssistUtils.equals(serverVersion, WorkContext.getVersion())) { + return true; + } - final List result = new ArrayList<>(1); - PopTipStrategy.NOW.showTip(new PopTip() { - @Override - public void show() { - String[] option = {Toolkit.i18nText("Fine-Design_Report_Yes"), Toolkit.i18nText("Fine-Design_Report_No")}; - int choice = JOptionPane.showOptionDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Version_Inconsistency"), - UIManager.getString("OptionPane.messageDialogTitle"), JOptionPane.YES_NO_OPTION, QUESTION_MESSAGE, UIManager.getIcon("OptionPane.warningIcon"), option, 1); - result.add(choice); - } - }); + final List result = new ArrayList<>(1); + PopTipStrategy.NOW.showTip(new PopTip() { + @Override + public void show() { + String[] option = {Toolkit.i18nText("Fine-Design_Report_Yes"), Toolkit.i18nText("Fine-Design_Report_No")}; + int choice = JOptionPane.showOptionDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Version_Inconsistency"), + UIManager.getString("OptionPane.messageDialogTitle"), JOptionPane.YES_NO_OPTION, QUESTION_MESSAGE, UIManager.getIcon("OptionPane.warningIcon"), option, 1); + result.add(choice); + } + }); - return result.size() != 0 && result.get(0) == 1; - } + // 只有选择 yes , 这里的值才为 0, 返回 true + // 否着返回 false, 将不进行下面的连接操作。 + return result.size() != 0 && result.get(0) == 0; } - return false; + + return true; } /** From 02dd1b00793e08c381d26f541d47f7ce2e94aac8 Mon Sep 17 00:00:00 2001 From: Harrison Date: Fri, 21 Dec 2018 11:43:14 +0800 Subject: [PATCH 13/15] =?UTF-8?q?REPORT-13074=20=E8=BF=9C=E7=A8=8B?= =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E5=90=91=E4=B8=8B=E5=85=BC=E5=AE=B9=201.=20?= =?UTF-8?q?=E5=BF=98=E4=BA=86=E6=B3=A8=E9=87=8A=E6=8E=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer-base/src/main/java/com/fr/env/RemoteEnvPane.java | 1 - 1 file changed, 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java b/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java index 742b6cc16..dc764153c 100644 --- a/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java +++ b/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java @@ -604,7 +604,6 @@ public class RemoteEnvPane extends BasicBeanPane { dialogDownPane = new JPanel(); uiLabel = new UILabel(UIManager.getIcon("OptionPane.informationIcon")); upPane.setLayout(new FlowLayout(FlowLayout.LEFT, 10, 10)); - //upPane.setLayout(new BorderLayout()); upPane.add(uiLabel); upPane.add(message); dialogDownPane.setLayout(new FlowLayout(FlowLayout.CENTER, 6, 0)); From b912d85688410664c67e612bb6ca13762dbc5d39 Mon Sep 17 00:00:00 2001 From: "alex.sung" Date: Fri, 21 Dec 2018 14:02:44 +0800 Subject: [PATCH 14/15] =?UTF-8?q?REPORT-13431=20=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E7=82=B9=E8=AE=B0=E5=BD=95,=20=E9=9C=80=E8=A6=81=E5=90=88?= =?UTF-8?q?=E5=B9=B6=E5=8F=91=E9=80=81=201.=E5=8F=91=E9=80=81=E5=89=8D?= =?UTF-8?q?=E5=8E=BB=E9=87=8D=202.SEND=5FDELAY=E5=8E=9F=E5=85=88=E5=AE=9A?= =?UTF-8?q?=E4=B9=89=E6=9C=89=E8=AF=AF=EF=BC=8C=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/InformationCollector.java | 157 +++++++++++++----- 1 file changed, 118 insertions(+), 39 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java b/designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java index 0398189d9..61b583c61 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java @@ -5,11 +5,6 @@ package com.fr.design.mainframe; import com.fr.base.FRContext; import com.fr.config.MarketConfig; -import com.fr.data.core.db.DBUtils; -import com.fr.data.core.db.dialect.DialectFactory; -import com.fr.data.core.db.dml.Delete; -import com.fr.data.core.db.dml.Select; -import com.fr.data.core.db.dml.Table; import com.fr.design.DesignerEnvManager; import com.fr.design.mainframe.errorinfo.ErrorInfoUploader; import com.fr.design.mainframe.templateinfo.TemplateInfoCollector; @@ -19,18 +14,13 @@ import com.fr.general.DateUtils; import com.fr.general.DesUtils; import com.fr.general.GeneralUtils; import com.fr.general.IOUtils; -import com.fr.general.http.HttpClient; import com.fr.general.http.HttpToolbox; import com.fr.intelli.record.FocusPoint; -import com.fr.intelli.record.MetricException; import com.fr.intelli.record.MetricRegistry; import com.fr.json.JSONArray; import com.fr.json.JSONException; import com.fr.json.JSONObject; import com.fr.log.FineLoggerFactory; -import com.fr.log.message.ParameterMessage; -import com.fr.record.DBRecordXManager; -import com.fr.stable.ArrayUtils; import com.fr.stable.EncodeConstants; import com.fr.stable.ProductConstants; import com.fr.stable.StableUtils; @@ -58,17 +48,15 @@ import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.UnsupportedEncodingException; -import java.net.URLEncoder; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; import java.text.DateFormat; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; +import java.util.Iterator; import java.util.List; import java.util.Map; +import java.util.Set; +import java.util.TreeSet; /** * @author neil @@ -79,7 +67,7 @@ public class InformationCollector implements XMLReadable, XMLWriter { // 24小时上传一次 private static final long DELTA = 24 * 3600 * 1000L; - private static final long SEND_DELAY = 30 * 1000L; + private static final long SEND_DELAY = 300 * 1000L; private static final String FILE_NAME = "fr.info"; private static final String XML_START_STOP_LIST = "StartStopList"; private static final String XML_START_STOP = "StartStop"; @@ -226,12 +214,7 @@ public class InformationCollector implements XMLReadable, XMLWriter { if (currentTime - lastTime <= DELTA) { return; } - JSONArray content = null; - try { - content = getFunctionsContent(currentTime, lastTime); - } catch (JSONException e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); - } + JSONArray content = getFunctionsContent(currentTime, lastTime); boolean success = false; FineLoggerFactory.getLogger().info("Start sent function records to the cloud center..."); String url = CloudCenter.getInstance().acquireUrlByKind(TABLE_FUNCTION_RECORD); @@ -443,7 +426,7 @@ public class InformationCollector implements XMLReadable, XMLWriter { }); } - public static JSONArray getFunctionsContent(long current, long last) throws JSONException{ + public JSONArray getFunctionsContent(long current, long last) { //记录当前条数,达到200条合并成一个请求 int count = 0; JSONArray functionArray = new JSONArray(); @@ -452,21 +435,20 @@ public class InformationCollector implements XMLReadable, XMLWriter { .addRestriction(RestrictionFactory.gte(COLUMN_TIME, last)); try { DataList focusPoints = MetricRegistry.getMetric().find(FocusPoint.class,condition); - JSONArray temp = new JSONArray(); + TreeSet focusPointsList = new TreeSet<>(); if(!focusPoints.isEmpty()){ for(int i=0;i< focusPoints.getList().size();i++){ FocusPoint focusPoint = focusPoints.getList().get(i); if(focusPoint != null){ if((++count <= MAX_EACH_REQUEST_RECORD_COUNT)){ - temp.put(getOneRecord(focusPoint)); + focusPointsList.add(getOneRecord(focusPoint)); } else { count = 0; - functionArray.put(temp); - temp = new JSONArray(); - temp.put(getOneRecord(focusPoint)); + functionArray.put(setToJSONArray(focusPointsList)); + focusPointsList.add(getOneRecord(focusPoint)); } if(i == (focusPoints.getList().size() -1)){ - functionArray.put(temp); + functionArray.put(setToJSONArray(focusPointsList)); } } } @@ -478,16 +460,33 @@ public class InformationCollector implements XMLReadable, XMLWriter { return functionArray; } - private static JSONObject getOneRecord(FocusPoint focusPoint) throws JSONException{ - com.fr.json.JSONObject record = new com.fr.json.JSONObject(); - record.put(ATTR_ID, focusPoint.getId()); - record.put(ATTR_TEXT, focusPoint.getText()); - record.put(ATTR_SOURCE, focusPoint.getSource()); - record.put(ATTR_TIME, focusPoint.getTime().getTime()); - record.put(ATTR_TITLE, focusPoint.getTitle()); - record.put(ATTR_USER_NAME, MarketConfig.getInstance().getBbsUsername()); - record.put(ATTR_UUID, DesignerEnvManager.getEnvManager().getUUID()); - return record; + private FunctionRecord getOneRecord(FocusPoint focusPoint) { + FunctionRecord functionRecord = new FunctionRecord(); + functionRecord.setId(focusPoint.getId() == null?StringUtils.EMPTY : focusPoint.getId()); + functionRecord.setText(focusPoint.getText() == null?StringUtils.EMPTY : focusPoint.getText()); + functionRecord.setSource(focusPoint.getSource()); + functionRecord.setTime(focusPoint.getTime().getTime()); + functionRecord.setTitle(focusPoint.getTitle() == null?StringUtils.EMPTY : focusPoint.getTitle()); + functionRecord.setUsername(MarketConfig.getInstance().getBbsUsername() == null?StringUtils.EMPTY : MarketConfig.getInstance().getBbsUsername()); + functionRecord.setUuid(DesignerEnvManager.getEnvManager().getUUID() == null?StringUtils.EMPTY : DesignerEnvManager.getEnvManager().getUUID()); + return functionRecord; + } + + private JSONArray setToJSONArray(Set set) throws JSONException { + JSONArray jsonArray = new JSONArray(); + for(Iterator iter = set.iterator(); iter.hasNext(); ) { + FunctionRecord functionRecord = (FunctionRecord)iter.next(); + com.fr.json.JSONObject record = new com.fr.json.JSONObject(); + record.put(ATTR_ID, functionRecord.getId()); + record.put(ATTR_TEXT, functionRecord.getText()); + record.put(ATTR_SOURCE, functionRecord.getSource()); + record.put(ATTR_TIME, functionRecord.getTime()); + record.put(ATTR_TITLE, functionRecord.getTitle()); + record.put(ATTR_USER_NAME, functionRecord.getUsername()); + record.put(ATTR_UUID, functionRecord.getUuid()); + jsonArray.put(record); + } + return jsonArray; } private class StartStopTime implements XMLReadable, XMLWriter { @@ -529,4 +528,84 @@ public class InformationCollector implements XMLReadable, XMLWriter { } + private class FunctionRecord implements Comparable{ + private String id; + private String text; + private int source; + private long time; + private String title; + private String username; + private String uuid; + + public FunctionRecord(){ + + } + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getText() { + return text; + } + + public void setText(String text) { + this.text = text; + } + + public int getSource() { + return source; + } + + public void setSource(int source) { + this.source = source; + } + + public long getTime() { + return time; + } + + public void setTime(long time) { + this.time = time; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public String getUuid() { + return uuid; + } + + public void setUuid(String uuid) { + this.uuid = uuid; + } + + @Override + public int compareTo(Object o) { + FunctionRecord functionRecord = (FunctionRecord) o; + if(this.getId().equals((functionRecord.getId())) && this.getText().equals(functionRecord.getText()) + && this.getSource() == functionRecord.getSource() && this.getTime() == functionRecord.getTime() + && this.getTitle().equals(functionRecord.getTitle()) && this.getUsername().equals(functionRecord.getUsername()) + && this.getUuid().equals(functionRecord.getUuid())){ + return 0; + } + return 1; + } + } } \ No newline at end of file From 0fcdd85bdb2801154a85c4f1c6452df57663bedb Mon Sep 17 00:00:00 2001 From: Harrison Date: Fri, 21 Dec 2018 16:26:57 +0800 Subject: [PATCH 15/15] =?UTF-8?q?REPORT-13074=20=E8=BF=9C=E7=A8=8B?= =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E5=90=91=E4=B8=8B=E5=85=BC=E5=AE=B9=201.=20?= =?UTF-8?q?=E5=B0=86=E5=B0=9D=E8=AF=95=E8=BF=9E=E6=8E=A5=E5=92=8C=E6=AD=A3?= =?UTF-8?q?=E5=BC=8F=E8=BF=9E=E6=8E=A5=E6=8F=90=E7=A4=BA=E5=88=86=E5=BC=80?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer-base/src/main/java/com/fr/env/RemoteEnvPane.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java b/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java index dc764153c..d2953eeb6 100644 --- a/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java +++ b/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java @@ -540,7 +540,7 @@ public class RemoteEnvPane extends BasicBeanPane { } if (result == TestConnectionResult.Partly_Sucess) { - message.setText(Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Version_Inconsistency")); + message.setText(Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Version_Inconsistence_Test")); uiLabel.setIcon(UIManager.getIcon("OptionPane.warningIcon")); }