EventFlow applications are stored as XML files containing two distinct kinds of information:
- Semantic elements
-
Describe the functionality of application components. This data changes only when you add or remove components and change their properties.
- Layout elements
-
Preserve the last saved graphical positions and dimensions of components in the EventFlow canvas. This data changes every time you move or resize a component on the canvas. The changes have no effect on your application's functionality.
For example, the Bsort.sbapp StreamBase
sample application contains this definition for the myBSort operator:
<box name="myBSort" type="bsort"> <input port="1" stream="StockIn"/> <output port="1" stream="StockOut"/> <param name="order-on" value="Time"/> <param name="passes" value="2"/> <param name="gui:x" value="180.0"/> <param name="gui:y" value="0.0"/> <param name="gui:width" value="70.0"/> <param name="gui:height" value="70.0"/> </box>
In this code, the box element and its first four
child elements are semantic elements; the last four child elements (containing the gui:
prefix) are are layout elements.
When you work in the EventFlow editor, the underlying XML code is hidden. However, in
some situations, you might prefer to not to store layout information in your
sbapp files. For example, in a source control system,
differences in layout information between versions are meaningles: eliminating this
information may be helpful for your version control and merging operations.
Two options are available to eliminate layout information from sbapp files:
- Separate semantic and layout elements into two different files
-
Layout elements are removed from the EventFlow source (
sbapp) file and stored in a new, associated layout (sblayout) file. The layout file has the same base name as the original sbapp file — only the extensions are different — and both files must be in the same folder. StreamBase Studio automatically associates these two files: when you open thesbappfile, its components are rendered in the EventFlow Editor using the dimensions and positions described in the layout file. - Remove and discard layout elements
-
This option simply deletes the layout elements from the
sbappfile. No layout file is created, and the layout information is lost.
You can change layout options either persistently or for a single file.
-
To change layout options for all EventFlows in your workspace, modify your Layout persistence option setting, as described in StreamBase Studio Preferences. Persistent settings determine how changes are stored the next time you modify and save an EventFlow file in the EventFlow Editor.
-
To change layout options for a single EventFlow, right-click its
sbappfile in the Package Explorer and choose → . Then, choose either or . Changing options for a single file supersedes your current layout preferences.
The following two files show the differences between the semantic and layout formats.
They were created by extracting the layout file from the Bsort.sbapp file included in the StreamBase sample
applications. If instead you chose the option to discard layout information, the
Bsort.sbapp file would be identical, but there would be
no layout file:
| Bsort.sbapp | Bsort.sblayout |
|---|---|
<modify version="5.1.0">
<add generator="gui">
<schema name="Input">
<field name="Symbol" type="string" size="5"/>
<field name="Volume" type="int"/>
<field name="Time" type="int"/>
</schema>
<stream name="StockIn" schema="Input">
</stream>
<box name="myBSort" type="bsort">
<input port="1" stream="StockIn"/>
<output port="1" stream="StockOut"/>
<param name="order-on" value="Time"/>
<param name="passes" value="2"/>
</box>
<output-stream name="StockOut">
</output-stream>
</add>
</modify>
|
<application-layout>
<component name="StockIn">
<param name="gui:x" value="70.0"/>
<param name="gui:y" value="10.0"/>
<param name="gui:width" value="70.0"/>
<param name="gui:height" value="50.0"/>
</component>
<component name="myBSort">
<param name="gui:x" value="180.0"/>
<param name="gui:y" value="0.0"/>
<param name="gui:width" value="70.0"/>
<param name="gui:height" value="70.0"/>
</component> <component name="StockOut">
<param name="gui:x" value="290.0"/>
<param name="gui:y" value="10.0"/>
<param name="gui:width" value="70.0"/>
<param name="gui:height" value="50.0"/>
</component>
</application-layout>
|
As you can see, the semantic and layout information are no longer combined, but separated into two separate files.
In the layout file, notice that there is no schema or box element. Instead,
component elements are used to reference all
sbapp components by their names. For example,
component name="StockIn" in Bsort.sblayout maps to stream
name="StockIn" in Bsort.sbapp.
When you add or modify an EventFlow application, StreamBase Studio
attempts to preserve the layout persistence option currently set in your Preferences
(unless you override it by using the →
command for a specific EventFlow).
This section discusses how each layout preference determines formatting when you
modify and save an sbapp file in the EventFlow Editor.
- Keep in application file
-
This is the installed preference setting in StreamBase Studio. As you would expect, this format is preserved each time you modify or save an application in the EventFlow Editor. When layout persistence is set to this option, both layout and semantic data is always saved in the
sbappfile. If ansblayoutfile with the same base name exists, it is ignored. - Keep in layout (.sblayout) file
-
-
If no associated layout file exists, it is created.
-
If the
sbappfile contains both semantic and layout information, the layout information is deleted from thesbappfile and written to the layout file. -
If the
sbappfile contains only semantic information, both the sbapp file and layout file are updated, preserving the existing separation of semantic and layout information.
-
- Discard
-
-
If the
sbappfile contains only semantic information, all semantic changes are saved in thesbappfile. No layout information is saved anywhere. -
If the
sbappfile contains both semantic and layout information, the layout information is deleted from the file and discarded. -
If the
sbappfile has an associated layout file, thesblayoutfile is ignored.
-
