Browse Source

添加删除

master
vito 9 years ago
parent
commit
69455f31fa
  1. 4
      designer_base/src/com/fr/design/actions/server/PluginManagerAction.java
  2. 39
      designer_base/src/com/fr/design/extra/PluginWebBridge.java
  3. 1
      designer_base/src/com/fr/design/extra/PluginWebPane.java

4
designer_base/src/com/fr/design/actions/server/PluginManagerAction.java

@ -3,7 +3,9 @@ package com.fr.design.actions.server;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.UIDialog;
import com.fr.design.extra.PluginManagerPane; import com.fr.design.extra.PluginManagerPane;
import com.fr.design.extra.PluginWebBridge;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.menu.MenuKeySet; import com.fr.design.menu.MenuKeySet;
import com.fr.general.Inter; import com.fr.general.Inter;
@ -28,7 +30,9 @@ public class PluginManagerAction extends UpdateAction {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
final PluginManagerPane managerPane = new PluginManagerPane(); final PluginManagerPane managerPane = new PluginManagerPane();
//// TODO: 16/4/11 重新写下这个界面窗口.
BasicDialog dlg = managerPane.showCustomSizeWindow(DesignerContext.getDesignerFrame(), null, BasicDialog.LARGE_SHOP); BasicDialog dlg = managerPane.showCustomSizeWindow(DesignerContext.getDesignerFrame(), null, BasicDialog.LARGE_SHOP);
PluginWebBridge.getHelper().setDialogHandle(dlg);
dlg.setVisible(true); dlg.setVisible(true);
} }

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

@ -1,10 +1,10 @@
package com.fr.design.extra; package com.fr.design.extra;
import com.fr.design.actions.server.PluginManagerAction;
import com.fr.design.dialog.UIDialog;
import com.fr.design.extra.exe.*; import com.fr.design.extra.exe.*;
import com.fr.general.FRLogger; import com.fr.general.FRLogger;
import com.fr.general.http.HttpClient; import com.fr.general.http.HttpClient;
import com.fr.json.JSONArray;
import com.fr.json.JSONObject;
import com.fr.plugin.Plugin; import com.fr.plugin.Plugin;
import com.fr.plugin.PluginLoader; import com.fr.plugin.PluginLoader;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
@ -15,6 +15,7 @@ import javafx.stage.FileChooser;
import javafx.stage.Stage; import javafx.stage.Stage;
import netscape.javascript.JSObject; import netscape.javascript.JSObject;
import javax.swing.*;
import java.io.File; import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -26,24 +27,38 @@ public class PluginWebBridge {
private static PluginWebBridge helper; private static PluginWebBridge helper;
public static PluginWebBridge getHelper(WebEngine webEngine) { private UIDialog uiDialog;
public static PluginWebBridge getHelper() {
if (helper != null) { if (helper != null) {
return helper; return helper;
} }
synchronized (PluginWebBridge.class) { synchronized (PluginWebBridge.class) {
if (helper == null) { if (helper == null) {
helper = new PluginWebBridge(webEngine); helper = new PluginWebBridge();
} }
return helper; return helper;
} }
} }
public static PluginWebBridge getHelper(WebEngine webEngine) {
getHelper();
helper.setEngine(webEngine);
return helper;
}
private WebEngine webEngine; private WebEngine webEngine;
private PluginWebBridge(WebEngine webEngine) { private PluginWebBridge() {
}
public void setEngine(WebEngine webEngine){
this.webEngine = webEngine; this.webEngine = webEngine;
} }
public void setDialogHandle(UIDialog uiDialog){
this.uiDialog = uiDialog;
}
/** /**
* 从插件服务器上安装插件 * 从插件服务器上安装插件
* *
@ -181,13 +196,13 @@ public class PluginWebBridge {
public String getPluginFromStore(String category, String seller, String fee) { public String getPluginFromStore(String category, String seller, String fee) {
StringBuilder url = new StringBuilder("http://127.0.0.1:8080/ShopServer?pg=plist"); StringBuilder url = new StringBuilder("http://127.0.0.1:8080/ShopServer?pg=plist");
if(StringUtils.isNotBlank(category)){ if (StringUtils.isNotBlank(category)) {
url.append("&cid=").append(category.split("-")[1]); url.append("&cid=").append(category.split("-")[1]);
} }
if(StringUtils.isNotBlank(seller)){ if (StringUtils.isNotBlank(seller)) {
url.append("&seller=").append(seller.split("-")[1]); url.append("&seller=").append(seller.split("-")[1]);
} }
if(StringUtils.isNotBlank(fee)){ if (StringUtils.isNotBlank(fee)) {
url.append("&fee=").append(fee.split("-")[1]); url.append("&fee=").append(fee.split("-")[1]);
} }
String resText = null; String resText = null;
@ -199,4 +214,12 @@ public class PluginWebBridge {
} }
return resText == null ? StringUtils.EMPTY : resText; return resText == null ? StringUtils.EMPTY : resText;
} }
public void closeWindow() {
if (uiDialog != null) {
uiDialog.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
uiDialog.setVisible(false);
uiDialog.dispose();
}
}
} }

1
designer_base/src/com/fr/design/extra/PluginWebPane.java

@ -3,7 +3,6 @@ package com.fr.design.extra;
import javafx.application.Platform; import javafx.application.Platform;
import javafx.embed.swing.JFXPanel; import javafx.embed.swing.JFXPanel;
import javafx.event.EventHandler; import javafx.event.EventHandler;
import javafx.scene.Group;
import javafx.scene.Scene; import javafx.scene.Scene;
import javafx.scene.layout.BorderPane; import javafx.scene.layout.BorderPane;
import javafx.scene.web.WebEngine; import javafx.scene.web.WebEngine;

Loading…
Cancel
Save