Browse Source

Pull request #12502: REPORT-100958 【版本管理三期】还原或者预览版本,弹窗应该关闭 & REPORT-100458 【版本管理二期】迁移弹窗,保留版本的输入框没有非法值校验

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

* commit 'fbe7375e684e154ec7068c47372b4c58a18e8404':
  REPORT-100958 【版本管理三期】还原或者预览版本,弹窗应该关闭 修改方法名
  REPORT-100958 【版本管理三期】还原或者预览版本,弹窗应该关闭 修改方法名
  REPORT-100458 【版本管理二期】迁移弹窗,保留版本的输入框没有非法值校验
  REPORT-100958 【版本管理三期】还原或者预览版本,弹窗应该关闭
  REPORT-100958 【版本管理三期】还原或者预览版本,弹窗应该关闭
release/11.0
parent
commit
a33c1cd216
  1. 17
      designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java
  2. 10
      designer-base/src/main/java/com/fr/design/editor/editor/NumberEditor.java
  3. 1
      designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java
  4. 26
      designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/RecyclePane.java
  5. 59
      designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/UIPositiveIntEditor.java
  6. 39
      designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/UIPositiveIntSpinner.java
  7. 13
      designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsCenterPane.java
  8. 18
      designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsMovePanel.java
  9. 4
      designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsNewPane.java

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

