directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject svn commit: r688922 - in /directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common: ./ widgets/browser/
Date Mon, 25 Aug 2008 23:39:46 GMT
Author: seelmann
Date: Mon Aug 25 16:39:46 2008
New Revision: 688922

URL: http://svn.apache.org/viewvc?rev=688922&view=rev
Log:
Fix for DIRSTUDIO-114 (group 'container entries first' in browser view)

Modified:
    directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/BrowserCommonConstants.java
    directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/BrowserCommonPreferencesInitializer.java
    directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserPreferences.java
    directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserSorter.java
    directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserSorterDialog.java

Modified: directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/BrowserCommonConstants.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/BrowserCommonConstants.java?rev=688922&r1=688921&r2=688922&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/BrowserCommonConstants.java
(original)
+++ directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/BrowserCommonConstants.java
Mon Aug 25 16:39:46 2008
@@ -84,6 +84,8 @@
 
     public static final String PREFERENCE_BROWSER_LEAF_ENTRIES_FIRST = "browserLeafEntriesFirst";
 
+    public static final String PREFERENCE_BROWSER_CONTAINER_ENTRIES_FIRST = "browserContainerEntriesFirst";
+
     public static final String PREFERENCE_BROWSER_META_ENTRIES_LAST = "browserMetaEntriesLast";
 
     public static final String PREFERENCE_BROWSER_SHOW_DIT = "browserShowDIT";

Modified: directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/BrowserCommonPreferencesInitializer.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/BrowserCommonPreferencesInitializer.java?rev=688922&r1=688921&r2=688922&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/BrowserCommonPreferencesInitializer.java
(original)
+++ directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/BrowserCommonPreferencesInitializer.java
Mon Aug 25 16:39:46 2008
@@ -130,6 +130,7 @@
         store.setDefault( BrowserCommonConstants.PREFERENCE_BROWSER_SORT_ORDER, BrowserCoreConstants.SORT_ORDER_ASCENDING
);
         store.setDefault( BrowserCommonConstants.PREFERENCE_BROWSER_SORT_LIMIT, 10000 );
         store.setDefault( BrowserCommonConstants.PREFERENCE_BROWSER_LEAF_ENTRIES_FIRST, true
);
+        store.setDefault( BrowserCommonConstants.PREFERENCE_BROWSER_CONTAINER_ENTRIES_FIRST,
false );
         store.setDefault( BrowserCommonConstants.PREFERENCE_BROWSER_META_ENTRIES_LAST, true
);
 
         // Entry Editor

Modified: directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserPreferences.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserPreferences.java?rev=688922&r1=688921&r2=688922&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserPreferences.java
(original)
+++ directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserPreferences.java
Mon Aug 25 16:39:46 2008
@@ -84,7 +84,8 @@
      */
     public int getSortBy()
     {
-        return BrowserCommonActivator.getDefault().getPreferenceStore().getInt( BrowserCommonConstants.PREFERENCE_BROWSER_SORT_BY
);
+        return BrowserCommonActivator.getDefault().getPreferenceStore().getInt(
+            BrowserCommonConstants.PREFERENCE_BROWSER_SORT_BY );
     }
 
 
