Browse Source

Merge pull request #13 in PF/design from ~JU/co-pf-9.0-design:9.0 to 9.0

* commit '1f70c2dd16ccc91d46bb150ec7c45deb203f9eb8':
  继续移植插件监听
  支持War部署
  ba-9.0 => pf-9.0 暂时先把war部署下插件相关的部分删了,一会儿尝试写到新的插件加载逻辑里面
master
superman 8 years ago
parent
commit
ab510fa471
  1. 2
      designer_base/src/com/fr/design/ExtraDesignClassManager.java
  2. 21
      designer_base/src/com/fr/design/data/datapane/TableDataTreePane.java
  3. 359
      designer_base/src/com/fr/design/extra/PluginHelper.java
  4. 73
      designer_base/src/com/fr/design/mainframe/DesignerFrame.java
  5. 26
      designer_base/src/com/fr/design/mainframe/WestRegionContainerPane.java
  6. 76
      designer_base/src/com/fr/env/RemoteEnv.java
  7. 19
      designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java

2
designer_base/src/com/fr/design/ExtraDesignClassManager.java

@ -40,7 +40,7 @@ public class ExtraDesignClassManager extends AbstractExtraClassManager implement
} }
static { static {
StableFactory.registerMarkedObject(PluginModule.EXTRA_DESIGN.getAgentName(), classManager); StableFactory.registerMarkedObject(PluginModule.ExtraDesign.getAgentName(), classManager);
} }
public TableDataNameObjectCreator[] getReportTableDataCreators() { public TableDataNameObjectCreator[] getReportTableDataCreators() {

21
designer_base/src/com/fr/design/data/datapane/TableDataTreePane.java

@ -14,6 +14,7 @@ import com.fr.design.data.tabledata.wrapper.AbstractTableDataWrapper;
import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.fun.TableDataDefineProvider;
import com.fr.design.fun.TableDataPaneProcessor; import com.fr.design.fun.TableDataPaneProcessor;
import com.fr.design.gui.ibutton.UIHeadGroup; import com.fr.design.gui.ibutton.UIHeadGroup;
import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.icontainer.UIScrollPane;
@ -29,6 +30,13 @@ import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralContext; import com.fr.general.GeneralContext;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.general.NameObject; import com.fr.general.NameObject;
import com.fr.plugin.context.PluginContext;
import com.fr.plugin.injectable.PluginModule;
import com.fr.plugin.manage.PluginFilter;
import com.fr.plugin.observer.PluginEvent;
import com.fr.plugin.observer.PluginEventListener;
import com.fr.plugin.observer.PluginListenerPriority;
import com.fr.plugin.observer.PluginListenerRegistration;
import com.fr.stable.core.PropertyChangeAdapter; import com.fr.stable.core.PropertyChangeAdapter;
import com.fr.stable.plugin.PluginReadListener; import com.fr.stable.plugin.PluginReadListener;
@ -82,12 +90,21 @@ public class TableDataTreePane extends BasicTableDataTreePane {
createAddMenuDef(); createAddMenuDef();
GeneralContext.addPluginReadListener(new PluginReadListener() { PluginListenerRegistration.getInstance().listenRunningChanged(new PluginEventListener(PluginListenerPriority.TableDataTreePane) {
@Override @Override
public void success(Status status) { public void on(PluginEvent event) {
addMenuDef.clearShortCuts(); addMenuDef.clearShortCuts();
createAddMenuDef(); createAddMenuDef();
} }
}, new PluginFilter() {
@Override
public boolean accept(PluginContext context) {
return context.contain(PluginModule.ExtraDesign, TableDataDefineProvider.XML_TAG);
}
}); });
editAction = new EditAction(); editAction = new EditAction();

359
designer_base/src/com/fr/design/extra/PluginHelper.java

@ -1,359 +0,0 @@
package com.fr.design.extra;
import com.fr.base.Env;
import com.fr.base.FRContext;
import com.fr.design.DesignerEnvManager;
import com.fr.design.extra.plugindependence.DownLoadDependenceUI;
import com.fr.general.*;
import com.fr.general.http.HttpClient;
import com.fr.plugin.Plugin;
import com.fr.plugin.PluginConfigManager;
import com.fr.stable.plugin.PluginConstants;
import com.fr.plugin.PluginLoader;
import com.fr.plugin.PluginManagerHelper;
import com.fr.plugin.dependence.PluginDependence;
import com.fr.plugin.dependence.PluginDependenceException;
import com.fr.plugin.dependence.PluginDependenceUnit;
import com.fr.stable.ArrayUtils;
import com.fr.stable.EncodeConstants;
import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils;
import com.fr.stable.project.ProjectConstants;
import com.fr.stable.xml.XMLTools;
import javax.swing.*;
import java.io.*;
import java.net.HttpURLConnection;
import java.net.URLDecoder;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.concurrent.ExecutionException;
/**
* @author richie
* @date 2015-03-10
* @since 8.0
*/
public class PluginHelper {
private static final String TEMP_PATH = System.getProperty("user.dir") + "/tmp";
public static final String DOWNLOAD_PATH = System.getProperty("user.dir") + "/download";
//插件依赖的下载位置
public static final String DEPENDENCE_DOWNLOAD_PATH = System.getProperty("user.dir") + "/download/dependence";
public static final String TEMP_FILE = "temp.zip";
public static final String CONNECTION_404 = "404";
/**
* 下载插件
*
* @param id 插件id
* @param p 下载百分比处理
*/
public static void downloadPluginFile(String id, String username, String password, Process<Double> p) throws Exception {
HttpClient httpClient = new HttpClient(getDownloadPath(id, username, password));
if (httpClient.getResponseCode() == HttpURLConnection.HTTP_OK) {
int totalSize = httpClient.getContentLength();
InputStream reader = httpClient.getResponseStream();
String temp = StableUtils.pathJoin(DOWNLOAD_PATH, TEMP_FILE);
StableUtils.makesureFileExist(new File(temp));
FileOutputStream writer = new FileOutputStream(temp);
byte[] buffer = new byte[PluginConstants.BYTES_NUM];
int bytesRead = 0;
int totalBytesRead = 0;
while ((bytesRead = reader.read(buffer)) > 0) {
writer.write(buffer, 0, bytesRead);
buffer = new byte[PluginConstants.BYTES_NUM];
totalBytesRead += bytesRead;
p.process(totalBytesRead / (double) totalSize);
}
reader.close();
writer.flush();
writer.close();
} else {
throw new com.fr.plugin.PluginVerifyException(Inter.getLocText("FR-Designer-Plugin_Connect_Server_Error"));
}
}
private static boolean invalidUser(String id, String username, String password) {
if (StringUtils.isEmpty(id)) {
return false;
} else if (StringUtils.isEmpty(username) || StringUtils.isEmpty(password)){
return false;
} else {
return true;
}
}
private static String getDownloadPath(String id, String username, String password) throws Exception {
HashMap<String, String> map = new HashMap<String, String>();
map.put("id", id);
map.put("username", username);
map.put("password", password);
HttpClient httpClient = new HttpClient(SiteCenter.getInstance().acquireUrlByKind("plugin.download"), map);
String resText = httpClient.getResponseText();
String charSet = EncodeConstants.ENCODING_UTF_8;
resText = URLDecoder.decode(URLDecoder.decode(resText, charSet), charSet);
return resText;
}
public static File getDownloadTempFile() {
return new File(StableUtils.pathJoin(DOWNLOAD_PATH, TEMP_FILE));
}
/**
* 从压缩文件中读取插件信息
*
* @param chosenFile 选择的压缩文件
* @return 返回插件对象
* @throws Exception 读取插件信息失败则抛出异常
*/
public static Plugin readPlugin(File chosenFile) throws Exception {
// 需要先删除临时目录保证加压出来的文件不会和安装失败的文件混合到一起
StableUtils.deleteFile(new File(TEMP_PATH));
IOUtils.unzip(chosenFile, TEMP_PATH);
File pluginFileDir = getTempPluginFileDirectory();
if (pluginFileDir == null) {
return null;
}
Plugin plugin = null;
if (pluginFileDir.isDirectory()) {
File[] pluginFiles = pluginFileDir.listFiles();
if (ArrayUtils.isNotEmpty(pluginFiles)) {
for (File f : pluginFiles) {
if (f.getName().equals("plugin.xml")) {
plugin = new Plugin();
InputStream inputStream = plugin.readEncryptXml(new FileInputStream(f));
XMLTools.readInputStreamXML(plugin, inputStream);
//检查是否需要准备插件依赖环境
checkDependenceEnv(plugin);
if (!plugin.isValidate()) {
return null;
}
inputStream.close();
break;
}
}
}
}
return plugin;
}
//将所有未配置好的资源文件依赖准备好
private static void checkDependenceEnv(Plugin plugin) throws PluginDependenceException {
PluginDependence dependence = plugin.getDependence();
if (dependence == null) {
return;
}
List<PluginDependenceUnit> needInstallDependence = new ArrayList<PluginDependenceUnit>();
String currentID = dependence.getCurrentPluginID();
List<PluginDependenceUnit> list = dependence.getDependPlugins();
for (int i = 0; list != null && i < list.size(); i++) {
PluginDependenceUnit dependenceUnit = list.get(i);
if (!dependenceUnit.checkFileEnv()) {
needInstallDependence.add(dependenceUnit);
}
}
if (needInstallDependence.isEmpty()) {
return;
}
//安装插件依赖
installDependenceOnline(currentID, needInstallDependence);
}
/**
* 构造一个下载UI
*
* @param currentID
* @param list
* @throws PluginDependenceException
*/
private static void installDependenceOnline(String currentID, List<PluginDependenceUnit> list) throws PluginDependenceException {
DownLoadDependenceUI ui = new DownLoadDependenceUI(currentID, list);
ui.installOnline();
}
/**
* 从选中的压缩文件中安装插件
*
* @param chosenFile 选择的压缩文件
* @param after 操作完成事件
* @throws Exception 安装失败则抛出异常
*/
public static void installPluginFromDisk(File chosenFile, After after) throws Exception {
Plugin plugin = readPlugin(chosenFile);
installPluginFromUnzippedTempDir(FRContext.getCurrentEnv(), plugin, after);
}
/**
* 从压缩文件中复制Restart*.class和restart.exe到bin目录下
*
* @param file 插件文件
* @param plugin 插件
* @throws Exception
*/
public static void copyFilesToBinFolder(File file, Plugin plugin) throws Exception {
File[] pluginFiles = file.listFiles();
for (File restartFile : pluginFiles) {
if (restartFile.getAbsolutePath().endsWith(".class")) {
String installHome = StableUtils.getInstallHome();
IOUtils.copy(restartFile, new File(StableUtils.pathJoin(new String[]{installHome, "bin"})));
}
}
}
/**
* 从插件压缩包解压到得临时文件中安装插件
*
* @param env 报表运行环境
* @param plugin 插件
* @param after 操作完成事件
* @throws Exception
*/
public static void installPluginFromUnzippedTempDir(Env env, final Plugin plugin, final After after) throws Exception {
validPlugin(plugin);
if (plugin.isValidate()) {
File file = getTempPluginFileDirectory();
env.copyFilesToPluginAndLibFolder(file, plugin);
copyFilesToBinFolder(file, plugin);
env.movePluginEmbFile(file, plugin);
}
// 删除放解压文件的临时文件夹
StableUtils.deleteFile(new File(TEMP_PATH));
PluginConfigManager.getProviderInstance().pushNewPlugin(plugin);
PluginConfigManager.getProviderInstance().syncPluginConfig();
new SwingWorker<String, Void>() {
@Override
protected String doInBackground() throws Exception {
return sendInstalledPluginInfo(plugin);
}
@Override
protected void done() {
try {
String text = get();
FRLogger.getLogger().info("plugin install:" + text);
} catch (InterruptedException e) {
FRLogger.getLogger().error(e.getMessage(), e);
} catch (ExecutionException e) {
FRLogger.getLogger().error(e.getMessage(), e);
}
if (after != null) {
after.done();
}
}
}.execute();
}
private static void validPlugin(Plugin plugin) throws Exception {
if (plugin == null) {
throw new com.fr.plugin.PluginVerifyException(Inter.getLocText("FR-Designer-Plugin_Illegal_Plugin_Zip_Cannot_Be_Install"));
}
if (PluginLoader.getLoader().isInstalled(plugin)) {
throw new com.fr.plugin.PluginVerifyException(Inter.getLocText("FR-Designer-Plugin_Has_Been_Installed"));
}
if (plugin.checkIfJarExpired()) {
String jarExpiredInfo = Inter.getLocText(new String[]{"FR-Designer-Plugin_Jar_Expired", ",", "FR-Designer-Plugin_Install_Failed", ",", "FR-Designer-Plugin_Please_Update_Jar", plugin.getRequiredJarTime()});
FRLogger.getLogger().error(jarExpiredInfo);
throw new com.fr.plugin.PluginVerifyException(jarExpiredInfo);
}
File fileToCheck = getTempPluginFileDirectory();
File oldfile = new File(StableUtils.pathJoin(FRContext.getCurrentEnv().getPath(), ProjectConstants.PLUGINS_NAME, "plugin-" + plugin.getId()));
if (!PluginManagerHelper.checkLic(plugin, fileToCheck)) {
if (!PluginManagerHelper.checkLic(plugin, oldfile)) {//安装时,在安装目录下和压缩包里都没有才弹框
String checkLicFail = Inter.getLocText("FR-Designer-PluginLicense_Check_Failed");
FRLogger.getLogger().error(checkLicFail);
throw new com.fr.plugin.PluginVerifyException(checkLicFail);
}
}
}
/**
* 获取插件解压的临时文件夹
*
* @return 临时文件
*/
public static File getTempPluginFileDirectory() {
File file = new File(TEMP_PATH);
if (file.isDirectory() && !file.getName().startsWith(".")) {
File[] files = file.listFiles();
if (ArrayUtils.isNotEmpty(files)) {
for (File f : files) {
if (foundConfigFile(f)) {
return f;
}
}
}
}
return null;
}
private static boolean foundConfigFile(File dir) {
if (!dir.isDirectory()) {
return false;
}
File[] files = dir.listFiles();
if (ArrayUtils.isNotEmpty(files)) {
for (File f : files) {
if ("plugin.xml".equals(f.getName())) {
return true;
}
}
}
return false;
}
/**
* 从运行环境中卸载插件
*
* @param env 报表运行环境
* @param plugin 插件
* @return 返回没有删除掉的文件的集合
* @throws Exception 卸载出错的时候抛出此异常
*/
public static String[] uninstallPlugin(Env env, Plugin plugin) throws Exception {
if (plugin == null || env == null) {
return ArrayUtils.EMPTY_STRING_ARRAY;
}
//卸载前监听
plugin.preUninstall();
PluginLoader.getLoader().deletePlugin(plugin);
return env.deleteFileFromPluginAndLibFolder(plugin);
}
/**
* 比较插件的版本这里简单的比价字符串不需要用数字作为标号
* 版本号相同也认为是更新
*
* @param plugin 当前的插件
* @param oldPlugin 老的插件
* @return 当前插件比老的插件版本高则返回true否则返回false
*/
public static boolean isNewThan(Plugin plugin, Plugin oldPlugin) {
return ComparatorUtils.compare(plugin.getVersion(), oldPlugin.getVersion()) >= 0;
}
private static String sendInstalledPluginInfo(final Plugin plugin) {
if (StableUtils.isDebug()) {
return "debug status";
}
HashMap<String, String> map = new HashMap<String, String>();
map.put("key", DesignerEnvManager.getEnvManager().getActivationKey());
map.put("detail", plugin.toJSONObject().toString());
map.put("build", GeneralUtils.readBuildNO());
//第三个参数encode, nodejs服务器那边如果参数不encode, 带了空格会报错, 直接用urlconnection也是一样, jetty没能还原.
HttpClient httpClient = new HttpClient(SiteCenter.getInstance().acquireUrlByKind("plugin.install"), map, true);
httpClient.setTimeout(TIME_OUT);
httpClient.asGet();
return httpClient.getResponseText();
}
private static final int TIME_OUT = 5000;
}

73
designer_base/src/com/fr/design/mainframe/DesignerFrame.java

@ -15,11 +15,7 @@ import com.fr.design.data.DesignTableDataManager;
import com.fr.design.data.datapane.TableDataTreePane; import com.fr.design.data.datapane.TableDataTreePane;
import com.fr.design.event.TargetModifiedEvent; import com.fr.design.event.TargetModifiedEvent;
import com.fr.design.event.TargetModifiedListener; import com.fr.design.event.TargetModifiedListener;
import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.*;
import com.fr.design.file.MutilTempalteTabPane;
import com.fr.design.file.NewTemplatePane;
import com.fr.design.file.SaveSomeTemplatePane;
import com.fr.design.file.TemplateTreePane;
import com.fr.design.fun.TitlePlaceProcessor; import com.fr.design.fun.TitlePlaceProcessor;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.imenu.UIMenuHighLight; import com.fr.design.gui.imenu.UIMenuHighLight;
@ -40,12 +36,16 @@ import com.fr.general.ComparatorUtils;
import com.fr.general.FRLogger; import com.fr.general.FRLogger;
import com.fr.general.GeneralContext; import com.fr.general.GeneralContext;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.plugin.context.PluginContext;
import com.fr.plugin.manage.PluginFilter;
import com.fr.plugin.observer.PluginEvent;
import com.fr.plugin.observer.PluginEventListener;
import com.fr.plugin.observer.PluginListenerRegistration;
import com.fr.stable.CoreConstants; import com.fr.stable.CoreConstants;
import com.fr.stable.OperatingSystem; import com.fr.stable.OperatingSystem;
import com.fr.stable.ProductConstants; import com.fr.stable.ProductConstants;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import com.fr.stable.image4j.codec.ico.ICODecoder; import com.fr.stable.image4j.codec.ico.ICODecoder;
import com.fr.stable.plugin.PluginReadListener;
import com.fr.stable.project.ProjectConstants; import com.fr.stable.project.ProjectConstants;
import javax.swing.*; import javax.swing.*;
@ -53,20 +53,8 @@ import javax.swing.border.MatteBorder;
import java.awt.*; import java.awt.*;
import java.awt.datatransfer.DataFlavor; import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.Transferable; import java.awt.datatransfer.Transferable;
import java.awt.dnd.DnDConstants; import java.awt.dnd.*;
import java.awt.dnd.DropTarget; import java.awt.event.*;
import java.awt.dnd.DropTargetDragEvent;
import java.awt.dnd.DropTargetDropEvent;
import java.awt.dnd.DropTargetEvent;
import java.awt.dnd.DropTargetListener;
import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
@ -186,26 +174,43 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
//hugh: private修改为protected方便oem的时候修改右上的组件构成 //hugh: private修改为protected方便oem的时候修改右上的组件构成
//顶部日志+登陆按钮 //顶部日志+登陆按钮
final JPanel northEastPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); final JPanel northEastPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
GeneralContext.addPluginReadListener(new PluginReadListener() {
PluginListenerRegistration.getInstance().listenRunningChanged(new PluginEventListener() {
@Override @Override
public void success(Status status) { public void on(PluginEvent event) {
TitlePlaceProcessor processor = ExtraDesignClassManager.getInstance().getSingle(TitlePlaceProcessor.MARK_STRING);
if (processor == null) { refreshNorthEastPane(northEastPane, ad);
processor = new DefaultTitlePlace(); }
} }, new PluginFilter() {
processor.hold(northEastPane, LogMessageBar.getInstance(), ad.createBBSLoginPane());
@Override
public boolean accept(PluginContext context) {
return context.contain(TitlePlaceProcessor.MARK_STRING);
} }
}); });
if (DesignerEnvManager.getEnvManager().getAlphafineConfigManager().isEnabled()) { if (DesignerEnvManager.getEnvManager().getAlphafineConfigManager().isEnabled()) {
northEastPane.add(ad.createAlphafinePane(), BorderLayout.CENTER); northEastPane.add(ad.createAlphafinePane(), BorderLayout.CENTER);
} }
return northEastPane; refreshNorthEastPane(northEastPane, ad);
} return northEastPane;
}
private void refreshNorthEastPane(JPanel northEastPane, ToolBarMenuDock ad) {
TitlePlaceProcessor processor = ExtraDesignClassManager.getInstance().getSingle(TitlePlaceProcessor.MARK_STRING);
if (processor == null) {
processor = new DefaultTitlePlace();
}
processor.hold(northEastPane, LogMessageBar.getInstance(), ad.createBBSLoginPane());
}
public DesignerFrame(ToolBarMenuDock ad) {
public DesignerFrame(ToolBarMenuDock ad) { setName(DESIGNER_FRAME_NAME);
setName(DESIGNER_FRAME_NAME); this.ad = ad;
this.ad = ad;
this.initTitleIcon(); this.initTitleIcon();
this.setTitle();// james:因为有默认的了 this.setTitle();// james:因为有默认的了
// set this to context. // set this to context.

26
designer_base/src/com/fr/design/mainframe/WestRegionContainerPane.java

@ -3,10 +3,15 @@ package com.fr.design.mainframe;
import com.fr.design.DesignModelAdapter; import com.fr.design.DesignModelAdapter;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.data.datapane.TableDataTreePane; import com.fr.design.data.datapane.TableDataTreePane;
import com.fr.design.fun.TableDataPaneProcessor;
import com.fr.design.gui.icontainer.UIResizableContainer; import com.fr.design.gui.icontainer.UIResizableContainer;
import com.fr.general.GeneralContext; import com.fr.plugin.context.PluginContext;
import com.fr.plugin.manage.PluginFilter;
import com.fr.plugin.observer.PluginEvent;
import com.fr.plugin.observer.PluginEventListener;
import com.fr.plugin.observer.PluginListenerPriority;
import com.fr.plugin.observer.PluginListenerRegistration;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import com.fr.stable.plugin.PluginReadListener;
public class WestRegionContainerPane extends UIResizableContainer { public class WestRegionContainerPane extends UIResizableContainer {
@ -27,12 +32,25 @@ public class WestRegionContainerPane extends UIResizableContainer {
public WestRegionContainerPane() { public WestRegionContainerPane() {
super(DesignerFrameFileDealerPane.getInstance(), Constants.RIGHT); super(DesignerFrameFileDealerPane.getInstance(), Constants.RIGHT);
GeneralContext.addPluginReadListener(new PluginReadListener() {
setDownPane(TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()));
PluginListenerRegistration.getInstance().listenRunningChanged(new PluginEventListener(PluginListenerPriority.WestRegionContainerPane) {
@Override @Override
public void success(Status status) { public void on(PluginEvent event) {
setDownPane(TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter())); setDownPane(TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()));
} }
}, new PluginFilter() {
@Override
public boolean accept(PluginContext context) {
return context.contain(TableDataPaneProcessor.XML_TAG);
}
}); });
setContainerWidth(165); setContainerWidth(165);
} }
} }

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

