Java Code Examples for org.eclipse.ui.forms.widgets.ScrolledForm#reflow()

The following examples show how to use org.eclipse.ui.forms.widgets.ScrolledForm#reflow() . 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: InfoPage.java    From olca-app with Mozilla Public License 2.0 6 votes vote down vote up
@Override
protected void createFormContent(IManagedForm mform) {
	ContributionResult result = editor.result;
	ScrolledForm form = UI.formHeader(mform,
			Labels.name(editor.setup.productSystem),
			Images.get(editor.result));
	FormToolkit tk = mform.getToolkit();
	Composite body = UI.formBody(form, tk);
	InfoSection.create(body, tk, editor.setup);
	if (editor.dqResult != null) {
		new DQInfoSection(body, tk, result, editor.dqResult);
	}
	if (result.hasImpactResults()) {
		ContributionChartSection.forImpacts(editor).render(body, tk);
	}
	ContributionChartSection.forFlows(editor).render(body, tk);
	form.reflow(true);
}
 
Example 2
Source File: InfoPage.java    From olca-app with Mozilla Public License 2.0 6 votes vote down vote up
@Override
protected void createFormContent(IManagedForm mform) {
	ScrolledForm form = UI.formHeader(this);
	FormToolkit tk = mform.getToolkit();
	Composite body = UI.formBody(form, tk);
	InfoSection info = new InfoSection(getEditor());
	info.render(body, tk);
	checkBox(info.getContainer(),
			M.InfrastructureProcess, "infrastructureProcess");
	createButtons(info.getContainer(), tk);
	createTimeSection(body, tk);
	createGeographySection(body, tk);
	createTechnologySection(body, tk);
	new ImageSection(getEditor(), tk, body);
	createDqSection(body, tk);
	body.setFocus();
	form.reflow(true);
}
 
Example 3
Source File: LocationPage.java    From olca-app with Mozilla Public License 2.0 6 votes vote down vote up
@Override
protected void createFormContent(IManagedForm mform) {
	ScrolledForm form = UI.formHeader(mform,
			Labels.name(setup.productSystem),
			Images.get(result));
	FormToolkit tk = mform.getToolkit();
	Composite body = UI.formBody(form, tk);
	createCombos(body, tk);
	SashForm sash = new SashForm(body, SWT.VERTICAL);
	UI.gridData(sash, true, true);
	tk.adapt(sash);
	createTree(sash, tk);
	map = ResultMap.on(sash, tk);
	form.reflow(true);
	refreshSelection();
}
 
Example 4
Source File: DiffEditorDialog.java    From olca-app with Mozilla Public License 2.0 6 votes vote down vote up
@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: TotalImpactResultPage.java    From olca-app with Mozilla Public License 2.0 6 votes vote down vote up
@Override
protected void createFormContent(IManagedForm mform) {
	ScrolledForm form = UI.formHeader(mform,
			Labels.name(setup.productSystem),
			Images.get(result));
	toolkit = mform.getToolkit();
	Composite body = UI.formBody(form, toolkit);
	Section section = UI.section(body, toolkit, M.ImpactAnalysis + ": "
			+ Labels.name(setup.impactMethod));
	UI.gridData(section, true, true);
	Composite client = toolkit.createComposite(section);
	section.setClient(client);
	UI.gridLayout(client, 1);
	createOptions(client);
	createTree(client);
	spinner.register(viewer);
	form.reflow(true);
}
 
Example 6
Source File: ImpactPage.java    From olca-app with Mozilla Public License 2.0 6 votes vote down vote up
@Override
protected void createFormContent(IManagedForm mform) {
	ScrolledForm form = UI.formHeader(this);
	FormToolkit tk = mform.getToolkit();
	Composite body = UI.formBody(form, tk);
	TableViewer table = Tables.createViewer(body,
			M.ImpactCategory, M.Location,
			M.ImpactFactor, M.Unit);
	table.setLabelProvider(new Label());
	table.setInput(loadFactors());
	Tables.bindColumnWidths(table, 0.4, 0.2, 0.2, 0.2);

	Action onOpen = Actions.onOpen(() -> {
		Factor f = Viewers.getFirstSelected(table);
		if (f != null) {
			App.openEditor(f.impact);
		}
	});
	Actions.bind(table, onOpen);
	Tables.onDoubleClick(table, e -> onOpen.run());
	form.reflow(true);
}
 
Example 7
Source File: ImpactFactorPage.java    From olca-app with Mozilla Public License 2.0 6 votes vote down vote up
@Override
protected void createFormContent(IManagedForm mform) {
	ScrolledForm form = UI.formHeader(this);
	FormToolkit tk = mform.getToolkit();
	Composite body = UI.formBody(form, tk);
	Section section = UI.section(body, tk, M.ImpactFactors);
	UI.gridData(section, true, true);
	Composite client = tk.createComposite(section);
	section.setClient(client);
	UI.gridLayout(client, 1);
	render(client, section);
	List<ImpactFactor> factors = impact().impactFactors;
	sortFactors(factors);
	viewer.setInput(factors);
	form.reflow(true);
}
 
