From 79e0d87f0e803077b702bd050605f76333b24b0e Mon Sep 17 00:00:00 2001 From: zack Date: Thu, 17 Nov 2016 14:57:30 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=A0JIRA=E4=BB=BB=E5=8A=A1=20=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E5=85=B1=E4=BA=AB=E8=BF=9C=E7=A8=8B=E5=88=87=E6=8D=A2?= =?UTF-8?q?=E5=90=8C=E6=AD=A5=E5=88=B0release?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer_base/src/com/fr/env/RemoteEnv.java | 44 +++++++++++++++++++ .../mainframe/FormWidgetDetailPane.java | 9 ---- .../fr/design/mainframe/ShareWidgetPane.java | 20 ++++----- 3 files changed, 54 insertions(+), 19 deletions(-) diff --git a/designer_base/src/com/fr/env/RemoteEnv.java b/designer_base/src/com/fr/env/RemoteEnv.java index 6aff74d7c..cbca9c2ca 100644 --- a/designer_base/src/com/fr/env/RemoteEnv.java +++ b/designer_base/src/com/fr/env/RemoteEnv.java @@ -22,6 +22,7 @@ import com.fr.file.CacheManager; import com.fr.file.DatasourceManager; import com.fr.file.DatasourceManagerProvider; import com.fr.file.filetree.FileNode; +import com.fr.form.share.ShareConstants; import com.fr.general.*; import com.fr.general.http.HttpClient; import com.fr.json.JSONArray; @@ -2105,4 +2106,47 @@ public class RemoteEnv implements Env { public void checkAndRegisterLic(FileNode node, Plugin plugin) throws Exception { } + + @Override + public File[] loadREUFile() throws Exception { + File target = new File(CacheManager.getProviderInstance().getCacheDirectory(), + "fr_share"); + StableUtils.deleteFile(target); + StableUtils.mkdirs(target); + File cacheDir = null; + File zip = null; + try { + HashMap para = new HashMap(); + para.put("op", "fr_remote_design"); + para.put("cmd", "design_read_reufile"); + para.put("current_uid", this.createUserID()); + para.put("currentUsername", this.getUser()); + + HttpClient client = createHttpMethod(para); + InputStream input = client.getResponseStream(); + zip = new File(StableUtils.pathJoin(CacheManager.getProviderInstance().getCacheDirectory().getAbsolutePath()), "share.zip"); + cacheDir = new File(StableUtils.pathJoin(CacheManager.getProviderInstance().getCacheDirectory().getAbsolutePath()), ShareConstants.DIR_SHARE_CACHE); + StableUtils.deleteFile(cacheDir); + StableUtils.mkdirs(cacheDir); + StableUtils.makesureFileExist(zip); + FileOutputStream out = new FileOutputStream(zip); + IOUtils.copyBinaryTo(input, out); + out.flush(); + out.close(); + IOUtils.unzip(zip, cacheDir.getAbsolutePath(), EncodeConstants.ENCODING_GBK);//先解压到临时目录 + if (cacheDir.exists() && cacheDir.isDirectory()) { + return cacheDir.listFiles(new FilenameFilter() { + public boolean accept(File file, String s) { + return s.endsWith("reu"); + } + }); + } + + } catch (Exception e) { + FRContext.getLogger().error(e.getMessage()); + } finally { + StableUtils.deleteFile(zip); + } + return new File[0]; + } } \ No newline at end of file diff --git a/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java b/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java index be0b8f6b1..d660d9a58 100644 --- a/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java +++ b/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java @@ -2,11 +2,6 @@ package com.fr.design.mainframe; import com.fr.base.BaseUtils; import com.fr.base.FRContext; -import com.fr.design.dialog.BasicPane; -import com.fr.design.dialog.UIDialog; -import com.fr.design.extra.PluginWebBridge; -import com.fr.design.extra.ShopDialog; -import com.fr.design.extra.WebManagerPaneFactory; import com.fr.design.gui.frpane.UITabbedPane; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.icombobox.UIComboBox; @@ -16,7 +11,6 @@ import com.fr.design.gui.imenu.UIMenuItem; import com.fr.design.gui.imenu.UIPopupMenu; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.utils.gui.GUICoreUtils; -import com.fr.form.share.ShareConstants; import com.fr.form.share.ShareLoader; import com.fr.form.ui.ElCaseBindInfo; import com.fr.general.FRLogger; @@ -24,7 +18,6 @@ import com.fr.general.Inter; import com.fr.general.SiteCenter; import com.fr.stable.ArrayUtils; import com.fr.stable.StringUtils; -import com.fr.stable.collections.array.Array; import javax.swing.*; import javax.swing.filechooser.FileNameExtensionFilter; @@ -37,7 +30,6 @@ import java.io.File; import java.io.IOException; import java.net.URI; import java.net.URISyntaxException; -import java.util.*; /** * Created with IntelliJ IDEA. @@ -107,7 +99,6 @@ public class FormWidgetDetailPane extends FormDockView{ reuWidgetPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); reuWidgetPanel.setBorder(null); if (elCaseBindInfoList == null) { - elCaseBindInfoList = new ElCaseBindInfo[0]; if (sw != null) { sw.cancel(true); } diff --git a/designer_form/src/com/fr/design/mainframe/ShareWidgetPane.java b/designer_form/src/com/fr/design/mainframe/ShareWidgetPane.java index cd04300bf..c5659d9bc 100644 --- a/designer_form/src/com/fr/design/mainframe/ShareWidgetPane.java +++ b/designer_form/src/com/fr/design/mainframe/ShareWidgetPane.java @@ -1,8 +1,8 @@ package com.fr.design.mainframe; - import com.fr.form.ui.ElCaseBindInfo; + import javax.swing.*; import java.awt.*; @@ -14,15 +14,15 @@ public class ShareWidgetPane extends JPanel { public ShareWidgetPane(ElCaseBindInfo[] elCaseBindInfoList, boolean isEdit) { this.setBorder(BorderFactory.createEmptyBorder(10, 3, 0, 0));// 设置面板的边框 ,距离上、左、下、右 的距离 - int rowCount = (elCaseBindInfoList.length + 1) / 2; - this.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 10)); - for (ElCaseBindInfo rbModuleInfo : elCaseBindInfoList) { - ShareWidgetButton widgetButton = new ShareWidgetButton(rbModuleInfo); - widgetButton.setElementCaseEdit(isEdit); - this.add(widgetButton); + if (elCaseBindInfoList != null) { + int rowCount = (elCaseBindInfoList.length + 1) / 2; + this.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 10)); + for (ElCaseBindInfo rbModuleInfo : elCaseBindInfoList) { + ShareWidgetButton widgetButton = new ShareWidgetButton(rbModuleInfo); + widgetButton.setElementCaseEdit(isEdit); + this.add(widgetButton); + } + this.setPreferredSize(new Dimension(240, rowCount * 80)); } - this.setPreferredSize(new Dimension(240, rowCount * 80)); - } - } \ No newline at end of file