Browse Source

Merge pull request #12553 in DESIGN/design from release/11.0 to bugfix/11.0

* commit 'f641635c08159ccfa18758911db9eef48f6649b8':
  REPORT-101409 【版本管理三期】删除无权限的版本没有失败提示
  REPORT-101608 【版本管理三期】通过版本中心入口进入版本详情,未保存的模板触发还原,选择保存还原会失败 代码规范
  REPORT-101773 【版本管理三期】版本详情页面选择版本删除,删完一个操作框的按钮就点不动了
  REPORT-101608 【版本管理三期】通过版本中心入口进入版本详情,未保存的模板触发还原,选择保存还原会失败
  REPORT-101482 【版本管理二期】迁移失败/成功的提示,都有个帮助文档的跳转
  REPORT-101608 【版本管理三期】通过版本中心入口进入版本详情,未保存的模板触发还原,选择保存还原会失败
  REPORT-101026 【版本管理三期】预览版本文件,有报错
  REPORT-99740 FRM报表块,get (-1,-1)类型的ColumnRow报错
  REPORT-101605 【版本管理三期】版本中心进入的版本详情入口,删除模板所有版本后,版本中心没有刷新
bugfix/11.0
superman 1 year ago
parent
commit
f0d45dc844
  1. 77
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java
  2. 91
      designer-base/src/main/java/com/fr/design/mainframe/vcs/VcsOperatorWorker.java
  3. 60
      designer-base/src/main/java/com/fr/design/mainframe/vcs/VcsProcessFailedWrapper.java
  4. 32
      designer-base/src/main/java/com/fr/design/mainframe/vcs/VcsTableOperatorListener.java
  5. 113
      designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsCloseTemplateHelper.java
  6. 13
      designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java
  7. 36
      designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsNewPaneWrapper.java
  8. 50
      designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/RecyclePane.java
  9. 37
      designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsCenterPane.java
  10. 31
      designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsMovePanel.java
  11. 70
      designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsNewPane.java
  12. 22
      designer-realize/src/main/java/com/fr/design/sort/common/SortColumnRowPane.java

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

