Browse Source

Merge pull request #517 in BA/design from ~ZACK/design:release to release

* commit 'd7c4bafc5cb32cc1e2da77a1ea55beea340c2130':
  无JIRA任务 组件共享支持远程安装删除
master
superman 8 years ago
parent
commit
3ff835a0e6
  1. 66
      designer_base/src/com/fr/env/RemoteEnv.java
  2. 2
      designer_form/src/com/fr/design/mainframe/CoverReportPane.java
  3. 27
      designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java
  4. 4
      designer_form/src/com/fr/design/mainframe/ShareWidgetButton.java

66
designer_base/src/com/fr/env/RemoteEnv.java vendored

@ -31,6 +31,7 @@ import com.fr.plugin.Plugin;
import com.fr.plugin.PluginLicense; import com.fr.plugin.PluginLicense;
import com.fr.plugin.PluginLicenseManager; import com.fr.plugin.PluginLicenseManager;
import com.fr.plugin.PluginLoader; import com.fr.plugin.PluginLoader;
import com.fr.share.ShareConstants;
import com.fr.stable.*; import com.fr.stable.*;
import com.fr.stable.file.XMLFileManagerProvider; import com.fr.stable.file.XMLFileManagerProvider;
import com.fr.stable.project.ProjectConstants; import com.fr.stable.project.ProjectConstants;
@ -2107,7 +2108,7 @@ public class RemoteEnv implements Env {
@Override @Override
public File[] loadREUFile() throws Exception { public File[] loadREUFile() throws Exception {
File target = new File(CacheManager.getProviderInstance().getCacheDirectory(), File target = new File(CacheManager.getProviderInstance().getCacheDirectory(),
"fr_share"); ShareConstants.DIR_SHARE_CACHE);
StableUtils.deleteFile(target); StableUtils.deleteFile(target);
StableUtils.mkdirs(target); StableUtils.mkdirs(target);
File cacheDir = null; File cacheDir = null;
@ -2122,7 +2123,7 @@ public class RemoteEnv implements Env {
HttpClient client = createHttpMethod(para); HttpClient client = createHttpMethod(para);
InputStream input = client.getResponseStream(); InputStream input = client.getResponseStream();
zip = new File(StableUtils.pathJoin(CacheManager.getProviderInstance().getCacheDirectory().getAbsolutePath()), "share.zip"); zip = new File(StableUtils.pathJoin(CacheManager.getProviderInstance().getCacheDirectory().getAbsolutePath()), "share.zip");
cacheDir = new File(StableUtils.pathJoin(CacheManager.getProviderInstance().getCacheDirectory().getAbsolutePath()), "fr_share"); cacheDir = new File(StableUtils.pathJoin(CacheManager.getProviderInstance().getCacheDirectory().getAbsolutePath()), ShareConstants.DIR_SHARE_CACHE);
StableUtils.deleteFile(cacheDir); StableUtils.deleteFile(cacheDir);
StableUtils.mkdirs(cacheDir); StableUtils.mkdirs(cacheDir);
StableUtils.makesureFileExist(zip); StableUtils.makesureFileExist(zip);
@ -2146,4 +2147,65 @@ public class RemoteEnv implements Env {
} }
return new File[0]; return new File[0];
} }
@Override
public boolean installREUFile(File reuFile) {
// if (reuFile == null) {
// return false;
// }
// try {
// HashMap<String, String> para = new HashMap<String, String>();
// para.put("op", "fr_remote_design");
// para.put("cmd", "design_install_reufile");
// para.put("current_uid", this.createUserID());
// para.put("currentUsername", this.getUser());
// para.put("reuFileName", reuFile.getName());
//
// HttpClient client = createHttpMethod(para);
// client.setContent(IOUtils.inputStream2Bytes(new FileInputStream(reuFile)));
// InputStream input = execute4InputStream(client);
// return ComparatorUtils.equals(stream2String(input), "true");
// } catch (Exception e) {
// return false;
// }
return false;
}
@Override
public boolean removeREUFilesByName(String fileName) {
if (StringUtils.isEmpty(fileName)) {
return true;
}
try {
HashMap<String, String> para = new HashMap<String, String>();
para.put("op", "fr_remote_design");
para.put("cmd", "design_remove_reufile");
para.put("current_uid", this.createUserID());
para.put("currentUsername", this.getUser());
para.put("reuFileName", fileName);
HttpClient client = createHttpMethod(para);
InputStream input = execute4InputStream(client);
return ComparatorUtils.equals(stream2String(input), "true");
} catch (Exception e) {
return false;
}
}
@Override
public String getSharePath() {
try {
HashMap<String, String> para = new HashMap<String, String>();
para.put("op", "fr_remote_design");
para.put("cmd", "design_get_share_path");
para.put("current_uid", this.createUserID());
para.put("currentUsername", this.getUser());
HttpClient client = createHttpMethod(para);
InputStream input = execute4InputStream(client);
return stream2String(input);
} catch (Exception e) {
return StringUtils.EMPTY;
}
}
} }