@ -36,6 +36,7 @@ import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.layout.VerticalFlowLayout;
import com.fr.design.mainframe.vcs.VcsConfigManager;
import com.fr.design.mainframe.vcs.common.VcsHelper;
import com.fr.design.mainframe.vcs.ui.UIPositiveIntEditor;
import com.fr.design.mainframe.vcs.ui.VcsMovePanel;
import com.fr.design.os.impl.SupportOSImpl;
import com.fr.design.unit.UnitConvertUtil;
@ -179,6 +180,8 @@ public class PreferencePane extends BasicPane {
private static final int DEFAULT_INDEX = 3;
private BasicDialog basicDialog;
private boolean languageChanged; // 是否修改了设计器语言设置
//设置是否支持undo
private UICheckBox supportUndoCheckBox;
@ -223,7 +226,7 @@ public class PreferencePane extends BasicPane {
private UIComboBox autoCleanIntervalComboBox;
private UIComboBox autoCleanRetainIntervalComboBox;
private IntegerEditor autoSaveIntervalEditor;
private UIPositiveIntEditor autoSaveIntervalEditor;
private UICheckBox saveCommitCheckBox;
private UICheckBox useIntervalCheckBox;
private VcsMovePanel movePanel;
@ -233,7 +236,7 @@ public class PreferencePane extends BasicPane {
private JPanel gcControlPane;
private UICheckBox startupPageEnabledCheckBox;
private IntegerEditor saveIntervalEditor;
private UIPositiveIntEditor saveIntervalEditor;
private UICheckBox gcEnableCheckBox;
private UIButton gcButton;
private UILabel remindVcsLabel;
@ -428,7 +431,7 @@ public class PreferencePane extends BasicPane {
saveIntervalPane = createSaveIntervalPane();
saveCommitCheckBox = new UICheckBox(i18nText("Fine-Design_Vcs_No_Delete"));
saveIntervalEditor = new IntegerEditor(60);
saveIntervalEditor = new UIPositiveIntEditor(60);
useIntervalCheckBox = new UICheckBox();
savePane.add(vcsEnableCheckBox);
savePane.add(saveIntervalPane);
@ -500,7 +503,7 @@ public class PreferencePane extends BasicPane {
checkAutoScheduleStartAndUpdateStatus();
useVcsAutoSaveScheduleCheckBox.setEnabled(useV2);
}
});
}, basicDialog);
};
private JPanel createAutoCleanPane() {
@ -554,7 +557,7 @@ public class PreferencePane extends BasicPane {
private JPanel createSaveIntervalPane() {
JPanel saveIntervalPane = new JPanel(FRGUIPaneFactory.createLeftZeroLayout());
useVcsAutoSaveScheduleCheckBox = new UICheckBox();
autoSaveIntervalEditor = new IntegerEditor(60);
autoSaveIntervalEditor = new UIPositiveIntEditor(60);
saveIntervalPane.add(useVcsAutoSaveScheduleCheckBox);
saveIntervalPane.add(new UILabel(i18nText("Fine-Design_Vcs_Every")));
saveIntervalPane.add(autoSaveIntervalEditor);
@ -1262,12 +1265,14 @@ public class PreferencePane extends BasicPane {
@Override
public BasicDialog showWindow(Window window) {
return showWindow(window, new DialogActionAdapter() {
basicDialog = showWindow(window, new DialogActionAdapter() {
@Override
public void doOk() {
languageChanged = !ComparatorUtils.equals(languageComboBox.getSelectedItem(), DesignerEnvManager.getEnvManager(false).getLanguage());
}
});
movePanel.setParentDialog(basicDialog);
return basicDialog;
}
@Override

10
designer-base/src/main/java/com/fr/design/editor/editor/NumberEditor.java

@ -38,7 +38,7 @@ public abstract class NumberEditor<T extends Number> extends Editor<T> {
*/
public NumberEditor(T value, String name) {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
numberField = new UINumberField();
numberField = createNumberField();
this.add(numberField, BorderLayout.CENTER);
this.numberField.addKeyListener(textKeyListener);
this.numberField.setHorizontalAlignment(UITextField.RIGHT);
@ -46,6 +46,14 @@ public abstract class NumberEditor<T extends Number> extends Editor<T> {
this.setName(name);
}
/**
* 创建NumberField对象
*
*/
protected UINumberField createNumberField() {
return new UINumberField();
}
/**
* 给numberField加键盘事件
*

1
designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java

@ -410,6 +410,7 @@ public class TemplateTreePane extends JPanel implements FileOperations {
try {
WorkContext.getCurrent().get(VcsOperator.class).recycleVersion(VcsHelper.getInstance().getCurrentUsername(), VcsHelper.getInstance().dealWithFilePath(((FileNode) node).getEnvPath()));
} catch (Exception e) {
FineLoggerFactory.getLogger().error("[VcsV2] recycle {} failed", nodeFILE.getName());
return false;
}
if (TemplateResourceManager.getResource().delete(nodeFILE)) {

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

@ -53,7 +53,7 @@ public class RecyclePane extends AbstractSupportSelectTablePane<VcsTableEntity>
private static final int COLUMNS_COUNT = 15;
private BasicDialog dialog;
private BasicDialog parent;
private BasicDialog parentDialog;
private List<VcsTableEntity> tableEntities;
public RecyclePane() {
@ -234,21 +234,27 @@ public class RecyclePane extends AbstractSupportSelectTablePane<VcsTableEntity>
* @param parent 父弹窗
*/
public void showDialog(BasicDialog parent) {
this.parent = parent;
this.parentDialog = parent;
dialog = this.showWindow(parent, false);
initDialogListener(dialog);
dialog.setVisible(true);
}
protected void initDialogListener(BasicDialog dialog) {
}
/**
* 关闭弹窗如果有父弹窗则一起关闭
* 关闭弹窗,如果有父弹窗,则一起关闭,如果有属性配置的弹窗面板要保存再关闭
*
*/
public void closeDialog() {
public void saveSettingAndCloseDialog() {
if (dialog != null) {
dialog.doOK();
dialog.dispose();
}
if (parent != null) {
parent.dispose();
if (parentDialog != null) {
parentDialog.doOK();
parentDialog.dispose();
}
}
@ -260,6 +266,14 @@ public class RecyclePane extends AbstractSupportSelectTablePane<VcsTableEntity>
this.dialog = dialog;
}
public BasicDialog getParentDialog() {
return parentDialog;
}
public void setParentDialog(BasicDialog parentDialog) {
this.parentDialog = parentDialog;
}
/**
* 删除范围
*

59
designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/UIPositiveIntEditor.java

@ -0,0 +1,59 @@
package com.fr.design.mainframe.vcs.ui;
import com.fr.design.editor.editor.IntegerEditor;
import com.fr.design.gui.itextfield.UIIntNumberField;
import com.fr.design.gui.itextfield.UINumberField;
import com.fr.stable.StringUtils;
import java.awt.event.FocusAdapter;
import java.awt.event.FocusEvent;
/**
* 正整数输入框
*
* @author Destiny.Lin
* @since 11.0
* Created on 2023/7/25
*/
public class UIPositiveIntEditor extends IntegerEditor {
private static final int DEFAULT_COLUMNS = 4;
private static final int MIN = 1;
private static final int MAX = 99999;
private static final int DEFAULT_VALUE = 60;
public UIPositiveIntEditor(Integer value) {
super(value);
numberField.setMaxValue(MAX);
numberField.setMinValue(MIN);
initNumberFieldListener();
}
public UIPositiveIntEditor(Integer value, Integer min, Integer max) {
super(value);
numberField.setMaxValue(max);
numberField.setMinValue(min);
initNumberFieldListener();
}
private void initNumberFieldListener() {
numberField.addFocusListener(new FocusAdapter() {
@Override
public void focusLost(FocusEvent e) {
if (StringUtils.isEmpty(numberField.getTextValue())) {
numberField.setValue(DEFAULT_VALUE);
}
}
});
}
@Override
protected UINumberField createNumberField() {
UIIntNumberField field = new UIIntNumberField();
field.setColumns(DEFAULT_COLUMNS);
return field;
}
}

39
designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/UIPositiveIntSpinner.java

@ -0,0 +1,39 @@
package com.fr.design.mainframe.vcs.ui;
import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.gui.itextfield.UIIntNumberField;
import com.fr.design.gui.itextfield.UINumberField;
/**
* 只允许输入正整数的Spinner
*
* @author Destiny.Lin
* @since 11.0
* Created on 2023/7/25
*/
public class UIPositiveIntSpinner extends UISpinner {
private static final int DEFAULT_COLUMNS = 5;
public UIPositiveIntSpinner() {
}
public UIPositiveIntSpinner(double minValue, double maxValue, double dierta) {
super(minValue, maxValue, dierta);
}
public UIPositiveIntSpinner(double minValue, double maxValue, double dierta, double defaultValue) {
super(minValue, maxValue, dierta, defaultValue);
}
public UIPositiveIntSpinner(double minValue, double maxValue, double dierta, double defaultValue, boolean fillNegativeNumber) {
super(minValue, maxValue, dierta, defaultValue, fillNegativeNumber);
}
@Override
protected UINumberField initNumberField() {
UIIntNumberField field = new UIIntNumberField();
field.setColumns(DEFAULT_COLUMNS);
return field;
}
}

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

@ -2,6 +2,7 @@ package com.fr.design.mainframe.vcs.ui;
import com.fr.base.svg.IconUtils;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
@ -139,6 +140,7 @@ public class VcsCenterPane extends VcsNewPane {
Object o = table.getValueAt(table.getEditingRow(), table.getEditingColumn());
if (o instanceof VcsTableEntity) {
VcsEntity entity = ((VcsTableEntity) o).getEntity();
saveSettingAndCloseDialog();
DesignerContext.getDesignerFrame().openTemplate(new FileNodeFILE(new FileNode(getTemplateTruePath(entity.getFilename()), false)));
}
}
@ -176,6 +178,17 @@ public class VcsCenterPane extends VcsNewPane {
return tableEntities;
}
@Override
protected void initDialogListener(BasicDialog dialog) {
dialog.addDialogActionListener(new DialogActionAdapter() {
@Override
public void doOk() {
getParentDialog().doOK();
getParentDialog().dispose();
}
});
}
@Override
protected String title4PopupWindow() {
return TITLE;

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

@ -82,6 +82,8 @@ public class VcsMovePanel extends BasicPane {
public static final String FAILED = "FAILED";
public static boolean moving = false;
private BasicDialog parentDialog;
private UILabel vcsUpdateExistLabel = new UILabel();
private UILabel vcsUpdateFireLabel = new UILabel();
@ -110,7 +112,7 @@ public class VcsMovePanel extends BasicPane {
//全部放弃
private UIRadioButton moveNothingButton;
private UISpinner spinner;
private UIPositiveIntSpinner spinner;
private MoveCallBack callBack;
@ -119,11 +121,12 @@ public class VcsMovePanel extends BasicPane {
private boolean visible = false;
public VcsMovePanel(CardLayout cardLayout, JPanel parentPane, MoveCallBack callBack) {
public VcsMovePanel(CardLayout cardLayout, JPanel parentPane, MoveCallBack callBack, BasicDialog parentDialog) {
this.parentCard = cardLayout;
this.parentPane = parentPane;
this.callBack = callBack;
this.setLayout(new BorderLayout());
this.parentDialog = parentDialog;
updatePane = FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane();
updatePane.setBorder(BorderFactory.createEmptyBorder(10, 10, 0, 0));
//初始化顶部的面板
@ -235,7 +238,7 @@ public class VcsMovePanel extends BasicPane {
moveAllPane.add(moveAllButton);
moveDefaultPanel.add(moveDefaultButton);
moveDefaultPanel.add(new UILabel(Toolkit.i18nText("Fine-Design_Vcs_Move_Default_Text_Left")));
spinner = new UISpinner(MIN_VALUE, MAX_VALUE, STEP, DEFAULT_VALUE);
spinner = new UIPositiveIntSpinner(MIN_VALUE, MAX_VALUE, STEP, DEFAULT_VALUE);
moveDefaultPanel.add(spinner);
moveDefaultPanel.add(new UILabel(Toolkit.i18nText("Fine-Design_Vcs_Move_Default_Text_Right")));
moveNothingPane.add(moveNothingButton);
@ -268,7 +271,7 @@ public class VcsMovePanel extends BasicPane {
@Override
public void actionPerformed(ActionEvent e) {
VcsCenterPane vcsCenterPane = new VcsCenterPane();
vcsCenterPane.showDialog();
vcsCenterPane.showDialog(parentDialog);
}
});
}
@ -362,6 +365,13 @@ public class VcsMovePanel extends BasicPane {
parentCard.show(parentPane, SETTING);
}
public BasicDialog getParentDialog() {
return parentDialog;
}
public void setParentDialog(BasicDialog parentDialog) {
this.parentDialog = parentDialog;
}
@Override
protected String title4PopupWindow() {

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

@ -160,7 +160,7 @@ public class VcsNewPane extends RecyclePane {
JOptionPane.QUESTION_MESSAGE);
if (selVal == JOptionPane.YES_OPTION) {
restoreEntity(entity);
VcsNewPane.this.closeDialog();
VcsNewPane.this.saveSettingAndCloseDialog();
}
}
}
@ -230,7 +230,7 @@ public class VcsNewPane extends RecyclePane {
if (o instanceof VcsTableEntity) {
VcsEntity entity = ((VcsTableEntity) o).getEntity();
previewEntity(entity);
VcsNewPane.this.closeDialog();
VcsNewPane.this.saveSettingAndCloseDialog();
}
}
});

Loading…
Cancel
Save