Beans Development Kit (BDK) Analysis (5)

zhaozj2021-02-16  45

Four. BDK Tools

From the JAR file to the ClassLoader, from the Applet class to the Applet package from the Applet class, from the class compile to the auxiliary information, from the bean package to various types of property editor, from the package event information to serialization Various operations of the object. So I will classify the tool class before analyzing:

1. JAR file operation

The operation of the JAR file includes:

l Jaraccess.java This class implements a tool that uses JAR file format to create a file.

l JARENTRYSOURCE.JAVA is used to request a JAR file

l Jarinfo.java represents a loaded JAR file that contains information about the file.

l JarLoader.java reads the contents of JAR files

l Manifest.java represents the manifest information of the JAR file

2. Applet

l AppletClassGenerator automatically generates Applet class code for Applet

l AppletGenerator.java generates an applet's JAR file by combined Beans

l MakeAppdlg.java requires a dialog box for making applets

3. Property editor

l PropertyCanvas.java supports an attribute value on a Canva, there are three member variables, which is worth noting that an object of PropertyEditor is editing. PropertyDialog is used in the Public Void Mouseclicked (MouseEvent EVT) method to get a new setting.

l PropertySelector.java is used to support the label selection of the attribute editor, which is also an object using PropertyEditor to implement editing.

l PropertyText.java is used to support the text input of the property editor, which is also an object using PropertyEditor to implement editing.

l PropertyDialog.java holds attribute editing with a general editor.

PropertyhookupManager.java

The hooks used to manage properties are used to make changes in an object to be passed to the attributes associated with it. It has a member variable is an instance of HashTable, which is used to mapping the PropertyHookUp object and event source.

l Public Synchronized Static Void Attach (Wrapper SourceWrapper, String PropertyName, Method getter,

Wrapper TargetWrapper, Method Setter)

The probably functionality can be seen from the parameters of this method. That is to contact the origin of the source object, the method, and the corresponding method of the target object. Use PropertyHookup in the implementation process to save each pair of contacts.

l PropertyNameDialog.java Properties dialog The properties of a given source object are used.

4. Bean package

Wrapper.java

Used to track each bean in the design window in Beanbox, this is the most important class in the BEAN package of BDK. It inherited Panel to implement serializable, mouselistener, MouseMotionListener interface.

l Public Wrapper (Object Bean, String Beanlabel, String Beanname) First check the parameters, determine if it is displayed, if it is not displayed, use Ourlabel to encapsulate visible Component; then join the current panel; final implementation Initialize () And the method attachlisteners () of the event listener. l Void Initialize () First make sure the invisible bean's invisibility; get all event descriptions of this bean; check if the target event vector exists, if there is no new target event vector and attribute target vector; finally passed the goal Event vector acquires attribute target vector.

l Private Vector getWpeifromwet (Vector WETS) The functionality of this method is to obtain property target vectors through the target event vector. The specific implementation is to remove each event of the target event vector, remove the WrappeReventTarget for each event. If the WrappeReventTarget member variable TargetListener is an instance of PropertyHookup, then the PropertyHookUp object is obtained, so gets the object's and this property-related event. Propertyhookuptargets vector, then package the vector set of WrapperPropertyEventInfo objects to return.

l Public String getadderName (String EventsetName) Gets the name of adding the listener method in the event collection

l Public String GetRemOverName (String EventsetName) Gets the name of the removal listener method in the event collection

l Public WrappeReventInfo [] getEventHookupinfo () Gets WrappeReventInfo information. First, it counts the total number of hook information; then list all WrappeReventTargets for EventTargets, and then use this to create a WrappeReventInfo array. Also listed all elements of PropertyTargets, add new WrappeReventInfo data.

l Void Removelisteners () temporarily deletes all event listeners.

l void attachlisteners () Re-join all event listeners

l void cleanup () When the package class is cut down from Beanbox,

l Public Void SetFromProtoTYPE (Boolean B) Set whether the object is obtained from serialization

l Public Vector getChangedProperties () used to get the vector change of the design period

l Public Vector getChangeDProperties () This static method is used to map an AWT control to a package object associated with it.

l Public void Paint (Graphics G) Rewinds the Paint Method

l Public Synchronized Void Domousestuff (MouseEvent EVT) is used to process the operation of its mouse when moving or changing the size

l Final BeanBox getBeanbox () Get instances of Beanbox

l Static void showinvisiblebeans (boolean show) Set whether it is an invisible bean

l Public Boolean Handleevent (EVENT EVT) is used to support legacy event processing

l Private Static Synchronized Void GetHashbars (Component C)

WrappeReventinfo.java

The hook information of the event listener is used to describe the specific information of the package, including the target bean, the class name of the adapter, and the event column name. In the constructor, you need to specify the target bean, the adapter's class name, and event set name.

WrapperPropertyEventInfo.java

Inherited the WrappeReventInfo class, used to connect to a specific attribute, "SUNW.BeanBox.PropertyHookup" is specified as hook, "PropertyChange" is specified as an event set name. Add three class members variables for the name of the settings, category, and attributes. In the constructor, you need to specify the target bean, attribute name, and method.

l Private string initstringFromType (class [] klass) is used to convert an array of Class objects into a character string array of class names.

Hookupmanager.java

The hook between the target method of the active source bean and the target bean will generate a class for each hook, and is compiled as an adapter to ClassLoader.

l atTargetDialog.java Dialog box for custom events for focus beans

l Report.java Report from internal information from a given Bean class

Propertyhookup.java

The PropertyHookup class implements the PropertyChangeListener and Serializable interface. Its two member variables are the source object, one is the vector of the Propertyhookuptargets object with the attribute name.

l Public Void Attach is used to create a property hook to facilitate changing the name of the name of the name to the source object to the setting method of the call target object.

l Synchronized Public Void PropertyChange (PropertyChangeEvent EVT) This method can be called when it is used to change attributes in the source object. We have mapped the property corresponding to a series of target objects, and then call the setter class method for each target.

Internal class PropertyHookuptarget is used to deliver target information. A SERIALIZABLE interface has two member variables, one is a target object, one is a Method object that records Setter.

l Private Void WriteObject (ObjectOutputStream S)

l Private Void ReadObject (ObjectInputStream S) is used to support serialization

转载请注明原文地址:https://www.9cbs.com/read-26500.html

New Post(0)