Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4075793

java.beans.beancontext.BeanContextSupport.needsGui() works wrong.

XMLWordPrintable

    • 1.2fcs
    • sparc
    • solaris_2.5
    • Not verified



      Name: mgC56079 Date: 09/02/97



        The java.beans.beancontext.BeanContextSupport.needsGui() should
        return true if beanContextPeer implements interface Visibility,
        but may return false.

      Here is the javadoc comment for this method:

        This method is typically called from the environment in order to determine
        if the implementor "needs" a GUI.
        The algorithm used herein tests the BeanContextPeer,
        and its current children to determine if they are either Containers,
        Components, or if they implement Visibility and return needsGui() == true.

      Here is the test demonstrating the bug:

      -----------DummyVisibilitySupport.java-----------
      import java.beans.beancontext.BeanContextSupport;
      import java.beans.Visibility;

      public class DummyVisibilitySupport extends BeanContextSupport implements Visibility {
        
        public DummyVisibilitySupport() {}
        public boolean avoidingGui() {return false;}
        public void dontUseGui() {}
        public boolean needsGui() { return true;}
        public void okToUseGui() {}
      }


      -----------------Test.java------------------------

      import DummyVisibilitySupport;
      import java.beans.beancontext.BeanContextSupport;
      import java.beans.beancontext.BeanContext;

      public class Test extends BeanContextSupport {
            public Test(BeanContext peer) {
                super(peer);
            }

          public static void main(String args[]) {
              
              Test test = new Test(new DummyVisibilitySupport());
              if (!test.needsGui()) {
                  System.out.println("needsGui() == false.");
              }
          }
      }

      ---------Output from the test---------------------
      needsGui() == false.
      --------------------------------------------------

      ======================================================================

            lcablesunw Larry Cable (Inactive)
            mgorshen Mikhail Gorshenev (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: