Browse Source

Merge remote-tracking branch 'origin/9.0' into write

master
loy 7 years ago
parent
commit
804c0a03a5
  1. 2
      build.9.0.gradle
  2. 7
      designer/src/com/fr/design/mainframe/alphafine/cell/model/AlphaCellModel.java
  3. 9
      designer/src/com/fr/design/mainframe/alphafine/cell/model/MoreModel.java
  4. 8
      designer/src/com/fr/design/mainframe/alphafine/cell/render/TitleCellRender.java
  5. 40
      designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java
  6. BIN
      designer/src/com/fr/design/mainframe/alphafine/images/loading.gif
  7. 5
      designer/src/com/fr/design/mainframe/alphafine/search/manager/ActionSearchManager.java
  8. 7
      designer/src/com/fr/design/mainframe/alphafine/search/manager/DocumentSearchManager.java
  9. 5
      designer/src/com/fr/design/mainframe/alphafine/search/manager/FileSearchManager.java
  10. 7
      designer/src/com/fr/design/mainframe/alphafine/search/manager/PluginSearchManager.java
  11. 4
      designer/src/com/fr/design/mainframe/alphafine/search/manager/RecentSearchManager.java
  12. 2
      designer/src/com/fr/design/mainframe/alphafine/search/manager/RecommendSearchManager.java
  13. 6
      designer/src/com/fr/design/mainframe/bbs/UserInfoLabel.java
  14. 5
      designer/src/com/fr/design/mainframe/bbs/UserInfoPane.java
  15. 2
      designer_base/src/com/fr/design/actions/help/alphafine/AlphaFineConfigManager.java
  16. 40
      designer_base/src/com/fr/design/extra/PluginOperateUtils.java
  17. 20
      designer_base/src/com/fr/design/extra/PluginWebBridge.java
  18. 8
      designer_base/src/com/fr/design/extra/WebViewDlgHelper.java
  19. 2
      designer_base/src/com/fr/design/extra/exe/callback/InstallFromDiskCallback.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/*.*")

7
designer/src/com/fr/design/mainframe/alphafine/cell/model/AlphaCellModel.java

@ -109,4 +109,11 @@ public abstract class AlphaCellModel implements Comparable {
}
return this.getName().compareTo(cellModel.getName());
}
/**
* 恢复正常状态
*/
public void resetState() {
}
}

9
designer/src/com/fr/design/mainframe/alphafine/cell/model/MoreModel.java

