directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject svn commit: r490383 [1/3] - in /directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor: ./ META-INF/ icons/ icons/old/ lib/ src/ src/org/ src/org/apache/ src/org/apache/directory/ src/org/apache/directory/ldapstudio/ src/org/apache/directory/ldapstu...
Date Tue, 26 Dec 2006 21:47:15 GMT
Author: seelmann
Date: Tue Dec 26 13:47:13 2006
New Revision: 490383

URL: http://svn.apache.org/viewvc?view=rev&rev=490383
Log:
Initial commit of the ACIItem Editor prototype.

Added:
    directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/.classpath
    directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/.project
    directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/META-INF/
    directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/META-INF/MANIFEST.MF
    directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/build.properties
    directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/icons/
    directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/icons/checkbox_checked.gif   (with props)
    directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/icons/checkbox_unchecked.gif   (with props)
    directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/icons/old/
    directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/icons/old/checkbox_checked.gif   (with props)
    directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/icons/old/checkbox_unchecked.gif   (with props)
    directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/icons/sample.gif   (with props)
    directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/lib/
    directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/lib/antlr-2.7.6.jar   (with props)
    directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/lib/commons-collections-3.1.jar   (with props)
    directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/lib/commons-configuration-1.2.jar   (with props)
    directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/lib/commons-lang-2.1.jar   (with props)
    directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/lib/commons-logging-1.1.jar   (with props)
    directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/lib/nlog4j-1.2.24.jar   (with props)
    directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/lib/shared-ldap-0.9.6-SNAPSHOT.jar   (with props)
    directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/plugin.xml
    directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/
    directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/Test.java
    directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/org/
    directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/org/apache/
    directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/org/apache/directory/
    directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/org/apache/directory/ldapstudio/
    directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/org/apache/directory/ldapstudio/aciitemeditor/
    directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/org/apache/directory/ldapstudio/aciitemeditor/ACIItemSerializer.java
    directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/org/apache/directory/ldapstudio/aciitemeditor/Activator.java
    directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/org/apache/directory/ldapstudio/aciitemeditor/dialogs/
    directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/org/apache/directory/ldapstudio/aciitemeditor/dialogs/ACIItemDialog.java
    directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/org/apache/directory/ldapstudio/aciitemeditor/dialogs/TextDialog.java
    directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/org/apache/directory/ldapstudio/aciitemeditor/dialogs/UserClassDialog.java
    directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/org/apache/directory/ldapstudio/aciitemeditor/dialogs/UserPermissionDialog.java
    directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/org/apache/directory/ldapstudio/aciitemeditor/editors/
    directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/org/apache/directory/ldapstudio/aciitemeditor/editors/MultiPageEditor.java
    directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/org/apache/directory/ldapstudio/aciitemeditor/editors/MultiPageEditorContributor.java
    directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/org/apache/directory/ldapstudio/aciitemeditor/widgets/
    directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/org/apache/directory/ldapstudio/aciitemeditor/widgets/ACIItemComposite.java
    directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/org/apache/directory/ldapstudio/aciitemeditor/widgets/ACIItemGeneralComposite.java
    directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/org/apache/directory/ldapstudio/aciitemeditor/widgets/ACIItemGrantsAndDenialsComposite.java
    directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/org/apache/directory/ldapstudio/aciitemeditor/widgets/ACIItemItemPermissionsComposite.java
    directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/org/apache/directory/ldapstudio/aciitemeditor/widgets/ACIItemProtectedItemsComposite.java
    directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/org/apache/directory/ldapstudio/aciitemeditor/widgets/ACIItemUserClassesComposite.java
    directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/org/apache/directory/ldapstudio/aciitemeditor/widgets/ACIItemUserPermissionsComposite.java
    directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/org/apache/directory/ldapstudio/aciitemeditor/widgets/WidgetModifyEvent.java
    directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/org/apache/directory/ldapstudio/aciitemeditor/widgets/WidgetModifyListener.java
    directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/org/apache/directory/ldapstudio/aciitemeditor/wizards/
    directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/test.aci

Added: directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/.classpath
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/.classpath?view=auto&rev=490383
==============================================================================
--- directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/.classpath (added)
+++ directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/.classpath Tue Dec 26 13:47:13 2006
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" path="src"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+	<classpathentry kind="lib" path="lib/antlr-2.7.6.jar"/>
+	<classpathentry kind="lib" path="lib/commons-collections-3.1.jar"/>
+	<classpathentry kind="lib" path="lib/commons-configuration-1.2.jar"/>
+	<classpathentry kind="lib" path="lib/commons-lang-2.1.jar"/>
+	<classpathentry kind="lib" path="lib/commons-logging-1.1.jar"/>
+	<classpathentry kind="lib" path="lib/nlog4j-1.2.24.jar"/>
+	<classpathentry kind="lib" path="lib/shared-ldap-0.9.6-SNAPSHOT.jar"/>
+	<classpathentry kind="output" path="classes"/>
+</classpath>

Added: directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/.project
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/.project?view=auto&rev=490383
==============================================================================
--- directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/.project (added)
+++ directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/.project Tue Dec 26 13:47:13 2006
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>ldapstudio-aciitemeditor</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.pde.ManifestBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.pde.SchemaBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
+		<nature>org.eclipse.pde.PluginNature</nature>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+		<nature>org.eclipse.jem.beaninfo.BeanInfoNature</nature>
+	</natures>
+</projectDescription>

Added: directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/META-INF/MANIFEST.MF?view=auto&rev=490383
==============================================================================
--- directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/META-INF/MANIFEST.MF (added)
+++ directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/META-INF/MANIFEST.MF Tue Dec 26 13:47:13 2006
@@ -0,0 +1,25 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: ACI Item Editor Plug-in
+Bundle-SymbolicName: org.apache.directory.ldapstudio.aciitemeditor;singleton:=true
+Bundle-Version: 0.0.1
+Bundle-Activator: org.apache.directory.ldapstudio.aciitemeditor.Activator
+Bundle-Localization: plugin
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.jface.text,
+ org.eclipse.core.resources,
+ org.eclipse.ui.editors,
+ org.eclipse.ui.ide,
+ org.eclipse.ui.workbench.texteditor,
+ org.eclipse.ui.forms
+Eclipse-LazyStart: true
+Bundle-Vendor: apache.org
+Bundle-ClassPath: .,
+ lib/shared-ldap-0.9.6-SNAPSHOT.jar,
+ lib/antlr-2.7.6.jar,
+ lib/commons-collections-3.1.jar,
+ lib/commons-configuration-1.2.jar,
+ lib/commons-lang-2.1.jar,
+ lib/commons-logging-1.1.jar,
+ lib/nlog4j-1.2.24.jar

Added: directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/build.properties
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/build.properties?view=auto&rev=490383
==============================================================================
--- directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/build.properties (added)
+++ directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/build.properties Tue Dec 26 13:47:13 2006
@@ -0,0 +1,13 @@
+source.. = src/
+output.. = classes/
+bin.includes = plugin.xml,\
+               META-INF/,\
+               .,\
+               icons/,\
+               lib/shared-ldap-0.9.6-SNAPSHOT.jar,\
+               lib/antlr-2.7.6.jar,\
+               lib/commons-collections-3.1.jar,\
+               lib/commons-configuration-1.2.jar,\
+               lib/commons-lang-2.1.jar,\
+               lib/commons-logging-1.1.jar,\
+               lib/nlog4j-1.2.24.jar

Added: directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/icons/checkbox_checked.gif
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/icons/checkbox_checked.gif?view=auto&rev=490383
==============================================================================
Binary file - no diff available.

Propchange: directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/icons/checkbox_checked.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/icons/checkbox_unchecked.gif
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/icons/checkbox_unchecked.gif?view=auto&rev=490383
==============================================================================
Binary file - no diff available.

Propchange: directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/icons/checkbox_unchecked.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/icons/old/checkbox_checked.gif
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/icons/old/checkbox_checked.gif?view=auto&rev=490383
==============================================================================
Binary file - no diff available.

Propchange: directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/icons/old/checkbox_checked.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/icons/old/checkbox_unchecked.gif
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/icons/old/checkbox_unchecked.gif?view=auto&rev=490383
==============================================================================
Binary file - no diff available.

