Search in sources :

Example 1 with ScrollBarLayout

use of org.eclipse.draw2d.ScrollBarLayout in project archi by archimatetool.

the class PaletteScrollBar method initialize.

@Override
protected void initialize() {
    super.initialize();
    setLayoutManager(new ScrollBarLayout(transposer) {

        @SuppressWarnings("deprecation")
        @Override
        protected Rectangle layoutButtons(ScrollBar scrollBar) {
            Rectangle bounds = transposer.t(scrollBar.getClientArea());
            Dimension buttonSize = new Dimension(BUTTON_WIDTH, BUTTON_HEIGHT);
            getButtonUp().setBounds(transposer.t(new Rectangle(bounds.getTop().getTranslated(-(buttonSize.width / 2), 0), buttonSize)));
            Rectangle r = new Rectangle(bounds.getBottom().getTranslated(-(buttonSize.width / 2), -buttonSize.height), buttonSize);
            getButtonDown().setBounds(transposer.t(r));
            Rectangle trackBounds = bounds.getCropped(new Insets(buttonSize.height, 0, buttonSize.height, 0));
            RangeModel model = scrollBar.getRangeModel();
            getButtonUp().setVisible(model.getValue() != model.getMinimum());
            getButtonDown().setVisible(model.getValue() != model.getMaximum() - model.getExtent());
            return trackBounds;
        }
    });
    setPageUp(null);
    setPageDown(null);
    setThumb(null);
    setOpaque(false);
}
Also used : Insets(org.eclipse.draw2d.geometry.Insets) Rectangle(org.eclipse.draw2d.geometry.Rectangle) Dimension(org.eclipse.draw2d.geometry.Dimension) ScrollBarLayout(org.eclipse.draw2d.ScrollBarLayout) RangeModel(org.eclipse.draw2d.RangeModel) ScrollBar(org.eclipse.draw2d.ScrollBar)

Aggregations

RangeModel (org.eclipse.draw2d.RangeModel)1 ScrollBar (org.eclipse.draw2d.ScrollBar)1 ScrollBarLayout (org.eclipse.draw2d.ScrollBarLayout)1 Dimension (org.eclipse.draw2d.geometry.Dimension)1 Insets (org.eclipse.draw2d.geometry.Insets)1 Rectangle (org.eclipse.draw2d.geometry.Rectangle)1