Java 类org.eclipse.swt.widgets.Slider 实例源码

项目:DarwinSPL    文件:DwprofileBrowserInformationControl.java   
/**
 * <p>
 * Tells whether the SWT Browser widget and hence this information control is
 * available.
 * </p>
 * 
 * @param parent the parent component used for checking or <code>null</code> if
 * none
 * 
 * @return <code>true</code> if this control is available
 */
public static boolean isAvailable(Composite parent) {
    if (!fgAvailabilityChecked) {
        try {
            Browser browser= new Browser(parent, SWT.NONE);
            browser.dispose();
            fgIsAvailable= true;

            Slider sliderV= new Slider(parent, SWT.VERTICAL);
            Slider sliderH= new Slider(parent, SWT.HORIZONTAL);
            int width= sliderV.computeSize(SWT.DEFAULT, SWT.DEFAULT).x;
            int height= sliderH.computeSize(SWT.DEFAULT, SWT.DEFAULT).y;
            fgScrollBarSize= new Point(width, height);
            sliderV.dispose();
            sliderH.dispose();
        } catch (SWTError er) {
            fgIsAvailable= false;
        } finally {
            fgAvailabilityChecked= true;
        }
    }

    return fgIsAvailable;
}
项目:DarwinSPL    文件:HyexpressionBrowserInformationControl.java   
/**
 * <p>
 * Tells whether the SWT Browser widget and hence this information control is
 * available.
 * </p>
 * 
 * @param parent the parent component used for checking or <code>null</code> if
 * none
 * 
 * @return <code>true</code> if this control is available
 */
public static boolean isAvailable(Composite parent) {
    if (!fgAvailabilityChecked) {
        try {
            Browser browser= new Browser(parent, SWT.NONE);
            browser.dispose();
            fgIsAvailable= true;

            Slider sliderV= new Slider(parent, SWT.VERTICAL);
            Slider sliderH= new Slider(parent, SWT.HORIZONTAL);
            int width= sliderV.computeSize(SWT.DEFAULT, SWT.DEFAULT).x;
            int height= sliderH.computeSize(SWT.DEFAULT, SWT.DEFAULT).y;
            fgScrollBarSize= new Point(width, height);
            sliderV.dispose();
            sliderH.dispose();
        } catch (SWTError er) {
            fgIsAvailable= false;
        } finally {
            fgAvailabilityChecked= true;
        }
    }

    return fgIsAvailable;
}
项目:DarwinSPL    文件:HyvalidityformulaBrowserInformationControl.java   
/**
 * <p>
 * Tells whether the SWT Browser widget and hence this information control is
 * available.
 * </p>
 * 
 * @param parent the parent component used for checking or <code>null</code> if
 * none
 * 
 * @return <code>true</code> if this control is available
 */
public static boolean isAvailable(Composite parent) {
    if (!fgAvailabilityChecked) {
        try {
            Browser browser= new Browser(parent, SWT.NONE);
            browser.dispose();
            fgIsAvailable= true;

            Slider sliderV= new Slider(parent, SWT.VERTICAL);
            Slider sliderH= new Slider(parent, SWT.HORIZONTAL);
            int width= sliderV.computeSize(SWT.DEFAULT, SWT.DEFAULT).x;
            int height= sliderH.computeSize(SWT.DEFAULT, SWT.DEFAULT).y;
            fgScrollBarSize= new Point(width, height);
            sliderV.dispose();
            sliderH.dispose();
        } catch (SWTError er) {
            fgIsAvailable= false;
        } finally {
            fgAvailabilityChecked= true;
        }
    }

    return fgIsAvailable;
}
项目:DarwinSPL    文件:HydatavalueBrowserInformationControl.java   
/**
 * <p>
 * Tells whether the SWT Browser widget and hence this information control is
 * available.
 * </p>
 * 
 * @param parent the parent component used for checking or <code>null</code> if
 * none
 * 
 * @return <code>true</code> if this control is available
 */
public static boolean isAvailable(Composite parent) {
    if (!fgAvailabilityChecked) {
        try {
            Browser browser= new Browser(parent, SWT.NONE);
            browser.dispose();
            fgIsAvailable= true;

            Slider sliderV= new Slider(parent, SWT.VERTICAL);
            Slider sliderH= new Slider(parent, SWT.HORIZONTAL);
            int width= sliderV.computeSize(SWT.DEFAULT, SWT.DEFAULT).x;
            int height= sliderH.computeSize(SWT.DEFAULT, SWT.DEFAULT).y;
            fgScrollBarSize= new Point(width, height);
            sliderV.dispose();
            sliderH.dispose();
        } catch (SWTError er) {
            fgIsAvailable= false;
        } finally {
            fgAvailabilityChecked= true;
        }
    }

    return fgIsAvailable;
}
项目:DarwinSPL    文件:HymappingBrowserInformationControl.java   
/**
 * <p>
 * Tells whether the SWT Browser widget and hence this information control is
 * available.
 * </p>
 * 
 * @param parent the parent component used for checking or <code>null</code> if
 * none
 * 
 * @return <code>true</code> if this control is available
 */
