Package com.alee.extended.statusbar

Examples of com.alee.extended.statusbar.WebStatusBar


    @Override
    public Component getPreview ( WebLookAndFeelDemo owner )
    {
        // Undecorated status bar
        WebStatusBar statusBar = new WebStatusBar ();
        statusBar.setUndecorated ( true );

        // Simple label
        statusBar.add ( new WebStatusLabel ( "Undecorated status bar", loadIcon ( "info.png" ) ) );

        // Simple memory bar
        WebMemoryBar memoryBar = new WebMemoryBar ();
        memoryBar.setPreferredWidth ( memoryBar.getPreferredSize ().width + 20 );
        statusBar.add ( memoryBar, ToolbarLayout.END );

        return statusBar;
    }
View Full Code Here


    @Override
    public Component getPreview ( WebLookAndFeelDemo owner )
    {
        // Simple status bar
        WebStatusBar statusBar = new WebStatusBar ();

        // Simple label
        statusBar.add ( new WebStatusLabel ( "Just a simple status bar", loadIcon ( "info.png" ) ) );

        // Simple memory bar
        WebMemoryBar memoryBar = new WebMemoryBar ();
        memoryBar.setPreferredWidth ( memoryBar.getPreferredSize ().width + 20 );
        statusBar.add ( memoryBar, ToolbarLayout.END );

        return statusBar;
    }
