Merging MK branch revs. 439,440,441: Removing sun.beans.editors, replaced non-free jpeg codec.
This commit is contained in:
		@@ -1,17 +1,39 @@
 | 
			
		||||
package eva2.gui;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
import javax.swing.*;
 | 
			
		||||
import java.awt.BorderLayout;
 | 
			
		||||
import java.awt.Component;
 | 
			
		||||
import java.awt.Dimension;
 | 
			
		||||
import java.awt.Font;
 | 
			
		||||
import java.awt.FontMetrics;
 | 
			
		||||
import java.awt.Graphics;
 | 
			
		||||
import java.awt.GridBagConstraints;
 | 
			
		||||
import java.awt.GridBagLayout;
 | 
			
		||||
import java.awt.Rectangle;
 | 
			
		||||
import java.awt.Toolkit;
 | 
			
		||||
import java.awt.event.ActionEvent;
 | 
			
		||||
import java.awt.event.ActionListener;
 | 
			
		||||
import java.beans.PropertyChangeEvent;
 | 
			
		||||
import java.beans.PropertyChangeListener;
 | 
			
		||||
import java.beans.PropertyChangeSupport;
 | 
			
		||||
import java.beans.PropertyEditor;
 | 
			
		||||
 | 
			
		||||
import javax.swing.BorderFactory;
 | 
			
		||||
import javax.swing.ImageIcon;
 | 
			
		||||
import javax.swing.JButton;
 | 
			
		||||
import javax.swing.JComponent;
 | 
			
		||||
import javax.swing.JLabel;
 | 
			
		||||
import javax.swing.JPanel;
 | 
			
		||||
import javax.swing.JScrollPane;
 | 
			
		||||
import javax.swing.JTextArea;
 | 
			
		||||
import javax.swing.SwingConstants;
 | 
			
		||||
 | 
			
		||||
import eva2.server.go.problems.InterfaceOptimizationObjective;
 | 
			
		||||
import eva2.server.go.problems.InterfaceOptimizationTarget;
 | 
			
		||||
import eva2.server.go.tools.AbstractObjectEditor;
 | 
			
		||||
import eva2.server.go.tools.GeneralGOEProperty;
 | 
			
		||||
import eva2.tools.BasicResourceLoader;
 | 
			
		||||
 | 
			
		||||
import java.beans.*;
 | 
			
		||||
import java.awt.*;
 | 
			
		||||
import java.awt.event.*;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Created by IntelliJ IDEA.
 | 
			
		||||
