COM 3240: Component-Based Programming
Prof. Lorenz 

Out: Apr 1, 2002
Due:
Apr 15, 2002

 

Problem Set #3: Adjusting Third-Party Component

Readings

Read Sections 15.2.3 and 15.3.1 in the Textbook.

Goal

In this exercise you are to "adjust" a third-party component to work with your visual builder. Given a third-party Nand component, for which you have only the class file (i.e., no source code), you are required to write a NandBeanInfo class that will make it appear to the builder as a "normal" JavaBean.

You are given

  1. A jar-file NAND.jar containing the Nand class.
  2. A jar-file NAND-test.jar containing 2 beans: BooleanSource and BooleanOutput.
  3. A GIF image: nand.gif to be associated with the Nand bean (as its icon).

You are required

  1. To write a NandBeanInfo class that make the Nand bean to "look and feel" like the friendly NandGate from Problem Set #1.

Instructions

  1. You should study the API of the give-away class in NAND.jar.
  2. (Load the NAND.jar as is into the BDK1.1 and observe its "misbehavior".)
  3. Write for the Nand class a Java bean-information class, named NandBeanInfo, which implements the java.beans.BeanInfo interface. You may extend the class java.beans.SimpleBeanInfo, if you like, but do not use a code generator.
  4. The NandBeanInfo class should "fix" the appearance of the Nand class, so that in the a visual bean-development tools, like the BDK, the Nand class would appear to have the same "look and feel" as the NandGate from Problem Set#1.
  5. Submit the source file of your NandBeanInfo class, and solution.jar to: com3240-grader@ccs.neu.edu with COM3240-EX3 in the subject field.

Description of the give-away BooleanSource, and BooleanOutput

  1. These are the same classes used in the Problem Set #1.  

How to test your NandBeanInfo in the BDK1.1

  1. To test your new component in the BDK1.1, you will first have to create a jar file, and then load it into the BeanBox.
  2. First, however, you will need to compile your class.
  3. Your NandBeanInfo class should be in the com3240 package. It should be in the same package as the Nand bean.
  4. To compile your class type:
    javac -classpath NAND.jar com3240/NandBeanInfo.java
  1. To be able to create a jar file, you would also need a manifest file. For your convenience, the manifest file is provided here: solution.mf
  1. Chose a nice GIF for you component (or download the nand.gif we used for Problem Set #1). If you chose another GIF, make sure the dimensions are correct.
  2. Now you are ready to create the jar file with both the bean and your BeanInfo in it, by typing (the order is important!):
    jar xf NAND.jar

    jar cfm solution.jar solution.mf nand.gif com3240/*.class