Could you use MessageBus for this? The menu action could send a message and the 
accordion's controller could listen for it.

On Sep 14, 2011, at 9:02 AM, prophe wrote:

> Hi all. I have a problem with menuBar. I want to add an action to menu item
> in top of my application, when I click on it, accordion must become
> invisible. But I can't get a link to the accordion component in my
> ApplicationMainMenu.class, which extends MenuBar. I' have the follow code:
> 
> <main:MainWindow title="Table Views" maximized="true"
>       xmlns:bxml="http://pivot.apache.org/bxml"; xmlns="org.apache.pivot.wtk"
>       xmlns:content="org.apache.pivot.wtk.content"
> xmlns:main="com.pivot.application.main">
>       <CardPane styles="{padding:3}">
>               <TablePane bxml:id="mainPanel"
>                       styles="{verticalSpacing:1, horizontalSpacing:1}">
>                       <columns>
>                               <TablePane.Column width="1*" />
>                       </columns>
>                       <TablePane.Row height="20">
>                               <bxml:include bxml:id="applicationMenu" 
> src="applicationMenu.bxml" />
>                       </TablePane.Row>
>                       <TablePane.Row height="20">
>                               <Label text="Application menu bar" />
>                       </TablePane.Row>
>                       <TablePane.Row height="1*">
>                               <Border styles="{padding:4,thickness:0}">
>                                       <SplitPane bxml:id="mainSplitPane" 
> orientation="horizontal"
>                                               splitRatio="0.15" 
> styles="{splitterThickness:3}">
>                                               <left>
>                                                       <Accordion 
> bxml:id="treeAccordion" styles="{padding:0}">
>                                                               <bxml:include 
> bxml:id="navDictionaryTree"
> src="navDictionaryTree.bxml" Accordion.headerData="Dictionary"/>
>                                                               <bxml:include 
> bxml:id="testTree" src="testTree.bxml"
> Accordion.headerData="Test tree"/>
>                                                               <Label 
> text="tree 3" Accordion.headerData="Tree 3" />
>                                                       </Accordion>
>                                               </left>
>                                               <right>
>                                                       <TabPane 
> bxml:id="centerContentTab" styles="{padding:2}"
>                                                               
> closeable="true">
>                                                       </TabPane>
>                                               </right>
>                                       </SplitPane>
>                               </Border>
>                       </TablePane.Row>
>                       <TablePane.Row height="20">
>                               <BoxPane styles="{padding:3}">
>                                       <PushButton 
> bxml:id="navigationMenuButton" styles="{toolbar:true}"
>                                               buttonData="Menu" />
>                               </BoxPane>
>                       </TablePane.Row>
>               </TablePane>
>       </CardPane>
> </main:MainWindow>
> 
> follow the tutorial I create  ApplicationMainMenu class extends MenuBar:
> 
>       private Accordion treeAccardion;
>       
>       public ApplicationMainMenu(){
>               Action.getNamedActions().put("showNavPanel", new Action() {
> 
>                       @Override
>                       public void perform(Component source) {
>                               //There I want get my accordion component with 
> id treeAccordion.
>                               
>                               System.out.println(treeAccardion);
>                       }                       
>               });
>       }
> 
> How can I get the link to treeAccardion?
> 
> 
> 
> 
> 
> 
> 
> -----
> Thank you!
> --
> View this message in context: 
> http://apache-pivot-users.399431.n3.nabble.com/Link-to-another-component-tp3335697p3335697.html
> Sent from the Apache Pivot - Users mailing list archive at Nabble.com.

Reply via email to