Browse Source

REPORT-5387 [9.0三轮回归]设计器按钮控件的图标设置无效

master
kerry 7 years ago
parent
commit
40d94dfc03
  1. 42
      designer_base/src/com/fr/design/extra/exe/GetPluginCategoriesExecutor.java
  2. 68
      designer_base/src/com/fr/design/extra/exe/GetPluginFromStoreExecutor.java
  3. 51
      designer_base/src/com/fr/design/extra/exe/ReadUpdateOnlineExecutor.java
  4. 47
      designer_base/src/com/fr/design/extra/exe/SearchOnlineExecutor.java
  5. 5
      designer_base/src/com/fr/design/web/CustomIconPane.java

42
designer_base/src/com/fr/design/extra/exe/GetPluginCategoriesExecutor.java

@ -0,0 +1,42 @@
package com.fr.design.extra.exe;
import com.fr.design.extra.PluginHelper;
import com.fr.design.extra.Process;
import com.fr.general.SiteCenter;
import com.fr.general.http.HttpClient;
/**
* Created by vito on 16/5/16.
*/
public class GetPluginCategoriesExecutor implements Executor {
private String result = "[]";
@Override
public String getTaskFinishMessage() {
return result;
}
@Override
public Command[] getCommands() {
return new Command[]{
new Command() {
@Override
public String getExecuteMessage() {
return null;
}
@Override
public void run(Process<String> process) {
String url = SiteCenter.getInstance().acquireUrlByKind("plugin.category");
if (url != null) {
HttpClient httpClient = new HttpClient(url);
result = httpClient.getResponseText();
} else {
result = PluginHelper.CONNECTION_404;
}
}
}
};
}
}

68
designer_base/src/com/fr/design/extra/exe/GetPluginFromStoreExecutor.java

@ -0,0 +1,68 @@
package com.fr.design.extra.exe;
import com.fr.design.extra.PluginHelper;
import com.fr.design.extra.Process;
import com.fr.general.FRLogger;
import com.fr.general.SiteCenter;
import com.fr.general.http.HttpClient;
import com.fr.stable.StringUtils;
/**
* Created by vito on 16/4/18.
* 获取插件分类信息
*/
public class GetPluginFromStoreExecutor implements Executor {
private String result = "[]";
private String category;
private String seller;
private String fee;
public GetPluginFromStoreExecutor(String category, String seller, String fee) {
this.category = category;
this.seller = seller;
this.fee = fee;
}
@Override
public String getTaskFinishMessage() {
return result;
}
@Override
public Command[] getCommands() {
return new Command[]{
new Command() {
@Override
public String getExecuteMessage() {
return StringUtils.EMPTY;
}
@Override
public void run(Process<String> process) {
String plistUrl = SiteCenter.getInstance().acquireUrlByKind("plugin.plist");
if (StringUtils.isNotBlank(plistUrl)) {
StringBuilder url = new StringBuilder();
url.append(plistUrl);
if (StringUtils.isNotBlank(category)) {
url.append("&cid=").append(category.split("-")[1]);
}
if (StringUtils.isNotBlank(seller)) {
url.append("&seller=").append(seller.split("-")[1]);
}
if (StringUtils.isNotBlank(fee)) {
url.append("&fee=").append(fee.split("-")[1]);
}
try {
HttpClient httpClient = new HttpClient(url.toString());
result = httpClient.getResponseText();
} catch (Exception e) {
FRLogger.getLogger().error(e.getMessage());
}
} else {
result = PluginHelper.CONNECTION_404;
}
}
}
};
}
}

51
designer_base/src/com/fr/design/extra/exe/ReadUpdateOnlineExecutor.java

@ -0,0 +1,51 @@
package com.fr.design.extra.exe;
import com.fr.design.extra.PluginsReaderFromStore;
import com.fr.design.extra.Process;
import com.fr.general.FRLogger;
import com.fr.plugin.Plugin;
import com.fr.stable.StringUtils;
import org.json.JSONArray;
import org.json.JSONObject;
/**
* Created by vito on 16/4/19.
*/
public class ReadUpdateOnlineExecutor implements Executor {
private Plugin[] plugins;
private String result;
@Override
public String getTaskFinishMessage() {
return result;
}
@Override
public Command[] getCommands() {
return new Command[]{
new Command() {
@Override
public String getExecuteMessage() {
return StringUtils.EMPTY;
}
@Override
public void run(Process<String> process) {
try {
plugins = PluginsReaderFromStore.readPluginsForUpdate();
JSONArray jsonArray = new JSONArray();
for (Plugin plugin : plugins) {
JSONObject jsonObject = new JSONObject();
jsonObject.put("pluginid", plugin.getId());
jsonArray.put(jsonObject);
}
result = jsonArray.toString();
} catch (Exception e) {
FRLogger.getLogger().error(e.getMessage());
}
}
}
};
}
}

47
designer_base/src/com/fr/design/extra/exe/SearchOnlineExecutor.java

@ -0,0 +1,47 @@
package com.fr.design.extra.exe;
import com.fr.design.extra.Process;
import com.fr.general.FRLogger;
import com.fr.general.SiteCenter;
import com.fr.general.http.HttpClient;
import com.fr.stable.StringUtils;
/**
* Created by vito on 16/4/18.
*/
public class SearchOnlineExecutor implements Executor {
private String result;
private String keyword;
public SearchOnlineExecutor(String keyword) {
this.keyword = keyword;
}
@Override
public String getTaskFinishMessage() {
return result;
}
@Override
public Command[] getCommands() {
return new Command[]{
new Command() {
@Override
public String getExecuteMessage() {
return StringUtils.EMPTY;
}
@Override
public void run(Process<String> process) {
try {
HttpClient httpClient = new HttpClient(SiteCenter.getInstance().acquireUrlByKind("plugin.plist") + "&keyword=" + keyword);
result = httpClient.getResponseText();
} catch (Exception e) {
FRLogger.getLogger().error(e.getMessage());
}
}
}
};
}
}

5
designer_base/src/com/fr/design/web/CustomIconPane.java

@ -232,6 +232,9 @@ public class CustomIconPane extends BasicPane {
}
private void updateButtonPane() {
if (editButton == null || removeButton == null){
return;
}
if (iconManager.isSystemIcon(selectedIconName)) {
editButton.setEnabled(false);
removeButton.setEnabled(false);
@ -298,7 +301,7 @@ public class CustomIconPane extends BasicPane {
} catch (RuntimeException re) {
return;
}
updateButtonPane();
updateButtonPane();
}
private class IconButton extends JToggleButton implements ActionListener{

Loading…
Cancel
Save