final ExpandableComposite excomposite= new ExpandableComposite(fBody, SWT.NONE, ExpandableComposite.TWISTIE | ExpandableComposite.CLIENT_INDENT | ExpandableComposite.COMPACT); if (fFirstChild == null) fFirstChild= excomposite; excomposite.setText(label); String last= null; if (fLastOpenKey != null && fDialogSettingsStore != null) excomposite.setExpanded(true); if (fFirstChild != excomposite) fFirstChild.setExpanded(false); } else { excomposite.setExpanded(false); excomposite.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, true, false)); excomposite.setClient(contents);
protected ExpandableComposite createStyleSection(Composite parent, String label, int nColumns) { ExpandableComposite excomposite= new ExpandableComposite(parent, SWT.NONE, ExpandableComposite.TWISTIE | ExpandableComposite.CLIENT_INDENT); excomposite.setText(label); excomposite.setExpanded(false); excomposite.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT)); excomposite.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false, nColumns, 1)); excomposite.addExpansionListener(new ExpansionAdapter() { public void expansionStateChanged(ExpansionEvent e) { expandedStateChanged((ExpandableComposite) e.getSource()); } }); fExpandedComposites.add(excomposite); makeScrollableCompositeAware(excomposite); return excomposite; }
public boolean isExpanded() { return mainItemComposite.isExpanded(); }
private void toggleState() { boolean newState = !isExpanded(); fireExpanding(newState, true); internalSetExpanded(newState); fireExpanding(newState, false); if (newState) FormUtil.ensureVisible(this); }
fPackageExplorer.setContentProvider(); final ExpandableComposite excomposite= new ExpandableComposite(sashForm, SWT.NONE, ExpandableComposite.TWISTIE | ExpandableComposite.CLIENT_INDENT); excomposite.setFont(sashForm.getFont()); excomposite.setText(NewWizardMessages.NewSourceContainerWorkbookPage_HintTextGroup_title); final boolean isExpanded= preferenceStore.getBoolean(OPEN_SETTING); excomposite.setExpanded(isExpanded); excomposite.addExpansionListener(new ExpansionAdapter() { public void expansionStateChanged(ExpansionEvent e) { ScrolledPageContent parentScrolledComposite= getParentScrolledComposite(excomposite); excomposite.setClient(fHintTextGroup.createControl(excomposite)); fUseFolderOutputs.doFillIntoGrid(body, 1); adjustSashForm(sashWeight, sashForm, excomposite.isExpanded()); GridData gd= new GridData(GridData.FILL_BOTH); PixelConverter converter= new PixelConverter(parent);
/** * Creates an ExpandibleComposite widget * @param parent the parent to add this widget to * @param style the style for ExpandibleComposite expanding handle, and layout * @param label the label for the widget * @param hspan how many columns to span in the parent * @param fill the fill style for the widget * Can be one of <code>GridData.FILL_HORIZONAL</code>, <code>GridData.FILL_BOTH</code> or <code>GridData.FILL_VERTICAL</code> * @return a new ExpandibleComposite widget * @since 3.6 */ public static ExpandableComposite createExpandibleComposite(Composite parent, int style, String label, int hspan, int fill) { ExpandableComposite ex = new ExpandableComposite(parent, SWT.NONE, style); ex.setText(label); ex.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT)); GridData gd = new GridData(fill); gd.horizontalSpan = hspan; ex.setLayoutData(gd); return ex; }
public static Section create(Composite parentComposite, String label, String previewKey) { final ExpandableComposite excomposite= new FormatterPreferenceSectionComposite(parentComposite, SWT.NONE, ExpandableComposite.TWISTIE | ExpandableComposite.CLIENT_INDENT); excomposite.clientVerticalSpacing= 0; excomposite.setText(label); excomposite.setExpanded(false); excomposite.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT)); excomposite.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false, GRID_COLUMNS, 1)); Composite inner= new Composite(excomposite, SWT.NONE); inner.setFont(parentComposite.getFont()); GridLayout layout= new GridLayout(GRID_COLUMNS, false); layout.marginWidth= 0; layout.marginLeft= 5; inner.setLayout(layout); excomposite.setClient(inner); return new Section(label, excomposite, inner, previewKey); }
final ExpandableComposite expandable = toolkit.createExpandableComposite(scrolledForm.getBody(), ExpandableComposite.TWISTIE); expandable.setText(area.getTitle()); expandable.setBackground(scrolledForm.getBackground()); expandable.setLayout(new GridLayout()); expandable.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, area.grabExcessVerticalSpace())); expandable.addExpansionListener(new ExpansionAdapter() { @Override public void expansionStateChanged(ExpansionEvent e) { expandable.setClient(sectionClient); expandable.setExpanded(expand);
final ExpandableComposite section = new ExpandableComposite(parent, SWT.NONE, ExpandableComposite.TWISTIE | ExpandableComposite.CLIENT_INDENT | ExpandableComposite.COMPACT | ExpandableComposite.EXPANDED); section.clientVerticalSpacing = 0; section.setBackground(parent.getBackground()); section.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT)); section.addExpansionListener(new ExpansionAdapter() { @Override public void expansionStateChanged(ExpansionEvent e) { section.setText("Build Plans"); section.setClient(composite); GridLayoutFactory.fillDefaults().numColumns(2).margins(0, 5).applyTo(composite);
private void createAdvancedSection(final Composite composite) { if (commitId != null) return; ExpandableComposite advanced = new ExpandableComposite(composite, ExpandableComposite.TREE_NODE | ExpandableComposite.CLIENT_INDENT); advanced.setText(UIText.CreateTagDialog_advanced); advanced.setToolTipText(UIText.CreateTagDialog_advancedToolTip); advanced.setLayoutData(GridDataFactory.fillDefaults().grab(true, false) .create()); .grab(true, false).hint(300, SWT.DEFAULT).create()); advanced.setClient(advancedComposite); advanced.addExpansionListener(new ExpansionAdapter() { public void expansionStateChanged(ExpansionEvent e) {
/** * Creates an {@link ExpandableComposite} with a client composite and a default grid layout * @param parent * @param title * @return */ private Composite createExpansibleComposite(Composite parent, String title) { ExpandableComposite ecomp = SWTFactory.createExpandibleComposite(parent, title, 1, GridData.FILL_HORIZONTAL); ecomp.addExpansionListener(new ExpansionAdapter() { public void expansionStateChanged(ExpansionEvent e) { Object obj = e.getSource(); handleExpand(getScrollingParent(obj)); } }); ecomp.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT)); fExpComps.add(ecomp); Composite client = SWTFactory.createComposite(ecomp, 2, 1, GridData.FILL_BOTH); ecomp.setClient(client); return client; }
ExpandableComposite pushUriArea = new ExpandableComposite(main, ExpandableComposite.TREE_NODE | ExpandableComposite.CLIENT_INDENT); GridDataFactory.fillDefaults().grab(true, false).applyTo(pushUriArea); pushUriArea.setExpanded(!config.getPushURIs().isEmpty()); pushUriArea.addExpansionListener(new ExpansionAdapter() { pushUriArea.setText(UIText.SimpleConfigurePushDialog_PushUrisLabel); final Composite pushUriDetails = new Composite(pushUriArea, SWT.NONE); pushUriArea.setClient(pushUriDetails); pushUriDetails.setLayout(new GridLayout(2, false)); GridDataFactory.fillDefaults().grab(true, true).applyTo(pushUriDetails);
mainItemComposite.setBackground(itemColor); mainItemComposite.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB)); String title = item.getTitle(); if (title != null) { mainItemComposite.setText(ViewUtilities.escapeForLabel(title)); mainItemComposite.addExpansionListener(new ExpansionAdapter() { @Override public void expansionStateChanged(ExpansionEvent e) { mainItemComposite.setTextClient(titleComposite); GridLayout layout = new GridLayout(number, false); GridData data = new GridData(GridData.FILL_BOTH); mainItemComposite.setClient(bodyWrapperComposite); TableWrapLayout wrapperLayout = new TableWrapLayout(); bodyWrapperComposite.setLayout(wrapperLayout); CheatSheetStopWatch.printLapTime("ViewItem.addItem()", "Time in addItem() after setting buttons and item collapsed: "); //$NON-NLS-1$ //$NON-NLS-2$ boldFont = mainItemComposite.getFont(); FontData[] fontDatas = boldFont.getFontData(); for (int i = 0; i < fontDatas.length; i++) { fontDatas[i].setStyle(fontDatas[i].getStyle() ^ SWT.BOLD); regularFont = new Font(mainItemComposite.getDisplay(), fontDatas); CheatSheetStopWatch.printLapTime("ViewItem.addItem()", "Time in addItem() after font initlization: "); //$NON-NLS-1$ //$NON-NLS-2$
ExpandableComposite.TWISTIE); recentWorkspacesForm.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); expandableComposite.setBackground(composite.getBackground()); expandableComposite.setText(IDEWorkbenchMessages.ChooseWorkspaceDialog_recentWorkspaces); expandableComposite.setExpanded(launchData.isShowRecentWorkspaces()); expandableComposite.addExpansionListener(new ExpansionAdapter() { @Override public void expansionStateChanged(ExpansionEvent e) { expandableComposite.setClient(panel); RowLayout layout = new RowLayout(); layout.type = SWT.VERTICAL;
private Composite createInnerComposite(ExpandableComposite excomposite, int nColumns, Font font) { Composite inner= new Composite(excomposite, SWT.NONE); inner.setFont(font); inner.setLayout(new GridLayout(nColumns, false)); excomposite.setClient(inner); return inner; }
@Override protected void createContents(Composite parent) { final Composite p = parent; expandable = new ExpandableComposite(parent, SWT.NONE, ExpandableComposite.TREE_NODE | ExpandableComposite.TWISTIE); super.createContents(expandable); createClearButton(group); expandable.setClient(group); expandable.addExpansionListener(new ExpansionAdapter() { @Override public void expansionStateChanged(ExpansionEvent e) { p.layout(); adjustSize(e.getState()); } }); }
| expansionStyle); section.titleBarTextMarginWidth = 0; section.setBackground(null); section.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT)); section.addExpansionListener(new ExpansionAdapter() { @Override public void expansionStateChanged(ExpansionEvent e) { section.setText(title); if (content.getLayout() instanceof GridLayout) { GridDataFactory.fillDefaults()
protected void restoreSectionExpansionStates(IDialogSettings settings) { for (int i = 0; i < expandedComposites.size(); i++) { ExpandableComposite excomposite = expandedComposites.get(i); if (settings == null) { excomposite.setExpanded(i == 0); // only expand the first node by default } else { excomposite.setExpanded(settings.getBoolean(SETTINGS_EXPANDED + String.valueOf(i))); } } }
/** * Creates an expandable composite as a part of the form. * * @param parent * the expandable composite parent * @param expansionStyle * the expandable composite style * @return the expandable composite widget */ public ExpandableComposite createExpandableComposite(Composite parent, int expansionStyle) { ExpandableComposite ec = new ExpandableComposite(parent, orientation, expansionStyle); ec.setMenu(parent.getMenu()); adapt(ec, true, true); ec.setFont(boldFontHolder.getBoldFont(ec.getFont())); return ec; }