Browse Source

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

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

* commit 'd8192fe60f80b161b915e10b297bd82c9daf65ff':
  REPORT-100954 【版本管理三期】版本中心弹窗交互问题
  REPORT-100757 【版本管理二期】未启动内置服务器,自动清理配置没有灰化
  REPORT-100991 【版本管理三期】版本中心二次搜索结果为空
  REPORT-100984 【版本管理二期】迁移完成直接进入新版版本管理,会有更新选项
  REPORT-100939 【版本管理三期】次管可见回收站 调换一下顺序
  REPORT-100939 【版本管理三期】次管可见回收站 去除多余引入
  REPORT-100939 【版本管理三期】次管可见回收站
  REPORT-100942 【版本管理三期】版本中心,版本详情,回收站的操作是否要加悬浮提示
  REPORT-100939 【版本管理三期】次管可见回收站
  REPORT-101035 【版本管理三期】版本中心删除模板的所有版本,版本中心没有实时刷新
  REPORT-101037 【版本管理三期】版本中心通过批量删除的按钮删除版本,只会删除一个版本
newui
parent
commit
187a5302e2
  1. 15
      designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java
  2. 2
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java
  3. 2
      designer-base/src/main/java/com/fr/design/mainframe/vcs/VcsTableEntity.java
  4. 19
      designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java
  5. 30
      designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/RecyclePane.java
  6. 35
      designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsCellEditor.java
  7. 29
      designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsCellRender.java
  8. 12
      designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsCenterPane.java
  9. 13
      designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsMovePanel.java
  10. 7
      designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsNewPane.java
  11. 37
      designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsOperatorPane.java

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

@ -467,8 +467,9 @@ public class PreferencePane extends BasicPane {
vcsPane.add(intervalPanel);
vcsPane.add(saveCommitCheckBox);
vcsPane.add(autoCleanPane);
saveIntervalPane.setVisible(!VcsHelper.getInstance().isLegacyMode());
autoCleanPane.setVisible(!VcsHelper.getInstance().isLegacyMode());
boolean support = VcsHelper.getInstance().checkV2FunctionSupport();
saveIntervalPane.setVisible(support);
autoCleanPane.setVisible(support);
if (VcsHelper.getInstance().isLegacyMode()) {
// 老版本时才显示gc选项
vcsPane.add(gcControlPane);
@ -490,7 +491,10 @@ public class PreferencePane extends BasicPane {
gcControlPane.setVisible(!useV2);
useVcsAutoCleanScheduleCheckBox.setSelected(useV2);
useVcsAutoSaveScheduleCheckBox.setSelected(useV2);
useVcsAutoCleanScheduleCheckBox.setEnabled(useV2 && FineScheduler.getInstance().isStarted());
boolean useAutoClean =useV2 && FineScheduler.getInstance().isStarted();
useVcsAutoCleanScheduleCheckBox.setEnabled(useAutoClean);
autoCleanIntervalComboBox.setEnabled(useAutoClean);
autoCleanRetainIntervalComboBox.setEnabled(useAutoClean);
useVcsAutoSaveScheduleCheckBox.setEnabled(useV2);
}
});
@ -509,7 +513,10 @@ 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() && FineScheduler.getInstance().isStarted());
boolean useAutoClean = !VcsHelper.getInstance().isLegacyMode() && FineScheduler.getInstance().isStarted();
useVcsAutoCleanScheduleCheckBox.setEnabled(useAutoClean);
autoCleanIntervalComboBox.setEnabled(useAutoClean);
autoCleanRetainIntervalComboBox.setEnabled(useAutoClean);
autoCleanPane.setVisible(false);
return autoCleanPane;
}

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

