The frame service class 'com.bea.ide.frame.FrameSvc' provides access to the application's main JFrame, and it's auxiliary views, docked and floating.
A 'frame view' is a view that participates in the application level docking layout, as opposed to a 'document view' which shows a visual representation of a specific document, and participates only in the layout defined by the document service, in the central document area of the IDE.
To add a frame view to the IDE, you must specify it in an 'extension-xml' section of your extension.xml file:
<extension-xml id="urn:com-bea-ide:frame">
<frame-set>
<frame-view class="workshop.shell.workspace.WorkspaceTreeContainer"
label="Workspace" />
<frame-view class="workshop.shell.workspace.WorkspaceFilesContainer"
label="Files" />
</frame-set>
...
</extension-xml>
Note: In production code you would use the localization escaping mechanism to specify the labels.
The class specified in the 'frame-view' tag must extend 'Component', or implement 'com.bea.ide.frame.IFrameView', or both.
Perhaps the simplest test frame view would be:
public class MyView extends JLabel
{
public MyView()
{
super("Hello World!");
setBorder(new TopBorder());
setHorizontalAlignment(CENTER);
}
}
<extension-xml id="urn:com-bea-ide:frame">
<frame-view-set>
<frame-view class="com.mydomain.MyView" label="Salutation" />
</frame-view-set>
</extension-xml>
Once the IDE is started, however, you would still need to choose the 'Test' menu item from the View/Windows menu in order to make the view visible. In order for your view to show at start-up, it must participate in a 'frame-layout'.
Note that the view class will not actually be instantiated until the view is made visible for the first time.
There are 2 ways to participate more fully in the overall window layout of the IDE.
The following is an example of how to use 'frame-layout' to specify a floating layout containing several of the simple test views described above:
<extension-xml id="urn:com-bea-ide:frame">
<frame-view-set>
<frame-view class="com.mydomain.MyView" id="v1" label="Salutation" />
<frame-view class="com.mydomain.MyView" id="v2" label="Salutation" />
<frame-view class="com.mydomain.MyView" id="v3" label="Salutation" />
<frame-view class="com.mydomain.MyView" id="v4" label="Salutation" />
</frame-view-set>
<application-layout id="main">
<frame-layout>
<frame-container orientation="horizontal">
<frame-view-ref class="com.mydomain.MyView" id="v1" proportion="50%" />
<frame-container width="50%">
<frame-view-ref class="com.mydomain.MyView" id="v2" proportion="25%" />
<frame-container height="75%">
<frame-view-ref class="com.mydomain.MyView" id="v3" proportion="50%" />
<frame-view-ref class="com.mydomain.MyView" id="v4" proportion="50%" />
</frame-container>
</frame-container>
</frame-container>
</frame-view-layout>
</application-layout>
</extension-xml>
Note that this specification only applies to the default layout. Once the user has started the IDE for the first time, and exited, a user specific layout is saved, and all extension.xml layouts are ignored in the next session. If you are playing with layouts, you will need to delete %USER_PROFILES%/.workshop.pref between IDE invocations to see your changes.
In any such 'frame-layout' specification, only the 'orientation' attribute of the root 'frame-container' is enforced. Any 'orientation' attributes in sub-nodes are ignored. Orientation alternates between horizontal and vertical at each level of the generated tree structure. Each level may also have an arbitrary number of child nodes.
Frame-container nodes in the main frame start with a set of root nodes, each with an orientation of 'north', 'south', 'east', or 'west'. The following XML places a sub-layout, identical to the floating layout above, at the bottom of the main frame window:
<extension-xml id="urn:com-bea-ide:frame">
...
<application-layout id="main">
<frame-layout id="main">
<frame-container orientation="south" proportion="20%">
<frame-view-ref class="com.mydomain.MyView" id="v1" proportion="50%" />
<frame-container width="50%">
<frame-view-ref class="com.mydomain.MyView" id="v2" proportion="25%" />
<frame-container height="75%">
<frame-view-ref class="com.mydomain.MyView" id="v3" proportion="50%" />
<frame-view-ref class="com.mydomain.MyView" id="v4" proportion="50%" />
</frame-container>
</frame-container>
</frame-container>
</frame-view-layout>
</application-layout>
</extension-xml>
The second method of placing a frame view is more flexible, and will impact an existing saved layout, the first time a new frame view is seen. The following is an example that uses the 'location' child tag on a 'frame-view' to place a custom output window tabbed with the standard 'Build' output window:
<frame-view-set>
<frame-view class="workshop.shell.output.OutputWindow" id="Hello" label="&Salutations">
<location classDest="workshop.shell.output.OutputWindow"
idDest="Build" orientation="tabbed" visible="true" />
</frame-view>
</frame-view-set>
This same technique can be used to place a new view in any relationship to an existing view, using the orientations 'north', 'south', 'west', and 'east'.
The following section lists all the valid attributes of the tags introduced above:
| fame-view-set |
|
| frame-view |
|
| location |
|
| application-layout |
|
| frame-layout |
|
| frame-container |
|
| frame-view-ref |
|
|
Implement this interface, or derive from JComponent for all classes specified in the 'class' attribute of a <frame-view> tag in your extension.xml. |
|
This class provides access to the main frame of the application, and its associated docking views. |
|
|
Constraints used to add a view to the application layout. |