Java Code Examples for org.eclipse.swt.SWT#SMOOTH

The following examples show how to use org.eclipse.swt.SWT#SMOOTH . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
/** 
 * @see org.eclipse.nebula.widgets.pgroup.AbstractGroupStrategy#computeTrim(int, int, int, int)
 */
public Rectangle computeTrim(int x, int y, int width, int height)
{
    Rectangle area = new Rectangle(x, y, width, height);
    area.x -= margin;
    area.y -= titleHeight;
    area.width += (2 * margin);
    area.height += titleHeight;
    if (getGroup().getExpanded())
    {
        if ((getGroup().getStyle() & SWT.SMOOTH) != 0)
        {
            area.height += 5;
        }
        else
        {
            area.height += margin;
        }
    }
    return area;
}
 
Example 2
public void fill(Composite parent) {
	super.fill(parent);
	Composite container = new Composite(parent, SWT.NONE);
	GridLayout gl = new GridLayout(2, false);
	gl.marginWidth = 5;
	gl.marginHeight = 3;
	container.setLayout(gl);

	progressBar = new ProgressBar(container, SWT.SMOOTH);
	GridData gdPprogressBar = new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1);
	gdPprogressBar.heightHint = 16;
	gdPprogressBar.widthHint = 130;
	progressBar.setLayoutData(gdPprogressBar);
	progressBar.setMinimum(0); // 最小值
	progressBar.setMaximum(100);// 最大值
	progressBar.setSelection(progressValue);
	progressBar.setToolTipText(defaultMessage);

	label = new Label(container, SWT.None);
	label.setText(progressValue + "%");

	StatusLineLayoutData data = new StatusLineLayoutData();
	container.setLayoutData(data);
}
 
Example 3
Source Project: nebula   File: PGroupSnippet1.java    License: Eclipse Public License 2.0 5 votes vote down vote up
public static void main (String [] args) {
    Display display = new Display ();
    Shell shell = new Shell (display);
    shell.setLayout(new GridLayout());

    PGroup group = new PGroup(shell, SWT.SMOOTH);
    group.setText("Example");
    
//  Optionally, change strategy and toggle
//  group.setStrategy(new FormGroupStrategy());
//  group.setToggleRenderer(new TwisteToggleRenderer());
    
    group.setLayout(new GridLayout());
    
    Label label = new Label(group,SWT.NONE);
    label.setText("Contents");
    Button button = new Button(group,SWT.PUSH);
    button.setText("Contents");
    Scale scale = new Scale(group,SWT.HORIZONTAL);
    
    
    shell.setSize(200,200);
    shell.open ();
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch ()) display.sleep ();
    }
    display.dispose ();
}
 
Example 4
Source Project: birt   File: ReportExamples.java    License: Eclipse Public License 1.0 5 votes vote down vote up
private void createDisplayGroup( CSashForm hSash )
{
	Composite displayGroup = new Composite( hSash, SWT.NONE );
	displayGroup.setLayout( new FillLayout( ) );
	CSashForm vSash = new CSashForm( displayGroup, SWT.VERTICAL
			| SWT.SMOOTH );

	createPreviewGroup( vSash );
	createDescriptionGroup( vSash );

	hSash.setWeights( new int[]{
			2, 3
	} );
}
 
Example 5
Source Project: olca-app   File: ValidationView.java    License: Mozilla Public License 2.0 5 votes vote down vote up
@Override
public void createPartControl(Composite parent) {
	SashForm body = new SashForm(parent, SWT.VERTICAL | SWT.SMOOTH);
	UI.gridData(body, true, true);
	UI.gridLayout(body, 1);
	createViewer(body);
}
 
Example 6
Source Project: nebula   File: RangeSlider.java    License: Eclipse Public License 2.0 5 votes vote down vote up
@Override
public int getStyle() {
	return super.getStyle() | orientation | (isSmooth ? SWT.SMOOTH : SWT.NONE) | //
			(isOn ? SWT.ON : SWT.NONE) | //
			(isFullSelection ? SWT.CONTROL : SWT.NONE) | //
			(isHighQuality ? SWT.HIGH : SWT.NONE);
}
 
Example 7
Source Project: olca-app   File: HistoryView.java    License: Mozilla Public License 2.0 5 votes vote down vote up
@Override
public void createPartControl(Composite parent) {
	SashForm body = new SashForm(parent, SWT.VERTICAL | SWT.SMOOTH);
	UI.gridData(body, true, true);
	UI.gridLayout(body, 1);
	createHistoryViewer(body);
	SashForm secondRow = new SashForm(body, SWT.HORIZONTAL | SWT.SMOOTH);
	createJsonViewer(secondRow);
	createReferencesViewer(secondRow);
	refresh();
}
 
Example 8
Source Project: scava   File: MetricDisplay.java    License: Eclipse Public License 2.0 5 votes vote down vote up
@Override
protected Control createDialogArea(Composite parent) {

	setTitleImage(null);
	setTitle("Metric informations");
	Composite area = (Composite) super.createDialogArea(parent);
	area.setLayout(new GridLayout(1, false));

	Composite textContainer = new Composite(area, SWT.NONE);
	textContainer.setLayout(new FillLayout(SWT.HORIZONTAL));
	textContainer.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, true, 1, 1));

	table = new Table(textContainer, SWT.BORDER | SWT.FULL_SELECTION);
	table.setLinesVisible(true);
	table.setHeaderVisible(true);

	TableColumn tblclmnNewColumn = new TableColumn(table, SWT.NONE);
	tblclmnNewColumn.setWidth(300);
	tblclmnNewColumn.setText("ID");

	TableColumn tblclmnNewColumn_1 = new TableColumn(table, SWT.NONE);
	tblclmnNewColumn_1.setWidth(100);
	tblclmnNewColumn_1.setText("Value");
	
	TableColumn tblclmnNewColumn_2 = new TableColumn(table, SWT.NONE);
	tblclmnNewColumn_2.setWidth(300);
	tblclmnNewColumn_2.setText("Description");
	

	progressBar = new ProgressBar(area, SWT.SMOOTH);
	progressBar.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));

	refreshMetrics();

	return area;
}
 
Example 9
Source Project: olca-app   File: SimulationPage.java    License: Mozilla Public License 2.0 5 votes vote down vote up
private void createProgressSection(FormToolkit toolkit, Composite body) {
	progressSection = UI.section(body, toolkit, M.Progress);
	Composite composite = UI.sectionClient(progressSection, toolkit);
	progressBar = new ProgressBar(composite, SWT.SMOOTH);
	progressBar.setMaximum(editor.setup.numberOfRuns);
	UI.gridData(progressBar, false, false).widthHint = 470;
	Button progressButton = toolkit.createButton(composite,
			M.Start, SWT.NONE);
	UI.gridData(progressButton, false, false).widthHint = 70;
	new SimulationControl(progressButton, editor, this);
}
 