Propchange: directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/icons/old/checkbox_unchecked.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/icons/sample.gif
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/icons/sample.gif?view=auto&rev=490383
==============================================================================
Binary file - no diff available.

Propchange: directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/icons/sample.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/lib/antlr-2.7.6.jar
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/lib/antlr-2.7.6.jar?view=auto&rev=490383
==============================================================================
Binary file - no diff available.

Propchange: directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/lib/antlr-2.7.6.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/lib/commons-collections-3.1.jar
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/lib/commons-collections-3.1.jar?view=auto&rev=490383
==============================================================================
Binary file - no diff available.

Propchange: directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/lib/commons-collections-3.1.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/lib/commons-configuration-1.2.jar
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/lib/commons-configuration-1.2.jar?view=auto&rev=490383
==============================================================================
Binary file - no diff available.

Propchange: directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/lib/commons-configuration-1.2.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/lib/commons-lang-2.1.jar
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/lib/commons-lang-2.1.jar?view=auto&rev=490383
==============================================================================
Binary file - no diff available.

Propchange: directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/lib/commons-lang-2.1.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/lib/commons-logging-1.1.jar
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/lib/commons-logging-1.1.jar?view=auto&rev=490383
==============================================================================
Binary file - no diff available.

Propchange: directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/lib/commons-logging-1.1.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/lib/nlog4j-1.2.24.jar
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/lib/nlog4j-1.2.24.jar?view=auto&rev=490383
==============================================================================
Binary file - no diff available.

Propchange: directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/lib/nlog4j-1.2.24.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/lib/shared-ldap-0.9.6-SNAPSHOT.jar
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/lib/shared-ldap-0.9.6-SNAPSHOT.jar?view=auto&rev=490383
==============================================================================
Binary file - no diff available.

Propchange: directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/lib/shared-ldap-0.9.6-SNAPSHOT.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/plugin.xml
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/plugin.xml?view=auto&rev=490383
==============================================================================
--- directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/plugin.xml (added)
+++ directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/plugin.xml Tue Dec 26 13:47:13 2006
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+
+   <extension
+         point="org.eclipse.ui.editors">
+      <editor
+            name="ACI Item Editor"
+            extensions="aci"
+            icon="icons/sample.gif"
+            contributorClass="org.apache.directory.ldapstudio.aciitemeditor.editors.MultiPageEditorContributor"
+            class="org.apache.directory.ldapstudio.aciitemeditor.editors.MultiPageEditor"
+            id="org.apache.directory.ldapstudio.aciitemeditor.editors.MultiPageEditor">
+      </editor>
+   </extension>
+
+</plugin>

Added: directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/Test.java
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/Test.java?view=auto&rev=490383
==============================================================================
--- directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/Test.java (added)
+++ directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/Test.java Tue Dec 26 13:47:13 2006
@@ -0,0 +1,51 @@
+import org.apache.directory.ldapstudio.aciitemeditor.ACIItemSerializer;
+import org.apache.directory.shared.ldap.aci.ACIItem;
+import org.apache.directory.shared.ldap.aci.ACIItemParser;
+
+
+public class Test
+{
+
+    public static void main (String [] args) throws Exception {
+        
+        ACIItemParser parser = new ACIItemParser( null );
+        
+
+        String spec = "{ identificationTag \"id1\", precedence 1, authenticationLevel simple, "
+            + "itemOrUserFirst itemFirst: { protectedItems  { entry }, "
+            + "itemPermissions { { userClasses { allUsers }, grantsAndDenials { grantAdd } } }"
+            + " } }";
+//        String spec = "{ identificationTag \"id1\", precedence 114, authenticationLevel simple  , "
+//            + "itemOrUserFirst itemFirst  :{ protectedItems  { entry  , attributeType { 1.2.3    , ou }  , "
+//            + " attributeValue { ou=people  , cn=Ersin  }  , rangeOfValues (cn=ErsinEr) , "
+//            + "classes and : { item: xyz , or:{item:X,item:Y}   }}  , "
+//            + "itemPermissions { { userClasses {allUsers  , userGroup { \"1.2=y,z=t\"  , \"a=b,c=d\" } "
+//            + " , subtree { { base \"ou=people\" } } }   , grantsAndDenials  {  denyCompare  , grantModify } },"
+//            + "{ precedence 10, userClasses {allUsers  , userGroup { \"1.2=y,z=t\"  , \"a=b,c=d\" } "
+//            + " , subtree { { base \"ou=people\" } } }   , grantsAndDenials  {  denyCompare  , grantModify } } } }}";
+        System.out.println(spec);
+
+        
+        ACIItem aciItem = parser.parse( spec );
+        System.out.println(aciItem);
+
+        
+        StringBuffer serializedAciItem = new StringBuffer();
+        aciItem.printToBuffer( serializedAciItem );
+        System.out.println(serializedAciItem);
+        
+        
+        ACIItem aciItem2 = parser.parse( serializedAciItem.toString() );
+        System.out.println(aciItem2);
+
+        
+        StringBuffer serializedAciItem2 = new StringBuffer();
+        aciItem.printToBuffer( serializedAciItem2 );
+        System.out.println(serializedAciItem2);
+        
+        
+    }
+
+
+    
+}

Added: directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/org/apache/directory/ldapstudio/aciitemeditor/ACIItemSerializer.java
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/org/apache/directory/ldapstudio/aciitemeditor/ACIItemSerializer.java?view=auto&rev=490383
==============================================================================
--- directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/org/apache/directory/ldapstudio/aciitemeditor/ACIItemSerializer.java (added)
+++ directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/org/apache/directory/ldapstudio/aciitemeditor/ACIItemSerializer.java Tue Dec 26 13:47:13 2006
@@ -0,0 +1,261 @@
+
+package org.apache.directory.ldapstudio.aciitemeditor;
+
+import java.util.Collection;
+import java.util.Iterator;
+
+import org.apache.directory.shared.ldap.aci.ACIItem;
+import org.apache.directory.shared.ldap.aci.ItemFirstACIItem;
+import org.apache.directory.shared.ldap.aci.ItemPermission;
+import org.apache.directory.shared.ldap.aci.ProtectedItem;
+import org.apache.directory.shared.ldap.aci.UserClass;
+import org.apache.directory.shared.ldap.aci.UserFirstACIItem;
+import org.apache.directory.shared.ldap.aci.UserPermission;
+
+public class ACIItemSerializer
+{
+
+    public static final char OPEN_CURLY = '{';
+    public static final char CLOSE_CURLY = '}';
+    public static final char SEP = ',';
+    public static final char SP = ' ';
+    public static final char COLON = ':';
+    public static final char QUOTE = '"';
+
+    
+    public static void serializeACIItem( ACIItem aciItem, StringBuffer sb ) {
+        
+        sb.append( OPEN_CURLY );
+        sb.append( SP );
+        
+        // identificationTag
+        sb.append( "identificationTag" );
+        sb.append( SP );
+        sb.append( QUOTE );
+        sb.append( aciItem.getIdentificationTag() );
+        sb.append( QUOTE );
+        sb.append( SEP );
+        sb.append( SP );
+        
+        // precedence
+        sb.append( "precedence" );
+        sb.append( SP );
+        sb.append( aciItem.getPrecedence() );
+        sb.append( SEP );
+        sb.append( SP );
+        
+        // authenticationLevel
+        sb.append( "authenticationLevel" );
+        sb.append( SP );
+        sb.append( aciItem.getAuthenticationLevel().getName() );
+        sb.append( SEP );
+        sb.append( SP );
+        
+        
+        // itemOrUserFirst
+        if(aciItem instanceof ItemFirstACIItem) 
+        {
+            sb.append( "itemOrUserFirst" );
+            sb.append( SP );
+            sb.append( "itemFirst" );
+            sb.append( COLON );
+            sb.append( SP );
+            
+            ItemFirstACIItem itemFirstACIItem = (ItemFirstACIItem)aciItem;
+            serializeItemFirst( itemFirstACIItem, sb );
+        }
+        else if(aciItem instanceof UserFirstACIItem) 
+        {
+            sb.append( "itemOrUserFirst" );
+            sb.append( SP );
+            sb.append( "userFirst" );
+            sb.append( COLON );
+            sb.append( SP );
+            
+            UserFirstACIItem userFirstACIItem = (UserFirstACIItem)aciItem;
+            serializeUserFirst( userFirstACIItem, sb );
+        }
+        
+        
+        sb.append( SP );
+        sb.append( CLOSE_CURLY );
+        
+    }
+    
+    
+    public static void serializeItemFirst( ItemFirstACIItem itemFirstACIItem, StringBuffer sb ) 
+    {
+        sb.append( OPEN_CURLY );
+        sb.append( SP );
+        
+        serializeProtectedItems( itemFirstACIItem.getProtectedItems(), sb );
+        sb.append( SEP );
+        sb.append( SP );
+        serializeItemPermissions( itemFirstACIItem.getItemPermissions(), sb );
+        
+        sb.append( SP );
+        sb.append( CLOSE_CURLY );
+    }
+
+
+    public static void serializeUserFirst( UserFirstACIItem userFirstACIItem, StringBuffer sb ) 
+    {
+        sb.append( OPEN_CURLY );
+        sb.append( SP );
+        
+        serializeUserClasses( userFirstACIItem.getUserClasses(), sb );
+        sb.append( SEP );
+        sb.append( SP );
+        serializeUserPermissions( userFirstACIItem.getUserPermission(), sb );
+        
+        sb.append( SP );
+        sb.append( CLOSE_CURLY );
+    }
+
+
+    public static void serializeProtectedItems( Collection<ProtectedItem> userPermissions, StringBuffer sb )
+    {
+        sb.append( "protectedItems" );
+        sb.append( SP );
+        sb.append( OPEN_CURLY );
+        sb.append( SP );
+
+        for ( Iterator<ProtectedItem> it = userPermissions.iterator(); it.hasNext(); )
+        {
+            ProtectedItem item = it.next();
+            if(item instanceof ProtectedItem.Entry)
+            {
+                serializeProtectedItem( (ProtectedItem.Entry)item, sb );
+            }
+            else if(item instanceof ProtectedItem.AllUserAttributeTypes)
+            {
+                serializeProtectedItem( (ProtectedItem.AllUserAttributeTypes)item, sb );
+            }
+            
+            else if(item instanceof ProtectedItem.AttributeType)
+            {
+                serializeProtectedItem( (ProtectedItem.AttributeType)item, sb );
+            }
+            else if(item instanceof ProtectedItem.AllAttributeValues)
+            {
+                serializeProtectedItem( (ProtectedItem.AllAttributeValues)item, sb );
+            }
+            else if(item instanceof ProtectedItem.AllUserAttributeTypesAndValues)
+            {
+                serializeProtectedItem( (ProtectedItem.AllUserAttributeTypesAndValues)item, sb );
+            }
+            else if(item instanceof ProtectedItem.AttributeValue)
+            {
+                serializeProtectedItem( (ProtectedItem.AttributeValue)item, sb );
+            }
+            else if(item instanceof ProtectedItem.SelfValue)
+            {
+                serializeProtectedItem( (ProtectedItem.SelfValue)item, sb );
+            }
+            else if(item instanceof ProtectedItem.RangeOfValues)
+            {
+                serializeProtectedItem( (ProtectedItem.RangeOfValues)item, sb );
+            }
+            else if(item instanceof ProtectedItem.MaxValueCount)
+            {
+                serializeProtectedItem( (ProtectedItem.MaxValueCount)item, sb );
+            }
+            else if(item instanceof ProtectedItem.MaxImmSub)
+            {
+                serializeProtectedItem( (ProtectedItem.MaxImmSub)item, sb );
+            }
+            else if(item instanceof ProtectedItem.RestrictedBy)
+            {
+                serializeProtectedItem( (ProtectedItem.RestrictedBy)item, sb );
+            }
+            else if(item instanceof ProtectedItem.Classes)
+            {
+                serializeProtectedItem( (ProtectedItem.Classes)item, sb );
+            }
+            
+
+            if(it.hasNext()) {
+                sb.append( SEP );
+                sb.append( SP );
+            }
+        }
+        
+        sb.append( SP );
+        sb.append( CLOSE_CURLY );
+    }
+    
+    
+    public static void serializeItemPermissions( Collection<ItemPermission> itemPermissions, StringBuffer sb )
+    {
+        // TODO Auto-generated method stub
+        
+    }
+    
+    
+    public static void serializeUserClasses( Collection<UserClass> userClasses, StringBuffer sb )
+    {
+        // TODO Auto-generated method stub
+        
+    }
+    
+    
+    public static void serializeUserPermissions( Collection<UserPermission> userPermissions, StringBuffer sb )
+    {
+        // TODO Auto-generated method stub
+        
+    }
+    
+    
+    
+    
+    public static void serializeProtectedItem( ProtectedItem.Entry item, StringBuffer sb )
+    {
+        sb.append( "entry" );
+    }
+    public static void serializeProtectedItem( ProtectedItem.AllUserAttributeTypes item, StringBuffer sb )
+    {
+        
+    }
+    public static void serializeProtectedItem( ProtectedItem.AttributeType item, StringBuffer sb )
+    {
+        
+    }
+    public static void serializeProtectedItem( ProtectedItem.AllAttributeValues item, StringBuffer sb )
+    {
+        
+    }
+    public static void serializeProtectedItem( ProtectedItem.AllUserAttributeTypesAndValues item, StringBuffer sb )
+    {
+        
+    }
+    public static void serializeProtectedItem( ProtectedItem.AttributeValue item, StringBuffer sb )
+    {
+        
+    }
+    public static void serializeProtectedItem( ProtectedItem.SelfValue item, StringBuffer sb )
+    {
+        
+    }
+    public static void serializeProtectedItem( ProtectedItem.RangeOfValues item, StringBuffer sb )
+    {
+        
+    }
+    public static void serializeProtectedItem( ProtectedItem.MaxValueCount item, StringBuffer sb )
+    {
+        
+    }
+    public static void serializeProtectedItem( ProtectedItem.MaxImmSub item, StringBuffer sb )
+    {
+        
+    }
+    public static void serializeProtectedItem( ProtectedItem.RestrictedBy item, StringBuffer sb )
+    {
+        
+    }
+    public static void serializeProtectedItem( ProtectedItem.Classes item, StringBuffer sb )
+    {
+        
+    }
+    
+
+}

Added: directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/org/apache/directory/ldapstudio/aciitemeditor/Activator.java
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/org/apache/directory/ldapstudio/aciitemeditor/Activator.java?view=auto&rev=490383
==============================================================================
--- directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/org/apache/directory/ldapstudio/aciitemeditor/Activator.java (added)
+++ directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/org/apache/directory/ldapstudio/aciitemeditor/Activator.java Tue Dec 26 13:47:13 2006
@@ -0,0 +1,120 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.ldapstudio.aciitemeditor;
+
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin
+{
+
+    // The plug-in ID
+    public static final String PLUGIN_ID = "org.apache.directory.ldapstudio.aciitemeditor";
+
+    // The shared instance
+    private static Activator plugin;
+
+
+    /**
+     * The constructor
+     */
+    public Activator()
+    {
+        plugin = this;
+    }
+
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+     */
+    public void start( BundleContext context ) throws Exception
+    {
+        super.start( context );
+    }
+
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+     */
+    public void stop( BundleContext context ) throws Exception
+    {
+        plugin = null;
+        super.stop( context );
+    }
+
+
+    /**
+     * Returns the shared instance
+     *
+     * @return the shared instance
+     */
+    public static Activator getDefault()
+    {
+        return plugin;
+    }
+
+
+    /**
+     * Returns an image descriptor for the image file at the given
+     * plug-in relative path
+     *
+     * @param path the path
+     * @return the image descriptor
+     */
+    public static ImageDescriptor getImageDescriptor( String path )
+    {
+        return imageDescriptorFromPlugin( PLUGIN_ID, path );
+    }
+
+
+    /**
+     * Use this method to get SWT images. A ImageRegistry is used 
+     * to manage the the path->Image mapping.
+     * <p>
+     * Note: Don't dispose the returned SWT Image. It is disposed
+     * automatically when the plugin is stopped.
+     * 
+     * @param path the path 
+     * @return The SWT Image or null
+     */
+    public Image getImage( String path )
+    {
+        Image image = getImageRegistry().get( path );
+        if ( image == null )
+        {
+            ImageDescriptor id = getImageDescriptor( path );
+            if ( id != null )
+            {
+                image = id.createImage();
+                getImageRegistry().put( path, image );
+            }
+        }
+        return image;
+    }
+}

