All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.alee.laf.desktoppane.InternalFramePainter Maven / Gradle / Ivy

The newest version!
package com.alee.laf.desktoppane;

import com.alee.api.jdk.Objects;
import com.alee.painter.decoration.AbstractContainerPainter;
import com.alee.painter.decoration.DecorationState;
import com.alee.painter.decoration.IDecoration;

import javax.swing.*;
import java.util.List;

import static javax.swing.JInternalFrame.*;

/**
 * Basic painter for {@link JInternalFrame} component.
 * It is used as {@link WebInternalFrameUI} default painter.
 *
 * @param  component type
 * @param  component UI type
 * @param  decoration type
 * @author Alexandr Zernov
 * @author Mikle Garin
 */

public class InternalFramePainter>
        extends AbstractContainerPainter implements IInternalFramePainter
{
    @Override
    protected void propertyChanged ( final String property, final Object oldValue, final Object newValue )
    {
        // Perform basic actions on property changes
        super.propertyChanged ( property, oldValue, newValue );

        // Decoration update on internal frame state changes
        if ( Objects.equals ( property, IS_SELECTED_PROPERTY, IS_CLOSED_PROPERTY, IS_ICON_PROPERTY, IS_MAXIMUM_PROPERTY ) )
        {
            updateDecorationState ();
        }
    }

    @Override
    public List getDecorationStates ()
    {
        final List states = super.getDecorationStates ();
        if ( component.isMaximum () )
        {
            states.add ( DecorationState.maximized );
        }
        return states;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy