Weblogic Platform 8.1 custom controls generally consist of two files: JCs files and java files.
JCS is the meaning of Java Control source, representing the source file, implementing the function of custom control; Java file representing
The following is an example of an interface that can be called by a widget:
1) the JCS file code is as follows:
Package verifyfunds. poutil;
Import java. util. stringtokenizer;
/**
* Provides a number formatting utility function for
* Verifyfunds Sample Control.
* Author's note: Weblogic Platform 8.1 defines many javadoc to facilitate our development and deployment.
* @ JCs: JC-jar label = "poutil"
* @ Editor-Info: code-gen control-interface = "true"
*/
// Note: by default, the JCS file is suffixed with "impl" after the Java file, and poutil. Java is the interface to be implemented by JCs.
// JCs all implement the com. Bea. Control. controlsource Interface
Public class poutilimpl implements poutil, Com. Bea. Control. controlsource
{
/**
* Formats a purchase order number, removing
* Non-numeric characters.
* The following figure shows the specific function implementation. If you are not interested, skip this step.
* @ Common: Operation
*/
Public int formatnumber (string stringnumber)
{
Stringbuffer delimiters = new stringbuffer ();
For (INT I = 0; I <stringnumber. Length (); I ++)
{
If (stringnumber. charat (I) <'0' | stringnumber. charat (I)>
'9 ')
Delimiters. append (stringnumber. charat (I ));
}
Stringtokenizer tokens = new stringtokenizer (stringnumber,
Delimiters. tostring ());
Stringbuffer cleanstring = new stringbuffer ();
While (tokens. hasmoretokens ())
{
Cleanstring. append (tokens. nexttoken ());
}
Int number = new INTEGER (cleanstring. tostring (). intvalue ();
Return number;
}
}
Javadoc annotation @ common: operation indicates that this method is part of a public interface. When this annotation appears
, WebLogic Workshop includes this method in the public interfaces listed in. java. In the design view,
This annotation is represented by the blue arrow icon.
2) the Java file code is as follows:
Package verifyfunds. poutil;
Import com. Bea. Control. Control;
// All interfaces inherit from Com. Bea. Control. Control.
Public interface poutil extends control
{
/**
* Formats a purchase order number, removing non-numeric characters.
*/
// Corresponds to the @ common: Operation Method in the JCS File
Int formatnumber (Java. Lang. String stringnumber );
}
WebLogic Workshop provides a good interface, so that we can develop and understand it in a graphic way.
Pretty good.