Dynamic resizing of ribbon components in Flamingo 5.0

July 13th, 2010

While the ribbon component in Flamingo component suite mainly targets hosting command buttons and button galleries, you can also add any core / third-party component by wrapping it in a JRibbonComponent class. You can add such components as they are, or associate optional icon / caption pair with them:

https://flamingo.dev.java.net/release-info/5.0/ribbon-comp-resize-top.png

In this example, the “Applications” ribbon band hosts three comboboxes, and each combobox has an icon and a caption next to it. To address different monitor and window sizes, as well as the user resizing the application window hosting the ribbon, Flamingo provides built-in support for dynamically resizing the content of the ribbon bands to best fit into the available space. As the user makes the window smaller, ribbon galleries show less buttons, and command buttons switch from big to small icons and hide the caption. Eventually, when there is not enough space to show the controls at the smallest visual state, the entire ribbon band becomes collapsed.

Support for dynamic resizing of the ribbon content has now been extended to the JRibbonComponents as well. Call the new JRibbonComponent.setResizingAware(true) API to turn the dynamic resizing on for the specific component. If this API is not called, the existing behavior is preserved.

Once the API is called, and the user starts resizing the ribbon, the wrapped component will hide the caption and icon as necessary before the band will go to the collapsed state. If you start with the ribbon band displayed above – where all comboboxes show the icons and captions, the next state will be

https://flamingo.dev.java.net/release-info/5.0/ribbon-comp-resize-medium.png

where the captions are gone, and the comboboxes fill the available space if JRibbonComponent.setHorizontalAlignment(HorizontalAlignment.FILL) was called when the component was created. If the user continues making the ribbon smaller, the next state is

https://flamingo.dev.java.net/release-info/5.0/ribbon-comp-resize-low.png

where the icons are gone as well. At this point the next state is to collapse the entire ribbon band:

https://flamingo.dev.java.net/release-info/5.0/ribbon-comp-resize-collapsed.png

This is the last planned new feature for Flamingo 5.0. Release candidate is planned for July 19, with the final release planned for August 9. Now is the best time to migrate your application to the latest 5.0dev drop of the library and help me find the remaining bugs.