Browse Source

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

* commit 'e95dfc7c7878c8f8c26a5b980e226580f7c780e8':
  REPORT-98345 版本管理三期 icon读取报错
  REPORT-100846 版本中心和版本详情都没有搜索弹窗
  REPORT-98345 版本管理三期 表头支持排序
  REPORT-100518 无磁盘写入权限,版本迁移无异常提示
  REPORT-100284 提示历史数据弹窗,提示文案和交互不符
  REPORT-100527 中断迁移没有异常提示
  REPORT-100757 未启动内置服务器,自动清理配置没有灰化 & REPORT-100070 新版版本管理交互和交互文档不一致
  REPORT-100545 迁移完成直接进入新版版本管理,会有存储优化选项
  REPORT-100167 【版本管理二期】自动清理配置项保存不生效
  Revert "REPORT-91839 模板版本管理二期 bug修复"
  REPORT-91839 模板版本管理二期 bug修复
bugfix/11.0
superman 1 year ago
parent
commit
0065064653
  1. 50
      designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java
  2. 6
      designer-base/src/main/java/com/fr/design/actions/file/SwitchExistEnv.java
  3. 15
      designer-base/src/main/java/com/fr/design/gui/itableeditorpane/UITableModelAdapter.java
  4. 7
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java
  5. 2
      designer-base/src/main/java/com/fr/design/mainframe/vcs/RecycleAction.java
  6. 11
      designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/AbstractSupportSelectTablePane.java
  7. 5
      designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsCenterPane.java
  8. 34
      designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsMovePanel.java
  9. 54
      designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsMovingExitOption.java

50
designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java

