Search in sources :

Example 1 with SliderScroller

use of org.eclipse.nebula.widgets.nattable.viewport.SliderScroller in project nebula.widgets.nattable by eclipse.

the class _5043_VerticalSplitViewportExample method createSplitSliders.

private void createSplitSliders(Composite natTableParent, final ViewportLayer top, final ViewportLayer bottom) {
    Composite sliderComposite = new Composite(natTableParent, SWT.NONE);
    GridData gridData = new GridData();
    gridData.verticalAlignment = GridData.FILL;
    gridData.grabExcessHorizontalSpace = false;
    gridData.grabExcessVerticalSpace = true;
    gridData.widthHint = 17;
    sliderComposite.setLayoutData(gridData);
    GridLayout gridLayout = new GridLayout(1, false);
    gridLayout.marginHeight = 0;
    gridLayout.marginWidth = 0;
    gridLayout.horizontalSpacing = 0;
    gridLayout.verticalSpacing = 0;
    sliderComposite.setLayout(gridLayout);
    // Slider Left
    // Need a composite here to set preferred size because Slider can't be
    // subclassed.
    Composite sliderTopComposite = new Composite(sliderComposite, SWT.NONE) {

        @Override
        public Point computeSize(int wHint, int hHint, boolean changed) {
            int height = ((ClientAreaAdapter) top.getClientAreaProvider()).getHeight();
            return new Point(17, height);
        }
    };
    sliderTopComposite.setLayout(new FillLayout());
    gridData = new GridData();
    gridData.horizontalAlignment = GridData.BEGINNING;
    gridData.verticalAlignment = GridData.BEGINNING;
    sliderTopComposite.setLayoutData(gridData);
    Slider sliderTop = new Slider(sliderTopComposite, SWT.VERTICAL);
    gridData = new GridData();
    gridData.horizontalAlignment = GridData.FILL;
    gridData.verticalAlignment = GridData.FILL;
    sliderTop.setLayoutData(gridData);
    top.setVerticalScroller(new SliderScroller(sliderTop));
    // Slider Right
    Slider sliderBottom = new Slider(sliderComposite, SWT.VERTICAL);
    gridData = new GridData();
    gridData.horizontalAlignment = GridData.BEGINNING;
    gridData.verticalAlignment = GridData.FILL;
    gridData.grabExcessHorizontalSpace = false;
    gridData.grabExcessVerticalSpace = true;
    sliderBottom.setLayoutData(gridData);
    bottom.setVerticalScroller(new SliderScroller(sliderBottom));
}
Also used : ClientAreaAdapter(org.eclipse.nebula.widgets.nattable.util.ClientAreaAdapter) GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) Slider(org.eclipse.swt.widgets.Slider) GridData(org.eclipse.swt.layout.GridData) Point(org.eclipse.swt.graphics.Point) FillLayout(org.eclipse.swt.layout.FillLayout) SliderScroller(org.eclipse.nebula.widgets.nattable.viewport.SliderScroller) Point(org.eclipse.swt.graphics.Point)

Example 2 with SliderScroller

use of org.eclipse.nebula.widgets.nattable.viewport.SliderScroller in project nebula.widgets.nattable by eclipse.

the class _5045_ScrollableRowHeaderExample method createSplitSliders.

