You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by ol...@apache.org on 2010/02/01 15:51:00 UTC
svn commit: r905294 - in
/cayenne/main/branches/STABLE-3.0/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/objentity:
ObjAttributeInfoDialog.java ObjAttributeInfoDialogView.java
Author: oltka
Date: Mon Feb 1 14:51:00 2010
New Revision: 905294
URL: http://svn.apache.org/viewvc?rev=905294&view=rev
Log:
CAY-1383 unneeded target in modeler attributes inspection
Modified:
cayenne/main/branches/STABLE-3.0/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/objentity/ObjAttributeInfoDialog.java
cayenne/main/branches/STABLE-3.0/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/objentity/ObjAttributeInfoDialogView.java
Modified: cayenne/main/branches/STABLE-3.0/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/objentity/ObjAttributeInfoDialog.java
URL: http://svn.apache.org/viewvc/cayenne/main/branches/STABLE-3.0/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/objentity/ObjAttributeInfoDialog.java?rev=905294&r1=905293&r2=905294&view=diff
==============================================================================
--- cayenne/main/branches/STABLE-3.0/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/objentity/ObjAttributeInfoDialog.java (original)
+++ cayenne/main/branches/STABLE-3.0/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/objentity/ObjAttributeInfoDialog.java Mon Feb 1 14:51:00 2010
@@ -26,12 +26,10 @@
import java.awt.event.KeyListener;
import java.util.ArrayList;
import java.util.Collection;
-import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
-import java.util.Vector;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JOptionPane;
@@ -62,7 +60,6 @@
import org.apache.cayenne.modeler.event.AttributeDisplayEvent;
import org.apache.cayenne.modeler.event.EntityDisplayEvent;
import org.apache.cayenne.modeler.util.CayenneController;
-import org.apache.cayenne.modeler.util.Comparators;
import org.apache.cayenne.modeler.util.EntityTreeFilter;
import org.apache.cayenne.modeler.util.EntityTreeModel;
import org.apache.cayenne.modeler.util.ModelerUtil;
@@ -81,7 +78,6 @@
protected List<DbEntity> relTargets;
- protected ObjEntity objectTarget;
protected List<ObjEntity> objectTargets;
protected Map<String, Embeddable> stringToEmbeddables;
@@ -106,7 +102,6 @@
stringToEmbeddables.put(emb.getClassName(), emb);
embeddableNames.add(emb.getClassName());
}
-
initController(model.getAttribute(row));
}
@@ -157,10 +152,6 @@
* Register auto-selection of the target
*/
view.getPathBrowser().addTreeSelectionListener(this);
- this.objectTarget = (ObjEntity) attr.getEntity();
- if (objectTarget != null) {
- updateTargetCombo(objectTarget.getDbEntity());
- }
view.getAttributeName().setText(attribute.getName());
if (attribute.getDbAttributePath() != null) {
@@ -653,79 +644,6 @@
}
public void valueChanged(TreeSelectionEvent e) {
-
- TreePath selectedPath = e.getPath();
-
- // first item in the path is Entity, so we must have
- // at least two elements to constitute a valid ordering path
- if (selectedPath == null || selectedPath.getPathCount() < 2) {
- return;
- }
-
- DbEntity target = null;
- if (selectedPath.getLastPathComponent() instanceof Relationship) {
- Relationship rel = (Relationship) selectedPath.getLastPathComponent();
- target = (DbEntity) rel.getTargetEntity();
-
- }
- else if (selectedPath.getLastPathComponent() instanceof Attribute) {
- Attribute attr = (Attribute) selectedPath.getLastPathComponent();
- target = (DbEntity) attr.getEntity();
- }
-
- if (target != null) {
-
- /**
- * Initialize root with one of mapped ObjEntities.
- */
- Collection<ObjEntity> objEntities = target.getDataMap().getMappedEntities(
- target);
-
- List<DbRelationship> relPath = new Vector<DbRelationship>(selectedPath
- .getPathCount() - 1);
- for (int i = 1; i < selectedPath.getPathCount(); i++) {
- if (selectedPath.getLastPathComponent() instanceof Relationship) {
- relPath.add((DbRelationship) selectedPath.getPathComponent(i));
- }
- }
-
- setObjectTarget(objEntities.size() == 0 ? null : objEntities
- .iterator()
- .next());
- if (objectTarget != null) {
- updateTargetCombo(objectTarget.getDbEntity());
- }
- else {
- updateTargetCombo(null);
- }
- }
- }
-
- public void setObjectTarget(ObjEntity objectTarget) {
- if (this.objectTarget != objectTarget) {
- this.objectTarget = objectTarget;
- }
- }
-
- protected void updateTargetCombo(DbEntity dbTarget) {
- if (dbTarget != null) {
- // copy those that have DbEntities mapped to dbTarget, and then sort
-
- view.getTargCombo().removeAllItems();
- this.objectTargets = new ArrayList<ObjEntity>();
-
- if (dbTarget != null) {
- objectTargets.addAll(dbTarget.getDataMap().getMappedEntities(dbTarget));
- Collections.sort(objectTargets, Comparators.getNamedObjectComparator());
- }
-
- for (ObjEntity obj : objectTargets) {
- view.getTargCombo().addItem(obj.getName());
- }
- }
- else {
- view.getTargCombo().addItem("");
- }
}
private Entity getFirstEntity() {
Modified: cayenne/main/branches/STABLE-3.0/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/objentity/ObjAttributeInfoDialogView.java
URL: http://svn.apache.org/viewvc/cayenne/main/branches/STABLE-3.0/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/objentity/ObjAttributeInfoDialogView.java?rev=905294&r1=905293&r2=905294&view=diff
==============================================================================
--- cayenne/main/branches/STABLE-3.0/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/objentity/ObjAttributeInfoDialogView.java (original)
+++ cayenne/main/branches/STABLE-3.0/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/objentity/ObjAttributeInfoDialogView.java Mon Feb 1 14:51:00 2010
@@ -65,7 +65,6 @@
protected JTextField attributeName;
protected JLabel currentPathLabel;
protected JLabel sourceEntityLabel;
- protected JComboBox targCombo;
protected JComboBox type;
protected JPanel typeManagerPane;
@@ -103,8 +102,6 @@
cancelButton.setEnabled(true);
selectPathButton.setEnabled(false);
- targCombo = new JComboBox();
-
setTitle("ObjAttribute Inspector");
setLayout(new BorderLayout());
@@ -125,13 +122,10 @@
builder.addLabel("Source:", cc.xy(1, 7));
builder.add(sourceEntityLabel, cc.xywh(3, 7, 1, 1));
- builder.addLabel("Target:", cc.xy(1, 9));
- builder.add(targCombo, cc.xywh(3, 9, 1, 1));
-
- builder.addLabel("Type:", cc.xy(1, 11));
- builder.add(type, cc.xywh(3, 11, 1, 1));
+ builder.addLabel("Type:", cc.xy(1, 9));
+ builder.add(type, cc.xywh(3, 9, 1, 1));
- builder.addSeparator("Mapping to Attributes", cc.xywh(1, 13, 7, 1));
+ builder.addSeparator("Mapping to Attributes", cc.xywh(1, 11, 7, 1));
typeManagerPane = new JPanel();
typeManagerPane.setLayout(new CardLayout());
@@ -170,7 +164,7 @@
typeManagerPane.add(builderPathPane.getPanel(), FLATTENED_PANEL);
typeManagerPane.add(embeddablePane.getPanel(), EMBEDDABLE_PANEL);
- builder.add(typeManagerPane, cc.xywh(1, 15, 7, 1));
+ builder.add(typeManagerPane, cc.xywh(1, 13, 7, 1));
add(builder.getPanel(), BorderLayout.CENTER);
@@ -239,10 +233,6 @@
return type;
}
- public JComboBox getTargCombo() {
- return targCombo;
- }
-
public MultiColumnBrowser getPathBrowser() {
return pathBrowser;
}