cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r415128 [2/2] - in /incubator/cayenne/soc/trunk/cayenne-rop/rop-browser: ./ META-INF/ cayenne/ dist/ icons/ lib/ lib/server/ src/ src/org/ src/org/apache/ src/org/apache/cayenne/ src/org/apache/cayenne/ropbrowser/ src/org/apache/cayenne/rop...
Date Sun, 18 Jun 2006 12:49:50 GMT
Added: incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/model/ModelElement.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/model/ModelElement.java?rev=415128&view=auto
==============================================================================
--- incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/model/ModelElement.java (added)
+++ incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/model/ModelElement.java Sun Jun 18 05:49:47 2006
@@ -0,0 +1,162 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2005 Elias Volanakis and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *    Elias Volanakis - initial API and implementation
+ *******************************************************************************/
+package org.apache.cayenne.ropbrowser.model;
+
+import java.beans.PropertyChangeListener;
+import java.beans.PropertyChangeSupport;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.ui.views.properties.IPropertyDescriptor;
+import org.eclipse.ui.views.properties.IPropertySource;
+import org.objectstyle.cayenne.PersistentObject;
+
+/**
+ * Adapted from org.eclipse.gef.examples.shapes
+ * Abstract prototype of a model element.
+ * <p>This class provides features necessary for all model elements, like:</p>
+ * <ul>
+ * <li>property-change support (used to notify edit parts of model changes),</li> 
+ * <li>property-source support (used to display property values in the Property View) and</li>
+ * </ul>
+ */
+public abstract class ModelElement implements IPropertySource {
+	
+	public static final String PROP_TRANSIENT = "ModelElement.transient";
+	public static final String PROP_SOURCE_CONN = "ModelElement.sourceConnection";
+	public static final String PROP_TARGET_CONN = "ModelElement.targetConnection";
+	protected int x = 0;
+	protected int y = 0;
+	protected int height;
+	protected int width;
+	
+	protected List<Connection> sourceConnections = new ArrayList<Connection>();
+	protected List<Connection> targetConnections = new ArrayList<Connection>();
+	
+	/** Delegate used to implemenent property-change-support. */
+	private transient PropertyChangeSupport pcsDelegate = new PropertyChangeSupport(this);
+	
+	public List getSourceConnections() {
+		return new ArrayList<Connection>(sourceConnections);
+	}
+
+	public List getTargetConnections() {
+		return new ArrayList<Connection>(targetConnections);
+	}
+	
+	public void addConnection(Connection conn) {
+		if (conn == null || conn.getSource() == conn.getTarget()) {
+			throw new IllegalArgumentException();
+		}
+		if (conn.getSource() == this) {
+			if (!sourceConnections.contains(conn)) {
+				sourceConnections.add(conn);
+				firePropertyChange(PROP_SOURCE_CONN, null, conn);
+			}
+		} else if (conn.getTarget() == this) {
+			if (!targetConnections.contains(conn)) {
+				targetConnections.add(conn);
+				firePropertyChange(PROP_TARGET_CONN, null, conn);
+			}
+		}
+	}
+
+	public int getX() {
+		return x;
+	}
+
+	public int getY() {
+		return y;
+	}
+
+	public int getWidth() {
+		return width;
+	}
+
+	public int getHeight() {
+		return height;
+	}
+	
+	/** 
+	 * Attach a non-null PropertyChangeListener to this object.
+	 * @param l a non-null PropertyChangeListener instance
+	 * @throws IllegalArgumentException if the parameter is null
+	 */
+	public synchronized void addPropertyChangeListener(PropertyChangeListener l) {
+		if (l == null) {
+			throw new IllegalArgumentException();
+		}
+		pcsDelegate.addPropertyChangeListener(l);
+	}
+	
+	/** 
+	 * Report a property change to registered listeners (for example edit parts).
+	 * @param property the programmatic name of the property that changed
+	 * @param oldValue the old value of this property
+	 * @param newValue the new value of this property
+	 */
+	protected void firePropertyChange(String property, Object oldValue, Object newValue) {
+		if (pcsDelegate.hasListeners(property)) {
+			pcsDelegate.firePropertyChange(property, oldValue, newValue);
+		}
+	}
+	
+	/**
+	 * Returns a value for this property source that can be edited in a property sheet.
+	 * <p>My personal rule of thumb:</p>
+	 * <ul>
+	 * <li>model elements should return themselves and</li> 
+	 * <li>custom IPropertySource implementations (like DimensionPropertySource in the GEF-logic
+	 * example) should return an editable value.</li>
+	 * </ul>
+	 * <p>Override only if necessary.</p>
+	 * @return this instance
+	 */
+	public Object getEditableValue() {
+		return this;
+	}
+	
+	public IPropertyDescriptor[] getPropertyDescriptors() {
+		return new IPropertyDescriptor[0];
+	}
+	
+	public abstract Object getPropertyValue(Object id);
+	
+	public abstract boolean isPropertySet(Object id);
+	
+	/** 
+	 * Remove a PropertyChangeListener from this component.
+	 * @param l a PropertyChangeListener instance
+	 */
+	public synchronized void removePropertyChangeListener(PropertyChangeListener l) {
+		if (l != null) {
+			pcsDelegate.removePropertyChangeListener(l);
+		}
+	}
+	
+	public abstract void resetPropertyValue(Object id);
+	
+	public abstract void setPropertyValue(Object id, Object value);
+
+	public void setSize(int width, int height) {
+		this.width = width;
+		this.height = height;
+		firePropertyChange(PROP_TRANSIENT, null, null);
+	}
+
+	public void setLocation(int x, int y) {
+		this.x = x;
+		this.y = y;
+		firePropertyChange(PROP_TRANSIENT, null, null);
+	}
+	
+	public abstract void updateConnections();
+}

Propchange: incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/model/ModelElement.java
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/model/NullModelElement.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/model/NullModelElement.java?rev=415128&view=auto
==============================================================================
--- incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/model/NullModelElement.java (added)
+++ incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/model/NullModelElement.java Sun Jun 18 05:49:47 2006
@@ -0,0 +1,56 @@
+/*
+ * Created on 16/06/2006
+ *
+ * To change the template for this generated file go to
+ * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
+ */
+package org.apache.cayenne.ropbrowser.model;
+
+import java.beans.PropertyChangeListener;
+import java.beans.PropertyChangeSupport;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+public class NullModelElement extends ModelElement {
+
+	private String name;
+	
+	public NullModelElement(String name) {
+		super();
+		this.name = name;
+	}
+	
+	public String getName() {
+		return name;
+	}
+
+	@Override
+	public Object getPropertyValue(Object id) {
+		return null;
+	}
+
+	@Override
+	public boolean isPropertySet(Object id) {
+		return false;
+	}
+
+	@Override
+	public void resetPropertyValue(Object id) {
+	}
+
+	@Override
+	public void setPropertyValue(Object id, Object value) {		
+	}
+	
+	public void updateConnections() {
+		for (Object o : getSourceConnections()) {
+			Connection conn = (Connection) o;
+			ModelElement element = conn.getTarget();
+			if (element instanceof CollectionModelElement) {
+				// delete the element and replace it with a NullModelElement
+			}
+			element.updateConnections();
+		}
+	}
+}

