You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pivot.apache.org by Jamal BERRICH <jb...@gmail.com> on 2010/12/03 02:00:26 UTC
TabPane
Hello
I'am creating a ui with pivot using Java (not xml).
I'm searching to traduct this code in Java :
<TabPane selectedIndex="-1" collapsible="true"
styles="{tabOrientation:'vertical'}"
tooltipText="Click a tab to expand/collapse">
<BoxPane styles="{horizontalAlignment:'center',
verticalAlignment:'center'}">
<TabPane.tabData>
<content:ButtonData icon="@anchor.png"
text="Anchor"/>
</TabPane.tabData>
<Label text="Collapsible"/>
</BoxPane>
</TabPane>
I have this :
TabPane tabPane = new TabPane();
tabPane.setSelectedIndex(-1);
tabPane.setCollapsed(true);
tabPane.getStyles().put("tabOrientation", Orientation.VERTICAL);
can you help me please ?
Re: TabPane
Posted by Greg Brown <gk...@verizon.net>.
Are you importing org.apache.pivot.wtk.content.*?
On Dec 3, 2010, at 6:26 AM, Jamal BERRICH wrote:
> I have doing that
> TabPane tabPane = new TabPane();
> tabPane.setSelectedIndex(-1);
> tabPane.setCollapsed(true);
> tabPane.getStyles().put("tabOrientation", Orientation.VERTICAL);
> BoxPane boxPane = new BoxPane();
> boxPane.getStyles().put("horizontalAlignment", HorizontalAlignment.CENTER);
> boxPane.getStyles().put("verticalAlignment", HorizontalAlignment.CENTER);
> TabPane.setTabData(tabPane, new ButtonData("Test"));
> boxPane.add(tabPane.getTabs().get(0));
> boxPane.add(leftBorder);
> tabPane.add(boxPane);
> splitPane.setLeft(tabPane);
>
> but i have some probleme in compilation.
> how to create tabData in java code line?
>
> 2010/12/3 Greg Brown <gk...@verizon.net>
> Looks good so far (though you'll want to call setCollapsible(true), not setCollapsed()). Next step would be:
>
> BoxPane boxPane = new BoxPane();
> boxPane.getStyles().put()...
> etc.
>
> While you can certainly create your UI this way, I am curious to know why you would prefer to do it "by hand" rather than using BXML. I know that a lot of developers have an aversion to XML, and this is (to some extent) justified - for many applications, XML is overly verbose, and something like JSON would be more appropriate. However, for UI construction, XML really is handy.
>
> Take a look at the BXML Primer section of the tutorial for more info on how BXML maps to Java (and vice versa).
>
> G
>
> On Dec 2, 2010, at 8:00 PM, Jamal BERRICH wrote:
>
> > Hello
> > I'am creating a ui with pivot using Java (not xml).
> > I'm searching to traduct this code in Java :
> > <TabPane selectedIndex="-1" collapsible="true" styles="{tabOrientation:'vertical'}"
> > tooltipText="Click a tab to expand/collapse">
> > <BoxPane styles="{horizontalAlignment:'center', verticalAlignment:'center'}">
> > <TabPane.tabData>
> > <content:ButtonData icon="@anchor.png" text="Anchor"/>
> > </TabPane.tabData>
> > <Label text="Collapsible"/>
> > </BoxPane>
> > </TabPane>
> >
> > I have this :
> > TabPane tabPane = new TabPane();
> > tabPane.setSelectedIndex(-1);
> > tabPane.setCollapsed(true);
> > tabPane.getStyles().put("tabOrientation", Orientation.VERTICAL);
> >
> > can you help me please ?
>
>
Re: TabPane
Posted by Jamal BERRICH <jb...@gmail.com>.
I have doing that
TabPane tabPane = new TabPane();
tabPane.setSelectedIndex(-1);
tabPane.setCollapsed(true);
tabPane.getStyles().put("tabOrientation", Orientation.VERTICAL);
BoxPane boxPane = new BoxPane();
boxPane.getStyles().put("horizontalAlignment",
HorizontalAlignment.CENTER);
boxPane.getStyles().put("verticalAlignment",
HorizontalAlignment.CENTER);
TabPane.setTabData(tabPane, new ButtonData("Test"));
boxPane.add(tabPane.getTabs().get(0));
boxPane.add(leftBorder);
tabPane.add(boxPane);
splitPane.setLeft(tabPane);
but i have some probleme in compilation.
how to create tabData in java code line?
2010/12/3 Greg Brown <gk...@verizon.net>
> Looks good so far (though you'll want to call setCollapsible(true), not
> setCollapsed()). Next step would be:
>
> BoxPane boxPane = new BoxPane();
> boxPane.getStyles().put()...
> etc.
>
> While you can certainly create your UI this way, I am curious to know why
> you would prefer to do it "by hand" rather than using BXML. I know that a
> lot of developers have an aversion to XML, and this is (to some extent)
> justified - for many applications, XML is overly verbose, and something like
> JSON would be more appropriate. However, for UI construction, XML really is
> handy.
>
> Take a look at the BXML Primer section of the tutorial for more info on how
> BXML maps to Java (and vice versa).
>
> G
>
> On Dec 2, 2010, at 8:00 PM, Jamal BERRICH wrote:
>
> > Hello
> > I'am creating a ui with pivot using Java (not xml).
> > I'm searching to traduct this code in Java :
> > <TabPane selectedIndex="-1" collapsible="true"
> styles="{tabOrientation:'vertical'}"
> > tooltipText="Click a tab to expand/collapse">
> > <BoxPane
> styles="{horizontalAlignment:'center', verticalAlignment:'center'}">
> > <TabPane.tabData>
> > <content:ButtonData
> icon="@anchor.png" text="Anchor"/>
> > </TabPane.tabData>
> > <Label text="Collapsible"/>
> > </BoxPane>
> > </TabPane>
> >
> > I have this :
> > TabPane tabPane = new TabPane();
> > tabPane.setSelectedIndex(-1);
> > tabPane.setCollapsed(true);
> > tabPane.getStyles().put("tabOrientation", Orientation.VERTICAL);
> >
> > can you help me please ?
>
>
Re: TabPane
Posted by Greg Brown <gk...@verizon.net>.
It is probably because you are trying to call setSelectedIndex() before adding any content to the tab pane.
On Dec 3, 2010, at 12:38 PM, Jamal BERRICH wrote:
> i have this error :(
> Exception in thread "AWT-EventQueue-0" java.lang.IndexOutOfBoundsException: index 0 out of bounds.
> at org.apache.pivot.collections.ArrayList.verifyIndexBounds(ArrayList.java:577)
> at org.apache.pivot.collections.ArrayList.get(ArrayList.java:346)
> at org.apache.pivot.wtk.TabPane$TabSequence.get(TabPane.java:134)
>
> 2010/12/3 Greg Brown <gk...@verizon.net>
> > I can see one major reason to use java code : in java, we have auto-completion, in xml we don't.
>
> That's true, and it would be a really nice feature to have. Even without it, I think I'd still lean towards XML over Java simply for maintenance reasons. But that's just my opinion. :-)
>
> G
>
>
Re: TabPane
Posted by Jamal BERRICH <jb...@gmail.com>.
i have this error :(
Exception in thread "AWT-EventQueue-0" java.lang.IndexOutOfBoundsException:
index 0 out of bounds.
at
org.apache.pivot.collections.ArrayList.verifyIndexBounds(ArrayList.java:577)
at org.apache.pivot.collections.ArrayList.get(ArrayList.java:346)
at org.apache.pivot.wtk.TabPane$TabSequence.get(TabPane.java:134)
2010/12/3 Greg Brown <gk...@verizon.net>
> > I can see one major reason to use java code : in java, we have
> auto-completion, in xml we don't.
>
> That's true, and it would be a really nice feature to have. Even without
> it, I think I'd still lean towards XML over Java simply for maintenance
> reasons. But that's just my opinion. :-)
>
> G
>
>
Re: TabPane
Posted by Greg Brown <gk...@verizon.net>.
> I can see one major reason to use java code : in java, we have auto-completion, in xml we don't.
That's true, and it would be a really nice feature to have. Even without it, I think I'd still lean towards XML over Java simply for maintenance reasons. But that's just my opinion. :-)
G
Re: TabPane
Posted by Thomas Leclaire <ze...@gmail.com>.
2010/12/3 Greg Brown <gk...@verizon.net>
> While you can certainly create your UI this way, I am curious to know why
> you would prefer to do it "by hand" rather than using BXML. I know that a
> lot of developers have an aversion to XML, and this is (to some extent)
> justified - for many applications, XML is overly verbose, and something like
> JSON would be more appropriate. However, for UI construction, XML really is
> handy.
>
Hi!
I can see one major reason to use java code : in java, we have
auto-completion, in xml we don't.
If we are not familiar with the pivot framework, find name of arguments is
really not easy. At each time, I have to search in sources files to know
which parameters i can use, ...
I think that auto completion in xml will be a really important feature to
provide in order that Pivot community grows.
Regards,
Thomas
Re: TabPane
Posted by Greg Brown <gk...@verizon.net>.
Looks good so far (though you'll want to call setCollapsible(true), not setCollapsed()). Next step would be:
BoxPane boxPane = new BoxPane();
boxPane.getStyles().put()...
etc.
While you can certainly create your UI this way, I am curious to know why you would prefer to do it "by hand" rather than using BXML. I know that a lot of developers have an aversion to XML, and this is (to some extent) justified - for many applications, XML is overly verbose, and something like JSON would be more appropriate. However, for UI construction, XML really is handy.
Take a look at the BXML Primer section of the tutorial for more info on how BXML maps to Java (and vice versa).
G
On Dec 2, 2010, at 8:00 PM, Jamal BERRICH wrote:
> Hello
> I'am creating a ui with pivot using Java (not xml).
> I'm searching to traduct this code in Java :
> <TabPane selectedIndex="-1" collapsible="true" styles="{tabOrientation:'vertical'}"
> tooltipText="Click a tab to expand/collapse">
> <BoxPane styles="{horizontalAlignment:'center', verticalAlignment:'center'}">
> <TabPane.tabData>
> <content:ButtonData icon="@anchor.png" text="Anchor"/>
> </TabPane.tabData>
> <Label text="Collapsible"/>
> </BoxPane>
> </TabPane>
>
> I have this :
> TabPane tabPane = new TabPane();
> tabPane.setSelectedIndex(-1);
> tabPane.setCollapsed(true);
> tabPane.getStyles().put("tabOrientation", Orientation.VERTICAL);
>
> can you help me please ?