Commits

Pierre-Arnaud Marcelot  committed 7636c5f

Added two specific checkboxes for all (user) attributes and all operational attributes.

git-svn-id: https://svn.apache.org/repos/asf/directory/studio/trunk@141126713f79535-47bb-0310-9956-ffa450edef68

  • Participants
  • Parent commits 88a01b2

Comments (0)

Files changed (1)

File plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/ReplicationDetailsPage.java

 import java.util.List;
 
 import org.apache.directory.server.config.beans.ReplConsumerBean;
+import org.apache.directory.shared.ldap.model.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.model.exception.LdapInvalidDnException;
 import org.apache.directory.shared.ldap.model.message.AliasDerefMode;
 import org.apache.directory.shared.ldap.model.message.SearchScope;
     private String[] attributeNamesAndOids;
 
     /** The list of attributes */
-    private List<String> attributesList;
+    private List<String> attributesList = new ArrayList<String>();
 
     // UI Widgets
     private Button enabledCheckbox;
     private Button subtreeScopeButton;
     private Button oneLevelScopeButton;
     private Button objectScopeButton;
+    private Button allAttributesCheckbox;
+    private Button allOperationalAttributesCheckbox;
     private TableViewer attributesTableViewer;
     private Button addAttributeButton;
     private Button editAttributeButton;
 
         // Attributes Label
         Label attributesLabel = toolkit.createLabel( composite, "Attributes:" );
-        attributesLabel.setLayoutData( new GridData( SWT.FILL, SWT.CENTER, true, false, 3, 1 ) );
+        attributesLabel.setLayoutData( new GridData( SWT.FILL, SWT.CENTER, false, false ) );
+
+        // All Attributes Checkbox
+        allAttributesCheckbox = toolkit.createButton( composite, "All Attributes", SWT.CHECK );
+        allAttributesCheckbox.setLayoutData( new GridData( SWT.FILL, SWT.CENTER, true, false, 2, 1 ) );
+
+        // All Operational Attributes Checkbox
+        toolkit.createLabel( composite, "" ); //$NON-NLS-1$
+        allOperationalAttributesCheckbox = toolkit.createButton( composite, "All Operational Attributes", SWT.CHECK );
+        allOperationalAttributesCheckbox.setLayoutData( new GridData( SWT.FILL, SWT.CENTER, true, false, 2, 1 ) );
 
         // Attributes Table Viewer
         Composite attributesTableComposite = toolkit.createComposite( composite );
         attributesTable.setLayoutData( new GridData( SWT.FILL, SWT.FILL, true, true, 1, 3 ) );
         attributesTableViewer = new TableViewer( attributesTable );
         attributesTableViewer.setContentProvider( new ArrayContentProvider() );
+        attributesTableViewer.setInput( attributesList );
 
         addAttributeButton = toolkit.createButton( attributesTableComposite, "Add...", SWT.PUSH );
         addAttributeButton.setLayoutData( createNewButtonGridData() );
         subtreeScopeButton.addSelectionListener( buttonSelectionListener );
         oneLevelScopeButton.addSelectionListener( buttonSelectionListener );
         objectScopeButton.addSelectionListener( buttonSelectionListener );
+        allAttributesCheckbox.addSelectionListener( buttonSelectionListener );
+        allOperationalAttributesCheckbox.addSelectionListener( buttonSelectionListener );
         attributesTableViewer.addDoubleClickListener( attributesTableViewerDoubleClickListener );
         attributesTableViewer.addSelectionChangedListener( attributesTableViewerSelectionListener );
         addAttributeButton.addSelectionListener( addAttributeButtonSelectionListener );
         subtreeScopeButton.removeSelectionListener( buttonSelectionListener );
         oneLevelScopeButton.removeSelectionListener( buttonSelectionListener );
         objectScopeButton.removeSelectionListener( buttonSelectionListener );
+        allAttributesCheckbox.removeSelectionListener( buttonSelectionListener );
+        allOperationalAttributesCheckbox.removeSelectionListener( buttonSelectionListener );
         attributesTableViewer.removeDoubleClickListener( attributesTableViewerDoubleClickListener );
         attributesTableViewer.removeSelectionChangedListener( attributesTableViewerSelectionListener );
         addAttributeButton.removeSelectionListener( addAttributeButtonSelectionListener );
 
             // Aliases Dereferencing
             input.setReplAliasDerefMode( getAliasDerefMode().getJndiValue() );
+
+            // Attributes
+            List<String> replAttributes = new ArrayList<String>();
+            replAttributes.addAll( attributesList );
+
+            // All (User) Attribute
+            if ( allAttributesCheckbox.getSelection() )
+            {
+                replAttributes.add( SchemaConstants.ALL_USER_ATTRIBUTES );
+            }
+
+            // All Operational Attributes
+            if ( allOperationalAttributesCheckbox.getSelection() )
+            {
+                replAttributes.add( SchemaConstants.ALL_OPERATIONAL_ATTRIBUTES );
+            }
+
+            input.setReplAttributes( replAttributes );
         }
     }
 
             }
 
             // Attributes
-            attributesList = input.getReplAttributes();
-            attributesTableViewer.setInput( attributesList );
+            attributesList.clear();
+            attributesList.addAll( input.getReplAttributes() );
+
+            // All Attributes Checkbox
+            if ( attributesList.contains( SchemaConstants.ALL_USER_ATTRIBUTES ) )
+            {
+                attributesList.remove( SchemaConstants.ALL_USER_ATTRIBUTES );
+                allAttributesCheckbox.setSelection( true );
+            }
+            else
+            {
+                allAttributesCheckbox.setSelection( false );
+            }
+
+            // All Operational Attributes Checkbox
+            if ( attributesList.contains( SchemaConstants.ALL_OPERATIONAL_ATTRIBUTES ) )
+            {
+                attributesList.remove( SchemaConstants.ALL_OPERATIONAL_ATTRIBUTES );
+                allOperationalAttributesCheckbox.setSelection( true );
+            }
+            else
+            {
+                allOperationalAttributesCheckbox.setSelection( false );
+            }
+
+            attributesTableViewer.refresh();
         }
 
         addListeners();