/*
  *  Use reflection to make a test compilable on not Mac OS X
  */
 private static void enableFullScreen(Window window) {
   try {
     Class fullScreenUtilities = Class.forName("com.apple.eawt.FullScreenUtilities");
     Method setWindowCanFullScreen =
         fullScreenUtilities.getMethod("setWindowCanFullScreen", Window.class, boolean.class);
     setWindowCanFullScreen.invoke(fullScreenUtilities, window, true);
     Class fullScreenListener = Class.forName("com.apple.eawt.FullScreenListener");
     Object listenerObject =
         Proxy.newProxyInstance(
             fullScreenListener.getClassLoader(),
             new Class[] {fullScreenListener},
             new InvocationHandler() {
               @Override
               public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
                 switch (method.getName()) {
                   case "windowEnteringFullScreen":
                     windowEnteringFullScreen = true;
                     break;
                   case "windowEnteredFullScreen":
                     windowEnteredFullScreen = true;
                     break;
                 }
                 return null;
               }
             });
     Method addFullScreenListener =
         fullScreenUtilities.getMethod(
             "addFullScreenListenerTo", Window.class, fullScreenListener);
     addFullScreenListener.invoke(fullScreenUtilities, window, listenerObject);
   } catch (Exception e) {
     throw new RuntimeException("FullScreen utilities not available", e);
   }
 }
Example #2
0
  void enableLionFS() {
    try {
      String version = System.getProperty("os.version");
      String[] tokens = version.split("\\.");
      int major = Integer.parseInt(tokens[0]), minor = 0;
      if (tokens.length > 1) minor = Integer.parseInt(tokens[1]);
      if (major < 10 || (major == 10 && minor < 7))
        throw new Exception("Operating system version is " + version);

      Class fsuClass = Class.forName("com.apple.eawt.FullScreenUtilities");
      Class argClasses[] = new Class[] {Window.class, Boolean.TYPE};
      Method setWindowCanFullScreen = fsuClass.getMethod("setWindowCanFullScreen", argClasses);
      setWindowCanFullScreen.invoke(fsuClass, this, true);

      Class fsListenerClass = Class.forName("com.apple.eawt.FullScreenListener");
      InvocationHandler fsHandler = new MyInvocationHandler(cc);
      Object proxy =
          Proxy.newProxyInstance(
              fsListenerClass.getClassLoader(), new Class[] {fsListenerClass}, fsHandler);
      argClasses = new Class[] {Window.class, fsListenerClass};
      Method addFullScreenListenerTo = fsuClass.getMethod("addFullScreenListenerTo", argClasses);
      addFullScreenListenerTo.invoke(fsuClass, this, proxy);

      canDoLionFS = true;
    } catch (Exception e) {
      vlog.debug("Could not enable OS X 10.7+ full-screen mode:");
      vlog.debug("  " + e.toString());
    }
  }
Example #3
0
 public void toggleLionFS() {
   try {
     Class appClass = Class.forName("com.apple.eawt.Application");
     Method getApplication = appClass.getMethod("getApplication", (Class[]) null);
     Object app = getApplication.invoke(appClass);
     Method requestToggleFullScreen = appClass.getMethod("requestToggleFullScreen", Window.class);
     requestToggleFullScreen.invoke(app, this);
   } catch (Exception e) {
     vlog.debug("Could not toggle OS X 10.7+ full-screen mode:");
     vlog.debug("  " + e.toString());
   }
 }
