Browse Source

Merge pull request #1175 in DESIGN/design from feature/10.0 to refactor/19.4.3

* commit '3d8ece2c7ff736201019eec8fe0e333b940d68ec': (28 commits)
  KERNEL-418 更新升级重构
  KERNEL-418 更新升级重构
  MOBILE-23325 【单选按钮样式】图文按钮:上传图片后,移动端图片显示很模糊
  KERNEL-418 更新升级重构
  无jira任务,sonar问题修复
  无jira任务,sonar问题修复
  KERNEL-418 更新升级重构
  KERNEL-418 更新升级重构
  CHART-10233 插件超链
  CHART-10233
  CHART-10233 超链面板
  CHART-10233 代码质量
  KERNEL-418 更新升级重构
  KERNEL-418 更新升级重构
  CHART-10233 代码质量
  CHART-10233 超链面板
  REPORT-21689 水印密度最小值限制,根据交互提供的内容补充
  REPORT-21689 水印密度最小值限制,根据交互提供的内容补充
  KERNEL-418 更新升级重构
  KERNEL-418 更新升级重构
  ...
research/11.0
Wim.Zhai 5 years ago
parent
commit
d83780bfc5
  1. 18
      designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java
  2. 19
      designer-base/src/main/java/com/fr/design/gui/ispinner/UISpinner.java
  3. 28
      designer-base/src/main/java/com/fr/design/gui/ispinner/UnsignedIntUISpinner.java
  4. 34
      designer-base/src/main/java/com/fr/design/gui/style/FormatePaneNumField.java
  5. 107
      designer-base/src/main/java/com/fr/design/report/WatermarkPane.java
  6. 79
      designer-base/src/main/java/com/fr/design/update/actions/RecoverForDesigner.java
  7. 60
      designer-base/src/main/java/com/fr/design/update/domain/UpdateConstants.java
  8. 2
      designer-base/src/main/java/com/fr/design/update/ui/dialog/RestoreDialog.java
  9. 55
      designer-base/src/main/java/com/fr/design/update/ui/dialog/RestoreResultDialog.java
  10. 108
      designer-base/src/main/java/com/fr/design/update/ui/dialog/UpdateMainDialog.java
  11. 15
      designer-base/src/main/java/com/fr/design/upm/UpmFinder.java
  12. 2
      designer-base/src/main/java/com/fr/design/upm/UpmShowDialog.java
  13. 3
      designer-base/src/main/java/com/fr/design/upm/UpmShowPane.java
  14. 19
      designer-base/src/main/java/com/fr/design/utils/ImageUtils.java
  15. 13
      designer-base/src/main/java/com/fr/design/web/CustomIconPane.java
  16. 26
      designer-base/src/test/java/com/fr/design/update/ui/dialog/RestoreResultDialogTest.java
  17. 8
      designer-chart/src/main/java/com/fr/design/ChartTypeInterfaceManager.java
  18. 2
      designer-chart/src/main/java/com/fr/design/chart/ChartTypePane.java
  19. 207
      designer-chart/src/main/java/com/fr/design/chartx/component/HyperLinkPane.java
  20. 12
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypePane.java
  21. 36
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/ColorPickerPaneNumFiled.java
  22. 2
      designer-chart/src/main/java/com/fr/extended/chart/ExtendedTypePane.java
  23. 7
      designer-chart/src/main/java/com/fr/van/chart/heatmap/designer/HeatMapIndependentVanChartInterface.java
  24. 3
      designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XCardAddButton.java
  25. 4
      designer-form/src/main/java/com/fr/design/form/layout/FRTitleLayout.java
  26. 2
      designer-form/src/main/java/com/fr/design/mainframe/EditingMouseListener.java
  27. 62
      designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java
  28. 9
      designer-realize/src/main/java/com/fr/design/mainframe/messagecollect/StartupMessageCollector.java
  29. 3
      designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java

18
designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java

@ -2,6 +2,7 @@ package com.fr.design.data;
import com.fr.base.StoreProcedureParameter; import com.fr.base.StoreProcedureParameter;
import com.fr.base.TableData; import com.fr.base.TableData;
import com.fr.concurrent.NamedThreadFactory;
import com.fr.data.TableDataSource; import com.fr.data.TableDataSource;
import com.fr.data.TableDataSourceTailor; import com.fr.data.TableDataSourceTailor;
import com.fr.data.core.DataCoreXmlUtils; import com.fr.data.core.DataCoreXmlUtils;
@ -30,6 +31,7 @@ import com.fr.general.ComparatorUtils;
import com.fr.general.data.DataModel; import com.fr.general.data.DataModel;
import com.fr.general.data.TableDataException; import com.fr.general.data.TableDataException;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.module.ModuleContext;
import com.fr.script.Calculator; import com.fr.script.Calculator;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.ParameterProvider; import com.fr.stable.ParameterProvider;
@ -48,8 +50,8 @@ import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.Timer; import java.util.concurrent.ScheduledExecutorService;
import java.util.TimerTask; import java.util.concurrent.TimeUnit;
/** /**
* 设计器管理操作数据集的类: * 设计器管理操作数据集的类:
@ -444,11 +446,18 @@ public abstract class DesignTableDataManager {
} catch (Exception e) { } catch (Exception e) {
throw new TableDataException(e.getMessage(), e); throw new TableDataException(e.getMessage(), e);
} finally { } finally {
new Timer().schedule(new TimerTask() { ScheduledExecutorService scheduledExecutorService = ModuleContext
.getExecutor()
.newSingleThreadScheduledExecutor(new NamedThreadFactory(""));
scheduledExecutorService.schedule(new Runnable() {
@Override
public void run() { public void run() {
if (loadingBar != null) {
loadingBar.close(); loadingBar.close();
} }
}, 100); }
}, 100, TimeUnit.MILLISECONDS);
scheduledExecutorService.shutdown();
} }
} }
@ -513,6 +522,7 @@ public abstract class DesignTableDataManager {
if (inParameters.length > 0 && !ComparatorUtils.equals(threadLocal.get(), NO_PARAMETER)) {// 检查Parameter. if (inParameters.length > 0 && !ComparatorUtils.equals(threadLocal.get(), NO_PARAMETER)) {// 检查Parameter.
final ParameterInputPane pPane = new ParameterInputPane(inParameters); final ParameterInputPane pPane = new ParameterInputPane(inParameters);
pPane.showSmallWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { pPane.showSmallWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() {
@Override
public void doOk() { public void doOk() {
parameterMap.putAll(pPane.update()); parameterMap.putAll(pPane.update());
} }

19
designer-base/src/main/java/com/fr/design/gui/ispinner/UISpinner.java

@ -39,6 +39,7 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver
private String spinnerName = StringUtils.EMPTY; private String spinnerName = StringUtils.EMPTY;
private UIObserverListener uiObserverListener; private UIObserverListener uiObserverListener;
private GlobalNameListener globalNameListener = null; private GlobalNameListener globalNameListener = null;
private boolean lessMinValue = false;
public UISpinner(double minValue, double maxValue, double dierta) { public UISpinner(double minValue, double maxValue, double dierta) {
@ -93,6 +94,18 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver
return textField; return textField;
} }
public UIButton getNextButton() {
return nextButton;
}
public boolean isLessMinValue() {
return lessMinValue;
}
public void resetLessMinValue() {
lessMinValue = false;
}
public void setValue(double value) { public void setValue(double value) {
setValue(value, true); setValue(value, true);
} }
@ -109,7 +122,8 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver
if (globalNameListener != null && shouldResponseNameListener()) { if (globalNameListener != null && shouldResponseNameListener()) {
globalNameListener.setGlobalName(spinnerName); globalNameListener.setGlobalName(spinnerName);
} }
value = value < minValue ? minValue : value; lessMinValue = value < minValue;
value = lessMinValue ? minValue : value;
value = value > maxValue ? maxValue : value; value = value > maxValue ? maxValue : value;
if (CommonUtils.equals(value, this.value)) { if (CommonUtils.equals(value, this.value)) {
return; return;
@ -131,7 +145,8 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver
if (globalNameListener != null && shouldResponseNameListener()) { if (globalNameListener != null && shouldResponseNameListener()) {
globalNameListener.setGlobalName(spinnerName); globalNameListener.setGlobalName(spinnerName);
} }
value = value < minValue ? minValue : value; lessMinValue = value < minValue;
value = lessMinValue ? minValue : value;
value = value > maxValue ? maxValue : value; value = value > maxValue ? maxValue : value;
if (CommonUtils.equals(value, this.value)) { if (CommonUtils.equals(value, this.value)) {

28
designer-base/src/main/java/com/fr/design/gui/ispinner/UnsignedIntUISpinner.java

@ -3,8 +3,6 @@ package com.fr.design.gui.ispinner;
import com.fr.design.gui.itextfield.UIIntNumberField; import com.fr.design.gui.itextfield.UIIntNumberField;
import com.fr.design.gui.itextfield.UINumberField; import com.fr.design.gui.itextfield.UINumberField;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
/** /**
* Created by IntelliJ IDEA. * Created by IntelliJ IDEA.
@ -31,7 +29,7 @@ public class UnsignedIntUISpinner extends UISpinner {
@Override @Override
protected UINumberField initNumberField() { protected UINumberField initNumberField() {
final UIIntNumberField numberField = new UIIntNumberField() { return new UIIntNumberField() {
public boolean shouldResponseChangeListener() { public boolean shouldResponseChangeListener() {
return false; return false;
} }
@ -44,29 +42,5 @@ public class UnsignedIntUISpinner extends UISpinner {
}; };
} }
}; };
numberField.addFocusListener(new FocusListener() {
@Override
public void focusGained(FocusEvent e) {
}
/**
* 失去焦点后再做范围限制不然最小值为 100 输个 1 都不让....
* @param e
*/
@Override
public void focusLost(FocusEvent e) {
double value = numberField.getValue();
if (!isOverMaxOrMinValue(value)) {
return;
}
numberField.setValue(value < minValue ? minValue : maxValue);
}
private boolean isOverMaxOrMinValue(double value) {
return value < minValue || value > maxValue;
}
});
return numberField;
} }
} }

34
designer-base/src/main/java/com/fr/design/gui/style/FormatePaneNumField.java

@ -1,10 +1,14 @@
package com.fr.design.gui.style; package com.fr.design.gui.style;
import com.fr.concurrent.NamedThreadFactory;
import com.fr.design.gui.frpane.AbstractAttrNoScrollPane; import com.fr.design.gui.frpane.AbstractAttrNoScrollPane;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
import com.fr.module.ModuleContext;
import com.fr.value.ClearableLazyValue;
import org.jetbrains.annotations.NotNull;
import java.util.Timer; import java.util.concurrent.ScheduledExecutorService;
import java.util.TimerTask; import java.util.concurrent.TimeUnit;
/** /**
* Created with IntelliJ IDEA. * Created with IntelliJ IDEA.
@ -14,31 +18,35 @@ import java.util.TimerTask;
* To change this template use File | Settings | File Templates. * To change this template use File | Settings | File Templates.
*/ */
public class FormatePaneNumField extends UITextField { public class FormatePaneNumField extends UITextField {
private Timer timer; private ClearableLazyValue<ScheduledExecutorService> ses = new ClearableLazyValue<ScheduledExecutorService>() {
@NotNull
@Override
protected ScheduledExecutorService compute() {
return ModuleContext.getExecutor()
.newSingleThreadScheduledExecutor(new NamedThreadFactory("FormatePaneNumFieldRunChange"));
}
};
public FormatePaneNumField() { public FormatePaneNumField() {
super(); super();
} }
@Override
protected void attributeChange() { protected void attributeChange() {
if (!AbstractAttrNoScrollPane.isHasChangeListener()) { if (!AbstractAttrNoScrollPane.isHasChangeListener()) {
return; return;
} }
if(timer != null){ ses.getValue().schedule(new Runnable() {
timer.cancel();
}
timer = new Timer();
timer.schedule(new TimerTask() {
@Override @Override
public void run() { public void run() {
runChange(); runChange();
} }
},100); }, 100, TimeUnit.MILLISECONDS);
} }
protected void runChange(){ protected void runChange() {
super.attributeChange(); super.attributeChange();
timer.cancel(); ses.getValue().shutdown();
ses.drop();
} }
} }