public static boolean isAvailable(Composite parent) {
    if (!fgAvailabilityChecked) {
        try {
            Browser browser= new Browser(parent, SWT.NONE);
            browser.dispose();
            fgIsAvailable= true;

            Slider sliderV= new Slider(parent, SWT.VERTICAL);
            Slider sliderH= new Slider(parent, SWT.HORIZONTAL);
            int width= sliderV.computeSize(SWT.DEFAULT, SWT.DEFAULT).x;
            int height= sliderH.computeSize(SWT.DEFAULT, SWT.DEFAULT).y;
            fgScrollBarSize= new Point(width, height);
            sliderV.dispose();
            sliderH.dispose();
        } catch (SWTError er) {
            fgIsAvailable= false;
        } finally {
            fgAvailabilityChecked= true;
        }
    }

    return fgIsAvailable;
}
项目:DarwinSPL    文件:HyconstraintsBrowserInformationControl.java   
/**
 * <p>
 * Tells whether the SWT Browser widget and hence this information control is
 * available.
 * </p>
 * 
 * @param parent the parent component used for checking or <code>null</code> if
 * none
 * 
 * @return <code>true</code> if this control is available
 */
public static boolean isAvailable(Composite parent) {
    if (!fgAvailabilityChecked) {
        try {
            Browser browser= new Browser(parent, SWT.NONE);
            browser.dispose();
            fgIsAvailable= true;

            Slider sliderV= new Slider(parent, SWT.VERTICAL);
            Slider sliderH= new Slider(parent, SWT.HORIZONTAL);
            int width= sliderV.computeSize(SWT.DEFAULT, SWT.DEFAULT).x;
            int height= sliderH.computeSize(SWT.DEFAULT, SWT.DEFAULT).y;
            fgScrollBarSize= new Point(width, height);
            sliderV.dispose();
            sliderH.dispose();
        } catch (SWTError er) {
            fgIsAvailable= false;
        } finally {
            fgAvailabilityChecked= true;
        }
    }

    return fgIsAvailable;
}
项目:DarwinSPL    文件:HymanifestBrowserInformationControl.java   
/**
 * <p>
 * Tells whether the SWT Browser widget and hence this information control is
 * available.
 * </p>
 * 
 * @param parent the parent component used for checking or <code>null</code> if
 * none
 * 
 * @return <code>true</code> if this control is available
 */
public static boolean isAvailable(Composite parent) {
    if (!fgAvailabilityChecked) {
        try {
            Browser browser= new Browser(parent, SWT.NONE);
            browser.dispose();
            fgIsAvailable= true;

            Slider sliderV= new Slider(parent, SWT.VERTICAL);
            Slider sliderH= new Slider(parent, SWT.HORIZONTAL);
            int width= sliderV.computeSize(SWT.DEFAULT, SWT.DEFAULT).x;
            int height= sliderH.computeSize(SWT.DEFAULT, SWT.DEFAULT).y;
            fgScrollBarSize= new Point(width, height);
            sliderV.dispose();
            sliderH.dispose();
        } catch (SWTError er) {
            fgIsAvailable= false;
        } finally {
            fgAvailabilityChecked= true;
        }
    }

    return fgIsAvailable;
}
项目:Black    文件:blackAction.java   
public void setSlider(Slider slider) {
    if (b.text != null && !b.text.isDisposed()) {
        sliderListener = new Listener() {

            @Override
            public void handleEvent(Event arg0) {
                // TODO Auto-generated method stub
                if (slider != null && !slider.isDisposed()) {
                    ScrollBar vb = b.text.getVerticalBar();
                    slider.setValues(vb.getSelection(), vb.getMinimum(), vb.getMaximum(), vb.getThumb(),
                            vb.getIncrement(), vb.getPageIncrement());
                }
            }
        };
        b.text.addListener(SWT.Paint, sliderListener);
    }
}
项目:pm    文件:ChartsComposite.java   
private void startSliderUpdateConditional(final Slider sliderStartDate, final Label startDateLabel, Slider sliderEndDate,  Label endDateLabel) {

        synchronized (sliderEndDate) {
            sliderSelection = true;
        }

        Integer startSliderValue = sliderStartDate.getSelection();

        if (sliderEndDate.getSelection() - sliderStartDate.getSelection() <= MINSLIDERVALUE) {
            if (sliderEndDate.getSelection() <= 100-MINSLIDERVALUE) {
                int endValue = startSliderValue+MINSLIDERVALUE;
                sliderEndDate.setSelection(endValue);
                endSliderUpdate(sliderEndDate, endDateLabel, endValue);
            } else {
                sliderEndDate.setSelection(99);
                endSliderUpdate(sliderEndDate, endDateLabel, 99);
                startSliderValue=100-MINSLIDERVALUE;
                sliderStartDate.setSelection(100-MINSLIDERVALUE);
            }

        }

        startSliderUpdate(sliderStartDate, startDateLabel, startSliderValue);

        slidingGroup.layout();
    }
项目:pm    文件:ChartsComposite.java   
private void startSliderUpdate(final Slider sliderStartDate, final Label startDateLabel, Integer sliderValue) {

        Date maxDate= maxDate();
        Date minDate= minimumDate();
        Integer maxSlider= 100;
        Integer minSlider= 0;
        Integer perCentValue = sliderValue*100/(maxSlider - minSlider - sliderStartDate.getThumb());

        Long diffDateInDays = (maxDate.getTime() - minDate.getTime())/(1000*3600*24);
        Long nbDaySinceMin  = perCentValue * diffDateInDays /100;
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(minDate);
        calendar.add(Calendar.DAY_OF_YEAR, nbDaySinceMin.intValue());
        slidingStartDate = DateFactory.midnithDate(calendar.getTime());

        startDateLabel.setText(DateFormat.getDateInstance(DateFormat.MEDIUM).format(slidingStartDate));
        startDateLabel.setFont(MainGui.DEFAULTFONT);
    }
