Removed m_ from most files in eva2.gui
This commit is contained in:
parent
7232f818ce
commit
8c38ce8cbd
@ -405,7 +405,6 @@ public class BeanInspector {
|
||||
//System.out.println("name = "+name );
|
||||
//System.out.println("type = "+type.getName() );
|
||||
Object args[] = {};
|
||||
//System.out.println("m_Target"+m_Target.toString());
|
||||
try {
|
||||
Object value = getter.invoke(obj, args);
|
||||
System.out.println("Inspecting name = " + name);
|
||||
@ -945,11 +944,11 @@ public class BeanInspector {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
PropertyDescriptor[] m_Properties = bi.getPropertyDescriptors();
|
||||
PropertyDescriptor[] properties = bi.getPropertyDescriptors();
|
||||
Method getter = null;
|
||||
for (int i = 0; i < m_Properties.length; i++) {
|
||||
if (m_Properties[i].getDisplayName().equals(mem)) {
|
||||
getter = m_Properties[i].getReadMethod();
|
||||
for (int i = 0; i < properties.length; i++) {
|
||||
if (properties[i].getDisplayName().equals(mem)) {
|
||||
getter = properties[i].getReadMethod();
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -984,17 +983,17 @@ public class BeanInspector {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
PropertyDescriptor[] m_Properties = bi.getPropertyDescriptors();
|
||||
PropertyDescriptor[] properties = bi.getPropertyDescriptors();
|
||||
// Method getter = null;
|
||||
Method setter = null;
|
||||
Class<?> type = null;
|
||||
// System.err.println("looking at " + toString(obj));
|
||||
for (int i = 0; i < m_Properties.length; i++) {
|
||||
if (m_Properties[i].getDisplayName().equals(mem)) {
|
||||
// System.err.println("looking at " + m_Properties[i].getDisplayName());
|
||||
// getter = m_Properties[i].getReadMethod();
|
||||
setter = m_Properties[i].getWriteMethod();
|
||||
type = m_Properties[i].getPropertyType();
|
||||
for (int i = 0; i < properties.length; i++) {
|
||||
if (properties[i].getDisplayName().equals(mem)) {
|
||||
// System.err.println("looking at " + properties[i].getDisplayName());
|
||||
// getter = properties[i].getReadMethod();
|
||||
setter = properties[i].getWriteMethod();
|
||||
type = properties[i].getPropertyType();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -81,19 +81,19 @@ public class OptimizationEditorPanel extends JPanel implements ItemListener {
|
||||
*
|
||||
*/
|
||||
public OptimizationEditorPanel(Object target, Object backup, PropertyChangeSupport support, GenericObjectEditor goe, boolean withCancel) {
|
||||
Object m_Object = target;
|
||||
Object object = target;
|
||||
backupObject = backup;
|
||||
propChangeSupport = support;
|
||||
genericObjectEditor = goe;
|
||||
|
||||
try {
|
||||
if (!(Proxy.isProxyClass(m_Object.getClass()))) {
|
||||
backupObject = copyObject(m_Object);
|
||||
if (!(Proxy.isProxyClass(object.getClass()))) {
|
||||
backupObject = copyObject(object);
|
||||
}
|
||||
} catch (OutOfMemoryError err) {
|
||||
backupObject = null;
|
||||
System.gc();
|
||||
System.err.println("Could not create backup object: not enough memory (OptimizationEditorPanel backup of " + m_Object + ")");
|
||||
System.err.println("Could not create backup object: not enough memory (OptimizationEditorPanel backup of " + object + ")");
|
||||
}
|
||||
comboBoxModel = new DefaultComboBoxModel(new String[0]);
|
||||
objectChooser = new JComboBox(comboBoxModel);
|
||||
@ -161,7 +161,6 @@ public class OptimizationEditorPanel extends JPanel implements ItemListener {
|
||||
@Override
|
||||
public void actionPerformed(final ActionEvent event) {
|
||||
if (backupObject != null) {
|
||||
// TODO m_goe.setObject(object);
|
||||
genericObjectEditor.setValue(copyObject(backupObject));
|
||||
updateClassType();
|
||||
updateChooser();
|
||||
|
@ -4,8 +4,8 @@ package eva2.gui;
|
||||
* A property for a double array. May be of dimensions m times n.
|
||||
*/
|
||||
public class PropertyDoubleArray implements java.io.Serializable {
|
||||
private double[][] m_DoubleArray;
|
||||
private int m_numCols = 1;
|
||||
private double[][] doubleArray;
|
||||
private int numCols = 1;
|
||||
|
||||
public PropertyDoubleArray(double[] d) {
|
||||
setDoubleArray(d);
|
||||
@ -16,9 +16,9 @@ public class PropertyDoubleArray implements java.io.Serializable {
|
||||
}
|
||||
|
||||
public PropertyDoubleArray(PropertyDoubleArray d) {
|
||||
this.m_DoubleArray = d.m_DoubleArray.clone();
|
||||
this.m_numCols = d.m_numCols;
|
||||
// System.arraycopy(d.m_DoubleArray, 0, this.m_DoubleArray, 0, this.m_DoubleArray.length);
|
||||
this.doubleArray = d.doubleArray.clone();
|
||||
this.numCols = d.numCols;
|
||||
// System.arraycopy(d.doubleArray, 0, this.doubleArray, 0, this.doubleArray.length);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -31,15 +31,15 @@ public class PropertyDoubleArray implements java.io.Serializable {
|
||||
*/
|
||||
public PropertyDoubleArray(int rows, int cols, double... d) {
|
||||
if (rows > 0 && cols > 0) {
|
||||
this.m_DoubleArray = new double[rows][cols];
|
||||
this.doubleArray = new double[rows][cols];
|
||||
} else {
|
||||
this.m_DoubleArray = null;
|
||||
this.doubleArray = null;
|
||||
}
|
||||
this.m_numCols = cols;
|
||||
this.numCols = cols;
|
||||
int index = 0;
|
||||
for (int i = 0; i < rows; i++) {
|
||||
for (int j = 0; j < cols; j++) {
|
||||
m_DoubleArray[i][j] = d[index];
|
||||
doubleArray[i][j] = d[index];
|
||||
index++;
|
||||
if (index >= d.length) {
|
||||
index = 0;
|
||||
@ -59,11 +59,11 @@ public class PropertyDoubleArray implements java.io.Serializable {
|
||||
* @param d The double[]
|
||||
*/
|
||||
public void setDoubleArray(double[] d) {
|
||||
this.m_DoubleArray = new double[d.length][1];
|
||||
this.doubleArray = new double[d.length][1];
|
||||
for (int i = 0; i < d.length; i++) {
|
||||
m_DoubleArray[i][0] = d[i];
|
||||
doubleArray[i][0] = d[i];
|
||||
}
|
||||
m_numCols = 1;
|
||||
numCols = 1;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -72,11 +72,11 @@ public class PropertyDoubleArray implements java.io.Serializable {
|
||||
* @param d The double[]
|
||||
*/
|
||||
public void setDoubleArray(double[][] d) {
|
||||
this.m_DoubleArray = d;
|
||||
this.doubleArray = d;
|
||||
if (d.length > 0) {
|
||||
m_numCols = d[0].length;
|
||||
numCols = d[0].length;
|
||||
} else {
|
||||
m_numCols = 1;
|
||||
numCols = 1;
|
||||
}
|
||||
}
|
||||
|
||||
@ -84,7 +84,7 @@ public class PropertyDoubleArray implements java.io.Serializable {
|
||||
* @return the double array itself (no clone)
|
||||
*/
|
||||
public double[][] getDoubleArrayShallow() {
|
||||
return this.m_DoubleArray;
|
||||
return this.doubleArray;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -93,40 +93,40 @@ public class PropertyDoubleArray implements java.io.Serializable {
|
||||
* @return a column as a vector (in copy)
|
||||
*/
|
||||
public double[] getDoubleColumnAsVector(int col) {
|
||||
if (col >= m_numCols) {
|
||||
throw new IllegalArgumentException("Error, invalid column selected, " + col + " of " + m_numCols);
|
||||
if (col >= numCols) {
|
||||
throw new IllegalArgumentException("Error, invalid column selected, " + col + " of " + numCols);
|
||||
}
|
||||
double[] ret = new double[m_DoubleArray.length];
|
||||
double[] ret = new double[doubleArray.length];
|
||||
for (int i = 0; i < ret.length; i++) {
|
||||
ret[i] = m_DoubleArray[i][col];
|
||||
ret[i] = doubleArray[i][col];
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
public int getNumCols() {
|
||||
return m_numCols;
|
||||
return numCols;
|
||||
}
|
||||
|
||||
public int getNumRows() {
|
||||
return m_DoubleArray.length;
|
||||
return doubleArray.length;
|
||||
}
|
||||
|
||||
public double getValue(int i, int j) {
|
||||
if (i < 0 || j < 0 || (i >= getNumRows()) || (j >= getNumCols())) {
|
||||
throw new IllegalArgumentException("Error, invalid access to double array: " + i + "," + j + " within " + getNumRows() + "," + getNumCols());
|
||||
}
|
||||
return m_DoubleArray[i][j];
|
||||
return doubleArray[i][j];
|
||||
}
|
||||
|
||||
public void adaptRowCount(int k) {
|
||||
if (k != m_DoubleArray.length) {
|
||||
double[][] newDD = new double[k][m_numCols];
|
||||
if (k != doubleArray.length) {
|
||||
double[][] newDD = new double[k][numCols];
|
||||
for (int i = 0; i < k; i++) {
|
||||
for (int j = 0; j < m_numCols; j++) {
|
||||
if (i < m_DoubleArray.length) {
|
||||
newDD[i][j] = m_DoubleArray[i][j];
|
||||
for (int j = 0; j < numCols; j++) {
|
||||
if (i < doubleArray.length) {
|
||||
newDD[i][j] = doubleArray[i][j];
|
||||
} else {
|
||||
newDD[i][j] = m_DoubleArray[m_DoubleArray.length - 1][j];
|
||||
newDD[i][j] = doubleArray[doubleArray.length - 1][j];
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -145,7 +145,7 @@ public class PropertyDoubleArray implements java.io.Serializable {
|
||||
inc = 1;
|
||||
}
|
||||
for (int j = 0; j < getNumCols(); j++) {
|
||||
newDD[i][j] = m_DoubleArray[i + inc][j];
|
||||
newDD[i][j] = doubleArray[i + inc][j];
|
||||
}
|
||||
}
|
||||
setDoubleArray(newDD);
|
||||
@ -165,7 +165,7 @@ public class PropertyDoubleArray implements java.io.Serializable {
|
||||
|
||||
for (int i = 0; i < getNumRows(); i++) {
|
||||
for (int j = 0; j < getNumCols(); j++) {
|
||||
newDD[i][j] = m_DoubleArray[i][j];
|
||||
newDD[i][j] = doubleArray[i][j];
|
||||
}
|
||||
}
|
||||
if (k >= 0) {
|
||||
@ -188,11 +188,11 @@ public class PropertyDoubleArray implements java.io.Serializable {
|
||||
for (int j = 0; j < getNumCols(); j++) {
|
||||
colSum = 0;
|
||||
for (int i = 0; i < getNumRows(); i++) {
|
||||
colSum += m_DoubleArray[i][j];
|
||||
colSum += doubleArray[i][j];
|
||||
}
|
||||
if (colSum != 0) {
|
||||
for (int i = 0; i < getNumRows(); i++) {
|
||||
m_DoubleArray[i][j] /= colSum;
|
||||
doubleArray[i][j] /= colSum;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -210,15 +210,15 @@ public class PropertyDoubleArray implements java.io.Serializable {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return BeanInspector.toString(m_DoubleArray);
|
||||
return BeanInspector.toString(doubleArray);
|
||||
}
|
||||
|
||||
// /** This method will allow you to set the value of the double array
|
||||
// * @param d The double[]
|
||||
// */
|
||||
// public void setDoubleArray(double[] d) {
|
||||
// this.m_DoubleArray = new double[d.length][1];
|
||||
// for (int i=0; i<d.length; i++) m_DoubleArray[i][0] = d[i];
|
||||
// this.doubleArray = new double[d.length][1];
|
||||
// for (int i=0; i<d.length; i++) doubleArray[i][0] = d[i];
|
||||
// }
|
||||
//
|
||||
// /** This method will return the complete name of the file
|
||||
@ -226,6 +226,6 @@ public class PropertyDoubleArray implements java.io.Serializable {
|
||||
// * @return The complete filename with path.
|
||||
// */
|
||||
// public double[] getDoubleArray() {
|
||||
// return this.m_DoubleArray;
|
||||
// return this.doubleArray;
|
||||
// }
|
||||
}
|
@ -9,18 +9,18 @@ package eva2.gui;
|
||||
*/
|
||||
public class PropertyEpsilonConstraint implements java.io.Serializable {
|
||||
|
||||
public double[] m_TargetValue;
|
||||
public int m_OptimizeObjective;
|
||||
public double[] targetValue;
|
||||
public int optimizeObjective;
|
||||
|
||||
public PropertyEpsilonConstraint() {
|
||||
}
|
||||
|
||||
public PropertyEpsilonConstraint(PropertyEpsilonConstraint e) {
|
||||
if (e.m_TargetValue != null) {
|
||||
this.m_TargetValue = new double[e.m_TargetValue.length];
|
||||
System.arraycopy(e.m_TargetValue, 0, this.m_TargetValue, 0, this.m_TargetValue.length);
|
||||
if (e.targetValue != null) {
|
||||
this.targetValue = new double[e.targetValue.length];
|
||||
System.arraycopy(e.targetValue, 0, this.targetValue, 0, this.targetValue.length);
|
||||
}
|
||||
this.m_OptimizeObjective = e.m_OptimizeObjective;
|
||||
this.optimizeObjective = e.optimizeObjective;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -9,23 +9,23 @@ package eva2.gui;
|
||||
*/
|
||||
public class PropertyEpsilonThreshold implements java.io.Serializable {
|
||||
|
||||
public double[] m_Punishment;
|
||||
public double[] m_TargetValue;
|
||||
public int m_OptimizeObjective;
|
||||
public double[] punishment;
|
||||
public double[] targetValue;
|
||||
public int optimizeObjective;
|
||||
|
||||
public PropertyEpsilonThreshold() {
|
||||
}
|
||||
|
||||
public PropertyEpsilonThreshold(PropertyEpsilonThreshold e) {
|
||||
if (e.m_TargetValue != null) {
|
||||
this.m_TargetValue = new double[e.m_TargetValue.length];
|
||||
System.arraycopy(e.m_TargetValue, 0, this.m_TargetValue, 0, this.m_TargetValue.length);
|
||||
if (e.targetValue != null) {
|
||||
this.targetValue = new double[e.targetValue.length];
|
||||
System.arraycopy(e.targetValue, 0, this.targetValue, 0, this.targetValue.length);
|
||||
}
|
||||
if (e.m_Punishment != null) {
|
||||
this.m_Punishment = new double[e.m_Punishment.length];
|
||||
System.arraycopy(e.m_Punishment, 0, this.m_Punishment, 0, this.m_Punishment.length);
|
||||
if (e.punishment != null) {
|
||||
this.punishment = new double[e.punishment.length];
|
||||
System.arraycopy(e.punishment, 0, this.punishment, 0, this.punishment.length);
|
||||
}
|
||||
this.m_OptimizeObjective = e.m_OptimizeObjective;
|
||||
this.optimizeObjective = e.optimizeObjective;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -3,17 +3,13 @@ package eva2.gui;
|
||||
import eva2.tools.ReflectPackage;
|
||||
|
||||
/**
|
||||
* Created by IntelliJ IDEA.
|
||||
* User: streiche
|
||||
* Date: 28.08.2003
|
||||
* Time: 11:10:28
|
||||
* To change this template use Options | File Templates.
|
||||
*
|
||||
*/
|
||||
public class PropertyFilePath implements java.io.Serializable {
|
||||
|
||||
public String FileName = "";
|
||||
public String FilePath = "";
|
||||
public String FileExtension = "";
|
||||
public String fileName = "";
|
||||
public String filePath = "";
|
||||
public String fileExtension = "";
|
||||
|
||||
/**
|
||||
* Constructor setting the absolute path. F
|
||||
@ -25,9 +21,9 @@ public class PropertyFilePath implements java.io.Serializable {
|
||||
}
|
||||
|
||||
public PropertyFilePath(PropertyFilePath d) {
|
||||
this.FileName = d.FileName;
|
||||
this.FilePath = d.FilePath;
|
||||
this.FileExtension = d.FileExtension;
|
||||
this.fileName = d.fileName;
|
||||
this.filePath = d.filePath;
|
||||
this.fileExtension = d.fileExtension;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -79,18 +75,18 @@ public class PropertyFilePath implements java.io.Serializable {
|
||||
if (trace) {
|
||||
System.out.println("File.Separator: " + filesep);
|
||||
}
|
||||
this.FileName = s.substring(s.lastIndexOf(filesep) + 1);
|
||||
this.FileExtension = this.FileName.substring(this.FileName.lastIndexOf("."));
|
||||
this.FilePath = s.substring(0, s.lastIndexOf(filesep) + 1);
|
||||
this.fileName = s.substring(s.lastIndexOf(filesep) + 1);
|
||||
this.fileExtension = this.fileName.substring(this.fileName.lastIndexOf("."));
|
||||
this.filePath = s.substring(0, s.lastIndexOf(filesep) + 1);
|
||||
|
||||
if (trace) {
|
||||
System.out.println("FilePath: " + this.FilePath);
|
||||
System.out.println("filePath: " + this.filePath);
|
||||
}
|
||||
if (trace) {
|
||||
System.out.println("Filename: " + this.FileName);
|
||||
System.out.println("Filename: " + this.fileName);
|
||||
}
|
||||
if (trace) {
|
||||
System.out.println("Fileext.: " + this.FileExtension);
|
||||
System.out.println("Fileext.: " + this.fileExtension);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
this.setCompleteFilePath(old);
|
||||
@ -104,6 +100,6 @@ public class PropertyFilePath implements java.io.Serializable {
|
||||
* @return The complete filename with path.
|
||||
*/
|
||||
public String getCompleteFilePath() {
|
||||
return this.FilePath + this.FileName;
|
||||
return this.filePath + this.fileName;
|
||||
}
|
||||
}
|
||||
|
@ -8,15 +8,15 @@ package eva2.gui;
|
||||
* To change this template use File | Settings | File Templates.
|
||||
*/
|
||||
public class PropertyIntArray implements java.io.Serializable {
|
||||
public int[] m_IntArray;
|
||||
public int[] intArray;
|
||||
|
||||
public PropertyIntArray(int[] d) {
|
||||
this.m_IntArray = d;
|
||||
this.intArray = d;
|
||||
}
|
||||
|
||||
public PropertyIntArray(PropertyIntArray d) {
|
||||
this.m_IntArray = new int[d.m_IntArray.length];
|
||||
System.arraycopy(d.m_IntArray, 0, this.m_IntArray, 0, this.m_IntArray.length);
|
||||
this.intArray = new int[d.intArray.length];
|
||||
System.arraycopy(d.intArray, 0, this.intArray, 0, this.intArray.length);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -30,7 +30,7 @@ public class PropertyIntArray implements java.io.Serializable {
|
||||
* @param d The int[]
|
||||
*/
|
||||
public void setIntArray(int[] d) {
|
||||
this.m_IntArray = d;
|
||||
this.intArray = d;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -39,6 +39,6 @@ public class PropertyIntArray implements java.io.Serializable {
|
||||
* @return The int array
|
||||
*/
|
||||
public int[] getIntArray() {
|
||||
return this.m_IntArray;
|
||||
return this.intArray;
|
||||
}
|
||||
}
|
@ -3,29 +3,25 @@ package eva2.gui;
|
||||
import eva2.optimization.problems.InterfaceOptimizationObjective;
|
||||
|
||||
/**
|
||||
* Created by IntelliJ IDEA.
|
||||
* User: streiche
|
||||
* Date: 14.01.2005
|
||||
* Time: 17:11:31
|
||||
* To change this template use File | Settings | File Templates.
|
||||
*
|
||||
*/
|
||||
public class PropertyOptimizationObjectives implements java.io.Serializable {
|
||||
public InterfaceOptimizationObjective[] m_AvailableObjectives;
|
||||
public InterfaceOptimizationObjective[] m_SelectedObjectives;
|
||||
public InterfaceOptimizationObjective[] availableObjectives;
|
||||
public InterfaceOptimizationObjective[] selectedObjectives;
|
||||
|
||||
public PropertyOptimizationObjectives(InterfaceOptimizationObjective[] d) {
|
||||
this.m_AvailableObjectives = d;
|
||||
this.m_SelectedObjectives = null;
|
||||
this.availableObjectives = d;
|
||||
this.selectedObjectives = null;
|
||||
}
|
||||
|
||||
public PropertyOptimizationObjectives(PropertyOptimizationObjectives d) {
|
||||
this.m_AvailableObjectives = new InterfaceOptimizationObjective[d.m_AvailableObjectives.length];
|
||||
for (int i = 0; i < this.m_AvailableObjectives.length; i++) {
|
||||
this.m_AvailableObjectives[i] = (InterfaceOptimizationObjective) d.m_AvailableObjectives[i].clone();
|
||||
this.availableObjectives = new InterfaceOptimizationObjective[d.availableObjectives.length];
|
||||
for (int i = 0; i < this.availableObjectives.length; i++) {
|
||||
this.availableObjectives[i] = (InterfaceOptimizationObjective) d.availableObjectives[i].clone();
|
||||
}
|
||||
this.m_SelectedObjectives = new InterfaceOptimizationObjective[d.m_SelectedObjectives.length];
|
||||
for (int i = 0; i < this.m_SelectedObjectives.length; i++) {
|
||||
this.m_SelectedObjectives[i] = (InterfaceOptimizationObjective) d.m_SelectedObjectives[i].clone();
|
||||
this.selectedObjectives = new InterfaceOptimizationObjective[d.selectedObjectives.length];
|
||||
for (int i = 0; i < this.selectedObjectives.length; i++) {
|
||||
this.selectedObjectives[i] = (InterfaceOptimizationObjective) d.selectedObjectives[i].clone();
|
||||
}
|
||||
}
|
||||
|
||||
@ -40,7 +36,7 @@ public class PropertyOptimizationObjectives implements java.io.Serializable {
|
||||
* @param d The InterfaceOptimizationTarget[]
|
||||
*/
|
||||
public void setSelectedTargets(InterfaceOptimizationObjective[] d) {
|
||||
this.m_SelectedObjectives = d;
|
||||
this.selectedObjectives = d;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -49,7 +45,7 @@ public class PropertyOptimizationObjectives implements java.io.Serializable {
|
||||
* @return The InterfaceOptimizationTarget[].
|
||||
*/
|
||||
public InterfaceOptimizationObjective[] getSelectedTargets() {
|
||||
return this.m_SelectedObjectives;
|
||||
return this.selectedObjectives;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -58,7 +54,7 @@ public class PropertyOptimizationObjectives implements java.io.Serializable {
|
||||
* @return The InterfaceOptimizationTarget[].
|
||||
*/
|
||||
public InterfaceOptimizationObjective[] getAvailableTargets() {
|
||||
return this.m_AvailableObjectives;
|
||||
return this.availableObjectives;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -67,19 +63,19 @@ public class PropertyOptimizationObjectives implements java.io.Serializable {
|
||||
* @param index The index of the target to be removed.
|
||||
*/
|
||||
public void removeTarget(int index) {
|
||||
if ((index < 0) || (index >= this.m_SelectedObjectives.length)) {
|
||||
if ((index < 0) || (index >= this.selectedObjectives.length)) {
|
||||
return;
|
||||
}
|
||||
|
||||
InterfaceOptimizationObjective[] newList = new InterfaceOptimizationObjective[this.m_SelectedObjectives.length - 1];
|
||||
InterfaceOptimizationObjective[] newList = new InterfaceOptimizationObjective[this.selectedObjectives.length - 1];
|
||||
int j = 0;
|
||||
for (int i = 0; i < this.m_SelectedObjectives.length; i++) {
|
||||
for (int i = 0; i < this.selectedObjectives.length; i++) {
|
||||
if (index != i) {
|
||||
newList[j] = this.m_SelectedObjectives[i];
|
||||
newList[j] = this.selectedObjectives[i];
|
||||
j++;
|
||||
}
|
||||
}
|
||||
this.m_SelectedObjectives = newList;
|
||||
this.selectedObjectives = newList;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -88,11 +84,11 @@ public class PropertyOptimizationObjectives implements java.io.Serializable {
|
||||
* @param optTarget
|
||||
*/
|
||||
public void addTarget(InterfaceOptimizationObjective optTarget) {
|
||||
InterfaceOptimizationObjective[] newList = new InterfaceOptimizationObjective[this.m_SelectedObjectives.length + 1];
|
||||
for (int i = 0; i < this.m_SelectedObjectives.length; i++) {
|
||||
newList[i] = this.m_SelectedObjectives[i];
|
||||
InterfaceOptimizationObjective[] newList = new InterfaceOptimizationObjective[this.selectedObjectives.length + 1];
|
||||
for (int i = 0; i < this.selectedObjectives.length; i++) {
|
||||
newList[i] = this.selectedObjectives[i];
|
||||
}
|
||||
newList[this.m_SelectedObjectives.length] = optTarget;
|
||||
this.m_SelectedObjectives = newList;
|
||||
newList[this.selectedObjectives.length] = optTarget;
|
||||
this.selectedObjectives = newList;
|
||||
}
|
||||
}
|
||||
|
@ -3,41 +3,37 @@ package eva2.gui;
|
||||
import eva2.optimization.problems.InterfaceOptimizationObjective;
|
||||
|
||||
/**
|
||||
* Created by IntelliJ IDEA.
|
||||
* User: streiche
|
||||
* Date: 18.01.2005
|
||||
* Time: 13:35:24
|
||||
* To change this template use File | Settings | File Templates.
|
||||
*
|
||||
*/
|
||||
public class PropertyOptimizationObjectivesWithParam implements java.io.Serializable {
|
||||
|
||||
public InterfaceOptimizationObjective[] m_AvailableObjectives;
|
||||
public InterfaceOptimizationObjective[] m_SelectedObjectives;
|
||||
public double[] m_Weights;
|
||||
public String m_DescriptiveString = "No Description given.";
|
||||
public String m_WeightsLabel = "-";
|
||||
public boolean m_NormalizationEnabled = true;
|
||||
public InterfaceOptimizationObjective[] availableObjectives;
|
||||
public InterfaceOptimizationObjective[] selectedObjectives;
|
||||
public double[] weights;
|
||||
public String descriptiveString = "No Description given.";
|
||||
public String weightsLabel = "-";
|
||||
public boolean normalizationEnabled = true;
|
||||
|
||||
public PropertyOptimizationObjectivesWithParam(InterfaceOptimizationObjective[] d) {
|
||||
this.m_AvailableObjectives = d;
|
||||
this.m_SelectedObjectives = null;
|
||||
this.availableObjectives = d;
|
||||
this.selectedObjectives = null;
|
||||
}
|
||||
|
||||
public PropertyOptimizationObjectivesWithParam(PropertyOptimizationObjectivesWithParam d) {
|
||||
this.m_DescriptiveString = d.m_DescriptiveString;
|
||||
this.m_WeightsLabel = d.m_WeightsLabel;
|
||||
this.m_NormalizationEnabled = d.m_NormalizationEnabled;
|
||||
this.m_AvailableObjectives = new InterfaceOptimizationObjective[d.m_AvailableObjectives.length];
|
||||
for (int i = 0; i < this.m_AvailableObjectives.length; i++) {
|
||||
this.m_AvailableObjectives[i] = (InterfaceOptimizationObjective) d.m_AvailableObjectives[i].clone();
|
||||
this.descriptiveString = d.descriptiveString;
|
||||
this.weightsLabel = d.weightsLabel;
|
||||
this.normalizationEnabled = d.normalizationEnabled;
|
||||
this.availableObjectives = new InterfaceOptimizationObjective[d.availableObjectives.length];
|
||||
for (int i = 0; i < this.availableObjectives.length; i++) {
|
||||
this.availableObjectives[i] = (InterfaceOptimizationObjective) d.availableObjectives[i].clone();
|
||||
}
|
||||
this.m_SelectedObjectives = new InterfaceOptimizationObjective[d.m_SelectedObjectives.length];
|
||||
for (int i = 0; i < this.m_SelectedObjectives.length; i++) {
|
||||
this.m_SelectedObjectives[i] = (InterfaceOptimizationObjective) d.m_SelectedObjectives[i].clone();
|
||||
this.selectedObjectives = new InterfaceOptimizationObjective[d.selectedObjectives.length];
|
||||
for (int i = 0; i < this.selectedObjectives.length; i++) {
|
||||
this.selectedObjectives[i] = (InterfaceOptimizationObjective) d.selectedObjectives[i].clone();
|
||||
}
|
||||
if (d.m_Weights != null) {
|
||||
this.m_Weights = new double[d.m_Weights.length];
|
||||
System.arraycopy(d.m_Weights, 0, this.m_Weights, 0, this.m_Weights.length);
|
||||
if (d.weights != null) {
|
||||
this.weights = new double[d.weights.length];
|
||||
System.arraycopy(d.weights, 0, this.weights, 0, this.weights.length);
|
||||
}
|
||||
}
|
||||
|
||||
@ -52,32 +48,32 @@ public class PropertyOptimizationObjectivesWithParam implements java.io.Serializ
|
||||
* @param d The InterfaceOptimizationTarget[]
|
||||
*/
|
||||
public void setSelectedTargets(InterfaceOptimizationObjective[] d) {
|
||||
this.m_SelectedObjectives = d;
|
||||
this.selectedObjectives = d;
|
||||
|
||||
if (this.m_Weights == null) {
|
||||
this.m_Weights = new double[d.length];
|
||||
for (int i = 0; i < this.m_Weights.length; i++) {
|
||||
this.m_Weights[i] = 1.0;
|
||||
if (this.weights == null) {
|
||||
this.weights = new double[d.length];
|
||||
for (int i = 0; i < this.weights.length; i++) {
|
||||
this.weights[i] = 1.0;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (d.length == this.m_Weights.length) {
|
||||
if (d.length == this.weights.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (d.length > this.m_Weights.length) {
|
||||
if (d.length > this.weights.length) {
|
||||
double[] newWeights = new double[d.length];
|
||||
for (int i = 0; i < this.m_Weights.length; i++) {
|
||||
newWeights[i] = this.m_Weights[i];
|
||||
for (int i = 0; i < this.weights.length; i++) {
|
||||
newWeights[i] = this.weights[i];
|
||||
}
|
||||
this.m_Weights = newWeights;
|
||||
this.weights = newWeights;
|
||||
} else {
|
||||
double[] newWeights = new double[d.length];
|
||||
for (int i = 0; i < d.length; i++) {
|
||||
newWeights[i] = this.m_Weights[i];
|
||||
newWeights[i] = this.weights[i];
|
||||
}
|
||||
this.m_Weights = newWeights;
|
||||
this.weights = newWeights;
|
||||
}
|
||||
}
|
||||
|
||||
@ -87,7 +83,7 @@ public class PropertyOptimizationObjectivesWithParam implements java.io.Serializ
|
||||
* @return The InterfaceOptimizationTarget[].
|
||||
*/
|
||||
public InterfaceOptimizationObjective[] getSelectedTargets() {
|
||||
return this.m_SelectedObjectives;
|
||||
return this.selectedObjectives;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -96,7 +92,7 @@ public class PropertyOptimizationObjectivesWithParam implements java.io.Serializ
|
||||
* @return The InterfaceOptimizationTarget[].
|
||||
*/
|
||||
public InterfaceOptimizationObjective[] getAvailableTargets() {
|
||||
return this.m_AvailableObjectives;
|
||||
return this.availableObjectives;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -105,11 +101,11 @@ public class PropertyOptimizationObjectivesWithParam implements java.io.Serializ
|
||||
* @return the weights
|
||||
*/
|
||||
public double[] getWeights() {
|
||||
return this.m_Weights;
|
||||
return this.weights;
|
||||
}
|
||||
|
||||
public void setWeights(double[] d) {
|
||||
this.m_Weights = d;
|
||||
this.weights = d;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -118,11 +114,11 @@ public class PropertyOptimizationObjectivesWithParam implements java.io.Serializ
|
||||
* @return the string
|
||||
*/
|
||||
public String getDescriptiveString() {
|
||||
return this.m_DescriptiveString;
|
||||
return this.descriptiveString;
|
||||
}
|
||||
|
||||
public void setDescriptiveString(String d) {
|
||||
this.m_DescriptiveString = d;
|
||||
this.descriptiveString = d;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -131,11 +127,11 @@ public class PropertyOptimizationObjectivesWithParam implements java.io.Serializ
|
||||
* @return the string
|
||||
*/
|
||||
public String getWeigthsLabel() {
|
||||
return this.m_WeightsLabel;
|
||||
return this.weightsLabel;
|
||||
}
|
||||
|
||||
public void setWeightsLabel(String d) {
|
||||
this.m_WeightsLabel = d;
|
||||
this.weightsLabel = d;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -144,11 +140,11 @@ public class PropertyOptimizationObjectivesWithParam implements java.io.Serializ
|
||||
* @return the string
|
||||
*/
|
||||
public boolean isNormalizationEnabled() {
|
||||
return this.m_NormalizationEnabled;
|
||||
return this.normalizationEnabled;
|
||||
}
|
||||
|
||||
public void enableNormalization(boolean d) {
|
||||
this.m_NormalizationEnabled = d;
|
||||
this.normalizationEnabled = d;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -157,22 +153,22 @@ public class PropertyOptimizationObjectivesWithParam implements java.io.Serializ
|
||||
* @param index The index of the target to be removed.
|
||||
*/
|
||||
public void removeTarget(int index) {
|
||||
if ((index < 0) || (index >= this.m_SelectedObjectives.length)) {
|
||||
if ((index < 0) || (index >= this.selectedObjectives.length)) {
|
||||
return;
|
||||
}
|
||||
|
||||
InterfaceOptimizationObjective[] newList = new InterfaceOptimizationObjective[this.m_SelectedObjectives.length - 1];
|
||||
double[] newWeights = new double[this.m_Weights.length - 1];
|
||||
InterfaceOptimizationObjective[] newList = new InterfaceOptimizationObjective[this.selectedObjectives.length - 1];
|
||||
double[] newWeights = new double[this.weights.length - 1];
|
||||
int j = 0;
|
||||
for (int i = 0; i < this.m_SelectedObjectives.length; i++) {
|
||||
for (int i = 0; i < this.selectedObjectives.length; i++) {
|
||||
if (index != i) {
|
||||
newList[j] = this.m_SelectedObjectives[i];
|
||||
newWeights[j] = this.m_Weights[i];
|
||||
newList[j] = this.selectedObjectives[i];
|
||||
newWeights[j] = this.weights[i];
|
||||
j++;
|
||||
}
|
||||
}
|
||||
this.m_SelectedObjectives = newList;
|
||||
this.m_Weights = newWeights;
|
||||
this.selectedObjectives = newList;
|
||||
this.weights = newWeights;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -181,15 +177,15 @@ public class PropertyOptimizationObjectivesWithParam implements java.io.Serializ
|
||||
* @param optTarget
|
||||
*/
|
||||
public void addTarget(InterfaceOptimizationObjective optTarget) {
|
||||
InterfaceOptimizationObjective[] newList = new InterfaceOptimizationObjective[this.m_SelectedObjectives.length + 1];
|
||||
double[] newWeights = new double[this.m_Weights.length + 1];
|
||||
for (int i = 0; i < this.m_SelectedObjectives.length; i++) {
|
||||
newList[i] = this.m_SelectedObjectives[i];
|
||||
newWeights[i] = this.m_Weights[i];
|
||||
InterfaceOptimizationObjective[] newList = new InterfaceOptimizationObjective[this.selectedObjectives.length + 1];
|
||||
double[] newWeights = new double[this.weights.length + 1];
|
||||
for (int i = 0; i < this.selectedObjectives.length; i++) {
|
||||
newList[i] = this.selectedObjectives[i];
|
||||
newWeights[i] = this.weights[i];
|
||||
}
|
||||
newList[this.m_SelectedObjectives.length] = optTarget;
|
||||
newWeights[this.m_SelectedObjectives.length] = 1.0;
|
||||
this.m_SelectedObjectives = newList;
|
||||
this.m_Weights = newWeights;
|
||||
newList[this.selectedObjectives.length] = optTarget;
|
||||
newWeights[this.selectedObjectives.length] = 1.0;
|
||||
this.selectedObjectives = newList;
|
||||
this.weights = newWeights;
|
||||
}
|
||||
}
|
@ -12,25 +12,25 @@ import java.beans.PropertyChangeSupport;
|
||||
*/
|
||||
public class PropertySelectableList<T> implements java.io.Serializable {
|
||||
|
||||
protected T[] m_Objects;
|
||||
protected boolean[] m_Selection;
|
||||
private transient PropertyChangeSupport m_Support = new PropertyChangeSupport(this);
|
||||
protected T[] objects;
|
||||
protected boolean[] selections;
|
||||
private transient PropertyChangeSupport propertyChangeSupport = new PropertyChangeSupport(this);
|
||||
|
||||
// public PropertySelectableList() {
|
||||
// }
|
||||
//
|
||||
public PropertySelectableList(T[] initial) {
|
||||
m_Objects = initial;
|
||||
m_Selection = new boolean[initial.length];
|
||||
objects = initial;
|
||||
selections = new boolean[initial.length];
|
||||
}
|
||||
|
||||
public PropertySelectableList(PropertySelectableList<T> b) {
|
||||
if (b.m_Objects != null) {
|
||||
this.m_Objects = b.m_Objects.clone();
|
||||
if (b.objects != null) {
|
||||
this.objects = b.objects.clone();
|
||||
}
|
||||
if (b.m_Selection != null) {
|
||||
this.m_Selection = new boolean[b.m_Selection.length];
|
||||
System.arraycopy(b.m_Selection, 0, this.m_Selection, 0, this.m_Selection.length);
|
||||
if (b.selections != null) {
|
||||
this.selections = new boolean[b.selections.length];
|
||||
System.arraycopy(b.selections, 0, this.selections, 0, this.selections.length);
|
||||
}
|
||||
}
|
||||
|
||||
@ -40,22 +40,22 @@ public class PropertySelectableList<T> implements java.io.Serializable {
|
||||
}
|
||||
|
||||
public void setObjects(T[] o) {
|
||||
this.m_Objects = o;
|
||||
this.m_Selection = new boolean[o.length];
|
||||
m_Support.firePropertyChange("PropertySelectableList", null, this);
|
||||
this.objects = o;
|
||||
this.selections = new boolean[o.length];
|
||||
propertyChangeSupport.firePropertyChange("PropertySelectableList", null, this);
|
||||
}
|
||||
|
||||
public void setObjects(T[] o, boolean[] selection) {
|
||||
this.m_Objects = o;
|
||||
this.m_Selection = selection;
|
||||
this.objects = o;
|
||||
this.selections = selection;
|
||||
if (o.length != selection.length) {
|
||||
throw new RuntimeException("Error, mismatching length of arrays in " + this.getClass());
|
||||
}
|
||||
m_Support.firePropertyChange("PropertySelectableList", null, this);
|
||||
propertyChangeSupport.firePropertyChange("PropertySelectableList", null, this);
|
||||
}
|
||||
|
||||
public T[] getObjects() {
|
||||
return this.m_Objects;
|
||||
return this.objects;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -66,7 +66,7 @@ public class PropertySelectableList<T> implements java.io.Serializable {
|
||||
public T[] getSelectedObjects() {
|
||||
T[] selObjects = getObjects().clone();
|
||||
for (int i = 0; i < selObjects.length; i++) {
|
||||
if (!m_Selection[i]) {
|
||||
if (!selections[i]) {
|
||||
selObjects[i] = null;
|
||||
}
|
||||
}
|
||||
@ -79,49 +79,49 @@ public class PropertySelectableList<T> implements java.io.Serializable {
|
||||
* @param selection
|
||||
*/
|
||||
public void setSelectionByIndices(int[] selection) {
|
||||
m_Selection = new boolean[getObjects().length];
|
||||
selections = new boolean[getObjects().length];
|
||||
for (int i = 0; i < selection.length; i++) {
|
||||
m_Selection[selection[i]] = true;
|
||||
selections[selection[i]] = true;
|
||||
}
|
||||
m_Support.firePropertyChange("PropertySelectableList", null, this);
|
||||
propertyChangeSupport.firePropertyChange("PropertySelectableList", null, this);
|
||||
}
|
||||
|
||||
public void setSelection(boolean[] selection) {
|
||||
this.m_Selection = selection;
|
||||
m_Support.firePropertyChange("PropertySelectableList", null, this);
|
||||
this.selections = selection;
|
||||
propertyChangeSupport.firePropertyChange("PropertySelectableList", null, this);
|
||||
}
|
||||
|
||||
public boolean[] getSelection() {
|
||||
return this.m_Selection;
|
||||
return this.selections;
|
||||
}
|
||||
|
||||
public void setSelectionForElement(int index, boolean b) {
|
||||
if (m_Selection[index] != b) {
|
||||
this.m_Selection[index] = b;
|
||||
m_Support.firePropertyChange("PropertySelectableList", null, this);
|
||||
if (selections[index] != b) {
|
||||
this.selections[index] = b;
|
||||
propertyChangeSupport.firePropertyChange("PropertySelectableList", null, this);
|
||||
}
|
||||
}
|
||||
|
||||
public int size() {
|
||||
if (m_Objects == null) {
|
||||
if (objects == null) {
|
||||
return 0;
|
||||
} else {
|
||||
return m_Objects.length;
|
||||
return objects.length;
|
||||
}
|
||||
}
|
||||
|
||||
public T get(int i) {
|
||||
return m_Objects[i];
|
||||
return objects[i];
|
||||
}
|
||||
|
||||
public boolean isSelected(int i) {
|
||||
return m_Selection[i];
|
||||
return selections[i];
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
m_Objects = null;
|
||||
m_Selection = null;
|
||||
m_Support.firePropertyChange("PropertySelectableList", null, this);
|
||||
objects = null;
|
||||
selections = null;
|
||||
propertyChangeSupport.firePropertyChange("PropertySelectableList", null, this);
|
||||
}
|
||||
|
||||
// /**
|
||||
@ -129,33 +129,33 @@ public class PropertySelectableList<T> implements java.io.Serializable {
|
||||
// * @param o
|
||||
// */
|
||||
// public void addObject(T o) {
|
||||
// if (m_Objects==null) {
|
||||
// m_Objects=(T[]) new Object[]{o};
|
||||
// m_Selection = new boolean[1];
|
||||
// if (objects==null) {
|
||||
// objects=(T[]) new Object[]{o};
|
||||
// selections = new boolean[1];
|
||||
// } else {
|
||||
// T[] newOs = (T[])new Object[m_Objects.length+1];
|
||||
// boolean[] newSs = new boolean[m_Selection.length+1];
|
||||
// System.arraycopy(m_Objects, 0, newOs, 0, this.m_Objects.length);
|
||||
// System.arraycopy(m_Selection, 0, newSs, 0, this.m_Selection.length);
|
||||
// newOs[m_Objects.length]=o;
|
||||
// newSs[m_Objects.length]=true;
|
||||
// m_Objects=newOs;
|
||||
// m_Selection=newSs;
|
||||
// T[] newOs = (T[])new Object[objects.length+1];
|
||||
// boolean[] newSs = new boolean[selections.length+1];
|
||||
// System.arraycopy(objects, 0, newOs, 0, this.objects.length);
|
||||
// System.arraycopy(selections, 0, newSs, 0, this.selections.length);
|
||||
// newOs[objects.length]=o;
|
||||
// newSs[objects.length]=true;
|
||||
// objects=newOs;
|
||||
// selections=newSs;
|
||||
// }
|
||||
// propertyChangeSupport.firePropertyChange("PropertySelectableList", null, this);
|
||||
// }
|
||||
|
||||
public void addPropertyChangeListener(PropertyChangeListener l) {
|
||||
if (m_Support == null) {
|
||||
m_Support = new PropertyChangeSupport(this);
|
||||
if (propertyChangeSupport == null) {
|
||||
propertyChangeSupport = new PropertyChangeSupport(this);
|
||||
}
|
||||
m_Support.addPropertyChangeListener(l);
|
||||
propertyChangeSupport.addPropertyChangeListener(l);
|
||||
}
|
||||
|
||||
public void removePropertyChangeListener(PropertyChangeListener l) {
|
||||
if (m_Support == null) {
|
||||
m_Support = new PropertyChangeSupport(this);
|
||||
if (propertyChangeSupport == null) {
|
||||
propertyChangeSupport = new PropertyChangeSupport(this);
|
||||
}
|
||||
m_Support.removePropertyChangeListener(l);
|
||||
propertyChangeSupport.removePropertyChangeListener(l);
|
||||
}
|
||||
}
|
||||
|
@ -61,7 +61,6 @@ public class PropertySheetPanel extends JPanel implements PropertyChangeListener
|
||||
/**
|
||||
* StringBuffer containing help text for the object being edited
|
||||
*/
|
||||
// private StringBuffer m_HelpText;
|
||||
private String className;
|
||||
/**
|
||||
* Button to pop up the full help text in a separate frame.
|
||||
@ -225,9 +224,7 @@ public class PropertySheetPanel extends JPanel implements PropertyChangeListener
|
||||
if (methsFound == 2) {
|
||||
break; // small speed-up
|
||||
}
|
||||
} // end for (int i = 0; i < m_Methods.length; i++) {
|
||||
// restore hide states of all properties
|
||||
// GenericObjectEditor.setHideProperties(m_Target.getClass(), hideStateBackup);
|
||||
}
|
||||
|
||||
// Now lets search for the individual properties, their
|
||||
// values, views and editors...
|
||||
@ -243,7 +240,6 @@ public class PropertySheetPanel extends JPanel implements PropertyChangeListener
|
||||
for (int i = 0; i < propertyDescriptors.length; i++) {
|
||||
// For each property do this
|
||||
// Don't display hidden or expert properties.
|
||||
// if (m_Properties[i].isHidden() || m_Properties[i].isExpert()) continue;
|
||||
// we now look at hidden properties, they can be shown or hidden dynamically (MK)
|
||||
String name = propertyDescriptors[i].getDisplayName();
|
||||
if (objectValues[i] == null) {
|
||||
@ -333,7 +329,6 @@ public class PropertySheetPanel extends JPanel implements PropertyChangeListener
|
||||
for (int i = 0; i < props.length; i++) {
|
||||
// For each property do this
|
||||
// Don't display hidden or expert properties.
|
||||
// if (m_Properties[i].isHidden() || m_Properties[i].isExpert()) continue;
|
||||
// we now look at hidden properties, they can be shown or hidden dynamically (MK)
|
||||
String name = props[i].getDisplayName();
|
||||
if (props[i].isExpert() && omitExpert) {
|
||||
@ -357,8 +352,6 @@ public class PropertySheetPanel extends JPanel implements PropertyChangeListener
|
||||
ex.printStackTrace();
|
||||
values[i] = null;
|
||||
}
|
||||
// PropertyEditor editor = null;
|
||||
//Class pec = m_Properties[i].getPropertyEditorClass();
|
||||
values[i] = value;
|
||||
|
||||
} // end for each property
|
||||
@ -766,7 +759,6 @@ public class PropertySheetPanel extends JPanel implements PropertyChangeListener
|
||||
viewWrappers[i].repaint();
|
||||
}
|
||||
|
||||
// System.out.println("Value: "+value +" / m_Values[i]: " + m_Values[i]);
|
||||
// Now try to update the target with the new value of the property
|
||||
// and allow the target to do some changes to the value, therefore
|
||||
// reread the new value from the target
|
||||
@ -777,7 +769,6 @@ public class PropertySheetPanel extends JPanel implements PropertyChangeListener
|
||||
// setting the current value to the target object
|
||||
setter.invoke(targetObject, args);
|
||||
// i could also get the new value
|
||||
//value = getter.invoke(m_Target, args2);
|
||||
// Now i'm reading the set value from the target to my local values
|
||||
objectValues[i] = getter.invoke(targetObject, args2);
|
||||
|
||||
@ -967,10 +958,8 @@ public class PropertySheetPanel extends JPanel implements PropertyChangeListener
|
||||
((PropertyText) views[i]).setText(val.toString());
|
||||
}
|
||||
} else if (views[i] instanceof PropertyPanel) {
|
||||
valChanged = false;//!((PropertyPanel)m_Views[i]).equals(value);
|
||||
// disregard whole panels and hope for the best
|
||||
} else if (views[i] instanceof PropertyValueSelector) {
|
||||
//changed = !((SelectedTag)val).isSelectedString((String)((PropertyValueSelector)m_Views[i]).getSelectedItem());
|
||||
// interestingly there seems to be an implicit update of the ValueSelector, possible changes
|
||||
// are already applied, all we need to see it is a repaint
|
||||
views[i].repaint();
|
||||
|
@ -26,10 +26,10 @@ import java.io.Serializable;
|
||||
public class PropertySheetPanelStat extends JPanel implements Serializable {
|
||||
|
||||
public final static boolean TRACE = false;
|
||||
private Object[] m_Values;
|
||||
private JCheckBoxFlag[] m_Views;
|
||||
private JLabel[] m_Labels;
|
||||
private boolean[] m_flag;
|
||||
private Object[] values;
|
||||
private JCheckBoxFlag[] views;
|
||||
private JLabel[] labels;
|
||||
private boolean[] flags;
|
||||
|
||||
/**
|
||||
* Creates the property sheet panel.
|
||||
@ -42,7 +42,7 @@ public class PropertySheetPanelStat extends JPanel implements Serializable {
|
||||
/**
|
||||
* A support object for handling property change listeners
|
||||
*/
|
||||
private PropertyChangeSupport m_support = new PropertyChangeSupport(this);
|
||||
private PropertyChangeSupport propertyChangeSupport = new PropertyChangeSupport(this);
|
||||
|
||||
public synchronized void setTarget(String[] names, boolean[] flag) {
|
||||
int componentOffset = 0;
|
||||
@ -54,26 +54,26 @@ public class PropertySheetPanelStat extends JPanel implements Serializable {
|
||||
|
||||
int rowHeight = 12;
|
||||
|
||||
m_Values = new Object[flag.length];
|
||||
m_Views = new JCheckBoxFlag[flag.length];
|
||||
m_Labels = new JLabel[names.length];
|
||||
values = new Object[flag.length];
|
||||
views = new JCheckBoxFlag[flag.length];
|
||||
labels = new JLabel[names.length];
|
||||
|
||||
for (int i = 0; i < names.length; i++) {
|
||||
m_Labels[i] = new JLabel(names[i], SwingConstants.RIGHT);
|
||||
m_Labels[i].setBorder(BorderFactory.createEmptyBorder(10, 10, 0, 5));
|
||||
m_Views[i] = new JCheckBoxFlag(flag[i]);
|
||||
labels[i] = new JLabel(names[i], SwingConstants.RIGHT);
|
||||
labels[i].setBorder(BorderFactory.createEmptyBorder(10, 10, 0, 5));
|
||||
views[i] = new JCheckBoxFlag(flag[i]);
|
||||
GridBagConstraints gbConstraints = new GridBagConstraints();
|
||||
gbConstraints.anchor = GridBagConstraints.EAST;
|
||||
gbConstraints.fill = GridBagConstraints.HORIZONTAL;
|
||||
gbConstraints.gridy = i + componentOffset;
|
||||
gbConstraints.gridx = 0;
|
||||
gbLayout.setConstraints(m_Labels[i], gbConstraints);
|
||||
add(m_Labels[i]);
|
||||
gbLayout.setConstraints(labels[i], gbConstraints);
|
||||
add(labels[i]);
|
||||
JPanel newPanel = new JPanel();
|
||||
newPanel.setBorder(BorderFactory.createEmptyBorder(10, 5, 0, 10));
|
||||
|
||||
newPanel.setLayout(new BorderLayout());
|
||||
newPanel.add(m_Views[i], BorderLayout.CENTER);
|
||||
newPanel.add(views[i], BorderLayout.CENTER);
|
||||
gbConstraints = new GridBagConstraints();
|
||||
gbConstraints.anchor = GridBagConstraints.WEST;
|
||||
gbConstraints.fill = GridBagConstraints.BOTH;
|
||||
@ -91,9 +91,9 @@ public class PropertySheetPanelStat extends JPanel implements Serializable {
|
||||
*
|
||||
*/
|
||||
public boolean[] getState() {
|
||||
boolean[] ret = new boolean[this.m_Views.length];
|
||||
boolean[] ret = new boolean[this.views.length];
|
||||
for (int i = 0; i < ret.length; i++) {
|
||||
ret[i] = m_Views[i].isSelected();
|
||||
ret[i] = views[i].isSelected();
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@ -104,20 +104,20 @@ public class PropertySheetPanelStat extends JPanel implements Serializable {
|
||||
*/
|
||||
class JCheckBoxFlag extends JCheckBox {
|
||||
|
||||
private boolean m_Flag = true;
|
||||
private boolean flag = true;
|
||||
|
||||
public JCheckBoxFlag(boolean flag) {
|
||||
super();
|
||||
m_Flag = flag;
|
||||
this.flag = flag;
|
||||
addItemListener(new ItemListener() {
|
||||
|
||||
@Override
|
||||
public void itemStateChanged(ItemEvent evt) {
|
||||
if (evt.getStateChange() == evt.SELECTED) {
|
||||
m_Flag = true;
|
||||
JCheckBoxFlag.this.flag = true;
|
||||
}
|
||||
if (evt.getStateChange() == evt.DESELECTED) {
|
||||
m_Flag = false;
|
||||
JCheckBoxFlag.this.flag = false;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -1,9 +1,5 @@
|
||||
package eva2.gui;
|
||||
/*
|
||||
* Title: EvA2 Description: Copyright: Copyright (c) 2003 Company: University of Tuebingen, Computer
|
||||
* Architecture @author Holger Ulmer, Felix Streichert, Hannes Planatscher @version: $Revision: 10 $
|
||||
* $Date: 2006-01-18 11:02:22 +0100 (Wed, 18 Jan 2006) $ $Author: streiche $
|
||||
*/
|
||||
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.event.ChangeEvent;
|
||||
|
@ -1,49 +0,0 @@
|
||||
//package eva2.gui;
|
||||
//
|
||||
///**
|
||||
// * Created by IntelliJ IDEA.
|
||||
// * User: streiche
|
||||
// * Date: 23.03.2004
|
||||
// * Time: 15:04:05
|
||||
// * To change this template use File | Settings | File Templates.
|
||||
// */
|
||||
//public class PropertyStringList implements java.io.Serializable {
|
||||
//
|
||||
// public String[] m_Strings;
|
||||
// public boolean[] m_Selection;
|
||||
//
|
||||
// public PropertyStringList() {
|
||||
//
|
||||
// }
|
||||
// public PropertyStringList(PropertyStringList b) {
|
||||
// if (b.m_Strings != null) {
|
||||
// this.m_Strings = new String[b.m_Strings.length];
|
||||
// System.arraycopy(b.m_Strings, 0, this.m_Strings, 0, this.m_Strings.length);
|
||||
// }
|
||||
// if (b.m_Selection != null) {
|
||||
// this.m_Selection = new boolean[b.m_Selection.length];
|
||||
// System.arraycopy(b.m_Selection, 0, this.m_Selection, 0, this.m_Selection.length);
|
||||
// }
|
||||
// }
|
||||
// public Object clone() {
|
||||
// return (Object) new PropertyStringList(this);
|
||||
// }
|
||||
// public void setStrings(String[] strings) {
|
||||
// this.m_Strings = strings;
|
||||
// this.m_Selection = new boolean[this.m_Strings.length];
|
||||
// }
|
||||
// public String[] getStrings() {
|
||||
// return this.m_Strings;
|
||||
// }
|
||||
//
|
||||
// public void setSelection(boolean[] selection) {
|
||||
// this.m_Selection = selection;
|
||||
// }
|
||||
// public boolean[] getSelection() {
|
||||
// return this.m_Selection;
|
||||
// }
|
||||
//
|
||||
// public void setSelectionForElement(int index, boolean b) {
|
||||
// this.m_Selection[index] = b;
|
||||
// }
|
||||
//}
|
@ -11,7 +11,7 @@ public class PropertyWeightedLPTchebycheff implements java.io.Serializable {
|
||||
|
||||
public double[] idealValue;
|
||||
public double[] weights;
|
||||
public int m_P = 0;
|
||||
public int p = 0;
|
||||
|
||||
public PropertyWeightedLPTchebycheff() {
|
||||
}
|
||||
@ -25,7 +25,7 @@ public class PropertyWeightedLPTchebycheff implements java.io.Serializable {
|
||||
this.weights = new double[e.weights.length];
|
||||
System.arraycopy(e.weights, 0, this.weights, 0, this.weights.length);
|
||||
}
|
||||
this.m_P = e.m_P;
|
||||
this.p = e.p;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,16 +1,5 @@
|
||||
package eva2.gui;
|
||||
|
||||
/*
|
||||
* Title: EvA2
|
||||
* Description: The main client class of the EvA framework.
|
||||
* Copyright: Copyright (c) 2008
|
||||
* Company: University of Tuebingen, Computer
|
||||
* Architecture
|
||||
*
|
||||
* @author Holger Ulmer, Felix Streichert, Hannes Planatscher
|
||||
* @version: $Revision: 322 $ $Date: 2007-12-11 17:24:07 +0100 (Tue, 11 Dec 2007)$
|
||||
* $Author: mkron $
|
||||
*/
|
||||
|
||||
import eva2.tools.BasicResourceLoader;
|
||||
|
||||
|
@ -22,17 +22,17 @@ public abstract class AbstractListSelectionEditor extends JPanel implements Prop
|
||||
/**
|
||||
* Handles property change notification
|
||||
*/
|
||||
private PropertyChangeSupport m_Support = new PropertyChangeSupport(this);
|
||||
private PropertyChangeSupport propertyChangeSupport = new PropertyChangeSupport(this);
|
||||
/**
|
||||
* The label for when we can't edit that type
|
||||
*/
|
||||
protected JLabel m_Label = new JLabel("Can't edit", SwingConstants.CENTER);
|
||||
protected JLabel label = new JLabel("Can't edit", SwingConstants.CENTER);
|
||||
|
||||
/**
|
||||
* The graphics stuff
|
||||
*/
|
||||
private JPanel m_CustomEditor, m_NodePanel;
|
||||
protected JCheckBox[] m_BlackCheck;
|
||||
private JPanel customEditor, nodePanel;
|
||||
protected JCheckBox[] blackCheck;
|
||||
|
||||
|
||||
public AbstractListSelectionEditor() {
|
||||
@ -42,11 +42,11 @@ public abstract class AbstractListSelectionEditor extends JPanel implements Prop
|
||||
* This method will init the CustomEditor Panel
|
||||
*/
|
||||
private void initCustomEditor() {
|
||||
this.m_CustomEditor = new JPanel();
|
||||
this.m_CustomEditor.setLayout(new BorderLayout());
|
||||
this.m_CustomEditor.add(new JLabel("Choose:"), BorderLayout.NORTH);
|
||||
this.m_NodePanel = new JPanel();
|
||||
this.m_CustomEditor.add(new JScrollPane(this.m_NodePanel), BorderLayout.CENTER);
|
||||
this.customEditor = new JPanel();
|
||||
this.customEditor.setLayout(new BorderLayout());
|
||||
this.customEditor.add(new JLabel("Choose:"), BorderLayout.NORTH);
|
||||
this.nodePanel = new JPanel();
|
||||
this.customEditor.add(new JScrollPane(this.nodePanel), BorderLayout.CENTER);
|
||||
this.updateEditor();
|
||||
}
|
||||
|
||||
@ -87,22 +87,22 @@ public abstract class AbstractListSelectionEditor extends JPanel implements Prop
|
||||
* The object may have changed update the editor. This notifies change listeners automatically.
|
||||
*/
|
||||
private void updateEditor() {
|
||||
if (this.m_NodePanel != null) {
|
||||
this.m_NodePanel.removeAll();
|
||||
this.m_NodePanel.setLayout(new GridLayout(getElementCount(), 1));
|
||||
this.m_BlackCheck = new JCheckBox[getElementCount()];
|
||||
if (this.nodePanel != null) {
|
||||
this.nodePanel.removeAll();
|
||||
this.nodePanel.setLayout(new GridLayout(getElementCount(), 1));
|
||||
this.blackCheck = new JCheckBox[getElementCount()];
|
||||
for (int i = 0; i < getElementCount(); i++) {
|
||||
this.m_BlackCheck[i] = new JCheckBox(getElementName(i), isElementSelected(i));
|
||||
this.m_BlackCheck[i].setToolTipText(getElementToolTip(i));
|
||||
this.m_BlackCheck[i].addActionListener(new ActionListener() {
|
||||
this.blackCheck[i] = new JCheckBox(getElementName(i), isElementSelected(i));
|
||||
this.blackCheck[i].setToolTipText(getElementToolTip(i));
|
||||
this.blackCheck[i].addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent ev) {
|
||||
if (actionOnSelect()) {
|
||||
m_Support.firePropertyChange("AbstractListSelectionEditor", null, this);
|
||||
propertyChangeSupport.firePropertyChange("AbstractListSelectionEditor", null, this);
|
||||
}
|
||||
}
|
||||
});
|
||||
this.m_NodePanel.add(this.m_BlackCheck[i]);
|
||||
this.nodePanel.add(this.blackCheck[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -163,18 +163,18 @@ public abstract class AbstractListSelectionEditor extends JPanel implements Prop
|
||||
|
||||
@Override
|
||||
public void addPropertyChangeListener(PropertyChangeListener l) {
|
||||
if (m_Support == null) {
|
||||
m_Support = new PropertyChangeSupport(this);
|
||||
if (propertyChangeSupport == null) {
|
||||
propertyChangeSupport = new PropertyChangeSupport(this);
|
||||
}
|
||||
m_Support.addPropertyChangeListener(l);
|
||||
propertyChangeSupport.addPropertyChangeListener(l);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removePropertyChangeListener(PropertyChangeListener l) {
|
||||
if (m_Support == null) {
|
||||
m_Support = new PropertyChangeSupport(this);
|
||||
if (propertyChangeSupport == null) {
|
||||
propertyChangeSupport = new PropertyChangeSupport(this);
|
||||
}
|
||||
m_Support.removePropertyChangeListener(l);
|
||||
propertyChangeSupport.removePropertyChangeListener(l);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -218,14 +218,14 @@ public abstract class AbstractListSelectionEditor extends JPanel implements Prop
|
||||
*/
|
||||
@Override
|
||||
public Component getCustomEditor() {
|
||||
if (this.m_CustomEditor == null) {
|
||||
if (this.customEditor == null) {
|
||||
this.initCustomEditor();
|
||||
}
|
||||
return m_CustomEditor;
|
||||
return customEditor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void propertyChange(PropertyChangeEvent evt) {
|
||||
m_Support.firePropertyChange("AbstractListSelectionEditor", null, this);
|
||||
propertyChangeSupport.firePropertyChange("AbstractListSelectionEditor", null, this);
|
||||
}
|
||||
}
|
@ -1,17 +1,4 @@
|
||||
package eva2.gui.editor;
|
||||
/*
|
||||
* Title: EvA2
|
||||
* Description:
|
||||
* Copyright: Copyright (c) 2003
|
||||
* Company: University of Tuebingen, Computer Architecture
|
||||
* @author Holger Ulmer, Felix Streichert, Hannes Planatscher
|
||||
* @version: $Revision: 194 $
|
||||
* $Date: 2007-10-23 13:43:24 +0200 (Tue, 23 Oct 2007) $
|
||||
* $Author: mkron $
|
||||
*/
|
||||
/*==========================================================================*
|
||||
* IMPORTS
|
||||
*==========================================================================*/
|
||||
|
||||
import eva2.gui.PropertyDialog;
|
||||
|
||||
@ -25,18 +12,14 @@ import java.beans.PropertyChangeListener;
|
||||
import java.beans.PropertyChangeSupport;
|
||||
import java.beans.PropertyEditor;
|
||||
|
||||
/*==========================================================================*
|
||||
* CLASS DECLARATION
|
||||
*==========================================================================*/
|
||||
public class BigStringEditor implements PropertyEditor {
|
||||
private PropertyChangeSupport m_Support = new PropertyChangeSupport(this);
|
||||
private PropertyEditor m_ElementEditor;
|
||||
private JTextArea m_TextArea;
|
||||
private JScrollPane m_ScrollPane;
|
||||
private JPanel m_Panel;
|
||||
// private Source m_Source;
|
||||
private JButton m_SetButton;
|
||||
static private boolean m_finished = false;
|
||||
private PropertyChangeSupport propertyChangeSupport = new PropertyChangeSupport(this);
|
||||
private PropertyEditor elementEditor;
|
||||
private JTextArea textArea;
|
||||
private JScrollPane scrollPane;
|
||||
private JPanel panel;
|
||||
private JButton setButton;
|
||||
static private boolean isFinished = false;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -44,7 +27,7 @@ public class BigStringEditor implements PropertyEditor {
|
||||
public static void editSource(String file) {
|
||||
|
||||
try {
|
||||
m_finished = false;
|
||||
isFinished = false;
|
||||
BigStringEditor editor = new BigStringEditor();
|
||||
|
||||
PropertyDialog dialog = new PropertyDialog(editor, file, 50, 50);
|
||||
@ -63,7 +46,7 @@ public class BigStringEditor implements PropertyEditor {
|
||||
|
||||
@Override
|
||||
public void windowClosed(WindowEvent e) {
|
||||
m_finished = true;
|
||||
isFinished = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -87,7 +70,7 @@ public class BigStringEditor implements PropertyEditor {
|
||||
}
|
||||
}
|
||||
);
|
||||
while (m_finished == false) {
|
||||
while (isFinished == false) {
|
||||
try {
|
||||
Thread.sleep(1000);
|
||||
} catch (Exception e) {
|
||||
@ -107,24 +90,24 @@ public class BigStringEditor implements PropertyEditor {
|
||||
*/
|
||||
public BigStringEditor() {
|
||||
super();
|
||||
// m_TextArea = new JEditTextArea();
|
||||
// m_TextArea.setTokenMarker(new JavaTokenMarker());
|
||||
m_TextArea = new JTextArea(60, 60);
|
||||
m_TextArea.setEditable(true);
|
||||
m_TextArea.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));
|
||||
m_ScrollPane = new JScrollPane(m_TextArea);
|
||||
m_Panel = new JPanel();
|
||||
m_Panel.setBorder(BorderFactory.createTitledBorder("Sourcecode"));
|
||||
m_Panel.setLayout(new BorderLayout());
|
||||
m_SetButton = new JButton("SET");
|
||||
m_SetButton.addActionListener(new ActionListener() {
|
||||
// textArea = new JEditTextArea();
|
||||
// textArea.setTokenMarker(new JavaTokenMarker());
|
||||
textArea = new JTextArea(60, 60);
|
||||
textArea.setEditable(true);
|
||||
textArea.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));
|
||||
scrollPane = new JScrollPane(textArea);
|
||||
panel = new JPanel();
|
||||
panel.setBorder(BorderFactory.createTitledBorder("Sourcecode"));
|
||||
panel.setLayout(new BorderLayout());
|
||||
setButton = new JButton("SET");
|
||||
setButton.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
setValue(m_TextArea.getText());
|
||||
setValue(textArea.getText());
|
||||
}
|
||||
});
|
||||
m_Panel.add(m_ScrollPane, BorderLayout.CENTER);
|
||||
m_Panel.add(m_SetButton, BorderLayout.SOUTH);
|
||||
panel.add(scrollPane, BorderLayout.CENTER);
|
||||
panel.add(setButton, BorderLayout.SOUTH);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -132,17 +115,11 @@ public class BigStringEditor implements PropertyEditor {
|
||||
*/
|
||||
@Override
|
||||
public void setValue(Object value) {
|
||||
m_ElementEditor = null;
|
||||
elementEditor = null;
|
||||
if (value instanceof String) {
|
||||
// m_Source.setString((String)value);
|
||||
m_TextArea.setText((String) value);
|
||||
|
||||
textArea.setText((String) value);
|
||||
}
|
||||
/* if (value instanceof Source) {
|
||||
// m_Source = (Source) value;
|
||||
m_TextArea.setText(((Source)value).getString());
|
||||
}*/
|
||||
m_Support.firePropertyChange("", null, null);
|
||||
propertyChangeSupport.firePropertyChange("", null, null);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -150,7 +127,6 @@ public class BigStringEditor implements PropertyEditor {
|
||||
*/
|
||||
@Override
|
||||
public Object getValue() {
|
||||
// m_Source.setString(m_TextArea.getText());
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -183,7 +159,6 @@ public class BigStringEditor implements PropertyEditor {
|
||||
public void paintValue(Graphics gfx, Rectangle box) {
|
||||
FontMetrics fm = gfx.getFontMetrics();
|
||||
int vpad = (box.height - fm.getAscent()) / 2;
|
||||
//String rep = EVAHELP.cutClassName(m_ElementClass.getName());
|
||||
gfx.drawString("BigStringEditor", 2, fm.getHeight() + vpad - 3);
|
||||
}
|
||||
|
||||
@ -224,23 +199,23 @@ public class BigStringEditor implements PropertyEditor {
|
||||
*/
|
||||
@Override
|
||||
public Component getCustomEditor() {
|
||||
return m_Panel;
|
||||
return panel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addPropertyChangeListener(PropertyChangeListener l) {
|
||||
if (m_Support == null) {
|
||||
m_Support = new PropertyChangeSupport(this);
|
||||
if (propertyChangeSupport == null) {
|
||||
propertyChangeSupport = new PropertyChangeSupport(this);
|
||||
}
|
||||
m_Support.addPropertyChangeListener(l);
|
||||
propertyChangeSupport.addPropertyChangeListener(l);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removePropertyChangeListener(PropertyChangeListener l) {
|
||||
if (m_Support == null) {
|
||||
m_Support = new PropertyChangeSupport(this);
|
||||
if (propertyChangeSupport == null) {
|
||||
propertyChangeSupport = new PropertyChangeSupport(this);
|
||||
}
|
||||
m_Support.removePropertyChangeListener(l);
|
||||
propertyChangeSupport.removePropertyChangeListener(l);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,14 +1,7 @@
|
||||
package eva2.gui.editor;
|
||||
|
||||
/*
|
||||
* Title: EvA2
|
||||
* Description:
|
||||
* Copyright: Copyright (c) 2003
|
||||
* Company: University of Tuebingen, Computer Architecture
|
||||
* @author Holger Ulmer, Felix Streichert, Hannes Planatscher
|
||||
* @version: $Revision: 10 $
|
||||
* $Date: 2006-01-18 11:02:22 +0100 (Wed, 18 Jan 2006) $
|
||||
* $Author: streiche $
|
||||
*
|
||||
*/
|
||||
public interface ComponentFilter {
|
||||
public boolean accept(java.awt.Component component);
|
||||
|
@ -14,7 +14,7 @@ public class GenericAreaEditor extends AbstractListSelectionEditor {
|
||||
/**
|
||||
* The GPArea that is to be edited
|
||||
*/
|
||||
private GPArea m_AreaObject;
|
||||
private GPArea areaObject;
|
||||
|
||||
public GenericAreaEditor() {
|
||||
// compiled code
|
||||
@ -22,18 +22,18 @@ public class GenericAreaEditor extends AbstractListSelectionEditor {
|
||||
|
||||
@Override
|
||||
protected int getElementCount() {
|
||||
return m_AreaObject.getCompleteList().size();
|
||||
return areaObject.getCompleteList().size();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getElementName(int i) {
|
||||
AbstractGPNode an = (AbstractGPNode) m_AreaObject.getCompleteList().get(i);
|
||||
AbstractGPNode an = (AbstractGPNode) areaObject.getCompleteList().get(i);
|
||||
return an.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isElementSelected(int i) {
|
||||
return ((Boolean) m_AreaObject.getBlackList().get(i)).booleanValue();
|
||||
return ((Boolean) areaObject.getBlackList().get(i)).booleanValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -41,18 +41,18 @@ public class GenericAreaEditor extends AbstractListSelectionEditor {
|
||||
/** This method checks the current BlackList and compiles it
|
||||
* to a new ReducedList.
|
||||
*/
|
||||
for (int i = 0; i < this.m_BlackCheck.length; i++) {
|
||||
this.m_AreaObject.setBlackListElement(i, this.m_BlackCheck[i].isSelected());
|
||||
for (int i = 0; i < this.blackCheck.length; i++) {
|
||||
this.areaObject.setBlackListElement(i, this.blackCheck[i].isSelected());
|
||||
}
|
||||
this.m_AreaObject.compileReducedList();
|
||||
this.areaObject.compileReducedList();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean setObject(Object o) {
|
||||
if (o instanceof GPArea) {
|
||||
this.m_AreaObject = (GPArea) o;
|
||||
m_AreaObject.addPropertyChangeListener(this);
|
||||
this.areaObject = (GPArea) o;
|
||||
areaObject.addPropertyChangeListener(this);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
@ -61,6 +61,6 @@ public class GenericAreaEditor extends AbstractListSelectionEditor {
|
||||
|
||||
@Override
|
||||
public Object getValue() {
|
||||
return this.m_AreaObject;
|
||||
return this.areaObject;
|
||||
}
|
||||
}
|
@ -63,7 +63,7 @@ public class GenericArrayEditor extends JPanel implements PropertyEditor {
|
||||
*/
|
||||
private List<JButton> lowerButtonList = new LinkedList<JButton>();
|
||||
private JComponent additionalCenterComp = null;
|
||||
private List<JMenuItem> m_popupItemList = new LinkedList<JMenuItem>();
|
||||
private List<JMenuItem> popupItemList = new LinkedList<JMenuItem>();
|
||||
private JButton addButton = new JButton("Add");
|
||||
private JButton setButton = new JButton("Set");
|
||||
private JButton setAllButton = new JButton("Set all");
|
||||
@ -608,11 +608,11 @@ public class GenericArrayEditor extends JPanel implements PropertyEditor {
|
||||
|
||||
public void addPopupItem(String text, ActionListener al) {
|
||||
JMenuItem item = createMenuItem(text, true, makeSelectionKnownAL(al));
|
||||
m_popupItemList.add(item);
|
||||
popupItemList.add(item);
|
||||
}
|
||||
|
||||
public void addPopupMenu() {
|
||||
if (m_popupItemList.size() > 0) {
|
||||
if (popupItemList.size() > 0) {
|
||||
elementList.addMouseListener(new MouseAdapter() {
|
||||
|
||||
@Override
|
||||
@ -624,7 +624,7 @@ public class GenericArrayEditor extends JPanel implements PropertyEditor {
|
||||
// do nothing
|
||||
} else { // right click released, so show popup
|
||||
JPopupMenu popupMenu = new JPopupMenu();
|
||||
for (JMenuItem item : m_popupItemList) {
|
||||
for (JMenuItem item : popupItemList) {
|
||||
popupMenu.add(item);
|
||||
}
|
||||
popupMenu.show(GenericArrayEditor.this, e.getX(), e.getY());
|
||||
@ -685,7 +685,6 @@ public class GenericArrayEditor extends JPanel implements PropertyEditor {
|
||||
public void paintValue(Graphics gfx, Rectangle box) {
|
||||
FontMetrics fm = gfx.getFontMetrics();
|
||||
int vpad = (box.height - fm.getAscent()) / 2;
|
||||
// System.out.println(m_ListModel + " --- " + m_ElementClass);
|
||||
String rep;
|
||||
if (listModel.getSize() == 0) {
|
||||
rep = "Empty";
|
||||
|
@ -53,22 +53,22 @@ public class GenericDoubleArrayEditor extends JPanel implements PropertyEditor {
|
||||
/**
|
||||
* Handles property change notification
|
||||
*/
|
||||
private PropertyChangeSupport m_Support = new PropertyChangeSupport(this);
|
||||
private PropertyChangeSupport support = new PropertyChangeSupport(this);
|
||||
/**
|
||||
* The label for when we can't edit that type
|
||||
*/
|
||||
private JLabel m_Label = new JLabel("Can't edit", SwingConstants.CENTER);
|
||||
private JLabel label = new JLabel("Can't edit", SwingConstants.CENTER);
|
||||
/**
|
||||
* The FilePath that is to be edited
|
||||
* The filePath that is to be edited
|
||||
*/
|
||||
private PropertyDoubleArray m_DoubleArray;
|
||||
private PropertyDoubleArray doubleArray;
|
||||
|
||||
/**
|
||||
* The gaphix stuff
|
||||
*/
|
||||
private JPanel m_CustomEditor, m_DataPanel, m_ButtonPanel;
|
||||
private JTextField[][] m_InputTextFields;
|
||||
private JButton m_OKButton, m_AddButton, m_DeleteButton, m_NormalizeButton;
|
||||
private JPanel customEditor, dataPanel, buttonPanel;
|
||||
private JTextField[][] inputTextFields;
|
||||
private JButton okButton, addButton, deleteButton, normalizeButton;
|
||||
|
||||
/**
|
||||
* Which columns has the focus? *
|
||||
@ -83,41 +83,41 @@ public class GenericDoubleArrayEditor extends JPanel implements PropertyEditor {
|
||||
* This method will init the CustomEditor Panel
|
||||
*/
|
||||
private void initCustomEditor() {
|
||||
this.m_CustomEditor = new JPanel();
|
||||
this.m_CustomEditor.setLayout(new BorderLayout());
|
||||
this.customEditor = new JPanel();
|
||||
this.customEditor.setLayout(new BorderLayout());
|
||||
|
||||
this.m_CustomEditor.add(new JLabel("Current Double Array:"), BorderLayout.NORTH);
|
||||
this.customEditor.add(new JLabel("Current Double Array:"), BorderLayout.NORTH);
|
||||
|
||||
// init data panel
|
||||
this.m_DataPanel = new JPanel();
|
||||
this.dataPanel = new JPanel();
|
||||
this.updateDataPanel();
|
||||
this.m_CustomEditor.add(this.m_DataPanel, BorderLayout.CENTER);
|
||||
this.customEditor.add(this.dataPanel, BorderLayout.CENTER);
|
||||
|
||||
// init button panel
|
||||
this.m_ButtonPanel = new JPanel();
|
||||
this.m_AddButton = new JButton("Add");
|
||||
this.m_AddButton.addActionListener(this.addAction);
|
||||
this.m_DeleteButton = new JButton("Delete");
|
||||
this.m_DeleteButton.addActionListener(this.deleteAction);
|
||||
this.m_NormalizeButton = new JButton("Normalize");
|
||||
this.m_NormalizeButton.addActionListener(this.normalizeAction);
|
||||
this.m_OKButton = new JButton("OK");
|
||||
this.m_OKButton.setEnabled(true);
|
||||
this.m_OKButton.addActionListener(new ActionListener() {
|
||||
this.buttonPanel = new JPanel();
|
||||
this.addButton = new JButton("Add");
|
||||
this.addButton.addActionListener(this.addAction);
|
||||
this.deleteButton = new JButton("Delete");
|
||||
this.deleteButton.addActionListener(this.deleteAction);
|
||||
this.normalizeButton = new JButton("Normalize");
|
||||
this.normalizeButton.addActionListener(this.normalizeAction);
|
||||
this.okButton = new JButton("OK");
|
||||
this.okButton.setEnabled(true);
|
||||
this.okButton.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
//backupObject = copyObject(object);
|
||||
if ((m_CustomEditor.getTopLevelAncestor() != null) && (m_CustomEditor.getTopLevelAncestor() instanceof Window)) {
|
||||
Window w = (Window) m_CustomEditor.getTopLevelAncestor();
|
||||
if ((customEditor.getTopLevelAncestor() != null) && (customEditor.getTopLevelAncestor() instanceof Window)) {
|
||||
Window w = (Window) customEditor.getTopLevelAncestor();
|
||||
w.dispose();
|
||||
}
|
||||
}
|
||||
});
|
||||
this.m_ButtonPanel.add(this.m_AddButton);
|
||||
this.m_ButtonPanel.add(this.m_DeleteButton);
|
||||
this.m_ButtonPanel.add(this.m_NormalizeButton);
|
||||
this.m_ButtonPanel.add(this.m_OKButton);
|
||||
this.m_CustomEditor.add(this.m_ButtonPanel, BorderLayout.SOUTH);
|
||||
this.buttonPanel.add(this.addButton);
|
||||
this.buttonPanel.add(this.deleteButton);
|
||||
this.buttonPanel.add(this.normalizeButton);
|
||||
this.buttonPanel.add(this.okButton);
|
||||
this.customEditor.add(this.buttonPanel, BorderLayout.SOUTH);
|
||||
this.updateEditor();
|
||||
}
|
||||
|
||||
@ -127,7 +127,7 @@ public class GenericDoubleArrayEditor extends JPanel implements PropertyEditor {
|
||||
ActionListener addAction = new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent event) {
|
||||
m_DoubleArray.addRowCopy(lastFocussedRow); // copy the last focussed row
|
||||
doubleArray.addRowCopy(lastFocussedRow); // copy the last focussed row
|
||||
updateEditor();
|
||||
}
|
||||
};
|
||||
@ -138,10 +138,10 @@ public class GenericDoubleArrayEditor extends JPanel implements PropertyEditor {
|
||||
ActionListener deleteAction = new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent event) {
|
||||
if (!m_DoubleArray.isValidRow(lastFocussedRow)) {
|
||||
m_DoubleArray.deleteRow(m_DoubleArray.getNumRows() - 1);
|
||||
if (!doubleArray.isValidRow(lastFocussedRow)) {
|
||||
doubleArray.deleteRow(doubleArray.getNumRows() - 1);
|
||||
} else {
|
||||
m_DoubleArray.deleteRow(lastFocussedRow);
|
||||
doubleArray.deleteRow(lastFocussedRow);
|
||||
}
|
||||
updateEditor();
|
||||
}
|
||||
@ -153,7 +153,7 @@ public class GenericDoubleArrayEditor extends JPanel implements PropertyEditor {
|
||||
ActionListener normalizeAction = new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent event) {
|
||||
m_DoubleArray.normalizeColumns();
|
||||
doubleArray.normalizeColumns();
|
||||
updateEditor();
|
||||
}
|
||||
};
|
||||
@ -172,21 +172,20 @@ public class GenericDoubleArrayEditor extends JPanel implements PropertyEditor {
|
||||
|
||||
@Override
|
||||
public void keyReleased(KeyEvent event) {
|
||||
double[][] tmpDD = new double[m_InputTextFields.length][m_InputTextFields[0].length];
|
||||
double[][] tmpDD = new double[inputTextFields.length][inputTextFields[0].length];
|
||||
|
||||
for (int i = 0; i < tmpDD.length; i++) {
|
||||
for (int j = 0; j < tmpDD[0].length; j++) {
|
||||
try {
|
||||
double d = 0;
|
||||
d = new Double(m_InputTextFields[i][j].getText()).doubleValue();
|
||||
d = new Double(inputTextFields[i][j].getText()).doubleValue();
|
||||
tmpDD[i][j] = d;
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
//tmpD[i] = new Double(m_InputTextField[i].getText()).doubleValue();
|
||||
}
|
||||
|
||||
m_DoubleArray.setDoubleArray(tmpDD);
|
||||
doubleArray.setDoubleArray(tmpDD);
|
||||
//updateEditor();
|
||||
}
|
||||
};
|
||||
@ -196,49 +195,32 @@ public class GenericDoubleArrayEditor extends JPanel implements PropertyEditor {
|
||||
* The object may have changed update the editor.
|
||||
*/
|
||||
private void updateEditor() {
|
||||
if (this.m_CustomEditor != null) {
|
||||
if (this.customEditor != null) {
|
||||
this.updateDataPanel();
|
||||
this.m_CustomEditor.validate();
|
||||
this.m_CustomEditor.repaint();
|
||||
this.customEditor.validate();
|
||||
this.customEditor.repaint();
|
||||
}
|
||||
}
|
||||
|
||||
// /** This method updates the data panel
|
||||
// */
|
||||
// private void updateDataPanelOrig() {
|
||||
// double[] tmpD = this.m_DoubleArray.getDoubleArray();
|
||||
//
|
||||
// this.m_DataPanel.removeAll();
|
||||
// this.m_DataPanel.setLayout(new GridLayout(tmpD.length, 2));
|
||||
// this.m_InputTextField = new JTextField[tmpD.length];
|
||||
// for (int i = 0; i < tmpD.length; i++) {
|
||||
// JLabel label = new JLabel("Value X"+i+": ");
|
||||
// this.m_DataPanel.add(label);
|
||||
// this.m_InputTextField[i] = new JTextField();
|
||||
// this.m_InputTextField[i].setText(""+tmpD[i]);
|
||||
// this.m_InputTextField[i].addKeyListener(this.readDoubleArrayAction);
|
||||
// this.m_DataPanel.add(this.m_InputTextField[i]);
|
||||
// }
|
||||
// }
|
||||
|
||||
/**
|
||||
* This method updates the data panel
|
||||
*/
|
||||
private void updateDataPanel() {
|
||||
int numRows = m_DoubleArray.getNumRows();
|
||||
int numCols = m_DoubleArray.getNumCols();
|
||||
this.m_DataPanel.removeAll();
|
||||
this.m_DataPanel.setLayout(new GridLayout(numRows, numCols + 1));
|
||||
this.m_InputTextFields = new JTextField[numRows][numCols];
|
||||
int numRows = doubleArray.getNumRows();
|
||||
int numCols = doubleArray.getNumCols();
|
||||
this.dataPanel.removeAll();
|
||||
this.dataPanel.setLayout(new GridLayout(numRows, numCols + 1));
|
||||
this.inputTextFields = new JTextField[numRows][numCols];
|
||||
for (int i = 0; i < numRows; i++) {
|
||||
JLabel label = new JLabel("Value X" + i + ": ");
|
||||
this.m_DataPanel.add(label);
|
||||
this.dataPanel.add(label);
|
||||
for (int j = 0; j < numCols; j++) {
|
||||
this.m_InputTextFields[i][j] = new JTextField();
|
||||
this.m_InputTextFields[i][j].setText("" + m_DoubleArray.getValue(i, j));
|
||||
this.m_InputTextFields[i][j].addKeyListener(this.readDoubleArrayAction);
|
||||
this.m_InputTextFields[i][j].addFocusListener(new MyFocusListener(i, this));
|
||||
this.m_DataPanel.add(this.m_InputTextFields[i][j]);
|
||||
this.inputTextFields[i][j] = new JTextField();
|
||||
this.inputTextFields[i][j].setText("" + doubleArray.getValue(i, j));
|
||||
this.inputTextFields[i][j].addKeyListener(this.readDoubleArrayAction);
|
||||
this.inputTextFields[i][j].addFocusListener(new MyFocusListener(i, this));
|
||||
this.dataPanel.add(this.inputTextFields[i][j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -257,7 +239,7 @@ public class GenericDoubleArrayEditor extends JPanel implements PropertyEditor {
|
||||
@Override
|
||||
public void setValue(Object o) {
|
||||
if (o instanceof PropertyDoubleArray) {
|
||||
this.m_DoubleArray = (PropertyDoubleArray) o;
|
||||
this.doubleArray = (PropertyDoubleArray) o;
|
||||
this.updateEditor();
|
||||
}
|
||||
}
|
||||
@ -269,7 +251,7 @@ public class GenericDoubleArrayEditor extends JPanel implements PropertyEditor {
|
||||
*/
|
||||
@Override
|
||||
public Object getValue() {
|
||||
return this.m_DoubleArray;
|
||||
return this.doubleArray;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -303,18 +285,18 @@ public class GenericDoubleArrayEditor extends JPanel implements PropertyEditor {
|
||||
|
||||
@Override
|
||||
public void addPropertyChangeListener(PropertyChangeListener l) {
|
||||
if (m_Support == null) {
|
||||
m_Support = new PropertyChangeSupport(this);
|
||||
if (support == null) {
|
||||
support = new PropertyChangeSupport(this);
|
||||
}
|
||||
m_Support.addPropertyChangeListener(l);
|
||||
support.addPropertyChangeListener(l);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removePropertyChangeListener(PropertyChangeListener l) {
|
||||
if (m_Support == null) {
|
||||
m_Support = new PropertyChangeSupport(this);
|
||||
if (support == null) {
|
||||
support = new PropertyChangeSupport(this);
|
||||
}
|
||||
m_Support.removePropertyChangeListener(l);
|
||||
support.removePropertyChangeListener(l);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -323,7 +305,7 @@ public class GenericDoubleArrayEditor extends JPanel implements PropertyEditor {
|
||||
* @param a The action listener.
|
||||
*/
|
||||
public void addOkListener(ActionListener a) {
|
||||
m_OKButton.addActionListener(a);
|
||||
okButton.addActionListener(a);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -332,7 +314,7 @@ public class GenericDoubleArrayEditor extends JPanel implements PropertyEditor {
|
||||
* @param a The action listener
|
||||
*/
|
||||
public void removeOkListener(ActionListener a) {
|
||||
m_OKButton.removeActionListener(a);
|
||||
okButton.removeActionListener(a);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -376,9 +358,9 @@ public class GenericDoubleArrayEditor extends JPanel implements PropertyEditor {
|
||||
*/
|
||||
@Override
|
||||
public Component getCustomEditor() {
|
||||
if (this.m_CustomEditor == null) {
|
||||
if (this.customEditor == null) {
|
||||
this.initCustomEditor();
|
||||
}
|
||||
return m_CustomEditor;
|
||||
return customEditor;
|
||||
}
|
||||
}
|
@ -21,23 +21,23 @@ public class GenericEpsilonConstraintEditor extends JPanel implements PropertyEd
|
||||
/**
|
||||
* Handles property change notification
|
||||
*/
|
||||
private PropertyChangeSupport m_Support = new PropertyChangeSupport(this);
|
||||
private PropertyChangeSupport propertyChangeSupport = new PropertyChangeSupport(this);
|
||||
/**
|
||||
* The label for when we can't edit that type
|
||||
*/
|
||||
private JLabel m_Label = new JLabel("Can't edit", SwingConstants.CENTER);
|
||||
private JLabel label = new JLabel("Can't edit", SwingConstants.CENTER);
|
||||
/**
|
||||
* The FilePath that is to be edited
|
||||
* The filePath that is to be edited
|
||||
*/
|
||||
private PropertyEpsilonConstraint m_EpsilonConstraint;
|
||||
private PropertyEpsilonConstraint epsilonConstraint;
|
||||
|
||||
/**
|
||||
* The gaphix stuff
|
||||
*/
|
||||
private JPanel m_CustomEditor, m_DataPanel, m_ButtonPanel, m_TargetPanel;
|
||||
private JTextField[] m_TargetTextField;
|
||||
private JComboBox m_Objective;
|
||||
private JButton m_OKButton;
|
||||
private JPanel customEditor, dataPanel, buttonPanel, targetPanel;
|
||||
private JTextField[] targetTextField;
|
||||
private JComboBox objectiveComboBox;
|
||||
private JButton okButton;
|
||||
|
||||
public GenericEpsilonConstraintEditor() {
|
||||
// compiled code
|
||||
@ -47,42 +47,42 @@ public class GenericEpsilonConstraintEditor extends JPanel implements PropertyEd
|
||||
* This method will init the CustomEditor Panel
|
||||
*/
|
||||
private void initCustomEditor() {
|
||||
this.m_CustomEditor = new JPanel();
|
||||
this.m_CustomEditor.setLayout(new BorderLayout());
|
||||
this.customEditor = new JPanel();
|
||||
this.customEditor.setLayout(new BorderLayout());
|
||||
|
||||
// target panel
|
||||
this.m_TargetPanel = new JPanel();
|
||||
this.m_TargetPanel.setLayout(new GridLayout(1, 2));
|
||||
this.m_TargetPanel.add(new JLabel("Optimize:"));
|
||||
this.m_Objective = new JComboBox();
|
||||
for (int i = 0; i < this.m_EpsilonConstraint.m_TargetValue.length; i++) {
|
||||
this.m_Objective.addItem("Objective " + i);
|
||||
this.targetPanel = new JPanel();
|
||||
this.targetPanel.setLayout(new GridLayout(1, 2));
|
||||
this.targetPanel.add(new JLabel("Optimize:"));
|
||||
this.objectiveComboBox = new JComboBox();
|
||||
for (int i = 0; i < this.epsilonConstraint.targetValue.length; i++) {
|
||||
this.objectiveComboBox.addItem("Objective " + i);
|
||||
}
|
||||
this.m_TargetPanel.add(this.m_Objective);
|
||||
this.m_Objective.addItemListener(this.objectiveAction);
|
||||
this.m_CustomEditor.add(this.m_TargetPanel, BorderLayout.NORTH);
|
||||
this.targetPanel.add(this.objectiveComboBox);
|
||||
this.objectiveComboBox.addItemListener(this.objectiveAction);
|
||||
this.customEditor.add(this.targetPanel, BorderLayout.NORTH);
|
||||
|
||||
// init data panel
|
||||
this.m_DataPanel = new JPanel();
|
||||
this.dataPanel = new JPanel();
|
||||
this.updateDataPanel();
|
||||
this.m_CustomEditor.add(this.m_DataPanel, BorderLayout.CENTER);
|
||||
this.customEditor.add(this.dataPanel, BorderLayout.CENTER);
|
||||
|
||||
// init button panel
|
||||
this.m_ButtonPanel = new JPanel();
|
||||
this.m_OKButton = new JButton("OK");
|
||||
this.m_OKButton.setEnabled(true);
|
||||
this.m_OKButton.addActionListener(new ActionListener() {
|
||||
this.buttonPanel = new JPanel();
|
||||
this.okButton = new JButton("OK");
|
||||
this.okButton.setEnabled(true);
|
||||
this.okButton.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
//backupObject = copyObject(object);
|
||||
if ((m_CustomEditor.getTopLevelAncestor() != null) && (m_CustomEditor.getTopLevelAncestor() instanceof Window)) {
|
||||
Window w = (Window) m_CustomEditor.getTopLevelAncestor();
|
||||
if ((customEditor.getTopLevelAncestor() != null) && (customEditor.getTopLevelAncestor() instanceof Window)) {
|
||||
Window w = (Window) customEditor.getTopLevelAncestor();
|
||||
w.dispose();
|
||||
}
|
||||
}
|
||||
});
|
||||
this.m_ButtonPanel.add(this.m_OKButton);
|
||||
this.m_CustomEditor.add(this.m_ButtonPanel, BorderLayout.SOUTH);
|
||||
this.buttonPanel.add(this.okButton);
|
||||
this.customEditor.add(this.buttonPanel, BorderLayout.SOUTH);
|
||||
this.updateEditor();
|
||||
}
|
||||
|
||||
@ -92,7 +92,7 @@ public class GenericEpsilonConstraintEditor extends JPanel implements PropertyEd
|
||||
ItemListener objectiveAction = new ItemListener() {
|
||||
@Override
|
||||
public void itemStateChanged(ItemEvent event) {
|
||||
m_EpsilonConstraint.m_OptimizeObjective = m_Objective.getSelectedIndex();
|
||||
epsilonConstraint.optimizeObjective = objectiveComboBox.getSelectedIndex();
|
||||
updateEditor();
|
||||
}
|
||||
};
|
||||
@ -111,20 +111,20 @@ public class GenericEpsilonConstraintEditor extends JPanel implements PropertyEd
|
||||
|
||||
@Override
|
||||
public void keyReleased(KeyEvent event) {
|
||||
double[] tmpT = m_EpsilonConstraint.m_TargetValue;
|
||||
double[] tmpT = epsilonConstraint.targetValue;
|
||||
|
||||
for (int i = 0; i < tmpT.length; i++) {
|
||||
|
||||
try {
|
||||
double d = 0;
|
||||
d = new Double(m_TargetTextField[i].getText()).doubleValue();
|
||||
d = new Double(targetTextField[i].getText()).doubleValue();
|
||||
tmpT[i] = d;
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
m_EpsilonConstraint.m_TargetValue = tmpT;
|
||||
epsilonConstraint.targetValue = tmpT;
|
||||
}
|
||||
};
|
||||
|
||||
@ -132,10 +132,10 @@ public class GenericEpsilonConstraintEditor extends JPanel implements PropertyEd
|
||||
* The object may have changed update the editor.
|
||||
*/
|
||||
private void updateEditor() {
|
||||
if (this.m_CustomEditor != null) {
|
||||
if (this.customEditor != null) {
|
||||
this.updateDataPanel();
|
||||
this.m_CustomEditor.validate();
|
||||
this.m_CustomEditor.repaint();
|
||||
this.customEditor.validate();
|
||||
this.customEditor.repaint();
|
||||
}
|
||||
}
|
||||
|
||||
@ -143,23 +143,23 @@ public class GenericEpsilonConstraintEditor extends JPanel implements PropertyEd
|
||||
* This method updates the data panel
|
||||
*/
|
||||
private void updateDataPanel() {
|
||||
double[] tmpT = this.m_EpsilonConstraint.m_TargetValue;
|
||||
int obj = this.m_EpsilonConstraint.m_OptimizeObjective;
|
||||
double[] tmpT = this.epsilonConstraint.targetValue;
|
||||
int obj = this.epsilonConstraint.optimizeObjective;
|
||||
|
||||
this.m_DataPanel.removeAll();
|
||||
this.m_DataPanel.setLayout(new GridLayout(tmpT.length + 1, 2));
|
||||
this.m_DataPanel.add(new JLabel());
|
||||
this.m_DataPanel.add(new JLabel("Target Value"));
|
||||
this.m_TargetTextField = new JTextField[tmpT.length];
|
||||
this.dataPanel.removeAll();
|
||||
this.dataPanel.setLayout(new GridLayout(tmpT.length + 1, 2));
|
||||
this.dataPanel.add(new JLabel());
|
||||
this.dataPanel.add(new JLabel("Target Value"));
|
||||
this.targetTextField = new JTextField[tmpT.length];
|
||||
for (int i = 0; i < tmpT.length; i++) {
|
||||
JLabel label = new JLabel("Objective " + i + ": ");
|
||||
this.m_DataPanel.add(label);
|
||||
this.m_TargetTextField[i] = new JTextField();
|
||||
this.m_TargetTextField[i].setText("" + tmpT[i]);
|
||||
this.m_TargetTextField[i].addKeyListener(this.readDoubleArrayAction);
|
||||
this.m_DataPanel.add(this.m_TargetTextField[i]);
|
||||
this.dataPanel.add(label);
|
||||
this.targetTextField[i] = new JTextField();
|
||||
this.targetTextField[i].setText("" + tmpT[i]);
|
||||
this.targetTextField[i].addKeyListener(this.readDoubleArrayAction);
|
||||
this.dataPanel.add(this.targetTextField[i]);
|
||||
}
|
||||
this.m_TargetTextField[obj].setEditable(false);
|
||||
this.targetTextField[obj].setEditable(false);
|
||||
}
|
||||
|
||||
|
||||
@ -171,7 +171,7 @@ public class GenericEpsilonConstraintEditor extends JPanel implements PropertyEd
|
||||
@Override
|
||||
public void setValue(Object o) {
|
||||
if (o instanceof PropertyEpsilonConstraint) {
|
||||
this.m_EpsilonConstraint = (PropertyEpsilonConstraint) o;
|
||||
this.epsilonConstraint = (PropertyEpsilonConstraint) o;
|
||||
this.updateEditor();
|
||||
}
|
||||
}
|
||||
@ -183,7 +183,7 @@ public class GenericEpsilonConstraintEditor extends JPanel implements PropertyEd
|
||||
*/
|
||||
@Override
|
||||
public Object getValue() {
|
||||
return this.m_EpsilonConstraint;
|
||||
return this.epsilonConstraint;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -217,18 +217,18 @@ public class GenericEpsilonConstraintEditor extends JPanel implements PropertyEd
|
||||
|
||||
@Override
|
||||
public void addPropertyChangeListener(PropertyChangeListener l) {
|
||||
if (m_Support == null) {
|
||||
m_Support = new PropertyChangeSupport(this);
|
||||
if (propertyChangeSupport == null) {
|
||||
propertyChangeSupport = new PropertyChangeSupport(this);
|
||||
}
|
||||
m_Support.addPropertyChangeListener(l);
|
||||
propertyChangeSupport.addPropertyChangeListener(l);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removePropertyChangeListener(PropertyChangeListener l) {
|
||||
if (m_Support == null) {
|
||||
m_Support = new PropertyChangeSupport(this);
|
||||
if (propertyChangeSupport == null) {
|
||||
propertyChangeSupport = new PropertyChangeSupport(this);
|
||||
}
|
||||
m_Support.removePropertyChangeListener(l);
|
||||
propertyChangeSupport.removePropertyChangeListener(l);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -237,7 +237,7 @@ public class GenericEpsilonConstraintEditor extends JPanel implements PropertyEd
|
||||
* @param a The action listener.
|
||||
*/
|
||||
public void addOkListener(ActionListener a) {
|
||||
m_OKButton.addActionListener(a);
|
||||
okButton.addActionListener(a);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -246,7 +246,7 @@ public class GenericEpsilonConstraintEditor extends JPanel implements PropertyEd
|
||||
* @param a The action listener
|
||||
*/
|
||||
public void removeOkListener(ActionListener a) {
|
||||
m_OKButton.removeActionListener(a);
|
||||
okButton.removeActionListener(a);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -290,9 +290,9 @@ public class GenericEpsilonConstraintEditor extends JPanel implements PropertyEd
|
||||
*/
|
||||
@Override
|
||||
public Component getCustomEditor() {
|
||||
if (this.m_CustomEditor == null) {
|
||||
if (this.customEditor == null) {
|
||||
this.initCustomEditor();
|
||||
}
|
||||
return m_CustomEditor;
|
||||
return customEditor;
|
||||
}
|
||||
}
|
@ -10,34 +10,30 @@ import java.beans.PropertyChangeSupport;
|
||||
import java.beans.PropertyEditor;
|
||||
|
||||
/**
|
||||
* Created by IntelliJ IDEA.
|
||||
* User: streiche
|
||||
* Date: 05.03.2004
|
||||
* Time: 15:17:09
|
||||
* To change this template use File | Settings | File Templates.
|
||||
*
|
||||
*/
|
||||
public class GenericEpsilonThresholdEditor extends JPanel implements PropertyEditor {
|
||||
|
||||
/**
|
||||
* Handles property change notification
|
||||
*/
|
||||
private PropertyChangeSupport m_Support = new PropertyChangeSupport(this);
|
||||
private PropertyChangeSupport propertyChangeSupport = new PropertyChangeSupport(this);
|
||||
/**
|
||||
* The label for when we can't edit that type
|
||||
*/
|
||||
private JLabel m_Label = new JLabel("Can't edit", SwingConstants.CENTER);
|
||||
private JLabel label = new JLabel("Can't edit", SwingConstants.CENTER);
|
||||
/**
|
||||
* The FilePath that is to be edited
|
||||
* The filePath that is to be edited
|
||||
*/
|
||||
private PropertyEpsilonThreshold m_EpsilonThreshhold;
|
||||
private PropertyEpsilonThreshold epsilonThreshhold;
|
||||
|
||||
/**
|
||||
* The gaphix stuff
|
||||
*/
|
||||
private JPanel m_CustomEditor, m_DataPanel, m_ButtonPanel, m_TargetPanel;
|
||||
private JTextField[] m_TargetTextField, m_PunishTextField;
|
||||
private JComboBox m_Objective;
|
||||
private JButton m_OKButton;
|
||||
private JPanel customEditor, dataPanel, buttonPanel, targetPanel;
|
||||
private JTextField[] targetTextField, punishTextField;
|
||||
private JComboBox objectiveComboBox;
|
||||
private JButton okButton;
|
||||
|
||||
public GenericEpsilonThresholdEditor() {
|
||||
// compiled code
|
||||
@ -47,42 +43,42 @@ public class GenericEpsilonThresholdEditor extends JPanel implements PropertyEdi
|
||||
* This method will init the CustomEditor Panel
|
||||
*/
|
||||
private void initCustomEditor() {
|
||||
this.m_CustomEditor = new JPanel();
|
||||
this.m_CustomEditor.setLayout(new BorderLayout());
|
||||
this.customEditor = new JPanel();
|
||||
this.customEditor.setLayout(new BorderLayout());
|
||||
|
||||
// target panel
|
||||
this.m_TargetPanel = new JPanel();
|
||||
this.m_TargetPanel.setLayout(new GridLayout(1, 2));
|
||||
this.m_TargetPanel.add(new JLabel("Optimize:"));
|
||||
this.m_Objective = new JComboBox();
|
||||
for (int i = 0; i < this.m_EpsilonThreshhold.m_TargetValue.length; i++) {
|
||||
this.m_Objective.addItem("Objective " + i);
|
||||
this.targetPanel = new JPanel();
|
||||
this.targetPanel.setLayout(new GridLayout(1, 2));
|
||||
this.targetPanel.add(new JLabel("Optimize:"));
|
||||
this.objectiveComboBox = new JComboBox();
|
||||
for (int i = 0; i < this.epsilonThreshhold.targetValue.length; i++) {
|
||||
this.objectiveComboBox.addItem("Objective " + i);
|
||||
}
|
||||
this.m_TargetPanel.add(this.m_Objective);
|
||||
this.m_Objective.addItemListener(this.objectiveAction);
|
||||
this.m_CustomEditor.add(this.m_TargetPanel, BorderLayout.NORTH);
|
||||
this.targetPanel.add(this.objectiveComboBox);
|
||||
this.objectiveComboBox.addItemListener(this.objectiveAction);
|
||||
this.customEditor.add(this.targetPanel, BorderLayout.NORTH);
|
||||
|
||||
// init data panel
|
||||
this.m_DataPanel = new JPanel();
|
||||
this.dataPanel = new JPanel();
|
||||
this.updateDataPanel();
|
||||
this.m_CustomEditor.add(this.m_DataPanel, BorderLayout.CENTER);
|
||||
this.customEditor.add(this.dataPanel, BorderLayout.CENTER);
|
||||
|
||||
// init button panel
|
||||
this.m_ButtonPanel = new JPanel();
|
||||
this.m_OKButton = new JButton("OK");
|
||||
this.m_OKButton.setEnabled(true);
|
||||
this.m_OKButton.addActionListener(new ActionListener() {
|
||||
this.buttonPanel = new JPanel();
|
||||
this.okButton = new JButton("OK");
|
||||
this.okButton.setEnabled(true);
|
||||
this.okButton.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
//backupObject = copyObject(object);
|
||||
if ((m_CustomEditor.getTopLevelAncestor() != null) && (m_CustomEditor.getTopLevelAncestor() instanceof Window)) {
|
||||
Window w = (Window) m_CustomEditor.getTopLevelAncestor();
|
||||
if ((customEditor.getTopLevelAncestor() != null) && (customEditor.getTopLevelAncestor() instanceof Window)) {
|
||||
Window w = (Window) customEditor.getTopLevelAncestor();
|
||||
w.dispose();
|
||||
}
|
||||
}
|
||||
});
|
||||
this.m_ButtonPanel.add(this.m_OKButton);
|
||||
this.m_CustomEditor.add(this.m_ButtonPanel, BorderLayout.SOUTH);
|
||||
this.buttonPanel.add(this.okButton);
|
||||
this.customEditor.add(this.buttonPanel, BorderLayout.SOUTH);
|
||||
this.updateEditor();
|
||||
}
|
||||
|
||||
@ -92,7 +88,7 @@ public class GenericEpsilonThresholdEditor extends JPanel implements PropertyEdi
|
||||
ItemListener objectiveAction = new ItemListener() {
|
||||
@Override
|
||||
public void itemStateChanged(ItemEvent event) {
|
||||
m_EpsilonThreshhold.m_OptimizeObjective = m_Objective.getSelectedIndex();
|
||||
epsilonThreshhold.optimizeObjective = objectiveComboBox.getSelectedIndex();
|
||||
updateEditor();
|
||||
}
|
||||
};
|
||||
@ -111,29 +107,29 @@ public class GenericEpsilonThresholdEditor extends JPanel implements PropertyEdi
|
||||
|
||||
@Override
|
||||
public void keyReleased(KeyEvent event) {
|
||||
double[] tmpT = m_EpsilonThreshhold.m_TargetValue;
|
||||
double[] tmpP = m_EpsilonThreshhold.m_Punishment;
|
||||
double[] tmpT = epsilonThreshhold.targetValue;
|
||||
double[] tmpP = epsilonThreshhold.punishment;
|
||||
|
||||
for (int i = 0; i < tmpT.length; i++) {
|
||||
|
||||
try {
|
||||
double d = 0;
|
||||
d = new Double(m_TargetTextField[i].getText()).doubleValue();
|
||||
d = new Double(targetTextField[i].getText()).doubleValue();
|
||||
tmpT[i] = d;
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
try {
|
||||
double d = 0;
|
||||
d = new Double(m_PunishTextField[i].getText()).doubleValue();
|
||||
d = new Double(punishTextField[i].getText()).doubleValue();
|
||||
tmpP[i] = d;
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
m_EpsilonThreshhold.m_TargetValue = tmpT;
|
||||
m_EpsilonThreshhold.m_Punishment = tmpP;
|
||||
epsilonThreshhold.targetValue = tmpT;
|
||||
epsilonThreshhold.punishment = tmpP;
|
||||
}
|
||||
};
|
||||
|
||||
@ -141,10 +137,10 @@ public class GenericEpsilonThresholdEditor extends JPanel implements PropertyEdi
|
||||
* The object may have changed update the editor.
|
||||
*/
|
||||
private void updateEditor() {
|
||||
if (this.m_CustomEditor != null) {
|
||||
if (this.customEditor != null) {
|
||||
this.updateDataPanel();
|
||||
this.m_CustomEditor.validate();
|
||||
this.m_CustomEditor.repaint();
|
||||
this.customEditor.validate();
|
||||
this.customEditor.repaint();
|
||||
}
|
||||
}
|
||||
|
||||
@ -152,31 +148,31 @@ public class GenericEpsilonThresholdEditor extends JPanel implements PropertyEdi
|
||||
* This method updates the data panel
|
||||
*/
|
||||
private void updateDataPanel() {
|
||||
double[] tmpT = this.m_EpsilonThreshhold.m_TargetValue;
|
||||
double[] tmpP = this.m_EpsilonThreshhold.m_Punishment;
|
||||
int obj = this.m_EpsilonThreshhold.m_OptimizeObjective;
|
||||
double[] tmpT = this.epsilonThreshhold.targetValue;
|
||||
double[] tmpP = this.epsilonThreshhold.punishment;
|
||||
int obj = this.epsilonThreshhold.optimizeObjective;
|
||||
|
||||
this.m_DataPanel.removeAll();
|
||||
this.m_DataPanel.setLayout(new GridLayout(tmpT.length + 1, 3));
|
||||
this.m_DataPanel.add(new JLabel());
|
||||
this.m_DataPanel.add(new JLabel("Target Value"));
|
||||
this.m_DataPanel.add(new JLabel("Punishment"));
|
||||
this.m_TargetTextField = new JTextField[tmpT.length];
|
||||
this.m_PunishTextField = new JTextField[tmpT.length];
|
||||
this.dataPanel.removeAll();
|
||||
this.dataPanel.setLayout(new GridLayout(tmpT.length + 1, 3));
|
||||
this.dataPanel.add(new JLabel());
|
||||
this.dataPanel.add(new JLabel("Target Value"));
|
||||
this.dataPanel.add(new JLabel("Punishment"));
|
||||
this.targetTextField = new JTextField[tmpT.length];
|
||||
this.punishTextField = new JTextField[tmpT.length];
|
||||
for (int i = 0; i < tmpT.length; i++) {
|
||||
JLabel label = new JLabel("Objective " + i + ": ");
|
||||
this.m_DataPanel.add(label);
|
||||
this.m_TargetTextField[i] = new JTextField();
|
||||
this.m_TargetTextField[i].setText("" + tmpT[i]);
|
||||
this.m_TargetTextField[i].addKeyListener(this.readDoubleArrayAction);
|
||||
this.m_DataPanel.add(this.m_TargetTextField[i]);
|
||||
this.m_PunishTextField[i] = new JTextField();
|
||||
this.m_PunishTextField[i].setText("" + tmpP[i]);
|
||||
this.m_PunishTextField[i].addKeyListener(this.readDoubleArrayAction);
|
||||
this.m_DataPanel.add(this.m_PunishTextField[i]);
|
||||
this.dataPanel.add(label);
|
||||
this.targetTextField[i] = new JTextField();
|
||||
this.targetTextField[i].setText("" + tmpT[i]);
|
||||
this.targetTextField[i].addKeyListener(this.readDoubleArrayAction);
|
||||
this.dataPanel.add(this.targetTextField[i]);
|
||||
this.punishTextField[i] = new JTextField();
|
||||
this.punishTextField[i].setText("" + tmpP[i]);
|
||||
this.punishTextField[i].addKeyListener(this.readDoubleArrayAction);
|
||||
this.dataPanel.add(this.punishTextField[i]);
|
||||
}
|
||||
this.m_TargetTextField[obj].setEditable(false);
|
||||
this.m_PunishTextField[obj].setEditable(false);
|
||||
this.targetTextField[obj].setEditable(false);
|
||||
this.punishTextField[obj].setEditable(false);
|
||||
}
|
||||
|
||||
|
||||
@ -188,7 +184,7 @@ public class GenericEpsilonThresholdEditor extends JPanel implements PropertyEdi
|
||||
@Override
|
||||
public void setValue(Object o) {
|
||||
if (o instanceof PropertyEpsilonThreshold) {
|
||||
this.m_EpsilonThreshhold = (PropertyEpsilonThreshold) o;
|
||||
this.epsilonThreshhold = (PropertyEpsilonThreshold) o;
|
||||
this.updateEditor();
|
||||
}
|
||||
}
|
||||
@ -200,7 +196,7 @@ public class GenericEpsilonThresholdEditor extends JPanel implements PropertyEdi
|
||||
*/
|
||||
@Override
|
||||
public Object getValue() {
|
||||
return this.m_EpsilonThreshhold;
|
||||
return this.epsilonThreshhold;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -234,18 +230,18 @@ public class GenericEpsilonThresholdEditor extends JPanel implements PropertyEdi
|
||||
|
||||
@Override
|
||||
public void addPropertyChangeListener(PropertyChangeListener l) {
|
||||
if (m_Support == null) {
|
||||
m_Support = new PropertyChangeSupport(this);
|
||||
if (propertyChangeSupport == null) {
|
||||
propertyChangeSupport = new PropertyChangeSupport(this);
|
||||
}
|
||||
m_Support.addPropertyChangeListener(l);
|
||||
propertyChangeSupport.addPropertyChangeListener(l);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removePropertyChangeListener(PropertyChangeListener l) {
|
||||
if (m_Support == null) {
|
||||
m_Support = new PropertyChangeSupport(this);
|
||||
if (propertyChangeSupport == null) {
|
||||
propertyChangeSupport = new PropertyChangeSupport(this);
|
||||
}
|
||||
m_Support.removePropertyChangeListener(l);
|
||||
propertyChangeSupport.removePropertyChangeListener(l);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -254,7 +250,7 @@ public class GenericEpsilonThresholdEditor extends JPanel implements PropertyEdi
|
||||
* @param a The action listener.
|
||||
*/
|
||||
public void addOkListener(ActionListener a) {
|
||||
m_OKButton.addActionListener(a);
|
||||
okButton.addActionListener(a);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -263,7 +259,7 @@ public class GenericEpsilonThresholdEditor extends JPanel implements PropertyEdi
|
||||
* @param a The action listener
|
||||
*/
|
||||
public void removeOkListener(ActionListener a) {
|
||||
m_OKButton.removeActionListener(a);
|
||||
okButton.removeActionListener(a);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -307,9 +303,9 @@ public class GenericEpsilonThresholdEditor extends JPanel implements PropertyEdi
|
||||
*/
|
||||
@Override
|
||||
public Component getCustomEditor() {
|
||||
if (this.m_CustomEditor == null) {
|
||||
if (this.customEditor == null) {
|
||||
this.initCustomEditor();
|
||||
}
|
||||
return m_CustomEditor;
|
||||
return customEditor;
|
||||
}
|
||||
}
|
@ -12,32 +12,28 @@ import java.beans.PropertyEditor;
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
* Created by IntelliJ IDEA.
|
||||
* User: streiche
|
||||
* Date: 28.08.2003
|
||||
* Time: 11:11:59
|
||||
* To change this template use Options | File Templates.
|
||||
*
|
||||
*/
|
||||
public class GenericFilePathEditor extends JPanel implements PropertyEditor {
|
||||
|
||||
/**
|
||||
* Handles property change notification
|
||||
*/
|
||||
private PropertyChangeSupport m_Support = new PropertyChangeSupport(this);
|
||||
private PropertyChangeSupport propertyChangeSupport = new PropertyChangeSupport(this);
|
||||
/**
|
||||
* The label for when we can't edit that type
|
||||
*/
|
||||
private JLabel m_Label = new JLabel("Can't edit", SwingConstants.CENTER);
|
||||
private JLabel label = new JLabel("Can't edit", SwingConstants.CENTER);
|
||||
/**
|
||||
* The FilePath that is to be edited
|
||||
* The filePath that is to be edited
|
||||
*/
|
||||
private PropertyFilePath m_FilePath;
|
||||
private PropertyFilePath filePath;
|
||||
|
||||
/**
|
||||
* The gaphix stuff
|
||||
*/
|
||||
private JFileChooser m_FileChooser;
|
||||
private JPanel m_Panel;
|
||||
private JFileChooser fileChooser;
|
||||
private JPanel panel;
|
||||
|
||||
public GenericFilePathEditor() {
|
||||
// compiled code
|
||||
@ -51,7 +47,7 @@ public class GenericFilePathEditor extends JPanel implements PropertyEditor {
|
||||
@Override
|
||||
public void setValue(Object o) {
|
||||
if (o instanceof PropertyFilePath) {
|
||||
this.m_FilePath = (PropertyFilePath) o;
|
||||
this.filePath = (PropertyFilePath) o;
|
||||
}
|
||||
}
|
||||
|
||||
@ -62,7 +58,7 @@ public class GenericFilePathEditor extends JPanel implements PropertyEditor {
|
||||
*/
|
||||
@Override
|
||||
public Object getValue() {
|
||||
return this.m_FilePath;
|
||||
return this.filePath;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -96,18 +92,18 @@ public class GenericFilePathEditor extends JPanel implements PropertyEditor {
|
||||
|
||||
@Override
|
||||
public void addPropertyChangeListener(PropertyChangeListener l) {
|
||||
if (m_Support == null) {
|
||||
m_Support = new PropertyChangeSupport(this);
|
||||
if (propertyChangeSupport == null) {
|
||||
propertyChangeSupport = new PropertyChangeSupport(this);
|
||||
}
|
||||
m_Support.addPropertyChangeListener(l);
|
||||
propertyChangeSupport.addPropertyChangeListener(l);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removePropertyChangeListener(PropertyChangeListener l) {
|
||||
if (m_Support == null) {
|
||||
m_Support = new PropertyChangeSupport(this);
|
||||
if (propertyChangeSupport == null) {
|
||||
propertyChangeSupport = new PropertyChangeSupport(this);
|
||||
}
|
||||
m_Support.removePropertyChangeListener(l);
|
||||
propertyChangeSupport.removePropertyChangeListener(l);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -130,7 +126,7 @@ public class GenericFilePathEditor extends JPanel implements PropertyEditor {
|
||||
public void paintValue(Graphics gfx, Rectangle box) {
|
||||
FontMetrics fm = gfx.getFontMetrics();
|
||||
int vpad = (box.height - fm.getAscent()) / 2;
|
||||
String rep = this.m_FilePath.FileName;
|
||||
String rep = this.filePath.fileName;
|
||||
gfx.drawString(rep, 2, fm.getHeight() + vpad - 3);
|
||||
}
|
||||
|
||||
@ -151,14 +147,14 @@ public class GenericFilePathEditor extends JPanel implements PropertyEditor {
|
||||
*/
|
||||
@Override
|
||||
public Component getCustomEditor() {
|
||||
this.m_Panel = new JPanel();
|
||||
this.m_FileChooser = new JFileChooser();
|
||||
File file = new File(this.m_FilePath.getCompleteFilePath());
|
||||
this.m_FileChooser.setSelectedFile(file);
|
||||
this.m_FileChooser.setMultiSelectionEnabled(false);
|
||||
this.m_Panel.add(this.m_FileChooser);
|
||||
this.m_FileChooser.addActionListener(this.fileChooserAction);
|
||||
return this.m_Panel;
|
||||
this.panel = new JPanel();
|
||||
this.fileChooser = new JFileChooser();
|
||||
File file = new File(this.filePath.getCompleteFilePath());
|
||||
this.fileChooser.setSelectedFile(file);
|
||||
this.fileChooser.setMultiSelectionEnabled(false);
|
||||
this.panel.add(this.fileChooser);
|
||||
this.fileChooser.addActionListener(this.fileChooserAction);
|
||||
return this.panel;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -169,20 +165,20 @@ public class GenericFilePathEditor extends JPanel implements PropertyEditor {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent event) {
|
||||
if (event.getActionCommand() == "ApproveSelection") {
|
||||
m_FilePath.setCompleteFilePath(m_FileChooser.getSelectedFile().getAbsolutePath());
|
||||
m_Support.firePropertyChange("", m_FilePath, null);
|
||||
Window w = (Window) m_FileChooser.getTopLevelAncestor();
|
||||
filePath.setCompleteFilePath(fileChooser.getSelectedFile().getAbsolutePath());
|
||||
propertyChangeSupport.firePropertyChange("", filePath, null);
|
||||
Window w = (Window) fileChooser.getTopLevelAncestor();
|
||||
w.dispose();
|
||||
m_Panel = null;
|
||||
panel = null;
|
||||
}
|
||||
if (event.getActionCommand() == "CancelSelection") {
|
||||
m_FilePath.setCompleteFilePath(m_FileChooser.getSelectedFile().getAbsolutePath());
|
||||
m_Support.firePropertyChange("", m_FilePath, null);
|
||||
Window w = (Window) m_FileChooser.getTopLevelAncestor();
|
||||
filePath.setCompleteFilePath(fileChooser.getSelectedFile().getAbsolutePath());
|
||||
propertyChangeSupport.firePropertyChange("", filePath, null);
|
||||
Window w = (Window) fileChooser.getTopLevelAncestor();
|
||||
if (w != null) {
|
||||
w.dispose();
|
||||
}
|
||||
m_Panel = null;
|
||||
panel = null;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -13,33 +13,29 @@ import java.beans.PropertyChangeSupport;
|
||||
import java.beans.PropertyEditor;
|
||||
|
||||
/**
|
||||
* Created by IntelliJ IDEA.
|
||||
* User: streiche
|
||||
* Date: 12.09.2005
|
||||
* Time: 10:20:30
|
||||
* To change this template use File | Settings | File Templates.
|
||||
*
|
||||
*/
|
||||
public class GenericIntArrayEditor extends JPanel implements PropertyEditor {
|
||||
|
||||
/**
|
||||
* Handles property change notification
|
||||
*/
|
||||
private PropertyChangeSupport m_Support = new PropertyChangeSupport(this);
|
||||
private PropertyChangeSupport propertyChangeSupport = new PropertyChangeSupport(this);
|
||||
/**
|
||||
* The label for when we can't edit that type
|
||||
*/
|
||||
private JLabel m_Label = new JLabel("Can't edit", SwingConstants.CENTER);
|
||||
private JLabel label = new JLabel("Can't edit", SwingConstants.CENTER);
|
||||
/**
|
||||
* The FilePath that is to be edited
|
||||
* The filePath that is to be edited
|
||||
*/
|
||||
private PropertyIntArray m_IntArray;
|
||||
private PropertyIntArray intArray;
|
||||
|
||||
/**
|
||||
* The gaphix stuff
|
||||
*/
|
||||
private JPanel m_CustomEditor, m_DataPanel, m_ButtonPanel;
|
||||
private JTextField[] m_InputTextField;
|
||||
private JButton m_OKButton;
|
||||
private JPanel customEditor, dataPanel, buttonPanel;
|
||||
private JTextField[] inputTextField;
|
||||
private JButton okButton;
|
||||
|
||||
public GenericIntArrayEditor() {
|
||||
// compiled code
|
||||
@ -49,32 +45,32 @@ public class GenericIntArrayEditor extends JPanel implements PropertyEditor {
|
||||
* This method will init the CustomEditor Panel
|
||||
*/
|
||||
private void initCustomEditor() {
|
||||
this.m_CustomEditor = new JPanel();
|
||||
this.m_CustomEditor.setLayout(new BorderLayout());
|
||||
this.customEditor = new JPanel();
|
||||
this.customEditor.setLayout(new BorderLayout());
|
||||
|
||||
this.m_CustomEditor.add(new JLabel("Current Int Array:"), BorderLayout.NORTH);
|
||||
this.customEditor.add(new JLabel("Current Int Array:"), BorderLayout.NORTH);
|
||||
|
||||
// init data panel
|
||||
this.m_DataPanel = new JPanel();
|
||||
this.dataPanel = new JPanel();
|
||||
this.updateDataPanel();
|
||||
this.m_CustomEditor.add(this.m_DataPanel, BorderLayout.CENTER);
|
||||
this.customEditor.add(this.dataPanel, BorderLayout.CENTER);
|
||||
|
||||
// init button panel
|
||||
this.m_ButtonPanel = new JPanel();
|
||||
this.m_OKButton = new JButton("OK");
|
||||
this.m_OKButton.setEnabled(true);
|
||||
this.m_OKButton.addActionListener(new ActionListener() {
|
||||
this.buttonPanel = new JPanel();
|
||||
this.okButton = new JButton("OK");
|
||||
this.okButton.setEnabled(true);
|
||||
this.okButton.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
//backupObject = copyObject(object);
|
||||
if ((m_CustomEditor.getTopLevelAncestor() != null) && (m_CustomEditor.getTopLevelAncestor() instanceof Window)) {
|
||||
Window w = (Window) m_CustomEditor.getTopLevelAncestor();
|
||||
if ((customEditor.getTopLevelAncestor() != null) && (customEditor.getTopLevelAncestor() instanceof Window)) {
|
||||
Window w = (Window) customEditor.getTopLevelAncestor();
|
||||
w.dispose();
|
||||
}
|
||||
}
|
||||
});
|
||||
this.m_ButtonPanel.add(this.m_OKButton);
|
||||
this.m_CustomEditor.add(this.m_ButtonPanel, BorderLayout.SOUTH);
|
||||
this.buttonPanel.add(this.okButton);
|
||||
this.customEditor.add(this.buttonPanel, BorderLayout.SOUTH);
|
||||
this.updateEditor();
|
||||
}
|
||||
|
||||
@ -92,18 +88,18 @@ public class GenericIntArrayEditor extends JPanel implements PropertyEditor {
|
||||
|
||||
@Override
|
||||
public void keyReleased(KeyEvent event) {
|
||||
int[] tmpD = new int[m_InputTextField.length];
|
||||
int[] tmpD = new int[inputTextField.length];
|
||||
|
||||
for (int i = 0; i < tmpD.length; i++) {
|
||||
try {
|
||||
int d = 0;
|
||||
d = new Integer(m_InputTextField[i].getText()).intValue();
|
||||
d = new Integer(inputTextField[i].getText()).intValue();
|
||||
tmpD[i] = d;
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
}
|
||||
m_IntArray.setIntArray(tmpD);
|
||||
intArray.setIntArray(tmpD);
|
||||
}
|
||||
};
|
||||
|
||||
@ -111,10 +107,10 @@ public class GenericIntArrayEditor extends JPanel implements PropertyEditor {
|
||||
* The object may have changed update the editor.
|
||||
*/
|
||||
private void updateEditor() {
|
||||
if (this.m_CustomEditor != null) {
|
||||
if (this.customEditor != null) {
|
||||
this.updateDataPanel();
|
||||
this.m_CustomEditor.validate();
|
||||
this.m_CustomEditor.repaint();
|
||||
this.customEditor.validate();
|
||||
this.customEditor.repaint();
|
||||
}
|
||||
}
|
||||
|
||||
@ -122,18 +118,18 @@ public class GenericIntArrayEditor extends JPanel implements PropertyEditor {
|
||||
* This method updates the data panel
|
||||
*/
|
||||
private void updateDataPanel() {
|
||||
int[] tmpD = this.m_IntArray.getIntArray();
|
||||
int[] tmpD = this.intArray.getIntArray();
|
||||
|
||||
this.m_DataPanel.removeAll();
|
||||
this.m_DataPanel.setLayout(new GridLayout(tmpD.length, 2));
|
||||
this.m_InputTextField = new JTextField[tmpD.length];
|
||||
this.dataPanel.removeAll();
|
||||
this.dataPanel.setLayout(new GridLayout(tmpD.length, 2));
|
||||
this.inputTextField = new JTextField[tmpD.length];
|
||||
for (int i = 0; i < tmpD.length; i++) {
|
||||
JLabel label = new JLabel("Value X" + i + ": ");
|
||||
this.m_DataPanel.add(label);
|
||||
this.m_InputTextField[i] = new JTextField();
|
||||
this.m_InputTextField[i].setText("" + tmpD[i]);
|
||||
this.m_InputTextField[i].addKeyListener(this.readIntArrayAction);
|
||||
this.m_DataPanel.add(this.m_InputTextField[i]);
|
||||
this.dataPanel.add(label);
|
||||
this.inputTextField[i] = new JTextField();
|
||||
this.inputTextField[i].setText("" + tmpD[i]);
|
||||
this.inputTextField[i].addKeyListener(this.readIntArrayAction);
|
||||
this.dataPanel.add(this.inputTextField[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -146,7 +142,7 @@ public class GenericIntArrayEditor extends JPanel implements PropertyEditor {
|
||||
@Override
|
||||
public void setValue(Object o) {
|
||||
if (o instanceof PropertyIntArray) {
|
||||
this.m_IntArray = (PropertyIntArray) o;
|
||||
this.intArray = (PropertyIntArray) o;
|
||||
this.updateEditor();
|
||||
}
|
||||
}
|
||||
@ -158,7 +154,7 @@ public class GenericIntArrayEditor extends JPanel implements PropertyEditor {
|
||||
*/
|
||||
@Override
|
||||
public Object getValue() {
|
||||
return this.m_IntArray;
|
||||
return this.intArray;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -192,18 +188,18 @@ public class GenericIntArrayEditor extends JPanel implements PropertyEditor {
|
||||
|
||||
@Override
|
||||
public void addPropertyChangeListener(PropertyChangeListener l) {
|
||||
if (m_Support == null) {
|
||||
m_Support = new PropertyChangeSupport(this);
|
||||
if (propertyChangeSupport == null) {
|
||||
propertyChangeSupport = new PropertyChangeSupport(this);
|
||||
}
|
||||
m_Support.addPropertyChangeListener(l);
|
||||
propertyChangeSupport.addPropertyChangeListener(l);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removePropertyChangeListener(PropertyChangeListener l) {
|
||||
if (m_Support == null) {
|
||||
m_Support = new PropertyChangeSupport(this);
|
||||
if (propertyChangeSupport == null) {
|
||||
propertyChangeSupport = new PropertyChangeSupport(this);
|
||||
}
|
||||
m_Support.removePropertyChangeListener(l);
|
||||
propertyChangeSupport.removePropertyChangeListener(l);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -212,7 +208,7 @@ public class GenericIntArrayEditor extends JPanel implements PropertyEditor {
|
||||
* @param a The action listener.
|
||||
*/
|
||||
public void addOkListener(ActionListener a) {
|
||||
m_OKButton.addActionListener(a);
|
||||
okButton.addActionListener(a);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -221,7 +217,7 @@ public class GenericIntArrayEditor extends JPanel implements PropertyEditor {
|
||||
* @param a The action listener
|
||||
*/
|
||||
public void removeOkListener(ActionListener a) {
|
||||
m_OKButton.removeActionListener(a);
|
||||
okButton.removeActionListener(a);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -265,9 +261,9 @@ public class GenericIntArrayEditor extends JPanel implements PropertyEditor {
|
||||
*/
|
||||
@Override
|
||||
public Component getCustomEditor() {
|
||||
if (this.m_CustomEditor == null) {
|
||||
if (this.customEditor == null) {
|
||||
this.initCustomEditor();
|
||||
}
|
||||
return m_CustomEditor;
|
||||
return customEditor;
|
||||
}
|
||||
}
|
@ -17,8 +17,8 @@ import java.util.logging.Logger;
|
||||
public class GenericObjectEditor implements PropertyEditor {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(GenericObjectEditor.class.getName());
|
||||
private Object m_Object;
|
||||
private Object m_Backup;
|
||||
private Object object;
|
||||
private Object backupObject;
|
||||
private PropertyChangeSupport propertyChangeSupport = new PropertyChangeSupport(this);
|
||||
private Class<?> classType;
|
||||
private OptimizationEditorPanel editorComponent;
|
||||
@ -322,13 +322,13 @@ public class GenericObjectEditor implements PropertyEditor {
|
||||
// This should really call equals() for comparison.
|
||||
boolean trueChange = (c != getValue());
|
||||
|
||||
m_Backup = m_Object;
|
||||
m_Object = c;
|
||||
backupObject = object;
|
||||
object = c;
|
||||
|
||||
if (editorComponent != null) {
|
||||
editorComponent.updateChildPropertySheet();
|
||||
if (trueChange) {
|
||||
propertyChangeSupport.firePropertyChange("", m_Backup, m_Object);
|
||||
propertyChangeSupport.firePropertyChange("", backupObject, object);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -340,7 +340,7 @@ public class GenericObjectEditor implements PropertyEditor {
|
||||
*/
|
||||
@Override
|
||||
public Object getValue() {
|
||||
return m_Object;
|
||||
return object;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -352,7 +352,7 @@ public class GenericObjectEditor implements PropertyEditor {
|
||||
*/
|
||||
@Override
|
||||
public String getJavaInitializationString() {
|
||||
return "new " + m_Object.getClass().getName() + "()";
|
||||
return "new " + object.getClass().getName() + "()";
|
||||
}
|
||||
|
||||
/**
|
||||
@ -373,12 +373,12 @@ public class GenericObjectEditor implements PropertyEditor {
|
||||
*/
|
||||
@Override
|
||||
public void paintValue(Graphics gfx, Rectangle box) {
|
||||
if (isEnabled && m_Object != null) {
|
||||
if (isEnabled && object != null) {
|
||||
int getNameMethod = -1;
|
||||
MethodDescriptor[] methods;
|
||||
String rep = "";
|
||||
try {
|
||||
BeanInfo beanInfo = Introspector.getBeanInfo(m_Object.getClass());
|
||||
BeanInfo beanInfo = Introspector.getBeanInfo(object.getClass());
|
||||
methods = beanInfo.getMethodDescriptors();
|
||||
for (int i = 0; i < methods.length; i++) {
|
||||
if (methods[i].getName().equalsIgnoreCase("getName")) {
|
||||
@ -391,13 +391,13 @@ public class GenericObjectEditor implements PropertyEditor {
|
||||
}
|
||||
if (getNameMethod >= 0) {
|
||||
try {
|
||||
rep = (String) methods[getNameMethod].getMethod().invoke(m_Object, (Object[]) null);
|
||||
rep = (String) methods[getNameMethod].getMethod().invoke(object, (Object[]) null);
|
||||
} catch (java.lang.IllegalAccessException e1) {
|
||||
} catch (java.lang.reflect.InvocationTargetException e2) {
|
||||
}
|
||||
}
|
||||
if (rep.length() <= 0) {
|
||||
rep = m_Object.getClass().getName();
|
||||
rep = object.getClass().getName();
|
||||
int dotPos = rep.lastIndexOf('.');
|
||||
if (dotPos != -1) {
|
||||
rep = rep.substring(dotPos + 1);
|
||||
@ -458,7 +458,7 @@ public class GenericObjectEditor implements PropertyEditor {
|
||||
@Override
|
||||
public Component getCustomEditor() {
|
||||
if (editorComponent == null) {
|
||||
editorComponent = new OptimizationEditorPanel(m_Object, m_Backup, propertyChangeSupport, this);
|
||||
editorComponent = new OptimizationEditorPanel(object, backupObject, propertyChangeSupport, this);
|
||||
}
|
||||
return editorComponent;
|
||||
}
|
||||
@ -468,7 +468,7 @@ public class GenericObjectEditor implements PropertyEditor {
|
||||
*/
|
||||
public void disableOKCancel() {
|
||||
if (editorComponent == null) {
|
||||
editorComponent = new OptimizationEditorPanel(m_Object, m_Backup,
|
||||
editorComponent = new OptimizationEditorPanel(object, backupObject,
|
||||
propertyChangeSupport, this);
|
||||
}
|
||||
editorComponent.setEnabledOkCancelButtons(false);
|
||||
|
@ -29,9 +29,9 @@ public class GenericObjectListSelectionEditor extends AbstractListSelectionEdito
|
||||
@Override
|
||||
protected boolean actionOnSelect() {
|
||||
boolean changed = false;
|
||||
for (int i = 0; i < this.m_BlackCheck.length; i++) {
|
||||
if (objList.isSelected(i) != this.m_BlackCheck[i].isSelected()) {
|
||||
objList.setSelectionForElement(i, this.m_BlackCheck[i].isSelected());
|
||||
for (int i = 0; i < this.blackCheck.length; i++) {
|
||||
if (objList.isSelected(i) != this.blackCheck[i].isSelected()) {
|
||||
objList.setSelectionForElement(i, this.blackCheck[i].isSelected());
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
|
@ -20,40 +20,36 @@ import java.beans.PropertyEditor;
|
||||
|
||||
|
||||
/**
|
||||
* Created by IntelliJ IDEA.
|
||||
* User: streiche
|
||||
* Date: 14.01.2005
|
||||
* Time: 17:32:47
|
||||
* To change this template use File | Settings | File Templates.
|
||||
*
|
||||
*/
|
||||
public class GenericOptimizationObjectivesEditor extends JPanel implements PropertyEditor, java.beans.PropertyChangeListener {
|
||||
|
||||
/**
|
||||
* Handles property change notification
|
||||
*/
|
||||
private PropertyChangeSupport m_Support = new PropertyChangeSupport(this);
|
||||
private PropertyChangeSupport propertyChangeSupport = new PropertyChangeSupport(this);
|
||||
/**
|
||||
* The label for when we can't edit that type
|
||||
*/
|
||||
private JLabel m_Label = new JLabel("Can't edit", SwingConstants.CENTER);
|
||||
private JLabel label = new JLabel("Can't edit", SwingConstants.CENTER);
|
||||
/**
|
||||
* The FilePath that is to be edited
|
||||
* The filePath that is to be edited
|
||||
*/
|
||||
private PropertyOptimizationObjectives m_OptimizationObjectives;
|
||||
private PropertyOptimizationObjectives optimizationObjectives;
|
||||
|
||||
/**
|
||||
* The gaphix stuff
|
||||
*/
|
||||
private JComponent m_Editor;
|
||||
private JPanel m_TargetList;
|
||||
private JComponent[] m_Targets;
|
||||
private JButton[] m_Delete;
|
||||
private JScrollPane m_ScrollTargets;
|
||||
private GeneralOptimizationEditorProperty[] m_Editors;
|
||||
private PropertyChangeListener m_self;
|
||||
private JComponent editor;
|
||||
private JPanel targetList;
|
||||
private JComponent[] targets;
|
||||
private JButton[] deleteButton;
|
||||
private JScrollPane scrollTargets;
|
||||
private GeneralOptimizationEditorProperty[] editors;
|
||||
private PropertyChangeListener self;
|
||||
|
||||
public GenericOptimizationObjectivesEditor() {
|
||||
m_self = this;
|
||||
self = this;
|
||||
|
||||
}
|
||||
|
||||
@ -61,47 +57,47 @@ public class GenericOptimizationObjectivesEditor extends JPanel implements Prope
|
||||
* This method will init the CustomEditor Panel
|
||||
*/
|
||||
private void initCustomEditor() {
|
||||
m_self = this;
|
||||
this.m_Editor = new JPanel();
|
||||
this.m_Editor.setPreferredSize(new Dimension(400, 200));
|
||||
this.m_Editor.setMinimumSize(new Dimension(400, 200));
|
||||
self = this;
|
||||
this.editor = new JPanel();
|
||||
this.editor.setPreferredSize(new Dimension(400, 200));
|
||||
this.editor.setMinimumSize(new Dimension(400, 200));
|
||||
|
||||
// init the editors
|
||||
InterfaceOptimizationObjective[] list = this.m_OptimizationObjectives.getSelectedTargets();
|
||||
this.m_Editors = new GeneralOptimizationEditorProperty[list.length];
|
||||
InterfaceOptimizationObjective[] list = this.optimizationObjectives.getSelectedTargets();
|
||||
this.editors = new GeneralOptimizationEditorProperty[list.length];
|
||||
for (int i = 0; i < list.length; i++) {
|
||||
this.m_Editors[i] = new GeneralOptimizationEditorProperty();
|
||||
this.m_Editors[i].name = list[i].getName();
|
||||
this.editors[i] = new GeneralOptimizationEditorProperty();
|
||||
this.editors[i].name = list[i].getName();
|
||||
try {
|
||||
this.m_Editors[i].value = list[i];
|
||||
this.m_Editors[i].editor = PropertyEditorProvider.findEditor(this.m_Editors[i].value.getClass());
|
||||
if (this.m_Editors[i].editor == null) {
|
||||
this.m_Editors[i].editor = PropertyEditorProvider.findEditor(InterfaceOptimizationObjective.class);
|
||||
this.editors[i].value = list[i];
|
||||
this.editors[i].editor = PropertyEditorProvider.findEditor(this.editors[i].value.getClass());
|
||||
if (this.editors[i].editor == null) {
|
||||
this.editors[i].editor = PropertyEditorProvider.findEditor(InterfaceOptimizationObjective.class);
|
||||
}
|
||||
if (this.m_Editors[i].editor instanceof GenericObjectEditor) {
|
||||
((GenericObjectEditor) this.m_Editors[i].editor).setClassType(InterfaceOptimizationTarget.class);
|
||||
if (this.editors[i].editor instanceof GenericObjectEditor) {
|
||||
((GenericObjectEditor) this.editors[i].editor).setClassType(InterfaceOptimizationTarget.class);
|
||||
}
|
||||
this.m_Editors[i].editor.setValue(this.m_Editors[i].value);
|
||||
this.m_Editors[i].editor.addPropertyChangeListener(this);
|
||||
AbstractObjectEditor.findViewFor(this.m_Editors[i]);
|
||||
if (this.m_Editors[i].view != null) {
|
||||
this.m_Editors[i].view.repaint();
|
||||
this.editors[i].editor.setValue(this.editors[i].value);
|
||||
this.editors[i].editor.addPropertyChangeListener(this);
|
||||
AbstractObjectEditor.findViewFor(this.editors[i]);
|
||||
if (this.editors[i].view != null) {
|
||||
this.editors[i].view.repaint();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
System.out.println("Darn can't read the value...");
|
||||
}
|
||||
}
|
||||
this.m_TargetList = new JPanel();
|
||||
this.targetList = new JPanel();
|
||||
this.updateTargetList();
|
||||
this.m_ScrollTargets = new JScrollPane(this.m_TargetList);
|
||||
this.scrollTargets = new JScrollPane(this.targetList);
|
||||
|
||||
this.m_Editor.setLayout(new BorderLayout());
|
||||
this.m_Editor.add(this.m_ScrollTargets, BorderLayout.CENTER);
|
||||
this.editor.setLayout(new BorderLayout());
|
||||
this.editor.add(this.scrollTargets, BorderLayout.CENTER);
|
||||
|
||||
// the add button
|
||||
JButton addButton = new JButton("Add Opt. Target");
|
||||
addButton.addActionListener(addTarget);
|
||||
this.m_Editor.add(addButton, BorderLayout.SOUTH);
|
||||
this.editor.add(addButton, BorderLayout.SOUTH);
|
||||
|
||||
// Some description would be nice
|
||||
JTextArea jt = new JTextArea();
|
||||
@ -125,7 +121,7 @@ public class GenericOptimizationObjectivesEditor extends JPanel implements Prope
|
||||
p2.add(help, BorderLayout.NORTH);
|
||||
jp.add(p2, BorderLayout.EAST);
|
||||
GridBagConstraints gbConstraints = new GridBagConstraints();
|
||||
this.m_Editor.add(jp, BorderLayout.NORTH);
|
||||
this.editor.add(jp, BorderLayout.NORTH);
|
||||
|
||||
this.updateEditor();
|
||||
}
|
||||
@ -136,13 +132,13 @@ public class GenericOptimizationObjectivesEditor extends JPanel implements Prope
|
||||
private void updateTargetList() {
|
||||
BasicResourceLoader loader = BasicResourceLoader.instance();
|
||||
byte[] bytes;
|
||||
InterfaceOptimizationObjective[] list = this.m_OptimizationObjectives.getSelectedTargets();
|
||||
InterfaceOptimizationObjective[] list = this.optimizationObjectives.getSelectedTargets();
|
||||
|
||||
this.m_TargetList.removeAll();
|
||||
this.m_TargetList.setLayout(new GridBagLayout());
|
||||
this.targetList.removeAll();
|
||||
this.targetList.setLayout(new GridBagLayout());
|
||||
GridBagConstraints gbc = new GridBagConstraints();
|
||||
this.m_Targets = new JComponent[list.length];
|
||||
this.m_Delete = new JButton[list.length];
|
||||
this.targets = new JComponent[list.length];
|
||||
this.deleteButton = new JButton[list.length];
|
||||
String[] cups = new String[8];
|
||||
for (int i = 0; i < cups.length; i++) {
|
||||
cups[i] = "" + (i + 1);
|
||||
@ -152,41 +148,41 @@ public class GenericOptimizationObjectivesEditor extends JPanel implements Prope
|
||||
gbc.fill = GridBagConstraints.BOTH;
|
||||
gbc.gridx = 0;
|
||||
gbc.weightx = 10;
|
||||
this.m_TargetList.add(new JLabel("Target"), gbc);
|
||||
this.targetList.add(new JLabel("Target"), gbc);
|
||||
gbc.anchor = GridBagConstraints.WEST;
|
||||
gbc.fill = GridBagConstraints.REMAINDER;
|
||||
gbc.gridx = 1;
|
||||
gbc.weightx = 1;
|
||||
this.m_TargetList.add(new JLabel("Remove"), gbc);
|
||||
this.targetList.add(new JLabel("Remove"), gbc);
|
||||
for (int i = 0; i < list.length; i++) {
|
||||
// the status indicator
|
||||
gbc.anchor = GridBagConstraints.WEST;
|
||||
gbc.fill = GridBagConstraints.BOTH;
|
||||
gbc.gridx = 0;
|
||||
gbc.weightx = 10;
|
||||
// this.m_Targets[i] = new JButton(""+list[i].getName());
|
||||
// this.m_Targets[i].setEnabled(false);
|
||||
this.m_Targets[i] = this.m_Editors[i].view;
|
||||
this.m_TargetList.add(this.m_Targets[i], gbc);
|
||||
// this.targets[i] = new JButton(""+list[i].getName());
|
||||
// this.targets[i].setEnabled(false);
|
||||
this.targets[i] = this.editors[i].view;
|
||||
this.targetList.add(this.targets[i], gbc);
|
||||
// The delete button
|
||||
gbc.anchor = GridBagConstraints.WEST;
|
||||
gbc.fill = GridBagConstraints.REMAINDER;
|
||||
gbc.gridx = 1;
|
||||
gbc.weightx = 1;
|
||||
bytes = loader.getBytesFromResourceLocation("images/Sub24.gif", true);
|
||||
this.m_Delete[i] = new JButton("", new ImageIcon(Toolkit.getDefaultToolkit().createImage(bytes)));
|
||||
this.m_Delete[i].addActionListener(deleteTarget);
|
||||
this.m_TargetList.add(this.m_Delete[i], gbc);
|
||||
this.deleteButton[i] = new JButton("", new ImageIcon(Toolkit.getDefaultToolkit().createImage(bytes)));
|
||||
this.deleteButton[i].addActionListener(deleteTarget);
|
||||
this.targetList.add(this.deleteButton[i], gbc);
|
||||
}
|
||||
this.m_TargetList.repaint();
|
||||
this.m_TargetList.validate();
|
||||
if (this.m_ScrollTargets != null) {
|
||||
this.m_ScrollTargets.validate();
|
||||
this.m_ScrollTargets.repaint();
|
||||
this.targetList.repaint();
|
||||
this.targetList.validate();
|
||||
if (this.scrollTargets != null) {
|
||||
this.scrollTargets.validate();
|
||||
this.scrollTargets.repaint();
|
||||
}
|
||||
if (this.m_Editor != null) {
|
||||
this.m_Editor.validate();
|
||||
this.m_Editor.repaint();
|
||||
if (this.editor != null) {
|
||||
this.editor.validate();
|
||||
this.editor.repaint();
|
||||
}
|
||||
}
|
||||
|
||||
@ -206,13 +202,13 @@ public class GenericOptimizationObjectivesEditor extends JPanel implements Prope
|
||||
ActionListener addTarget = new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent event) {
|
||||
m_OptimizationObjectives.addTarget((InterfaceOptimizationObjective) m_OptimizationObjectives.getAvailableTargets()[0].clone());
|
||||
int l = m_OptimizationObjectives.getSelectedTargets().length;
|
||||
optimizationObjectives.addTarget((InterfaceOptimizationObjective) optimizationObjectives.getAvailableTargets()[0].clone());
|
||||
int l = optimizationObjectives.getSelectedTargets().length;
|
||||
GeneralOptimizationEditorProperty[] newEdit = new GeneralOptimizationEditorProperty[l];
|
||||
for (int i = 0; i < m_Editors.length; i++) {
|
||||
newEdit[i] = m_Editors[i];
|
||||
for (int i = 0; i < editors.length; i++) {
|
||||
newEdit[i] = editors[i];
|
||||
}
|
||||
InterfaceOptimizationObjective[] list = m_OptimizationObjectives.getSelectedTargets();
|
||||
InterfaceOptimizationObjective[] list = optimizationObjectives.getSelectedTargets();
|
||||
l--;
|
||||
newEdit[l] = new GeneralOptimizationEditorProperty();
|
||||
newEdit[l].name = list[l].getName();
|
||||
@ -226,7 +222,7 @@ public class GenericOptimizationObjectivesEditor extends JPanel implements Prope
|
||||
((GenericObjectEditor) newEdit[l].editor).setClassType(InterfaceOptimizationTarget.class);
|
||||
}
|
||||
newEdit[l].editor.setValue(newEdit[l].value);
|
||||
newEdit[l].editor.addPropertyChangeListener(m_self);
|
||||
newEdit[l].editor.addPropertyChangeListener(self);
|
||||
AbstractObjectEditor.findViewFor(newEdit[l]);
|
||||
if (newEdit[l].view != null) {
|
||||
newEdit[l].view.repaint();
|
||||
@ -234,7 +230,7 @@ public class GenericOptimizationObjectivesEditor extends JPanel implements Prope
|
||||
} catch (Exception e) {
|
||||
System.out.println("Darn can't read the value...");
|
||||
}
|
||||
m_Editors = newEdit;
|
||||
editors = newEdit;
|
||||
updateTargetList();
|
||||
}
|
||||
};
|
||||
@ -245,17 +241,17 @@ public class GenericOptimizationObjectivesEditor extends JPanel implements Prope
|
||||
ActionListener deleteTarget = new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent event) {
|
||||
int l = m_OptimizationObjectives.getSelectedTargets().length, j = 0;
|
||||
int l = optimizationObjectives.getSelectedTargets().length, j = 0;
|
||||
GeneralOptimizationEditorProperty[] newEdit = new GeneralOptimizationEditorProperty[l - 1];
|
||||
for (int i = 0; i < m_Delete.length; i++) {
|
||||
if (event.getSource().equals(m_Delete[i])) {
|
||||
m_OptimizationObjectives.removeTarget(i);
|
||||
for (int i = 0; i < deleteButton.length; i++) {
|
||||
if (event.getSource().equals(deleteButton[i])) {
|
||||
optimizationObjectives.removeTarget(i);
|
||||
} else {
|
||||
newEdit[j] = m_Editors[i];
|
||||
newEdit[j] = editors[i];
|
||||
j++;
|
||||
}
|
||||
}
|
||||
m_Editors = newEdit;
|
||||
editors = newEdit;
|
||||
updateTargetList();
|
||||
}
|
||||
};
|
||||
@ -264,13 +260,13 @@ public class GenericOptimizationObjectivesEditor extends JPanel implements Prope
|
||||
* The object may have changed update the editor.
|
||||
*/
|
||||
private void updateEditor() {
|
||||
if (this.m_Editor != null) {
|
||||
this.m_TargetList.validate();
|
||||
this.m_TargetList.repaint();
|
||||
this.m_ScrollTargets.validate();
|
||||
this.m_ScrollTargets.repaint();
|
||||
this.m_Editor.validate();
|
||||
this.m_Editor.repaint();
|
||||
if (this.editor != null) {
|
||||
this.targetList.validate();
|
||||
this.targetList.repaint();
|
||||
this.scrollTargets.validate();
|
||||
this.scrollTargets.repaint();
|
||||
this.editor.validate();
|
||||
this.editor.repaint();
|
||||
}
|
||||
}
|
||||
|
||||
@ -283,7 +279,7 @@ public class GenericOptimizationObjectivesEditor extends JPanel implements Prope
|
||||
@Override
|
||||
public void setValue(Object o) {
|
||||
if (o instanceof PropertyOptimizationObjectives) {
|
||||
this.m_OptimizationObjectives = (PropertyOptimizationObjectives) o;
|
||||
this.optimizationObjectives = (PropertyOptimizationObjectives) o;
|
||||
this.updateEditor();
|
||||
}
|
||||
}
|
||||
@ -295,7 +291,7 @@ public class GenericOptimizationObjectivesEditor extends JPanel implements Prope
|
||||
*/
|
||||
@Override
|
||||
public Object getValue() {
|
||||
return this.m_OptimizationObjectives;
|
||||
return this.optimizationObjectives;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -386,10 +382,10 @@ public class GenericOptimizationObjectivesEditor extends JPanel implements Prope
|
||||
*/
|
||||
@Override
|
||||
public Component getCustomEditor() {
|
||||
if (this.m_Editor == null) {
|
||||
if (this.editor == null) {
|
||||
this.initCustomEditor();
|
||||
}
|
||||
return m_Editor;
|
||||
return editor;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -407,18 +403,18 @@ public class GenericOptimizationObjectivesEditor extends JPanel implements Prope
|
||||
|
||||
@Override
|
||||
public void addPropertyChangeListener(PropertyChangeListener l) {
|
||||
if (m_Support == null) {
|
||||
m_Support = new PropertyChangeSupport(this);
|
||||
if (propertyChangeSupport == null) {
|
||||
propertyChangeSupport = new PropertyChangeSupport(this);
|
||||
}
|
||||
m_Support.addPropertyChangeListener(l);
|
||||
propertyChangeSupport.addPropertyChangeListener(l);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removePropertyChangeListener(PropertyChangeListener l) {
|
||||
if (m_Support == null) {
|
||||
m_Support = new PropertyChangeSupport(this);
|
||||
if (propertyChangeSupport == null) {
|
||||
propertyChangeSupport = new PropertyChangeSupport(this);
|
||||
}
|
||||
m_Support.removePropertyChangeListener(l);
|
||||
propertyChangeSupport.removePropertyChangeListener(l);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -431,34 +427,34 @@ public class GenericOptimizationObjectivesEditor extends JPanel implements Prope
|
||||
public void propertyChange(PropertyChangeEvent evt) {
|
||||
Object newVal = evt.getNewValue();
|
||||
Object oldVal = evt.getOldValue();
|
||||
InterfaceOptimizationObjective[] list = this.m_OptimizationObjectives.getSelectedTargets();
|
||||
InterfaceOptimizationObjective[] list = this.optimizationObjectives.getSelectedTargets();
|
||||
for (int i = 0; i < list.length; i++) {
|
||||
if (oldVal.equals(list[i])) {
|
||||
list[i] = (InterfaceOptimizationObjective) newVal;
|
||||
this.m_Editors[i].name = list[i].getName();
|
||||
this.editors[i].name = list[i].getName();
|
||||
try {
|
||||
this.m_Editors[i].value = list[i];
|
||||
this.m_Editors[i].editor = PropertyEditorProvider.findEditor(this.m_Editors[i].value.getClass());
|
||||
if (this.m_Editors[i].editor == null) {
|
||||
this.m_Editors[i].editor = PropertyEditorProvider.findEditor(InterfaceOptimizationObjective.class);
|
||||
this.editors[i].value = list[i];
|
||||
this.editors[i].editor = PropertyEditorProvider.findEditor(this.editors[i].value.getClass());
|
||||
if (this.editors[i].editor == null) {
|
||||
this.editors[i].editor = PropertyEditorProvider.findEditor(InterfaceOptimizationObjective.class);
|
||||
}
|
||||
if (this.m_Editors[i].editor instanceof GenericObjectEditor) {
|
||||
((GenericObjectEditor) this.m_Editors[i].editor).setClassType(InterfaceOptimizationTarget.class);
|
||||
if (this.editors[i].editor instanceof GenericObjectEditor) {
|
||||
((GenericObjectEditor) this.editors[i].editor).setClassType(InterfaceOptimizationTarget.class);
|
||||
}
|
||||
this.m_Editors[i].editor.setValue(this.m_Editors[i].value);
|
||||
this.m_Editors[i].editor.addPropertyChangeListener(this);
|
||||
AbstractObjectEditor.findViewFor(this.m_Editors[i]);
|
||||
if (this.m_Editors[i].view != null) {
|
||||
this.m_Editors[i].view.repaint();
|
||||
this.editors[i].editor.setValue(this.editors[i].value);
|
||||
this.editors[i].editor.addPropertyChangeListener(this);
|
||||
AbstractObjectEditor.findViewFor(this.editors[i]);
|
||||
if (this.editors[i].view != null) {
|
||||
this.editors[i].view.repaint();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
System.out.println("Darn can't read the value...");
|
||||
}
|
||||
this.m_Targets[i] = this.m_Editors[i].view;
|
||||
this.targets[i] = this.editors[i].view;
|
||||
}
|
||||
}
|
||||
//this.m_OptimizationTargets.setSelectedTargets(list);
|
||||
this.updateCenterComponent(evt); // Let our panel update before guys downstream
|
||||
m_Support.firePropertyChange("", m_OptimizationObjectives, m_OptimizationObjectives);
|
||||
propertyChangeSupport.firePropertyChange("", optimizationObjectives, optimizationObjectives);
|
||||
}
|
||||
}
|
@ -21,96 +21,92 @@ import java.beans.PropertyEditor;
|
||||
|
||||
|
||||
/**
|
||||
* Created by IntelliJ IDEA.
|
||||
* User: streiche
|
||||
* Date: 18.01.2005
|
||||
* Time: 13:46:20
|
||||
* To change this template use File | Settings | File Templates.
|
||||
*
|
||||
*/
|
||||
public class GenericOptimizationObjectivesWithParamEditor extends JPanel implements PropertyEditor, java.beans.PropertyChangeListener {
|
||||
|
||||
/**
|
||||
* Handles property change notification
|
||||
*/
|
||||
private PropertyChangeSupport m_Support = new PropertyChangeSupport(this);
|
||||
private PropertyChangeSupport propertyChangeSupport = new PropertyChangeSupport(this);
|
||||
/**
|
||||
* The label for when we can't edit that type
|
||||
*/
|
||||
private JLabel m_Label = new JLabel("Can't edit", SwingConstants.CENTER);
|
||||
private JLabel label = new JLabel("Can't edit", SwingConstants.CENTER);
|
||||
/**
|
||||
* The FilePath that is to be edited
|
||||
* The filePath that is to be edited
|
||||
*/
|
||||
private PropertyOptimizationObjectivesWithParam m_OptimizationObjectivesWithWeights;
|
||||
private PropertyOptimizationObjectivesWithParam optimizationObjectivesWithWeights;
|
||||
|
||||
/**
|
||||
* The gaphix stuff
|
||||
*/
|
||||
private JComponent m_Editor;
|
||||
private JPanel m_TargetList;
|
||||
private JTextField[] m_Weights;
|
||||
private JComponent[] m_Targets;
|
||||
private JButton[] m_Delete;
|
||||
private JScrollPane m_ScrollTargets;
|
||||
private GeneralOptimizationEditorProperty[] m_Editors;
|
||||
private PropertyChangeListener m_self;
|
||||
private JComponent editor;
|
||||
private JPanel targetList;
|
||||
private JTextField[] weights;
|
||||
private JComponent[] targets;
|
||||
private JButton[] deleteButton;
|
||||
private JScrollPane scrollTargets;
|
||||
private GeneralOptimizationEditorProperty[] editors;
|
||||
private PropertyChangeListener self;
|
||||
|
||||
public GenericOptimizationObjectivesWithParamEditor() {
|
||||
m_self = this;
|
||||
self = this;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method will init the CustomEditor Panel
|
||||
*/
|
||||
private void initCustomEditor() {
|
||||
m_self = this;
|
||||
this.m_Editor = new JPanel();
|
||||
this.m_Editor.setPreferredSize(new Dimension(450, 200));
|
||||
this.m_Editor.setMinimumSize(new Dimension(450, 200));
|
||||
self = this;
|
||||
this.editor = new JPanel();
|
||||
this.editor.setPreferredSize(new Dimension(450, 200));
|
||||
this.editor.setMinimumSize(new Dimension(450, 200));
|
||||
|
||||
// init the editors
|
||||
InterfaceOptimizationObjective[] list = this.m_OptimizationObjectivesWithWeights.getSelectedTargets();
|
||||
this.m_Editors = new GeneralOptimizationEditorProperty[list.length];
|
||||
InterfaceOptimizationObjective[] list = this.optimizationObjectivesWithWeights.getSelectedTargets();
|
||||
this.editors = new GeneralOptimizationEditorProperty[list.length];
|
||||
for (int i = 0; i < list.length; i++) {
|
||||
this.m_Editors[i] = new GeneralOptimizationEditorProperty();
|
||||
this.m_Editors[i].name = list[i].getName();
|
||||
this.editors[i] = new GeneralOptimizationEditorProperty();
|
||||
this.editors[i].name = list[i].getName();
|
||||
try {
|
||||
this.m_Editors[i].value = list[i];
|
||||
this.m_Editors[i].editor = PropertyEditorProvider.findEditor(this.m_Editors[i].value.getClass());
|
||||
if (this.m_Editors[i].editor == null) {
|
||||
this.m_Editors[i].editor = PropertyEditorProvider.findEditor(InterfaceOptimizationObjective.class);
|
||||
this.editors[i].value = list[i];
|
||||
this.editors[i].editor = PropertyEditorProvider.findEditor(this.editors[i].value.getClass());
|
||||
if (this.editors[i].editor == null) {
|
||||
this.editors[i].editor = PropertyEditorProvider.findEditor(InterfaceOptimizationObjective.class);
|
||||
}
|
||||
if (this.m_Editors[i].editor instanceof GenericObjectEditor) {
|
||||
((GenericObjectEditor) this.m_Editors[i].editor).setClassType(InterfaceOptimizationObjective.class);
|
||||
if (this.editors[i].editor instanceof GenericObjectEditor) {
|
||||
((GenericObjectEditor) this.editors[i].editor).setClassType(InterfaceOptimizationObjective.class);
|
||||
}
|
||||
this.m_Editors[i].editor.setValue(this.m_Editors[i].value);
|
||||
this.m_Editors[i].editor.addPropertyChangeListener(this);
|
||||
AbstractObjectEditor.findViewFor(this.m_Editors[i]);
|
||||
if (this.m_Editors[i].view != null) {
|
||||
this.m_Editors[i].view.repaint();
|
||||
this.editors[i].editor.setValue(this.editors[i].value);
|
||||
this.editors[i].editor.addPropertyChangeListener(this);
|
||||
AbstractObjectEditor.findViewFor(this.editors[i]);
|
||||
if (this.editors[i].view != null) {
|
||||
this.editors[i].view.repaint();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
System.out.println("Darn can't read the value...");
|
||||
}
|
||||
}
|
||||
this.m_TargetList = new JPanel();
|
||||
this.targetList = new JPanel();
|
||||
this.updateTargetList();
|
||||
this.m_ScrollTargets = new JScrollPane(this.m_TargetList);
|
||||
this.scrollTargets = new JScrollPane(this.targetList);
|
||||
|
||||
this.m_Editor.setLayout(new BorderLayout());
|
||||
this.m_Editor.add(this.m_ScrollTargets, BorderLayout.CENTER);
|
||||
this.editor.setLayout(new BorderLayout());
|
||||
this.editor.add(this.scrollTargets, BorderLayout.CENTER);
|
||||
|
||||
// The Button Panel
|
||||
JPanel buttonPanel = new JPanel();
|
||||
buttonPanel.setLayout(new GridLayout(1, 2));
|
||||
JButton addButton = new JButton("Add Opt. Target");
|
||||
JButton normButton = new JButton("Normalize Weights");
|
||||
normButton.setEnabled(this.m_OptimizationObjectivesWithWeights.isNormalizationEnabled());
|
||||
normButton.setEnabled(this.optimizationObjectivesWithWeights.isNormalizationEnabled());
|
||||
normButton.addActionListener(normalizeWeights);
|
||||
addButton.addActionListener(addTarget);
|
||||
buttonPanel.add(normButton);
|
||||
buttonPanel.add(addButton);
|
||||
|
||||
this.m_Editor.add(buttonPanel, BorderLayout.SOUTH);
|
||||
this.editor.add(buttonPanel, BorderLayout.SOUTH);
|
||||
|
||||
// Some description would be nice
|
||||
JTextArea jt = new JTextArea();
|
||||
@ -118,7 +114,7 @@ public class GenericOptimizationObjectivesWithParamEditor extends JPanel impleme
|
||||
jt.setEditable(false);
|
||||
jt.setLineWrap(true);
|
||||
jt.setWrapStyleWord(true);
|
||||
jt.setText(this.m_OptimizationObjectivesWithWeights.getDescriptiveString());
|
||||
jt.setText(this.optimizationObjectivesWithWeights.getDescriptiveString());
|
||||
jt.setBackground(getBackground());
|
||||
JPanel jp = new JPanel();
|
||||
jp.setBorder(BorderFactory.createCompoundBorder(
|
||||
@ -135,7 +131,7 @@ public class GenericOptimizationObjectivesWithParamEditor extends JPanel impleme
|
||||
jp.add(p2, BorderLayout.EAST);
|
||||
GridBagConstraints gbConstraints = new GridBagConstraints();
|
||||
|
||||
this.m_Editor.add(jp, BorderLayout.NORTH);
|
||||
this.editor.add(jp, BorderLayout.NORTH);
|
||||
|
||||
this.updateEditor();
|
||||
}
|
||||
@ -146,15 +142,15 @@ public class GenericOptimizationObjectivesWithParamEditor extends JPanel impleme
|
||||
private void updateTargetList() {
|
||||
BasicResourceLoader loader = BasicResourceLoader.instance();
|
||||
byte[] bytes;
|
||||
InterfaceOptimizationObjective[] list = this.m_OptimizationObjectivesWithWeights.getSelectedTargets();
|
||||
double[] weights = this.m_OptimizationObjectivesWithWeights.getWeights();
|
||||
InterfaceOptimizationObjective[] list = this.optimizationObjectivesWithWeights.getSelectedTargets();
|
||||
double[] weights = this.optimizationObjectivesWithWeights.getWeights();
|
||||
|
||||
this.m_TargetList.removeAll();
|
||||
this.m_TargetList.setLayout(new GridBagLayout());
|
||||
this.targetList.removeAll();
|
||||
this.targetList.setLayout(new GridBagLayout());
|
||||
GridBagConstraints gbc = new GridBagConstraints();
|
||||
this.m_Weights = new JTextField[list.length];
|
||||
this.m_Targets = new JComponent[list.length];
|
||||
this.m_Delete = new JButton[list.length];
|
||||
this.weights = new JTextField[list.length];
|
||||
this.targets = new JComponent[list.length];
|
||||
this.deleteButton = new JButton[list.length];
|
||||
String[] cups = new String[8];
|
||||
for (int i = 0; i < cups.length; i++) {
|
||||
cups[i] = "" + (i + 1);
|
||||
@ -164,52 +160,52 @@ public class GenericOptimizationObjectivesWithParamEditor extends JPanel impleme
|
||||
gbc.fill = GridBagConstraints.BOTH;
|
||||
gbc.gridx = 0;
|
||||
gbc.weightx = 2;
|
||||
this.m_TargetList.add(new JLabel(this.m_OptimizationObjectivesWithWeights.getWeigthsLabel()), gbc);
|
||||
this.targetList.add(new JLabel(this.optimizationObjectivesWithWeights.getWeigthsLabel()), gbc);
|
||||
gbc.anchor = GridBagConstraints.WEST;
|
||||
gbc.fill = GridBagConstraints.BOTH;
|
||||
gbc.gridx = 1;
|
||||
gbc.weightx = 10;
|
||||
this.m_TargetList.add(new JLabel("Target"), gbc);
|
||||
this.targetList.add(new JLabel("Target"), gbc);
|
||||
gbc.anchor = GridBagConstraints.WEST;
|
||||
gbc.fill = GridBagConstraints.REMAINDER;
|
||||
gbc.gridx = 2;
|
||||
gbc.weightx = 1;
|
||||
this.m_TargetList.add(new JLabel("Remove"), gbc);
|
||||
this.targetList.add(new JLabel("Remove"), gbc);
|
||||
for (int i = 0; i < list.length; i++) {
|
||||
// the weight
|
||||
gbc.anchor = GridBagConstraints.WEST;
|
||||
gbc.fill = GridBagConstraints.BOTH;
|
||||
gbc.gridx = 0;
|
||||
gbc.weightx = 2;
|
||||
this.m_Weights[i] = new JTextField("" + weights[i]);
|
||||
this.m_Weights[i].addKeyListener(this.readDoubleArrayAction);
|
||||
this.m_TargetList.add(this.m_Weights[i], gbc);
|
||||
this.weights[i] = new JTextField("" + weights[i]);
|
||||
this.weights[i].addKeyListener(this.readDoubleArrayAction);
|
||||
this.targetList.add(this.weights[i], gbc);
|
||||
// the status indicator
|
||||
gbc.anchor = GridBagConstraints.WEST;
|
||||
gbc.fill = GridBagConstraints.BOTH;
|
||||
gbc.gridx = 1;
|
||||
gbc.weightx = 10;
|
||||
this.m_Targets[i] = this.m_Editors[i].view;
|
||||
this.m_TargetList.add(this.m_Targets[i], gbc);
|
||||
this.targets[i] = this.editors[i].view;
|
||||
this.targetList.add(this.targets[i], gbc);
|
||||
// The delete button
|
||||
gbc.anchor = GridBagConstraints.WEST;
|
||||
gbc.fill = GridBagConstraints.REMAINDER;
|
||||
gbc.gridx = 2;
|
||||
gbc.weightx = 1;
|
||||
bytes = loader.getBytesFromResourceLocation("images/Sub24.gif", true);
|
||||
this.m_Delete[i] = new JButton("", new ImageIcon(Toolkit.getDefaultToolkit().createImage(bytes)));
|
||||
this.m_Delete[i].addActionListener(deleteTarget);
|
||||
this.m_TargetList.add(this.m_Delete[i], gbc);
|
||||
this.deleteButton[i] = new JButton("", new ImageIcon(Toolkit.getDefaultToolkit().createImage(bytes)));
|
||||
this.deleteButton[i].addActionListener(deleteTarget);
|
||||
this.targetList.add(this.deleteButton[i], gbc);
|
||||
}
|
||||
this.m_TargetList.repaint();
|
||||
this.m_TargetList.validate();
|
||||
if (this.m_ScrollTargets != null) {
|
||||
this.m_ScrollTargets.validate();
|
||||
this.m_ScrollTargets.repaint();
|
||||
this.targetList.repaint();
|
||||
this.targetList.validate();
|
||||
if (this.scrollTargets != null) {
|
||||
this.scrollTargets.validate();
|
||||
this.scrollTargets.repaint();
|
||||
}
|
||||
if (this.m_Editor != null) {
|
||||
this.m_Editor.validate();
|
||||
this.m_Editor.repaint();
|
||||
if (this.editor != null) {
|
||||
this.editor.validate();
|
||||
this.editor.repaint();
|
||||
}
|
||||
}
|
||||
|
||||
@ -229,13 +225,13 @@ public class GenericOptimizationObjectivesWithParamEditor extends JPanel impleme
|
||||
ActionListener addTarget = new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent event) {
|
||||
m_OptimizationObjectivesWithWeights.addTarget((InterfaceOptimizationObjective) m_OptimizationObjectivesWithWeights.getAvailableTargets()[0].clone());
|
||||
int l = m_OptimizationObjectivesWithWeights.getSelectedTargets().length;
|
||||
optimizationObjectivesWithWeights.addTarget((InterfaceOptimizationObjective) optimizationObjectivesWithWeights.getAvailableTargets()[0].clone());
|
||||
int l = optimizationObjectivesWithWeights.getSelectedTargets().length;
|
||||
GeneralOptimizationEditorProperty[] newEdit = new GeneralOptimizationEditorProperty[l];
|
||||
for (int i = 0; i < m_Editors.length; i++) {
|
||||
newEdit[i] = m_Editors[i];
|
||||
for (int i = 0; i < editors.length; i++) {
|
||||
newEdit[i] = editors[i];
|
||||
}
|
||||
InterfaceOptimizationObjective[] list = m_OptimizationObjectivesWithWeights.getSelectedTargets();
|
||||
InterfaceOptimizationObjective[] list = optimizationObjectivesWithWeights.getSelectedTargets();
|
||||
l--;
|
||||
newEdit[l] = new GeneralOptimizationEditorProperty();
|
||||
newEdit[l].name = list[l].getName();
|
||||
@ -249,7 +245,7 @@ public class GenericOptimizationObjectivesWithParamEditor extends JPanel impleme
|
||||
((GenericObjectEditor) newEdit[l].editor).setClassType(InterfaceOptimizationObjective.class);
|
||||
}
|
||||
newEdit[l].editor.setValue(newEdit[l].value);
|
||||
newEdit[l].editor.addPropertyChangeListener(m_self);
|
||||
newEdit[l].editor.addPropertyChangeListener(self);
|
||||
AbstractObjectEditor.findViewFor(newEdit[l]);
|
||||
if (newEdit[l].view != null) {
|
||||
newEdit[l].view.repaint();
|
||||
@ -257,7 +253,7 @@ public class GenericOptimizationObjectivesWithParamEditor extends JPanel impleme
|
||||
} catch (Exception e) {
|
||||
System.out.println("Darn can't read the value...");
|
||||
}
|
||||
m_Editors = newEdit;
|
||||
editors = newEdit;
|
||||
updateTargetList();
|
||||
}
|
||||
};
|
||||
@ -268,17 +264,17 @@ public class GenericOptimizationObjectivesWithParamEditor extends JPanel impleme
|
||||
ActionListener deleteTarget = new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent event) {
|
||||
int l = m_OptimizationObjectivesWithWeights.getSelectedTargets().length, j = 0;
|
||||
int l = optimizationObjectivesWithWeights.getSelectedTargets().length, j = 0;
|
||||
GeneralOptimizationEditorProperty[] newEdit = new GeneralOptimizationEditorProperty[l - 1];
|
||||
for (int i = 0; i < m_Delete.length; i++) {
|
||||
if (event.getSource().equals(m_Delete[i])) {
|
||||
m_OptimizationObjectivesWithWeights.removeTarget(i);
|
||||
for (int i = 0; i < deleteButton.length; i++) {
|
||||
if (event.getSource().equals(deleteButton[i])) {
|
||||
optimizationObjectivesWithWeights.removeTarget(i);
|
||||
} else {
|
||||
newEdit[j] = m_Editors[i];
|
||||
newEdit[j] = editors[i];
|
||||
j++;
|
||||
}
|
||||
}
|
||||
m_Editors = newEdit;
|
||||
editors = newEdit;
|
||||
updateTargetList();
|
||||
}
|
||||
};
|
||||
@ -289,7 +285,7 @@ public class GenericOptimizationObjectivesWithParamEditor extends JPanel impleme
|
||||
ActionListener normalizeWeights = new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent event) {
|
||||
double[] newW = m_OptimizationObjectivesWithWeights.getWeights();
|
||||
double[] newW = optimizationObjectivesWithWeights.getWeights();
|
||||
double sum = 0;
|
||||
for (int i = 0; i < newW.length; i++) {
|
||||
sum += newW[i];
|
||||
@ -298,7 +294,7 @@ public class GenericOptimizationObjectivesWithParamEditor extends JPanel impleme
|
||||
for (int i = 0; i < newW.length; i++) {
|
||||
newW[i] /= sum;
|
||||
}
|
||||
m_OptimizationObjectivesWithWeights.setWeights(newW);
|
||||
optimizationObjectivesWithWeights.setWeights(newW);
|
||||
}
|
||||
updateTargetList();
|
||||
}
|
||||
@ -318,18 +314,18 @@ public class GenericOptimizationObjectivesWithParamEditor extends JPanel impleme
|
||||
|
||||
@Override
|
||||
public void keyReleased(KeyEvent event) {
|
||||
double[] newW = m_OptimizationObjectivesWithWeights.getWeights();
|
||||
double[] newW = optimizationObjectivesWithWeights.getWeights();
|
||||
|
||||
for (int i = 0; i < newW.length; i++) {
|
||||
try {
|
||||
double d = 0;
|
||||
d = new Double(m_Weights[i].getText()).doubleValue();
|
||||
d = new Double(weights[i].getText()).doubleValue();
|
||||
newW[i] = d;
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
|
||||
m_OptimizationObjectivesWithWeights.setWeights(newW);
|
||||
optimizationObjectivesWithWeights.setWeights(newW);
|
||||
}
|
||||
};
|
||||
|
||||
@ -337,13 +333,13 @@ public class GenericOptimizationObjectivesWithParamEditor extends JPanel impleme
|
||||
* The object may have changed update the editor.
|
||||
*/
|
||||
private void updateEditor() {
|
||||
if (this.m_Editor != null) {
|
||||
this.m_TargetList.validate();
|
||||
this.m_TargetList.repaint();
|
||||
this.m_ScrollTargets.validate();
|
||||
this.m_ScrollTargets.repaint();
|
||||
this.m_Editor.validate();
|
||||
this.m_Editor.repaint();
|
||||
if (this.editor != null) {
|
||||
this.targetList.validate();
|
||||
this.targetList.repaint();
|
||||
this.scrollTargets.validate();
|
||||
this.scrollTargets.repaint();
|
||||
this.editor.validate();
|
||||
this.editor.repaint();
|
||||
}
|
||||
}
|
||||
|
||||
@ -355,7 +351,7 @@ public class GenericOptimizationObjectivesWithParamEditor extends JPanel impleme
|
||||
@Override
|
||||
public void setValue(Object o) {
|
||||
if (o instanceof PropertyOptimizationObjectivesWithParam) {
|
||||
this.m_OptimizationObjectivesWithWeights = (PropertyOptimizationObjectivesWithParam) o;
|
||||
this.optimizationObjectivesWithWeights = (PropertyOptimizationObjectivesWithParam) o;
|
||||
this.updateEditor();
|
||||
}
|
||||
}
|
||||
@ -367,7 +363,7 @@ public class GenericOptimizationObjectivesWithParamEditor extends JPanel impleme
|
||||
*/
|
||||
@Override
|
||||
public Object getValue() {
|
||||
return this.m_OptimizationObjectivesWithWeights;
|
||||
return this.optimizationObjectivesWithWeights;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -458,10 +454,10 @@ public class GenericOptimizationObjectivesWithParamEditor extends JPanel impleme
|
||||
*/
|
||||
@Override
|
||||
public Component getCustomEditor() {
|
||||
if (this.m_Editor == null) {
|
||||
if (this.editor == null) {
|
||||
this.initCustomEditor();
|
||||
}
|
||||
return m_Editor;
|
||||
return editor;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -479,18 +475,18 @@ public class GenericOptimizationObjectivesWithParamEditor extends JPanel impleme
|
||||
|
||||
@Override
|
||||
public void addPropertyChangeListener(PropertyChangeListener l) {
|
||||
if (m_Support == null) {
|
||||
m_Support = new PropertyChangeSupport(this);
|
||||
if (propertyChangeSupport == null) {
|
||||
propertyChangeSupport = new PropertyChangeSupport(this);
|
||||
}
|
||||
m_Support.addPropertyChangeListener(l);
|
||||
propertyChangeSupport.addPropertyChangeListener(l);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removePropertyChangeListener(PropertyChangeListener l) {
|
||||
if (m_Support == null) {
|
||||
m_Support = new PropertyChangeSupport(this);
|
||||
if (propertyChangeSupport == null) {
|
||||
propertyChangeSupport = new PropertyChangeSupport(this);
|
||||
}
|
||||
m_Support.removePropertyChangeListener(l);
|
||||
propertyChangeSupport.removePropertyChangeListener(l);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -503,34 +499,34 @@ public class GenericOptimizationObjectivesWithParamEditor extends JPanel impleme
|
||||
public void propertyChange(PropertyChangeEvent evt) {
|
||||
Object newVal = evt.getNewValue();
|
||||
Object oldVal = evt.getOldValue();
|
||||
InterfaceOptimizationObjective[] list = this.m_OptimizationObjectivesWithWeights.getSelectedTargets();
|
||||
InterfaceOptimizationObjective[] list = this.optimizationObjectivesWithWeights.getSelectedTargets();
|
||||
for (int i = 0; i < list.length; i++) {
|
||||
if (oldVal.equals(list[i])) {
|
||||
list[i] = (InterfaceOptimizationObjective) newVal;
|
||||
this.m_Editors[i].name = list[i].getName();
|
||||
this.editors[i].name = list[i].getName();
|
||||
try {
|
||||
this.m_Editors[i].value = list[i];
|
||||
this.m_Editors[i].editor = PropertyEditorProvider.findEditor(this.m_Editors[i].value.getClass());
|
||||
if (this.m_Editors[i].editor == null) {
|
||||
this.m_Editors[i].editor = PropertyEditorProvider.findEditor(InterfaceOptimizationObjective.class);
|
||||
this.editors[i].value = list[i];
|
||||
this.editors[i].editor = PropertyEditorProvider.findEditor(this.editors[i].value.getClass());
|
||||
if (this.editors[i].editor == null) {
|
||||
this.editors[i].editor = PropertyEditorProvider.findEditor(InterfaceOptimizationObjective.class);
|
||||
}
|
||||
if (this.m_Editors[i].editor instanceof GenericObjectEditor) {
|
||||
((GenericObjectEditor) this.m_Editors[i].editor).setClassType(InterfaceOptimizationObjective.class);
|
||||
if (this.editors[i].editor instanceof GenericObjectEditor) {
|
||||
((GenericObjectEditor) this.editors[i].editor).setClassType(InterfaceOptimizationObjective.class);
|
||||
}
|
||||
this.m_Editors[i].editor.setValue(this.m_Editors[i].value);
|
||||
this.m_Editors[i].editor.addPropertyChangeListener(this);
|
||||
AbstractObjectEditor.findViewFor(this.m_Editors[i]);
|
||||
if (this.m_Editors[i].view != null) {
|
||||
this.m_Editors[i].view.repaint();
|
||||
this.editors[i].editor.setValue(this.editors[i].value);
|
||||
this.editors[i].editor.addPropertyChangeListener(this);
|
||||
AbstractObjectEditor.findViewFor(this.editors[i]);
|
||||
if (this.editors[i].view != null) {
|
||||
this.editors[i].view.repaint();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
System.out.println("Darn can't read the value...");
|
||||
}
|
||||
this.m_Targets[i] = this.m_Editors[i].view;
|
||||
this.targets[i] = this.editors[i].view;
|
||||
}
|
||||
}
|
||||
//this.m_OptimizationTargets.setSelectedTargets(list);
|
||||
this.updateCenterComponent(evt); // Let our panel update before guys downstream
|
||||
m_Support.firePropertyChange("", m_OptimizationObjectivesWithWeights, m_OptimizationObjectivesWithWeights);
|
||||
propertyChangeSupport.firePropertyChange("", optimizationObjectivesWithWeights, optimizationObjectivesWithWeights);
|
||||
}
|
||||
}
|
@ -13,34 +13,30 @@ import java.beans.PropertyChangeSupport;
|
||||
import java.beans.PropertyEditor;
|
||||
|
||||
/**
|
||||
* Created by IntelliJ IDEA.
|
||||
* User: streiche
|
||||
* Date: 15.07.2005
|
||||
* Time: 10:32:43
|
||||
* To change this template use File | Settings | File Templates.
|
||||
*
|
||||
*/
|
||||
public class GenericWeigthedLPTchebycheffEditor extends JPanel implements PropertyEditor {
|
||||
|
||||
/**
|
||||
* Handles property change notification
|
||||
*/
|
||||
private PropertyChangeSupport m_Support = new PropertyChangeSupport(this);
|
||||
private PropertyChangeSupport support = new PropertyChangeSupport(this);
|
||||
/**
|
||||
* The label for when we can't edit that type
|
||||
*/
|
||||
private JLabel m_Label = new JLabel("Can't edit", SwingConstants.CENTER);
|
||||
private JLabel label = new JLabel("Can't edit", SwingConstants.CENTER);
|
||||
/**
|
||||
* The FilePath that is to be edited
|
||||
* The filePath that is to be edited
|
||||
*/
|
||||
private PropertyWeightedLPTchebycheff m_WLPT;
|
||||
private PropertyWeightedLPTchebycheff propertyWeightedLPTchebycheff;
|
||||
|
||||
/**
|
||||
* The gaphix stuff
|
||||
*/
|
||||
private JPanel m_CustomEditor, m_DataPanel, m_ButtonPanel, m_TargetPanel;
|
||||
private JTextField[] m_IdealTextField, m_WeightTextField;
|
||||
private JTextField m_PValue;
|
||||
private JButton m_OKButton;
|
||||
private JPanel customEditor, dataPanel, buttonPanel, targetPanel;
|
||||
private JTextField[] idealTextField, weightTextField;
|
||||
private JTextField pvalueTextField;
|
||||
private JButton okButton;
|
||||
|
||||
public GenericWeigthedLPTchebycheffEditor() {
|
||||
// compiled code
|
||||
@ -50,39 +46,39 @@ public class GenericWeigthedLPTchebycheffEditor extends JPanel implements Proper
|
||||
* This method will init the CustomEditor Panel
|
||||
*/
|
||||
private void initCustomEditor() {
|
||||
this.m_CustomEditor = new JPanel();
|
||||
this.m_CustomEditor.setLayout(new BorderLayout());
|
||||
this.customEditor = new JPanel();
|
||||
this.customEditor.setLayout(new BorderLayout());
|
||||
|
||||
// target panel
|
||||
this.m_TargetPanel = new JPanel();
|
||||
this.m_TargetPanel.setLayout(new GridLayout(1, 2));
|
||||
this.m_TargetPanel.add(new JLabel("Choose P:"));
|
||||
this.m_PValue = new JTextField("" + this.m_WLPT.m_P);
|
||||
this.m_TargetPanel.add(this.m_PValue);
|
||||
this.m_PValue.addKeyListener(this.readDoubleAction);
|
||||
this.m_CustomEditor.add(this.m_TargetPanel, BorderLayout.NORTH);
|
||||
this.targetPanel = new JPanel();
|
||||
this.targetPanel.setLayout(new GridLayout(1, 2));
|
||||
this.targetPanel.add(new JLabel("Choose P:"));
|
||||
this.pvalueTextField = new JTextField("" + this.propertyWeightedLPTchebycheff.p);
|
||||
this.targetPanel.add(this.pvalueTextField);
|
||||
this.pvalueTextField.addKeyListener(this.readDoubleAction);
|
||||
this.customEditor.add(this.targetPanel, BorderLayout.NORTH);
|
||||
|
||||
// init data panel
|
||||
this.m_DataPanel = new JPanel();
|
||||
this.dataPanel = new JPanel();
|
||||
this.updateDataPanel();
|
||||
this.m_CustomEditor.add(this.m_DataPanel, BorderLayout.CENTER);
|
||||
this.customEditor.add(this.dataPanel, BorderLayout.CENTER);
|
||||
|
||||
// init button panel
|
||||
this.m_ButtonPanel = new JPanel();
|
||||
this.m_OKButton = new JButton("OK");
|
||||
this.m_OKButton.setEnabled(true);
|
||||
this.m_OKButton.addActionListener(new ActionListener() {
|
||||
this.buttonPanel = new JPanel();
|
||||
this.okButton = new JButton("OK");
|
||||
this.okButton.setEnabled(true);
|
||||
this.okButton.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
//backupObject = copyObject(object);
|
||||
if ((m_CustomEditor.getTopLevelAncestor() != null) && (m_CustomEditor.getTopLevelAncestor() instanceof Window)) {
|
||||
Window w = (Window) m_CustomEditor.getTopLevelAncestor();
|
||||
if ((customEditor.getTopLevelAncestor() != null) && (customEditor.getTopLevelAncestor() instanceof Window)) {
|
||||
Window w = (Window) customEditor.getTopLevelAncestor();
|
||||
w.dispose();
|
||||
}
|
||||
}
|
||||
});
|
||||
this.m_ButtonPanel.add(this.m_OKButton);
|
||||
this.m_CustomEditor.add(this.m_ButtonPanel, BorderLayout.SOUTH);
|
||||
this.buttonPanel.add(this.okButton);
|
||||
this.customEditor.add(this.buttonPanel, BorderLayout.SOUTH);
|
||||
this.updateEditor();
|
||||
}
|
||||
|
||||
@ -101,8 +97,8 @@ public class GenericWeigthedLPTchebycheffEditor extends JPanel implements Proper
|
||||
@Override
|
||||
public void keyReleased(KeyEvent event) {
|
||||
try {
|
||||
int d = new Integer(m_PValue.getText()).intValue();
|
||||
m_WLPT.m_P = d;
|
||||
int d = new Integer(pvalueTextField.getText()).intValue();
|
||||
propertyWeightedLPTchebycheff.p = d;
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
@ -123,29 +119,29 @@ public class GenericWeigthedLPTchebycheffEditor extends JPanel implements Proper
|
||||
|
||||
@Override
|
||||
public void keyReleased(KeyEvent event) {
|
||||
double[] tmpT = m_WLPT.idealValue;
|
||||
double[] tmpP = m_WLPT.weights;
|
||||
double[] tmpT = propertyWeightedLPTchebycheff.idealValue;
|
||||
double[] tmpP = propertyWeightedLPTchebycheff.weights;
|
||||
|
||||
for (int i = 0; i < tmpT.length; i++) {
|
||||
|
||||
try {
|
||||
double d = 0;
|
||||
d = new Double(m_IdealTextField[i].getText()).doubleValue();
|
||||
d = new Double(idealTextField[i].getText()).doubleValue();
|
||||
tmpT[i] = d;
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
try {
|
||||
double d = 0;
|
||||
d = new Double(m_WeightTextField[i].getText()).doubleValue();
|
||||
d = new Double(weightTextField[i].getText()).doubleValue();
|
||||
tmpP[i] = d;
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
m_WLPT.idealValue = tmpT;
|
||||
m_WLPT.weights = tmpP;
|
||||
propertyWeightedLPTchebycheff.idealValue = tmpT;
|
||||
propertyWeightedLPTchebycheff.weights = tmpP;
|
||||
}
|
||||
};
|
||||
|
||||
@ -153,10 +149,10 @@ public class GenericWeigthedLPTchebycheffEditor extends JPanel implements Proper
|
||||
* The object may have changed update the editor.
|
||||
*/
|
||||
private void updateEditor() {
|
||||
if (this.m_CustomEditor != null) {
|
||||
if (this.customEditor != null) {
|
||||
this.updateDataPanel();
|
||||
this.m_CustomEditor.validate();
|
||||
this.m_CustomEditor.repaint();
|
||||
this.customEditor.validate();
|
||||
this.customEditor.repaint();
|
||||
}
|
||||
}
|
||||
|
||||
@ -164,29 +160,29 @@ public class GenericWeigthedLPTchebycheffEditor extends JPanel implements Proper
|
||||
* This method updates the data panel
|
||||
*/
|
||||
private void updateDataPanel() {
|
||||
double[] tmpT = this.m_WLPT.idealValue;
|
||||
double[] tmpP = this.m_WLPT.weights;
|
||||
int obj = this.m_WLPT.m_P;
|
||||
double[] tmpT = this.propertyWeightedLPTchebycheff.idealValue;
|
||||
double[] tmpP = this.propertyWeightedLPTchebycheff.weights;
|
||||
int obj = this.propertyWeightedLPTchebycheff.p;
|
||||
|
||||
this.m_PValue.setText("" + obj);
|
||||
this.m_DataPanel.removeAll();
|
||||
this.m_DataPanel.setLayout(new GridLayout(tmpT.length + 1, 3));
|
||||
this.m_DataPanel.add(new JLabel());
|
||||
this.m_DataPanel.add(new JLabel("Ideal Value"));
|
||||
this.m_DataPanel.add(new JLabel("Weights"));
|
||||
this.m_IdealTextField = new JTextField[tmpT.length];
|
||||
this.m_WeightTextField = new JTextField[tmpT.length];
|
||||
this.pvalueTextField.setText("" + obj);
|
||||
this.dataPanel.removeAll();
|
||||
this.dataPanel.setLayout(new GridLayout(tmpT.length + 1, 3));
|
||||
this.dataPanel.add(new JLabel());
|
||||
this.dataPanel.add(new JLabel("Ideal Value"));
|
||||
this.dataPanel.add(new JLabel("Weights"));
|
||||
this.idealTextField = new JTextField[tmpT.length];
|
||||
this.weightTextField = new JTextField[tmpT.length];
|
||||
for (int i = 0; i < tmpT.length; i++) {
|
||||
JLabel label = new JLabel("Objective " + i + ": ");
|
||||
this.m_DataPanel.add(label);
|
||||
this.m_IdealTextField[i] = new JTextField();
|
||||
this.m_IdealTextField[i].setText("" + tmpT[i]);
|
||||
this.m_IdealTextField[i].addKeyListener(this.readDoubleArrayAction);
|
||||
this.m_DataPanel.add(this.m_IdealTextField[i]);
|
||||
this.m_WeightTextField[i] = new JTextField();
|
||||
this.m_WeightTextField[i].setText("" + tmpP[i]);
|
||||
this.m_WeightTextField[i].addKeyListener(this.readDoubleArrayAction);
|
||||
this.m_DataPanel.add(this.m_WeightTextField[i]);
|
||||
this.dataPanel.add(label);
|
||||
this.idealTextField[i] = new JTextField();
|
||||
this.idealTextField[i].setText("" + tmpT[i]);
|
||||
this.idealTextField[i].addKeyListener(this.readDoubleArrayAction);
|
||||
this.dataPanel.add(this.idealTextField[i]);
|
||||
this.weightTextField[i] = new JTextField();
|
||||
this.weightTextField[i].setText("" + tmpP[i]);
|
||||
this.weightTextField[i].addKeyListener(this.readDoubleArrayAction);
|
||||
this.dataPanel.add(this.weightTextField[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -199,7 +195,7 @@ public class GenericWeigthedLPTchebycheffEditor extends JPanel implements Proper
|
||||
@Override
|
||||
public void setValue(Object o) {
|
||||
if (o instanceof PropertyWeightedLPTchebycheff) {
|
||||
this.m_WLPT = (PropertyWeightedLPTchebycheff) o;
|
||||
this.propertyWeightedLPTchebycheff = (PropertyWeightedLPTchebycheff) o;
|
||||
this.updateEditor();
|
||||
}
|
||||
}
|
||||
@ -211,7 +207,7 @@ public class GenericWeigthedLPTchebycheffEditor extends JPanel implements Proper
|
||||
*/
|
||||
@Override
|
||||
public Object getValue() {
|
||||
return this.m_WLPT;
|
||||
return this.propertyWeightedLPTchebycheff;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -245,18 +241,18 @@ public class GenericWeigthedLPTchebycheffEditor extends JPanel implements Proper
|
||||
|
||||
@Override
|
||||
public void addPropertyChangeListener(PropertyChangeListener l) {
|
||||
if (m_Support == null) {
|
||||
m_Support = new PropertyChangeSupport(this);
|
||||
if (support == null) {
|
||||
support = new PropertyChangeSupport(this);
|
||||
}
|
||||
m_Support.addPropertyChangeListener(l);
|
||||
support.addPropertyChangeListener(l);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removePropertyChangeListener(PropertyChangeListener l) {
|
||||
if (m_Support == null) {
|
||||
m_Support = new PropertyChangeSupport(this);
|
||||
if (support == null) {
|
||||
support = new PropertyChangeSupport(this);
|
||||
}
|
||||
m_Support.removePropertyChangeListener(l);
|
||||
support.removePropertyChangeListener(l);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -265,7 +261,7 @@ public class GenericWeigthedLPTchebycheffEditor extends JPanel implements Proper
|
||||
* @param a The action listener.
|
||||
*/
|
||||
public void addOkListener(ActionListener a) {
|
||||
m_OKButton.addActionListener(a);
|
||||
okButton.addActionListener(a);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -274,7 +270,7 @@ public class GenericWeigthedLPTchebycheffEditor extends JPanel implements Proper
|
||||
* @param a The action listener
|
||||
*/
|
||||
public void removeOkListener(ActionListener a) {
|
||||
m_OKButton.removeActionListener(a);
|
||||
okButton.removeActionListener(a);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -318,9 +314,9 @@ public class GenericWeigthedLPTchebycheffEditor extends JPanel implements Proper
|
||||
*/
|
||||
@Override
|
||||
public Component getCustomEditor() {
|
||||
if (this.m_CustomEditor == null) {
|
||||
if (this.customEditor == null) {
|
||||
this.initCustomEditor();
|
||||
}
|
||||
return m_CustomEditor;
|
||||
return customEditor;
|
||||
}
|
||||
}
|
@ -11,15 +11,8 @@ import java.beans.PropertyEditor;
|
||||
|
||||
|
||||
/**
|
||||
* <p>Title: EvA2</p>
|
||||
* <p>Description: </p>
|
||||
* <p>Copyright: Copyright (c) 2003</p>
|
||||
* <p>Company: </p>
|
||||
*
|
||||
* @author not attributable
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class MultiLineStringEditor implements PropertyEditor {
|
||||
protected MultiLineString value; // The value we will be editing.
|
||||
|
||||
|
@ -1,13 +1,6 @@
|
||||
package eva2.gui.editor;
|
||||
/*
|
||||
* Title: EvA2
|
||||
* Description:
|
||||
* Copyright: Copyright (c) 2003
|
||||
* Company: University of Tuebingen, Computer Architecture
|
||||
* @author Holger Ulmer, Felix Streichert, Hannes Planatscher
|
||||
* @version: $Revision: 194 $
|
||||
* $Date: 2007-10-23 13:43:24 +0200 (Tue, 23 Oct 2007) $
|
||||
* $Author: mkron $
|
||||
*
|
||||
*/
|
||||
|
||||
import eva2.gui.PropertySheetPanelStat;
|
||||
@ -22,31 +15,31 @@ import java.beans.PropertyEditor;
|
||||
|
||||
public class StatisticsEditor implements PropertyEditor {
|
||||
|
||||
private PropertyChangeSupport m_Support = new PropertyChangeSupport(this);
|
||||
private PropertySheetPanelStat m_StatPanel;
|
||||
private JScrollPane m_ScrollPane;
|
||||
private JPanel m_Panel;
|
||||
private GenericStatistics m_Value;
|
||||
private PropertyChangeSupport propertyChangeSupport = new PropertyChangeSupport(this);
|
||||
private PropertySheetPanelStat statPanel;
|
||||
private JScrollPane scrollPane;
|
||||
private JPanel panel;
|
||||
private GenericStatistics statistics;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public StatisticsEditor() {
|
||||
super();
|
||||
m_StatPanel = new PropertySheetPanelStat();
|
||||
m_StatPanel.addPropertyChangeListener(
|
||||
statPanel = new PropertySheetPanelStat();
|
||||
statPanel.addPropertyChangeListener(
|
||||
new PropertyChangeListener() {
|
||||
|
||||
@Override
|
||||
public void propertyChange(PropertyChangeEvent evt) {
|
||||
m_Support.firePropertyChange("", null, null);
|
||||
propertyChangeSupport.firePropertyChange("", null, null);
|
||||
}
|
||||
});
|
||||
m_ScrollPane = new JScrollPane(m_StatPanel);
|
||||
m_Panel = new JPanel();
|
||||
m_Panel.setLayout(new BorderLayout());
|
||||
scrollPane = new JScrollPane(statPanel);
|
||||
panel = new JPanel();
|
||||
panel.setLayout(new BorderLayout());
|
||||
|
||||
m_Panel.add(m_ScrollPane, BorderLayout.CENTER);
|
||||
panel.add(scrollPane, BorderLayout.CENTER);
|
||||
|
||||
}
|
||||
|
||||
@ -56,10 +49,10 @@ public class StatisticsEditor implements PropertyEditor {
|
||||
@Override
|
||||
public void setValue(Object value) {
|
||||
if (value instanceof GenericStatistics) {
|
||||
m_Value = (GenericStatistics) value;
|
||||
m_StatPanel.setTarget(m_Value.getPropertyNames(), m_Value.getState());
|
||||
statistics = (GenericStatistics) value;
|
||||
statPanel.setTarget(statistics.getPropertyNames(), statistics.getState());
|
||||
}
|
||||
m_Support.firePropertyChange("", null, null);
|
||||
propertyChangeSupport.firePropertyChange("", null, null);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -68,8 +61,8 @@ public class StatisticsEditor implements PropertyEditor {
|
||||
@Override
|
||||
public Object getValue() {
|
||||
System.out.println("getValue !!!!!!!!!!!!");
|
||||
m_Value.setState(m_StatPanel.getState());
|
||||
return m_Value;
|
||||
statistics.setState(statPanel.getState());
|
||||
return statistics;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -136,22 +129,22 @@ public class StatisticsEditor implements PropertyEditor {
|
||||
*/
|
||||
@Override
|
||||
public Component getCustomEditor() {
|
||||
return m_Panel;
|
||||
return panel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addPropertyChangeListener(PropertyChangeListener l) {
|
||||
if (m_Support == null) {
|
||||
m_Support = new PropertyChangeSupport(this);
|
||||
if (propertyChangeSupport == null) {
|
||||
propertyChangeSupport = new PropertyChangeSupport(this);
|
||||
}
|
||||
m_Support.addPropertyChangeListener(l);
|
||||
propertyChangeSupport.addPropertyChangeListener(l);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removePropertyChangeListener(PropertyChangeListener l) {
|
||||
if (m_Support == null) {
|
||||
m_Support = new PropertyChangeSupport(this);
|
||||
if (propertyChangeSupport == null) {
|
||||
propertyChangeSupport = new PropertyChangeSupport(this);
|
||||
}
|
||||
m_Support.removePropertyChangeListener(l);
|
||||
propertyChangeSupport.removePropertyChangeListener(l);
|
||||
}
|
||||
}
|
||||
|
@ -11,8 +11,8 @@ public class StringSelectionEditor extends AbstractListSelectionEditor {
|
||||
|
||||
@Override
|
||||
protected boolean actionOnSelect() {
|
||||
for (int i = 0; i < this.m_BlackCheck.length; i++) {
|
||||
strs.setSelected(i, this.m_BlackCheck[i].isSelected());
|
||||
for (int i = 0; i < this.blackCheck.length; i++) {
|
||||
strs.setSelected(i, this.blackCheck[i].isSelected());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -1,14 +1,4 @@
|
||||
package eva2.gui.editor;
|
||||
/*
|
||||
* Title: EvA2
|
||||
* Description:
|
||||
* Copyright: Copyright (c) 2003
|
||||
* Company: University of Tuebingen, Computer Architecture
|
||||
* @author Holger Ulmer, Felix Streichert, Hannes Planatscher
|
||||
* @version: $Revision: 14 $
|
||||
* $Date: 2006-12-18 16:32:23 +0100 (Mon, 18 Dec 2006) $
|
||||
* $Author: marcekro $
|
||||
*/
|
||||
|
||||
import eva2.EvAInfo;
|
||||
import eva2.gui.PropertyValueSelector;
|
||||
|
Loading…
x
Reference in New Issue
Block a user