107
designer-base/src/main/java/com/fr/design/report/WatermarkPane.java

@ -23,6 +23,9 @@ import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener; import javax.swing.event.DocumentListener;
import javax.swing.JDialog;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Color; import java.awt.Color;
@ -30,6 +33,13 @@ import java.awt.event.FocusEvent;
import java.awt.event.FocusListener; import java.awt.event.FocusListener;
import java.awt.event.ItemEvent; import java.awt.event.ItemEvent;
import java.awt.event.ItemListener; import java.awt.event.ItemListener;
import java.awt.event.MouseListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.FocusAdapter;
import java.awt.Dialog;
import java.awt.FlowLayout;
/** /**
* Created by plough on 2018/5/15. * Created by plough on 2018/5/15.
@ -49,6 +59,13 @@ public class WatermarkPane extends BasicPane {
private UISpinner verticalGapSpinner; private UISpinner verticalGapSpinner;
// 文字颜色 // 文字颜色
private NewColorSelectPane colorPane; private NewColorSelectPane colorPane;
//间距超过限制消息
private UILabel message;
//横向间距最小值
public static final int HORIZONTAL_GAP_MIX = 100;
//纵向间距最小值
public static final int VERTICAL_GAP_MIX = 50;
private static final Dimension SPINNER_DIMENSION = new Dimension(75, 20); private static final Dimension SPINNER_DIMENSION = new Dimension(75, 20);
@ -57,6 +74,7 @@ public class WatermarkPane extends BasicPane {
} }
private void initComponents() { private void initComponents() {
message = new UILabel();
this.setBorder(BorderFactory.createEmptyBorder(4, 4, -5, 4)); this.setBorder(BorderFactory.createEmptyBorder(4, 4, -5, 4));
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
@ -93,7 +111,7 @@ public class WatermarkPane extends BasicPane {
public WatermarkAttr update() { public WatermarkAttr update() {
WatermarkAttr watermark = new WatermarkAttr(); WatermarkAttr watermark = new WatermarkAttr();
watermark.setText(formulaPane.getUITextField().getText()); watermark.setText(formulaPane.getUITextField().getText());
watermark.setFontSize((int)fontSizeComboBox.getSelectedItem()); watermark.setFontSize((int) fontSizeComboBox.getSelectedItem());
watermark.setHorizontalGap((int) horizontalGapSpinner.getValue()); watermark.setHorizontalGap((int) horizontalGapSpinner.getValue());
watermark.setVerticalGap((int) verticalGapSpinner.getValue()); watermark.setVerticalGap((int) verticalGapSpinner.getValue());
watermark.setColor(colorPane.getColor()); watermark.setColor(colorPane.getColor());
@ -109,7 +127,7 @@ public class WatermarkPane extends BasicPane {
this.formulaPane = formulaPane; this.formulaPane = formulaPane;
} }
protected UIScrollPane initRightPane(){ protected UIScrollPane initRightPane() {
formulaPane = new TinyFormulaPane(); formulaPane = new TinyFormulaPane();
fontSizeComboBox = new UIComboBox(FRFontPane.FONT_SIZES); fontSizeComboBox = new UIComboBox(FRFontPane.FONT_SIZES);
fontSizeComboBox.setEditable(true); fontSizeComboBox.setEditable(true);
@ -117,7 +135,17 @@ public class WatermarkPane extends BasicPane {
verticalGapSpinner = new UnsignedIntUISpinner(50, Integer.MAX_VALUE, 1, 100); verticalGapSpinner = new UnsignedIntUISpinner(50, Integer.MAX_VALUE, 1, 100);
horizontalGapSpinner.setPreferredSize(SPINNER_DIMENSION); horizontalGapSpinner.setPreferredSize(SPINNER_DIMENSION);
verticalGapSpinner.setPreferredSize(SPINNER_DIMENSION); verticalGapSpinner.setPreferredSize(SPINNER_DIMENSION);
JPanel fontSizeTypePane = new JPanel(new BorderLayout(10,0)); message.setBorder(BorderFactory.createEmptyBorder(8, 5, 0, 0));
//失去焦点时要判断是否要弹出提示
horizontalGapSpinner.getTextField().addFocusListener(
createFocusListener4GapNumberField(horizontalGapSpinner, HORIZONTAL_GAP_MIX, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Horizontal_Gap_Over_Warning")));
verticalGapSpinner.getTextField().addFocusListener(createFocusListener4GapNumberField(verticalGapSpinner, VERTICAL_GAP_MIX, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Vertical_Gap_Over_Warning")));
//next 按钮 释放时也要判断是否要弹出提示
horizontalGapSpinner.getNextButton().addMouseListener(createMouseListener4GapNextButton(horizontalGapSpinner, HORIZONTAL_GAP_MIX, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Horizontal_Gap_Over_Warning")));
verticalGapSpinner.getNextButton().addMouseListener(createMouseListener4GapNextButton(verticalGapSpinner, VERTICAL_GAP_MIX, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Vertical_Gap_Over_Warning")));
JPanel fontSizeTypePane = new JPanel(new BorderLayout(10, 0));
fontSizeTypePane.add(fontSizeComboBox, BorderLayout.CENTER); fontSizeTypePane.add(fontSizeComboBox, BorderLayout.CENTER);
//水印间距面板 //水印间距面板
@ -144,18 +172,18 @@ public class WatermarkPane extends BasicPane {
JPanel rightContentPane = TableLayoutHelper.createCommonTableLayoutPane(new JComponent[][]{ JPanel rightContentPane = TableLayoutHelper.createCommonTableLayoutPane(new JComponent[][]{
{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Watermark_Text")), formulaPane}, {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Watermark_Text")), formulaPane},
{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Font_Size")), fontSizeTypePane}, {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Font_Size")), fontSizeTypePane},
{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Watermark_Gap")),watermarkGapPane }, {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Watermark_Gap")), watermarkGapPane},
{null,watermarkGapTipsPane }, {null, watermarkGapTipsPane},
{colorLabelPane, colorPane}, {colorLabelPane, colorPane},
}, rowSize, columnSize, 10); }, rowSize, columnSize, 10);
rightContentPane.setBorder(BorderFactory.createEmptyBorder(15, 12, 10, 12)); rightContentPane.setBorder(BorderFactory.createEmptyBorder(15, 12, 10, 12));
UIScrollPane configPane = new UIScrollPane(rightContentPane); UIScrollPane configPane = new UIScrollPane(rightContentPane);
configPane.setBorder(GUICoreUtils.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Config"),null)); configPane.setBorder(GUICoreUtils.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Config"), null));
return configPane; return configPane;
} }
protected void populateFontSize(int fontSize){ protected void populateFontSize(int fontSize) {
this.fontSizeComboBox.setSelectedItem(fontSize); this.fontSizeComboBox.setSelectedItem(fontSize);
this.fontSizeComboBox.addItemListener(new ItemListener() { this.fontSizeComboBox.addItemListener(new ItemListener() {
@Override @Override
@ -165,7 +193,7 @@ public class WatermarkPane extends BasicPane {
}); });
} }
protected void populateWatermarkGap(WatermarkAttr watermark){ protected void populateWatermarkGap(WatermarkAttr watermark) {
this.horizontalGapSpinner.setValue(watermark.getHorizontalGap()); this.horizontalGapSpinner.setValue(watermark.getHorizontalGap());
this.horizontalGapSpinner.addUISpinnerFocusListenner(new FocusListener() { this.horizontalGapSpinner.addUISpinnerFocusListenner(new FocusListener() {
@ -195,7 +223,7 @@ public class WatermarkPane extends BasicPane {
}); });
} }
protected void paintPreviewPane(){ protected void paintPreviewPane() {
watermarkPreviewPane.repaint(update()); watermarkPreviewPane.repaint(update());
} }
@ -235,4 +263,65 @@ public class WatermarkPane extends BasicPane {
protected String title4PopupWindow() { protected String title4PopupWindow() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_WaterMark"); return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_WaterMark");
} }
/**
* 创建水印间距文本段焦点监听器
*
* @return
*/
private FocusListener createFocusListener4GapNumberField(final UISpinner spinner, final int limitMinValue, final String messageStr) {
return new FocusAdapter() {
@Override
public void focusLost(FocusEvent e) {
if (!spinner.isLessMinValue()) {
return;
}
spinner.resetLessMinValue();
createGapDialog(new StringBuilder(messageStr).append(limitMinValue).toString());
}
};
}
/**
* 创建水印间距微调器 NextButton 的鼠标释放监听器
*
* @param messageStr 提示消息
* @param limitMinValue 限制的最小值
* @return
*/
private MouseListener createMouseListener4GapNextButton(final UISpinner spinner, final int limitMinValue, final String messageStr) {
MouseAdapter mouseAdapter = new MouseAdapter() {
@Override
public void mouseReleased(MouseEvent e) {
if (!spinner.isLessMinValue()) {
return;
}
spinner.resetLessMinValue();
createGapDialog(new StringBuilder(messageStr).append(limitMinValue).toString());
}
};
return mouseAdapter;
}
/**
* 创建超过水印间距限制的对话框
*
* @param messageStr 提示消息
*/
private void createGapDialog(String messageStr) {
JDialog dialog = new JDialog((Dialog) SwingUtilities.getWindowAncestor(WatermarkPane.this), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Joption_News"), true);
dialog.setSize(new Dimension(268, 118));
message.setText(messageStr);
JPanel upPane = new JPanel();
UILabel uiLabel = new UILabel(UIManager.getIcon("OptionPane.informationIcon"));
upPane.setLayout(new FlowLayout(FlowLayout.LEFT, 10, 10));
upPane.add(uiLabel);
upPane.add(message);
dialog.add(upPane);
dialog.setResizable(false);
dialog.setLocationRelativeTo(SwingUtilities.getWindowAncestor(WatermarkPane.this));
dialog.setVisible(true);
dialog.dispose();
}
} }

79
designer-base/src/main/java/com/fr/design/update/actions/RecoverForDesigner.java