Added: directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/org/apache/directory/ldapstudio/aciitemeditor/dialogs/ACIItemDialog.java
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/org/apache/directory/ldapstudio/aciitemeditor/dialogs/ACIItemDialog.java?view=auto&rev=490383
==============================================================================
--- directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/org/apache/directory/ldapstudio/aciitemeditor/dialogs/ACIItemDialog.java (added)
+++ directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/org/apache/directory/ldapstudio/aciitemeditor/dialogs/ACIItemDialog.java Tue Dec 26 13:47:13 2006
@@ -0,0 +1,34 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.ldapstudio.aciitemeditor.dialogs;
+
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.swt.widgets.Shell;
+
+public class ACIItemDialog extends Dialog
+{
+
+    protected ACIItemDialog( Shell parentShell )
+    {
+        super( parentShell );
+    }
+
+}

Added: directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/org/apache/directory/ldapstudio/aciitemeditor/dialogs/TextDialog.java
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/org/apache/directory/ldapstudio/aciitemeditor/dialogs/TextDialog.java?view=auto&rev=490383
==============================================================================
--- directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/org/apache/directory/ldapstudio/aciitemeditor/dialogs/TextDialog.java (added)
+++ directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/org/apache/directory/ldapstudio/aciitemeditor/dialogs/TextDialog.java Tue Dec 26 13:47:13 2006
@@ -0,0 +1,112 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.ldapstudio.aciitemeditor.dialogs;
+
+
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+
+
+public class TextDialog extends Dialog
+{
+
+    public static final String DIALOG_TITLE = "Text Editor";
+
+    public static final double MAX_WIDTH = 250.0;
+
+    public static final double MAX_HEIGHT = 250.0;
+
+    private String initialValue;
+
+    private String returnValue;
+
+    private Text text;
+
+
+    public TextDialog( Shell parentShell, String initialValue )
+    {
+        super( parentShell );
+        super.setShellStyle( super.getShellStyle() | SWT.RESIZE );
+        if(initialValue == null) initialValue = "";
+        this.initialValue = initialValue;
+        this.returnValue = null;
+    }
+
+
+    public boolean close()
+    {
+        return super.close();
+    }
+
+
+    protected void configureShell( Shell shell )
+    {
+        super.configureShell( shell );
+        shell.setText( DIALOG_TITLE );
+        //shell.setImage( BrowserUIPlugin.getDefault().getImage( BrowserUIConstants.IMG_TEXTEDITOR ) );
+    }
+
+
+    protected void createButtonsForButtonBar( Composite parent )
+    {
+        createButton( parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, false );
+        createButton( parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false );
+    }
+
+
+    protected void okPressed()
+    {
+        this.returnValue = this.text.getText();
+        super.okPressed();
+    }
+
+
+    protected Control createDialogArea( Composite parent )
+    {
+        // create composite
+        Composite composite = ( Composite ) super.createDialogArea( parent );
+        GridData gd = new GridData( GridData.FILL_BOTH );
+        composite.setLayoutData( gd );
+
+        // text widget
+        text = new Text( composite, SWT.MULTI | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL );
+        text.setText( this.initialValue );
+        gd = new GridData( GridData.FILL_BOTH );
+        gd.widthHint = convertHorizontalDLUsToPixels( IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH );
+        gd.heightHint = convertHorizontalDLUsToPixels( IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH / 2 );
+        text.setLayoutData( gd );
+
+        applyDialogFont( composite );
+        return composite;
+    }
+
+
+    public String getText()
+    {
+        return this.returnValue;
+    }
+}

Added: directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/org/apache/directory/ldapstudio/aciitemeditor/dialogs/UserClassDialog.java
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/org/apache/directory/ldapstudio/aciitemeditor/dialogs/UserClassDialog.java?view=auto&rev=490383
==============================================================================
--- directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/org/apache/directory/ldapstudio/aciitemeditor/dialogs/UserClassDialog.java (added)
+++ directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/org/apache/directory/ldapstudio/aciitemeditor/dialogs/UserClassDialog.java Tue Dec 26 13:47:13 2006
@@ -0,0 +1,269 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.ldapstudio.aciitemeditor.dialogs;
+
+
+import org.apache.directory.shared.ldap.aci.UserClass;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+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.Control;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+
+
+public class UserClassDialog extends Dialog
+{
+
+    public static final String DIALOG_TITLE = "User Class Editor";
+
+    public static final double MAX_WIDTH = 250.0;
+
+    public static final double MAX_HEIGHT = 350.0;
+
+    private String initialValue;
+
+    private String returnValue;
+
+    private Class initialClass;
+
+    private Class returnClass;
+
+    private Group group;
+
+    private Button allUsersRadio;
+
+    private Button thisEntryRadio;
+
+    private Button nameRadio;
+
+    private Button userGroupRadio;
+
+    private Button subtreeRadio;
+
+    private Text text;
+
+
+    public UserClassDialog( Shell parentShell, Class initialClass, String initialValue )
+    {
+        super( parentShell );
+        super.setShellStyle( super.getShellStyle() | SWT.RESIZE );
+        this.initialClass = initialClass;
+        if ( initialValue == null )
+            initialValue = "";
+        this.initialValue = initialValue;
+        this.returnClass = null;
+        this.returnValue = null;
+    }
+
+
+    public boolean close()
+    {
+        return super.close();
+    }
+
+
+    protected void configureShell( Shell shell )
+    {
+        super.configureShell( shell );
+        shell.setText( DIALOG_TITLE );
+        //shell.setImage( BrowserUIPlugin.getDefault().getImage( BrowserUIConstants.IMG_TEXTEDITOR ) );
+    }
+
+
+    protected void createButtonsForButtonBar( Composite parent )
+    {
+        createButton( parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, false );
+        createButton( parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false );
+    }
+
+
+    protected void okPressed()
+    {
+        returnClass = getUserClassFromRadios();
+        returnValue = text.getText();
+        super.okPressed();
+    }
+
+
+    protected Control createDialogArea( Composite parent )
+    {
+        // create composite
+        Composite composite = ( Composite ) super.createDialogArea( parent );
+        GridData gd = new GridData( GridData.FILL_BOTH );
+        composite.setLayoutData( gd );
+
+        // create classes group
+        GridLayout gridLayout = new GridLayout();
+        gridLayout.numColumns = 5;
+        GridData gridData = new GridData();
+        gridData.horizontalAlignment = GridData.FILL;
+        gridData.grabExcessHorizontalSpace = true;
+        gridData.verticalAlignment = GridData.CENTER;
+        group = new Group( composite, SWT.NONE );
+        group.setLayoutData( gridData );
+        group.setLayout( gridLayout );
+        group.setText( "User Class" );
+
+        allUsersRadio = new Button( group, SWT.RADIO );
+        allUsersRadio.setText( "All Users" );
+        allUsersRadio.addSelectionListener( new SelectionAdapter()
+        {
+            public void widgetSelected( SelectionEvent e )
+            {
+                update();
+            }
+        } );
+        thisEntryRadio = new Button( group, SWT.RADIO );
+        thisEntryRadio.setText( "This Entry" );
+        thisEntryRadio.addSelectionListener( new SelectionAdapter()
+        {
+            public void widgetSelected( SelectionEvent e )
+            {
+                update();
+            }
+        } );
+        nameRadio = new Button( group, SWT.RADIO );
+        nameRadio.setText( "Name" );
+        nameRadio.addSelectionListener( new SelectionAdapter()
+        {
+            public void widgetSelected( SelectionEvent e )
+            {
+                update();
+            }
+        } );
+        userGroupRadio = new Button( group, SWT.RADIO );
+        userGroupRadio.setText( "User Group" );
+        userGroupRadio.addSelectionListener( new SelectionAdapter()
+        {
+            public void widgetSelected( SelectionEvent e )
+            {
+                update();
+            }
+        } );
+        subtreeRadio = new Button( group, SWT.RADIO );
+        subtreeRadio.setText( "Subtree" );
+        subtreeRadio.addSelectionListener( new SelectionAdapter()
+        {
+            public void widgetSelected( SelectionEvent e )
+            {
+                update();
+            }
+        } );
+        if ( initialClass != null )
+        {
+            if ( initialClass == UserClass.AllUsers.class )
+            {
+                allUsersRadio.setSelection( true );
+            }
+            else if ( initialClass == UserClass.ThisEntry.class )
+            {
+                thisEntryRadio.setSelection( true );
+
+            }
+            else if ( initialClass == UserClass.Name.class )
+            {
+                nameRadio.setSelection( true );
+            }
+            else if ( initialClass == UserClass.UserGroup.class )
+            {
+                userGroupRadio.setSelection( true );
+            }
+            else if ( initialClass == UserClass.Subtree.class )
+            {
+                subtreeRadio.setSelection( true );
+            }
+        }
+
+        // create text widget
+        text = new Text( composite, SWT.MULTI | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL );
+        text.setText( this.initialValue );
+        gd = new GridData( GridData.FILL_BOTH );
+        gd.widthHint = convertHorizontalDLUsToPixels( IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH );
+        gd.heightHint = convertHorizontalDLUsToPixels( IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH / 2 );
+        text.setLayoutData( gd );
+
+        update();
+
+        applyDialogFont( composite );
+        return composite;
+    }
+
+
+    private void update()
+    {
+        Class clazz = getUserClassFromRadios();
+        if ( clazz == null || clazz == UserClass.AllUsers.class || clazz == UserClass.ThisEntry.class )
+        {
+            text.setEnabled( false );
+        }
+        else
+        {
+            text.setEnabled( true );
+        }
+    }
+
+
+    private Class getUserClassFromRadios()
+    {
+        if ( allUsersRadio.getSelection() )
+        {
+            return UserClass.AllUsers.class;
+        }
+        else if ( thisEntryRadio.getSelection() )
+        {
+            return UserClass.ThisEntry.class;
+        }
+        else if ( nameRadio.getSelection() )
+        {
+            return UserClass.Name.class;
+        }
+        else if ( userGroupRadio.getSelection() )
+        {
+            return UserClass.UserGroup.class;
+        }
+        else if ( subtreeRadio.getSelection() )
+        {
+            return UserClass.Subtree.class;
+        }
+
+        return null;
+    }
+
+
+    public String getText()
+    {
+        return returnValue;
+    }
+
+
+    public Class getUserClassClass()
+    {
+        return returnClass;
+    }
+}

