/*************** <auto-copyright.pl BEGIN do not edit this line> **************
 *
 * VR Juggler is (C) Copyright 1998-2005 by Iowa State University
 *
 * Original Authors:
 *   Allen Bierbaum, Christopher Just,
 *   Patrick Hartling, Kevin Meinert,
 *   Carolina Cruz-Neira, Albert Baker
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 *
 * -----------------------------------------------------------------
 * File:          $RCSfile$
 * Date modified: $Date$
 * Version:       $Revision$
 * -----------------------------------------------------------------
 *
 *************** <auto-copyright.pl END do not edit this line> ***************/
package org.vrjuggler.jccl.editors;

import java.beans.*;
import java.util.*;
import java.awt.*;
import org.vrjuggler.jccl.config.*;

/**
 * This all-static class is a registry for specialized PropertyEditors for
 * PropertyDefinitions.
 */
public class CustomEditorRegistry
{
   /**
    * Attempts to find a PropertyEditor that can edit property values described
    * by the PropertyDefinition identified by the given token.
    *
    * @param token      the token of the PropertyDefinition for which to get an
    *                   editor
    *
    * @return  an editor object for the given PropertyDefinition token; null if
    *          no suitable editor can be found
    */
   public static java.util.List findEditors(String token)
   {
      initialize();
     
      java.util.List editorList = null;
      
      if (mEditors.containsKey(token))
      {
         System.out.println("Found: " + token);
         try
         {
            java.util.List classList = (java.util.List)mEditors.get(token);
               
            editorList = new ArrayList();
            
            for(Iterator itr = classList.iterator() ; itr.hasNext() ; )
            {
               
               Class editorClass = (Class)itr.next();
               CustomEditor editor = null;
               
               editor = (CustomEditor)editorClass.newInstance();
               
               System.out.println("Editor: " + editor.getTitle());
               
               editorList.add(editor);   
            }
            
         }
         catch (Exception e)
         {
            e.printStackTrace();
            // Silently ignore errors
         }
      }
      return editorList;
   }

   /**
    * Register an editor class to be used to edit property values described by
    * the PropertyDefinition identified by the given token.
    *
    * @param token         the token of the PropertyDefinition describing the
    *                      property that will be edited
    * @param editorClass   the Class object of the editor class. If this is
    *                      null, the existing definition will be removed.
    */
   public static void registerEditor(String token, Class editorClass)
   {
      initialize();
      
      // Register the new editor class with the given token
      if (editorClass != null)
      {
         System.out.println("CustomEditorRegistry - Registering["
               + token + " -> " + editorClass);
         if(mEditors.containsKey(token))
         {
            java.util.List editorList = (java.util.List)mEditors.get(token);
            if(!editorList.contains(editorClass))
            {
               editorList.add(editorClass);
            }
         }
         else
         {
            java.util.List editorList = new ArrayList();
            editorList.add(editorClass);
            mEditors.put(token, editorList);
         }
      }
      // We have been asked to remove the editor under the given token
      else
      {
         mEditors.remove(token);
      }
   }

   /**
    * Initializes the internal editor map. We don't do initialization statically
    * so we don't eat up memory if this registry is never used.
    */
   public static void initialize()
   {
      if (mEditors == null)
      {
         mEditors = new HashMap();
      }
   }

   /**
    * The map of PropertyDefinition tokens to PropertyEditors.
    */
   private static Map mEditors = null;
}

@@ -1369,16 +1369,35 @@
 itors;%0A%0A
+import java.awt.*;%0A
 import j
@@ -1429,33 +1429,102 @@
 util.*;%0A
+%0A
 import 
-java.awt.*
+org.vrjuggler.tweek.TweekCore;%0Aimport org.vrjuggler.tweek.text.MessageDocument
 ;%0Aimport
@@ -1554,16 +1554,17 @@
 fig.*;%0A%0A
+%0A
 /**%0A * T
@@ -2297,34 +2297,107 @@
         
-System.out.println
+MessageDocument doc = TweekCore.instance().getMessageDocument();%0A         doc.printStatusnl
 (%22Found:
@@ -2401,32 +2401,33 @@
 nd: %22 + token);%0A
+%0A
          try%0A   
@@ -2892,34 +2892,33 @@
         
-System.out.println
+doc.printStatusnl
 (%22Editor
@@ -3857,26 +3857,99 @@
     
-System.out.println
+MessageDocument doc = TweekCore.instance().getMessageDocument();%0A         doc.printStatusnl
 (%22Cu
@@ -3982,17 +3982,31 @@
 tering%5B%22
-%0A
+ + token +%0A    
         
@@ -4012,25 +4012,23 @@
         
-+ token +
+       
  %22 -%3E %22 
@@ -4035,32 +4035,33 @@
 + editorClass);%0A
+%0A
          if(mEdi

Use the Tweek informational message panel to reduce the amount of informational output that goes to the console.