Search in sources :

Example 1 with AbstractBandControlPanel

use of org.pushingpixels.flamingo.internal.ui.ribbon.AbstractBandControlPanel in project freeplane by freeplane.

the class RibbonBandContributorFactory method reorganizePolicies.

/**
 *********************************************************************************
 * CONSTRUCTORS
 *********************************************************************************
 */
@SuppressWarnings("unchecked")
protected void reorganizePolicies(JRibbonBand band, boolean tolerateExceptions) {
    Insets ins = band.getInsets();
    AbstractBandControlPanel controlPanel = band.getControlPanel();
    if (controlPanel == null)
        return;
    int height = controlPanel.getPreferredSize().height + band.getUI().getBandTitleHeight() + ins.top + ins.bottom;
    List<RibbonBandResizePolicy> resizePolicies = band.getResizePolicies();
    FlamingoUtilities.checkResizePoliciesConsistencyBase(band);
    int index = -1;
    while ((index = checkPolicies(band, height, resizePolicies)) > -1) {
        if (tolerateExceptions) {
            band.setResizePolicies(buildNewList(resizePolicies, index));
            break;
        } else {
            throw new IllegalStateException(getExceptionMessage(band, height, resizePolicies, index));
        }
    }
}
Also used : RibbonBandResizePolicy(org.pushingpixels.flamingo.api.ribbon.resize.RibbonBandResizePolicy) IconRibbonBandResizePolicy(org.pushingpixels.flamingo.api.ribbon.resize.IconRibbonBandResizePolicy) Insets(java.awt.Insets) AbstractBandControlPanel(org.pushingpixels.flamingo.internal.ui.ribbon.AbstractBandControlPanel)

Aggregations

Insets (java.awt.Insets)1 IconRibbonBandResizePolicy (org.pushingpixels.flamingo.api.ribbon.resize.IconRibbonBandResizePolicy)1 RibbonBandResizePolicy (org.pushingpixels.flamingo.api.ribbon.resize.RibbonBandResizePolicy)1 AbstractBandControlPanel (org.pushingpixels.flamingo.internal.ui.ribbon.AbstractBandControlPanel)1