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

The following examples show how to use org.eclipse.swt.SWT#SMOOTH . 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
Source File: RectangleGroupStrategy.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
/** 
 * @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
Source File: XLIFFEditorStatusLineItemWithProgressBar.java    From tmxeditor8 with GNU General Public License v2.0 6 votes vote down vote up
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 File: PGroupSnippet1.java    From nebula with 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 File: ExcelExportProgessBar.java    From translationstudio8 with GNU General Public License v2.0 5 votes vote down vote up
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 5
Source File: ProgressBarDialog.java    From slr-toolkit with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * 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 6
Source File: SimulationView.java    From statecharts with Eclipse Public License 1.0 5 votes vote down vote up
@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 7
Source File: AbstractTwoColumnEditorPropertySection.java    From statecharts with Eclipse Public License 1.0 5 votes vote down vote up
@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 8
Source File: ExcelExportProgessBar.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
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 9
Source File: SimulationPage.java    From olca-app with 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
Source File: MetricDisplay.java    From scava with 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 11
Source File: HistoryView.java    From olca-app with 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 12
Source File: RangeSlider.java    From nebula with 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 13
Source File: ValidationView.java    From olca-app with 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 14
Source File: ReportExamples.java    From birt with 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 15
Source File: ProcessDialog.java    From jframe with Apache License 2.0 4 votes vote down vote up
/**
 * @param parent
 */
public ProcessDialog(Shell parent) {
    super(parent, SWT.SMOOTH);
}
 
Example 16
Source File: SWTIndeterminateProgressBar.java    From tuxguitar with GNU Lesser General Public License v2.1 4 votes vote down vote up
public SWTIndeterminateProgressBar(SWTContainer<? extends Composite> parent) {
	super(new ProgressBar(parent.getControl(), SWT.BORDER | SWT.HORIZONTAL | SWT.SMOOTH | SWT.INDETERMINATE), parent);
}
 
Example 17
Source File: RangeSlider.java    From nebula with 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 File: PGroup.java    From nebula with 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 19
Source File: ProgressModal.java    From Universal-FE-Randomizer with 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 20
Source File: UpdateDialog.java    From offspring with 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;
}