Added: directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/org/apache/directory/ldapstudio/aciitemeditor/dialogs/UserPermissionDialog.java
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/org/apache/directory/ldapstudio/aciitemeditor/dialogs/UserPermissionDialog.java?view=auto&rev=490383
==============================================================================
--- directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/org/apache/directory/ldapstudio/aciitemeditor/dialogs/UserPermissionDialog.java (added)
+++ directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/org/apache/directory/ldapstudio/aciitemeditor/dialogs/UserPermissionDialog.java Tue Dec 26 13:47:13 2006
@@ -0,0 +1,163 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.ldapstudio.aciitemeditor.dialogs;
+
+
+import java.text.ParseException;
+import java.util.Collection;
+
+import javax.swing.SpinnerListModel;
+
+import org.apache.directory.ldapstudio.aciitemeditor.widgets.ACIItemGrantsAndDenialsComposite;
+import org.apache.directory.ldapstudio.aciitemeditor.widgets.ACIItemProtectedItemsComposite;
+import org.apache.directory.shared.ldap.aci.GrantAndDenial;
+import org.apache.directory.shared.ldap.aci.ProtectedItem;
+import org.apache.directory.shared.ldap.aci.UserClass;
+import org.apache.directory.shared.ldap.aci.UserPermission;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+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.Control;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Spinner;
+import org.eclipse.swt.widgets.Text;
+
+
+public class UserPermissionDialog extends Dialog
+{
+
+    public static final String DIALOG_TITLE = "User Permission Editor";
+
+    public static final double MAX_WIDTH = 250.0;
+
+    public static final double MAX_HEIGHT = 350.0;
+
+    private UserPermission initialUserPermission;
+
+    private UserPermission returnUserPermission;
+    
+    private Label precedenceLabel = null;
+    
+    private Spinner precedenceSpinner = null;
+    
+    private ACIItemProtectedItemsComposite protectedItemsComposite;
+    
+    private ACIItemGrantsAndDenialsComposite grantsAndDenialsComposite;
+
+
+    public UserPermissionDialog( Shell parentShell, UserPermission initialUserPermission )
+    {
+        super( parentShell );
+        super.setShellStyle( super.getShellStyle() | SWT.RESIZE );
+        this.initialUserPermission = initialUserPermission;
+        this.returnUserPermission = null;
+    }
+
+
+    public boolean close()
+    {
+        return super.close();
+    }
+
+
+    protected void configureShell( Shell shell )
+    {
+        super.configureShell( shell );
+        shell.setText( DIALOG_TITLE );
+        //shell.setImage( BrowserUIPlugin.getDefault().getImage( BrowserUIConstants.IMG_TEXTEDITOR ) );
+    }
+
+
+    protected void createButtonsForButtonBar( Composite parent )
+    {
+        createButton( parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, false );
+        createButton( parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false );
+    }
+
+
+    protected void okPressed()
+    {
+        try
+        {
+            int precedence = precedenceSpinner.getSelection();
+            Collection<ProtectedItem> protectedItems = protectedItemsComposite.getProtectedItems();
+            Collection<GrantAndDenial> grantsAndDenials = grantsAndDenialsComposite.getGrantsAndDenials();
+            returnUserPermission = new UserPermission(precedence, grantsAndDenials, protectedItems);
+            super.okPressed();
+        }
+        catch ( ParseException e )
+        {
+            MessageDialog.openError( getShell(), "Invalid User Permission", e.getMessage() );
+        }
+    }
+
+
+    protected Control createDialogArea( Composite parent )
+    {
+        Composite composite = ( Composite ) super.createDialogArea( parent );
+        GridData gd = new GridData( GridData.FILL_BOTH );
+        composite.setLayoutData( gd );
+
+        Composite spinnerComposite = new Composite( composite, SWT.NONE );
+        spinnerComposite.setLayout( new GridLayout( 2, false ) );
+        spinnerComposite.setLayoutData( new GridData() );
+        precedenceLabel = new Label( spinnerComposite, SWT.NONE );
+        precedenceLabel.setText( "Precedence:" );
+        precedenceSpinner = new Spinner( spinnerComposite, SWT.BORDER );
+        precedenceSpinner.setValues( 0, 0, 255, 0, 1, 10 );
+        GridData precedenceGridData = new GridData();
+        precedenceGridData.grabExcessHorizontalSpace = true;
+        precedenceGridData.verticalAlignment = GridData.CENTER;
+        precedenceGridData.horizontalAlignment = GridData.BEGINNING;
+        precedenceGridData.widthHint = 3 * 12;
+        precedenceSpinner.setLayoutData( precedenceGridData );
+        
+        protectedItemsComposite = new ACIItemProtectedItemsComposite( composite, SWT.NONE );
+        
+        grantsAndDenialsComposite = new ACIItemGrantsAndDenialsComposite( composite, SWT.NONE );
+
+        
+        if(initialUserPermission != null)
+        {
+            precedenceSpinner.setSelection( initialUserPermission.getPrecedence() );
+            protectedItemsComposite.setProtectedItems( initialUserPermission.getProtectedItems() );
+            grantsAndDenialsComposite.setGrantsAndDenials( initialUserPermission.getGrantsAndDenials() );
+        }
+        
+        applyDialogFont( composite );
+        return composite;
+    }
+
+
+    public UserPermission getUserPermission()
+    {
+        return returnUserPermission;
+    }
+}