Example 10
public void open(int minValue, int maxValue) {
	childShell = new Shell(shell.getDisplay(), SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
	childShell.setText("Exporting to Excel.. please wait");

	progressBar = new ProgressBar(childShell, SWT.SMOOTH);
	progressBar.setMinimum(minValue);
	progressBar.setMaximum(maxValue);
	progressBar.setBounds(0, 0, 400, 25);
	progressBar.setFocus();

	childShell.pack();
	childShell.open();
}
 
Example 11
@Override
public void createControls(Composite parent) {
	parent.setLayout(new FillLayout());
	SashForm sashForm = new SashForm(parent, SWT.HORIZONTAL | SWT.SMOOTH);
	sashForm.setSashWidth(2);
	sashForm.setBackground(sashForm.getDisplay().getSystemColor( SWT.COLOR_GRAY));
	sashForm.setLayout(new FillLayout());
	Composite leftColumn = getToolkit().createComposite(sashForm);
	leftColumn.setLayout(createLeftColumnLayout());
	Composite rightColumn = getToolkit().createComposite(sashForm);
	rightColumn.setLayout(createRightColumnLayout());
	sashForm.setWeights(new int[] { 1, 1 });
	createLeftColumnControls(leftColumn);
	createRightColumnControls(rightColumn);
}
 
Example 12
@Override
public void createPartControl(Composite parent) {
	parent.setLayout(new FillLayout(SWT.VERTICAL));
	Composite top = kit.createComposite(parent);
	top.setLayout(new GridLayout(2, false));
	SashForm sash = new SashForm(top, SWT.VERTICAL | SWT.SMOOTH);
	sash.setSashWidth(2);
	GridDataFactory.fillDefaults().grab(true, true).applyTo(sash);
	createSimulationSessionViewer(sash);
	createExecutionContextViewer(sash);
	sash.setWeights(new int[] { 1, 5 });
	IToolBarManager mgr = getViewSite().getActionBars().getToolBarManager();
	addSimulationSessionActions(mgr);
	super.createPartControl(parent);
}
 
Example 13
/**
 * Create contents of the dialog.
 * @param parent
 */
@Override
protected Control createDialogArea(Composite parent) {
	Composite container = (Composite) super.createDialogArea(parent);
	container.setLayout(new GridLayout(1, false));
       completedInfo = new Label(container, SWT.NONE);
       completedInfo.setAlignment(SWT.CENTER);
       GridData gd_completedInfo = new GridData(SWT.CENTER, SWT.CENTER, true, false, 1, 1);
       gd_completedInfo.minimumWidth = 250;
       completedInfo.setLayoutData(gd_completedInfo);
       completedInfo.setSize(250, 40);
       completedInfo.setText("Processing Data ...");
       new Label(container, SWT.NONE);
       
       progressBar = new ProgressBar(container, SWT.SMOOTH);
       GridData gd_progressBar = new GridData(SWT.CENTER, SWT.CENTER, true, false, 1, 1);
       gd_progressBar.minimumWidth = 250;
       progressBar.setLayoutData(gd_progressBar);
       progressBar.setBounds(10, 23, 400, 17);
       
       taskLabel = new Label(container, SWT.NONE);
       taskLabel.setAlignment(SWT.CENTER);
       GridData gd_taskLabel = new GridData(SWT.CENTER, SWT.CENTER, true, false, 1, 1);
       gd_taskLabel.heightHint = 15;
       gd_taskLabel.minimumWidth = 250;
       taskLabel.setLayoutData(gd_taskLabel);
       taskLabel.setSize(250, 40);
       
	return container;
}
 
Example 14
public void open(int minValue, int maxValue) {
	childShell = new Shell(shell.getDisplay(), SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
	childShell.setText("Exporting to Excel.. please wait");

	progressBar = new ProgressBar(childShell, SWT.SMOOTH);
	progressBar.setMinimum(minValue);
	progressBar.setMaximum(maxValue);
	progressBar.setBounds(0, 0, 400, 25);
	progressBar.setFocus();

	childShell.pack();
	childShell.open();
}
 
Example 15
Source Project: Universal-FE-Randomizer   File: ProgressModal.java    License: MIT License 4 votes vote down vote up
public ProgressModal(Shell parent, String title) {
	display = Display.getDefault();
	yuneImage = new Image(display, Main.class.getClassLoader().getResourceAsStream("YuneIcon_100x100.png"));
	
	dialogShell = new Shell(parent, SWT.PRIMARY_MODAL | SWT.DIALOG_TRIM);
	dialogShell.setText(title);
	dialogShell.setImage(yuneImage);
	
	progressBar = new ProgressBar(dialogShell, SWT.SMOOTH);
	
	FormLayout mainLayout = new FormLayout();
	mainLayout.marginWidth = 5;
	mainLayout.marginHeight = 5;
	dialogShell.setLayout(mainLayout);
	
	imageLabel = new Label(dialogShell, SWT.NONE);
	imageLabel.setImage(yuneImage);
	
	FormData imageData = new FormData(100, 100);
	imageData.left = new FormAttachment(0, 10);
	imageData.top = new FormAttachment(0, 10);
	imageData.bottom = new FormAttachment(100, -10);
	imageLabel.setLayoutData(imageData);
	
	FormData progressData = new FormData(300, 20);
	progressData.left = new FormAttachment(imageLabel, 10);
	progressData.bottom = new FormAttachment(imageLabel, -50, SWT.CENTER);
	progressData.right = new FormAttachment(100, -10);
	progressBar.setLayoutData(progressData);
	
	statusLabel = new Label(dialogShell, SWT.NONE);
	
	FormData statusData = new FormData();
	statusData.left = new FormAttachment(progressBar, 0, SWT.LEFT);
	statusData.top = new FormAttachment(progressBar, 5);
	statusData.right = new FormAttachment(100, -10);
	statusLabel.setLayoutData(statusData);
	
	dialogShell.layout();
	final Point newSize = dialogShell.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
	dialogShell.setSize(newSize);
	
	Rectangle parentBounds = parent.getBounds();
	Rectangle dialogBounds = dialogShell.getBounds();
	
	dialogShell.setLocation(parentBounds.x + (parentBounds.width - dialogBounds.width) / 2, parentBounds.y + (parentBounds.height - dialogBounds.height) / 2);
}
 
Example 16
Source Project: nebula   File: PGroup.java    License: Eclipse Public License 2.0 4 votes vote down vote up
private static int checkStyle(int style)
{
    int mask = SWT.LEFT_TO_RIGHT | SWT.RIGHT_TO_LEFT | SWT.SMOOTH;
    return (style & mask) | SWT.DOUBLE_BUFFERED;
}
 
Example 17
Source Project: nebula   File: RangeSlider.java    License: Eclipse Public License 2.0 4 votes vote down vote up
/**
 * Constructs a new instance of this class given its parent and a style value
 * describing its behavior and appearance.
 * <p>
 * The style value is either one of the style constants defined in class
 * <code>SWT</code> which is applicable to instances of this class, or must be
 * built by <em>bitwise OR</em>'ing together (that is, using the
 * <code>int</code> "|" operator) two or more of those <code>SWT</code> style
 * constants. The class description lists the style constants that are
 * applicable to the class. Style bits are also inherited from superclasses.
 * </p>
 *
 * @param parent a composite control which will be the parent of the new
 *            instance (cannot be null)
 * @param style the style of control to construct. Default style is HORIZONTAL
 *
 * @exception IllegalArgumentException
 *                <ul>
 *                <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
 *                </ul>
 * @exception SWTException
 *                <ul>
 *                <li>ERROR_THREAD_INVALID_ACCESS - if not called from the
 *                thread that created the parent</li>
 *                </ul>
 * @see SWT#HORIZONTAL
 * @see SWT#VERTICAL
 * @see Widget#getStyle
 *
 */
public RangeSlider(final Composite parent, final int style) {
	super(parent, SWT.DOUBLE_BUFFERED | ((style & SWT.BORDER) == SWT.BORDER ? SWT.BORDER : SWT.NONE));
	minimum = lowerValue = 0;
	maximum = upperValue = 100;
	listeners = new ArrayList<SelectionListener>();
	increment = 1;
	pageIncrement = 10;
	slider = SWTGraphicUtil.createImageFromFile("images/slider-normal.png");
	sliderHover = SWTGraphicUtil.createImageFromFile("images/slider-hover.png");
	sliderDrag = SWTGraphicUtil.createImageFromFile("images/slider-drag.png");
	sliderSelected = SWTGraphicUtil.createImageFromFile("images/slider-selected.png");

	vSlider = SWTGraphicUtil.createImageFromFile("images/h-slider-normal.png");
	vSliderHover = SWTGraphicUtil.createImageFromFile("images/h-slider-hover.png");
	vSliderDrag = SWTGraphicUtil.createImageFromFile("images/h-slider-drag.png");
	vSliderSelected = SWTGraphicUtil.createImageFromFile("images/h-slider-selected.png");

	if ((style & SWT.VERTICAL) == SWT.VERTICAL) {
		orientation = SWT.VERTICAL;
	} else {
		orientation = SWT.HORIZONTAL;
	}
	isSmooth = (style & SWT.SMOOTH) == SWT.SMOOTH;
	isFullSelection = (style & SWT.CONTROL) == SWT.CONTROL;
	isHighQuality = (style & SWT.HIGH) == SWT.HIGH;
	isOn = (style & SWT.ON) == SWT.ON;
	selectedElement = isFullSelection ? BOTH : LOWER;

	addListener(SWT.Dispose, event -> {
		SWTGraphicUtil.safeDispose(slider);
		SWTGraphicUtil.safeDispose(sliderHover);
		SWTGraphicUtil.safeDispose(sliderDrag);
		SWTGraphicUtil.safeDispose(sliderSelected);

		SWTGraphicUtil.safeDispose(vSlider);
		SWTGraphicUtil.safeDispose(vSliderHover);
		SWTGraphicUtil.safeDispose(vSliderDrag);
		SWTGraphicUtil.safeDispose(vSliderSelected);
	});
	addMouseListeners();
	addListener(SWT.Resize, event -> {
		if (isHighQuality) {
			setTickFactors();
		} else {
			tickFactor = ((orientation == SWT.HORIZONTAL ? getClientArea().width : getClientArea().height) - 20f) / tickDivisions;
		}
	});
	addListener(SWT.FocusIn, e -> {
		hasFocus = true;
		redraw();
	});
	addListener(SWT.FocusOut, e -> {
		hasFocus = false;
		redraw();
	});
	addListener(SWT.KeyDown, event -> {
		handleKeyDown(event);
	});
	addPaintListener(event -> {
		drawWidget(event);
	});
}
 
Example 18
Source Project: jframe   File: ProcessDialog.java    License: Apache License 2.0 4 votes vote down vote up
/**
 * @param parent
 */
public ProcessDialog(Shell parent) {
    super(parent, SWT.SMOOTH);
}
 
Example 19
public SWTIndeterminateProgressBar(SWTContainer<? extends Composite> parent) {
	super(new ProgressBar(parent.getControl(), SWT.BORDER | SWT.HORIZONTAL | SWT.SMOOTH | SWT.INDETERMINATE), parent);
}
 
Example 20
Source Project: offspring   File: UpdateDialog.java    License: MIT License 4 votes vote down vote up
@Override
protected Control createDialogArea(Composite parent) {
  Composite container = (Composite) super.createDialogArea(parent);

  GridLayout layout = new GridLayout(1, false);
  layout.horizontalSpacing = 15;
  layout.marginTop = 10;
  layout.marginLeft = 10;

  GridData gd = new GridData(GridData.FILL, GridData.FILL, false, true);
  gd.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);

  mainContainer = new Composite(container, SWT.NONE);
  mainContainer.setLayoutData(gd);
  mainContainer.setLayout(layout);

  messageLabel = new Label(mainContainer, SWT.WRAP);
  messageLabel.setText("...");
  GridDataFactory.swtDefaults().align(SWT.FILL, SWT.FILL).grab(true, false)
      .applyTo(messageLabel);

  installButton = new Button(mainContainer, SWT.PUSH);
  installButton.setText("Install Updates");
  installButton.setVisible(false);
  installButton.addSelectionListener(new SelectionAdapter() {

    @Override
    public void widgetSelected(SelectionEvent e) {
      installUpdates = true;
      hideInstallButton();
    }
  });
  GridDataFactory.swtDefaults().exclude(true).applyTo(installButton);

  progressBarComposite = new Composite(mainContainer, SWT.NONE);
  progressBarComposite.setVisible(false);
  GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).grab(true, true)
      .exclude(true).applyTo(progressBarComposite);
  GridLayoutFactory.fillDefaults().numColumns(1)
      .applyTo(progressBarComposite);

  progressBar = new ProgressIndicator(progressBarComposite, SWT.SMOOTH);
  GridDataFactory.fillDefaults().grab(true, true).align(SWT.FILL, SWT.FILL)
      .applyTo(progressBar);

  mainContainer.layout();
  return container;
}