项目:pm    文件:ChartsComposite.java   
private void endSliderUpdateConditional( Slider sliderEndDate,  Label endDateLabel,  Slider sliderStartDate, Label startDateLabel) {

        synchronized (sliderEndDate) {
            sliderSelection = true;
        }


        Integer sliderValue = sliderEndDate.getSelection();

        if (sliderEndDate.getSelection() - sliderStartDate.getSelection() <= MINSLIDERVALUE) {
            if (sliderStartDate.getSelection() >= MINSLIDERVALUE) {
                int startValue = sliderValue-MINSLIDERVALUE;
                sliderStartDate.setSelection(startValue);
                startSliderUpdate(sliderStartDate, startDateLabel, startValue);
            } else {
                sliderStartDate.setSelection(0);
                startSliderUpdate(sliderStartDate, startDateLabel, 0);
                sliderValue = MINSLIDERVALUE;
                sliderEndDate.setSelection(MINSLIDERVALUE);
            }
        }

        endSliderUpdate(sliderEndDate, endDateLabel, sliderValue);

        slidingGroup.layout();
    }
项目:pm    文件:ChartsComposite.java   
private void endSliderUpdate(Slider sliderEndDate, Label endDateLabel, Integer sliderValue) {

        Date maxDate= maxDate();
        Date minDate= minimumDate();
        Integer maxSlider= 100;
        Integer minSlider= 0;
        Integer perCentValue = sliderValue*100/ (maxSlider - minSlider - sliderEndDate.getThumb());

        Long diffDate = (maxDate.getTime() - minDate.getTime())/(1000*3600*24);
        Long nbDaySinceMin  = perCentValue * diffDate /100;
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(minDate);
        calendar.add(Calendar.DAY_OF_YEAR, nbDaySinceMin.intValue());
        slidingEndDate = DateFactory.midnithDate(calendar.getTime());

        endDateLabel.setText(DateFormat.getDateInstance(DateFormat.MEDIUM).format(slidingEndDate));
        endDateLabel.setFont(MainGui.DEFAULTFONT);

    }
项目:xiliary    文件:MouseWheelSupportTest.java   
@Test
public void updateScrollBarSelection() {
  FlatScrollBar scrollBar = createScrollBar();
  SelectionListener listener = equipScrollBarWithListener( scrollBar );
  MouseWheelSupport mouseWheelSupport = new MouseWheelSupport( scrollBar );
  mouseWheelSupport.create();
  Slider slider = ( Slider )mouseWheelSupport.getControl();
  slider.setSelection( 10 );

  mouseWheelSupport.updateScrollBarSelection( direction );

  SelectionEvent event = verifyNotification( listener );
  assertThat( event.widget ).isSameAs( scrollBar );
  assertThat( event.detail ).isEqualTo( direction );
  assertThat( scrollBar.getSelection() ).isEqualTo( 10 );
}
项目:eclipse-bash-editor    文件:ReducedBrowserInformationControl.java   
/**
 * Tells whether this control is available for given parent composite
 * 
 * @param parent
 *            the parent component used for checking or <code>null</code> if
 *            none
 * @return <code>true</code> if this control is available
 */
public static boolean isAvailableFor(Composite parent) {
    if (!browserAvailabilityChecked) {
        try {
            Browser browser = new Browser(parent, SWT.NONE);
            browser.dispose();
            swtBrowserCanBeUsed = true;

            /* compute scrollbar size */
            Slider sliderV = new Slider(parent, SWT.VERTICAL);
            Slider sliderH = new Slider(parent, SWT.HORIZONTAL);

            int width = sliderV.computeSize(SWT.DEFAULT, SWT.DEFAULT).x;
            int height = sliderH.computeSize(SWT.DEFAULT, SWT.DEFAULT).y;

            cachedScrollBarSize = new Point(width, height);

            sliderV.dispose();
            sliderH.dispose();

        } catch (SWTError er) {
            swtBrowserCanBeUsed = false;
        } finally {
            browserAvailabilityChecked = true;
        }
    }

    return swtBrowserCanBeUsed;
}
项目:pandionj    文件:FrameView.java   
FrameView(Composite parent) {
    super(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    setLayout(layout);
    setBackground(ColorConstants.white);
    header = new Label(this, SWT.BORDER);
    header.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));

    FontManager.setFont(header, Constants.MESSAGE_FONT_SIZE);

    viewer = new FrameViewer(this);

    slider = new Slider(this, SWT.HORIZONTAL | SWT.BORDER);
    slider.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));

    slider.setMinimum(1);
    slider.setMaximum(1);
    slider.setIncrement(1);
    slider.addSelectionListener(new SelectionAdapter() {
        int sel = slider.getSelection();
        @Override
        public void widgetSelected(SelectionEvent e) {
            if(slider.getSelection() != sel) {
                model.setStep(slider.getSelection()-1);
                sel = slider.getSelection();
                PandionJUI.navigateToLine(model.getSourceFile(), model.getStepLine());
                //              slider.setToolTipText(slider.getSelection() + "/" + slider.getMaximum());
            }
        }
    });
    slider.setVisible(false);
}
项目:egradle    文件:SimpleBrowserInformationControl.java   
/**
 * Tells whether this control is available for given parent composite
 * 
 * @param parent
 *            the parent component used for checking or <code>null</code> if
 *            none
 * @return <code>true</code> if this control is available
 */
public static boolean isAvailableFor(Composite parent) {
    if (!browserAvailabilityChecked) {
        try {
            Browser browser = new Browser(parent, SWT.NONE);
            browser.dispose();
            swtBrowserCanBeUsed = true;

            /* compute scrollbar size */
            Slider sliderV = new Slider(parent, SWT.VERTICAL);
            Slider sliderH = new Slider(parent, SWT.HORIZONTAL);

            int width = sliderV.computeSize(SWT.DEFAULT, SWT.DEFAULT).x;
            int height = sliderH.computeSize(SWT.DEFAULT, SWT.DEFAULT).y;

            cachedScrollBarSize = new Point(width, height);

            sliderV.dispose();
            sliderH.dispose();

        } catch (SWTError er) {
            swtBrowserCanBeUsed = false;
        } finally {
            browserAvailabilityChecked = true;
        }
    }

    return swtBrowserCanBeUsed;
}
项目:TranskribusSwtGui    文件:ImageEnhanceDialog.java   
/**
     * Create contents of the dialog.
     * @param parent
     */
    @Override protected Control createDialogArea(Composite parent) {
        Composite container = (Composite) super.createDialogArea(parent);
        container.setLayout(new GridLayout(5, false));

        Label gl = new Label(container, 0);
        gl.setText("Gamma correction: ");

        gammaSlider = new Slider(container, SWT.HORIZONTAL);
        gammaSlider.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
        gammaSlider.setIncrement(1);
        gammaSlider.setValues(1, 1, 100, 1, 1, 1);
        gammaSlider.setSelection(50);
        gammaSlider.addSelectionListener(new SelectionAdapter() {           
            @Override public void widgetSelected(SelectionEvent e) {
                updateGammaValue();
            }
        });

        gammaValueLabel = new Label(container, 0);

        applyGammaBtn = new Button(container, SWT.PUSH);
        applyGammaBtn.setText("Apply");

        defaultGammaBtn = new Button(container, SWT.PUSH);
        defaultGammaBtn.setText("Default");
//      defaultGammaBtn.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, true, false, 1, 1));

        updateSliderValueFromGamma();

        addListener();

        return container;
    }
项目:APICloud-Studio    文件:CustomAbstractInformationControl.java   
private int getResizeHandleSize(Composite parent)
{
    if (fResizeHandleSize == -1)
    {
        Slider sliderV = new Slider(parent, SWT.VERTICAL);
        Slider sliderH = new Slider(parent, SWT.HORIZONTAL);
        int width = sliderV.computeSize(SWT.DEFAULT, SWT.DEFAULT).x;
        int height = sliderH.computeSize(SWT.DEFAULT, SWT.DEFAULT).y;
        sliderV.dispose();
        sliderH.dispose();
        fResizeHandleSize = Math.min(width, height);
    }

    return fResizeHandleSize;
}
项目:APICloud-Studio    文件:CustomBrowserInformationControl.java   
/**
 * Tells whether the SWT Browser widget and hence this information control is available.
 * 
 * @param parent
 *            the parent component used for checking or <code>null</code> if none
 * @return <code>true</code> if this control is available
 */
