Browse Source

Merge pull request #16 in ~NEIL/design from feature/10.0 to release/10.0

* commit '9b277e3062d56fe15442ee28e12ab86104048084':
  REPORT-16556 @xiaoxia 大模版进入模版版本比较慢
  无JIRA任务 增加配置项默认值
  REPORT-16559
  rt
  REPORT-16559
  REPORT-16559
  REPORT-16547
  REPORT-16547 bug fix
  REPORT-16547
  REPORT-15314 103模板信息收集=>修复报错&修正判定制作完成的逻辑
  bug fix
  REPORT-16458 设计器中更新日志推送弹框显示不全=>显示更多新特性
  REPORT-16550  REPORT-16547
  REPORT-16458 设计器中更新日志推送弹框显示不全=>文字不全
  REPORT-14865 更新日志推送=>显示最新版本号
bugfix/10.0
neil 6 years ago
parent
commit
0ac9268410
  1. 5
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java
  2. 2
      designer-base/src/main/java/com/fr/design/mainframe/DesktopCardPane.java
  3. 5
      designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java
  4. 12
      designer-base/src/main/java/com/fr/design/mainframe/template/info/DesignerOpenHistory.java
  5. 2
      designer-base/src/main/java/com/fr/design/mainframe/template/info/TemplateInfo.java
  6. 11
      designer-base/src/main/java/com/fr/design/mainframe/template/info/TemplateInfoCollector.java
  7. 8
      designer-base/src/main/java/com/fr/design/mainframe/vcs/VcsConfigManager.java
  8. 41
      designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java
  9. 7
      designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/EditFileVersionDialog.java
  10. 5
      designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionCellEditor.java
  11. 5
      designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionDialog.java
  12. 4
      designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionRowPanel.java
  13. 5
      designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionsPanel.java
  14. 16
      designer-base/src/main/java/com/fr/design/update/push/DesignerPushUpdateDialog.java
  15. 14
      designer-base/src/main/resources/com/fr/design/ui/update/push/pushUpdate.css
  16. 12
      designer-base/src/main/resources/com/fr/design/ui/update/push/pushUpdate.js
  17. 12
      designer-base/src/test/java/com/fr/design/mainframe/template/info/DesignerOpenHistoryTest.java
  18. 14
      designer-realize/src/main/java/com/fr/start/Designer.java

5
designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java

@ -299,11 +299,6 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
boolean isCurrentEditing = isCurrentEditing(path); boolean isCurrentEditing = isCurrentEditing(path);
// 如果模板正在编辑,保存后再打开版本管理
if (isCurrentEditing) {
saveCurrentEditingTemplate();
}
// 如果模板已经打开了,关掉,避免出现2个同名tab(1个是模板,1个是版本) // 如果模板已经打开了,关掉,避免出现2个同名tab(1个是模板,1个是版本)
closeOpenedTemplate(path, isCurrentEditing); closeOpenedTemplate(path, isCurrentEditing);
FileVersionsPanel fileVersionTablePanel = FileVersionsPanel.getInstance(); FileVersionsPanel fileVersionTablePanel = FileVersionsPanel.getInstance();

2
designer-base/src/main/java/com/fr/design/mainframe/DesktopCardPane.java

@ -30,7 +30,7 @@ public class DesktopCardPane extends BasicPane implements TargetModifiedListener
// 判断是否切换设计器状态到禁止拷贝剪切 // 判断是否切换设计器状态到禁止拷贝剪切
if (jt.getTarget().getAttrMark(DesignBanCopyAttrMark.XML_TAG) != null) { if (jt.getTarget().getAttrMark(DesignBanCopyAttrMark.XML_TAG) != null) {
DesignModeContext.switchTo(DesignerMode.BAN_COPY_AND_CUT); DesignModeContext.switchTo(DesignerMode.BAN_COPY_AND_CUT);
} else { } else if (!DesignModeContext.isVcsMode()){
DesignModeContext.switchTo(DesignerMode.NORMAL); DesignModeContext.switchTo(DesignerMode.NORMAL);
} }
DesignerFrameFileDealerPane.getInstance().setCurrentEditingTemplate(jt); DesignerFrameFileDealerPane.getInstance().setCurrentEditingTemplate(jt);

5
designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java

