Dear Apache Pivot experts,
I would like to add a top level menu bar to the application. I have
modified the StockTracker app's main window BXML file like this:
stock_tracker_window.bxml
....
<TablePane styles="{padding:8, horizontalSpacing:6, verticalSpacing:6}">
<columns>
<TablePane.Column width="1*" />
</columns>
<TablePane.Row height="-1">
<Border styles="{padding:6, color:10}">
<bxml:include src="menu_2.bxml"/>
</Border>
</TablePane.Row>
<TablePane.Row height="-1">
<Label text="%stockTracker"
styles="{font:{size:14, bold:true},
verticalAlignment:'center'}" />
</TablePane.Row>
.....
After trying to run the application I always got:
Java.lang.RuntimeException
Error setting property "content" for type org.apache.pivot.wtk.Border to
value "com.expo.finance.MenuBars"
Caused by: java.lang.IllegalArgumentException: Window parent must be
null or display, cannot be org.apache.pivot.wtk.Border
Below is the source of "menu_2.bxml" file:
....
<menus:MenuBars title="Menu Bars" maximized="true"
styles="{padding:{top:0, left:4, bottom:4, right:4},
showWindowControls:false}"
xmlns:bxml="http://pivot.apache.org/bxml"
xmlns:content="org.apache.pivot.wtk.content"
xmlns:menus="com.expo.finance"
xmlns="org.apache.pivot.wtk">
<bxml:define>
<FileBrowserSheet bxml:id="fileBrowserSheet"/>
</bxml:define>
<actionMappings>
<Window.ActionMapping action="fileNew" keyStroke="CMD-N"/>
<Window.ActionMapping action="fileOpen" keyStroke="CMD-O"/>
</actionMappings>
<menuBar>
<MenuBar>
<MenuBar.Item buttonData="File">
<Menu>
<Menu.Section>
<Menu.Item action="fileNew">
<buttonData>
<content:MenuItemData text="New"
keyboardShortcut="CMD-N"/>
</buttonData>
</Menu.Item>
<Menu.Item action="fileOpen">
<buttonData>
<content:MenuItemData text="Open"
keyboardShortcut="CMD-O"/>
</buttonData>
</Menu.Item>
</Menu.Section>
</Menu>
</MenuBar.Item>
</MenuBar>
</menuBar>
</menus:MenuBars>
....
Best Regards,
Ilya A. Zimnovich