@ -0,0 +1,79 @@
package com.fr.design.update.actions;
import com.fr.decision.update.backup.Recover;
import com.fr.decision.update.data.UpdateConstants;
import com.fr.decision.update.exception.UpdateException;
import com.fr.general.GeneralUtils;
import com.fr.general.IOUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.CommonUtils;
import com.fr.stable.StableUtils;
import com.fr.stable.project.ProjectConstants;
import com.fr.workspace.WorkContext;
import java.io.File;
import java.io.IOException;
/**
* @author Bryant
* @version 10.0
* Created by Bryant on 2019-10-09
*/
public class RecoverForDesigner implements Recover {
@Override
public boolean recover() {
try{
IOUtils.copyFilesInDirByPath(StableUtils.pathJoin(StableUtils.getInstallHome(), UpdateConstants.DESIGNERBACKUPPATH),
StableUtils.pathJoin(StableUtils.getInstallHome(), ProjectConstants.LIB_NAME));
return true;
} catch (IOException ignore) {
FineLoggerFactory.getLogger().error("Recover error for designer");
return false;
}
}
@Override
public boolean backup() {
String installHome = StableUtils.getInstallHome();
//jar包备份文件的目录为"backup/"+jar包当前版本号
String todayBackupDir = StableUtils.pathJoin(installHome, UpdateConstants.DESIGNER_BACKUP_DIR, (GeneralUtils.readBuildNO()));
backupFilesFromInstallEnv(todayBackupDir);
backupFilesFromInstallLib(installHome, todayBackupDir);
try {
File file = new File(StableUtils.pathJoin(installHome, UpdateConstants.DOWNLOADPATH));
CommonUtils.mkdirs(file);
IOUtils.copyFilesInDirByPath(StableUtils.pathJoin(installHome,ProjectConstants.LIB_NAME),
StableUtils.pathJoin(installHome, UpdateConstants.DESIGNERBACKUPPATH));
return true;
}catch (IOException e) {
UpdateException exception = new UpdateException("Backup Exception for designer" + e.getMessage());
FineLoggerFactory.getLogger().error(exception.getMessage(),exception);
return false;
}
}
private void backupFilesFromInstallEnv(String todayBackupDir) {
try {
CommonUtils.mkdirs(new File(StableUtils.pathJoin(todayBackupDir,UpdateConstants.BACKUPPATH)));
IOUtils.copyFilesInDirByPath(
StableUtils.pathJoin(WorkContext.getCurrent().getPath(),ProjectConstants.LIB_NAME),
StableUtils.pathJoin(todayBackupDir,UpdateConstants.BACKUPPATH));
} catch (IOException e) {
UpdateException exception = new UpdateException(e.getMessage());
FineLoggerFactory.getLogger().error(exception.getMessage() + "backup for Designer recover in env failed");
}
}
private void backupFilesFromInstallLib(String installHome, String todayBackupDir) {
try {
CommonUtils.mkdirs(new File(StableUtils.pathJoin(todayBackupDir,UpdateConstants.DESIGNERBACKUPPATH)));
IOUtils.copyFilesInDirByPath(
StableUtils.pathJoin(installHome,ProjectConstants.LIB_NAME),
StableUtils.pathJoin(todayBackupDir,UpdateConstants.DESIGNERBACKUPPATH));
} catch (IOException e) {
UpdateException exception = new UpdateException(e.getMessage());
FineLoggerFactory.getLogger().error(exception.getMessage() + "backup for Designer recover in install failed");
}
}
}

60
designer-base/src/main/java/com/fr/design/update/domain/UpdateConstants.java

@ -1,60 +0,0 @@
package com.fr.design.update.domain;
/**
* Created by XINZAI on 2018/8/21.
*/
import java.awt.Color;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
/**
* 更新升级的常量
*/
public interface UpdateConstants {
String APPS_FOLDER_NAME = "webapps";
int CONNECTION_TIMEOUT = 1000 * 5;
Color BAR_COLOR = new Color(0x3384F0);
String CHANGELOG_X_START = "2018-07-11";
String DEFAULT_APP_NAME = "FineReport";
String DOWNLOAD_DIR = "update";
String DESIGNER_BACKUP_DIR = "designerbackup";
String UPDATE_CACHE_CONFIG_X = "updateCacheConfig10";
String UPDATE_CACHE_INFO_X = "updateCacheInfo10";
int BYTE = 153600;
List<String> JARS_FOR_SERVER_X = Collections.unmodifiableList(Arrays.asList(new String[]{
"fine-activator-10.0.jar",
"fine-core-10.0.jar",
"fine-report-engine-10.0.jar",
"fine-decision-10.0.jar",
"fine-decision-report-10.0.jar",
"fine-schedule-10.0.jar",
"fine-schedule-report-10.0.jar",
"fine-swift-log-adaptor-10.0.jar",
"fine-webui-10.0.jar",
"fine-datasource-10.0.jar",
"fine-third-10.0.jar",
"fine-accumulator-10.0.jar"
}));
List<String> JARS_FOR_DESIGNER_X = Collections.unmodifiableList(Arrays.asList(new String[]{
"fine-report-designer-10.0.jar",
"aspectjrt.jar"
}));
List<String> LOG_TYPE = Collections.unmodifiableList(Arrays.asList(new String[]{
"REPORT", "MOBILE", "CHART", "PFC", "BI"
}));
}

2
designer-base/src/main/java/com/fr/design/update/ui/dialog/RestoreDialog.java

@ -1,9 +1,9 @@
package com.fr.design.update.ui.dialog; package com.fr.design.update.ui.dialog;
import com.fr.decision.update.data.UpdateConstants;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.update.domain.UpdateConstants;
import com.fr.design.update.factory.DirectoryOperationFactory; import com.fr.design.update.factory.DirectoryOperationFactory;
import com.fr.design.update.ui.widget.ColorfulCellRender; import com.fr.design.update.ui.widget.ColorfulCellRender;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;

55
designer-base/src/main/java/com/fr/design/update/ui/dialog/RestoreResultDialog.java

@ -1,17 +1,16 @@
package com.fr.design.update.ui.dialog; package com.fr.design.update.ui.dialog;
import com.fr.decision.update.data.UpdateConstants;
import com.fr.design.RestartHelper; import com.fr.design.RestartHelper;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.update.domain.UpdateConstants;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.stable.ProductConstants;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.project.ProjectConstants; import com.fr.stable.project.ProjectConstants;
import com.fr.workspace.WorkContext;
import javax.swing.AbstractAction; import javax.swing.AbstractAction;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
@ -25,6 +24,7 @@ import java.awt.Font;
import java.awt.Frame; import java.awt.Frame;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@ -45,7 +45,7 @@ public class RestoreResultDialog extends JDialog {
initCommonComponents(); initCommonComponents();
} }
public RestoreResultDialog(Frame parent, boolean modal, String jarDir) { RestoreResultDialog(Frame parent, boolean modal, String jarDir) {
super(parent, modal); super(parent, modal);
this.jarRestoreDir = jarDir; this.jarRestoreDir = jarDir;
if (ComparatorUtils.equals(jarDir, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Updater_Restore_Old_Version"))) { if (ComparatorUtils.equals(jarDir, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Updater_Restore_Old_Version"))) {
@ -92,9 +92,7 @@ public class RestoreResultDialog extends JDialog {
jarProgressLabel.setVisible(true); jarProgressLabel.setVisible(true);
progressLabelPane.add(jarProgressLabel); progressLabelPane.add(jarProgressLabel);
pane.add(progressLabelPane, BorderLayout.CENTER); pane.add(progressLabelPane, BorderLayout.CENTER);
deletePreviousPropertyFile();
UpdateMainDialog.deletePreviousPropertyFile();
putJarBackupFiles(); putJarBackupFiles();
restartButton.setEnabled(true); restartButton.setEnabled(true);
restartLaterButton.setEnabled(true); restartLaterButton.setEnabled(true);
@ -102,6 +100,15 @@ public class RestoreResultDialog extends JDialog {
this.setTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Updater_Jar_Restore")); this.setTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Updater_Jar_Restore"));
} }
static boolean deletePreviousPropertyFile() {
File moveFile = new File(RestartHelper.MOVE_FILE);
File delFile = new File(RestartHelper.RECORD_FILE);
if (StableUtils.mkdirs(moveFile) && StableUtils.mkdirs(delFile)) {
return StableUtils.deleteFile(moveFile) && StableUtils.deleteFile(delFile);
}
return false;
}
private void initOldVersionRestoreComps() { private void initOldVersionRestoreComps() {
this.setResizable(false); this.setResizable(false);
JPanel pane = new JPanel(); JPanel pane = new JPanel();
@ -151,8 +158,8 @@ public class RestoreResultDialog extends JDialog {
} }
private void putJarBackupFiles() { private void putJarBackupFiles() {
Map<String, String> map = new HashMap<String, String>(); Map<String, String> map = new HashMap<>();
java.util.List<String> list = new ArrayList<String>(); List<String> list = new ArrayList<>();
String installHome = StableUtils.getInstallHome(); String installHome = StableUtils.getInstallHome();
putJarBackupFilesToInstallLib(installHome, map, list); putJarBackupFilesToInstallLib(installHome, map, list);
@ -161,23 +168,29 @@ public class RestoreResultDialog extends JDialog {
RestartHelper.saveFilesWhichToDelete(list.toArray(new String[list.size()])); RestartHelper.saveFilesWhichToDelete(list.toArray(new String[list.size()]));
} }
private void putJarBackupFilesToInstallLib(String installHome, Map<String, String> map, java.util.List<String> list) { private void putJarBackupFilesToInstallLib(String installHome, Map<String, String> map, List<String> list) {
List<String> files = UpdateConstants.JARS_FOR_DESIGNER_X;
String backupDir = UpdateConstants.DESIGNER_BACKUP_DIR; String backupDir = UpdateConstants.DESIGNER_BACKUP_DIR;
for (String file : files) { File installLib = new File(StableUtils.pathJoin(installHome, backupDir, jarRestoreDir, UpdateConstants.DESIGNERBACKUPPATH));
map.put(StableUtils.pathJoin(installHome, backupDir, jarRestoreDir, file), File[] files = installLib.listFiles();
StableUtils.pathJoin(installHome, ProjectConstants.LIB_NAME, file)); if (files != null) {
list.add(StableUtils.pathJoin(installHome, ProjectConstants.LIB_NAME, file)); for (File file : files) {
map.put(file.getAbsolutePath(),
StableUtils.pathJoin(installHome, ProjectConstants.LIB_NAME, file.getName()));
list.add(StableUtils.pathJoin(installHome, ProjectConstants.LIB_NAME, file.getName()));
}
} }
} }
private void putJarBackupFilesToInstallEnv(String installHome, Map<String, String> map, java.util.List<String> list) { private void putJarBackupFilesToInstallEnv(String installHome, Map<String, String> map, List<String> list) {
List<String> files = UpdateConstants.JARS_FOR_SERVER_X;
String backupDir = UpdateConstants.DESIGNER_BACKUP_DIR; String backupDir = UpdateConstants.DESIGNER_BACKUP_DIR;
for (String file : files) { File installEnv = new File(StableUtils.pathJoin(installHome, backupDir, jarRestoreDir, UpdateConstants.BACKUPPATH));
map.put(StableUtils.pathJoin(installHome, backupDir, jarRestoreDir, file), File[] files = installEnv.listFiles();
StableUtils.pathJoin(installHome, UpdateConstants.APPS_FOLDER_NAME, ProductConstants.getAppFolderName(), ProjectConstants.WEBINF_NAME, ProjectConstants.LIB_NAME, file)); if (files != null) {
list.add(StableUtils.pathJoin(installHome, UpdateConstants.APPS_FOLDER_NAME, ProductConstants.getAppFolderName(), ProjectConstants.WEBINF_NAME, ProjectConstants.LIB_NAME, file)); for (File file : files) {
map.put(file.getAbsolutePath(),
StableUtils.pathJoin(WorkContext.getCurrent().getPath(), ProjectConstants.LIB_NAME, file.getName()));
list.add(StableUtils.pathJoin(WorkContext.getCurrent().getPath(), ProjectConstants.LIB_NAME, file.getName()));
}
} }
} }
} }

108
designer-base/src/main/java/com/fr/design/update/ui/dialog/UpdateMainDialog.java

