本文整理汇总了Java中org.eclipse.ui.forms.widgets.Section.addExpansionListener方法的典型用法代码示例。如果您正苦于以下问题:Java Section.addExpansionListener方法的具体用法?Java Section.addExpansionListener怎么用?Java Section.addExpansionListener使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.ui.forms.widgets.Section
的用法示例。
在下文中一共展示了Section.addExpansionListener方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createSectionComposite
import org.eclipse.ui.forms.widgets.Section; //导入方法依赖的package包/类
/**
* Constructs a section and returns a section client composite
*
* the section layout is TableWrapLayout
*
*
* @param parent parent container for the section
* @param title title of the section
* @param description description of the section
* @param toolkit toolkit to create the composite
* @param sectionFlags parameters of the section
* @param expansionListener
* @return a section client (the content container of the section)
*/
public static Section createSectionComposite(Composite parent, String title, String description,
FormToolkit toolkit, int sectionFlags, IExpansionListener expansionListener)
{
Section section = toolkit.createSection(parent, sectionFlags);
TableWrapData td = new TableWrapData(TableWrapData.FILL_GRAB);
td.grabHorizontal = true;
section.setLayoutData(td);
section.setText(title);
section.setDescription(description);
if (expansionListener != null)
{
section.addExpansionListener(expansionListener);
}
// create section client
Composite sectionClient = toolkit.createComposite(section);
TableWrapLayout layout = new TableWrapLayout();
layout.numColumns = 1;
sectionClient.setLayout(layout);
section.setClient(sectionClient);
// draw flat borders
toolkit.paintBordersFor(sectionClient);
return section;
}
示例2: createControl
import org.eclipse.ui.forms.widgets.Section; //导入方法依赖的package包/类
@Override
public void createControl(Composite parent, final FormToolkit toolkit) {
final List<TaskAttribute> diffTaskAttributes = getDiffTaskAttributes();
if (diffTaskAttributes == null || diffTaskAttributes.isEmpty()) {
return;
}
int style = ExpandableComposite.TWISTIE | ExpandableComposite.SHORT_TITLE_BAR;
final Section groupSection = toolkit.createSection(parent, style);
groupSection.setText("Changes (" + diffTaskAttributes.size() + ')');
groupSection.clientVerticalSpacing = 0;
groupSection.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
if (groupSection.isExpanded()) {
addDiffViewersToSection(toolkit, diffTaskAttributes, groupSection);
} else {
groupSection.addExpansionListener(new ExpansionAdapter() {
@Override
public void expansionStateChanged(ExpansionEvent e) {
if (groupSection.getClient() == null) {
try {
getTaskEditorPage().setReflow(false);
addDiffViewersToSection(toolkit, diffTaskAttributes, groupSection);
} finally {
getTaskEditorPage().setReflow(true);
}
getTaskEditorPage().reflow();
}
}
});
}
}
示例3: createSectionTitle
import org.eclipse.ui.forms.widgets.Section; //导入方法依赖的package包/类
public Composite createSectionTitle(Composite parent, String text, boolean expandable, int columns, int span) {
int style = Section.EXPANDED | Section.TITLE_BAR;
if (expandable)
style = style | Section.TWISTIE;
Section section = new NotifyExpandSection(parent, style, sectionSizeChange);
section.titleBarTextMarginWidth = 0;
// section.marginWidth = 2;
section.setTitleBarBorderColor(SWTResourceManager.getColor(SWT.COLOR_GRAY));
section.setTitleBarBackground(SWTResourceManager.getColor(SWT.COLOR_TITLE_INACTIVE_BACKGROUND));
// section.setFont(SWTResourceManager.getBoldFont(section.getFont()));
if (parent.getLayout() instanceof GridLayout) {
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalSpan = span;
section.setLayoutData(gd);
}
section.setText(text);
if (sectionSizeChange != null)
section.addExpansionListener(sectionSizeChange);
// section.setSeparatorControl(new Label(section, SWT.SEPARATOR
// | SWT.HORIZONTAL));
parent = createComposite(section, SWT.BORDER);
GridLayout layout = new GridLayout(columns, false);
layout.marginHeight = 4;
layout.marginWidth = 2;
parent.setLayout(layout);
section.setClient(parent);
return parent;
}
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:32,代码来源:TabbedPropertySheetWidgetFactory.java
示例4: createSection
import org.eclipse.ui.forms.widgets.Section; //导入方法依赖的package包/类
public Composite createSection(Composite parent, String text, boolean expandable, int columns, int span, int style) {
style = style | Section.EXPANDED;
if (expandable)
style = style | Section.TREE_NODE;
Section section = new NotifyExpandSection(parent, style, sectionSizeChange);
section.titleBarTextMarginWidth = 0;
section.setFont(SWTResourceManager.getBoldFont(section.getFont()));
if (parent.getLayout() instanceof GridLayout) {
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalSpan = span;
section.setLayoutData(gd);
}
section.setText(text);
section.setSeparatorControl(new Label(section, SWT.SEPARATOR | SWT.HORIZONTAL));
if (sectionSizeChange != null)
section.addExpansionListener(sectionSizeChange);
Composite cmp = createComposite(section, SWT.NONE);
GridLayout layout = new GridLayout(columns, false);
layout.marginHeight = 4;
layout.marginWidth = 2;
cmp.setLayout(layout);
section.setClient(cmp);
return cmp;
}
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:28,代码来源:TabbedPropertySheetWidgetFactory.java
示例5: createAndGetSection
import org.eclipse.ui.forms.widgets.Section; //导入方法依赖的package包/类
/**
* Create a section and return it. The client of the section is a composite where the control can be created
*/
public Section createAndGetSection(Composite parent, String text, boolean expandable, int columns, int span, int style) {
style = style | Section.EXPANDED;
if (expandable)
style = style | Section.TREE_NODE;
Section section = new NotifyExpandSection(parent, style, sectionSizeChange);
section.titleBarTextMarginWidth = 0;
section.setFont(SWTResourceManager.getBoldFont(section.getFont()));
if (parent.getLayout() instanceof GridLayout) {
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalSpan = span;
section.setLayoutData(gd);
}
section.setText(text);
section.setSeparatorControl(new Label(section, SWT.SEPARATOR | SWT.HORIZONTAL));
if (sectionSizeChange != null)
section.addExpansionListener(sectionSizeChange);
Composite cmp = createComposite(section, SWT.NONE);
GridLayout layout = new GridLayout(columns, false);
layout.marginHeight = 4;
layout.marginWidth = 2;
cmp.setLayout(layout);
section.setClient(cmp);
return section;
}
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:31,代码来源:TabbedPropertySheetWidgetFactory.java
示例6: createSection
import org.eclipse.ui.forms.widgets.Section; //导入方法依赖的package包/类
private Section createSection( final Composite parent,
final FormToolkit tk,
final String title,
final boolean isGrabVertical,
final boolean isExpandable) {
final int style = isExpandable ? //
Section.TWISTIE //
| Section.TITLE_BAR
: Section.TITLE_BAR;
final Section section = tk.createSection(parent, style);
section.setText(title);
GridDataFactory.fillDefaults().grab(true, isGrabVertical).applyTo(section);
final Composite sectionContainer = tk.createComposite(section);
section.setClient(sectionContainer);
section.addExpansionListener(new ExpansionAdapter() {
@Override
public void expansionStateChanged(final ExpansionEvent e) {
onExpandSection();
}
});
return section;
}