public static boolean isAvailable(Composite parent)
{
    if (!fgAvailabilityChecked)
    {
        try
        {
            Browser browser = new Browser(parent, SWT.NONE);
            browser.dispose();
            fgIsAvailable = true;

            Slider sliderV = new Slider(parent, SWT.VERTICAL);
            Slider sliderH = new Slider(parent, SWT.HORIZONTAL);
            int width = sliderV.computeSize(SWT.DEFAULT, SWT.DEFAULT).x;
            int height = sliderH.computeSize(SWT.DEFAULT, SWT.DEFAULT).y;
            fgScrollBarSize = new Point(width, height);
            sliderV.dispose();
            sliderH.dispose();
        }
        catch (SWTError er)
        {
            fgIsAvailable = false;
        }
        finally
        {
            fgAvailabilityChecked = true;
        }
    }

    return fgIsAvailable;
}
项目:birt    文件:ChartSlider.java   
protected void placeComponents( int style )
{
    GridLayout gl = new GridLayout( 1, false );
    gl.marginBottom = 0;
    gl.marginHeight = 0;
    gl.marginLeft = 0;
    gl.marginRight = 0;
    gl.marginTop = 0;
    gl.marginWidth = 0;
    this.setLayout( gl );

    slider = new Slider( this, style );
    GridData gd = new GridData( GridData.FILL_BOTH );
    slider.setLayoutData( gd );
}
项目:xiliary    文件:MouseWheelSupportTest.java   
@Test
public void getControl() {
  FlatScrollBar scrollBar = createScrollBar();
  MouseWheelSupport mouseWheelSupport = new MouseWheelSupport( scrollBar );
  mouseWheelSupport.create();

  Control actual = mouseWheelSupport.getControl();

  assertThat( actual ).isInstanceOf( Slider.class );
}
项目:xiliary    文件:MouseWheelSupportTest.java   
@Test
public void copySettingsIfSliderHasLayoutData() {
  FlatScrollBar scrollBar = createScrollBar();
  Rectangle expected = new Rectangle( 10, 20, 30, 40 );
  scrollBar.setBounds( expected );
  MouseWheelSupport mouseWheelSupport = new MouseWheelSupport( scrollBar );
  mouseWheelSupport.create();
  Slider slider = ( Slider )mouseWheelSupport.getControl();
  slider.setLayoutData( new FormData() );
  scrollBar.setBounds( new Rectangle( 50, 60, 70, 80 ) );

  mouseWheelSupport.copySettings();

  assertThat( slider.getBounds() ).isEqualTo( expected  );
}
项目:xiliary    文件:MouseWheelSupportTest.java   
private static void verifySliderSettings(
  MouseWheelSupport support, Rectangle bounds, int max, int min, int inc, int pageInc, int thumb, int selection  )
{
  Slider slider = ( Slider )support.getControl();
  assertThat( slider.getMaximum() ).isEqualTo( max );
  assertThat( slider.getMinimum() ).isEqualTo( min );
  assertThat( slider.getIncrement() ).isEqualTo( inc );
  assertThat( slider.getPageIncrement() ).isEqualTo( pageInc );
  assertThat( slider.getThumb() ).isEqualTo( thumb );
  assertThat( slider.getSelection() ).isEqualTo( selection );
  assertThat( slider.getBounds() ).isEqualTo( bounds );
}
项目:maru    文件:TimeSlider.java   
private void createPartControl(Composite parent)
{
    GridLayout containerLayout = new GridLayout();
    containerLayout.marginWidth = 0;
    containerLayout.marginHeight = 0;

    GridData containerData = new GridData();
    containerData.horizontalAlignment = GridData.FILL;
    containerData.verticalAlignment = GridData.FILL;
    containerData.grabExcessHorizontalSpace = true;
    containerData.grabExcessVerticalSpace = true;

    Composite container = new Composite(parent, SWT.NONE);
    container.setLayout(containerLayout);
    container.setLayoutData(containerData);

    GridData sliderData = new GridData();
    sliderData.horizontalAlignment = GridData.FILL;
    sliderData.verticalAlignment = GridData.FILL;
    sliderData.grabExcessHorizontalSpace = true;
    sliderData.grabExcessVerticalSpace = true;

    slider = new Slider(container, SWT.HORIZONTAL);
    slider.setLayoutData(sliderData);
    slider.setEnabled(false);

    sliderListener = new TimeSliderListener();
    slider.addListener(SWT.Selection, sliderListener);
}
项目:q7.quality.mockups    文件:SliderTest.java   
public Control construct(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    GridDataFactory.swtDefaults().align(SWT.FILL, SWT.FILL)
            .grab(true, true).applyTo(composite);
    GridLayoutFactory.swtDefaults().numColumns(2).applyTo(composite);

    Slider slider = new Slider (composite, SWT.HORIZONTAL);
    Rectangle clientArea = composite.getClientArea ();
    slider.setBounds (clientArea.x + 10, clientArea.y + 10, 200, 32);
    slider.addListener (SWT.Selection, new Listener () {
        public void handleEvent (Event event) {
            String string = "SWT.NONE";
            switch (event.detail) {
                case SWT.DRAG: string = "SWT.DRAG"; break;
                case SWT.HOME: string = "SWT.HOME"; break;
                case SWT.END: string = "SWT.END"; break;
                case SWT.ARROW_DOWN: string = "SWT.ARROW_DOWN"; break;
                case SWT.ARROW_UP: string = "SWT.ARROW_UP"; break;
                case SWT.PAGE_DOWN: string = "SWT.PAGE_DOWN"; break;
                case SWT.PAGE_UP: string = "SWT.PAGE_UP"; break;
            }
            System.out.println ("Scroll detail -> " + string);
        }
    });

    return null;
}
项目:cuina    文件:ColorEditor.java   
@Override
    public void createComponents(Composite parent)
    {
        parent.setLayout(new GridLayout(2, false));

        ColorVerifier verifier = new ColorVerifier();
        Handler handler = new Handler();

        COLORS[0] = parent.getDisplay().getSystemColor(SWT.COLOR_RED);
        COLORS[1] = parent.getDisplay().getSystemColor(SWT.COLOR_GREEN);
        COLORS[2] = parent.getDisplay().getSystemColor(SWT.COLOR_BLUE);
        COLORS[3] = parent.getDisplay().getSystemColor(SWT.COLOR_GRAY);
        int[] cc = new int[] {color.getRed(), color.getGreen(), color.getBlue(), color.getAlpha()};
        for (int i = 0; i < ELEMENT_COUNT; i++)
        {
//          labels[i] = new Label(parent, SWT.BORDER);
//          labels[i].setLayoutData(new GridData(32, 20));
//          labels[i].setBackground(COLORS[i]);
            sliders[i] = new Slider(parent, SWT.NONE);
            sliders[i].setBackground(COLORS[i]);
            sliders[i].addListener(SWT.Selection, handler);
            sliders[i].setValues(0, 0, 256, 1, 1, 10);
            texts[i] = new Text(parent, SWT.BORDER);
            texts[i].addVerifyListener(verifier);
            texts[i].addListener(SWT.Modify, handler);

            texts[i].setText( Integer.toString(cc[i]));
        }
    }
