Browse Source

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

* commit '970d9a517e63d0bec183960162ddcf45d7f5e74b':
  整合License部分(还是提示没写)
master
superman 8 years ago
parent
commit
668c98f74c
  1. 19
      designer_base/src/com/fr/design/extra/PluginControlPane.java
  2. 14
      designer_base/src/com/fr/design/extra/PluginWebBridge.java
  3. 26
      designer_base/src/com/fr/env/RemoteEnv.java

19
designer_base/src/com/fr/design/extra/PluginControlPane.java

@ -8,9 +8,9 @@ import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.IOUtils;
import com.fr.general.Inter;
import com.fr.plugin.PluginLicense;
import com.fr.plugin.PluginLicenseManager;
import com.fr.plugin.context.PluginContext;
import com.fr.plugin.context.PluginMarker;
import com.fr.plugin.license.Licensed;
import com.fr.plugin.manage.PluginManager;
import com.fr.plugin.manage.control.PluginTaskCallback;
import com.fr.plugin.manage.control.PluginTaskResult;
@ -68,15 +68,18 @@ public class PluginControlPane extends BasicPane {
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
if (value instanceof PluginView) {
PluginLicense pluginLicense = PluginLicenseManager.getInstance().getPluginLicenseByID(((PluginView) value).getID());
Licensed context = PluginManager.getContext(PluginMarker.read((PluginView) value));
if (context == null) {
return this;
}
String extraInfo = "";
if (pluginLicense.isJarDamage()) {
if (context.isLicDamaged()) {
extraInfo = "(" + Inter.getLocText("FR-Plugin-Plugin_Damaged") + ")";
} else if (pluginLicense.getLeftTime() != -1) {
if (pluginLicense.isAvailable()) {
extraInfo = "(" + (pluginLicense.isTrial() ? Inter.getLocText("FR-Plugin-Designer_Trial") : Inter.getLocText("FR-Plugin-Designer_Authorized")) + pluginLicense.getLeftTime() + Inter.getLocText("FR-Plugin-Designer_Left") + ")";
} else if (!context.isFree()) {
if (context.isAvailable()) {
extraInfo = "(" + (context.isOnTrial() ? Inter.getLocText("FR-Plugin-Designer_Trial") : Inter.getLocText("FR-Plugin-Designer_Authorized")) + context.getLeftDays() + Inter.getLocText("FR-Plugin-Designer_Left") + ")";
} else {
extraInfo = "(" + (pluginLicense.isTrial() ? Inter.getLocText("FR-Plugin-Designer_Trial") : Inter.getLocText("FR-Plugin-Designer_Authorized")) + Inter.getLocText("FR-Plugin-Designer_Expired") + ")";
extraInfo = "(" + (context.isOnTrial() ? Inter.getLocText("FR-Plugin-Designer_Trial") : Inter.getLocText("FR-Plugin-Designer_Authorized")) + Inter.getLocText("FR-Plugin-Designer_Expired") + ")";
}
}
setText(((PluginView) value).getName() + extraInfo);

14
designer_base/src/com/fr/design/extra/PluginWebBridge.java

@ -9,8 +9,6 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.general.FRLogger;
import com.fr.general.Inter;
import com.fr.general.SiteCenter;
import com.fr.plugin.PluginLicense;
import com.fr.plugin.PluginLicenseManager;
import com.fr.plugin.context.PluginContext;
import com.fr.plugin.context.PluginMarker;
import com.fr.plugin.manage.PluginManager;
@ -278,17 +276,7 @@ public class PluginWebBridge {
List<PluginContext> plugins = PluginManager.getContexts();
return plugins.toArray(new PluginContext[plugins.size()]);
}
/**
* 获取已经安装的插件的授权情况
*
* @return 已安装的插件授权对象
*/
public PluginLicense getPluginLicenseByID(String pluginID) {
return PluginLicenseManager.getInstance().getPluginLicenseByID(pluginID);
}
private String[] jsObjectToStringArray(JSObject obj) {
if (obj == null) {
return ArrayUtils.EMPTY_STRING_ARRAY;

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

@ -27,9 +27,6 @@ import com.fr.general.http.HttpClient;
import com.fr.json.JSONArray;
import com.fr.json.JSONException;
import com.fr.json.JSONObject;
import com.fr.plugin.PluginLicense;
import com.fr.plugin.PluginLicenseManager;
import com.fr.plugin.xml.PluginXml;
import com.fr.share.ShareConstants;
import com.fr.stable.*;
import com.fr.stable.file.XMLFileManagerProvider;
@ -1991,11 +1988,7 @@ public class RemoteEnv extends AbstractEnv {
public void setLicName(String licName) {
//do nth
}
@Override
public void checkAndRegisterLic(FileNode node, PluginXml plugin) throws Exception {
}
/**
* 获取当前env的build文件路径
@ -2034,23 +2027,6 @@ public class RemoteEnv extends AbstractEnv {
}
public void readPluginLicenses() throws Exception {
ByteArrayOutputStream out = new ByteArrayOutputStream();
HashMap<String, String> para = new HashMap<String, String>();
para.put("op", "fr_remote_design");
para.put("cmd", "design_plugin_licenses");
InputStream inputStream = postBytes2ServerB(out.toByteArray(), para);
String pluginsLicensesStr = IOUtils.inputStream2String(inputStream, EncodeConstants.ENCODING_UTF_8);
if (StringUtils.isNotBlank(pluginsLicensesStr) && pluginsLicensesStr.startsWith("[")) {
JSONArray jsonArray = new JSONArray(pluginsLicensesStr);
for (int i = 0; i < jsonArray.length(); i++) {
PluginLicense pluginLicense = new PluginLicense();
pluginLicense.parseJSON(jsonArray.getJSONObject(i));
PluginLicenseManager.getInstance().addRemotePluginLicense(pluginLicense);
}
}
}
@Override
public String pluginServiceAction(String serviceID, String req) throws Exception {

Loading…
Cancel
Save