FrameView.java Sample

This topic inludes the source code for the FrameView.java Sample.

Sample Location

This sample is located in the following directory in your WebLogic Workshop installation:

BEA_HOME/weblogic81/samples/workshop/ExtensionDevKit/IdeDevKit/FrameViewSimple/src/ideExtensions/frameViewSimple/

Sample Source Code


01 package ideExtensions.frameViewSimple;
02 
03 import com.bea.ide.ui.frame.FrameSvc;
04 import com.bea.ide.ui.frame.IFrameView;
05 import java.awt.Component;
06 import javax.swing.JLabel;
07 
08 /**
09  * A frame to display a simple message. This class extends JLabel, a
10  * Java Swing user interface component, returning an instance of itself
11  * when the IDE requests its UI. It also implements IFrameView, an
12  * interface to support this class' role as a frame in the WebLogic Workshop
13  * IDE.
14  */
15 public class FrameView extends JLabel implements com.bea.ide.ui.frame.IFrameView
16 {
17     /**
18      * Constructs a new instance of this class with a simple message to
19      * display in the frame.
20      */
21   public FrameView()
22   {
23         // Call the JLabel class' constructor.
24     super("hi mom. yo dad. peace sis.");
25   }
26 
27     /**
28      * Called by the IDE to retrieve the user interface component to
29      * display in the frame.
30      *
31      @param id The value of the id attribute specified for this <frame-view>
32      * in the extension.xml; <code>null</code> if the attribute was not
33      * specified.
34      @return The UI component to display in the frame.
35      */
36   public Component getView(String id)
37   {
38         // Return a pointer to an instance of this class, which extends JLabel.
39     return this;
40   }
41 
42     /**
43      * Called by the IDE to determine whether this frame is "available" --
44      * in other words, whether the frame may be displayed in the UI.
45      *
46      * This method will only be called if the extension.xml specifies the
47      * askavailable attribute as "true" in the <frame-view> element.
48      *
49      @return <code>true</code> if the frame is available for display;
50      <code>false</code> if it is not.
51      */
52   public boolean isAvailable()
53   {
54     return true;
55   }
56 }