Browse Source

new:新增组件复用商店界面

master
vito 8 years ago
parent
commit
c839d40b66
  1. 20
      designer/src/com/fr/design/report/freeze/RepeatAndFreezeSettingPane.java
  2. 9
      designer_base/src/com/fr/design/actions/server/PluginManagerAction.java
  3. 53
      designer_base/src/com/fr/design/actions/server/ReuseManagerAction.java
  4. 3
      designer_base/src/com/fr/design/extra/PluginWebBridge.java
  5. 4
      designer_base/src/com/fr/design/extra/PluginWebPane.java
  6. 36
      designer_base/src/com/fr/design/extra/ReuseWebBridge.java
  7. 54
      designer_base/src/com/fr/design/extra/ReuseWebPane.java
  8. 10
      designer_base/src/com/fr/design/extra/ShopDialog.java
  9. 56
      designer_base/src/com/fr/design/extra/ShopManagerPane.java
  10. 24
      designer_base/src/com/fr/design/extra/ShopPaneConfig.java
  11. 99
      designer_base/src/com/fr/design/extra/WebManagerPaneFactory.java
  12. 9
      designer_base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java
  13. 9
      designer_base/src/com/fr/start/BaseDesigner.java

20
designer/src/com/fr/design/report/freeze/RepeatAndFreezeSettingPane.java

