org.pushingpixels.flamingo.api.ribbon.resize
public interface RibbonBandResizePolicy
JRibbonBand
s and
JFlowRibbonBand
s.
The resize policy defines a single visual state of the given ribbon band. For every control in the specific ribbon band (command button, gallery etc), the resize policy defines what is its display state.
The resize policies are installed with
AbstractRibbonBand.setResizePolicies(java.util.List)
API. The order
of the resize policies in this list is important. The first entry in the list
must be the most permissive policies that returns the largest value from its
getPreferredWidth(int, int)
. Each successive entry in the list must
return the value smaller than its predecessors. The last entry
must be IconRibbonBandResizePolicy
.
As the ribbon horizontal size is changed (by the user resizing the
application window), the ribbon task resize sequencing policy set by
RibbonTask.setResizeSequencingPolicy(RibbonBandResizeSequencingPolicy)
determines the order of ribbon bands to shrink / expand. See more details in
the documentation of the RibbonBandResizeSequencingPolicy
.
The CoreRibbonResizePolicies
provides a number of built in resize
policies that respect the application element priorities passed to
JRibbonBand.addCommandButton(org.pushingpixels.flamingo.api.common.AbstractCommandButton, org.pushingpixels.flamingo.api.ribbon.RibbonElementPriority)
and
JRibbonBand.addRibbonGallery(String, java.util.List, java.util.Map, int, int, org.pushingpixels.flamingo.api.ribbon.RibbonElementPriority)
APIs. There are three types of built in resize policies:
JFlowRibbonBand
s. The CoreRibbonResizePolicies.FlowTwoRows
and CoreRibbonResizePolicies.FlowThreeRows
allow placing the flow ribbon band content in two
and three rows respectively.JRibbonBand
s. The
CoreRibbonResizePolicies.BaseCoreRibbonBandResizePolicy
is the base class for these policies.
These policies respect the RibbonElementPriority
associated on
command buttons and ribbon galleries in getPreferredWidth(int, int)
and install(int, int)
. While install(int, int)
call on a
JFlowRibbonBand
only changes the bounds of the flow components, this
call on a JRibbonBand
can also change the display state of the
command buttons (with
AbstractCommandButton.setDisplayState(org.pushingpixels.flamingo.api.common.CommandButtonDisplayState)
) and the number of visible buttons in the ribbon galleries.IconRibbonBandResizePolicy
.
In addition to the specific resize policies, the
CoreRibbonResizePolicies
provides three core resize policies lists
for JRibbonBand
s:
CoreRibbonResizePolicies.getCorePoliciesPermissive(JRibbonBand)
returns a list that starts with a resize policy that shows all command
buttons in the CommandButtonDisplayState.BIG
and ribbon galleries
with the largest number of visible buttons, fully utilizing the available
screen space.CoreRibbonResizePolicies.getCorePoliciesRestrictive(JRibbonBand)
returns a list that starts with a resize policy that respects the associated
ribbon element priority set on the specific components.CoreRibbonResizePolicies.getCorePoliciesNone(JRibbonBand)
returns
a list that only has a mirror
resize policy that respects the
associated ribbon element priority set on the specific components.
Note that as mentioned above, all the three lists above have the
collapsed
policy as their last element.
In addition, the
CoreRibbonResizePolicies.getCoreFlowPoliciesRestrictive(JFlowRibbonBand, int)
returns a restrictive resize policy for JFlowRibbonBand
s. The list
starts with the two-row policy, goes to the three-row policy and then finally
to the collapsed policy.
Modifier and Type | Method and Description |
---|---|
int |
getPreferredWidth(int availableHeight,
int gap)
Returns the preferred width of the associated ribbon band under the
specified dimensions.
|
void |
install(int availableHeight,
int gap)
Installs this resize policy on the associated ribbon band.
|
int getPreferredWidth(int availableHeight, int gap)
availableHeight
- The height available for the associated ribbon band.gap
- The inter-component gap.void install(int availableHeight, int gap)
JFlowRibbonBand
s only changes the bounds of the flow components.
For JRibbonBand
s can also change the display state of the command
buttons (with
AbstractCommandButton.setDisplayState(org.pushingpixels.flamingo.api.common.CommandButtonDisplayState)
) and the number of visible buttons in the ribbon galleries. Note that
this method is for internal use only and should not be called by the
application code.availableHeight
- The height available for the associated ribbon band.gap
- The inter-component gap.