Class AbstractContentPart<V extends javafx.scene.Node>

java.lang.Object
org.eclipse.gef.mvc.fx.parts.AbstractVisualPart<V>
org.eclipse.gef.mvc.fx.parts.AbstractContentPart<V>
Type Parameters:
V - The visual Node used by this AbstractContentPart .
All Implemented Interfaces:
IActivatable, IAdaptable, IAdaptable.Bound<IViewer>, IDisposable, IContentPart<V>, IVisualPart<V>

public abstract class AbstractContentPart<V extends javafx.scene.Node> extends AbstractVisualPart<V> implements IContentPart<V>
The AbstractContentPart is an IContentPart implementation that binds the VR type parameter (visual root type) to Node.
  • Property Details

  • Constructor Details

  • Method Details

    • addContentChild

      public final void addContentChild(Object contentChild, int index)
      Inserts the given contentChild as a child to this part's content, so that it will be returned by subsequent calls to IContentPart.getContentChildrenUnmodifiable().

      Delegates to doAddContentChild(Object, int), which is to be overwritten by subclasses.

      Specified by:
      addContentChild in interface IContentPart<V extends javafx.scene.Node>
      Parameters:
      contentChild - An Object which should be added as a child to this part's content.
      index - The index at which the contentChild should be added.
    • attachToContentAnchorage

      public final void attachToContentAnchorage(Object contentAnchorage, String role)
      Attaches this part's content to the given contentAnchorage under the specified role, so that it will be returned by subsequent calls to IContentPart.getContentAnchoragesUnmodifiable().

      Delegates to doAttachToContentAnchorage(Object, String), which is to be overwritten by subclasses.

      Specified by:
      attachToContentAnchorage in interface IContentPart<V extends javafx.scene.Node>
      Parameters:
      contentAnchorage - An Object to which this part's content should be attached to.
      role - The role under which the attachment is to be established.
    • contentAnchoragesUnmodifiableProperty

      public ReadOnlySetMultimapProperty<Object,String> contentAnchoragesUnmodifiableProperty()
      Description copied from interface: IContentPart
      Returns an unmodifiable read-only set-multimap property containing the content anchorages.
      Specified by:
      contentAnchoragesUnmodifiableProperty in interface IContentPart<V extends javafx.scene.Node>
      Returns:
      An unmodifiable read-only set-multimap property.
      See Also:
    • contentChildrenUnmodifiableProperty

      public javafx.beans.property.ReadOnlyListProperty<Object> contentChildrenUnmodifiableProperty()
      Description copied from interface: IContentPart
      Returns an unmodfiable read-only property containing the content children.
      Specified by:
      contentChildrenUnmodifiableProperty in interface IContentPart<V extends javafx.scene.Node>
      Returns:
      An unmodifiable read-only property named IContentPart.CONTENT_CHILDREN_PROPERTY.
      See Also:
    • contentProperty

      public final javafx.beans.property.ObjectProperty<Object> contentProperty()
      Description copied from interface: IContentPart
      A writable property representing the IContentPart's content.
      Specified by:
      contentProperty in interface IContentPart<V extends javafx.scene.Node>
      Returns:
      A writable property named IContentPart.CONTENT_PROPERTY.
      See Also:
    • detachFromContentAnchorage

      public final void detachFromContentAnchorage(Object contentAnchorage, String role)
      Detaches this part's content from the given contentAnchorage under the specified role, so that it will no longer be returned by subsequent calls to IContentPart.getContentAnchoragesUnmodifiable().

      Delegates to doDetachFromContentAnchorage(Object, String), which is to be overwritten by subclasses.

      Specified by:
      detachFromContentAnchorage in interface IContentPart<V extends javafx.scene.Node>
      Parameters:
      contentAnchorage - An Object from which this part's content should be detached from.
      role - The role under which the attachment is established.
    • doAddContentChild

      protected void doAddContentChild(Object contentChild, int index)
      Adds the given contentChild to this part's content children, so that it will no longer be returned by subsequent calls to doGetContentChildren().
      Parameters:
      contentChild - An Object which should be removed from this part's content children.
      index - The index of the contentChild that is removed.
    • doAttachToContentAnchorage

      protected void doAttachToContentAnchorage(Object contentAnchorage, String role)
      Attaches this part's content to the given contentAnchorage under the specified role, so that it will be returned by subsequent calls to doGetContentAnchorages().
      Parameters:
      contentAnchorage - An Object to which this part's content should be attached to.
      role - The role under which the attachment is to be established.
    • doDetachFromContentAnchorage

      protected void doDetachFromContentAnchorage(Object contentAnchorage, String role)
      Detaches this part's content from the given contentAnchorage under the specified role, so that it will no longer be returned by subsequent calls to doGetContentAnchorages().
      Parameters:
      contentAnchorage - An Object from which this part's content should be detached from.
      role - The role under which the attachment is established.
    • doGetContentAnchorages

      protected abstract SetMultimap<? extends Object,String> doGetContentAnchorages()
      Hook method to return the current list of content anchorages. Has to be overwritten by clients.
      Returns:
      The current list of content anchorages.
    • doGetContentChildren

      protected abstract List<? extends Object> doGetContentChildren()
      Hook method to return the current list of content children. Has to be overwritten by clients.
      Returns:
      The current list of content children.
    • doRemoveContentChild

      protected void doRemoveContentChild(Object contentChild)
      Removes the given contentChild from this part's content children, so that it will no longer be returned by subsequent calls to doGetContentChildren().
      Parameters:
      contentChild - An Object which should be removed from this part's content children.
    • doReorderContentChild

      protected void doReorderContentChild(Object contentChild, int newIndex)
      Rearranges the given contentChild to the new index position.
      Parameters:
      contentChild - The Object which is to be reordered.
      newIndex - The index to which the content child is to be reordered.
    • getContent

      public Object getContent()
      Description copied from interface: IContentPart
      Returns this part's content.
      Specified by:
      getContent in interface IContentPart<V extends javafx.scene.Node>
      Returns:
      This part's content.
      See Also:
    • getContentAnchoragesUnmodifiable

      public ObservableSetMultimap<Object,String> getContentAnchoragesUnmodifiable()
      Gets the value of the property contentAnchoragesUnmodifiable.
      Specified by:
      getContentAnchoragesUnmodifiable in interface IContentPart<V extends javafx.scene.Node>
      Property description:
      Returns:
      An unmodifiable ObservableSetMultimap of the content anchorages with a role to qualify each anchorage-anchored link. If there is only a single anchorage-anchored link to a respective anchorage, its role may be left undefined (i.e. the map will contain an entry of the form (anchorage, null)).
    • getContentChildrenUnmodifiable

      public javafx.collections.ObservableList<Object> getContentChildrenUnmodifiable()
      Gets the value of the property contentChildrenUnmodifiable.
      Specified by:
      getContentChildrenUnmodifiable in interface IContentPart<V extends javafx.scene.Node>
      Property description:
      Returns:
      A List of all of this part's content children.
    • isFocusable

      public boolean isFocusable()
      Description copied from interface: IContentPart
      Returns true if policies and other parts of the application are allowed to assign focus to this part by changing the FocusModel. Otherwise returns false.
      Specified by:
      isFocusable in interface IContentPart<V extends javafx.scene.Node>
      Returns:
      true if policies and other parts of the application are allowed to assign focus to this part by changing the FocusModel, otherwise false.
    • isSelectable

      public boolean isSelectable()
      Description copied from interface: IContentPart
      Returns true if policies and other parts of the application are allowed to add this part to the selection maintained by the SelectionModel. Otherwise returns false.
      Specified by:
      isSelectable in interface IContentPart<V extends javafx.scene.Node>
      Returns:
      true if policies and other parts of the application are allowed to add this part to the selection maintained by the SelectionModel, otherwise false.
    • refreshContentAnchorages

      public void refreshContentAnchorages()
      Description copied from interface: IContentPart
      Triggers a re-computation of the content anchorages of this IContentPart.
      Specified by:
      refreshContentAnchorages in interface IContentPart<V extends javafx.scene.Node>
    • refreshContentChildren

      public void refreshContentChildren()
      Description copied from interface: IContentPart
      Triggers a re-computation of the content children of this IContentPart.
      Specified by:
      refreshContentChildren in interface IContentPart<V extends javafx.scene.Node>
    • register

      protected void register(IViewer viewer)
      Description copied from class: AbstractVisualPart
      Called when a link to the IViewer is obtained. Registers this IVisualPart for its "main" visual (i.e. the one returned by AbstractVisualPart.getVisual()) at the IViewer.getVisualPartMap() of the given IViewer. To simplify matters, this IVisualPart only has to register itself for its "main" visual, i.e. if the "main" visual contains a number of children visuals, it does not need to register itself for those children visuals. Therefore, if the visualization changes dynamically, the registration at the visual-part-map does not need to be updated. Consequently, when looking up an IVisualPart for a given visual in the visual-part-map, it is required to walk up the visual hierarchy until a registered visual is found.
      Overrides:
      register in class AbstractVisualPart<V extends javafx.scene.Node>
      Parameters:
      viewer - The IViewer to register at.
    • registerAtContentPartMap

      protected void registerAtContentPartMap(IViewer viewer, Object content)
      Registers the model in the IViewer.getContentPartMap(). Subclasses should only extend this method if they need to register this EditPart in additional ways.
      Parameters:
      viewer - The viewer to register at.
      content - The content to register.
    • removeContentChild

      public final void removeContentChild(Object contentChild)
      Removes the given contentChild from this part's content children, so that it will no longer be returned by subsequent calls to IContentPart.getContentChildrenUnmodifiable().

      Delegates to doRemoveContentChild(Object), which is to be overwritten by subclasses.

      Specified by:
      removeContentChild in interface IContentPart<V extends javafx.scene.Node>
      Parameters:
      contentChild - An Object which should be removed from this part's content children.
    • reorderContentChild

      public void reorderContentChild(Object contentChild, int newIndex)
      Rearranges the given contentChild to the new index position. Fires property change events using IContentPart.CONTENT_CHILDREN_PROPERTY as property name.

      Delegates to doReorderContentChild(Object, int), which is to be overwritten by subclasses.

      Specified by:
      reorderContentChild in interface IContentPart<V extends javafx.scene.Node>
      Parameters:
      contentChild - The Object which is to be reordered.
      newIndex - The index to which the content child is to be reordered.
    • setContent

      public void setContent(Object content)
      Set the primary content object that this EditPart represents. This method is used by an IContentPartFactory when creating an IContentPart.
      Specified by:
      setContent in interface IContentPart<V extends javafx.scene.Node>
      Parameters:
      content - The new content for this part.
      See Also:
    • unregister

      protected void unregister(IViewer viewer)
      Description copied from class: AbstractVisualPart
      Called when the link to the IViewer is lost. Unregisters this IVisualPart for its "main" visual (i.e. the one returned by AbstractVisualPart.getVisual()) from the IViewer.getVisualPartMap() of the given IViewer. To simplify matters, this IVisualPart only has to unregister itself for its "main" visual, i.e. if the "main" visual contains a number of children visuals, it does not need to unregister itself for those children visuals. Therefore, if the visualization changes dynamically, the registration at the visual-part-map does not need to be updated. Consequently, when looking up an IVisualPart for a given visual in the visual-part-map, it is required to walk up the visual hierarchy until a registered visual is found.
      Overrides:
      unregister in class AbstractVisualPart<V extends javafx.scene.Node>
      Parameters:
      viewer - The IViewer to unregister from.
    • unregisterFromContentPartMap

      protected void unregisterFromContentPartMap(IViewer viewer, Object content)
      Unregisters the model in the IViewer.getContentPartMap(). Subclasses should only extend this method if they need to unregister this EditPart in additional ways.
      Parameters:
      viewer - The viewer to unregister from.
      content - The content to unregister.