Added: directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/org/apache/directory/ldapstudio/aciitemeditor/editors/MultiPageEditor.java
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/org/apache/directory/ldapstudio/aciitemeditor/editors/MultiPageEditor.java?view=auto&rev=490383
==============================================================================
--- directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/org/apache/directory/ldapstudio/aciitemeditor/editors/MultiPageEditor.java (added)
+++ directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/org/apache/directory/ldapstudio/aciitemeditor/editors/MultiPageEditor.java Tue Dec 26 13:47:13 2006
@@ -0,0 +1,134 @@
+package org.apache.directory.ldapstudio.aciitemeditor.editors;
+
+
+import org.apache.directory.ldapstudio.aciitemeditor.widgets.ACIItemComposite;
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IResourceChangeEvent;
+import org.eclipse.core.resources.IResourceChangeListener;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.dialogs.ErrorDialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IEditorSite;
+import org.eclipse.ui.IFileEditorInput;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.editors.text.TextEditor;
+import org.eclipse.ui.ide.IDE;
+import org.eclipse.ui.part.MultiPageEditorPart;
+
+
+public class MultiPageEditor extends MultiPageEditorPart implements IResourceChangeListener{
+
+    /** The visual editor used on page 1. */
+    private ACIItemComposite aciItemComposite;
+    
+	/** The source editor used on page 2. */
+	private TextEditor sourceEditor;
+
+	//private StyledText text;
+    
+    
+	public MultiPageEditor() {
+		super();
+		ResourcesPlugin.getWorkspace().addResourceChangeListener(this);
+	}
+	
+	void createPage1() 
+    {
+        aciItemComposite = new ACIItemComposite( getContainer(), SWT.NONE );
+	    int index = addPage(aciItemComposite);
+	    setPageText(index, "Visual Editor");
+	}
+    
+	void createPage2() {
+		try {
+            sourceEditor = new TextEditor();
+			int index = addPage(sourceEditor, getEditorInput());
+			setPageText(index, "Source Editor");
+		} catch (PartInitException e) {
+			ErrorDialog.openError(
+				getSite().getShell(),
+				"Error creating nested text editor",
+				null,
+				e.getStatus());
+		}
+	}
+    
+//	void createPage2() {
+//		Composite composite = new Composite(getContainer(), SWT.NONE);
+//		FillLayout layout = new FillLayout();
+//		composite.setLayout(layout);
+//		text = new StyledText(composite, SWT.H_SCROLL | SWT.V_SCROLL);
+//		text.setEditable(false);
+//
+//		int index = addPage(composite);
+//		setPageText(index, "Preview");
+//	}
+
+
+	protected void createPages() {
+		createPage1();
+		createPage2();
+        
+        
+//        ((GridData)visualPage.getUserClassesComposite().getLayoutData()).heightHint = 0;
+//        getContainer().layout( true, true );
+        //getContainer().update();
+        //getContainer().redraw();
+        
+	}
+
+
+	public void dispose() {
+		ResourcesPlugin.getWorkspace().removeResourceChangeListener(this);
+		super.dispose();
+	}
+
+
+	public void doSave(IProgressMonitor monitor) {
+		getEditor(1).doSave(monitor);
+	}
+
+
+	public void doSaveAs() {
+		IEditorPart editor = getEditor(1);
+		editor.doSaveAs();
+		setPageText(0, editor.getTitle());
+		setInput(editor.getEditorInput());
+	}
+
+	public void gotoMarker(IMarker marker) {
+		setActivePage(0);
+		IDE.gotoMarker(getEditor(1), marker);
+	}
+    
+	public void init(IEditorSite site, IEditorInput editorInput)
+		throws PartInitException {
+		if (!(editorInput instanceof IFileEditorInput))
+			throw new PartInitException("Invalid Input: Must be IFileEditorInput");
+		super.init(site, editorInput);
+	}
+    
+	public boolean isSaveAsAllowed() {
+		return true;
+	}
+    
+	/**
+	 * Calculates the contents of page 2 when the it is activated.
+	 */
+	protected void pageChange(int newPageIndex) {
+		super.pageChange(newPageIndex);
+		if (newPageIndex == 2) {
+			// TODO
+		}
+	}
+
+    public void resourceChanged( IResourceChangeEvent event )
+    {
+        
+    }
+
+
+}

Added: directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/org/apache/directory/ldapstudio/aciitemeditor/editors/MultiPageEditorContributor.java
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/org/apache/directory/ldapstudio/aciitemeditor/editors/MultiPageEditorContributor.java?view=auto&rev=490383
==============================================================================
--- directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/org/apache/directory/ldapstudio/aciitemeditor/editors/MultiPageEditorContributor.java (added)
+++ directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/org/apache/directory/ldapstudio/aciitemeditor/editors/MultiPageEditorContributor.java Tue Dec 26 13:47:13 2006
@@ -0,0 +1,103 @@
+package org.apache.directory.ldapstudio.aciitemeditor.editors;
+
+import org.eclipse.jface.action.*;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IWorkbenchActionConstants;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.actions.ActionFactory;
+import org.eclipse.ui.ide.IDE;
+import org.eclipse.ui.ide.IDEActionFactory;
+import org.eclipse.ui.part.MultiPageEditorActionBarContributor;
+import org.eclipse.ui.texteditor.ITextEditor;
+import org.eclipse.ui.texteditor.ITextEditorActionConstants;
+
+/**
+ * Manages the installation/deinstallation of global actions for multi-page editors.
+ * Responsible for the redirection of global actions to the active editor.
+ * Multi-page contributor replaces the contributors for the individual editors in the multi-page editor.
+ */
+public class MultiPageEditorContributor extends MultiPageEditorActionBarContributor {
+	private IEditorPart activeEditorPart;
+	private Action sampleAction;
+	/**
+	 * Creates a multi-page contributor.
+	 */
+	public MultiPageEditorContributor() {
+		super();
+		createActions();
+	}
+	/**
+	 * Returns the action registed with the given text editor.
+	 * @return IAction or null if editor is null.
+	 */
+	protected IAction getAction(ITextEditor editor, String actionID) {
+		return (editor == null ? null : editor.getAction(actionID));
+	}
+	/* (non-JavaDoc)
+	 * Method declared in AbstractMultiPageEditorActionBarContributor.
+	 */
+
+	public void setActivePage(IEditorPart part) {
+		if (activeEditorPart == part)
+			return;
+
+		activeEditorPart = part;
+
+		IActionBars actionBars = getActionBars();
+		if (actionBars != null) {
+
+			ITextEditor editor = (part instanceof ITextEditor) ? (ITextEditor) part : null;
+
+			actionBars.setGlobalActionHandler(
+				ActionFactory.DELETE.getId(),
+				getAction(editor, ITextEditorActionConstants.DELETE));
+			actionBars.setGlobalActionHandler(
+				ActionFactory.UNDO.getId(),
+				getAction(editor, ITextEditorActionConstants.UNDO));
+			actionBars.setGlobalActionHandler(
+				ActionFactory.REDO.getId(),
+				getAction(editor, ITextEditorActionConstants.REDO));
+			actionBars.setGlobalActionHandler(
+				ActionFactory.CUT.getId(),
+				getAction(editor, ITextEditorActionConstants.CUT));
+			actionBars.setGlobalActionHandler(
+				ActionFactory.COPY.getId(),
+				getAction(editor, ITextEditorActionConstants.COPY));
+			actionBars.setGlobalActionHandler(
+				ActionFactory.PASTE.getId(),
+				getAction(editor, ITextEditorActionConstants.PASTE));
+			actionBars.setGlobalActionHandler(
+				ActionFactory.SELECT_ALL.getId(),
+				getAction(editor, ITextEditorActionConstants.SELECT_ALL));
+			actionBars.setGlobalActionHandler(
+				ActionFactory.FIND.getId(),
+				getAction(editor, ITextEditorActionConstants.FIND));
+			actionBars.setGlobalActionHandler(
+				IDEActionFactory.BOOKMARK.getId(),
+				getAction(editor, IDEActionFactory.BOOKMARK.getId()));
+			actionBars.updateActionBars();
+		}
+	}
+	private void createActions() {
+		sampleAction = new Action() {
+			public void run() {
+				MessageDialog.openInformation(null, "Test_editor Plug-in", "Sample Action Executed");
+			}
+		};
+		sampleAction.setText("Sample Action");
+		sampleAction.setToolTipText("Sample Action tool tip");
+		sampleAction.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().
+				getImageDescriptor(IDE.SharedImages.IMG_OBJS_TASK_TSK));
+	}
+	public void contributeToMenu(IMenuManager manager) {
+		IMenuManager menu = new MenuManager("Editor &Menu");
+		manager.prependToGroup(IWorkbenchActionConstants.MB_ADDITIONS, menu);
+		menu.add(sampleAction);
+	}
+	public void contributeToToolBar(IToolBarManager manager) {
+		manager.add(new Separator());
+		manager.add(sampleAction);
+	}
+}