Example #4
0
  /**
   * Load a class specified by a file- or entry-name
   *
   * @param name name of a file or entry
   * @return class file that was denoted by the name, null if no class or does not contain a main
   *     method
   */
  private Class load(String name) {
    if (name.endsWith(".class") && name.indexOf("Test") >= 0 && name.indexOf('$') < 0) {
      String classname = name.substring(0, name.length() - ".class".length());

      if (classname.startsWith("/")) {
        classname = classname.substring(1);
      }
      classname = classname.replace('/', '.');

      try {
        final Class<?> cls = Class.forName(classname);
        cls.getMethod("main", new Class[] {String[].class});
        if (!getClass().equals(cls)) {
          return cls;
        }
      } catch (NoClassDefFoundError e) {
        // class has unresolved dependencies
        return null;
      } catch (ClassNotFoundException e) {
        // class not in classpath
        return null;
      } catch (NoSuchMethodException e) {
        // class does not have a main method
        return null;
      } catch (UnsupportedClassVersionError e) {
        // unsupported version
        return null;
      }
    }
    return null;
  }
  @Override
  public void actionPerformed(AnActionEvent anActionEvent) {
    KevoreeEditorComponent.getInstance(null);
    if (KevoreeEditorComponent.keveditorCL != null) {
      try {
        final Class clazz =
            KevoreeEditorComponent.keveditorCL.loadClass("org.kevoree.tools.ui.editor.runner.App");
        final Method meth = clazz.getMethod("main", String[].class);
        // TODO inject the selected file
        SwingUtilities.invokeLater(
            new Runnable() {
              @Override
              public void run() {
                String[] params = new String[0];
                try {
                  meth.invoke(null, (Object) params);
                } catch (IllegalAccessException e) {
                  e.printStackTrace();
                } catch (InvocationTargetException e) {
                  e.printStackTrace();
                }
              }
            });

      } catch (Exception e) {
        e.printStackTrace();
      }

    } else {
      com.intellij.openapi.diagnostic.Logger.getInstance(this.getClass())
          .error("Editor Jar not resolved");
    }
  }
  /**
   * Creates a new entity enumeration icon chooser.
   *
   * @param enumeration the enumeration to display in this combo box
   */
  public EnumerationIconChooser(Class<E> enumeration) {
    super();

    this.enumeration = enumeration;

    try {
      this.icons = (ImageIcon[]) enumeration.getMethod("getIcons").invoke(null);
      for (int i = 0; i < icons.length; i++) {
        addItem(icons[i]);
      }
    } catch (NoSuchMethodException ex) {
      System.err.println(
          "The method 'getIcons()' is missing in enumeration " + enumeration.getName());
      ex.printStackTrace();
      System.exit(1);
    } catch (IllegalAccessException ex) {
      System.err.println(
          "Cannot access method 'getIcons()' in enumeration "
              + enumeration.getName()
              + ": ex.getMessage()");
      ex.printStackTrace();
      System.exit(1);
    } catch (InvocationTargetException ex) {
      ex.getCause().printStackTrace();
      System.exit(1);
    }
  }
 public static FontMetrics getFontMetrics(JComponent c, Graphics g, Font f) {
   FontMetrics fm = null;
   if (getJavaVersion() >= 1.6) {
     try {
       Class swingUtilities2Class = Class.forName("sun.swing.SwingUtilities2");
       Class classParams[] = {JComponent.class, Graphics.class, Font.class};
       Method m = swingUtilities2Class.getMethod("getFontMetrics", classParams);
       Object methodParams[] = {c, g, f};
       fm = (FontMetrics) m.invoke(null, methodParams);
     } catch (Exception ex) {
       // Nothing to do
     }
   }
   if (fm == null) {
     if (g == null) {
       if (c != null) {
         g = c.getGraphics();
       }
     }
     if (g != null) {
       if (f != null) {
         fm = g.getFontMetrics(f);
       } else {
         fm = g.getFontMetrics();
       }
     } else if (c != null) {
       if (f != null) {
         fm = c.getFontMetrics(f);
       } else {
         fm = c.getFontMetrics(c.getFont());
       }
     }
   }
   return fm;
 }
 public static void drawStringUnderlineCharAt(
     JComponent c, Graphics g, String text, int underlinedIndex, int x, int y) {
   Graphics2D g2D = (Graphics2D) g;
   Object savedRenderingHint = null;
   if (AbstractLookAndFeel.getTheme().isTextAntiAliasingOn()) {
     savedRenderingHint = g2D.getRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING);
     g2D.setRenderingHint(
         RenderingHints.KEY_TEXT_ANTIALIASING,
         AbstractLookAndFeel.getTheme().getTextAntiAliasingHint());
   }
   if (getJavaVersion() >= 1.6) {
     try {
       Class swingUtilities2Class = Class.forName("sun.swing.SwingUtilities2");
       Class classParams[] = {
         JComponent.class, Graphics.class, String.class, Integer.TYPE, Integer.TYPE, Integer.TYPE
       };
       Method m = swingUtilities2Class.getMethod("drawStringUnderlineCharAt", classParams);
       Object methodParams[] = {
         c, g, text, new Integer(underlinedIndex), new Integer(x), new Integer(y)
       };
       m.invoke(null, methodParams);
     } catch (Exception ex) {
       BasicGraphicsUtils.drawString(g, text, underlinedIndex, x, y);
     }
   } else if (getJavaVersion() >= 1.4) {
     BasicGraphicsUtils.drawStringUnderlineCharAt(g, text, underlinedIndex, x, y);
   } else {
     BasicGraphicsUtils.drawString(g, text, underlinedIndex, x, y);
   }
   if (AbstractLookAndFeel.getTheme().isTextAntiAliasingOn()) {
     g2D.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, savedRenderingHint);
   }
 }
