Browse Source

Merge branch 'release/10.0' of https://code.fineres.com/scm/~qinghui.liu/design into release/10.0

feature/big-screen
Qinghui.Liu 5 years ago
parent
commit
f9cc0877bf
  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) { public void actionPerformed(ActionEvent evt) {
DesignerFrame designerFrame = DesignerContext.getDesignerFrame(); DesignerFrame designerFrame = DesignerContext.getDesignerFrame();
final StyleManagerPane styleListPane = new StyleManagerPane(); final StyleManagerPane styleListPane = new StyleManagerPane();
BasicDialog styleListDialog = styleListPane.showWindow(designerFrame); final BasicDialog styleListDialog = styleListPane.showWindow(designerFrame);
styleListDialog.addDialogActionListener(new DialogActionAdapter() { styleListDialog.addDialogActionListener(new DialogActionAdapter() {
@Override @Override
public void doOk() { public void doOk() {
if (!styleListPane.isNamePermitted()) {
styleListDialog.setDoOKSucceed(false);
}
Configurations.modify(new WorkerFacade(ServerPreferenceConfig.class) { Configurations.modify(new WorkerFacade(ServerPreferenceConfig.class) {
@Override @Override
public void run() { 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) { public void update(ServerPreferenceConfig configManager) {
this.styleArrayPane.update(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.base.Style;
import com.fr.config.ServerPreferenceConfig; import com.fr.config.ServerPreferenceConfig;
import com.fr.config.StyleMap; import com.fr.config.StyleMap;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.gui.controlpane.AbstractNameableCreator; import com.fr.design.gui.controlpane.AbstractNameableCreator;
import com.fr.design.gui.controlpane.JListControlPane; import com.fr.design.gui.controlpane.JListControlPane;
import com.fr.design.gui.controlpane.NameableCreator; import com.fr.design.gui.controlpane.NameableCreator;
import com.fr.design.gui.controlpane.UnrepeatedNameHelper; import com.fr.design.gui.controlpane.UnrepeatedNameHelper;
import com.fr.design.gui.ilist.ListModelElement; import com.fr.design.gui.ilist.ListModelElement;
import com.fr.design.gui.ilist.ModNameActionListener; 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.design.style.StylePane;
import com.fr.general.ComparatorUtils;
import com.fr.general.NameObject; import com.fr.general.NameObject;
import com.fr.stable.Nameable; import com.fr.stable.Nameable;
import com.fr.transaction.Configurations; import com.fr.stable.StringUtils;
import com.fr.transaction.WorkerAdaptor;
import javax.swing.*;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
public class StyleArrayPane extends JListControlPane { public class StyleArrayPane extends JListControlPane {
private boolean namePermitted = true;
/** /**
* Constructor. * Constructor.
*/ */
@ -30,11 +35,37 @@ public class StyleArrayPane extends JListControlPane {
super(); super();
this.addModNameActionListener(new ModNameActionListener() { this.addModNameActionListener(new ModNameActionListener() {
public void nameModed(int index, String oldName, String newName) { 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(); 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); configManager.setStyleMap(styleMap);
} }
public boolean isNamePermitted() {
return namePermitted;
}
} }

Loading…
Cancel
Save