@ -50,9 +50,12 @@ import com.fr.io.attr.ImageExportAttr;
import com.fr.locale.InterProviderFactory;
import com.fr.log.FineLoggerFactory;
import com.fr.report.ReportConfigManager;
import com.fr.scheduler.tool.FineScheduler;
import com.fr.stable.Constants;
import com.fr.stable.os.OperatingSystem;
import com.fr.third.apache.logging.log4j.Level;
import com.fr.third.guava.collect.BiMap;
import com.fr.third.guava.collect.HashBiMap;
import com.fr.transaction.Configurations;
import com.fr.transaction.Worker;
import com.fr.transaction.WorkerAdaptor;
@ -92,6 +95,7 @@ import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.File;
import java.text.DecimalFormat;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import java.util.concurrent.ExecutionException;
@ -224,6 +228,8 @@ public class PreferencePane extends BasicPane {
private JPanel saveIntervalPane;
private JPanel autoCleanPane;
private JPanel gcControlPane;
private UICheckBox startupPageEnabledCheckBox;
private IntegerEditor saveIntervalEditor;
private UICheckBox gcEnableCheckBox;
@ -245,7 +251,15 @@ public class PreferencePane extends BasicPane {
private UIRadioButton previewRenderQuality;
private static final int DPI_SCALE_S = 1;
private static final int DPI_SCALE_M = 2;
private static final BiMap<Integer, Integer> INDEX_DAY_MAP = HashBiMap.create(new HashMap<Integer, Integer>() {
{
put(ONE_DAY_INDEX, ONE_DAY_INT);
put(ONE_WEEK_INDEX, ONE_WEEK_INT);
put(ONE_MONTH_INDEX, ONE_MONTH_INT);
put(SIX_MONTH_INDEX, SIX_MONTH_INT);
put(THREE_MONTH_INDEX, THREE_MONTH_INT);
}
});
public PreferencePane() {
this.initComponents();
}
@ -418,7 +432,7 @@ public class PreferencePane extends BasicPane {
savePane.add(saveIntervalPane);
//gc面板
JPanel gcControlPane = createGcControlPane();
gcControlPane = createGcControlPane();
JPanel enableVcsPanel = new JPanel(FRGUIPaneFactory.createLeftZeroLayout());
enableVcsPanel.add(remindVcsLabel);
@ -470,9 +484,14 @@ public class PreferencePane extends BasicPane {
private VcsMovePanel createMovePane(CardLayout cardLayout, JPanel parentPane) {
return new VcsMovePanel(cardLayout, parentPane, new VcsMovePanel.MoveCallBack(){
@Override
public void doCallBack(boolean visible) {
saveIntervalPane.setVisible(visible);
autoCleanPane.setVisible(visible);
public void doCallBack(boolean useV2) {
saveIntervalPane.setVisible(useV2);
autoCleanPane.setVisible(useV2);
gcControlPane.setVisible(!useV2);
useVcsAutoCleanScheduleCheckBox.setSelected(useV2);
useVcsAutoSaveScheduleCheckBox.setSelected(useV2);
useVcsAutoCleanScheduleCheckBox.setEnabled(useV2 && FineScheduler.getInstance().isStarted());
useVcsAutoSaveScheduleCheckBox.setEnabled(useV2);
}
});
};
@ -490,7 +509,7 @@ public class PreferencePane extends BasicPane {
autoCleanPane.add(new UILabel(i18nText("Fine-Design_Vcs_Auto_Clean_Content")));
autoCleanPane.add(autoCleanRetainIntervalComboBox);
autoCleanPane.add(new UILabel(i18nText("Fine-Design_Vcs_Auto_Clean_Last")));
useVcsAutoCleanScheduleCheckBox.setEnabled(!VcsHelper.getInstance().isLegacyMode());
useVcsAutoCleanScheduleCheckBox.setEnabled(!VcsHelper.getInstance().isLegacyMode() && FineScheduler.getInstance().isStarted());
autoCleanPane.setVisible(false);
return autoCleanPane;
}
@ -916,6 +935,8 @@ public class PreferencePane extends BasicPane {
useVcsAutoSaveScheduleCheckBox.setSelected(vcsConfigManager.isUseAutoSave());
useVcsAutoCleanScheduleCheckBox.setSelected(VcsConfig.getInstance().isUseV2AutoClean());
autoSaveIntervalEditor.setValue(vcsConfigManager.getAutoSaveInterval());
autoCleanIntervalComboBox.setSelectedIndex(getIndex(VcsConfig.getInstance().getV2CleanInterval()));
autoCleanRetainIntervalComboBox.setSelectedIndex(getIndex(VcsConfig.getInstance().getV2RetainInterval()));
gridLineColorTBButton.setColor(designerEnvManager.getGridLineColor());
paginationLineColorTBButton.setColor(designerEnvManager.getPaginationLineColor());
@ -1005,18 +1026,11 @@ public class PreferencePane extends BasicPane {
}
private int getDay(int dateIndex) {
switch (dateIndex) {
case ONE_DAY_INDEX:
return ONE_DAY_INT;
case ONE_WEEK_INDEX:
return ONE_WEEK_INT;
case ONE_MONTH_INDEX:
return ONE_MONTH_INT;
case SIX_MONTH_INDEX:
return SIX_MONTH_INT;
default:
return THREE_MONTH_INT;
}
return INDEX_DAY_MAP.getOrDefault(dateIndex, THREE_MONTH_INT);
}
private int getIndex(int day) {
return INDEX_DAY_MAP.inverse().getOrDefault(day, THREE_MONTH_INDEX);
}
/**

6
designer-base/src/main/java/com/fr/design/actions/file/SwitchExistEnv.java

@ -7,6 +7,7 @@ import com.fr.design.env.DesignerWorkspaceInfo;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.file.SaveSomeTemplatePane;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.mainframe.vcs.ui.VcsMovingExitOption;
import com.fr.design.menu.KeySetUtils;
import com.fr.design.menu.MenuDef;
import com.fr.design.menu.SeparatorDef;
@ -60,6 +61,11 @@ public class SwitchExistEnv extends MenuDef {
* @param e 事件
*/
public void actionPerformed(ActionEvent e) {
//检查是否正在迁移,如果正在迁移就弹出弹窗让用户选择
if (!VcsMovingExitOption.ShowDialogAndConfirmSwitch()) {
//如果用户选择取消切换环境则返回,不然说明用户就是想切换,则往下走
return;
}
final String envName = getName();
DesignerEnvManager envManager = DesignerEnvManager.getEnvManager();
DesignerWorkspaceInfo selectedEnv = envManager.getWorkspaceInfo(envName);

15
designer-base/src/main/java/com/fr/design/gui/itableeditorpane/UITableModelAdapter.java

@ -4,6 +4,7 @@ import com.fr.base.BaseUtils;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.mainframe.DesignerContext;
import com.fr.log.FineLoggerFactory;
import org.jetbrains.annotations.Nullable;
import javax.swing.JOptionPane;
import javax.swing.JTable;
@ -64,6 +65,20 @@ public abstract class UITableModelAdapter<T> extends AbstractTableModel implemen
return null;
}
/**
* 获取映射后的值
*
* @param row
* @return
*/
@Nullable
public T getConvertRowSelectedValue(int row) {
if (table.getSelectedRow() >= 0) {
return list.get(table.convertRowIndexToModel(row));
}
return null;
}
public void setColumnClass(Class<?>[] classes) {
this.classes = classes;
}

7
designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java

@ -34,6 +34,7 @@ import com.fr.design.mainframe.share.mini.MiniShopDisposingChecker;
import com.fr.design.mainframe.toolbar.ToolBarMenuDock;
import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus;
import com.fr.design.mainframe.vcs.common.VcsHelper;
import com.fr.design.mainframe.vcs.ui.VcsMovingExitOption;
import com.fr.design.menu.ShortCut;
import com.fr.design.os.impl.MacOsAddListenerAction;
import com.fr.design.os.impl.SupportOSImpl;
@ -161,6 +162,12 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
@Override
public void windowClosing(WindowEvent e) {
//检查是否正在迁移,如果正在迁移就弹出弹窗让用户选择
if (!VcsMovingExitOption.ShowDialogAndConfirmExit()) {
//如果用户选择取消退出则返回,不然说明用户就是想退出,则往下走
return;
}
// 检查mini商城是否存在未结束的后台任务
if (!MiniShopDisposingChecker.check()) {
return;

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

@ -18,7 +18,7 @@ import java.awt.event.ActionEvent;
public class RecycleAction extends UpdateAction {
public RecycleAction() {
this.setSmallIcon("/com/fr/design/standard/vcslist/vcs_recycle");
this.setSmallIcon("/com/fr/design/standard/vcslist/vcs_recycle", false);
this.setName(Toolkit.i18nText("Fine-Design_Vcs_Recycle"));
}

11
designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/AbstractSupportSelectTablePane.java

@ -19,6 +19,7 @@ import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTable;
import javax.swing.RowSorter;
import javax.swing.SwingConstants;
import javax.swing.SwingWorker;
import javax.swing.UIManager;
@ -26,6 +27,7 @@ import javax.swing.plaf.ColorUIResource;
import javax.swing.plaf.UIResource;
import javax.swing.table.JTableHeader;
import javax.swing.table.TableCellRenderer;
import javax.swing.table.TableRowSorter;
import java.awt.*;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
@ -151,6 +153,13 @@ public abstract class AbstractSupportSelectTablePane<T extends TableEntity> exte
tablePane.add(tableTopPane, BorderLayout.NORTH);
tablePane.add(tableContentPane, BorderLayout.CENTER);
tableContentPane.getEditTable().getColumnModel().getColumn(0).setMaxWidth(50);
RowSorter<UITableModelAdapter<T>> sorter = new TableRowSorter<UITableModelAdapter<T>>(model) {
@Override
public boolean isSortable(int column) {
return column != 0;
}
};
tableContentPane.getEditTable().setRowSorter(sorter);
return tablePane;
}
@ -171,7 +180,7 @@ public abstract class AbstractSupportSelectTablePane<T extends TableEntity> exte
int row = ((JTable) e.getSource()).rowAtPoint(e.getPoint());
int col = ((JTable) e.getSource()).columnAtPoint(e.getPoint());
if (col == 0) {
T entity = model.getSelectedValue();
T entity = model.getConvertRowSelectedValue(row);
//改变面板的各个状态
changeComponentStatus(entity, row, col, table);
}

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

@ -189,4 +189,9 @@ public class VcsCenterPane extends VcsNewPane {
protected boolean isNeedRestore() {
return false;
}
@Override
protected boolean isNeedSearch() {
return true;
}
}

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

@ -197,8 +197,14 @@ public class VcsMovePanel extends BasicPane {
private void initTipDesc() {
UILabel descLabel = FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Vcs_Move_Desc"));
UILabel firstLabel = FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Vcs_Move_Tips_First"));
UILabel secondLabel = FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Vcs_Move_Tips_Second"));
descLabel.setForeground(TIP_COLOR);
firstLabel.setForeground(TIP_COLOR);
secondLabel.setForeground(TIP_COLOR);
choosePane.add(descLabel);
choosePane.add(firstLabel);
choosePane.add(secondLabel);
}
private void initRadioButton() {
@ -372,7 +378,7 @@ public class VcsMovePanel extends BasicPane {
}
private class MoveWorker extends SwingWorker<Void, Integer> {
private class MoveWorker extends SwingWorker<Boolean, Integer> {
private VcsMoveStrategy strategy;
@ -381,7 +387,7 @@ public class VcsMovePanel extends BasicPane {
}
@Override
protected Void doInBackground() throws Exception {
protected Boolean doInBackground() throws Exception {
try {
//开始迁移
VcsMoveService.getInstance().startMove(new VcsMoveService.BaseMoveServiceWhileMoving() {
@ -396,13 +402,10 @@ public class VcsMovePanel extends BasicPane {
}
}, strategy);
} catch (Exception e) {
this.cancel(true);
VcsMoveService.getInstance().stopMoving();
initFailedPane();
VcsMovePanel.this.getParentCard().show(getParentPane(), FAILED);
FineLoggerFactory.getLogger().error("[VcsV2] Vcs move failed!");
return false;
}
return null;
return true;
}
@Override
@ -413,13 +416,22 @@ public class VcsMovePanel extends BasicPane {
@Override
protected void done() {
VcsMoveService.getInstance().stopMoving();
initSuccessPane();
VcsMovePanel.this.getParentCard().show(getParentPane(), SUCCESS);
VcsHelper.getInstance().updateLegacyMode();
try {
if (get()) {
initSuccessPane();
VcsMovePanel.this.getParentCard().show(getParentPane(), SUCCESS);
VcsHelper.getInstance().updateLegacyMode();
} else {
initFailedPane();
VcsMovePanel.this.getParentCard().show(getParentPane(), FAILED);
FineLoggerFactory.getLogger().error("[VcsV2] Vcs move failed!");
}
} catch (InterruptedException | ExecutionException e) {
throw new RuntimeException(e);
}
}
}
/**
* 迁移回调事件
*

54
designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsMovingExitOption.java

@ -0,0 +1,54 @@
package com.fr.design.mainframe.vcs.ui;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DesignerContext;
import com.fr.workspace.server.vcs.v2.move.VcsMoveService;
import javax.swing.JOptionPane;
/**
* 版本管理迁移检查
*
* @author Destiny.Lin
* @since 11.0
* Created on 2023/7/18
*/
public class VcsMovingExitOption {
/**
* 关闭前的检查
*
* @return
*/
public static boolean ShowDialogAndConfirmExit() {
return showDialogAndChoose(Toolkit.i18nText("Fine-Design_Vcs_Close_Tips"));
}
/**
* 切换环境前的检查
*
* @return
*/
public static boolean ShowDialogAndConfirmSwitch() {
return showDialogAndChoose(Toolkit.i18nText("Fine-Design_Vcs_Switch_Tips"));
}
private static boolean showDialogAndChoose(String msg) {
if (VcsMoveService.getInstance().isMoving()) {
int result = FineJOptionPane.showConfirmDialog(
DesignerContext.getDesignerFrame(),
msg,
Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"),
FineJOptionPane.YES_NO_OPTION
);
return result == JOptionPane.YES_OPTION;
}
return true;
}
}
Loading…
Cancel
Save