directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r580930 - in /directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor: controller/ controller/actions/ model/hierarchy/ view/views/
Date Mon, 01 Oct 2007 12:14:07 GMT
Author: pamarcelot
Date: Mon Oct  1 05:14:04 2007
New Revision: 580930

URL: http://svn.apache.org/viewvc?rev=580930&view=rev
Log:
Part of a fix for DIRSTUDIO-200 (Add an OC and AT hierarchical global view)
	o The ATAdded, ATModified, ATRemoved are now perfectly handled.

Modified:
    directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/SchemaViewController.java
    directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/NewAttributeTypeAction.java
    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/controller/SchemaViewController.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/SchemaViewController.java?rev=580930&r1=580929&r2=580930&view=diff
==============================================================================
--- directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/SchemaViewController.java
(original)
+++ directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/SchemaViewController.java
Mon Oct  1 05:14:04 2007
@@ -160,7 +160,6 @@
             }
             else if ( presentation == PluginConstants.PREFS_SCHEMA_VIEW_SCHEMA_PRESENTATION_HIERARCHICAL
)
             {
-                //                addAttributeTypeHierchicalPresentation( at, store, contentProvider
);
                 contentProvider.attributeTypeAdded( at );
                 view.refresh();
             }

Modified: directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/NewAttributeTypeAction.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/NewAttributeTypeAction.java?rev=580930&r1=580929&r2=580930&view=diff
==============================================================================
--- directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/NewAttributeTypeAction.java
(original)
+++ directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/NewAttributeTypeAction.java
Mon Oct  1 05:14:04 2007
@@ -79,6 +79,7 @@
         StructuredSelection selection = ( StructuredSelection ) viewer.getSelection();
         if ( ( !selection.isEmpty() ) && ( selection.size() == 1 ) )
         {
+            // TODO REFACTOR THIS
             Object firstElement = selection.getFirstElement();
             if ( firstElement instanceof SchemaWrapper )
             {

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=580930&r1=580929&r2=580930&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
Mon Oct  1 05:14:04 2007
@@ -243,6 +243,19 @@
 
     public void attributeTypeModified( AttributeTypeImpl at )
     {
+        List<Object> parents = getParents( at );
+        if ( parents != null )
+        {
+            for ( Object parent : parents )
+            {
+                childrenMap.remove( parent, at );
+            }
+
+            parentsMap.remove( at );
+        }
+
+        //        removeAttributeType( at );
+        addAttributeType( at );
     }
 
 

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=580930&r1=580929&r2=580930&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
Mon Oct  1 05:14:04 2007
@@ -87,8 +87,6 @@
         firstNameSorter = new FirstNameSorter();
         oidSorter = new OidSorter();
         schemaSorter = new SchemaSorter();
-
-        elementsToWrappersMap = new MultiValueMap();
     }
 
 
@@ -139,6 +137,8 @@
             {
                 if ( root.getChildren().isEmpty() )
                 {
+                    elementsToWrappersMap = new MultiValueMap();
+
                     SchemaHandler schemaHandler = Activator.getDefault().getSchemaHandler();
                     if ( schemaHandler != null )
                     {
@@ -190,6 +190,8 @@
             {
                 if ( root.getChildren().isEmpty() )
                 {
+                    elementsToWrappersMap = new MultiValueMap();
+
                     hierarchyManager = new HierarchyManager();
 
                     if ( group == PluginConstants.PREFS_SCHEMA_VIEW_GROUPING_FOLDERS )
@@ -535,6 +537,61 @@
 
     public void attributeTypeModified( AttributeTypeImpl at )
     {
+        // Propagating the modification to the hierarchy manager
+        hierarchyManager.attributeTypeModified( at );
+        
+        // Removing the Wrappers
+        List<TreeNode> wrappers = getWrappers( at );
+        if ( wrappers != null )
+        {
+            for ( TreeNode wrapper : wrappers )
+            {
+                wrapper.getParent().removeChild( wrapper );
+            }
+
+            elementsToWrappersMap.remove( at );
+        }
+
+        // Creating the wrapper
+        List<Object> parents = hierarchyManager.getParents( at );
+        if ( parents != null )
+        {
+            for ( Object parent : parents )
+            {
+                AttributeTypeWrapper parentATW = ( AttributeTypeWrapper ) getWrapper( parent
);
+                AttributeTypeWrapper atw = null;
+                if ( parentATW == null )
+                {
+                    int group = store.getInt( PluginConstants.PREFS_SCHEMA_VIEW_GROUPING
);
+                    if ( group == PluginConstants.PREFS_SCHEMA_VIEW_GROUPING_FOLDERS )
+                    {
+                        for ( TreeNode child : root.getChildren() )
+                        {
+                            if ( child instanceof Folder )
+                            {
+                                Folder folder = ( Folder ) child;
+                                if ( folder.getType().equals( FolderType.ATTRIBUTE_TYPE )
)
+                                {
+                                    atw = new AttributeTypeWrapper( at, folder );
+                                    break;
+                                }
+                            }
+                        }
+                    }
+                    else if ( group == PluginConstants.PREFS_SCHEMA_VIEW_GROUPING_MIXED )
+                    {
+                        atw = new AttributeTypeWrapper( at, root );
+                    }
+
+                }
+                else
+                {
+                    atw = new AttributeTypeWrapper( at, parentATW );
+                }
+                atw.getParent().addChild( atw );
+                elementsToWrappersMap.put( at, atw );
+            }
+        }
     }
 
 
@@ -596,13 +653,13 @@
     {
         for ( TreeNode child : wrapper.getChildren() )
         {
-            if ( child instanceof AttributeTypeImpl )
+            if ( child instanceof AttributeTypeWrapper )
             {
-                elementsToWrappersMap.remove( ( AttributeTypeImpl ) child, child );
+                elementsToWrappersMap.remove( ( ( AttributeTypeWrapper ) child ).getAttributeType(),
child );
             }
-            else if ( child instanceof ObjectClassImpl )
+            else if ( child instanceof ObjectClassWrapper )
             {
-                elementsToWrappersMap.remove( ( ObjectClassImpl ) child, child );
+                elementsToWrappersMap.remove( ( ( ObjectClassWrapper ) child ).getObjectClass(),
child );
             }
         }
     }



Mime
View raw message