Example #9
0
  /** @since 3.0.5 */
  public static void showDBResults(StartupParameters params) {
    // System.err.println("not implemented full yet");

    // We want to do this, but because we don't know if structure-gui.jar is in the classpath we use
    // reflection to hide the calls

    UserConfiguration config = UserConfiguration.fromStartupParams(params);

    String tableClass = "org.biojava.nbio.structure.align.gui.DBResultTable";

    try {
      Class<?> c = Class.forName(tableClass);
      Object table = c.newInstance();

      Method show = c.getMethod("show", new Class[] {File.class, UserConfiguration.class});

      show.invoke(table, new File(params.getShowDBresult()), config);

    } catch (Exception e) {
      e.printStackTrace();

      System.err.println(
          "Probably structure-gui.jar is not in the classpath, can't show results...");
    }

    // DBResultTable table = new DBResultTable();

    // table.show(new File(params.getShowDBresult()),config);

  }
Example #10
0
  @SuppressWarnings({"rawtypes", "unchecked"})
  public static void showAlignmentGUI()
      throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException,
          IllegalAccessException {
    // proxy for AlignmentGui.getInstance();

    Class c = Class.forName(alignmentGUI);
    Method m = c.getMethod("getInstance", (Class[]) null);
    m.invoke(c, (Object[]) null);
  }
Example #11
0
 Method getSetMethod(Class<?> targetClass, Class<?> fieldType, String fieldName) {
   fieldName = fieldName.substring(0, 1).toUpperCase() + fieldName.substring(1);
   String methodname = "set" + fieldName;
   Method method = null;
   try {
     method = targetClass.getMethod(methodname, new Class<?>[] {fieldType});
   } catch (Exception e) {
     playerObjects.getLogFile().WriteLine(Formatting.exceptionToStackTrace(e));
   }
   return method;
 }
Example #12
0
  /**
   * Shows a structure in Jmol
   *
   * @since 3.0.5
   */
  public static void showStructure(Structure structure)
      throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException,
          IllegalAccessException, InstantiationException {

    Class<?> structureAlignmentJmol = Class.forName(strucAligJmol);

    Object strucAligJ = structureAlignmentJmol.newInstance();

    Method setS = structureAlignmentJmol.getMethod("setStructure", new Class[] {Structure.class});

    setS.invoke(strucAligJ, structure);
  }
Example #13
0
 public static void setEditable(Object comp, boolean b) {
   Class[] args1 = new Class[1];
   args1[0] = Boolean.TYPE;
   Method setEditableControlMethod = null;
   String methodName = "setEditable";
   Class controlClass = comp.getClass();
   try {
     setEditableControlMethod = controlClass.getMethod(methodName, args1);
   } catch (Exception ex) {
     Err.error("Missing method " + methodName + " from " + controlClass);
   }
   SelfReferenceUtils.invoke(comp, setEditableControlMethod, Boolean.valueOf(b));
 }
Example #14
0
 public static boolean hasEditableMethod(Object comp) {
   boolean result = true;
   String methodName = "isEditable";
   Class controlClass = comp.getClass();
   try {
     controlClass.getMethod(methodName, (Class[]) null);
   } catch (NoSuchMethodException ex1) {
     result = false;
   } catch (Exception ex2) {
     Err.error("Missing method " + methodName + " from " + controlClass + ", ex: " + ex2);
   }
   return result;
 }
Example #15
0
 public static void setText(Object comp, Object txt) {
   Class[] args1 = new Class[1];
   args1[0] = String.class;
   Method setTextControlMethod = null;
   String methodName = "setText";
   Class controlClass = comp.getClass();
   try {
     setTextControlMethod = controlClass.getMethod(methodName, args1);
   } catch (Exception ex1) {
     args1[0] = Object.class;
     try {
       setTextControlMethod = controlClass.getMethod(methodName, args1);
     } catch (Exception ex2) {
       Err.error("Missing method " + methodName + " from " + controlClass);
     }
   }
   String s = null;
   if (txt != null) {
     s = txt.toString();
   }
   SelfReferenceUtils.invoke(comp, setTextControlMethod, s);
 }
