Package com.alee.extended.breadcrumb

Examples of com.alee.extended.breadcrumb.WebBreadcrumbButton


    }

    private void fillBreadcrumb ( WebBreadcrumb b )
    {
        // Sample breadcrumb data
        b.add ( new WebBreadcrumbButton ( "1" ) );
        b.add ( new WebBreadcrumbButton ( "2" ) );
        b.add ( new WebBreadcrumbButton ( "3" ) );
        b.add ( new WebBreadcrumbButton ( "4" ) );
    }
View Full Code Here


    {
        classPath.removeAll ();

        // Root element
        final JarEntry root = jarStructure.getRoot ();
        final WebBreadcrumbButton rootElement = new WebBreadcrumbButton ();
        rootElement.setIcon ( root.getIcon () );
        TooltipManager.setTooltip ( rootElement, root.getIcon (), jarStructure.getJarLocation () );
        rootElement.addActionListener ( new ActionListener ()
        {
            @Override
            public void actionPerformed ( final ActionEvent e )
            {
                final WebPopupMenu rootMenu = new WebPopupMenu ();

                final WebMenuItem showInFS = new WebMenuItem ( "Show in folder", browseIcon );
                showInFS.addActionListener ( new ActionListener ()
                {
                    @Override
                    public void actionPerformed ( final ActionEvent e )
                    {
                        try
                        {
                            final File jarFile = new File ( jarStructure.getJarLocation () );
                            Desktop.getDesktop ().browse ( jarFile.getParentFile ().toURI () );
                        }
                        catch ( final Throwable ex )
                        {
                            Log.error ( this, ex );
                        }
                    }
                } );
                rootMenu.add ( showInFS );

                final List<JarEntry> entries = jarStructure.getChildEntries ( root );
                if ( entries.size () > 0 )
                {
                    rootMenu.addSeparator ();
                    for ( final JarEntry entry : entries )
                    {
                        rootMenu.add ( createEntryMenuItem ( entry ) );
                    }
                }

                rootMenu.showBelowMiddle ( rootElement );
            }
        } );
        classPath.add ( rootElement );

        if ( lastEntry != null )
        {
            // All other elements
            final List<JarEntry> path = lastEntry.getPath ();
            for ( final JarEntry entry : path )
            {
                if ( entry.getType ().equals ( JarEntryType.packageEntry ) )
                {
                    final WebBreadcrumbButton element = new WebBreadcrumbButton ();
                    element.setIcon ( entry.getIcon () );
                    element.setText ( entry.getName () );
                    element.addActionListener ( new ActionListener ()
                    {
                        @Override
                        public void actionPerformed ( final ActionEvent e )
                        {
                            final List<JarEntry> entries = jarStructure.getChildEntries ( entry );
                            if ( entries.size () > 0 )
                            {
                                final WebPopupMenu packageMenu = new WebPopupMenu ();
                                for ( final JarEntry menuEntry : entries )
                                {
                                    packageMenu.add ( createEntryMenuItem ( menuEntry ) );
                                }
                                packageMenu.showBelowMiddle ( element );
                            }
                        }
                    } );
                    classPath.add ( element );
                }
                else
                {
                    final WebBreadcrumbLabel element = new WebBreadcrumbLabel ();
                    element.setIcon ( entry.getIcon () );
                    element.setText ( entry.getName () );
                    classPath.add ( element );
                }
            }
        }
View Full Code Here

TOP

Related Classes of com.alee.extended.breadcrumb.WebBreadcrumbButton

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.