@ -1,5 +1,6 @@
package com.fr.design.update.ui.dialog; package com.fr.design.update.ui.dialog;
import com.fr.decision.update.data.UpdateConstants;
import com.fr.decision.update.info.UpdateCallBack; import com.fr.decision.update.info.UpdateCallBack;
import com.fr.decision.update.info.UpdateProgressCallBack; import com.fr.decision.update.info.UpdateProgressCallBack;
import com.fr.design.RestartHelper; import com.fr.design.RestartHelper;
@ -9,11 +10,11 @@ import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.update.actions.FileProcess; import com.fr.design.update.actions.FileProcess;
import com.fr.design.update.domain.UpdateConstants;
import com.fr.design.update.domain.UpdateInfoCachePropertyManager; import com.fr.design.update.domain.UpdateInfoCachePropertyManager;
import com.fr.design.update.factory.DirectoryOperationFactory; import com.fr.design.update.factory.DirectoryOperationFactory;
import com.fr.design.update.ui.widget.LoadingLabel; import com.fr.design.update.ui.widget.LoadingLabel;
@ -23,22 +24,15 @@ import com.fr.design.update.ui.widget.UpdateInfoTableCellRender;
import com.fr.design.update.ui.widget.UpdateInfoTableModel; import com.fr.design.update.ui.widget.UpdateInfoTableModel;
import com.fr.design.update.ui.widget.UpdateInfoTextAreaCellRender; import com.fr.design.update.ui.widget.UpdateInfoTextAreaCellRender;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.CloudCenter; import com.fr.general.*;
import com.fr.general.ComparatorUtils;
import com.fr.general.DateUtils;
import com.fr.general.GeneralContext;
import com.fr.general.GeneralUtils;
import com.fr.general.SiteCenter;
import com.fr.general.http.HttpClient;
import com.fr.general.http.HttpToolbox; import com.fr.general.http.HttpToolbox;
import com.fr.json.JSONArray; import com.fr.json.JSONArray;
import com.fr.json.JSONObject; import com.fr.json.JSONObject;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.ArrayUtils; import com.fr.stable.*;
import com.fr.stable.EncodeConstants; import com.fr.third.org.apache.http.client.methods.CloseableHttpResponse;
import com.fr.stable.ProductConstants; import com.fr.third.org.apache.http.client.methods.HttpGet;
import com.fr.stable.StableUtils; import com.fr.third.org.apache.http.impl.client.CloseableHttpClient;
import com.fr.stable.StringUtils;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import com.sun.java.swing.plaf.motif.MotifProgressBarUI; import com.sun.java.swing.plaf.motif.MotifProgressBarUI;
@ -46,21 +40,11 @@ import javax.swing.*;
import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener; import javax.swing.event.DocumentListener;
import javax.swing.table.TableRowSorter; import javax.swing.table.TableRowSorter;
import java.awt.BorderLayout; import java.awt.*;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dialog;
import java.awt.Dimension;
import java.awt.Frame;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.io.BufferedReader; import java.io.*;
import java.io.BufferedWriter; import java.nio.charset.StandardCharsets;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.text.ParsePosition; import java.text.ParsePosition;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
@ -69,6 +53,8 @@ import java.util.List;
import java.util.Locale; import java.util.Locale;
import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutionException;
import static java.nio.charset.StandardCharsets.*;
/** /**
* Created by XINZAI on 2018/8/21. * Created by XINZAI on 2018/8/21.
*/ */
@ -121,8 +107,6 @@ public class UpdateMainDialog extends UIDialog {
//搜索更新信息关键词文本框 //搜索更新信息关键词文本框
private UITextField searchUpdateInfoKeyword; private UITextField searchUpdateInfoKeyword;
private boolean updateSuccessful;
private UpdateInfoTable updateInfoTable; private UpdateInfoTable updateInfoTable;
private ArrayList<Object[]> updateInfoList; private ArrayList<Object[]> updateInfoList;
@ -248,12 +232,12 @@ public class UpdateMainDialog extends UIDialog {
updateInfoTable.setShowGrid(false); updateInfoTable.setShowGrid(false);
updateInfoTable.setCellSelectionEnabled(false); updateInfoTable.setCellSelectionEnabled(false);
TableRowSorter<UpdateInfoTableModel> sorter = new TableRowSorter<UpdateInfoTableModel>(updateInfoTable.getDataModel()); TableRowSorter<UpdateInfoTableModel> sorter = new TableRowSorter<>(updateInfoTable.getDataModel());
sorter.setSortable(updateTimeColIndex, true); sorter.setSortable(updateTimeColIndex, true);
sorter.setSortable(updateTitleColIndex, false); sorter.setSortable(updateTitleColIndex, false);
sorter.setSortable(updateSignColIndex, false); sorter.setSortable(updateSignColIndex, false);
updateInfoTable.setRowSorter(sorter); updateInfoTable.setRowSorter(sorter);
List<RowSorter.SortKey> sortKeys = new ArrayList<RowSorter.SortKey>(); List<RowSorter.SortKey> sortKeys = new ArrayList<>();
sortKeys.add(new RowSorter.SortKey(updateTimeColIndex, SortOrder.DESCENDING)); sortKeys.add(new RowSorter.SortKey(updateTimeColIndex, SortOrder.DESCENDING));
sorter.setSortKeys(sortKeys); sorter.setSortKeys(sortKeys);
@ -367,6 +351,7 @@ public class UpdateMainDialog extends UIDialog {
try { try {
downloadFileConfig = get(); downloadFileConfig = get();
showDownLoadInfo(); showDownLoadInfo();
afterInit();
} catch (InterruptedException e) { } catch (InterruptedException e) {
stopLoading(); stopLoading();
Thread.currentThread().interrupt(); Thread.currentThread().interrupt();
@ -380,7 +365,7 @@ public class UpdateMainDialog extends UIDialog {
} }
private SwingWorker<JSONArray, Void> getUpdateInfo(final String keyword) { private SwingWorker<JSONArray, Void> getUpdateInfo(final String keyword) {
updateInfoList = new ArrayList<Object[]>(); updateInfoList = new ArrayList<>();
lastUpdateCacheTime = UpdateConstants.CHANGELOG_X_START; lastUpdateCacheTime = UpdateConstants.CHANGELOG_X_START;
String cacheConfigPath = getUpdateCacheConfig(); String cacheConfigPath = getUpdateCacheConfig();
cacheProperty = new UpdateInfoCachePropertyManager(StableUtils.pathJoin(WorkContext.getCurrent().getPath(), "resources", "offlineres", cacheConfigPath)); cacheProperty = new UpdateInfoCachePropertyManager(StableUtils.pathJoin(WorkContext.getCurrent().getPath(), "resources", "offlineres", cacheConfigPath));
@ -395,6 +380,8 @@ public class UpdateMainDialog extends UIDialog {
return new SwingWorker<JSONArray, Void>() { return new SwingWorker<JSONArray, Void>() {
@Override @Override
protected JSONArray doInBackground() { protected JSONArray doInBackground() {
CloseableHttpClient httpClient;
CloseableHttpResponse response;
try { try {
getUpdateInfoSuccess = false; getUpdateInfoSuccess = false;
//step1:read from cache file //step1:read from cache file
@ -403,16 +390,15 @@ public class UpdateMainDialog extends UIDialog {
if (downloadFileConfig == null) { if (downloadFileConfig == null) {
throw new Exception("network error."); throw new Exception("network error.");
} }
HttpClient hc = new HttpClient(SiteCenter.getInstance().acquireUrlByKind("changelog10") + "&start=" + lastUpdateCacheTime + "&end=" + getLatestJARTimeStr()); HttpGet get = new HttpGet(CloudCenter.getInstance().acquireUrlByKind("changelog10") + "&start=" + lastUpdateCacheTime + "&end=" + getLatestJARTimeStr());
hc.asGet(); httpClient = HttpToolbox.getHttpClient(CloudCenter.getInstance().acquireUrlByKind("changelog10") + "&start=" + lastUpdateCacheTime + "&end=" + getLatestJARTimeStr());
hc.setTimeout(UpdateConstants.CONNECTION_TIMEOUT * 2); response = httpClient.execute(get);
String responseText = hc.getResponseText(); String responseText = CommonIOUtils.inputStream2String(response.getEntity().getContent(),EncodeConstants.ENCODING_UTF_8).trim();
JSONArray array = JSONArray.create(); JSONArray array = JSONArray.create();
//假如返回"-1",说明socket出错了 //假如返回"-1",说明socket出错了
if (!ComparatorUtils.equals(responseText, "-1")) { if (!ComparatorUtils.equals(responseText, "-1")) {
array = new JSONArray(responseText); array = new JSONArray(responseText);
} }
hc.release();
return array; return array;
} catch (Exception e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage()); FineLoggerFactory.getLogger().error(e.getMessage());
@ -430,7 +416,6 @@ public class UpdateMainDialog extends UIDialog {
getUpdateInfoSuccess = true; getUpdateInfoSuccess = true;
//step4:update cache file,start from cacheRecordTime,end latest server jartime //step4:update cache file,start from cacheRecordTime,end latest server jartime
updateCachedInfoFile(jsonArray); updateCachedInfoFile(jsonArray);
afterInit();
} catch (Exception e) { } catch (Exception e) {
getUpdateInfoSuccess = true; getUpdateInfoSuccess = true;
FineLoggerFactory.getLogger().error(e.getMessage()); FineLoggerFactory.getLogger().error(e.getMessage());
@ -441,6 +426,7 @@ public class UpdateMainDialog extends UIDialog {
private void afterInit() { private void afterInit() {
if (autoUpdateAfterInit) { if (autoUpdateAfterInit) {
updateButton.setEnabled(true);
updateButton.doClick(); updateButton.doClick();
} }
} }
@ -454,7 +440,7 @@ public class UpdateMainDialog extends UIDialog {
return; return;
} }
if (cacheFile.exists()) { if (cacheFile.exists()) {
try (InputStreamReader streamReader = new InputStreamReader(new FileInputStream(cacheFile), "UTF-8"); try (InputStreamReader streamReader = new InputStreamReader(new FileInputStream(cacheFile), StandardCharsets.UTF_8);
BufferedReader br = new BufferedReader(streamReader)) { BufferedReader br = new BufferedReader(streamReader)) {
String readStr, updateTimeStr; String readStr, updateTimeStr;
while ((readStr = br.readLine()) != null) { while ((readStr = br.readLine()) != null) {
@ -499,8 +485,8 @@ public class UpdateMainDialog extends UIDialog {
if (endTime.equals(lastUpdateCacheTime) || jsonArray.length() == 0 || ComparatorUtils.compare(endTime, lastUpdateCacheTime) <= 0) { if (endTime.equals(lastUpdateCacheTime) || jsonArray.length() == 0 || ComparatorUtils.compare(endTime, lastUpdateCacheTime) <= 0) {
return; return;
} }
try (OutputStreamWriter writerStream = new OutputStreamWriter(new FileOutputStream(cacheFile), EncodeConstants.ENCODING_UTF_8); try (OutputStreamWriter writerStream = new OutputStreamWriter(new FileOutputStream(cacheFile), UTF_8)) {
BufferedWriter bufferWriter = new BufferedWriter(writerStream)) { try (BufferedWriter bufferWriter = new BufferedWriter(writerStream)) {
for (int i = 0; i < jsonArray.length(); i++) { for (int i = 0; i < jsonArray.length(); i++) {
JSONObject jo = (JSONObject) jsonArray.get(i); JSONObject jo = (JSONObject) jsonArray.get(i);
bufferWriter.write((String) jo.get("update") + '\t' + jo.get("title")); bufferWriter.write((String) jo.get("update") + '\t' + jo.get("title"));
@ -508,6 +494,7 @@ public class UpdateMainDialog extends UIDialog {
bufferWriter.flush(); bufferWriter.flush();
} }
} }
}
lastUpdateCacheState = UPDATE_CACHE_STATE_SUCCESS; lastUpdateCacheState = UPDATE_CACHE_STATE_SUCCESS;
lastUpdateCacheTime = endTime; lastUpdateCacheTime = endTime;
cacheProperty.updateProperty("updateTime", lastUpdateCacheTime); cacheProperty.updateProperty("updateTime", lastUpdateCacheTime);
@ -523,6 +510,9 @@ public class UpdateMainDialog extends UIDialog {
//形如 Build#release-2018.07.31.03.03.52.80 //形如 Build#release-2018.07.31.03.03.52.80
String currentNO = GeneralUtils.readBuildNO(); String currentNO = GeneralUtils.readBuildNO();
Date curJarDate = UPDATE_INFO_TABLE_FORMAT.parse(currentNO, new ParsePosition(currentNO.indexOf("-") + 1)); Date curJarDate = UPDATE_INFO_TABLE_FORMAT.parse(currentNO, new ParsePosition(currentNO.indexOf("-") + 1));
if (curJarDate == null) {
curJarDate = updateTime;
}
if (!ComparatorUtils.equals(keyword, StringUtils.EMPTY)) { if (!ComparatorUtils.equals(keyword, StringUtils.EMPTY)) {
if (!containsKeyword(UPDATE_INFO_TABLE_FORMAT.format(updateTime), keyword) && !containsKeyword(updateTitle, keyword)) { if (!containsKeyword(UPDATE_INFO_TABLE_FORMAT.format(updateTime), keyword) && !containsKeyword(updateTitle, keyword)) {
continue; continue;
@ -532,7 +522,7 @@ public class UpdateMainDialog extends UIDialog {
updateInfoList.add(new Object[]{UPDATE_INFO_TABLE_FORMAT.format(updateTime), updateTitle, updateTime.after(curJarDate)}); updateInfoList.add(new Object[]{UPDATE_INFO_TABLE_FORMAT.format(updateTime), updateTitle, updateTime.after(curJarDate)});
} }
} }
return new ArrayList<Object[]>(updateInfoList); return new ArrayList<>(updateInfoList);
} }
private boolean containsKeyword(String str, String keyword) { private boolean containsKeyword(String str, String keyword) {
@ -594,25 +584,26 @@ public class UpdateMainDialog extends UIDialog {
updateButton.addActionListener(new ActionListener() { updateButton.addActionListener(new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
if (updateSuccessful) { int a = JOptionPane.showConfirmDialog(getParent(), Toolkit.i18nText("Fine-Design_Update_Info_Information"),Toolkit.i18nText("Fine-Design_Update_Info_Title"), JOptionPane.OK_CANCEL_OPTION);
RestartHelper.restart(); if (a == 0) {
} else {
progressBar.setVisible(true); progressBar.setVisible(true);
progressBar.setString(Toolkit.i18nText("Fine-Design_Update_Info_Wait_Message"));
UpdateCallBack callBack = new UpdateProgressCallBack(progressBar); UpdateCallBack callBack = new UpdateProgressCallBack(progressBar);
deletePreviousPropertyFile();
updateButton.setEnabled(false); updateButton.setEnabled(false);
updateLabel.setVisible(false); updateLabel.setVisible(false);
new FileProcess(callBack) { new FileProcess(callBack) {
@Override @Override
public void onDownloadSuccess() { public void onDownloadSuccess() {
updateButton.setEnabled(true);
progressBar.setVisible(false); progressBar.setVisible(false);
updateSuccessful = true; deleteForDesignerUpdate();
updateButton.setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Updater_Restart_Designer")); RestartHelper.restart();
} }
@Override @Override
public void onDownloadFailed() { public void onDownloadFailed() {
progressBar.setVisible(false); progressBar.setVisible(false);
deleteForDesignerUpdate();
JOptionPane.showMessageDialog(getParent(), Toolkit.i18nText("Fine-Design_Update_Info_Failed_Message"));
RestartHelper.restart();
} }
}.execute(); }.execute();
} }
@ -620,22 +611,13 @@ public class UpdateMainDialog extends UIDialog {
}); });
} }
/** private void deleteForDesignerUpdate() {
* 确保升级更新之前删除以前的配置文件 File designerBackup = new File(StableUtils.pathJoin(StableUtils.getInstallHome(),UpdateConstants.DESIGNERBACKUPPATH));
*/ CommonUtils.deleteFile(designerBackup);
public static void deletePreviousPropertyFile() { File downloadForDesigner = new File(StableUtils.pathJoin(StableUtils.getInstallHome(),UpdateConstants.DOWNLOADPATH));
//在进行更新升级之前确保move和delete.properties删除 CommonUtils.deleteFile(downloadForDesigner);
File moveFile = new File(RestartHelper.MOVE_FILE);
File delFile = new File(RestartHelper.RECORD_FILE);
if ((moveFile.exists()) && (!moveFile.delete())) {
FineLoggerFactory.getLogger().error(RestartHelper.MOVE_FILE + "delete failed!");
}
if ((delFile.exists()) && (!delFile.delete())) {
FineLoggerFactory.getLogger().error(RestartHelper.RECORD_FILE + "delete failed!");
}
} }
//获取备份目录 //获取备份目录
private String getBackupDirectory() { private String getBackupDirectory() {
return UpdateConstants.DESIGNER_BACKUP_DIR; return UpdateConstants.DESIGNER_BACKUP_DIR;
@ -687,10 +669,8 @@ public class UpdateMainDialog extends UIDialog {
/** /**
* 检查有效性 * 检查有效性
* *
* @throws Exception
*/ */
@Override @Override
public void checkValid() throws Exception { public void checkValid() throws Exception {
} }
} }

15
designer-base/src/main/java/com/fr/design/upm/UpmFinder.java

@ -2,7 +2,9 @@ package com.fr.design.upm;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.design.dialog.UIDialog; import com.fr.design.dialog.UIDialog;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.update.ui.dialog.UpdateMainDialog;
import com.fr.event.Event; import com.fr.event.Event;
import com.fr.event.EventDispatcher; import com.fr.event.EventDispatcher;
import com.fr.event.Listener; import com.fr.event.Listener;
@ -51,11 +53,24 @@ public class UpmFinder {
} }
public static void showUPMDialog() { public static void showUPMDialog() {
boolean flag = true;
try {
Class.forName("com.teamdev.jxbrowser.chromium.Browser");
} catch (ClassNotFoundException e) {
flag = false;
}
if (flag) {
UpmShowPane upmPane = new UpmShowPane(); UpmShowPane upmPane = new UpmShowPane();
if (dialog == null) { if (dialog == null) {
dialog = new UpmShowDialog(DesignerContext.getDesignerFrame(), upmPane); dialog = new UpmShowDialog(DesignerContext.getDesignerFrame(), upmPane);
} }
dialog.setVisible(true); dialog.setVisible(true);
} else {
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Update_Info_Plugin_Message"));
UpdateMainDialog dialog = new UpdateMainDialog(DesignerContext.getDesignerFrame());
dialog.setAutoUpdateAfterInit();
dialog.showDialog();
}
} }
public static void closeWindow() { public static void closeWindow() {

2
designer-base/src/main/java/com/fr/design/upm/UpmShowDialog.java

@ -3,7 +3,6 @@ package com.fr.design.upm;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.UIDialog; import com.fr.design.dialog.UIDialog;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.stable.StableUtils;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;
@ -30,5 +29,6 @@ public class UpmShowDialog extends UIDialog {
@Override @Override
public void checkValid() throws Exception { public void checkValid() throws Exception {
} }
} }

3
designer-base/src/main/java/com/fr/design/upm/UpmShowPane.java

@ -27,7 +27,7 @@ public class UpmShowPane extends BasicPane {
return "UPM"; return "UPM";
} }
public UpmShowPane() { UpmShowPane() {
setLayout(new BorderLayout()); setLayout(new BorderLayout());
if (UpmFinder.checkUPMResourcesExist()) { if (UpmFinder.checkUPMResourcesExist()) {
modernUIPane = new ModernUIPane.Builder<>() modernUIPane = new ModernUIPane.Builder<>()
@ -65,5 +65,4 @@ public class UpmShowPane extends BasicPane {
} }
add(modernUIPane, BorderLayout.CENTER); add(modernUIPane, BorderLayout.CENTER);
} }
} }

19
designer-base/src/main/java/com/fr/design/utils/ImageUtils.java

@ -240,6 +240,7 @@ public class ImageUtils {
* @param opacityCompatible 是否处理背景透明 * @param opacityCompatible 是否处理背景透明
*/ */
public static BufferedImage scale(BufferedImage srcImg, float scale, boolean opacityCompatible) { public static BufferedImage scale(BufferedImage srcImg, float scale, boolean opacityCompatible) {
int scaleType;
if (scale < 0) { if (scale < 0) {
// 自动修正负数 // 自动修正负数
scale = -scale; scale = -scale;
@ -247,7 +248,15 @@ public class ImageUtils {
int width = mul(Integer.toString(srcImg.getWidth(null)), Float.toString(scale)).intValue(); // 得到源图宽 int width = mul(Integer.toString(srcImg.getWidth(null)), Float.toString(scale)).intValue(); // 得到源图宽
int height = mul(Integer.toString(srcImg.getHeight(null)), Float.toString(scale)).intValue(); // 得到源图长 int height = mul(Integer.toString(srcImg.getHeight(null)), Float.toString(scale)).intValue(); // 得到源图长
return CoreGraphHelper.toBufferedImage(scale(srcImg, width, height, opacityCompatible)); int srcHeight = srcImg.getHeight(null);
int srcWidth = srcImg.getWidth(null);
if (srcHeight < height || srcWidth < width) {
// 放大图片使用平滑模式
scaleType = Image.SCALE_SMOOTH;
} else {
scaleType = Image.SCALE_DEFAULT;
}
return CoreGraphHelper.toBufferedImage(scale(srcImg, width, height, opacityCompatible, scaleType));
} }
private static BigDecimal mul(String v1, String v2) { private static BigDecimal mul(String v1, String v2) {
@ -268,18 +277,12 @@ public class ImageUtils {
* @param opacityCompatible 是否处理背景透明 * @param opacityCompatible 是否处理背景透明
* @return {@link Image} * @return {@link Image}
*/ */
private static Image scale(BufferedImage srcImg, int width, int height, boolean opacityCompatible) { public static Image scale(BufferedImage srcImg, int width, int height, boolean opacityCompatible, int scaleType) {
int srcHeight = srcImg.getHeight(null); int srcHeight = srcImg.getHeight(null);
int srcWidth = srcImg.getWidth(null); int srcWidth = srcImg.getWidth(null);
int scaleType;
if (srcHeight == height && srcWidth == width) { if (srcHeight == height && srcWidth == width) {
// 源与目标长宽一致返回原图 // 源与目标长宽一致返回原图
return srcImg; return srcImg;
} else if (srcHeight < height || srcWidth < width) {
// 放大图片使用平滑模式
scaleType = Image.SCALE_SMOOTH;
} else {
scaleType = Image.SCALE_DEFAULT;
} }
if (opacityCompatible) {//需要保留透明度背景 if (opacityCompatible) {//需要保留透明度背景
BufferedImage toImg = CoreGraphHelper.createBufferedImage(width, height, srcImg.getType()); BufferedImage toImg = CoreGraphHelper.createBufferedImage(width, height, srcImg.getType());

13
designer-base/src/main/java/com/fr/design/web/CustomIconPane.java

@ -16,12 +16,12 @@ import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.utils.ImageUtils;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.form.ui.WidgetInfoConfig; import com.fr.form.ui.WidgetInfoConfig;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import com.fr.stable.CoreGraphHelper;
import com.fr.stable.ListMap; import com.fr.stable.ListMap;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.transaction.Configurations; import com.fr.transaction.Configurations;
@ -39,6 +39,9 @@ import java.awt.event.FocusEvent;
import java.awt.event.FocusListener; import java.awt.event.FocusListener;
import java.awt.geom.Rectangle2D; import java.awt.geom.Rectangle2D;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
/** /**
* carl自定义Icon编辑 * carl自定义Icon编辑
@ -452,13 +455,7 @@ public class CustomIconPane extends BasicPane {
String path = jf.getSelectedFile().getAbsolutePath(); String path = jf.getSelectedFile().getAbsolutePath();
// 图片存储有最大值48*48限制,没有超过最大值时,按原图大小存储,超过最大值后,压缩至最大值存储 // 图片存储有最大值48*48限制,没有超过最大值时,按原图大小存储,超过最大值后,压缩至最大值存储
Image image = BaseUtils.readImage(path); Image image = BaseUtils.readImage(path);
BufferedImage bufferedImage = CoreGraphHelper.createBufferedImage(Math.min(image.getWidth(null), IconManager.MAXSTORAGE_ICONWIDTH), iconImage = ImageUtils.scale((BufferedImage) image, Math.min(image.getWidth(null), IconManager.MAXSTORAGE_ICONWIDTH), Math.min(image.getHeight(null), IconManager.MAXSTORAGE_ICONHEIGHT), true, Image.SCALE_SMOOTH);
Math.min(image.getHeight(null), IconManager.MAXSTORAGE_ICONHEIGHT), BufferedImage.TYPE_INT_ARGB);
Graphics2D g2d = bufferedImage.createGraphics();
g2d.drawImage(image, 0, 0, Math.min(image.getWidth(null), IconManager.MAXSTORAGE_ICONWIDTH), Math.min(image.getHeight(null), IconManager.MAXSTORAGE_ICONHEIGHT), null);
bufferedImage.flush();
g2d.dispose();
iconImage = bufferedImage;
if (iconImage != null) { if (iconImage != null) {
showImageLabel.setIcon(new ImageIcon(iconImage)); showImageLabel.setIcon(new ImageIcon(iconImage));
} }

26
designer-base/src/test/java/com/fr/design/update/ui/dialog/RestoreResultDialogTest.java

@ -0,0 +1,26 @@
package com.fr.design.update.ui.dialog;
import com.fr.design.RestartHelper;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.StableUtils;
import org.junit.Assert;
import org.junit.Test;
import java.io.File;
import java.io.IOException;
public class RestoreResultDialogTest {
@Test
public void testDeletePreviousPropertyFile() {
File moveFile = new File(RestartHelper.MOVE_FILE);
File recordFile = new File(RestartHelper.RECORD_FILE);
try {
StableUtils.makesureFileExist(moveFile);
StableUtils.makesureFileExist(recordFile);
Assert.assertTrue(RestoreResultDialog.deletePreviousPropertyFile());
} catch (IOException e) {
FineLoggerFactory.getLogger().error(e.getMessage(),e);
}
}
}

8
designer-chart/src/main/java/com/fr/design/ChartTypeInterfaceManager.java

@ -165,7 +165,7 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
ChartWidgetOption[] child = new ChartWidgetOption[chartIDs.length]; ChartWidgetOption[] child = new ChartWidgetOption[chartIDs.length];
int index = 0; int index = 0;
for (String chartID : chartIDs) { for (String chartID : chartIDs) {
ChartProvider[] rowChart = ChartTypeManager.getInstance().getChartTypes(chartID); ChartProvider[] rowChart = ChartTypeManager.getInstance().getCharts(chartID);
if (ArrayUtils.isEmpty(rowChart) && !ChartTypeManager.innerChart(chartID)) { if (ArrayUtils.isEmpty(rowChart) && !ChartTypeManager.innerChart(chartID)) {
continue; continue;
} }
@ -364,7 +364,7 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
try { try {
//兼容 图表类型选择界面会调到这边 //兼容 图表类型选择界面会调到这边
ChartProvider[] charts = ChartTypeManager.getInstanceWithCheck().getChartTypes(chartID); ChartProvider[] charts = ChartTypeManager.getInstanceWithCheck().getCharts(chartID);
result = new String[charts.length]; result = new String[charts.length];
for (int i = 0; i < charts.length; i++) { for (int i = 0; i < charts.length; i++) {
//Chart && AbstractChart //Chart && AbstractChart
@ -403,7 +403,7 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
//兼容 //兼容
private String[] getCompatibleSubName(String chartID, ChartTypeUIProvider provider) { private String[] getCompatibleSubName(String chartID, ChartTypeUIProvider provider) {
ChartProvider[] chartProviders = ChartTypeManager.getInstanceWithCheck().getChartTypes(chartID); ChartProvider[] chartProviders = ChartTypeManager.getInstanceWithCheck().getCharts(chartID);
if (chartProviders.length == 1) { if (chartProviders.length == 1) {
return new String[]{getName(chartID)}; return new String[]{getName(chartID)};
@ -453,7 +453,7 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
try { try {
ChartProvider chartProvider = ChartTypeManager.getInstanceWithCheck().getChartTypes(chartID)[0]; ChartProvider chartProvider = ChartTypeManager.getInstanceWithCheck().getCharts(chartID)[0];
if (chartProvider instanceof Chart) { if (chartProvider instanceof Chart) {
//AbstractExtendedChartUIProvider //AbstractExtendedChartUIProvider
result = ((Chart) chartProvider).getChartName(); result = ((Chart) chartProvider).getChartName();

2
designer-chart/src/main/java/com/fr/design/chart/ChartTypePane.java

@ -126,7 +126,7 @@ public class ChartTypePane extends ChartCommonWizardPane {
ChartProvider chart4Update = cc.getSelectedChartProvider(); ChartProvider chart4Update = cc.getSelectedChartProvider();
if (chart4Update == null) { if (chart4Update == null) {
String plotID = this.chartIDs[mainTypeList.getSelectedIndex()]; String plotID = this.chartIDs[mainTypeList.getSelectedIndex()];
ChartProvider chart = ChartTypeManager.getInstance().getChartTypes(plotID)[iconViewList.getSelectedIndex()]; ChartProvider chart = ChartTypeManager.getInstance().getCharts(plotID)[iconViewList.getSelectedIndex()];
try { try {
chart4Update = (ChartProvider) chart.clone(); chart4Update = (ChartProvider) chart.clone();
cc.addChart(chart4Update); cc.addChart(chart4Update);

207
designer-chart/src/main/java/com/fr/design/chartx/component/HyperLinkPane.java

@ -0,0 +1,207 @@
package com.fr.design.chartx.component;
import com.fr.base.BaseFormula;
import com.fr.chart.web.ChartHyperPoplink;
import com.fr.chart.web.ChartHyperRelateCellLink;
import com.fr.chart.web.ChartHyperRelateFloatLink;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.chart.javascript.ChartEmailPane;
import com.fr.design.chart.series.SeriesCondition.impl.ChartHyperPoplinkPane;
import com.fr.design.chart.series.SeriesCondition.impl.ChartHyperRelateCellLinkPane;
import com.fr.design.chart.series.SeriesCondition.impl.ChartHyperRelateFloatLinkPane;
import com.fr.design.chart.series.SeriesCondition.impl.FormHyperlinkPane;
import com.fr.design.event.UIObserver;
import com.fr.design.event.UIObserverListener;
import com.fr.design.fun.HyperlinkProvider;
import com.fr.design.gui.controlpane.NameObjectCreator;
import com.fr.design.gui.controlpane.NameableCreator;
import com.fr.design.gui.controlpane.UIListControlPane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itoolbar.UIToolbar;
import com.fr.design.hyperlink.ReportletHyperlinkPane;
import com.fr.design.hyperlink.WebHyperlinkPane;
import com.fr.design.i18n.Toolkit;
import com.fr.design.javascript.JavaScriptImplPane;
import com.fr.design.javascript.ParameterJavaScriptPane;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.general.NameObject;
import com.fr.js.EmailJavaScript;
import com.fr.js.FormHyperlinkProvider;
import com.fr.js.JavaScript;
import com.fr.js.JavaScriptImpl;
import com.fr.js.NameJavaScript;
import com.fr.js.NameJavaScriptGroup;
import com.fr.js.ParameterJavaScript;
import com.fr.js.ReportletHyperlink;
import com.fr.js.WebHyperlink;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.Nameable;
import com.fr.stable.bridge.StableFactory;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import javax.swing.JPanel;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.awt.Component;
/**
* @author Bjorn
* @version 10.0
* Created by Bjorn on 2019-09-25
*/
public class HyperLinkPane extends UIListControlPane implements UIObserver {
private Map<String, BaseFormula> hyperLinkEditorMap;
private UIObserverListener uiObserverListener;
public HyperLinkPane() {
super();
this.setBorder(null);
}
@Override
public NameableCreator[] createNameableCreators() {
List<NameableCreator> creators = new ArrayList<NameableCreator>();
creators.add(new NameObjectCreator(Toolkit.i18nText("Fine-Design_Chart_Link_Reportlet"),
ReportletHyperlink.class, ReportletHyperlinkPane.class));
creators.add(new NameObjectCreator(Toolkit.i18nText("Fine-Design_Chart_Link_Mail"), EmailJavaScript.class, NewChartEmailPane.class));
creators.add(new NameObjectCreator(Toolkit.i18nText("Fine-Design_Chart_Link_Web"),
WebHyperlink.class, WebHyperlinkPane.class));
creators.add(new NameObjectCreator(Toolkit.i18nText("Fine-Design_Chart_Link_Dynamic_Parameters"),
ParameterJavaScript.class, ParameterJavaScriptPane.class));
creators.add(new NameObjectCreator("JavaScript", JavaScriptImpl.class, JavaScriptImplPane.class));
creators.add(new NameObjectCreator(Toolkit.i18nText("Fine-Design_Chart_Float_Chart"),
ChartHyperPoplink.class, ChartHyperPoplinkPane.class));
creators.add(new NameObjectCreator(Toolkit.i18nText("Fine-Design_Chart_Link_Cell"),
ChartHyperRelateCellLink.class, ChartHyperRelateCellLinkPane.class));
creators.add(new NameObjectCreator(Toolkit.i18nText("Fine-Design_Chart_Link_Float"),
ChartHyperRelateFloatLink.class, ChartHyperRelateFloatLinkPane.class));
FormHyperlinkProvider hyperlink = StableFactory.getMarkedInstanceObjectFromClass(FormHyperlinkProvider.XML_TAG, FormHyperlinkProvider.class);
creators.add(new NameObjectCreator(Toolkit.i18nText("Fine-Design_Chart_Link_Form"),
hyperlink.getClass(), FormHyperlinkPane.class));
Set<HyperlinkProvider> providers = ExtraDesignClassManager.getInstance().getArray(HyperlinkProvider.XML_TAG);
for (HyperlinkProvider provider : providers) {
NameableCreator nc = provider.createHyperlinkCreator();
creators.add(nc);
}
return creators.toArray(new NameableCreator[creators.size()]);
}
public BasicBeanPane createPaneByCreators(NameableCreator creator) {
Constructor<? extends BasicBeanPane> constructor;
try {
constructor = creator.getUpdatePane().getConstructor(HashMap.class, boolean.class);
return constructor.newInstance(hyperLinkEditorMap, false);
} catch (InstantiationException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
} catch (IllegalAccessException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
} catch (NoSuchMethodException e) {
return super.createPaneByCreators(creator);
} catch (InvocationTargetException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
return null;
}
@Override
public void registerChangeListener(UIObserverListener listener) {
uiObserverListener = listener;
}
@Override
public boolean shouldResponseChangeListener() {
return true;
}
@Override
protected JPanel getLeftTopPane(UIToolbar topToolBar) {
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH;
double[] columnSize = {f, e};
double[] rowSize = {p};
Component[][] components = new Component[][]{
new Component[]{new UILabel(getAddItemText()), topToolBar},
};
return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
}
@Override
public void saveSettings() {
if (isPopulating) {
return;
}
uiObserverListener.doChange();
}
public void update(NameJavaScriptGroup nameGroup) {
Nameable[] nameables = update();
nameGroup.clear();
for (int i = 0; i < nameables.length; i++) {
JavaScript javaScript = (JavaScript) ((NameObject) nameables[i]).getObject();
String name = nameables[i].getName();
NameJavaScript nameJava = new NameJavaScript(name, javaScript);
nameGroup.addNameHyperlink(nameJava);
}
}
public void populate(NameJavaScriptGroup nameGroup, Map<String, BaseFormula> hyperLinkEditorMap) {
this.hyperLinkEditorMap = hyperLinkEditorMap;
List<NameObject> nameObjects = new ArrayList<NameObject>();
for (int i = 0; nameGroup != null && i < nameGroup.size(); i++) {
NameJavaScript javaScript = nameGroup.getNameHyperlink(i);
if (javaScript != null && javaScript.getJavaScript() != null) {
JavaScript script = javaScript.getJavaScript();
nameObjects.add(new NameObject(javaScript.getName(), script));
}
}
this.populate(nameObjects.toArray(new NameObject[nameObjects.size()]));
doLayout();
}
/**
* 弹出列表的标题.
*
* @return 返回标题字符串.
*/
@Override
public String title4PopupWindow() {
return Toolkit.i18nText("Fine-Design_Report_Hyperlink");
}
@Override
protected String getAddItemText() {
return Toolkit.i18nText("Fine-Design_Basic_Add_Hyperlink");
}
//邮箱
public static class NewChartEmailPane extends ChartEmailPane {
@Override
protected boolean needRenamePane() {
return false;
}
}
}

12
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypePane.java

@ -19,15 +19,15 @@ import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Iterator; import java.util.Iterator;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
/** /**
* 图表 属性表, 类型选择 界面. * 图表 属性表, 类型选择 界面.
@ -124,7 +124,8 @@ public class ChartTypePane extends AbstractChartAttrPane{
String lastPlotID = chart.getID(); String lastPlotID = chart.getID();
try{ try{
ChartProvider newDefaultChart = (ChartProvider) ((AbstractChartTypePane) getSelectedPane()).getDefaultChart().clone(); AbstractChartTypePane selectedPane = (AbstractChartTypePane) getSelectedPane();
ChartProvider newDefaultChart =(ChartProvider) ChartTypeManager.getInstanceWithCheck().getCharts(selectedPane.getPlotID())[0].clone();
if (!ComparatorUtils.equals(chart.getClass(), newDefaultChart.getClass())) { if (!ComparatorUtils.equals(chart.getClass(), newDefaultChart.getClass())) {
//vanChart 和 chart 之间切换 //vanChart 和 chart 之间切换
//不同chart之间切换 //不同chart之间切换
@ -135,7 +136,6 @@ public class ChartTypePane extends AbstractChartAttrPane{
}catch (CloneNotSupportedException e){ }catch (CloneNotSupportedException e){
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
//这一步会替换plot //这一步会替换plot
((AbstractChartTypePane)getSelectedPane()).updateBean(chart); ((AbstractChartTypePane)getSelectedPane()).updateBean(chart);

36
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/ColorPickerPaneNumFiled.java

@ -1,9 +1,13 @@
package com.fr.design.mainframe.chart.gui.style.series; package com.fr.design.mainframe.chart.gui.style.series;
import java.util.Timer; import com.fr.concurrent.NamedThreadFactory;
import java.util.TimerTask;
import com.fr.design.gui.itextfield.UINumberField; import com.fr.design.gui.itextfield.UINumberField;
import com.fr.module.ModuleContext;
import com.fr.value.ClearableLazyValue;
import org.jetbrains.annotations.NotNull;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
/** /**
* Created with IntelliJ IDEA. * Created with IntelliJ IDEA.
@ -13,28 +17,34 @@ import com.fr.design.gui.itextfield.UINumberField;
* To change this template use File | Settings | File Templates. * To change this template use File | Settings | File Templates.
*/ */
public class ColorPickerPaneNumFiled extends UINumberField { public class ColorPickerPaneNumFiled extends UINumberField {
private Timer timer; private ClearableLazyValue<ScheduledExecutorService> ses = new ClearableLazyValue<ScheduledExecutorService>() {
@NotNull
@Override
protected ScheduledExecutorService compute() {
return ModuleContext.getExecutor()
.newSingleThreadScheduledExecutor(new NamedThreadFactory("FormatePaneNumFieldRunChange"));
}
};
public ColorPickerPaneNumFiled() { public ColorPickerPaneNumFiled() {
super(); super();
} }
@Override
protected void attributeChange() { protected void attributeChange() {
if(timer != null){ ses.getValue().schedule(new Runnable() {
timer.cancel();
}
timer = new Timer();
timer.schedule(new TimerTask() {
@Override @Override
public void run() { public void run() {
// kuns: 默认修改500, 在地图修改系列颜色text时, 快速响应.
runChange(); runChange();
} }
},500);// kuns: 默认修改500, 在地图修改系列颜色text时, 快速响应. }, 500, TimeUnit.MILLISECONDS);
} }
protected void runChange(){ protected void runChange() {
super.attributeChange(); super.attributeChange();
timer.cancel(); ses.getValue().shutdown();
ses.drop();
} }

2
designer-chart/src/main/java/com/fr/extended/chart/ExtendedTypePane.java

@ -67,7 +67,7 @@ public class ExtendedTypePane<T extends AbstractChart> extends AbstractChartType
@Override @Override
public ChartProvider getDefaultChart() { public ChartProvider getDefaultChart() {
return ChartTypeManager.getInstance().getChartTypes(getPlotID())[0]; return ChartTypeManager.getInstance().getCharts(getPlotID())[0];
} }
@Override @Override

7
designer-chart/src/main/java/com/fr/van/chart/heatmap/designer/HeatMapIndependentVanChartInterface.java

@ -38,6 +38,13 @@ public class HeatMapIndependentVanChartInterface extends MapIndependentVanChartI
return Toolkit.i18nText("Fine-Design_Chart_New_HeatMap"); return Toolkit.i18nText("Fine-Design_Chart_New_HeatMap");
} }
@Override
public String[] getSubName() {
return new String[]{
Toolkit.i18nText("Fine-Design_Chart_New_HeatMap"),
};
}
@Override @Override
public String[] getDemoImagePath() { public String[] getDemoImagePath() {
return new String[]{ return new String[]{

3
designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XCardAddButton.java

@ -92,6 +92,9 @@ public class XCardAddButton extends XButton {
if(cardLayout == null && tagLayout ==null ){ if(cardLayout == null && tagLayout ==null ){
initRelateLayout(); initRelateLayout();
} }
if (cardLayout == null) {
throw new IllegalArgumentException("cardLayout can not be null");
}
int index = cardLayout.toData().getWidgetCount(); int index = cardLayout.toData().getWidgetCount();
//添加新的tab,并将原来的设为未选中状态 //添加新的tab,并将原来的设为未选中状态

4
designer-form/src/main/java/com/fr/design/form/layout/FRTitleLayout.java

@ -126,15 +126,17 @@ public class FRTitleLayout implements FRLayoutManager, LayoutManager{
int titleH = title==null ? 0 : WTitleLayout.TITLE_HEIGHT; int titleH = title==null ? 0 : WTitleLayout.TITLE_HEIGHT;
for (int i=0; i< target.getComponentCount(); i++) { for (int i=0; i< target.getComponentCount(); i++) {
Component comp = target.getComponent(i); Component comp = target.getComponent(i);
if (comp != null) {
if (comp == title) { if (comp == title) {
comp.setBounds(0, 0, width, WTitleLayout.TITLE_HEIGHT); comp.setBounds(0, 0, width, WTitleLayout.TITLE_HEIGHT);
} else if (comp == body) { } else if (comp == body) {
int y = titleH+gap; int y = titleH + gap;
comp.setBounds(0, y, width, height-y); comp.setBounds(0, y, width, height-y);
} }
} }
} }
} }
}
public Object getConstraints(Component comp) { public Object getConstraints(Component comp) {
if (comp == null){ if (comp == null){

2
designer-form/src/main/java/com/fr/design/mainframe/EditingMouseListener.java

@ -573,8 +573,8 @@ public class EditingMouseListener extends MouseInputAdapter {
GUICoreUtils.showPopupMenu(cellPopupMenu, designer, e.getX(), e.getY()); GUICoreUtils.showPopupMenu(cellPopupMenu, designer, e.getX(), e.getY());
} }
} }
}
creator.doLayout(); creator.doLayout();
}
LayoutUtils.layoutRootContainer(designer.getRootComponent()); LayoutUtils.layoutRootContainer(designer.getRootComponent());
} }

62
designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java

@ -30,6 +30,7 @@ import com.fr.stable.xml.XMLTools;
import com.fr.stable.xml.XMLWriter; import com.fr.stable.xml.XMLWriter;
import com.fr.stable.xml.XMLableReader; import com.fr.stable.xml.XMLableReader;
import com.fr.third.javax.xml.stream.XMLStreamException; import com.fr.third.javax.xml.stream.XMLStreamException;
import com.sun.management.OperatingSystemMXBean;
import java.io.BufferedWriter; import java.io.BufferedWriter;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
@ -43,11 +44,14 @@ import java.io.InputStream;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.io.OutputStreamWriter; import java.io.OutputStreamWriter;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.lang.management.ManagementFactory;
import java.nio.charset.StandardCharsets;
import java.text.DateFormat; import java.text.DateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Objects;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
@ -58,9 +62,12 @@ import java.util.concurrent.TimeUnit;
*/ */
public class InformationCollector implements XMLReadable, XMLWriter { public class InformationCollector implements XMLReadable, XMLWriter {
// 24小时上传一次 /**
* 24小时上传一次
*/
private static final long DELTA = 24 * 3600 * 1000L; private static final long DELTA = 24 * 3600 * 1000L;
private static final long SEND_DELAY = 300 * 1000L; private static final long SEND_DELAY = 300 * 1000L;
private static final int BYTE_TO_MB = 1024 * 1024;
private static final String FILE_NAME = "fr.info"; private static final String FILE_NAME = "fr.info";
private static final String XML_START_STOP_LIST = "StartStopList"; private static final String XML_START_STOP_LIST = "StartStopList";
private static final String XML_START_STOP = "StartStop"; private static final String XML_START_STOP = "StartStop";
@ -73,12 +80,20 @@ public class InformationCollector implements XMLReadable, XMLWriter {
private static final String XML_UUID = "UUID"; private static final String XML_UUID = "UUID";
private static final String XML_KEY = "ActiveKey"; private static final String XML_KEY = "ActiveKey";
private static final String XML_OS = "OS"; private static final String XML_OS = "OS";
private static final String XML_ARCH = "arch";
private static final String XML_AVAILABLE_PROCESSORS = "cpu";
private static final String XML_PHYSICAL_MEMORY = "systemMemory";
private static InformationCollector collector; private static InformationCollector collector;
//启动时间与关闭时间列表 /**
* 启动时间与关闭时间列表
*/
private List<StartStopTime> startStop = new ArrayList<StartStopTime>(); private List<StartStopTime> startStop = new ArrayList<StartStopTime>();
//上一次的发送时间
/**
* 上一次的发送时间
*/
private String lastTime; private String lastTime;
private StartStopTime current = new StartStopTime(); private StartStopTime current = new StartStopTime();
@ -130,7 +145,7 @@ public class InformationCollector implements XMLReadable, XMLWriter {
} }
try { try {
return DateUtils.string2Date(this.lastTime, true).getTime(); return Objects.requireNonNull(DateUtils.string2Date(this.lastTime, true)).getTime();
} catch (Exception e) { } catch (Exception e) {
return -1; return -1;
} }
@ -141,11 +156,12 @@ public class InformationCollector implements XMLReadable, XMLWriter {
JSONObject content = new JSONObject(); JSONObject content = new JSONObject();
JSONArray startStopArray = new JSONArray(); JSONArray startStopArray = new JSONArray();
for (int i = 0; i < startStop.size(); i++) { for (StartStopTime startStopTime : startStop) {
JSONObject jo = new JSONObject(); JSONObject jo = new JSONObject();
jo.put(ATTR_START, startStop.get(i).getStartDate()); jo.put(ATTR_START, startStopTime.getStartDate());
jo.put(ATTR_STOP, startStop.get(i).getStopDate()); jo.put(ATTR_STOP, startStopTime.getStopDate());
startStopArray.put(jo); startStopArray.put(jo);
}
DesignerEnvManager envManager = DesignerEnvManager.getEnvManager(); DesignerEnvManager envManager = DesignerEnvManager.getEnvManager();
content.put(XML_START_STOP, startStopArray); content.put(XML_START_STOP, startStopArray);
content.put(XML_UUID, envManager.getUUID()); content.put(XML_UUID, envManager.getUUID());
@ -154,12 +170,25 @@ public class InformationCollector implements XMLReadable, XMLWriter {
content.put(XML_USERNAME, MarketConfig.getInstance().getBbsUsername()); content.put(XML_USERNAME, MarketConfig.getInstance().getBbsUsername());
content.put(XML_KEY, envManager.getActivationKey()); content.put(XML_KEY, envManager.getActivationKey());
content.put(XML_OS, System.getProperty("os.name")); content.put(XML_OS, System.getProperty("os.name"));
} content.put(XML_ARCH, System.getProperty("os.arch"));
content.put(XML_AVAILABLE_PROCESSORS, Runtime.getRuntime().availableProcessors());
content.put(XML_PHYSICAL_MEMORY, getTotalPhysicalMemorySize());
return content; return content;
} }
/**
* 获取物理内存单位GB
*
* @return 物理内存
*/
private static long getTotalPhysicalMemorySize() {
OperatingSystemMXBean bean = (OperatingSystemMXBean) ManagementFactory.getOperatingSystemMXBean();
return bean.getTotalPhysicalMemorySize() / BYTE_TO_MB;
}
private void sendUserInfo() { private void sendUserInfo() {
long currentTime = new Date().getTime(); long currentTime = System.currentTimeMillis();
long lastTime = getLastTimeMillis(); long lastTime = getLastTimeMillis();
if (currentTime - lastTime <= DELTA) { if (currentTime - lastTime <= DELTA) {
@ -196,7 +225,8 @@ public class InformationCollector implements XMLReadable, XMLWriter {
return; return;
} }
ScheduledExecutorService service = Executors.newSingleThreadScheduledExecutor(new NamedThreadFactory("InformationCollector")); ScheduledExecutorService service = Executors
.newSingleThreadScheduledExecutor(new NamedThreadFactory("InformationCollector"));
service.schedule(new Runnable() { service.schedule(new Runnable() {
@Override @Override
public void run() { public void run() {
@ -206,6 +236,7 @@ public class InformationCollector implements XMLReadable, XMLWriter {
ErrorInfoUploader.getInstance().sendErrorInfo(); ErrorInfoUploader.getInstance().sendErrorInfo();
} }
}, SEND_DELAY, TimeUnit.MILLISECONDS); }, SEND_DELAY, TimeUnit.MILLISECONDS);
service.shutdown();
} }
/** /**
@ -239,7 +270,7 @@ public class InformationCollector implements XMLReadable, XMLWriter {
XMLTools.writeOutputStreamXML(this, out); XMLTools.writeOutputStreamXML(this, out);
out.flush(); out.flush();
out.close(); out.close();
String fileContent = new String(out.toByteArray(), EncodeConstants.ENCODING_UTF_8); String fileContent = new String(out.toByteArray(), StandardCharsets.UTF_8);
String encodeCotent = DesUtils.getEncString(fileContent); String encodeCotent = DesUtils.getEncString(fileContent);
writeEncodeContentToFile(encodeCotent, xmlFile); writeEncodeContentToFile(encodeCotent, xmlFile);
} catch (Exception e) { } catch (Exception e) {
@ -253,7 +284,7 @@ public class InformationCollector implements XMLReadable, XMLWriter {
*/ */
private static void writeEncodeContentToFile(String fileContent, File file) { private static void writeEncodeContentToFile(String fileContent, File file) {
try (FileOutputStream fos = new FileOutputStream(file); try (FileOutputStream fos = new FileOutputStream(file);
OutputStreamWriter osw = new OutputStreamWriter(fos, EncodeConstants.ENCODING_UTF_8); OutputStreamWriter osw = new OutputStreamWriter(fos, StandardCharsets.UTF_8);
BufferedWriter bw = new BufferedWriter(osw)) { BufferedWriter bw = new BufferedWriter(osw)) {
bw.write(fileContent); bw.write(fileContent);
} catch (Exception e) { } catch (Exception e) {
@ -276,8 +307,8 @@ public class InformationCollector implements XMLReadable, XMLWriter {
private void writeStartStopList(XMLPrintWriter writer) { private void writeStartStopList(XMLPrintWriter writer) {
//启停 //启停
writer.startTAG(XML_START_STOP_LIST); writer.startTAG(XML_START_STOP_LIST);
for (int i = 0; i < startStop.size(); i++) { for (StartStopTime startStopTime : startStop) {
startStop.get(i).writeXML(writer); startStopTime.writeXML(writer);
} }
writer.end(); writer.end();
} }
@ -315,6 +346,7 @@ public class InformationCollector implements XMLReadable, XMLWriter {
startStop.clear(); startStop.clear();
reader.readXMLObject(new XMLReadable() { reader.readXMLObject(new XMLReadable() {
@Override
public void readXML(XMLableReader reader) { public void readXML(XMLableReader reader) {
if (XML_START_STOP.equals(reader.getTagName())) { if (XML_START_STOP.equals(reader.getTagName())) {
StartStopTime startStopTime = new StartStopTime(); StartStopTime startStopTime = new StartStopTime();
@ -346,6 +378,7 @@ public class InformationCollector implements XMLReadable, XMLWriter {
this.stopDate = endDate; this.stopDate = endDate;
} }
@Override
public void writeXML(XMLPrintWriter writer) { public void writeXML(XMLPrintWriter writer) {
writer.startTAG(XML_START_STOP); writer.startTAG(XML_START_STOP);
if (StringUtils.isNotEmpty(startDate)) { if (StringUtils.isNotEmpty(startDate)) {
@ -357,6 +390,7 @@ public class InformationCollector implements XMLReadable, XMLWriter {
writer.end(); writer.end();
} }
@Override
public void readXML(XMLableReader reader) { public void readXML(XMLableReader reader) {
this.startDate = reader.getAttrAsString(ATTR_START, StringUtils.EMPTY); this.startDate = reader.getAttrAsString(ATTR_START, StringUtils.EMPTY);
this.stopDate = reader.getAttrAsString(ATTR_STOP, StringUtils.EMPTY); this.stopDate = reader.getAttrAsString(ATTR_STOP, StringUtils.EMPTY);

9
designer-realize/src/main/java/com/fr/design/mainframe/messagecollect/StartupMessageCollector.java

@ -8,6 +8,7 @@ import com.fr.event.EventDispatcher;
import com.fr.event.Listener; import com.fr.event.Listener;
import com.fr.general.CloudCenter; import com.fr.general.CloudCenter;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralUtils;
import com.fr.general.http.HttpToolbox; import com.fr.general.http.HttpToolbox;
import com.fr.json.JSONObject; import com.fr.json.JSONObject;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
@ -30,14 +31,15 @@ public class StartupMessageCollector {
private static final String XML_STARTUP_TIME = "t"; private static final String XML_STARTUP_TIME = "t";
private static final String XML_STARTUP_LOG = "startupLog"; private static final String XML_STARTUP_LOG = "startupLog";
private static final String XML_STARTUP_Memory = "designerMemory"; private static final String XML_STARTUP_MEMORY = "designerMemory";
private static final String XML_STARTUP_COST = "cost"; private static final String XML_STARTUP_COST = "cost";
private static final String XML_UUID = "UUID"; private static final String XML_UUID = "UUID";
private static final String XML_BUILD_NO = "buildNO";
private static final String STARTUP_URL_KEY = "user.info.v10.startup"; private static final String STARTUP_URL_KEY = "user.info.v10.startup";
private static final String LOG_TYPE = "single"; private static final String LOG_TYPE = "single";
private static final int BYTE_TO_MB = 1024 * 1024; private static final int BYTE_TO_MB = 1024 * 1024;
public static final StartupMessageCollector INSTANCE = new StartupMessageCollector(); private static final StartupMessageCollector INSTANCE = new StartupMessageCollector();
private StartupMessageCollector() { private StartupMessageCollector() {
} }
@ -67,10 +69,11 @@ public class StartupMessageCollector {
} }
JSONObject json = JSONObject.create() JSONObject json = JSONObject.create()
.put(XML_UUID, DesignerEnvManager.getEnvManager().getUUID()) .put(XML_UUID, DesignerEnvManager.getEnvManager().getUUID())
.put(XML_BUILD_NO, GeneralUtils.readBuildNO())
.put(XML_STARTUP_TIME, FineRuntime.getAppStartTime() + FineRuntime.getStartingTime()) .put(XML_STARTUP_TIME, FineRuntime.getAppStartTime() + FineRuntime.getStartingTime())
.put(XML_STARTUP_COST, FineRuntime.getStartingTime()) .put(XML_STARTUP_COST, FineRuntime.getStartingTime())
.put(XML_STARTUP_LOG, profile) .put(XML_STARTUP_LOG, profile)
.put(XML_STARTUP_Memory, Runtime.getRuntime().totalMemory() / BYTE_TO_MB); .put(XML_STARTUP_MEMORY, Runtime.getRuntime().maxMemory() / BYTE_TO_MB);
sendInfo(json, url + LOG_TYPE); sendInfo(json, url + LOG_TYPE);
} }
}); });

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

@ -8,6 +8,7 @@ import com.fr.base.passport.FinePassportManager;
import com.fr.base.process.ProcessOperator; import com.fr.base.process.ProcessOperator;
import com.fr.chart.chartattr.ChartCollection; import com.fr.chart.chartattr.ChartCollection;
import com.fr.config.MarketConfig; import com.fr.config.MarketConfig;
import com.fr.decision.update.backup.RecoverManager;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.ExtraDesignClassManager; import com.fr.design.ExtraDesignClassManager;
import com.fr.design.actions.NewFormAction; import com.fr.design.actions.NewFormAction;
@ -57,6 +58,7 @@ import com.fr.design.module.DesignModuleFactory;
import com.fr.design.parameter.FormParameterReader; import com.fr.design.parameter.FormParameterReader;
import com.fr.design.parameter.ParameterPropertyPane; import com.fr.design.parameter.ParameterPropertyPane;
import com.fr.design.parameter.WorkBookParameterReader; import com.fr.design.parameter.WorkBookParameterReader;
import com.fr.design.update.actions.RecoverForDesigner;
import com.fr.design.widget.ui.btn.FormSubmitButtonDetailPane; import com.fr.design.widget.ui.btn.FormSubmitButtonDetailPane;
import com.fr.form.stable.ElementCaseThumbnailProcessor; import com.fr.form.stable.ElementCaseThumbnailProcessor;
import com.fr.general.xml.GeneralXMLTools; import com.fr.general.xml.GeneralXMLTools;
@ -128,6 +130,7 @@ public class DesignerActivator extends Activator {
UserInfoPane.getInstance().updateBBSUserInfo(); UserInfoPane.getInstance().updateBBSUserInfo();
storePassport(); storePassport();
AlphaFineHelper.switchConfig4Locale(); AlphaFineHelper.switchConfig4Locale();
RecoverManager.register(new RecoverForDesigner());
} }
@Override @Override

Loading…
Cancel
Save