项目:RxSWT    文件:SelectionAdapter.java   
static SelectionAdapter create(Widget widget) {
    if (widget instanceof Button) {
        return create((Button) widget);
    } else if (widget instanceof CCombo) {
        return create((CCombo) widget);
    } else if (widget instanceof Combo) {
        return create((Combo) widget);
    } else if (widget instanceof CoolItem) {
        return create((CoolItem) widget);
    } else if (widget instanceof CTabFolder) {
        return create((CTabFolder) widget);
    } else if (widget instanceof DateTime) {
        return create((DateTime) widget);
    } else if (widget instanceof Link) {
        return create((Link) widget);
    } else if (widget instanceof List) {
        return create((List) widget);
    } else if (widget instanceof MenuItem) {
        return create((MenuItem) widget);
    } else if (widget instanceof Sash) {
        return create((Sash) widget);
    } else if (widget instanceof Scale) {
        return create((Scale) widget);
    } else if (widget instanceof Slider) {
        return create((Slider) widget);
    } else if (widget instanceof Spinner) {
        return create((Spinner) widget);
    } else if (widget instanceof StyledText) {
        return create((StyledText) widget);
    } else if (widget instanceof TabFolder) {
        return create((TabFolder) widget);
    } else if (widget instanceof Table) {
        return create((Table) widget);
    } else if (widget instanceof TableColumn) {
        return create((TableColumn) widget);
    } else if (widget instanceof TableCursor) {
        return create((TableCursor) widget);
    } else if (widget instanceof Text) {
        return create((Text) widget);
    } else if (widget instanceof ToolItem) {
        return create((ToolItem) widget);
    } else if (widget instanceof ToolTip) {
        return create((ToolTip) widget);
    } else if (widget instanceof TrayItem) {
        return create((TrayItem) widget);
    } else if (widget instanceof Tree) {
        return create((Tree) widget);
    } else if (widget instanceof TreeColumn) {
        return create((TreeColumn) widget);
    } else if (widget instanceof TreeCursor) {
        return create((TreeCursor) widget);
    }

    throw new IllegalArgumentException("The given widget (" + widget.getClass().getName() + ") is not supported.");
}
项目:xcalendar    文件:SwtUtils.java   
/**
 * Slider
 */
