kerry 8 years ago
parent
commit
ee4e1c77c1
  1. 1140
      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. 5
      designer_base/src/com/fr/design/data/datapane/connect/JDBCDefPane.java
  5. 3
      designer_base/src/com/fr/design/extra/PluginWebBridge.java
  6. 4
      designer_base/src/com/fr/design/extra/PluginWebPane.java
  7. 36
      designer_base/src/com/fr/design/extra/ReuseWebBridge.java
  8. 54
      designer_base/src/com/fr/design/extra/ReuseWebPane.java
  9. 12
      designer_base/src/com/fr/design/extra/ShopDialog.java
  10. 84
      designer_base/src/com/fr/design/extra/ShopManagerPane.java
  11. 24
      designer_base/src/com/fr/design/extra/ShopPaneConfig.java
  12. 99
      designer_base/src/com/fr/design/extra/WebManagerPaneFactory.java
  13. 103
      designer_base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java
  14. 9
      designer_base/src/com/fr/start/BaseDesigner.java

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

File diff suppressed because it is too large Load Diff

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;
}
};
}

5
designer_base/src/com/fr/design/data/datapane/connect/JDBCDefPane.java

@ -43,7 +43,8 @@ public class JDBCDefPane extends JPanel {
new DriverURLName("org.hsqldb.jdbcDriver", "jdbc:hsqldb:file:[PATH_TO_DB_FILES]"), new DriverURLName("com.inet.tds.TdsDriver", "jdbc:inetdae7:localhost:1433/"), new DriverURLName("org.hsqldb.jdbcDriver", "jdbc:hsqldb:file:[PATH_TO_DB_FILES]"), new DriverURLName("com.inet.tds.TdsDriver", "jdbc:inetdae7:localhost:1433/"),
new DriverURLName("COM.cloudscape.JDBCDriver", "jdbc:cloudscape:/cloudscape/"), new DriverURLName("COM.cloudscape.JDBCDriver", "jdbc:cloudscape:/cloudscape/"),
new DriverURLName("com.internetcds.jdbc.tds.Driver", "jdbc:freetds:sqlserver://localhost/")}); new DriverURLName("com.internetcds.jdbc.tds.Driver", "jdbc:freetds:sqlserver://localhost/")});
// jdbcMap.put("Hadoop Hive",new DriverURLName[]{new DriverURLName("org.apache.hadoop.hive.jdbc.HiveDriver","jdbc:hive://localhost:10000/default")}); jdbcMap.put("Inceptor",new DriverURLName[]{new DriverURLName("org.apache.hive.jdbc.HiveDriver","jdbc:inceptor2://localhost:10000/default"),
new DriverURLName("org.apache.hadoop.hive.jdbc.HiveDriver","jdbc:inceptor://localhost:10000/default")});
jdbcMap.put("Oracle", new DriverURLName[]{new DriverURLName("oracle.jdbc.driver.OracleDriver", "jdbc:oracle:thin:@localhost:1521:databaseName")}); jdbcMap.put("Oracle", new DriverURLName[]{new DriverURLName("oracle.jdbc.driver.OracleDriver", "jdbc:oracle:thin:@localhost:1521:databaseName")});
jdbcMap.put("DB2", new DriverURLName[]{new DriverURLName("com.ibm.db2.jcc.DB2Driver", "jdbc:db2://localhost:50000/")}); jdbcMap.put("DB2", new DriverURLName[]{new DriverURLName("com.ibm.db2.jcc.DB2Driver", "jdbc:db2://localhost:50000/")});
jdbcMap.put("SQL Server", new DriverURLName[]{new DriverURLName("com.microsoft.sqlserver.jdbc.SQLServerDriver", "jdbc:sqlserver://localhost:1433;" + "databaseName=")}); jdbcMap.put("SQL Server", new DriverURLName[]{new DriverURLName("com.microsoft.sqlserver.jdbc.SQLServerDriver", "jdbc:sqlserver://localhost:1433;" + "databaseName=")});
@ -63,7 +64,7 @@ public class JDBCDefPane extends JPanel {
private UITextField userNameTextField; private UITextField userNameTextField;
private JPasswordField passwordTextField; private JPasswordField passwordTextField;
// 请不要改动dbtype,只应该最后添加 // 请不要改动dbtype,只应该最后添加
private final String[] dbtype = {"", "Oracle", "DB2", "SQL Server", "MySQL", "Sybase", "Access", "Derby", "Postgre","SQLite", "Others"}; private final String[] dbtype = {"", "Oracle", "DB2", "SQL Server", "MySQL", "Sybase", "Access", "Derby", "Postgre","SQLite","Inceptor", "Others"};
// carl:DBCP的一些属性 // carl:DBCP的一些属性
private IntegerEditor DBCP_INITIAL_SIZE = new IntegerEditor(); private IntegerEditor DBCP_INITIAL_SIZE = new IntegerEditor();

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);
}
});
}
}

