![JAR search and dependency download from the Maven repository](/logo.png)
com.alee.painter.decoration.shape.StretchInfo Maven / Gradle / Ivy
/*
* This file is part of WebLookAndFeel library.
*
* WebLookAndFeel library is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* WebLookAndFeel library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with WebLookAndFeel library. If not, see .
*/
package com.alee.painter.decoration.shape;
import com.alee.utils.general.Pair;
import java.io.Serializable;
/**
* Class containing shape stretch information.
*
* @author Mikle Garin
*/
public class StretchInfo implements Serializable
{
/**
* Horizontal stretch intervals.
*/
protected Pair horizontalStretch;
/**
* Vertical stretch intervals.
*/
protected Pair verticalStretch;
/**
* Shape settings.
*/
protected Object[] settings;
public StretchInfo ()
{
super ();
}
public StretchInfo ( final Pair horizontalStretch, final Pair verticalStretch,
final Object... settings )
{
super ();
this.horizontalStretch = horizontalStretch;
this.verticalStretch = verticalStretch;
this.settings = settings;
}
public Pair getHorizontalStretch ()
{
return horizontalStretch;
}
public Pair getVerticalStretch ()
{
return verticalStretch;
}
public Object[] getSettings ()
{
return settings;
}
public boolean isStretchable ()
{
return horizontalStretch != null || verticalStretch != null;
}
@Override
public String toString ()
{
final StringBuilder sb = new StringBuilder ();
if ( horizontalStretch != null )
{
sb.append ( "hor:" );
toString ( sb, horizontalStretch );
}
if ( verticalStretch != null )
{
sb.append ( "ver:" );
toString ( sb, verticalStretch );
}
return sb.toString ();
}
/**
* Appends intervals to string builder.
*
* @param sb string builder
* @param interval stretch interval
*/
protected void toString ( final StringBuilder sb, final Pair interval )
{
sb.append ( interval.getKey () ).append ( "," ).append ( interval.getValue () );
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy