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(); // 触发设计器保存按钮亮起来 } }