Java Code Examples for org.eclipse.ui.forms.widgets.ScrolledForm#getBody()
The following examples show how to use
org.eclipse.ui.forms.widgets.ScrolledForm#getBody() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SankeyMiniViewAction.java From olca-app with Mozilla Public License 2.0 | 6 votes |
private Composite createForm(Composite parent) { FormToolkit toolkit = new FormToolkit(Display.getCurrent()); ScrolledForm form = toolkit.createScrolledForm(parent); Composite body = form.getBody(); body.setLayout(new FillLayout()); toolkit.paintBordersFor(body); SashForm sash = new SashForm(body, SWT.VERTICAL); toolkit.adapt(sash, true, true); Section section = toolkit.createSection(sash, ExpandableComposite.NO_TITLE | ExpandableComposite.EXPANDED); section.setText(""); Composite composite = toolkit.createComposite(section, SWT.NONE); composite.setLayout(new GridLayout()); section.setClient(composite); toolkit.paintBordersFor(composite); return composite; }
Example 2
Source File: DemoGeometryPage.java From ice with Eclipse Public License 1.0 | 6 votes |
/** * <p> * Provides the page with the geometryApplication's information to display * geometry. * </p> * * @param managedForm * the managed form that handles the page */ @Override public void createFormContent(IManagedForm managedForm) { // Local Declarations final ScrolledForm form = managedForm.getForm(); GridLayout layout = new GridLayout(); // Setup the layout and layout data layout.numColumns = 1; form.getBody().setLayoutData( new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); form.getBody().setLayout(new FillLayout()); // Just create some text and say hello Label geometryText = new Label(form.getBody(), SWT.FLAT); geometryText.setText("Draw something based on the geometry."); return; }
Example 3
Source File: ReportViewer.java From olca-app with Mozilla Public License 2.0 | 6 votes |
@Override protected void createFormContent(IManagedForm mform) { ScrolledForm form = mform.getForm(); Composite comp = form.getBody(); comp.setLayout(new FillLayout()); try { Browser b = new Browser(comp, SWT.NONE); b.setJavascriptEnabled(true); UI.onLoaded(b, HtmlFolder.getUrl("report.html"), () -> { Gson gson = new Gson(); String json = gson.toJson(report); String command = "setData(" + json + ")"; b.execute(command); }); } catch (Exception e) { Logger log = LoggerFactory.getLogger(getClass()); log.error("failed to load report in browser", e); } }
Example 4
Source File: DiffEditorDialog.java From olca-app with Mozilla Public License 2.0 | 6 votes |
@Override protected void createFormContent(IManagedForm mform) { String title = M.Diff; if (this.title != null) title += ": " + this.title; ScrolledForm form = UI.formHeader(mform, title); if (logo != null) form.setImage(logo); FormToolkit toolkit = mform.getToolkit(); Composite body = form.getBody(); UI.gridLayout(body, 1, 0, 0); toolkit.paintBordersFor(body); UI.gridData(body, true, true); if (editMode) editor = DiffEditor.forEditing(body, toolkit); else editor = DiffEditor.forViewing(body, toolkit); editor.initialize(root, labelProvider, dependencyResolver, action); UI.gridData(editor, true, true); form.reflow(true); }
Example 5
Source File: CommitDialog.java From olca-app with Mozilla Public License 2.0 | 5 votes |
@Override protected void createFormContent(IManagedForm mform) { ScrolledForm form = UI.formHeader(mform, M.CommitChangesToRepository); FormToolkit toolkit = mform.getToolkit(); Composite body = form.getBody(); body.setLayout(new GridLayout()); toolkit.paintBordersFor(body); UI.gridData(body, true, true); createCommitMessage(body, toolkit); createModelViewer(body, toolkit); form.reflow(true); viewer.setInput(Collections.singleton(node)); viewer.setSelection(initialSelection); }
Example 6
Source File: StartPage.java From olca-app with Mozilla Public License 2.0 | 5 votes |
@Override protected void createFormContent(IManagedForm mform) { ScrolledForm form = mform.getForm(); Composite comp = form.getBody(); comp.setLayout(new FillLayout()); Browser browser = new Browser(comp, SWT.NONE); browser.setJavascriptEnabled(true); // handles link clicks and opens them in the browser UI.bindFunction(browser, "onOpenLink", (args) -> { if (args == null || args.length == 0) return null; Object s = args[0]; if (!(s instanceof String)) return null; Desktop.browse(s.toString()); return null; }); // handles click on the "native library hint" UI.bindFunction(browser, "onLibHintClick", (args) -> { LibraryDownload.open(); return null; }); // set the start page configuration UI.onLoaded(browser, HtmlFolder.getUrl("home.html"), () -> { HashMap<String, Object> config = new HashMap<>(); config.put("version", getVersion()); String lang = AppArg.get("nl"); config.put("lang", Strings.nullOrEmpty(lang) ? "en" : lang); config.put("showLibHint", !Julia.isWithUmfpack()); String json = new Gson().toJson(config); browser.execute("setData(" + json + ")"); }); }
Example 7
Source File: LibraryResultDialog.java From olca-app with Mozilla Public License 2.0 | 5 votes |
@Override protected void createFormContent(IManagedForm mform) { ScrolledForm form = UI.formHeader(mform, M.LibraryDataSets); FormToolkit toolkit = mform.getToolkit(); Composite body = form.getBody(); body.setLayout(new GridLayout()); toolkit.paintBordersFor(body); UI.gridData(body, true, true); String description = M.RecognizedLibraryDatasetsDescription; Label label = toolkit.createLabel(body, description, SWT.WRAP); UI.gridData(label, true, false).widthHint = 750; Viewer viewer = new Viewer(body); form.reflow(true); viewer.setInput(restrictions); }
Example 8
Source File: ReferencesResultDialog.java From olca-app with Mozilla Public License 2.0 | 5 votes |
@Override protected void createFormContent(IManagedForm mform) { ScrolledForm form = UI.formHeader(mform, M.CommitReferenceNotice); FormToolkit toolkit = mform.getToolkit(); Composite body = form.getBody(); body.setLayout(new GridLayout()); toolkit.paintBordersFor(body); UI.gridData(body, true, true); createModelViewer(body, toolkit); form.reflow(true); viewer.setInput(Collections.singleton(node)); Set<FileReference> initialSelection = getNewElements(node); viewer.setSelection(initialSelection); }
Example 9
Source File: TextDiffDialog.java From olca-app with Mozilla Public License 2.0 | 5 votes |
@Override protected void createFormContent(IManagedForm mform) { String property = PropertyLabels.get(ModelUtil.getType(node.parent.getElement()), node.property); ScrolledForm form = UI.formHeader(mform, "Compare - " + property); Composite body = form.getBody(); UI.gridLayout(body, 2, 0, 0).makeColumnsEqualWidth = true; UI.gridData(body, true, true); ModelLabelProvider label = new ModelLabelProvider(); String leftText = label.getValueText(node, Site.LOCAL); String rightText = label.getValueText(node, Site.REMOTE); createText(body, leftText, rightText, Site.LOCAL); createText(body, rightText, leftText, Site.REMOTE); }
Example 10
Source File: DataQualityShell.java From olca-app with Mozilla Public License 2.0 | 5 votes |
private void create(boolean withUncertainty) { ScrolledForm form = toolkit.createScrolledForm(this); Composite root = form.getBody(); UI.gridLayout(root, 1); createHeader(root); createSeparator(root); createContent(root); createSeparator(root); createFooter(root, withUncertainty); }
Example 11
Source File: DiffDialog.java From olca-app with Mozilla Public License 2.0 | 5 votes |
@Override protected void createFormContent(IManagedForm mform) { ScrolledForm form = UI.formHeader(mform, M.Diff); FormToolkit toolkit = mform.getToolkit(); Composite body = form.getBody(); body.setLayout(new GridLayout()); toolkit.paintBordersFor(body); UI.gridData(body, true, true); viewer = new FetchDiffViewer(body, loader); form.reflow(true); viewer.setInput(Collections.singletonList(rootNode)); viewer.setOnMerge(() -> getButton(OK).setEnabled(!viewer.hasConflicts())); }
Example 12
Source File: InvoiceCorrectionView.java From elexis-3-core with Eclipse Public License 1.0 | 5 votes |
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); }
Example 13
Source File: HeaderPage.java From uima-uimaj with Apache License 2.0 | 5 votes |
/** * Setup 2 column layout not sash. * * @param managedForm the managed form * @param equalWidth the equal width * @return the form 2 panel */ public Form2Panel setup2ColumnLayoutNotSash(IManagedForm managedForm, boolean equalWidth) { final ScrolledForm sform = managedForm.getForm(); final Composite form = sform.getBody(); GridLayout layout = new GridLayout(2, equalWidth); form.setLayout(layout); form.setLayoutData(new GridData(GridData.FILL_BOTH)); leftPanel = newComposite(form); rightPanel = newComposite(form); // strategy for setting size hints of right and left panels // Why set hints? Because they make the inner containing things // scroll horiz. if they're too wide (useful for aggregates having // long names). // What hint to set? The hint should be the smallest size you want // with child scrolling, before the tabbed page container itself // gets a scroll bar. // When in the life cycle to do this? Only need to do it once, but // after the Grid Layout has happened. This can be the first resizing // event (learned this by debugging) sform.addListener(SWT.Resize, new Listener() { @Override public void handleEvent(Event event) { float col1CurrentWidth = leftPanel.getSize().x; float col2CurrentWidth = rightPanel.getSize().x; final int minLeftPanelWidth = 250; // in pels final int minRightPanelWidth = (int) (col2CurrentWidth * minLeftPanelWidth / col1CurrentWidth); ((GridData) leftPanel.getLayoutData()).widthHint = minLeftPanelWidth; ((GridData) rightPanel.getLayoutData()).widthHint = minRightPanelWidth; sform.removeListener(SWT.Resize, this); // only do this one time } }); return new Form2Panel(form, leftPanel, rightPanel); }
Example 14
Source File: HeaderPage.java From uima-uimaj with Apache License 2.0 | 5 votes |
/** * Setup 2 column layout. * * @param managedForm the managed form * @param w1 the w 1 * @param w2 the w 2 * @return the form 2 panel */ public Form2Panel setup2ColumnLayout(IManagedForm managedForm, int w1, int w2) { final ScrolledForm sform = managedForm.getForm(); final Composite form = sform.getBody(); form.setLayout(new GridLayout(1, false)); // this is required ! Composite xtra = toolkit.createComposite(form); xtra.setLayout(new GridLayout(1, false)); xtra.setLayoutData(new GridData(GridData.FILL_BOTH)); Control c = xtra.getParent(); while (!(c instanceof ScrolledComposite)) c = c.getParent(); ((GridData) xtra.getLayoutData()).widthHint = c.getSize().x; ((GridData) xtra.getLayoutData()).heightHint = c.getSize().y; sashForm = new SashForm(xtra, SWT.HORIZONTAL); sashForm.setLayoutData(new GridData(GridData.FILL_BOTH)); // needed leftPanel = newComposite(sashForm); ((GridLayout) leftPanel.getLayout()).marginHeight = 5; ((GridLayout) leftPanel.getLayout()).marginWidth = 5; rightPanel = newComposite(sashForm); ((GridLayout) rightPanel.getLayout()).marginHeight = 5; ((GridLayout) rightPanel.getLayout()).marginWidth = 5; sashForm.setWeights(new int[] { w1, w2 }); leftPanelPercent = (float) w1 / (float) (w1 + w2); rightPanelPercent = (float) w2 / (float) (w1 + w2); rightPanel.addControlListener(new ControlAdapter() { @Override public void controlResized(ControlEvent e) { setSashFormWidths(); } }); return new Form2Panel(form, leftPanel, rightPanel); }
Example 15
Source File: HeaderPage.java From uima-uimaj with Apache License 2.0 | 5 votes |
/** * Setup 2 column grid. * * @param managedForm the managed form * @param equalWidth the equal width * @return the composite */ // this method creates no new composites. public Composite setup2ColumnGrid(IManagedForm managedForm, boolean equalWidth) { final ScrolledForm sform = managedForm.getForm(); final Composite form = sform.getBody(); GridLayout layout = new GridLayout(2, equalWidth); form.setLayout(layout); form.setLayoutData(new GridData(GridData.FILL_BOTH)); return form; }
Example 16
Source File: HeaderPage.java From uima-uimaj with Apache License 2.0 | 5 votes |
/** * Setup 1 column layout. * * @param managedForm the managed form * @return the composite */ public Composite setup1ColumnLayout(IManagedForm managedForm) { final ScrolledForm sform = managedForm.getForm(); final Composite form = sform.getBody(); form.setLayout(new GridLayout(1, false)); // this is required ! Composite xtra = toolkit.createComposite(form); xtra.setLayout(new GridLayout(1, false)); xtra.setLayoutData(new GridData(GridData.FILL_BOTH)); Control c = form.getParent(); while (!(c instanceof ScrolledComposite)) c = c.getParent(); ((GridData) xtra.getLayoutData()).widthHint = c.getSize().x; return xtra; }
Example 17
Source File: ICESectionPage.java From ice with Eclipse Public License 1.0 | 5 votes |
/** * <p> * This operation creates ICETableComponentSectionParts for each * TableComponent in the list of TableComponents and figures out exactly how * they should be arranged and span across the page based on their * properties. * </p> * */ private void createTableComponentSections() { // Get the parent form and the ToolKit to create decorated Sections. final ScrolledForm scrolledForm = managedFormRef.getForm(); final FormToolkit formToolkit = managedFormRef.getToolkit(); // Each TableComponent will get is own Section that occupies a single // row in the parent GridLayout (that is, the Form's GridLayout). The // rows will grab all excess vertical and horizontal space available in // the Form. // Create the TableComponent Sections. Composite container = scrolledForm.getBody(); for (int i = 0; i < tableComponents.size(); i++) { // Create a new Section for the current TableComponent. TableComponent tableComponent = tableComponents.get(i); Section section = formToolkit.createSection(container, ExpandableComposite.TITLE_BAR | Section.DESCRIPTION | ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED); // Each Section should fill all available horizontal and vertical // space in the parent GridLayout, but it should only grab excess // horizontal space. section.setLayoutData( new GridData(SWT.FILL, SWT.FILL, true, false)); // To populate the Section, use an ICETableComponentSectionPart. ICETableComponentSectionPart sectionPart; sectionPart = new ICETableComponentSectionPart(section, editor, managedFormRef); sectionPart.setTableComponent(tableComponent); sectionPart.renderSection(); // Add the part to the ManagedForm's update lifecycle. managedFormRef.addPart(sectionPart); } return; }
Example 18
Source File: UI.java From olca-app with Mozilla Public License 2.0 | 5 votes |
public static Composite formBody(ScrolledForm form, FormToolkit tk) { Composite body = form.getBody(); GridLayout layout = new GridLayout(); layout.marginRight = 10; layout.marginLeft = 10; layout.horizontalSpacing = 10; layout.marginBottom = 10; layout.marginTop = 10; layout.verticalSpacing = 10; layout.numColumns = 1; body.setLayout(layout); tk.paintBordersFor(body); gridData(body, true, true); return body; }
Example 19
Source File: BasicFormPage.java From tlaplus with MIT License | 4 votes |
/** * Called during FormPage life cycle and delegates the form creation * to three methods {@link BasicFormPage#createBodyContent(IManagedForm)}, * {@link BasicFormPage#loadData()}, {@link BasicFormPage#pageInitializationComplete()} */ protected void createFormContent(IManagedForm managedForm) { ScrolledForm formWidget = managedForm.getForm(); formWidget.setText(getTitle()); if (imagePathTemplate != null) { // Show the given image left of the form page's title and beneath the tab // bar. E.g. the main model page displays three sliders left of its "Model // Overview" label. formWidget.setImage(createRegisteredImage(24)); } Composite body = formWidget.getBody(); FormToolkit toolkit = managedForm.getToolkit(); toolkit.decorateFormHeading(formWidget.getForm()); /* * The head client is the second row of the header section, below the title; if we don't create this * with 'NO_FOCUS' then the toolbar will always take focus on a form page that gains focus. */ ToolBar headClientTB = new ToolBar(formWidget.getForm().getHead(), SWT.HORIZONTAL | SWT.NO_FOCUS); headClientTBM = new ToolBarManager(headClientTB); // run button headClientTBM.add(new DynamicContributionItem(new RunAction())); // validate button headClientTBM.add(new DynamicContributionItem(new GenerateAction())); // stop button headClientTBM.add(new DynamicContributionItem(new StopAction())); // refresh the head client toolbar headClientTBM.update(true); formWidget.getForm().setHeadClient(headClientTB); // setup body layout body.setLayout(getBodyLayout()); // create the body of the page createBodyContent(managedForm); super.createFormContent(managedForm); try { // load data from the model //TODO decouple from UI thread (causes I/O) loadData(); } catch (CoreException e) { TLCUIActivator.getDefault().logError("Error loading data from the model into the form fields", e); } // check the model is-running state refresh(); // finalizes the page construction // activates the change listeners pageInitializationComplete(); TLCUIHelper.setHelp(getPartControl(), helpId); getManagedForm().getForm().getForm().addMessageHyperlinkListener(errorMessageHyperLinkListener); }
Example 20
Source File: OpenMiniatureViewAction.java From olca-app with Mozilla Public License 2.0 | 4 votes |
@Override protected Control createContents(final Composite parent) { FormToolkit toolkit = new FormToolkit(Display.getCurrent()); ScrolledForm scrolledForm = toolkit.createScrolledForm(parent); Composite body = scrolledForm.getBody(); body.setLayout(new FillLayout()); toolkit.paintBordersFor(body); SashForm sashForm = new SashForm(body, SWT.VERTICAL); toolkit.adapt(sashForm, true, true); Section categorySection = toolkit .createSection(sashForm, ExpandableComposite.NO_TITLE | ExpandableComposite.EXPANDED); categorySection.setText(""); Composite composite = toolkit.createComposite(categorySection, SWT.NONE); composite.setLayout(new GridLayout()); categorySection.setClient(composite); toolkit.paintBordersFor(composite); final Scale scale = new Scale(composite, SWT.NONE); scale.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); final double[] values = GraphConfig.ZOOM_LEVELS; final int increment = 100 / (values.length - 1); scale.setIncrement(increment); scale.setMinimum(0); scale.setMaximum(100); Controls.onSelect(scale, (e) -> { zoomManager.setZoom(values[scale.getSelection() / increment]); }); scale.setSelection(increment * (values.length - 1) / 2); Canvas canvas = new Canvas(composite, SWT.BORDER); canvas.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); lws = new LightweightSystem(canvas); thumbnail = new ScrollableThumbnail(port); thumbnail.setSource(figure); lws.setContents(thumbnail); disposeListener = new DisposeListener() { @Override public void widgetDisposed(final DisposeEvent e) { if (thumbnail != null) { thumbnail.deactivate(); thumbnail = null; } if (control != null && !control.isDisposed()) control.removeDisposeListener(disposeListener); close(); } }; control.addDisposeListener(disposeListener); return super.createContents(parent); }