XiaXiang 7 years ago
parent
commit
b097c6033d
  1. 2
      build.9.0.gradle
  2. 6
      designer/src/com/fr/design/mainframe/bbs/UserInfoLabel.java
  3. 5
      designer/src/com/fr/design/mainframe/bbs/UserInfoPane.java
  4. 10
      designer_base/src/com/fr/design/DesignerEnvManager.java
  5. 40
      designer_base/src/com/fr/design/extra/PluginOperateUtils.java
  6. 20
      designer_base/src/com/fr/design/extra/PluginWebBridge.java
  7. 8
      designer_base/src/com/fr/design/extra/WebViewDlgHelper.java
  8. 2
      designer_base/src/com/fr/design/extra/exe/callback/InstallFromDiskCallback.java
  9. 3
      designer_base/src/com/fr/design/menu/MenuManager.java
  10. 2
      designer_base/src/com/fr/env/RemoteEnv.java
  11. 27
      designer_form/src/com/fr/design/gui/xpane/ToolTipEditor.java

2
build.9.0.gradle

@ -18,7 +18,7 @@ task appletJar<<{
} }
unjar(src:"${libDir}/3rd.jar",dest:"./tmp") unjar(src:"${libDir}/3rd.jar",dest:"./tmp")
unjar(src:"${libDir}/servlet-api.jar",dest:"./tmp") unjar(src:"${libDir}/servlet-api.jar",dest:"./tmp")
jar(jarfile:"build/libs/fr-applet-8.0.jar"){ jar(jarfile:"build/libs/fr-applet-9.0.jar"){
fileset(dir:"build/classes"){ fileset(dir:"build/classes"){
exclude(name:"*.*") exclude(name:"*.*")
exclude(name:"bin/*.*") exclude(name:"bin/*.*")

6
designer/src/com/fr/design/mainframe/bbs/UserInfoLabel.java

@ -16,6 +16,8 @@ import com.fr.general.DateUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.general.SiteCenter; import com.fr.general.SiteCenter;
import com.fr.general.http.HttpClient; import com.fr.general.http.HttpClient;
import com.fr.plugin.manage.bbs.BBSPluginLogin;
import com.fr.plugin.manage.bbs.BBSUserInfo;
import com.fr.stable.EncodeConstants; import com.fr.stable.EncodeConstants;
import com.fr.stable.OperatingSystem; import com.fr.stable.OperatingSystem;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
@ -236,7 +238,8 @@ public class UserInfoLabel extends UILabel {
@Override @Override
public void mouseClicked(MouseEvent e) { public void mouseClicked(MouseEvent e) {
userName = DesignerEnvManager.getEnvManager().getBBSName(); BBSUserInfo bbsUserInfo = BBSPluginLogin.getInstance().getUserInfo();
userName = bbsUserInfo == null ? "" : bbsUserInfo.getUserName();
if (StringUtils.isNotEmpty(userName)) { if (StringUtils.isNotEmpty(userName)) {
UIPopupMenu menu = new UIPopupMenu(); UIPopupMenu menu = new UIPopupMenu();
menu.setOnlyText(true); menu.setOnlyText(true);
@ -262,6 +265,7 @@ public class UserInfoLabel extends UILabel {
UIMenuItem closeOther = new UIMenuItem(Inter.getLocText("FR-Designer-BBSLogin_Switch-Account")); UIMenuItem closeOther = new UIMenuItem(Inter.getLocText("FR-Designer-BBSLogin_Switch-Account"));
closeOther.addMouseListener(new MouseAdapter() { closeOther.addMouseListener(new MouseAdapter() {
public void mousePressed(MouseEvent e) { public void mousePressed(MouseEvent e) {
BBSPluginLogin.getInstance().logOut();
UserLoginContext.fireLoginContextListener(); UserLoginContext.fireLoginContextListener();
} }

5
designer/src/com/fr/design/mainframe/bbs/UserInfoPane.java

@ -14,11 +14,12 @@ import java.util.Date;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.extra.LoginWebBridge;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.general.DateUtils; import com.fr.general.DateUtils;
import com.fr.general.FRLogger; import com.fr.general.FRLogger;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.plugin.manage.bbs.BBSPluginLogin;
import com.fr.plugin.manage.bbs.BBSUserInfo;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
@ -168,6 +169,8 @@ public class UserInfoPane extends BasicPane{
* *
*/ */
public void markSignIn(String userName){ public void markSignIn(String userName){
String password = DesignerEnvManager.getEnvManager().getBBSPassword();
BBSPluginLogin.getInstance().login(new BBSUserInfo(userName, password));
this.userInfoLabel.setText(userName); this.userInfoLabel.setText(userName);
this.userInfoLabel.setUserName(userName); this.userInfoLabel.setUserName(userName);
this.userInfoLabel.setOpaque(true); this.userInfoLabel.setOpaque(true);

10
designer_base/src/com/fr/design/DesignerEnvManager.java

@ -3,7 +3,10 @@
*/ */
package com.fr.design; package com.fr.design;
import com.fr.base.*; import com.fr.base.BaseXMLUtils;
import com.fr.base.Env;
import com.fr.base.FRContext;
import com.fr.base.Utils;
import com.fr.dav.LocalEnv; import com.fr.dav.LocalEnv;
import com.fr.design.actions.help.alphafine.AlphaFineConfigManager; import com.fr.design.actions.help.alphafine.AlphaFineConfigManager;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
@ -18,7 +21,6 @@ import com.fr.stable.xml.*;
import javax.swing.*; import javax.swing.*;
import javax.swing.SwingWorker.StateValue; import javax.swing.SwingWorker.StateValue;
import java.awt.*; import java.awt.*;
import java.io.*; import java.io.*;
import java.util.*; import java.util.*;
@ -1799,7 +1801,9 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
return; return;
} }
writer.startTAG("Env").attr("class", env.getClass().getName()).attr("name", name); writer.startTAG("Env");
writer.classAttr(env.getClass());
writer.attr("name", name);
env.writeXML(writer); env.writeXML(writer);

40
designer_base/src/com/fr/design/extra/PluginOperateUtils.java

@ -1,8 +1,8 @@
package com.fr.design.extra; package com.fr.design.extra;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.design.DesignerEnvManager;
import com.fr.design.extra.exe.callback.*; import com.fr.design.extra.exe.callback.*;
import com.fr.design.gui.ilable.UILabel;
import com.fr.general.FRLogger; import com.fr.general.FRLogger;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.general.SiteCenter; import com.fr.general.SiteCenter;
@ -33,15 +33,8 @@ public class PluginOperateUtils {
public static void installPluginOnline(final PluginMarker pluginMarker, JSCallback jsCallback) { public static void installPluginOnline(final PluginMarker pluginMarker, JSCallback jsCallback) {
//下载插件 //下载插件
if (!BBSPluginLogin.getInstance().hasLogin()) {
UserLoginContext.fireLoginContextListener();
}
if (BBSPluginLogin.getInstance().hasLogin()) {
PluginTask pluginTask = PluginTask.installTask(pluginMarker); PluginTask pluginTask = PluginTask.installTask(pluginMarker);
PluginControllerHelper.installOnline(pluginMarker, new InstallOnlineCallback(pluginTask, jsCallback)); PluginControllerHelper.installOnline(pluginMarker, new InstallOnlineCallback(pluginTask, jsCallback));
}else{
jsCallback.execute("success");
}
} }
public static void installPluginFromDisk(File zipFile, JSCallback jsCallback) { public static void installPluginFromDisk(File zipFile, JSCallback jsCallback) {
@ -50,15 +43,10 @@ public class PluginOperateUtils {
public static void updatePluginOnline(List<PluginMarker> pluginMarkerList, JSCallback jsCallback) { public static void updatePluginOnline(List<PluginMarker> pluginMarkerList, JSCallback jsCallback) {
if (!(BBSPluginLogin.getInstance().hasLogin())) {
LoginCheckContext.fireLoginCheckListener();
}
if (BBSPluginLogin.getInstance().hasLogin()) {
for (int i = 0; i < pluginMarkerList.size(); i++) { for (int i = 0; i < pluginMarkerList.size(); i++) {
updatePluginOnline(pluginMarkerList.get(i), jsCallback); updatePluginOnline(pluginMarkerList.get(i), jsCallback);
} }
} }
}
public static void updatePluginOnline(PluginMarker pluginMarker, JSCallback jsCallback) { public static void updatePluginOnline(PluginMarker pluginMarker, JSCallback jsCallback) {
try { try {
@ -76,8 +64,8 @@ public class PluginOperateUtils {
} }
public static void updatePluginFromDisk(final String filePath, JSCallback jsCallback) { public static void updatePluginFromDisk(File zipFile, JSCallback jsCallback) {
PluginManager.getController().update(new File(filePath), new UpdateFromDiskCallback(new File(filePath), jsCallback)); PluginManager.getController().update(zipFile, new UpdateFromDiskCallback(zipFile, jsCallback));
} }
@ -101,7 +89,7 @@ public class PluginOperateUtils {
public void run() { public void run() {
int rv = JOptionPane.showConfirmDialog( int rv = JOptionPane.showConfirmDialog(
null, null,
Inter.getLocText("FR-Designer-Plugin_Delete_Confirmed"), Inter.getLocText("FR-Plugin_Delete_Confirmed"),
Inter.getLocText("FR-Designer-Plugin_Warning"), Inter.getLocText("FR-Designer-Plugin_Warning"),
JOptionPane.OK_CANCEL_OPTION, JOptionPane.OK_CANCEL_OPTION,
JOptionPane.INFORMATION_MESSAGE JOptionPane.INFORMATION_MESSAGE
@ -271,22 +259,16 @@ public class PluginOperateUtils {
}).start(); }).start();
} }
public static void getLoginInfo(JSCallback jsCallback) { public static void getLoginInfo(JSCallback jsCallback, UILabel uiLabel) {
if (!BBSPluginLogin.getInstance().hasLogin()) {
String userName = DesignerEnvManager.getEnvManager().getBBSName();
String password = DesignerEnvManager.getEnvManager().getBBSPassword();
if (StringUtils.isNotBlank(userName)) {
BBSPluginLogin.getInstance().login(new BBSUserInfo(userName, password));
}
}
BBSUserInfo bbsUserInfo = BBSPluginLogin.getInstance().getUserInfo(); BBSUserInfo bbsUserInfo = BBSPluginLogin.getInstance().getUserInfo();
String username = bbsUserInfo == null ? "" : bbsUserInfo.getUserName(); String username = bbsUserInfo == null ? "" : bbsUserInfo.getUserName();
String inShowUsername = DesignerEnvManager.getEnvManager().getInShowBBsName();
if (StringUtils.isEmpty(username) && StringUtils.isEmpty(inShowUsername)) { if (StringUtils.isEmpty(username)) {
return; jsCallback.execute("");
uiLabel.setText(Inter.getLocText("FR-Base_UnSignIn"));
} else { } else {
String result = StringUtils.isEmpty(inShowUsername) ? username : inShowUsername; uiLabel.setText(username);
String result = username;
jsCallback.execute(result); jsCallback.execute(result);
} }
} }

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

@ -12,6 +12,8 @@ import com.fr.general.SiteCenter;
import com.fr.plugin.context.PluginContext; import com.fr.plugin.context.PluginContext;
import com.fr.plugin.context.PluginMarker; import com.fr.plugin.context.PluginMarker;
import com.fr.plugin.manage.PluginManager; import com.fr.plugin.manage.PluginManager;
import com.fr.plugin.manage.bbs.BBSPluginLogin;
import com.fr.plugin.manage.bbs.BBSUserInfo;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javafx.scene.web.WebEngine; import javafx.scene.web.WebEngine;
@ -196,7 +198,8 @@ public class PluginWebBridge {
*/ */
public void updatePluginFromDisk(String filePath, final JSObject callback) { public void updatePluginFromDisk(String filePath, final JSObject callback) {
JSCallback jsCallback = new JSCallback(webEngine, callback); JSCallback jsCallback = new JSCallback(webEngine, callback);
PluginOperateUtils.updatePluginFromDisk(filePath, jsCallback); File file = new File(filePath);
PluginOperateUtils.updatePluginFromDisk(file, jsCallback);
} }
/** /**
@ -377,9 +380,20 @@ public class PluginWebBridge {
* *
* @param callback * @param callback
*/ */
public void getLoginInfo(final JSObject callback) { public String getLoginInfo(final JSObject callback) {
registerLoginInfo(callback);
BBSUserInfo bbsUserInfo = BBSPluginLogin.getInstance().getUserInfo();
return bbsUserInfo == null ? "": bbsUserInfo.getUserName();
}
/**
* 系统登录注册
*
* @param callback
*/
public void registerLoginInfo(final JSObject callback) {
JSCallback jsCallback = new JSCallback(webEngine, callback); JSCallback jsCallback = new JSCallback(webEngine, callback);
PluginOperateUtils.getLoginInfo(jsCallback); PluginOperateUtils.getLoginInfo(jsCallback, uiLabel);
} }
/** /**

8
designer_base/src/com/fr/design/extra/WebViewDlgHelper.java

@ -39,7 +39,7 @@ public class WebViewDlgHelper {
public static void createPluginDialog() { public static void createPluginDialog() {
if (StableUtils.getMajorJavaVersion() >= VERSION_8) { if (StableUtils.getMajorJavaVersion() >= VERSION_8) {
String relativePath = "/scripts/store/web/index.html"; String relativePath = "/scripts/store/web/index.html";
String mainJsPath = StableUtils.pathJoin(FRContext.getCurrentEnv().getWebReportPath(), relativePath); String mainJsPath = StableUtils.pathJoin(installHome, relativePath);
File file = new File(mainJsPath); File file = new File(mainJsPath);
if (!file.exists()) { if (!file.exists()) {
int rv = JOptionPane.showConfirmDialog( int rv = JOptionPane.showConfirmDialog(
@ -54,7 +54,7 @@ public class WebViewDlgHelper {
} }
} else { } else {
String indexPath = "index.html"; String indexPath = "index.html";
String mainIndexPath = StableUtils.pathJoin(FRContext.getCurrentEnv().getWebReportPath(), indexPath); String mainIndexPath = StableUtils.pathJoin(installHome, indexPath);
checkAndCopyMainFile(mainIndexPath, mainJsPath); checkAndCopyMainFile(mainIndexPath, mainJsPath);
updateShopScripts(SHOP_SCRIPTS); updateShopScripts(SHOP_SCRIPTS);
showPluginDlg(mainIndexPath); showPluginDlg(mainIndexPath);
@ -144,7 +144,7 @@ public class WebViewDlgHelper {
} }
private static void showLoginDlg() { private static void showLoginDlg() {
LoginWebPane webPane = new LoginWebPane(FRContext.getCurrentEnv().getWebReportPath()); LoginWebPane webPane = new LoginWebPane(installHome);
UIDialog qqdlg = new LoginDialog(DesignerContext.getDesignerFrame(), webPane); UIDialog qqdlg = new LoginDialog(DesignerContext.getDesignerFrame(), webPane);
LoginWebBridge.getHelper().setDialogHandle(qqdlg); LoginWebBridge.getHelper().setDialogHandle(qqdlg);
qqdlg.setVisible(true); qqdlg.setVisible(true);
@ -186,7 +186,7 @@ public class WebViewDlgHelper {
try { try {
if (get()) { if (get()) {
IOUtils.unzip(new File(StableUtils.pathJoin(PluginConstants.DOWNLOAD_PATH, PluginConstants.TEMP_FILE)), FRContext.getCurrentEnv().getWebReportPath()); IOUtils.unzip(new File(StableUtils.pathJoin(PluginConstants.DOWNLOAD_PATH, PluginConstants.TEMP_FILE)), installHome);
// TODO: 2017/4/17 删除之前存放在安装目录下的script // TODO: 2017/4/17 删除之前存放在安装目录下的script
int rv = JOptionPane.showOptionDialog( int rv = JOptionPane.showOptionDialog(
null, null,

2
designer_base/src/com/fr/design/extra/exe/callback/InstallFromDiskCallback.java

@ -73,7 +73,7 @@ public class InstallFromDiskCallback extends AbstractPluginTaskCallback {
if (rv == JOptionPane.CANCEL_OPTION || rv == JOptionPane.CLOSED_OPTION) { if (rv == JOptionPane.CANCEL_OPTION || rv == JOptionPane.CLOSED_OPTION) {
return; return;
} }
PluginOperateUtils.updatePluginOnline(pluginMarker, jsCallback); PluginOperateUtils.updatePluginFromDisk(zipFile, jsCallback);
}else { }else {
jsCallback.execute("failed"); jsCallback.execute("failed");
FRLogger.getLogger().info(Inter.getLocText("FR-Plugin_Install_Failed")); FRLogger.getLogger().info(Inter.getLocText("FR-Plugin_Install_Failed"));

3
designer_base/src/com/fr/design/menu/MenuManager.java

@ -4,7 +4,6 @@ import com.fr.design.DesignState;
import com.fr.design.actions.MenuAction; import com.fr.design.actions.MenuAction;
import com.fr.file.XMLFileManager; import com.fr.file.XMLFileManager;
import com.fr.general.FRLogger; import com.fr.general.FRLogger;
import com.fr.general.GeneralUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.xml.XMLPrintWriter; import com.fr.stable.xml.XMLPrintWriter;
import com.fr.stable.xml.XMLReadable; import com.fr.stable.xml.XMLReadable;
@ -140,7 +139,7 @@ public class MenuManager extends XMLFileManager {
return; return;
} }
try { try {
MenuAction action = (MenuAction) GeneralUtils.classForName(name).newInstance(); MenuAction action = (MenuAction) reader.getAttrAsClass().newInstance();
menu.addShortCut(action); menu.addShortCut(action);
} catch (Exception exp) { } catch (Exception exp) {
FRLogger.getLogger().error(exp.getMessage(), exp); FRLogger.getLogger().error(exp.getMessage(), exp);

2
designer_base/src/com/fr/env/RemoteEnv.java vendored

@ -2181,7 +2181,7 @@ public class RemoteEnv extends AbstractEnv {
try { try {
HashMap<String, String> para = new HashMap<String, String>(); HashMap<String, String> para = new HashMap<String, String>();
para.put("op", "plugin"); para.put("op", "plugin");
para.put("cmd", "get_states"); para.put("cmd", "get_status");
para.put("current_uid", this.createUserID()); para.put("current_uid", this.createUserID());
para.put("currentUsername", this.getUser()); para.put("currentUsername", this.getUser());

27
designer_form/src/com/fr/design/gui/xpane/ToolTipEditor.java

@ -17,6 +17,12 @@ import com.fr.form.ui.EditorHolder;
import com.fr.form.ui.Widget; import com.fr.form.ui.Widget;
import com.fr.form.ui.WidgetValue; import com.fr.form.ui.WidgetValue;
import com.fr.general.Background; import com.fr.general.Background;
import com.fr.general.GeneralContext;
import com.fr.plugin.context.PluginContext;
import com.fr.plugin.injectable.PluginModule;
import com.fr.plugin.manage.PluginFilter;
import com.fr.plugin.observer.PluginEvent;
import com.fr.plugin.observer.PluginEventListener;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import javax.swing.*; import javax.swing.*;
@ -28,9 +34,28 @@ import java.awt.geom.RoundRectangle2D;
public class ToolTipEditor extends JWindow { public class ToolTipEditor extends JWindow {
private static ToolTipEditor editor = new ToolTipEditor(); private static volatile ToolTipEditor editor = new ToolTipEditor();
static {
GeneralContext.listenPluginRunningChanged(new PluginEventListener() {
@Override
public void on(PluginEvent event) {
editor = new ToolTipEditor();
}
}, new PluginFilter() {
@Override
public boolean accept(PluginContext context) {
return context.contain(PluginModule.ExtraDesign);
}
});
}
public static ToolTipEditor getInstance() { public static ToolTipEditor getInstance() {
return editor; return editor;
} }

Loading…
Cancel
Save