cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r912580 - in /cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler: ProjectTreeView.java dialog/FindDialog.java dialog/validator/DataMapErrorMsg.java undo/CreateNodeUndoableEdit.java util/CayenneController.java
Date Mon, 22 Feb 2010 14:27:28 GMT
Author: aadamchik
Date: Mon Feb 22 14:27:27 2010
New Revision: 912580

URL: http://svn.apache.org/viewvc?rev=912580&view=rev
Log:
Fixing incorrect static application ivar in CayenneController introduced in r905616
also doing some minor cleanup in other modeler classes

Modified:
    cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/ProjectTreeView.java
    cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/FindDialog.java
    cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/validator/DataMapErrorMsg.java
    cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/undo/CreateNodeUndoableEdit.java
    cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/CayenneController.java

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/ProjectTreeView.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/ProjectTreeView.java?rev=912580&r1=912579&r2=912580&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/ProjectTreeView.java
(original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/ProjectTreeView.java
Mon Feb 22 14:27:27 2010
@@ -198,12 +198,12 @@
     }
 
     private void initFromModel(Project project) {
-        
+
         // build model
         ProjectTreeModel model = new ProjectTreeModel(project);
         setRootVisible(true);
         setModel(model);
-        
+
         // expand top level
         getSelectionModel().setSelectionMode(
                 TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION);
@@ -350,7 +350,7 @@
 
         DefaultMutableTreeNode node = getProjectModel().getNodeForObjectPath(
                 new Object[] {
-                        (DataChannelDescriptor)mediator.getProject().getRootNode(),
+                        (DataChannelDescriptor) mediator.getProject().getRootNode(),
                         e.getProcedure().getDataMap()
                 });
 
@@ -367,7 +367,7 @@
     public void procedureChanged(ProcedureEvent e) {
         if (e.isNameChange()) {
             Object[] path = new Object[] {
-                    (DataChannelDescriptor)mediator.getProject().getRootNode(),
+                    (DataChannelDescriptor) mediator.getProject().getRootNode(),
                     e.getProcedure().getDataMap(), e.getProcedure()
             };
 
@@ -380,7 +380,7 @@
     public void procedureRemoved(ProcedureEvent e) {
 
         removeNode(new Object[] {
-                (DataChannelDescriptor)mediator.getProject().getRootNode(),
+                (DataChannelDescriptor) mediator.getProject().getRootNode(),
                 e.getProcedure().getDataMap(), e.getProcedure()
         });
     }
@@ -389,9 +389,11 @@
 
         DefaultMutableTreeNode node = getProjectModel().getNodeForObjectPath(
                 new Object[] {
-                        e.getDomain() != null ? e.getDomain() : 
-                            (DataChannelDescriptor)mediator.getProject().getRootNode(),
-                                e.getDataMap()
+                        e.getDomain() != null
+                                ? e.getDomain()
+                                : (DataChannelDescriptor) mediator
+                                        .getProject()
+                                        .getRootNode(), e.getDataMap()
                 });
 
         if (node == null) {
@@ -408,9 +410,10 @@
 
         if (e.isNameChange()) {
             Object[] path = new Object[] {
-                    e.getDomain() != null ? e.getDomain() : 
-                        (DataChannelDescriptor)mediator.getProject().getRootNode(),
-                            e.getQuery()
+                    e.getDomain() != null
+                            ? e.getDomain()
+                            : (DataChannelDescriptor) mediator.getProject().getRootNode(),
+                    e.getQuery()
             };
 
             updateNode(path);
@@ -421,9 +424,9 @@
 
     public void queryRemoved(QueryEvent e) {
         removeNode(new Object[] {
-                e.getDomain() != null ? e.getDomain() : 
-                    (DataChannelDescriptor)mediator.getProject().getRootNode(),
-                        e.getDataMap(), e.getQuery()
+                e.getDomain() != null ? e.getDomain() : (DataChannelDescriptor) mediator
+                        .getProject()
+                        .getRootNode(), e.getDataMap(), e.getQuery()
         });
     }
 
@@ -436,7 +439,7 @@
         updateNode(path);
 
         if (e.isNameChange()) {
-            
+
             positionNode(path, Comparators.getNamedObjectComparator());
             showNode(path);
         }
@@ -446,9 +449,11 @@
 
         DefaultMutableTreeNode node = getProjectModel().getNodeForObjectPath(
                 new Object[] {
-                        e.getDomain() != null ? e.getDomain() : 
-                            (DataChannelDescriptor)mediator.getProject().getRootNode(),
-                                e.getDataNode()
+                        e.getDomain() != null
+                                ? e.getDomain()
+                                : (DataChannelDescriptor) mediator
+                                        .getProject()
+                                        .getRootNode(), e.getDataNode()
                 });
 
         if (node != null) {
@@ -462,8 +467,10 @@
 
                 getProjectModel().nodeChanged(node);
 
-                DataChannelDescriptor domain = (DataChannelDescriptor) mediator.getProject().getRootNode();
-                
+                DataChannelDescriptor domain = (DataChannelDescriptor) mediator
+                        .getProject()
+                        .getRootNode();
+
                 // check for DataMap additions/removals...
                 Object[] mapsName = e.getDataNode().getDataMapNames().toArray();
                 int mapCount = mapsName.length;
@@ -476,7 +483,8 @@
                         for (int j = 0; j < node.getChildCount(); j++) {
                             DefaultMutableTreeNode child = (DefaultMutableTreeNode) node
                                     .getChildAt(j);
-                            if (domain.getDataMap(mapsName[i].toString()) == child.getUserObject())
{
+                            if (domain.getDataMap(mapsName[i].toString()) == child
+                                    .getUserObject()) {
                                 found = true;
                                 break;
                             }
@@ -522,8 +530,9 @@
 
         DefaultMutableTreeNode node = getProjectModel().getNodeForObjectPath(
                 new Object[] {
-                    e.getDomain() != null ? e.getDomain() : 
-                        (DataChannelDescriptor)mediator.getProject().getRootNode()
+                    e.getDomain() != null
+                            ? e.getDomain()
+                            : (DataChannelDescriptor) mediator.getProject().getRootNode()
                 });
 
         if (node == null) {
@@ -542,18 +551,18 @@
         }
 
         removeNode(new Object[] {
-                e.getDomain() != null ? e.getDomain() : 
-                    (DataChannelDescriptor)mediator.getProject().getRootNode(),
-                        e.getDataNode()
+                e.getDomain() != null ? e.getDomain() : (DataChannelDescriptor) mediator
+                        .getProject()
+                        .getRootNode(), e.getDataNode()
         });
     }
 
     public void dataMapChanged(DataMapEvent e) {
 
         Object[] path = new Object[] {
-                e.getDomain() != null ? e.getDomain() : 
-                    (DataChannelDescriptor)mediator.getProject().getRootNode()
-                        , e.getDataMap()
+                e.getDomain() != null ? e.getDomain() : (DataChannelDescriptor) mediator
+                        .getProject()
+                        .getRootNode(), e.getDataMap()
         };
 
         updateNode(path);
@@ -568,14 +577,16 @@
     public void dataMapAdded(DataMapEvent e) {
         DefaultMutableTreeNode domainNode = getProjectModel().getNodeForObjectPath(
                 new Object[] {
-                    e.getDomain() != null ? e.getDomain() : (DataChannelDescriptor)mediator.getProject().getRootNode()
+                    e.getDomain() != null
+                            ? e.getDomain()
+                            : (DataChannelDescriptor) mediator.getProject().getRootNode()
                 });
 
         DefaultMutableTreeNode newMapNode = ProjectTreeFactory.wrapProjectNode(e
                 .getDataMap());
-        
+
         mediator.getEntityResolver().addDataMap(e.getDataMap());
-        
+
         positionNode(domainNode, newMapNode, Comparators
                 .getDataDomainChildrenComparator());
         showNode(newMapNode);
@@ -583,15 +594,18 @@
 
     public void dataMapRemoved(DataMapEvent e) {
         DataMap map = e.getDataMap();
-        DataChannelDescriptor dataChannelDescriptor = (DataChannelDescriptor)Application.getProject().getRootNode();
+        DataChannelDescriptor dataChannelDescriptor = (DataChannelDescriptor) Application
+                .getProject()
+                .getRootNode();
         removeNode(new Object[] {
                 dataChannelDescriptor, map
         });
 
         mediator.getEntityResolver().removeDataMap(e.getDataMap());
-        
+
         // Clean up map from the nodes
-        for (DataNodeDescriptor dataNode : new ArrayList<DataNodeDescriptor>(dataChannelDescriptor.getNodeDescriptors()))
{
+        for (DataNodeDescriptor dataNode : new ArrayList<DataNodeDescriptor>(
+                dataChannelDescriptor.getNodeDescriptors())) {
             removeNode(new Object[] {
                     dataChannelDescriptor, dataNode, map
             });
@@ -633,9 +647,10 @@
     protected void entityChanged(EntityEvent e) {
         if (e.isNameChange()) {
             Object[] path = new Object[] {
-                    e.getDomain() != null ? e.getDomain() : 
-                        (DataChannelDescriptor)mediator.getProject().getRootNode()
-                            , e.getEntity().getDataMap(), e.getEntity()
+                    e.getDomain() != null
+                            ? e.getDomain()
+                            : (DataChannelDescriptor) mediator.getProject().getRootNode(),
+                    e.getEntity().getDataMap(), e.getEntity()
             };
 
             updateNode(path);
@@ -654,9 +669,11 @@
 
         DefaultMutableTreeNode mapNode = getProjectModel().getNodeForObjectPath(
                 new Object[] {
-                        e.getDomain() != null ? e.getDomain() :
-                            (DataChannelDescriptor)mediator.getProject().getRootNode()
-                                , e.getEntity().getDataMap()
+                        e.getDomain() != null
+                                ? e.getDomain()
+                                : (DataChannelDescriptor) mediator
+                                        .getProject()
+                                        .getRootNode(), e.getEntity().getDataMap()
                 });
 
         if (mapNode == null) {
@@ -679,9 +696,9 @@
 
         // remove from DataMap tree
         removeNode(new Object[] {
-                e.getDomain() != null ? e.getDomain() :
-                    (DataChannelDescriptor)mediator.getProject().getRootNode()
-                        , e.getEntity().getDataMap(), e.getEntity()
+                e.getDomain() != null ? e.getDomain() : (DataChannelDescriptor) mediator
+                        .getProject()
+                        .getRootNode(), e.getEntity().getDataMap(), e.getEntity()
         });
     }
 
@@ -789,15 +806,18 @@
         if (data.length == 0) {
             // this should clear the right-side panel
             DomainDisplayEvent domEvent = new DomainDisplayEvent(this, null);
-            domEvent.setDomain((DataChannelDescriptor) mediator.getProject().getRootNode());
+            domEvent.setDomain((DataChannelDescriptor) mediator
+                    .getProject()
+                    .getRootNode());
             mediator.fireDomainDisplayEvent(domEvent);
             return;
         }
 
         Object obj = data[data.length - 1];
         if (obj instanceof DataChannelDescriptor) {
-            mediator
-                    .fireDomainDisplayEvent(new DomainDisplayEvent(this, (DataChannelDescriptor)
obj));
+            mediator.fireDomainDisplayEvent(new DomainDisplayEvent(
+                    this,
+                    (DataChannelDescriptor) obj));
         }
         else if (obj instanceof DataMap) {
             if (data.length == 2) {
@@ -818,7 +838,7 @@
             if (data.length == 1) {
                 mediator.fireDataNodeDisplayEvent(new DataNodeDisplayEvent(
                         this,
-                        (DataChannelDescriptor) mediator.getProject().getRootNode() ,
+                        (DataChannelDescriptor) mediator.getProject().getRootNode(),
                         (DataNodeDescriptor) obj));
             }
         }
@@ -926,7 +946,7 @@
         popup.add(buildMenu(CreateObjEntityAction.getActionName()));
         popup.add(buildMenu(CreateEmbeddableAction.getActionName()));
         popup.add(buildMenu(CreateDbEntityAction.getActionName()));
-  
+
         popup.add(buildMenu(CreateProcedureAction.getActionName()));
         popup.add(buildMenu(CreateQueryAction.getActionName()));
         popup.addSeparator();
@@ -983,8 +1003,11 @@
 
         DefaultMutableTreeNode mapNode = getProjectModel().getNodeForObjectPath(
                 new Object[] {
-                        e.getDomain() != null ? e.getDomain() : 
-                            (DataChannelDescriptor)mediator.getProject().getRootNode(), map
+                        e.getDomain() != null
+                                ? e.getDomain()
+                                : (DataChannelDescriptor) mediator
+                                        .getProject()
+                                        .getRootNode(), map
                 });
 
         if (mapNode == null) {
@@ -999,8 +1022,9 @@
     public void embeddableChanged(EmbeddableEvent e, DataMap map) {
         if (e.isNameChange()) {
             Object[] path = new Object[] {
-                    e.getDomain() != null ? e.getDomain() :
-                        (DataChannelDescriptor)mediator.getProject().getRootNode(),
+                    e.getDomain() != null
+                            ? e.getDomain()
+                            : (DataChannelDescriptor) mediator.getProject().getRootNode(),
                     map, e.getEmbeddable()
             };
 
@@ -1017,16 +1041,15 @@
 
         // remove from DataMap tree
         removeNode(new Object[] {
-                e.getDomain() != null ? e.getDomain() : 
-                    (DataChannelDescriptor)mediator.getProject().getRootNode(),
-                    map,
-                e.getEmbeddable()
+                e.getDomain() != null ? e.getDomain() : (DataChannelDescriptor) mediator
+                        .getProject()
+                        .getRootNode(), map, e.getEmbeddable()
         });
     }
 
     public void currentEmbeddableChanged(EmbeddableDisplayEvent e) {
         e.setEmbeddableChanged(true);
-        
+
         if ((e.getSource() == this || !e.isEmbeddableChanged()) && !e.isRefired())
{
             return;
         }
@@ -1034,6 +1057,6 @@
         showNode(new Object[] {
                 e.getDomain(), e.getDataMap(), e.getEmbeddable()
         });
-        
+
     }
 }

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/FindDialog.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/FindDialog.java?rev=912580&r1=912579&r2=912580&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/FindDialog.java
(original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/FindDialog.java
Mon Feb 22 14:27:27 2010
@@ -194,7 +194,7 @@
                 .getInstance()
                 .getFrameController()
                 .getView()).getView();
-        DataChannelDescriptor domain = (DataChannelDescriptor) getApplication()
+        DataChannelDescriptor domain = (DataChannelDescriptor) Application
                 .getInstance()
                 .getProject()
                 .getRootNode();

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/validator/DataMapErrorMsg.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/validator/DataMapErrorMsg.java?rev=912580&r1=912579&r2=912580&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/validator/DataMapErrorMsg.java
(original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/validator/DataMapErrorMsg.java
Mon Feb 22 14:27:27 2010
@@ -30,26 +30,17 @@
 
 /**
  * DataMap validation message.
- * 
  */
 public class DataMapErrorMsg extends ValidationDisplayHandler {
 
     protected DataMap map;
 
-    /**
-     * Constructor for DataMapErrorMsg.
-     * 
-     * @param result
-     */
     public DataMapErrorMsg(ValidationInfo result) {
         super(result);
 
         Object object = result.getValidatedObject();
         map = (DataMap) object;
-        domain = (DataChannelDescriptor) Application
-                .getInstance()
-                .getProject()
-                .getRootNode();
+        domain = (DataChannelDescriptor) Application.getProject().getRootNode();
     }
 
     public void displayField(ProjectController mediator, JFrame frame) {
@@ -57,5 +48,4 @@
         event = new DataMapDisplayEvent(frame, map, domain);
         mediator.fireDataMapDisplayEvent(event);
     }
-
 }

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/undo/CreateNodeUndoableEdit.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/undo/CreateNodeUndoableEdit.java?rev=912580&r1=912579&r2=912580&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/undo/CreateNodeUndoableEdit.java
(original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/undo/CreateNodeUndoableEdit.java
Mon Feb 22 14:27:27 2010
@@ -38,7 +38,7 @@
     private DataChannelDescriptor domain;
 
     public CreateNodeUndoableEdit(Application application, DataNodeDescriptor node) {
-        this.domain = (DataChannelDescriptor)application.getProject().getRootNode();;
+        this.domain = (DataChannelDescriptor) Application.getProject().getRootNode();
         this.node = node;
     }
 

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/CayenneController.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/CayenneController.java?rev=912580&r1=912579&r2=912580&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/CayenneController.java
(original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/CayenneController.java
Mon Feb 22 14:27:27 2010
@@ -46,14 +46,13 @@
 
 /**
  * A superclass of CayenneModeler controllers.
- * 
  */
 public abstract class CayenneController implements BoundComponent {
 
     private static Log logObj = LogFactory.getLog(CayenneController.class);
 
     protected CayenneController parent;
-    protected static Application application;
+    protected Application application;
     protected PropertyChangeSupport propertyChangeSupport;
 
     public CayenneController(CayenneController parent) {
@@ -65,7 +64,7 @@
         this.application = application;
     }
 
-    public static Application getApplication() {
+    public Application getApplication() {
         return application;
     }
 
@@ -111,11 +110,13 @@
     protected Preferences getViewPreferences() {
         Preferences pref = getApplication().getMainPreferenceForProject();
         String pathToProject = pref.absolutePath();
-        String path = pathToProject +"/"+ getView().getClass().getName().replace(".", "/");
-        
+        String path = pathToProject
+                + "/"
+                + getView().getClass().getName().replace(".", "/");
+
         return pref.node(path);
     }
-    
+
     /**
      * Utility method to provide a visual indication an execution error. This
      * implementation logs an error and pops up a dialog window with error message.
@@ -125,7 +126,8 @@
         logObj.info("Error in " + getClass().getName(), th);
         th.printStackTrace();
 
-        JOptionPane.showMessageDialog(getView(),
+        JOptionPane.showMessageDialog(
+                getView(),
                 th.getMessage(),
                 title,
                 JOptionPane.ERROR_MESSAGE);
@@ -184,7 +186,8 @@
                 }
             }
         };
-        dialog.getRootPane().registerKeyboardAction(closeAction,
+        dialog.getRootPane().registerKeyboardAction(
+                closeAction,
                 escReleased,
                 JComponent.WHEN_IN_FOCUSED_WINDOW);
     }



Mime
View raw message