@@ -126,6 +127,18 @@
 
 
     /**
+     * Returns true if container entries should be shown before leaf entries.
+     * 
+     * @return true, if container entries should be shown first
+     */
+    public boolean isContainerEntriesFirst()
+    {
+        return BrowserCommonActivator.getDefault().getPreferenceStore().getBoolean(
+            BrowserCommonConstants.PREFERENCE_BROWSER_CONTAINER_ENTRIES_FIRST );
+    }
+
+
+    /**
      * Returns true if meta entries should be shown after non-meta entries.
      * 
      * @return true, if meta entries should be shown first

Modified: directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserSorter.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserSorter.java?rev=688922&r1=688921&r2=688922&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserSorter.java
(original)
+++ directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserSorter.java
Mon Aug 25 16:39:46 2008
@@ -100,38 +100,35 @@
      */
     public int category( Object element )
     {
-        if ( preferences.isLeafEntriesFirst() || preferences.isMetaEntriesLast() )
+        if ( element instanceof IEntry )
         {
-            if ( element instanceof IEntry )
+            IEntry entry = ( IEntry ) element;
+            if ( ( entry instanceof DirectoryMetadataEntry || entry instanceof RootDSE ||
entry.isAlias() || entry
+                .isReferral() )
+                && preferences.isMetaEntriesLast() )
             {
-                IEntry entry = ( IEntry ) element;
-                if ( ( entry instanceof DirectoryMetadataEntry || entry instanceof RootDSE
|| entry.isAlias() || entry
-                    .isReferral() )
-                    && preferences.isMetaEntriesLast() )
-                {
-                    return 3;
-                }
-                else if ( entry.isSubentry() && preferences.isLeafEntriesFirst()
)
-                {
-                    return 0;
-                }
-                else if ( !entry.hasChildren() && preferences.isLeafEntriesFirst()
)
-                {
-                    return 1;
-                }
-                else
-                {
-                    return 2;
-                }
+                return 3;
+            }
+            else if ( entry.isSubentry() )
+            {
+                return 0;
+            }
+            else if ( !entry.hasChildren() && preferences.isLeafEntriesFirst() )
+            {
+                return 1;
+            }
+            else if ( entry.hasChildren() && preferences.isContainerEntriesFirst()
)
+            {
+                return 1;
             }
             else
             {
-                return 4;
+                return 2;
             }
         }
         else
         {
-            return 0;
+            return 4;
         }
     }
 

Modified: directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserSorterDialog.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserSorterDialog.java?rev=688922&r1=688921&r2=688922&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserSorterDialog.java
(original)
+++ directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserSorterDialog.java
Mon Aug 25 16:39:46 2008
@@ -79,6 +79,12 @@
     /** The leaf entries first button. */
     private Button leafEntriesFirstButton;
 
+    /** The container entries first button. */
+    private Button containerEntriesFirstButton;
+
+    /** The mixed button. */
+    private Button mixedButton;
+
     /** The meta entries last button. */
     private Button metaEntriesLastButton;
 
@@ -132,6 +138,8 @@
             IPreferenceStore store = BrowserCommonActivator.getDefault().getPreferenceStore();
             store.setValue( BrowserCommonConstants.PREFERENCE_BROWSER_LEAF_ENTRIES_FIRST,
leafEntriesFirstButton
                 .getSelection() );
+            store.setValue( BrowserCommonConstants.PREFERENCE_BROWSER_CONTAINER_ENTRIES_FIRST,
+                containerEntriesFirstButton.getSelection() );
             store.setValue( BrowserCommonConstants.PREFERENCE_BROWSER_META_ENTRIES_LAST,
metaEntriesLastButton
                 .getSelection() );
             store.setValue( BrowserCommonConstants.PREFERENCE_BROWSER_SORT_LIMIT, sortLimit
);
@@ -163,12 +171,22 @@
         composite.setLayoutData( gd );
 
         Group groupingGroup = BaseWidgetUtils.createGroup( composite, "Group entries", 1
);
+        Composite columGroup = BaseWidgetUtils.createColumnContainer( groupingGroup, 3, 1
);
 
-        leafEntriesFirstButton = BaseWidgetUtils.createCheckbox( groupingGroup, "Leaf enties
first", 1 );
+        leafEntriesFirstButton = BaseWidgetUtils.createRadiobutton( columGroup, "Leaf entries
first", 1 );
         leafEntriesFirstButton
             .setToolTipText( "This option displays entries without children before entries
with children." );
         leafEntriesFirstButton.setSelection( preferences.isLeafEntriesFirst() );
 
+        containerEntriesFirstButton = BaseWidgetUtils.createRadiobutton( columGroup, "Container
entries first", 1 );
+        containerEntriesFirstButton
+        .setToolTipText( "This option displays entries with children before entries without
children." );
+        containerEntriesFirstButton.setSelection( preferences.isContainerEntriesFirst() );
+        
+        mixedButton = BaseWidgetUtils.createRadiobutton( columGroup, "Mixed", 1 );
+        mixedButton.setToolTipText( "This option displays entries with and without children
mixed." );
+        mixedButton.setSelection( !preferences.isLeafEntriesFirst() && !preferences.isContainerEntriesFirst()
);
+
         metaEntriesLastButton = BaseWidgetUtils.createCheckbox( groupingGroup, "Meta entries
last", 1 );
         metaEntriesLastButton
             .setToolTipText( "This option displays meta entries after normal entries. Meta
entries are e.g. the root DSE or the schema entry." );



Mime
View raw message