Added: directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/org/apache/directory/ldapstudio/aciitemeditor/widgets/ACIItemComposite.java
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/org/apache/directory/ldapstudio/aciitemeditor/widgets/ACIItemComposite.java?view=auto&rev=490383
==============================================================================
--- directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/org/apache/directory/ldapstudio/aciitemeditor/widgets/ACIItemComposite.java (added)
+++ directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/org/apache/directory/ldapstudio/aciitemeditor/widgets/ACIItemComposite.java Tue Dec 26 13:47:13 2006
@@ -0,0 +1,211 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.ldapstudio.aciitemeditor.widgets;
+
+
+import java.text.ParseException;
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.apache.directory.shared.ldap.aci.ACIItem;
+import org.apache.directory.shared.ldap.aci.AuthenticationLevel;
+import org.apache.directory.shared.ldap.aci.UserFirstACIItem;
+import org.apache.directory.shared.ldap.aci.UserPermission;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.ScrolledComposite;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+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.Label;
+
+
+/**
+ * This is the main widget of the ACI item visual editor. It manages
+ * the lifecyle of all other ACI item widgets. In particular it
+ * shows/hides the userFirst and itemFirst widgets depending on
+ * the user's selection. 
+ * <p>
+ * It extends ScrolledComposite.
+ * 
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ACIItemComposite extends ScrolledComposite implements WidgetModifyListener
+{
+    /** The inner composite for all the content */
+    private Composite composite = null;
+
+    /** The general composite contains id-tag, precedence, auth-level, userFirst/itemFirst */
+    private ACIItemGeneralComposite generalComposite = null;
+
+    /** The user classes composite used for userFirst selection */
+    private ACIItemUserClassesComposite userFirstUserClassesComposite = null;
+    
+    /** The user permission composite used for userFirst selection */
+    private ACIItemUserPermissionsComposite userFirstUserPermissionsComposite = null;
+
+    /** The protected items composite used for itemFirst selection */
+    private ACIItemProtectedItemsComposite itemFirstProtectedItemsComposite = null;
+
+    /** The item permission composite used for itemFirst selection */
+    //private ACIItemItemPermissionsComposite itemFirstItemPermissionsComposite = null;
+
+    
+    /**
+     * Creates a new instance of ACIItemComposite.
+     *
+     * @param parent
+     * @param style
+     */
+    public ACIItemComposite( Composite parent, int style )
+    {
+        super( parent, style | SWT.H_SCROLL | SWT.V_SCROLL );
+        setExpandHorizontal( true );
+        setExpandVertical( true );
+
+        createComposite();
+
+        setContent( composite );
+        setMinSize( composite.computeSize( SWT.DEFAULT, SWT.DEFAULT ) );
+    }
+
+
+    /**
+     * This method initializes the inner composite with all contained widgets.
+     *
+     */
+    private void createComposite()
+    {
+        GridLayout gridLayout = new GridLayout();
+        gridLayout.numColumns = 1;
+        GridData gridData = new GridData();
+        gridData.horizontalAlignment = GridData.FILL;
+        gridData.grabExcessHorizontalSpace = true;
+        gridData.verticalAlignment = GridData.CENTER;
+
+        composite = new Composite( this, SWT.NONE );
+        composite.setLayout( gridLayout );
+        composite.setLayoutData( gridData );
+
+
+        // test button
+        Button testButton = new Button( composite, SWT.NONE );
+        testButton.setText( " C H E C K " );
+        testButton.addSelectionListener( new SelectionAdapter(){
+            public void widgetSelected( SelectionEvent e )
+            {
+                try
+                {
+                    String identificationTag = generalComposite.getIdentificationTag();
+                    int precedence = generalComposite.getPrecedence();
+                    AuthenticationLevel authenticationLevel = generalComposite.getAuthenticationLevel();
+
+                    ACIItem item;
+                    if( generalComposite.isUserFirst() ) 
+                    {
+                        Collection userClasses = userFirstUserClassesComposite.getUserClasses();
+                        Collection userPermissions = userFirstUserPermissionsComposite.getUserPermissions();
+                        item = new UserFirstACIItem(identificationTag, precedence, authenticationLevel, userClasses, userPermissions);
+                    }
+                    else if( generalComposite.isItemFirst() )
+                    {
+                        Collection protectedItems = itemFirstProtectedItemsComposite.getProtectedItems();
+                        //Collection itemPermissions = itemFirstItemPermissionsComposite.getItemPermissions();
+                        Collection itemPermissions = new ArrayList();
+                        item = new UserFirstACIItem(identificationTag, precedence, authenticationLevel, protectedItems, itemPermissions);
+                    }
+                    else {
+                        throw new ParseException("No first selected", 0);
+                    }
+                    
+                    StringBuffer buffer = new StringBuffer();
+                    item.printToBuffer( buffer );
+                    MessageDialog.openInformation( getShell(), "Check", buffer.toString() );
+                    System.out.println(buffer.toString());
+                    
+                }
+                catch ( Exception e1 )
+                {
+                    MessageDialog.openError( getShell(), "Check Error", e1.getMessage() );
+                    e1.printStackTrace();
+                }
+            }
+        } );
+        
+        generalComposite = new ACIItemGeneralComposite( composite, SWT.NONE );
+        generalComposite.addWidgetModifyListener( this );
+
+        userFirstUserClassesComposite = new ACIItemUserClassesComposite( composite, SWT.NONE );
+        userFirstUserPermissionsComposite = new ACIItemUserPermissionsComposite( composite, SWT.NONE );
+        
+        itemFirstProtectedItemsComposite = new ACIItemProtectedItemsComposite( composite, SWT.NONE );
+        //itemFirstItemPermissionsComposite = new ACIItemItemPermissionsComposite( composite, SWT.NONE );
+
+        
+        widgetModified( null );
+    }
+
+    /**
+     * This method is called from the contained ACIItemXXXComposites 
+     * when they are modified.
+     * 
+     */
+    public void widgetModified( WidgetModifyEvent event )
+    {
+        // switch userFirst / itemFirst
+        if ( generalComposite.isItemFirst() && !generalComposite.isUserFirst() && !itemFirstProtectedItemsComposite.isVisible() )
+        {
+            userFirstUserClassesComposite.setVisible( false );
+            userFirstUserPermissionsComposite.setVisible( false );
+            itemFirstProtectedItemsComposite.setVisible( true );
+            //itemFirstItemPermissionsComposite.setVisible( true );
+
+            setMinSize( composite.computeSize( SWT.DEFAULT, SWT.DEFAULT ) );
+            layout( true, true );
+        }
+        else if ( generalComposite.isUserFirst() && !generalComposite.isItemFirst() && !userFirstUserClassesComposite.isVisible() )
+        {
+            userFirstUserClassesComposite.setVisible( true );
+            userFirstUserPermissionsComposite.setVisible( true );
+            itemFirstProtectedItemsComposite.setVisible( false );
+            //itemFirstItemPermissionsComposite.setVisible( false );
+
+            setMinSize( composite.computeSize( SWT.DEFAULT, SWT.DEFAULT ) );
+            layout( true, true );
+        }
+        else if( !generalComposite.isItemFirst() && !generalComposite.isUserFirst() )
+        {
+            userFirstUserClassesComposite.setVisible( false );
+            userFirstUserPermissionsComposite.setVisible( false );
+            itemFirstProtectedItemsComposite.setVisible( false );
+            //itemFirstItemPermissionsComposite.setVisible( false );
+
+            setMinSize( composite.computeSize( SWT.DEFAULT, SWT.DEFAULT ) );
+            layout( true, true );
+        }
+
+    }
+
+} //  @jve:decl-index=0:visual-constraint="10,10"

