diff --git a/designer_base/src/com/fr/design/actions/server/PluginManagerAction.java b/designer_base/src/com/fr/design/actions/server/PluginManagerAction.java index 91b4eb810..646eb479a 100644 --- a/designer_base/src/com/fr/design/actions/server/PluginManagerAction.java +++ b/designer_base/src/com/fr/design/actions/server/PluginManagerAction.java @@ -28,8 +28,7 @@ public class PluginManagerAction extends UpdateAction { @Override public void actionPerformed(ActionEvent e) { final PluginManagerPane managerPane = new PluginManagerPane(); - BasicDialog dlg = managerPane.showLargeWindow(DesignerContext.getDesignerFrame(),null); - + BasicDialog dlg = managerPane.showCustomSizeWindow(DesignerContext.getDesignerFrame(), null, BasicDialog.LARGE_SHOP); dlg.setVisible(true); } diff --git a/designer_base/src/com/fr/design/dialog/BasicDialog.java b/designer_base/src/com/fr/design/dialog/BasicDialog.java index 703b19205..a1f2785cf 100644 --- a/designer_base/src/com/fr/design/dialog/BasicDialog.java +++ b/designer_base/src/com/fr/design/dialog/BasicDialog.java @@ -10,6 +10,7 @@ public abstract class BasicDialog extends UIDialog { public static final Dimension MEDIUM = new Dimension(600, 400); public static final Dimension DEFAULT = new Dimension(660, 600); public static final Dimension LARGE = new Dimension(900, 600); + public static final Dimension LARGE_SHOP = new Dimension(900, 760); public static final Dimension CHART = new Dimension(760, 560); public static final Dimension MAP_SIZE = new Dimension(760, 450); public static final Dimension UPDATE_ONLINE_SIZE = new Dimension(600,300); diff --git a/designer_base/src/com/fr/design/dialog/BasicPane.java b/designer_base/src/com/fr/design/dialog/BasicPane.java index c94c246bf..09190f20f 100644 --- a/designer_base/src/com/fr/design/dialog/BasicPane.java +++ b/designer_base/src/com/fr/design/dialog/BasicPane.java @@ -16,380 +16,414 @@ import java.awt.*; */ public abstract class BasicPane extends JPanel { - /** - *显示窗口 - * @param window 窗口 - * @return 对话框 - */ - public BasicDialog showWindow(Window window) { - return this.showWindow(window, null); - } - - - /** - * 显示窗口 - * @param window 窗口 - * @param l 对话框监听器 - * @return 对话框 - */ - public BasicDialog showWindow(Window window, DialogActionListener l) { - BasicDialog dg; - if (window instanceof Frame) { - dg = new DIALOG((Frame) window); - } else { - dg = new DIALOG((Dialog) window); - } - - if (l != null) { - dg.addDialogActionListener(l); - } - - dg.setBasicDialogSize(BasicDialog.DEFAULT); - GUICoreUtils.centerWindow(dg); - dg.setResizable(false); - return dg; - } - - /** - * 显示窗口 - * @param window 窗口 - * @param isNeedButtonsPane 是否需要确定删除按钮 - * @return 对话框 - */ - public BasicDialog showWindow(Window window, boolean isNeedButtonsPane) { - BasicDialog dg; - if (window instanceof Frame) { - dg = new DIALOG((Frame) window, isNeedButtonsPane); - } else { - dg = new DIALOG((Dialog) window, isNeedButtonsPane); - } - dg.setBasicDialogSize(BasicDialog.DEFAULT); - GUICoreUtils.centerWindow(dg); - dg.setResizable(false); - return dg; - } - - - - /** - * 图表类型选择时 弹出的按钮大小, 不适合用最大最小, 因为图表大小 默认是规定好的, 那么界面大小也是必须配合. - * 并且包括 条件显示中 多个条件的大小 - * @param window 窗口 - * @param l 监听器 - * @return 对话框 - */ - public BasicDialog showWindow4ChartType(Window window, DialogActionListener l) { - BasicDialog dg; - if (window instanceof Frame) { - dg = new DIALOG((Frame) window); - } else { - dg = new DIALOG((Dialog) window); - } - - if (l != null) { - dg.addDialogActionListener(l); - } - - dg.setBasicDialogSize(BasicDialog.CHART); - GUICoreUtils.centerWindow(dg); - dg.setResizable(false); - return dg; - } - - /** - * 显示窗口 - * @param window 窗口 - * @param l 对话框监听器 - * @return 对话框 - */ - public BasicDialog showSmallWindow(Window window, DialogActionListener l) { - BasicDialog dg; - if (window instanceof Frame) { - dg = new DIALOG((Frame) window); - } else { - dg = new DIALOG((Dialog) window); - } - - if (l != null) { - dg.addDialogActionListener(l); - } - dg.setBasicDialogSize(BasicDialog.SMALL); - GUICoreUtils.centerWindow(dg); - dg.setResizable(false); - return dg; - } - - /** - * 显示窗口 - * @param window 窗口 - * @param l 对话框监听器 - * @return 对话框 - */ - public BasicDialog showMediumWindow(Window window, DialogActionListener l) { - BasicDialog dg; - if (window instanceof Frame) { - dg = new DIALOG((Frame) window); - } else { - dg = new DIALOG((Dialog) window); - } - - if (l != null) { - dg.addDialogActionListener(l); - } - dg.setBasicDialogSize(BasicDialog.MEDIUM); - GUICoreUtils.centerWindow(dg); - dg.setResizable(false); - return dg; - } - - /** - * 显示窗口 - * @param window 窗口 - * @param l 对话框监听器 - * @return 对话框 - */ - public BasicDialog showLargeWindow(Window window, DialogActionListener l) { - BasicDialog dg; - if (window instanceof Frame) { - dg = new DIALOG((Frame) window); - } else { - dg = new DIALOG((Dialog) window); - } - - if (l != null) { - dg.addDialogActionListener(l); - } - dg.setBasicDialogSize(BasicDialog.LARGE); - GUICoreUtils.centerWindow(dg); - dg.setResizable(false); - return dg; - } - - /** - * 显示窗口 - * @param window 窗口 - * @param l 对话框监听器 - * @return 对话框 - */ - public UIDialog showUnsizedWindow(Window window, DialogActionListener l) { - UIDialog dg; - if (window instanceof Frame) { - dg = new UnsizedDialog((Frame) window); - } else { - dg = new UnsizedDialog((Dialog) window); - } - - if (l != null) { - dg.addDialogActionListener(l); - } - GUICoreUtils.centerWindow(dg); - dg.setResizable(false); - return dg; - } - - /** - * 显示窗口 - * @param window 窗口 - * @param l 对话框监听器 - * @return 对话框 - */ - public BasicDialog showWindow4ChartMapArray(Window window,DialogActionListener l){ - BasicDialog dg; - if (window instanceof Frame) { - dg = new DIALOG((Frame) window); - } else { - dg = new DIALOG((Dialog) window); - } - - if (l != null) { - dg.addDialogActionListener(l); - } - dg.setBasicDialogSize(BasicDialog.MAP_SIZE); - GUICoreUtils.centerWindow(dg); - dg.setResizable(false); - return dg; - } - - - /** - * 显示窗口 - * @param window 窗口 - * @return 对话框 - */ - public BasicDialog showWindow4UpdateOnline(Window window){ - BasicDialog dg; - if (window instanceof Frame) { - dg = new DIALOG((Frame) window,false); - } else { - dg = new DIALOG((Dialog) window,false); - } - dg.setBasicDialogSize(BasicDialog.UPDATE_ONLINE_SIZE); - GUICoreUtils.centerWindow(dg); - dg.setResizable(false); - return dg; - } - - protected abstract String title4PopupWindow(); - - public String getTitle(){ - return title4PopupWindow(); - } - - /** - * 作为名字面板 - * @return 面板 - */ - public NamePane asNamePane() { - return new NamePane(this); - } - - /** - * 检查是否符合规范 + /** + * 显示窗口 * - * @throws Exception 异常 - */ - public void checkValid() throws Exception { - } - - public static final class NamePane extends BasicPane { - private UITextField nameTextField; - private BasicPane centerPane; - private UILabel showfield; - private PropertyChangeAdapter changeListener; - - private NamePane(BasicPane bPane) { - this.setLayout(new BorderLayout(4, 4)); - - nameTextField = new UITextField(30); - JPanel northPane = new JPanel(new BorderLayout(4, 4)); - northPane.add(new UILabel(Inter.getLocText("FR-Designer-Hyperlink_Name") + ":"), BorderLayout.WEST); - northPane.add(nameTextField, BorderLayout.CENTER); - northPane.add(showfield = new UILabel(" "), BorderLayout.EAST); - showfield.setForeground(new Color(204, 0, 1)); - showfield.setPreferredSize(new Dimension(220, showfield.getPreferredSize().height)); - this.add(northPane, BorderLayout.NORTH); - this.centerPane = bPane; - this.add(bPane, BorderLayout.CENTER); - this.nameTextField.getDocument().addDocumentListener(new javax.swing.event.DocumentListener() { - - @Override - public void insertUpdate(DocumentEvent e) { - doTextChanged(); - } - - @Override - public void removeUpdate(DocumentEvent e) { - doTextChanged(); - } - - @Override - public void changedUpdate(DocumentEvent e) { - doTextChanged(); - } - - }); - } - - private void doTextChanged() { - if (changeListener != null) { - changeListener.propertyChange(); - } - } - - public String getObjectName() { - return this.nameTextField.getText().trim(); - } - - public void setObjectName(String name) { - this.nameTextField.setText(name); - } - - public void setShowText(String name) { - this.showfield.setText(name); - } - - @Override - protected String title4PopupWindow() { - return centerPane.title4PopupWindow(); - } - - /** - * 检查是否符合规范 - * - * @throws Exception 异常 - */ - public void checkValid() throws Exception { - super.checkValid(); - - this.centerPane.checkValid(); - } - - /** - * 添加属性改变的监听器 - * @param listener 监听器 - */ - public void addPropertyChangeListener(PropertyChangeAdapter listener) { - this.changeListener = listener; - } - } - - private class DIALOG extends BasicDialog { - public DIALOG(Frame parent) { - super(parent, BasicPane.this); - this.setTitle(BasicPane.this.title4PopupWindow()); - } - - public DIALOG(Dialog parent) { - super(parent, BasicPane.this); - this.setTitle(BasicPane.this.title4PopupWindow()); - } - - - public DIALOG(Frame parent, boolean isNeedButtonPane) { - super(parent, BasicPane.this, isNeedButtonPane); - this.setTitle(BasicPane.this.title4PopupWindow()); - } - - - public DIALOG(Dialog parent, boolean isNeedButtonPane) { - super(parent, BasicPane.this, isNeedButtonPane); - this.setTitle(BasicPane.this.title4PopupWindow()); - } - - - - /** - * init Components - */ - - - /** - * Check valid. - */ - public void checkValid() throws Exception { - BasicPane.this.checkValid(); - } + * @param window 窗口 + * @return 对话框 + */ + public BasicDialog showWindow(Window window) { + return this.showWindow(window, null); + } - } - private class UnsizedDialog extends UIDialog { + /** + * 显示窗口 + * + * @param window 窗口 + * @param l 对话框监听器 + * @return 对话框 + */ + public BasicDialog showWindow(Window window, DialogActionListener l) { + BasicDialog dg; + if (window instanceof Frame) { + dg = new DIALOG((Frame) window); + } else { + dg = new DIALOG((Dialog) window); + } + + if (l != null) { + dg.addDialogActionListener(l); + } + + dg.setBasicDialogSize(BasicDialog.DEFAULT); + GUICoreUtils.centerWindow(dg); + dg.setResizable(false); + return dg; + } + + /** + * 显示窗口 + * + * @param window 窗口 + * @param isNeedButtonsPane 是否需要确定删除按钮 + * @return 对话框 + */ + public BasicDialog showWindow(Window window, boolean isNeedButtonsPane) { + BasicDialog dg; + if (window instanceof Frame) { + dg = new DIALOG((Frame) window, isNeedButtonsPane); + } else { + dg = new DIALOG((Dialog) window, isNeedButtonsPane); + } + dg.setBasicDialogSize(BasicDialog.DEFAULT); + GUICoreUtils.centerWindow(dg); + dg.setResizable(false); + return dg; + } + + + /** + * 图表类型选择时 弹出的按钮大小, 不适合用最大最小, 因为图表大小 默认是规定好的, 那么界面大小也是必须配合. + * 并且包括 条件显示中 多个条件的大小 + * + * @param window 窗口 + * @param l 监听器 + * @return 对话框 + */ + public BasicDialog showWindow4ChartType(Window window, DialogActionListener l) { + BasicDialog dg; + if (window instanceof Frame) { + dg = new DIALOG((Frame) window); + } else { + dg = new DIALOG((Dialog) window); + } + + if (l != null) { + dg.addDialogActionListener(l); + } + + dg.setBasicDialogSize(BasicDialog.CHART); + GUICoreUtils.centerWindow(dg); + dg.setResizable(false); + return dg; + } + + /** + * 显示窗口 + * + * @param window 窗口 + * @param l 对话框监听器 + * @return 对话框 + */ + public BasicDialog showSmallWindow(Window window, DialogActionListener l) { + BasicDialog dg; + if (window instanceof Frame) { + dg = new DIALOG((Frame) window); + } else { + dg = new DIALOG((Dialog) window); + } + + if (l != null) { + dg.addDialogActionListener(l); + } + dg.setBasicDialogSize(BasicDialog.SMALL); + GUICoreUtils.centerWindow(dg); + dg.setResizable(false); + return dg; + } + + /** + * 显示窗口 + * + * @param window 窗口 + * @param l 对话框监听器 + * @return 对话框 + */ + public BasicDialog showMediumWindow(Window window, DialogActionListener l) { + BasicDialog dg; + if (window instanceof Frame) { + dg = new DIALOG((Frame) window); + } else { + dg = new DIALOG((Dialog) window); + } + + if (l != null) { + dg.addDialogActionListener(l); + } + dg.setBasicDialogSize(BasicDialog.MEDIUM); + GUICoreUtils.centerWindow(dg); + dg.setResizable(false); + return dg; + } + + /** + * 显示窗口 + * + * @param window 窗口 + * @param l 对话框监听器 + * @return 对话框 + */ + public BasicDialog showLargeWindow(Window window, DialogActionListener l) { + BasicDialog dg; + if (window instanceof Frame) { + dg = new DIALOG((Frame) window); + } else { + dg = new DIALOG((Dialog) window); + } + + if (l != null) { + dg.addDialogActionListener(l); + } + dg.setBasicDialogSize(BasicDialog.LARGE); + GUICoreUtils.centerWindow(dg); + dg.setResizable(false); + return dg; + } + + /** + * 显示自定义大小的窗口 + * + * @param window 窗口 + * @param l 对话框监听器 + * @param dimension 窗口大小 + * @return 对话框 + */ + public BasicDialog showCustomSizeWindow(Window window, DialogActionListener l, Dimension dimension) { + BasicDialog dg; + if (window instanceof Frame) { + dg = new DIALOG((Frame) window); + } else { + dg = new DIALOG((Dialog) window); + } + if (l != null) { + dg.addDialogActionListener(l); + } + dg.setBasicDialogSize(dimension); + GUICoreUtils.centerWindow(dg); + dg.setResizable(false); + return dg; + } + + /** + * 显示窗口 + * + * @param window 窗口 + * @param l 对话框监听器 + * @return 对话框 + */ + public UIDialog showUnsizedWindow(Window window, DialogActionListener l) { + UIDialog dg; + if (window instanceof Frame) { + dg = new UnsizedDialog((Frame) window); + } else { + dg = new UnsizedDialog((Dialog) window); + } + + if (l != null) { + dg.addDialogActionListener(l); + } + GUICoreUtils.centerWindow(dg); + dg.setResizable(false); + return dg; + } + + /** + * 显示窗口 + * + * @param window 窗口 + * @param l 对话框监听器 + * @return 对话框 + */ + public BasicDialog showWindow4ChartMapArray(Window window, DialogActionListener l) { + BasicDialog dg; + if (window instanceof Frame) { + dg = new DIALOG((Frame) window); + } else { + dg = new DIALOG((Dialog) window); + } + + if (l != null) { + dg.addDialogActionListener(l); + } + dg.setBasicDialogSize(BasicDialog.MAP_SIZE); + GUICoreUtils.centerWindow(dg); + dg.setResizable(false); + return dg; + } + + + /** + * 显示窗口 + * + * @param window 窗口 + * @return 对话框 + */ + public BasicDialog showWindow4UpdateOnline(Window window) { + BasicDialog dg; + if (window instanceof Frame) { + dg = new DIALOG((Frame) window, false); + } else { + dg = new DIALOG((Dialog) window, false); + } + dg.setBasicDialogSize(BasicDialog.UPDATE_ONLINE_SIZE); + GUICoreUtils.centerWindow(dg); + dg.setResizable(false); + return dg; + } + + protected abstract String title4PopupWindow(); + + public String getTitle() { + return title4PopupWindow(); + } + + /** + * 作为名字面板 + * + * @return 面板 + */ + public NamePane asNamePane() { + return new NamePane(this); + } - public UnsizedDialog(Frame parent) { - super(parent, BasicPane.this); - this.setTitle(BasicPane.this.title4PopupWindow()); - } + /** + * 检查是否符合规范 + * + * @throws Exception 异常 + */ + public void checkValid() throws Exception { + } + + public static final class NamePane extends BasicPane { + private UITextField nameTextField; + private BasicPane centerPane; + private UILabel showfield; + private PropertyChangeAdapter changeListener; + + private NamePane(BasicPane bPane) { + this.setLayout(new BorderLayout(4, 4)); + + nameTextField = new UITextField(30); + JPanel northPane = new JPanel(new BorderLayout(4, 4)); + northPane.add(new UILabel(Inter.getLocText("FR-Designer-Hyperlink_Name") + ":"), BorderLayout.WEST); + northPane.add(nameTextField, BorderLayout.CENTER); + northPane.add(showfield = new UILabel(" "), BorderLayout.EAST); + showfield.setForeground(new Color(204, 0, 1)); + showfield.setPreferredSize(new Dimension(220, showfield.getPreferredSize().height)); + this.add(northPane, BorderLayout.NORTH); + this.centerPane = bPane; + this.add(bPane, BorderLayout.CENTER); + this.nameTextField.getDocument().addDocumentListener(new javax.swing.event.DocumentListener() { + + @Override + public void insertUpdate(DocumentEvent e) { + doTextChanged(); + } + + @Override + public void removeUpdate(DocumentEvent e) { + doTextChanged(); + } + + @Override + public void changedUpdate(DocumentEvent e) { + doTextChanged(); + } + + }); + } + + private void doTextChanged() { + if (changeListener != null) { + changeListener.propertyChange(); + } + } + + public String getObjectName() { + return this.nameTextField.getText().trim(); + } + + public void setObjectName(String name) { + this.nameTextField.setText(name); + } + + public void setShowText(String name) { + this.showfield.setText(name); + } + + @Override + protected String title4PopupWindow() { + return centerPane.title4PopupWindow(); + } + + /** + * 检查是否符合规范 + * + * @throws Exception 异常 + */ + public void checkValid() throws Exception { + super.checkValid(); + + this.centerPane.checkValid(); + } + + /** + * 添加属性改变的监听器 + * + * @param listener 监听器 + */ + public void addPropertyChangeListener(PropertyChangeAdapter listener) { + this.changeListener = listener; + } + } + + private class DIALOG extends BasicDialog { + public DIALOG(Frame parent) { + super(parent, BasicPane.this); + this.setTitle(BasicPane.this.title4PopupWindow()); + } + + public DIALOG(Dialog parent) { + super(parent, BasicPane.this); + this.setTitle(BasicPane.this.title4PopupWindow()); + } + + + public DIALOG(Frame parent, boolean isNeedButtonPane) { + super(parent, BasicPane.this, isNeedButtonPane); + this.setTitle(BasicPane.this.title4PopupWindow()); + } + + + public DIALOG(Dialog parent, boolean isNeedButtonPane) { + super(parent, BasicPane.this, isNeedButtonPane); + this.setTitle(BasicPane.this.title4PopupWindow()); + } + + + /** + * init Components + */ + + + /** + * Check valid. + */ + public void checkValid() throws Exception { + BasicPane.this.checkValid(); + } + + } - public UnsizedDialog(Dialog parent) { - super(parent, BasicPane.this); - this.setTitle(BasicPane.this.title4PopupWindow()); - } + private class UnsizedDialog extends UIDialog { + + public UnsizedDialog(Frame parent) { + super(parent, BasicPane.this); + this.setTitle(BasicPane.this.title4PopupWindow()); + } + + public UnsizedDialog(Dialog parent) { + super(parent, BasicPane.this); + this.setTitle(BasicPane.this.title4PopupWindow()); + } - public void checkValid() throws Exception { - BasicPane.this.checkValid(); - } + public void checkValid() throws Exception { + BasicPane.this.checkValid(); + } - } + } } \ No newline at end of file diff --git a/designer_base/src/com/fr/design/extra/PluginWebBridge.java b/designer_base/src/com/fr/design/extra/PluginWebBridge.java index b4eb6e9e1..b32dcdd40 100644 --- a/designer_base/src/com/fr/design/extra/PluginWebBridge.java +++ b/designer_base/src/com/fr/design/extra/PluginWebBridge.java @@ -1,6 +1,8 @@ package com.fr.design.extra; import com.fr.design.extra.exe.*; +import com.fr.general.FRLogger; +import com.fr.general.http.HttpClient; import com.fr.json.JSONArray; import com.fr.json.JSONObject; import com.fr.plugin.Plugin; @@ -157,6 +159,7 @@ public class PluginWebBridge { /** * 获取已经安装的插件的数组 + * * @return 已安装的插件组成的数组 */ public Plugin[] getInstalledPlugins() { @@ -174,4 +177,26 @@ public class PluginWebBridge { } return list.toArray(new String[len]); } + + public String getPluginFromStore(String category, String seller, String fee) { + + StringBuilder url = new StringBuilder("http://127.0.0.1:8080/ShopServer?pg=plist"); + 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]); + } + String resText = null; + try { + HttpClient httpClient = new HttpClient(url.toString()); + resText = httpClient.getResponseText(); + } catch (Exception e) { + FRLogger.getLogger().error(e.getMessage()); + } + return resText == null ? StringUtils.EMPTY : resText; + } } diff --git a/designer_base/src/com/fr/design/extra/PluginWebPane.java b/designer_base/src/com/fr/design/extra/PluginWebPane.java index 8b899220f..54c882bdd 100644 --- a/designer_base/src/com/fr/design/extra/PluginWebPane.java +++ b/designer_base/src/com/fr/design/extra/PluginWebPane.java @@ -5,6 +5,7 @@ import javafx.embed.swing.JFXPanel; import javafx.event.EventHandler; import javafx.scene.Group; import javafx.scene.Scene; +import javafx.scene.layout.BorderPane; import javafx.scene.web.WebEngine; import javafx.scene.web.WebEvent; import javafx.scene.web.WebView; @@ -24,7 +25,7 @@ public class PluginWebPane extends JFXPanel { Platform.runLater(new Runnable() { @Override public void run() { - Group root = new Group(); + BorderPane root = new BorderPane(); Scene scene = new Scene(root); PluginWebPane.this.setScene(scene); WebView webView = new WebView(); @@ -38,7 +39,7 @@ public class PluginWebPane extends JFXPanel { }); JSObject obj = (JSObject) webEngine.executeScript("window"); obj.setMember("PluginHelper", PluginWebBridge.getHelper(webEngine)); - root.getChildren().add(webView); + root.setCenter(webView); } }); }