Propchange: incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/model/NullModelElement.java
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/model/ObjectDiagram.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/model/ObjectDiagram.java?rev=415128&view=auto
==============================================================================
--- incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/model/ObjectDiagram.java (added)
+++ incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/model/ObjectDiagram.java Sun Jun 18 05:49:47 2006
@@ -0,0 +1,125 @@
+package org.apache.cayenne.ropbrowser.model;
+
+import java.beans.PropertyChangeListener;
+import java.beans.PropertyChangeSupport;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import org.eclipse.ui.views.properties.IPropertyDescriptor;
+import org.eclipse.ui.views.properties.IPropertySource;
+import org.objectstyle.cayenne.CayenneContext;
+import org.objectstyle.cayenne.ObjectContext;
+import org.objectstyle.cayenne.query.NamedQuery;
+
+public class ObjectDiagram implements IPropertySource {
+	
+	public static final String PROP_NODE_ADDED = "ObjectDiagram.NodeAdded";
+	public static final String PROP_NODE_REMOVED = "ObjectDiagram.NodeRemoved";
+	protected List<ModelElement> objects = new ArrayList<ModelElement>();
+	protected ObjectContext context;
+	
+	/** Delegate used to implemenent property-change-support. */
+	private transient PropertyChangeSupport pcsDelegate = new PropertyChangeSupport(this);
+		
+	public ObjectDiagram(ObjectContext context, String query) {
+		this.context = context;
+		
+		NamedQuery select = new NamedQuery(query);
+		List matches = this.context.performQuery(select);
+		CollectionModelElement coll = new CollectionModelElement(null);
+		coll.setObjects(matches);
+		addElement(coll);
+	}
+
+	public boolean addElement(ModelElement element) {
+		if (element != null) {
+			if (!objects.contains(element)) {
+				objects.add(element);
+				firePropertyChange(PROP_NODE_ADDED, null, element);
+				return true;
+			}
+		}
+		return false;
+	}
+	
+	public boolean removeChild(ModelElement element) {
+		if (element != null) {
+			objects.remove(element);
+			firePropertyChange(PROP_NODE_REMOVED, null, element);
+			return true;
+		}
+		return false;
+	}
+	
+	/** Return a List of Objects in this diagram.  The returned List should not be modified. */
+	public List getObjects() {
+		return objects;
+	}
+	
+	public IPropertyDescriptor[] getPropertyDescriptors() {
+		return new IPropertyDescriptor[0];
+	}
+
+	public Object getPropertyValue(Object id) {
+		return null;
+	}
+
+	public boolean isPropertySet(Object id) {
+		return false;
+	}
+
+	public void resetPropertyValue(Object id) {
+	}
+
+	public void setPropertyValue(Object id, Object value) {
+	}
+	
+	/** 
+	 * Remove a PropertyChangeListener from this component.
+	 * @param l a PropertyChangeListener instance
+	 */
+	public synchronized void removePropertyChangeListener(PropertyChangeListener l) {
+		if (l != null) {
+			pcsDelegate.removePropertyChangeListener(l);
+		}
+	}
+	
+	/** 
+	 * Attach a non-null PropertyChangeListener to this object.
+	 * @param l a non-null PropertyChangeListener instance
+	 * @throws IllegalArgumentException if the parameter is null
+	 */
+	public synchronized void addPropertyChangeListener(PropertyChangeListener l) {
+		if (l == null) {
+			throw new IllegalArgumentException();
+		}
+		pcsDelegate.addPropertyChangeListener(l);
+	}
+	
+	/** 
+	 * Report a property change to registered listeners (for example edit parts).
+	 * @param property the programmatic name of the property that changed
+	 * @param oldValue the old value of this property
+	 * @param newValue the new value of this property
+	 */
+	protected void firePropertyChange(String property, Object oldValue, Object newValue) {
+		if (pcsDelegate.hasListeners(property)) {
+			pcsDelegate.firePropertyChange(property, oldValue, newValue);
+		}
+	}
+	
+	/**
+	 * Returns a value for this property source that can be edited in a property sheet.
+	 * <p>My personal rule of thumb:</p>
+	 * <ul>
+	 * <li>model elements should return themselves and</li> 
+	 * <li>custom IPropertySource implementations (like DimensionPropertySource in the GEF-logic
+	 * example) should return an editable value.</li>
+	 * </ul>
+	 * <p>Override only if necessary.</p>
+	 * @return this instance
+	 */
+	public Object getEditableValue() {
+		return this;
+	}
+}

Propchange: incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/model/ObjectDiagram.java
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/model/Painting.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/model/Painting.java?rev=415128&view=auto
==============================================================================
--- incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/model/Painting.java (added)
+++ incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/model/Painting.java Sun Jun 18 05:49:47 2006
@@ -0,0 +1,10 @@
+package org.apache.cayenne.ropbrowser.model;
+
+import org.apache.cayenne.ropbrowser.model.auto._Painting;
+
+/**
+ * A persistent class mapped as "Painting" Cayenne entity.
+ */
+public class Painting extends _Painting {
+
+}
\ No newline at end of file

Propchange: incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/model/Painting.java
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/model/auto/_Artist.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/model/auto/_Artist.java?rev=415128&view=auto
==============================================================================
--- incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/model/auto/_Artist.java (added)
+++ incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/model/auto/_Artist.java Sun Jun 18 05:49:47 2006
@@ -0,0 +1,114 @@
+package org.apache.cayenne.ropbrowser.model.auto;
+
+import java.util.Date;
+import java.util.List;
+
+import org.apache.cayenne.ropbrowser.model.AbstractObject;
+import org.apache.cayenne.ropbrowser.model.Painting;
+
+/**
+ * A generated persistent class mapped as "Artist" Cayenne entity. It is a good idea to
+ * avoid changing this class manually, since it will be overwritten next time code is
+ * regenerated. If you need to make any customizations, put them in a subclass.
+ */
+public class _Artist extends AbstractObject {
+
+    public static final String ALIVE_PROPERTY = "alive";
+    public static final String ARTIST_NAME_PROPERTY = "artistName";
+    public static final String DATE_OF_BIRTH_PROPERTY = "dateOfBirth";
+    public static final String ARTIST_PAINTING_PROPERTY = "artistPainting";
+
+    protected Boolean alive;
+    protected String artistName;
+    protected Date dateOfBirth;
+    protected List artistPainting;
+
+    public Boolean getAlive() {
+        if(objectContext != null) {
+            objectContext.prepareForAccess(this, "alive");
+        }
+        
+        return alive;
+    }
+    public void setAlive(Boolean alive) {
+        if(objectContext != null) {
+            objectContext.prepareForAccess(this, "alive");
+        }
+        
+        Object oldValue = this.alive;
+        this.alive = alive;
+        
+        // notify objectContext about simple property change
+        if(objectContext != null) {
+            objectContext.propertyChanged(this, "alive", oldValue, alive);
+        }
+    }
+    
+    
+    public String getArtistName() {
+        if(objectContext != null) {
+            objectContext.prepareForAccess(this, "artistName");
+        }
+        
+        return artistName;
+    }
+    public void setArtistName(String artistName) {
+        if(objectContext != null) {
+            objectContext.prepareForAccess(this, "artistName");
+        }
+        
+        Object oldValue = this.artistName;
+        this.artistName = artistName;
+        
+        // notify objectContext about simple property change
+        if(objectContext != null) {
+            objectContext.propertyChanged(this, "artistName", oldValue, artistName);
+        }
+    }
+    
+    
+    public Date getDateOfBirth() {
+        if(objectContext != null) {
+            objectContext.prepareForAccess(this, "dateOfBirth");
+        }
+        
+        return dateOfBirth;
+    }
+    public void setDateOfBirth(Date dateOfBirth) {
+        if(objectContext != null) {
+            objectContext.prepareForAccess(this, "dateOfBirth");
+        }
+        
+        Object oldValue = this.dateOfBirth;
+        this.dateOfBirth = dateOfBirth;
+        
+        // notify objectContext about simple property change
+        if(objectContext != null) {
+            objectContext.propertyChanged(this, "dateOfBirth", oldValue, dateOfBirth);
+        }
+    }
+    
+    
+    public List getArtistPainting() {
+        if(objectContext != null) {
+            objectContext.prepareForAccess(this, "artistPainting");
+        }
+        
+        return artistPainting;
+    }
+    public void addToArtistPainting(Painting object) {
+        if(objectContext != null) {
+            objectContext.prepareForAccess(this, "artistPainting");
+        }
+        
+        this.artistPainting.add(object);
+    }
+    public void removeFromArtistPainting(Painting object) {
+        if(objectContext != null) {
+            objectContext.prepareForAccess(this, "artistPainting");
+        }
+        
+        this.artistPainting.remove(object);
+    }
+    
+}
\ No newline at end of file

