Browse Source

Pull request #12535: REPORT-98345 版本管理三期 修复bug

Merge in DESIGN/design from ~DESTINY.LIN/design:final/11.0 to final/11.0

* commit '0e318971e0bbea8f167ed6927993e5ad083737ca':
  REPORT-101608 【版本管理三期】通过版本中心入口进入版本详情,未保存的模板触发还原,选择保存还原会失败 代码规范
  REPORT-101773 【版本管理三期】版本详情页面选择版本删除,删完一个操作框的按钮就点不动了
  REPORT-101608 【版本管理三期】通过版本中心入口进入版本详情,未保存的模板触发还原,选择保存还原会失败
  REPORT-101482 【版本管理二期】迁移失败/成功的提示,都有个帮助文档的跳转
  REPORT-101608 【版本管理三期】通过版本中心入口进入版本详情,未保存的模板触发还原,选择保存还原会失败
  REPORT-101026 【版本管理三期】预览版本文件,有报错
  REPORT-101605 【版本管理三期】版本中心进入的版本详情入口,删除模板所有版本后,版本中心没有刷新
new-design
parent
commit
a4adff6de4
  1. 77
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java
  2. 19
      designer-base/src/main/java/com/fr/design/mainframe/vcs/VcsTableOperatorListener.java
  3. 113
      designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsCloseTemplateHelper.java
  4. 36
      designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsNewPaneWrapper.java
  5. 29
      designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/RecyclePane.java
  6. 23
      designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsCenterPane.java
  7. 31
      designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsMovePanel.java
  8. 9
      designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsNewPane.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();
}
} }
/** /**

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

@ -0,0 +1,19 @@
package com.fr.design.mainframe.vcs;
import java.util.List;
/**
* 版本管理表格操作事件
*
* @author Destiny.Lin
* @since 11.0
* Created on 2023/7/27
*/
public interface VcsTableOperatorListener {
/**
* 处理操作
*/
void doOperator(List<VcsTableEntity> entityList);
}

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();
}
}

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);
}
}
}

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

@ -11,6 +11,7 @@ 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.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 +26,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 +47,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;
@ -211,9 +216,10 @@ public class RecyclePane extends AbstractSupportSelectTablePane<VcsTableEntity>
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()); tableEntities = model.getList().stream().filter(tableEntity -> !tableEntity.isSelect()).collect(Collectors.toList());
model.setList(tableEntities); model.setList(new ArrayList<>(tableEntities));
model.fireTableDataChanged(); model.fireTableDataChanged();
listener.doAfterChooseYes(selectList); listener.doAfterChooseYes(selectList);
fireVcsListener(model.getList());
} }
} }
} }
@ -274,6 +280,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 +365,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);
} }
/** /**

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

@ -10,6 +10,7 @@ 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.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 +105,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();
@ -117,7 +119,8 @@ public class VcsCenterPane extends VcsNewPane {
if (selVal == JOptionPane.YES_OPTION) { if (selVal == JOptionPane.YES_OPTION) {
VcsOperatorWorker.createDeleteWorker().doDelete(entity); VcsOperatorWorker.createDeleteWorker().doDelete(entity);
removeTarget((VcsTableEntity) o); removeTarget((VcsTableEntity) o);
model.getList().remove(o); model.fireTableRowsDeleted(row, row);
model.removeRow(row);
model.fireTableDataChanged(); model.fireTableDataChanged();
} }
} }
@ -154,13 +157,20 @@ 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(entities -> {
if (entities.size() == 0) {
model.getList().remove(o);
model.fireTableDataChanged();
}
});
VcsCloseTemplateHelper.checkTemplateSavedAndShowVcsNewPane(path, VcsCloseTemplateHelper.isCurrentEditing(path), getDialog(), pane);
} }
} }
}); });
@ -182,8 +192,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> {

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

@ -202,8 +202,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 +213,11 @@ 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); model.fireTableRowsDeleted(row, row);
model.removeRow(row);
model.fireTableDataChanged(); model.fireTableDataChanged();
VcsOperatorWorker.createDeleteWorker().deleteTargetVersion(entity); VcsOperatorWorker.createDeleteWorker().deleteTargetVersion(entity);
fireVcsListener(model.getList());
} }
} }
} }
@ -231,7 +233,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();
} }
} }
}); });

Loading…
Cancel
Save