View Full Code Here

    }

    private WebStatusBar createStatusBar ()
    {
        // Window status bar
        final WebStatusBar statusBar = new WebStatusBar ();

        // Location breadcrumb
        statusBar.add ( getLocationBreadcrumb () );

        // Group description
        final ExampleGroup sg = getSelectedGroup ();

        statusBar.addSpacing ();

        final FeatureState fgs = sg.getFeatureGroupState ();
        final WebLabel featureState = new WebLabel ();
        TooltipManager.setTooltip ( featureState, fgs.getIcon (), fgs.getDescription () );
        featureState.setIcon ( fgs.getIcon () );
        featureState.addMouseListener ( new MouseAdapter ()
        {
            @Override
            public void mousePressed ( final MouseEvent e )
            {
                showLegend ( featureState, getSelectedGroup ().getFeatureGroupState () );
            }
        } );
        statusBar.add ( featureState );

        statusBar.addSpacing ();

        final WebLabel groupDescription = new WebLabel ();
        groupDescription.setText ( sg.getGroupDescription () );
        statusBar.add ( groupDescription );

        exampleTabs.addChangeListener ( new ChangeListener ()
        {
            @Override
            public void stateChanged ( final ChangeEvent e )
            {
                final ExampleGroup sg = getSelectedGroup ();
                final FeatureState fgs = sg.getFeatureGroupState ();
                TooltipManager.removeTooltips ( featureState );
                TooltipManager.setTooltip ( featureState, fgs.getIcon (), fgs.getDescription () );
                featureState.setIcon ( fgs.getIcon () );
                groupDescription.setText ( sg.getGroupDescription () );
            }
        } );

        // Update button
        final WebButton update = WebButton.createIconWebButton ( getUpdateIcon () );
        update.setVisible ( false );
        update.addActionListener ( new ActionListener ()
        {
            @Override
            public void actionPerformed ( final ActionEvent e )
            {
                WebUtils.browseSiteSafely ( WEBLAF_SITE + "download/" );
            }
        } );
        statusBar.addToMiddle ( update );

        // Version checker
        WebTimer.repeat ( "WebLookAndFeelDemo.versionCheck", 60000L, 10000L, new ActionListener ()
        {
            private VersionInfo lastVersion = null;

            @Override
            public void actionPerformed ( final ActionEvent e )
            {
                try
                {
                    final VersionInfo lv = getLastVersion ();
                    if ( lv != null && lv.compareTo ( VersionManager.getLibraryVersion () ) > 0 )
                    {
                        // Displaying update icon
                        update.setVisible ( true );

                        // Updating tips
                        final ImageIcon updateIcon = getUpdateIcon ();

                        final WebCustomTooltip versionTip = TooltipManager
                                .showOneTimeTooltip ( update, null, updateIcon, "New library version available: " + lv.toString () );
                        update.addMouseListener ( new MouseAdapter ()
                        {
                            @Override
                            public void mouseEntered ( final MouseEvent e )
                            {
                                versionTip.closeTooltip ();
                                update.removeMouseListener ( this );
                            }
                        } );

                        TooltipManager.setTooltip ( update, updateIcon, "Download new version: " + lv.toString () );

                        // Finishing updater thread
                        ( ( WebTimer ) e.getSource () ).stop ();
                    }
                }
                catch ( final Throwable ex )
                {
                    // Ignore version check exceptions
                }
            }

            public VersionInfo getLastVersion ()
            {
                if ( lastVersion == null )
                {
                    try
                    {
                        final String versionUrl = WebLookAndFeelDemo.WEBLAF_SITE + "downloads/version.xml";
                        lastVersion = XmlUtils.fromXML ( new URL ( versionUrl ) );
                    }
                    catch ( final Throwable ex )
                    {
                        // Ignore version check exceptions
                    }
                }
                return lastVersion;
            }
        } );

        // todo Language chooser button
        //        final WebButton language = new WebButton ( LanguageManager.getLanguage (),
        //                LanguageManager.getLanguageIcon ( LanguageManager.getLanguage () ) );
        //        language.setRound ( StyleConstants.smallRound );
        //        language.setLeftRightSpacing ( 2 );
        //        TooltipManager.setTooltip ( language, language.getIcon (), "Application language" );
        //        language.addActionListener ( new ActionListener ()
        //        {
        //            public void actionPerformed ( ActionEvent e )
        //            {
        //                WebButtonPopup wbp = new WebButtonPopup ( language, PopupWay.upCenter );
        //
        //                WebButton otherLanguage = new WebButton ( LanguageManager.RUSSIAN,
        //                        LanguageManager.getLanguageIcon ( LanguageManager.RUSSIAN ) );
        //                otherLanguage.setHorizontalAlignment ( WebButton.LEFT );
        //                otherLanguage.setUndecorated ( true );
        //                otherLanguage.setMargin ( 3, 3, 0, 3 );
        //                otherLanguage.setLeftRightSpacing ( 2 );
        //                wbp.setContent ( otherLanguage );
        //
        //                PopupManager.showPopup ( language, wbp );
        //            }
        //        } );
        //        statusBar.addToEnd ( language );

        // Enabled state toggle
        final WebToggleButton enabled = WebToggleButton.createIconWebButton ( enabledIcon );
        enabled.addHotkey ( WebLookAndFeelDemo.this, Hotkey.ALT_E );
        enabled.setSelected ( true );
        final Runnable enabledUpdater = new Runnable ()
        {
            @Override
            public void run ()
            {
                final boolean e = enabled.isSelected ();
                enabled.setIcon ( e ? enabledIcon : disabledIcon );

                TooltipManager.removeTooltips ( enabled );
                TooltipManager.setTooltip ( enabled, e ? enabledIcon : disabledIcon,
                        e ? "All examples are enabled" : "All examples are disabled" );
            }
        };
        enabledUpdater.run ();
        enabled.addActionListener ( new ActionListener ()
        {
            @Override
            public void actionPerformed ( final ActionEvent e )
            {
                // Updating button
                enabledUpdater.run ();

                // Updating examples
                final boolean enable = enabled.isSelected ();
                for ( int i = 0; i < exampleTabs.getTabCount (); i++ )
                {
                    final Component tabContent = exampleTabs.getComponentAt ( i );

                    // Workaround to keep focus in window
                    if ( SwingUtils.hasFocusOwner ( tabContent ) )
                    {
                        memoryBar.requestFocusInWindow ();
                    }

                    // Enabling/disabling examples
                    SwingUtils.setEnabledRecursively ( tabContent, enable );
                }
            }
        } );

        // Animation toggle
        final WebToggleButton animate = WebToggleButton.createIconWebButton ( animationIcon );
        TooltipManager.setTooltip ( animate, animationIcon, "Allow heavy animation" );
        animate.addHotkey ( WebLookAndFeelDemo.this, Hotkey.ALT_A );
        animate.setSelected ( true );
        animate.addActionListener ( new ActionListener ()
        {
            private List<TransitionEffect> oldEffects;

            @Override
            public void actionPerformed ( final ActionEvent e )
            {
                if ( animate.isSelected () )
                {
                    containerTransition.setTransitionEffects ( oldEffects );
                }
                else
                {
                    oldEffects = containerTransition.getTransitionEffects ();
                    containerTransition.clearTransitionEffects ();
                }
            }
        } );

        // Tab names toggle
        final WebToggleButton displayTabTitles = WebToggleButton.createIconWebButton ( tabNamesIcon );
        TooltipManager.setTooltip ( displayTabTitles, tabNamesIcon, "Display tab titles" );
        displayTabTitles.addHotkey ( WebLookAndFeelDemo.this, Hotkey.ALT_T );
        displayTabTitles.setSelected ( true );
        displayTabTitles.addActionListener ( new ActionListener ()
        {
            @Override
            public void actionPerformed ( final ActionEvent e )
            {
                if ( displayTabTitles.isSelected () )
                {
                    final List<ExampleGroup> groups = ExamplesManager.getExampleGroups ();
                    for ( int i = 0; i < exampleTabs.getTabCount (); i++ )
                    {
                        exampleTabs.setTitleAt ( i, groups.get ( i ).getGroupName () );
                    }
                }
                else
                {
                    for ( int i = 0; i < exampleTabs.getTabCount (); i++ )
                    {
                        exampleTabs.setTitleAt ( i, "" );
                    }
                }
            }
        } );

        // Component orientation toggle
        final WebToggleButton ltrOrientation = WebToggleButton.createIconWebButton ( orientationIcon );
        TooltipManager.setTooltip ( ltrOrientation, orientationIcon, "Use LTR components orientation" );
        ltrOrientation.addHotkey ( ltrOrientation, Hotkey.ALT_R );
        ltrOrientation.setSelected ( WebLookAndFeel.isLeftToRight () );
        ltrOrientation.addActionListener ( new ActionListener ()
        {
            @Override
            public void actionPerformed ( final ActionEvent e )
            {
                WebLookAndFeel.changeOrientation ();
            }
        } );

        // Special application-wide (global) hotkey
        HotkeyManager.registerHotkey ( Hotkey.ALT_R, new HotkeyRunnable ()
        {
            @Override
            public void run ( final KeyEvent e )
            {
                if ( !ltrOrientation.isFocusOwner () )
                {
                    ltrOrientation.doClick ();
                }
            }
        } );

        statusBar.addToEnd ( enabled );
        statusBar.addToEnd ( animate );
        statusBar.addToEnd ( displayTabTitles );
        statusBar.addToEnd ( ltrOrientation );

        statusBar.addSeparatorToEnd ();

        // Memory bar
        memoryBar = new WebMemoryBar ();
        memoryBar.setShowMaximumMemory ( false );
        memoryBar.setPreferredWidth ( memoryBar.getPreferredSize ().width + 20 );
        statusBar.addToEnd ( memoryBar );

        NotificationManager.setMargin ( 0, 0, statusBar.getPreferredSize ().height, 0 );
        return statusBar;
    }
