Browse Source

REPORT-58089 【主题切换】单元格样式重名以后变成重命名,会导致多个重命名

【问题原因】
重命名主题配置中的单元格样式时,若出现名称为空或
名称重复的情况,则直接恢复为旧名称

【改动思路】
同上
research/11.0
Starryi 3 years ago
parent
commit
7c96c453a7
  1. 4
      designer-base/src/main/java/com/fr/design/mainframe/theme/edit/CellStyleListEditPane.java

4
designer-base/src/main/java/com/fr/design/mainframe/theme/edit/CellStyleListEditPane.java

@ -67,10 +67,12 @@ public class CellStyleListEditPane extends JListControlPane {
allNames[index] = StringUtils.EMPTY; allNames[index] = StringUtils.EMPTY;
if (StringUtils.isEmpty(newName)) { if (StringUtils.isEmpty(newName)) {
showTipDialogAndReset(i18nText("Fine-Design_Basic_Predefined_Style_Empty_Name"), index); showTipDialogAndReset(i18nText("Fine-Design_Basic_Predefined_Style_Empty_Name"), index);
nameableList.setNameAt(oldName, index);
return; return;
} }
if (isNameRepeated(new List[]{Arrays.asList(allNames)}, newName)) { if (isNameRepeated(new List[]{Arrays.asList(allNames)}, newName)) {
showTipDialogAndReset(i18nText("Fine-Design_Basic_Predefined_Style_Duplicate_Name", newName), index); showTipDialogAndReset(i18nText("Fine-Design_Basic_Predefined_Style_Duplicate_Name", newName), index);
nameableList.setNameAt(oldName, index);
return; return;
} }
populateSelectedValue(); populateSelectedValue();
@ -249,6 +251,7 @@ public class CellStyleListEditPane extends JListControlPane {
super(i18nText("Fine-Design_Predefined_Cell_New_Style"), ThemedCellStyle.class, updatePane); super(i18nText("Fine-Design_Predefined_Cell_New_Style"), ThemedCellStyle.class, updatePane);
} }
@Override
public Nameable createNameable(UnrepeatedNameHelper helper) { public Nameable createNameable(UnrepeatedNameHelper helper) {
ThemedCellStyle cellStyle = new ThemedCellStyle(); ThemedCellStyle cellStyle = new ThemedCellStyle();
cellStyle.setName(menuName); cellStyle.setName(menuName);
@ -260,6 +263,7 @@ public class CellStyleListEditPane extends JListControlPane {
return new NameObject(helper.createUnrepeatedName(this.menuName()), cellStyle); return new NameObject(helper.createUnrepeatedName(this.menuName()), cellStyle);
} }
@Override
public Object acceptObject2Populate(Object ob) { public Object acceptObject2Populate(Object ob) {
if (ob instanceof NameObject) { if (ob instanceof NameObject) {
ob = ((NameObject) ob).getObject(); ob = ((NameObject) ob).getObject();

Loading…
Cancel
Save