Propchange: incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/model/auto/_Artist.java
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/model/auto/_Gallery.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/model/auto/_Gallery.java?rev=415128&view=auto
==============================================================================
--- incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/model/auto/_Gallery.java (added)
+++ incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/model/auto/_Gallery.java Sun Jun 18 05:49:47 2006
@@ -0,0 +1,65 @@
+package org.apache.cayenne.ropbrowser.model.auto;
+
+import java.util.List;
+
+import org.apache.cayenne.ropbrowser.model.AbstractObject;
+import org.apache.cayenne.ropbrowser.model.Painting;
+
+/**
+ * A generated persistent class mapped as "Gallery" Cayenne entity. It is a good idea to
+ * avoid changing this class manually, since it will be overwritten next time code is
+ * regenerated. If you need to make any customizations, put them in a subclass.
+ */
+public class _Gallery extends AbstractObject {
+
+    public static final String GALLERY_NAME_PROPERTY = "galleryName";
+    public static final String GALLERY_PAINTING_PROPERTY = "galleryPainting";
+
+    protected String galleryName;
+    protected List galleryPainting;
+
+    public String getGalleryName() {
+        if(objectContext != null) {
+            objectContext.prepareForAccess(this, "galleryName");
+        }
+        
+        return galleryName;
+    }
+    public void setGalleryName(String galleryName) {
+        if(objectContext != null) {
+            objectContext.prepareForAccess(this, "galleryName");
+        }
+        
+        Object oldValue = this.galleryName;
+        this.galleryName = galleryName;
+        
+        // notify objectContext about simple property change
+        if(objectContext != null) {
+            objectContext.propertyChanged(this, "galleryName", oldValue, galleryName);
+        }
+    }
+    
+    
+    public List getGalleryPainting() {
+        if(objectContext != null) {
+            objectContext.prepareForAccess(this, "galleryPainting");
+        }
+        
+        return galleryPainting;
+    }
+    public void addToGalleryPainting(Painting object) {
+        if(objectContext != null) {
+            objectContext.prepareForAccess(this, "galleryPainting");
+        }
+        
+        this.galleryPainting.add(object);
+    }
+    public void removeFromGalleryPainting(Painting object) {
+        if(objectContext != null) {
+            objectContext.prepareForAccess(this, "galleryPainting");
+        }
+        
+        this.galleryPainting.remove(object);
+    }
+    
+}
\ No newline at end of file

Propchange: incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/model/auto/_Gallery.java
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/model/auto/_Painting.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/model/auto/_Painting.java?rev=415128&view=auto
==============================================================================
--- incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/model/auto/_Painting.java (added)
+++ incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/model/auto/_Painting.java Sun Jun 18 05:49:47 2006
@@ -0,0 +1,99 @@
+package org.apache.cayenne.ropbrowser.model.auto;
+
+import org.apache.cayenne.ropbrowser.model.AbstractObject;
+import org.apache.cayenne.ropbrowser.model.Artist;
+import org.apache.cayenne.ropbrowser.model.Gallery;
+import org.objectstyle.cayenne.ValueHolder;
+
+/**
+ * A generated persistent class mapped as "Painting" Cayenne entity. It is a good idea to
+ * avoid changing this class manually, since it will be overwritten next time code is
+ * regenerated. If you need to make any customizations, put them in a subclass.
+ */
+public class _Painting extends AbstractObject {
+
+    public static final String ESTIMATED_PRICE_PROPERTY = "estimatedPrice";
+    public static final String PAINTING_NAME_PROPERTY = "paintingName";
+    public static final String PAINTING_ARTIST_PROPERTY = "paintingArtist";
+    public static final String PAINTING_GALLERY_PROPERTY = "paintingGallery";
+
+    protected Float estimatedPrice;
+    protected String paintingName;
+    protected ValueHolder paintingArtist;
+    protected ValueHolder paintingGallery;
+
+    public Float getEstimatedPrice() {
+        if(objectContext != null) {
+            objectContext.prepareForAccess(this, "estimatedPrice");
+        }
+        
+        return estimatedPrice;
+    }
+    public void setEstimatedPrice(Float estimatedPrice) {
+        if(objectContext != null) {
+            objectContext.prepareForAccess(this, "estimatedPrice");
+        }
+        
+        Object oldValue = this.estimatedPrice;
+        this.estimatedPrice = estimatedPrice;
+        
+        // notify objectContext about simple property change
+        if(objectContext != null) {
+            objectContext.propertyChanged(this, "estimatedPrice", oldValue, estimatedPrice);
+        }
+    }
+    
+    
+    public String getPaintingName() {
+        if(objectContext != null) {
+            objectContext.prepareForAccess(this, "paintingName");
+        }
+        
+        return paintingName;
+    }
+    public void setPaintingName(String paintingName) {
+        if(objectContext != null) {
+            objectContext.prepareForAccess(this, "paintingName");
+        }
+        
+        Object oldValue = this.paintingName;
+        this.paintingName = paintingName;
+        
+        // notify objectContext about simple property change
+        if(objectContext != null) {
+            objectContext.propertyChanged(this, "paintingName", oldValue, paintingName);
+        }
+    }
+    
+    
+    public Artist getPaintingArtist() {
+        if(objectContext != null) {
+            objectContext.prepareForAccess(this, "paintingArtist");
+        }
+        
+        return (Artist) paintingArtist.getValue();
+    }
+    public void setPaintingArtist(Artist paintingArtist) {
+        if(objectContext != null) {
+            objectContext.prepareForAccess(this, "paintingArtist");
+        }
+        
+        this.paintingArtist.setValue(paintingArtist);
+    }
+    
+    public Gallery getPaintingGallery() {
+        if(objectContext != null) {
+            objectContext.prepareForAccess(this, "paintingGallery");
+        }
+        
+        return (Gallery) paintingGallery.getValue();
+    }
+    public void setPaintingGallery(Gallery paintingGallery) {
+        if(objectContext != null) {
+            objectContext.prepareForAccess(this, "paintingGallery");
+        }
+        
+        this.paintingGallery.setValue(paintingGallery);
+    }
+    
+}
\ No newline at end of file

