Browse Source

fix conflict

fix-lag
白岳 3 years ago committed by eason
parent
commit
8a5bf2b69d
  1. 4
      designer-base/src/main/java/com/fr/design/gui/controlpane/JListControlPane.java
  2. 23
      designer-base/src/main/java/com/fr/design/gui/ilist/JNameEdList.java
  3. 54
      designer-chart/src/main/java/com/fr/design/module/ChartPreStyleListPane.java

4
designer-base/src/main/java/com/fr/design/gui/controlpane/JListControlPane.java

@ -23,12 +23,12 @@ import javax.swing.ListSelectionModel;
import javax.swing.SwingUtilities;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import java.util.Collection;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.util.Collection;
public abstract class JListControlPane extends JControlPane implements ListControlPaneProvider {
private static final String LIST_NAME = "JControl_List";
@ -335,7 +335,7 @@ public abstract class JListControlPane extends JControlPane implements ListContr
getHelper().checkButtonEnabled();
}
private class NameableListCellRenderer extends
protected class NameableListCellRenderer extends
DefaultListCellRenderer {
@Override
public Component getListCellRendererComponent(JList list, Object value,

23
designer-base/src/main/java/com/fr/design/gui/ilist/JNameEdList.java

@ -1,25 +1,22 @@
package com.fr.design.gui.ilist;
import com.fr.design.gui.NameInspector;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.general.GeneralUtils;
import com.fr.general.NameObject;
import com.fr.base.Utils;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.stable.Nameable;
import com.fr.stable.StringUtils;
import com.fr.stable.core.PropertyChangeAdapter;
import javax.swing.*;
import javax.swing.ListModel;
import javax.swing.event.CellEditorListener;
import javax.swing.event.ChangeEvent;
import java.awt.*;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.ArrayList;
import java.util.Vector;
import java.awt.Component;
import java.awt.Rectangle;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
public class JNameEdList extends UIList implements CellEditorListener {
private static final int ICON_WIDTH = 20;
@ -38,6 +35,8 @@ public class JNameEdList extends UIList implements CellEditorListener {
*/
private String oldName;
private boolean replaceEmptyName = true;
public JNameEdList(ListModel dataModel) {
super(dataModel);
}
@ -70,6 +69,10 @@ public class JNameEdList extends UIList implements CellEditorListener {
return this.editable;
}
public void setReplaceEmptyName(boolean replaceEmptyName) {
this.replaceEmptyName = replaceEmptyName;
}
public void setNameShouldNumber(boolean isNameShouldNumber) {
this.isNameShouldNumber = isNameShouldNumber;
}
@ -301,7 +304,7 @@ public class JNameEdList extends UIList implements CellEditorListener {
ListCellEditor editor = getCellEditor();
if (editor != null && editorComp != null) {
Object value = editor.getCellEditorValue();
String name = StringUtils.isBlank(value.toString()) ? oldName : value.toString();
String name = StringUtils.isBlank(value.toString()) && replaceEmptyName ? oldName : value.toString();
setNameAt(name, editingIndex);
removeComp();
doAfterStopEditing();

54
designer-chart/src/main/java/com/fr/design/module/ChartPreStyleListPane.java

@ -4,16 +4,28 @@ import com.fr.base.ChartColorMatching;
import com.fr.base.ChartPreStyleConfig;
import com.fr.base.Utils;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.gui.controlpane.JListControlPane;
import com.fr.design.gui.controlpane.NameObjectCreator;
import com.fr.design.gui.controlpane.NameableCreator;
import com.fr.design.gui.controlpane.ShortCut4JControlPane;
import com.fr.design.gui.ilist.JNameEdList;
import com.fr.design.gui.ilist.ModNameActionListener;
import com.fr.design.i18n.Toolkit;
import com.fr.design.menu.ShortCut;
import com.fr.general.ComparatorUtils;
import com.fr.general.NameObject;
import com.fr.stable.Nameable;
import com.fr.stable.StringUtils;
import javax.swing.JOptionPane;
import javax.swing.SwingUtilities;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
/**
* @author Bjorn
@ -22,6 +34,46 @@ import java.util.Iterator;
*/
public class ChartPreStyleListPane extends JListControlPane {
ChartPreStyleManagerPane chartPreStyleManagerPane;
public ChartPreStyleListPane(ChartPreStyleManagerPane chartPreStyleManagerPane) {
super();
this.chartPreStyleManagerPane = chartPreStyleManagerPane;
initListener();
addModNameActionListener((int index, String oldName, String newName) -> {
if (ComparatorUtils.equals(oldName, newName)) {
return;
}
String[] allNames = nameableList.getAllNames();
allNames[index] = StringUtils.EMPTY;
if (StringUtils.isEmpty(newName)) {
showTipDialog(Toolkit.i18nText("Fine-Design_Chart_Fill_Style_Empty_Name_Tip"));
nameableList.setNameAt(oldName, index);
return;
}
if (isNameRepeated(new List[]{Arrays.asList(allNames)}, newName)) {
showTipDialog(Toolkit.i18nText("Fine-Design_Chart_Fill_Style_Exist_Name_Tip", newName));
nameableList.setNameAt(oldName, index);
return;
}
populateSelectedValue();
});
}
private void showTipDialog(String content) {
FineJOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(ChartPreStyleListPane.this),
content,
Toolkit.i18nText("Fine-Design_Basic_Alert"),
JOptionPane.WARNING_MESSAGE);
}
@Override
protected JNameEdList createJNameList() {
JNameEdList jNameList = super.createJNameList();
jNameList.setReplaceEmptyName(false);
return jNameList;
}
/**
* 创建有名字的creator
*

Loading…
Cancel
Save