Example #16
0
 public static String getName(Object comp) {
   String result;
   Method getNameControlMethod = null;
   String methodName = "getName";
   Class controlClass = comp.getClass();
   try {
     getNameControlMethod = controlClass.getMethod(methodName, (Class[]) null);
   } catch (Exception ex) {
     Err.error("Missing method " + methodName + " from " + controlClass);
   }
   result = (String) SelfReferenceUtils.invoke(comp, getNameControlMethod);
   return result;
 }
Example #17
0
  @SuppressWarnings({"unused"})
  public static Structure getAlignedStructure(Atom[] ca1, Atom[] ca2)
      throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException,
          IllegalAccessException {

    Class<?> structureAlignmentJmol = Class.forName(strucAligJmol);

    Class<?> c = Class.forName(displayAFP);
    Method show = c.getMethod("getAlignedStructure", new Class[] {Atom[].class, Atom[].class});

    Structure s = (Structure) show.invoke(null, ca1, ca2);

    return s;
  }
Example #18
0
 Method getGetMethod(Class<?> targetClass, Class<?> fieldType, String fieldName) {
   fieldName = fieldName.substring(0, 1).toUpperCase() + fieldName.substring(1);
   String methodname = "get" + fieldName;
   if (fieldType == boolean.class || fieldType == Boolean.class) {
     methodname = "is" + fieldName;
   }
   Method method = null;
   try {
     method = targetClass.getMethod(methodname, new Class<?>[0]);
   } catch (Exception e) {
     playerObjects.getLogFile().WriteLine(Formatting.exceptionToStackTrace(e));
   }
   return method;
 }
Example #19
0
  @SuppressWarnings({"rawtypes", "unchecked"})
  public static Object display(AFPChain afpChain, Atom[] ca1, Atom[] ca2)
      throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException,
          IllegalAccessException {

    Class c = Class.forName(strucAlignmentDisplay);

    Method display =
        c.getMethod("display", new Class[] {AFPChain.class, Atom[].class, Atom[].class});

    Object structureAlignmentJmol = display.invoke(null, afpChain, ca1, ca2);

    return structureAlignmentJmol;
  }
Example #20
0
  @SuppressWarnings({"rawtypes", "unchecked", "unused"})
  public static Atom[] getAtomArray(Atom[] ca, List<Group> hetatoms, List<Group> nucs)
      throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException,
          IllegalAccessException {

    Class structureAlignmentJmol = Class.forName(strucAligJmol);

    Class c = Class.forName(displayAFP);
    Method show = c.getMethod("getAtomArray", new Class[] {Atom[].class, List.class, List.class});

    Atom[] atoms = (Atom[]) show.invoke(null, ca, hetatoms, nucs);

    return atoms;
  }
Example #21
0
  public static JPanel getScaleableMatrixPanel(Matrix m)
      throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException,
          IllegalAccessException, InstantiationException {

    Class<?> scaleMatrixPanelC = Class.forName(scaleMatrixPanel);

    Method setMatrix = scaleMatrixPanelC.getMethod("setMatrix", new Class[] {Matrix.class});

    JPanel panel = (JPanel) scaleMatrixPanelC.newInstance();

    setMatrix.invoke(panel, m);

    return panel;
  }
Example #22
0
    /** Creates a new key tip layer. */
    public KeyTipLayer() {
      this.setOpaque(false);

      // Support placing heavyweight components in the ribbon frame. See
      // http://today.java.net/article/2009/11/02/transparent-panel-mixing-heavyweight-and-lightweight-components.
      try {
        Class awtUtilitiesClass = Class.forName("com.sun.awt.AWTUtilities");
        Method mSetComponentMixing =
            awtUtilitiesClass.getMethod(
                "setComponentMixingCutoutShape", Component.class, Shape.class);
        mSetComponentMixing.invoke(null, this, new Rectangle());
      } catch (Throwable ignored) {
      }
    }
 public UMLMultiplicityComboBox(UMLUserInterfaceContainer container, Class elementClass) {
   super();
   setModel(new DefaultComboBoxModel(_mults));
   _container = container;
   addItemListener(this);
   Class[] getArgs = {};
   Class[] setArgs = {MMultiplicity.class};
   try {
     _getMethod = elementClass.getMethod("getMultiplicity", getArgs);
     _setMethod = elementClass.getMethod("setMultiplicity", setArgs);
   } catch (Exception e) {
     setEnabled(false);
     System.out.println(e.toString() + " in UMLMultiplicityComboBox()");
   }
 }