public static void setValues(Slider s) {
    setValues(s, 0, 0, 1, 0);
}
项目:xcalendar    文件:SwtUtils.java   
public static void setValues(Slider s, int min, int max, int thumb) {
    setValues(s, min, max, thumb, s.getSelection());
}
项目:xcalendar    文件:SwtUtils.java   
public static void setValues(Slider s, int min, int max, int thumb, int selection) {
    setValues(s, min, thumb + max, thumb, selection, s.getIncrement(), s.getPageIncrement());
}
项目:xcalendar    文件:SwtUtils.java   
public static void setValues(Slider s, int min, int max, int thumb, int selection, int increment, int page) {
    s.setValues(selection, min, max, thumb, increment, page);
}
项目:TranskribusSwtGui    文件:ImageEnhanceDialog.java   
public Slider getGammaSlider() {
    return gammaSlider;
}
项目:ether    文件:ParameterWindow.java   
ParamUI(Composite parent, Parametrizable cmd, Parameter param) {
    this.parent = parent;
    this.cmd    = cmd;
    this.p      = param;
    this.def    = cmd.getVal(param);
    this.label  = new Label(parent, SWT.NONE);
    updateLabel();
    this.label.setLayoutData(cfill());
    switch(p.getType()) {
    case BITMAP:
    case RANGE:
        try {
            this.slider = new Slider(parent, SWT.NONE);
            this.slider.setMinimum(0);
            this.slider.setMaximum(((int)S)+10);
            this.slider.setSelection(par2sel(cmd.getVal(p), p));
            this.slider.addSelectionListener(this);
            this.slider.setLayoutData(cfill());
            this.slider.setData("paramui", this);
            Display.getDefault().timerExec(POLL_DELAY, this);
        } catch(Throwable t) {
            log.warning(t);
        }
        break;
    case ITEMS:
        this.combo = new Combo(parent, SWT.READ_ONLY);
        this.combo.setItems(param.getItems());
        this.combo.addSelectionListener(this);
        this.combo.select((int)(cmd.getVal(p)));
        this.combo.setLayoutData(cfill());
        Display.getDefault().timerExec(POLL_DELAY, this);
        break;
    case VALUES:
        this.combo = new Combo(parent, SWT.READ_ONLY);
        this.combo.setItems(param.getItems());
        this.combo.addSelectionListener(this);
        this.combo.select(p.getValuesIndexFor(cmd.getVal(p)));
        this.combo.setLayoutData(cfill());
        Display.getDefault().timerExec(POLL_DELAY, this);
        break;
    case BOOL:
        this.check = new Button(parent, SWT.CHECK);
        this.check.addSelectionListener(this);
        this.check.setSelection(cmd.getVal(p) != 0);
        this.check.setLayoutData(cfill());
        Display.getDefault().timerExec(POLL_DELAY, this);
        break;
    }
}
项目:SMVHunter    文件:TreeViewControls.java   
public TreeViewControls(Composite parent) {
    super(parent, SWT.NONE);
    GridLayout layout = new GridLayout(5, false);
    layout.marginWidth = layout.marginHeight = 2;
    layout.verticalSpacing = layout.horizontalSpacing = 4;
    setLayout(layout);

    Label filterLabel = new Label(this, SWT.NONE);
    filterLabel.setText("Filter by class or id:");
    filterLabel.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, true));

    mFilterText = new Text(this, SWT.LEFT | SWT.SINGLE);
    mFilterText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    mFilterText.addModifyListener(mFilterTextModifyListener);
    mFilterText.setText(HierarchyViewerDirector.getDirector().getFilterText());

    Label smallZoomLabel = new Label(this, SWT.NONE);
    smallZoomLabel.setText(" 20%");
    smallZoomLabel
            .setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, true));

    mZoomSlider = new Slider(this, SWT.HORIZONTAL);
    GridData zoomSliderGridData = new GridData(GridData.CENTER, GridData.CENTER, false, false);
    zoomSliderGridData.widthHint = 190;
    mZoomSlider.setLayoutData(zoomSliderGridData);
    mZoomSlider.setMinimum((int) (TreeViewModel.MIN_ZOOM * 10));
    mZoomSlider.setMaximum((int) (TreeViewModel.MAX_ZOOM * 10 + 1));
    mZoomSlider.setThumb(1);
    mZoomSlider.setSelection((int) Math.round(TreeViewModel.getModel().getZoom() * 10));

    mZoomSlider.addSelectionListener(mZoomSliderSelectionListener);

    Label largeZoomLabel = new Label(this, SWT.NONE);
    largeZoomLabel
            .setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, true));
    largeZoomLabel.setText("200%");

    addDisposeListener(mDisposeListener);

    TreeViewModel.getModel().addTreeChangeListener(this);
}
项目:limpet    文件:RangeSliderView.java   
private Figure addRow(final Composite column, final RangeHelper helper)
{
  final Figure figure = new Figure();

  // store the helper
  figure.helper = helper;

  // ok, do the layout
  figure.holder = new Composite(column, SWT.NONE);
  final GridLayout gl = new GridLayout(3, false);
  GridData gd = new GridData(SWT.FILL, SWT.FILL, true, false);
  figure.holder.setLayoutData(gd);
  figure.holder.setLayout(gl);

  figure.label = new Label(figure.holder, SWT.NONE);
  gd = new GridData(SWT.CENTER, SWT.FILL, true, false);
  gd.horizontalSpan = 3;
  figure.label.setLayoutData(gd);
  figure.label.setText(PENDING_TEXT);

  figure.slider = new Slider(figure.holder, SWT.NONE);
  gd = new GridData(SWT.FILL, SWT.FILL, true, false);
  gd.horizontalSpan = 3;
  figure.slider.setLayoutData(gd);

  // and connect to the control
  figure.connect();

  figure.minL = new Label(figure.holder, SWT.NONE);
  gd = new GridData(SWT.BEGINNING, SWT.FILL, true, false);
  figure.minL.setLayoutData(gd);
  figure.minL.setText("   ==   ");

  figure.val = new Label(figure.holder, SWT.NONE);
  gd = new GridData(SWT.CENTER, SWT.FILL, true, false);
  figure.val.setLayoutData(gd);
  figure.val.setText("   ==   ");

  figure.maxL = new Label(figure.holder, SWT.NONE);
  gd = new GridData(SWT.END, SWT.FILL, true, false);
  figure.maxL.setLayoutData(gd);
  figure.maxL.setText("   ==   ");

  return figure;
}
项目:dawnsci    文件:CompositeTableRow.java   
public CompositeTableRow(CompositeEntry entry,
                         Table container,
                         CompositingControl control,
                         boolean disableOp) {

    this.name = entry.getName();
    TableItem newItem = new TableItem(container,SWT.DOUBLE_BUFFERED);
    TableEditor editor0 = new TableEditor(container);
    editor0.horizontalAlignment = SWT.CENTER;
    editor0.grabHorizontal = true;
    chkActive = new Button(container,SWT.CHECK);
    chkActive.setSelection(true);
    chkActive.addSelectionListener(control);
    editor0.setEditor(chkActive,newItem,0);

    TableEditor editor = new TableEditor(container);
    editor.horizontalAlignment = SWT.CENTER;
    editor.grabHorizontal = true;
    panel = new Composite(container, SWT.NONE);
    panel.setLayout(new GridLayout(2,true));
    slider = new Slider(panel,SWT.HORIZONTAL|SWT.NO_TRIM);
    slider.setValues((int)(entry.getWeight()*100), 0, 104, 5, 1, 5);
    slider.addSelectionListener(this);
    slider.addSelectionListener(control);
    spinner = new Spinner(panel,SWT.DOUBLE_BUFFERED);
    spinner.setMinimum(0);
    spinner.setMaximum(100);
    spinner.setSelection((int)(entry.getWeight()*100));
    spinner.addSelectionListener(control);
    spinner.addSelectionListener(this);
    panel.pack();
    editor.setEditor(panel,newItem,2);
    newItem.setText(1,name);
    TableEditor editor2 = new TableEditor(container);
    editor2.horizontalAlignment = SWT.CENTER;
    editor2.grabHorizontal = true;
    editor2.grabVertical = true;
    op = new Combo(container,SWT.NONE);
    op.add("ADD");
    op.add("SUBTRACT");
    op.add("MULTIPLY");
    op.add("DIVIDE");
    op.add("MINIMUM");
    op.add("MAXIMUM");
    op.select(convertOperationToInt(entry.getOperation()));
    op.pack();
    op.addSelectionListener(control);
    op.setEnabled(!disableOp);
    editor2.setEditor(op,newItem,3);
    TableEditor editor3 = new TableEditor(container);
    editor3.horizontalAlignment = SWT.CENTER;
    editor3.grabHorizontal = true;
    editor3.grabVertical = true;
    chkRed = new Button(container,SWT.CHECK);
    chkRed.setSelection(true);
    chkRed.pack();
    chkRed.addSelectionListener(control);
    editor3.setEditor(chkRed,newItem,4);
    TableEditor editor4 = new TableEditor(container);
    editor4.horizontalAlignment = SWT.CENTER;
    editor4.grabHorizontal = true;
    editor4.grabVertical = true;
    chkGreen = new Button(container,SWT.CHECK);
    chkGreen.pack();
    chkGreen.setSelection(true);
    chkGreen.addSelectionListener(control);
    editor4.setEditor(chkGreen,newItem,5);
    TableEditor editor5 = new TableEditor(container);
    editor5.horizontalAlignment = SWT.CENTER;
    editor5.grabHorizontal = true;
    editor5.grabVertical = true;
    chkBlue = new Button(container,SWT.CHECK);
    chkBlue.pack();
    chkBlue.setSelection(true);
    chkBlue.addSelectionListener(control);
    editor5.setEditor(chkBlue,newItem,6);       

}
项目:birt    文件:ChartSlider.java   
public Slider getWidget( )
{
    return this.slider;
}
项目:lunifera-sharky-m2m    文件:SliderDialog.java   
public void open() {

        Shell parent = getParent();
        GridLayout layout = new org.eclipse.swt.layout.GridLayout(1, false);
        this.getParent().setLayout(layout);
        this.getParent().setText("Replay control");

        GridData gData = new GridData(SWT.FILL, SWT.FILL, true, false);
        slider = new Slider(parent, SWT.HORIZONTAL);
        Rectangle clientArea = parent.getClientArea();
        slider.setBounds(clientArea.x + 10, clientArea.y + 10, 200, 32);
        max = replayBodyProvider.getReplayStatesCount();
        slider.setValues(0, 0, max, 1, 1, 1);
        slider.setLayoutData(gData);

        label = new Label(parent, SWT.BORDER);
        gData = new GridData(SWT.FILL, SWT.FILL, true, false);
        label.setLayoutData(gData);
        if (max == 0) {
            label.setText("nothing to replay");
        } else {
            label.setText(slider.getSelection() + 1 + "/" + max + "steps");
        }

        Button button = new Button(parent, SWT.NONE);
        gData = new GridData(SWT.LEAD, SWT.FILL, false, false);
        button.setLayoutData(gData);
        button.setText("Play");

        slider.addListener(SWT.Selection, new Listener() {
            public void handleEvent(Event event) {
                switch (event.detail) {
                case SWT.HOME:
                case SWT.DRAG:
                case SWT.END:
                case SWT.ARROW_DOWN:
                case SWT.ARROW_UP:
                case SWT.PAGE_DOWN:
                case SWT.PAGE_UP:
                    replayBodyProvider.setReplayToState(slider.getSelection());
                    label.setText(slider.getSelection() + 1 + "/" + max + "steps");
                    break;
                }
            }
        });

        button.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
                replayBodyProvider.replay(slider.getSelection());
            }
        });

        parent.open();
        while (!parent.isDisposed()) {
            if (!parent.getDisplay().readAndDispatch()) {
                parent.getDisplay().sleep();
            }
        }

    }
