From b6b65c13009faec45f3a8a4b629233e1a3925bf8 Mon Sep 17 00:00:00 2001 From: Hades Date: Tue, 28 May 2019 11:06:53 +0800 Subject: [PATCH 01/21] =?UTF-8?q?REPORT-17451=20=E6=8E=A7=E4=BB=B6?= =?UTF-8?q?=E5=8F=AF=E7=94=A8=E5=8F=AF=E8=A7=81=E5=A4=B1=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../widget/ui/FormWidgetCardPane.java | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java b/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java index 3e70f7d0f..d5753ce15 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java @@ -1,6 +1,5 @@ package com.fr.design.mainframe.widget.ui; -import com.fr.base.BaseUtils; import com.fr.design.data.DataCreatorUI; import com.fr.design.designer.beans.events.DesignerEvent; import com.fr.design.designer.creator.XCreator; @@ -28,13 +27,13 @@ import com.fr.design.widget.Operator; import com.fr.design.widget.ui.designer.component.WidgetAbsoluteBoundPane; import com.fr.design.widget.ui.designer.component.WidgetBoundPane; import com.fr.design.widget.ui.designer.component.WidgetCardTagBoundPane; -import com.fr.form.ui.FormWidgetHelper; import com.fr.form.ui.Widget; import com.fr.form.ui.container.WScaleLayout; import com.fr.form.ui.container.WTitleLayout; import com.fr.form.ui.widget.CRBoundsWidget; import com.fr.general.ComparatorUtils; +import com.fr.general.IOUtils; import com.fr.stable.StringUtils; import javax.swing.BorderFactory; @@ -91,6 +90,7 @@ public class FormWidgetCardPane extends AbstractAttrNoScrollPane { return new WidgetBoundPane(xCreator); } + @Override protected JPanel createContentPane() { return null; } @@ -218,21 +218,14 @@ public class FormWidgetCardPane extends AbstractAttrNoScrollPane { UITextField widgetNameField = widgetPropertyPane.getWidgetNameField(); String toSetWidgetName = widgetNameField.getText(); String currentWidgetName = widget.getWidgetName(); - // 设置的组件名和当前组件名相同 直接返回 - if (ComparatorUtils.equals(toSetWidgetName, currentWidgetName)) { - return; - } - String containerName = designer.getTarget().getContainer().getWidgetName(); - Widget existWidget = FormWidgetHelper.findWidgetByName(widget, widgetNameField.getText()); - // 判断设置的组件名是否和容器同名以及组件是否在容器在存在 满足任何其一 抛出提示 - boolean exist = ComparatorUtils.equals(containerName, toSetWidgetName) || existWidget != null; + boolean exist = designer.getTarget().isNameExist(toSetWidgetName) && !ComparatorUtils.equals(toSetWidgetName, currentWidgetName); if (exist) { widgetNameField.setText(currentWidgetName); - JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Rename_Failure"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Joption_News"), JOptionPane.ERROR_MESSAGE, BaseUtils.readIcon("com/fr/design/form/images/joption_failure.png")); + JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Rename_Failure"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Joption_News"), JOptionPane.ERROR_MESSAGE, IOUtils.readIcon("com/fr/design/form/images/joption_failure.png")); return; } widgetPropertyPane.update(widget); - xCreator.resetCreatorName(toSetWidgetName); + xCreator.resetCreatorName(currentWidgetName); xCreator.resetVisible(widget.isVisible()); designer.getEditListenerTable().fireCreatorModified(xCreator, DesignerEvent.CREATOR_RENAMED); return; @@ -262,6 +255,7 @@ public class FormWidgetCardPane extends AbstractAttrNoScrollPane { creator.firePropertyChange(); } + @Override public String getIconPath() { return StringUtils.EMPTY; } From 5307f4a3aee6996b58fd889c7007b981b276fd2c Mon Sep 17 00:00:00 2001 From: Hades Date: Tue, 28 May 2019 16:03:45 +0800 Subject: [PATCH 02/21] =?UTF-8?q?REPORT-16650=20=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E6=9D=83=E9=99=90=E7=BC=96=E8=BE=91=20=E5=A4=9A?= =?UTF-8?q?=E8=A7=92=E8=89=B2=E6=A0=91=E5=A4=9A=E9=80=89=E6=97=A0=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../FormWidgetAuthorityEditPane.java | 91 +++++++++++++++---- 1 file changed, 74 insertions(+), 17 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/designer/properties/FormWidgetAuthorityEditPane.java b/designer-form/src/main/java/com/fr/design/designer/properties/FormWidgetAuthorityEditPane.java index 6f84aaa32..b66293cfc 100644 --- a/designer-form/src/main/java/com/fr/design/designer/properties/FormWidgetAuthorityEditPane.java +++ b/designer-form/src/main/java/com/fr/design/designer/properties/FormWidgetAuthorityEditPane.java @@ -4,14 +4,18 @@ import java.awt.BorderLayout; import java.awt.Component; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; +import java.util.ArrayList; +import java.util.List; import javax.swing.BorderFactory; import javax.swing.JComponent; import javax.swing.JPanel; +import javax.swing.tree.TreePath; import com.fr.design.constants.LayoutConstants; -import com.fr.design.file.HistoryTemplateListPane; +import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.gui.icheckbox.UICheckBox; +import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.AuthorityEditPane; @@ -22,6 +26,9 @@ import com.fr.design.roleAuthority.ReportAndFSManagePane; import com.fr.design.roleAuthority.RolesAlreadyEditedPane; import com.fr.form.ui.Widget; import com.fr.general.ComparatorUtils; +import com.fr.stable.ArrayUtils; +import com.fr.stable.StableUtils; +import com.fr.stable.StringUtils; /** @@ -34,15 +41,21 @@ public class FormWidgetAuthorityEditPane extends AuthorityEditPane { private Widget[] widgets = null; private UICheckBox widgetVisible = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Visible")); private UICheckBox widgetAvailable = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Enabled")); + private String[] selectedArray; private ItemListener visibleItemListener = new ItemListener() { + @Override public void itemStateChanged(ItemEvent e) { String selectedRoles = ReportAndFSManagePane.getInstance().getRoleTree().getSelectedRoleName(); if (selectedRoles == null) { return; } - if (widgets != null && widgets.length > 0) { - for (int i = 0; i < widgets.length; i++) { - widgets[i].changeVisibleAuthorityState(selectedRoles, widgetVisible.isSelected()); + initSelectedArray(); + if (ArrayUtils.isEmpty(selectedArray)) { + return; + } + for (String selectedRole : selectedArray) { + for (Widget widget : widgets) { + widget.changeVisibleAuthorityState(selectedRole, widgetVisible.isSelected()); } } doAfterAuthority(); @@ -51,6 +64,7 @@ public class FormWidgetAuthorityEditPane extends AuthorityEditPane { private ItemListener usableItemListener = new ItemListener() { + @Override public void itemStateChanged(ItemEvent e) { String selectedRoles = ReportAndFSManagePane.getInstance().getRoleTree().getSelectedRoleName(); if (ComparatorUtils.equals(selectedRoles, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Engine_Role"))) { @@ -59,9 +73,13 @@ public class FormWidgetAuthorityEditPane extends AuthorityEditPane { if (selectedRoles == null) { return; } - if (widgets != null && widgets.length > 0) { - for (int i = 0; i < widgets.length; i++) { - widgets[i].changeUsableAuthorityState(selectedRoles, widgetAvailable.isSelected()); + initSelectedArray(); + if (ArrayUtils.isEmpty(selectedArray)) { + return; + } + for (String selectedRole : selectedArray) { + for (Widget widget : widgets) { + widget.changeUsableAuthorityState(selectedRole, widgetAvailable.isSelected()); } } doAfterAuthority(); @@ -78,7 +96,7 @@ public class FormWidgetAuthorityEditPane extends AuthorityEditPane { private void doAfterAuthority() { designer.repaint(); - HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().fireTargetModified(); + HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().fireTargetModified(); RolesAlreadyEditedPane.getInstance().refreshDockingView(); RolesAlreadyEditedPane.getInstance().setReportAndFSSelectedRoles(); RolesAlreadyEditedPane.getInstance().repaint(); @@ -90,6 +108,7 @@ public class FormWidgetAuthorityEditPane extends AuthorityEditPane { * * @date 2014-12-21-下午6:19:43 */ + @Override public void populateType() { type.setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Form_Widget_Config")); } @@ -99,15 +118,16 @@ public class FormWidgetAuthorityEditPane extends AuthorityEditPane { * * @date 2014-12-21-下午7:12:27 */ + @Override public void populateName() { - String nameText = ""; if (widgets == null || widgets.length <= 0) { return; } - for (int i = 0; i < widgets.length; i++) { - nameText += "," + widgets[i].getClass().getSimpleName(); + List widgetNames = new ArrayList(); + for (Widget widget : widgets) { + widgetNames.add(widget.getClass().getSimpleName()); } - name.setText(nameText.substring(1)); + name.setText(StableUtils.join(widgetNames, ",")); } /** @@ -116,6 +136,7 @@ public class FormWidgetAuthorityEditPane extends AuthorityEditPane { * @return 面板 * @date 2014-12-21-下午6:19:03 */ + @Override public JPanel populateCheckPane() { checkPane.add(populateWidgetCheckPane(), BorderLayout.CENTER); checkPane.setBorder(BorderFactory.createEmptyBorder(0, LEFT_CHECKPANE, 0, 0)); @@ -138,10 +159,11 @@ public class FormWidgetAuthorityEditPane extends AuthorityEditPane { /** * 对单元格区域进行操作时的权限编辑页面 */ + @Override public void populateDetials() { //更新说明要是JWorkBook的话,说明鼠标焦点又改变了 - HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().setAuthorityMode(true); - signelSelection(); + HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().setAuthorityMode(true); + singleSelection(); refreshCreator(); //如果是布局选中不支持的元素则显示“该元素不支持权限控制” @@ -186,8 +208,8 @@ public class FormWidgetAuthorityEditPane extends AuthorityEditPane { //实现单选 - private void signelSelection() { - if (HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().isJWorkBook()) { + private void singleSelection() { + if (HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().isJWorkBook()) { //清工具栏 JComponent component = DesignerContext.getDesignerFrame().getToolbarComponent(); if (component instanceof AuthorityEditToolBarComponent) { @@ -195,7 +217,7 @@ public class FormWidgetAuthorityEditPane extends AuthorityEditPane { } //清空报表主体的单元格选择 - HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().removeTemplateSelection(); + HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().removeTemplateSelection(); } } @@ -204,5 +226,40 @@ public class FormWidgetAuthorityEditPane extends AuthorityEditPane { widgets = size == 0 ? null : designer.getSelectionModel().getSelection().getSelectedWidgets(); } + private void initSelectedArray() { + TreePath[] selectionPaths = ReportAndFSManagePane.getInstance().getRoleTree().getCheckBoxTreeSelectionModel().getSelectionPaths(); + if (selectionPaths.length == 1) { + if (((ExpandMutableTreeNode) (selectionPaths[0].getLastPathComponent())).getChildCount() > 0) { + ExpandMutableTreeNode node = (ExpandMutableTreeNode) ((ExpandMutableTreeNode) (selectionPaths[0].getLastPathComponent())).getLastChild(); + selectedArray = new String[node.getChildCount()]; + for (int i = 0, len = node.getChildCount(); i < len; i++) { + ExpandMutableTreeNode treeNode = (ExpandMutableTreeNode) node.getChildAt(i); + String nodeName = treeNode.getUserObject().toString(); + selectedArray[i] = nodeName; + } + } else { + selectedArray = pathToString(selectionPaths); + } + } else { + selectedArray = pathToString(selectionPaths); + } + } + + private String[] pathToString(TreePath[] path) { + List roles = new ArrayList(); + if (!ArrayUtils.isEmpty(path)) { + for (TreePath tempPath : path) { + String temp = tempPath.toString(); + boolean exist = StringUtils.isNotEmpty(temp) && temp.startsWith("[") && temp.endsWith("]"); + if (exist) { + temp = temp.substring(1, temp.length() - 1); + String[] selectedRoles = temp.split("," + StringUtils.BLANK); + String role = selectedRoles[2].trim(); + roles.add(role); + } + } + } + return roles.toArray(new String[0]); + } } From db20d7ffcf389080a4be9c0603c0430a899f43d0 Mon Sep 17 00:00:00 2001 From: Hades Date: Wed, 29 May 2019 09:51:35 +0800 Subject: [PATCH 03/21] =?UTF-8?q?REPORT-17500=20=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E6=97=A0=E6=B3=95=E8=B7=B3=E8=BD=AC=E5=88=B0=E5=B8=AE?= =?UTF-8?q?=E5=8A=A9=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/actions/help/TutorialAction.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/actions/help/TutorialAction.java b/designer-base/src/main/java/com/fr/design/actions/help/TutorialAction.java index f5dc26f10..b0aa2b579 100644 --- a/designer-base/src/main/java/com/fr/design/actions/help/TutorialAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/help/TutorialAction.java @@ -3,6 +3,7 @@ package com.fr.design.actions.help; import com.fr.base.BaseUtils; import com.fr.design.actions.UpdateAction; import com.fr.design.menu.MenuKeySet; +import com.fr.design.utils.BrowseUtils; import com.fr.general.CloudCenter; import com.fr.general.GeneralContext; import com.fr.general.http.HttpToolbox; @@ -22,6 +23,8 @@ import java.net.URI; public class TutorialAction extends UpdateAction { + private static final String URL_FOR_TEST_NETWORK = "https://www.baidu.com"; + public TutorialAction() { this.setMenuKeySet(HELP_TUTORIAL); this.setName(getMenuKeySet().getMenuName()); @@ -34,9 +37,11 @@ public class TutorialAction extends UpdateAction { * 动作 * @param evt 事件 */ + @Override public void actionPerformed(ActionEvent evt) { String helpURL = CloudCenter.getInstance().acquireUrlByKind(createDocKey()); - if (isServerOnline(helpURL)) { + // 用第三方网址去判断是否处在离线状态 + if (isServerOnline(URL_FOR_TEST_NETWORK)) { try { Desktop.getDesktop().browse(new URI(helpURL)); return; From 45881aaa87f479cd45a643e1a9e881fcff40bcec Mon Sep 17 00:00:00 2001 From: Hades Date: Wed, 29 May 2019 10:25:06 +0800 Subject: [PATCH 04/21] =?UTF-8?q?REPORT-17500=20=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E6=97=A0=E6=B3=95=E8=B7=B3=E8=BD=AC=E5=88=B0=E5=B8=AE?= =?UTF-8?q?=E5=8A=A9=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/actions/help/TutorialAction.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/actions/help/TutorialAction.java b/designer-base/src/main/java/com/fr/design/actions/help/TutorialAction.java index b0aa2b579..1eec7ec8a 100644 --- a/designer-base/src/main/java/com/fr/design/actions/help/TutorialAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/help/TutorialAction.java @@ -1,11 +1,11 @@ package com.fr.design.actions.help; -import com.fr.base.BaseUtils; +import com.fr.cluster.ClusterBridge; import com.fr.design.actions.UpdateAction; import com.fr.design.menu.MenuKeySet; -import com.fr.design.utils.BrowseUtils; import com.fr.general.CloudCenter; import com.fr.general.GeneralContext; +import com.fr.general.IOUtils; import com.fr.general.http.HttpToolbox; import com.fr.log.FineLoggerFactory; import com.fr.stable.CommonUtils; @@ -29,7 +29,7 @@ public class TutorialAction extends UpdateAction { this.setMenuKeySet(HELP_TUTORIAL); this.setName(getMenuKeySet().getMenuName()); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/bbs/help.png")); + this.setSmallIcon(IOUtils.readIcon("/com/fr/design/images/bbs/help.png")); this.setAccelerator(getMenuKeySet().getKeyStroke()); } From 35007b79d0191d82c5f4634a6d1e8526834cac56 Mon Sep 17 00:00:00 2001 From: Hades Date: Wed, 29 May 2019 13:56:20 +0800 Subject: [PATCH 05/21] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=97=A0=E7=94=A8impor?= =?UTF-8?q?t?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/actions/help/TutorialAction.java | 1 - 1 file changed, 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/actions/help/TutorialAction.java b/designer-base/src/main/java/com/fr/design/actions/help/TutorialAction.java index 1eec7ec8a..5de31eb31 100644 --- a/designer-base/src/main/java/com/fr/design/actions/help/TutorialAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/help/TutorialAction.java @@ -1,6 +1,5 @@ package com.fr.design.actions.help; -import com.fr.cluster.ClusterBridge; import com.fr.design.actions.UpdateAction; import com.fr.design.menu.MenuKeySet; import com.fr.general.CloudCenter; From 678c9124ce6776acc866c14f3c92bec6847dd80b Mon Sep 17 00:00:00 2001 From: Hades Date: Wed, 29 May 2019 15:55:50 +0800 Subject: [PATCH 06/21] =?UTF-8?q?REPORT-17186=20=E3=80=90=E5=86=B3?= =?UTF-8?q?=E7=AD=96=E6=8A=A5=E8=A1=A8=E3=80=91=E6=9D=A1=E4=BB=B6=E5=B1=9E?= =?UTF-8?q?=E6=80=A7=E6=B7=BB=E5=8A=A0=E8=B6=85=E9=93=BE=EF=BC=8C=E4=BC=9A?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E5=9C=A8=E8=B6=85=E7=BA=A7=E9=93=BE=E6=8E=A5?= =?UTF-8?q?=E9=87=8C=E7=94=9F=E6=88=90=E4=B8=80=E6=9D=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/gui/xpane/FormHyperlinkGroupPaneNoPop.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/designer-form/src/main/java/com/fr/design/gui/xpane/FormHyperlinkGroupPaneNoPop.java b/designer-form/src/main/java/com/fr/design/gui/xpane/FormHyperlinkGroupPaneNoPop.java index 313b57147..6098a2600 100644 --- a/designer-form/src/main/java/com/fr/design/gui/xpane/FormHyperlinkGroupPaneNoPop.java +++ b/designer-form/src/main/java/com/fr/design/gui/xpane/FormHyperlinkGroupPaneNoPop.java @@ -23,4 +23,14 @@ public class FormHyperlinkGroupPaneNoPop extends FormHyperlinkGroupPane{ protected boolean isNewStyle() { return false; } + + /** + * 是否需要将条件属性中的超级链接自动保存到超级链接属性中 + * + * @return 是否需要自动保存 + */ + @Override + public boolean needAutoSave() { + return false; + } } From 8d7ff550dbb15fe949c2494e8285c4b122919ee0 Mon Sep 17 00:00:00 2001 From: Hades Date: Thu, 30 May 2019 09:40:51 +0800 Subject: [PATCH 07/21] update --- .../fr/design/gui/xpane/FormHyperlinkGroupPaneNoPop.java | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/gui/xpane/FormHyperlinkGroupPaneNoPop.java b/designer-form/src/main/java/com/fr/design/gui/xpane/FormHyperlinkGroupPaneNoPop.java index 6098a2600..051c7bd49 100644 --- a/designer-form/src/main/java/com/fr/design/gui/xpane/FormHyperlinkGroupPaneNoPop.java +++ b/designer-form/src/main/java/com/fr/design/gui/xpane/FormHyperlinkGroupPaneNoPop.java @@ -24,13 +24,8 @@ public class FormHyperlinkGroupPaneNoPop extends FormHyperlinkGroupPane{ return false; } - /** - * 是否需要将条件属性中的超级链接自动保存到超级链接属性中 - * - * @return 是否需要自动保存 - */ @Override - public boolean needAutoSave() { - return false; + public void saveSettings() { + // do nothing } } From 77b716bb89cc8c8881f836c90d684d2283306810 Mon Sep 17 00:00:00 2001 From: zack Date: Thu, 30 May 2019 16:11:01 +0800 Subject: [PATCH 08/21] =?UTF-8?q?REPORT-15183=20=E6=9C=89=E4=B8=80?= =?UTF-8?q?=E4=B8=AA=E6=94=B9=E8=BF=9C=E7=A8=8Burl=E7=9A=84=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E8=A1=A5=E4=B8=80=E4=B8=8B10.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/env/RemoteEnvPane.java | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 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 0d4839d6d..9b97c4359 100644 --- a/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java +++ b/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java @@ -3,9 +3,11 @@ package com.fr.env; import com.fr.base.FRContext; import com.fr.base.ServerConfig; import com.fr.design.DesignerEnvManager; +import com.fr.design.ExtraDesignClassManager; import com.fr.design.beans.BasicBeanPane; import com.fr.design.border.UITitledBorder; import com.fr.design.env.RemoteDesignerWorkspaceInfo; +import com.fr.design.fun.DesignerEnvProcessor; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.ilable.UILabel; @@ -303,10 +305,17 @@ public class RemoteEnvPane extends BasicBeanPane { @Override public RemoteDesignerWorkspaceInfo updateBean() { + String url = this.remoteWorkspaceURL.getURL(); + String username = this.usernameInput.getText(); + String password = new String(this.passwordInput.getPassword()); + DesignerEnvProcessor envProcessor = ExtraDesignClassManager.getInstance().getSingle(DesignerEnvProcessor.XML_TAG); + if (envProcessor != null) { + url = envProcessor.changeEnvPathBeforeConnect(username, password, url); + } WorkspaceConnectionInfo connection = new WorkspaceConnectionInfo( - this.remoteWorkspaceURL.getURL(), - this.usernameInput.getText(), - new String(this.passwordInput.getPassword()), + url, + username, + password, this.certPathInput.getText(), new String(this.certSecretKeyInput.getPassword())); From 4aad0cc62d70b48aecbc3dbbfbee2b30b1d04852 Mon Sep 17 00:00:00 2001 From: Hades Date: Fri, 31 May 2019 12:40:19 +0800 Subject: [PATCH 09/21] =?UTF-8?q?REPORT-17730=20=E6=8E=A7=E4=BB=B6?= =?UTF-8?q?=E5=90=8D=E6=97=A0=E6=B3=95=E4=BF=9D=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java b/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java index d5753ce15..5e57557e7 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java @@ -225,7 +225,8 @@ public class FormWidgetCardPane extends AbstractAttrNoScrollPane { return; } widgetPropertyPane.update(widget); - xCreator.resetCreatorName(currentWidgetName); + // 上面一行更新了组件 这里必须重新调用getWidgetName + xCreator.resetCreatorName(widget.getWidgetName()); xCreator.resetVisible(widget.isVisible()); designer.getEditListenerTable().fireCreatorModified(xCreator, DesignerEvent.CREATOR_RENAMED); return; From 10c9240e087cedd1d30a9ec15a07b667f6c53f43 Mon Sep 17 00:00:00 2001 From: XiaXiang Date: Fri, 31 May 2019 14:04:57 +0800 Subject: [PATCH 10/21] =?UTF-8?q?REPORT-17494=20=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=E7=89=88=E6=9C=AC=E7=AE=A1=E7=90=86=EF=BC=8C=E9=80=89=E9=A1=B9?= =?UTF-8?q?=E7=81=B0=E5=8C=96=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/actions/file/PreferencePane.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java b/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java index 447e6652b..de7e34278 100644 --- a/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java +++ b/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java @@ -232,8 +232,8 @@ public class PreferencePane extends BasicPane { enableVcsPanel.add(vcsEnableCheckBox); enableVcsPanel.add(remindVcsLabel); JPanel intervalPanel = new JPanel(FRGUIPaneFactory.createLeftZeroLayout()); - UILabel everyLabel = new UILabel(Toolkit.i18nText("Fine-Design_Vcs_Every")); - UILabel delayLabel = new UILabel(Toolkit.i18nText("Fine-Design_Vcs_Delay")); + final UILabel everyLabel = new UILabel(Toolkit.i18nText("Fine-Design_Vcs_Every")); + final UILabel delayLabel = new UILabel(Toolkit.i18nText("Fine-Design_Vcs_Delay")); intervalPanel.add(useIntervalCheckBox); intervalPanel.add(everyLabel); intervalPanel.add(saveIntervalEditor); @@ -246,10 +246,14 @@ public class PreferencePane extends BasicPane { saveCommitCheckBox.setEnabled(true); saveIntervalEditor.setEnabled(true); useIntervalCheckBox.setEnabled(true); + everyLabel.setEnabled(true); + delayLabel.setEnabled(true); } else { saveCommitCheckBox.setEnabled(false); saveIntervalEditor.setEnabled(false); useIntervalCheckBox.setEnabled(false); + everyLabel.setEnabled(false); + delayLabel.setEnabled(false); } } }); From f04c4cfdf916abc61645924c46a1e7bc88a23708 Mon Sep 17 00:00:00 2001 From: Hades Date: Fri, 31 May 2019 16:18:59 +0800 Subject: [PATCH 11/21] =?UTF-8?q?KERNEL-582=20=E5=9B=BD=E9=99=85=E5=8C=96?= =?UTF-8?q?=E5=AE=9A=E5=88=B6=E7=9A=84=E5=9C=B0=E6=96=B9=E4=BC=9A=E8=B6=8A?= =?UTF-8?q?=E6=9D=A5=E8=B6=8A=E5=A4=9A=EF=BC=8C=E6=83=B3=E5=8A=9E=E6=B3=95?= =?UTF-8?q?=E5=8E=BB=E6=8E=89=E8=BF=99=E7=A7=8Dif=20else=E5=86=99=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/actions/community/VideoAction.java | 16 +++----- .../java/com/fr/design/i18n/ActionType.java | 32 +++++++++++++++ .../java/com/fr/design/i18n/LocaleCenter.java | 41 +++++++++++++++++++ .../com/fr/design/i18n/LocaleDifference.java | 32 +++++++++++++++ .../impl/AbstractDefaultLocaleAction.java | 41 +++++++++++++++++++ .../design/i18n/impl/ChinaLocaleAction.java | 9 ++++ .../design/i18n/impl/JapanLocaleAction.java | 21 ++++++++++ .../design/i18n/impl/KoreaLocaleAction.java | 6 +++ .../design/i18n/impl/TaiWanLocaleAction.java | 21 ++++++++++ .../fr/design/i18n/impl/USLocaleAction.java | 16 ++++++++ .../mainframe/toolbar/ToolBarMenuDock.java | 5 +-- .../start/CollectUserInformationDialog.java | 21 ++-------- .../main/java/com/fr/start/SplashContext.java | 10 +---- 13 files changed, 231 insertions(+), 40 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/i18n/ActionType.java create mode 100644 designer-base/src/main/java/com/fr/design/i18n/LocaleCenter.java create mode 100644 designer-base/src/main/java/com/fr/design/i18n/LocaleDifference.java create mode 100644 designer-base/src/main/java/com/fr/design/i18n/impl/AbstractDefaultLocaleAction.java create mode 100644 designer-base/src/main/java/com/fr/design/i18n/impl/ChinaLocaleAction.java create mode 100644 designer-base/src/main/java/com/fr/design/i18n/impl/JapanLocaleAction.java create mode 100644 designer-base/src/main/java/com/fr/design/i18n/impl/KoreaLocaleAction.java create mode 100644 designer-base/src/main/java/com/fr/design/i18n/impl/TaiWanLocaleAction.java create mode 100644 designer-base/src/main/java/com/fr/design/i18n/impl/USLocaleAction.java diff --git a/designer-base/src/main/java/com/fr/design/actions/community/VideoAction.java b/designer-base/src/main/java/com/fr/design/actions/community/VideoAction.java index 8e9fd5b32..6eea8cc15 100644 --- a/designer-base/src/main/java/com/fr/design/actions/community/VideoAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/community/VideoAction.java @@ -1,15 +1,15 @@ package com.fr.design.actions.community; -import com.fr.base.BaseUtils; import com.fr.design.actions.UpdateAction; +import com.fr.design.i18n.ActionType; +import com.fr.design.i18n.LocaleCenter; import com.fr.design.menu.MenuKeySet; import com.fr.design.utils.BrowseUtils; -import com.fr.general.CloudCenter; import com.fr.general.GeneralContext; +import com.fr.general.IOUtils; import javax.swing.*; import java.awt.event.ActionEvent; -import java.util.Locale; public class VideoAction extends UpdateAction { @@ -19,20 +19,14 @@ public class VideoAction extends UpdateAction this.setMenuKeySet(VIDEO); this.setName(getMenuKeySet().getMenuName()); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/bbs/video.png")); + this.setSmallIcon(IOUtils.readIcon("/com/fr/design/images/bbs/video.png")); } @Override public void actionPerformed(ActionEvent arg0) { - String url; - if (GeneralContext.getLocale().equals(Locale.US)) { - url = CloudCenter.getInstance().acquireUrlByKind("bbs.video.en"); - } else { - url = CloudCenter.getInstance().acquireUrlByKind("bbs.video"); - } - BrowseUtils.browser(url); + BrowseUtils.browser(LocaleCenter.getInstance().getLocaleAction(GeneralContext.getLocale()).getUrls().get(ActionType.VIDEO)); } public static final MenuKeySet VIDEO = new MenuKeySet() { diff --git a/designer-base/src/main/java/com/fr/design/i18n/ActionType.java b/designer-base/src/main/java/com/fr/design/i18n/ActionType.java new file mode 100644 index 000000000..1f6b9943a --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/i18n/ActionType.java @@ -0,0 +1,32 @@ +package com.fr.design.i18n; + +public enum ActionType { + + /** + * 视频教学 + */ + VIDEO("video"), + + /** + * 激活码 + */ + ACTIVATION_CODE("activationCode"), + + /** + * 帮助文档 + */ + HELP_DOCUMENT("helpDocument"), + + /** + * 论坛 + */ + BBS("bbs"); + + + private String description; + + ActionType(String description) { + this.description = description; + } + +} diff --git a/designer-base/src/main/java/com/fr/design/i18n/LocaleCenter.java b/designer-base/src/main/java/com/fr/design/i18n/LocaleCenter.java new file mode 100644 index 000000000..79476f15f --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/i18n/LocaleCenter.java @@ -0,0 +1,41 @@ +package com.fr.design.i18n; + +import com.fr.design.i18n.impl.ChinaLocaleAction; +import com.fr.design.i18n.impl.JapanLocaleAction; +import com.fr.design.i18n.impl.KoreaLocaleAction; +import com.fr.design.i18n.impl.TaiWanLocaleAction; +import com.fr.design.i18n.impl.USLocaleAction; + +import java.util.HashMap; +import java.util.Locale; +import java.util.Map; + +public class LocaleCenter { + + private Map actionMap = new HashMap(); + + private LocaleCenter() { + init(); + } + + private void init() { + actionMap.put(Locale.CHINA, new ChinaLocaleAction()); + actionMap.put(Locale.US, new USLocaleAction()); + actionMap.put(Locale.TAIWAN, new TaiWanLocaleAction()); + actionMap.put(Locale.JAPAN, new JapanLocaleAction()); + actionMap.put(Locale.KOREA, new KoreaLocaleAction()); + } + + private static class Holder { + private static final LocaleCenter INSTANCE = new LocaleCenter(); + } + + public static LocaleCenter getInstance() { + return Holder.INSTANCE; + } + + public LocaleDifference getLocaleAction(Locale locale) { + LocaleDifference localeDifference = actionMap.get(locale); + return localeDifference == null ? actionMap.get(Locale.CHINA) : localeDifference; + } +} diff --git a/designer-base/src/main/java/com/fr/design/i18n/LocaleDifference.java b/designer-base/src/main/java/com/fr/design/i18n/LocaleDifference.java new file mode 100644 index 000000000..41a7b26ce --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/i18n/LocaleDifference.java @@ -0,0 +1,32 @@ +package com.fr.design.i18n; + +import java.util.List; +import java.util.Map; + +/** + * 国际化之间有不同表现的动作 + */ +public interface LocaleDifference { + + /** + * 返回该国际化所有的url + * @return url + */ + Map getUrls(); + + + /** + * 添加Action + * @param list 列表 + * @param action 对应action + */ + void addAction(List list, Object action); + + /** + * 返回设计器启动画面路径 + * @return 路径 + */ + String getSplashPath(); + + +} diff --git a/designer-base/src/main/java/com/fr/design/i18n/impl/AbstractDefaultLocaleAction.java b/designer-base/src/main/java/com/fr/design/i18n/impl/AbstractDefaultLocaleAction.java new file mode 100644 index 000000000..d190c990f --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/i18n/impl/AbstractDefaultLocaleAction.java @@ -0,0 +1,41 @@ +package com.fr.design.i18n.impl; + +import com.fr.design.i18n.LocaleDifference; +import com.fr.design.i18n.ActionType; +import com.fr.general.CloudCenter; + +import java.util.EnumMap; +import java.util.List; +import java.util.Map; + +public abstract class AbstractDefaultLocaleAction implements LocaleDifference { + + protected EnumMap urls = new EnumMap(ActionType.class); + + protected void init() { + urls.put(ActionType.BBS, CloudCenter.getInstance().acquireUrlByKind("bbs")); + urls.put(ActionType.VIDEO, CloudCenter.getInstance().acquireUrlByKind("bbs.video")); + urls.put(ActionType.ACTIVATION_CODE, CloudCenter.getInstance().acquireUrlByKind("frlogin.cn")); + urls.put(ActionType.HELP_DOCUMENT, CloudCenter.getInstance().acquireUrlByKind("help.zh_CN.10")); + } + + @Override + public Map getUrls() { + if (urls.isEmpty()) { + init(); + } + return urls; + } + + @Override + public void addAction(List list, Object action) { + // do nothing + } + + @Override + public String getSplashPath() { + return "/com/fr/design/images/splash_10_en.gif"; + } + + +} diff --git a/designer-base/src/main/java/com/fr/design/i18n/impl/ChinaLocaleAction.java b/designer-base/src/main/java/com/fr/design/i18n/impl/ChinaLocaleAction.java new file mode 100644 index 000000000..c10c9b714 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/i18n/impl/ChinaLocaleAction.java @@ -0,0 +1,9 @@ +package com.fr.design.i18n.impl; + +public class ChinaLocaleAction extends AbstractDefaultLocaleAction { + + @Override + public String getSplashPath() { + return "/com/fr/design/images/splash_10.gif"; + } +} diff --git a/designer-base/src/main/java/com/fr/design/i18n/impl/JapanLocaleAction.java b/designer-base/src/main/java/com/fr/design/i18n/impl/JapanLocaleAction.java new file mode 100644 index 000000000..8a018bee0 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/i18n/impl/JapanLocaleAction.java @@ -0,0 +1,21 @@ +package com.fr.design.i18n.impl; + +import com.fr.design.i18n.ActionType; +import com.fr.general.CloudCenter; + +public class JapanLocaleAction extends AbstractDefaultLocaleAction { + + @Override + protected void init() { + super.init(); + urls.put(ActionType.ACTIVATION_CODE, CloudCenter.getInstance().acquireUrlByKind("frlogin.jp")); + } + + + @Override + public String getSplashPath() { + return "/com/fr/design/images/splash_10_jp.gif"; + } + + +} diff --git a/designer-base/src/main/java/com/fr/design/i18n/impl/KoreaLocaleAction.java b/designer-base/src/main/java/com/fr/design/i18n/impl/KoreaLocaleAction.java new file mode 100644 index 000000000..0216ecdbd --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/i18n/impl/KoreaLocaleAction.java @@ -0,0 +1,6 @@ +package com.fr.design.i18n.impl; + + +public class KoreaLocaleAction extends AbstractDefaultLocaleAction { + +} diff --git a/designer-base/src/main/java/com/fr/design/i18n/impl/TaiWanLocaleAction.java b/designer-base/src/main/java/com/fr/design/i18n/impl/TaiWanLocaleAction.java new file mode 100644 index 000000000..2985e7416 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/i18n/impl/TaiWanLocaleAction.java @@ -0,0 +1,21 @@ +package com.fr.design.i18n.impl; + +import com.fr.design.i18n.ActionType; +import com.fr.general.CloudCenter; + +import java.util.List; + +public class TaiWanLocaleAction extends AbstractDefaultLocaleAction { + + @Override + protected void init() { + super.init(); + urls.put(ActionType.VIDEO, CloudCenter.getInstance().acquireUrlByKind("bbs.video.zh_TW")); + urls.put(ActionType.ACTIVATION_CODE, CloudCenter.getInstance().acquireUrlByKind("frlogin.tw")); + } + + @Override + public void addAction(List list, Object action) { + list.add(action); + } +} diff --git a/designer-base/src/main/java/com/fr/design/i18n/impl/USLocaleAction.java b/designer-base/src/main/java/com/fr/design/i18n/impl/USLocaleAction.java new file mode 100644 index 000000000..bdd305761 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/i18n/impl/USLocaleAction.java @@ -0,0 +1,16 @@ +package com.fr.design.i18n.impl; + +import com.fr.design.i18n.ActionType; +import com.fr.general.CloudCenter; + +public class USLocaleAction extends AbstractDefaultLocaleAction { + + @Override + protected void init() { + super.init(); + urls.put(ActionType.VIDEO, CloudCenter.getInstance().acquireUrlByKind("bbs.video.en")); + urls.put(ActionType.HELP_DOCUMENT, CloudCenter.getInstance().acquireUrlByKind("help.en_US.10")); + urls.put(ActionType.ACTIVATION_CODE, CloudCenter.getInstance().acquireUrlByKind("frlogin.en")); + } + +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java b/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java index 7e0d6b359..52103026a 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java @@ -47,6 +47,7 @@ import com.fr.design.gui.imenu.UIMenu; import com.fr.design.gui.imenu.UIMenuBar; import com.fr.design.gui.itoolbar.UILargeToolbar; import com.fr.design.gui.itoolbar.UIToolbar; +import com.fr.design.i18n.LocaleCenter; import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.ToolBarNewTemplatePane; import com.fr.design.menu.MenuDef; @@ -543,9 +544,7 @@ public abstract class ToolBarMenuDock { shortCuts.add(new CusDemandAction()); shortCuts.add(new CenterAction()); shortCuts.add(new SignAction()); - if (Locale.TAIWAN.equals(GeneralContext.getLocale())) { - shortCuts.add(new FacebookFansAction()); - } + LocaleCenter.getInstance().getLocaleAction(GeneralContext.getLocale()).addAction(shortCuts, new FacebookFansAction()); return shortCuts.toArray(new ShortCut[shortCuts.size()]); } diff --git a/designer-realize/src/main/java/com/fr/start/CollectUserInformationDialog.java b/designer-realize/src/main/java/com/fr/start/CollectUserInformationDialog.java index c32c2307d..f74fb7966 100644 --- a/designer-realize/src/main/java/com/fr/start/CollectUserInformationDialog.java +++ b/designer-realize/src/main/java/com/fr/start/CollectUserInformationDialog.java @@ -7,11 +7,11 @@ import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itextarea.DescriptionTextArea; import com.fr.design.gui.itextfield.UITextField; +import com.fr.design.i18n.ActionType; +import com.fr.design.i18n.LocaleCenter; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.ActiveKeyGenerator; import com.fr.design.utils.gui.GUICoreUtils; -import com.fr.general.CloudCenter; -import com.fr.general.ComparatorUtils; import com.fr.general.GeneralContext; import javax.swing.*; @@ -31,11 +31,6 @@ public class CollectUserInformationDialog extends UIDialog { private static final int ONLINE_VERIFY_TIMEOUT = 30 * 1000; - private static final String CN_LOGIN_HTML = CloudCenter.getInstance().acquireUrlByKind("frlogin.cn"); - private static final String EN_LOGIN_HTML = CloudCenter.getInstance().acquireUrlByKind("frlogin.en"); - private static final String TW_LOGIN_HTML = CloudCenter.getInstance().acquireUrlByKind("frlogin.tw"); - private static final String JP_LOGIN_HTML = CloudCenter.getInstance().acquireUrlByKind("frlogin.jp"); - private UITextField keyTextField; private ActionListener actionListener = new ActionListener() { @@ -130,18 +125,8 @@ public class CollectUserInformationDialog extends UIDialog { private void getKeyAction() { Locale locale = GeneralContext.getLocale(); - String url = EN_LOGIN_HTML; - if (ComparatorUtils.equals(locale, Locale.TAIWAN)) { - url = TW_LOGIN_HTML; - } - if (ComparatorUtils.equals(locale, Locale.CHINA)) { - url = CN_LOGIN_HTML; - } - if (ComparatorUtils.equals(locale, Locale.JAPAN)) { - url = JP_LOGIN_HTML; - } try { - Desktop.getDesktop().browse(new URI(url)); + Desktop.getDesktop().browse(new URI(LocaleCenter.getInstance().getLocaleAction(locale).getUrls().get(ActionType.ACTIVATION_CODE))); } catch (Exception ignored) { } diff --git a/designer-realize/src/main/java/com/fr/start/SplashContext.java b/designer-realize/src/main/java/com/fr/start/SplashContext.java index 17eff62ba..17a4897b3 100644 --- a/designer-realize/src/main/java/com/fr/start/SplashContext.java +++ b/designer-realize/src/main/java/com/fr/start/SplashContext.java @@ -1,6 +1,7 @@ package com.fr.start; import com.fr.design.DesignerEnvManager; +import com.fr.design.i18n.LocaleCenter; import com.fr.design.mainframe.bbs.BBSConstants; import com.fr.event.Event; import com.fr.event.EventDispatcher; @@ -166,13 +167,6 @@ public class SplashContext { } private static String getSplashPath() { - Locale locale = DesignerEnvManager.getEnvManager().getLanguage(); - if (Locale.US.equals(locale) || Locale.KOREA.equals(locale) || Locale.TAIWAN.equals(locale)) { - return "/com/fr/design/images/splash_10_en.gif"; - } else if (Locale.JAPAN.equals(locale)) { - return "/com/fr/design/images/splash_10_jp.gif"; - } else { - return "/com/fr/design/images/splash_10.gif"; - } + return LocaleCenter.getInstance().getLocaleAction(DesignerEnvManager.getEnvManager().getLanguage()).getSplashPath(); } } From 4418950c11964bca1176e13b6e2de882f8922220 Mon Sep 17 00:00:00 2001 From: "yaoh.wu" Date: Tue, 4 Jun 2019 15:14:55 +0800 Subject: [PATCH 12/21] =?UTF-8?q?REPORT-17527=20=E6=8E=A8=E9=80=81?= =?UTF-8?q?=E8=BF=9C=E7=A8=8B=E8=AE=BE=E8=AE=A1=E8=A7=A6=E5=8F=91=E7=9A=84?= =?UTF-8?q?=E6=8A=A5=E8=A1=A8=E9=A2=84=E8=A7=88=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/actions/file/WebPreviewUtils.java | 89 ++++++++++++------- 1 file changed, 59 insertions(+), 30 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/actions/file/WebPreviewUtils.java b/designer-base/src/main/java/com/fr/design/actions/file/WebPreviewUtils.java index de223e2cc..f3bfe5622 100644 --- a/designer-base/src/main/java/com/fr/design/actions/file/WebPreviewUtils.java +++ b/designer-base/src/main/java/com/fr/design/actions/file/WebPreviewUtils.java @@ -1,7 +1,8 @@ package com.fr.design.actions.file; -import com.fr.base.vcs.DesignerMode; +import com.fr.design.base.mode.DesignModeContext; import com.fr.design.fun.PreviewProvider; +import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.JTemplate; import com.fr.design.utils.DesignUtils; @@ -10,41 +11,56 @@ import com.fr.file.FileNodeFILE; import com.fr.general.GeneralUtils; import com.fr.general.web.ParameterConstants; import com.fr.stable.project.ProjectConstants; +import com.fr.web.referrer.DesignSessionReferrer; -import javax.swing.JOptionPane; -import java.util.Collections; +import java.util.ArrayList; import java.util.HashMap; +import java.util.List; import java.util.Map; +import static javax.swing.JOptionPane.OK_CANCEL_OPTION; +import static javax.swing.JOptionPane.OK_OPTION; +import static javax.swing.JOptionPane.WARNING_MESSAGE; +import static javax.swing.JOptionPane.showConfirmDialog; + public final class WebPreviewUtils { public static void preview(JTemplate jt) { preview(jt, jt.getPreviewType()); } - @SuppressWarnings("unchecked") public static void preview(JTemplate jt, PreviewProvider provider) { String baseRoute = jt.route(); - if (provider == null) { - actionPerformed(jt, baseRoute, Collections.EMPTY_MAP, ParameterConstants.VIEWLET); - } else { - actionPerformed(jt, baseRoute, provider.parametersForPreview(), provider.getActionType()); + + String previewType = ParameterConstants.VIEWLET; + Map paraMap = new HashMap<>(getExtraPara()); + + if (provider != null) { + Map providerParaMap = provider.parametersForPreview(); + if (providerParaMap != null) { + paraMap.putAll(providerParaMap); + } + previewType = provider.getActionType(); } + actionPerformed(jt, baseRoute, paraMap, previewType); + } + + private static Map getExtraPara() { + Map extraPara = new HashMap<>(); + if (DesignModeContext.isVcsMode()) { + extraPara.put("mode", DesignModeContext.getMode().toString()); + + } + extraPara.putAll(new DesignSessionReferrer.Builder().referrerMap()); + + return extraPara; } private static void actionPerformed(JTemplate jt, String baseRoute, Map map, String actionType) { if (jt == null) { return; } - - if (map == null || map == Collections.EMPTY_MAP) { - map = new HashMap<>(); - } - if (DesignerMode.isVcsMode()) { - map.put("mode", DesignerMode.getMode().toString()); - } DesignerContext.getDesignerFrame().refreshToolbar(); - jt.stopEditing(); /* * alex:如果没有保存,先保存到Env @@ -54,17 +70,20 @@ public final class WebPreviewUtils { if (!jt.isSaved() && !jt.saveTemplate2Env()) { return; } - FILE currentTemplate = jt.getEditingFILE(); // carl:是否是保存在运行环境下的模板,不是就不能被预览 if (currentTemplate instanceof FileNodeFILE) { browseUrl(currentTemplate, baseRoute, map, actionType, jt); } else { // 说明模板没有保存在报表运行环境下面,提示用户 - int selVal = JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Web_Preview_Message"), - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preview_Tool_Tips"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE); + int selVal = showConfirmDialog( + DesignerContext.getDesignerFrame(), + Toolkit.i18nText("Fine-Design_Basic_Web_Preview_Message"), + Toolkit.i18nText("Fine-Design_Basic_Preview_Tool_Tips"), + OK_CANCEL_OPTION, + WARNING_MESSAGE); - if (JOptionPane.OK_OPTION == selVal) { + if (OK_OPTION == selVal) { if (!jt.saveAsTemplate2Env()) { return; } @@ -74,7 +93,10 @@ public final class WebPreviewUtils { } } - private static void browseUrl(FILE currentTemplate, String baseRoute, Map map, String actionType, JTemplate jt) { + private static void browseUrl(FILE currentTemplate, + String baseRoute, + Map map, + String actionType, JTemplate jt) { if (!(currentTemplate instanceof FileNodeFILE)) { return; } @@ -85,8 +107,8 @@ public final class WebPreviewUtils { path = path.substring(ProjectConstants.REPORTLETS_NAME.length() + 1); } - java.util.List parameterNameList = new java.util.ArrayList(); - java.util.List parameterValueList = new java.util.ArrayList(); + List parameterNameList = new ArrayList<>(); + List parameterValueList = new ArrayList<>(); parameterNameList.add(actionType); parameterValueList.add(path); @@ -96,14 +118,21 @@ public final class WebPreviewUtils { parameterValueList.add(GeneralUtils.objectToString(map.get(key))); } } - DesignUtils.visitEnvServerByParameters(baseRoute, parameterNameList.toArray(new String[parameterNameList.size()]), parameterValueList.toArray(new String[parameterValueList.size()])); + DesignUtils.visitEnvServerByParameters( + baseRoute, + parameterNameList.toArray(new String[0]), + parameterValueList.toArray(new String[0]) + ); } else { - int selVal = JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Web_Preview_Message"), - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preview_Tool_Tips"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE); - if (JOptionPane.OK_OPTION == selVal) { - if (!jt.saveAsTemplate()) { - return; - } + int selVal = showConfirmDialog( + DesignerContext.getDesignerFrame(), + Toolkit.i18nText("Fine-Design_Basic_Web_Preview_Message"), + Toolkit.i18nText("Fine-Design_Basic_Preview_Tool_Tips"), + OK_CANCEL_OPTION, + WARNING_MESSAGE + ); + if (OK_OPTION == selVal) { + jt.saveAsTemplate(); } } } From bfc341f3b0113e61227940f8941f0ec33b91e954 Mon Sep 17 00:00:00 2001 From: Hades Date: Tue, 4 Jun 2019 19:56:13 +0800 Subject: [PATCH 13/21] update --- .../design/actions/community/VideoAction.java | 2 +- .../main/java/com/fr/design/i18n/Action.java | 21 +++++++++++++++ .../java/com/fr/design/i18n/ActionType.java | 6 +++++ .../java/com/fr/design/i18n/LocaleCenter.java | 15 ++++++++++- .../com/fr/design/i18n/LocaleDifference.java | 23 +++++++++++++--- .../impl/AbstractDefaultLocaleAction.java | 27 ++++++++++++++++--- .../design/i18n/impl/ChinaLocaleAction.java | 13 +++++++++ .../design/i18n/impl/JapanLocaleAction.java | 13 +++++++++ .../design/i18n/impl/KoreaLocaleAction.java | 11 ++++++++ .../design/i18n/impl/TaiWanLocaleAction.java | 11 ++++++-- .../fr/design/i18n/impl/USLocaleAction.java | 12 +++++++++ .../mainframe/toolbar/ToolBarMenuDock.java | 10 +++++-- .../start/CollectUserInformationDialog.java | 3 +-- .../main/java/com/fr/start/SplashContext.java | 5 ++-- 14 files changed, 153 insertions(+), 19 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/i18n/Action.java diff --git a/designer-base/src/main/java/com/fr/design/actions/community/VideoAction.java b/designer-base/src/main/java/com/fr/design/actions/community/VideoAction.java index 6eea8cc15..e405f3bb5 100644 --- a/designer-base/src/main/java/com/fr/design/actions/community/VideoAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/community/VideoAction.java @@ -26,7 +26,7 @@ public class VideoAction extends UpdateAction @Override public void actionPerformed(ActionEvent arg0) { - BrowseUtils.browser(LocaleCenter.getInstance().getLocaleAction(GeneralContext.getLocale()).getUrls().get(ActionType.VIDEO)); + BrowseUtils.browser(LocaleCenter.getInstance().getLocaleAction().getUrls().get(ActionType.VIDEO)); } public static final MenuKeySet VIDEO = new MenuKeySet() { diff --git a/designer-base/src/main/java/com/fr/design/i18n/Action.java b/designer-base/src/main/java/com/fr/design/i18n/Action.java new file mode 100644 index 000000000..a976ae4b7 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/i18n/Action.java @@ -0,0 +1,21 @@ +package com.fr.design.i18n; + +/** + * 包装一些动作 + * @author Hades + * @date 2019/6/4 + */ +public interface Action { + + Action EMPTY_ACTION = new Action() { + @Override + public void todo() { + // do nothing + } + }; + + /** + * 具体动作 + */ + void todo(); +} diff --git a/designer-base/src/main/java/com/fr/design/i18n/ActionType.java b/designer-base/src/main/java/com/fr/design/i18n/ActionType.java index 1f6b9943a..724d3df66 100644 --- a/designer-base/src/main/java/com/fr/design/i18n/ActionType.java +++ b/designer-base/src/main/java/com/fr/design/i18n/ActionType.java @@ -1,5 +1,11 @@ package com.fr.design.i18n; +/** + * 不同语言环境下的action + * + * @author Hades + * @date 2019/5/30 + */ public enum ActionType { /** diff --git a/designer-base/src/main/java/com/fr/design/i18n/LocaleCenter.java b/designer-base/src/main/java/com/fr/design/i18n/LocaleCenter.java index 79476f15f..20bc09611 100644 --- a/designer-base/src/main/java/com/fr/design/i18n/LocaleCenter.java +++ b/designer-base/src/main/java/com/fr/design/i18n/LocaleCenter.java @@ -1,15 +1,24 @@ package com.fr.design.i18n; +import com.fr.design.DesignerEnvManager; import com.fr.design.i18n.impl.ChinaLocaleAction; import com.fr.design.i18n.impl.JapanLocaleAction; import com.fr.design.i18n.impl.KoreaLocaleAction; import com.fr.design.i18n.impl.TaiWanLocaleAction; import com.fr.design.i18n.impl.USLocaleAction; +import com.fr.general.ComparatorUtils; +import com.fr.general.GeneralContext; import java.util.HashMap; import java.util.Locale; import java.util.Map; +/** + * 不同语言环境的动作管理 + * + * @author Hades + * @date 2019/5/30 + */ public class LocaleCenter { private Map actionMap = new HashMap(); @@ -34,7 +43,11 @@ public class LocaleCenter { return Holder.INSTANCE; } - public LocaleDifference getLocaleAction(Locale locale) { + public LocaleDifference getLocaleAction() { + Locale locale = GeneralContext.getLocale(); + if (!ComparatorUtils.equals(locale, DesignerEnvManager.getEnvManager().getLanguage())) { + locale = DesignerEnvManager.getEnvManager().getLanguage(); + } LocaleDifference localeDifference = actionMap.get(locale); return localeDifference == null ? actionMap.get(Locale.CHINA) : localeDifference; } diff --git a/designer-base/src/main/java/com/fr/design/i18n/LocaleDifference.java b/designer-base/src/main/java/com/fr/design/i18n/LocaleDifference.java index 41a7b26ce..d18ef8b9f 100644 --- a/designer-base/src/main/java/com/fr/design/i18n/LocaleDifference.java +++ b/designer-base/src/main/java/com/fr/design/i18n/LocaleDifference.java @@ -1,10 +1,14 @@ package com.fr.design.i18n; import java.util.List; +import java.util.Locale; import java.util.Map; /** * 国际化之间有不同表现的动作 + * + * @author Hades + * @date 2019/5/30 */ public interface LocaleDifference { @@ -16,11 +20,17 @@ public interface LocaleDifference { /** - * 添加Action - * @param list 列表 - * @param action 对应action + * 哪些国际化需要执行该动作 + * @param locales */ - void addAction(List list, Object action); + void doAction(Locale ...locales); + + /** + * 构建具体的动作 + * @param action + * @return + */ + LocaleDifference buildAction(Action action); /** * 返回设计器启动画面路径 @@ -28,5 +38,10 @@ public interface LocaleDifference { */ String getSplashPath(); + /** + * 对应的国际化 + * @return + */ + Locale getLocale(); } diff --git a/designer-base/src/main/java/com/fr/design/i18n/impl/AbstractDefaultLocaleAction.java b/designer-base/src/main/java/com/fr/design/i18n/impl/AbstractDefaultLocaleAction.java index d190c990f..9ed01d31d 100644 --- a/designer-base/src/main/java/com/fr/design/i18n/impl/AbstractDefaultLocaleAction.java +++ b/designer-base/src/main/java/com/fr/design/i18n/impl/AbstractDefaultLocaleAction.java @@ -1,16 +1,28 @@ package com.fr.design.i18n.impl; +import com.fr.design.i18n.Action; import com.fr.design.i18n.LocaleDifference; import com.fr.design.i18n.ActionType; import com.fr.general.CloudCenter; +import com.fr.general.ComparatorUtils; +import java.util.ArrayList; +import java.util.Arrays; import java.util.EnumMap; import java.util.List; +import java.util.Locale; import java.util.Map; +/** + * 一些默认的实现 + * + * @author Hades + * @date 2019/5/30 + */ public abstract class AbstractDefaultLocaleAction implements LocaleDifference { protected EnumMap urls = new EnumMap(ActionType.class); + private Action action = Action.EMPTY_ACTION; protected void init() { urls.put(ActionType.BBS, CloudCenter.getInstance().acquireUrlByKind("bbs")); @@ -28,14 +40,21 @@ public abstract class AbstractDefaultLocaleAction implements LocaleDifference { } @Override - public void addAction(List list, Object action) { - // do nothing + public void doAction(Locale ...locales) { + List localeList = Arrays.asList(locales); + if (localeList.contains(this.getLocale())) { + action.todo(); + } + } + + @Override + public LocaleDifference buildAction(Action action) { + this.action = action; + return this; } @Override public String getSplashPath() { return "/com/fr/design/images/splash_10_en.gif"; } - - } diff --git a/designer-base/src/main/java/com/fr/design/i18n/impl/ChinaLocaleAction.java b/designer-base/src/main/java/com/fr/design/i18n/impl/ChinaLocaleAction.java index c10c9b714..d2fc2c7f9 100644 --- a/designer-base/src/main/java/com/fr/design/i18n/impl/ChinaLocaleAction.java +++ b/designer-base/src/main/java/com/fr/design/i18n/impl/ChinaLocaleAction.java @@ -1,9 +1,22 @@ package com.fr.design.i18n.impl; +import java.util.Locale; + +/** + * 简体中文环境具体的表现动作 + * + * @author Hades + * @date 2019/5/30 + */ public class ChinaLocaleAction extends AbstractDefaultLocaleAction { @Override public String getSplashPath() { return "/com/fr/design/images/splash_10.gif"; } + + @Override + public Locale getLocale() { + return Locale.CHINA; + } } diff --git a/designer-base/src/main/java/com/fr/design/i18n/impl/JapanLocaleAction.java b/designer-base/src/main/java/com/fr/design/i18n/impl/JapanLocaleAction.java index 8a018bee0..81614bbb8 100644 --- a/designer-base/src/main/java/com/fr/design/i18n/impl/JapanLocaleAction.java +++ b/designer-base/src/main/java/com/fr/design/i18n/impl/JapanLocaleAction.java @@ -3,6 +3,14 @@ package com.fr.design.i18n.impl; import com.fr.design.i18n.ActionType; import com.fr.general.CloudCenter; +import java.util.Locale; + +/** + * 日文环境具体的表现动作 + * + * @author Hades + * @date 2019/5/30 + */ public class JapanLocaleAction extends AbstractDefaultLocaleAction { @Override @@ -17,5 +25,10 @@ public class JapanLocaleAction extends AbstractDefaultLocaleAction { return "/com/fr/design/images/splash_10_jp.gif"; } + @Override + public Locale getLocale() { + return Locale.JAPAN; + } + } diff --git a/designer-base/src/main/java/com/fr/design/i18n/impl/KoreaLocaleAction.java b/designer-base/src/main/java/com/fr/design/i18n/impl/KoreaLocaleAction.java index 0216ecdbd..5a5e9b8ed 100644 --- a/designer-base/src/main/java/com/fr/design/i18n/impl/KoreaLocaleAction.java +++ b/designer-base/src/main/java/com/fr/design/i18n/impl/KoreaLocaleAction.java @@ -1,6 +1,17 @@ package com.fr.design.i18n.impl; +import java.util.Locale; +/** + * 韩文环境具体的表现动作 + * + * @author Hades + * @date 2019/5/30 + */ public class KoreaLocaleAction extends AbstractDefaultLocaleAction { + @Override + public Locale getLocale() { + return Locale.KOREA; + } } diff --git a/designer-base/src/main/java/com/fr/design/i18n/impl/TaiWanLocaleAction.java b/designer-base/src/main/java/com/fr/design/i18n/impl/TaiWanLocaleAction.java index 2985e7416..f9e8df2af 100644 --- a/designer-base/src/main/java/com/fr/design/i18n/impl/TaiWanLocaleAction.java +++ b/designer-base/src/main/java/com/fr/design/i18n/impl/TaiWanLocaleAction.java @@ -4,7 +4,14 @@ import com.fr.design.i18n.ActionType; import com.fr.general.CloudCenter; import java.util.List; +import java.util.Locale; +/** + * 繁体中文具体的表现动作 + * + * @author Hades + * @date 2019/5/30 + */ public class TaiWanLocaleAction extends AbstractDefaultLocaleAction { @Override @@ -15,7 +22,7 @@ public class TaiWanLocaleAction extends AbstractDefaultLocaleAction { } @Override - public void addAction(List list, Object action) { - list.add(action); + public Locale getLocale() { + return Locale.TAIWAN; } } diff --git a/designer-base/src/main/java/com/fr/design/i18n/impl/USLocaleAction.java b/designer-base/src/main/java/com/fr/design/i18n/impl/USLocaleAction.java index bdd305761..4acfc3db1 100644 --- a/designer-base/src/main/java/com/fr/design/i18n/impl/USLocaleAction.java +++ b/designer-base/src/main/java/com/fr/design/i18n/impl/USLocaleAction.java @@ -3,6 +3,14 @@ package com.fr.design.i18n.impl; import com.fr.design.i18n.ActionType; import com.fr.general.CloudCenter; +import java.util.Locale; + +/** + * 英文环境具体的表现动作 + * + * @author Hades + * @date 2019/5/30 + */ public class USLocaleAction extends AbstractDefaultLocaleAction { @Override @@ -13,4 +21,8 @@ public class USLocaleAction extends AbstractDefaultLocaleAction { urls.put(ActionType.ACTIVATION_CODE, CloudCenter.getInstance().acquireUrlByKind("frlogin.en")); } + @Override + public Locale getLocale() { + return Locale.US; + } } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java b/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java index 52103026a..3fad25f6f 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java @@ -47,6 +47,7 @@ import com.fr.design.gui.imenu.UIMenu; import com.fr.design.gui.imenu.UIMenuBar; import com.fr.design.gui.itoolbar.UILargeToolbar; import com.fr.design.gui.itoolbar.UIToolbar; +import com.fr.design.i18n.Action; import com.fr.design.i18n.LocaleCenter; import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.ToolBarNewTemplatePane; @@ -533,7 +534,7 @@ public abstract class ToolBarMenuDock { * @return 社区菜单的子菜单 */ public ShortCut[] createCommunityShortCuts() { - java.util.List shortCuts = new ArrayList(); + final java.util.List shortCuts = new ArrayList(); shortCuts.add(new BBSAction()); shortCuts.add(new VideoAction()); shortCuts.add(new TutorialAction()); @@ -544,7 +545,12 @@ public abstract class ToolBarMenuDock { shortCuts.add(new CusDemandAction()); shortCuts.add(new CenterAction()); shortCuts.add(new SignAction()); - LocaleCenter.getInstance().getLocaleAction(GeneralContext.getLocale()).addAction(shortCuts, new FacebookFansAction()); + LocaleCenter.getInstance().getLocaleAction().buildAction(new Action() { + @Override + public void todo() { + shortCuts.add(new FacebookFansAction()); + } + }).doAction(Locale.TAIWAN); return shortCuts.toArray(new ShortCut[shortCuts.size()]); } diff --git a/designer-realize/src/main/java/com/fr/start/CollectUserInformationDialog.java b/designer-realize/src/main/java/com/fr/start/CollectUserInformationDialog.java index f74fb7966..1ec071281 100644 --- a/designer-realize/src/main/java/com/fr/start/CollectUserInformationDialog.java +++ b/designer-realize/src/main/java/com/fr/start/CollectUserInformationDialog.java @@ -124,9 +124,8 @@ public class CollectUserInformationDialog extends UIDialog { private void getKeyAction() { - Locale locale = GeneralContext.getLocale(); try { - Desktop.getDesktop().browse(new URI(LocaleCenter.getInstance().getLocaleAction(locale).getUrls().get(ActionType.ACTIVATION_CODE))); + Desktop.getDesktop().browse(new URI(LocaleCenter.getInstance().getLocaleAction().getUrls().get(ActionType.ACTIVATION_CODE))); } catch (Exception ignored) { } diff --git a/designer-realize/src/main/java/com/fr/start/SplashContext.java b/designer-realize/src/main/java/com/fr/start/SplashContext.java index 17a4897b3..9fcdad122 100644 --- a/designer-realize/src/main/java/com/fr/start/SplashContext.java +++ b/designer-realize/src/main/java/com/fr/start/SplashContext.java @@ -1,6 +1,5 @@ package com.fr.start; -import com.fr.design.DesignerEnvManager; import com.fr.design.i18n.LocaleCenter; import com.fr.design.mainframe.bbs.BBSConstants; import com.fr.event.Event; @@ -25,7 +24,7 @@ import java.util.concurrent.TimeUnit; public class SplashContext { public static final String SPLASH_PATH = getSplashPath(); - public static final String SPLASH_CACHE_NAME = SPLASH_PATH.substring(SPLASH_PATH.lastIndexOf("/") + 1); + public static final String SPLASH_CACHE_NAME = SPLASH_PATH.substring(SPLASH_PATH.lastIndexOf('/') + 1); private static final int FETCH_ONLINE_MAX_TIMES = 50; private static final SplashContext SPLASH_CONTEXT = new SplashContext(); @@ -167,6 +166,6 @@ public class SplashContext { } private static String getSplashPath() { - return LocaleCenter.getInstance().getLocaleAction(DesignerEnvManager.getEnvManager().getLanguage()).getSplashPath(); + return LocaleCenter.getInstance().getLocaleAction().getSplashPath(); } } From f9fb1389e67f6b10aa7378203fb98ca97d9e2fa0 Mon Sep 17 00:00:00 2001 From: zack Date: Wed, 5 Jun 2019 09:24:53 +0800 Subject: [PATCH 14/21] =?UTF-8?q?MOBILE-21196=20=E3=80=90=E6=80=A7?= =?UTF-8?q?=E8=83=BD=E3=80=91=E7=A7=BB=E5=8A=A8=E7=AB=AF=E3=80=8B=E6=8A=A5?= =?UTF-8?q?=E8=A1=A8=E3=80=8B=E6=89=93=E5=BC=80=E5=B0=91=E6=95=B0=E5=8D=95?= =?UTF-8?q?=E5=85=83=E6=A0=BC=E6=8F=92=E5=85=A5=E5=9B=BE=E7=89=87=E7=9A=84?= =?UTF-8?q?=E6=A8=A1=E6=9D=BF=EF=BC=8C=E5=87=BA=E7=8E=B0=E5=8A=A0=E8=BD=BD?= =?UTF-8?q?=E7=BC=93=E6=85=A2=EF=BC=8C=E6=97=B6=E9=97=B4=E5=9C=A85s?= =?UTF-8?q?=E4=BB=A5=E4=B8=8A=E4=B8=8D=E7=AD=89=20=20=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E9=83=A8=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/gui/frpane/ImgChooseWrapper.java | 4 ++-- .../ImageBackgroundQuickPane.java | 2 +- .../backgroundpane/ImagePreviewPane.java | 2 +- .../background/image/ImagePreviewPane.java | 2 +- .../java/com/fr/design/utils/ImageUtils.java | 19 +++++++++++++--- .../com/fr/design/mainframe/JWorkBook.java | 4 +++- .../com/fr/design/report/SelectImagePane.java | 22 +++++-------------- 7 files changed, 30 insertions(+), 25 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/frpane/ImgChooseWrapper.java b/designer-base/src/main/java/com/fr/design/gui/frpane/ImgChooseWrapper.java index 36183f107..19823d8b4 100644 --- a/designer-base/src/main/java/com/fr/design/gui/frpane/ImgChooseWrapper.java +++ b/designer-base/src/main/java/com/fr/design/gui/frpane/ImgChooseWrapper.java @@ -7,7 +7,6 @@ import com.fr.design.style.background.image.ImageFileChooser; import com.fr.design.style.background.image.ImagePreviewer; import com.fr.design.utils.ImageUtils; import com.fr.general.ImageWithSuffix; - import com.fr.stable.CoreGraphHelper; import com.fr.stable.StringUtils; @@ -16,6 +15,7 @@ import javax.swing.SwingWorker; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import java.awt.Image; +import java.awt.image.BufferedImage; import java.io.File; /** @@ -103,7 +103,7 @@ public class ImgChooseWrapper { if (imageFileChooser.isCheckSelected()) { imageWithSuffix = ImageUtils.defaultImageCompWithSuff(selectedFile); } else { - Image image = BaseUtils.readImage(selectedFile.getPath()); + BufferedImage image = BaseUtils.readImage(selectedFile.getPath()); String type = ImageUtils.getImageType(selectedFile); imageWithSuffix = new ImageWithSuffix(image, type); } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/ImageBackgroundQuickPane.java b/designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/ImageBackgroundQuickPane.java index 7f794b708..afa6fc907 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/ImageBackgroundQuickPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/ImageBackgroundQuickPane.java @@ -114,7 +114,7 @@ public class ImageBackgroundQuickPane extends BackgroundQuickPane { @Override public Background updateBean() { - ImageFileBackground imageBackground = new ImageFileBackground(previewPane.getImage(), suffix); + ImageFileBackground imageBackground = new ImageFileBackground(previewPane.getImageWithSuffix()); imageStyle = Style.DEFAULT_STYLE.deriveImageLayout(imageLayoutPane.getSelectedItem()); imageBackground.setLayout(imageStyle.getImageLayout()); return imageBackground; diff --git a/designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/ImagePreviewPane.java b/designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/ImagePreviewPane.java index 6b9882397..24b3ebfc4 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/ImagePreviewPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/ImagePreviewPane.java @@ -304,7 +304,7 @@ public class ImagePreviewPane extends JComponent implements Scrollable, ImagePre @Override public void setImage(Image image) { - setImageWithSuffix(image == null ? null : new ImageWithSuffix(image)); + setImageWithSuffix(ImageWithSuffix.build(image)); } diff --git a/designer-base/src/main/java/com/fr/design/style/background/image/ImagePreviewPane.java b/designer-base/src/main/java/com/fr/design/style/background/image/ImagePreviewPane.java index 0e5cbe463..bc4f3f41c 100644 --- a/designer-base/src/main/java/com/fr/design/style/background/image/ImagePreviewPane.java +++ b/designer-base/src/main/java/com/fr/design/style/background/image/ImagePreviewPane.java @@ -63,7 +63,7 @@ public class ImagePreviewPane extends JComponent implements Scrollable, ImagePre @Override public void setImage(Image image) { - setImageWithSuffix(image == null ? null : new ImageWithSuffix(image)); + setImageWithSuffix(ImageWithSuffix.build(image)); } diff --git a/designer-base/src/main/java/com/fr/design/utils/ImageUtils.java b/designer-base/src/main/java/com/fr/design/utils/ImageUtils.java index 33f928a46..389b9981e 100644 --- a/designer-base/src/main/java/com/fr/design/utils/ImageUtils.java +++ b/designer-base/src/main/java/com/fr/design/utils/ImageUtils.java @@ -1,6 +1,7 @@ package com.fr.design.utils; import com.fr.base.BaseUtils; +import com.fr.base.frpx.util.ImageIOHelper; import com.fr.general.ComparatorUtils; import com.fr.general.FRLogger; import com.fr.general.ImageWithSuffix; @@ -70,7 +71,7 @@ public class ImageUtils { return null; } BufferedImage srcImg = BaseUtils.readImage(imageFile.getPath()); - Image desImg = srcImg; + BufferedImage desImg = srcImg; try { if (canbeCompressedToJPEG(imageFile)) { @@ -186,11 +187,23 @@ public class ImageUtils { /** * 获取图片类型 + * 先根据ImageReader获取,ImageReader获取不到就拿后缀 * * @param imageFile 图片文件 * @return 图片类型(JPEG, PNG, GIF) */ public static String getImageType(File imageFile) { + String imageType = getImageTypeByImageReader(imageFile); + return StringUtils.EMPTY.equals(imageType) ? ImageIOHelper.getSuffix(imageFile) : imageType; + } + + /** + * 根据ImageReader获取图片类型 + * + * @param imageFile 图片文件 + * @return 图片类型(JPEG, PNG, GIF) + */ + public static String getImageTypeByImageReader(File imageFile) { try { ImageInputStream iis = ImageIO.createImageInputStream(imageFile); Iterator iter = ImageIO.getImageReaders(iis); @@ -226,7 +239,7 @@ public class ImageUtils { * @param scale 缩放比例。比例大于1时为放大,小于1大于0为缩小 * @param opacityCompatible 是否处理背景透明 */ - public static Image scale(BufferedImage srcImg, float scale, boolean opacityCompatible) { + public static BufferedImage scale(BufferedImage srcImg, float scale, boolean opacityCompatible) { if (scale < 0) { // 自动修正负数 scale = -scale; @@ -234,7 +247,7 @@ public class ImageUtils { int width = mul(Integer.toString(srcImg.getWidth(null)), Float.toString(scale)).intValue(); // 得到源图宽 int height = mul(Integer.toString(srcImg.getHeight(null)), Float.toString(scale)).intValue(); // 得到源图长 - return scale(srcImg, width, height, opacityCompatible); + return CoreGraphHelper.toBufferedImage(scale(srcImg, width, height, opacityCompatible)); } private static BigDecimal mul(String v1, String v2) { diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java b/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java index 07136bc1e..6e72e98fe 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java @@ -68,6 +68,7 @@ import com.fr.file.FILE; import com.fr.file.FileNodeFILE; import com.fr.file.filetree.FileNode; import com.fr.general.ComparatorUtils; +import com.fr.general.ImageWithSuffix; import com.fr.general.ModuleContext; import com.fr.grid.Grid; import com.fr.grid.GridUtils; @@ -89,6 +90,7 @@ import com.fr.report.elementcase.TemplateElementCase; import com.fr.report.poly.PolyWorkSheet; import com.fr.report.worksheet.WorkSheet; import com.fr.stable.ArrayUtils; +import com.fr.stable.CoreGraphHelper; import com.fr.stable.StableUtils; import com.fr.stable.StringUtils; import com.fr.stable.module.Module; @@ -621,7 +623,7 @@ public class JWorkBook extends JTemplate { if (workBook instanceof WorkBookAdapter) { elem.setValue(new CellImagePainter(cellImage)); } else { - elem.setValue(cellImage.getImage()); + elem.setValue(ImageWithSuffix.build(cellImage.getImage(),cellImage.getSuffix())); } } diff --git a/designer-realize/src/main/java/com/fr/design/report/SelectImagePane.java b/designer-realize/src/main/java/com/fr/design/report/SelectImagePane.java index 77a662d6d..ba57676ec 100644 --- a/designer-realize/src/main/java/com/fr/design/report/SelectImagePane.java +++ b/designer-realize/src/main/java/com/fr/design/report/SelectImagePane.java @@ -2,16 +2,15 @@ package com.fr.design.report; import com.fr.base.BaseUtils; import com.fr.base.Style; -import com.fr.base.frpx.pack.PictureCollection; -import com.fr.base.frpx.util.ImageIOHelper; import com.fr.design.dialog.BasicPane; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIRadioButton; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.style.background.image.ImageFileChooser; import com.fr.design.style.background.image.ImagePreviewPane; +import com.fr.design.utils.ImageUtils; import com.fr.design.utils.gui.GUICoreUtils; - +import com.fr.general.ImageWithSuffix; import com.fr.report.cell.Elem; import com.fr.report.cell.cellattr.CellImage; import com.fr.report.cell.painter.CellImagePainter; @@ -28,6 +27,7 @@ import java.awt.GridLayout; import java.awt.Image; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import java.awt.image.BufferedImage; import java.io.File; /** @@ -46,11 +46,6 @@ public class SelectImagePane extends BasicPane { private Image previewImage = null; - /** - * 默认格式 - */ - private String suffix = PictureCollection.DEFAULT_SUFFIX; - private File imageFile; public SelectImagePane() { @@ -127,13 +122,12 @@ public class SelectImagePane extends BasicPane { if (selectedFile != null && selectedFile.isFile()) { String filePath = selectedFile.getPath(); - suffix = ImageIOHelper.getSuffix(filePath); - Image image = BaseUtils.readImage(filePath); + BufferedImage image = BaseUtils.readImage(filePath); CoreGraphHelper.waitForImage(image); imageFile = selectedFile; setImageStyle(); - previewPane.setImage(image); + previewPane.setImageWithSuffix(ImageWithSuffix.build(image, ImageUtils.getImageType(selectedFile))); previewPane.setImageStyle(imageStyle); previewImage = image; } else { @@ -184,7 +178,6 @@ public class SelectImagePane extends BasicPane { setImage((Image) value); } else if (value instanceof CellImagePainter) { setImage(((CellImagePainter) value).getImage()); - suffix = ((CellImagePainter) value).getSuffix(); } style = cell.getStyle(); @@ -214,11 +207,8 @@ public class SelectImagePane extends BasicPane { public CellImage update() { CellImage cellImage = new CellImage(); - cellImage.setImage(previewPane.getImage()); + cellImage.setImage(previewPane.getImageWithSuffix()); cellImage.setStyle(this.imageStyle); - if (suffix != null) { - cellImage.setSuffix(suffix); - } return cellImage; } From 63cf9064fe8b4e2032908cf60f5f9cb6e505b062 Mon Sep 17 00:00:00 2001 From: Hades Date: Wed, 5 Jun 2019 09:38:04 +0800 Subject: [PATCH 15/21] =?UTF-8?q?REPORT-17656=20=E5=86=B3=E7=AD=96?= =?UTF-8?q?=E6=8A=A5=E8=A1=A8=E6=8A=A5=E8=A1=A8=E5=9D=97=E5=A4=8D=E5=88=B6?= =?UTF-8?q?=E5=90=8E=E5=80=BC=E8=A2=AB=E6=B8=85=E7=A9=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/actions/community/VideoAction.java | 16 +++-- .../main/java/com/fr/design/i18n/Action.java | 21 ------- .../java/com/fr/design/i18n/ActionType.java | 38 ------------ .../java/com/fr/design/i18n/LocaleCenter.java | 54 ----------------- .../com/fr/design/i18n/LocaleDifference.java | 47 --------------- .../impl/AbstractDefaultLocaleAction.java | 60 ------------------- .../design/i18n/impl/ChinaLocaleAction.java | 22 ------- .../design/i18n/impl/JapanLocaleAction.java | 34 ----------- .../design/i18n/impl/KoreaLocaleAction.java | 17 ------ .../design/i18n/impl/TaiWanLocaleAction.java | 28 --------- .../fr/design/i18n/impl/USLocaleAction.java | 28 --------- .../mainframe/toolbar/ToolBarMenuDock.java | 13 ++-- .../com/fr/grid/GridCornerMouseHandler.java | 2 + .../start/CollectUserInformationDialog.java | 22 ++++++- .../main/java/com/fr/start/SplashContext.java | 15 +++-- 15 files changed, 47 insertions(+), 370 deletions(-) delete mode 100644 designer-base/src/main/java/com/fr/design/i18n/Action.java delete mode 100644 designer-base/src/main/java/com/fr/design/i18n/ActionType.java delete mode 100644 designer-base/src/main/java/com/fr/design/i18n/LocaleCenter.java delete mode 100644 designer-base/src/main/java/com/fr/design/i18n/LocaleDifference.java delete mode 100644 designer-base/src/main/java/com/fr/design/i18n/impl/AbstractDefaultLocaleAction.java delete mode 100644 designer-base/src/main/java/com/fr/design/i18n/impl/ChinaLocaleAction.java delete mode 100644 designer-base/src/main/java/com/fr/design/i18n/impl/JapanLocaleAction.java delete mode 100644 designer-base/src/main/java/com/fr/design/i18n/impl/KoreaLocaleAction.java delete mode 100644 designer-base/src/main/java/com/fr/design/i18n/impl/TaiWanLocaleAction.java delete mode 100644 designer-base/src/main/java/com/fr/design/i18n/impl/USLocaleAction.java diff --git a/designer-base/src/main/java/com/fr/design/actions/community/VideoAction.java b/designer-base/src/main/java/com/fr/design/actions/community/VideoAction.java index e405f3bb5..7fa6314d6 100644 --- a/designer-base/src/main/java/com/fr/design/actions/community/VideoAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/community/VideoAction.java @@ -1,15 +1,15 @@ package com.fr.design.actions.community; +import com.fr.base.BaseUtils; import com.fr.design.actions.UpdateAction; -import com.fr.design.i18n.ActionType; -import com.fr.design.i18n.LocaleCenter; import com.fr.design.menu.MenuKeySet; import com.fr.design.utils.BrowseUtils; +import com.fr.general.CloudCenter; import com.fr.general.GeneralContext; -import com.fr.general.IOUtils; import javax.swing.*; import java.awt.event.ActionEvent; +import java.util.Locale; public class VideoAction extends UpdateAction { @@ -19,14 +19,20 @@ public class VideoAction extends UpdateAction this.setMenuKeySet(VIDEO); this.setName(getMenuKeySet().getMenuName()); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(IOUtils.readIcon("/com/fr/design/images/bbs/video.png")); + this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/bbs/video.png")); } @Override public void actionPerformed(ActionEvent arg0) { - BrowseUtils.browser(LocaleCenter.getInstance().getLocaleAction().getUrls().get(ActionType.VIDEO)); + String url; + if (GeneralContext.getLocale().equals(Locale.US)) { + url = CloudCenter.getInstance().acquireUrlByKind("bbs.video.en"); + } else { + url = CloudCenter.getInstance().acquireUrlByKind("bbs.video"); + } + BrowseUtils.browser(url); } public static final MenuKeySet VIDEO = new MenuKeySet() { diff --git a/designer-base/src/main/java/com/fr/design/i18n/Action.java b/designer-base/src/main/java/com/fr/design/i18n/Action.java deleted file mode 100644 index a976ae4b7..000000000 --- a/designer-base/src/main/java/com/fr/design/i18n/Action.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.fr.design.i18n; - -/** - * 包装一些动作 - * @author Hades - * @date 2019/6/4 - */ -public interface Action { - - Action EMPTY_ACTION = new Action() { - @Override - public void todo() { - // do nothing - } - }; - - /** - * 具体动作 - */ - void todo(); -} diff --git a/designer-base/src/main/java/com/fr/design/i18n/ActionType.java b/designer-base/src/main/java/com/fr/design/i18n/ActionType.java deleted file mode 100644 index 724d3df66..000000000 --- a/designer-base/src/main/java/com/fr/design/i18n/ActionType.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.fr.design.i18n; - -/** - * 不同语言环境下的action - * - * @author Hades - * @date 2019/5/30 - */ -public enum ActionType { - - /** - * 视频教学 - */ - VIDEO("video"), - - /** - * 激活码 - */ - ACTIVATION_CODE("activationCode"), - - /** - * 帮助文档 - */ - HELP_DOCUMENT("helpDocument"), - - /** - * 论坛 - */ - BBS("bbs"); - - - private String description; - - ActionType(String description) { - this.description = description; - } - -} diff --git a/designer-base/src/main/java/com/fr/design/i18n/LocaleCenter.java b/designer-base/src/main/java/com/fr/design/i18n/LocaleCenter.java deleted file mode 100644 index 20bc09611..000000000 --- a/designer-base/src/main/java/com/fr/design/i18n/LocaleCenter.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.fr.design.i18n; - -import com.fr.design.DesignerEnvManager; -import com.fr.design.i18n.impl.ChinaLocaleAction; -import com.fr.design.i18n.impl.JapanLocaleAction; -import com.fr.design.i18n.impl.KoreaLocaleAction; -import com.fr.design.i18n.impl.TaiWanLocaleAction; -import com.fr.design.i18n.impl.USLocaleAction; -import com.fr.general.ComparatorUtils; -import com.fr.general.GeneralContext; - -import java.util.HashMap; -import java.util.Locale; -import java.util.Map; - -/** - * 不同语言环境的动作管理 - * - * @author Hades - * @date 2019/5/30 - */ -public class LocaleCenter { - - private Map actionMap = new HashMap(); - - private LocaleCenter() { - init(); - } - - private void init() { - actionMap.put(Locale.CHINA, new ChinaLocaleAction()); - actionMap.put(Locale.US, new USLocaleAction()); - actionMap.put(Locale.TAIWAN, new TaiWanLocaleAction()); - actionMap.put(Locale.JAPAN, new JapanLocaleAction()); - actionMap.put(Locale.KOREA, new KoreaLocaleAction()); - } - - private static class Holder { - private static final LocaleCenter INSTANCE = new LocaleCenter(); - } - - public static LocaleCenter getInstance() { - return Holder.INSTANCE; - } - - public LocaleDifference getLocaleAction() { - Locale locale = GeneralContext.getLocale(); - if (!ComparatorUtils.equals(locale, DesignerEnvManager.getEnvManager().getLanguage())) { - locale = DesignerEnvManager.getEnvManager().getLanguage(); - } - LocaleDifference localeDifference = actionMap.get(locale); - return localeDifference == null ? actionMap.get(Locale.CHINA) : localeDifference; - } -} diff --git a/designer-base/src/main/java/com/fr/design/i18n/LocaleDifference.java b/designer-base/src/main/java/com/fr/design/i18n/LocaleDifference.java deleted file mode 100644 index d18ef8b9f..000000000 --- a/designer-base/src/main/java/com/fr/design/i18n/LocaleDifference.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.fr.design.i18n; - -import java.util.List; -import java.util.Locale; -import java.util.Map; - -/** - * 国际化之间有不同表现的动作 - * - * @author Hades - * @date 2019/5/30 - */ -public interface LocaleDifference { - - /** - * 返回该国际化所有的url - * @return url - */ - Map getUrls(); - - - /** - * 哪些国际化需要执行该动作 - * @param locales - */ - void doAction(Locale ...locales); - - /** - * 构建具体的动作 - * @param action - * @return - */ - LocaleDifference buildAction(Action action); - - /** - * 返回设计器启动画面路径 - * @return 路径 - */ - String getSplashPath(); - - /** - * 对应的国际化 - * @return - */ - Locale getLocale(); - -} diff --git a/designer-base/src/main/java/com/fr/design/i18n/impl/AbstractDefaultLocaleAction.java b/designer-base/src/main/java/com/fr/design/i18n/impl/AbstractDefaultLocaleAction.java deleted file mode 100644 index 9ed01d31d..000000000 --- a/designer-base/src/main/java/com/fr/design/i18n/impl/AbstractDefaultLocaleAction.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.fr.design.i18n.impl; - -import com.fr.design.i18n.Action; -import com.fr.design.i18n.LocaleDifference; -import com.fr.design.i18n.ActionType; -import com.fr.general.CloudCenter; -import com.fr.general.ComparatorUtils; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.EnumMap; -import java.util.List; -import java.util.Locale; -import java.util.Map; - -/** - * 一些默认的实现 - * - * @author Hades - * @date 2019/5/30 - */ -public abstract class AbstractDefaultLocaleAction implements LocaleDifference { - - protected EnumMap urls = new EnumMap(ActionType.class); - private Action action = Action.EMPTY_ACTION; - - protected void init() { - urls.put(ActionType.BBS, CloudCenter.getInstance().acquireUrlByKind("bbs")); - urls.put(ActionType.VIDEO, CloudCenter.getInstance().acquireUrlByKind("bbs.video")); - urls.put(ActionType.ACTIVATION_CODE, CloudCenter.getInstance().acquireUrlByKind("frlogin.cn")); - urls.put(ActionType.HELP_DOCUMENT, CloudCenter.getInstance().acquireUrlByKind("help.zh_CN.10")); - } - - @Override - public Map getUrls() { - if (urls.isEmpty()) { - init(); - } - return urls; - } - - @Override - public void doAction(Locale ...locales) { - List localeList = Arrays.asList(locales); - if (localeList.contains(this.getLocale())) { - action.todo(); - } - } - - @Override - public LocaleDifference buildAction(Action action) { - this.action = action; - return this; - } - - @Override - public String getSplashPath() { - return "/com/fr/design/images/splash_10_en.gif"; - } -} diff --git a/designer-base/src/main/java/com/fr/design/i18n/impl/ChinaLocaleAction.java b/designer-base/src/main/java/com/fr/design/i18n/impl/ChinaLocaleAction.java deleted file mode 100644 index d2fc2c7f9..000000000 --- a/designer-base/src/main/java/com/fr/design/i18n/impl/ChinaLocaleAction.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.fr.design.i18n.impl; - -import java.util.Locale; - -/** - * 简体中文环境具体的表现动作 - * - * @author Hades - * @date 2019/5/30 - */ -public class ChinaLocaleAction extends AbstractDefaultLocaleAction { - - @Override - public String getSplashPath() { - return "/com/fr/design/images/splash_10.gif"; - } - - @Override - public Locale getLocale() { - return Locale.CHINA; - } -} diff --git a/designer-base/src/main/java/com/fr/design/i18n/impl/JapanLocaleAction.java b/designer-base/src/main/java/com/fr/design/i18n/impl/JapanLocaleAction.java deleted file mode 100644 index 81614bbb8..000000000 --- a/designer-base/src/main/java/com/fr/design/i18n/impl/JapanLocaleAction.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.fr.design.i18n.impl; - -import com.fr.design.i18n.ActionType; -import com.fr.general.CloudCenter; - -import java.util.Locale; - -/** - * 日文环境具体的表现动作 - * - * @author Hades - * @date 2019/5/30 - */ -public class JapanLocaleAction extends AbstractDefaultLocaleAction { - - @Override - protected void init() { - super.init(); - urls.put(ActionType.ACTIVATION_CODE, CloudCenter.getInstance().acquireUrlByKind("frlogin.jp")); - } - - - @Override - public String getSplashPath() { - return "/com/fr/design/images/splash_10_jp.gif"; - } - - @Override - public Locale getLocale() { - return Locale.JAPAN; - } - - -} diff --git a/designer-base/src/main/java/com/fr/design/i18n/impl/KoreaLocaleAction.java b/designer-base/src/main/java/com/fr/design/i18n/impl/KoreaLocaleAction.java deleted file mode 100644 index 5a5e9b8ed..000000000 --- a/designer-base/src/main/java/com/fr/design/i18n/impl/KoreaLocaleAction.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.fr.design.i18n.impl; - -import java.util.Locale; - -/** - * 韩文环境具体的表现动作 - * - * @author Hades - * @date 2019/5/30 - */ -public class KoreaLocaleAction extends AbstractDefaultLocaleAction { - - @Override - public Locale getLocale() { - return Locale.KOREA; - } -} diff --git a/designer-base/src/main/java/com/fr/design/i18n/impl/TaiWanLocaleAction.java b/designer-base/src/main/java/com/fr/design/i18n/impl/TaiWanLocaleAction.java deleted file mode 100644 index f9e8df2af..000000000 --- a/designer-base/src/main/java/com/fr/design/i18n/impl/TaiWanLocaleAction.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.fr.design.i18n.impl; - -import com.fr.design.i18n.ActionType; -import com.fr.general.CloudCenter; - -import java.util.List; -import java.util.Locale; - -/** - * 繁体中文具体的表现动作 - * - * @author Hades - * @date 2019/5/30 - */ -public class TaiWanLocaleAction extends AbstractDefaultLocaleAction { - - @Override - protected void init() { - super.init(); - urls.put(ActionType.VIDEO, CloudCenter.getInstance().acquireUrlByKind("bbs.video.zh_TW")); - urls.put(ActionType.ACTIVATION_CODE, CloudCenter.getInstance().acquireUrlByKind("frlogin.tw")); - } - - @Override - public Locale getLocale() { - return Locale.TAIWAN; - } -} diff --git a/designer-base/src/main/java/com/fr/design/i18n/impl/USLocaleAction.java b/designer-base/src/main/java/com/fr/design/i18n/impl/USLocaleAction.java deleted file mode 100644 index 4acfc3db1..000000000 --- a/designer-base/src/main/java/com/fr/design/i18n/impl/USLocaleAction.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.fr.design.i18n.impl; - -import com.fr.design.i18n.ActionType; -import com.fr.general.CloudCenter; - -import java.util.Locale; - -/** - * 英文环境具体的表现动作 - * - * @author Hades - * @date 2019/5/30 - */ -public class USLocaleAction extends AbstractDefaultLocaleAction { - - @Override - protected void init() { - super.init(); - urls.put(ActionType.VIDEO, CloudCenter.getInstance().acquireUrlByKind("bbs.video.en")); - urls.put(ActionType.HELP_DOCUMENT, CloudCenter.getInstance().acquireUrlByKind("help.en_US.10")); - urls.put(ActionType.ACTIVATION_CODE, CloudCenter.getInstance().acquireUrlByKind("frlogin.en")); - } - - @Override - public Locale getLocale() { - return Locale.US; - } -} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java b/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java index 3fad25f6f..7e0d6b359 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java @@ -47,8 +47,6 @@ import com.fr.design.gui.imenu.UIMenu; import com.fr.design.gui.imenu.UIMenuBar; import com.fr.design.gui.itoolbar.UILargeToolbar; import com.fr.design.gui.itoolbar.UIToolbar; -import com.fr.design.i18n.Action; -import com.fr.design.i18n.LocaleCenter; import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.ToolBarNewTemplatePane; import com.fr.design.menu.MenuDef; @@ -534,7 +532,7 @@ public abstract class ToolBarMenuDock { * @return 社区菜单的子菜单 */ public ShortCut[] createCommunityShortCuts() { - final java.util.List shortCuts = new ArrayList(); + java.util.List shortCuts = new ArrayList(); shortCuts.add(new BBSAction()); shortCuts.add(new VideoAction()); shortCuts.add(new TutorialAction()); @@ -545,12 +543,9 @@ public abstract class ToolBarMenuDock { shortCuts.add(new CusDemandAction()); shortCuts.add(new CenterAction()); shortCuts.add(new SignAction()); - LocaleCenter.getInstance().getLocaleAction().buildAction(new Action() { - @Override - public void todo() { - shortCuts.add(new FacebookFansAction()); - } - }).doAction(Locale.TAIWAN); + if (Locale.TAIWAN.equals(GeneralContext.getLocale())) { + shortCuts.add(new FacebookFansAction()); + } return shortCuts.toArray(new ShortCut[shortCuts.size()]); } diff --git a/designer-realize/src/main/java/com/fr/grid/GridCornerMouseHandler.java b/designer-realize/src/main/java/com/fr/grid/GridCornerMouseHandler.java index 4c4342291..e68bd907b 100644 --- a/designer-realize/src/main/java/com/fr/grid/GridCornerMouseHandler.java +++ b/designer-realize/src/main/java/com/fr/grid/GridCornerMouseHandler.java @@ -29,6 +29,8 @@ public class GridCornerMouseHandler extends MouseInputAdapter { private void doSelectAll() { ElementCasePane reportPane = this.gridCorner.getElementCasePane(); + // 全选时,停止编辑状态 + reportPane.getGrid().stopEditing(); ColumnRow lastColumnRow = GridUtils.getAdjustLastColumnRowOfReportPane(reportPane); reportPane.setSelection(new CellSelection(0, 0, lastColumnRow.getColumn(), lastColumnRow.getRow())); diff --git a/designer-realize/src/main/java/com/fr/start/CollectUserInformationDialog.java b/designer-realize/src/main/java/com/fr/start/CollectUserInformationDialog.java index 1ec071281..c32c2307d 100644 --- a/designer-realize/src/main/java/com/fr/start/CollectUserInformationDialog.java +++ b/designer-realize/src/main/java/com/fr/start/CollectUserInformationDialog.java @@ -7,11 +7,11 @@ import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itextarea.DescriptionTextArea; import com.fr.design.gui.itextfield.UITextField; -import com.fr.design.i18n.ActionType; -import com.fr.design.i18n.LocaleCenter; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.ActiveKeyGenerator; import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.general.CloudCenter; +import com.fr.general.ComparatorUtils; import com.fr.general.GeneralContext; import javax.swing.*; @@ -31,6 +31,11 @@ public class CollectUserInformationDialog extends UIDialog { private static final int ONLINE_VERIFY_TIMEOUT = 30 * 1000; + private static final String CN_LOGIN_HTML = CloudCenter.getInstance().acquireUrlByKind("frlogin.cn"); + private static final String EN_LOGIN_HTML = CloudCenter.getInstance().acquireUrlByKind("frlogin.en"); + private static final String TW_LOGIN_HTML = CloudCenter.getInstance().acquireUrlByKind("frlogin.tw"); + private static final String JP_LOGIN_HTML = CloudCenter.getInstance().acquireUrlByKind("frlogin.jp"); + private UITextField keyTextField; private ActionListener actionListener = new ActionListener() { @@ -124,8 +129,19 @@ public class CollectUserInformationDialog extends UIDialog { private void getKeyAction() { + Locale locale = GeneralContext.getLocale(); + String url = EN_LOGIN_HTML; + if (ComparatorUtils.equals(locale, Locale.TAIWAN)) { + url = TW_LOGIN_HTML; + } + if (ComparatorUtils.equals(locale, Locale.CHINA)) { + url = CN_LOGIN_HTML; + } + if (ComparatorUtils.equals(locale, Locale.JAPAN)) { + url = JP_LOGIN_HTML; + } try { - Desktop.getDesktop().browse(new URI(LocaleCenter.getInstance().getLocaleAction().getUrls().get(ActionType.ACTIVATION_CODE))); + Desktop.getDesktop().browse(new URI(url)); } catch (Exception ignored) { } diff --git a/designer-realize/src/main/java/com/fr/start/SplashContext.java b/designer-realize/src/main/java/com/fr/start/SplashContext.java index 9fcdad122..441bf0f60 100644 --- a/designer-realize/src/main/java/com/fr/start/SplashContext.java +++ b/designer-realize/src/main/java/com/fr/start/SplashContext.java @@ -1,6 +1,6 @@ package com.fr.start; -import com.fr.design.i18n.LocaleCenter; +import com.fr.design.DesignerEnvManager; import com.fr.design.mainframe.bbs.BBSConstants; import com.fr.event.Event; import com.fr.event.EventDispatcher; @@ -24,7 +24,7 @@ import java.util.concurrent.TimeUnit; public class SplashContext { public static final String SPLASH_PATH = getSplashPath(); - public static final String SPLASH_CACHE_NAME = SPLASH_PATH.substring(SPLASH_PATH.lastIndexOf('/') + 1); + public static final String SPLASH_CACHE_NAME = SPLASH_PATH.substring(SPLASH_PATH.lastIndexOf("/") + 1); private static final int FETCH_ONLINE_MAX_TIMES = 50; private static final SplashContext SPLASH_CONTEXT = new SplashContext(); @@ -166,6 +166,13 @@ public class SplashContext { } private static String getSplashPath() { - return LocaleCenter.getInstance().getLocaleAction().getSplashPath(); + Locale locale = DesignerEnvManager.getEnvManager().getLanguage(); + if (Locale.US.equals(locale) || Locale.KOREA.equals(locale) || Locale.TAIWAN.equals(locale)) { + return "/com/fr/design/images/splash_10_en.gif"; + } else if (Locale.JAPAN.equals(locale)) { + return "/com/fr/design/images/splash_10_jp.gif"; + } else { + return "/com/fr/design/images/splash_10.gif"; + } } -} +} \ No newline at end of file From 7d209fba578597d85cd0e2709a1e73ebf62cf85a Mon Sep 17 00:00:00 2001 From: Hades Date: Wed, 5 Jun 2019 09:40:43 +0800 Subject: [PATCH 16/21] update --- .../main/java/com/fr/design/actions/community/VideoAction.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/actions/community/VideoAction.java b/designer-base/src/main/java/com/fr/design/actions/community/VideoAction.java index 7fa6314d6..4fabbd6da 100644 --- a/designer-base/src/main/java/com/fr/design/actions/community/VideoAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/community/VideoAction.java @@ -6,6 +6,7 @@ import com.fr.design.menu.MenuKeySet; import com.fr.design.utils.BrowseUtils; import com.fr.general.CloudCenter; import com.fr.general.GeneralContext; +import com.fr.general.IOUtils; import javax.swing.*; import java.awt.event.ActionEvent; @@ -19,7 +20,7 @@ public class VideoAction extends UpdateAction this.setMenuKeySet(VIDEO); this.setName(getMenuKeySet().getMenuName()); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/bbs/video.png")); + this.setSmallIcon(IOUtils.readIcon("/com/fr/design/images/bbs/video.png")); } From 045dcec0500d260abc97bdfe7c431c95014cc76b Mon Sep 17 00:00:00 2001 From: "Wim.Zhai" Date: Wed, 5 Jun 2019 10:22:33 +0800 Subject: [PATCH 17/21] =?UTF-8?q?CHART-3647=20=E5=88=A0=E9=99=A4=E5=A4=9A?= =?UTF-8?q?=E4=BD=99=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../map/designer/type/VanChartMapSourceChoosePane.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/VanChartMapSourceChoosePane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/VanChartMapSourceChoosePane.java index 5fa180ffe..606f04dd1 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/VanChartMapSourceChoosePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/VanChartMapSourceChoosePane.java @@ -2,6 +2,7 @@ package com.fr.van.chart.map.designer.type; import com.fr.base.Parameter; import com.fr.base.Utils; +import com.fr.decision.webservice.v10.map.WMSFactory; import com.fr.design.event.UIObserver; import com.fr.design.event.UIObserverListener; import com.fr.design.file.HistoryTemplateListPane; @@ -19,6 +20,7 @@ import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.JTemplate; import com.fr.general.ComparatorUtils; import com.fr.general.http.HttpClient; +import com.fr.geojson.helper.GEOJSONHelper; import com.fr.plugin.chart.base.GisLayer; import com.fr.plugin.chart.base.ViewCenter; import com.fr.plugin.chart.map.VanChartMapPlot; @@ -26,9 +28,7 @@ import com.fr.plugin.chart.map.designer.type.GEOJSONTreeHelper; import com.fr.plugin.chart.map.layer.WMSLayer; import com.fr.plugin.chart.map.server.ChartGEOJSONHelper; import com.fr.plugin.chart.map.server.CompatibleGEOJSONHelper; -import com.fr.geojson.helper.GEOJSONHelper; import com.fr.plugin.chart.map.server.MapLayerConfigManager; -import com.fr.plugin.chart.service.WMSFactory; import com.fr.plugin.chart.type.GISLayerType; import com.fr.plugin.chart.type.MapType; import com.fr.plugin.chart.type.ZoomLevel; @@ -57,6 +57,7 @@ import java.awt.event.ItemListener; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.util.ArrayList; +import java.util.List; /** * Created by Mitisky on 16/5/11. @@ -392,7 +393,10 @@ public class VanChartMapSourceChoosePane extends JPanel implements UIObserver { } String res = httpClient.getResponseText(); - list = WMSFactory.readLayers(res); + List layers = WMSFactory.readLayers(res); + for (String layer : layers) { + list.add(new WMSLayer(layer, false)); + } return null; } From 7fdcce6b04a20781f68c682668e89d7dd1f075f3 Mon Sep 17 00:00:00 2001 From: "Wim.Zhai" Date: Wed, 5 Jun 2019 10:36:12 +0800 Subject: [PATCH 18/21] fix list --- .../van/chart/map/designer/type/VanChartMapSourceChoosePane.java | 1 + 1 file changed, 1 insertion(+) diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/VanChartMapSourceChoosePane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/VanChartMapSourceChoosePane.java index 606f04dd1..dab21dd62 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/VanChartMapSourceChoosePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/VanChartMapSourceChoosePane.java @@ -394,6 +394,7 @@ public class VanChartMapSourceChoosePane extends JPanel implements UIObserver { String res = httpClient.getResponseText(); List layers = WMSFactory.readLayers(res); + list.clear(); for (String layer : layers) { list.add(new WMSLayer(layer, false)); } From d69ecae6f14c228ac49181a61ae9cab68d662c0d Mon Sep 17 00:00:00 2001 From: "Wim.Zhai" Date: Wed, 5 Jun 2019 15:30:10 +0800 Subject: [PATCH 19/21] CHART-9401 fix list --- .../chart/map/designer/type/VanChartMapSourceChoosePane.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/VanChartMapSourceChoosePane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/VanChartMapSourceChoosePane.java index dab21dd62..10664b340 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/VanChartMapSourceChoosePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/VanChartMapSourceChoosePane.java @@ -381,7 +381,7 @@ public class VanChartMapSourceChoosePane extends JPanel implements UIObserver { public void actionPerformed(ActionEvent e) { new SwingWorker() { - private java.util.List list; + private java.util.List list = new ArrayList<>(); @Override protected Void doInBackground() throws Exception { From 2a9fcf77e653c8cf87f87ce262e020b6f4a099fd Mon Sep 17 00:00:00 2001 From: Hades Date: Thu, 6 Jun 2019 15:30:09 +0800 Subject: [PATCH 20/21] =?UTF-8?q?REPORT-17277=20frm=E7=9A=84body=E7=82=B9?= =?UTF-8?q?=E5=87=BB=E4=BA=8B=E4=BB=B6=E4=B8=8D=E8=A7=81=E4=BA=86=20=20&&?= =?UTF-8?q?=20REPORT-17897=20=E8=AE=BE=E8=AE=A1=E5=99=A8=E6=96=87=E4=BB=B6?= =?UTF-8?q?-=E9=80=89=E9=A1=B9=E6=98=BE=E7=A4=BA=E4=B8=8D=E5=AE=8C?= =?UTF-8?q?=E6=95=B4=20=20&&=20REPORT-17873=20=E6=A8=A1=E6=9D=BF-=E6=8A=A5?= =?UTF-8?q?=E8=A1=A8=E5=A1=AB=E6=8A=A5=E5=B1=9E=E6=80=A7-=E5=88=B7?= =?UTF-8?q?=E6=96=B0=E6=8C=89=E9=92=AE=E6=8F=90=E7=A4=BA=E6=A1=86=E7=9A=84?= =?UTF-8?q?=E5=9B=BD=E9=99=85=E5=8C=96=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/actions/file/PreferencePane.java | 13 +++- .../fr/design/data/datapane/ChoosePane.java | 5 +- .../java/com/fr/design/dialog/BasicPane.java | 77 +++++-------------- .../layout/FRFitLayoutDefinePane.java | 3 +- 4 files changed, 33 insertions(+), 65 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java b/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java index de7e34278..2a856f159 100644 --- a/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java +++ b/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java @@ -8,6 +8,7 @@ import com.fr.design.RestartHelper; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.DialogActionAdapter; +import com.fr.design.dialog.DialogActionListener; import com.fr.design.editor.editor.IntegerEditor; import com.fr.design.gui.frpane.UITabbedPane; import com.fr.design.gui.ibutton.UIButton; @@ -31,6 +32,7 @@ import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.widget.FRWidgetFactory; import com.fr.general.ComparatorUtils; import com.fr.general.FRFont; +import com.fr.general.IOUtils; import com.fr.general.Inter; import com.fr.general.log.Log4jConfig; import com.fr.locale.InterProviderFactory; @@ -79,6 +81,7 @@ public class PreferencePane extends BasicPane { private static final int CACHING_DEFAULT = 5; private static final int CACHING_GAP = 5; private static final int MEMORY_TIP_LABEL_MAX_WIDTH = 230; + private static final int OFFSET_HEIGHT = 50; private static final String TYPE = "pressed"; private static final String DISPLAY_TYPE = "+"; @@ -133,7 +136,6 @@ public class PreferencePane extends BasicPane { private UIComboBox logLevelComboBox, pageLengthComboBox, reportLengthComboBox; private UIDictionaryComboBox languageComboBox; private IntegerEditor portEditor; - private UITextField jdkHomeTextField; private UICheckBox oracleSpace; private UISpinner cachingTemplateSpinner; private UICheckBox openDebugComboBox; @@ -393,10 +395,10 @@ public class PreferencePane extends BasicPane { new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preference_Pagination_Line_Color")); - gridLineColorTBButton = new UIColorButton(BaseUtils.readIcon("/com/fr/design/images/gui/color/foreground.png")); + gridLineColorTBButton = new UIColorButton(IOUtils.readIcon("/com/fr/design/images/gui/color/foreground.png")); gridLineColorTBButton.setEnabled(this.isEnabled()); - paginationLineColorTBButton = new UIColorButton(BaseUtils.readIcon("/com/fr/design/images/gui/color/foreground.png")); + paginationLineColorTBButton = new UIColorButton(IOUtils.readIcon("/com/fr/design/images/gui/color/foreground.png")); paginationLineColorTBButton.setEnabled(this.isEnabled()); JPanel leftPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); @@ -790,4 +792,9 @@ public class PreferencePane extends BasicPane { } }); } + + @Override + public BasicDialog showWindow(Window window, DialogActionListener l) { + return showWindowWithCustomSize(window, l, new Dimension(BasicDialog.DEFAULT.width, this.getPreferredSize().height + OFFSET_HEIGHT)); + } } diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/ChoosePane.java b/designer-base/src/main/java/com/fr/design/data/datapane/ChoosePane.java index 9ec67adb6..413a0f00d 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/ChoosePane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/ChoosePane.java @@ -32,6 +32,7 @@ import com.fr.design.mainframe.DesignerFrame; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.file.ConnectionConfig; import com.fr.general.ComparatorUtils; +import com.fr.general.IOUtils; import com.fr.log.FineLoggerFactory; import com.fr.stable.StringUtils; import com.fr.workspace.WorkContext; @@ -331,7 +332,7 @@ public class ChoosePane extends BasicBeanPane implements Refresha DBUtils.refreshDatabase(); String schema = StringUtils.isEmpty(schemaBox.getSelectedItem()) ? null : schemaBox.getSelectedItem(); DataCoreUtils.refreshTables(getConnection(), TableProcedure.TABLE, schema); - JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Refresh_Successfully") + "!", com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Refresh_Database"), + JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Refresh_Successfully") + "!", com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Refresh_Database"), JOptionPane.INFORMATION_MESSAGE); } @@ -343,7 +344,7 @@ public class ChoosePane extends BasicBeanPane implements Refresha DefaultMutableTreeNode node = (DefaultMutableTreeNode) value; Object userObj = node.getUserObject(); if (userObj instanceof String) { - this.setIcon(BaseUtils.readIcon("com/fr/design/images/m_insert/expandCell.gif")); + this.setIcon(IOUtils.readIcon("com/fr/design/images/m_insert/expandCell.gif")); } else if (userObj instanceof TableProcedure) { this.setText(((TableProcedure) userObj).getName()); } diff --git a/designer-base/src/main/java/com/fr/design/dialog/BasicPane.java b/designer-base/src/main/java/com/fr/design/dialog/BasicPane.java index c01daff70..4809e536c 100644 --- a/designer-base/src/main/java/com/fr/design/dialog/BasicPane.java +++ b/designer-base/src/main/java/com/fr/design/dialog/BasicPane.java @@ -40,21 +40,7 @@ public abstract class BasicPane extends JPanel { * @return 对话框 */ public BasicDialog showWindow(Window window, DialogActionListener l) { - BasicDialog dg; - if (window instanceof Frame) { - dg = new DIALOG((Frame) window); - } else { - dg = new DIALOG((Dialog) window); - } - - if (l != null) { - dg.addDialogActionListener(l); - } - - dg.setBasicDialogSize(BasicDialog.DEFAULT); - GUICoreUtils.centerWindow(dg); - dg.setResizable(false); - return dg; + return showWindowWithCustomSize(window, l, BasicDialog.DEFAULT); } /** @@ -100,21 +86,7 @@ public abstract class BasicPane extends JPanel { * @return 对话框 */ public BasicDialog showWindow4ChartType(Window window, DialogActionListener l) { - BasicDialog dg; - if (window instanceof Frame) { - dg = new DIALOG((Frame) window); - } else { - dg = new DIALOG((Dialog) window); - } - - if (l != null) { - dg.addDialogActionListener(l); - } - - dg.setBasicDialogSize(BasicDialog.CHART); - GUICoreUtils.centerWindow(dg); - dg.setResizable(false); - return dg; + return showWindowWithCustomSize(window, l, BasicDialog.CHART); } /** @@ -125,20 +97,7 @@ public abstract class BasicPane extends JPanel { * @return 对话框 */ public BasicDialog showSmallWindow(Window window, DialogActionListener l) { - BasicDialog dg; - if (window instanceof Frame) { - dg = new DIALOG((Frame) window); - } else { - dg = new DIALOG((Dialog) window); - } - - if (l != null) { - dg.addDialogActionListener(l); - } - dg.setBasicDialogSize(BasicDialog.SMALL); - GUICoreUtils.centerWindow(dg); - dg.setResizable(false); - return dg; + return showWindowWithCustomSize(window, l, BasicDialog.SMALL); } /** @@ -149,20 +108,7 @@ public abstract class BasicPane extends JPanel { * @return 对话框 */ public BasicDialog showMediumWindow(Window window, DialogActionListener l) { - BasicDialog dg; - if (window instanceof Frame) { - dg = new DIALOG((Frame) window); - } else { - dg = new DIALOG((Dialog) window); - } - - if (l != null) { - dg.addDialogActionListener(l); - } - dg.setBasicDialogSize(BasicDialog.MEDIUM); - GUICoreUtils.centerWindow(dg); - dg.setResizable(false); - return dg; + return showWindowWithCustomSize(window, l, BasicDialog.MEDIUM); } /** @@ -173,6 +119,17 @@ public abstract class BasicPane extends JPanel { * @return 对话框 */ public BasicDialog showLargeWindow(Window window, DialogActionListener l) { + return showWindowWithCustomSize(window, l, BasicDialog.LARGE); + } + + /** + * 以自定义的宽高显示窗口 + * @param window 窗口 + * @param l 对话框监听器 + * @param dimension 自定义尺寸 + * @return 对话框 + */ + protected BasicDialog showWindowWithCustomSize(Window window, DialogActionListener l, Dimension dimension) { BasicDialog dg; if (window instanceof Frame) { dg = new DIALOG((Frame) window); @@ -183,7 +140,7 @@ public abstract class BasicPane extends JPanel { if (l != null) { dg.addDialogActionListener(l); } - dg.setBasicDialogSize(BasicDialog.LARGE); + dg.setBasicDialogSize(dimension); GUICoreUtils.centerWindow(dg); dg.setResizable(false); return dg; @@ -350,6 +307,7 @@ public abstract class BasicPane extends JPanel { } } + @Override public void setVisible(boolean isVisible) { this.nameTextField.setVisible(isVisible); this.Name.setVisible(isVisible); @@ -377,6 +335,7 @@ public abstract class BasicPane extends JPanel { * * @throws Exception 异常 */ + @Override public void checkValid() throws Exception { super.checkValid(); 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 04864c98a..ff8ef4411 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 @@ -195,7 +195,7 @@ public class FRFitLayoutDefinePane extends AbstractDataModify { Component[] components = xWFitLayout.getComponents(); xWFitLayout.removeAll(); layout.resetStyle(); - XWAbsoluteBodyLayout xwAbsoluteBodyLayout = new XWAbsoluteBodyLayout(wAbsoluteBodyLayout, new Dimension(0, 0)); + XWAbsoluteBodyLayout xwAbsoluteBodyLayout = xWFitLayout.getBackupParent() == null ? new XWAbsoluteBodyLayout(wAbsoluteBodyLayout, new Dimension(0, 0)) : (XWAbsoluteBodyLayout) xWFitLayout.getBackupParent(); xWFitLayout.getLayoutAdapter().addBean(xwAbsoluteBodyLayout, 0, 0); for (Component component : components) { XCreator xCreator = (XCreator) component; @@ -208,6 +208,7 @@ public class FRFitLayoutDefinePane extends AbstractDataModify { } xwAbsoluteBodyLayout.add(component); } + xWFitLayout.setBackupParent(xwAbsoluteBodyLayout); FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner(); formDesigner.getSelectionModel().setSelectedCreators( FormSelectionUtils.rebuildSelection(xWFitLayout, new Widget[]{wAbsoluteBodyLayout})); From d2d97234a366a5fd37b95cca0dd1075f1ddbd248 Mon Sep 17 00:00:00 2001 From: "yaoh.wu" Date: Mon, 10 Jun 2019 13:34:25 +0800 Subject: [PATCH 21/21] =?UTF-8?q?REPORT-17887=20=E6=95=B0=E5=AD=97?= =?UTF-8?q?=E6=8E=A7=E4=BB=B6=E6=9C=80=E5=A4=A7=E5=80=BC=E6=9C=80=E5=B0=8F?= =?UTF-8?q?=E5=80=BC=E9=83=A8=E5=88=86=E5=9C=BA=E6=99=AF=E4=BF=9D=E5=AD=98?= =?UTF-8?q?=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/NumberEditorValidatePane.java | 42 ++++++++++++------- 1 file changed, 26 insertions(+), 16 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/widget/component/NumberEditorValidatePane.java b/designer-base/src/main/java/com/fr/design/widget/component/NumberEditorValidatePane.java index 78accb96b..42bcfae0a 100644 --- a/designer-base/src/main/java/com/fr/design/widget/component/NumberEditorValidatePane.java +++ b/designer-base/src/main/java/com/fr/design/widget/component/NumberEditorValidatePane.java @@ -9,13 +9,15 @@ import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.form.ui.NumberEditor; - import com.fr.stable.StringUtils; -import javax.swing.*; +import javax.swing.BorderFactory; +import javax.swing.JPanel; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; -import java.awt.*; +import java.awt.BorderLayout; +import java.awt.Component; +import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -23,6 +25,7 @@ import java.awt.event.ActionListener; * Created by kerry on 2017/9/10. */ public class NumberEditorValidatePane extends JPanel { + private UICheckBox allowDecimalsCheckBox; private UICheckBox allowNegativeCheckBox; private UICheckBox setMaxValueCheckBox; @@ -104,6 +107,7 @@ public class NumberEditorValidatePane extends JPanel { private void initListeners() { allowDecimalsListener = new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { if (allowDecimalsCheckBox.isSelected()) { limitNumberPane.setVisible(true); @@ -129,8 +133,8 @@ public class NumberEditorValidatePane extends JPanel { if (!setMinValueCheckBox.isSelected()) { maxValueSpinner.getTextField().setMinValue(0.0); } - Double minValue = Double.parseDouble("" + minValueSpinner.getValue()); - Double maxValue = Double.parseDouble("" + maxValueSpinner.getValue()); + double minValue = Double.parseDouble("" + minValueSpinner.getValue()); + double maxValue = Double.parseDouble("" + maxValueSpinner.getValue()); if (minValue < 0.0) { minValueSpinner.setValue(0.0); } @@ -143,10 +147,11 @@ public class NumberEditorValidatePane extends JPanel { setMaxListener = new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { if (setMaxValueCheckBox.isSelected()) { maxValueSpinner.setEnabled(true); - Double value = new Double(0); + Double value = (double) 0; if (setMinValueCheckBox.isSelected()) { Double minValue = Double.parseDouble("" + minValueSpinner.getValue()); if (minValue > value) { @@ -163,10 +168,11 @@ public class NumberEditorValidatePane extends JPanel { setMinListener = new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { if (setMinValueCheckBox.isSelected()) { minValueSpinner.setEnabled(true); - Double value = new Double(0); + Double value = (double) 0; if (setMaxValueCheckBox.isSelected()) { Double maxValue = Double.parseDouble("" + maxValueSpinner.getValue()); if (maxValue < value) { @@ -177,7 +183,7 @@ public class NumberEditorValidatePane extends JPanel { maxValueSpinner.getTextField().setMinValue(value); } else { minValueSpinner.setEnabled(false); - maxValueSpinner.getTextField().setMinValue(allowNegativeCheckBox.isSelected() ? (-Double.MAX_VALUE) : new Double(0)); + maxValueSpinner.getTextField().setMinValue(allowNegativeCheckBox.isSelected() ? (-Double.MAX_VALUE) : (double) 0); } } }; @@ -222,28 +228,28 @@ public class NumberEditorValidatePane extends JPanel { allowNegativeCheckBox.setSelected(e.isAllowNegative()); if (e.getMaxValue() == Double.MAX_VALUE) { setMaxValueCheckBox.setSelected(false); - maxValueSpinner.setValue(new Double(Double.MAX_VALUE)); + maxValueSpinner.setValue(Double.MAX_VALUE); maxValueSpinner.setEnabled(false); } else { setMaxValueCheckBox.setSelected(true); maxValueSpinner.setEnabled(true); - maxValueSpinner.setValue(new Double(e.getMaxValue())); + maxValueSpinner.setValue(e.getMaxValue()); } if (e.getMinValue() == -Double.MAX_VALUE) { setMinValueCheckBox.setSelected(false); - minValueSpinner.setValue(new Double(-Double.MAX_VALUE)); + minValueSpinner.setValue(-Double.MAX_VALUE); minValueSpinner.setEnabled(false); } else { setMinValueCheckBox.setSelected(true); minValueSpinner.setEnabled(true); - minValueSpinner.setValue(new Double(e.getMinValue())); + minValueSpinner.setValue(e.getMinValue()); } - if(setMinValueCheckBox.isSelected() || setMaxValueCheckBox.isSelected()){ + if (setMinValueCheckBox.isSelected() || setMaxValueCheckBox.isSelected()) { errorMsgTextFieldPane.setVisible(true); errorMsgTextField.setText(e.getRegErrorMessage()); - }else{ + } else { errorMsgTextFieldPane.setVisible(false); errorMsgTextField.setText(StringUtils.EMPTY); } @@ -259,15 +265,19 @@ public class NumberEditorValidatePane extends JPanel { if (setMinValueCheckBox.isSelected()) { ob.setMinValue(minValueSpinner.getValue()); + } else { + ob.setMinValue(-Double.MAX_VALUE); } if (setMaxValueCheckBox.isSelected()) { ob.setMaxValue(maxValueSpinner.getValue()); + } else { + ob.setMaxValue(Double.MAX_VALUE); } - if(setMinValueCheckBox.isSelected() || setMaxValueCheckBox.isSelected()){ + if (setMinValueCheckBox.isSelected() || setMaxValueCheckBox.isSelected()) { errorMsgTextFieldPane.setVisible(true); - }else{ + } else { errorMsgTextFieldPane.setVisible(false); errorMsgTextField.setText(StringUtils.EMPTY); }