private void createSplitSliders(Composite natTableParent, final ViewportLayer left, int fixedHeaderWidth, final ViewportLayer right) {
    Composite sliderComposite = new Composite(natTableParent, SWT.NONE);
    GridData gridData = new GridData();
    gridData.horizontalAlignment = GridData.FILL;
    gridData.grabExcessHorizontalSpace = true;
    gridData.grabExcessVerticalSpace = false;
    gridData.heightHint = 17;
    sliderComposite.setLayoutData(gridData);
    GridLayout gridLayout = new GridLayout(2, false);
    gridLayout.marginHeight = 0;
    gridLayout.marginWidth = 0;
    gridLayout.horizontalSpacing = 0;
    gridLayout.verticalSpacing = 0;
    sliderComposite.setLayout(gridLayout);
    // Slider Left
    // Need a composite here to set preferred size because Slider can't be
    // subclassed.
    Composite sliderLeftComposite = new Composite(sliderComposite, SWT.NONE) {

        @Override
        public Point computeSize(int wHint, int hHint, boolean changed) {
            int width = ((ClientAreaAdapter) left.getClientAreaProvider()).getWidth() + fixedHeaderWidth;
            return new Point(width, 17);
        }
    };
    sliderLeftComposite.setLayout(new FillLayout());
    gridData = new GridData();
    gridData.horizontalAlignment = GridData.BEGINNING;
    gridData.verticalAlignment = GridData.BEGINNING;
    sliderLeftComposite.setLayoutData(gridData);
    Slider sliderLeft = new Slider(sliderLeftComposite, SWT.HORIZONTAL);
    gridData = new GridData();
    gridData.horizontalAlignment = GridData.FILL;
    gridData.verticalAlignment = GridData.FILL;
    sliderLeft.setLayoutData(gridData);
    left.setHorizontalScroller(new SliderScroller(sliderLeft));
    // Slider Right
    Slider sliderRight = new Slider(sliderComposite, SWT.HORIZONTAL);
    gridData = new GridData();
    gridData.horizontalAlignment = GridData.FILL;
    gridData.verticalAlignment = GridData.BEGINNING;
    gridData.grabExcessHorizontalSpace = true;
    gridData.grabExcessVerticalSpace = false;
    sliderRight.setLayoutData(gridData);
    right.setHorizontalScroller(new SliderScroller(sliderRight));
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) Slider(org.eclipse.swt.widgets.Slider) GridData(org.eclipse.swt.layout.GridData) Point(org.eclipse.swt.graphics.Point) FillLayout(org.eclipse.swt.layout.FillLayout) SliderScroller(org.eclipse.nebula.widgets.nattable.viewport.SliderScroller) Point(org.eclipse.swt.graphics.Point)

Example 3 with SliderScroller

use of org.eclipse.nebula.widgets.nattable.viewport.SliderScroller in project nebula.widgets.nattable by eclipse.

the class _5046_MultiScrollExample method createSplitSliders.

/**
 * @param natTableParent
 * @param gridLayer
 * @param fixedHeaderWidth
 */
private void createSplitSliders(Composite natTableParent, ExtendedGridLayer gridLayer, int fixedHeaderWidth) {
    Composite sliderComposite = new Composite(natTableParent, SWT.NONE);
    GridData gridData = new GridData();
    gridData.horizontalAlignment = GridData.FILL;
    gridData.grabExcessHorizontalSpace = true;
    gridData.grabExcessVerticalSpace = false;
    gridData.heightHint = 17;
    sliderComposite.setLayoutData(gridData);
    GridLayout gridLayout = new GridLayout(2, false);
    gridLayout.marginHeight = 0;
    gridLayout.marginWidth = 0;
    gridLayout.horizontalSpacing = 0;
    gridLayout.verticalSpacing = 0;
    sliderComposite.setLayout(gridLayout);
    // Slider Left
    // Need a composite here to set preferred size because Slider can't be
    // subclassed.
    Composite sliderLeftComposite = new Composite(sliderComposite, SWT.NONE) {

        @Override
        public Point computeSize(int wHint, int hHint, boolean changed) {
            int width = ((ClientAreaAdapter) gridLayer.getStructureBody().getViewportLayer().getClientAreaProvider()).getWidth() + fixedHeaderWidth;
            return new Point(width, 17);
        }
    };
    sliderLeftComposite.setLayout(new FillLayout());
    gridData = new GridData();
    gridData.horizontalAlignment = GridData.BEGINNING;
    gridData.verticalAlignment = GridData.BEGINNING;
    sliderLeftComposite.setLayoutData(gridData);
    Slider sliderLeft = new Slider(sliderLeftComposite, SWT.HORIZONTAL);
    gridData = new GridData();
    gridData.horizontalAlignment = GridData.FILL;
    gridData.verticalAlignment = GridData.FILL;
    sliderLeft.setLayoutData(gridData);
    gridLayer.getStructureBody().getViewportLayer().setHorizontalScroller(new SliderScroller(sliderLeft));
    // Slider Right
    Slider sliderRight = new Slider(sliderComposite, SWT.HORIZONTAL);
    gridData = new GridData();
    gridData.horizontalAlignment = GridData.FILL;
    gridData.verticalAlignment = GridData.BEGINNING;
    gridData.grabExcessHorizontalSpace = true;
    gridData.grabExcessVerticalSpace = false;
    sliderRight.setLayoutData(gridData);
    gridLayer.getContentBody().getViewportLayer().setHorizontalScroller(new SliderScroller(sliderRight));
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) Slider(org.eclipse.swt.widgets.Slider) GridData(org.eclipse.swt.layout.GridData) Point(org.eclipse.swt.graphics.Point) FillLayout(org.eclipse.swt.layout.FillLayout) SliderScroller(org.eclipse.nebula.widgets.nattable.viewport.SliderScroller) Point(org.eclipse.swt.graphics.Point)

Example 4 with SliderScroller

use of org.eclipse.nebula.widgets.nattable.viewport.SliderScroller in project nebula.widgets.nattable by eclipse.

the class _5042_HorizontalSplitViewportExample method createSplitSliders.

private void createSplitSliders(Composite natTableParent, final ViewportLayer left, final ViewportLayer right) {
    Composite sliderComposite = new Composite(natTableParent, SWT.NONE);
    GridData gridData = new GridData();
    gridData.horizontalAlignment = GridData.FILL;
    gridData.grabExcessHorizontalSpace = true;
    gridData.grabExcessVerticalSpace = false;
    gridData.heightHint = 17;
    sliderComposite.setLayoutData(gridData);
    GridLayout gridLayout = new GridLayout(2, false);
    gridLayout.marginHeight = 0;
    gridLayout.marginWidth = 0;
    gridLayout.horizontalSpacing = 0;
    gridLayout.verticalSpacing = 0;
    sliderComposite.setLayout(gridLayout);
    // Slider Left
    // Need a composite here to set preferred size because Slider can't be
    // subclassed.
    Composite sliderLeftComposite = new Composite(sliderComposite, SWT.NONE) {

        @Override
        public Point computeSize(int wHint, int hHint, boolean changed) {
            int width = ((ClientAreaAdapter) left.getClientAreaProvider()).getWidth();
            return new Point(width, 17);
        }
    };
    sliderLeftComposite.setLayout(new FillLayout());
    gridData = new GridData();
    gridData.horizontalAlignment = GridData.BEGINNING;
    gridData.verticalAlignment = GridData.BEGINNING;
    sliderLeftComposite.setLayoutData(gridData);
    Slider sliderLeft = new Slider(sliderLeftComposite, SWT.HORIZONTAL);
    gridData = new GridData();
    gridData.horizontalAlignment = GridData.FILL;
    gridData.verticalAlignment = GridData.FILL;
    sliderLeft.setLayoutData(gridData);
    left.setHorizontalScroller(new SliderScroller(sliderLeft));
    // Slider Right
    Slider sliderRight = new Slider(sliderComposite, SWT.HORIZONTAL);
    gridData = new GridData();
    gridData.horizontalAlignment = GridData.FILL;
    gridData.verticalAlignment = GridData.BEGINNING;
    gridData.grabExcessHorizontalSpace = true;
    gridData.grabExcessVerticalSpace = false;
    sliderRight.setLayoutData(gridData);
    right.setHorizontalScroller(new SliderScroller(sliderRight));
}
Also used : ClientAreaAdapter(org.eclipse.nebula.widgets.nattable.util.ClientAreaAdapter) GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) Slider(org.eclipse.swt.widgets.Slider) GridData(org.eclipse.swt.layout.GridData) Point(org.eclipse.swt.graphics.Point) FillLayout(org.eclipse.swt.layout.FillLayout) SliderScroller(org.eclipse.nebula.widgets.nattable.viewport.SliderScroller) Point(org.eclipse.swt.graphics.Point)

