use of org.eclipse.ui.forms.events.ExpansionEvent in project eclipse.platform.ui by eclipse-platform.
the class SectionFactoryTest method addsSectionExpandListeners.
@Test
public void addsSectionExpandListeners() {
final ExpansionEvent[] raisedEvents = new ExpansionEvent[1];
Section section = SectionFactory.newSection(Section.TWISTIE).onExpanded(e -> raisedEvents[0] = e).create(shell);
Control twistie = section.getChildren()[0];
assertTrue("Expected a twistie", twistie instanceof Twistie);
click(twistie);
assertNotNull(raisedEvents[0]);
}
use of org.eclipse.ui.forms.events.ExpansionEvent in project eclipse.platform.ui by eclipse-platform.
the class ChooseWorkspaceWithSettingsDialog method createSettingsControls.
/**
* Create the controls for selecting the controls we are going to export.
*
* @param workArea
*/
private void createSettingsControls(Composite workArea) {
final FormToolkit toolkit = new FormToolkit(workArea.getDisplay());
workArea.addDisposeListener(e -> toolkit.dispose());
final ScrolledForm form = toolkit.createScrolledForm(workArea);
form.getBody().setBackground(workArea.getBackground());
form.getBody().setLayout(new GridLayout());
form.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
final ExpandableComposite copySettingsExpandable = toolkit.createExpandableComposite(form.getBody(), ExpandableComposite.TWISTIE);
copySettingsExpandable.setText(IDEWorkbenchMessages.ChooseWorkspaceWithSettingsDialog_SettingsGroupName);
copySettingsExpandable.setBackground(workArea.getBackground());
copySettingsExpandable.setLayout(new GridLayout());
copySettingsExpandable.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
copySettingsExpandable.addExpansionListener(new IExpansionListener() {
@Override
public void expansionStateChanged(ExpansionEvent e) {
form.reflow(true);
Point size = getInitialSize();
Shell shell = getShell();
shell.setBounds(getConstrainedShellBounds(new Rectangle(shell.getLocation().x, shell.getLocation().y, size.x, size.y)));
}
@Override
public void expansionStateChanging(ExpansionEvent e) {
// Nothing to do here
}
});
Composite sectionClient = toolkit.createComposite(copySettingsExpandable);
sectionClient.setBackground(workArea.getBackground());
if (createButtons(toolkit, sectionClient))
copySettingsExpandable.setExpanded(true);
copySettingsExpandable.setClient(sectionClient);
}
use of org.eclipse.ui.forms.events.ExpansionEvent in project jbosstools-hibernate by jbosstools.
the class HibernateJavaEntity2_0Composite method initializeTypeDefCollapsibleSection.
protected void initializeTypeDefCollapsibleSection(Composite container) {
final Section section = this.getWidgetFactory().createSection(container, ExpandableComposite.TITLE_BAR | ExpandableComposite.TWISTIE);
section.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
// $NON-NLS-1$
section.setText("Type Definitions");
section.addExpansionListener(new ExpansionAdapter() {
@Override
public void expansionStateChanging(ExpansionEvent e) {
if (e.getState() && section.getClient() == null) {
section.setClient(initializeTypeDefsSection(section, buildTypeDefContainerHolder()));
}
}
});
}
use of org.eclipse.ui.forms.events.ExpansionEvent in project jbosstools-hibernate by jbosstools.
the class HibernateColumnComposite method initializeLayout.
@Override
protected void initializeLayout(Composite container) {
// // Column group pane
// container = addTitledGroup(
// container,
// JptJpaUiDetailsMessages.ColumnComposite_columnSection
// );
//
// // Column widgets
// addLabeledComposite(
// container,
// JptJpaUiDetailsMessages.ColumnComposite_name,
// addColumnCombo(container),
// JpaHelpContextIds.MAPPING_COLUMN
// );
//
// // Table widgets
// addLabeledComposite(
// container,
// JptJpaUiDetailsMessages.ColumnComposite_table,
// addTableCombo(container),
// JpaHelpContextIds.MAPPING_COLUMN_TABLE
// );
//
// // Details sub-pane
// container = addCollapsibleSubSection(
// container,
// JptJpaUiDetailsMessages.ColumnComposite_details,
// new SimplePropertyValueModel<Boolean>(Boolean.FALSE)
// );
//
// new DetailsComposite(this, getSubjectHolder(), addSubPane(container, 0, 16));
// Column widgets
this.addLabel(container, JptJpaUiDetailsMessages.COLUMN_COMPOSITE_NAME);
this.addColumnCombo(container);
// Table widgets
this.addLabel(container, JptJpaUiDetailsMessages.COLUMN_COMPOSITE_TABLE);
this.addTableCombo(container);
// Details sub-pane
final Section detailsSection = this.getWidgetFactory().createSection(container, ExpandableComposite.TWISTIE);
detailsSection.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
detailsSection.setText(JptJpaUiDetailsMessages.COLUMN_COMPOSITE_DETAILS);
GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
gridData.horizontalSpan = 2;
detailsSection.setLayoutData(gridData);
detailsSection.addExpansionListener(new ExpansionAdapter() {
@Override
public void expansionStateChanging(ExpansionEvent e) {
if (e.getState() && detailsSection.getClient() == null) {
detailsSection.setClient(HibernateColumnComposite.this.initializeDetailsSection(detailsSection));
}
}
});
}
use of org.eclipse.ui.forms.events.ExpansionEvent in project gda-core by openGDA.
the class DataCollectionStatus method createPartControl.
/**
* Create contents of the view part.
*
* @param parent
*/
@Override
public void createPartControl(Composite parent) {
toolkit = new FormToolkit(parent.getDisplay());
form = toolkit.createScrolledForm(parent);
form.setText("Server Data Collection Status Report");
TableWrapLayout layout = new TableWrapLayout();
form.getBody().setLayout(layout);
layout.numColumns = 2;
Section section1 = toolkit.createSection(form.getBody(), Section.DESCRIPTION | ExpandableComposite.TITLE_BAR | ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
TableWrapData td = new TableWrapData(TableWrapData.FILL);
td.colspan = 2;
section1.setLayoutData(td);
section1.addExpansionListener(new ExpansionAdapter() {
@Override
public void expansionStateChanged(ExpansionEvent e) {
form.reflow(true);
}
});
section1.setText("Experiment Setup");
section1.setDescription("Dispaly summary information on samples being processed on the server after start.");
Composite section1Client = toolkit.createComposite(section1);
section1Client.setLayout(new GridLayout(4, false));
Label label = toolkit.createLabel(section1Client, "Sample configuration file: ");
GridData gd = new GridData();
gd.horizontalSpan = 1;
label.setLayoutData(gd);
txtSamplesfile = toolkit.createText(section1Client, "samples definition file path", SWT.READ_ONLY | SWT.WRAP);
gd = new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalSpan = 3;
gd.grabExcessHorizontalSpace = true;
txtSamplesfile.setLayoutData(gd);
label = toolkit.createLabel(section1Client, "Number of Active Samples: ");
txtActivesamples = toolkit.createText(section1Client, "0", SWT.READ_ONLY);
txtActivesamples.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
label = toolkit.createLabel(section1Client, "Number of Calibrations: ");
txtNumberCalibrations = toolkit.createText(section1Client, "0", SWT.READ_ONLY);
txtNumberCalibrations.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
label = toolkit.createLabel(section1Client, "Total Number of Collections: ");
txtTotalNumberCollections = toolkit.createText(section1Client, "0", SWT.READ_ONLY);
txtTotalNumberCollections.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
section1.setClient(section1Client);
toolkit.paintBordersFor(section1Client);
Section section = toolkit.createSection(form.getBody(), Section.DESCRIPTION | ExpandableComposite.TITLE_BAR | ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
td = new TableWrapData(TableWrapData.FILL);
td.colspan = 2;
section.setLayoutData(td);
section.addExpansionListener(new ExpansionAdapter() {
@Override
public void expansionStateChanged(ExpansionEvent e) {
form.reflow(true);
}
});
section.setText("Experiment Progress");
section.setDescription("Display data collection progress informtion of the samples on the server.");
Composite sectionClient = toolkit.createComposite(section);
sectionClient.setLayout(new GridLayout(4, false));
label = toolkit.createLabel(sectionClient, "Data file to collect: ");
gd = new GridData();
gd.horizontalSpan = 1;
label.setLayoutData(gd);
txtDataFilePath = toolkit.createText(sectionClient, "Display data file name is currently collecting", SWT.READ_ONLY | SWT.WRAP);
gd = new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalSpan = 3;
gd.grabExcessHorizontalSpace = true;
txtDataFilePath.setLayoutData(gd);
label = toolkit.createLabel(sectionClient, "Acquisition Progress: ");
gd = new GridData();
gd.horizontalSpan = 1;
label.setLayoutData(gd);
progressBar = new ProgressBar(sectionClient, SWT.NONE);
gd = new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalSpan = 3;
gd.grabExcessHorizontalSpace = true;
progressBar.setLayoutData(gd);
progressBar.setMaximum(100);
progressBar.setMinimum(0);
progressBar.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TEXT_BORDER);
label = toolkit.createLabel(sectionClient, "Progress Message: ");
gd = new GridData();
gd.horizontalSpan = 1;
label.setLayoutData(gd);
txtProgressMessage = toolkit.createText(sectionClient, "Display server data collection progress messages here.", SWT.READ_ONLY | SWT.WRAP);
gd = new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalSpan = 3;
gd.grabExcessHorizontalSpace = true;
txtProgressMessage.setLayoutData(gd);
label = toolkit.createLabel(sectionClient, "Current Scan Number: ");
txtScanNumber = toolkit.createText(sectionClient, "Display current scan number", SWT.READ_ONLY);
txtScanNumber.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
label = toolkit.createLabel(sectionClient, "Current Scan Point: ");
txtScanPointNumber = toolkit.createText(sectionClient, "0/0", SWT.READ_ONLY);
txtScanPointNumber.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
label = toolkit.createLabel(sectionClient, "Current Sample: ");
txtSamplename = toolkit.createText(sectionClient, "Display current sample name", SWT.READ_ONLY);
txtSamplename.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
label = toolkit.createLabel(sectionClient, "Current Cell: ");
txtCellname = toolkit.createText(sectionClient, "Display current cell name", SWT.READ_ONLY);
txtCellname.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
label = toolkit.createLabel(sectionClient, "Current Stage: ");
txtStagename = toolkit.createText(sectionClient, "Display current stage name", SWT.READ_ONLY);
txtStagename.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
label = toolkit.createLabel(sectionClient, "Current Collection: ");
txtCollectionNumber = toolkit.createText(sectionClient, "0/0", SWT.READ_ONLY);
txtCollectionNumber.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
section.setClient(sectionClient);
toolkit.paintBordersFor(sectionClient);
initialisation();
// register as selection listener of sample editor if exist
// getViewSite().getWorkbenchWindow().getSelectionService().addSelectionListener(SampleViewExtensionFactory.ID, selectionListener);
createActions();
initializeToolBar();
initializeMenu();
updateActionIconsState();
}
Aggregations