@ -337,7 +337,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
}
toolbarDef.addShortCut(vcsAction);
//11.0.19及其之后加入回收站逻辑
if (!VcsHelper.getInstance().isLegacyMode()) {
if (VcsHelper.getInstance().checkV2FunctionSupport()) {
recycleAction = new RecycleAction();
toolbarDef.addShortCut(recycleAction);
}

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

@ -39,7 +39,7 @@ public class VcsTableEntity implements TableEntity{
* @return 版本大小
*/
public String getSize() {
return String.format("%.2f",entity.getSize()/MB_SIZE) + MB;
return String.format("%.3f",entity.getSize()/MB_SIZE) + MB;
}
/**

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

@ -15,6 +15,7 @@ import com.fr.design.mainframe.vcs.VcsConfigManager;
import com.fr.design.mainframe.vcs.ui.FileVersionTable;
import com.fr.event.Event;
import com.fr.event.EventDispatcher;
import com.fr.event.Listener;
import com.fr.event.ListenerAdaptor;
import com.fr.general.IOUtils;
import com.fr.log.FineLoggerFactory;
@ -24,6 +25,8 @@ import com.fr.report.entity.VcsEntity;
import com.fr.stable.StringUtils;
import com.fr.stable.project.ProjectConstants;
import com.fr.workspace.WorkContext;
import com.fr.workspace.Workspace;
import com.fr.workspace.WorkspaceEvent;
import com.fr.workspace.server.vcs.VcsOperator;
import com.fr.workspace.server.vcs.filesystem.VcsFileSystem;
import com.fr.workspace.server.vcs.git.config.GcConfig;
@ -66,6 +69,8 @@ public class VcsHelper implements JTemplateActionListener {
private volatile boolean legacyMode;
private volatile boolean root;
public static VcsHelper getInstance() {
return INSTANCE;
}
@ -89,6 +94,18 @@ public class VcsHelper implements JTemplateActionListener {
}
}
});
EventDispatcher.listen(WorkspaceEvent.AfterSwitch, new Listener<Workspace>() {
@Override
public void on(Event event, Workspace param) {
try {
root = WorkContext.getCurrent().isLocal() || WorkContext.getCurrent().isRoot() ;
} catch (Exception e) {
root = false;
FineLoggerFactory.getLogger().error("[VcsHelper] get root failed", e.getMessage());
}
}
});
}
/**
@ -370,7 +387,7 @@ public class VcsHelper implements JTemplateActionListener {
* @return 支持返回true
*/
public boolean checkV2FunctionSupport() {
return !VcsHelper.getInstance().isLegacyMode() && (WorkContext.getCurrent().isLocal() || WorkContext.getCurrent().isRoot());
return !VcsHelper.getInstance().isLegacyMode() && root;
}
/**

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

@ -48,6 +48,8 @@ public class RecyclePane extends AbstractSupportSelectTablePane<VcsTableEntity>
private static final int COLUMNS_COUNT = 15;
private List<VcsTableEntity> tableEntities;
public RecyclePane() {
super(i18nText("Fine-Design_Vcs_Recycle"), (o, columnIndex) -> {
switch (columnIndex) {
@ -86,6 +88,7 @@ public class RecyclePane extends AbstractSupportSelectTablePane<VcsTableEntity>
for (VcsEntity entity : entityList) {
tableEntities.add(new VcsTableEntity(entity));
}
updateTableList(tableEntities);
return tableEntities;
}
@ -128,6 +131,7 @@ public class RecyclePane extends AbstractSupportSelectTablePane<VcsTableEntity>
private void initDeleteLabelListener() {
if (isNeedDelete()) {
deleteLabel.setToolTipText(Toolkit.i18nText("Fine-Design_Vcs_ToolTip_Delete"));
deleteLabel.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
@ -144,6 +148,7 @@ public class RecyclePane extends AbstractSupportSelectTablePane<VcsTableEntity>
private void initRestoreListener() {
if (isNeedRestore()) {
restoreLabel.setToolTipText(Toolkit.i18nText("Fine-Design_Vcs_ToolTip_Restore"));
restoreLabel.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
@ -164,8 +169,7 @@ public class RecyclePane extends AbstractSupportSelectTablePane<VcsTableEntity>
@Override
public void actionPerformed(ActionEvent e) {
String str = searchTextField.getText();
List<VcsTableEntity> entityList = model.getList();
model.setList(entityList.stream().filter(entity -> entity.getEntity().getFilename().contains(str)).collect(Collectors.toList()));
model.setList(tableEntities.stream().filter(entity -> entity.getEntity().getFilename().contains(str)).collect(Collectors.toList()));
model.fireTableDataChanged();
}
});
@ -183,7 +187,8 @@ public class RecyclePane extends AbstractSupportSelectTablePane<VcsTableEntity>
JOptionPane.OK_CANCEL_OPTION,
JOptionPane.QUESTION_MESSAGE);
if (selVal == JOptionPane.YES_OPTION) {
model.setList(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.fireTableDataChanged();
listener.doAfterChooseYes(selectList);
}
@ -250,6 +255,25 @@ public class RecyclePane extends AbstractSupportSelectTablePane<VcsTableEntity>
return true;
}
/**
* 更新数据列表
*
* @param entities
*/
public void updateTableList(List<VcsTableEntity> entities) {
tableEntities = entities;
}
/**
* 移除指定元素
*
* @param entity
*/
public void removeTarget(VcsTableEntity entity) {
tableEntities.remove(entity);
}
/**
* 版本管理按钮事件响应
*/

35
designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsCellEditor.java

@ -0,0 +1,35 @@
package com.fr.design.mainframe.vcs.ui;
import javax.swing.AbstractCellEditor;
import javax.swing.JTable;
import javax.swing.table.TableCellEditor;
import java.awt.*;
import static com.fr.design.mainframe.vcs.ui.AbstractSupportSelectTablePane.DEFAULT_SELECT_TABLE_ROW_COLOR;
/**
* Vcs的表格Editor
*
* @author Destiny.Lin
* @since 11.0
* Created on 2023/7/20
*/
public class VcsCellEditor extends AbstractCellEditor implements TableCellEditor {
private final VcsOperatorPane vcsPanel;
public VcsCellEditor(VcsOperatorPane vcsPanel) {
this.vcsPanel = vcsPanel;
}
@Override
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
vcsPanel.setBackground(isSelected ? DEFAULT_SELECT_TABLE_ROW_COLOR : Color.WHITE);
return vcsPanel;
}
@Override
public Object getCellEditorValue() {
return vcsPanel;
}
}

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

@ -0,0 +1,29 @@
package com.fr.design.mainframe.vcs.ui;
import javax.swing.JTable;
import javax.swing.table.TableCellRenderer;
import java.awt.*;
import static com.fr.design.mainframe.vcs.ui.AbstractSupportSelectTablePane.DEFAULT_SELECT_TABLE_ROW_COLOR;
/**
* Vcs的表格Render
*
* @author Destiny.Lin
* @since 11.0
* Created on 2023/7/20
*/
public class VcsCellRender implements TableCellRenderer {
private final VcsOperatorPane vcsPanel;
public VcsCellRender(VcsOperatorPane vcsPanel) {
this.vcsPanel = vcsPanel;
}
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
vcsPanel.setBackground(isSelected ? DEFAULT_SELECT_TABLE_ROW_COLOR : Color.WHITE);
return vcsPanel;
}
}

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