@ -112,7 +112,7 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
// 判断是否切换设计器状态到禁止拷贝剪切 // 判断是否切换设计器状态到禁止拷贝剪切
if (t.getAttrMark(DesignBanCopyAttrMark.XML_TAG) != null) { if (t.getAttrMark(DesignBanCopyAttrMark.XML_TAG) != null) {
DesignModeContext.switchTo(com.fr.design.base.mode.DesignerMode.BAN_COPY_AND_CUT); DesignModeContext.switchTo(com.fr.design.base.mode.DesignerMode.BAN_COPY_AND_CUT);
} else { } else if (!DesignModeContext.isVcsMode()) {
DesignModeContext.switchTo(com.fr.design.base.mode.DesignerMode.NORMAL); DesignModeContext.switchTo(com.fr.design.base.mode.DesignerMode.NORMAL);
} }
this.template = t; this.template = t;
@ -543,9 +543,6 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
return false; return false;
} }
collectInfo(); collectInfo();
if (DesignerEnvManager.getEnvManager().getVcsConfigManager().isVcsEnable()) {
VcsHelper.dealWithVcs(this);
}
return this.saveFile(); return this.saveFile();
} }

12
designer-base/src/main/java/com/fr/design/mainframe/template/info/DesignerOpenHistory.java

@ -48,6 +48,18 @@ class DesignerOpenHistory implements XMLReadable, XMLWriter {
history[0] = today; history[0] = today;
} }
/**
* 设计器在 dayCount 时间内启动超过 X 目前定的 X = 3
*/
boolean isOpenEnoughTimesInPeriod(int dayCount) {
boolean enoughTimes = StringUtils.isNotEmpty(history[LENGTH - 1]);
if (!enoughTimes) {
return false;
}
return getHistorySpanDayCount() < dayCount;
}
/** /**
* 获取历史记录中囊括的日子数即最早的历史记录 history[LENGTH - 1]到最晚的记录 history[0] 之间的时间跨度 * 获取历史记录中囊括的日子数即最早的历史记录 history[LENGTH - 1]到最晚的记录 history[0] 之间的时间跨度
*/ */

2
designer-base/src/main/java/com/fr/design/mainframe/template/info/TemplateInfo.java