@ -36,9 +36,9 @@ import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.manager.search.TemplateTreeSearchManager; import com.fr.design.mainframe.manager.search.TemplateTreeSearchManager;
import com.fr.design.mainframe.manager.search.searcher.control.pane.TemplateTreeSearchToolbarPane; import com.fr.design.mainframe.manager.search.searcher.control.pane.TemplateTreeSearchToolbarPane;
import com.fr.design.mainframe.vcs.RecycleAction; import com.fr.design.mainframe.vcs.RecycleAction;
import com.fr.design.mainframe.vcs.common.VcsCloseTemplateHelper;
import com.fr.design.mainframe.vcs.common.VcsHelper; import com.fr.design.mainframe.vcs.common.VcsHelper;
import com.fr.design.mainframe.vcs.ui.FileVersionsPanel; import com.fr.design.mainframe.vcs.ui.FileVersionsPanel;
import com.fr.design.mainframe.vcs.ui.VcsNewPane;
import com.fr.design.menu.KeySetUtils; import com.fr.design.menu.KeySetUtils;
import com.fr.design.menu.ShortCut; import com.fr.design.menu.ShortCut;
import com.fr.design.menu.ToolBarDef; import com.fr.design.menu.ToolBarDef;
@ -46,7 +46,6 @@ import com.fr.design.roleAuthority.RolesAlreadyEditedPane;
import com.fr.design.ui.util.UIUtil; import com.fr.design.ui.util.UIUtil;
import com.fr.design.utils.DesignUtils; import com.fr.design.utils.DesignUtils;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.design.worker.save.CallbackSaveWorker;
import com.fr.event.Event; import com.fr.event.Event;
import com.fr.file.filetree.FileNode; import com.fr.file.filetree.FileNode;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
@ -392,15 +391,6 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
} }
} }
private boolean isCurrentEditing(String path) {
JTemplate<?, ?> jt = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
if (JTemplate.isValid(jt)) {
String editing = jt.getEditingFILE().getPath();
return ComparatorUtils.equals(editing, path);
}
return false;
}
/** /**
* 按钮状态改变 * 按钮状态改变
*/ */
@ -505,7 +495,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
String path = DesignerFrameFileDealerPane.getInstance().getSelectedOperation().getFilePath(); String path = DesignerFrameFileDealerPane.getInstance().getSelectedOperation().getFilePath();
path = StableUtils.pathJoin(ProjectConstants.REPORTLETS_NAME, path); path = StableUtils.pathJoin(ProjectConstants.REPORTLETS_NAME, path);
boolean currentEditing = isCurrentEditing(path); boolean currentEditing = VcsCloseTemplateHelper.isCurrentEditing(path);
if (VcsHelper.getInstance().isLegacyMode()) { if (VcsHelper.getInstance().isLegacyMode()) {
// 如果模板已经打开了,关掉,避免出现2个同名tab(1个是模板,1个是版本) // 如果模板已经打开了,关掉,避免出现2个同名tab(1个是模板,1个是版本)
closeOpenedTemplate(path, currentEditing); closeOpenedTemplate(path, currentEditing);
@ -513,16 +503,10 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
fileVersionTablePanel.showFileVersionsPane(); fileVersionTablePanel.showFileVersionsPane();
stateChange(); stateChange();
} else { } else {
checkTemplateSavedAndShowVcsNewPane(path, currentEditing); VcsCloseTemplateHelper.checkTemplateSavedAndShowVcsNewPane(path, currentEditing);
} }
} }
private void showVcsNewPane(String path) {
VcsNewPane panel = new VcsNewPane(path);
panel.showDialog();
}
/** /**
* 版本管理可用状态的监控 * 版本管理可用状态的监控
@ -577,61 +561,6 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
} }
} }
/**
* 如果指定模板已经打开
* <p>1.如果该模板已保存则正常打开新版本管理弹窗
* <p>2.如果该模板未保存触发保存逻辑
* <li>a.如果用户选择保存则保存并不关闭模板弹出新版本管理弹窗
* <li>b.如果用户选择不保存则关闭当前模板弹出新版本管理弹窗
* <li>c.如果用户选择取消, 则啥操作都不做
*
* @param path
* @param isCurrentEditing
*/
private void checkTemplateSavedAndShowVcsNewPane(String path, boolean isCurrentEditing) {
for (JTemplate jTemplate : HistoryTemplateListCache.getInstance().getHistoryList()) {
if (ComparatorUtils.equals(jTemplate.getEditingFILE().getPath(), path)) {
if (!jTemplate.isALLSaved()) {
MultiTemplateTabPane.getInstance().setIsCloseCurrent(isCurrentEditing);
MultiTemplateTabPane.getInstance().closeFormat(jTemplate);
confirmCloseAndShowVcsNewPane(jTemplate, path);
return;
}
}
}
showVcsNewPane(path);
}
private void confirmCloseAndShowVcsNewPane(JTemplate<?, ?> specifiedTemplate, String path) {
if (specifiedTemplate == null) {
return;
}
if (!specifiedTemplate.isALLSaved() && !DesignerMode.isVcsMode()) {
specifiedTemplate.stopEditing();
int returnVal = FineJOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Utils_Would_You_Like_To_Save") + " \"" + specifiedTemplate.getEditingFILE() + "\" ?",
Toolkit.i18nText("Fine-Design_Basic_Confirm"), JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE);
if (returnVal == JOptionPane.YES_OPTION) {
CallbackSaveWorker worker = specifiedTemplate.save();
worker.addSuccessCallback(() -> {
FineLoggerFactory.getLogger().info(Toolkit.i18nText("Fine-Design_Basic_Template_Already_Saved", specifiedTemplate.getEditingFILE().getName()));
showVcsNewPane(path);
});
worker.start(specifiedTemplate.getRuntimeId());
} else if (returnVal == JOptionPane.NO_OPTION) {
closeTpl(specifiedTemplate);
showVcsNewPane(path);
}
} else {
showVcsNewPane(path);
}
}
private void closeTpl(JTemplate<?, ?> specifiedTemplate) {
HistoryTemplateListCache.getInstance().closeSelectedReport(specifiedTemplate);
MultiTemplateTabPane.getInstance().closeAndFreeLock(specifiedTemplate);
MultiTemplateTabPane.getInstance().activePrevTemplateAfterClose();
}
} }
/** /**

91
designer-base/src/main/java/com/fr/design/mainframe/vcs/VcsOperatorWorker.java

@ -10,7 +10,9 @@ import com.fr.report.entity.VcsEntity;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import com.fr.workspace.server.vcs.VcsOperator; import com.fr.workspace.server.vcs.VcsOperator;
import com.fr.workspace.server.vcs.v2.VcsTaskResult;
import javax.swing.SwingUtilities;
import javax.swing.SwingWorker; import javax.swing.SwingWorker;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -26,7 +28,7 @@ import java.util.concurrent.ExecutionException;
public class VcsOperatorWorker { public class VcsOperatorWorker {
private int count = 0; private int count = 0;
private static final int FREQ = 5; private static final int FREQ = 6;
private String successStr; private String successStr;
@ -102,21 +104,16 @@ public class VcsOperatorWorker {
* *
* @param vcsEntities 需要还原的版本 * @param vcsEntities 需要还原的版本
*/ */
public void batchRestore(List<VcsEntity> vcsEntities) { public void batchRestore(List<VcsEntity> vcsEntities, VcsTableOperatorListener listener) {
List<String> failedList = new ArrayList<>(); VcsProcessFailedWrapper wrapper = new VcsProcessFailedWrapper();
startProcess(vcsEntities, failedList, (vcsEntity, operator) -> { startProcess(vcsEntities, wrapper, (vcsEntity, operator) -> {
String fileName = vcsEntity.getFilename(); String fileName = vcsEntity.getFilename();
boolean result = true; VcsTaskResult result = operator.restoreVersion(fileName);
try { if (!result.isSuccess()) {
operator.restoreVersion(fileName); wrapper.addFailedEntity(vcsEntity);
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
result = false;
} }
if (!result) { return result;
failedList.add(fileName+PREFIX+vcsEntity.getVersion()+TAIL); }, listener);
}
});
} }
@ -126,25 +123,21 @@ public class VcsOperatorWorker {
* @param vcsEntities 需要删除的版本 * @param vcsEntities 需要删除的版本
* @param all 是否需要删除所有版本 * @param all 是否需要删除所有版本
*/ */
public void batchDelete(List<VcsEntity> vcsEntities, boolean all) { public void batchDelete(List<VcsEntity> vcsEntities, boolean all, VcsTableOperatorListener listener) {
List<String> failedList = new ArrayList<>(); VcsProcessFailedWrapper wrapper = new VcsProcessFailedWrapper();
startProcess(vcsEntities, failedList, (vcsEntity, operator) -> { startProcess(vcsEntities, wrapper, (vcsEntity, operator) -> {
String fileName = vcsEntity.getFilename(); String fileName = vcsEntity.getFilename();
boolean result = true; VcsTaskResult result;
try { if (all) {
if (all) { result = operator.deleteVersionForRecycle(fileName);
operator.deleteVersionForRecycle(fileName); } else {
} else { result = operator.deleteVersion(fileName, vcsEntity.getVersion(), VcsEntity.CommitType.TYPE_DEFAULT);
operator.deleteVersion(fileName, vcsEntity.getVersion());
}
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
result = false;
} }
if (!result) { if (!result.isSuccess()) {
failedList.add(fileName+PREFIX+vcsEntity.getVersion()+TAIL); wrapper.addFailedEntity(vcsEntity);
} }
}); return result;
}, listener);
} }
@ -153,9 +146,9 @@ public class VcsOperatorWorker {
* *
* @param entity VcsEntity * @param entity VcsEntity
*/ */
public void doDelete(VcsEntity entity) { public void doDelete(VcsEntity entity, VcsTableOperatorListener listener) {
String fileName = entity.getFilename(); String fileName = entity.getFilename();
start4Single(entity, (vcsEntity, operator) -> operator.deleteVersionForRecycle(fileName), fileName + everyFailedStr); start4Single(entity, (vcsEntity, operator) -> operator.deleteVersionForRecycle(fileName), fileName + everyFailedStr, listener);
} }
/** /**
@ -163,12 +156,11 @@ public class VcsOperatorWorker {
* *
* @param entity 版本 * @param entity 版本
*/ */
public void deleteTargetVersion(VcsEntity entity) { public void deleteTargetVersion(VcsEntity entity, VcsTableOperatorListener listener) {
String fileName = entity.getFilename(); String fileName = entity.getFilename();
int version = entity.getVersion(); int version = entity.getVersion();
start4Single(entity, (vcsEntity, operator) -> { VcsEntity.CommitType commitType = entity.getCommitType();
operator.deleteVersion(fileName, version); start4Single(entity, (vcsEntity, operator) -> operator.deleteVersion(fileName, version, commitType), fileName + everyFailedStr, listener);
}, fileName + everyFailedStr);
} }
@ -177,16 +169,17 @@ public class VcsOperatorWorker {
* *
* @param entity 版本 * @param entity 版本
*/ */
public void updateEntityAnnotation(VcsEntity entity) { public void updateEntityAnnotation(VcsEntity entity, VcsTableOperatorListener listener) {
start4Single(entity, (vcsEntity, operator) -> { start4Single(entity, (vcsEntity, operator) -> {
operator.updateVersion(entity); operator.updateVersion(entity);
}, everyFailedStr); return new VcsTaskResult(true);
}, everyFailedStr, listener);
} }
private void startProcess(List<VcsEntity> vcsEntities, List<String> failedList, VcsWorkerOperator workerOperator) { private void startProcess(List<VcsEntity> vcsEntities, VcsProcessFailedWrapper wrapper, VcsWorkerOperator workerOperator, VcsTableOperatorListener listener) {
try { try {
dialog.getProgressBar().setMaximum(vcsEntities.size()); dialog.getProgressBar().setMaximum(vcsEntities.size());
start4Batch(vcsEntities, failedList, workerOperator); start4Batch(vcsEntities, wrapper, workerOperator, listener);
dialog.showDialog(); dialog.showDialog();
} catch (Exception e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
@ -202,13 +195,15 @@ public class VcsOperatorWorker {
return (count > FREQ && count % FREQ == 0) || count < FREQ; return (count > FREQ && count % FREQ == 0) || count < FREQ;
} }
private void start4Single(VcsEntity entity, VcsWorkerOperator vcsWorkerOperator, String failedTip) { private void start4Single(VcsEntity entity, VcsWorkerOperator vcsWorkerOperator, String failedTip, VcsTableOperatorListener listener) {
new SwingWorker<Boolean, Void>() { new SwingWorker<Boolean, Void>() {
@Override @Override
protected void done() { protected void done() {
try { try {
if (!get()) { if (!get()) {
FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), failedTip); FineJOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(DesignerContext.getDesignerFrame()), failedTip);
} else {
listener.updateUI();
} }
} catch (InterruptedException | ExecutionException e) { } catch (InterruptedException | ExecutionException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
@ -218,16 +213,16 @@ public class VcsOperatorWorker {
protected Boolean doInBackground() throws Exception { protected Boolean doInBackground() throws Exception {
try { try {
VcsOperator operator = WorkContext.getCurrent().get(VcsOperator.class); VcsOperator operator = WorkContext.getCurrent().get(VcsOperator.class);
vcsWorkerOperator.process(entity, operator); VcsTaskResult result = vcsWorkerOperator.process(entity, operator);
return result.isSuccess();
} catch (Exception e) { } catch (Exception e) {
return false; return false;
} }
return true;
} }
}.execute(); }.execute();
} }
private void start4Batch(List<VcsEntity> vcsEntities, List<String> failedList, VcsWorkerOperator workerOperator) { private void start4Batch(List<VcsEntity> vcsEntities, VcsProcessFailedWrapper wrapper, VcsWorkerOperator workerOperator, VcsTableOperatorListener listener) {
new SwingWorker<Boolean, Integer>() { new SwingWorker<Boolean, Integer>() {
@Override @Override
protected Boolean doInBackground() throws Exception { protected Boolean doInBackground() throws Exception {
@ -239,7 +234,7 @@ public class VcsOperatorWorker {
publish(count); publish(count);
} }
} }
return failedList.isEmpty(); return wrapper.isAllSuccess();
} }
@Override @Override
protected void process(List<Integer> chunks) { protected void process(List<Integer> chunks) {
@ -249,7 +244,9 @@ public class VcsOperatorWorker {
protected void done() { protected void done() {
dialog.closeDialog(); dialog.closeDialog();
try { try {
List<String> failedList = wrapper.getDetailFailedList();
showErrorDetailPane(get(), failedList, failedList.size(), vcsEntities.size() - failedList.size()); showErrorDetailPane(get(), failedList, failedList.size(), vcsEntities.size() - failedList.size());
listener.updateUI(wrapper);
} catch (InterruptedException | ExecutionException e) { } catch (InterruptedException | ExecutionException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
@ -286,6 +283,6 @@ public class VcsOperatorWorker {
* @param vcsEntity 版本 * @param vcsEntity 版本
* @param operator 操作类 * @param operator 操作类
*/ */
void process(VcsEntity vcsEntity, VcsOperator operator) throws Exception; VcsTaskResult process(VcsEntity vcsEntity, VcsOperator operator) throws Exception;
} }
} }

60
designer-base/src/main/java/com/fr/design/mainframe/vcs/VcsProcessFailedWrapper.java

@ -0,0 +1,60 @@
package com.fr.design.mainframe.vcs;
import com.fr.report.entity.VcsEntity;
import java.util.ArrayList;
import java.util.List;
/**
* 版本管理处理失败列表的包装类
*
* @author Destiny.Lin
* @since 11.0
* Created on 2023/7/28
*/
public class VcsProcessFailedWrapper {
private static final String PREFIX = "(v.";
private static final String TAIL = ")";
private List<VcsEntity> failedList = new ArrayList<>();
/**
* 添加处理失败的VcsEntity
*
* @param entity entity
*/
public void addFailedEntity(VcsEntity entity) {
failedList.add(entity);
}
/**
* 获取用于展示的详细失败信息列表
*/
public List<String> getDetailFailedList() {
List<String> detailList = new ArrayList<>();
for (VcsEntity entity : failedList) {
detailList.add(entity.getFilename()+PREFIX+entity.getVersion()+TAIL);
}
return detailList;
}
/**
* 获取处理失败的vcsEntity的名称列表
*/
public List<String> getFailedNameList() {
List<String> detailList = new ArrayList<>();
for (VcsEntity entity : failedList) {
detailList.add(entity.getFilename());
}
return detailList;
}
/**
* 处理是否全部成功
*/
public boolean isAllSuccess() {
return failedList.isEmpty();
}
}

32
designer-base/src/main/java/com/fr/design/mainframe/vcs/VcsTableOperatorListener.java

@ -0,0 +1,32 @@
package com.fr.design.mainframe.vcs;
import java.util.List;
/**
* 版本管理表格操作事件
*
* @author Destiny.Lin
* @since 11.0
* Created on 2023/7/27
*/
public interface VcsTableOperatorListener {
/**
* 处理操作
*/
default void doOperator(List<VcsTableEntity> entityList){}
/**
* 更新界面
*/
default void updateUI(){}
/**
* 根据处理失败的内容来更新界面
*
* @param wrapper 失败内容
*/
default void updateUI(VcsProcessFailedWrapper wrapper){}
}

113
designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsCloseTemplateHelper.java

@ -0,0 +1,113 @@
package com.fr.design.mainframe.vcs.common;
import com.fr.base.vcs.DesignerMode;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.file.MultiTemplateTabPane;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.mainframe.vcs.ui.VcsNewPane;
import com.fr.design.worker.save.CallbackSaveWorker;
import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory;
import javax.swing.JOptionPane;
import javax.swing.SwingUtilities;
/**
* 版本管理关闭模板辅助类
*
* @author Destiny.Lin
* @since 11.0
* Created on 2023/7/27
*/
public class VcsCloseTemplateHelper {
/**
* 根据传入的pane与dialog生成指定面板的Vcs模板关闭的处理方法
* 如果指定模板已经打开
* <p>1.如果该模板已保存则正常打开新版本管理弹窗
* <p>2.如果该模板未保存触发保存逻辑
* <li>a.如果用户选择保存则保存并不关闭模板弹出新版本管理弹窗
* <li>b.如果用户选择不保存则关闭当前模板弹出新版本管理弹窗
* <li>c.如果用户选择取消, 则啥操作都不做
*
* @param path 对应模板路径
* @param isCurrentEditing 是否是正在编辑的模板
* @param parent 生成的新版本管理的详情面板的父面板
*/
public static void checkTemplateSavedAndShowVcsNewPane(String path, boolean isCurrentEditing, BasicDialog parent, VcsNewPane pane) {
VcsNewPaneWrapper wrapper = new VcsNewPaneWrapper(path, parent, pane);
for (JTemplate jTemplate : HistoryTemplateListCache.getInstance().getHistoryList()) {
if (ComparatorUtils.equals(jTemplate.getEditingFILE().getPath(), path)) {
if (!jTemplate.isALLSaved()) {
MultiTemplateTabPane.getInstance().setIsCloseCurrent(isCurrentEditing);
MultiTemplateTabPane.getInstance().closeFormat(jTemplate);
confirmCloseAndShowVcsNewPane(jTemplate, wrapper);
return;
}
}
}
wrapper.show();
}
/**
* 自己生成新的VcsNewPane的Vcs模板关闭的处理方法
*/
public static void checkTemplateSavedAndShowVcsNewPane(String path, boolean isCurrentEditing) {
checkTemplateSavedAndShowVcsNewPane(path, isCurrentEditing, null, null);
}
/**
* 是否是当前编辑的模板
*
* @param path 对应模板路径
* @return 是则返回true
*/
public static boolean isCurrentEditing(String path) {
JTemplate<?, ?> jt = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
if (JTemplate.isValid(jt)) {
String editing = jt.getEditingFILE().getPath();
return ComparatorUtils.equals(editing, path);
}
return false;
}
private static void confirmCloseAndShowVcsNewPane(JTemplate<?, ?> specifiedTemplate, VcsNewPaneWrapper wrapper) {
if (specifiedTemplate == null) {
return;
}
if (!specifiedTemplate.isALLSaved() && !DesignerMode.isVcsMode()) {
specifiedTemplate.stopEditing();
int returnVal = FineJOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(),
String.format("%s\"%s\" ?",Toolkit.i18nText("Fine-Design_Basic_Utils_Would_You_Like_To_Save"), specifiedTemplate.getEditingFILE()),
Toolkit.i18nText("Fine-Design_Basic_Confirm"), JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE);
if (returnVal == JOptionPane.YES_OPTION) {
CallbackSaveWorker worker = specifiedTemplate.save();
worker.addSuccessCallback(() -> {
FineLoggerFactory.getLogger().info(Toolkit.i18nText("Fine-Design_Basic_Template_Already_Saved", specifiedTemplate.getEditingFILE().getName()));
SwingUtilities.invokeLater(wrapper::show);
});
worker.start(specifiedTemplate.getRuntimeId());
} else if (returnVal == JOptionPane.NO_OPTION) {
closeTpl(specifiedTemplate);
wrapper.show();
}
} else {
wrapper.show();
}
}
private static void closeTpl(JTemplate<?, ?> specifiedTemplate) {
HistoryTemplateListCache.getInstance().closeSelectedReport(specifiedTemplate);
MultiTemplateTabPane.getInstance().closeAndFreeLock(specifiedTemplate);
MultiTemplateTabPane.getInstance().activePrevTemplateAfterClose();
}
}

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

@ -22,6 +22,7 @@ import com.fr.log.FineLoggerFactory;
import com.fr.plugin.context.PluginContext; import com.fr.plugin.context.PluginContext;
import com.fr.plugin.manage.PluginManager; import com.fr.plugin.manage.PluginManager;
import com.fr.report.entity.VcsEntity; import com.fr.report.entity.VcsEntity;
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 com.fr.workspace.WorkContext;
@ -64,6 +65,8 @@ public class VcsHelper implements JTemplateActionListener {
private final static String VCS_PLUGIN_ID = "com.fr.plugin.vcs.v10"; private final static String VCS_PLUGIN_ID = "com.fr.plugin.vcs.v10";
private final static String VCS_FILE_SLASH = "/"; private final static String VCS_FILE_SLASH = "/";
private final static String SERVICE_NAME_MOVE = "moveVcs"; private final static String SERVICE_NAME_MOVE = "moveVcs";
private static final String VCS_VERSIONS = "reportlets_versions";
private static final String VERSION_MARK = ".v";
private static final VcsHelper INSTANCE = new VcsHelper(); private static final VcsHelper INSTANCE = new VcsHelper();
private static ScheduledExecutorService saveSchedule; private static ScheduledExecutorService saveSchedule;
@ -398,4 +401,14 @@ public class VcsHelper implements JTemplateActionListener {
public boolean checkAutoSaveSupport() { public boolean checkAutoSaveSupport() {
return VcsConfigManager.getInstance().isUseAutoSave() && !VcsHelper.getInstance().isLegacyMode(); return VcsConfigManager.getInstance().isUseAutoSave() && !VcsHelper.getInstance().isLegacyMode();
} }
/**
* 获取文件路径
*
* @param entity
* @return
*/
public String getFilePath(VcsEntity entity) {
return StableUtils.pathJoin(VCS_VERSIONS, entity.getFilename() + VERSION_MARK + entity.getVersion());
}
} }

36
designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsNewPaneWrapper.java

@ -0,0 +1,36 @@
package com.fr.design.mainframe.vcs.common;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.mainframe.vcs.ui.VcsNewPane;
/**
* 构建VcsNewPane的包装类
*
* @author Destiny.Lin
* @since 11.0
* Created on 2023/7/27
*/
public class VcsNewPaneWrapper {
private String path;
private BasicDialog dialog;
private VcsNewPane pane;
public VcsNewPaneWrapper(String path, BasicDialog dialog, VcsNewPane pane) {
this.path = path;
this.dialog = dialog;
this.pane = pane;
}
/**
* 显示面板
*/
public void show() {
if (pane != null) {
pane.showDialog(dialog);
} else {
VcsNewPane newPane = new VcsNewPane(path);
newPane.showDialog(dialog);
}
}
}

50
designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/RecyclePane.java

@ -10,7 +10,9 @@ import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.vcs.VcsOperatorWorker; import com.fr.design.mainframe.vcs.VcsOperatorWorker;
import com.fr.design.mainframe.vcs.TableEntity; import com.fr.design.mainframe.vcs.TableEntity;
import com.fr.design.mainframe.vcs.TableValueOperator; import com.fr.design.mainframe.vcs.TableValueOperator;
import com.fr.design.mainframe.vcs.VcsProcessFailedWrapper;
import com.fr.design.mainframe.vcs.VcsTableEntity; import com.fr.design.mainframe.vcs.VcsTableEntity;
import com.fr.design.mainframe.vcs.VcsTableOperatorListener;
import com.fr.report.entity.VcsEntity; import com.fr.report.entity.VcsEntity;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
@ -25,7 +27,9 @@ import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter; import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Set;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static com.fr.design.i18n.Toolkit.i18nText; import static com.fr.design.i18n.Toolkit.i18nText;
@ -44,6 +48,8 @@ public class RecyclePane extends AbstractSupportSelectTablePane<VcsTableEntity>
public static final Icon ICON_DELETE = IconUtils.readSVGIcon("/com/fr/design/standard/vcslist/vcs_recycle_delete", IconUtils.ICON_TYPE_NORMAL); public static final Icon ICON_DELETE = IconUtils.readSVGIcon("/com/fr/design/standard/vcslist/vcs_recycle_delete", IconUtils.ICON_TYPE_NORMAL);
public static final Icon ICON_DELETE_DISABLE = IconUtils.readSVGIcon("/com/fr/design/standard/vcslist/vcs_recycle_delete", IconUtils.ICON_TYPE_DISABLED); public static final Icon ICON_DELETE_DISABLE = IconUtils.readSVGIcon("/com/fr/design/standard/vcslist/vcs_recycle_delete", IconUtils.ICON_TYPE_DISABLED);
private Set<VcsTableOperatorListener> listenerSet = new HashSet<>();
protected UITextField searchTextField; protected UITextField searchTextField;
protected UILabel deleteLabel; protected UILabel deleteLabel;
@ -160,7 +166,12 @@ public class RecyclePane extends AbstractSupportSelectTablePane<VcsTableEntity>
fireListener(new VcsResponseListener() { fireListener(new VcsResponseListener() {
@Override @Override
public void doAfterChooseYes(List<VcsEntity> selectList) { public void doAfterChooseYes(List<VcsEntity> selectList) {
VcsOperatorWorker.createDeleteWorker().batchDelete(selectList, isNeedDeleteAllVersion()); VcsOperatorWorker.createDeleteWorker(). batchDelete(selectList, isNeedDeleteAllVersion(), new VcsTableOperatorListener() {
@Override
public void updateUI(VcsProcessFailedWrapper wrapper) {
updateVcsUI(wrapper);
}
});
} }
}, true); }, true);
} }
@ -177,7 +188,12 @@ public class RecyclePane extends AbstractSupportSelectTablePane<VcsTableEntity>
fireListener(new VcsResponseListener() { fireListener(new VcsResponseListener() {
@Override @Override
public void doAfterChooseYes(List<VcsEntity> selectList) { public void doAfterChooseYes(List<VcsEntity> selectList) {
VcsOperatorWorker.createRestoreWorker().batchRestore(selectList); VcsOperatorWorker.createRestoreWorker().batchRestore(selectList, new VcsTableOperatorListener() {
@Override
public void updateUI(VcsProcessFailedWrapper wrapper) {
updateVcsUI(wrapper);
}
});
} }
}, false); }, false);
} }
@ -210,14 +226,17 @@ public class RecyclePane extends AbstractSupportSelectTablePane<VcsTableEntity>
JOptionPane.OK_CANCEL_OPTION, JOptionPane.OK_CANCEL_OPTION,
JOptionPane.QUESTION_MESSAGE); JOptionPane.QUESTION_MESSAGE);
if (selVal == JOptionPane.YES_OPTION) { if (selVal == JOptionPane.YES_OPTION) {
tableEntities = model.getList().stream().filter(tableEntity -> !tableEntity.isSelect()).collect(Collectors.toList());
model.setList(tableEntities);
model.fireTableDataChanged();
listener.doAfterChooseYes(selectList); listener.doAfterChooseYes(selectList);
} }
} }
} }
private void updateVcsUI(VcsProcessFailedWrapper wrapper) {
tableEntities = model.getList().stream().filter(tableEntity -> !tableEntity.isSelect() || wrapper.getFailedNameList().contains(tableEntity.getFilename())).collect(Collectors.toList());
model.setList(new ArrayList<>(tableEntities));
model.fireTableDataChanged();
fireVcsListener(model.getList());
}
/** /**
* 显示弹窗 * 显示弹窗
@ -274,6 +293,25 @@ public class RecyclePane extends AbstractSupportSelectTablePane<VcsTableEntity>
this.parentDialog = parentDialog; this.parentDialog = parentDialog;
} }
/**
* 添加版本管理表格操作事件
*
* @param listener 版本管理表格操作事件
*/
public void addVcsListener(VcsTableOperatorListener listener) {
listenerSet.add(listener);
}
/**
* 触发版本管理表格操作事件
*/
public void fireVcsListener(List<VcsTableEntity> tableEntities) {
for (VcsTableOperatorListener listener : listenerSet) {
listener.doOperator(tableEntities);
}
}
/** /**
* 删除范围 * 删除范围
* *
@ -340,7 +378,7 @@ public class RecyclePane extends AbstractSupportSelectTablePane<VcsTableEntity>
* @param entities * @param entities
*/ */
public void updateTableList(List<VcsTableEntity> entities) { public void updateTableList(List<VcsTableEntity> entities) {
tableEntities = entities; tableEntities = new ArrayList<>(entities);
} }
/** /**

37
designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsCenterPane.java

@ -10,6 +10,8 @@ import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.vcs.VcsOperatorWorker; import com.fr.design.mainframe.vcs.VcsOperatorWorker;
import com.fr.design.mainframe.vcs.VcsTableEntity; import com.fr.design.mainframe.vcs.VcsTableEntity;
import com.fr.design.mainframe.vcs.VcsTableOperatorListener;
import com.fr.design.mainframe.vcs.common.VcsCloseTemplateHelper;
import com.fr.file.FileNodeFILE; import com.fr.file.FileNodeFILE;
import com.fr.file.filetree.FileNode; import com.fr.file.filetree.FileNode;
import com.fr.report.entity.VcsEntity; import com.fr.report.entity.VcsEntity;
@ -104,7 +106,8 @@ public class VcsCenterPane extends VcsNewPane {
@Override @Override
public void mouseClicked(MouseEvent e) { public void mouseClicked(MouseEvent e) {
JTable table = tableContentPane.getEditTable(); JTable table = tableContentPane.getEditTable();
Object o = table.getValueAt(table.getEditingRow(), table.getEditingColumn()); int row = table.getEditingRow();
Object o = table.getValueAt(row, table.getEditingColumn());
if (o instanceof VcsTableEntity) { if (o instanceof VcsTableEntity) {
VcsEntity entity = ((VcsTableEntity) o).getEntity(); VcsEntity entity = ((VcsTableEntity) o).getEntity();
String fileName = entity.getFilename(); String fileName = entity.getFilename();
@ -115,10 +118,15 @@ public class VcsCenterPane extends VcsNewPane {
JOptionPane.OK_CANCEL_OPTION, JOptionPane.OK_CANCEL_OPTION,
JOptionPane.QUESTION_MESSAGE); JOptionPane.QUESTION_MESSAGE);
if (selVal == JOptionPane.YES_OPTION) { if (selVal == JOptionPane.YES_OPTION) {
VcsOperatorWorker.createDeleteWorker().doDelete(entity); VcsOperatorWorker.createDeleteWorker().doDelete(entity, new VcsTableOperatorListener() {
removeTarget((VcsTableEntity) o); @Override
model.getList().remove(o); public void updateUI() {
model.fireTableDataChanged(); removeTarget((VcsTableEntity) o);
model.fireTableRowsDeleted(row, row);
model.removeRow(row);
model.fireTableDataChanged();
}
});
} }
} }
} }
@ -154,13 +162,23 @@ public class VcsCenterPane extends VcsNewPane {
Object o = table.getValueAt(table.getEditingRow(), table.getEditingColumn()); Object o = table.getValueAt(table.getEditingRow(), table.getEditingColumn());
if (o instanceof VcsTableEntity) { if (o instanceof VcsTableEntity) {
VcsEntity entity = ((VcsTableEntity) o).getEntity(); VcsEntity entity = ((VcsTableEntity) o).getEntity();
VcsNewPane pane = new VcsNewPane(getTemplateTruePath(entity.getFilename())) { String path = getTemplateTruePath(entity.getFilename());
VcsNewPane pane = new VcsNewPane(path) {
@Override @Override
protected String title4PopupWindow() { protected String title4PopupWindow() {
return entity.getFilename()+Toolkit.i18nText("Fine-Design_Vcs_Version_Tips"); return entity.getFilename()+Toolkit.i18nText("Fine-Design_Vcs_Version_Tips");
} }
}; };
pane.showDialog(getDialog()); pane.addVcsListener(new VcsTableOperatorListener() {
@Override
public void doOperator(List<VcsTableEntity> entityList) {
if (entities.size() == 0) {
model.getList().remove(o);
model.fireTableDataChanged();
}
}
});
VcsCloseTemplateHelper.checkTemplateSavedAndShowVcsNewPane(path, VcsCloseTemplateHelper.isCurrentEditing(path), getDialog(), pane);
} }
} }
}); });
@ -182,8 +200,9 @@ public class VcsCenterPane extends VcsNewPane {
dialog.addDialogActionListener(new DialogActionAdapter() { dialog.addDialogActionListener(new DialogActionAdapter() {
@Override @Override
public void doOk() { public void doOk() {
getParentDialog().doOK(); BasicDialog parent = getParentDialog();
getParentDialog().dispose(); parent.doOK();
parent.dispose();
} }
}); });
} }

31
designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsMovePanel.java

@ -11,6 +11,7 @@ import com.fr.design.gui.ibutton.UIRadioButton;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.iprogressbar.ModernUIProgressBarUI; import com.fr.design.gui.iprogressbar.ModernUIProgressBarUI;
import com.fr.design.gui.ispinner.UISpinner; import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.i18n.LocaleLinkProvider;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.VerticalFlowLayout; import com.fr.design.layout.VerticalFlowLayout;
@ -18,6 +19,7 @@ import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.DesignerFrameFileDealerPane; import com.fr.design.mainframe.DesignerFrameFileDealerPane;
import com.fr.design.mainframe.vcs.VcsExceptionUtils; import com.fr.design.mainframe.vcs.VcsExceptionUtils;
import com.fr.design.mainframe.vcs.common.VcsHelper; import com.fr.design.mainframe.vcs.common.VcsHelper;
import com.fr.design.utils.BrowseUtils;
import com.fr.design.utils.DesignUtils; import com.fr.design.utils.DesignUtils;
import com.fr.design.utils.ThemeUtils; import com.fr.design.utils.ThemeUtils;
import com.fr.design.widget.FRWidgetFactory; import com.fr.design.widget.FRWidgetFactory;
@ -74,6 +76,12 @@ public class VcsMovePanel extends BasicPane {
private static final int DEFAULT_VALUE = 5; private static final int DEFAULT_VALUE = 5;
private static final String HELP_KEY = "Fine-Design_Vcs_Move_Help_Link";
private static final String HELP_KEY_DEFAULT = "Fine-Design_Vcs_Move_Help_Link_Default";
private static final String HELP_URL = LocaleLinkProvider.getInstance().getLink(HELP_KEY, HELP_KEY_DEFAULT);
public static final String SETTING = "SETTING"; public static final String SETTING = "SETTING";
public static final String PROCESS = "PROCESS"; public static final String PROCESS = "PROCESS";
@ -121,6 +129,8 @@ public class VcsMovePanel extends BasicPane {
private boolean visible = false; private boolean visible = false;
private UILabel seeLabel;
private UILabel helpLabel;
public VcsMovePanel(CardLayout cardLayout, JPanel parentPane, MoveCallBack callBack, BasicDialog parentDialog) { public VcsMovePanel(CardLayout cardLayout, JPanel parentPane, MoveCallBack callBack, BasicDialog parentDialog) {
this.parentCard = cardLayout; this.parentCard = cardLayout;
@ -407,6 +417,9 @@ public class VcsMovePanel extends BasicPane {
body.add(new UILabel(StringUtils.BLANK)); body.add(new UILabel(StringUtils.BLANK));
body.add(tipLabel); body.add(tipLabel);
body.add(new UILabel(StringUtils.BLANK)); body.add(new UILabel(StringUtils.BLANK));
JPanel panel = createHelpPane();
body.add(panel);
body.add(new UILabel(StringUtils.BLANK));
body.add(button); body.add(button);
statusPane.add(body); statusPane.add(body);
statusPane.setLayout(FRGUIPaneFactory.createCenterLayout(body, 0.5f, 0.5f)); statusPane.setLayout(FRGUIPaneFactory.createCenterLayout(body, 0.5f, 0.5f));
@ -417,6 +430,24 @@ public class VcsMovePanel extends BasicPane {
tipLabel.setAlignmentX(CENTER_ALIGNMENT); tipLabel.setAlignmentX(CENTER_ALIGNMENT);
} }
private JPanel createHelpPane() {
JPanel panel = new JPanel();
seeLabel = new UILabel(Toolkit.i18nText("Fine-Design_Vcs_Move_See"));
seeLabel.setForeground(TIP_COLOR);
helpLabel = new UILabel(Toolkit.i18nText("Fine-Design_Vcs_Move_Help"));
helpLabel.setForeground(LABEL_COLOR);
helpLabel.setCursor(new Cursor(Cursor.HAND_CURSOR));
helpLabel.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
BrowseUtils.browser(HELP_URL);
}
});
panel.add(seeLabel);
panel.add(helpLabel);
return panel;
}
private class MoveWorker extends SwingWorker<Boolean, Integer> { private class MoveWorker extends SwingWorker<Boolean, Integer> {

70
designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsNewPane.java

@ -11,15 +11,18 @@ import com.fr.design.mainframe.JTemplate;
import com.fr.design.mainframe.vcs.TableValueOperator; import com.fr.design.mainframe.vcs.TableValueOperator;
import com.fr.design.mainframe.vcs.VcsOperatorWorker; import com.fr.design.mainframe.vcs.VcsOperatorWorker;
import com.fr.design.mainframe.vcs.VcsTableEntity; import com.fr.design.mainframe.vcs.VcsTableEntity;
import com.fr.design.mainframe.vcs.VcsTableOperatorListener;
import com.fr.design.mainframe.vcs.common.VcsCacheFileNodeFile; import com.fr.design.mainframe.vcs.common.VcsCacheFileNodeFile;
import com.fr.design.mainframe.vcs.common.VcsHelper; import com.fr.design.mainframe.vcs.common.VcsHelper;
import com.fr.file.FileNodeFILE; import com.fr.file.FileNodeFILE;
import com.fr.file.filetree.FileNode; import com.fr.file.filetree.FileNode;
import com.fr.io.utils.ResourceIOUtils;
import com.fr.report.entity.VcsEntity; import com.fr.report.entity.VcsEntity;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import com.fr.workspace.server.vcs.VcsFileUtils; import com.fr.workspace.server.vcs.VcsFileUtils;
import com.fr.workspace.server.vcs.VcsOperator; import com.fr.workspace.server.vcs.VcsOperator;
import com.fr.workspace.server.vcs.v2.VcsTaskResult;
import javax.swing.Icon; import javax.swing.Icon;
import javax.swing.JComponent; import javax.swing.JComponent;
@ -30,6 +33,7 @@ import java.awt.*;
import java.awt.event.MouseAdapter; import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.awt.event.MouseMotionAdapter; import java.awt.event.MouseMotionAdapter;
import java.io.FileNotFoundException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutionException;
@ -51,6 +55,7 @@ public class VcsNewPane extends RecyclePane {
protected static int EDIT_COL = 4; protected static int EDIT_COL = 4;
private static final String PATH = "path";
private static final int DOUBLE_CLICK_COUNT = 2; private static final int DOUBLE_CLICK_COUNT = 2;
protected VcsOperatorPane operatorPane; protected VcsOperatorPane operatorPane;
@ -170,28 +175,42 @@ public class VcsNewPane extends RecyclePane {
private void restoreEntity(VcsEntity entity) { private void restoreEntity(VcsEntity entity) {
new SwingWorker<Void, Void>() { new SwingWorker<VcsTaskResult, Void>() {
@Override @Override
protected Void doInBackground() throws Exception { protected VcsTaskResult doInBackground() throws Exception {
String path = VcsHelper.getInstance().getFilePath(entity);
if (!ResourceIOUtils.exist(path)) {
return new VcsTaskResult(false, new FileNotFoundException());
}
//step1.设置还原的用户名 //step1.设置还原的用户名
entity.setUsername(VcsHelper.getInstance().getCurrentUsername()); entity.setUsername(VcsHelper.getInstance().getCurrentUsername());
//step2.rollback到指定版本 //step2.rollback到指定版本
WorkContext.getCurrent().get(VcsOperator.class).rollbackTo(entity); WorkContext.getCurrent().get(VcsOperator.class).rollbackTo(entity);
return null; //最里面的文件系统的write会吞异常,这边就一直默认成功吧,日志里会体现失败的情况
return new VcsTaskResult(true);
} }
@Override @Override
protected void done() { protected void done() {
//step3.如果原来原模板已经打开则关闭原模板,打开rollback后的新模板 try {
List<JTemplate<?, ?>> templateList = HistoryTemplateListCache.getInstance().getHistoryList(); VcsTaskResult result = get();
for (JTemplate<?, ?> template : templateList) { if (result.isSuccess()) {
if (StringUtils.equals(filePath, template.getPath())) { //step3.如果原来原模板已经打开则关闭原模板,打开rollback后的新模板
MultiTemplateTabPane.getInstance().setIsCloseCurrent(HistoryTemplateListCache.getInstance().isCurrentEditingFile(filePath)); List<JTemplate<?, ?>> templateList = HistoryTemplateListCache.getInstance().getHistoryList();
MultiTemplateTabPane.getInstance().closeFormat(template); for (JTemplate<?, ?> template : templateList) {
MultiTemplateTabPane.getInstance().closeSpecifiedTemplate(template); if (StringUtils.equals(filePath, template.getPath())) {
break; MultiTemplateTabPane.getInstance().setIsCloseCurrent(HistoryTemplateListCache.getInstance().isCurrentEditingFile(filePath));
MultiTemplateTabPane.getInstance().closeFormat(template);
MultiTemplateTabPane.getInstance().closeSpecifiedTemplate(template);
break;
}
}
DesignerContext.getDesignerFrame().openTemplate(new FileNodeFILE(new FileNode(filePath, false)));
} else {
FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Warning_Template_Do_Not_Exsit"));
} }
} catch (InterruptedException | ExecutionException e) {
throw new RuntimeException(e);
} }
DesignerContext.getDesignerFrame().openTemplate(new FileNodeFILE(new FileNode(filePath, false)));
} }
}.execute(); }.execute();
} }
@ -202,8 +221,8 @@ public class VcsNewPane extends RecyclePane {
@Override @Override
public void mouseClicked(MouseEvent e) { public void mouseClicked(MouseEvent e) {
JTable table = tableContentPane.getEditTable(); JTable table = tableContentPane.getEditTable();
int row = table.getEditingColumn(); int row = table.getEditingRow();
Object o = table.getValueAt(table.getEditingRow(), row); Object o = table.getValueAt(row, table.getEditingColumn());
if (o instanceof VcsTableEntity) { if (o instanceof VcsTableEntity) {
VcsEntity entity = ((VcsTableEntity) o).getEntity(); VcsEntity entity = ((VcsTableEntity) o).getEntity();
int selVal = FineJOptionPane.showConfirmDialog( int selVal = FineJOptionPane.showConfirmDialog(
@ -213,9 +232,15 @@ public class VcsNewPane extends RecyclePane {
JOptionPane.OK_CANCEL_OPTION, JOptionPane.OK_CANCEL_OPTION,
JOptionPane.QUESTION_MESSAGE); JOptionPane.QUESTION_MESSAGE);
if (selVal == JOptionPane.YES_OPTION) { if (selVal == JOptionPane.YES_OPTION) {
model.getList().remove(o); VcsOperatorWorker.createDeleteWorker().deleteTargetVersion(entity, new VcsTableOperatorListener() {
model.fireTableDataChanged(); @Override
VcsOperatorWorker.createDeleteWorker().deleteTargetVersion(entity); public void updateUI() {
model.fireTableRowsDeleted(row, row);
model.removeRow(row);
model.fireTableDataChanged();
}
});
fireVcsListener(model.getList());
} }
} }
} }
@ -231,7 +256,6 @@ public class VcsNewPane extends RecyclePane {
if (o instanceof VcsTableEntity) { if (o instanceof VcsTableEntity) {
VcsEntity entity = ((VcsTableEntity) o).getEntity(); VcsEntity entity = ((VcsTableEntity) o).getEntity();
previewEntity(entity); previewEntity(entity);
VcsNewPane.this.saveSettingAndCloseDialog();
} }
} }
}); });
@ -336,9 +360,13 @@ public class VcsNewPane extends RecyclePane {
@Override @Override
public void doOK() { public void doOK() {
entity.setCommitMsg(getMsgTestArea().getText()); entity.setCommitMsg(getMsgTestArea().getText());
VcsOperatorWorker.createUpdateWorker().updateEntityAnnotation(entity); VcsOperatorWorker.createUpdateWorker().updateEntityAnnotation(entity, new VcsTableOperatorListener() {
setVisible(false); @Override
model.fireTableDataChanged(); public void updateUI() {
setVisible(false);
model.fireTableDataChanged();
}
});
} }
}; };
dialog.setVisible(true); dialog.setVisible(true);

22
designer-realize/src/main/java/com/fr/design/sort/common/SortColumnRowPane.java

@ -24,13 +24,16 @@ import com.fr.stable.ColumnRow;
import com.fr.stable.EssentialUtils; import com.fr.stable.EssentialUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.*; import javax.swing.Icon;
import java.awt.*; import javax.swing.JPanel;
import javax.swing.JTextField;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.event.MouseAdapter; import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator;
import java.util.Map; import java.util.Map;
public class SortColumnRowPane extends JPanel implements UIObserver { public class SortColumnRowPane extends JPanel implements UIObserver {
@ -260,8 +263,10 @@ public class SortColumnRowPane extends JPanel implements UIObserver {
disableHeaderCellsStyleMap = new HashMap<>(); disableHeaderCellsStyleMap = new HashMap<>();
tempHeaderCells = new ArrayList<>(); tempHeaderCells = new ArrayList<>();
for (ColumnRow columnRow : notSelectables) { for (ColumnRow columnRow : notSelectables) {
TemplateCellElement templateCellElement TemplateCellElement templateCellElement = null;
= elementCase.getTemplateCellElement(columnRow.column, columnRow.row); if (columnRow != ColumnRow.ERROR) {
templateCellElement = elementCase.getTemplateCellElement(columnRow.column, columnRow.row);
}
if (templateCellElement == null) { if (templateCellElement == null) {
templateCellElement = new DefaultTemplateCellElement(columnRow.column, columnRow.row); templateCellElement = new DefaultTemplateCellElement(columnRow.column, columnRow.row);
elementCase.addCellElement(templateCellElement); elementCase.addCellElement(templateCellElement);
@ -280,8 +285,11 @@ public class SortColumnRowPane extends JPanel implements UIObserver {
if (cellSelectionManager != null) { if (cellSelectionManager != null) {
try { try {
for (ColumnRow headerColumnRow : disableHeaderCellsStyleMap.keySet()) { for (ColumnRow headerColumnRow : disableHeaderCellsStyleMap.keySet()) {
TemplateCellElement headerTemplateCellElement TemplateCellElement headerTemplateCellElement = null;
= elementCase.getTemplateCellElement(headerColumnRow.column, headerColumnRow.row); if (headerColumnRow != ColumnRow.ERROR) {
headerTemplateCellElement
= elementCase.getTemplateCellElement(headerColumnRow.column, headerColumnRow.row);
}
if (headerTemplateCellElement != null) { if (headerTemplateCellElement != null) {
headerTemplateCellElement.setStyle(disableHeaderCellsStyleMap.get(headerColumnRow)); headerTemplateCellElement.setStyle(disableHeaderCellsStyleMap.get(headerColumnRow));
} }

Loading…
Cancel
Save