Java 类org.eclipse.ui.forms.events.IExpansionListener 实例源码

项目:google-cloud-eclipse    文件:PipelineOptionsFormComponent.java   
private ExpandableComposite optionsTypeSection(PipelineLaunchConfiguration launchConfiguration,
    String optionsTypeName, Collection<String> optionsTypeProperties,
    Map<String, Optional<String>> optionsDescriptions, int style) {
  ExpandableComposite expandable = formToolkit.createSection(form.getBody(), style);
  expandable.setLayout(new GridLayout());
  expandable.setBackground(parent.getBackground());
  expandable.setForeground(parent.getForeground());
  expandable.setText(optionsTypeName);
  expandable.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));

  LabeledTextMapComponent typeArgs = new LabeledTextMapComponent(formToolkit, expandable,
      new GridData(SWT.FILL, SWT.CENTER, true, false), argumentSeparator);

  for (ModifyListener modifyListener : modifyListeners) {
    typeArgs.addModifyListener(modifyListener);
  }
  for (IExpansionListener expandListener : expansionListeners) {
    expandable.addExpansionListener(expandListener);
  }
  for (String property : optionsTypeProperties) {
    typeArgs.addLabeledText(property, optionsDescriptions.get(property));
  }

  optionsComponents.put(expandable, typeArgs);
  expandable.setClient(typeArgs.getControl());
  typeArgs.setTextValuesForExistingLabels(launchConfiguration.getArgumentValues());

  return expandable;
}
项目:tlaplus    文件:FormHelper.java   
/**
 * 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;
}
项目:tlaplus    文件:BasicFormPage.java   
public IExpansionListener getExpansionListener()
{
    if (this.formRebuildingListener == null)
    {
        this.formRebuildingListener = new ExpansionAdapter() {
            public void expansionStateChanged(ExpansionEvent e)
            {
                getManagedForm().reflow(true);
            }
        };
    }
    return this.formRebuildingListener;
}
项目:google-cloud-eclipse    文件:PipelineOptionsFormComponent.java   
public void addExpandListener(IExpansionListener expandListener) {
  for (ExpandableComposite expandable : optionsComponents.keySet()) {
    expandable.addExpansionListener(expandListener);
  }
  expansionListeners.add(expandListener);
}