diff org.eclipse.ui.forms/src/org/eclipse/ui/forms/IManagedForm.d @ 12:bc29606a740c

Added dwt-addons in original directory structure of eclipse.org
author Frank Benoit <benoit@tionex.de>
date Sat, 14 Mar 2009 18:23:29 +0100
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.ui.forms/src/org/eclipse/ui/forms/IManagedForm.d	Sat Mar 14 18:23:29 2009 +0100
@@ -0,0 +1,194 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ * Port to the D programming language:
+ *     Frank Benoit <benoit@tionex.de>
+ *******************************************************************************/
+module org.eclipse.ui.forms.IManagedForm;
+
+import org.eclipse.ui.forms.IFormPart;
+import org.eclipse.ui.forms.IMessageManager;
+
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.ScrolledForm;
+
+import java.lang.all;
+import java.util.Set;
+
+/**
+ * Managed form wraps a form widget and adds life cycle methods for form parts.
+ * A form part is a portion of the form that participates in form life cycle
+ * events.
+ * <p>
+ * There is no 1/1 mapping between widgets and form parts. A widget like Section
+ * can be a part by itself, but a number of widgets can gather around one form
+ * part.
+ * <p>
+ * This interface should not be extended or implemented. New form instances
+ * should be created using ManagedForm.
+ *
+ * @see ManagedForm
+ * @since 3.0
+ * @noimplement This interface is not intended to be implemented by clients.
+ */
+public interface IManagedForm {
+    /**
+     * Initializes the form by looping through the managed parts and
+     * initializing them. Has no effect if already called once.
+     *
+     * @since 3.1
+     */
+    public void initialize();
+
+    /**
+     * Returns the toolkit used by this form.
+     *
+     * @return the toolkit
+     */
+    public FormToolkit getToolkit();
+
+    /**
+     * Returns the form widget managed by this form.
+     *
+     * @return the form widget
+     */
+    public ScrolledForm getForm();
+
+    /**
+     * Reflows the form as a result of the layout change.
+     *
+     * @param changed
+     *            if <code>true</code>, discard cached layout information
+     */
+    public void reflow(bool changed);
+
+    /**
+     * A part can use this method to notify other parts that implement
+     * IPartSelectionListener about selection changes.
+     *
+     * @param part
+     *            the part that broadcasts the selection
+     * @param selection
+     *            the selection in the part
+     */
+    public void fireSelectionChanged(IFormPart part, ISelection selection);
+
+    /**
+     * Returns all the parts currently managed by this form.
+     *
+     * @return the managed parts
+     */
+    IFormPart[] getParts();
+
+    /**
+     * Adds the new part to the form.
+     *
+     * @param part
+     *            the part to add
+     */
+    void addPart(IFormPart part);
+
+    /**
+     * Removes the part from the form.
+     *
+     * @param part
+     *            the part to remove
+     */
+    void removePart(IFormPart part);
+
+    /**
+     * Sets the input of this page to the provided object.
+     *
+     * @param input
+     *            the new page input
+     * @return <code>true</code> if the form contains this object,
+     *         <code>false</code> otherwise.
+     */
+    bool setInput(Object input);
+
+    /**
+     * Returns the current page input.
+     *
+     * @return page input object or <code>null</code> if not applicable.
+     */
+    Object getInput();
+
+    /**
+     * Tests if form is dirty. A managed form is dirty if at least one managed
+     * part is dirty.
+     *
+     * @return <code>true</code> if at least one managed part is dirty,
+     *         <code>false</code> otherwise.
+     */
+    bool isDirty();
+
+    /**
+     * Notifies the form that the dirty state of one of its parts has changed.
+     * The global dirty state of the form can be obtained by calling 'isDirty'.
+     *
+     * @see #isDirty
+     */
+    void dirtyStateChanged();
+
+    /**
+     * Commits the dirty form. All pending changes in the widgets are flushed
+     * into the model.
+     *
+     * @param onSave
+     */
+    void commit(bool onSave);
+
+    /**
+     * Tests if form is stale. A managed form is stale if at least one managed
+     * part is stale. This can happen when the underlying model changes,
+     * resulting in the presentation of the part being out of sync with the
+     * model and needing refreshing.
+     *
+     * @return <code>true</code> if the form is stale, <code>false</code>
+     *         otherwise.
+     */
+    bool isStale();
+
+    /**
+     * Notifies the form that the stale state of one of its parts has changed.
+     * The global stale state of the form can be obtained by calling 'isStale'.
+     */
+    void staleStateChanged();
+
+    /**
+     * Refreshes the form by refreshing every part that is stale.
+     */
+    void refresh();
+
+    /**
+     * Sets the container that owns this form. Depending on the context, the
+     * container may be wizard, editor page, editor etc.
+     *
+     * @param container
+     *            the container of this form
+     */
+    void setContainer(Object container);
+
+    /**
+     * Returns the container of this form.
+     *
+     * @return the form container
+     */
+    Object getContainer();
+
+    /**
+     * Returns the message manager that will keep track of messages in this
+     * form.
+     *
+     * @return the message manager instance
+     * @since 3.3
+     */
+    IMessageManager getMessageManager();
+}