You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by ak...@apache.org on 2006/01/19 23:46:58 UTC

svn commit: r370658 - in /directory/trunks/apacheds: core/src/main/java/org/apache/ldap/server/partition/impl/btree/gui/IndexDialog.java protocols/ldap/src/main/java/org/apache/ldap/server/protocol/support/extended/LaunchDiagnosticUiHandler.java

Author: akarasulu
Date: Thu Jan 19 14:46:52 2006
New Revision: 370658

URL: http://svn.apache.org/viewcvs?rev=370658&view=rev
Log:
changes ...

 o made index dialog display the index name rather than the OID
 o made the handler launch diagnostic UI frames centered and offset from 
   each other so they can all be seen.


Modified:
    directory/trunks/apacheds/core/src/main/java/org/apache/ldap/server/partition/impl/btree/gui/IndexDialog.java
    directory/trunks/apacheds/protocols/ldap/src/main/java/org/apache/ldap/server/protocol/support/extended/LaunchDiagnosticUiHandler.java

Modified: directory/trunks/apacheds/core/src/main/java/org/apache/ldap/server/partition/impl/btree/gui/IndexDialog.java
URL: http://svn.apache.org/viewcvs/directory/trunks/apacheds/core/src/main/java/org/apache/ldap/server/partition/impl/btree/gui/IndexDialog.java?rev=370658&r1=370657&r2=370658&view=diff
==============================================================================
--- directory/trunks/apacheds/core/src/main/java/org/apache/ldap/server/partition/impl/btree/gui/IndexDialog.java (original)
+++ directory/trunks/apacheds/core/src/main/java/org/apache/ldap/server/partition/impl/btree/gui/IndexDialog.java Thu Jan 19 14:46:52 2006
@@ -92,7 +92,7 @@
         });
 
         pack();
-        setTitle("Index On Attribute '" + index.getAttribute() + "'");
+        setTitle("Index On Attribute '" + index.getAttribute().getName() + "'");
         setBounds(new java.awt.Rectangle(0, 0, 512, 471));
         getContentPane().add(mainPnl, java.awt.BorderLayout.CENTER);
         mainPnl.setLayout(new java.awt.BorderLayout());

Modified: directory/trunks/apacheds/protocols/ldap/src/main/java/org/apache/ldap/server/protocol/support/extended/LaunchDiagnosticUiHandler.java
URL: http://svn.apache.org/viewcvs/directory/trunks/apacheds/protocols/ldap/src/main/java/org/apache/ldap/server/protocol/support/extended/LaunchDiagnosticUiHandler.java?rev=370658&r1=370657&r2=370658&view=diff
==============================================================================
--- directory/trunks/apacheds/protocols/ldap/src/main/java/org/apache/ldap/server/protocol/support/extended/LaunchDiagnosticUiHandler.java (original)
+++ directory/trunks/apacheds/protocols/ldap/src/main/java/org/apache/ldap/server/protocol/support/extended/LaunchDiagnosticUiHandler.java Thu Jan 19 14:46:52 2006
@@ -17,10 +17,14 @@
 package org.apache.ldap.server.protocol.support.extended;
 
 
+import java.awt.Dimension;
+import java.awt.Point;
+import java.awt.Toolkit;
 import java.util.Iterator;
 
 import javax.naming.NamingException;
 import javax.naming.ldap.LdapContext;
+import javax.swing.JFrame;
 
 import org.apache.ldap.common.message.ExtendedRequest;
 import org.apache.ldap.common.message.ResultCodeEnum;
@@ -67,6 +71,7 @@
 
             DirectoryPartitionNexus nexus = service.getConfiguration().getPartitionNexus();
             Iterator list = nexus.listSuffixes( true );
+            int launchedWindowCount = 0;
             while ( list.hasNext() )
             {
                 LdapName dn = new LdapName( ( String ) list.next() );
@@ -75,15 +80,45 @@
                 {
                     BTreeDirectoryPartition btPartition = ( BTreeDirectoryPartition ) partition;
                     PartitionFrame frame = new PartitionFrame( btPartition, btPartition.getSearchEngine() );
+                    Point pos = getCenteredPosition( frame );
+                    pos.y = launchedWindowCount*20 + pos.y;
+                    double multiplier = getAspectRatio() * 20.0;
+                    pos.x =  ( int ) ( launchedWindowCount * multiplier ) + pos.x;
+                    frame.setLocation( pos );
                     frame.setVisible( true );
+                    launchedWindowCount++;
                 }
             }
             
             SessionsFrame sessions = new SessionsFrame();
+            Point pos = getCenteredPosition( sessions );
+            pos.y = launchedWindowCount*20 + pos.y;
+            double multiplier = getAspectRatio() * 20.0;
+            pos.x =  ( int ) ( launchedWindowCount * multiplier ) + pos.x;
+            sessions.setLocation( pos );
             sessions.setVisible( true );
             return;
         }
 
         session.write( new LaunchDiagnosticUiResponse( req.getMessageId(), ResultCodeEnum.OPERATIONSERROR ) );
+    }
+    
+    
+    public double getAspectRatio()
+    {
+        Toolkit tk = Toolkit.getDefaultToolkit();
+        Dimension screenSize = tk.getScreenSize();
+        return ( double ) screenSize.getWidth() / ( double ) screenSize.getHeight();
+    }
+    
+    
+    public Point getCenteredPosition( JFrame frame )
+    {
+        Point pt = new Point();
+        Toolkit tk = Toolkit.getDefaultToolkit();
+        Dimension screenSize = tk.getScreenSize();
+        pt.x = ( screenSize.width - frame.getWidth() ) / 2;
+        pt.y = ( screenSize.height - frame.getHeight() ) / 2;
+        return pt;
     }
 }