Example #24
0
  @SuppressWarnings({"rawtypes", "unchecked"})
  public static void showAlignmentImage(AFPChain afpChain, Atom[] ca1, Atom[] ca2, Object jmol)
      throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException,
          IllegalAccessException {

    Class structureAlignmentJmol = Class.forName(strucAligJmol);

    Class c = Class.forName(displayAFP);
    Method show =
        c.getMethod(
            "showAlignmentImage",
            new Class[] {AFPChain.class, Atom[].class, Atom[].class, structureAlignmentJmol});

    show.invoke(null, afpChain, ca1, ca2, jmol);
  }
Example #25
0
  public static Object worker(String pathToJar, String className, String methodName) {
    JarFile jarFile = null;
    try {
      jarFile = new JarFile(pathToJar);
    } catch (IOException e) {
      e.printStackTrace();
    }

    if (jarFile != null) {
      Enumeration e = jarFile.entries();
      while (e.hasMoreElements()) {
        try {
          URL[] urls;
          urls = new URL[] {new URL("jar:file:" + pathToJar + "!/")};
          URLClassLoader cl = URLClassLoader.newInstance(urls);
          JarEntry je = (JarEntry) e.nextElement();
          if (je.isDirectory() || !je.getName().endsWith(".class")) {
            continue;
          }
          // -6 because of .class
          String tempClassName = je.getName().substring(0, je.getName().length() - 6);
          tempClassName = tempClassName.replace('/', '.');
          if (className.equals(tempClassName)) {
            Class<?> myClass = cl.loadClass(className);
            Object whatInstance = myClass.newInstance();
            Method myMethod = myClass.getMethod(methodName, new Class[] {});
            return myMethod.invoke(whatInstance);
          }
        } catch (ClassNotFoundException
            | NoSuchMethodException
            | InstantiationException
            | MalformedURLException
            | IllegalAccessException
            | InvocationTargetException e1) {
          System.err.println(e1);
        } finally {
          try {
            jarFile.close();
          } catch (IOException e1) {
            e1.printStackTrace();
          }
        }
      }
    }
    return null;
  }
Example #26
0
    public Object createValue(UIDefaults table) {
      try {
        Class c = Class.forName(className, true, Thread.currentThread().getContextClassLoader());

        if (methodName == null) {
          return c.newInstance();
        }
        Method m = c.getMethod(methodName, (Class[]) null);

        return m.invoke(c, (Object[]) null);
      } catch (ClassNotFoundException cnfe) {
      } catch (IllegalAccessException iae) {
      } catch (InvocationTargetException ite) {
      } catch (NoSuchMethodException nsme) {
      } catch (InstantiationException ie) {
      }
      return null;
    }
