Browse Source

REPORT-14865 更新日志推送=>跳转更新

research/10.0
plough 6 years ago
parent
commit
8f7f1028e1
  1. 10
      designer-base/src/main/java/com/fr/design/onlineupdate/push/DesignerPushUpdateManager.java
  2. 25
      designer-base/src/main/java/com/fr/design/onlineupdate/ui/dialog/UpdateMainDialog.java
  3. 13
      designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java

10
designer-base/src/main/java/com/fr/design/onlineupdate/push/DesignerPushUpdateManager.java

@ -2,6 +2,7 @@ package com.fr.design.onlineupdate.push;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.DesignerFrame;
import com.fr.design.onlineupdate.ui.dialog.UpdateMainDialog;
import com.fr.general.CloudCenter;
import com.fr.general.GeneralContext;
import com.fr.general.GeneralUtils;
@ -141,7 +142,14 @@ public class DesignerPushUpdateManager {
* 跳转到更新升级窗口并自动开始更新
*/
void doUpdate() {
// todo
new Thread() {
@Override
public void run() {
UpdateMainDialog dialog = new UpdateMainDialog(DesignerContext.getDesignerFrame());
dialog.setAutoUpdateAfterInit();
dialog.showDialog();
}
}.start();
}
/**

25
designer-base/src/main/java/com/fr/design/onlineupdate/ui/dialog/UpdateMainDialog.java

@ -59,7 +59,14 @@ import java.awt.Dimension;
import java.awt.Frame;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.*;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.text.ParsePosition;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
@ -137,6 +144,8 @@ public class UpdateMainDialog extends UIDialog {
private String lastUpdateCacheTime;
private String lastUpdateCacheState = UPDATE_CACHE_STATE_FAIL;
private boolean autoUpdateAfterInit = false; // 是否在加载结束后,自动开始更新
public UpdateMainDialog(Dialog parent) {
super(parent);
initComponents();
@ -148,6 +157,13 @@ public class UpdateMainDialog extends UIDialog {
initComponents();
}
/**
* 等待面板初始化结束后点击"更新"按钮
*/
public void setAutoUpdateAfterInit() {
autoUpdateAfterInit = true;
}
private void initUpdateActionPane() {
double[] rowUpdateSubContentPaneSize = {UPDATE_CONTENT_PANE_ROW_SIZE, TableLayout.PREFERRED, UPDATE_CONTENT_PANE_ROW_SIZE};
double[] rowUpdateContentPaneSize = {TableLayout.PREFERRED};
@ -428,6 +444,7 @@ public class UpdateMainDialog extends UIDialog {
getUpdateInfoSuccess = true;
//step4:update cache file,start from cacheRecordTime,end latest server jartime
updateCachedInfoFile(jsonArray);
afterInit();
} catch (Exception e) {
getUpdateInfoSuccess = true;
FineLoggerFactory.getLogger().error(e.getMessage());
@ -436,6 +453,12 @@ public class UpdateMainDialog extends UIDialog {
};
}
private void afterInit() {
if (autoUpdateAfterInit) {
updateButton.doClick();
}
}
//从文件中读取缓存的更新信息
private void getCachedUpdateInfo(String keyword) throws Exception {
String cacheInfoPath = getUpdateCacheInfo();

13
designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java

@ -21,6 +21,7 @@ import com.fr.design.actions.insert.flot.FormulaFloatAction;
import com.fr.design.actions.insert.flot.ImageFloatAction;
import com.fr.design.actions.insert.flot.TextBoxFloatAction;
import com.fr.design.bridge.DesignToolbarProvider;
import com.fr.design.event.DesignerOpenedListener;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.form.parameter.FormParaDesigner;
import com.fr.design.fun.ElementUIProvider;
@ -35,6 +36,7 @@ import com.fr.design.javascript.ParameterJavaScriptPane;
import com.fr.design.javascript.ProcessTransitionAdapter;
import com.fr.design.mainframe.BaseJForm;
import com.fr.design.mainframe.CellElementPropertyPane;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.DesignerFrameFileDealerPane;
import com.fr.design.mainframe.EastRegionContainerPane;
import com.fr.design.mainframe.ElementCaseThumbnail;
@ -130,7 +132,16 @@ public class DesignerActivator extends Activator {
loadLogAppender();
DesignerSocketIO.update();
UserInfoPane.getInstance().updateBBSUserInfo();
DesignerPushUpdateManager.getInstance().checkAndPop();
checkUpdateLater();
}
private void checkUpdateLater() {
DesignerContext.getDesignerFrame().addDesignerOpenedListener(new DesignerOpenedListener() {
@Override
public void designerOpened() {
DesignerPushUpdateManager.getInstance().checkAndPop();
}
});
}
private void loadLogAppender() {

Loading…
Cancel
Save