@@ -65,7 +87,7 @@ public class GenericOptimizationObjectivesEditor extends JPanel implements Prope
 | 
			
		||||
                    ((GenericObjectEditor) this.m_Editors[i].m_Editor).setClassType(InterfaceOptimizationTarget.class);
 | 
			
		||||
                this.m_Editors[i].m_Editor.setValue(this.m_Editors[i].m_Value);
 | 
			
		||||
                this.m_Editors[i].m_Editor.addPropertyChangeListener(this);
 | 
			
		||||
                this.findViewFor(this.m_Editors[i]);
 | 
			
		||||
                AbstractObjectEditor.findViewFor(this.m_Editors[i]);
 | 
			
		||||
                if (this.m_Editors[i].m_View != null) this.m_Editors[i].m_View.repaint();
 | 
			
		||||
            } catch (Exception e) {
 | 
			
		||||
                System.out.println("Darn can't read the value...");
 | 
			
		||||
@@ -204,7 +226,7 @@ public class GenericOptimizationObjectivesEditor extends JPanel implements Prope
 | 
			
		||||
                    ((GenericObjectEditor) newEdit[l].m_Editor).setClassType(InterfaceOptimizationTarget.class);
 | 
			
		||||
                newEdit[l].m_Editor.setValue(newEdit[l].m_Value);
 | 
			
		||||
                newEdit[l].m_Editor.addPropertyChangeListener(m_self);
 | 
			
		||||
                findViewFor(newEdit[l]);
 | 
			
		||||
                AbstractObjectEditor.findViewFor(newEdit[l]);
 | 
			
		||||
                if (newEdit[l].m_View != null) newEdit[l].m_View.repaint();
 | 
			
		||||
            } catch (Exception e) {
 | 
			
		||||
                System.out.println("Darn can't read the value...");
 | 
			
		||||
@@ -344,31 +366,6 @@ public class GenericOptimizationObjectivesEditor extends JPanel implements Prope
 | 
			
		||||
        this.updateEditor();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void findViewFor(GeneralGOEProperty editor) {
 | 
			
		||||
        if (editor.m_Editor instanceof sun.beans.editors.BoolEditor) {
 | 
			
		||||
            editor.m_View = new PropertyBoolSelector(editor.m_Editor);
 | 
			
		||||
        } else {
 | 
			
		||||
            if (editor.m_Editor instanceof sun.beans.editors.DoubleEditor) {
 | 
			
		||||
                editor.m_View = new PropertyText(editor.m_Editor);
 | 
			
		||||
            } else {
 | 
			
		||||
                if (editor.m_Editor.isPaintable() && editor.m_Editor.supportsCustomEditor()) {
 | 
			
		||||
                    editor.m_View = new PropertyPanel(editor.m_Editor);
 | 
			
		||||
                } else {
 | 
			
		||||
                    if (editor.m_Editor.getTags() != null ) {
 | 
			
		||||
                        editor.m_View = new PropertyValueSelector(editor.m_Editor);
 | 
			
		||||
                    } else {
 | 
			
		||||
                        if (editor.m_Editor.getAsText() != null) {
 | 
			
		||||
                            editor.m_View = new PropertyText(editor.m_Editor);
 | 
			
		||||
                        } else {
 | 
			
		||||
                            System.out.println("Warning: Property \"" + editor.m_Name
 | 
			
		||||
                                 + "\" has non-displayabale editor.  Skipping.");
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /********************************* java.beans.PropertyChangeListener *************************/
 | 
			
		||||
 | 
			
		||||
    public void addPropertyChangeListener(PropertyChangeListener l) {
 | 
			
		||||
@@ -398,7 +395,7 @@ public class GenericOptimizationObjectivesEditor extends JPanel implements Prope
 | 
			
		||||
                        ((GenericObjectEditor) this.m_Editors[i].m_Editor).setClassType(InterfaceOptimizationTarget.class);
 | 
			
		||||
                    this.m_Editors[i].m_Editor.setValue(this.m_Editors[i].m_Value);
 | 
			
		||||
                    this.m_Editors[i].m_Editor.addPropertyChangeListener(this);
 | 
			
		||||
                    this.findViewFor(this.m_Editors[i]);
 | 
			
		||||
                    AbstractObjectEditor.findViewFor(this.m_Editors[i]);
 | 
			
		||||
                    if (this.m_Editors[i].m_View != null) this.m_Editors[i].m_View.repaint();
 | 
			
		||||
                } catch (Exception e) {
 | 
			
		||||
                    System.out.println("Darn can't read the value...");
 | 
			
		||||
 
 | 
			
		||||
@@ -1,19 +1,42 @@
 | 
			
		||||
package eva2.gui;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
import javax.swing.*;
 | 
			
		||||
import java.awt.BorderLayout;
 | 
			
		||||
import java.awt.Component;
 | 
			
		||||
import java.awt.Dimension;
 | 
			
		||||
import java.awt.Font;
 | 
			
		||||
import java.awt.FontMetrics;
 | 
			
		||||
import java.awt.Graphics;
 | 
			
		||||
import java.awt.GridBagConstraints;
 | 
			
		||||
import java.awt.GridBagLayout;
 | 
			
		||||
import java.awt.GridLayout;
 | 
			
		||||
import java.awt.Rectangle;
 | 
			
		||||
import java.awt.Toolkit;
 | 
			
		||||
import java.awt.event.ActionEvent;
 | 
			
		||||
import java.awt.event.ActionListener;
 | 
			
		||||
import java.awt.event.KeyEvent;
 | 
			
		||||
import java.awt.event.KeyListener;
 | 
			
		||||
import java.beans.PropertyChangeEvent;
 | 
			
		||||
import java.beans.PropertyChangeListener;
 | 
			
		||||
import java.beans.PropertyChangeSupport;
 | 
			
		||||
import java.beans.PropertyEditor;
 | 
			
		||||
 | 
			
		||||
import javax.swing.BorderFactory;
 | 
			
		||||
import javax.swing.ImageIcon;
 | 
			
		||||
import javax.swing.JButton;
 | 
			
		||||
import javax.swing.JComponent;
 | 
			
		||||
import javax.swing.JLabel;
 | 
			
		||||
import javax.swing.JPanel;
 | 
			
		||||
import javax.swing.JScrollPane;
 | 
			
		||||
import javax.swing.JTextArea;
 | 
			
		||||
import javax.swing.JTextField;
 | 
			
		||||
import javax.swing.SwingConstants;
 | 
			
		||||
 | 
			
		||||
import eva2.server.go.problems.InterfaceOptimizationObjective;
 | 
			
		||||
import eva2.server.go.tools.AbstractObjectEditor;
 | 
			
		||||
import eva2.server.go.tools.GeneralGOEProperty;
 | 
			
		||||
import eva2.tools.BasicResourceLoader;
 | 
			
		||||
 | 
			
		||||
import java.beans.*;
 | 
			
		||||
import java.awt.*;
 | 
			
		||||
import java.awt.event.ActionListener;
 | 
			
		||||
import java.awt.event.ActionEvent;
 | 
			
		||||
import java.awt.event.KeyListener;
 | 
			
		||||
import java.awt.event.KeyEvent;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Created by IntelliJ IDEA.
 | 
			
		||||
@@ -67,7 +90,7 @@ public class GenericOptimizationObjectivesWithParamEditor extends JPanel impleme
 | 
			
		||||
                    ((GenericObjectEditor) this.m_Editors[i].m_Editor).setClassType(InterfaceOptimizationObjective.class);
 | 
			
		||||
                this.m_Editors[i].m_Editor.setValue(this.m_Editors[i].m_Value);
 | 
			
		||||
                this.m_Editors[i].m_Editor.addPropertyChangeListener(this);
 | 
			
		||||
                this.findViewFor(this.m_Editors[i]);
 | 
			
		||||
                AbstractObjectEditor.findViewFor(this.m_Editors[i]);
 | 
			
		||||
                if (this.m_Editors[i].m_View != null) this.m_Editors[i].m_View.repaint();
 | 
			
		||||
            } catch (Exception e) {
 | 
			
		||||
                System.out.println("Darn can't read the value...");
 | 
			
		||||
@@ -227,7 +250,7 @@ public class GenericOptimizationObjectivesWithParamEditor extends JPanel impleme
 | 
			
		||||
                    ((GenericObjectEditor) newEdit[l].m_Editor).setClassType(InterfaceOptimizationObjective.class);
 | 
			
		||||
                newEdit[l].m_Editor.setValue(newEdit[l].m_Value);
 | 
			
		||||
                newEdit[l].m_Editor.addPropertyChangeListener(m_self);
 | 
			
		||||
                findViewFor(newEdit[l]);
 | 
			
		||||
                AbstractObjectEditor.findViewFor(newEdit[l]);
 | 
			
		||||
                if (newEdit[l].m_View != null) newEdit[l].m_View.repaint();
 | 
			
		||||
            } catch (Exception e) {
 | 
			
		||||
                System.out.println("Darn can't read the value...");
 | 
			
		||||
@@ -409,31 +432,6 @@ public class GenericOptimizationObjectivesWithParamEditor extends JPanel impleme
 | 
			
		||||
        this.updateEditor();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void findViewFor(GeneralGOEProperty editor) {
 | 
			
		||||
        if (editor.m_Editor instanceof sun.beans.editors.BoolEditor) {
 | 
			
		||||
            editor.m_View = new PropertyBoolSelector(editor.m_Editor);
 | 
			
		||||
        } else {
 | 
			
		||||
            if (editor.m_Editor instanceof sun.beans.editors.DoubleEditor) {
 | 
			
		||||
                editor.m_View = new PropertyText(editor.m_Editor);
 | 
			
		||||
            } else {
 | 
			
		||||
                if (editor.m_Editor.isPaintable() && editor.m_Editor.supportsCustomEditor()) {
 | 
			
		||||
                    editor.m_View = new PropertyPanel(editor.m_Editor);
 | 
			
		||||
                } else {
 | 
			
		||||
                    if (editor.m_Editor.getTags() != null ) {
 | 
			
		||||
                        editor.m_View = new PropertyValueSelector(editor.m_Editor);
 | 
			
		||||
                    } else {
 | 
			
		||||
                        if (editor.m_Editor.getAsText() != null) {
 | 
			
		||||
                            editor.m_View = new PropertyText(editor.m_Editor);
 | 
			
		||||
                        } else {
 | 
			
		||||
                            System.out.println("Warning: Property \"" + editor.m_Name
 | 
			
		||||
                                 + "\" has non-displayabale editor.  Skipping.");
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /********************************* java.beans.PropertyChangeListener *************************/
 | 
			
		||||
 | 
			
		||||
    public void addPropertyChangeListener(PropertyChangeListener l) {
 | 
			
		||||
@@ -463,7 +461,7 @@ public class GenericOptimizationObjectivesWithParamEditor extends JPanel impleme
 | 
			
		||||
                        ((GenericObjectEditor) this.m_Editors[i].m_Editor).setClassType(InterfaceOptimizationObjective.class);
 | 
			
		||||
                    this.m_Editors[i].m_Editor.setValue(this.m_Editors[i].m_Value);
 | 
			
		||||
                    this.m_Editors[i].m_Editor.addPropertyChangeListener(this);
 | 
			
		||||
                    this.findViewFor(this.m_Editors[i]);
 | 
			
		||||
                    AbstractObjectEditor.findViewFor(this.m_Editors[i]);
 | 
			
		||||
                    if (this.m_Editors[i].m_View != null) this.m_Editors[i].m_View.repaint();
 | 
			
		||||
                } catch (Exception e) {
 | 
			
		||||
                    System.out.println("Darn can't read the value...");
 | 
			
		||||
 
 | 
			
		||||
@@ -33,15 +33,13 @@ import java.io.ObjectInputStream;
 | 
			
		||||
import java.io.ObjectOutputStream;
 | 
			
		||||
import java.io.Serializable;
 | 
			
		||||
 | 
			
		||||
import javax.imageio.ImageIO;
 | 
			
		||||
import javax.swing.JButton;
 | 
			
		||||
import javax.swing.JFileChooser;
 | 
			
		||||
import javax.swing.JFrame;
 | 
			
		||||
import javax.swing.JOptionPane;
 | 
			
		||||
import javax.swing.JPanel;
 | 
			
		||||
 | 
			
		||||
import com.sun.image.codec.jpeg.JPEGCodec;
 | 
			
		||||
import com.sun.image.codec.jpeg.JPEGImageEncoder;
 | 
			
		||||
 | 
			
		||||
import eva2.EvAInfo;
 | 
			
		||||
import eva2.server.go.individuals.AbstractEAIndividual;
 | 
			
		||||
import eva2.server.go.populations.Population;
 | 
			
		||||
@@ -144,94 +142,9 @@ public class Plot implements PlotInterface, Serializable {
 | 
			
		||||
			}
 | 
			
		||||
		});
 | 
			
		||||
 | 
			
		||||
//		JButton PrintButton = new JButton ("Print");
 | 
			
		||||
//		PrintButton.addActionListener(new ActionListener() {
 | 
			
		||||
//			public void actionPerformed(ActionEvent e) {
 | 
			
		||||
//				try {
 | 
			
		||||
//					Robot robot = new Robot();
 | 
			
		||||
//					// Capture a particular area on the screen
 | 
			
		||||
//					int x = 100;
 | 
			
		||||
//					int y = 100;
 | 
			
		||||
//					int width = 200;
 | 
			
		||||
//					int height = 200;
 | 
			
		||||
//					Rectangle area = new Rectangle(x, y, width, height);
 | 
			
		||||
//					BufferedImage bufferedImage = robot.createScreenCapture(area);
 | 
			
		||||
//
 | 
			
		||||
//					// Capture the whole screen
 | 
			
		||||
//					area = new Rectangle(Toolkit.getDefaultToolkit().getScreenSize());
 | 
			
		||||
//					bufferedImage = robot.createScreenCapture(area);
 | 
			
		||||
//					try {
 | 
			
		||||
//						FileOutputStream fos = new FileOutputStream("test.jpeg");
 | 
			
		||||
//						BufferedOutputStream bos = new BufferedOutputStream(fos);
 | 
			
		||||
//						JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(bos);
 | 
			
		||||
//						encoder.encode(bufferedImage);
 | 
			
		||||
//						bos.close();
 | 
			
		||||
//					} catch (Exception eee) {}
 | 
			
		||||
//
 | 
			
		||||
//
 | 
			
		||||
//				} catch (AWTException ee) {
 | 
			
		||||
//					ee.printStackTrace();
 | 
			
		||||
//				}
 | 
			
		||||
//
 | 
			
		||||
//
 | 
			
		||||
//
 | 
			
		||||
//				PrinterJob job = PrinterJob.getPrinterJob();
 | 
			
		||||
////				PageFormat format = job.defaultPage();
 | 
			
		||||
////				job.setPrintable(m_PlotArea, format);
 | 
			
		||||
////				if (job.printDialog()) {
 | 
			
		||||
////				// If not cancelled, start printing!  This will call the print()
 | 
			
		||||
////				// method defined by the Printable interface.
 | 
			
		||||
////				try { job.print(); }
 | 
			
		||||
////				catch (PrinterException ee) {
 | 
			
		||||
////				System.out.println(ee);
 | 
			
		||||
////				ee.printStackTrace();
 | 
			
		||||
////				}
 | 
			
		||||
////				}
 | 
			
		||||
//
 | 
			
		||||
//				///////////////////////////////////////////////
 | 
			
		||||
//				//PagePrinter pp = new PagePrinter(m_PlotArea,m_PlotArea.getGraphics(),job.defaultPage());
 | 
			
		||||
//				//pp.print();
 | 
			
		||||
//				//  public int print( Graphics g, PageFormat pf, int pi ){
 | 
			
		||||
////				m_PlotArea.print(m_PlotArea.getGraphics(), new PageFormat(),0);
 | 
			
		||||
//				// Obtain a java.awt.print.PrinterJob  (not java.awt.PrintJob)
 | 
			
		||||
//				//PrinterJob job = PrinterJob.getPrinterJob();
 | 
			
		||||
//				// Tell the PrinterJob to print us (since we implement Printable)
 | 
			
		||||
//				// using the default page layout
 | 
			
		||||
//				PageFormat page = job.defaultPage();
 | 
			
		||||
//
 | 
			
		||||
//				job.setPrintable(m_PlotArea, page);
 | 
			
		||||
//				// Display the print dialog that allows the user to set options.
 | 
			
		||||
//				// The method returns false if the user cancelled the print request
 | 
			
		||||
//				if (job.printDialog()) {
 | 
			
		||||
//					// If not cancelled, start printing!  This will call the print()
 | 
			
		||||
//					// method defined by the Printable interface.
 | 
			
		||||
//					try { job.print(); }
 | 
			
		||||
//					catch (PrinterException ee) {
 | 
			
		||||
//						System.out.println(ee);
 | 
			
		||||
//						ee.printStackTrace();
 | 
			
		||||
//					}
 | 
			
		||||
//				}
 | 
			
		||||
//			}
 | 
			
		||||
//		});
 | 
			
		||||
 | 
			
		||||
		// MK: Im not sure whether save/open ever worked...
 | 
			
		||||
//		JButton OpenButton = new JButton ("Open..");
 | 
			
		||||
//		OpenButton.setToolTipText("Load an old plot");
 | 
			
		||||
//		OpenButton.addActionListener(new ActionListener() {
 | 
			
		||||
//			public void actionPerformed(ActionEvent e) {
 | 
			
		||||
//				m_PlotArea.openObject();
 | 
			
		||||
//			}
 | 
			
		||||
//		});
 | 
			
		||||
//		JButton SaveButton = new JButton ("Save..");
 | 
			
		||||
//		SaveButton.addActionListener(new ActionListener() {
 | 
			
		||||
//			public void actionPerformed(ActionEvent e) {
 | 
			
		||||
//				m_PlotArea.saveObject();
 | 
			
		||||
//			}
 | 
			
		||||
//		});
 | 
			
		||||
		JButton SaveJPGButton = new JButton ("Save as JPG...");
 | 
			
		||||
		JButton SaveJPGButton = new JButton ("Save as PNG...");
 | 
			
		||||
		SaveJPGButton.addActionListener(new ActionListener() {
 | 
			
		||||
			public void actionPerformed(ActionEvent e) {
 | 
			
		||||
				String outfile ="";
 | 
			
		||||
				try {
 | 
			
		||||
					Robot       robot = new Robot();
 | 
			
		||||
					Rectangle   area;
 | 
			
		||||
@@ -241,16 +154,34 @@ public class Plot implements PlotInterface, Serializable {
 | 
			
		||||
					if (fc.showSaveDialog(m_Frame) != JFileChooser.APPROVE_OPTION) return;
 | 
			
		||||
//					System.out.println("Name " + outfile);
 | 
			
		||||
					try {
 | 
			
		||||
						/* Old version
 | 
			
		||||
						FileOutputStream fos = new FileOutputStream(fc.getSelectedFile().getAbsolutePath()+".jpeg");
 | 
			
		||||
						BufferedOutputStream bos = new BufferedOutputStream(fos);
 | 
			
		||||
						JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(bos);
 | 
			
		||||
						encoder.encode(bufferedImage);
 | 
			
		||||
						bos.close();
 | 
			
		||||
						bos.close();*/
 | 
			
		||||
						File file = new File(fc.getSelectedFile().getAbsolutePath()+".png"); 
 | 
			
		||||
						ImageIO.write(bufferedImage, "png", file); 
 | 
			
		||||
						/* JPEG version with javax.imageio
 | 
			
		||||
					    float compression = 0.8f;
 | 
			
		||||
						FileImageOutputStream out = new FileImageOutputStream(new File(fc.getSelectedFile().getAbsolutePath()+".jpeg"));
 | 
			
		||||
						ImageWriter encoder = (ImageWriter)ImageIO.getImageWritersByFormatName("JPEG").next();
 | 
			
		||||
						JPEGImageWriteParam param = new JPEGImageWriteParam(null);
 | 
			
		||||
 | 
			
		||||
						param.setCompressionMode(ImageWriteParam.MODE_EXPLICIT);
 | 
			
		||||
						param.setCompressionQuality(compression);
 | 
			
		||||
 | 
			
		||||
						encoder.setOutput(out);
 | 
			
		||||
						encoder.write((IIOMetadata) null, new IIOImage(bufferedImage,null,null), param);
 | 
			
		||||
 | 
			
		||||
						out.close();
 | 
			
		||||
*/
 | 
			
		||||
						
 | 
			
		||||
					} catch (Exception eee) {
 | 
			
		||||
						System.err.println("Error on exporting JPEG: " + eee.getMessage());
 | 
			
		||||
						System.err.println("Error on exporting PNG: " + eee.getMessage());
 | 
			
		||||
					}
 | 
			
		||||
				} catch (AWTException ee) {
 | 
			
		||||
					System.err.println("Error on creating JPEG: " + ee.getMessage());
 | 
			
		||||
					System.err.println("Error on creating PNG: " + ee.getMessage());
 | 
			
		||||
					ee.printStackTrace();
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,50 +1,35 @@
 | 
			
		||||
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 $
 | 
			
		||||
 */
 | 
			
		||||
/*==========================================================================*
 | 
			
		||||
 * IMPORTS
 | 
			
		||||
 *==========================================================================*/
 | 
			
		||||
import java.awt.*;
 | 
			
		||||
import java.awt.event.*;
 | 
			
		||||
import java.beans.*;
 | 
			
		||||
import javax.swing.*;
 | 
			
		||||
import sun.beans.editors.BoolEditor;
 | 
			
		||||
/*==========================================================================*
 | 
			
		||||
* CLASS DECLARATION
 | 
			
		||||
*==========================================================================*/
 | 
			
		||||
 | 
			
		||||
import java.awt.event.ItemEvent;
 | 
			
		||||
import java.awt.event.ItemListener;
 | 
			
		||||
import java.beans.PropertyEditor;
 | 
			
		||||
 | 
			
		||||
import javax.swing.JCheckBox;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 *
 | 
			
		||||
 * A checkbox for boolean editors. 
 | 
			
		||||
 */
 | 
			
		||||
public class PropertyBoolSelector extends JCheckBox {
 | 
			
		||||
  private BoolEditor m_Editor;
 | 
			
		||||
  /**
 | 
			
		||||
   *
 | 
			
		||||
   */
 | 
			
		||||
  public PropertyBoolSelector(PropertyEditor pe) {
 | 
			
		||||
    super();
 | 
			
		||||
    m_Editor = (BoolEditor) pe;
 | 
			
		||||
    if (m_Editor.getAsText().equals("True"))
 | 
			
		||||
      setSelected(true);
 | 
			
		||||
    else
 | 
			
		||||
      setSelected(false);
 | 
			
		||||
	private static final long serialVersionUID = 8181005734895597714L;
 | 
			
		||||
	private PropertyEditor m_Editor;
 | 
			
		||||
 | 
			
		||||
    addItemListener(new ItemListener () {
 | 
			
		||||
        public void itemStateChanged (ItemEvent evt) {
 | 
			
		||||
          if (evt.getStateChange() == evt.SELECTED) {
 | 
			
		||||
            m_Editor.setValue(Boolean.TRUE);
 | 
			
		||||
          }
 | 
			
		||||
          if (evt.getStateChange() == evt.DESELECTED) {
 | 
			
		||||
            m_Editor.setValue(Boolean.FALSE);
 | 
			
		||||
          }
 | 
			
		||||
        }
 | 
			
		||||
    });
 | 
			
		||||
  }
 | 
			
		||||
	public PropertyBoolSelector(PropertyEditor pe) {
 | 
			
		||||
		super();
 | 
			
		||||
		m_Editor = pe;
 | 
			
		||||
		if (m_Editor.getAsText().equals("True"))
 | 
			
		||||
			setSelected(true);
 | 
			
		||||
		else
 | 
			
		||||
			setSelected(false);
 | 
			
		||||
 | 
			
		||||
		addItemListener(new ItemListener () {
 | 
			
		||||
			public void itemStateChanged (ItemEvent evt) {
 | 
			
		||||
				if (evt.getStateChange() == ItemEvent.SELECTED) {
 | 
			
		||||
					m_Editor.setValue(Boolean.TRUE);
 | 
			
		||||
				}
 | 
			
		||||
				if (evt.getStateChange() == ItemEvent.DESELECTED) {
 | 
			
		||||
					m_Editor.setValue(Boolean.FALSE);
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		});
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -4,17 +4,7 @@ import java.awt.Color;
 | 
			
		||||
import java.beans.PropertyDescriptor;
 | 
			
		||||
import java.beans.PropertyEditor;
 | 
			
		||||
import java.beans.PropertyEditorManager;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
import sun.beans.editors.BoolEditor;
 | 
			
		||||
import sun.beans.editors.ByteEditor;
 | 
			
		||||
import sun.beans.editors.ColorEditor;
 | 
			
		||||
import sun.beans.editors.DoubleEditor;
 | 
			
		||||
import sun.beans.editors.FloatEditor;
 | 
			
		||||
import sun.beans.editors.IntEditor;
 | 
			
		||||
import sun.beans.editors.LongEditor;
 | 
			
		||||
import sun.beans.editors.ShortEditor;
 | 
			
		||||
import sun.beans.editors.StringEditor;
 | 
			
		||||
import eva2.server.go.InterfaceTerminator;
 | 
			
		||||
import eva2.server.go.individuals.codings.gp.GPArea;
 | 
			
		||||
import eva2.tools.SelectedTag;
 | 
			
		||||
@@ -151,15 +141,15 @@ public class PropertyEditorProvider {
 | 
			
		||||
        PropertyEditorManager.registerEditor(double[].class, GenericArrayEditor.class);
 | 
			
		||||
        PropertyEditorManager.registerEditor(InterfaceTerminator[].class, GenericArrayEditor.class);
 | 
			
		||||
        
 | 
			
		||||
        PropertyEditorManager.registerEditor(Double.class, DoubleEditor.class);
 | 
			
		||||
        PropertyEditorManager.registerEditor(Integer.class, IntEditor.class);
 | 
			
		||||
        PropertyEditorManager.registerEditor(Boolean.class, BoolEditor.class);
 | 
			
		||||
        PropertyEditorManager.registerEditor(byte.class, ByteEditor.class);
 | 
			
		||||
        PropertyEditorManager.registerEditor(Color.class, ColorEditor.class);
 | 
			
		||||
        PropertyEditorManager.registerEditor(short.class, ShortEditor.class);
 | 
			
		||||
        PropertyEditorManager.registerEditor(float.class, FloatEditor.class);
 | 
			
		||||
        PropertyEditorManager.registerEditor(long.class, LongEditor.class);
 | 
			
		||||
        PropertyEditorManager.registerEditor(String.class, StringEditor.class);
 | 
			
		||||
//        PropertyEditorManager.registerEditor(Double.class, DoubleEditor.class);
 | 
			
		||||
//        PropertyEditorManager.registerEditor(Integer.class, IntEditor.class);
 | 
			
		||||
//        PropertyEditorManager.registerEditor(Boolean.class, BoolEditor.class);
 | 
			
		||||
//        PropertyEditorManager.registerEditor(byte.class, ByteEditor.class);
 | 
			
		||||
//        PropertyEditorManager.registerEditor(Color.class, ColorEditor.class);
 | 
			
		||||
//        PropertyEditorManager.registerEditor(short.class, ShortEditor.class);
 | 
			
		||||
//        PropertyEditorManager.registerEditor(float.class, FloatEditor.class);
 | 
			
		||||
//        PropertyEditorManager.registerEditor(long.class, LongEditor.class);
 | 
			
		||||
//        PropertyEditorManager.registerEditor(String.class, StringEditor.class);
 | 
			
		||||
        
 | 
			
		||||
        // The Editor for the new GO
 | 
			
		||||
        
 | 
			
		||||
 
 | 
			
		||||
@@ -124,7 +124,56 @@ public class PropertySheetPanel extends JPanel implements PropertyChangeListener
 | 
			
		||||
        m_support.removePropertyChangeListener(l);
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
   
 | 
			
		||||
    /**
 | 
			
		||||
     * Create a fitting viewer component for an editor instance. If none can be identified,
 | 
			
		||||
     * null is returned.
 | 
			
		||||
     * 
 | 
			
		||||
     * @param editor
 | 
			
		||||
     * @return
 | 
			
		||||
     */
 | 
			
		||||
    public static JComponent getView(PropertyEditor editor) {
 | 
			
		||||
    	JComponent view = null;
 | 
			
		||||
    	// Now figure out how to display it...
 | 
			
		||||
    	if (editor.isPaintable() && editor.supportsCustomEditor()) {
 | 
			
		||||
    		view = new PropertyPanel(editor);
 | 
			
		||||
    	} else {
 | 
			
		||||
    		String[] tags = editor.getTags();
 | 
			
		||||
    		if (tags != null ) {
 | 
			
		||||
    			if ((tags.length==2) && (tags[0].equals("True")) && (tags[1].equals("False")) ) view = new PropertyBoolSelector(editor);
 | 
			
		||||
    			else view = new PropertyValueSelector(editor);
 | 
			
		||||
    		} else {
 | 
			
		||||
    			if (editor.getAsText() != null) {
 | 
			
		||||
    				view = new PropertyText(editor);
 | 
			
		||||
    			} else {
 | 
			
		||||
    				view=null;
 | 
			
		||||
    			}
 | 
			
		||||
    		}
 | 
			
		||||
    	}
 | 
			
		||||
    	/*
 | 
			
		||||
    	if (tmpEdit instanceof sun.beans.editors.BoolEditor) {
 | 
			
		||||
    		NewView = new PropertyBoolSelector(tmpEdit);
 | 
			
		||||
    	} else {
 | 
			
		||||
    		if (tmpEdit instanceof sun.beans.editors.DoubleEditor) {
 | 
			
		||||
    			NewView = new PropertyText(tmpEdit);
 | 
			
		||||
    		} else {
 | 
			
		||||
    			if (tmpEdit.isPaintable() && tmpEdit.supportsCustomEditor()) {
 | 
			
		||||
    				NewView = new PropertyPanel(tmpEdit);
 | 
			
		||||
    			} else {
 | 
			
		||||
    				if (tmpEdit.getTags() != null ) {
 | 
			
		||||
    					NewView = new PropertyValueSelector(tmpEdit);
 | 
			
		||||
    				} else {
 | 
			
		||||
    					if (tmpEdit.getAsText() != null) {
 | 
			
		||||
    						NewView = new PropertyText(tmpEdit);
 | 
			
		||||
    					} else {
 | 
			
		||||
 | 
			
		||||
    					}
 | 
			
		||||
    				}
 | 
			
		||||
    			}
 | 
			
		||||
    		}
 | 
			
		||||
    	}*/
 | 
			
		||||
    	return view;
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    /** Sets a new target object for customisation.
 | 
			
		||||
     * @param targ a value of type 'Object'
 | 
			
		||||
     */
 | 
			
		||||
@@ -204,7 +253,7 @@ public class PropertySheetPanel extends JPanel implements PropertyChangeListener
 | 
			
		||||
            Method  setter  = m_Properties[i].getWriteMethod();
 | 
			
		||||
            // Only display read/write properties.
 | 
			
		||||
            if (getter == null || setter == null) continue;
 | 
			
		||||
            JComponent NewView = null;
 | 
			
		||||
            JComponent newView = null;
 | 
			
		||||
            try {
 | 
			
		||||
	            Object          args[]  = { };
 | 
			
		||||
	            Object          value   = getter.invoke(m_Target, args);
 | 
			
		||||
@@ -231,30 +280,13 @@ public class PropertySheetPanel extends JPanel implements PropertyChangeListener
 | 
			
		||||
                
 | 
			
		||||
                m_TipTexts[i] = getToolTipText(name, m_Methods, m_Target, tipTextLineLen);
 | 
			
		||||
 | 
			
		||||
                // Now figure out how to display it...
 | 
			
		||||
                if (editor instanceof sun.beans.editors.BoolEditor) {
 | 
			
		||||
                    NewView = new PropertyBoolSelector(editor);
 | 
			
		||||
	            } else {
 | 
			
		||||
                    if (editor instanceof sun.beans.editors.DoubleEditor) {
 | 
			
		||||
                        NewView = new PropertyText(editor);
 | 
			
		||||
	                } else {
 | 
			
		||||
	                    if (editor.isPaintable() && editor.supportsCustomEditor()) {
 | 
			
		||||
	                        NewView = new PropertyPanel(editor);
 | 
			
		||||
                        } else {
 | 
			
		||||
                            if (editor.getTags() != null ) {
 | 
			
		||||
                                NewView = new PropertyValueSelector(editor);
 | 
			
		||||
                            } else {
 | 
			
		||||
                                if (editor.getAsText() != null) {
 | 
			
		||||
                                    NewView = new PropertyText(editor);
 | 
			
		||||
                                } else {
 | 
			
		||||
                                    System.out.println("Warning: Property \"" + name
 | 
			
		||||
                                        + "\" has non-displayabale editor.  Skipping.");
 | 
			
		||||
                                    continue;
 | 
			
		||||
                                }
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
//                System.out.println("PSP editor class: " + editor.getClass());
 | 
			
		||||
                newView = getView(editor);
 | 
			
		||||
                if (newView==null) {
 | 
			
		||||
                	System.err.println("Warning: Property \"" + name + "\" has non-displayabale editor.  Skipping.");
 | 
			
		||||
                	continue;
 | 
			
		||||
                }
 | 
			
		||||
                
 | 
			
		||||
                editor.addPropertyChangeListener(this);
 | 
			
		||||
            } catch (InvocationTargetException ex) {
 | 
			
		||||
	            System.out.println("InvocationTargetException " + name
 | 
			
		||||
@@ -273,7 +305,7 @@ public class PropertySheetPanel extends JPanel implements PropertyChangeListener
 | 
			
		||||
 | 
			
		||||
            m_Labels[i]         = new JLabel(name, SwingConstants.RIGHT);
 | 
			
		||||
            m_Labels[i].setBorder(BorderFactory.createEmptyBorder(10,10,0,5));
 | 
			
		||||
            m_Views[i]          = NewView;
 | 
			
		||||
            m_Views[i]          = newView;
 | 
			
		||||
            m_ViewWrapper[i]    = new JPanel();
 | 
			
		||||
            m_ViewWrapper[i].setLayout(new BorderLayout());
 | 
			
		||||
            GridBagConstraints gbConstraints = new GridBagConstraints();
 | 
			
		||||
@@ -407,7 +439,7 @@ public class PropertySheetPanel extends JPanel implements PropertyChangeListener
 | 
			
		||||
            try {
 | 
			
		||||
                Object  args[]      = { };
 | 
			
		||||
                String  globalInfo  = (String)(meth.invoke(m_Target, args));
 | 
			
		||||
                String  summary     = globalInfo;
 | 
			
		||||
//                String  summary     = globalInfo;
 | 
			
		||||
//                int     ci          = globalInfo.indexOf('.');
 | 
			
		||||
//                if (ci != -1) {	
 | 
			
		||||
//                	// this shortens the displayed text, using only the first "sentence".
 | 
			
		||||
@@ -429,7 +461,7 @@ public class PropertySheetPanel extends JPanel implements PropertyChangeListener
 | 
			
		||||
                });
 | 
			
		||||
 | 
			
		||||
                JTextArea jt = new JTextArea();
 | 
			
		||||
                jt.setText(summary);
 | 
			
		||||
                jt.setText(globalInfo);
 | 
			
		||||
                jt.setFont(new Font("SansSerif", Font.PLAIN, rowHeight));
 | 
			
		||||
                jt.setEditable(false);
 | 
			
		||||
                jt.setLineWrap(true);
 | 
			
		||||
@@ -618,32 +650,14 @@ public class PropertySheetPanel extends JPanel implements PropertyChangeListener
 | 
			
		||||
        	m_Editors[i]    = tmpEdit;
 | 
			
		||||
        	if (tmpEdit instanceof GenericObjectEditor) ((GenericObjectEditor) tmpEdit).setClassType(m_Properties[i].getPropertyType());
 | 
			
		||||
        	m_Editors[i].setValue(newValue);
 | 
			
		||||
        	JComponent NewView = null;
 | 
			
		||||
        	if (tmpEdit instanceof sun.beans.editors.BoolEditor) {
 | 
			
		||||
        		NewView = new PropertyBoolSelector(tmpEdit);
 | 
			
		||||
        	} else {
 | 
			
		||||
        		if (tmpEdit instanceof sun.beans.editors.DoubleEditor) {
 | 
			
		||||
        			NewView = new PropertyText(tmpEdit);
 | 
			
		||||
        		} else {
 | 
			
		||||
        			if (tmpEdit.isPaintable() && tmpEdit.supportsCustomEditor()) {
 | 
			
		||||
        				NewView = new PropertyPanel(tmpEdit);
 | 
			
		||||
        			} else {
 | 
			
		||||
        				if (tmpEdit.getTags() != null ) {
 | 
			
		||||
        					NewView = new PropertyValueSelector(tmpEdit);
 | 
			
		||||
        				} else {
 | 
			
		||||
        					if (tmpEdit.getAsText() != null) {
 | 
			
		||||
        						NewView = new PropertyText(tmpEdit);
 | 
			
		||||
        					} else {
 | 
			
		||||
        						System.out.println("Warning: Property \"" + m_Properties[i].getDisplayName()
 | 
			
		||||
        								+ "\" has non-displayabale editor.  Skipping.");
 | 
			
		||||
        						return false;
 | 
			
		||||
        					}
 | 
			
		||||
        				}
 | 
			
		||||
        			}
 | 
			
		||||
        		}
 | 
			
		||||
        	JComponent newView = null;
 | 
			
		||||
        	newView = getView(tmpEdit);
 | 
			
		||||
        	if (newView==null) {
 | 
			
		||||
        		System.err.println("Warning: Property \"" + m_Properties[i].getDisplayName() + "\" has non-displayabale editor.  Skipping.");
 | 
			
		||||
        		return false;
 | 
			
		||||
        	}
 | 
			
		||||
        	m_Editors[i].addPropertyChangeListener(this);
 | 
			
		||||
        	m_Views[i] = NewView;
 | 
			
		||||
        	m_Views[i] = newView;
 | 
			
		||||
        	if (m_TipTexts[i] != null) m_Views[i].setToolTipText(m_TipTexts[i]);
 | 
			
		||||
        	m_ViewWrapper[i].removeAll();
 | 
			
		||||
        	m_ViewWrapper[i].setLayout(new BorderLayout());
 | 
			
		||||
 
 | 
			
		||||
@@ -1,68 +1,64 @@
 | 
			
		||||
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: 57 $
 | 
			
		||||
 *            $Date: 2007-05-04 14:22:16 +0200 (Fri, 04 May 2007) $
 | 
			
		||||
 *            $Author: mkron $
 | 
			
		||||
 */
 | 
			
		||||
/*==========================================================================*
 | 
			
		||||
 * IMPORTS
 | 
			
		||||
 *==========================================================================*/
 | 
			
		||||
import java.awt.*;
 | 
			
		||||
import java.awt.event.*;
 | 
			
		||||
import java.beans.*;
 | 
			
		||||
import javax.swing.*;
 | 
			
		||||
/*==========================================================================*
 | 
			
		||||
* CLASS DECLARATION
 | 
			
		||||
*==========================================================================*/
 | 
			
		||||
 | 
			
		||||
import java.awt.event.FocusAdapter;
 | 
			
		||||
import java.awt.event.FocusEvent;
 | 
			
		||||
import java.awt.event.KeyAdapter;
 | 
			
		||||
import java.awt.event.KeyEvent;
 | 
			
		||||
import java.beans.PropertyEditor;
 | 
			
		||||
 | 
			
		||||
import javax.swing.JTextField;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 *
 | 
			
		||||
 * A text property editor view. Updates the editor on key release and lost focus events.
 | 
			
		||||
 * 
 | 
			
		||||
 */
 | 
			
		||||
public class PropertyText extends JTextField {
 | 
			
		||||
  private PropertyEditor m_Editor;
 | 
			
		||||
  /**
 | 
			
		||||
   *
 | 
			
		||||
   */
 | 
			
		||||
  public PropertyText(PropertyEditor pe) {
 | 
			
		||||
    super(pe.getAsText());
 | 
			
		||||
    m_Editor = pe;
 | 
			
		||||
//    m_Editor.addPropertyChangeListener(new PropertyChangeListener() {
 | 
			
		||||
//      public void propertyChange(PropertyChangeEvent evt) {
 | 
			
		||||
//	updateUs();
 | 
			
		||||
//      }
 | 
			
		||||
//    });
 | 
			
		||||
    addKeyListener(new KeyAdapter() {
 | 
			
		||||
      public void keyReleased(KeyEvent e) {
 | 
			
		||||
        //if (e.getKeyCode() == KeyEvent.VK_ENTER)
 | 
			
		||||
	  updateEditor();
 | 
			
		||||
      }
 | 
			
		||||
    });
 | 
			
		||||
    addFocusListener(new FocusAdapter() {
 | 
			
		||||
      public void focusLost(FocusEvent e) {
 | 
			
		||||
	updateEditor();
 | 
			
		||||
      }
 | 
			
		||||
    });
 | 
			
		||||
  }
 | 
			
		||||
  /**
 | 
			
		||||
   *
 | 
			
		||||
   */
 | 
			
		||||
  public void updateUs() {
 | 
			
		||||
    try {
 | 
			
		||||
      String x = m_Editor.getAsText();
 | 
			
		||||
      setText(x);
 | 
			
		||||
    } catch (IllegalArgumentException ex) {}
 | 
			
		||||
  }
 | 
			
		||||
  /**
 | 
			
		||||
   *
 | 
			
		||||
   */
 | 
			
		||||
  protected void updateEditor() {
 | 
			
		||||
    try {
 | 
			
		||||
      String x = getText();
 | 
			
		||||
      if (!m_Editor.getAsText().equals(x)) m_Editor.setAsText(x);
 | 
			
		||||
    } catch (IllegalArgumentException ex) {}
 | 
			
		||||
  }
 | 
			
		||||
	private PropertyEditor m_Editor;
 | 
			
		||||
	/**
 | 
			
		||||
	 *
 | 
			
		||||
	 */
 | 
			
		||||
	public PropertyText(PropertyEditor pe) {
 | 
			
		||||
		super(pe.getAsText());
 | 
			
		||||
		m_Editor = pe;
 | 
			
		||||
		//    m_Editor.addPropertyChangeListener(new PropertyChangeListener() {
 | 
			
		||||
		//      public void propertyChange(PropertyChangeEvent evt) {
 | 
			
		||||
		//	updateUs();
 | 
			
		||||
		//      }
 | 
			
		||||
		//    });
 | 
			
		||||
		addKeyListener(new KeyAdapter() {
 | 
			
		||||
			public void keyReleased(KeyEvent e) {
 | 
			
		||||
				//if (e.getKeyCode() == KeyEvent.VK_ENTER)
 | 
			
		||||
				updateEditor();
 | 
			
		||||
			}
 | 
			
		||||
		});
 | 
			
		||||
		addFocusListener(new FocusAdapter() {
 | 
			
		||||
			public void focusLost(FocusEvent e) {
 | 
			
		||||
				updateEditor();
 | 
			
		||||
			}
 | 
			
		||||
		});
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 *
 | 
			
		||||
	 */
 | 
			
		||||
	protected void updateEditor() {
 | 
			
		||||
		try {
 | 
			
		||||
			String x = getText();
 | 
			
		||||
			if (!m_Editor.getAsText().equals(x)) {
 | 
			
		||||
				m_Editor.setAsText(x);
 | 
			
		||||
//				setText(m_Editor.getAsText());
 | 
			
		||||
			}
 | 
			
		||||
		} catch (IllegalArgumentException ex) {
 | 
			
		||||
//			System.err.println("Warning: Couldnt set value (PropertyText)");
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public boolean checkConsistency() {
 | 
			
		||||
		String x = getText();
 | 
			
		||||
		return x.equals(m_Editor.getAsText());
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public void updateFromEditor() {
 | 
			
		||||
		setText(m_Editor.getAsText());
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -15,6 +15,7 @@ import eva2.server.go.problems.InterfaceMultiObjectiveDeNovoProblem;
 | 
			
		||||
import eva2.server.go.problems.InterfaceOptimizationObjective;
 | 
			
		||||
import eva2.server.go.strategies.GeneticAlgorithm;
 | 
			
		||||
import eva2.server.go.strategies.InterfaceOptimizer;
 | 
			
		||||
import eva2.server.go.tools.AbstractObjectEditor;
 | 
			
		||||
import eva2.server.go.tools.GeneralGOEProperty;
 | 
			
		||||
 | 
			
		||||
import java.awt.*;
 | 
			
		||||
@@ -134,7 +135,7 @@ public class MOCCOParameterizeGDF extends MOCCOPhase implements InterfaceProcess
 | 
			
		||||
            if (this.m_EOpt.m_Editor instanceof GenericObjectEditor)
 | 
			
		||||
                ((GenericObjectEditor) this.m_EOpt.m_Editor).setClassType(InterfaceOptimizer.class);
 | 
			
		||||
            this.m_EOpt.m_Editor.setValue(this.m_EOpt.m_Value);
 | 
			
		||||
            this.findViewFor(this.m_EOpt);
 | 
			
		||||
            AbstractObjectEditor.findViewFor(this.m_EOpt);
 | 
			
		||||
            if (this.m_EOpt.m_View != null) this.m_EOpt.m_View.repaint();
 | 
			
		||||
        } catch (Exception e) {
 | 
			
		||||
            System.out.println("Darn can't read the value...");
 | 
			
		||||
@@ -157,7 +158,7 @@ public class MOCCOParameterizeGDF extends MOCCOPhase implements InterfaceProcess
 | 
			
		||||
            if (editor.m_Editor instanceof GenericObjectEditor)
 | 
			
		||||
                ((GenericObjectEditor) editor.m_Editor).setClassType(InterfaceTerminator.class);
 | 
			
		||||
            editor.m_Editor.setValue(editor.m_Value);
 | 
			
		||||
            this.findViewFor(editor);
 | 
			
		||||
            AbstractObjectEditor.findViewFor(editor);
 | 
			
		||||
            if (editor.m_View != null) editor.m_View.repaint();
 | 
			
		||||
        } catch (Exception e) {
 | 
			
		||||
            System.out.println("Darn can't read the value...");
 | 
			
		||||
 
 | 
			
		||||
@@ -11,6 +11,7 @@ import eva2.server.go.populations.Population;
 | 
			
		||||
import eva2.server.go.strategies.GeneticAlgorithm;
 | 
			
		||||
import eva2.server.go.strategies.InterfaceOptimizer;
 | 
			
		||||
import eva2.server.go.strategies.MultiObjectiveEA;
 | 
			
		||||
import eva2.server.go.tools.AbstractObjectEditor;
 | 
			
		||||
import eva2.server.go.tools.GeneralGOEProperty;
 | 
			
		||||
 | 
			
		||||
import java.awt.*;
 | 
			
		||||
@@ -91,7 +92,7 @@ public class MOCCOParameterizeMO extends MOCCOPhase implements InterfaceProcessE
 | 
			
		||||
            if (editor.m_Editor instanceof GenericObjectEditor)
 | 
			
		||||
                ((GenericObjectEditor) editor.m_Editor).setClassType(InterfaceOptimizer.class);
 | 
			
		||||
            editor.m_Editor.setValue(editor.m_Value);
 | 
			
		||||
            this.findViewFor(editor);
 | 
			
		||||
            AbstractObjectEditor.findViewFor(editor);
 | 
			
		||||
            if (editor.m_View != null) editor.m_View.repaint();
 | 
			
		||||
        } catch (Exception e) {
 | 
			
		||||
            System.out.println("Darn can't read the value...");
 | 
			
		||||
@@ -114,7 +115,7 @@ public class MOCCOParameterizeMO extends MOCCOPhase implements InterfaceProcessE
 | 
			
		||||
            if (editor.m_Editor instanceof GenericObjectEditor)
 | 
			
		||||
                ((GenericObjectEditor) editor.m_Editor).setClassType(InterfaceTerminator.class);
 | 
			
		||||
            editor.m_Editor.setValue(editor.m_Value);
 | 
			
		||||
            this.findViewFor(editor);
 | 
			
		||||
            AbstractObjectEditor.findViewFor(editor);
 | 
			
		||||
            if (editor.m_View != null) editor.m_View.repaint();
 | 
			
		||||
        } catch (Exception e) {
 | 
			
		||||
            System.out.println("Darn can't read the value...");
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,16 @@
 | 
			
		||||
package eva2.server.go.mocco;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
import javax.swing.*;
 | 
			
		||||
import java.awt.BorderLayout;
 | 
			
		||||
import java.awt.GridBagConstraints;
 | 
			
		||||
import java.awt.GridBagLayout;
 | 
			
		||||
import java.awt.event.ActionEvent;
 | 
			
		||||
import java.awt.event.ActionListener;
 | 
			
		||||
 | 
			
		||||
import javax.swing.JButton;
 | 
			
		||||
import javax.swing.JLabel;
 | 
			
		||||
import javax.swing.JPanel;
 | 
			
		||||
import javax.swing.JTextField;
 | 
			
		||||
 | 
			
		||||
import eva2.gui.GenericObjectEditor;
 | 
			
		||||
import eva2.gui.PropertyEditorProvider;
 | 
			
		||||
@@ -12,13 +21,10 @@ import eva2.server.go.operators.migration.SOBestMigration;
 | 
			
		||||
import eva2.server.go.operators.moso.MOSOLpMetric;
 | 
			
		||||
import eva2.server.go.problems.AbstractMultiObjectiveOptimizationProblem;
 | 
			
		||||
import eva2.server.go.strategies.IslandModelEA;
 | 
			
		||||
import eva2.server.go.tools.AbstractObjectEditor;
 | 
			
		||||
import eva2.server.go.tools.GeneralGOEProperty;
 | 
			
		||||
import eva2.tools.math.RNG;
 | 
			
		||||
 | 
			
		||||
import java.awt.*;
 | 
			
		||||
import java.awt.event.ActionListener;
 | 
			
		||||
import java.awt.event.ActionEvent;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Created by IntelliJ IDEA.
 | 
			
		||||
 * User: streiche
 | 
			
		||||
@@ -110,7 +116,7 @@ public class MOCCOParameterizeRefPoint extends MOCCOPhase implements InterfacePr
 | 
			
		||||
            if (this.m_EMOSO.m_Editor instanceof GenericObjectEditor)
 | 
			
		||||
                ((GenericObjectEditor) this.m_EMOSO.m_Editor).setClassType(MOSOLpMetric.class);
 | 
			
		||||
            this.m_EMOSO.m_Editor.setValue(this.m_EMOSO.m_Value);
 | 
			
		||||
            this.findViewFor(this.m_EMOSO);
 | 
			
		||||
            AbstractObjectEditor.findViewFor(this.m_EMOSO);
 | 
			
		||||
            if (this.m_EMOSO.m_View != null) this.m_EMOSO.m_View.repaint();
 | 
			
		||||
        } catch (Exception e) {
 | 
			
		||||
            System.out.println("Darn can't read the value...");
 | 
			
		||||
@@ -141,7 +147,7 @@ public class MOCCOParameterizeRefPoint extends MOCCOPhase implements InterfacePr
 | 
			
		||||
            if (this.m_EIMEA.m_Editor instanceof GenericObjectEditor)
 | 
			
		||||
                ((GenericObjectEditor) this.m_EIMEA.m_Editor).setClassType(IslandModelEA.class);
 | 
			
		||||
            this.m_EIMEA.m_Editor.setValue(this.m_EIMEA.m_Value);
 | 
			
		||||
            this.findViewFor(this.m_EIMEA);
 | 
			
		||||
            AbstractObjectEditor.findViewFor(this.m_EIMEA);
 | 
			
		||||
            if (this.m_EIMEA.m_View != null) this.m_EIMEA.m_View.repaint();
 | 
			
		||||
        } catch (Exception e) {
 | 
			
		||||
            System.out.println("Darn can't read the value...");
 | 
			
		||||
@@ -164,7 +170,7 @@ public class MOCCOParameterizeRefPoint extends MOCCOPhase implements InterfacePr
 | 
			
		||||
            if (editor.m_Editor instanceof GenericObjectEditor)
 | 
			
		||||
                ((GenericObjectEditor) editor.m_Editor).setClassType(InterfaceTerminator.class);
 | 
			
		||||
            editor.m_Editor.setValue(editor.m_Value);
 | 
			
		||||
            this.findViewFor(editor);
 | 
			
		||||
            AbstractObjectEditor.findViewFor(editor);
 | 
			
		||||
            if (editor.m_View != null) editor.m_View.repaint();
 | 
			
		||||
        } catch (Exception e) {
 | 
			
		||||
            System.out.println("Darn can't read the value...");
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,16 @@
 | 
			
		||||
package eva2.server.go.mocco;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
import javax.swing.*;
 | 
			
		||||
import java.awt.BorderLayout;
 | 
			
		||||
import java.awt.GridBagConstraints;
 | 
			
		||||
import java.awt.GridBagLayout;
 | 
			
		||||
import java.awt.event.ActionEvent;
 | 
			
		||||
import java.awt.event.ActionListener;
 | 
			
		||||
 | 
			
		||||
import javax.swing.JButton;
 | 
			
		||||
import javax.swing.JLabel;
 | 
			
		||||
import javax.swing.JOptionPane;
 | 
			
		||||
import javax.swing.JPanel;
 | 
			
		||||
 | 
			
		||||
import eva2.gui.GenericObjectEditor;
 | 
			
		||||
import eva2.gui.PropertyEditorProvider;
 | 
			
		||||
@@ -10,12 +19,9 @@ import eva2.server.go.MOCCOStandalone;
 | 
			
		||||
import eva2.server.go.strategies.GeneticAlgorithm;
 | 
			
		||||
import eva2.server.go.strategies.InterfaceOptimizer;
 | 
			
		||||
import eva2.server.go.strategies.MultiObjectiveEA;
 | 
			
		||||
import eva2.server.go.tools.AbstractObjectEditor;
 | 
			
		||||
import eva2.server.go.tools.GeneralGOEProperty;
 | 
			
		||||
 | 
			
		||||
import java.awt.*;
 | 
			
		||||
import java.awt.event.ActionListener;
 | 
			
		||||
import java.awt.event.ActionEvent;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Created by IntelliJ IDEA.
 | 
			
		||||
 * User: streiche
 | 
			
		||||
@@ -79,7 +85,7 @@ public class MOCCOParameterizeSO extends MOCCOPhase implements InterfaceProcessE
 | 
			
		||||
            if (editor.m_Editor instanceof GenericObjectEditor)
 | 
			
		||||
                ((GenericObjectEditor) editor.m_Editor).setClassType(InterfaceOptimizer.class);
 | 
			
		||||
            editor.m_Editor.setValue(editor.m_Value);
 | 
			
		||||
            this.findViewFor(editor);
 | 
			
		||||
            AbstractObjectEditor.findViewFor(editor);
 | 
			
		||||
            if (editor.m_View != null) editor.m_View.repaint();
 | 
			
		||||
        } catch (Exception e) {
 | 
			
		||||
            System.out.println("Darn can't read the value...");
 | 
			
		||||
@@ -102,7 +108,7 @@ public class MOCCOParameterizeSO extends MOCCOPhase implements InterfaceProcessE
 | 
			
		||||
            if (editor.m_Editor instanceof GenericObjectEditor)
 | 
			
		||||
                ((GenericObjectEditor) editor.m_Editor).setClassType(InterfaceTerminator.class);
 | 
			
		||||
            editor.m_Editor.setValue(editor.m_Value);
 | 
			
		||||
            this.findViewFor(editor);
 | 
			
		||||
            AbstractObjectEditor.findViewFor(editor);
 | 
			
		||||
            if (editor.m_View != null) editor.m_View.repaint();
 | 
			
		||||
        } catch (Exception e) {
 | 
			
		||||
            System.out.println("Darn can't read the value...");
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,19 @@
 | 
			
		||||
package eva2.server.go.mocco;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
import javax.swing.*;
 | 
			
		||||
import java.awt.BorderLayout;
 | 
			
		||||
import java.awt.GridBagConstraints;
 | 
			
		||||
import java.awt.GridBagLayout;
 | 
			
		||||
import java.awt.event.ActionEvent;
 | 
			
		||||
import java.awt.event.ActionListener;
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
 | 
			
		||||
import javax.swing.BorderFactory;
 | 
			
		||||
import javax.swing.JButton;
 | 
			
		||||
import javax.swing.JCheckBox;
 | 
			
		||||
import javax.swing.JLabel;
 | 
			
		||||
import javax.swing.JPanel;
 | 
			
		||||
import javax.swing.JTextField;
 | 
			
		||||
 | 
			
		||||
import eva2.gui.GenericObjectEditor;
 | 
			
		||||
import eva2.gui.PropertyDoubleArray;
 | 
			
		||||
@@ -15,13 +27,9 @@ import eva2.server.go.problems.InterfaceMultiObjectiveDeNovoProblem;
 | 
			
		||||
import eva2.server.go.problems.InterfaceOptimizationObjective;
 | 
			
		||||
import eva2.server.go.strategies.GeneticAlgorithm;
 | 
			
		||||
import eva2.server.go.strategies.InterfaceOptimizer;
 | 
			
		||||
import eva2.server.go.tools.AbstractObjectEditor;
 | 
			
		||||
import eva2.server.go.tools.GeneralGOEProperty;
 | 
			
		||||
 | 
			
		||||
import java.awt.*;
 | 
			
		||||
import java.awt.event.ActionListener;
 | 
			
		||||
import java.awt.event.ActionEvent;
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Created by IntelliJ IDEA.
 | 
			
		||||
 * User: streiche
 | 
			
		||||
@@ -169,7 +177,7 @@ public class MOCCOParameterizeSTEP extends MOCCOPhase implements InterfaceProces
 | 
			
		||||
            if (this.m_EOpt.m_Editor instanceof GenericObjectEditor)
 | 
			
		||||
                ((GenericObjectEditor) this.m_EOpt.m_Editor).setClassType(InterfaceOptimizer.class);
 | 
			
		||||
            this.m_EOpt.m_Editor.setValue(this.m_EOpt.m_Value);
 | 
			
		||||
            this.findViewFor(this.m_EOpt);
 | 
			
		||||
            AbstractObjectEditor.findViewFor(this.m_EOpt);
 | 
			
		||||
            if (this.m_EOpt.m_View != null) this.m_EOpt.m_View.repaint();
 | 
			
		||||
        } catch (Exception e) {
 | 
			
		||||
            System.out.println("Darn can't read the value...");
 | 
			
		||||
@@ -192,7 +200,7 @@ public class MOCCOParameterizeSTEP extends MOCCOPhase implements InterfaceProces
 | 
			
		||||
            if (editor.m_Editor instanceof GenericObjectEditor)
 | 
			
		||||
                ((GenericObjectEditor) editor.m_Editor).setClassType(InterfaceTerminator.class);
 | 
			
		||||
            editor.m_Editor.setValue(editor.m_Value);
 | 
			
		||||
            this.findViewFor(editor);
 | 
			
		||||
            AbstractObjectEditor.findViewFor(editor);
 | 
			
		||||
            if (editor.m_View != null) editor.m_View.repaint();
 | 
			
		||||
        } catch (Exception e) {
 | 
			
		||||
            System.out.println("Darn can't read the value...");
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,18 @@
 | 
			
		||||
package eva2.server.go.mocco;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
import javax.swing.*;
 | 
			
		||||
import java.awt.BorderLayout;
 | 
			
		||||
import java.awt.GridBagConstraints;
 | 
			
		||||
import java.awt.GridBagLayout;
 | 
			
		||||
import java.awt.event.ActionEvent;
 | 
			
		||||
import java.awt.event.ActionListener;
 | 
			
		||||
 | 
			
		||||
import javax.swing.BorderFactory;
 | 
			
		||||
import javax.swing.JButton;
 | 
			
		||||
import javax.swing.JComponent;
 | 
			
		||||
import javax.swing.JLabel;
 | 
			
		||||
import javax.swing.JPanel;
 | 
			
		||||
import javax.swing.JTextField;
 | 
			
		||||
 | 
			
		||||
import eva2.gui.GenericObjectEditor;
 | 
			
		||||
import eva2.gui.PropertyEditorProvider;
 | 
			
		||||
@@ -12,13 +23,10 @@ import eva2.server.go.operators.migration.SOBestMigration;
 | 
			
		||||
import eva2.server.go.operators.moso.MOSOWeightedLPTchebycheff;
 | 
			
		||||
import eva2.server.go.problems.AbstractMultiObjectiveOptimizationProblem;
 | 
			
		||||
import eva2.server.go.strategies.IslandModelEA;
 | 
			
		||||
import eva2.server.go.tools.AbstractObjectEditor;
 | 
			
		||||
import eva2.server.go.tools.GeneralGOEProperty;
 | 
			
		||||
import eva2.tools.math.RNG;
 | 
			
		||||
 | 
			
		||||
import java.awt.*;
 | 
			
		||||
import java.awt.event.ActionListener;
 | 
			
		||||
import java.awt.event.ActionEvent;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Created by IntelliJ IDEA.
 | 
			
		||||
 * User: streiche
 | 
			
		||||
@@ -116,7 +124,7 @@ public class MOCCOParameterizeTchebycheff extends MOCCOPhase implements Interfac
 | 
			
		||||
            if (this.m_EIMEA.m_Editor instanceof GenericObjectEditor)
 | 
			
		||||
                ((GenericObjectEditor) this.m_EIMEA.m_Editor).setClassType(IslandModelEA.class);
 | 
			
		||||
            this.m_EIMEA.m_Editor.setValue(this.m_EIMEA.m_Value);
 | 
			
		||||
            this.findViewFor(this.m_EIMEA);
 | 
			
		||||
            AbstractObjectEditor.findViewFor(this.m_EIMEA);
 | 
			
		||||
            if (this.m_EIMEA.m_View != null) this.m_EIMEA.m_View.repaint();
 | 
			
		||||
        } catch (Exception e) {
 | 
			
		||||
            System.out.println("Darn can't read the value...");
 | 
			
		||||
@@ -139,7 +147,7 @@ public class MOCCOParameterizeTchebycheff extends MOCCOPhase implements Interfac
 | 
			
		||||
            if (editor.m_Editor instanceof GenericObjectEditor)
 | 
			
		||||
                ((GenericObjectEditor) editor.m_Editor).setClassType(InterfaceTerminator.class);
 | 
			
		||||
            editor.m_Editor.setValue(editor.m_Value);
 | 
			
		||||
            this.findViewFor(editor);
 | 
			
		||||
            AbstractObjectEditor.findViewFor(editor);
 | 
			
		||||
            if (editor.m_View != null) editor.m_View.repaint();
 | 
			
		||||
        } catch (Exception e) {
 | 
			
		||||
            System.out.println("Darn can't read the value...");
 | 
			
		||||
 
 | 
			
		||||
@@ -76,34 +76,6 @@ public abstract class MOCCOPhase implements InterfaceProcessElement {
 | 
			
		||||
//        return classes;
 | 
			
		||||
//    }
 | 
			
		||||
 | 
			
		||||
    /** Find a proper property editor for a given GeneralGOEProperty
 | 
			
		||||
      * @param editor   The object to search the visualization for.
 | 
			
		||||
     */
 | 
			
		||||
    public void findViewFor(GeneralGOEProperty editor) {
 | 
			
		||||
        if (editor.m_Editor instanceof sun.beans.editors.BoolEditor) {
 | 
			
		||||
            editor.m_View = new PropertyBoolSelector(editor.m_Editor);
 | 
			
		||||
        } else {
 | 
			
		||||
            if (editor.m_Editor instanceof sun.beans.editors.DoubleEditor) {
 | 
			
		||||
                editor.m_View = new PropertyText(editor.m_Editor);
 | 
			
		||||
            } else {
 | 
			
		||||
                if (editor.m_Editor.isPaintable() && editor.m_Editor.supportsCustomEditor()) {
 | 
			
		||||
                    editor.m_View = new PropertyPanel(editor.m_Editor);
 | 
			
		||||
                } else {
 | 
			
		||||
                    if (editor.m_Editor.getTags() != null ) {
 | 
			
		||||
                        editor.m_View = new PropertyValueSelector(editor.m_Editor);
 | 
			
		||||
                    } else {
 | 
			
		||||
                        if (editor.m_Editor.getAsText() != null) {
 | 
			
		||||
                            editor.m_View = new PropertyText(editor.m_Editor);
 | 
			
		||||
                        } else {
 | 
			
		||||
                            System.out.println("Warning: Property \"" + editor.m_Name
 | 
			
		||||
                                 + "\" has non-displayabale editor.  Skipping.");
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /** This method makes a helptext element similar to that used in EvA
 | 
			
		||||
     * @param help  The text to display
 | 
			
		||||
     * @return the helptext component
 | 
			
		||||
 
 | 
			
		||||
@@ -1,20 +1,44 @@
 | 
			
		||||
package eva2.server.go.operators.crossover;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
import javax.swing.*;
 | 
			
		||||
import java.awt.BorderLayout;
 | 
			
		||||
import java.awt.Component;
 | 
			
		||||
import java.awt.Dimension;
 | 
			
		||||
import java.awt.Font;
 | 
			
		||||
import java.awt.FontMetrics;
 | 
			
		||||
import java.awt.Graphics;
 | 
			
		||||
import java.awt.GridBagConstraints;
 | 
			
		||||
import java.awt.GridBagLayout;
 | 
			
		||||
import java.awt.GridLayout;
 | 
			
		||||
import java.awt.Rectangle;
 | 
			
		||||
import java.awt.Toolkit;
 | 
			
		||||
import java.awt.event.ActionEvent;
 | 
			
		||||
import java.awt.event.ActionListener;
 | 
			
		||||
import java.awt.event.KeyEvent;
 | 
			
		||||
import java.awt.event.KeyListener;
 | 
			
		||||
import java.beans.PropertyChangeEvent;
 | 
			
		||||
import java.beans.PropertyChangeListener;
 | 
			
		||||
import java.beans.PropertyChangeSupport;
 | 
			
		||||
import java.beans.PropertyEditor;
 | 
			
		||||
 | 
			
		||||
import eva2.gui.*;
 | 
			
		||||
import javax.swing.BorderFactory;
 | 
			
		||||
import javax.swing.ImageIcon;
 | 
			
		||||
import javax.swing.JButton;
 | 
			
		||||
import javax.swing.JComponent;
 | 
			
		||||
import javax.swing.JLabel;
 | 
			
		||||
import javax.swing.JPanel;
 | 
			
		||||
import javax.swing.JScrollPane;
 | 
			
		||||
import javax.swing.JTextArea;
 | 
			
		||||
import javax.swing.JTextField;
 | 
			
		||||
import javax.swing.SwingConstants;
 | 
			
		||||
 | 
			
		||||
import eva2.gui.GenericObjectEditor;
 | 
			
		||||
import eva2.gui.PropertyEditorProvider;
 | 
			
		||||
import eva2.server.go.tools.AbstractObjectEditor;
 | 
			
		||||
import eva2.server.go.tools.GeneralGEOFaker;
 | 
			
		||||
import eva2.server.go.tools.GeneralGOEProperty;
 | 
			
		||||
import eva2.tools.BasicResourceLoader;
 | 
			
		||||
 | 
			
		||||
import java.beans.*;
 | 
			
		||||
import java.awt.*;
 | 
			
		||||
import java.awt.event.ActionListener;
 | 
			
		||||
import java.awt.event.ActionEvent;
 | 
			
		||||
import java.awt.event.KeyListener;
 | 
			
		||||
import java.awt.event.KeyEvent;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Created by IntelliJ IDEA.
 | 
			
		||||
@@ -69,7 +93,7 @@ public class PropertyCrossoverMixerEditor extends JPanel implements PropertyEdit
 | 
			
		||||
                    ((GenericObjectEditor) this.m_Editors[i].m_Editor).setClassType(InterfaceCrossover.class);
 | 
			
		||||
                this.m_Editors[i].m_Editor.setValue(this.m_Editors[i].m_Value);
 | 
			
		||||
                this.m_Editors[i].m_Editor.addPropertyChangeListener(this);
 | 
			
		||||
                this.findViewFor(this.m_Editors[i]);
 | 
			
		||||
                AbstractObjectEditor.findViewFor(this.m_Editors[i]);
 | 
			
		||||
                if (this.m_Editors[i].m_View != null) this.m_Editors[i].m_View.repaint();
 | 
			
		||||
            } catch (Exception e) {
 | 
			
		||||
                System.out.println("Darn can't read the value...");
 | 
			
		||||
@@ -229,7 +253,7 @@ public class PropertyCrossoverMixerEditor extends JPanel implements PropertyEdit
 | 
			
		||||
                    ((GenericObjectEditor) newEdit[l].m_Editor).setClassType(InterfaceCrossover.class);
 | 
			
		||||
                newEdit[l].m_Editor.setValue(newEdit[l].m_Value);
 | 
			
		||||
                newEdit[l].m_Editor.addPropertyChangeListener(m_self);
 | 
			
		||||
                findViewFor(newEdit[l]);
 | 
			
		||||
                AbstractObjectEditor.findViewFor(newEdit[l]);
 | 
			
		||||
                if (newEdit[l].m_View != null) newEdit[l].m_View.repaint();
 | 
			
		||||
            } catch (Exception e) {
 | 
			
		||||
                System.out.println("Darn can't read the value...");
 | 
			
		||||
@@ -404,31 +428,6 @@ public class PropertyCrossoverMixerEditor extends JPanel implements PropertyEdit
 | 
			
		||||
        this.updateEditor();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void findViewFor(GeneralGOEProperty editor) {
 | 
			
		||||
        if (editor.m_Editor instanceof sun.beans.editors.BoolEditor) {
 | 
			
		||||
            editor.m_View = new PropertyBoolSelector(editor.m_Editor);
 | 
			
		||||
        } else {
 | 
			
		||||
            if (editor.m_Editor instanceof sun.beans.editors.DoubleEditor) {
 | 
			
		||||
                editor.m_View = new PropertyText(editor.m_Editor);
 | 
			
		||||
            } else {
 | 
			
		||||
                if (editor.m_Editor.isPaintable() && editor.m_Editor.supportsCustomEditor()) {
 | 
			
		||||
                    editor.m_View = new PropertyPanel(editor.m_Editor);
 | 
			
		||||
                } else {
 | 
			
		||||
                    if (editor.m_Editor.getTags() != null ) {
 | 
			
		||||
                        editor.m_View = new PropertyValueSelector(editor.m_Editor);
 | 
			
		||||
                    } else {
 | 
			
		||||
                        if (editor.m_Editor.getAsText() != null) {
 | 
			
		||||
                            editor.m_View = new PropertyText(editor.m_Editor);
 | 
			
		||||
                        } else {
 | 
			
		||||
                            System.out.println("Warning: Property \"" + editor.m_Name
 | 
			
		||||
                                 + "\" has non-displayabale editor.  Skipping.");
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /********************************* java.beans.PropertyChangeListener *************************/
 | 
			
		||||
 | 
			
		||||
    public void addPropertyChangeListener(PropertyChangeListener l) {
 | 
			
		||||
@@ -458,7 +457,7 @@ public class PropertyCrossoverMixerEditor extends JPanel implements PropertyEdit
 | 
			
		||||
                        ((GenericObjectEditor) this.m_Editors[i].m_Editor).setClassType(InterfaceCrossover.class);
 | 
			
		||||
                    this.m_Editors[i].m_Editor.setValue(this.m_Editors[i].m_Value);
 | 
			
		||||
                    this.m_Editors[i].m_Editor.addPropertyChangeListener(this);
 | 
			
		||||
                    this.findViewFor(this.m_Editors[i]);
 | 
			
		||||
                    AbstractObjectEditor.findViewFor(this.m_Editors[i]);
 | 
			
		||||
                    if (this.m_Editors[i].m_View != null) this.m_Editors[i].m_View.repaint();
 | 
			
		||||
                } catch (Exception e) {
 | 
			
		||||
                    System.out.println("Darn can't read the value...");
 | 
			
		||||
 
 | 
			
		||||
@@ -3,6 +3,7 @@ package eva2.server.go.operators.mutation;
 | 
			
		||||
import javax.swing.*;
 | 
			
		||||
 | 
			
		||||
import eva2.gui.*;
 | 
			
		||||
import eva2.server.go.tools.AbstractObjectEditor;
 | 
			
		||||
import eva2.server.go.tools.GeneralGEOFaker;
 | 
			
		||||
import eva2.server.go.tools.GeneralGOEProperty;
 | 
			
		||||
import eva2.tools.BasicResourceLoader;
 | 
			
		||||
@@ -67,7 +68,7 @@ public class PropertyMutationMixerEditor extends JPanel implements PropertyEdito
 | 
			
		||||
                    ((GenericObjectEditor) this.m_Editors[i].m_Editor).setClassType(InterfaceMutation.class);
 | 
			
		||||
                this.m_Editors[i].m_Editor.setValue(this.m_Editors[i].m_Value);
 | 
			
		||||
                this.m_Editors[i].m_Editor.addPropertyChangeListener(this);
 | 
			
		||||
                this.findViewFor(this.m_Editors[i]);
 | 
			
		||||
                AbstractObjectEditor.findViewFor(this.m_Editors[i]);
 | 
			
		||||
                if (this.m_Editors[i].m_View != null) this.m_Editors[i].m_View.repaint();
 | 
			
		||||
            } catch (Exception e) {
 | 
			
		||||
                System.out.println("Darn can't read the value...");
 | 
			
		||||
@@ -227,7 +228,7 @@ public class PropertyMutationMixerEditor extends JPanel implements PropertyEdito
 | 
			
		||||
                    ((GenericObjectEditor) newEdit[l].m_Editor).setClassType(InterfaceMutation.class);
 | 
			
		||||
                newEdit[l].m_Editor.setValue(newEdit[l].m_Value);
 | 
			
		||||
                newEdit[l].m_Editor.addPropertyChangeListener(m_self);
 | 
			
		||||
                findViewFor(newEdit[l]);
 | 
			
		||||
                AbstractObjectEditor.findViewFor(newEdit[l]);
 | 
			
		||||
                if (newEdit[l].m_View != null) newEdit[l].m_View.repaint();
 | 
			
		||||
            } catch (Exception e) {
 | 
			
		||||
                System.out.println("Darn can't read the value...");
 | 
			
		||||
@@ -402,31 +403,6 @@ public class PropertyMutationMixerEditor extends JPanel implements PropertyEdito
 | 
			
		||||
        this.updateEditor();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void findViewFor(GeneralGOEProperty editor) {
 | 
			
		||||
        if (editor.m_Editor instanceof sun.beans.editors.BoolEditor) {
 | 
			
		||||
            editor.m_View = new PropertyBoolSelector(editor.m_Editor);
 | 
			
		||||
        } else {
 | 
			
		||||
            if (editor.m_Editor instanceof sun.beans.editors.DoubleEditor) {
 | 
			
		||||
                editor.m_View = new PropertyText(editor.m_Editor);
 | 
			
		||||
            } else {
 | 
			
		||||
                if (editor.m_Editor.isPaintable() && editor.m_Editor.supportsCustomEditor()) {
 | 
			
		||||
                    editor.m_View = new PropertyPanel(editor.m_Editor);
 | 
			
		||||
                } else {
 | 
			
		||||
                    if (editor.m_Editor.getTags() != null ) {
 | 
			
		||||
                        editor.m_View = new PropertyValueSelector(editor.m_Editor);
 | 
			
		||||
                    } else {
 | 
			
		||||
                        if (editor.m_Editor.getAsText() != null) {
 | 
			
		||||
                            editor.m_View = new PropertyText(editor.m_Editor);
 | 
			
		||||
                        } else {
 | 
			
		||||
                            System.out.println("Warning: Property \"" + editor.m_Name
 | 
			
		||||
                                 + "\" has non-displayabale editor.  Skipping.");
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /********************************* java.beans.PropertyChangeListener *************************/
 | 
			
		||||
 | 
			
		||||
    public void addPropertyChangeListener(PropertyChangeListener l) {
 | 
			
		||||
@@ -456,7 +432,7 @@ public class PropertyMutationMixerEditor extends JPanel implements PropertyEdito
 | 
			
		||||
                        ((GenericObjectEditor) this.m_Editors[i].m_Editor).setClassType(InterfaceMutation.class);
 | 
			
		||||
                    this.m_Editors[i].m_Editor.setValue(this.m_Editors[i].m_Value);
 | 
			
		||||
                    this.m_Editors[i].m_Editor.addPropertyChangeListener(this);
 | 
			
		||||
                    this.findViewFor(this.m_Editors[i]);
 | 
			
		||||
                    AbstractObjectEditor.findViewFor(this.m_Editors[i]);
 | 
			
		||||
                    if (this.m_Editors[i].m_View != null) this.m_Editors[i].m_View.repaint();
 | 
			
		||||
                } catch (Exception e) {
 | 
			
		||||
                    System.out.println("Darn can't read the value...");
 | 
			
		||||
 
 | 
			
		||||
@@ -283,28 +283,9 @@ public abstract class AbstractObjectEditor implements PropertyEditor, java.beans
 | 
			
		||||
    /** This method tries to find a suitable view for a given Property
 | 
			
		||||
     * @param editor    The property the select a view for.
 | 
			
		||||
     */
 | 
			
		||||
    public void findViewFor(GeneralGOEProperty editor) {
 | 
			
		||||
        if (editor.m_Editor instanceof sun.beans.editors.BoolEditor) {
 | 
			
		||||
            editor.m_View = new PropertyBoolSelector(editor.m_Editor);
 | 
			
		||||
        } else {
 | 
			
		||||
            if (editor.m_Editor instanceof sun.beans.editors.DoubleEditor) {
 | 
			
		||||
                editor.m_View = new PropertyText(editor.m_Editor);
 | 
			
		||||
            } else {
 | 
			
		||||
                if (editor.m_Editor.isPaintable() && editor.m_Editor.supportsCustomEditor()) {
 | 
			
		||||
                    editor.m_View = new PropertyPanel(editor.m_Editor);
 | 
			
		||||
                } else {
 | 
			
		||||
                    if (editor.m_Editor.getTags() != null ) {
 | 
			
		||||
                        editor.m_View = new PropertyValueSelector(editor.m_Editor);
 | 
			
		||||
                    } else {
 | 
			
		||||
                        if (editor.m_Editor.getAsText() != null) {
 | 
			
		||||
                            editor.m_View = new PropertyText(editor.m_Editor);
 | 
			
		||||
                        } else {
 | 
			
		||||
                            System.out.println("Warning: Property \"" + editor.m_Name
 | 
			
		||||
    public static void findViewFor(GeneralGOEProperty editor) {
 | 
			
		||||
    	editor.m_View = PropertySheetPanel.getView(editor.m_Editor);
 | 
			
		||||
    	if (editor.m_View==null) System.out.println("Warning: Property \"" + editor.m_Name
 | 
			
		||||
                                 + "\" has non-displayabale editor.  Skipping.");
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user