|
|
|
@ -9,7 +9,6 @@ import com.fr.design.dialog.FineJOptionPane;
|
|
|
|
|
import com.fr.design.dialog.UIDialog; |
|
|
|
|
import com.fr.design.gui.ibutton.UIButton; |
|
|
|
|
import com.fr.design.gui.icontainer.UIScrollPane; |
|
|
|
|
import com.fr.design.gui.ilable.ActionLabel; |
|
|
|
|
import com.fr.design.gui.ilable.UILabel; |
|
|
|
|
import com.fr.design.gui.itextfield.UITextField; |
|
|
|
|
import com.fr.design.i18n.Toolkit; |
|
|
|
@ -17,7 +16,6 @@ import com.fr.design.layout.TableLayout;
|
|
|
|
|
import com.fr.design.layout.TableLayoutHelper; |
|
|
|
|
import com.fr.design.mainframe.DesignerContext; |
|
|
|
|
import com.fr.design.update.actions.FileProcess; |
|
|
|
|
import com.fr.design.update.actions.NewFeatureAction; |
|
|
|
|
import com.fr.design.update.domain.UpdateInfoCachePropertyManager; |
|
|
|
|
import com.fr.design.update.utils.UpdateFileUtils; |
|
|
|
|
import com.fr.design.update.ui.widget.LoadingLabel; |
|
|
|
@ -59,6 +57,7 @@ import java.util.*;
|
|
|
|
|
import java.util.List; |
|
|
|
|
import java.util.concurrent.ExecutionException; |
|
|
|
|
|
|
|
|
|
import static com.fr.design.dialog.FineJOptionPane.OPTION_OK_CANCEL; |
|
|
|
|
import static java.nio.charset.StandardCharsets.*; |
|
|
|
|
import static javax.swing.JOptionPane.QUESTION_MESSAGE; |
|
|
|
|
|
|
|
|
@ -186,7 +185,7 @@ public class UpdateMainDialog extends UIDialog {
|
|
|
|
|
double[] rowUpdateContentPaneSize = {TableLayout.PREFERRED}; |
|
|
|
|
double[] columnUpdateContentPaneSize = {TableLayout.PREFERRED, TableLayout.FILL, TableLayout.PREFERRED}; |
|
|
|
|
double[] rowUpdateSubContentPaneSize = {UPDATE_CONTENT_PANE_ROW_SIZE, TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED, UPDATE_CONTENT_PANE_ROW_SIZE}; |
|
|
|
|
double[] columnUpdateSubContentPaneSize = {UPDATE_CONTENT_PANE_COLUMN_SIZE, TableLayout.PREFERRED, TableLayout.PREFERRED}; |
|
|
|
|
double[] columnUpdateSubContentPaneSize = {UPDATE_CONTENT_PANE_COLUMN_SIZE, TableLayout.FILL, TableLayout.PREFERRED}; |
|
|
|
|
double[] columnUpdateSubContentPaneLabelSize = {UPDATE_CONTENT_PANE_LABEL_COLUMN_SIZE, TableLayout.PREFERRED}; |
|
|
|
|
|
|
|
|
|
JPanel jarUpdateContentPane = new JPanel(); |
|
|
|
@ -197,8 +196,7 @@ public class UpdateMainDialog extends UIDialog {
|
|
|
|
|
new Component[]{new UILabel(), new UILabel(), new UILabel()}, |
|
|
|
|
new Component[]{new UILabel(), updateVersionReminderPane, new UILabel()}, |
|
|
|
|
new Component[]{new UILabel(), initPaneContent(Color.WHITE, rowUpdateContentPaneSize, columnUpdateSubContentPaneLabelSize, new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Updater_JAR_Version")), jarCurrentLabel), new UILabel()}, |
|
|
|
|
new Component[]{new UILabel(), initPaneContent(Color.WHITE, rowUpdateContentPaneSize, columnUpdateSubContentPaneLabelSize, new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Updater_Latest_JAR")), loadingLabel), |
|
|
|
|
getNewFeatureActionLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Latest_Feature_Detail"))}, |
|
|
|
|
new Component[]{new UILabel(), initPaneContent(Color.WHITE, rowUpdateContentPaneSize, columnUpdateSubContentPaneLabelSize, new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Updater_Latest_JAR")), loadingLabel), new UILabel()}, |
|
|
|
|
new Component[]{new UILabel(), new UILabel(), new UILabel()} |
|
|
|
|
}, rowUpdateSubContentPaneSize, columnUpdateSubContentPaneSize, LayoutConstants.VGAP_LARGE); |
|
|
|
|
jarUpdateContentPane2.setBackground(Color.WHITE); |
|
|
|
@ -419,8 +417,8 @@ public class UpdateMainDialog extends UIDialog {
|
|
|
|
|
if (downloadFileConfig == null) { |
|
|
|
|
throw new Exception("network error."); |
|
|
|
|
} |
|
|
|
|
HttpGet get = new HttpGet(CloudCenter.getInstance().acquireUrlByKind("updatelog") + "&start=" + lastUpdateCacheTime + "&end=" + getLatestJARTimeStr()); |
|
|
|
|
httpClient = HttpToolbox.getHttpClient(CloudCenter.getInstance().acquireUrlByKind("updatelog") + "&start=" + lastUpdateCacheTime + "&end=" + getLatestJARTimeStr()); |
|
|
|
|
HttpGet get = new HttpGet(CloudCenter.getInstance().acquireUrlByKind("changelog10") + "&start=" + lastUpdateCacheTime + "&end=" + getLatestJARTimeStr()); |
|
|
|
|
httpClient = HttpToolbox.getHttpClient(CloudCenter.getInstance().acquireUrlByKind("changelog10") + "&start=" + lastUpdateCacheTime + "&end=" + getLatestJARTimeStr()); |
|
|
|
|
response = httpClient.execute(get); |
|
|
|
|
String responseText = CommonIOUtils.inputStream2String(response.getEntity().getContent(),EncodeConstants.ENCODING_UTF_8).trim(); |
|
|
|
|
JSONArray array = JSONArray.create(); |
|
|
|
@ -610,7 +608,41 @@ public class UpdateMainDialog extends UIDialog {
|
|
|
|
|
* jar包更新按钮监听器 |
|
|
|
|
*/ |
|
|
|
|
private void addActionListenerForUpdateBtn() { |
|
|
|
|
updateButton.addActionListener(new UpdateAction()); |
|
|
|
|
updateButton.addActionListener(new ActionListener() { |
|
|
|
|
@Override |
|
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
|
String[] option = {Toolkit.i18nText("Fine-Design_Report_Yes"), Toolkit.i18nText("Fine-Design_Report_No")}; |
|
|
|
|
int a = JOptionPane.showOptionDialog(getParent(), Toolkit.i18nText("Fine-Design_Update_Info_Information"), |
|
|
|
|
Toolkit.i18nText("Fine-Design_Update_Info_Title"),JOptionPane.YES_NO_OPTION, QUESTION_MESSAGE, UIManager.getIcon("OptionPane.warningIcon"), option, 1); |
|
|
|
|
if (a == 0) { |
|
|
|
|
progressBar.setVisible(true); |
|
|
|
|
progressBar.setString(Toolkit.i18nText("Fine-Design_Update_Info_Wait_Message")); |
|
|
|
|
UpdateCallBack callBack = new UpdateProgressCallBack(progressBar); |
|
|
|
|
updateButton.setEnabled(false); |
|
|
|
|
updateLabel.setVisible(false); |
|
|
|
|
RestoreResultDialog.deletePreviousPropertyFile(); |
|
|
|
|
final String installLib = StableUtils.pathJoin(StableUtils.getInstallHome(), ProjectConstants.LOGS_NAME, UpdateConstants.INSTALL_LIB); |
|
|
|
|
final JFrame frame = DesignerContext.getDesignerFrame(); |
|
|
|
|
final RestartHelper helper = new RestartHelper(); |
|
|
|
|
FineProcessContext.getParentPipe().fire(FineProcessEngineEvent.DESTROY); |
|
|
|
|
new FileProcess(callBack) { |
|
|
|
|
@Override |
|
|
|
|
public void onDownloadSuccess() { |
|
|
|
|
progressBar.setVisible(false); |
|
|
|
|
deleteForDesignerUpdate(installLib); |
|
|
|
|
helper.restartForUpdate(frame); |
|
|
|
|
} |
|
|
|
|
@Override |
|
|
|
|
public void onDownloadFailed() { |
|
|
|
|
progressBar.setVisible(false); |
|
|
|
|
deleteForDesignerUpdate(installLib); |
|
|
|
|
FineJOptionPane.showMessageDialog(getParent(), Toolkit.i18nText("Fine-Design_Update_Info_Failed_Message")); |
|
|
|
|
helper.restartForUpdate(frame); |
|
|
|
|
} |
|
|
|
|
}.execute(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void deleteForDesignerUpdate(String installLib) { |
|
|
|
@ -656,13 +688,6 @@ public class UpdateMainDialog extends UIDialog {
|
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private ActionLabel getNewFeatureActionLabel(final String text){ |
|
|
|
|
ActionLabel actionLabel = new ActionLabel(text); |
|
|
|
|
actionLabel.addActionListener(new NewFeatureAction()); |
|
|
|
|
return actionLabel; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 显示窗口 |
|
|
|
|
*/ |
|
|
|
@ -680,43 +705,4 @@ public class UpdateMainDialog extends UIDialog {
|
|
|
|
|
@Override |
|
|
|
|
public void checkValid() throws Exception { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private class UpdateAction implements ActionListener { |
|
|
|
|
@Override |
|
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
|
String[] option = {Toolkit.i18nText("Fine-Design_Report_Yes"), Toolkit.i18nText("Fine-Design_Report_No")}; |
|
|
|
|
int a = JOptionPane.showOptionDialog(getParent(), Toolkit.i18nText("Fine-Design_Update_Info_Information"), |
|
|
|
|
Toolkit.i18nText("Fine-Design_Update_Info_Title"),JOptionPane.YES_NO_OPTION, QUESTION_MESSAGE, UIManager.getIcon("OptionPane.warningIcon"), option, 1); |
|
|
|
|
if (a == 0) { |
|
|
|
|
progressBar.setVisible(true); |
|
|
|
|
progressBar.setString(Toolkit.i18nText("Fine-Design_Update_Info_Wait_Message")); |
|
|
|
|
UpdateCallBack callBack = new UpdateProgressCallBack(progressBar); |
|
|
|
|
updateButton.setEnabled(false); |
|
|
|
|
updateLabel.setVisible(false); |
|
|
|
|
RestoreResultDialog.deletePreviousPropertyFile(); |
|
|
|
|
final String installLib = StableUtils.pathJoin(StableUtils.getInstallHome(), ProjectConstants.LOGS_NAME, UpdateConstants.INSTALL_LIB); |
|
|
|
|
final JFrame frame = DesignerContext.getDesignerFrame(); |
|
|
|
|
final RestartHelper helper = new RestartHelper(); |
|
|
|
|
FineProcessContext.getParentPipe().fire(FineProcessEngineEvent.DESTROY); |
|
|
|
|
new FileProcess(callBack) { |
|
|
|
|
@Override |
|
|
|
|
public void onDownloadSuccess() { |
|
|
|
|
progressBar.setVisible(false); |
|
|
|
|
deleteForDesignerUpdate(installLib); |
|
|
|
|
helper.restartForUpdate(frame); |
|
|
|
|
} |
|
|
|
|
@Override |
|
|
|
|
public void onDownloadFailed() { |
|
|
|
|
progressBar.setVisible(false); |
|
|
|
|
deleteForDesignerUpdate(installLib); |
|
|
|
|
FineJOptionPane.showMessageDialog(getParent(), Toolkit.i18nText("Fine-Design_Update_Info_Failed_Message")); |
|
|
|
|
helper.restartForUpdate(frame); |
|
|
|
|
} |
|
|
|
|
}.execute(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |