True - FileBrowser is an example of what we would call a "composite" component. Unlike the JavaWindow example, it defines its own skin class, but the skin is actually composed of other components. Spinner is another example of this type of component.
On Sep 30, 2010, at 10:09 AM, Chris Bartlett wrote: > FileBrowser is also a good example of building a new component using existing > components. > > http://pivot.apache.org/tutorials/file-browsing.html > > http://svn.apache.org/repos/asf/pivot/trunk/wtk/src/org/apache/pivot/wtk/ > FileBrowser.java > FileBrowserListener.java > FileBrowserSheet.java > FileBrowserSheetListener.java > http://svn.apache.org/repos/asf/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/ > FileBrowserSkin.java > http://svn.apache.org/repos/asf/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/ > TerraFileBrowserSheetSkin.java > TerraFileBrowserSheetSkin.json > TerraFileBrowserSkin.java > TerraFileBrowserSkin.json > terra_file_browser_sheet_skin.bxml > terra_file_browser_skin.bxml > > On 30 September 2010 20:57, Greg Brown <[email protected]> wrote: > Hi Peter, > > This is definitely possible. The implementation specifics will depend largely > on what you are trying to accomplish. Extending an existing class is probably > the easiest way to create a custom component. This example shows how to > create a custom subclass of Pivot's Window component that implements the code > behind for the markup defined in java_window.bxml: > > > http://svn.apache.org/repos/asf/pivot/trunk/examples/src/org/apache/pivot/examples/scripting/JavaWindow.java > > http://svn.apache.org/repos/asf/pivot/trunk/examples/src/org/apache/pivot/examples/scripting/java_window.bxml > > However, you can also subclass Component directly - in that case, you'll also > need to provide at least one skin class for your custom component. Here's a > simple example that implements the "ruler" headers in the ScrollPane tutorial: > > > http://svn.apache.org/repos/asf/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/navigation/Ruler.java > > http://svn.apache.org/repos/asf/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/navigation/RulerListener.java > > http://svn.apache.org/repos/asf/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/navigation/RulerSkin.java > > Hope this helps, > Greg > > On Sep 30, 2010, at 9:43 AM, Piotr Rojek wrote: > > > > > > > Hello > > > > I need to create sth like a custom control in Pivot. I would like to define > > layout in XML and have a Java code-behind file. Basically I want to > > dynamically load and then unload this control as needed in main window but > > all the but all the behavior should be defined in code-behind file, not in > > application. Is it possible and how to code it? > > > > Cheers, > > > > Peter > > > > > > > > > > > > > >
