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. 12
      designer_base/src/com/fr/design/DesignerEnvManager.java
  5. 48
      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. 37
      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}/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"){
exclude(name:"*.*")
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.SiteCenter;
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.OperatingSystem;
import com.fr.stable.StableUtils;
@ -236,7 +238,8 @@ public class UserInfoLabel extends UILabel {
@Override
public void mouseClicked(MouseEvent e) {
userName = DesignerEnvManager.getEnvManager().getBBSName();
BBSUserInfo bbsUserInfo = BBSPluginLogin.getInstance().getUserInfo();
userName = bbsUserInfo == null ? "" : bbsUserInfo.getUserName();
if (StringUtils.isNotEmpty(userName)) {
UIPopupMenu menu = new UIPopupMenu();
menu.setOnlyText(true);
@ -262,6 +265,7 @@ public class UserInfoLabel extends UILabel {
UIMenuItem closeOther = new UIMenuItem(Inter.getLocText("FR-Designer-BBSLogin_Switch-Account"));
closeOther.addMouseListener(new MouseAdapter() {
public void mousePressed(MouseEvent e) {
BBSPluginLogin.getInstance().logOut();
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.design.DesignerEnvManager;
import com.fr.design.dialog.BasicPane;
import com.fr.design.extra.LoginWebBridge;
import com.fr.design.mainframe.DesignerContext;
import com.fr.general.DateUtils;
import com.fr.general.FRLogger;
import com.fr.general.Inter;
import com.fr.plugin.manage.bbs.BBSPluginLogin;
import com.fr.plugin.manage.bbs.BBSUserInfo;
import com.fr.stable.StringUtils;
@ -168,6 +169,8 @@ public class UserInfoPane extends BasicPane{
*
*/
public void markSignIn(String userName){
String password = DesignerEnvManager.getEnvManager().getBBSPassword();
BBSPluginLogin.getInstance().login(new BBSUserInfo(userName, password));
this.userInfoLabel.setText(userName);
this.userInfoLabel.setUserName(userName);
this.userInfoLabel.setOpaque(true);

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

@ -3,7 +3,10 @@
*/
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.design.actions.help.alphafine.AlphaFineConfigManager;
import com.fr.design.constants.UIConstants;
@ -18,7 +21,6 @@ import com.fr.stable.xml.*;
import javax.swing.*;
import javax.swing.SwingWorker.StateValue;
import java.awt.*;
import java.io.*;
import java.util.*;
@ -1798,8 +1800,10 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
if (env == null) {
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);

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

@ -1,8 +1,8 @@
package com.fr.design.extra;
import com.fr.base.FRContext;
import com.fr.design.DesignerEnvManager;
import com.fr.design.extra.exe.callback.*;
import com.fr.design.gui.ilable.UILabel;
import com.fr.general.FRLogger;
import com.fr.general.Inter;
import com.fr.general.SiteCenter;
@ -33,15 +33,8 @@ public class PluginOperateUtils {
public static void installPluginOnline(final PluginMarker pluginMarker, JSCallback jsCallback) {
//下载插件
if (!BBSPluginLogin.getInstance().hasLogin()) {
UserLoginContext.fireLoginContextListener();
}
if (BBSPluginLogin.getInstance().hasLogin()) {
PluginTask pluginTask = PluginTask.installTask(pluginMarker);
PluginControllerHelper.installOnline(pluginMarker, new InstallOnlineCallback(pluginTask, jsCallback));
}else{
jsCallback.execute("success");
}
PluginTask pluginTask = PluginTask.installTask(pluginMarker);
PluginControllerHelper.installOnline(pluginMarker, new InstallOnlineCallback(pluginTask, jsCallback));
}
public static void installPluginFromDisk(File zipFile, JSCallback jsCallback) {
@ -50,13 +43,8 @@ public class PluginOperateUtils {
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++) {
updatePluginOnline(pluginMarkerList.get(i), jsCallback);
}
for (int i = 0; i < pluginMarkerList.size(); i++) {
updatePluginOnline(pluginMarkerList.get(i), jsCallback);
}
}
@ -76,8 +64,8 @@ public class PluginOperateUtils {
}
public static void updatePluginFromDisk(final String filePath, JSCallback jsCallback) {
PluginManager.getController().update(new File(filePath), new UpdateFromDiskCallback(new File(filePath), jsCallback));
public static void updatePluginFromDisk(File zipFile, JSCallback jsCallback) {
PluginManager.getController().update(zipFile, new UpdateFromDiskCallback(zipFile, jsCallback));
}
@ -101,7 +89,7 @@ public class PluginOperateUtils {
public void run() {
int rv = JOptionPane.showConfirmDialog(
null,
Inter.getLocText("FR-Designer-Plugin_Delete_Confirmed"),
Inter.getLocText("FR-Plugin_Delete_Confirmed"),
Inter.getLocText("FR-Designer-Plugin_Warning"),
JOptionPane.OK_CANCEL_OPTION,
JOptionPane.INFORMATION_MESSAGE
@ -271,22 +259,16 @@ public class PluginOperateUtils {
}).start();
}
public static void getLoginInfo(JSCallback jsCallback) {
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));
}
}
public static void getLoginInfo(JSCallback jsCallback, UILabel uiLabel) {
BBSUserInfo bbsUserInfo = BBSPluginLogin.getInstance().getUserInfo();
String username = bbsUserInfo == null ? "" : bbsUserInfo.getUserName();
String inShowUsername = DesignerEnvManager.getEnvManager().getInShowBBsName();
if (StringUtils.isEmpty(username) && StringUtils.isEmpty(inShowUsername)) {
return;
if (StringUtils.isEmpty(username)) {
jsCallback.execute("");
uiLabel.setText(Inter.getLocText("FR-Base_UnSignIn"));
} else {
String result = StringUtils.isEmpty(inShowUsername) ? username : inShowUsername;
uiLabel.setText(username);
String result = username;
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.PluginMarker;
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.StringUtils;
import javafx.scene.web.WebEngine;
@ -196,7 +198,8 @@ public class PluginWebBridge {
*/
public void updatePluginFromDisk(String filePath, final JSObject 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
*/
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);
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() {
if (StableUtils.getMajorJavaVersion() >= VERSION_8) {
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);
if (!file.exists()) {
int rv = JOptionPane.showConfirmDialog(
@ -54,7 +54,7 @@ public class WebViewDlgHelper {
}
} else {
String indexPath = "index.html";
String mainIndexPath = StableUtils.pathJoin(FRContext.getCurrentEnv().getWebReportPath(), indexPath);
String mainIndexPath = StableUtils.pathJoin(installHome, indexPath);
checkAndCopyMainFile(mainIndexPath, mainJsPath);
updateShopScripts(SHOP_SCRIPTS);
showPluginDlg(mainIndexPath);
@ -144,7 +144,7 @@ public class WebViewDlgHelper {
}
private static void showLoginDlg() {
LoginWebPane webPane = new LoginWebPane(FRContext.getCurrentEnv().getWebReportPath());
LoginWebPane webPane = new LoginWebPane(installHome);
UIDialog qqdlg = new LoginDialog(DesignerContext.getDesignerFrame(), webPane);
LoginWebBridge.getHelper().setDialogHandle(qqdlg);
qqdlg.setVisible(true);
@ -186,7 +186,7 @@ public class WebViewDlgHelper {
try {
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
int rv = JOptionPane.showOptionDialog(
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) {
return;
}
PluginOperateUtils.updatePluginOnline(pluginMarker, jsCallback);
PluginOperateUtils.updatePluginFromDisk(zipFile, jsCallback);
}else {
jsCallback.execute("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.file.XMLFileManager;
import com.fr.general.FRLogger;
import com.fr.general.GeneralUtils;
import com.fr.stable.StringUtils;
import com.fr.stable.xml.XMLPrintWriter;
import com.fr.stable.xml.XMLReadable;
@ -140,7 +139,7 @@ public class MenuManager extends XMLFileManager {
return;
}
try {
MenuAction action = (MenuAction) GeneralUtils.classForName(name).newInstance();
MenuAction action = (MenuAction) reader.getAttrAsClass().newInstance();
menu.addShortCut(action);
} catch (Exception 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 {
HashMap<String, String> para = new HashMap<String, String>();
para.put("op", "plugin");
para.put("cmd", "get_states");
para.put("cmd", "get_status");
para.put("current_uid", this.createUserID());
para.put("currentUsername", this.getUser());

37
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.WidgetValue;
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 javax.swing.*;
@ -27,12 +33,31 @@ import java.awt.event.MouseEvent;
import java.awt.geom.RoundRectangle2D;
public class ToolTipEditor extends JWindow {
private static ToolTipEditor editor = new ToolTipEditor();
public static ToolTipEditor getInstance() {
return editor;
}
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() {
return editor;
}
private XEditorHolder holder;
private Border buttonBorder = new UIRoundedBorder(new Color(149, 149, 149), 1, 5);

Loading…
Cancel
Save