Browse Source

Merge pull request #1621 in DESIGN/design from ~HADES/design:release/10.0 to release/10.0

* commit '3d8154f87708ac2fe98f69e63f2699558f981b82':
  REPORT-28242 【样式专题】服务器-预定义样式-添加样式
feature/big-screen
Hades 5 years ago
parent
commit
a3bde56964
  1. 5
      designer-realize/src/main/java/com/fr/design/actions/server/StyleListAction.java
  2. 4
      designer-realize/src/main/java/com/fr/design/actions/server/StyleManagerPane.java
  3. 41
      designer-realize/src/main/java/com/fr/design/present/StyleArrayPane.java

5
designer-realize/src/main/java/com/fr/design/actions/server/StyleListAction.java

@ -40,10 +40,13 @@ public class StyleListAction extends UpdateAction {
public void actionPerformed(ActionEvent evt) {
DesignerFrame designerFrame = DesignerContext.getDesignerFrame();
final StyleManagerPane styleListPane = new StyleManagerPane();
BasicDialog styleListDialog = styleListPane.showWindow(designerFrame);
final BasicDialog styleListDialog = styleListPane.showWindow(designerFrame);
styleListDialog.addDialogActionListener(new DialogActionAdapter() {
@Override
public void doOk() {
if (!styleListPane.isNamePermitted()) {
styleListDialog.setDoOKSucceed(false);
}
Configurations.modify(new WorkerFacade(ServerPreferenceConfig.class) {
@Override
public void run() {

4
designer-realize/src/main/java/com/fr/design/actions/server/StyleManagerPane.java

@ -34,4 +34,8 @@ public class StyleManagerPane extends BasicPane {
public void update(ServerPreferenceConfig configManager) {
this.styleArrayPane.update(configManager);
}
public boolean isNamePermitted() {
return styleArrayPane.isNamePermitted();
}
}

41
designer-realize/src/main/java/com/fr/design/present/StyleArrayPane.java

@ -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;
}
}

Loading…
Cancel
Save