private void initAdditionalParametersUi() { ExpandableComposite exp = new ExpandableComposite(this, ExpandableComposite.COMPACT); exp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1)); additonalParameters = new Text(exp, SWT.MULTI | SWT.BORDER | SWT.WRAP | SWT.V_SCROLL); additonalParameters.setLayoutData(new GridData(GridData.FILL_BOTH)); additonalParameters.setToolTipText("Advanced parameters for Text2Image - use key=value format in each line!"); // advancedParameters.setText("hyphen=null\n"); // advancedPropertiesTable = buildPropertyTable(exp, true); exp.setClient(additonalParameters); exp.setText("Additional Parameters"); // Fonts.setBoldFont(exp); exp.setExpanded(true); exp.addExpansionListener(new ExpansionAdapter() { public void expansionStateChanged(ExpansionEvent e) { layout(); } }); }
private void initRecogTools() { ExpandableComposite exp = new ExpandableComposite(this, ExpandableComposite.COMPACT); exp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); trComp = new TextRecognitionComposite(exp, 0); trComp.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 3, 1)); exp.setClient(trComp); exp.setText("Text Recognition"); Fonts.setBoldFont(exp); exp.setExpanded(true); exp.addExpansionListener(new ExpansionAdapter() { public void expansionStateChanged(ExpansionEvent e) { layout(); } }); }
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; }
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() { @Override public void expansionStateChanged(ExpansionEvent e) { expandedStateChanged((ExpandableComposite) e.getSource()); } }); expandedComposites.add(excomposite); makeScrollableCompositeAware(excomposite); return excomposite; }
private Composite createProblemCategory(Composite parent, String label) { // Expandable panel for each category of problems ExpandableComposite expandPanel = new ExpandableComposite(parent, SWT.NONE, ExpandableComposite.TWISTIE | ExpandableComposite.CLIENT_INDENT); expandPanel.setText(label); expandPanel.setExpanded(false); expandPanel.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT)); expandPanel.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false)); expandPanel.addExpansionListener(new ExpansionAdapter() { @Override public void expansionStateChanged(ExpansionEvent e) { topPanel.layout(true, true); scrollPanel.setMinSize(topPanel.computeSize(SWT.DEFAULT, SWT.DEFAULT)); } }); // Create panel to store the actual problems Composite categoryPanel = new Composite(expandPanel, SWT.NONE); categoryPanel.setLayout(new GridLayout(2, false)); expandPanel.setClient(categoryPanel); return categoryPanel; }
/** * Creates an individual diff viewer in the given composite. */ private void createDiffViewer(final FormToolkit toolkit, Composite composite, final TaskAttribute diffTaskAttribute) { int style = ExpandableComposite.TREE_NODE | ExpandableComposite.LEFT_TEXT_CLIENT_ALIGNMENT | ExpandableComposite.COMPACT; ExpandableComposite diffComposite = toolkit.createExpandableComposite(composite, style); diffComposite.clientVerticalSpacing = 0; diffComposite.setLayout(new GridLayout()); diffComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); diffComposite.setTitleBarForeground(toolkit.getColors().getColor(IFormColors.TITLE)); diffComposite.setText(calculateDiffChangeHeader(diffTaskAttribute)); final Composite diffViewerComposite = toolkit.createComposite(diffComposite); diffComposite.setClient(diffViewerComposite); diffViewerComposite.setLayout( new FillWidthLayout(EditorUtil.getLayoutAdvisor(getTaskEditorPage()), 15, 0, 0, 3)); diffComposite.addExpansionListener(new ExpansionAdapter() { @Override public void expansionStateChanged(ExpansionEvent event) { expandCollapseDiff(toolkit, diffViewerComposite, diffTaskAttribute, event.getState()); } }); GridDataFactory.fillDefaults().grab(true, false).applyTo(diffComposite); }
/** * Upon expanding and hiding the advanced controls will adjust accordingly. * * @param e */ private void updateAdvancedArea(ExpansionEvent e) { // Set the visibility of the advanced section advancedComposite.setVisible(e.getState()); // We want to exclude the advanced composite if it is not visible advGridDataFactory.exclude(!e.getState()).applyTo(advancedComposite); // Set Boolean selection when advanced is hidden if(!e.getState() && isAdvancedRadioSelected()) { clearSelections(); booleanButton.setSelection(true); } // Resize and update layout refreshLayout(); }
protected ExpandableComposite createStyleSection(Composite parent, String label, int nColumns, Key key) { ExpandableComposite excomposite= new ExpandableComposite(parent, SWT.NONE, ExpandableComposite.TWISTIE | ExpandableComposite.CLIENT_INDENT); excomposite.setText(label); if (key != null) { excomposite.setData(key); } 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() { @Override public void expansionStateChanged(ExpansionEvent e) { expandedStateChanged((ExpandableComposite) e.getSource()); } }); fExpandableComposites.add(excomposite); makeScrollableCompositeAware(excomposite); return excomposite; }
private void createSecondSection( ScrolledForm form, FormToolkit toolkit) { ExpandableComposite ec = toolkit.createExpandableComposite(form.getBody(), ExpandableComposite.TREE_NODE| ExpandableComposite.CLIENT_INDENT); ec.setText("Expandable Composite title"); String ctext = "We will now create a somewhat long text so that "+ "we can use it as content for the expandable composite. "+ "Expandable composite is used to hide or show the text using the " + "toggle control"; Label client = toolkit.createLabel(ec, ctext, SWT.WRAP); ec.setClient(client); TableWrapData td = new TableWrapData(); td.colspan = 2; ec.setLayoutData(td); ec.addExpansionListener(new ExpansionAdapter() { @Override public void expansionStateChanged(ExpansionEvent e) { form.reflow(true); } }); }
private void createAdvancedSection() { createExpandableComposite(); final Composite bucketComposite = createBucketSection(expandableComposite); expandableComposite.setClient(bucketComposite); expandableComposite.addExpansionListener(new ExpansionAdapter() { @Override public void expansionStateChanged(ExpansionEvent event) { layoutChangedHandler.run(); } }); }
private void initWerGroup() { ExpandableComposite werExp = new ExpandableComposite(this, ExpandableComposite.COMPACT); Composite werGroup = new Composite(werExp, SWT.SHADOW_ETCHED_IN); werGroup.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); // metadatagroup.setText("Document metadata"); werGroup.setLayout(new GridLayout(2, false)); Label refLabel = new Label(werGroup, 0); refLabel.setText("Reference:"); refVersionCombo = new Combo(werGroup, SWT.READ_ONLY); Label hypLabel = new Label(werGroup, 0); hypLabel.setText("Hypothesis:"); hypVersionCombo = new Combo(werGroup, SWT.READ_ONLY); Label emptyLabel = new Label(werGroup,0); computeWerBtn = new Button(werGroup, SWT.PUSH); computeWerBtn.setText("Compare"); computeWerBtn.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 1, 1)); computeWerBtn.setToolTipText("Compares the two selected transcripts and computes word error rate and character error rate."); computeWerBtn.pack(); werExp.setClient(werGroup); werExp.setText("Compute WER"); werExp.setExpanded(true); werExp.addExpansionListener(new ExpansionAdapter() { public void expansionStateChanged(ExpansionEvent e) { layout(); } }); }
private void postInitExpandable(ExpandableComposite exp, Composite c, String title) { exp.setClient(c); exp.setText("OCR"); exp.setExpanded(true); exp.addExpansionListener(new ExpansionAdapter() { public void expansionStateChanged(ExpansionEvent e) { layout(); } }); }
private void configExpandable(ExpandableComposite exp, Composite client, String text, final Composite container, boolean expand) { exp.setClient(client); exp.setText(text); exp.addExpansionListener(new ExpansionAdapter() { public void expansionStateChanged(ExpansionEvent e) { container.layout(); } }); exp.setExpanded(expand); }
private void initOtherTools() { ExpandableComposite exp = new ExpandableComposite(this, ExpandableComposite.COMPACT); exp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); Composite c = new Composite(exp, SWT.SHADOW_ETCHED_IN); c.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); c.setLayout(new GridLayout(1, true)); otherToolsPagesSelector = new CurrentTranscriptOrCurrentDocPagesSelector(c, SWT.NONE, true); otherToolsPagesSelector.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); polygon2baselinesBtn = new Button(c, SWT.PUSH); polygon2baselinesBtn.setText("Add Baselines to Polygons"); polygon2baselinesBtn.setToolTipText("Creates baselines for all surrounding polygons - warning: existing baselines will be lost (text is retained however!)"); polygon2baselinesBtn.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); baseline2PolygonBtn = new Button(c, SWT.PUSH); baseline2PolygonBtn.setText("Add Polygons to Baselines"); baseline2PolygonBtn.setToolTipText("Creates polygons for all baselines - warning: existing polygons will be lost (text is retained however!)"); baseline2PolygonBtn.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); exp.setClient(c); new Label(c, SWT.NONE); exp.setText("Other Tools"); Fonts.setBoldFont(exp); exp.setExpanded(true); exp.addExpansionListener(new ExpansionAdapter() { public void expansionStateChanged(ExpansionEvent e) { layout(); } }); }
private void initWerGroup() { werExp = new ExpandableComposite(this, ExpandableComposite.COMPACT); werExp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); werGroup = new Composite(werExp, SWT.SHADOW_ETCHED_IN); werGroup.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1)); // metadatagroup.setText("Document metadata"); werGroup.setLayout(new GridLayout(2, false)); refVersionChooser = new TranscriptVersionChooser("Reference:\n(Correct Text) ", werGroup, 0); refVersionChooser.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1)); hypVersionChooser = new TranscriptVersionChooser("Hypothesis:\n(HTR Text) ", werGroup, 0); hypVersionChooser.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1)); Label emptyLabel = new Label(werGroup,0); computeWerBtn = new Button(werGroup, SWT.PUSH); computeWerBtn.setText("Compare"); computeWerBtn.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, true, 2, 1)); computeWerBtn.setToolTipText("Compares the two selected transcripts and computes word error rate and character error rate."); // computeWerBtn.pack(); compareVersionsBtn = new Button(werGroup, SWT.PUSH); compareVersionsBtn.setText("Compare Versions in Textfile"); compareVersionsBtn.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, true, 2, 1)); compareVersionsBtn.setToolTipText("Shows the difference of the two selected versions"); werExp.setClient(werGroup); werExp.setText("Compute Accuracy"); Fonts.setBoldFont(werExp); werExp.setExpanded(true); werExp.addExpansionListener(new ExpansionAdapter() { public void expansionStateChanged(ExpansionEvent e) { layout(); } }); }
public IExpansionListener getExpansionListener() { if (this.formRebuildingListener == null) { this.formRebuildingListener = new ExpansionAdapter() { public void expansionStateChanged(ExpansionEvent e) { getManagedForm().reflow(true); } }; } return this.formRebuildingListener; }
@Override public void expansionStateChanged(ExpansionEvent e) { ExpandableComposite source = (ExpandableComposite) e.getSource(); updateSectionStyle(source); if (fIsBeingManaged) return; if (e.getState()) { try { fIsBeingManaged = true; for (Iterator<ExpandableComposite> iter = fSections.iterator(); iter.hasNext();) { ExpandableComposite composite = iter.next(); if (composite != source) composite.setExpanded(false); } } finally { fIsBeingManaged = false; } if (fLastOpenKey != null && fDialogSettingsStore != null) fDialogSettingsStore.setValue(fLastOpenKey, source.getText()); } else { if (!fIsBeingManaged && fLastOpenKey != null && fDialogSettingsStore != null) fDialogSettingsStore.setValue(fLastOpenKey, __NONE); } ExpandableComposite exComp = getParentExpandableComposite(source); if (exComp != null) exComp.layout(true, true); ScrolledPageContent parentScrolledComposite = getParentScrolledComposite(source); if (parentScrolledComposite != null) { parentScrolledComposite.reflow(true); } }
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()); } }); //fExpandables.add(excomposite); makeScrollableCompositeAware(excomposite); return excomposite; }
@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(); } } }); } }
/** * Expand the section and if the expansionNotifier is not null then call then notify * the expansion */ @Override public void setExpanded(boolean expanded) { super.setExpanded(expanded); if (expansionNotifier != null) expansionNotifier.expansionStateChanged(new ExpansionEvent(this, expanded)); }
/** * private constructor. */ public TabbedPropertySheetWidgetFactory(TabbedPropertySheetPage propertyPage) { super(Display.getCurrent()); this.page = propertyPage; sectionSizeChange = new ExpansionAdapter() { @Override public void expansionStateChanged(ExpansionEvent e) { page.getTabbedPropertyComposite().updatePageMinimumSize(); } }; }
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; }
@Override public void expansionStateChanged(ExpansionEvent e) { ExpandableComposite source= (ExpandableComposite) e.getSource(); updateSectionStyle(source); if (fIsBeingManaged) return; if (e.getState()) { try { fIsBeingManaged= true; for (Iterator<ExpandableComposite> iter= fSections.iterator(); iter.hasNext();) { ExpandableComposite composite= iter.next(); if (composite != source) composite.setExpanded(false); } } finally { fIsBeingManaged= false; } if (fLastOpenKey != null && fDialogSettingsStore != null) fDialogSettingsStore.setValue(fLastOpenKey, source.getText()); } else { if (!fIsBeingManaged && fLastOpenKey != null && fDialogSettingsStore != null) fDialogSettingsStore.setValue(fLastOpenKey, __NONE); } ExpandableComposite exComp= getParentExpandableComposite(source); if (exComp != null) exComp.layout(true, true); ScrolledPageContent parentScrolledComposite= getParentScrolledComposite(source); if (parentScrolledComposite != null) { parentScrolledComposite.reflow(true); } }
/** * Creates a new component. * * @param wizardPage */ public AdvancedSettingsComponent(final Composite parent, final ProjectImportConfiguration propectImportConfiguration, final boolean enableProjectNameTemplate, SimplerParametersWizardPage wizardPage) { super(parent, ExpandableComposite.COMPACT | ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED); this.wizardPage = wizardPage; setText("Advanced"); final Composite advancedComposite = new Composite(this, SWT.NONE); setClient(advancedComposite); addExpansionListener(new ExpansionAdapter() { public void expansionStateChanged(ExpansionEvent e) { Shell shell = parent.getShell(); Point minSize = shell.getMinimumSize(); shell.setMinimumSize(shell.getSize().x, minSize.y); shell.pack(); parent.layout(); shell.setMinimumSize(minSize); } }); GridLayout gridLayout = new GridLayout(); gridLayout.marginLeft = 11; gridLayout.numColumns = 2; advancedComposite.setLayout(gridLayout); createAdvancedSection(advancedComposite); }
public void createComponents(FallDTO fallDTO){ this.setBackground(UiDesk.getColor(UiDesk.COL_WHITE)); FormToolkit tk = UiDesk.getToolkit(); ScrolledForm form = tk.createScrolledForm(this); form.setBackground(UiDesk.getColor(UiDesk.COL_WHITE)); form.setLayoutData(SWTHelper.getFillGridData(1, true, 1, false)); Composite body = form.getBody(); GridLayout gd1 = new GridLayout(); gd1.marginWidth = 0; gd1.marginHeight = 0; body.setLayout(gd1); ExpandableComposite expandable = WidgetFactory.createExpandableComposite(tk, form, ""); //$NON-NLS-1$ expandable.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); expandable.setExpanded(false); expandable.setText("Fallangaben"); expandable.addExpansionListener(new ExpansionAdapter() { @Override public void expansionStateChanged(ExpansionEvent e){ invoiceComposite.updateScrollBars(); } }); Composite group = tk.createComposite(expandable, SWT.NONE); GridLayout gd = new GridLayout(2, false); gd.marginWidth = 0; gd.marginHeight = 0; group.setLayout(gd); group.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); expandable.setClient(group); fallDetailBlatt2 = new FallDetailBlatt2(group, fallDTO, true); GridData gd2 = new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1); gd2.heightHint = 340; fallDetailBlatt2.setLayoutData(gd2); }
/** * ExpandableComposite (Aufklapp-Feld) in der Form erzeugen * * @param client * das Element, das aufgeklappt werden soll * @param Text * Der Text, der auf dem Composite stehen soll */ public ExpandableComposite createExpandableComposite(Control client, String Text){ ExpandableComposite ret = tk.createExpandableComposite(form.getBody(), ExpandableComposite.TWISTIE); ret.setText(Text); client.setParent(ret); ret.setClient(client); ret.addExpansionListener(new ExpansionAdapter() { public void expansionStateChanged(ExpansionEvent e){ form.reflow(true); } }); return ret; }
public static ExpandableComposite createExpandableComposite(final FormToolkit t, final ScrolledForm f, String text){ ExpandableComposite ret = t.createExpandableComposite(f.getBody(), ExpandableComposite.TWISTIE); ret.setText(text); ret.addExpansionListener(new ExpansionAdapter() { public void expansionStateChanged(ExpansionEvent e){ f.reflow(true); } }); return ret; }
/** * Add a form to the supplied Composite. */ private Control createForm(Composite parent) { final FormToolkit toolkit = new FormToolkit(parent.getDisplay()); final ScrolledForm form = toolkit.createScrolledForm(parent); /* * For the life of me I can't understand why I have to supply * a GridData instance to the form object in order to get the form * to fill the dialog area. * * BTW, I only found this out through trial and error. */ form.setLayoutData(new GridData(GridData.FILL_BOTH)); TableWrapLayout layout = new TableWrapLayout(); layout.numColumns = 2; layout.horizontalSpacing = 15; layout.verticalSpacing = 10; form.getBody().setLayout(layout); form.getBody().setLayoutData(new TableWrapData( TableWrapData.FILL_GRAB, TableWrapData.FILL_GRAB, 1, 3)); for (Task item : items) { // add an expandable description of the task, with a pretty title ExpandableComposite ec = toolkit.createExpandableComposite(form.getBody(), ExpandableComposite.TREE_NODE | ExpandableComposite.CLIENT_INDENT); ec.setText(item.getTitle()); Label label = toolkit.createLabel(ec, item.getDescription(), SWT.WRAP); ec.setClient(label); ec.addExpansionListener(new ExpansionAdapter() { @Override public void expansionStateChanged(ExpansionEvent e) { form.reflow(true); } }); ec.setExpanded(true); ec.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB)); // add a combo box allowing the user to select the repair action to take createDecisionCombo(form.getBody(), item); } return parent; }
@Override public void expansionStateChanging(ExpansionEvent event) { // ignored }
@Override public void expansionStateChanged(ExpansionEvent event) { run(); }
/** * Create contents of the dialog. * @param parent */ @Override protected Control createDialogArea(Composite parent) { Composite container = (Composite) super.createDialogArea(parent); container.setLayout(new GridLayout(2, false)); iconLabel = new Label(container, 0); iconLabel.setImage(Images.getSystemImage(swtIcon)); messageText = new StyledText(container, SWT.FLAT | SWT.READ_ONLY | SWT.MULTI | SWT.WRAP | SWT.VERTICAL); messageText.setBackground(container.getBackground()); messageText.setText(message); messageText.setLayoutData(new GridData(GridData.FILL_BOTH)); hasDetails = !StringUtils.isEmpty(detailedMessage) || exception != null; if (hasDetails) { ec = new ExpandableComposite(container, ExpandableComposite.COMPACT); ec.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1)); ec.setLayout(new GridLayout()); exceptionText = new StyledText(ec, SWT.BORDER | SWT.MULTI | SWT.VERTICAL | SWT.WRAP); GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true); gd.heightHint = 800; exceptionText.setLayoutData(gd); String msg = ""; int i=0; if (!StringUtils.isEmpty(detailedMessage)) { msg = detailedMessage+"\n\n"; i = msg.length(); } String exceptionStr = exception==null ? "" : ExceptionUtil.printStackTrace(exception); String exceptionHeader = "Exception:\n"; if (!StringUtils.isEmpty(exceptionStr)) { msg += exceptionHeader; msg += exceptionStr; } exceptionText.setText(msg); if (!StringUtils.isEmpty(exceptionStr)) { TextStyle ts = new TextStyle(Fonts.createBoldFont(exceptionText.getFont()), exceptionText.getForeground(), exceptionText.getBackground()); StyleRange sr = new StyleRange(ts); sr.start = i; sr.length = exceptionHeader.length(); exceptionText.setStyleRange(sr); } ec.setClient(exceptionText); ec.setText("Details"); Fonts.setBoldFont(ec); ec.setExpanded(false); ec.addExpansionListener(new ExpansionAdapter() { public void expansionStateChanged(ExpansionEvent e) { updateSize(); } }); // getShell().pack(); } // getShell().setSize(getShell().computeSize(SWT.DEFAULT, getMinHeight())); // parent.pack(); // getShell().setSize(getShell().computeSize(SWT.DEFAULT, getMinHeight())); SWTUtil.centerShell(getShell()); // updateSize(); return container; }
private void initStyleSheetsWidget() { ExpandableComposite styleSheetExp = new ExpandableComposite(container, ExpandableComposite.COMPACT); styleSheetExp.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 2, 1)); Composite styleSheetGroup = new Composite(styleSheetExp, SWT.SHADOW_ETCHED_IN); // styleSheetGroup = new Group(textStyleGroup, SWT.NONE); // styleSheetGroup.setText("Stylesheets"); styleSheetGroup.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 2, 1)); styleSheetGroup.setLayout(new GridLayout(3, false)); styleSheetList = new org.eclipse.swt.widgets.List(styleSheetGroup, SWT.SINGLE | SWT.V_SCROLL | SWT.H_SCROLL); styleSheetList.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 3)); styleSheetList.pack(); int nrOfVisibleItems = 4; ((GridData)styleSheetList.getLayoutData()).heightHint = styleSheetList.getItemHeight()*nrOfVisibleItems; // Menu m = new Menu(textStyleGroup); // MenuItem mi = new MenuItem(m, 0); // mi.setText("Delete"); // styleSheetList.setMenu(m); Label l = new Label(styleSheetGroup, SWT.LEFT); l.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1)); l.setText("Name: "); styleSheetName = new Text(styleSheetGroup, SWT.LEFT | SWT.BORDER); styleSheetName.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1)); addAsStyleSheet = new Button(styleSheetGroup, SWT.PUSH); addAsStyleSheet.setLayoutData(new GridData(SWT.FILL, SWT.TOP, false, false, 2, 1)); addAsStyleSheet.setText("Add stylesheet"); deleteStyleSheet = new Button(styleSheetGroup, SWT.PUSH); deleteStyleSheet.setLayoutData(new GridData(SWT.FILL, SWT.TOP, false, false, 2, 1)); deleteStyleSheet.setText("Delete stylesheet"); // textStyleGroup.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1)); // styleSheetCombo = createComboWithLabel(textStyleGroup, "Style sheet", SWT.DROP_DOWN | SWT.READ_ONLY); // styleSheetList = createListWithLabel(styleSheetGroup, "Style sheet", SWT.SINGLE | SWT.V_SCROLL); // styleSheetList.setSize(styleSheetList.computeSize(SWT.DEFAULT, styleSheetList.getItemHeight()*3)); // styleSheetList.setSize(styleSheetList.computeSize(SWT.DEFAULT, 10)); loadStyleSheets(); styleSheetExp.setClient(styleSheetGroup); styleSheetExp.setText("Style sheets"); styleSheetExp.setExpanded(false); styleSheetExp.addExpansionListener(new ExpansionAdapter() { public void expansionStateChanged(ExpansionEvent e) { container.layout(); } }); }
private void createAdvancedOptions(Composite parent) { IPixelConverter converter = PixelConverterFactory.createPixelConverter(JFaceResources.getDialogFont()); // Expandable panel for advanced options final ExpandableComposite expandPanel = new ExpandableComposite(parent, SWT.NONE, ExpandableComposite.TWISTIE | ExpandableComposite.CLIENT_INDENT); expandPanel.setText("Advanced"); expandPanel.setExpanded(false); expandPanel.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT)); GridData expandPanelGridData = new GridData(GridData.FILL, GridData.FILL, true, false, 3, 1); expandPanelGridData.verticalIndent = converter.convertHeightInCharsToPixels(1); expandPanel.setLayoutData(expandPanelGridData); expandPanel.addExpansionListener(new ExpansionAdapter() { @Override public void expansionStateChanged(ExpansionEvent e) { Shell shell = getShell(); shell.setLayoutDeferred(true); // Suppress redraw flickering Point size = shell.getSize(); int shellHeightDeltaOnExpand = advancedContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT).y; if (expandPanel.isExpanded()) { shell.setSize(size.x, size.y + shellHeightDeltaOnExpand); } else { shell.setSize(size.x, size.y - shellHeightDeltaOnExpand); } shell.layout(true, true); shell.setLayoutDeferred(false); } }); advancedContainer = new Composite(expandPanel, SWT.NONE); advancedContainer.setLayoutData(new GridData()); advancedContainer.setFont(parent.getFont()); advancedContainer.setLayout(new GridLayout(1, false)); expandPanel.setClient(advancedContainer); // Additional compiler parameters field SWTFactory.createLabel(advancedContainer, "Additional compiler arguments:", 1); extraArgsText = SWTUtilities.createMultilineTextbox(advancedContainer, SWT.BORDER, false); GridData extraArgsGridData = new GridData(GridData.FILL_HORIZONTAL); extraArgsGridData.heightHint = converter.convertHeightInCharsToPixels(5); extraArgsText.setLayoutData(extraArgsGridData); // Additional VM args field SWTFactory.createLabel(advancedContainer, "VM arguments:", 1); vmArgsText = SWTUtilities.createMultilineTextbox(advancedContainer, SWT.BORDER, false); GridData vmArgsGridData = new GridData(GridData.FILL_HORIZONTAL); vmArgsGridData.heightHint = converter.convertHeightInCharsToPixels(5); vmArgsText.setLayoutData(vmArgsGridData); }
@Override public void expansionStateChanged(ExpansionEvent e) { ExpandableComposite src = (ExpandableComposite) e.getSource(); CoreHub.localCfg.set(KEY_PATIENTENBLATT + src.getText(), src.isExpanded()); scrldfrm.reflow(true); }
@Override public void expansionStateChanged(ExpansionEvent e){ form.reflow(true); }