Propchange: incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/model/auto/_Painting.java
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/parts/CollectionEditPart.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/parts/CollectionEditPart.java?rev=415128&view=auto
==============================================================================
--- incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/parts/CollectionEditPart.java (added)
+++ incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/parts/CollectionEditPart.java Sun Jun 18 05:49:47 2006
@@ -0,0 +1,196 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2005 Elias Volanakis and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *    Elias Volanakis - initial API and implementation
+ *******************************************************************************/
+package org.apache.cayenne.ropbrowser.parts;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.cayenne.ropbrowser.figures.CollectionFigure;
+import org.apache.cayenne.ropbrowser.model.AbstractObject;
+import org.apache.cayenne.ropbrowser.model.CollectionModelElement;
+import org.apache.cayenne.ropbrowser.model.Connection;
+import org.apache.cayenne.ropbrowser.model.ModelElement;
+import org.apache.cayenne.ropbrowser.model.NullModelElement;
+import org.apache.cayenne.ropbrowser.model.ObjectDiagram;
+import org.apache.cayenne.ropbrowser.policies.CollectionDirectEditPolicy;
+import org.apache.cayenne.ropbrowser.policies.CollectionSelectionPolicy;
+import org.eclipse.draw2d.ChopboxAnchor;
+import org.eclipse.draw2d.ConnectionAnchor;
+import org.eclipse.draw2d.Figure;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.draw2d.geometry.Rectangle;
+
+import org.eclipse.gef.ConnectionEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.NodeEditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.RequestConstants;
+import org.eclipse.gef.editparts.AbstractGraphicalEditPart;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.objectstyle.cayenne.map.Relationship;
+
+/**
+ * EditPart used for Shape instances (more specific for EllipticalShape and
+ * RectangularShape instances).
+ * <p>This edit part must implement the PropertyChangeListener interface, 
+ * so it can be notified of property changes in the corresponding model element.
+ * </p>
+ * 
+ * @author Elias Volanakis
+ */
+class CollectionEditPart extends ElementEditPart {
+	
+	/* (non-Javadoc)
+	 * @see org.eclipse.gef.editparts.AbstractEditPart#createEditPolicies()
+	 */
+	protected void createEditPolicies() {
+		// allow removal of the associated model element
+		// installEditPolicy(EditPolicy.COMPONENT_ROLE, new ShapeComponentEditPolicy());
+		//installEditPolicy(EditPolicy.COMPONENT_ROLE, new RootComponentEditPolicy());
+		installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new CollectionSelectionPolicy());
+		installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new CollectionDirectEditPolicy());		
+		// allow the creation of connections and 
+		// and the reconnection of connections between Shape instances
+		/* installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new GraphicalNodeEditPolicy() {
+			/* (non-Javadoc)
+			 * @see org.eclipse.gef.editpolicies.GraphicalNodeEditPolicy#getConnectionCompleteCommand(org.eclipse.gef.requests.CreateConnectionRequest)
+			 *
+			protected Command getConnectionCompleteCommand(CreateConnectionRequest request) {
+				ConnectionCreateCommand cmd 
+					= (ConnectionCreateCommand) request.getStartCommand();
+				cmd.setTarget((Shape) getHost().getModel());
+				return cmd;
+			}
+			/* (non-Javadoc)
+			 * @see org.eclipse.gef.editpolicies.GraphicalNodeEditPolicy#getConnectionCreateCommand(org.eclipse.gef.requests.CreateConnectionRequest)
+			 *
+			protected Command getConnectionCreateCommand(CreateConnectionRequest request) {
+				Shape source = (Shape) getHost().getModel();
+				int style = ((Integer) request.getNewObjectType()).intValue();
+				ConnectionCreateCommand cmd = new ConnectionCreateCommand(source, style);
+				request.setStartCommand(cmd);
+				return cmd;
+			}
+			/* (non-Javadoc)
+			 * @see org.eclipse.gef.editpolicies.GraphicalNodeEditPolicy#getReconnectSourceCommand(org.eclipse.gef.requests.ReconnectRequest)
+			 *
+			protected Command getReconnectSourceCommand(ReconnectRequest request) {
+				Connection conn = (Connection) request.getConnectionEditPart().getModel();
+				Shape newSource = (Shape) getHost().getModel();
+				ConnectionReconnectCommand cmd = new ConnectionReconnectCommand(conn);
+				cmd.setNewSource(newSource);
+				return cmd;
+			}
+			/* (non-Javadoc)
+			 * @see org.eclipse.gef.editpolicies.GraphicalNodeEditPolicy#getReconnectTargetCommand(org.eclipse.gef.requests.ReconnectRequest)
+			 *
+			protected Command getReconnectTargetCommand(ReconnectRequest request) {
+				Connection conn = (Connection) request.getConnectionEditPart().getModel();
+				Shape newTarget = (Shape) getHost().getModel();
+				ConnectionReconnectCommand cmd = new ConnectionReconnectCommand(conn);
+				cmd.setNewTarget(newTarget);
+				return cmd;
+			}
+		}); */
+	}
+		
+	/*(non-Javadoc)
+	 * @see org.eclipse.gef.editparts.AbstractGraphicalEditPart#createFigure()
+	 */
+	protected IFigure createFigure() {
+		
+		CollectionModelElement model = getModelCast();
+		
+		CollectionFigure figure = new CollectionFigure(model);
+				
+		return figure;
+	}
+	
+	/* (non-Javadoc)
+	 * @see java.beans.PropertyChangeListener#propertyChange(java.beans.PropertyChangeEvent)
+	 */
+	public void propertyChange(PropertyChangeEvent evt) {
+		super.propertyChange(evt);
+		
+		System.out.println("Event");
+		
+		String prop = evt.getPropertyName();
+		if (!ModelElement.PROP_TRANSIENT.equals(prop) && !ModelElement.PROP_TARGET_CONN.equals(prop) && !ModelElement.PROP_SOURCE_CONN.equals(prop)) {
+			((CollectionFigure) getFigure()).setAttributes(getModelCast().getCurrent());
+		}
+	}
+
+	private CollectionModelElement getModelCast() {
+		return (CollectionModelElement) getModel();
+	}
+
+	/**
+	 * @see org.eclipse.gef.EditPart#performRequest(org.eclipse.gef.Request)
+	 */
+	public void performRequest(Request request)
+	{
+		// TODO keybinding
+		if (request.getType().equals(RequestConstants.REQ_OPEN)) {
+			getModelCast().next();
+			getModelCast().updateConnections();
+		}
+		if (request.getType().equals(RequestConstants.REQ_DIRECT_EDIT)) {
+			Point loc = ((DirectEditRequest) request).getLocation().getCopy();
+			Figure relationshipCompartment = ((CollectionFigure) getFigure()).getRelationshipCompartment();
+			relationshipCompartment.translateToRelative(loc);
+			if (relationshipCompartment.containsPoint(loc)) {
+				Iterator children = relationshipCompartment.getChildren().iterator();
+				Iterator relationships = getModelCast().getCurrent().getRelationships().iterator();
+				while (children.hasNext() && relationships.hasNext()) {
+					Figure figure = (Figure) children.next();
+					Relationship rel = (Relationship) relationships.next();
+					if (figure instanceof Label) {
+						Label label = (Label) figure;
+						Point location = ((DirectEditRequest) request).getLocation().getCopy();
+						label.translateToRelative(location);
+						if (label.containsPoint(location)) {
+							
+							ModelElement element = null;
+							// follow the relationship to get the object
+							Object value = getModelCast().getCurrent().followRelationship(rel);
+							
+							if (value == null || (value instanceof List && ((List) value).isEmpty())) {
+								element = new NullModelElement(rel.getTargetEntityName());
+							}
+							else {
+								CollectionModelElement e = new CollectionModelElement(getModelCast().getCurrent());
+								if (rel.isToMany()) {
+									e.setObjects((List) value);
+								}
+								else {
+									e.setObjects(Arrays.asList(new AbstractObject[] {(AbstractObject) value}));
+								}
+								element = e;
+							}
+							
+							if (((ObjectDiagram) ((ObjectDiagramEditPart) getParent()).getModel()).addElement(element)) {
+								Connection conn = new Connection(getModelCast(), element, rel);
+							}
+							
+							return;
+						}
+					}
+				}
+			}
+		}
+	}
+}
\ No newline at end of file

Propchange: incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/parts/CollectionEditPart.java
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/parts/ConnectionEditPart.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/parts/ConnectionEditPart.java?rev=415128&view=auto
==============================================================================
--- incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/parts/ConnectionEditPart.java (added)
+++ incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/parts/ConnectionEditPart.java Sun Jun 18 05:49:47 2006
@@ -0,0 +1,28 @@
+/*
+ * Created on 16/06/2006
+ *
+ * To change the template for this generated file go to
+ * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
+ */
+package org.apache.cayenne.ropbrowser.parts;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.PolygonDecoration;
+import org.eclipse.draw2d.PolylineConnection;
+import org.eclipse.gef.editparts.AbstractConnectionEditPart;
+
+public class ConnectionEditPart extends AbstractConnectionEditPart {
+
+	@Override
+	protected void createEditPolicies() {
+	}
+	
+	/* (non-Javadoc)
+	 * @see org.eclipse.gef.editparts.AbstractGraphicalEditPart#createFigure()
+	 */
+	protected IFigure createFigure() {
+		PolylineConnection connection = (PolylineConnection) super.createFigure();
+		connection.setTargetDecoration(new PolygonDecoration()); // arrow at target endpoint
+		return connection;
+	}
+}