Added: directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/org/apache/directory/ldapstudio/aciitemeditor/widgets/ACIItemGeneralComposite.java
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/org/apache/directory/ldapstudio/aciitemeditor/widgets/ACIItemGeneralComposite.java?view=auto&rev=490383
==============================================================================
--- directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/org/apache/directory/ldapstudio/aciitemeditor/widgets/ACIItemGeneralComposite.java (added)
+++ directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/org/apache/directory/ldapstudio/aciitemeditor/widgets/ACIItemGeneralComposite.java Tue Dec 26 13:47:13 2006
@@ -0,0 +1,297 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.ldapstudio.aciitemeditor.widgets;
+
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.directory.shared.ldap.aci.AuthenticationLevel;
+import org.eclipse.jface.viewers.ArrayContentProvider;
+import org.eclipse.jface.viewers.ComboViewer;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.events.TypedEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Spinner;
+import org.eclipse.swt.widgets.Text;
+
+/**
+ * This composite contains general ACI item properties:
+ * <ul>
+ *   <li>identification tag
+ *   <li>precedence
+ *   <li>authentication level
+ *   <li>selection for userFirst or itemFirst
+ * </ul>
+ * 
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ACIItemGeneralComposite extends Composite implements ModifyListener, SelectionListener
+{
+    /** The inner composite for all the content */
+    private Composite composite = null;
+    
+    /** The identification tag label */
+    private Label identificationTagLabel = null;
+    
+    /** The identification tag text field */
+    private Text identificationTagText = null;
+
+    /** The precedence label */
+    private Label precedenceLabel = null;
+    
+    /** The spinner to select a valid precedence between 0 and 255 */
+    private Spinner precedenceSpinner = null;
+    
+    /** The authentication level label */
+    private Label authenticationLevelLabel = null;
+    
+    /** The combo to select a valid uthentication level */
+    private Combo authenticationLevelCombo = null;
+    
+    /** 
+     * The combo viewer is attached to authenticationLevelCombo to work with
+     * AuthenticationLevel objects rather than Strings 
+     */
+    private ComboViewer authenticationLevelComboViewer = null;
+    
+    /** The user or item first label */
+    private Label userOrItemFirstLabel = null;
+    
+    /** The user first radio button */
+    private Button userFirstRadioButton = null;
+    
+    /** The item first radio button */
+    private Button itemFirstRadioButton = null;
+    
+    /** The list with listers */
+    private List<WidgetModifyListener> listenerList = new ArrayList<WidgetModifyListener>();
+
+    
+    /**
+     * Creates a new instance of ACIItemGeneralComposite.
+     *
+     * @param parent
+     * @param style
+     */
+    public ACIItemGeneralComposite( Composite parent, int style )
+    {
+        super( parent, style );
+
+        GridLayout layout = new GridLayout();
+        layout.horizontalSpacing = 0;
+        layout.verticalSpacing = 0;
+        layout.marginHeight = 0;
+        layout.marginWidth = 0;
+        setLayout( layout );
+
+        GridData layoutData = new GridData();
+        layoutData.horizontalAlignment = GridData.FILL;
+        layoutData.grabExcessHorizontalSpace = true;
+        layoutData.verticalAlignment = GridData.CENTER;
+        setLayoutData( layoutData );
+
+        createComposite();
+    }
+
+
+    /**
+     * This method initializes composite	
+     *
+     */
+    private void createComposite()
+    {
+
+        GridData identificationTagGridData = new GridData();
+        identificationTagGridData.grabExcessHorizontalSpace = true;
+        identificationTagGridData.verticalAlignment = GridData.CENTER;
+        identificationTagGridData.horizontalSpan = 2;
+        identificationTagGridData.horizontalAlignment = GridData.FILL;
+
+        GridData precedenceGridData = new GridData();
+        precedenceGridData.grabExcessHorizontalSpace = true;
+        precedenceGridData.verticalAlignment = GridData.CENTER;
+        precedenceGridData.horizontalSpan = 2;
+        precedenceGridData.horizontalAlignment = GridData.BEGINNING;
+        precedenceGridData.widthHint = 3 * 12;
+
+        GridData authenticationLevelGridData = new GridData();
+        authenticationLevelGridData.grabExcessHorizontalSpace = true;
+        authenticationLevelGridData.verticalAlignment = GridData.CENTER;
+        authenticationLevelGridData.horizontalSpan = 2;
+        authenticationLevelGridData.horizontalAlignment = GridData.FILL;
+
+        GridLayout gridLayout = new GridLayout();
+        gridLayout.numColumns = 3;
+        GridData gridData = new GridData();
+        gridData.horizontalAlignment = GridData.FILL;
+        gridData.grabExcessHorizontalSpace = true;
+        gridData.verticalAlignment = GridData.CENTER;
+
+        composite = new Composite( this, SWT.NONE );
+        composite.setLayout( gridLayout );
+        composite.setLayoutData( gridData );
+        
+        identificationTagLabel = new Label( composite, SWT.NONE );
+        identificationTagLabel.setText( "Identification Tag:" );
+        identificationTagText = new Text( composite, SWT.BORDER );
+        identificationTagText.setLayoutData( identificationTagGridData );
+        identificationTagText.addModifyListener( this );
+
+        precedenceLabel = new Label( composite, SWT.NONE );
+        precedenceLabel.setText( "Precedence:" );
+        precedenceSpinner = new Spinner( composite, SWT.BORDER );
+        precedenceSpinner.setValues( 0, 0, 255, 0, 1, 10 );
+        precedenceSpinner.setLayoutData( precedenceGridData );
+        precedenceSpinner.addModifyListener( this );
+
+        authenticationLevelLabel = new Label( composite, SWT.NONE );
+        authenticationLevelLabel.setText( "Authentication Level:" );
+        authenticationLevelCombo = new Combo( composite, SWT.READ_ONLY );
+        authenticationLevelCombo.setLayoutData( authenticationLevelGridData );
+        AuthenticationLevel[] authenticationLevels = new AuthenticationLevel[3];
+        authenticationLevels[0] = AuthenticationLevel.NONE;
+        authenticationLevels[1] = AuthenticationLevel.SIMPLE;
+        authenticationLevels[2] = AuthenticationLevel.STRONG;
+        authenticationLevelComboViewer = new ComboViewer( authenticationLevelCombo );
+        authenticationLevelComboViewer.setContentProvider( new ArrayContentProvider() );
+        authenticationLevelComboViewer.setLabelProvider( new LabelProvider() );
+        authenticationLevelComboViewer.setInput( authenticationLevels );
+        authenticationLevelCombo.addModifyListener( this );
+
+        userOrItemFirstLabel = new Label( composite, SWT.NONE );
+        userOrItemFirstLabel.setText( "User or Item first:" );
+        userFirstRadioButton = new Button( composite, SWT.RADIO );
+        userFirstRadioButton.setText( "User First" );
+        userFirstRadioButton.addSelectionListener( this );
+        itemFirstRadioButton = new Button( composite, SWT.RADIO );
+        itemFirstRadioButton.setText( "Item First" );
+        itemFirstRadioButton.addSelectionListener( this );
+
+    }
+
+
+    public void addWidgetModifyListener( WidgetModifyListener listener )
+    {
+        checkWidget();
+        if ( listener == null )
+            SWT.error( SWT.ERROR_NULL_ARGUMENT );
+        listenerList.add( listener );
+    }
+
+
+    public void removeWidgetModifyListener( WidgetModifyListener listener )
+    {
+        checkWidget();
+        if ( listener == null )
+            SWT.error( SWT.ERROR_NULL_ARGUMENT );
+        listenerList.remove( listener );
+    }
+
+
+    private void fire( TypedEvent e)
+    {
+        for ( WidgetModifyListener listener : listenerList )
+        {
+            listener.widgetModified( new WidgetModifyEvent( this ) );
+        }
+    }
+
+
+    public void modifyText( ModifyEvent e )
+    {
+        fire( e );
+    }
+
+
+    public void widgetDefaultSelected( SelectionEvent e )
+    {
+        fire( e );
+    }
+
+
+    public void widgetSelected( SelectionEvent e )
+    {
+        fire( e );
+    }
+
+    /**
+     * Returns the identification tag.
+     *
+     * @return the identification tag
+     */
+    public String getIdentificationTag()
+    {
+        return identificationTagText.getText();
+    }
+    
+    /**
+     * Returns the selected precedence.
+     *
+     * @return the selected precedence
+     */
+    public int getPrecedence()
+    {
+        return precedenceSpinner.getSelection();
+    }
+    
+    /**
+     * Returns the selected authentication level.
+     *
+     * @return the selected authentication level
+     */
+    public AuthenticationLevel getAuthenticationLevel()
+    {
+        IStructuredSelection selection = ( IStructuredSelection ) authenticationLevelComboViewer.getSelection();
+        return ( AuthenticationLevel ) selection.getFirstElement();
+    }
+    
+    /**
+     * Returns true if user first is selected.
+     *
+     * @return true if user first is selected
+     */
+    public boolean isUserFirst() {
+        return userFirstRadioButton.getSelection();
+    }
+    
+    /**
+     * Returns true if item first is selected.
+     *
+     * @return true if item first is selected
+     */
+    public boolean isItemFirst() {
+        return itemFirstRadioButton.getSelection();
+    }
+    
+} //  @jve:decl-index=0:visual-constraint="10,10"



Mime
View raw message