View Full Code Here

        container.add ( split, BorderLayout.CENTER );
    }

    private void initializeStatusBar ()
    {
        statusbar = new WebStatusBar ();

        //

        final WebBreadcrumb updateBreadcrumb = new WebBreadcrumb ( false );
        updateBreadcrumb.setEncloseLastElement ( false );
View Full Code Here

        } );
        toolBar.addToEnd ( rotate180 );

        //

        final WebStatusBar bottomToolBar = new WebStatusBar ();
        editorPanel.add ( bottomToolBar, BorderLayout.SOUTH );

        final boolean sgs = SettingsManager.get ( "NinePatchEditor", "showSpacing", true );
        final WebToggleButton showGuidesSpacing = new WebToggleButton ( GUIDES_ICON );
        showGuidesSpacing.setLanguage ( "weblaf.ex.npeditor.showSpacing" );
        showGuidesSpacing.setRolloverDecoratedOnly ( true );
        showGuidesSpacing.setSelected ( sgs );
        ninePatchEditor.setShowGuideSpacing ( sgs );
        showGuidesSpacing.addActionListener ( new ActionListener ()
        {
            @Override
            public void actionPerformed ( final ActionEvent e )
            {
                final boolean sgs = showGuidesSpacing.isSelected ();
                SettingsManager.set ( "NinePatchEditor", "showSpacing", sgs );
                ninePatchEditor.setShowGuideSpacing ( sgs );
            }
        } );

        final boolean sr = SettingsManager.get ( "NinePatchEditor", "showRuler", true );
        final WebToggleButton showRuler = new WebToggleButton ( RULER_ICON );
        showRuler.setLanguage ( "weblaf.ex.npeditor.showRuler" );
        showRuler.setRolloverDecoratedOnly ( true );
        showRuler.setSelected ( sr );
        ninePatchEditor.setShowRuler ( sr );
        showRuler.addActionListener ( new ActionListener ()
        {
            @Override
            public void actionPerformed ( final ActionEvent e )
            {
                final boolean sr = showRuler.isSelected ();
                SettingsManager.set ( "NinePatchEditor", "showRuler", sr );
                ninePatchEditor.setShowRuler ( sr );
            }
        } );

        final boolean fc = SettingsManager.get ( "NinePatchEditor", "fillContent", true );
        final WebToggleButton fillContent = new WebToggleButton ( CONTENT_ICON );
        fillContent.setLanguage ( "weblaf.ex.npeditor.fillContent" );
        fillContent.setRolloverDecoratedOnly ( true );
        fillContent.setSelected ( fc );
        ninePatchEditor.setFillContentArea ( fc );
        fillContent.addActionListener ( new ActionListener ()
        {
            @Override
            public void actionPerformed ( final ActionEvent e )
            {
                final boolean fc = fillContent.isSelected ();
                SettingsManager.set ( "NinePatchEditor", "fillContent", fc );
                ninePatchEditor.setFillContentArea ( fc );
            }
        } );

        final boolean fs = SettingsManager.get ( "NinePatchEditor", "fillStretch", true );
        final WebToggleButton fillStretch = new WebToggleButton ( STRETCH_ICON );
        fillStretch.setLanguage ( "weblaf.ex.npeditor.fillStretch" );
        fillStretch.setRolloverDecoratedOnly ( true );
        fillStretch.setSelected ( fs );
        ninePatchEditor.setFillStretchAreas ( fs );
        fillStretch.addActionListener ( new ActionListener ()
        {
            @Override
            public void actionPerformed ( final ActionEvent e )
            {
                final boolean fs = fillStretch.isSelected ();
                SettingsManager.set ( "NinePatchEditor", "fillStretch", fs );
                ninePatchEditor.setFillStretchAreas ( fs );
            }
        } );

        final boolean rc = SettingsManager.get ( "NinePatchEditor", "rulerCursor", true );
        final WebToggleButton rulerCursor = new WebToggleButton ( RULER_CURSOR_ICON );
        rulerCursor.setLanguage ( "weblaf.ex.npeditor.rulerCursor" );
        rulerCursor.setRolloverDecoratedOnly ( true );
        rulerCursor.setSelected ( rc );
        ninePatchEditor.setShowRulerCursorPosition ( rc );
        rulerCursor.addActionListener ( new ActionListener ()
        {
            @Override
            public void actionPerformed ( final ActionEvent e )
            {
                final boolean rc = rulerCursor.isSelected ();
                SettingsManager.set ( "NinePatchEditor", "rulerCursor", rc );
                ninePatchEditor.setShowRulerCursorPosition ( rc );
            }
        } );

        final boolean ac = SettingsManager.get ( "NinePatchEditor", "areaCursor", false );
        final WebToggleButton areaCursor = new WebToggleButton ( AREA_CURSOR_ICON );
        areaCursor.setLanguage ( "weblaf.ex.npeditor.areaCursor" );
        areaCursor.setRolloverDecoratedOnly ( true );
        areaCursor.setSelected ( ac );
        ninePatchEditor.setShowAreaCursorPosition ( ac );
        areaCursor.addActionListener ( new ActionListener ()
        {
            @Override
            public void actionPerformed ( final ActionEvent e )
            {
                final boolean ac = areaCursor.isSelected ();
                SettingsManager.set ( "NinePatchEditor", "areaCursor", ac );
                ninePatchEditor.setShowAreaCursorPosition ( ac );
            }
        } );

        final WebSlider zoomSlider = new WebSlider ( NinePatchEditor.MIN_ZOOM, NinePatchEditor.MAX_ZOOM, ninePatchEditor.getZoom () );
        zoomSlider.setPreferredWidth ( 170 );
        zoomSlider.setAngledThumb ( false );
        zoomSlider.setPaintTicks ( false );
        zoomSlider.setPaintLabels ( false );
        changeListener = new ChangeListener ()
        {
            @Override
            public void stateChanged ( final ChangeEvent e )
            {
                ninePatchEditor.removeZoomChangeListener ( zoomChangeListener );
                ninePatchEditor.setZoom ( zoomSlider.getValue () );
                ninePatchEditor.addZoomChangeListener ( zoomChangeListener );
            }
        };
        zoomSlider.addChangeListener ( changeListener );
        zoomChangeListener = new ZoomChangeListener ()
        {
            @Override
            public void zoomChanged ()
            {
                zoomSlider.removeChangeListener ( changeListener );
                zoomSlider.setValue ( ninePatchEditor.getZoom () );
                zoomSlider.addChangeListener ( changeListener );
            }
        };
        ninePatchEditor.addZoomChangeListener ( zoomChangeListener );

        final WebButton minZoom = new WebButton ( MIN_ICON );
        minZoom.setRolloverDecoratedOnly ( true );
        minZoom.addActionListener ( new ActionListener ()
        {
            @Override
            public void actionPerformed ( final ActionEvent e )
            {
                zoomSlider.setValue ( NinePatchEditor.MIN_ZOOM );
            }
        } );

        final WebButton maxZoom = new WebButton ( MAX_ICON );
        maxZoom.setRolloverDecoratedOnly ( true );
        maxZoom.addActionListener ( new ActionListener ()
        {
            @Override
            public void actionPerformed ( final ActionEvent e )
            {
                zoomSlider.setValue ( NinePatchEditor.MAX_ZOOM );
            }
        } );

        bottomToolBar.add ( showGuidesSpacing );
        bottomToolBar.add ( showRuler );
        bottomToolBar.addSeparator ();
        bottomToolBar.add ( fillContent );
        bottomToolBar.add ( fillStretch );
        bottomToolBar.addSeparator ();
        bottomToolBar.add ( rulerCursor );
        bottomToolBar.add ( areaCursor );
        bottomToolBar.addToEnd ( minZoom );
        bottomToolBar.addToEnd ( zoomSlider );
        bottomToolBar.addToEnd ( maxZoom );

        return editorPanel;
    }
View Full Code Here

TOP

Related Classes of com.alee.extended.statusbar.WebStatusBar

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.