Example 8
Source File: GeoPage.java    From olca-app with Mozilla Public License 2.0 5 votes vote down vote up
@Override
protected void createFormContent(IManagedForm mform) {
	ScrolledForm form = UI.formHeader(this);
	FormToolkit tk = mform.getToolkit();
	Composite body = UI.formBody(form, tk);
	setupSection(body, tk);
	paramSection = new GeoParamSection(this);
	paramSection.drawOn(body, tk);
	flowSection = new GeoFlowSection(this);
	flowSection.drawOn(body, tk);
	form.reflow(true);
}
 
Example 9
Source File: ReportEditorPage.java    From olca-app with Mozilla Public License 2.0 5 votes vote down vote up
@Override
protected void createFormContent(IManagedForm managedForm) {
	ScrolledForm form = UI.formHeader(this);
	tk = managedForm.getToolkit();
	Composite body = UI.formBody(form, tk);
	createInfoSection(body);
	createAddButton(body);
	sectionList = new SectionList(editor, body, form, tk);
	form.reflow(true);
}
 
Example 10
Source File: GroupPage.java    From olca-app with Mozilla Public License 2.0 5 votes vote down vote up
@Override
protected void createFormContent(IManagedForm mform) {
	ScrolledForm form = UI.formHeader(mform,
			Labels.name(setup.productSystem),
			Images.get(result));
	FormToolkit toolkit = mform.getToolkit();
	Composite body = UI.formBody(form, toolkit);
	createGroupingSection(toolkit, body);
	resultSection = new GroupResultSection(groups, result);
	resultSection.render(body, toolkit);
	form.reflow(true);
}
 
Example 11
Source File: ImpactMethodInfoPage.java    From olca-app with Mozilla Public License 2.0 5 votes vote down vote up
@Override
protected void createFormContent(IManagedForm mform) {
	ScrolledForm form = UI.formHeader(this);
	FormToolkit tk = mform.getToolkit();
	Composite body = UI.formBody(form, tk);
	InfoSection info = new InfoSection(getEditor());
	info.render(body, tk);
	createIndicatorTable(tk, body);
	body.setFocus();
	form.reflow(true);
}
 
Example 12
Source File: ImpactCategoryEditor.java    From olca-app with Mozilla Public License 2.0 5 votes vote down vote up
@Override
protected void createFormContent(IManagedForm mform) {
	ScrolledForm form = UI.formHeader(this);
	FormToolkit toolkit = mform.getToolkit();
	Composite body = UI.formBody(form, toolkit);
	InfoSection info = new InfoSection(getEditor());
	info.render(body, toolkit);
	Composite comp = info.getContainer();
	text(comp, M.ReferenceUnit, "referenceUnit");
	body.setFocus();
	form.reflow(true);
}
 
Example 13
Source File: ICEScrolledPropertiesBlock.java    From ice with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * <p>
 * This operation creates actions in the toolbar for the block.
 * </p>
 * 
 * @param managedForm
 *            <p>
 *            The parent Form
 *            </p>
 */
@Override
protected void createToolBarActions(IManagedForm managedForm) {
	final ScrolledForm form = managedForm.getForm();
	Action haction = new Action("Horizontal Orientation",
			IAction.AS_RADIO_BUTTON) {
		@Override
		public void run() {
			sashForm.setOrientation(SWT.HORIZONTAL);
			form.reflow(true);
		}
	};
	haction.setChecked(true);
	haction.setToolTipText("Set Details to the Right of Masters");
	Action vaction = new Action("Vertical Orientation",
			IAction.AS_RADIO_BUTTON) {
		@Override
		public void run() {
			sashForm.setOrientation(SWT.VERTICAL);
			form.reflow(true);
		}
	};
	vaction.setChecked(false);
	vaction.setToolTipText("Set Details Below Masters");
	form.getToolBarManager().add(haction);
	form.getToolBarManager().add(vaction);
}
 
Example 14
Source File: MappingPage.java    From olca-app with Mozilla Public License 2.0 5 votes vote down vote up
@Override
protected void createFormContent(IManagedForm mform) {
	ScrolledForm form = UI.formHeader(mform, "Flow mapping");
	FormToolkit tk = mform.getToolkit();
	Composite body = UI.formBody(form, tk);
	createInfoSection(tk, body);
	createTable(body, tk);
	form.reflow(true);
}
 
