public ProgressMonitorControl(final Composite parent, final int style) { super(parent, style); final GridLayout layout = new GridLayout(1, true); layout.marginWidth = 0; layout.marginHeight = 0; layout.horizontalSpacing = getHorizontalSpacing(); layout.verticalSpacing = getVerticalSpacing() / 2; setLayout(layout); statusLabel = new Label(this, SWT.NONE); GridDataBuilder.newInstance().hGrab().hFill().applyTo(statusLabel); progressIndicator = new ProgressIndicator(this); GridDataBuilder.newInstance().hGrab().hFill().applyTo(progressIndicator); }
private void createUIProgress(final Composite parent) { final int selectedTours = _tourDataList.size(); // hide progress bar when only one tour is printed if (selectedTours < 2) { return; } // container final Composite container = new Composite(parent, SWT.NONE); GridDataFactory.fillDefaults().grab(true, false).indent(0, VERTICAL_SECTION_MARGIN).applyTo(container); GridLayoutFactory.swtDefaults().margins(10, 5).numColumns(1).applyTo(container); { /* * progress indicator */ _progressIndicator = new ProgressIndicator(container, SWT.NONE); GridDataFactory.fillDefaults().grab(true, false).applyTo(_progressIndicator); /* * label: printed filename */ _lblPrintFilePath = new ImageComboLabel(container, SWT.NONE); GridDataFactory.fillDefaults().grab(true, false).applyTo(_lblPrintFilePath); } }
private void createUI30Progress(final Composite parent) { final int selectedTours = _tourDataList.size(); // hide progress bar when only one tour is exported if (selectedTours < 2) { return; } // container final Composite container = new Composite(parent, SWT.NONE); GridDataFactory.fillDefaults().grab(true, false).indent(0, VERTICAL_SECTION_MARGIN).applyTo(container); GridLayoutFactory.swtDefaults().margins(10, 5).numColumns(1).applyTo(container); { /* * progress indicator */ _progressIndicator = new ProgressIndicator(container, SWT.NONE); GridDataFactory.fillDefaults().grab(true, false).applyTo(_progressIndicator); /* * label: exported filename */ _lblExportedFilePath = new ImageComboLabel(container, SWT.NONE); GridDataFactory.fillDefaults().grab(true, false).applyTo(_lblExportedFilePath); } }
@Override public void beginTask(final String name, final int totalWork) { sync.syncExec(new Runnable() { @Override public void run() { dialog.showProgressIndicator(); ProgressIndicator p = dialog.getProgressIndicator(); if (p != null && !p.isDisposed()) { p.beginTask(totalWork); p.setToolTipText(name); } } }); }
@Override public void worked(final int work) { sync.syncExec(new Runnable() { @Override public void run() { ProgressIndicator p = dialog.getProgressIndicator(); if (p != null && !p.isDisposed()) { p.worked(work); } } }); }
@Override public void done() { sync.syncExec(new Runnable() { @Override public void run() { ProgressIndicator p = dialog.getProgressIndicator(); if (p != null && !p.isDisposed()) { p.sendRemainingWork(); } dialog.hideProgressIndicator(); } }); }
@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("Initializing"); GridDataFactory.swtDefaults().align(SWT.FILL, SWT.FILL).grab(true, false) .applyTo(messageLabel); new Label(mainContainer, SWT.NONE); progressBar = new ProgressIndicator(mainContainer, SWT.SMOOTH); GridDataFactory.swtDefaults().align(SWT.FILL, SWT.FILL).grab(true, false) .applyTo(progressBar); mainContainer.layout(); return container; }
@Override public void beginTask(final String name, final int totalWork) { sync.syncExec(new Runnable() { @Override public void run() { ProgressIndicator p = dialog.getProgressIndicator(); if (p != null && !p.isDisposed()) { p.beginAnimatedTask(); dialog.setStatus(name); } } }); }
@Override protected Control createDialogArea(Composite parent) { Composite composite = (Composite) super.createDialogArea(parent); composite.setLayout(new GridLayout()); taskLabel = new Label(composite, SWT.WRAP); taskLabel.setText(DEFAULT_TASKNAME); GridDataFactory.fillDefaults().align(SWT.FILL, SWT.BEGINNING).grab(true, false).hint(convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH), SWT.DEFAULT).applyTo(taskLabel); // progress indicator GridData gd = new GridData(); gd.heightHint = convertVerticalDLUsToPixels(BAR_DLUS); gd.horizontalAlignment = GridData.FILL; gd.grabExcessHorizontalSpace = true; gd.horizontalSpan = 2; progressIndicator = new ProgressIndicator(composite); progressIndicator.setLayoutData(gd); // label showing current task gd = new GridData(GridData.FILL_HORIZONTAL); gd.heightHint = convertVerticalDLUsToPixels(LABEL_DLUS); gd.horizontalSpan = 2; subTaskLabel = new Label(composite, SWT.LEFT | SWT.WRAP); subTaskLabel.setLayoutData(gd); subTaskLabel.setFont(parent.getFont()); composite.layout(true); return composite; }
public ProgressIndicator getProgressIndicator() { return fProgressIndicator; }
public ProgressIndicator getProgressIndicator() { return progressBar; }
@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; }