@ -83,8 +83,11 @@ public class VcsCenterPane extends VcsNewPane {
@Override
public VcsOperatorPane createOperatorPane() {
manager = new UILabel(MANAGER_ICON);
manager.setToolTipText(Toolkit.i18nText("Fine-Design_Vcs_ToolTip_Manager"));
open = new UILabel(OPEN_ICON);
open.setToolTipText(Toolkit.i18nText("Fine-Design_Vcs_ToolTip_Open"));
delete = new UILabel(DELETE_ICON);
delete.setToolTipText(Toolkit.i18nText("Fine-Design_Vcs_ToolTip_Delete"));
initManagerListener();
initOpenListener();
initDeleteListener();
@ -112,6 +115,9 @@ public class VcsCenterPane extends VcsNewPane {
JOptionPane.QUESTION_MESSAGE);
if (selVal == JOptionPane.YES_OPTION) {
VcsOperatorWorker.createDeleteWorker().doDelete(entity);
removeTarget((VcsTableEntity) o);
model.getList().remove(o);
model.fireTableDataChanged();
}
DesignerContext.getDesignerFrame().openTemplate(new FileNodeFILE(new FileNode(getTemplateTruePath(fileName), false)));
}
@ -161,6 +167,7 @@ public class VcsCenterPane extends VcsNewPane {
for (VcsEntity entity : entities) {
tableEntities.add(new VcsTableEntity(entity));
}
updateTableList(tableEntities);
return tableEntities;
}
@ -194,4 +201,9 @@ public class VcsCenterPane extends VcsNewPane {
protected boolean isNeedSearch() {
return true;
}
@Override
protected boolean isNeedDeleteAllVersion() {
return true;
}
}

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

@ -16,6 +16,7 @@ import com.fr.design.layout.VerticalFlowLayout;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.vcs.common.VcsHelper;
import com.fr.design.utils.DesignUtils;
import com.fr.design.utils.ThemeUtils;
import com.fr.design.widget.FRWidgetFactory;
import com.fr.general.FRFont;
import com.fr.log.FineLoggerFactory;
@ -37,6 +38,9 @@ import java.awt.event.MouseEvent;
import java.util.List;
import java.util.concurrent.ExecutionException;
import static javax.swing.JOptionPane.YES_NO_CANCEL_OPTION;
import static javax.swing.JOptionPane.YES_OPTION;
/**
* 迁移面板
@ -238,7 +242,9 @@ public class VcsMovePanel extends BasicPane {
}
private void initVcsLabel(JPanel parent) {
parent.removeAll();
if (!VcsHelper.getInstance().isLegacyMode()) {
parent.setBackground(ThemeUtils.BACK_COLOR);
centerButton = new UIButton(Toolkit.i18nText("Fine-Design_Vcs_Center"));
parent.add(centerButton);
initVcsCenterListener();
@ -324,11 +330,8 @@ public class VcsMovePanel extends BasicPane {
private void doAfterMove() {
visible = !VcsHelper.getInstance().isLegacyMode();
if (visible) {
updatePane = FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane();
updatePane.add(new UIButton(Toolkit.i18nText("Fine-Design_Vcs_Center")));
}
updatePane.setVisible(!visible);
initVcsLabel(updatePane);
updatePane.setVisible(visible);
callBack.doCallBack(visible);
parentCard.show(parentPane, SETTING);
}

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

@ -111,8 +111,8 @@ public class VcsNewPane extends RecyclePane {
}
};
this.operatorPane = createOperatorPane();
this.model.setDefaultEditor(VcsOperatorPane.class, operatorPane);
this.model.setDefaultRenderer(VcsOperatorPane.class, operatorPane);
this.model.setDefaultEditor(VcsOperatorPane.class, new VcsCellEditor(createOperatorPane()));
this.model.setDefaultRenderer(VcsOperatorPane.class, new VcsCellRender(createOperatorPane()));
}
@ -128,8 +128,11 @@ public class VcsNewPane extends RecyclePane {
*/
public VcsOperatorPane createOperatorPane() {
restore = new UILabel(RESTORE_ICON);
restore.setToolTipText(Toolkit.i18nText("Fine-Design_Vcs_ToolTip_Restore"));
delete = new UILabel(DELETE_ICON);
delete.setToolTipText(Toolkit.i18nText("Fine-Design_Vcs_ToolTip_Delete"));
preview = new UILabel(PREVIEW_ICON);
preview.setToolTipText(Toolkit.i18nText("Fine-Design_Vcs_ToolTip_Preview"));
initPreviewListener();
initDeleteListener();
initRestoreListener();

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

@ -3,20 +3,15 @@ package com.fr.design.mainframe.vcs.ui;
import com.fr.design.layout.FRGUIPaneFactory;
import javax.swing.AbstractCellEditor;
import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.JTable;
import javax.swing.table.TableCellEditor;
import javax.swing.table.TableCellRenderer;
import java.awt.*;
import java.util.List;
import java.util.List;
import static com.fr.design.mainframe.vcs.ui.AbstractSupportSelectTablePane.DEFAULT_SELECT_TABLE_ROW_COLOR;
/**
* 操作面板用于置放常用的操作label
@ -27,37 +22,19 @@ import static com.fr.design.mainframe.vcs.ui.AbstractSupportSelectTablePane.DEFA
* @since 11.0
* Created on 2023/7/13
*/
public class VcsOperatorPane extends AbstractCellEditor implements TableCellEditor, TableCellRenderer {
private JPanel contentPane;
private static final Color DETAIL_FONT_COLOR = new Color(65, 155, 249);
public class VcsOperatorPane extends JPanel {
public VcsOperatorPane(List<JComponent> iconJComponentMap) {
init(iconJComponentMap);
}
private void init(List<JComponent> iconJComponentMap) {
contentPane = new JPanel(FRGUIPaneFactory.createLeftZeroVgapNormalHgapLayout());
this.setLayout(FRGUIPaneFactory.createLeftZeroVgapNormalHgapLayout());
for (JComponent value : iconJComponentMap) {
value.setForeground(DETAIL_FONT_COLOR);
value.setCursor(new Cursor(Cursor.HAND_CURSOR));
contentPane.add(value);
this.add(value);
}
}
@Override
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
return contentPane;
}
@Override
public Object getCellEditorValue() {
return contentPane;
}
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
contentPane.setBackground(isSelected ? DEFAULT_SELECT_TABLE_ROW_COLOR : Color.WHITE);
return contentPane;
}
}

Loading…
Cancel
Save