Class FlamingoUtilities
java.lang.Object
org.pushingpixels.flamingo.internal.utils.FlamingoUtilities
Helper utilities for Flamingo project. This class is for internal use only.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
checkResizePoliciesConsistency
(AbstractRibbonBand ribbonBand) static void
checkResizePoliciesConsistencyBase
(AbstractRibbonBand ribbonBand) static String
clipString
(FontMetrics metrics, int availableWidth, String fullText) Clips string based on specified font metrics and available width (in pixels).static BufferedImage
createThumbnail
(BufferedImage image, int requestedThumbWidth) Creates a thumbnail of the specified width.static Color
getAlphaColor
(Color color, int alpha) Returns the alpha version of the specified color.static JRibbonApplicationMenuButton
Recursively searches thecomp
child components for aJRibbonApplicationMenuButton
and returns it.static BufferedImage
getBlankImage
(int width, int height) Retrieves transparent image of specified dimension.static Color
static Color
Gets the color based on the specifiedUIManager
keys.static ResizableIcon
getCommandButtonPopupActionIcon
(JCommandButton commandButton) Returns a popup action icon for the specific command button.static FontUIResource
Gets the component font.static int
getHLayoutGap
(AbstractCommandButton commandButton) static Color
getLighterColor
(Color color, double diff) Returns lighter version of the specified color.static ResizableIcon
getRibbonBandExpandIcon
(AbstractRibbonBand ribbonBand) Returns a ribbon band expand icon.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.static GeneralPath
getRibbonGalleryOutline
(int startX, int endX, int topY, int bottomY, float radius) Returns the outline of in-ribbon gallery.static GeneralPath
getRibbonTaskToggleButtonOutline
(int width, int height, float radius) Returns the clip area of a task toggle button in ribbon component.static int
getVLayoutGap
(AbstractCommandButton commandButton) static boolean
hasPopupAction
(AbstractCommandButton commandButton) static boolean
static boolean
isShowingMinimizedRibbonInPopup
(JRibbonTaskToggleButton taskToggleButton) static void
renderSurface
(Graphics g, Container c, Rectangle rect, boolean toSimulateRollover, boolean hasTopBorder, boolean hasBottomBorder) static void
updateRibbonFrameIconImages
(JRibbonFrame ribbonFrame) Handles updating the application menu button icon image.
-
Constructor Details
-
FlamingoUtilities
public FlamingoUtilities()
-
-
Method Details
-
getFont
Gets the component font. -
getColor
Gets the color based on the specifiedUIManager
keys. -
getRibbonBandExpandIcon
Returns a ribbon band expand icon.- Returns:
- Ribbon band expand icon.
-
getCommandButtonPopupActionIcon
Returns a popup action icon for the specific command button. -
createThumbnail
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
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
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
Retrieves transparent image of specified dimension.- Parameters:
width
- Image width.height
- Image height.- Returns:
- Transparent image of specified dimension.
-
getAlphaColor
Returns the alpha version of the specified color.- Parameters:
color
- Original color.alpha
- Alpha channel value.- Returns:
- Alpha version of the specified color.
-
getHLayoutGap
-
getVLayoutGap
-
hasPopupAction
-
updateRibbonFrameIconImages
Handles updating the application menu button icon image. IfribbonFrame
does not have an application menu button nothing is performed.- Parameters:
ribbonFrame
- the ribbon frame containing the application icon
-
getApplicationMenuButton
Recursively searches thecomp
child components for aJRibbonApplicationMenuButton
and returns it. If nothing is foundnull
is returned.- Parameters:
comp
- the component to recursively search- Returns:
- the
JRibbonApplicationMenuButton
, ornull
if not found
-
renderSurface
-
getLighterColor
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
-
isShowingMinimizedRibbonInPopup
-
isShowingMinimizedRibbonInPopup
-
checkResizePoliciesConsistency
-
checkResizePoliciesConsistencyBase
-