Example #27
0
 /**
  * TODO - Think about reason are not going to ControlSignatures for this. Pros for not -
  * ControlSignatures is part of strandz core, whereas this is lgpl Pros for having in
  * ControlSignatures - Controls inside a table should be treated in exactly the same way as other
  * field controls. (This would require changes to info package).
  *
  * <p>Of course providing a service interface would be the answer, but changing info provides
  * inertia. Bugs because of differences will help the case for change.
  */
 public static boolean isEditable(Object comp) {
   boolean result = false;
   Method isEditableControlMethod = null;
   String methodName = "isEditable";
   Class controlClass = comp.getClass();
   boolean noMethod = false;
   try {
     isEditableControlMethod = controlClass.getMethod(methodName, (Class[]) null);
   } catch (NoSuchMethodException ex1) {
     noMethod = true;
   } catch (Exception ex2) {
     Err.error("Missing method " + methodName + " from " + controlClass + ", ex: " + ex2);
   }
   if (!noMethod) {
     result = ((Boolean) SelfReferenceUtils.invoke(comp, isEditableControlMethod)).booleanValue();
   }
   return result;
 }
    /**
     * Create a new ProjectionClass from the class
     *
     * @param pc projection class
     * @throws ClassNotFoundException couldn't find the class
     * @throws IntrospectionException problem with introspection
     */
    ProjectionClass(Class pc) throws ClassNotFoundException, IntrospectionException {
      projClass = pc;

      // eliminate common properties with "stop class" for getBeanInfo()
      Class stopClass;
      try {
        stopClass = Misc.findClass("ucar.unidata.geoloc.ProjectionImpl");
      } catch (Exception ee) {
        System.err.println("constructParamInput failed ");
        stopClass = null;
      }

      // analyze current projection class as a bean; may throw IntrospectionException
      BeanInfo info = java.beans.Introspector.getBeanInfo(projClass, stopClass);

      // find read/write methods
      PropertyDescriptor[] props = info.getPropertyDescriptors();
      if (debugBeans) {
        System.out.print("Bean Properties for class " + projClass);
        if ((props == null) || (props.length == 0)) {
          System.out.println("none");
          return;
        }
        System.out.println("");
      }
      for (int i = 0; i < props.length; i++) {
        PropertyDescriptor pd = props[i];
        Method reader = pd.getReadMethod();
        Method writer = pd.getWriteMethod();
        // only interesetd in read/write properties
        if ((reader == null) || (writer == null)) {
          continue;
        }
        // A hack to exclude some attributes
        if (pd.getName().equals("name") || pd.getName().equals("defaultMapArea")) {
          continue;
        }
        ProjectionParam p = new ProjectionParam(pd.getName(), reader, writer, pd.getPropertyType());
        paramList.add(p);

        if (debugBeans) {
          System.out.println("  -->" + p);
        }
      }

      // get an instance of this class so we can call toClassName()
      Projection project;
      if (null == (project = makeDefaultProjection())) {
        name = "none";
        return;
      }

      // invoke the toClassName method
      try {
        Method m = projClass.getMethod("getProjectionTypeLabel", VOIDCLASSARG);
        name = (String) m.invoke(project, VOIDOBJECTARG);
      } catch (NoSuchMethodException ee) {
        System.err.println(
            "ProjectionManager: class "
                + projClass
                + " does not have method getProjectionTypeLabel()");
        throw new ClassNotFoundException();
      } catch (SecurityException ee) {
        System.err.println(
            "ProjectionManager: class "
                + projClass
                + " got SecurityException on getProjectionTypeLabel()"
                + ee);
        throw new ClassNotFoundException();
      } catch (Exception ee) {
        System.err.println(
            "ProjectionManager: class "
                + projClass
                + " Exception when invoking getProjectionTypeLabel()"
                + ee);
        throw new ClassNotFoundException();
      }
    }
