Package com.alee.managers.language.data

Examples of com.alee.managers.language.data.TooltipWay


     * Tooltip layout update
     */

    public void updateBorder ()
    {
        final TooltipWay displayWay = getActualDisplayWay ();

        // Default margins
        final int leftSpacing = shadeWidth + contentSpacing + leftRightSpacing +
                ( displayWay.equals ( TooltipWay.right ) ? cornerLength : 0 );
        final int rightSpacing = shadeWidth + contentSpacing + leftRightSpacing +
                ( displayWay.equals ( TooltipWay.left ) ? cornerLength : 0 );
        final int topSpacing = shadeWidth +
                contentSpacing + ( displayWay.equals ( TooltipWay.down ) ? cornerLength : 0 );
        final int bottomSpacing = shadeWidth +
                contentSpacing + ( displayWay.equals ( TooltipWay.up ) ? cornerLength : 0 );

        // Additional hotkey margins
        final Insets hm = getHotkeyMargins ();

        // Updating border
View Full Code Here


    public void updateLocation ()
    {
        final Component component = getComponent ();
        if ( getParent () != null && getParent ().isShowing () && component.isShowing () )
        {
            final TooltipWay displayWay = getActualDisplayWay ();
            final Point p = getParent ().getLocationOnScreen ();
            final Point c = component.getLocationOnScreen ();
            final Dimension ps = getPreferredSize ();

            final int x0 = c.x - p.x;
            final int y0 = c.y - p.y;

            if ( displayWay.equals ( TooltipWay.up ) || displayWay.equals ( TooltipWay.down ) )
            {
                final int compMiddle;
                final int compTipY;
                if ( displayLocation == null )
                {
                    if ( relativeToBounds == null )
                    {
                        final Component rtc = getRelativeToComponent ();
                        if ( rtc == null )
                        {
                            compMiddle = x0 + component.getWidth () / 2;
                            compTipY = y0 + ( displayWay.equals ( TooltipWay.up ) ? ( cornerLength / 2 - shadeWidth - ps.height ) :
                                    ( component.getHeight () - cornerLength / 2 + shadeWidth ) );
                        }
                        else
                        {
                            final Rectangle b = SwingUtils.getRelativeBounds ( rtc, component );
                            compMiddle = x0 + b.x + b.width / 2;
                            compTipY = y0 + b.y + ( displayWay.equals ( TooltipWay.up ) ? ( cornerLength / 2 - shadeWidth - ps.height ) :
                                    ( b.height - cornerLength / 2 + shadeWidth ) );
                        }
                    }
                    else
                    {
                        final Rectangle b = relativeToBounds;
                        compMiddle = x0 + b.x + b.width / 2;
                        compTipY = y0 + b.y + ( displayWay.equals ( TooltipWay.up ) ? ( cornerLength / 2 - shadeWidth - ps.height ) :
                                ( b.height - cornerLength / 2 + shadeWidth ) );
                    }
                }
                else
                {
                    compMiddle = x0 + displayLocation.x;
                    compTipY = y0 + displayLocation.y - ( displayWay.equals ( TooltipWay.up ) ? ps.height : 0 );
                }

                if ( compMiddle - ps.width / 2 < windowSideSpacing )
                {
                    final int cw = windowSideSpacing - ( compMiddle - ps.width / 2 );
                    cornerPeak = Math.max ( shadeWidth + round + cornerSideX + 1, getWidth () / 2 - cw );
                    setLocation ( windowSideSpacing, compTipY );
                }
                else if ( compMiddle + ps.width / 2 > getParent ().getWidth () - windowSideSpacing )
                {
                    final int cw = ( compMiddle + ps.width / 2 ) - ( getParent ().getWidth () - windowSideSpacing );
                    cornerPeak = Math.min ( ps.width - shadeWidth - round - cornerSideX - 1, getWidth () / 2 + cw );
                    setLocation ( getParent ().getWidth () - windowSideSpacing - ps.width, compTipY );
                }
                else
                {
                    cornerPeak = getWidth () / 2;
                    setLocation ( compMiddle - ps.width / 2, compTipY );
                }
            }
            else if ( displayWay.equals ( TooltipWay.left ) || displayWay.equals ( TooltipWay.right ) )
            {
                final int compMiddle;
                final int compTipX;
                if ( displayLocation == null )
                {
                    if ( relativeToBounds == null )
                    {
                        final Component rtc = getRelativeToComponent ();
                        if ( rtc == null )
                        {
                            compMiddle = y0 + component.getHeight () / 2;
                            compTipX = x0 + ( displayWay.equals ( TooltipWay.left ) ? ( cornerLength / 2 - shadeWidth - ps.width ) :
                                    ( component.getWidth () - cornerLength / 2 + shadeWidth ) );
                        }
                        else
                        {
                            final Rectangle b = SwingUtils.getRelativeBounds ( rtc, component );
                            compMiddle = y0 + b.y + b.height / 2;
                            compTipX = x0 + b.x + ( displayWay.equals ( TooltipWay.left ) ? ( cornerLength / 2 - shadeWidth - ps.width ) :
                                    ( b.width - cornerLength / 2 + shadeWidth ) );
                        }
                    }
                    else
                    {
                        final Rectangle b = relativeToBounds;
                        compMiddle = y0 + b.y + b.height / 2;
                        compTipX = x0 + b.x + ( displayWay.equals ( TooltipWay.left ) ? ( cornerLength / 2 - shadeWidth - ps.width ) :
                                ( b.width - cornerLength / 2 + shadeWidth ) );
                    }
                }
                else
                {
                    compMiddle = y0 + displayLocation.y;
                    compTipX = x0 + displayLocation.x - ( displayWay.equals ( TooltipWay.left ) ? ps.width : 0 );
                }

                if ( compMiddle - ps.height / 2 < windowSideSpacing )
                {
                    final int cw = windowSideSpacing - ( compMiddle - ps.height / 2 );
View Full Code Here

        {
            oc = GraphicsUtils.setupAlphaComposite ( g2d, trasparency );
        }

        // Tooltip settings
        final TooltipWay displayWay = getActualDisplayWay ();

        // Initialize border and shade shape
        Shape bs = null;
        if ( shadeWidth > 0 && shadeColor != null )
        {
            bs = getTooltipShape ( displayWay, false );
        }

        // Shade
        GraphicsUtils.drawShade ( g2d, bs, WebCustomTooltipStyle.shadeType, shadeColor, shadeWidth );

        // Background
        if ( topBgColor != null )
        {
            if ( bottomBgColor != null )
            {
                // Gradient background
                if ( displayWay.equals ( TooltipWay.down ) )
                {
                    g2d.setPaint ( new GradientPaint ( 0, getHeight () * 2 / 3, topBgColor, 0, getHeight (), bottomBgColor ) );
                }
                else
                {
View Full Code Here

TOP

Related Classes of com.alee.managers.language.data.TooltipWay

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.