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