Class FlamingoUtilities
- java.lang.Object
-
- org.pushingpixels.flamingo.internal.utils.FlamingoUtilities
-
public class FlamingoUtilities extends Object
Helper utilities for Flamingo project. This class is for internal use only.
-
-
Constructor Summary
Constructors Constructor Description FlamingoUtilities()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidcheckResizePoliciesConsistency(AbstractRibbonBand ribbonBand)static voidcheckResizePoliciesConsistencyBase(AbstractRibbonBand ribbonBand)static StringclipString(FontMetrics metrics, int availableWidth, String fullText)Clips string based on specified font metrics and available width (in pixels).static BufferedImagecreateThumbnail(BufferedImage image, int requestedThumbWidth)Creates a thumbnail of the specified width.static ColorgetAlphaColor(Color color, int alpha)Returns the alpha version of the specified color.static JRibbonApplicationMenuButtongetApplicationMenuButton(Component comp)Recursively searches thecompchild components for aJRibbonApplicationMenuButtonand returns it.static BufferedImagegetBlankImage(int width, int height)Retrieves transparent image of specified dimension.static ColorgetBorderColor()static ColorgetColor(Color defaultColor, String... keys)Gets the color based on the specifiedUIManagerkeys.static ResizableIcongetCommandButtonPopupActionIcon(JCommandButton commandButton)Returns a popup action icon for the specific command button.static FontUIResourcegetFont(Component comp, String... keys)Gets the component font.static intgetHLayoutGap(AbstractCommandButton commandButton)static ColorgetLighterColor(Color color, double diff)Returns lighter version of the specified color.static ResizableIcongetRibbonBandExpandIcon(AbstractRibbonBand ribbonBand)Returns a ribbon band expand icon.static GeneralPathgetRibbonBorderOutline(int startX, int endX, int startSelectedX, int endSelectedX, int topY, int bandTopY, int bottomY, float radius)Returns the outline of the ribbon border.static GeneralPathgetRibbonGalleryOutline(int startX, int endX, int topY, int bottomY, float radius)Returns the outline of in-ribbon gallery.static GeneralPathgetRibbonTaskToggleButtonOutline(int width, int height, float radius)Returns the clip area of a task toggle button in ribbon component.static intgetVLayoutGap(AbstractCommandButton commandButton)static booleanhasPopupAction(AbstractCommandButton commandButton)static booleanisShowingMinimizedRibbonInPopup(JRibbon ribbon)static booleanisShowingMinimizedRibbonInPopup(JRibbonTaskToggleButton taskToggleButton)static voidrenderSurface(Graphics g, Container c, Rectangle rect, boolean toSimulateRollover, boolean hasTopBorder, boolean hasBottomBorder)static voidupdateRibbonFrameIconImages(JRibbonFrame ribbonFrame)Handles updating the application menu button icon image.
-
-
-
Method Detail
-
getFont
public static FontUIResource getFont(Component comp, String... keys)
Gets the component font.
-
getColor
public static Color getColor(Color defaultColor, String... keys)
Gets the color based on the specifiedUIManagerkeys.
-
getRibbonBandExpandIcon
public static ResizableIcon getRibbonBandExpandIcon(AbstractRibbonBand ribbonBand)
Returns a ribbon band expand icon.- Returns:
- Ribbon band expand icon.
-
getCommandButtonPopupActionIcon
public static ResizableIcon getCommandButtonPopupActionIcon(JCommandButton commandButton)
Returns a popup action icon for the specific command button.
-
createThumbnail
public static BufferedImage createThumbnail(BufferedImage image, int requestedThumbWidth)
Creates a thumbnail of the specified width.- Parameters:
image- The original image.requestedThumbWidth- The width of the resulting thumbnail.- Returns:
- Thumbnail of the specified width.
-
getRibbonBorderOutline
public static GeneralPath getRibbonBorderOutline(int startX, int endX, int startSelectedX, int endSelectedX, int topY, int bandTopY, int bottomY, float radius)
Returns the outline of the ribbon border.- Parameters:
startX- The starting X of the ribbon area.endX- The ending X of the ribbon area.startSelectedX- The starting X of the toggle tab button of the selected task.endSelectedX- The ending X of the toggle tab button of the selected task.topY- The top Y of the ribbon area.bandTopY- The top Y of the ribbon band area.bottomY- The bottom Y of the ribbon area.radius- Corner radius.- Returns:
- The outline of the ribbon border.
-
getRibbonTaskToggleButtonOutline
public static GeneralPath getRibbonTaskToggleButtonOutline(int width, int height, float radius)
Returns the clip area of a task toggle button in ribbon component.- Parameters:
width- Toggle tab button width.height- Toggle tab button height.radius- Toggle tab button corner radius.- Returns:
- Clip area of a toggle tab button in ribbon component.
-
getRibbonGalleryOutline
public static GeneralPath getRibbonGalleryOutline(int startX, int endX, int topY, int bottomY, float radius)
Returns the outline of in-ribbon gallery.- Parameters:
startX- Start X of the in-ribbon gallery.endX- End X of the in-ribbon gallery.topY- Top Y of the in-ribbon gallery.bottomY- Bottom Y of the in-ribbon gallery.radius- Corner radius.- Returns:
- The outline of in-ribbon gallery.
-
clipString
public static String clipString(FontMetrics metrics, int availableWidth, String fullText)
Clips string based on specified font metrics and available width (in pixels). Returns the clipped string, which contains the beginning and the end of the input string separated by ellipses (...) in case the string is too long to fit into the specified width, and the origianl string otherwise.- Parameters:
metrics- Font metrics.availableWidth- Available width in pixels.fullText- String to clip.- Returns:
- The clipped string, which contains the beginning and the end of the input string separated by ellipses (...) in case the string is too long to fit into the specified width, and the origianl string otherwise.
-
getBlankImage
public static BufferedImage getBlankImage(int width, int height)
Retrieves transparent image of specified dimension.- Parameters:
width- Image width.height- Image height.- Returns:
- Transparent image of specified dimension.
-
getAlphaColor
public static Color getAlphaColor(Color color, int alpha)
Returns the alpha version of the specified color.- Parameters:
color- Original color.alpha- Alpha channel value.- Returns:
- Alpha version of the specified color.
-
getHLayoutGap
public static int getHLayoutGap(AbstractCommandButton commandButton)
-
getVLayoutGap
public static int getVLayoutGap(AbstractCommandButton commandButton)
-
hasPopupAction
public static boolean hasPopupAction(AbstractCommandButton commandButton)
-
updateRibbonFrameIconImages
public static void updateRibbonFrameIconImages(JRibbonFrame ribbonFrame)
Handles updating the application menu button icon image. IfribbonFramedoes not have an application menu button nothing is performed.- Parameters:
ribbonFrame- the ribbon frame containing the application icon
-
getApplicationMenuButton
public static JRibbonApplicationMenuButton getApplicationMenuButton(Component comp)
Recursively searches thecompchild components for aJRibbonApplicationMenuButtonand returns it. If nothing is foundnullis returned.- Parameters:
comp- the component to recursively search- Returns:
- the
JRibbonApplicationMenuButton, ornullif not found
-
renderSurface
public static void renderSurface(Graphics g, Container c, Rectangle rect, boolean toSimulateRollover, boolean hasTopBorder, boolean hasBottomBorder)
-
getLighterColor
public static Color getLighterColor(Color color, double diff)
Returns lighter version of the specified color.- Parameters:
color- Color.diff- Difference factor (values closer to 1.0 will produce results closer to white color).- Returns:
- Lighter version of the specified color.
-
getBorderColor
public static Color getBorderColor()
-
isShowingMinimizedRibbonInPopup
public static boolean isShowingMinimizedRibbonInPopup(JRibbon ribbon)
-
isShowingMinimizedRibbonInPopup
public static boolean isShowingMinimizedRibbonInPopup(JRibbonTaskToggleButton taskToggleButton)
-
checkResizePoliciesConsistency
public static void checkResizePoliciesConsistency(AbstractRibbonBand ribbonBand)
-
checkResizePoliciesConsistencyBase
public static void checkResizePoliciesConsistencyBase(AbstractRibbonBand ribbonBand)
-
-