Node lookup with TabPane

Jonathan Giles jonathan.giles at oracle.com
Sun Jun 8 20:44:15 UTC 2014


Christian,

There is no reason why this shouldn't work - please file a bug report in 
our Jira bug tracker and we can take a look at resolving this.

Thanks,

-- Jonathan

On 8/06/2014 8:31 p.m., Christian wrote:
> Hi,
> I'm not sure if this is a bug because it looks like it is designed 
> this way.
> I just tried to do a TabPane.lookupAll("#myId") which does not return 
> any result.
> This is because the TabPane doesn't add the Tabs(which are no nodes) 
> to its children.
> If it would add the content of each pane to the children the lookup 
> would work.
> My solution right now is to scan the scenegraph myself.
> It is just not that easy to determine when to use lookupAll and when 
> to manually scan the scenegraph.
> Didn't yet check it but I think the same might apply to containers 
> like Accordion.
> Would be nice if somebody could give me some clarification.
> Thanks,
> Christian
>
>
> Unit Test:
> public class TabTest {
>   @Test
>   public void testLookup() throws Exception {
>     TabPane tabPane = new TabPane();
>     Tab tab1 = new Tab("tab1");
>     tabPane.getTabs().add(tab1);
>
>     StackPane content = new StackPane();
>     TextField nodeWithId = new TextField();
>     nodeWithId.setId("test");
>     content.getChildren().add(nodeWithId);
>     tab1.setContent(content);
>
>     assertSame(nodeWithId, content.lookup("#test"));
>     Set<Node> idNodes = tabPane.lookupAll("#test");
>     assertEquals(1,idNodes.size());
>     assertSame(nodeWithId, tabPane.lookup("#test"));
>   }
> }



More information about the openjfx-dev mailing list