@ -211,7 +211,7 @@ class TemplateInfo implements XMLReadable, XMLWriter {
// 条件 2. 设计器在这段未编辑的时间内启动超过 X 次(目前定的 X = 3)。即"设计器最近 X 次启动的时间跨度" < "未编辑时间"; // 条件 2. 设计器在这段未编辑的时间内启动超过 X 次(目前定的 X = 3)。即"设计器最近 X 次启动的时间跨度" < "未编辑时间";
return idleDayCount > COMPLETE_DAY_COUNT return idleDayCount > COMPLETE_DAY_COUNT
&& DesignerOpenHistory.getInstance().getHistorySpanDayCount() < idleDayCount; && DesignerOpenHistory.getInstance().isOpenEnoughTimesInPeriod(idleDayCount);
} }
String getConsumingMapJsonString() { String getConsumingMapJsonString() {

11
designer-base/src/main/java/com/fr/design/mainframe/template/info/TemplateInfoCollector.java

@ -20,6 +20,7 @@ import java.io.FileOutputStream;
import java.io.FileReader; import java.io.FileReader;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
@ -101,16 +102,22 @@ public class TemplateInfoCollector implements XMLReadable, XMLWriter {
removeTestTemplates(); removeTestTemplates();
List<String> removeLaterList = new ArrayList<>();
for (String key : templateInfoMap.keySet()) { for (String key : templateInfoMap.keySet()) {
TemplateInfo templateInfo = templateInfoMap.get(key); TemplateInfo templateInfo = templateInfoMap.get(key);
if (templateInfo.isReadyForSend()) { if (templateInfo.isReadyForSend()) {
if (SendHelper.sendTemplateInfo(templateInfo)) { if (SendHelper.sendTemplateInfo(templateInfo)) {
// 清空记录 removeLaterList.add(key);
removeFromTemplateInfoList(templateInfo.getTemplateID());
} }
} }
} }
// 清空记录
for (String key : removeLaterList) {
removeFromTemplateInfoList(key);
}
saveInfo(); saveInfo();
} }

8
designer-base/src/main/java/com/fr/design/mainframe/vcs/VcsConfigManager.java

@ -11,10 +11,10 @@ import com.fr.stable.xml.XMLableReader;
public class VcsConfigManager implements XMLReadable, XMLWriter { public class VcsConfigManager implements XMLReadable, XMLWriter {
public static final String XML_TAG = "VcsConfigManager"; public static final String XML_TAG = "VcsConfigManager";
private static volatile VcsConfigManager instance = new VcsConfigManager(); private static volatile VcsConfigManager instance = new VcsConfigManager();
private boolean vcsEnable; private boolean vcsEnable = true;
private boolean saveCommit; private boolean saveCommit = true;
private boolean useInterval; private boolean useInterval = true;
private int saveInterval; private int saveInterval = 60;
public static VcsConfigManager getInstance() { public static VcsConfigManager getInstance() {
return instance; return instance;

41
designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java

@ -30,25 +30,11 @@ import static com.fr.stable.StableUtils.pathJoin;
*/ */
public class VcsHelper { public class VcsHelper {
private final static String VCS_DIR = "vcs";
public final static String VCS_CACHE_DIR = pathJoin(VCS_DIR, "cache");
private static final int MINUTE = 60 * 1000;
private final static String VCS_PLUGIN_ID = "com.fr.plugin.vcs.v10";
public final static String CURRENT_USERNAME = WorkContext.getCurrent().isLocal()
? Toolkit.i18nText("Fine-Design_Vcs_Local_User")
: WorkContext.getCurrent().getConnection().getUserName();
public final static Color TABLE_SELECT_BACKGROUND = new Color(0xD8F2FD); public final static Color TABLE_SELECT_BACKGROUND = new Color(0xD8F2FD);
public final static Color COPY_VERSION_BTN_COLOR = new Color(0x419BF9); public final static Color COPY_VERSION_BTN_COLOR = new Color(0x419BF9);
public final static EmptyBorder EMPTY_BORDER = new EmptyBorder(10, 10, 0, 10); public final static EmptyBorder EMPTY_BORDER = new EmptyBorder(10, 10, 0, 10);
public final static EmptyBorder EMPTY_BORDER_MEDIUM = new EmptyBorder(5, 10, 0, 10);
public final static EmptyBorder EMPTY_BORDER_BOTTOM = new EmptyBorder(10, 10, 10, 10); public final static EmptyBorder EMPTY_BORDER_BOTTOM = new EmptyBorder(10, 10, 10, 10);
public final static Icon VCS_LIST_PNG = IOUtils.readIcon("/com/fr/design/images/vcs/vcs_list.png"); public final static Icon VCS_LIST_PNG = IOUtils.readIcon("/com/fr/design/images/vcs/vcs_list.png");
public final static Icon VCS_BACK_PNG = IOUtils.readIcon("/com/fr/design/images/vcs/vcs_back.png"); public final static Icon VCS_BACK_PNG = IOUtils.readIcon("/com/fr/design/images/vcs/vcs_back.png");
public final static Icon VCS_FILTER_PNG = IOUtils.readIcon("/com/fr/design/images/vcs/icon_filter@1x.png"); public final static Icon VCS_FILTER_PNG = IOUtils.readIcon("/com/fr/design/images/vcs/icon_filter@1x.png");
@ -56,6 +42,10 @@ public class VcsHelper {
public final static Icon VCS_DELETE_PNG = IOUtils.readIcon("/com/fr/design/images/vcs/icon_delete.png"); public final static Icon VCS_DELETE_PNG = IOUtils.readIcon("/com/fr/design/images/vcs/icon_delete.png");
public final static Icon VCS_USER_PNG = IOUtils.readIcon("/com/fr/design/images/vcs/icon_user@1x.png"); public final static Icon VCS_USER_PNG = IOUtils.readIcon("/com/fr/design/images/vcs/icon_user@1x.png");
public final static Icon VCS_REVERT = IOUtils.readIcon("/com/fr/design/images/vcs/icon_revert.png"); public final static Icon VCS_REVERT = IOUtils.readIcon("/com/fr/design/images/vcs/icon_revert.png");
private final static String VCS_DIR = "vcs";
public final static String VCS_CACHE_DIR = pathJoin(VCS_DIR, "cache");
private static final int MINUTE = 60 * 1000;
private final static String VCS_PLUGIN_ID = "com.fr.plugin.vcs.v10";
private static int containsFolderCounts() { private static int containsFolderCounts() {
TemplateFileTree fileTree = TemplateTreePane.getInstance().getTemplateFileTree(); TemplateFileTree fileTree = TemplateTreePane.getInstance().getTemplateFileTree();
@ -71,6 +61,12 @@ public class VcsHelper {
return fileTree.getSelectionPaths().length - fileTree.getSelectedTemplatePaths().length; return fileTree.getSelectionPaths().length - fileTree.getSelectedTemplatePaths().length;
} }
public static String getCurrentUsername() {
return WorkContext.getCurrent().isLocal()
? Toolkit.i18nText("Fine-Design_Vcs_Local_User")
: WorkContext.getCurrent().getConnection().getUserName();
}
private static int selectedTemplateCounts() { private static int selectedTemplateCounts() {
TemplateFileTree fileTree = TemplateTreePane.getInstance().getTemplateFileTree(); TemplateFileTree fileTree = TemplateTreePane.getInstance().getTemplateFileTree();
if (fileTree.getSelectionPaths() == null) { if (fileTree.getSelectionPaths() == null) {
@ -99,10 +95,14 @@ public class VcsHelper {
} }
public static boolean needDeleteVersion(VcsEntity entity) { public static boolean needDeleteVersion(VcsEntity entity) {
if (entity == null || !DesignerEnvManager.getEnvManager().getVcsConfigManager().isUseInterval()) { VcsConfigManager configManager = DesignerEnvManager.getEnvManager().getVcsConfigManager();
if (entity == null || !configManager.isUseInterval()) {
return false;
}
if (configManager.isSaveCommit() && StringUtils.isNotBlank(entity.getCommitMsg())) {
return false; return false;
} }
return new Date().getTime() - entity.getTime().getTime() < DesignerEnvManager.getEnvManager().getVcsConfigManager().getSaveInterval() * MINUTE && StringUtils.isBlank(entity.getCommitMsg()); return new Date().getTime() - entity.getTime().getTime() < DesignerEnvManager.getEnvManager().getVcsConfigManager().getSaveInterval() * MINUTE;
} }
public static boolean needInit() { public static boolean needInit() {
@ -112,6 +112,7 @@ public class VcsHelper {
/** /**
* 版本控制 * 版本控制
*
* @param jt * @param jt
*/ */
public static void dealWithVcs(final JTemplate jt) { public static void dealWithVcs(final JTemplate jt) {
@ -119,7 +120,7 @@ public class VcsHelper {
@Override @Override
public void run() { public void run() {
String fileName = VcsHelper.getEditingFilename(); String fileName = getEditingFilename();
VcsOperator operator = WorkContext.getCurrent().get(VcsOperator.class); VcsOperator operator = WorkContext.getCurrent().get(VcsOperator.class);
VcsEntity entity = operator.getFileVersionByIndex(fileName, 0); VcsEntity entity = operator.getFileVersionByIndex(fileName, 0);
int latestFileVersion = 0; int latestFileVersion = 0;
@ -127,11 +128,11 @@ public class VcsHelper {
latestFileVersion = entity.getVersion(); latestFileVersion = entity.getVersion();
} }
if (jt.getEditingFILE() instanceof VcsCacheFileNodeFile) { if (jt.getEditingFILE() instanceof VcsCacheFileNodeFile) {
operator.saveVersionFromCache(VcsHelper.CURRENT_USERNAME, fileName, StringUtils.EMPTY, latestFileVersion + 1); operator.saveVersionFromCache(getCurrentUsername(), fileName, StringUtils.EMPTY, latestFileVersion + 1);
String path = DesignerFrameFileDealerPane.getInstance().getSelectedOperation().getFilePath(); String path = DesignerFrameFileDealerPane.getInstance().getSelectedOperation().getFilePath();
FileVersionTable.getInstance().updateModel(1, WorkContext.getCurrent().get(VcsOperator.class).getVersions(path.replaceFirst("/", ""))); FileVersionTable.getInstance().updateModel(1, WorkContext.getCurrent().get(VcsOperator.class).getVersions(path.replaceFirst("/", "")));
} else { } else {
operator.saveVersion(VcsHelper.CURRENT_USERNAME, fileName, StringUtils.EMPTY, latestFileVersion + 1); operator.saveVersion(getCurrentUsername(), fileName, StringUtils.EMPTY, latestFileVersion + 1);
} }
VcsEntity oldEntity = WorkContext.getCurrent().get(VcsOperator.class).getFileVersionByIndex(fileName, 1); VcsEntity oldEntity = WorkContext.getCurrent().get(VcsOperator.class).getFileVersionByIndex(fileName, 1);
if (VcsHelper.needDeleteVersion(oldEntity)) { if (VcsHelper.needDeleteVersion(oldEntity)) {

7
designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/EditFileVersionDialog.java

@ -8,16 +8,15 @@ import com.fr.design.gui.itextarea.UITextArea;
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.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.locale.InterProviderFactory;
import com.fr.report.ReportContext;
import com.fr.report.entity.VcsEntity; import com.fr.report.entity.VcsEntity;
import com.fr.workspace.WorkContext;
import com.fr.workspace.server.vcs.VcsOperator;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Component; import java.awt.Component;
import java.awt.FlowLayout; import java.awt.FlowLayout;
import java.awt.Frame; import java.awt.Frame;
import java.awt.Toolkit;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
@ -80,7 +79,7 @@ public class EditFileVersionDialog extends UIDialog {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
entity.setCommitMsg(msgTestArea.getText()); entity.setCommitMsg(msgTestArea.getText());
ReportContext.getInstance().getVcsController().saveOrUpdateFileVersion(entity); WorkContext.getCurrent().get(VcsOperator.class).updateVersion(entity);
setVisible(false); setVisible(false);
} }
}); });

5
designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionCellEditor.java

@ -35,15 +35,16 @@ public class FileVersionCellEditor extends AbstractCellEditor implements TableCe
@Override @Override
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) { public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
String fileOfVersion; String fileOfVersion;
VcsOperator vcsOperator = WorkContext.getCurrent().get(VcsOperator.class);
Component editor = row == 0 ? firstRowPanel : renderAndEditor; Component editor = row == 0 ? firstRowPanel : renderAndEditor;
if (isSelected) { if (isSelected) {
return editor; return editor;
} else if (row == 0) { } else if (row == 0) {
String path = DesignerFrameFileDealerPane.getInstance().getSelectedOperation().getFilePath(); String path = DesignerFrameFileDealerPane.getInstance().getSelectedOperation().getFilePath();
fileOfVersion = WorkContext.getCurrent().get(VcsOperator.class).getFileOfCurrent(path.replaceFirst("/", "")); fileOfVersion = vcsOperator.getFileOfCurrent(path.replaceFirst("/", ""));
} else { } else {
renderAndEditor.update((VcsEntity) value); renderAndEditor.update((VcsEntity) value);
fileOfVersion = WorkContext.getCurrent().get(VcsOperator.class).getFileOfFileVersion(((VcsEntity) value).getFilename(), ((VcsEntity) value).getVersion()); fileOfVersion = vcsOperator.getFileOfFileVersion(((VcsEntity) value).getFilename(), ((VcsEntity) value).getVersion());
} }

5
designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionDialog.java

@ -36,7 +36,7 @@ public class FileVersionDialog extends UIDialog {
private UITextField textField; private UITextField textField;
public FileVersionDialog(Frame frame) { public FileVersionDialog(Frame frame, final String fileName) {
super(frame); super(frame);
setUndecorated(true); setUndecorated(true);
setModal(true); setModal(true);
@ -63,7 +63,7 @@ public class FileVersionDialog extends UIDialog {
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
FileVersionDialog.this.setVisible(false); FileVersionDialog.this.setVisible(false);
Date date = dateEditor.getValue(); Date date = dateEditor.getValue();
List<VcsEntity> vcsEntities = WorkContext.getCurrent().get(VcsOperator.class).getFilterVersions(date, new Date(date.getTime() + DELAY), textField.getText()); List<VcsEntity> vcsEntities = WorkContext.getCurrent().get(VcsOperator.class).getFilterVersions(fileName, date, new Date(date.getTime() + DELAY), textField.getText());
FileVersionTable.getInstance().updateModel(1, vcsEntities); FileVersionTable.getInstance().updateModel(1, vcsEntities);
} }
@ -91,4 +91,5 @@ public class FileVersionDialog extends UIDialog {
public void checkValid() throws Exception { public void checkValid() throws Exception {
} }
} }

4
designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionRowPanel.java

@ -43,13 +43,13 @@ public class FileVersionRowPanel extends JPanel {
// version + username // version + username
Box upPane = Box.createHorizontalBox(); Box upPane = Box.createHorizontalBox();
upPane.setBorder(VcsHelper.EMPTY_BORDER); upPane.setBorder(VcsHelper.EMPTY_BORDER_MEDIUM);
upPane.add(versionLabel); upPane.add(versionLabel);
upPane.add(Box.createHorizontalGlue()); upPane.add(Box.createHorizontalGlue());
// msg // msg
msgLabel.setBorder(VcsHelper.EMPTY_BORDER); msgLabel.setBorder(VcsHelper.EMPTY_BORDER_MEDIUM);
msgLabel.setOpaque(false); msgLabel.setOpaque(false);
msgLabel.setBackground(new Color(0, 0, 0, 0)); msgLabel.setBackground(new Color(0, 0, 0, 0));
msgLabel.setEditable(false); msgLabel.setEditable(false);

5
designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionsPanel.java

@ -2,6 +2,7 @@ package com.fr.design.mainframe.vcs.ui;
import com.fr.base.GraphHelper; import com.fr.base.GraphHelper;
import com.fr.design.base.mode.DesignModeContext; import com.fr.design.base.mode.DesignModeContext;
import com.fr.design.base.mode.DesignerMode;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.file.MutilTempalteTabPane; import com.fr.design.file.MutilTempalteTabPane;
@ -100,7 +101,7 @@ public class FileVersionsPanel extends BasicPane {
} }
private void showFilterPane() { private void showFilterPane() {
versionDialog = new FileVersionDialog(DesignerContext.getDesignerFrame()); versionDialog = new FileVersionDialog(DesignerContext.getDesignerFrame(), templatePath);
versionDialog.setVisible(true); versionDialog.setVisible(true);
} }
@ -153,7 +154,7 @@ public class FileVersionsPanel extends BasicPane {
WestRegionContainerPane.getInstance().replaceUpPane( WestRegionContainerPane.getInstance().replaceUpPane(
isExit ? DesignerFrameFileDealerPane.getInstance() : this); isExit ? DesignerFrameFileDealerPane.getInstance() : this);
DesignModeContext.switchTo(isExit ? com.fr.design.base.mode.DesignerMode.NORMAL : com.fr.design.base.mode.DesignerMode.VCS); DesignModeContext.switchTo(isExit ? DesignerMode.NORMAL : DesignerMode.VCS);
// MutilTempalteTabPane & NewTemplatePane 是否可点 // MutilTempalteTabPane & NewTemplatePane 是否可点
ToolBarNewTemplatePane.getInstance().setButtonGray(!isExit); ToolBarNewTemplatePane.getInstance().setButtonGray(!isExit);

16
designer-base/src/main/java/com/fr/design/update/push/DesignerPushUpdateDialog.java

@ -16,6 +16,7 @@ import com.fr.web.struct.category.StylePath;
import com.fr.web.struct.impl.FineUI; import com.fr.web.struct.impl.FineUI;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.SwingUtilities;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.Frame; import java.awt.Frame;
@ -34,10 +35,15 @@ class DesignerPushUpdateDialog extends UIDialog {
initComponents(); initComponents();
} }
static void createAndShow(Frame parent, DesignerUpdateInfo updateInfo) { static void createAndShow(final Frame parent, final DesignerUpdateInfo updateInfo) {
DesignerPushUpdateDialog dialog = new DesignerPushUpdateDialog(parent); SwingUtilities.invokeLater(new Runnable() {
dialog.populate(updateInfo); public void run() {
dialog.showDialog(); DesignerPushUpdateDialog dialog = new DesignerPushUpdateDialog(parent);
dialog.populate(updateInfo);
dialog.showDialog();
}
});
} }
private void initComponents() { private void initComponents() {
@ -72,7 +78,7 @@ class DesignerPushUpdateDialog extends UIDialog {
private Model createModel(DesignerUpdateInfo updateInfo) { private Model createModel(DesignerUpdateInfo updateInfo) {
Model model = new Model(); Model model = new Model();
model.setVersion(updateInfo.getPushVersion()); model.setVersion(updateInfo.getLatestVersion());
model.setContent(updateInfo.getPushContent()); model.setContent(updateInfo.getPushContent());
model.setMoreInfoUrl(updateInfo.getMoreInfoUrl()); model.setMoreInfoUrl(updateInfo.getMoreInfoUrl());
model.setBackgroundUrl(updateInfo.getBackgroundUrl()); model.setBackgroundUrl(updateInfo.getBackgroundUrl());

14
designer-base/src/main/resources/com/fr/design/ui/update/push/pushUpdate.css

@ -4,6 +4,8 @@ body {
color: white; color: white;
background-size: 100% 100% !important; background-size: 100% 100% !important;
-moz-background-size: 100% 100% !important; -moz-background-size: 100% 100% !important;
font-family: PingFangSC-Regular, Georgia, "Nimbus Roman No9 L", "Songti SC", "Noto Serif CJK SC", "Source Han Serif SC", "Source Han Serif CN", STSong, "AR PL New Sung", "AR PL SungtiL GB", NSimSun, SimSun, "TW\-Sung", "WenQuanYi Bitmap Song", "AR PL UMing CN", "AR PL UMing HK", "AR PL UMing TW", "AR PL UMing TW MBE", PMingLiU, MingLiU, serif !important;
} }
.close-btn { .close-btn {
@ -24,15 +26,17 @@ body {
color: white !important; color: white !important;
} }
.font-bold {
font-weight: bold;
}
.title { .title {
font-family: PingFangSC-Semibold;
font-size: 24px; font-size: 24px;
letter-spacing: 1.5px; letter-spacing: 1.5px;
line-height: 24px; line-height: 24px;
} }
.version { .version {
font-family: PingFangSC-Semibold;
font-size: 12px; font-size: 12px;
line-height: 14px; line-height: 14px;
margin-top: 6px; margin-top: 6px;
@ -40,9 +44,8 @@ body {
.desc { .desc {
margin-top: 40px; margin-top: 40px;
font-family: PingFangSC-Regular;
font-size: 13px; font-size: 13px;
width: 540px; width: 82%;
margin-left: 19px; margin-left: 19px;
text-indent: -19px; text-indent: -19px;
overflow: visible !important; overflow: visible !important;
@ -54,7 +57,6 @@ body {
.moreInfo { .moreInfo {
margin-top: 20px; margin-top: 20px;
font-family: PingFangSC-Regular;
font-size: 13px; font-size: 13px;
text-decoration: underline; text-decoration: underline;
} }
@ -65,7 +67,7 @@ body {
} }
.buttonGroup .bi-button { .buttonGroup .bi-button {
font-family: PingFangSC-Medium; font-weight: 600;
font-size: 11px; font-size: 11px;
text-align: center; text-align: center;
line-height: 12px; line-height: 12px;

12
designer-base/src/main/resources/com/fr/design/ui/update/push/pushUpdate.js

@ -33,13 +33,13 @@ function getTitleArea() {
{ {
type: "bi.label", type: "bi.label",
text: i18nText("Fine-Design_Find_New_Version"), text: i18nText("Fine-Design_Find_New_Version"),
cls: "title", cls: "title font-bold",
textAlign: "left" textAlign: "left"
}, },
{ {
type: "bi.label", type: "bi.label",
text: Pool.data.getVersion(), text: Pool.data.getVersion(),
cls: "version", cls: "version font-bold",
textAlign: "left" textAlign: "left"
} }
] ]
@ -126,13 +126,7 @@ function getShowItems() {
var buttonGroup = getButtonGroup(); var buttonGroup = getButtonGroup();
var showItems = [title, closeButton, descArea]; return [title, closeButton, descArea, moreInfo, buttonGroup];
if (descList.length > MAX_DESC_NUM) {
showItems.push(moreInfo);
}
showItems.push(buttonGroup);
return showItems;
} }
window.addEventListener("load", function (ev) { window.addEventListener("load", function (ev) {

12
designer-base/src/test/java/com/fr/design/mainframe/template/info/DesignerOpenHistoryTest.java

@ -87,6 +87,18 @@ public class DesignerOpenHistoryTest {
} }
} }
@Test
public void testOpenEnoughTimesInPeriod() {
assertTrue(openHistory.isOpenEnoughTimesInPeriod(15));
assertFalse(openHistory.isOpenEnoughTimesInPeriod(3));
Reflect.on(openHistory).set("history", new String[] {"2019-05-03", "2019-05-02", ""});
assertFalse(openHistory.isOpenEnoughTimesInPeriod(15));
Reflect.on(openHistory).set("history", new String[] {"2019-05-03", "", ""});
assertFalse(openHistory.isOpenEnoughTimesInPeriod(15));
}
@Test @Test
public void testHasOpenedToday() { public void testHasOpenedToday() {
assertFalse(openHistory.hasOpenedToday()); assertFalse(openHistory.hasOpenedToday());

14
designer-realize/src/main/java/com/fr/start/Designer.java

@ -10,6 +10,7 @@ import com.fr.design.actions.file.newReport.NewWorkBookAction;
import com.fr.design.actions.server.ServerConfigManagerAction; import com.fr.design.actions.server.ServerConfigManagerAction;
import com.fr.design.actions.server.StyleListAction; import com.fr.design.actions.server.StyleListAction;
import com.fr.design.actions.server.WidgetManagerAction; import com.fr.design.actions.server.WidgetManagerAction;
import com.fr.design.base.mode.DesignModeContext;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.HistoryTemplateListPane;
@ -29,6 +30,7 @@ import com.fr.design.mainframe.alphafine.component.AlphaFinePane;
import com.fr.design.mainframe.bbs.UserInfoLabel; import com.fr.design.mainframe.bbs.UserInfoLabel;
import com.fr.design.mainframe.bbs.UserInfoPane; import com.fr.design.mainframe.bbs.UserInfoPane;
import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus; import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus;
import com.fr.design.mainframe.vcs.common.VcsHelper;
import com.fr.design.menu.KeySetUtils; import com.fr.design.menu.KeySetUtils;
import com.fr.design.menu.MenuDef; import com.fr.design.menu.MenuDef;
import com.fr.design.menu.SeparatorDef; import com.fr.design.menu.SeparatorDef;
@ -219,6 +221,9 @@ public class Designer extends BaseDesigner {
jt.stopEditing(); jt.stopEditing();
jt.saveTemplate(); jt.saveTemplate();
jt.requestFocus(); jt.requestFocus();
if (DesignerEnvManager.getEnvManager().getVcsConfigManager().isVcsEnable()) {
VcsHelper.dealWithVcs(jt);
}
} }
}); });
return saveButton; return saveButton;
@ -277,6 +282,9 @@ public class Designer extends BaseDesigner {
return; return;
} }
WebPreviewUtils.preview(jt); WebPreviewUtils.preview(jt);
if (DesignerEnvManager.getEnvManager().getVcsConfigManager().isVcsEnable()) {
VcsHelper.dealWithVcs(jt);
}
} }
@Override @Override
@ -309,12 +317,12 @@ public class Designer extends BaseDesigner {
@Override @Override
protected void refreshLargeToolbarState() { protected void refreshLargeToolbarState() {
JTemplate<?, ?> jt = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); JTemplate<?, ?> jt = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
if (jt == null) { if (jt == null) {
return; return;
} }
saveButton.setEnabled(!jt.isSaved() && !DesignerMode.isVcsMode()); saveButton.setEnabled(!jt.isSaved() && !DesignModeContext.isVcsMode());
MutilTempalteTabPane.getInstance().refreshOpenedTemplate(HistoryTemplateListPane.getInstance().getHistoryList()); MutilTempalteTabPane.getInstance().refreshOpenedTemplate(HistoryTemplateListCache.getInstance().getHistoryList());
MutilTempalteTabPane.getInstance().repaint(); MutilTempalteTabPane.getInstance().repaint();
if (DesignerEnvManager.getEnvManager().isSupportUndo()) { if (DesignerEnvManager.getEnvManager().isSupportUndo()) {
undo.setEnabled(jt.canUndo()); undo.setEnabled(jt.canUndo());

Loading…
Cancel
Save