Example 5 with SliderScroller

use of org.eclipse.nebula.widgets.nattable.viewport.SliderScroller in project nebula.widgets.nattable by eclipse.

the class _5044_HorizontalSplitViewportGridExample method createSplitSliders.

private void createSplitSliders(Composite natTableParent, final ILayer rowHeaderLayer, final ViewportLayer left, final ViewportLayer right) {
    Composite sliderComposite = new Composite(natTableParent, SWT.NONE);
    GridData gridData = new GridData();
    gridData.horizontalAlignment = GridData.FILL;
    gridData.grabExcessHorizontalSpace = true;
    gridData.grabExcessVerticalSpace = false;
    gridData.heightHint = 17;
    sliderComposite.setLayoutData(gridData);
    GridLayout gridLayout = new GridLayout(2, false);
    gridLayout.marginHeight = 0;
    gridLayout.marginWidth = 0;
    gridLayout.horizontalSpacing = 0;
    gridLayout.verticalSpacing = 0;
    sliderComposite.setLayout(gridLayout);
    // Slider Left
    // Need a composite here to set preferred size because Slider can't be
    // subclassed.
    Composite sliderLeftComposite = new Composite(sliderComposite, SWT.NONE) {

        @Override
        public Point computeSize(int wHint, int hHint, boolean changed) {
            int width = ((ClientAreaAdapter) left.getClientAreaProvider()).getWidth();
            width += rowHeaderLayer.getWidth();
            return new Point(width, 17);
        }
    };
    sliderLeftComposite.setLayout(new FillLayout());
    gridData = new GridData();
    gridData.horizontalAlignment = GridData.BEGINNING;
    gridData.verticalAlignment = GridData.BEGINNING;
    sliderLeftComposite.setLayoutData(gridData);
    Slider sliderLeft = new Slider(sliderLeftComposite, SWT.HORIZONTAL);
    gridData = new GridData();
    gridData.horizontalAlignment = GridData.FILL;
    gridData.verticalAlignment = GridData.FILL;
    sliderLeft.setLayoutData(gridData);
    left.setHorizontalScroller(new SliderScroller(sliderLeft));
    // Slider Right
    Slider sliderRight = new Slider(sliderComposite, SWT.HORIZONTAL);
    gridData = new GridData();
    gridData.horizontalAlignment = GridData.FILL;
    gridData.verticalAlignment = GridData.BEGINNING;
    gridData.grabExcessHorizontalSpace = true;
    gridData.grabExcessVerticalSpace = true;
    sliderRight.setLayoutData(gridData);
    right.setHorizontalScroller(new SliderScroller(sliderRight));
}
Also used : ClientAreaAdapter(org.eclipse.nebula.widgets.nattable.util.ClientAreaAdapter) GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) Slider(org.eclipse.swt.widgets.Slider) GridData(org.eclipse.swt.layout.GridData) Point(org.eclipse.swt.graphics.Point) FillLayout(org.eclipse.swt.layout.FillLayout) SliderScroller(org.eclipse.nebula.widgets.nattable.viewport.SliderScroller) Point(org.eclipse.swt.graphics.Point)

Aggregations

SliderScroller (org.eclipse.nebula.widgets.nattable.viewport.SliderScroller)5 Point (org.eclipse.swt.graphics.Point)5 FillLayout (org.eclipse.swt.layout.FillLayout)5 GridData (org.eclipse.swt.layout.GridData)5 GridLayout (org.eclipse.swt.layout.GridLayout)5 Composite (org.eclipse.swt.widgets.Composite)5 Slider (org.eclipse.swt.widgets.Slider)5 ClientAreaAdapter (org.eclipse.nebula.widgets.nattable.util.ClientAreaAdapter)3 ScrolledComposite (org.eclipse.swt.custom.ScrolledComposite)1