@ -10,9 +10,10 @@ import javax.swing.event.ChangeListener;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.UIDialog; import com.fr.design.dialog.UIDialog;
import com.fr.design.extra.PluginManagerPane; import com.fr.design.extra.ShopManagerPane;
import com.fr.design.extra.PluginShopDialog; import com.fr.design.extra.ShopDialog;
import com.fr.design.extra.PluginWebBridge; import com.fr.design.extra.PluginWebBridge;
import com.fr.design.extra.WebManagerPaneFactory;
import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.ActionLabel; import com.fr.design.gui.ilable.ActionLabel;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
@ -126,10 +127,7 @@ public class RepeatAndFreezeSettingPane extends BasicPane {
* 获取分页冻结的标题(表单中不需要写分页二字) * 获取分页冻结的标题(表单中不需要写分页二字)
* *
* @return 分页冻结的标题 * @return 分页冻结的标题
*
*
* @date 2014-11-14-下午1:32:08 * @date 2014-11-14-下午1:32:08
*
*/ */
protected String getPageFrozenTitle() { protected String getPageFrozenTitle() {
return Inter.getLocText("FR-Engine_Page-Frozen"); return Inter.getLocText("FR-Engine_Page-Frozen");
@ -390,9 +388,7 @@ public class RepeatAndFreezeSettingPane extends BasicPane {
/** /**
* 窗口标题 * 窗口标题
* *
*
* @date 2014-11-14-下午2:30:58 * @date 2014-11-14-下午2:30:58
*
*/ */
protected String title4PopupWindow() { protected String title4PopupWindow() {
return Inter.getLocText("FR-Engine_Repeat-Freeze"); return Inter.getLocText("FR-Engine_Repeat-Freeze");
@ -466,10 +462,7 @@ public class RepeatAndFreezeSettingPane extends BasicPane {
* 初始化填报冻结pane * 初始化填报冻结pane
* *
* @param writeFrozenColumnRow 填报冻结格子 * @param writeFrozenColumnRow 填报冻结格子
*
*
* @date 2014-11-14-下午2:30:15 * @date 2014-11-14-下午2:30:15
*
*/ */
public void populateWriteFrozenColumnRow(ColumnRow writeFrozenColumnRow) { public void populateWriteFrozenColumnRow(ColumnRow writeFrozenColumnRow) {
if (writeFrozenColumnRow != null) { if (writeFrozenColumnRow != null) {
@ -540,10 +533,7 @@ public class RepeatAndFreezeSettingPane extends BasicPane {
* 更新WriteFrozenColumnRow * 更新WriteFrozenColumnRow
* *
* @return 行列 * @return 行列
*
*
* @date 2014-11-14-下午2:29:45 * @date 2014-11-14-下午2:29:45
*
*/ */
public ColumnRow updateWriteFrozenColumnRow() { public ColumnRow updateWriteFrozenColumnRow() {
if (useWriteFrozenCCheckBox.isSelected() || useWriteFrozenRCheckBox.isSelected()) { if (useWriteFrozenCCheckBox.isSelected() || useWriteFrozenRCheckBox.isSelected()) {
@ -562,8 +552,8 @@ public class RepeatAndFreezeSettingPane extends BasicPane {
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
try { try {
//Desktop.getDesktop().browse(new URI(url)); //Desktop.getDesktop().browse(new URI(url));
final PluginManagerPane managerPane = new PluginManagerPane(); BasicPane managerPane = new WebManagerPaneFactory().createPluginPane();
UIDialog dlg = new PluginShopDialog(DesignerContext.getDesignerFrame(),managerPane); UIDialog dlg = new ShopDialog(DesignerContext.getDesignerFrame(), managerPane);
PluginWebBridge.getHelper().setDialogHandle(dlg); PluginWebBridge.getHelper().setDialogHandle(dlg);
dlg.setVisible(true); dlg.setVisible(true);
RepeatAndFreezeSettingPane.this.getTopLevelAncestor().setVisible(false); RepeatAndFreezeSettingPane.this.getTopLevelAncestor().setVisible(false);

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

@ -2,10 +2,11 @@ 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.BasicPane;
import com.fr.design.dialog.UIDialog; import com.fr.design.dialog.UIDialog;
import com.fr.design.extra.PluginManagerPane;
import com.fr.design.extra.PluginWebBridge; import com.fr.design.extra.PluginWebBridge;
import com.fr.design.extra.PluginShopDialog; import com.fr.design.extra.ShopDialog;
import com.fr.design.extra.WebManagerPaneFactory;
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;
@ -29,8 +30,8 @@ public class PluginManagerAction extends UpdateAction {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
final PluginManagerPane managerPane = new PluginManagerPane(); BasicPane managerPane = new WebManagerPaneFactory().createPluginPane();
UIDialog dlg = new PluginShopDialog(DesignerContext.getDesignerFrame(),managerPane); UIDialog dlg = new ShopDialog(DesignerContext.getDesignerFrame(), managerPane);
PluginWebBridge.getHelper().setDialogHandle(dlg); PluginWebBridge.getHelper().setDialogHandle(dlg);
dlg.setVisible(true); dlg.setVisible(true);
} }

53
designer_base/src/com/fr/design/actions/server/ReuseManagerAction.java

@ -0,0 +1,53 @@
package com.fr.design.actions.server;
import com.fr.base.BaseUtils;
import com.fr.design.actions.UpdateAction;
import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.UIDialog;
import com.fr.design.extra.ShopDialog;
import com.fr.design.extra.PluginWebBridge;
import com.fr.design.extra.WebManagerPaneFactory;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.menu.MenuKeySet;
import com.fr.general.Inter;
import javax.swing.*;
import java.awt.event.ActionEvent;
/**
* Created by vito on 2016/9/27.
*/
public class ReuseManagerAction extends UpdateAction {
public ReuseManagerAction() {
this.setMenuKeySet(REUSE_MANAGER);
this.setName(getMenuKeySet().getMenuKeySetName());
this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/server/plugin.png"));
}
@Override
public void actionPerformed(ActionEvent e) {
BasicPane managerPane = new WebManagerPaneFactory().createReusePane();
UIDialog dlg = new ShopDialog(DesignerContext.getDesignerFrame(), managerPane);
PluginWebBridge.getHelper().setDialogHandle(dlg);
dlg.setVisible(true);
}
public static final MenuKeySet REUSE_MANAGER = new MenuKeySet() {
@Override
public char getMnemonic() {
return 'R';
}
@Override
public String getMenuName() {
return Inter.getLocText("FR-Designer-Reuse_Manager");
}
@Override
public KeyStroke getKeyStroke() {
return null;
}
};
}

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

@ -42,6 +42,7 @@ public class PluginWebBridge {
private String ACTION = "action"; private String ACTION = "action";
private String KEYWORD = "keyword"; private String KEYWORD = "keyword";
private Map<String, Object> config; private Map<String, Object> config;
private WebEngine webEngine;
private UILabel uiLabel; private UILabel uiLabel;
@ -79,8 +80,6 @@ public class PluginWebBridge {
return helper; return helper;
} }
private WebEngine webEngine;
private PluginWebBridge() { private PluginWebBridge() {
} }

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

@ -19,7 +19,7 @@ public class PluginWebPane extends JFXPanel {
private WebEngine webEngine; private WebEngine webEngine;
public PluginWebPane(final String installHome) { public PluginWebPane(final String mainJs) {
Platform.setImplicitExit(false); Platform.setImplicitExit(false);
Platform.runLater(new Runnable() { Platform.runLater(new Runnable() {
@Override @Override
@ -29,7 +29,7 @@ public class PluginWebPane extends JFXPanel {
PluginWebPane.this.setScene(scene); PluginWebPane.this.setScene(scene);
WebView webView = new WebView(); WebView webView = new WebView();
webEngine = webView.getEngine(); webEngine = webView.getEngine();
webEngine.load("file:///" + installHome + "/scripts/store/web/index.html"); webEngine.load("file:///" + mainJs);
webEngine.setOnAlert(new EventHandler<WebEvent<String>>() { webEngine.setOnAlert(new EventHandler<WebEvent<String>>() {
@Override @Override
public void handle(WebEvent<String> event) { public void handle(WebEvent<String> event) {

36
designer_base/src/com/fr/design/extra/ReuseWebBridge.java

@ -0,0 +1,36 @@
package com.fr.design.extra;
import javafx.scene.web.WebEngine;
/**
* Created by vito on 2016/9/28.
*/
public class ReuseWebBridge {
public static ReuseWebBridge helper;
private WebEngine webEngine;
public static ReuseWebBridge getHelper() {
if (helper != null) {
return helper;
}
synchronized (ReuseWebBridge.class) {
if (helper == null) {
helper = new ReuseWebBridge();
}
return helper;
}
}
public static ReuseWebBridge getHelper(WebEngine webEngine) {
getHelper();
helper.setEngine(webEngine);
return helper;
}
private ReuseWebBridge() {
}
public void setEngine(WebEngine webEngine) {
this.webEngine = webEngine;
}
}

54
designer_base/src/com/fr/design/extra/ReuseWebPane.java

@ -0,0 +1,54 @@
package com.fr.design.extra;
import javafx.application.Platform;
import javafx.embed.swing.JFXPanel;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.layout.BorderPane;
import javafx.scene.web.WebEngine;
import javafx.scene.web.WebEvent;
import javafx.scene.web.WebView;
import netscape.javascript.JSObject;
import javax.swing.*;
/**
* Created by vito on 2016/9/28.
*/
public class ReuseWebPane extends JFXPanel {
private WebEngine webEngine;
public ReuseWebPane(final String mainJs) {
Platform.setImplicitExit(false);
Platform.runLater(new Runnable() {
@Override
public void run() {
BorderPane root = new BorderPane();
Scene scene = new Scene(root);
ReuseWebPane.this.setScene(scene);
WebView webView = new WebView();
webEngine = webView.getEngine();
webEngine.load("file:///" + mainJs);
webEngine.setOnAlert(new EventHandler<WebEvent<String>>() {
@Override
public void handle(WebEvent<String> event) {
showAlert(event.getData());
}
});
JSObject obj = (JSObject) webEngine.executeScript("window");
obj.setMember("ReuseHelper", ReuseWebBridge.getHelper(webEngine));
webView.setContextMenuEnabled(false);//屏蔽右键
root.setCenter(webView);
}
});
}
private void showAlert(final String message) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
JOptionPane.showMessageDialog(ReuseWebPane.this, message);
}
});
}
}

10
designer_base/src/com/fr/design/extra/PluginShopDialog.java → designer_base/src/com/fr/design/extra/ShopDialog.java

@ -3,8 +3,7 @@ package com.fr.design.extra;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.UIDialog; import com.fr.design.dialog.UIDialog;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.Inter; import com.fr.stable.StableUtils;
import javafx.embed.swing.JFXPanel;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;
@ -12,19 +11,20 @@ import java.awt.*;
/** /**
* Created by vito on 16/4/18. * Created by vito on 16/4/18.
*/ */
public class PluginShopDialog extends UIDialog { public class ShopDialog extends UIDialog {
private static final Dimension DEFAULT_SHOP = new Dimension(900, 700); private static final Dimension DEFAULT_SHOP = new Dimension(900, 700);
public PluginShopDialog(Frame frame, BasicPane pane) { public ShopDialog(Frame frame, BasicPane pane) {
super(frame); super(frame);
if (StableUtils.getMajorJavaVersion() == 8) {
setUndecorated(true); setUndecorated(true);
}
JPanel panel = (JPanel) getContentPane(); JPanel panel = (JPanel) getContentPane();
panel.setLayout(new BorderLayout()); panel.setLayout(new BorderLayout());
add(pane, BorderLayout.CENTER); add(pane, BorderLayout.CENTER);
setSize(DEFAULT_SHOP); setSize(DEFAULT_SHOP);
GUICoreUtils.centerWindow(this); GUICoreUtils.centerWindow(this);
setResizable(false); setResizable(false);
setTitle(Inter.getLocText("FR-Designer-Plugin_Manager"));
} }
@Override @Override

56
designer_base/src/com/fr/design/extra/PluginManagerPane.java → designer_base/src/com/fr/design/extra/ShopManagerPane.java

@ -4,7 +4,6 @@ import com.fr.base.FRContext;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.RestartHelper; import com.fr.design.RestartHelper;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.frpane.UITabbedPane;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
@ -12,12 +11,12 @@ import com.fr.general.SiteCenter;
import com.fr.general.http.HttpClient; import com.fr.general.http.HttpClient;
import com.fr.plugin.PluginVerifyException; import com.fr.plugin.PluginVerifyException;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import javafx.embed.swing.JFXPanel;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;
import java.io.File; import java.io.File;
import java.net.HttpURLConnection; import java.net.HttpURLConnection;
import java.net.URL;
import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutionException;
/** /**
@ -31,21 +30,18 @@ import java.util.concurrent.ExecutionException;
* 因为如果直接嵌入WebView,和设计器的交互就需要预先设定好,这样灵活性会差很多,而如果使用JavaScript引擎, * 因为如果直接嵌入WebView,和设计器的交互就需要预先设定好,这样灵活性会差很多,而如果使用JavaScript引擎,
* 就可以直接在JavaScript中和WebView组件做交互,而同时JavaScript中可以调用任何的设计器API. * 就可以直接在JavaScript中和WebView组件做交互,而同时JavaScript中可以调用任何的设计器API.
*/ */
public class PluginManagerPane extends BasicPane { public class ShopManagerPane extends BasicPane {
private static final String LATEST = "latest"; private static final String LATEST = "latest";
private ShopPaneConfig shopPaneConfig;
public PluginManagerPane() { public ShopManagerPane(ShopPaneConfig shopPaneConfig) {
this.shopPaneConfig = shopPaneConfig;
setLayout(new BorderLayout()); setLayout(new BorderLayout());
if (StableUtils.getMajorJavaVersion() == 8) {
String installHome;
if (StableUtils.isDebug()) { if (StableUtils.isDebug()) {
URL url = ClassLoader.getSystemResource(""); addPane();
installHome = url.getPath();
addPane(installHome);
} else { } else {
installHome = StableUtils.getInstallHome(); File file = new File(shopPaneConfig.getMainJS());
File file = new File(StableUtils.pathJoin(installHome, "scripts"));
if (!file.exists()) { if (!file.exists()) {
int rv = JOptionPane.showConfirmDialog( int rv = JOptionPane.showConfirmDialog(
this, this,
@ -58,55 +54,31 @@ public class PluginManagerPane extends BasicPane {
downloadShopScripts(); downloadShopScripts();
} }
} else { } else {
addPane(installHome); addPane();
updateShopScripts(); updateShopScripts();
} }
} }
} else {
initTraditionalStore();
}
} }
/** private void addPane() {
* 以关键词打开设计器商店 JFXPanel webPane = shopPaneConfig.getWebPane();
*
* @param keyword 关键词
*/
public PluginManagerPane(String keyword) {
this();
PluginWebBridge.getHelper().openWithSearch(keyword);
}
private void addPane(String installHome) {
PluginWebPane webPane = new PluginWebPane(new File(installHome).getAbsolutePath());
add(webPane, BorderLayout.CENTER); add(webPane, BorderLayout.CENTER);
} }
private void initTraditionalStore() {
UITabbedPane tabbedPane = new UITabbedPane();
add(tabbedPane, BorderLayout.CENTER);
PluginInstalledPane installedPane = new PluginInstalledPane();
tabbedPane.addTab(installedPane.tabTitle(), installedPane);
tabbedPane.addTab(Inter.getLocText("FR-Designer-Plugin_Update"), new PluginUpdatePane(tabbedPane));
tabbedPane.addTab(Inter.getLocText("FR-Designer-Plugin_All_Plugins"), new PluginFromStorePane(tabbedPane));
}
private void downloadShopScripts() { private void downloadShopScripts() {
new SwingWorker<Boolean, Void>() { new SwingWorker<Boolean, Void>() {
@Override @Override
protected Boolean doInBackground() throws Exception { protected Boolean doInBackground() throws Exception {
String id = "shop_scripts";
String username = DesignerEnvManager.getEnvManager().getBBSName(); String username = DesignerEnvManager.getEnvManager().getBBSName();
String password = DesignerEnvManager.getEnvManager().getBBSPassword(); String password = DesignerEnvManager.getEnvManager().getBBSPassword();
try { try {
PluginHelper.downloadPluginFile(id, username, password, new Process<Double>() { PluginHelper.downloadPluginFile(shopPaneConfig.getScriptsId(), username, password, new Process<Double>() {
@Override @Override
public void process(Double integer) { public void process(Double integer) {
} }
}); });
} catch (PluginVerifyException e) { } catch (PluginVerifyException e) {
JOptionPane.showMessageDialog(PluginManagerPane.this, e.getMessage(), Inter.getLocText("FR-Designer-Plugin_Warning"), JOptionPane.ERROR_MESSAGE); JOptionPane.showMessageDialog(ShopManagerPane.this, e.getMessage(), Inter.getLocText("FR-Designer-Plugin_Warning"), JOptionPane.ERROR_MESSAGE);
return false; return false;
} catch (Exception e) { } catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e); FRContext.getLogger().error(e.getMessage(), e);
@ -122,7 +94,7 @@ public class PluginManagerPane extends BasicPane {
if (get()) { if (get()) {
IOUtils.unzip(new File(StableUtils.pathJoin(PluginHelper.DOWNLOAD_PATH, PluginHelper.TEMP_FILE)), StableUtils.getInstallHome()); IOUtils.unzip(new File(StableUtils.pathJoin(PluginHelper.DOWNLOAD_PATH, PluginHelper.TEMP_FILE)), StableUtils.getInstallHome());
int rv = JOptionPane.showOptionDialog( int rv = JOptionPane.showOptionDialog(
PluginManagerPane.this, ShopManagerPane.this,
Inter.getLocText("FR-Designer-Plugin_Shop_Installed"), Inter.getLocText("FR-Designer-Plugin_Shop_Installed"),
Inter.getLocText("FR-Designer-Plugin_Warning"), Inter.getLocText("FR-Designer-Plugin_Warning"),
JOptionPane.YES_NO_OPTION, JOptionPane.YES_NO_OPTION,
@ -151,7 +123,7 @@ public class PluginManagerPane extends BasicPane {
if (httpClient.getResponseCode() == HttpURLConnection.HTTP_OK) { if (httpClient.getResponseCode() == HttpURLConnection.HTTP_OK) {
if (!ComparatorUtils.equals(httpClient.getResponseText(), LATEST)) { if (!ComparatorUtils.equals(httpClient.getResponseText(), LATEST)) {
int rv = JOptionPane.showConfirmDialog( int rv = JOptionPane.showConfirmDialog(
PluginManagerPane.this, ShopManagerPane.this,
Inter.getLocText("FR-Designer-Plugin_Shop_Need_Update"), Inter.getLocText("FR-Designer-Plugin_Shop_Need_Update"),
Inter.getLocText("FR-Designer-Plugin_Warning"), Inter.getLocText("FR-Designer-Plugin_Warning"),
JOptionPane.OK_CANCEL_OPTION, JOptionPane.OK_CANCEL_OPTION,

24
designer_base/src/com/fr/design/extra/ShopPaneConfig.java

@ -0,0 +1,24 @@
package com.fr.design.extra;
import javafx.embed.swing.JFXPanel;
/**
* Created by vito on 2016/9/28.
*/
public abstract class ShopPaneConfig {
private String mainJS;
private String scriptsId;
private JFXPanel webPane;
public ShopPaneConfig() {
this.mainJS = getMainJS();
this.scriptsId = getScriptsId();
this.webPane = getWebPane();
}
abstract String getMainJS();
abstract String getScriptsId();
abstract JFXPanel getWebPane();
}

99
designer_base/src/com/fr/design/extra/WebManagerPaneFactory.java

@ -0,0 +1,99 @@
package com.fr.design.extra;
import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.frpane.UITabbedPane;
import com.fr.general.Inter;
import com.fr.stable.StableUtils;
import javafx.embed.swing.JFXPanel;
import java.awt.*;
import java.io.File;
import java.net.URL;
/**
* Created by vito on 2016/9/28.
*/
public class WebManagerPaneFactory {
private String installHome;
public WebManagerPaneFactory() {
if (StableUtils.isDebug()) {
URL url = ClassLoader.getSystemResource("");
this.installHome = url.getPath();
} else {
this.installHome = StableUtils.getInstallHome();
}
}
public BasicPane createPluginPane() {
if (StableUtils.getMajorJavaVersion() == 8) {
return new ShopManagerPane(new ShopPaneConfig() {
@Override
String getMainJS() {
String relativePath = "/scripts/store/web/index.html";
return StableUtils.pathJoin(new File(installHome).getAbsolutePath(), relativePath);
}
@Override
String getScriptsId() {
return "shop_scripts";
}
@Override
JFXPanel getWebPane() {
return new PluginWebPane(getMainJS());
}
});
} else {
BasicPane traditionalStorePane = new BasicPane() {
@Override
protected String title4PopupWindow() {
return Inter.getLocText("FR-Designer-Plugin_Manager");
}
};
traditionalStorePane.setLayout(new BorderLayout());
traditionalStorePane.add(initTraditionalStore(), BorderLayout.CENTER);
return traditionalStorePane;
}
}
public BasicPane createReusePane() {
return new ShopManagerPane(new ShopPaneConfig() {
@Override
String getMainJS() {
String relativePath = "/scripts/store/reuse/index.html";
return StableUtils.pathJoin(new File(installHome).getAbsolutePath(), relativePath);
}
@Override
String getScriptsId() {
return "reuse_scripts";
}
@Override
JFXPanel getWebPane() {
return new ReuseWebPane(getMainJS());
}
});
}
/**
* 以关键词打开设计器商店
*
* @param keyword 关键词
*/
public BasicPane createPluginPane(String keyword) {
PluginWebBridge.getHelper().openWithSearch(keyword);
return createPluginPane();
}
private Component initTraditionalStore() {
UITabbedPane tabbedPane = new UITabbedPane();
PluginInstalledPane installedPane = new PluginInstalledPane();
tabbedPane.addTab(installedPane.tabTitle(), installedPane);
tabbedPane.addTab(Inter.getLocText("FR-Designer-Plugin_Update"), new PluginUpdatePane(tabbedPane));
tabbedPane.addTab(Inter.getLocText("FR-Designer-Plugin_All_Plugins"), new PluginFromStorePane(tabbedPane));
return tabbedPane;
}
}

9
designer_base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java

@ -236,7 +236,6 @@ public abstract class ToolBarMenuDock {
* 创建论坛登录面板, chart那边不需要 * 创建论坛登录面板, chart那边不需要
* *
* @return 面板组件 * @return 面板组件
*
*/ */
public Component createBBSLoginPane() { public Component createBBSLoginPane() {
return new UILabel(); return new UILabel();
@ -266,7 +265,8 @@ public abstract class ToolBarMenuDock {
if (!BaseUtils.isAuthorityEditing()) { if (!BaseUtils.isAuthorityEditing()) {
if (shouldShowPlugin()) { if (shouldShowPlugin()) {
menuDef.addShortCut( menuDef.addShortCut(
new PluginManagerAction() new PluginManagerAction(),
new ReuseManagerAction()
); );
} }
menuDef.addShortCut( menuDef.addShortCut(
@ -290,6 +290,7 @@ public abstract class ToolBarMenuDock {
/** /**
* 创建帮助子菜单 * 创建帮助子菜单
*
* @return 帮组菜单的子菜单 * @return 帮组菜单的子菜单
*/ */
public ShortCut[] createHelpShortCuts() { public ShortCut[] createHelpShortCuts() {
@ -312,6 +313,7 @@ public abstract class ToolBarMenuDock {
/** /**
* 创建社区子菜单 * 创建社区子菜单
*
* @return 社区菜单的子菜单 * @return 社区菜单的子菜单
*/ */
public ShortCut[] createCommunityShortCuts() { public ShortCut[] createCommunityShortCuts() {
@ -346,6 +348,7 @@ public abstract class ToolBarMenuDock {
insertMenu(menuDef, MenuHandler.BBS); insertMenu(menuDef, MenuHandler.BBS);
return menuDef; return menuDef;
} }
/** /**
* 生成工具栏 * 生成工具栏
* *
@ -470,6 +473,7 @@ public abstract class ToolBarMenuDock {
public int getMenuState() { public int getMenuState() {
return DesignState.WORK_SHEET; return DesignState.WORK_SHEET;
} }
public int getToolBarHeight() { public int getToolBarHeight() {
return PANLE_HEIGNT; return PANLE_HEIGNT;
} }
@ -546,7 +550,6 @@ public abstract class ToolBarMenuDock {
/** /**
* 设计器退出时, 做的一些操作. * 设计器退出时, 做的一些操作.
*
*/ */
public void shutDown() { public void shutDown() {

9
designer_base/src/com/fr/start/BaseDesigner.java

@ -7,10 +7,11 @@ import com.fr.base.FRContext;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.ExtraDesignClassManager; import com.fr.design.ExtraDesignClassManager;
import com.fr.design.RestartHelper; import com.fr.design.RestartHelper;
import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.UIDialog; import com.fr.design.dialog.UIDialog;
import com.fr.design.extra.PluginManagerPane; import com.fr.design.extra.ShopDialog;
import com.fr.design.extra.PluginShopDialog;
import com.fr.design.extra.PluginWebBridge; import com.fr.design.extra.PluginWebBridge;
import com.fr.design.extra.WebManagerPaneFactory;
import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.file.MutilTempalteTabPane; import com.fr.design.file.MutilTempalteTabPane;
import com.fr.design.file.TemplateTreePane; import com.fr.design.file.TemplateTreePane;
@ -130,8 +131,8 @@ public abstract class BaseDesigner extends ToolBarMenuDock {
String text = StableUtils.join(plugins, ",") + Inter.getLocText("FR-Designer_Plugin_Should_Update"); String text = StableUtils.join(plugins, ",") + Inter.getLocText("FR-Designer_Plugin_Should_Update");
int r = JOptionPane.showConfirmDialog(null, text, Inter.getLocText("FR-Designer_Plugin_Should_Update_Title"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE); int r = JOptionPane.showConfirmDialog(null, text, Inter.getLocText("FR-Designer_Plugin_Should_Update_Title"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE);
if (r == JOptionPane.OK_OPTION) { if (r == JOptionPane.OK_OPTION) {
final PluginManagerPane managerPane = new PluginManagerPane(); BasicPane managerPane = new WebManagerPaneFactory().createPluginPane();
UIDialog dlg = new PluginShopDialog(DesignerContext.getDesignerFrame(),managerPane); UIDialog dlg = new ShopDialog(DesignerContext.getDesignerFrame(), managerPane);
PluginWebBridge.getHelper().setDialogHandle(dlg); PluginWebBridge.getHelper().setDialogHandle(dlg);
dlg.setVisible(true); dlg.setVisible(true);
} }

Loading…
Cancel
Save