Propchange: incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/parts/ConnectionEditPart.java
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/parts/ElementEditPart.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/parts/ElementEditPart.java?rev=415128&view=auto
==============================================================================
--- incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/parts/ElementEditPart.java (added)
+++ incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/parts/ElementEditPart.java Sun Jun 18 05:49:47 2006
@@ -0,0 +1,168 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2005 Elias Volanakis and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *    Elias Volanakis - initial API and implementation
+ *******************************************************************************/
+package org.apache.cayenne.ropbrowser.parts;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.cayenne.ropbrowser.figures.CollectionFigure;
+import org.apache.cayenne.ropbrowser.model.CollectionModelElement;
+import org.apache.cayenne.ropbrowser.model.Connection;
+import org.apache.cayenne.ropbrowser.model.ModelElement;
+import org.apache.cayenne.ropbrowser.model.ObjectDiagram;
+import org.apache.cayenne.ropbrowser.policies.CollectionDirectEditPolicy;
+import org.apache.cayenne.ropbrowser.policies.CollectionSelectionPolicy;
+import org.eclipse.draw2d.ChopboxAnchor;
+import org.eclipse.draw2d.ConnectionAnchor;
+import org.eclipse.draw2d.Figure;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.draw2d.geometry.Rectangle;
+
+import org.eclipse.gef.ConnectionEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.NodeEditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.RequestConstants;
+import org.eclipse.gef.editparts.AbstractGraphicalEditPart;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.objectstyle.cayenne.map.Relationship;
+
+/**
+ * EditPart used for Shape instances (more specific for EllipticalShape and
+ * RectangularShape instances).
+ * <p>This edit part must implement the PropertyChangeListener interface, 
+ * so it can be notified of property changes in the corresponding model element.
+ * </p>
+ * 
+ * @author Elias Volanakis
+ */
+public abstract class ElementEditPart extends AbstractGraphicalEditPart 
+	implements PropertyChangeListener, NodeEditPart {
+	
+	private ConnectionAnchor anchor;
+	
+	/**
+	 * Upon activation, attach to the model element as a property change listener.
+	 */
+	public void activate() {
+		if (!isActive()) {
+			super.activate();
+			((ModelElement) getModel()).addPropertyChangeListener(this);
+		}
+	}
+	
+	/**
+	 * Upon deactivation, detach from the model element as a property change listener.
+	 */
+	public void deactivate() {
+		if (isActive()) {
+			super.deactivate();
+			((ModelElement) getModel()).removePropertyChangeListener(this);
+		}
+	}
+	
+	/* (non-Javadoc)
+	 * @see java.beans.PropertyChangeListener#propertyChange(java.beans.PropertyChangeEvent)
+	 */
+	public void propertyChange(PropertyChangeEvent evt) {
+		String prop = evt.getPropertyName();
+		
+		if (ModelElement.PROP_TRANSIENT.equals(prop)) {
+			refreshVisuals();
+		}
+		else if (ModelElement.PROP_SOURCE_CONN.equals(prop)) {
+			refreshSourceConnections();
+		}
+		else if (ModelElement.PROP_TARGET_CONN.equals(prop)) {
+			refreshTargetConnections();
+		}
+	}
+	
+	private ModelElement getModelCast() {
+		return (ModelElement) getModel();
+	}
+	
+	protected void refreshVisuals() {
+		// notify parent container of changed position & location
+		// if this line is removed, the XYLayoutManager used by the parent container 
+		// (the Figure of the ShapesDiagramEditPart), will not know the bounds of this figure
+		// and will not draw it correctly.
+		ModelElement model = getModelCast();
+		if (model.getWidth() == 0 && model.getHeight() == 0) {
+			model.setSize(getFigure().getPreferredSize().width, getFigure().getPreferredSize().height);
+		}
+		Rectangle bounds = new Rectangle(model.getX(), model.getY(), model.getWidth(), model.getHeight());
+		((GraphicalEditPart) getParent()).setLayoutConstraint(this, getFigure(), bounds);
+	}
+	
+	protected ConnectionAnchor getConnectionAnchor() {
+		if (anchor == null) {
+			anchor = new ChopboxAnchor(getFigure());
+		}
+		return anchor;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.eclipse.gef.editparts.AbstractGraphicalEditPart#getModelSourceConnections()
+	 */
+	protected List getModelSourceConnections() {
+		return getModelCast().getSourceConnections();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.eclipse.gef.editparts.AbstractGraphicalEditPart#getModelTargetConnections()
+	 */
+	protected List getModelTargetConnections() {
+		return getModelCast().getTargetConnections();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.eclipse.gef.NodeEditPart#getSourceConnectionAnchor(org.eclipse.gef.ConnectionEditPart)
+	 */
+	public ConnectionAnchor getSourceConnectionAnchor(ConnectionEditPart connection) {
+		return getConnectionAnchor();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.eclipse.gef.NodeEditPart#getSourceConnectionAnchor(org.eclipse.gef.Request)
+	 */
+	public ConnectionAnchor getSourceConnectionAnchor(Request request) {
+		return getConnectionAnchor();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.eclipse.gef.NodeEditPart#getTargetConnectionAnchor(org.eclipse.gef.ConnectionEditPart)
+	 */
+	public ConnectionAnchor getTargetConnectionAnchor(ConnectionEditPart connection) {
+		return getConnectionAnchor();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.eclipse.gef.NodeEditPart#getTargetConnectionAnchor(org.eclipse.gef.Request)
+	 */
+	public ConnectionAnchor getTargetConnectionAnchor(Request request) {
+		return getConnectionAnchor();
+	}
+	
+	protected void createEditPolicies() {
+	}
+}
\ No newline at end of file

Propchange: incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/parts/ElementEditPart.java
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/parts/NullEditPart.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/parts/NullEditPart.java?rev=415128&view=auto
==============================================================================
--- incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/parts/NullEditPart.java (added)
+++ incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/parts/NullEditPart.java Sun Jun 18 05:49:47 2006
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2005 Elias Volanakis and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *    Elias Volanakis - initial API and implementation
+ *******************************************************************************/
+package org.apache.cayenne.ropbrowser.parts;
+
+import org.apache.cayenne.ropbrowser.figures.NullFigure;
+import org.apache.cayenne.ropbrowser.model.NullModelElement;
+import org.eclipse.draw2d.IFigure;
+
+/**
+ * EditPart used for Shape instances (more specific for EllipticalShape and
+ * RectangularShape instances).
+ * <p>This edit part must implement the PropertyChangeListener interface, 
+ * so it can be notified of property changes in the corresponding model element.
+ * </p>
+ * 
+ * @author Elias Volanakis
+ */
+public class NullEditPart extends ElementEditPart {
+	
+	/*(non-Javadoc)
+	 * @see org.eclipse.gef.editparts.AbstractGraphicalEditPart#createFigure()
+	 */
+	protected IFigure createFigure() {
+		NullModelElement model = getModelCast();
+		
+		NullFigure figure = new NullFigure(model);
+		
+		return figure;
+	}
+	
+	private NullModelElement getModelCast() {
+		return ((NullModelElement) getModel());
+	}
+}
\ No newline at end of file

Propchange: incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/parts/NullEditPart.java
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/parts/ObjectDiagramEditPart.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/parts/ObjectDiagramEditPart.java?rev=415128&view=auto
==============================================================================
--- incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/parts/ObjectDiagramEditPart.java (added)
+++ incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/parts/ObjectDiagramEditPart.java Sun Jun 18 05:49:47 2006
@@ -0,0 +1,163 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2005 Elias Volanakis and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *    Elias Volanakis - initial API and implementation
+ *******************************************************************************/
+package org.apache.cayenne.ropbrowser.parts;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.List;
+
+import org.apache.cayenne.ropbrowser.commands.ObjectSetConstraintCommand;
+import org.apache.cayenne.ropbrowser.model.ModelElement;
+import org.apache.cayenne.ropbrowser.model.ObjectDiagram;
+import org.eclipse.draw2d.ConnectionLayer;
+import org.eclipse.draw2d.Figure;
+import org.eclipse.draw2d.FreeformLayer;
+import org.eclipse.draw2d.FreeformLayout;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.MarginBorder;
+import org.eclipse.draw2d.ShortestPathConnectionRouter;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.LayerConstants;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editparts.AbstractGraphicalEditPart;
+import org.eclipse.gef.editpolicies.RootComponentEditPolicy;
+import org.eclipse.gef.editpolicies.XYLayoutEditPolicy;
+import org.eclipse.gef.requests.ChangeBoundsRequest;
+import org.eclipse.gef.requests.CreateRequest;
+
+/**
+ * EditPart for the a ShapesDiagram instance.
+ * <p>This edit part server as the main diagram container, the white area where
+ * everything else is in. Also responsible for the container's layout (the
+ * way the container rearanges is contents) and the container's capabilities
+ * (edit policies).
+ * </p>
+ * <p>This edit part must implement the PropertyChangeListener interface, 
+ * so it can be notified of property changes in the corresponding model element.
+ * </p>
+ * 
+ * @author Elias Volanakis
+ */
+class ObjectDiagramEditPart extends AbstractGraphicalEditPart 
+	implements PropertyChangeListener  {
+
+	/**
+	 * Upon activation, attach to the model element as a property change listener.
+	 */
+	public void activate() {
+		if (!isActive()) {
+			super.activate();
+			((ObjectDiagram) getModel()).addPropertyChangeListener(this);
+		}
+	}
+	
+	/* (non-Javadoc)
+	 * @see org.eclipse.gef.editparts.AbstractEditPart#createEditPolicies()
+	 */
+	protected void createEditPolicies() {
+		// disallows the removal of this edit part from its parent
+		installEditPolicy(EditPolicy.COMPONENT_ROLE, new RootComponentEditPolicy());
+		// handles constraint changes (e.g. moving and/or resizing) of model elements
+		// and creation of new model elements
+		installEditPolicy(EditPolicy.LAYOUT_ROLE,  new ObjectsXYLayoutEditPolicy());
+	}
+	
+	/* (non-Javadoc)
+	 * @see org.eclipse.gef.editparts.AbstractGraphicalEditPart#createFigure()
+	 */
+	protected IFigure createFigure() {
+		Figure f = new FreeformLayer();
+		f.setBorder(new MarginBorder(3));
+		f.setLayoutManager(new FreeformLayout());
+	
+		// Create the static router for the connection layer
+		ConnectionLayer connLayer = (ConnectionLayer)getLayer(LayerConstants.CONNECTION_LAYER);
+		connLayer.setConnectionRouter(new ShortestPathConnectionRouter(f));
+		
+		return f;
+	}
+	
+	/**
+	 * Upon deactivation, detach from the model element as a property change listener.
+	 */
+	public void deactivate() {
+		if (isActive()) {
+			super.deactivate();
+			((ObjectDiagram) getModel()).removePropertyChangeListener(this);
+		}
+	}
+	
+	/* (non-Javadoc)
+	 * @see org.eclipse.gef.editparts.AbstractEditPart#getModelChildren()
+	 */
+	protected List getModelChildren() {
+		ObjectDiagram diagram = (ObjectDiagram) this.getModel();
+		return  diagram.getObjects(); // return a list of objects
+	}
+	
+	/* (non-Javadoc)
+	 * @see java.beans.PropertyChangeListener#propertyChange(PropertyChangeEvent)
+	 */
+	public void propertyChange(PropertyChangeEvent evt) {
+		String prop = evt.getPropertyName();
+		if (ObjectDiagram.PROP_NODE_ADDED.equals(prop)
+				|| ObjectDiagram.PROP_NODE_REMOVED.equals(prop)) {
+			refreshChildren();
+		}
+	}
+	
+	/**
+	 * EditPolicy for the Figure used by this edit part.
+	 * Children of XYLayoutEditPolicy can be used in Figures with XYLayout.
+	 * @author Elias Volanakis
+	 */
+	private static class ObjectsXYLayoutEditPolicy extends XYLayoutEditPolicy {
+		
+		protected Command createAddCommand(EditPart child, Object constraint) {
+			return null;
+		}
+		
+		/* (non-Javadoc)
+		 * @see ConstrainedLayoutEditPolicy#createChangeConstraintCommand(ChangeBoundsRequest, EditPart, Object)
+		 */
+		protected Command createChangeConstraintCommand(ChangeBoundsRequest request,
+				EditPart child, Object constraint) {
+			if (child instanceof ElementEditPart && constraint instanceof Rectangle) {
+				return new ObjectSetConstraintCommand(
+						(ModelElement) child.getModel(), request, (Rectangle) constraint);
+			}
+			return super.createChangeConstraintCommand(request, child, constraint);
+		}
+		
+		/* (non-Javadoc)
+		 * @see ConstrainedLayoutEditPolicy#createChangeConstraintCommand(EditPart, Object)
+		 */
+		protected Command createChangeConstraintCommand(EditPart child,
+				Object constraint) {
+			return null;
+		}
+		
+		/* (non-Javadoc)
+		 * @see LayoutEditPolicy#getCreateCommand(CreateRequest)
+		 */
+		protected Command getCreateCommand(CreateRequest request) {
+			return null;
+		}
+		
+		protected Command getDeleteDependantCommand(Request request) {
+			return null;
+		}
+		
+	}
+}
\ No newline at end of file

Propchange: incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/parts/ObjectDiagramEditPart.java
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/parts/ObjectEditPartFactory.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/parts/ObjectEditPartFactory.java?rev=415128&view=auto
==============================================================================
--- incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/parts/ObjectEditPartFactory.java (added)
+++ incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/parts/ObjectEditPartFactory.java Sun Jun 18 05:49:47 2006
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2005 Elias Volanakis and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *    Elias Volanakis - initial API and implementation
+ *******************************************************************************/
+package org.apache.cayenne.ropbrowser.parts;
+
+import org.apache.cayenne.ropbrowser.model.CollectionModelElement;
+import org.apache.cayenne.ropbrowser.model.Connection;
+import org.apache.cayenne.ropbrowser.model.NullModelElement;
+import org.apache.cayenne.ropbrowser.model.ObjectDiagram;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPartFactory;
+
+/**
+ * Factory that maps model elements to edit parts.
+ * @author Elias Volanakis
+ */
+public class ObjectEditPartFactory implements EditPartFactory {
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.eclipse.gef.EditPartFactory#createEditPart(org.eclipse.gef.EditPart, java.lang.Object)
+	 */
+	public EditPart createEditPart(EditPart context, Object modelElement) {
+		// get EditPart for model element
+		EditPart part = getPartForElement(modelElement);
+		// store model element in EditPart
+		part.setModel(modelElement);
+		return part;
+	}
+
+	/**
+	 * Maps an object to an EditPart. 
+	 * @throws RuntimeException if no match was found (programming error)
+	 */
+	private EditPart getPartForElement(Object object) {
+		if (object instanceof ObjectDiagram) {
+			return new ObjectDiagramEditPart();
+		}
+		if (object instanceof CollectionModelElement) {
+			return new CollectionEditPart();
+		}
+		if (object instanceof Connection) {
+			return new ConnectionEditPart();
+		}
+		if (object instanceof NullModelElement) {
+			return new NullEditPart();
+		}
+		throw new RuntimeException(
+				"Can't create part for model element: "
+				+ ((object != null) ? object.getClass().getName() : "null"));
+	}
+
+}
\ No newline at end of file

Propchange: incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/parts/ObjectEditPartFactory.java
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/policies/CollectionDirectEditPolicy.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/policies/CollectionDirectEditPolicy.java?rev=415128&view=auto
==============================================================================
--- incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/policies/CollectionDirectEditPolicy.java (added)
+++ incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/policies/CollectionDirectEditPolicy.java Sun Jun 18 05:49:47 2006
@@ -0,0 +1,24 @@
+/*
+ * Created on 15/06/2006
+ *
+ * To change the template for this generated file go to
+ * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
+ */
+package org.apache.cayenne.ropbrowser.policies;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.DirectEditPolicy;
+import org.eclipse.gef.requests.DirectEditRequest;
+
+public class CollectionDirectEditPolicy extends DirectEditPolicy {
+
+	@Override
+	protected Command getDirectEditCommand(DirectEditRequest request) {
+		return null;
+	}
+
+	@Override
+	protected void showCurrentEditValue(DirectEditRequest request) {
+	}
+
+}

Propchange: incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/policies/CollectionDirectEditPolicy.java
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/policies/CollectionSelectionPolicy.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/policies/CollectionSelectionPolicy.java?rev=415128&view=auto
==============================================================================
--- incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/policies/CollectionSelectionPolicy.java (added)
+++ incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/policies/CollectionSelectionPolicy.java Sun Jun 18 05:49:47 2006
@@ -0,0 +1,18 @@
+/*
+ * Created on 15/06/2006
+ *
+ * To change the template for this generated file go to
+ * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
+ */
+package org.apache.cayenne.ropbrowser.policies;
+
+import org.eclipse.gef.editpolicies.SelectionEditPolicy;
+
+public class CollectionSelectionPolicy extends SelectionEditPolicy {
+	
+	protected void showSelection() {
+	}
+	
+	protected void hideSelection() {
+	}
+}
\ No newline at end of file

Propchange: incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/policies/CollectionSelectionPolicy.java
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/server/Artist.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/server/Artist.java?rev=415128&view=auto
==============================================================================
--- incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/server/Artist.java (added)
+++ incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/server/Artist.java Sun Jun 18 05:49:47 2006
@@ -0,0 +1,10 @@
+package org.apache.cayenne.ropbrowser.server;
+
+import org.apache.cayenne.ropbrowser.server.auto._Artist;
+
+public class Artist extends _Artist {
+
+}
+
+
+

Propchange: incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/server/Artist.java
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/server/Gallery.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/server/Gallery.java?rev=415128&view=auto
==============================================================================
--- incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/server/Gallery.java (added)
+++ incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/server/Gallery.java Sun Jun 18 05:49:47 2006
@@ -0,0 +1,10 @@
+package org.apache.cayenne.ropbrowser.server;
+
+import org.apache.cayenne.ropbrowser.server.auto._Gallery;
+
+public class Gallery extends _Gallery {
+
+}
+
+
+

Propchange: incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/server/Gallery.java
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/server/Painting.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/server/Painting.java?rev=415128&view=auto
==============================================================================
--- incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/server/Painting.java (added)
+++ incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/server/Painting.java Sun Jun 18 05:49:47 2006
@@ -0,0 +1,10 @@
+package org.apache.cayenne.ropbrowser.server;
+
+import org.apache.cayenne.ropbrowser.server.auto._Painting;
+
+public class Painting extends _Painting {
+
+}
+
+
+

Propchange: incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/server/Painting.java
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/server/auto/_Artist.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/server/auto/_Artist.java?rev=415128&view=auto
==============================================================================
--- incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/server/auto/_Artist.java (added)
+++ incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/server/auto/_Artist.java Sun Jun 18 05:49:47 2006
@@ -0,0 +1,54 @@
+package org.apache.cayenne.ropbrowser.server.auto;
+
+import java.util.List;
+
+/** Class _Artist was generated by Cayenne.
+  * It is probably a good idea to avoid changing this class manually, 
+  * since it may be overwritten next time code is regenerated. 
+  * If you need to make any customizations, please use subclass. 
+  */
+public class _Artist extends org.objectstyle.cayenne.CayenneDataObject {
+
+    public static final String ALIVE_PROPERTY = "alive";
+    public static final String ARTIST_NAME_PROPERTY = "artistName";
+    public static final String DATE_OF_BIRTH_PROPERTY = "dateOfBirth";
+    public static final String ARTIST_PAINTING_PROPERTY = "artistPainting";
+
+    public static final String ARTIST_ID_PK_COLUMN = "ARTIST_ID";
+
+    public void setAlive(Boolean alive) {
+        writeProperty("alive", alive);
+    }
+    public Boolean getAlive() {
+        return (Boolean)readProperty("alive");
+    }
+    
+    
+    public void setArtistName(String artistName) {
+        writeProperty("artistName", artistName);
+    }
+    public String getArtistName() {
+        return (String)readProperty("artistName");
+    }
+    
+    
+    public void setDateOfBirth(java.util.Date dateOfBirth) {
+        writeProperty("dateOfBirth", dateOfBirth);
+    }
+    public java.util.Date getDateOfBirth() {
+        return (java.util.Date)readProperty("dateOfBirth");
+    }
+    
+    
+    public void addToArtistPainting(org.apache.cayenne.ropbrowser.server.Painting obj) {
+        addToManyTarget("artistPainting", obj, true);
+    }
+    public void removeFromArtistPainting(org.apache.cayenne.ropbrowser.server.Painting obj) {
+        removeToManyTarget("artistPainting", obj, true);
+    }
+    public List getArtistPainting() {
+        return (List)readProperty("artistPainting");
+    }
+    
+    
+}

Propchange: incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/server/auto/_Artist.java
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/server/auto/_Gallery.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/server/auto/_Gallery.java?rev=415128&view=auto
==============================================================================
--- incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/server/auto/_Gallery.java (added)
+++ incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/server/auto/_Gallery.java Sun Jun 18 05:49:47 2006
@@ -0,0 +1,36 @@
+package org.apache.cayenne.ropbrowser.server.auto;
+
+import java.util.List;
+
+/** Class _Gallery was generated by Cayenne.
+  * It is probably a good idea to avoid changing this class manually, 
+  * since it may be overwritten next time code is regenerated. 
+  * If you need to make any customizations, please use subclass. 
+  */
+public class _Gallery extends org.objectstyle.cayenne.CayenneDataObject {
+
+    public static final String GALLERY_NAME_PROPERTY = "galleryName";
+    public static final String GALLERY_PAINTING_PROPERTY = "galleryPainting";
+
+    public static final String GALLERY_ID_PK_COLUMN = "GALLERY_ID";
+
+    public void setGalleryName(String galleryName) {
+        writeProperty("galleryName", galleryName);
+    }
+    public String getGalleryName() {
+        return (String)readProperty("galleryName");
+    }
+    
+    
+    public void addToGalleryPainting(org.apache.cayenne.ropbrowser.server.Painting obj) {
+        addToManyTarget("galleryPainting", obj, true);
+    }
+    public void removeFromGalleryPainting(org.apache.cayenne.ropbrowser.server.Painting obj) {
+        removeToManyTarget("galleryPainting", obj, true);
+    }
+    public List getGalleryPainting() {
+        return (List)readProperty("galleryPainting");
+    }
+    
+    
+}

Propchange: incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/server/auto/_Gallery.java
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/server/auto/_Painting.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/server/auto/_Painting.java?rev=415128&view=auto
==============================================================================
--- incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/server/auto/_Painting.java (added)
+++ incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/server/auto/_Painting.java Sun Jun 18 05:49:47 2006
@@ -0,0 +1,51 @@
+package org.apache.cayenne.ropbrowser.server.auto;
+
+/** Class _Painting was generated by Cayenne.
+  * It is probably a good idea to avoid changing this class manually, 
+  * since it may be overwritten next time code is regenerated. 
+  * If you need to make any customizations, please use subclass. 
+  */
+public class _Painting extends org.objectstyle.cayenne.CayenneDataObject {
+
+    public static final String ESTIMATED_PRICE_PROPERTY = "estimatedPrice";
+    public static final String PAINTING_NAME_PROPERTY = "paintingName";
+    public static final String PAINTING_ARTIST_PROPERTY = "paintingArtist";
+    public static final String PAINTING_GALLERY_PROPERTY = "paintingGallery";
+
+    public static final String PAINTING_ID_PK_COLUMN = "PAINTING_ID";
+
+    public void setEstimatedPrice(Float estimatedPrice) {
+        writeProperty("estimatedPrice", estimatedPrice);
+    }
+    public Float getEstimatedPrice() {
+        return (Float)readProperty("estimatedPrice");
+    }
+    
+    
+    public void setPaintingName(String paintingName) {
+        writeProperty("paintingName", paintingName);
+    }
+    public String getPaintingName() {
+        return (String)readProperty("paintingName");
+    }
+    
+    
+    public void setPaintingArtist(org.apache.cayenne.ropbrowser.server.Artist paintingArtist) {
+        setToOneTarget("paintingArtist", paintingArtist, true);
+    }
+
+    public org.apache.cayenne.ropbrowser.server.Artist getPaintingArtist() {
+        return (org.apache.cayenne.ropbrowser.server.Artist)readProperty("paintingArtist");
+    } 
+    
+    
+    public void setPaintingGallery(org.apache.cayenne.ropbrowser.server.Gallery paintingGallery) {
+        setToOneTarget("paintingGallery", paintingGallery, true);
+    }
+
+    public org.apache.cayenne.ropbrowser.server.Gallery getPaintingGallery() {
+        return (org.apache.cayenne.ropbrowser.server.Gallery)readProperty("paintingGallery");
+    } 
+    
+    
+}

Propchange: incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/server/auto/_Painting.java
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/views/ControlPanelView.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/views/ControlPanelView.java?rev=415128&view=auto
==============================================================================
--- incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/views/ControlPanelView.java (added)
+++ incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/views/ControlPanelView.java Sun Jun 18 05:49:47 2006
@@ -0,0 +1,196 @@
+/*
+ * Created on 6/06/2006
+ *
+ * To change the template for this generated file go to
+ * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
+ */
+package org.apache.cayenne.ropbrowser.views;
+
+import java.util.Date;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.cayenne.ropbrowser.ConnectionManager;
+import org.apache.cayenne.ropbrowser.ObjectEditor;
+import org.apache.cayenne.ropbrowser.ObjectEditorInput;
+import org.apache.cayenne.ropbrowser.ROPBrowserPlugin;
+import org.apache.cayenne.ropbrowser.model.Artist;
+import org.apache.cayenne.ropbrowser.model.CollectionModelElement;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CCombo;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.forms.widgets.Form;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.part.ViewPart;
+import org.eclipse.ui.views.properties.IPropertyDescriptor;
+import org.objectstyle.cayenne.CayenneContext;
+import org.objectstyle.cayenne.DataObject;
+import org.objectstyle.cayenne.ObjectContext;
+import org.objectstyle.cayenne.map.Attribute;
+import org.objectstyle.cayenne.map.EntityResolver;
+import org.objectstyle.cayenne.map.ObjAttribute;
+import org.objectstyle.cayenne.map.ObjEntity;
+import org.objectstyle.cayenne.property.ClassDescriptor;
+import org.objectstyle.cayenne.property.Property;
+import org.objectstyle.cayenne.query.NamedQuery;
+import org.objectstyle.cayenne.query.Query;
+
+public class ControlPanelView extends ViewPart implements SelectionListener {
+
+	public static final String ID = "org.apache.cayenne.ropbrowser.views.ControlPanelView";
+
+	private static final String PREF_SERVER = "CONTROL_PANEL_SERVER";
+
+	private FormToolkit	toolkit;
+	private Form form;
+	// TODO change to a drop down to take advantage of maintained connections
+	// reselecting should switch back
+	private Text serverText;
+	private Button connectButton;
+	private CCombo queryCombo;
+	private Button runQueryButton;
+
+	private ConnectionManager connectionManager;
+	private ObjectContext currentContext;
+	
+	public ControlPanelView() {
+		connectionManager = ConnectionManager.getInstance();
+	}
+	
+	@Override
+	public void createPartControl(Composite parent) {
+		toolkit = new FormToolkit(parent.getDisplay());
+		form = toolkit.createForm(parent);
+		
+		GridLayout layout = new GridLayout(3, false);
+		layout.horizontalSpacing = 10;
+		layout.verticalSpacing = 10;
+		form.getBody().setLayout(layout);
+				
+		toolkit.createLabel(form.getBody(), "Server");
+		serverText = toolkit.createText(form.getBody(), "", SWT.NULL);
+		serverText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+		String defaultServer = ROPBrowserPlugin.getDefault().getPluginPreferences().getString(PREF_SERVER);
+		if (defaultServer != null) {
+			serverText.setText(defaultServer);
+		}
+		
+		connectButton = toolkit.createButton(form.getBody(), "Connect", SWT.PUSH);
+		connectButton.addSelectionListener(this);
+		
+		queryCombo = new CCombo(form.getBody(), SWT.READ_ONLY | SWT.FLAT);
+		GridData data = new GridData(SWT.FILL, SWT.NULL, true, false);
+		data.horizontalSpan = 2;
+		queryCombo.setLayoutData(data);
+		queryCombo.addSelectionListener(this);
+		
+		runQueryButton = toolkit.createButton(form.getBody(), "Run", SWT.PUSH);
+		runQueryButton.addSelectionListener(this);
+		
+		toolkit.paintBordersFor(form.getBody());
+		form.getBody().pack();
+	}
+
+	@Override
+	public void setFocus() {
+		form.setFocus();
+	}
+
+	public void widgetSelected(SelectionEvent e) {
+		if (e.getSource() == connectButton) {
+			ROPBrowserPlugin.getDefault().getPluginPreferences().setValue(PREF_SERVER, serverText.getText());
+			
+			this.currentContext = connectionManager.connect(serverText.getText());
+					
+			// get all the queries for this connection
+			EntityResolver entityResolver = this.currentContext.getEntityResolver();
+			Iterator i = entityResolver.getQueries().iterator();
+			while (i.hasNext()) {
+				queryCombo.add(((Query)i.next()).getName());
+			}
+		}
+		else if (e.getSource() == runQueryButton) {
+			try {
+				getViewSite().getPage().openEditor(new ObjectEditorInput(this.currentContext, queryCombo.getText()), ObjectEditor.ID, true);
+			} catch (PartInitException ex) {
+				System.out.println(ex.getMessage());
+			}
+		}
+			/*
+			NamedQuery select = new NamedQuery("ArtistQuery");
+			List matches = context.performQuery(select);
+			
+			CollectionModelElement coll = new CollectionModelElement();
+			coll.setObjects(matches);
+						
+			IPropertyDescriptor [] descs = coll.getPropertyDescriptors();
+			System.out.println("--------Artists-------");
+			System.out.println("Descs: " + descs.length);
+			for (int j = 0; j < 3; j++) {
+				System.out.println("--------");
+				for (IPropertyDescriptor desc : descs) {
+					System.out.println(desc.getDisplayName());
+					System.out.println(coll.getPropertyValue(desc.getId()));
+				}
+				coll.next();
+			}
+			
+			coll.setObjects(context.performQuery(new NamedQuery("GalleryQuery")));
+						
+			descs = coll.getPropertyDescriptors();
+			System.out.println("--------Galleries-------");
+			System.out.println("Descs: " + descs.length);
+			for (int j = 0; j < 3; j++) {
+				System.out.println("--------");
+				for (IPropertyDescriptor desc : descs) {
+					System.out.println(desc.getDisplayName());
+					System.out.println(coll.getPropertyValue(desc.getId()));
+				}
+				coll.next();
+			}
+			
+			*/
+			//artist.setPropertyValue(descs[0].getId(), "false");
+			//context.commitChanges();
+			
+			// TESTING SECTION
+			/*
+			
+			ObjEntity obj = entityResolver.getObjEntity("Artist");
+			Iterator k = obj.getAttributes().iterator();
+			
+			ClassDescriptor test = entityResolver.getClassDescriptor("Artist");
+			
+			System.out.println("Attributes");
+			while (k.hasNext()) {
+				ObjAttribute a = (ObjAttribute) k.next();
+				System.out.println(a.getName());
+				System.out.println(a.getType());
+				Property p = test.getProperty(a.getName());
+				System.out.println(p.getName());
+				System.out.println(p.readProperty(artist));
+			}
+			
+			
+			i = test.getProperties();
+			
+			System.out.println("Properties");
+			while (i.hasNext()) {
+				Property p = (Property) i.next();
+				System.out.println(p.getName());
+				System.out.println(p.readProperty(artist));
+			}
+			*/
+	}
+
+	public void widgetDefaultSelected(SelectionEvent e) {
+	}
+}

Propchange: incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/views/ControlPanelView.java
------------------------------------------------------------------------------
    svn:executable = *



Mime
View raw message