use of org.eclipse.swt.custom.ScrolledComposite in project linuxtools by eclipse.
the class CreateVMPage method createControl.
@Override
public void createControl(Composite parent) {
ScrolledComposite scrollTop = new ScrolledComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL);
scrollTop.setExpandVertical(true);
scrollTop.setExpandHorizontal(true);
final Composite container = new Composite(scrollTop, SWT.NONE);
GridLayoutFactory.fillDefaults().numColumns(3).margins(6, 6).applyTo(container);
// VM Name
final Label vmNameLabel = new Label(container, SWT.NONE);
vmNameLabel.setText(// $NON-NLS-1$
WizardMessages.getString("CreateVM.name.label"));
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(false, false).applyTo(vmNameLabel);
final Text vmNameText = new Text(container, SWT.BORDER);
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).span(2, 1).applyTo(vmNameText);
vmNameText.setToolTipText(// $NON-NLS-1$
WizardMessages.getString("CreateVMPage.name.tooltip"));
// VM Name binding
final IObservableValue<String> vmmNameObservable = BeanProperties.value(CreateVMPageModel.class, CreateVMPageModel.VM_NAME).observe(model);
dbc.bindValue(WidgetProperties.text(SWT.Modify).observe(vmNameText), vmmNameObservable);
// Box name
final Label boxRefLabel = new Label(container, SWT.NONE);
boxRefLabel.setText(// $NON-NLS-1$
WizardMessages.getString("CreateVMPage.boxRef.label"));
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(false, false).applyTo(boxRefLabel);
final Text boxRefText = new Text(container, SWT.BORDER);
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(boxRefText);
boxRefText.setToolTipText(// $NON-NLS-1$
WizardMessages.getString("CreateVMPage.boxRef.tooltip"));
// Box Name binding
final IObservableValue<String> boxRefObservable = BeanProperties.value(CreateVMPageModel.class, CreateVMPageModel.BOX_REF).observe(model);
dbc.bindValue(WidgetProperties.text(SWT.Modify).observe(boxRefText), boxRefObservable);
// Box name search
final Button boxSearchButton = new Button(container, SWT.NONE);
boxSearchButton.setText(// $NON-NLS-1$
WizardMessages.getString("CreateVMPage.search.label"));
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(false, false).applyTo(boxSearchButton);
boxSearchButton.addSelectionListener(onSearchImage());
// VM File Checkbox
final Button customVMFileButton = new Button(container, SWT.CHECK);
customVMFileButton.setText(// $NON-NLS-1$
WizardMessages.getString("CreateVMPage.File.CheckBox"));
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(false, false).span(3, 1).applyTo(customVMFileButton);
final IObservableValue<String> customVMFileObservable = BeanProperties.value(CreateVMPageModel.class, CreateVMPageModel.V_FILE_MODE).observe(model);
dbc.bindValue(WidgetProperties.selection().observe(customVMFileButton), customVMFileObservable);
// VM File
final Label boxLocLabel = new Label(container, SWT.NONE);
boxLocLabel.setText(// $NON-NLS-1$
WizardMessages.getString("CreateVMPage.loc.label"));
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(false, false).applyTo(boxLocLabel);
final Text boxLocText = new Text(container, SWT.BORDER);
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(boxLocText);
boxLocText.setToolTipText(// $NON-NLS-1$
WizardMessages.getString("CreateVMPage.loc.tooltip"));
boxLocText.setEnabled(false);
// Location binding
final IObservableValue<String> boxLocObservable = BeanProperties.value(CreateVMPageModel.class, CreateVMPageModel.VM_FILE).observe(model);
dbc.bindValue(WidgetProperties.text(SWT.Modify).observe(boxLocText), boxLocObservable);
boxLocText.addModifyListener(e -> vmFileChanged(boxLocText.getText()));
// Vagrantfile search
final Button vgFilesearchButton = new Button(container, SWT.NONE);
vgFilesearchButton.setText(// $NON-NLS-1$
WizardMessages.getString("CreateVMPage.search.label"));
vgFilesearchButton.setEnabled(false);
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(false, false).applyTo(vgFilesearchButton);
vgFilesearchButton.addSelectionListener(onSearchVMFile());
customVMFileButton.addSelectionListener(onCheckCustomVMFile(vmNameText, boxRefText, boxLocText, vgFilesearchButton, boxSearchButton));
dbc.addValidationStatusProvider(new CreateVMValidationStatusProvider(vmmNameObservable, boxRefObservable, boxLocObservable));
advanced = new CreateVMAdvancedComposite(container, scrollTop, model);
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).span(3, 1).grab(true, false).applyTo(advanced);
// setup validation support
WizardPageSupport.create(this, dbc);
scrollTop.setContent(container);
Point point = container.computeSize(SWT.DEFAULT, SWT.DEFAULT);
scrollTop.setSize(point);
scrollTop.setMinSize(point);
setControl(container);
}
use of org.eclipse.swt.custom.ScrolledComposite in project linuxtools by eclipse.
the class SelectGraphAndSeriesWizardPage method createControl.
@Override
public void createControl(Composite parent) {
wizard = (SelectGraphAndSeriesWizard) getWizard();
model = wizard.model;
boolean edit = wizard.isEditing();
// Set the layout data
Composite comp = new Composite(parent, SWT.NONE);
comp.setLayout(new GridLayout());
Group cmpGraphOptsGraph = new Group(comp, SWT.SHADOW_ETCHED_IN);
cmpGraphOptsGraph.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
RowLayout rowLayout = new RowLayout();
rowLayout.type = SWT.HORIZONTAL;
rowLayout.spacing = 10;
cmpGraphOptsGraph.setLayout(rowLayout);
// $NON-NLS-1$
cmpGraphOptsGraph.setText(Localization.getString("SelectGraphAndSeriesWizardPage.Graph"));
String[] graphIDs = GraphFactory.getAvailableGraphs(wizard.model.getDataSet());
int btnGraphSelected = -1;
btnGraphs = new Button[graphIDs.length];
for (int i = 0; i < btnGraphs.length; i++) {
btnGraphs[i] = new Button(cmpGraphOptsGraph, SWT.RADIO);
btnGraphs[i].setImage(GraphFactory.getGraphImage(graphIDs[i]));
btnGraphs[i].addListener(SWT.Selection, this);
btnGraphs[i].setData(graphIDs[i]);
btnGraphs[i].setToolTipText(// $NON-NLS-1$
GraphFactory.getGraphName(btnGraphs[i].getData().toString()) + "\n\n" + GraphFactory.getGraphDescription(btnGraphs[i].getData().toString()));
if (btnGraphSelected == -1 && wizard.isEditing() && graphIDs[i].equals(wizard.model.getGraphID())) {
btnGraphs[i].setSelection(true);
btnGraphSelected = i;
}
}
ScrolledComposite scrolledComposite = new ScrolledComposite(comp, SWT.V_SCROLL | SWT.BORDER);
scrolledComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
scrolledComposite.setExpandHorizontal(true);
Composite cmpGraphOptsSeries = new Composite(scrolledComposite, SWT.NONE);
cmpGraphOptsSeries.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
cmpGraphOptsSeries.setLayout(new GridLayout(2, false));
scrolledComposite.setContent(cmpGraphOptsSeries);
Label lblTitle = new Label(cmpGraphOptsSeries, SWT.NONE);
lblTitle.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
// $NON-NLS-1$
lblTitle.setText(Localization.getString("SelectGraphAndSeriesWizardPage.Title"));
txtTitle = new Text(cmpGraphOptsSeries, SWT.BORDER);
txtTitle.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
if (edit) {
txtTitle.setText(model.getGraphData().title);
}
txtTitle.addModifyListener(e -> checkErrors(false));
// Add the data series widgets
String[] labels = model.getSeries();
cboYItems = new Combo[!edit ? labels.length : Math.max(labels.length, model.getYSeries().length)];
lblYItems = new Label[cboYItems.length];
deleted = new boolean[cboYItems.length + 1];
Label lblXItem = new Label(cmpGraphOptsSeries, SWT.NONE);
lblXItem.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
// $NON-NLS-1$
lblXItem.setText(Localization.getString("SelectGraphAndSeriesWizardPage.XSeries"));
cboXItem = new Combo(cmpGraphOptsSeries, SWT.DROP_DOWN | SWT.READ_ONLY);
cboXItem.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
cboXItem.addSelectionListener(new ComboSelectionListener());
// $NON-NLS-1$
cboXItem.add(Localization.getString("SelectGraphAndSeriesWizardPage.RowID"));
for (int i = 0; i < cboYItems.length; i++) {
lblYItems[i] = new Label(cmpGraphOptsSeries, SWT.NONE);
lblYItems[i].setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
// $NON-NLS-1$
lblYItems[i].setText(MessageFormat.format(Localization.getString("SelectGraphAndSeriesWizardPage.YSeries"), i));
cboYItems[i] = new Combo(cmpGraphOptsSeries, SWT.DROP_DOWN | SWT.READ_ONLY);
cboYItems[i].setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
cboYItems[i].addSelectionListener(new ComboSelectionListener());
if (i > 0) {
// $NON-NLS-1$
cboYItems[i].add(Localization.getString("SelectGraphAndSeriesWizardPage.NA"));
cboYItems[i].setVisible(false);
lblYItems[i].setVisible(false);
}
}
for (int j, i = 0; i < labels.length; i++) {
cboXItem.add(labels[i]);
for (j = 0; j < lblYItems.length; j++) {
cboYItems[j].add(labels[i]);
}
}
int selected;
if (!edit) {
cboXItem.select(0);
cboYItems[0].select(0);
} else {
selected = model.getXSeries();
if (selected < labels.length) {
cboXItem.select(selected + 1);
} else {
// $NON-NLS-1$
cboXItem.add(Localization.getString("SelectGraphAndSeriesWizardPage.Deleted"), 0);
cboXItem.select(0);
deleted[0] = true;
}
selected = model.getYSeries()[0];
if (selected < labels.length) {
cboYItems[0].select(selected);
} else {
// $NON-NLS-1$
cboYItems[0].add(Localization.getString("SelectGraphAndSeriesWizardPage.Deleted"), 0);
cboYItems[0].select(0);
deleted[1] = true;
}
}
boolean cvisible = true;
for (int i = 1; i < cboYItems.length; i++) {
if (!edit || model.getYSeries().length <= i) {
cboYItems[i].select(selected = 0);
} else {
selected = model.getYSeries()[i];
if (selected < labels.length) {
cboYItems[i].select(selected + 1);
} else {
cboYItems[i].add(Localization.getString("SelectGraphAndSeriesWizardPage.Deleted"), // $NON-NLS-1$
0);
cboYItems[i].select(0);
deleted[i + 1] = true;
}
}
cboYItems[i].setVisible(cvisible);
lblYItems[i].setVisible(cvisible);
cvisible = (selected > 0);
}
// Select one of the graph types by default, rather than blank choice
if (!edit) {
btnGraphs[0].setSelection(true);
saveDataToModelGraph(graphIDs[0]);
} else if (btnGraphSelected == -1) {
saveDataToModelGraph(null);
}
cmpGraphOptsSeries.pack();
setControl(comp);
checkErrors(true);
}
use of org.eclipse.swt.custom.ScrolledComposite in project linuxtools by eclipse.
the class EditDockerConnectionPage method createControl.
@Override
public void createControl(final Composite parent) {
final ScrolledComposite scrollTop = new ScrolledComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL);
scrollTop.setExpandVertical(true);
scrollTop.setExpandHorizontal(true);
final Composite container = new Composite(scrollTop, SWT.NONE);
GridLayoutFactory.fillDefaults().numColumns(1).applyTo(container);
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).applyTo(container);
createConnectionSettingsContainer(container);
// attach the Databinding context status to this wizard page.
WizardPageSupport.create(this, this.dbc);
scrollTop.setContent(container);
Point point = container.computeSize(SWT.DEFAULT, SWT.DEFAULT);
scrollTop.setSize(point);
scrollTop.setMinSize(point);
setControl(container);
}
use of org.eclipse.swt.custom.ScrolledComposite in project linuxtools by eclipse.
the class ImageRunNetworkPage method createControl.
@Override
public void createControl(Composite parent) {
final ScrolledComposite scrollTop = new ScrolledComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL);
scrollTop.setExpandVertical(true);
scrollTop.setExpandHorizontal(true);
final Composite container = new Composite(scrollTop, SWT.NONE);
container.setLayout(new GridLayout());
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).span(1, 1).grab(true, false).applyTo(container);
GridLayoutFactory.fillDefaults().numColumns(COLUMNS).margins(6, 6).applyTo(container);
createNetworkModeContainer(container);
setDefaultValues();
scrollTop.setContent(container);
Point point = container.computeSize(SWT.DEFAULT, SWT.DEFAULT);
scrollTop.setSize(point);
scrollTop.setMinSize(point);
setControl(scrollTop);
}
use of org.eclipse.swt.custom.ScrolledComposite in project linuxtools by eclipse.
the class ImageRunSelectionPage method createControl.
@Override
public void createControl(final Composite parent) {
final ScrolledComposite scrollTop = new ScrolledComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL);
scrollTop.setExpandVertical(true);
scrollTop.setExpandHorizontal(true);
final Composite container = new Composite(scrollTop, SWT.NONE);
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).span(1, 1).grab(true, false).applyTo(container);
GridLayoutFactory.fillDefaults().numColumns(COLUMNS).margins(6, 6).applyTo(container);
setDefaultValues();
createImageSettingsSection(container);
createSectionSeparator(container, true);
createPortSettingsSection(container);
// addSectionSeparator(container, false);
createLinkSettingsSection(container);
// addSectionSeparator(container, false);
createRunOptionsSection(container);
// Observe model changes to propagate to the UI via listeners.
final IObservableValue imageSelectionObservable = BeanProperties.value(ImageRunSelectionModel.class, ImageRunSelectionModel.SELECTED_IMAGE_NAME).observe(model);
imageSelectionObservable.addValueChangeListener(onImageSelectionChange());
// $NON-NLS-1$
writeValue = new WritableValue<>("", String.class);
// setup validation support
WizardPageSupport.create(this, dbc);
// set validation
final ImageSelectionValidator imageSelectionValidator = new ImageSelectionValidator(imageSelectionObservable);
imageSelectionObservable.addValueChangeListener(onImageSelectionChange());
dbc.addValidationStatusProvider(imageSelectionValidator);
imageSelectionObservable.addValueChangeListener(onImageSelectionChange());
final IObservableValue containerNameObservable = BeanProperties.value(ImageRunSelectionModel.class, ImageRunSelectionModel.CONTAINER_NAME).observe(model);
final ContainerNameValidator containerNameValidator = new ContainerNameValidator(model.getSelectedConnection(), containerNameObservable);
dbc.addValidationStatusProvider(containerNameValidator);
// // force displaying the error message upon startup
final Object containerstatus = containerNameValidator.getValidationStatus().getValue();
// attach the Databinding context status to this wizard page.
WizardPageSupport.create(this, this.dbc);
setStatusMessage(containerstatus);
scrollTop.setContent(container);
Point point = container.computeSize(SWT.DEFAULT, SWT.DEFAULT);
scrollTop.setSize(point);
scrollTop.setMinSize(point);
setControl(scrollTop);
}
Aggregations