From 2412d0d2643f699988b644e4e32c2ad1a5ce6695 Mon Sep 17 00:00:00 2001 From: "Mata.Li" Date: Wed, 1 Aug 2018 16:56:19 +0800 Subject: [PATCH 1/2] REPORT-9953 & REPORT-10231 --- .../design/actions/file/SwitchExistEnv.java | 6 +++++ .../fr/design/env/DesignerWorkspaceInfo.java | 2 ++ .../env/LocalDesignerWorkspaceInfo.java | 14 ++++++++++ .../env/RemoteDesignerWorkspaceInfo.java | 7 +++++ .../com/fr/design/mainframe/TemplatePane.java | 6 +++++ .../mobile/ChartEditorDefinePane.java | 26 ++++++++++++------- 6 files changed, 51 insertions(+), 10 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/actions/file/SwitchExistEnv.java b/designer-base/src/main/java/com/fr/design/actions/file/SwitchExistEnv.java index d32a1aa67..0eb371a7e 100644 --- a/designer-base/src/main/java/com/fr/design/actions/file/SwitchExistEnv.java +++ b/designer-base/src/main/java/com/fr/design/actions/file/SwitchExistEnv.java @@ -93,7 +93,13 @@ public class SwitchExistEnv extends MenuDef { Workspace workspace; try { workspace = DesignerWorkspaceGenerator.generate(selectedEnv); + boolean checkValid = true; if (workspace == null) { + checkValid = false; + }else { + checkValid = selectedEnv.checkValid(); + } + if (!checkValid) { JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Switch_Workspace_Failed"), null, 0, UIManager.getIcon("OptionPane.errorIcon")); return; diff --git a/designer-base/src/main/java/com/fr/design/env/DesignerWorkspaceInfo.java b/designer-base/src/main/java/com/fr/design/env/DesignerWorkspaceInfo.java index 755fb5370..09cfff5cf 100644 --- a/designer-base/src/main/java/com/fr/design/env/DesignerWorkspaceInfo.java +++ b/designer-base/src/main/java/com/fr/design/env/DesignerWorkspaceInfo.java @@ -11,4 +11,6 @@ public interface DesignerWorkspaceInfo extends XMLable { String getPath(); WorkspaceConnection getConnection(); + + boolean checkValid(); } diff --git a/designer-base/src/main/java/com/fr/design/env/LocalDesignerWorkspaceInfo.java b/designer-base/src/main/java/com/fr/design/env/LocalDesignerWorkspaceInfo.java index 648f3c233..70de03441 100644 --- a/designer-base/src/main/java/com/fr/design/env/LocalDesignerWorkspaceInfo.java +++ b/designer-base/src/main/java/com/fr/design/env/LocalDesignerWorkspaceInfo.java @@ -1,5 +1,7 @@ package com.fr.design.env; +import com.fr.base.EnvException; +import com.fr.general.ComparatorUtils; import com.fr.general.NameObject; import com.fr.stable.StableUtils; import com.fr.stable.StringUtils; @@ -7,6 +9,8 @@ import com.fr.stable.xml.XMLPrintWriter; import com.fr.stable.xml.XMLableReader; import com.fr.workspace.connect.WorkspaceConnection; +import java.io.File; + /** * Created by juhaoyu on 2018/6/15. */ @@ -69,4 +73,14 @@ public class LocalDesignerWorkspaceInfo implements DesignerWorkspaceInfo { return object; } + + @Override + public boolean checkValid(){ + File file = new File(this.path); + if(!file.isDirectory() || !ComparatorUtils.equals(file.getName(), "WEB-INF")) { + return false; + } + + return true; + } } diff --git a/designer-base/src/main/java/com/fr/design/env/RemoteDesignerWorkspaceInfo.java b/designer-base/src/main/java/com/fr/design/env/RemoteDesignerWorkspaceInfo.java index 25fc10225..fd8aa77dc 100644 --- a/designer-base/src/main/java/com/fr/design/env/RemoteDesignerWorkspaceInfo.java +++ b/designer-base/src/main/java/com/fr/design/env/RemoteDesignerWorkspaceInfo.java @@ -86,4 +86,11 @@ public class RemoteDesignerWorkspaceInfo implements DesignerWorkspaceInfo { object.connection = (WorkspaceConnection) StableUtils.cloneObject(this.connection); return object; } + + + @Override + public boolean checkValid(){ + + return true; + } } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/TemplatePane.java b/designer-base/src/main/java/com/fr/design/mainframe/TemplatePane.java index 1afc67333..2cb9e600b 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/TemplatePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/TemplatePane.java @@ -147,7 +147,13 @@ public class TemplatePane extends JPanel implements MouseListener { DesignerWorkspaceInfo selectedEnv = envManager.getWorkspaceInfo(selectedName); try { Workspace workspace = DesignerWorkspaceGenerator.generate(selectedEnv); + boolean checkValid = true; if (workspace == null) { + checkValid = false; + }else { + checkValid = selectedEnv.checkValid(); + } + if (!checkValid) { JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Switch_Workspace_Failed"), null, 0, UIManager.getIcon("OptionPane.errorIcon")); return false; diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ChartEditorDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ChartEditorDefinePane.java index e65269b88..ecfb98bdd 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ChartEditorDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ChartEditorDefinePane.java @@ -87,6 +87,8 @@ public class ChartEditorDefinePane extends MobileWidgetDefinePane { unavailableTipLabel.setText("" + tipText + ""); unavailableTipLabel.setForeground(Color.gray); panel.add(unavailableTipLabel, BorderLayout.NORTH); + allowFullCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Allow_Full_Screen")); + panel.add(allowFullCheckBox); return panel; } @@ -150,19 +152,20 @@ public class ChartEditorDefinePane extends MobileWidgetDefinePane { public void populate(FormDesigner designer) { this.designer = designer; + BaseChartEditor chartEditor = (BaseChartEditor)xCreator.toData(); + boolean allowFullScreen = chartEditor.getMobileAttr().isAllowFullScreen(); + this.allowFullCheckBox.setSelected(allowFullScreen); + this.bindListeners2Widgets(); + this.addAttributeChangeListener(changeListener); + if (!isAppRelayout() || isInAbsoluteLayout()) { return; } - BaseChartEditor chartEditor = (BaseChartEditor)xCreator.toData(); ChartMobileFitAttrStateProvider zoomOutAttr = chartEditor.getMobileAttr().getZoomOutAttr(); this.zoomOutComboBox.setSelectedItem(new Item(zoomOutAttr.description(), zoomOutAttr)); updateTipLabel(); - boolean allowFullScreen = chartEditor.getMobileAttr().isAllowFullScreen(); - this.allowFullCheckBox.setSelected(allowFullScreen); - // 数据 populate 完成后,再设置监听 - this.bindListeners2Widgets(); this.zoomOutComboBox.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { @@ -171,21 +174,24 @@ public class ChartEditorDefinePane extends MobileWidgetDefinePane { return; } updateTipLabel(); - ChartMobileFitAttrState selectedAttr = (ChartMobileFitAttrState)((Item)e.getItem()).getValue(); + ChartMobileFitAttrState selectedAttr = (ChartMobileFitAttrState) ((Item) e.getItem()).getValue(); if (selectedAttr.getState() != ChartMobileFitAttrState.AUTO.getState()) { } } }); - this.addAttributeChangeListener(changeListener); } @Override public void update() { ChartMobileAttrProvider mobileAttr = ((BaseChartEditor)xCreator.toData()).getMobileAttr(); - mobileAttr.setZoomInAttr(ChartMobileFitAttrState.PROPORTION); - mobileAttr.setZoomOutAttr((ChartMobileFitAttrState)((Item)zoomOutComboBox.getSelectedItem()).getValue()); - mobileAttr.setAllowFullScreen(allowFullCheckBox.isSelected()); + if(zoomOutComboBox != null) { + mobileAttr.setZoomInAttr(ChartMobileFitAttrState.PROPORTION); + mobileAttr.setZoomOutAttr((ChartMobileFitAttrState) ((Item) zoomOutComboBox.getSelectedItem()).getValue()); + mobileAttr.setAllowFullScreen(allowFullCheckBox.isSelected()); + }else { + mobileAttr.setAllowFullScreen(allowFullCheckBox.isSelected()); + } DesignerContext.getDesignerFrame().getSelectedJTemplate().fireTargetModified(); // 触发设计器保存按钮亮起来 } } From 95581eae868c3f2187c789363baaba8ebbb9abb9 Mon Sep 17 00:00:00 2001 From: "Mata.Li" Date: Wed, 1 Aug 2018 17:19:57 +0800 Subject: [PATCH 2/2] REPORT-9953 & REPORT-10231 --- .../java/com/fr/design/actions/file/SwitchExistEnv.java | 7 +------ .../main/java/com/fr/design/mainframe/TemplatePane.java | 7 +------ .../com/fr/design/mainframe/toolbar/ToolBarMenuDock.java | 2 +- 3 files changed, 3 insertions(+), 13 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/actions/file/SwitchExistEnv.java b/designer-base/src/main/java/com/fr/design/actions/file/SwitchExistEnv.java index 0eb371a7e..03ce167cc 100644 --- a/designer-base/src/main/java/com/fr/design/actions/file/SwitchExistEnv.java +++ b/designer-base/src/main/java/com/fr/design/actions/file/SwitchExistEnv.java @@ -93,12 +93,7 @@ public class SwitchExistEnv extends MenuDef { Workspace workspace; try { workspace = DesignerWorkspaceGenerator.generate(selectedEnv); - boolean checkValid = true; - if (workspace == null) { - checkValid = false; - }else { - checkValid = selectedEnv.checkValid(); - } + boolean checkValid = workspace == null ? false : selectedEnv.checkValid(); if (!checkValid) { JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Switch_Workspace_Failed"), null, 0, UIManager.getIcon("OptionPane.errorIcon")); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/TemplatePane.java b/designer-base/src/main/java/com/fr/design/mainframe/TemplatePane.java index 2cb9e600b..47036317f 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/TemplatePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/TemplatePane.java @@ -147,12 +147,7 @@ public class TemplatePane extends JPanel implements MouseListener { DesignerWorkspaceInfo selectedEnv = envManager.getWorkspaceInfo(selectedName); try { Workspace workspace = DesignerWorkspaceGenerator.generate(selectedEnv); - boolean checkValid = true; - if (workspace == null) { - checkValid = false; - }else { - checkValid = selectedEnv.checkValid(); - } + boolean checkValid = workspace == null ? false : selectedEnv.checkValid(); if (!checkValid) { JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Switch_Workspace_Failed"), null, 0, UIManager.getIcon("OptionPane.errorIcon")); 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 b618669e9..c5005c953 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 @@ -234,7 +234,7 @@ public abstract class ToolBarMenuDock { // 添加帮助菜单 menuList.add(createHelpMenuDef()); - if (GeneralContext.getLocale() == Locale.CHINA || GeneralContext.getLocale() == Locale.TAIWAN) { + if (GeneralContext.getLocale().equals(Locale.CHINA) || GeneralContext.getLocale().equals(Locale.TAIWAN)) { // 添加社区菜单 addCommunityMenuDef(menuList); }