@ -27,10 +27,9 @@ import com.fr.general.http.HttpClient;
import com.fr.json.JSONArray; import com.fr.json.JSONArray;
import com.fr.json.JSONException; import com.fr.json.JSONException;
import com.fr.json.JSONObject; import com.fr.json.JSONObject;
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.xml.PluginXml;
import com.fr.share.ShareConstants; 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;
@ -388,7 +387,6 @@ public class RemoteEnv extends AbstractEnv {
private void extraChangeEnvPara() { private void extraChangeEnvPara() {
//在env连接之前, 加载一下不依赖env的插件. 看看需不需要改变参数. //在env连接之前, 加载一下不依赖env的插件. 看看需不需要改变参数.
PluginLoader.init();
DesignerEnvProcessor envProcessor = ExtraDesignClassManager.getInstance().getSingle(DesignerEnvProcessor.XML_TAG); DesignerEnvProcessor envProcessor = ExtraDesignClassManager.getInstance().getSingle(DesignerEnvProcessor.XML_TAG);
if (envProcessor != null) { if (envProcessor != null) {
this.path = envProcessor.changeEnvPathBeforeConnect(user, password, path); this.path = envProcessor.changeEnvPathBeforeConnect(user, password, path);
@ -1994,6 +1992,11 @@ public class RemoteEnv extends AbstractEnv {
//do nth //do nth
} }
@Override
public void checkAndRegisterLic(FileNode node, PluginXml plugin) throws Exception {
}
/** /**
* 获取当前env的build文件路径 * 获取当前env的build文件路径
*/ */
@ -2030,55 +2033,6 @@ public class RemoteEnv extends AbstractEnv {
return info; return info;
} }
/**
* 将文件拷贝到插件目录
*
* @param dir 要拷贝的文件
* @param plugin 插件
*/
public void copyFilesToPluginAndLibFolder(File dir, Plugin plugin) throws Exception {
}
/**
* 将文件添加到指定目录或者删除指定目录的文件
*
* @param file 解压插件的临时目录
* @param plugin 当前处理的插件
*/
public void movePluginEmbFile(File file, Plugin plugin) throws Exception {
}
/**
* 将文件从插件目录删除
*
* @param plugin 要删除插件
* @return 同上
*/
public String[] deleteFileFromPluginAndLibFolder(Plugin plugin) {
return new String[0];
}
/**
* 保存插件的配置文件
*
* @param plugin 插件
*/
public void writePlugin(Plugin plugin) throws Exception {
}
/**
* 获取插件的配置目录
*
* @param plugin
*/
public String getPluginFilePath(Plugin plugin) {
return StringUtils.EMPTY;
}
public void readPluginLicenses() throws Exception { public void readPluginLicenses() throws Exception {
ByteArrayOutputStream out = new ByteArrayOutputStream(); ByteArrayOutputStream out = new ByteArrayOutputStream();
@ -2117,12 +2071,6 @@ public class RemoteEnv extends AbstractEnv {
@Override @Override
public void pluginServiceStart(String serviceID){ public void pluginServiceStart(String serviceID){
} }
@Override
public void checkAndRegisterLic(FileNode node, Plugin plugin) throws Exception {
}
@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(),
@ -2238,4 +2186,16 @@ public class RemoteEnv extends AbstractEnv {
return StringUtils.EMPTY; return StringUtils.EMPTY;
} }
} }
@Override
public boolean isLocalEnv() {
return false;
}
@Override
public boolean hasPluginServiceStarted(String key) {
// TODO: 2017/5/22
return true;
}
} }

19
designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java

@ -23,7 +23,13 @@ import com.fr.form.ui.ChartEditor;
import com.fr.general.GeneralContext; import com.fr.general.GeneralContext;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.plugin.context.PluginContext;
import com.fr.plugin.injectable.PluginModule;
import com.fr.plugin.injectable.PluginSingleInjection; import com.fr.plugin.injectable.PluginSingleInjection;
import com.fr.plugin.manage.PluginFilter;
import com.fr.plugin.observer.PluginEvent;
import com.fr.plugin.observer.PluginEventListener;
import com.fr.plugin.observer.PluginListenerRegistration;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.bridge.StableFactory; import com.fr.stable.bridge.StableFactory;
@ -55,15 +61,22 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
StableFactory.registerMarkedObject(XML_TAG, classManager); StableFactory.registerMarkedObject(XML_TAG, classManager);
} }
// TODO: 2017/3/8
static { static {
GeneralContext.addPluginReadListener(new PluginReadListener() {
PluginListenerRegistration.getInstance().listenRunningChanged(new PluginEventListener() {
@Override @Override
public void success() { public void on(PluginEvent event) {
//重新注册designModuleFactory //重新注册designModuleFactory
DesignModuleFactory.registerExtraWidgetOptions(initWidgetOption()); DesignModuleFactory.registerExtraWidgetOptions(initWidgetOption());
} }
}, new PluginFilter() {
@Override
public boolean accept(PluginContext context) {
return context.contain(PluginModule.ExtraChartType);
}
}); });
} }

Loading…
Cancel
Save