Java源码示例:org.eclipse.jface.layout.LayoutConstants
示例1
@Override
protected Control createDialogArea(final Composite parent) {
Composite area = (Composite) super.createDialogArea(parent);
Composite container = new Composite(area, SWT.NONE);
Link flexPricing = new Link(container, SWT.WRAP);
flexPricing.setText(Messages.getString("deploy.preferences.dialog.flex.pricing")); //$NON-NLS-1$
flexPricing.addSelectionListener(
new OpenUriSelectionListener(new ErrorDialogErrorHandler(getShell())));
FontUtil.convertFontToItalic(flexPricing);
GridDataFactory.fillDefaults().grab(true, true).applyTo(container);
Point margins = LayoutConstants.getMargins();
GridLayoutFactory.fillDefaults()
.extendedMargins(margins.x, margins.x, 0 /* no upper margin */, margins.y)
.generateLayout(container);
return area;
}
示例2
@Override
protected Control createDialogArea(Composite parent) {
Composite area = (Composite) super.createDialogArea(parent);
Composite container = new Composite(area, SWT.NONE);
content = createDeployPreferencesPanel(container, project, loginService,
this::handleLayoutChange, new ProjectRepository(googleApiFactory));
GridDataFactory.fillDefaults().grab(true, false).applyTo(content);
// we pull in Dialog's content margins which are zeroed out by TitleAreaDialog
GridDataFactory.fillDefaults().grab(true, true).applyTo(container);
GridLayoutFactory.fillDefaults()
.margins(LayoutConstants.getMargins().x, LayoutConstants.getMargins().y)
.generateLayout(container);
TitleAreaDialogSupport.create(this, content.getDataBindingContext())
.setValidationMessageProvider(new ValidationMessageProvider() {
@Override
public int getMessageType(ValidationStatusProvider statusProvider) {
int type = super.getMessageType(statusProvider);
setValid(type != IMessageProvider.ERROR);
return type;
}
});
return area;
}
示例3
@Override
protected Control createDialogArea(Composite parent) {
Composite tparent = (Composite) super.createDialogArea(parent);
Point defaultSpacing = LayoutConstants.getSpacing();
GridLayoutFactory.fillDefaults().margins(LayoutConstants.getMargins())
.spacing(defaultSpacing.x * 2, defaultSpacing.y).numColumns(2).applyTo(tparent);
Label imgLbl = new Label(tparent, SWT.TOP);
imgLbl.setImage(warningImg);
GridDataFactory.fillDefaults().align(SWT.CENTER, SWT.BEGINNING).applyTo(imgLbl);
String message = MessageFormat.format(Messages.getString("dialog.FileCoverMsgDialog.message"), fileName);
if (message != null) {
Label messageLbl = new Label(tparent, SWT.WRAP);
messageLbl.setText(message);
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.BEGINNING).grab(true, false).hint(
convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH),
SWT.DEFAULT).applyTo(messageLbl);
}
return tparent;
}
示例4
private void createButtons(Composite parent) {
Composite composite = getWidgetFactory().createComposite(parent);
composite.setLayout(GridLayoutFactory.fillDefaults().spacing(LayoutConstants.getSpacing().x, 2).create());
composite.setLayoutData(GridDataFactory.fillDefaults().grab(false, true).create());
Button addButton = getWidgetFactory().createButton(composite, Messages.AddSimple, SWT.FLAT);
addButton.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).hint(85, SWT.DEFAULT).create());
addButton.addListener(SWT.Selection, e -> addAdditionalResource());
editButton = getWidgetFactory().createButton(composite, Messages.edit, SWT.FLAT);
editButton.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).hint(85, SWT.DEFAULT).create());
editButton.addListener(SWT.Selection, e -> editAdditionalResource());
removeButton = getWidgetFactory().createButton(composite, Messages.remove, SWT.FLAT);
removeButton.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).hint(85, SWT.DEFAULT).create());
removeButton.addListener(SWT.Selection, e -> removeSelectedAdditionResource());
}
示例5
private void createDefinitionSection(Composite parent) {
this.section = formPage.getToolkit().createSection(parent, Section.EXPANDED);
section.setLayoutData(GridDataFactory.fillDefaults().create());
section.setLayout(GridLayoutFactory.fillDefaults().create());
Composite client = formPage.getToolkit().createComposite(section);
client.setLayout(
GridLayoutFactory.fillDefaults().create());
client.setLayoutData(GridDataFactory.fillDefaults().grab(false, true).create());
Composite definitionComposite = formPage.getToolkit().createComposite(client);
definitionComposite.setLayoutData(GridDataFactory.fillDefaults().grab(false, true).create());
definitionComposite.setLayout(
GridLayoutFactory.fillDefaults().numColumns(2).spacing(LayoutConstants.getSpacing().x, 1)
.margins(10, 10).create());
createToolbar(definitionComposite);
createSearchField(definitionComposite);
createViewer(definitionComposite);
section.setClient(client);
}
示例6
protected void createParametersComposite(Composite parent) {
Composite parametersComposite = formPage.getToolkit().createComposite(parent);
parametersComposite.setLayout(GridLayoutFactory.fillDefaults().margins(0, 10).create());
parametersComposite
.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).hint(500, SWT.DEFAULT).create());
Label parametersLabel = formPage.getToolkit().createLabel(parametersComposite, Messages.parametersLabel);
parametersLabel.setLayoutData(GridDataFactory.fillDefaults().create());
Composite viewerComposite = formPage.getToolkit().createComposite(parametersComposite);
viewerComposite.setLayout(
GridLayoutFactory.fillDefaults().numColumns(2).spacing(LayoutConstants.getSpacing().x, 1).create());
viewerComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
createToolbar(viewerComposite);
createSearchField(viewerComposite);
createParametersTable(viewerComposite);
}
示例7
private void createSelectButtonComposite(Composite parent) {
Composite buttonComposite = new Composite(parent, SWT.NONE);
buttonComposite.setLayout(GridLayoutFactory.fillDefaults().spacing(LayoutConstants.getSpacing().x, 1).create());
buttonComposite.setLayoutData(GridDataFactory.fillDefaults().create());
new ButtonWidget.Builder()
.withLabel(Messages.selectAll)
.fill()
.onClick(e -> checkAllElements())
.createIn(buttonComposite);
new ButtonWidget.Builder()
.withLabel(Messages.selectNone)
.fill()
.onClick(e -> checkedElementsObservable.clear())
.createIn(buttonComposite);
}
示例8
@Override
public Control createControl(Composite parent, IWizardContainer container, DataBindingContext ctx) {
this.wizardContainer = container;
final Composite mainComposite = new Composite(parent, SWT.NONE);
mainComposite.setLayout(
GridLayoutFactory.fillDefaults().margins(10, 10).spacing(LayoutConstants.getSpacing().x, 25).create());
mainComposite.setLayoutData(GridDataFactory.fillDefaults().create());
final LocalResourceManager resourceManager = new LocalResourceManager(JFaceResources.getResources(),
mainComposite);
this.errorColor = resourceManager.createColor(ColorConstants.ERROR_RGB);
this.successColor = resourceManager.createColor(ColorConstants.SUCCESS_RGB);
doFileLocationBrowser(mainComposite, ctx);
doCreateAdditionalControl(mainComposite, ctx);
doCreateFileTree(mainComposite, ctx);
treeSection.setVisible(filePath != null);
textWidget.addTextListener(SWT.Modify, e -> {
treeSection.setVisible(textWidget.getText() != null && !textWidget.getText().isEmpty());
treeSection.layout();
});
return mainComposite;
}
示例9
/**
* @see org.bonitasoft.studio.ui.wizard.ControlSupplier#createControl(org.eclipse.swt.widgets.Composite, org.eclipse.core.databinding.DataBindingContext)
*/
@Override
public Control createControl(Composite parent, IWizardContainer container, DataBindingContext ctx) {
this.wizardContainer = container;
final Composite mainComposite = new Composite(parent, SWT.NONE);
mainComposite.setLayout(
GridLayoutFactory.fillDefaults().margins(10, 10).spacing(LayoutConstants.getSpacing().x, 25).create());
mainComposite.setLayoutData(GridDataFactory.fillDefaults().create());
doCreateWorkspaceTips(mainComposite);
doCreateFileBrowser(mainComposite, ctx);
statusSection = createStatusSection(mainComposite);
statusSection.setVisible(false);
textWidget.addTextListener(SWT.Modify, e -> {
statusSection.setVisible(textWidget.getText() != null && !textWidget.getText().isEmpty());
});
return mainComposite;
}
示例10
@Override
public Control createExpressionEditor(final Composite parent, final EMFDataBindingContext ctx) {
final Composite mainComposite = new Composite(parent, SWT.NONE);
mainComposite.setLayoutData(GridDataFactory.fillDefaults()
.grab(true, true).create());
mainComposite.setLayout(GridLayoutFactory.fillDefaults().numColumns(1).create());
new Label(mainComposite, SWT.NONE)
.setLayoutData(GridDataFactory.fillDefaults().indent(0, -LayoutConstants.getSpacing().y + 1).create()); // Filler
viewer = new ContractInputTableViewer(mainComposite, SWT.FULL_SELECTION | SWT.BORDER
| SWT.SINGLE | SWT.V_SCROLL);
viewer.getTable().setLayoutData(
GridDataFactory.fillDefaults().grab(true, true).create());
viewer.initialize();
viewer.addPostSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(final SelectionChangedEvent event) {
if (!event.getSelection().isEmpty()) {
ContractInputExpressionEditor.this.fireSelectionChanged();
}
}
});
createReturnTypeComposite(parent);
return mainComposite;
}
示例11
private void createCommitComposite(Composite parent) {
this.commitSection = this.toolkit.createSection(parent, ExpandableComposite.SHORT_TITLE_BAR);
this.commitSection.clientVerticalSpacing = 0;
this.commitSection.setText(Messages.AbapGitStaging_commit_section_header);
this.commitSection.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
Composite commitComposite = this.toolkit.createComposite(this.commitSection);
GridLayoutFactory.fillDefaults().numColumns(1).applyTo(commitComposite);
this.commitSection.setClient(commitComposite);
//commit section : warnings and errors composite
createToggleableWarningsComposite(commitComposite);
//commit message text
createCommitMessageComposite(commitComposite);
Composite commitPersonComposite = this.toolkit.createComposite(commitComposite);
this.toolkit.paintBordersFor(commitPersonComposite);
GridDataFactory.fillDefaults().grab(true, false).applyTo(commitPersonComposite);
GridLayoutFactory.swtDefaults().margins(1, 2).numColumns(3).spacing(1, LayoutConstants.getSpacing().y)
.applyTo(commitPersonComposite);
//author
createAuthorComposite(commitPersonComposite);
//committer
createCommitterComposite(commitPersonComposite);
//commit button
this.commitAndPushButton = this.toolkit.createButton(commitComposite, Messages.AbapGitStaging_commit_button, SWT.PUSH);
this.commitAndPushButton.setLayoutData(GridDataFactory.fillDefaults().align(SWT.RIGHT, SWT.BEGINNING).create());
SWTUtil.setButtonWidthHint(this.commitAndPushButton);
this.commitAndPushButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
validateInputAndPushChanges();
}
});
}
示例12
public void createControl(Composite parent) {
initData(); // 先初始化本页面需要的数据
Composite contents = new Composite(parent, SWT.NONE);
GridLayout layout = new GridLayout();
contents.setLayout(layout);
GridData gridData = new GridData();
gridData.horizontalAlignment = SWT.FILL;
gridData.grabExcessHorizontalSpace = true;
contents.setLayoutData(gridData);
createFilesGroup(contents); // 文件列表区域
createPropertiesGroup(contents); // 源文件属性区域组
createConversionOptionsGroup(contents); // 转换选项组
bindValue(); // 数据绑定
try {
loadFiles(); // 加载文件列表
} catch (Exception e) {
e.printStackTrace();
}
filesTable.select(0); // 默认选中第一行数据
filesTable.notifyListeners(SWT.Selection, null);
Dialog.applyDialogFont(parent);
Point defaultMargins = LayoutConstants.getMargins();
GridLayoutFactory.fillDefaults().numColumns(1).margins(defaultMargins.x, defaultMargins.y)
.generateLayout(contents);
setControl(contents);
validate();
}
示例13
public void createControl(Composite parent) {
Composite contents = new Composite(parent, SWT.NONE);
GridLayout layout = new GridLayout();
contents.setLayout(layout);
GridData gridData = new GridData();
gridData.horizontalAlignment = SWT.FILL;
gridData.grabExcessHorizontalSpace = true;
contents.setLayoutData(gridData);
createFilesGroup(contents); // 文件列表区域
createPropertiesGroup(contents);// 源文件属性区域组
createConversionOptionsGroup(contents); // 转换选项组
createSegmentationGroup(contents); // 分段规则选择区域组
bindValue(); // 数据绑定
loadFiles(); // 加载文件列表
filesTable.select(0); // 默认选中第一行数据
filesTable.notifyListeners(SWT.Selection, null);
Dialog.applyDialogFont(parent);
Point defaultMargins = LayoutConstants.getMargins();
GridLayoutFactory.fillDefaults().numColumns(1).margins(defaultMargins.x, defaultMargins.y)
.generateLayout(contents);
setControl(contents);
srxFile.setText(ConverterContext.defaultSrx);
validate();
}
示例14
public void createControl(Composite parent) {
initData(); // 先初始化本页面需要的数据
Composite contents = new Composite(parent, SWT.NONE);
GridLayout layout = new GridLayout();
contents.setLayout(layout);
GridData gridData = new GridData();
gridData.horizontalAlignment = SWT.FILL;
gridData.grabExcessHorizontalSpace = true;
contents.setLayoutData(gridData);
createFilesGroup(contents); // 文件列表区域
createPropertiesGroup(contents); // 源文件属性区域组
createConversionOptionsGroup(contents); // 转换选项组
bindValue(); // 数据绑定
try {
loadFiles(); // 加载文件列表
} catch (Exception e) {
e.printStackTrace();
}
filesTable.select(0); // 默认选中第一行数据
filesTable.notifyListeners(SWT.Selection, null);
Dialog.applyDialogFont(parent);
Point defaultMargins = LayoutConstants.getMargins();
GridLayoutFactory.fillDefaults().numColumns(1).margins(defaultMargins.x, defaultMargins.y)
.generateLayout(contents);
setControl(contents);
validate();
}
示例15
public void createControl(Composite parent) {
initData(); // 先初始化本页面需要的数据
Composite contents = new Composite(parent, SWT.NONE);
GridLayout layout = new GridLayout();
contents.setLayout(layout);
GridData gridData = new GridData();
gridData.horizontalAlignment = SWT.FILL;
gridData.grabExcessHorizontalSpace = true;
contents.setLayoutData(gridData);
createFilesGroup(contents); // 文件列表区域
createPropertiesGroup(contents); // 源文件属性区域组
createConversionOptionsGroup(contents); // 转换选项组
bindValue(); // 数据绑定
try {
loadFiles(); // 加载文件列表
} catch (Exception e) {
e.printStackTrace();
}
filesTable.select(0); // 默认选中第一行数据
filesTable.notifyListeners(SWT.Selection, null);
Dialog.applyDialogFont(parent);
Point defaultMargins = LayoutConstants.getMargins();
GridLayoutFactory.fillDefaults().numColumns(1).margins(defaultMargins.x, defaultMargins.y)
.generateLayout(contents);
setControl(contents);
validate();
}
示例16
public void createControl(Composite parent) {
Composite contents = new Composite(parent, SWT.NONE);
GridLayout layout = new GridLayout();
contents.setLayout(layout);
GridData gridData = new GridData();
gridData.horizontalAlignment = SWT.FILL;
gridData.grabExcessHorizontalSpace = true;
contents.setLayoutData(gridData);
createFilesGroup(contents); // 文件列表区域
createPropertiesGroup(contents);// 源文件属性区域组
createConversionOptionsGroup(contents); // 转换选项组
createSegmentationGroup(contents); // 分段规则选择区域组
bindValue(); // 数据绑定
loadFiles(); // 加载文件列表
filesTable.select(0); // 默认选中第一行数据
filesTable.notifyListeners(SWT.Selection, null);
Dialog.applyDialogFont(parent);
Point defaultMargins = LayoutConstants.getMargins();
GridLayoutFactory.fillDefaults().numColumns(1).margins(defaultMargins.x, defaultMargins.y)
.generateLayout(contents);
setControl(contents);
srxFile.setText(ConverterContext.defaultSrx);
validate();
}
示例17
public void createControl(Composite parent) {
initData(); // 先初始化本页面需要的数据
Composite contents = new Composite(parent, SWT.NONE);
GridLayout layout = new GridLayout();
contents.setLayout(layout);
GridData gridData = new GridData();
gridData.horizontalAlignment = SWT.FILL;
gridData.grabExcessHorizontalSpace = true;
contents.setLayoutData(gridData);
createFilesGroup(contents); // 文件列表区域
createPropertiesGroup(contents); // 源文件属性区域组
createConversionOptionsGroup(contents); // 转换选项组
bindValue(); // 数据绑定
try {
loadFiles(); // 加载文件列表
} catch (Exception e) {
e.printStackTrace();
}
filesTable.select(0); // 默认选中第一行数据
filesTable.notifyListeners(SWT.Selection, null);
Dialog.applyDialogFont(parent);
Point defaultMargins = LayoutConstants.getMargins();
GridLayoutFactory.fillDefaults().numColumns(1).margins(defaultMargins.x, defaultMargins.y)
.generateLayout(contents);
setControl(contents);
validate();
}
示例18
@Override
public Control createControl(Composite parent, IWizardContainer wizardContainer, DataBindingContext ctx) {
final Composite mainComposite = new Composite(parent, SWT.NONE);
mainComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
mainComposite.setLayout(GridLayoutFactory.swtDefaults().spacing(LayoutConstants.getSpacing().x, 10).create());
if (!orgaToDeploy.isPresent()) {
createOrganizationViewer(mainComposite, fileStoreObservable, ctx);
}
createDefaultUserTextWidget(ctx, mainComposite, fileStoreObservable);
initializeOrganizationFileStore();
return mainComposite;
}
示例19
@Override
public Control createExpressionEditor(final Composite parent, final EMFDataBindingContext ctx) {
mainComposite = new Composite(parent, SWT.NONE);
mainComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
mainComposite.setLayout(GridLayoutFactory.fillDefaults().create());
new Label(mainComposite, SWT.NONE)
.setLayoutData(GridDataFactory.fillDefaults().indent(0, -LayoutConstants.getSpacing().y + 1).create()); //filler
inputNameComposite = new Composite(mainComposite, SWT.NONE);
inputNameComposite.setLayout(GridLayoutFactory.fillDefaults().numColumns(3).create());
inputNameComposite.setLayoutData(GridDataFactory.fillDefaults().create());
final Label scriptNameLabel = new Label(inputNameComposite, SWT.NONE);
scriptNameLabel.setLayoutData(GridDataFactory.fillDefaults().align(SWT.BEGINNING, SWT.CENTER).create());
scriptNameLabel.setText(Messages.name);
expressionNameText = new Text(inputNameComposite, SWT.BORDER | SWT.SINGLE);
expressionNameText.setLayoutData(GridDataFactory.fillDefaults().align(SWT.BEGINNING, SWT.CENTER).grab(false, false)
.hint(400, SWT.DEFAULT).create());
LocalResourceManager resourceManager = new LocalResourceManager(JFaceResources.getResources(), parent);
Color errorColor = resourceManager.createColor(new RGB(214, 77, 77));
errorLabel = new CLabel(inputNameComposite, SWT.NONE);
errorLabel.setLayoutData(GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).create());
errorLabel.setForeground(errorColor);
final IScriptLanguageProvider provider = ScriptLanguageService.getInstance().getScriptLanguageProvider(languageId);
editor = provider.getExpressionEditor();
editor.setIsPageFlowContext(isPageFlowContext);
final Composite editorComposite = new Composite(mainComposite, SWT.NONE);
editorComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
editorComposite.setLayout(GridLayoutFactory.fillDefaults().create());
editor.createExpressionEditor(editorComposite, ctx);
createReturnTypeComposite(editorComposite);
return mainComposite;
}
示例20
@Override
public void createControl(Composite parent) {
Composite composite = new Composite(parent, SWT.NONE);
composite.setLayout(GridLayoutFactory.swtDefaults().spacing(LayoutConstants.getSpacing().x, 10).create());
composite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
ctx = new EMFDataBindingContext();
new TextWidget.Builder()
.withLabel(Messages.name)
.labelAbove()
.fill()
.grabHorizontalSpace()
.bindTo(EMFObservables.observeValue(workingCopy,
ProcessPackage.Literals.ADDITIONAL_RESOURCE__NAME))
.withValidator(new AdditionalResourceBarPathValidator(pool, originalAdditionalResource))
.inContext(ctx)
.createIn(composite)
.setFocus();
new TextAreaWidget.Builder()
.withLabel(Messages.description)
.labelAbove()
.fill()
.grabHorizontalSpace()
.heightHint(100)
.bindTo(EMFObservables.observeValue(workingCopy,
ProcessPackage.Literals.ADDITIONAL_RESOURCE__DESCRIPTION))
.inContext(ctx)
.useNativeRender()
.createIn(composite);
setControl(composite);
WizardPageSupport.create(this, ctx);
}
示例21
protected void createExpressionTypePanel(final Composite parentForm) {
final Composite parentComposite = new Composite(parentForm, SWT.NONE);
parentComposite
.setLayoutData(GridDataFactory.swtDefaults().align(SWT.BEGINNING, SWT.FILL).grab(false, true).create());
parentComposite.setLayout(GridLayoutFactory.fillDefaults().spacing(LayoutConstants.getSpacing().x, 1).create());
final Label expressionTypeLabel = new Label(parentComposite, SWT.NONE);
expressionTypeLabel.setText(Messages.expressionTypeLabel);
expressionTypeLabel.setLayoutData(GridDataFactory.swtDefaults().grab(true, false).create());
expressionTypeViewer = new TableViewer(parentComposite, SWT.FULL_SELECTION | SWT.BORDER | SWT.SINGLE);
expressionTypeViewer.getTable().setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
expressionTypeViewer.setContentProvider(new ExpressionTypeContentProvider());
expressionTypeViewer.setLabelProvider(new ExpressionTypeLabelProvider());
expressionTypeViewer.setSorter(new ViewerSorter() {
@Override
public int compare(final Viewer viewer, final Object e1, final Object e2) {
final IExpressionProvider p1 = (IExpressionProvider) e1;
final IExpressionProvider p2 = (IExpressionProvider) e2;
return p1.getTypeLabel().compareTo(p2.getTypeLabel());
}
});
if (viewerTypeFilters != null) {
expressionTypeViewer.setFilters(viewerTypeFilters);
}
if (!filteredEditor.isEmpty()) {
expressionTypeViewer.addFilter(filterEditor());
}
ColumnViewerToolTipSupport.enableFor(expressionTypeViewer, ToolTip.NO_RECREATE);
expressionTypeViewer.setInput(expressionViewer.getInput());
}
示例22
private Composite createMergeViewer(Composite parent) {
Composite composite = new Composite(parent, SWT.None);
composite.setLayout(GridLayoutFactory.fillDefaults().spacing(LayoutConstants.getSpacing().x, 1).create());
composite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
viewer = new TreeViewer(composite,
SWT.VIRTUAL | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL | SWT.FULL_SELECTION | SWT.BORDER);
viewer.getTree().setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
viewer.setUseHashlookup(true);
ColumnViewerToolTipSupport.enableFor(viewer);
viewer.getTree().setHeaderVisible(true);
viewer.getTree().setLinesVisible(true);
viewer.setContentProvider(new SmartImportBdmTreeContentProvider());
TableLayout layout = new TableLayout();
layout.addColumnData(new ColumnWeightData(6, true));
layout.addColumnData(new ColumnWeightData(2, true));
viewer.getTree().setLayout(layout);
createModelColumn();
createActionColumn();
IViewerObservableValue singleSelectionObservable = ViewerProperties.singleSelection().observe(viewer);
viewer.addDoubleClickListener(e -> viewer.setExpandedState(singleSelectionObservable.getValue(),
!viewer.getExpandedState(singleSelectionObservable.getValue())));
return composite;
}
示例23
private void createContraintsDefinitionComposite(Composite parent, AbstractBdmFormPage formPage) {
Composite composite = formPage.getToolkit().createComposite(parent);
composite.setLayout(
GridLayoutFactory.fillDefaults().numColumns(2).spacing(LayoutConstants.getSpacing().x, 1).margins(5, 10)
.create());
composite.setLayoutData(GridDataFactory.fillDefaults().grab(false, true).hint(500, SWT.DEFAULT).create());
createToolbar(composite);
createSearchField(composite);
createConstraintsDefinitionViewer(formPage, composite);
}
示例24
public AttributeEditionControl(Composite parent,
BusinessDataModelFormPage formPage,
IObservableValue<BusinessObject> selectedBoObservable,
DataBindingContext ctx) {
super(parent, SWT.None);
setLayout(GridLayoutFactory.fillDefaults().create());
setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
formPage.getToolkit().adapt(this);
this.formPage = formPage;
this.selectedBoObservable = selectedBoObservable;
this.ctx = ctx;
fieldsObservable = EMFObservables.observeDetailList(Realm.getDefault(), selectedBoObservable,
BusinessDataModelPackage.Literals.BUSINESS_OBJECT__FIELDS);
Composite viewerComposite = formPage.getToolkit().createComposite(this);
viewerComposite.setLayout(GridLayoutFactory.fillDefaults().spacing(LayoutConstants.getSpacing().x, 1).create());
viewerComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).hint(1000, 300).create());
Composite toolbarComposite = formPage.getToolkit().createComposite(viewerComposite);
toolbarComposite.setLayout(GridLayoutFactory.fillDefaults().numColumns(2).create());
toolbarComposite.setLayoutData(GridDataFactory.fillDefaults().create());
createToolbar(toolbarComposite);
createSearchField(toolbarComposite);
createAttributeTableViewer(viewerComposite);
createDetailsSection();
enableButtons();
selectedBoObservable.addValueChangeListener(e -> selectedFieldObservable.setValue(null));
}
示例25
private void createIndexDefinitionComposite(Composite parent) {
Composite composite = formPage.getToolkit().createComposite(parent);
composite.setLayout(GridLayoutFactory.fillDefaults().numColumns(2).spacing(LayoutConstants.getSpacing().x, 1)
.extendedMargins(15, 5, 10, 10).create());
composite.setLayoutData(GridDataFactory.fillDefaults().grab(false, true).create());
createToolbar(composite);
createSearchField(composite);
createIndexViewer(composite);
}
示例26
protected Composite createBusinessObjectListComposite(AbstractBdmFormPage formPage) {
Composite boListComposite = formPage.getToolkit().createComposite(section);
boListComposite.setLayout(
GridLayoutFactory.fillDefaults().numColumns(2).spacing(LayoutConstants.getSpacing().x, 1).margins(5, 10)
.create());
boListComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
createToolbar(boListComposite, formPage);
createSearchField(boListComposite, formPage);
createViewer(boListComposite, formPage);
enableButtons();
return boListComposite;
}
示例27
public ConstraintFormPart(Composite parent, ConstraintFormPage formPage) {
this.formPage = formPage;
parent.setLayout(
GridLayoutFactory.fillDefaults().numColumns(2).spacing(20, LayoutConstants.getSpacing().y).create());
parent.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
deployRequiredControl = new DeployRequiredControl(parent, formPage,
GridDataFactory.fillDefaults().span(2, 1).create());
createBusinessObjectList(parent);
createConstraintEditionControl(parent);
}
示例28
private void createTableViewer(final Composite parent) {
final Label filler = new Label(mainComposite, SWT.NONE);
filler.setLayoutData(
GridDataFactory.fillDefaults().span(2, 1).indent(0, -LayoutConstants.getSpacing().y + 1).create());
viewer = new TableViewer(mainComposite, SWT.FULL_SELECTION | SWT.BORDER
| SWT.SINGLE | SWT.V_SCROLL);
final TableLayout layout = new TableLayout();
layout.addColumnData(new ColumnWeightData(100, false));
viewer.getTable().setLayout(layout);
viewer.getTable().setLayoutData(
GridDataFactory.fillDefaults().grab(true, true).span(2, 1).create());
final TableViewerColumn columnViewer = new TableViewerColumn(viewer, SWT.NONE);
final TableColumn column = columnViewer.getColumn();
column.setText(Messages.name);
final TableColumnSorter sorter = new TableColumnSorter(viewer);
sorter.setColumn(column);
viewer.getTable().setHeaderVisible(true);
viewer.setContentProvider(new ArrayContentProvider());
viewer.setLabelProvider(new ParameterNameLabelProvider());
viewer.addPostSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(final SelectionChangedEvent event) {
if (!event.getSelection().isEmpty()) {
ParameterEditor.this.fireSelectionChanged();
}
}
});
}
示例29
@Override
public Control createControl(Composite parent, IWizardContainer wizardContainer, DataBindingContext ctx) {
Composite mainComposite = new Composite(parent, SWT.INHERIT_FORCE);
mainComposite.setLayout(GridLayoutFactory.swtDefaults()
.create());
mainComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
Composite viewerAndButtonsComposite = new Composite(mainComposite, SWT.INHERIT_FORCE);
viewerAndButtonsComposite.setLayout(
GridLayoutFactory.fillDefaults().numColumns(2).spacing(LayoutConstants.getSpacing().x, 1).create());
viewerAndButtonsComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
new Label(viewerAndButtonsComposite, SWT.NONE); // column filler
createSearchAndCollapseComposite(ctx, viewerAndButtonsComposite);
createSelectButtonComposite(viewerAndButtonsComposite);
createViewer(ctx, viewerAndButtonsComposite);
createArtifactCounter(viewerAndButtonsComposite);
createDeployOptions(ctx, viewerAndButtonsComposite);
checkedElementsObservable = fileStoreViewer.checkedElementsObservable();
defaultSelection();
searchObservableValue.addValueChangeListener(e -> applySearch(e.diff.getNewValue()));
checkedElementsObservable.addSetChangeListener(event -> {
if (!filtering) {
mergeSets();
updateCleanDeployEnablement();
updateUserProposals();
updateEnvironmentEnablement();
}
});
mergeSets();
updateUserProposals();
updateCleanDeployEnablement();
updateEnvironmentEnablement();
return mainComposite;
}
示例30
private void doCreateFileTree(Composite parent, DataBindingContext dbc) {
final Composite composite = new Composite(parent, SWT.NONE);
composite.setLayout(GridLayoutFactory.fillDefaults().spacing(LayoutConstants.getSpacing().x, 1).create());
composite.setLayoutData(
GridDataFactory.fillDefaults().grab(true, true).create());
createTreeHeader(composite, dbc);
treeSection.setClient(createTree(treeSection));
}