2
designer_form/src/com/fr/design/mainframe/CoverReportPane.java

@ -3,7 +3,7 @@ package com.fr.design.mainframe;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.icon.IconPathConstants; import com.fr.design.icon.IconPathConstants;
import com.fr.form.share.ShareConstants; import com.fr.share.ShareConstants;
import com.fr.general.FRScreen; import com.fr.general.FRScreen;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;

27
designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java

@ -16,6 +16,7 @@ import com.fr.form.ui.ElCaseBindInfo;
import com.fr.general.FRLogger; import com.fr.general.FRLogger;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.general.SiteCenter; import com.fr.general.SiteCenter;
import com.fr.share.ShareConstants;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
@ -359,18 +360,22 @@ public class FormWidgetDetailPane extends FormDockView{
} }
private void installFromDiskZipFile(File chosenFile) { private void installFromDiskZipFile(File chosenFile) {
try { if (chosenFile != null && chosenFile.getName().endsWith(ShareConstants.SUFFIX_MODULE)) {
ShareLoader.getLoader().installModuleFromDiskZipFile(chosenFile); try {
refreshShareMoudule(); if (ShareLoader.getLoader().installModuleFromDiskZipFile(chosenFile)) {
elCaseBindInfoList = ShareLoader.getLoader().getAllBindInfoList(); refreshShareMoudule();
refreshDownPanel(false); elCaseBindInfoList = ShareLoader.getLoader().getAllBindInfoList();
refreshComboxData(); refreshDownPanel(false);
JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Share_Module_OK")); refreshComboxData();
} catch (IOException e) { JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Share_Module_OK"));
JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Share_Module_Error")); } else {
FRLogger.getLogger().error(e.getMessage(), e); JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Share_Module_Error"));
}
} catch (IOException e) {
JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Share_Module_Error"));
FRLogger.getLogger().error(e.getMessage(), e);
}
} }
} }
private void refreshShareMoudule() { private void refreshShareMoudule() {

4
designer_form/src/com/fr/design/mainframe/ShareWidgetButton.java

@ -1,12 +1,10 @@
package com.fr.design.mainframe; package com.fr.design.mainframe;
import com.fr.base.*; import com.fr.base.*;
import com.fr.design.constants.UIConstants;
import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XCreatorUtils; import com.fr.design.designer.creator.XCreatorUtils;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.icon.IconPathConstants; import com.fr.share.ShareConstants;
import com.fr.form.share.ShareConstants;
import com.fr.form.share.ShareLoader; import com.fr.form.share.ShareLoader;
import com.fr.form.ui.ElCaseBindInfo; import com.fr.form.ui.ElCaseBindInfo;
import com.fr.form.ui.Widget; import com.fr.form.ui.Widget;

Loading…
Cancel
Save