@ -16,11 +16,11 @@ public class MoreModel extends AlphaCellModel {
super(name, content, CellType.MORE);
this.needMore = needMore;
this.contentType = type;
setLoading(true);
}
public MoreModel(String name) {
super(name, null, CellType.MORE);
this.needMore = false;
this(name, true);
}
public MoreModel(String name, boolean isLoading) {
@ -51,6 +51,11 @@ public class MoreModel extends AlphaCellModel {
}
@Override
public void resetState() {
setLoading(false);
}
public boolean isLoading() {
return isLoading;
}

8
designer/src/com/fr/design/mainframe/alphafine/cell/render/TitleCellRender.java

@ -12,6 +12,7 @@ import java.awt.*;
* Created by XiaXiang on 2017/4/20.
*/
public class TitleCellRender implements ListCellRenderer<Object> {
private static final int LOAD_OFFSET = 28;
@Override
public Component getListCellRendererComponent(JList<?> list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
@ -23,9 +24,9 @@ public class TitleCellRender implements ListCellRenderer<Object> {
panel.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 0));
titleLabel.setText(moreModel.getName());
titleLabel.setFont(AlphaFineConstants.SMALL_FONT);
titleLabel.setForeground(AlphaFineConstants.DARK_GRAY);
showMoreLabel.setFont(AlphaFineConstants.SMALL_FONT);
showMoreLabel.setText(moreModel.getContent());
titleLabel.setForeground(AlphaFineConstants.DARK_GRAY);
showMoreLabel.setForeground(AlphaFineConstants.DARK_GRAY);
panel.add(titleLabel, BorderLayout.WEST);
if (moreModel.isNeedMore()) {
@ -33,11 +34,12 @@ public class TitleCellRender implements ListCellRenderer<Object> {
panel.add(showMoreLabel, BorderLayout.EAST);
}
if (moreModel.isLoading()) {
ImageIcon imageIcon = (ImageIcon) IOUtils.readIcon("/com/fr/design/mainframe/alphafine/images/loading.gif");
ImageIcon imageIcon = new ImageIcon(getClass().getResource("/com/fr/design/mainframe/alphafine/images/loading.gif"));
//设置cell的加载动画
imageIcon.setImageObserver(list);
UILabel loadingLabel = new UILabel(imageIcon);
panel.add(loadingLabel, BorderLayout.SOUTH);
loadingLabel.setBorder(BorderFactory.createEmptyBorder(LOAD_OFFSET,0,0,0));
panel.add(loadingLabel, 0);
}
panel.setPreferredSize(new Dimension(list.getFixedCellWidth(), AlphaFineConstants.CELL_TITLE_HEIGHT));
return panel;

40
designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java

@ -14,7 +14,6 @@ import com.fr.design.mainframe.alphafine.cell.model.FileModel;
import com.fr.design.mainframe.alphafine.cell.model.MoreModel;
import com.fr.design.mainframe.alphafine.cell.model.PluginModel;
import com.fr.design.mainframe.alphafine.cell.render.ContentCellRender;
import com.fr.design.mainframe.alphafine.listener.ComponentHandler;
import com.fr.design.mainframe.alphafine.listener.DocumentAdapter;
import com.fr.design.mainframe.alphafine.model.SearchResult;
import com.fr.design.mainframe.alphafine.preview.ActionPreviewPane;
@ -144,21 +143,18 @@ public class AlphaFineDialog extends UIDialog {
super.paintComponent(g);
}
};
closeButton.setContentAreaFilled(false);
closeButton.setPreferredSize(AlphaFineConstants.CLOSE_BUTTON_SIZE);
closeButton.setIcon(new ImageIcon(getClass().getResource("/com/fr/design/mainframe/alphafine/images/alphafine_close.png")));
closeButton.set4ToolbarButton();
closeButton.setBorderPainted(false);
closeButton.setRolloverEnabled(false);
closeButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
dispose();
}
});
UILabel borderLabel = new UILabel();
borderLabel.setBackground(AlphaFineConstants.GRAY);
borderLabel.setPreferredSize(new Dimension(AlphaFineConstants.HEIGHT, 1));
topPane.add(closeButton, BorderLayout.EAST);
topPane.add(borderLabel, BorderLayout.SOUTH);
add(topPane, BorderLayout.CENTER);
searchTextField.getDocument().addDocumentListener(new DocumentAdapter() {
@Override
@ -184,7 +180,7 @@ public class AlphaFineDialog extends UIDialog {
*/
private void initProperties() {
setUndecorated(true);
addComponentListener(new ComponentHandler());
//addComponentListener(new ComponentHandler());
setSize(AlphaFineConstants.FIELD_SIZE);
centerWindow(this);
@ -306,6 +302,10 @@ public class AlphaFineDialog extends UIDialog {
searchResultPane.add(leftSearchResultPane, BorderLayout.WEST);
rightSearchResultPane.setPreferredSize(new Dimension(AlphaFineConstants.RIGHT_WIDTH, AlphaFineConstants.CONTENT_HEIGHT));
searchResultPane.add(rightSearchResultPane, BorderLayout.EAST);
UILabel splitLabel = new UILabel();
splitLabel.setBackground(AlphaFineConstants.GRAY);
splitLabel.setPreferredSize(new Dimension(AlphaFineConstants.HEIGHT, 1));
searchResultPane.add(splitLabel, BorderLayout.NORTH);
add(searchResultPane, BorderLayout.SOUTH);
setSize(AlphaFineConstants.FULL_SIZE);
}
@ -324,10 +324,24 @@ public class AlphaFineDialog extends UIDialog {
rebuildList(searchTextField.getText().toLowerCase());
return null;
}
@Override
protected void done() {
if (!isCancelled()) {
fireStopLoading();
}
}
};
this.searchWorker.execute();
}
/**
* 停止加载状态
*/
private void fireStopLoading() {
searchListModel.resetState();
}
/**
* 重新构建搜索结果列表
* 先根据输入判断是不是隐藏的搜索功能
@ -370,8 +384,8 @@ public class AlphaFineDialog extends UIDialog {
searchListModel.removeAllElements();
searchListModel.resetSelectedState();
rightSearchResultPane.removeAll();
rightSearchResultPane.validate();
rightSearchResultPane.repaint();
validate();
repaint();
}
/**
@ -978,7 +992,7 @@ public class AlphaFineDialog extends UIDialog {
public AlphaCellModel remove(int index) {
AlphaCellModel object = myDelegate.get(index);
myDelegate.remove(object);
fireIntervalRemoved(this, index, index);
fireContentsChanged(this, index, index);
return object;
}
@ -1006,6 +1020,12 @@ public class AlphaFineDialog extends UIDialog {
private void setValidSelected(boolean selected) {
isValidSelected = selected;
}
public void resetState() {
for (int i = 0; i< getSize(); i++) {
getElementAt(i).resetState();
}
}
}
}

BIN
designer/src/com/fr/design/mainframe/alphafine/images/loading.gif

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 10 KiB

5
designer/src/com/fr/design/mainframe/alphafine/search/manager/ActionSearchManager.java

@ -21,7 +21,6 @@ import java.util.List;
* Created by XiaXiang on 2017/3/27.
*/
public class ActionSearchManager implements AlphaFineSearchProcessor {
private static final MoreModel TITLE_MODEL = new MoreModel(Inter.getLocText("FR-Designer_Set"));
private static ActionSearchManager actionSearchManager = null;
private SearchResult filterModelList;
private SearchResult lessModelList;
@ -58,7 +57,7 @@ public class ActionSearchManager implements AlphaFineSearchProcessor {
lessModelList = new SearchResult();
moreModelList = new SearchResult();
if (StringUtils.isBlank(searchText)) {
lessModelList.add(TITLE_MODEL);
lessModelList.add(new MoreModel(Inter.getLocText("FR-Designer_Set")));
return lessModelList;
}
if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isContainAction()) {
@ -78,7 +77,7 @@ public class ActionSearchManager implements AlphaFineSearchProcessor {
}
if (result.size() < AlphaFineConstants.SHOW_SIZE + 1) {
lessModelList.add(0, TITLE_MODEL);
lessModelList.add(0, new MoreModel(Inter.getLocText("FR-Designer_Set")));
if (result.size() == 0) {
lessModelList.add(AlphaFineHelper.NO_RESULT_MODEL);
} else {

7
designer/src/com/fr/design/mainframe/alphafine/search/manager/DocumentSearchManager.java

@ -19,7 +19,6 @@ import com.fr.stable.StringUtils;
* Created by XiaXiang on 2017/3/27.
*/
public class DocumentSearchManager implements AlphaFineSearchProcessor {
private static final MoreModel TITLE_MODEL = new MoreModel(Inter.getLocText("FR-Designer_COMMUNITY_HELP"));
private static DocumentSearchManager documentSearchManager = null;
private SearchResult lessModelList;
private SearchResult moreModelList;
@ -51,7 +50,7 @@ public class DocumentSearchManager implements AlphaFineSearchProcessor {
lessModelList = new SearchResult();
moreModelList = new SearchResult();
if (StringUtils.isBlank(searchText)) {
lessModelList.add(TITLE_MODEL);
lessModelList.add(new MoreModel(Inter.getLocText("FR-Designer_COMMUNITY_HELP")));
return lessModelList;
}
if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isContainDocument()) {
@ -78,7 +77,7 @@ public class DocumentSearchManager implements AlphaFineSearchProcessor {
}
}
if (searchResult.size() < AlphaFineConstants.SHOW_SIZE + 1) {
lessModelList.add(0, TITLE_MODEL);
lessModelList.add(0, new MoreModel(Inter.getLocText("FR-Designer_COMMUNITY_HELP")));
if (searchResult.size() == 0) {
lessModelList.add(AlphaFineHelper.NO_RESULT_MODEL);
} else {
@ -105,7 +104,7 @@ public class DocumentSearchManager implements AlphaFineSearchProcessor {
*/
private SearchResult getNoConnectList() {
SearchResult result = new SearchResult();
result.add(0, TITLE_MODEL);
result.add(0, new MoreModel(Inter.getLocText("FR-Designer_COMMUNITY_HELP")));
result.add(AlphaFineHelper.NO_CONNECTION_MODEL);
return result;
}

5
designer/src/com/fr/design/mainframe/alphafine/search/manager/FileSearchManager.java

@ -31,7 +31,6 @@ public class FileSearchManager implements AlphaFineSearchProcessor {
private static final String DS_NAME = "dsname=\"";
private static final String FRM_PREFIX = "k:frm ";
private static final String CPT_PREFIX = "k:cpt ";
private static final MoreModel TITLE_MODEL = new MoreModel(Inter.getLocText("FR-Designer_Templates"));
private static FileSearchManager fileSearchManager = null;
private SearchResult filterModelList;
private SearchResult lessModelList;
@ -77,7 +76,7 @@ public class FileSearchManager implements AlphaFineSearchProcessor {
searchText = searchText.substring(MARK_LENGTH, searchText.length());
}
if (StringUtils.isBlank(searchText) || ComparatorUtils.equals(searchText, DS_NAME)) {
lessModelList.add(TITLE_MODEL);
lessModelList.add(new MoreModel(Inter.getLocText("FR-Designer_Templates")));
return lessModelList;
}
@ -102,7 +101,7 @@ public class FileSearchManager implements AlphaFineSearchProcessor {
}
if (result.size() < AlphaFineConstants.SHOW_SIZE + 1) {
lessModelList.add(0, TITLE_MODEL);
lessModelList.add(0, new MoreModel(Inter.getLocText("FR-Designer_Templates")));
if (result.size() == 0) {
lessModelList.add(AlphaFineHelper.NO_RESULT_MODEL);
} else {

7
designer/src/com/fr/design/mainframe/alphafine/search/manager/PluginSearchManager.java

@ -23,7 +23,6 @@ import java.net.URLEncoder;
* Created by XiaXiang on 2017/3/27.
*/
public class PluginSearchManager implements AlphaFineSearchProcessor {
private static final MoreModel TITLE_MODEL = new MoreModel(Inter.getLocText("FR-Designer-Plugin_Addon"));
private static PluginSearchManager pluginSearchManager = null;
private SearchResult lessModelList;
private SearchResult moreModelList;
@ -84,7 +83,7 @@ public class PluginSearchManager implements AlphaFineSearchProcessor {
this.lessModelList = new SearchResult();
this.moreModelList = new SearchResult();
if (StringUtils.isBlank(searchText)) {
lessModelList.add(TITLE_MODEL);
lessModelList.add(new MoreModel(Inter.getLocText("FR-Designer-Plugin_Addon")));
return lessModelList;
}
if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isContainPlugin()) {
@ -111,7 +110,7 @@ public class PluginSearchManager implements AlphaFineSearchProcessor {
}
}
if (searchResult.size() < AlphaFineConstants.SHOW_SIZE + 1) {
lessModelList.add(0, TITLE_MODEL);
lessModelList.add(0, new MoreModel(Inter.getLocText("FR-Designer-Plugin_Addon")));
if (searchResult.size() == 0) {
lessModelList.add(AlphaFineHelper.NO_RESULT_MODEL);
} else {
@ -134,7 +133,7 @@ public class PluginSearchManager implements AlphaFineSearchProcessor {
private SearchResult getNoConnectList() {
SearchResult result = new SearchResult();
result.add(0, TITLE_MODEL);
result.add(0, new MoreModel(Inter.getLocText("FR-Designer-Plugin_Addon")));
result.add(AlphaFineHelper.NO_CONNECTION_MODEL);
return result;
}

4
designer/src/com/fr/design/mainframe/alphafine/search/manager/RecentSearchManager.java

@ -272,11 +272,11 @@ public class RecentSearchManager extends XMLFileManager implements AlphaFineSear
@Override
public SearchResult getLessSearchResult(String searchText) {
public synchronized SearchResult getLessSearchResult(String searchText) {
this.modelList = new SearchResult();
recentModelList = getRecentModelList(searchText);
if (recentModelList != null && recentModelList.size() > 0) {
modelList.add(new MoreModel(Inter.getLocText("FR-Designer_AlphaFine_Latest"), false));
modelList.add(new MoreModel(Inter.getLocText("FR-Designer_AlphaFine_Latest")));
}
modelList.addAll(recentModelList);
return modelList;

2
designer/src/com/fr/design/mainframe/alphafine/search/manager/RecommendSearchManager.java

@ -93,7 +93,7 @@ public class RecommendSearchManager implements AlphaFineSearchProcessor {
private SearchResult getNoConnectList() {
SearchResult result = new SearchResult();
result.add(0, new MoreModel(Inter.getLocText("FR-Designer_AlphaFine_Recommend"), false));
result.add(0, new MoreModel(Inter.getLocText("FR-Designer_AlphaFine_Recommend")));
result.add(AlphaFineHelper.NO_CONNECTION_MODEL);
return result;
}

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

2
designer_base/src/com/fr/design/actions/help/alphafine/AlphaFineConfigManager.java

@ -35,7 +35,7 @@ public class AlphaFineConfigManager implements XMLable {
/**
* 猜您需要
*/
private boolean isContainRecommend;
private boolean isContainRecommend = true;
/**
* 设置

40
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");
}
}
public static void installPluginFromDisk(File zipFile, JSCallback jsCallback) {
@ -50,15 +43,10 @@ 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);
}
}
}
public static void updatePluginOnline(PluginMarker pluginMarker, JSCallback jsCallback) {
try {
@ -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"));

Loading…
Cancel
Save