Example 15
Source File: ProcessResultPage.java    From olca-app with Mozilla Public License 2.0 5 votes vote down vote up
@Override
protected void createFormContent(IManagedForm mform) {
	toolkit = mform.getToolkit();
	ScrolledForm form = UI.formHeader(mform,
			Labels.name(setup.productSystem),
			Images.get(result));
	Composite body = UI.formBody(form, toolkit);
	createFlowSection(body);
	if (result.hasImpactResults())
		createImpactSection(body);
	form.reflow(true);
	setInputs();
}
 
Example 16
Source File: LibraryResultDialog.java    From olca-app with Mozilla Public License 2.0 5 votes vote down vote up
@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 17
Source File: CommitEntryDialog.java    From olca-app with Mozilla Public License 2.0 5 votes vote down vote up
@Override
protected void createFormContent(IManagedForm mform) {
	ScrolledForm form = UI.formHeader(mform, M.ChangesToBeFetched);
	FormToolkit toolkit = mform.getToolkit();
	Composite body = form.getBody();
	body.setLayout(new GridLayout());
	toolkit.paintBordersFor(body);
	UI.gridData(body, true, true);
	CommitEntryViewer viewer = new CommitEntryViewer(body, client);
	form.reflow(true);
	viewer.setInput(commits);
}
 
Example 18
Source File: CommitDialog.java    From olca-app with Mozilla Public License 2.0 5 votes vote down vote up
@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 19
Source File: HeaderPageWithSash.java    From uima-uimaj with Apache License 2.0 5 votes vote down vote up
/**
 * Creates the tool bar actions.
 *
 * @param managedForm the managed form
 */
protected void createToolBarActions(IManagedForm managedForm) {
  final ScrolledForm form = managedForm.getForm();

  haction = new Action("hor", IAction.AS_RADIO_BUTTON) { //$NON-NLS-1$
    @Override
    public void run() {
      sashForm.setOrientation(SWT.HORIZONTAL);
      form.reflow(true);
    }
  };
  haction.setChecked(true);
  haction.setToolTipText("Horizontal Orientation");
  TAEConfiguratorPlugin instance = TAEConfiguratorPlugin.getDefault();
  haction.setImageDescriptor(instance
          .getImageDescriptor(TAEConfiguratorPlugin.IMAGE_TH_HORIZONTAL));
  haction.setDisabledImageDescriptor(instance
          .getImageDescriptor(TAEConfiguratorPlugin.IMAGE_TH_HORIZONTAL));

  vaction = new Action("ver", IAction.AS_RADIO_BUTTON) { //$NON-NLS-1$
    @Override
    public void run() {
      sashForm.setOrientation(SWT.VERTICAL);
      form.reflow(true);
    }
  };
  vaction.setChecked(false);
  vaction.setToolTipText("Vertical Orientation");
  vaction.setImageDescriptor(instance
          .getImageDescriptor(TAEConfiguratorPlugin.IMAGE_TH_VERTICAL));
  vaction.setDisabledImageDescriptor(instance
          .getImageDescriptor(TAEConfiguratorPlugin.IMAGE_TH_VERTICAL));
  form.getToolBarManager().add(haction);
  form.getToolBarManager().add(vaction);
  form.updateToolBar();
  maybeInitialize(managedForm);
}
 
Example 20
Source File: CommentsPage.java    From olca-app with Mozilla Public License 2.0 4 votes vote down vote up
@Override
protected void createFormContent(IManagedForm mForm) {
	String title = getTitle();
	Image image = null;
	if (model != null) {
		title += ": " + model.name;
		image = Images.get(model);
	}
	ScrolledForm form = UI.formHeader(mForm, title, image);
	Composite body = UI.formBody(form, mForm.getToolkit());
	body.setLayout(new FillLayout());
	Browser browser = new Browser(body, SWT.NONE);
	browser.setJavascriptEnabled(true);

	UI.bindFunction(browser, "getLabel", (args) -> {
		if (args == null || args.length == 0)
			return "";
		Object path = args[0];
		if (path == null)
			return "";
		return CommentLabels.get(path.toString());
	});

	UI.bindFunction(browser, "openModel", (args) -> {
		if (args == null || args.length < 2)
			return null;
		Object type = args[0];
		Object refId = args[1];
		if (type == null || refId == null)
			return null;
		App.openEditor(getDescriptor(
				ModelType.valueOf(type.toString()),
				refId.toString()));
		return null;
	});

	UI.onLoaded(browser, HtmlFolder.getUrl("comments.html"), () -> {
		Gson gson = new Gson();
		for (Comment comment : comments) {
			String fullPath = getFullPath(comment);
			fullPath = fullPath != null
					? "'" + fullPath + "'"
					: fullPath;
			browser.execute("add(" + gson.toJson(comment)
					+ ", false, " + fullPath + ");");
		}
	});

	form.reflow(true);
}