Package com.alee.managers.style.data

Examples of com.alee.managers.style.data.ComponentStyle


     * @param type      component type
     * @return component style
     */
    protected ComponentStyle getComponentStyleImpl ( final JComponent component, final SupportedComponent type )
    {
        final ComponentStyle style = getComponentStyle ( component, type );
        if ( style == null )
        {
            throw new StyleException ( "Skin doesn't contain style for UI class ID: " + component.getUIClassID () );
        }
        return style;
View Full Code Here


                               final Map<String, Painter> customPainters )
    {
        try
        {
            final SupportedComponent type = getSupportedComponentTypeImpl ( component );
            final ComponentStyle style = getComponentStyleImpl ( component, type );
            final ComponentUI ui = getComponentUIImpl ( component );

            // Installing painters
            for ( final PainterStyle painterStyle : style.getPainters () )
            {
                // Painter ID
                final String painterId = painterStyle.getId ();

                // Retrieving painter to install into component
                // Custom painter can be null - that will just mean that component should not have painter installed
                final Painter painter;
                if ( customPainters != null && customPainters.containsKey ( painterId ) )
                {
                    // Using provided custom painter
                    // This might be set using Web-component "set...Painter"-like methods
                    painter = customPainters.get ( painterId );
                }
                else
                {
                    // Creating painter instance
                    // Be aware that all painters must have default constructor
                    painter = ReflectUtils.createInstanceSafely ( painterStyle.getPainterClass () );
                    if ( painter == null )
                    {
                        throw new StyleException (
                                "Unable to create painter \"" + painterStyle.getPainterClass () + "\" for component: " + component );
                    }

                    // Applying painter properties
                    // These properties are applied only for style-provided painters
                    // Customly provided painters are not affected by these properties to avoid unexpected changes in them
                    final Map<String, Object> cpp = getCustomPainterProperties ( customPainterProperties, painterStyle, painterId );
                    applyProperties ( painter, painterStyle.getProperties (), cpp );
                }

                // Installing painter into the UI
                final String setterMethod = ReflectUtils.getSetterMethodName ( painterId );
                ReflectUtils.callMethod ( ui, setterMethod, painter );
            }

            // Applying UI properties
            // todo Check whether properties should be applied or not somehow? Additional settings?
            applyProperties ( ui, style.getUIProperties (), null );

            // Applying component properties
            // todo Check whether properties should be applied or not somehow? Additional settings?
            applyProperties ( component, style.getComponentProperties (), null );

            return true;
        }
        catch ( final Throwable e )
        {
View Full Code Here

    public boolean removeSkin ( final JComponent component )
    {
        try
        {
            // Uninstalling skin painters from the UI
            final ComponentStyle style = getComponentStyleImpl ( component );
            final ComponentUI ui = getComponentUIImpl ( component );
            for ( final PainterStyle painterStyle : style.getPainters () )
            {
                final String setterMethod = ReflectUtils.getSetterMethodName ( painterStyle.getId () );
                ReflectUtils.callMethod ( ui, setterMethod, ( Painter ) null );
            }
            return true;
View Full Code Here

TOP

Related Classes of com.alee.managers.style.data.ComponentStyle

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.