directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r581818 - in /directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor: model/hierarchy/HierarchyManager.java view/views/SchemaViewContentProvider.java
Date Thu, 04 Oct 2007 09:40:30 GMT
Author: pamarcelot
Date: Thu Oct  4 02:40:29 2007
New Revision: 581818

URL: http://svn.apache.org/viewvc?rev=581818&view=rev
Log:
Part of a fix for DIRSTUDIO-200 (Add an OC and AT hierarchical global view)

Modified:
    directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/hierarchy/HierarchyManager.java
    directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/SchemaViewContentProvider.java

Modified: directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/hierarchy/HierarchyManager.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/hierarchy/HierarchyManager.java?rev=581818&r1=581817&r2=581818&view=diff
==============================================================================
--- directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/hierarchy/HierarchyManager.java
(original)
+++ directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/hierarchy/HierarchyManager.java
Thu Oct  4 02:40:29 2007
@@ -266,8 +266,13 @@
                 for ( Object value : children )
                 {
                     childrenMap.put( object, value );
+                    if ( oid.equals( "2.5.6.0" ) )
+                    {
+                        childrenMap.remove( root, value );
+                    }
                     parentsMap.remove( value, oid.toLowerCase() );
                     parentsMap.put( value, object );
+
                 }
                 childrenMap.remove( oid.toLowerCase() );
             }

Modified: directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/SchemaViewContentProvider.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/SchemaViewContentProvider.java?rev=581818&r1=581817&r2=581818&view=diff
==============================================================================
--- directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/SchemaViewContentProvider.java
(original)
+++ directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/SchemaViewContentProvider.java
Thu Oct  4 02:40:29 2007
@@ -248,8 +248,27 @@
                 Collections.reverse( children );
             }
         }
-        else if ( ( parentElement instanceof AttributeTypeWrapper ) || ( parentElement instanceof
ObjectClassWrapper )
-            || ( parentElement instanceof SchemaWrapper ) )
+        else if ( ( parentElement instanceof AttributeTypeWrapper ) || ( parentElement instanceof
ObjectClassWrapper ) )
+        {
+            children = ( ( TreeNode ) parentElement ).getChildren();
+
+            // Sort by
+            if ( sortBy == PluginConstants.PREFS_SCHEMA_VIEW_SORTING_BY_FIRSTNAME )
+            {
+                Collections.sort( children, firstNameSorter );
+            }
+            else if ( sortBy == PluginConstants.PREFS_SCHEMA_VIEW_SORTING_BY_OID )
+            {
+                Collections.sort( children, oidSorter );
+            }
+
+            // Sort Order
+            if ( sortOrder == PluginConstants.PREFS_SCHEMA_VIEW_SORTING_ORDER_DESCENDING
)
+            {
+                Collections.reverse( children );
+            }
+        }
+        else if ( parentElement instanceof SchemaWrapper )
         {
             children = ( ( TreeNode ) parentElement ).getChildren();
 
@@ -862,6 +881,56 @@
      */
     public void objectClassAddedHierarchicalPresentation( ObjectClassImpl oc )
     {
+        // Removing unattached nodes for "top"
+        List<Object> ocChildren = new ArrayList<Object>();
+        List<Object> ocChildren2 = null;
+        if ( "2.5.6.0".equals( oc.getOid() ) )
+        {
+            ocChildren2 = hierarchyManager.getChildren( "2.5.6.0" );
+            if ( ocChildren2 != null )
+            {
+                ocChildren.addAll( ocChildren2 );
+            }
+            ocChildren2 = hierarchyManager.getChildren( "top" );
+            if ( ocChildren2 != null )
+            {
+                ocChildren.addAll( ocChildren2 );
+            }
+        }
+        ocChildren2 = hierarchyManager.getChildren( oc );
+        if ( ocChildren2 != null )
+        {
+            ocChildren.addAll( ocChildren2 );
+        }
+        for ( Object ocChild : ocChildren )
+        {
+            List<TreeNode> wrappers = getWrappers( ocChild );
+            if ( wrappers != null )
+            {
+                for ( TreeNode wrapper : wrappers )
+                {
+                    int group = store.getInt( PluginConstants.PREFS_SCHEMA_VIEW_GROUPING
);
+                    if ( group == PluginConstants.PREFS_SCHEMA_VIEW_GROUPING_FOLDERS )
+                    {
+                        if ( wrapper.getParent().getParent().equals( root ) )
+                        {
+                            wrapper.getParent().removeChild( wrapper );
+                            elementsToWrappersMap.remove( oc, wrapper );
+                        }
+                    }
+                    else if ( group == PluginConstants.PREFS_SCHEMA_VIEW_GROUPING_MIXED )
+                    {
+                        if ( wrapper.getParent().equals( root ) )
+                        {
+                            wrapper.getParent().removeChild( wrapper );
+                            elementsToWrappersMap.remove( oc, wrapper );
+                        }
+                    }
+                    removeRecursiveChildren( wrapper );
+                }
+            }
+        }
+
         // Propagating the addition to the hierarchy manager
         hierarchyManager.objectClassAdded( oc );
 
@@ -932,6 +1001,7 @@
                     ObjectClassWrapper ocw = new ObjectClassWrapper( ( ObjectClassImpl )
child, createdWrapper );
                     ocw.getParent().addChild( ocw );
                     elementsToWrappersMap.put( ( ObjectClassImpl ) child, ocw );
+                    addHierarchyChildren( ocw, hierarchyManager.getChildren( child ) );
                 }
             }
         }
@@ -1181,7 +1251,15 @@
      */
     private void schemaAddedHierarchicalPresentation( Schema schema )
     {
-        // TODO implement
+        for ( AttributeTypeImpl at : schema.getAttributeTypes() )
+        {
+            attributeTypeAddedHierarchicalPresentation( at );
+        }
+
+        for ( ObjectClassImpl oc : schema.getObjectClasses() )
+        {
+            objectClassAddedHierarchicalPresentation( oc );
+        }
     }
 
 
@@ -1233,8 +1311,15 @@
      */
     private void schemaRemovedHierarchicalPresentation( Schema schema )
     {
-        // TODO implement
+        for ( AttributeTypeImpl at : schema.getAttributeTypes() )
+        {
+            attributeTypeRemovedHierarchicalPresentation( at );
+        }
 
+        for ( ObjectClassImpl oc : schema.getObjectClasses() )
+        {
+            objectClassRemovedHierarchicalPresentation( oc );
+        }
     }
 
 



Mime
View raw message