Java Code Examples for org.eclipse.swt.widgets.ProgressBar#setLayoutData()

The following examples show how to use org.eclipse.swt.widgets.ProgressBar#setLayoutData() . 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: ProgressDialogEx.java    From SWET with MIT License 6 votes vote down vote up
public ProgressController(Composite parent, int style) {
	this.parent = parent;
	display = Display.getCurrent();

	progressTitle = new Label(parent, SWT.NONE);
	progressTitle.setText("Progress");
	GridData titleData = new GridData();
	titleData.horizontalAlignment = GridData.BEGINNING;
	titleData.grabExcessHorizontalSpace = true;
	progressTitle.setLayoutData(titleData);

	progressValue = new Label(parent, SWT.NONE);
	progressValue.setText("0%");
	GridData valueData = new GridData();
	valueData.horizontalAlignment = GridData.END;
	progressValue.setLayoutData(valueData);

	progressBar = new ProgressBar(parent, style);
	GridData progressData = new GridData();
	progressData.horizontalAlignment = GridData.FILL;
	progressData.horizontalSpan = 2;
	progressData.grabExcessHorizontalSpace = true;
	progressBar.setLayoutData(progressData);

}
 
Example 2
Source File: ProgressBarDemo.java    From slr-toolkit with Eclipse Public License 1.0 6 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.INDETERMINATE);
       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);
       progressBar.setSelection(100);
       
	return container;
}
 
Example 3
Source File: LicenseManageDialog.java    From translationstudio8 with GNU General Public License v2.0 6 votes vote down vote up
private void createBarComp(Composite parent) {
	Composite barComp = new Composite(parent, SWT.NONE);
	GridLayout barLayout = new GridLayout();
	barLayout.marginTop = 10;
	barComp.setLayout(barLayout);
	barComp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
	
	label4 = new Label(barComp, SWT.NONE);
	label4.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
	
	bar = new ProgressBar(barComp, SWT.NONE);
	bar.setMaximum(10);
	bar.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
	
	setVisible(false);
}
 
Example 4
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 5
Source File: LicenseManageDialog.java    From tmxeditor8 with GNU General Public License v2.0 6 votes vote down vote up
private void createBarComp(Composite parent) {
	Composite barComp = new Composite(parent, SWT.NONE);
	GridLayout barLayout = new GridLayout();
	barLayout.marginTop = 10;
	barComp.setLayout(barLayout);
	barComp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

	label4 = new Label(barComp, SWT.NONE);
	label4.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

	bar = new ProgressBar(barComp, SWT.NONE);
	bar.setMaximum(10);
	bar.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

	setVisible(false);
}
 
Example 6
Source File: MessageArea.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Create a progress bar
 */
private void createProgressBar() {
	progressBar = new ProgressBar(composite, SWT.SMOOTH | SWT.HORIZONTAL);
	progressBar.setMinimum(progressBarMinimumValue);
	progressBar.setMaximum(progressBarMaximumValue);
	progressBar.setSelection(progressBarValue);
	final GridData gd = new GridData(GridData.FILL, GridData.FILL, true, false, 1, 1);
	progressBar.setLayoutData(gd);
}
 
Example 7
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 8
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 9
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 10
Source File: SplashScreen.java    From ldparteditor with MIT License 4 votes vote down vote up
@Override
protected Control createContents(final Composite parent) {

    final Color bgColor = SWTResourceManager.getColor(SWT.COLOR_WHITE);
    final Composite frame = new Composite(parent, SWT.NONE);
    final FormData titleData = new FormData();
    final FormData statusData = new FormData();
    final FormLayout layout = new FormLayout();
    final Label titleLabel = new Label(frame, SWT.NONE);
    final Label statusLabel = new Label(frame, SWT.NONE);
    final ProgressBar bar = new ProgressBar(frame, SWT.NONE);
    final FormData barData = new FormData();

    bar.setMaximum(100);

    titleLabel.setText(Version.getApplicationName() + " " + Version.getVersion() + "\n" + Version.getStage() + "\n(C) " + Version.getDevelopmentLead()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$

    titleLabel.setBackground(bgColor);
    bar.setBackground(bgColor);
    statusLabel.setBackground(bgColor);

    frame.setLayout(layout);
    frame.setBackgroundImage(ResourceManager.getImage("imgSplash.png")); //$NON-NLS-1$

    barData.left = new FormAttachment(15, 5);
    barData.right = new FormAttachment(100, -5);
    barData.bottom = new FormAttachment(100, -5);
    bar.setLayoutData(barData);

    titleData.left = new FormAttachment(45, 5);
    titleData.right = new FormAttachment(100, 0);
    titleData.top = new FormAttachment(50, 0);
    titleLabel.setLayoutData(titleData);

    statusData.left = new FormAttachment(15, 5);
    statusData.right = new FormAttachment(100, 0);
    statusData.top = new FormAttachment(80, 0);
    statusLabel.setLayoutData(statusData);

    this.bar = bar;
    this.label = statusLabel;

    return frame;
}
 
Example 11
Source File: StaticHTMLController.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
public void setViewer( IViewer viewer )
{
	this.viewer = viewer;

	if ( !( viewer instanceof AbstractViewer ) )
	{
		return;
	}

	Composite viewerUI = (Composite) ( (SWTAbstractViewer) viewer ).getUI( );

	if ( viewerUI == null )
	{
		return;
	}
	pane = new Composite( viewerUI, SWT.NONE );
	pane.setLayoutData( new GridData( GridData.HORIZONTAL_ALIGN_FILL ) );

	RowLayout rowLayout = new RowLayout( );
	rowLayout.type = SWT.HORIZONTAL;
	rowLayout.spacing = 5;
	pane.setLayout( rowLayout );

	for ( Iterator iter = buttons.iterator( ); iter.hasNext( ); )
	{
		ButtonInfo buttonInfo = (ButtonInfo) iter.next( );
		Button button = new Button( pane, SWT.PUSH );

		button.setText( buttonInfo.text );
		button.setToolTipText( buttonInfo.toolTip );
		if ( buttonInfo.selectionListener != null )
		{
			button.addSelectionListener( buttonInfo.selectionListener );
		}
	}

	GridData gd = new GridData( GridData.END, GridData.CENTER, false, false );
	gd.heightHint = 10;
	gd.widthHint = 100;
	progressBar = new ProgressBar( viewerUI, SWT.INDETERMINATE );
	progressBar.setLayoutData( gd );
	setBusy( true );
}