项目:lunifera-sharky-m2m    文件:SliderDialog.java   
public void open() {

        Shell parent = getParent();
        GridLayout layout = new org.eclipse.swt.layout.GridLayout(1, false);
        this.getParent().setLayout(layout);
        this.getParent().setText("Replay control");

        GridData gData = new GridData(SWT.FILL, SWT.FILL, true, false);
        slider = new Slider(parent, SWT.HORIZONTAL);
        Rectangle clientArea = parent.getClientArea();
        slider.setBounds(clientArea.x + 10, clientArea.y + 10, 200, 32);
        max = replayBodyProvider.getReplayStatesCount();
        slider.setValues(0, 0, max, 1, 1, 1);
        slider.setLayoutData(gData);

        label = new Label(parent, SWT.BORDER);
        gData = new GridData(SWT.FILL, SWT.FILL, true, false);
        label.setLayoutData(gData);
        if (max == 0) {
            label.setText("nothing to replay");
        } else {
            label.setText(slider.getSelection() + 1 + "/" + max + "steps");
        }

        Button button = new Button(parent, SWT.NONE);
        gData = new GridData(SWT.LEAD, SWT.FILL, false, false);
        button.setLayoutData(gData);
        button.setText("Play");

        slider.addListener(SWT.Selection, new Listener() {
            public void handleEvent(Event event) {
                switch (event.detail) {
                case SWT.HOME:
                case SWT.DRAG:
                case SWT.END:
                case SWT.ARROW_DOWN:
                case SWT.ARROW_UP:
                case SWT.PAGE_DOWN:
                case SWT.PAGE_UP:
                    replayBodyProvider.setReplayToState(slider.getSelection());
                    label.setText(slider.getSelection() + 1 + "/" + max + "steps");
                    break;
                }
            }
        });

        button.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
                replayBodyProvider.replay(slider.getSelection());
            }
        });

        parent.open();
        while (!parent.isDisposed()) {
            if (!parent.getDisplay().readAndDispatch()) {
                parent.getDisplay().sleep();
            }
        }

    }