Error setting property "content"...

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Error setting property "content"...

Ilya Zimnovich
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

Reply | Threaded
Open this post in threaded view
|

Re: Error setting property "content"...

Roger and Beth Whitcomb
Hi Ilya,
     Welcome to Pivot!  Thanks for bringing your questions to the list.  
Every question helps other people too!

     So, to your question:  it looks like the main .bxml you load is the
modified "stock_tracker_window.bxml", and that you are trying to put a
window into the middle of that TablePane.  I'm not sure why you are
doing that, but that is the main problem.  I presume that your MenuBars
class is derived from Window, which must be a top-level object (as the
error message implies).  A Window is not meant to be put inside other
components, but to be the parent of other components.  It looks to me
like you could simply load your "menu2.bxml" as the main .bxml file of
your application and everything would work fine.

HTH,
~Roger

On 3/23/14 3:42 PM, Ilya Zimnovich wrote:

> 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
>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: Error setting property "content"...

Ilya Zimnovich
Dear Roger,

Thanks for your help! You are right, the problem was due to the MenuBars
class was derived from Window.

I just examined the MenuBars tutorial and took the MenuBars class and
the "menu_bars.bxml" file from the example as the basis for the top
level menu of my application. Well, it turned out however that the
MenuBars class was actually a top level window, while I thought (because
of its name) that it is a container for menu items. I feel like it
should be called something like MenuBarsWindow or MenuBarsFrame to avoid
confusion.

I sure the Apache Pivot tutorials are missing the example of
StockTracker like desktop application with top level menus, tool-bars
and maybe child panels or dialogs for the Apache Pivot newbies to start
with.

Best Regards,
Ilya A. Zimnovich

On 24.03.2014 06:40, Roger and Beth Whitcomb wrote:

> Hi Ilya,
>     Welcome to Pivot!  Thanks for bringing your questions to the
> list.  Every question helps other people too!
>
>     So, to your question:  it looks like the main .bxml you load is
> the modified "stock_tracker_window.bxml", and that you are trying to
> put a window into the middle of that TablePane.  I'm not sure why you
> are doing that, but that is the main problem.  I presume that your
> MenuBars class is derived from Window, which must be a top-level
> object (as the error message implies).  A Window is not meant to be
> put inside other components, but to be the parent of other
> components.  It looks to me like you could simply load your
> "menu2.bxml" as the main .bxml file of your application and everything
> would work fine.
>
> HTH,
> ~Roger
>
> On 3/23/14 3:42 PM, Ilya Zimnovich wrote:
>> 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
>>
>>
>>
>

Reply | Threaded
Open this post in threaded view
|

RE: Error setting property "content"...

Roger Whitcomb-2
Noted that there could be improvement in our tutorial examples for desktop applications.

Thanks,
~Roger

-----Original Message-----
From: Ilya Zimnovich [mailto:[hidden email]]
Sent: Monday, March 24, 2014 9:07 AM
To: [hidden email]
Subject: Re: Error setting property "content"...

Dear Roger,

Thanks for your help! You are right, the problem was due to the MenuBars class was derived from Window.

I just examined the MenuBars tutorial and took the MenuBars class and the "menu_bars.bxml" file from the example as the basis for the top level menu of my application. Well, it turned out however that the MenuBars class was actually a top level window, while I thought (because of its name) that it is a container for menu items. I feel like it should be called something like MenuBarsWindow or MenuBarsFrame to avoid confusion.

I sure the Apache Pivot tutorials are missing the example of StockTracker like desktop application with top level menus, tool-bars and maybe child panels or dialogs for the Apache Pivot newbies to start with.

Best Regards,
Ilya A. Zimnovich

On 24.03.2014 06:40, Roger and Beth Whitcomb wrote:

> Hi Ilya,
>     Welcome to Pivot!  Thanks for bringing your questions to the list.  
> Every question helps other people too!
>
>     So, to your question:  it looks like the main .bxml you load is
> the modified "stock_tracker_window.bxml", and that you are trying to
> put a window into the middle of that TablePane.  I'm not sure why you
> are doing that, but that is the main problem.  I presume that your
> MenuBars class is derived from Window, which must be a top-level
> object (as the error message implies).  A Window is not meant to be
> put inside other components, but to be the parent of other components.  
> It looks to me like you could simply load your "menu2.bxml" as the
> main .bxml file of your application and everything would work fine.
>
> HTH,
> ~Roger
>
> On 3/23/14 3:42 PM, Ilya Zimnovich wrote:
>> 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
>>
>>
>>
>