Example #29
0
  /**
   * Analyze class fields and fill in "voSetterMethods","voGetterMethods","indexes",reverseIndexes"
   * attributes.
   *
   * @param prefix e.g. "attrx.attry."
   * @param parentMethods getter methods of parent v.o.
   * @param classType class to analyze
   */
  private void analyzeClassFields(String prefix, Method[] parentMethods, Class classType) {
    try {
      if (prefix.split("\\.").length > ClientSettings.MAX_NR_OF_LOOPS_IN_ANALYZE_VO) return;

      // retrieve all getter and setter methods defined in the specified value object...
      String attributeName = null;
      Method[] methods = classType.getMethods();
      String aName = null;
      for (int i = 0; i < methods.length; i++) {
        attributeName = methods[i].getName();

        if (attributeName.startsWith("get")
            && methods[i].getParameterTypes().length == 0
            && ValueObject.class.isAssignableFrom(methods[i].getReturnType())) {
          aName = getAttributeName(attributeName, classType);
          Method[] newparentMethods = new Method[parentMethods.length + 1];
          System.arraycopy(parentMethods, 0, newparentMethods, 0, parentMethods.length);
          newparentMethods[parentMethods.length] = methods[i];
          analyzeClassFields(prefix + aName + ".", newparentMethods, methods[i].getReturnType());
        }

        if (attributeName.startsWith("get")
            && methods[i].getParameterTypes().length == 0
            && (methods[i].getReturnType().equals(String.class)
                || methods[i].getReturnType().equals(Long.class)
                || methods[i].getReturnType().equals(Long.TYPE)
                || methods[i].getReturnType().equals(Float.class)
                || methods[i].getReturnType().equals(Float.TYPE)
                || methods[i].getReturnType().equals(Short.class)
                || methods[i].getReturnType().equals(Short.TYPE)
                || methods[i].getReturnType().equals(Double.class)
                || methods[i].getReturnType().equals(Double.TYPE)
                || methods[i].getReturnType().equals(BigDecimal.class)
                || methods[i].getReturnType().equals(java.util.Date.class)
                || methods[i].getReturnType().equals(java.sql.Date.class)
                || methods[i].getReturnType().equals(java.sql.Timestamp.class)
                || methods[i].getReturnType().equals(Integer.class)
                || methods[i].getReturnType().equals(Integer.TYPE)
                || methods[i].getReturnType().equals(Character.class)
                || methods[i].getReturnType().equals(Boolean.class)
                || methods[i].getReturnType().equals(boolean.class)
                || methods[i].getReturnType().equals(ImageIcon.class)
                || methods[i].getReturnType().equals(Icon.class)
                || methods[i].getReturnType().equals(byte[].class)
                || methods[i].getReturnType().equals(Object.class)
                || ValueObject.class.isAssignableFrom(methods[i].getReturnType()))) {
          attributeName = getAttributeName(attributeName, classType);
          //          try {
          //            if
          // (classType.getMethod("set"+attributeName.substring(0,1).toUpperCase()+attributeName.substring(1),new Class[]{methods[i].getReturnType()})!=null)
          Method[] newparentMethods = new Method[parentMethods.length + 1];
          System.arraycopy(parentMethods, 0, newparentMethods, 0, parentMethods.length);
          newparentMethods[parentMethods.length] = methods[i];
          voGetterMethods.put(prefix + attributeName, newparentMethods);
          //          } catch (NoSuchMethodException ex) {
          //          }
        } else if (attributeName.startsWith("is")
            && methods[i].getParameterTypes().length == 0
            && (methods[i].getReturnType().equals(Boolean.class)
                || methods[i].getReturnType().equals(boolean.class))) {
          attributeName = getAttributeName(attributeName, classType);
          Method[] newparentMethods = new Method[parentMethods.length + 1];
          System.arraycopy(parentMethods, 0, newparentMethods, 0, parentMethods.length);
          newparentMethods[parentMethods.length] = methods[i];
          voGetterMethods.put(prefix + attributeName, newparentMethods);
        } else if (attributeName.startsWith("set") && methods[i].getParameterTypes().length == 1) {
          attributeName = getAttributeName(attributeName, classType);
          try {
            if (classType.getMethod(
                    "get"
                        + attributeName.substring(0, 1).toUpperCase()
                        + attributeName.substring(1),
                    new Class[0])
                != null) {
              Method[] newparentMethods = new Method[parentMethods.length + 1];
              System.arraycopy(parentMethods, 0, newparentMethods, 0, parentMethods.length);
              newparentMethods[parentMethods.length] = methods[i];
              voSetterMethods.put(prefix + attributeName, newparentMethods);
            }
          } catch (NoSuchMethodException ex) {
            try {
              if (classType.getMethod(
                      "is"
                          + attributeName.substring(0, 1).toUpperCase()
                          + attributeName.substring(1),
                      new Class[0])
                  != null) {
                Method[] newparentMethods = new Method[parentMethods.length + 1];
                System.arraycopy(parentMethods, 0, newparentMethods, 0, parentMethods.length);
                newparentMethods[parentMethods.length] = methods[i];
                voSetterMethods.put(prefix + attributeName, newparentMethods);
              }
            } catch (NoSuchMethodException exx) {
            }
          }
        }
      }

      // fill in indexes with the colProperties indexes first; after them, it will be added the
      // other indexes (of attributes not mapped with grid column...)
      HashSet alreadyAdded = new HashSet();
      int i = 0;
      for (i = 0; i < colProperties.length; i++) {
        indexes.put(new Integer(i), colProperties[i].getColumnName());
        reverseIndexes.put(colProperties[i].getColumnName(), new Integer(i));
        alreadyAdded.add(colProperties[i].getColumnName());
      }
      Enumeration en = voGetterMethods.keys();
      while (en.hasMoreElements()) {
        attributeName = en.nextElement().toString();
        if (!alreadyAdded.contains(attributeName)) {
          indexes.put(new Integer(i), attributeName);
          reverseIndexes.put(attributeName, new Integer(i));
          i++;
        }
      }
    } catch (Exception ex) {
      ex.printStackTrace();
    }
  }