|
|
|
@ -3,26 +3,31 @@ package com.fr.design.present;
|
|
|
|
|
import com.fr.base.Style; |
|
|
|
|
import com.fr.config.ServerPreferenceConfig; |
|
|
|
|
import com.fr.config.StyleMap; |
|
|
|
|
import com.fr.design.dialog.FineJOptionPane; |
|
|
|
|
import com.fr.design.gui.controlpane.AbstractNameableCreator; |
|
|
|
|
import com.fr.design.gui.controlpane.JListControlPane; |
|
|
|
|
import com.fr.design.gui.controlpane.NameableCreator; |
|
|
|
|
import com.fr.design.gui.controlpane.UnrepeatedNameHelper; |
|
|
|
|
import com.fr.design.gui.ilist.ListModelElement; |
|
|
|
|
import com.fr.design.gui.ilist.ModNameActionListener; |
|
|
|
|
import com.fr.design.mainframe.DesignerContext; |
|
|
|
|
import com.fr.design.i18n.Toolkit; |
|
|
|
|
import com.fr.design.style.StylePane; |
|
|
|
|
|
|
|
|
|
import com.fr.general.ComparatorUtils; |
|
|
|
|
import com.fr.general.NameObject; |
|
|
|
|
import com.fr.stable.Nameable; |
|
|
|
|
import com.fr.transaction.Configurations; |
|
|
|
|
import com.fr.transaction.WorkerAdaptor; |
|
|
|
|
import com.fr.stable.StringUtils; |
|
|
|
|
|
|
|
|
|
import javax.swing.*; |
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
import java.util.Arrays; |
|
|
|
|
import java.util.Iterator; |
|
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
|
public class StyleArrayPane extends JListControlPane { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private boolean namePermitted = true; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Constructor. |
|
|
|
|
*/ |
|
|
|
@ -30,11 +35,37 @@ public class StyleArrayPane extends JListControlPane {
|
|
|
|
|
super(); |
|
|
|
|
this.addModNameActionListener(new ModNameActionListener() { |
|
|
|
|
public void nameModed(int index, String oldName, String newName) { |
|
|
|
|
if (ComparatorUtils.equals(oldName, newName)) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
namePermitted = true; |
|
|
|
|
String[] allNames = nameableList.getAllNames(); |
|
|
|
|
allNames[index] = StringUtils.EMPTY; |
|
|
|
|
if (StringUtils.isEmpty(newName)) { |
|
|
|
|
showTipDialogAndReset(Toolkit.i18nText("Fine-Design_Basic_Predefined_Style_Empty_Name"), index); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
if (isNameRepeated(new List[] {Arrays.asList(allNames)}, newName)) { |
|
|
|
|
showTipDialogAndReset(Toolkit.i18nText("Fine-Design_Basic_Predefined_Style_Duplicate_Name", newName), index); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
populateSelectedValue(); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void showTipDialogAndReset(String content, int index) { |
|
|
|
|
nameableList.stopEditing(); |
|
|
|
|
|
|
|
|
|
FineJOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(StyleArrayPane.this), |
|
|
|
|
content, |
|
|
|
|
Toolkit.i18nText("Fine-Design_Basic_Alert"), |
|
|
|
|
JOptionPane.WARNING_MESSAGE); |
|
|
|
|
setIllegalIndex(index); |
|
|
|
|
namePermitted = false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 创建样式设置组件 |
|
|
|
|
* |
|
|
|
@ -105,4 +136,8 @@ public class StyleArrayPane extends JListControlPane {
|
|
|
|
|
|
|
|
|
|
configManager.setStyleMap(styleMap); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public boolean isNamePermitted() { |
|
|
|
|
return namePermitted; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|