Remove Generic from most editors. They are not generic at all.

This commit is contained in:
Fabian Becker 2014-11-09 18:57:50 +01:00
parent 8f35b0c6d4
commit 6386c03f43
13 changed files with 61 additions and 75 deletions

View File

@ -25,7 +25,7 @@ public class PropertyEditorProvider {
if ((editor == null) && useDefaultGOE) {
if (cls.isArray()) {
editor = new GenericArrayEditor();
editor = new ArrayEditor();
} else if (cls.isEnum()) {
editor = new EnumEditor();
} else {
@ -84,7 +84,7 @@ public class PropertyEditorProvider {
if ((editor == null) && useDefaultGOE) {
if (type.isArray()) {
editor = new GenericArrayEditor();
editor = new ArrayEditor();
} else if (type.isEnum()) {
editor = new EnumEditor();
} else {
@ -114,25 +114,25 @@ public class PropertyEditorProvider {
PropertyEditorManager.registerEditor(SelectedTag.class, TagEditor.class);
PropertyEditorManager.registerEditor(Enum.class, EnumEditor.class);
PropertyEditorManager.registerEditor(int[].class, GenericArrayEditor.class);
PropertyEditorManager.registerEditor(double[].class, GenericArrayEditor.class);
PropertyEditorManager.registerEditor(InterfaceTerminator[].class, GenericArrayEditor.class);
PropertyEditorManager.registerEditor(int[].class, ArrayEditor.class);
PropertyEditorManager.registerEditor(double[].class, ArrayEditor.class);
PropertyEditorManager.registerEditor(InterfaceTerminator[].class, ArrayEditor.class);
// The Editor for the new GO
PropertyEditorManager.registerEditor(StringSelection.class, StringSelectionEditor.class);
// Traveling Salesman problem
PropertyEditorManager.registerEditor(GPArea.class, GenericAreaEditor.class);
PropertyEditorManager.registerEditor(PropertyDoubleArray.class, GenericDoubleArrayEditor.class);
PropertyEditorManager.registerEditor(PropertyIntArray.class, GenericIntArrayEditor.class);
PropertyEditorManager.registerEditor(PropertyEpsilonThreshold.class, GenericEpsilonThresholdEditor.class);
PropertyEditorManager.registerEditor(PropertyEpsilonConstraint.class, GenericEpsilonConstraintEditor.class);
PropertyEditorManager.registerEditor(PropertyWeightedLPTchebycheff.class, GenericWeigthedLPTchebycheffEditor.class);
PropertyEditorManager.registerEditor(PropertyFilePath.class, GenericFilePathEditor.class);
PropertyEditorManager.registerEditor(PropertyOptimizationObjectives.class, GenericOptimizationObjectivesEditor.class);
PropertyEditorManager.registerEditor(PropertyOptimizationObjectivesWithParam.class, GenericOptimizationObjectivesWithParamEditor.class);
PropertyEditorManager.registerEditor(GPArea.class, AreaEditor.class);
PropertyEditorManager.registerEditor(PropertyDoubleArray.class, DoubleArrayEditor.class);
PropertyEditorManager.registerEditor(PropertyIntArray.class, IntArrayEditor.class);
PropertyEditorManager.registerEditor(PropertyEpsilonThreshold.class, EpsilonThresholdEditor.class);
PropertyEditorManager.registerEditor(PropertyEpsilonConstraint.class, EpsilonConstraintEditor.class);
PropertyEditorManager.registerEditor(PropertyWeightedLPTchebycheff.class, WeigthedLPTchebycheffEditor.class);
PropertyEditorManager.registerEditor(PropertyFilePath.class, FilePathEditor.class);
PropertyEditorManager.registerEditor(PropertyOptimizationObjectives.class, OptimizationObjectivesEditor.class);
PropertyEditorManager.registerEditor(PropertyOptimizationObjectivesWithParam.class, OptimizationObjectivesWithParamEditor.class);
PropertyEditorManager.registerEditor(eva2.gui.MultiLineString.class, MultiLineStringEditor.class);
PropertyEditorManager.registerEditor(PropertySelectableList.class, GenericArrayEditor.class);
PropertyEditorManager.registerEditor(PropertySelectableList.class, ArrayEditor.class);
}
}

View File

@ -6,13 +6,13 @@ import eva2.optimization.individuals.codings.gp.GPArea;
/**
*
*/
public class GenericAreaEditor extends AbstractListSelectionEditor {
public class AreaEditor extends AbstractListSelectionEditor {
/**
* The GPArea that is to be edited
*/
private GPArea areaObject;
public GenericAreaEditor() {
public AreaEditor() {
// compiled code
}

View File

@ -19,9 +19,9 @@ import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
public class GenericArrayEditor extends JPanel implements PropertyEditor {
public class ArrayEditor extends JPanel implements PropertyEditor {
private final static Logger LOGGER = Logger.getLogger(GenericArrayEditor.class.getName());
private final static Logger LOGGER = Logger.getLogger(ArrayEditor.class.getName());
/**
* Handles property change notification
*/
@ -126,7 +126,7 @@ public class GenericArrayEditor extends JPanel implements PropertyEditor {
}
propChangeSupport.firePropertyChange("", null, null);
} catch (Exception ex) {
JOptionPane.showMessageDialog(GenericArrayEditor.this, "Could not create an object copy", null, JOptionPane.ERROR_MESSAGE);
JOptionPane.showMessageDialog(ArrayEditor.this, "Could not create an object copy", null, JOptionPane.ERROR_MESSAGE);
}
} else if (e.getSource() == setAllButton) {
Object addObj = elementEditor.getValue();
@ -134,7 +134,7 @@ public class GenericArrayEditor extends JPanel implements PropertyEditor {
try {
listModel.setElementAt(new SerializedObject(addObj).getObject(), i);
} catch (Exception e1) {
JOptionPane.showMessageDialog(GenericArrayEditor.this, "Could not create an object copy", null, JOptionPane.ERROR_MESSAGE);
JOptionPane.showMessageDialog(ArrayEditor.this, "Could not create an object copy", null, JOptionPane.ERROR_MESSAGE);
}
}
propChangeSupport.firePropertyChange("", null, null);
@ -145,7 +145,7 @@ public class GenericArrayEditor extends JPanel implements PropertyEditor {
try {
listModel.setElementAt(new SerializedObject(addObj).getObject(), selected);
} catch (Exception e1) {
JOptionPane.showMessageDialog(GenericArrayEditor.this, "Could not create an object copy", null, JOptionPane.ERROR_MESSAGE);
JOptionPane.showMessageDialog(ArrayEditor.this, "Could not create an object copy", null, JOptionPane.ERROR_MESSAGE);
}
propChangeSupport.firePropertyChange("", null, null);
}
@ -193,7 +193,7 @@ public class GenericArrayEditor extends JPanel implements PropertyEditor {
/**
* Sets up the array editor.
*/
public GenericArrayEditor() {
public ArrayEditor() {
setLayout(new BorderLayout());
add(cantEditLabel, BorderLayout.CENTER);
deleteButton.addActionListener(innerActionListener);
@ -213,9 +213,9 @@ public class GenericArrayEditor extends JPanel implements PropertyEditor {
private class ActionJList extends MouseAdapter {
protected JList list;
GenericArrayEditor gae = null;
ArrayEditor gae = null;
public ActionJList(JList l, GenericArrayEditor genAE) {
public ActionJList(JList l, ArrayEditor genAE) {
list = l;
gae = genAE;
}
@ -628,7 +628,7 @@ public class GenericArrayEditor extends JPanel implements PropertyEditor {
for (JMenuItem item : popupItemList) {
popupMenu.add(item);
}
popupMenu.show(GenericArrayEditor.this, e.getX(), e.getY());
popupMenu.show(ArrayEditor.this, e.getX(), e.getY());
}
}
});

View File

@ -16,9 +16,9 @@ import java.beans.PropertyEditor;
*/
class MyFocusListener implements FocusListener {
private int myID = -1;
private GenericDoubleArrayEditor arrEditor = null;
private DoubleArrayEditor arrEditor = null;
public MyFocusListener(int id, GenericDoubleArrayEditor gdae) {
public MyFocusListener(int id, DoubleArrayEditor gdae) {
myID = id;
this.arrEditor = gdae;
}
@ -46,9 +46,7 @@ class MyFocusListener implements FocusListener {
/**
* A generic editor for PropertyDoubleArray.
*/
public class GenericDoubleArrayEditor extends JPanel implements PropertyEditor {
private static final long serialVersionUID = 7749892624600018812L;
public class DoubleArrayEditor extends JPanel implements PropertyEditor {
/**
* Handles property change notification
*/
@ -74,7 +72,7 @@ public class GenericDoubleArrayEditor extends JPanel implements PropertyEditor {
*/
private int lastFocussedRow = -1;
public GenericDoubleArrayEditor() {
public DoubleArrayEditor() {
// compiled code
}

View File

@ -12,7 +12,7 @@ import java.beans.PropertyEditor;
/**
*
*/
public class GenericEpsilonConstraintEditor extends JPanel implements PropertyEditor {
public class EpsilonConstraintEditor extends JPanel implements PropertyEditor {
/**
* Handles property change notification
@ -35,7 +35,7 @@ public class GenericEpsilonConstraintEditor extends JPanel implements PropertyEd
private JComboBox objectiveComboBox;
private JButton okButton;
public GenericEpsilonConstraintEditor() {
public EpsilonConstraintEditor() {
// compiled code
}

View File

@ -12,16 +12,12 @@ import java.beans.PropertyEditor;
/**
*
*/
public class GenericEpsilonThresholdEditor extends JPanel implements PropertyEditor {
public class EpsilonThresholdEditor extends JPanel implements PropertyEditor {
/**
* Handles property change notification
*/
private PropertyChangeSupport propertyChangeSupport = new PropertyChangeSupport(this);
/**
* The label for when we can't edit that type
*/
private JLabel label = new JLabel("Can't edit", SwingConstants.CENTER);
/**
* The filePath that is to be edited
*/
@ -35,7 +31,7 @@ public class GenericEpsilonThresholdEditor extends JPanel implements PropertyEdi
private JComboBox objectiveComboBox;
private JButton okButton;
public GenericEpsilonThresholdEditor() {
public EpsilonThresholdEditor() {
// compiled code
}

View File

@ -14,16 +14,12 @@ import java.io.File;
/**
*
*/
public class GenericFilePathEditor extends JPanel implements PropertyEditor {
public class FilePathEditor extends JPanel implements PropertyEditor {
/**
* Handles property change notification
*/
private PropertyChangeSupport propertyChangeSupport = new PropertyChangeSupport(this);
/**
* The label for when we can't edit that type
*/
private JLabel label = new JLabel("Can't edit", SwingConstants.CENTER);
/**
* The filePath that is to be edited
*/
@ -35,7 +31,7 @@ public class GenericFilePathEditor extends JPanel implements PropertyEditor {
private JFileChooser fileChooser;
private JPanel panel;
public GenericFilePathEditor() {
public FilePathEditor() {
// compiled code
}

View File

@ -15,16 +15,12 @@ import java.beans.PropertyEditor;
/**
*
*/
public class GenericIntArrayEditor extends JPanel implements PropertyEditor {
public class IntArrayEditor extends JPanel implements PropertyEditor {
/**
* Handles property change notification
*/
private PropertyChangeSupport propertyChangeSupport = new PropertyChangeSupport(this);
/**
* The label for when we can't edit that type
*/
private JLabel label = new JLabel("Can't edit", SwingConstants.CENTER);
/**
* The filePath that is to be edited
*/
@ -37,7 +33,7 @@ public class GenericIntArrayEditor extends JPanel implements PropertyEditor {
private JTextField[] inputTextField;
private JButton okButton;
public GenericIntArrayEditor() {
public IntArrayEditor() {
// compiled code
}

View File

@ -5,10 +5,10 @@ import eva2.gui.PropertySelectableList;
/**
* An editor for a selectable List.
*/
public class GenericObjectListSelectionEditor extends AbstractListSelectionEditor {
public class ObjectListSelectionEditor extends AbstractListSelectionEditor {
private PropertySelectableList objList;
public GenericObjectListSelectionEditor() {
public ObjectListSelectionEditor() {
}
@Override

View File

@ -22,7 +22,7 @@ import java.beans.PropertyEditor;
/**
*
*/
public class GenericOptimizationObjectivesEditor extends JPanel implements PropertyEditor, java.beans.PropertyChangeListener {
public class OptimizationObjectivesEditor extends JPanel implements PropertyEditor, java.beans.PropertyChangeListener {
/**
* Handles property change notification
@ -48,7 +48,7 @@ public class GenericOptimizationObjectivesEditor extends JPanel implements Prope
private GeneralOptimizationEditorProperty[] editors;
private PropertyChangeListener self;
public GenericOptimizationObjectivesEditor() {
public OptimizationObjectivesEditor() {
self = this;
}

View File

@ -23,7 +23,7 @@ import java.beans.PropertyEditor;
/**
*
*/
public class GenericOptimizationObjectivesWithParamEditor extends JPanel implements PropertyEditor, java.beans.PropertyChangeListener {
public class OptimizationObjectivesWithParamEditor extends JPanel implements PropertyEditor, java.beans.PropertyChangeListener {
/**
* Handles property change notification
@ -50,7 +50,7 @@ public class GenericOptimizationObjectivesWithParamEditor extends JPanel impleme
private GeneralOptimizationEditorProperty[] editors;
private PropertyChangeListener self;
public GenericOptimizationObjectivesWithParamEditor() {
public OptimizationObjectivesWithParamEditor() {
self = this;
}

View File

@ -15,7 +15,7 @@ import java.beans.PropertyEditor;
/**
*
*/
public class GenericWeigthedLPTchebycheffEditor extends JPanel implements PropertyEditor {
public class WeigthedLPTchebycheffEditor extends JPanel implements PropertyEditor {
/**
* Handles property change notification
@ -38,7 +38,7 @@ public class GenericWeigthedLPTchebycheffEditor extends JPanel implements Proper
private JTextField pvalueTextField;
private JButton okButton;
public GenericWeigthedLPTchebycheffEditor() {
public WeigthedLPTchebycheffEditor() {
// compiled code
}

View File

@ -2,7 +2,7 @@ package eva2.optimization.statistics;
import eva2.gui.JParaPanel;
import eva2.gui.PropertySelectableList;
import eva2.gui.editor.GenericArrayEditor;
import eva2.gui.editor.ArrayEditor;
import eva2.optimization.enums.StatisticsOnSingleDataSet;
import eva2.optimization.enums.StatisticsOnTwoSampledData;
import eva2.optimization.go.InterfaceOptimizationParameters;
@ -155,14 +155,14 @@ public class OptimizationJobList extends PropertySelectableList<OptimizationJob>
* @return
*/
public static PropertyEditor makeEditor(final Component parent, final OptimizationJobList jobList) {
final GenericArrayEditor genericArrayEditor = new GenericArrayEditor();
genericArrayEditor.setWithAddButton(false);
genericArrayEditor.setWithSetButton(false);
final ArrayEditor arrayEditor = new ArrayEditor();
arrayEditor.setWithAddButton(false);
arrayEditor.setWithSetButton(false);
ActionListener al = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
StatisticalEvaluation.evaluate(jobList, jobList.getObjects(), genericArrayEditor.getSelectedIndices(),
StatisticalEvaluation.evaluate(jobList, jobList.getObjects(), arrayEditor.getSelectedIndices(),
(StatisticsOnSingleDataSet[]) StatisticalEvaluation.statsParams.getOneSampledStats().getSelectedEnum(StatisticsOnSingleDataSet.values()),
(StatisticsOnTwoSampledData[]) StatisticalEvaluation.statsParams.getTwoSampledStats().getSelectedEnum(StatisticsOnTwoSampledData.values()));
}
@ -171,28 +171,28 @@ public class OptimizationJobList extends PropertySelectableList<OptimizationJob>
@Override
public void actionPerformed(ActionEvent e) {
genericArrayEditor.selectDeselectAll();
arrayEditor.selectDeselectAll();
}
};
ActionListener sal = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
jobList.saveSelectedJobs(genericArrayEditor);
jobList.saveSelectedJobs(arrayEditor);
}
};
genericArrayEditor.addUpperActionButton("(De-)Sel. all", sl);
genericArrayEditor.addUpperActionButton("Test Stats", al);
genericArrayEditor.addLowerActionButton("Save selected", sal);
arrayEditor.addUpperActionButton("(De-)Sel. all", sl);
arrayEditor.addUpperActionButton("Test Stats", al);
arrayEditor.addLowerActionButton("Save selected", sal);
genericArrayEditor.addPopupItem("Reuse as current settings", getReuseActionListener(parent, jobList));
genericArrayEditor.setAdditionalCenterPane(createStatsPanel(jobList, genericArrayEditor));
genericArrayEditor.setValue(jobList);
arrayEditor.addPopupItem("Reuse as current settings", getReuseActionListener(parent, jobList));
arrayEditor.setAdditionalCenterPane(createStatsPanel(jobList, arrayEditor));
arrayEditor.setValue(jobList);
return genericArrayEditor;
return arrayEditor;
}
private static JComponent createStatsPanel(final OptimizationJobList jobList, final GenericArrayEditor edi) {
private static JComponent createStatsPanel(final OptimizationJobList jobList, final ArrayEditor edi) {
JParaPanel pan = new JParaPanel(StatisticalEvaluation.statsParams, "Statistics");
return pan.makePanel();
}