12
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);
setUndecorated(true); if (StableUtils.getMajorJavaVersion() == 8) {
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

84
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,82 +30,55 @@ 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) { if (StableUtils.isDebug()) {
String installHome; addPane();
if (StableUtils.isDebug()) { } else {
URL url = ClassLoader.getSystemResource(""); File file = new File(shopPaneConfig.getMainJS());
installHome = url.getPath(); if (!file.exists()) {
addPane(installHome); int rv = JOptionPane.showConfirmDialog(
} else { this,
installHome = StableUtils.getInstallHome(); Inter.getLocText("FR-Designer-Plugin_Shop_Need_Install"),
File file = new File(StableUtils.pathJoin(installHome, "scripts")); Inter.getLocText("FR-Designer-Plugin_Warning"),
if (!file.exists()) { JOptionPane.OK_CANCEL_OPTION,
int rv = JOptionPane.showConfirmDialog( JOptionPane.INFORMATION_MESSAGE
this, );
Inter.getLocText("FR-Designer-Plugin_Shop_Need_Install"), if (rv == JOptionPane.OK_OPTION) {
Inter.getLocText("FR-Designer-Plugin_Warning"), downloadShopScripts();
JOptionPane.OK_CANCEL_OPTION,
JOptionPane.INFORMATION_MESSAGE
);
if (rv == JOptionPane.OK_OPTION) {
downloadShopScripts();
}
} else {
addPane(installHome);
updateShopScripts();
} }
} else {
addPane();
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;
}
}

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

@ -146,13 +146,13 @@ public abstract class ToolBarMenuDock {
// 给菜单加插件入口 // 给菜单加插件入口
for (MenuDef m : menuDefs) { for (MenuDef m : menuDefs) {
switch (m.getAnchor()) { switch (m.getAnchor()) {
case MenuHandler.TEMPLATE : case MenuHandler.TEMPLATE:
insertMenu(m, MenuHandler.TEMPLATE, new TemplateTargetAction(plus)); insertMenu(m, MenuHandler.TEMPLATE, new TemplateTargetAction(plus));
break; break;
case MenuHandler.INSERT : case MenuHandler.INSERT:
insertMenu(m, MenuHandler.INSERT); insertMenu(m, MenuHandler.INSERT);
break; break;
case MenuHandler.CELL : case MenuHandler.CELL:
insertMenu(m, MenuHandler.CELL); insertMenu(m, MenuHandler.CELL);
break; break;
default: default:
@ -199,7 +199,7 @@ public abstract class ToolBarMenuDock {
addSwitchExistEnvAction(menuDef); addSwitchExistEnvAction(menuDef);
menuDef.addShortCut( new ExitDesignerAction()); menuDef.addShortCut(new ExitDesignerAction());
insertMenu(menuDef, MenuHandler.FILE); insertMenu(menuDef, MenuHandler.FILE);
return menuDef; return menuDef;
@ -221,7 +221,7 @@ public abstract class ToolBarMenuDock {
menuDef.addShortCut(new SwitchExistEnv()); menuDef.addShortCut(new SwitchExistEnv());
} }
protected ShortCut openTemplateAction(){ protected ShortCut openTemplateAction() {
return new OpenTemplateAction(); return new OpenTemplateAction();
} }
@ -231,15 +231,14 @@ public abstract class ToolBarMenuDock {
* @return 菜单 * @return 菜单
*/ */
public abstract ShortCut[] createNewFileShortCuts(); public abstract ShortCut[] createNewFileShortCuts();
/** /**
* 创建论坛登录面板, chart那边不需要 * 创建论坛登录面板, chart那边不需要
* *
* @return 面板组件 * @return 面板组件
* */
*/ public Component createBBSLoginPane() {
public Component createBBSLoginPane(){ return new UILabel();
return new UILabel();
} }
@ -264,9 +263,10 @@ 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() {
@ -298,11 +299,11 @@ public abstract class ToolBarMenuDock {
shortCuts.add(SeparatorDef.DEFAULT); shortCuts.add(SeparatorDef.DEFAULT);
//shortCuts.add(new TutorialAction()); //shortCuts.add(new TutorialAction());
shortCuts.add(SeparatorDef.DEFAULT); shortCuts.add(SeparatorDef.DEFAULT);
if (ComparatorUtils.equals(ProductConstants.APP_NAME,FINEREPORT)) { if (ComparatorUtils.equals(ProductConstants.APP_NAME, FINEREPORT)) {
shortCuts.add(new FeedBackAction()); shortCuts.add(new FeedBackAction());
shortCuts.add(SeparatorDef.DEFAULT); shortCuts.add(SeparatorDef.DEFAULT);
shortCuts.add(SeparatorDef.DEFAULT); shortCuts.add(SeparatorDef.DEFAULT);
// shortCuts.add(new ForumAction()); // shortCuts.add(new ForumAction());
} }
shortCuts.add(SeparatorDef.DEFAULT); shortCuts.add(SeparatorDef.DEFAULT);
shortCuts.add(new AboutAction()); shortCuts.add(new AboutAction());
@ -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,7 +473,8 @@ 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;
} }
@ -479,29 +483,29 @@ public abstract class ToolBarMenuDock {
* *
* @return 子菜单 * @return 子菜单
*/ */
public ShortCut[] shortcut4ExportMenu(){ public ShortCut[] shortcut4ExportMenu() {
return new ShortCut[0]; return new ShortCut[0];
} }
}; };
public NewTemplatePane getNewTemplatePane(){ public NewTemplatePane getNewTemplatePane() {
return new NewTemplatePane() { return new NewTemplatePane() {
@Override @Override
public Icon getNew() { public Icon getNew() {
return BaseUtils.readIcon("/com/fr/design/images/buttonicon/addicon.png"); return BaseUtils.readIcon("/com/fr/design/images/buttonicon/addicon.png");
} }
@Override @Override
public Icon getMouseOverNew() { public Icon getMouseOverNew() {
return BaseUtils.readIcon("/com/fr/design/images/buttonicon/add_press.png"); return BaseUtils.readIcon("/com/fr/design/images/buttonicon/add_press.png");
} }
@Override @Override
public Icon getMousePressNew() { public Icon getMousePressNew() {
return BaseUtils.readIcon("/com/fr/design/images/buttonicon/add_press.png"); return BaseUtils.readIcon("/com/fr/design/images/buttonicon/add_press.png");
} }
}; };
} }
protected void insertMenu(MenuDef menuDef, String anchor) { protected void insertMenu(MenuDef menuDef, String anchor) {
@ -521,7 +525,7 @@ public abstract class ToolBarMenuDock {
for (MenuHandler handler : target) { for (MenuHandler handler : target) {
int insertPosition = handler.insertPosition(menuDef.getShortCutCount()); int insertPosition = handler.insertPosition(menuDef.getShortCutCount());
ShortCut shortCut = action.methodAction(handler); ShortCut shortCut = action.methodAction(handler);
if (shortCut == null){ if (shortCut == null) {
continue; continue;
} }
@ -534,48 +538,47 @@ public abstract class ToolBarMenuDock {
menuDef.insertShortCut(insertPosition, shortCut); menuDef.insertShortCut(insertPosition, shortCut);
if (handler.insertSeparatorBefore()) { if (handler.insertSeparatorBefore()) {
menuDef.insertShortCut(insertPosition, SeparatorDef.DEFAULT); menuDef.insertShortCut(insertPosition, SeparatorDef.DEFAULT);
insertPosition ++; insertPosition++;
} }
if (handler.insertSeparatorAfter()) { if (handler.insertSeparatorAfter()) {
insertPosition ++; insertPosition++;
menuDef.insertShortCut(insertPosition, SeparatorDef.DEFAULT); menuDef.insertShortCut(insertPosition, SeparatorDef.DEFAULT);
} }
} }
} }
} }
/** /**
* 设计器退出时, 做的一些操作. * 设计器退出时, 做的一些操作.
* */
*/ public void shutDown() {
public void shutDown(){
} }
private interface ShortCutMethodAction{ private interface ShortCutMethodAction {
public ShortCut methodAction(MenuHandler handler); public ShortCut methodAction(MenuHandler handler);
} }
private abstract class AbstractShortCutMethodAction implements ShortCutMethodAction{ private abstract class AbstractShortCutMethodAction implements ShortCutMethodAction {
public ShortCut methodAction(MenuHandler handler){ public ShortCut methodAction(MenuHandler handler) {
return handler.shortcut(); return handler.shortcut();
} }
} }
//不需要编辑对象的菜单, 比如文件, 服务器, 关于 //不需要编辑对象的菜单, 比如文件, 服务器, 关于
private class NoTargetAction extends AbstractShortCutMethodAction{ private class NoTargetAction extends AbstractShortCutMethodAction {
} }
//模板为对象的菜单, 比如模板, 后续如果单元格也要, 直接加个CellTargetAction即可. //模板为对象的菜单, 比如模板, 后续如果单元格也要, 直接加个CellTargetAction即可.
//在methodAction中做handler.shortcut(cell), 不需要修改handler中原有接口, 加个shortcut(cell). //在methodAction中做handler.shortcut(cell), 不需要修改handler中原有接口, 加个shortcut(cell).
private class TemplateTargetAction extends AbstractShortCutMethodAction{ private class TemplateTargetAction extends AbstractShortCutMethodAction {
private ToolBarMenuDockPlus plus; private ToolBarMenuDockPlus plus;
public TemplateTargetAction(ToolBarMenuDockPlus plus){ public TemplateTargetAction(ToolBarMenuDockPlus plus) {
this.plus = plus; this.plus = plus;
} }

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