Previous Next vertical dots separating previous/next from contents/index/pdf

Creating Custom Controls

This topic describes how to use a custom custom control. It explains how to:

Custom control files can be located:

To Create a Custom Control

The following instruction assume you are in the J2EE perspective (Window > Open Perspective > J2EE).

  1. You cannot create a control in the default package. So the first step is to create a package for the control. For example:

  2. Right-click the package and select New > Custom Control.
  3. In the Control name field, enter the class name for the control.

    The Java interface and implementation classes will be based on the name entered here. For example, if you enter Hello, two classes will be created: (=the interface class)

            and (=the implementation class)
  4. Click Finish.

Default control interface and implementation classes are produced. Assuming that your control is named Hello, the following class files are produced: Interface Class File

package controls.myControl;
import org.apache.beehive.controls.api.bean.ControlInterface;
public interface Hello {
} Implementation Class File

package controls.myControl;
import org.apache.beehive.controls.api.bean.ControlImplementation;
public class HelloImpl implements Hello, Serializable {
	private static final long serialVersionUID = 1L;

Continue the composition of the custom control by adding methods to these class files.

To Use a Custom Control in an Application

If you have an existing custom control in your project or in a utility project in the current workspace, you can add a reference to that control to a control client by right-clicking anywhere within the client's Java source file and selecting Insert > Control.

A list of available controls appears. The heading Existing Project Controls lists the controls in the same project as the client. The heading Existing Application Controls lists the controls in the utility projects in the same workspace.

When you add a control reference to a client, Workshop for WebLogic Platform modifies your client's source code to include an annotation and variable declaration for the control. The annotation ensures that the control is recognized by Workshop for WebLogic Platform, and the variable declaration gives you a way to work with the control from your client code. For example, if you add a new custom control named Hello, the following code will be added to your client:

    import org.apache.beehive.controls.api.bean.Control;
    import controls.myControl.Hello;
	private Hello hello;
Once you have a reference to a control, your client can call methods on that control. For more detail on calling a control method, see Invoking a Control Method.

Related Topics

Invoking a Control Method

Source Files for Custom Controls


Skip navigation bar   Back to Top