Class AbstractVisualPart<V extends javafx.scene.Node>

    • Constructor Detail

      • AbstractVisualPart

        public AbstractVisualPart()
    • Method Detail

      • activateAdapters

        protected void activateAdapters()
        Activates the adapters registered at this AbstractVisualPart.
      • activateChildren

        protected void activateChildren()
        Activates the children of this AbstractVisualPart.
      • activeProperty

        public javafx.beans.property.ReadOnlyBooleanProperty activeProperty()
        Specified by:
        activeProperty in interface IActivatable
      • adaptersProperty

        public javafx.beans.property.ReadOnlyMapProperty<AdapterKey<?>,​java.lang.Object> adaptersProperty()
        Specified by:
        adaptersProperty in interface IAdaptable
      • addChild

        public void addChild​(IVisualPart<? extends javafx.scene.Node> child)
        Description copied from interface: IVisualPart
        Adds the given child to the list of this part's children.
        Specified by:
        addChild in interface IVisualPart<V extends javafx.scene.Node>
        Parameters:
        child - The IVisualPart which is added to the list of this part's children.
      • addChild

        public void addChild​(IVisualPart<? extends javafx.scene.Node> child,
                             int index)
        Description copied from interface: IVisualPart
        Adds the given child to the list of this part's children at the specified index.
        Specified by:
        addChild in interface IVisualPart<V extends javafx.scene.Node>
        Parameters:
        child - The IVisualPart which is added to the list of this part's children.
        index - The index at which the given IVisualPart is inserted into this part's children list.
      • addChildren

        public void addChildren​(java.util.List<? extends IVisualPart<? extends javafx.scene.Node>> children)
        Description copied from interface: IVisualPart
        Adds the given children to the list of this part's children.
        Specified by:
        addChildren in interface IVisualPart<V extends javafx.scene.Node>
        Parameters:
        children - The IVisualParts which are added to the list of this part's children.
      • addChildren

        public void addChildren​(java.util.List<? extends IVisualPart<? extends javafx.scene.Node>> children,
                                int index)
        Description copied from interface: IVisualPart
        Adds the given children to the list of this part's children at the specified index.
        Specified by:
        addChildren in interface IVisualPart<V extends javafx.scene.Node>
        Parameters:
        children - The IVisualParts which are added to the list of this part's children.
        index - The index at which the given IVisualParts are inserted into this part's children list.
      • attachToAnchorage

        public void attachToAnchorage​(IVisualPart<? extends javafx.scene.Node> anchorage)
        Description copied from interface: IVisualPart
        Attaches the given IVisualPart to the given anchorage under the "default" role.
        Specified by:
        attachToAnchorage in interface IVisualPart<V extends javafx.scene.Node>
        Parameters:
        anchorage - The anchorage IVisualPart to attach this part to.
      • attachToAnchorage

        public void attachToAnchorage​(IVisualPart<? extends javafx.scene.Node> anchorage,
                                      java.lang.String role)
        Description copied from interface: IVisualPart
        Attaches the given IVisualPart to the given anchorage under the given role.
        Specified by:
        attachToAnchorage in interface IVisualPart<V extends javafx.scene.Node>
        Parameters:
        anchorage - The anchorage IVisualPart to attach this part to.
        role - The role under which this IVisualPart is attached to the given anchorage. null.
      • deactivateAdapters

        protected void deactivateAdapters()
        Deactivates the adapters registered at this AbstractVisualPart.
      • deactivateChildren

        protected void deactivateChildren()
        Deactivates the children of this AbstractVisualPart.
      • detachFromAnchorage

        public void detachFromAnchorage​(IVisualPart<? extends javafx.scene.Node> anchorage,
                                        java.lang.String role)
        Description copied from interface: IVisualPart
        Detaches this IVisualPart from the given anchorage IVisualPart under the given role.
        Specified by:
        detachFromAnchorage in interface IVisualPart<V extends javafx.scene.Node>
        Parameters:
        anchorage - The anchorage IVisualPart to detach this part from.
        role - The role under which the IVisualPart can be found in this part's anchorages.
      • determineViewer

        protected IViewer determineViewer​(IVisualPart<? extends javafx.scene.Node> parent,
                                          Multiset<IVisualPart<? extends javafx.scene.Node>> anchoreds)
        Determines the viewer reference via the given parent or any of the given anchoreds.
        Parameters:
        parent - The parent to obtain the viewer from.
        anchoreds - The anchoreds to alternatively obtain the viewer from.
        Returns:
        The viewer, if it could be determined via the parent or any of the anchoreds.
      • doActivate

        protected void doActivate()
        Activates this AbstractVisualPart, which activates its children and adapters.
      • doAddChildVisual

        protected void doAddChildVisual​(IVisualPart<? extends javafx.scene.Node> child,
                                        int index)
        Performs the addition of the child's visual to this IVisualPart's visual.
        Parameters:
        child - The IVisualPart being added
        index - The child's position
        See Also:
        addChild(IVisualPart, int)
      • doAttachToAnchorageVisual

        protected void doAttachToAnchorageVisual​(IVisualPart<? extends javafx.scene.Node> anchorage,
                                                 java.lang.String role)
        Attaches this part's visual to the visual of the given anchorage.
        Parameters:
        anchorage - The anchorage IVisualPart.
        role - The anchorage role.
      • doCreateVisual

        protected abstract V doCreateVisual()
        Creates this part's visual.
        Returns:
        This part's visual.
      • doDeactivate

        protected void doDeactivate()
        Deactivates this AbstractVisualPart, which deactivates its children and adapters.
      • doDetachFromAnchorageVisual

        protected void doDetachFromAnchorageVisual​(IVisualPart<? extends javafx.scene.Node> anchorage,
                                                   java.lang.String role)
        Detaches this part's visual from the visual of the given anchorage.
        Parameters:
        anchorage - The anchorage IVisualPart.
        role - The anchorage role.
      • doRefreshVisual

        protected abstract void doRefreshVisual​(V visual)
        Refreshes this part's visualization based on this part's content.
        Parameters:
        visual - This part's visual.
      • doRemoveChildVisual

        protected void doRemoveChildVisual​(IVisualPart<? extends javafx.scene.Node> child,
                                           int index)
        Removes the child's visual from this IVisualPart's visual.
        Parameters:
        child - The child IVisualPart.
        index - The index of the child whose visual is to be removed.
      • getAdapter

        public <T> T getAdapter​(java.lang.Class<T> classKey)
        Specified by:
        getAdapter in interface IAdaptable
      • getAdapters

        public javafx.collections.ObservableMap<AdapterKey<?>,​java.lang.Object> getAdapters()
        Specified by:
        getAdapters in interface IAdaptable
      • getAdapters

        public <T> java.util.Map<AdapterKey<? extends T>,​T> getAdapters​(java.lang.Class<? super T> classKey)
        Specified by:
        getAdapters in interface IAdaptable
      • getChildrenUnmodifiable

        public javafx.collections.ObservableList<IVisualPart<? extends javafx.scene.Node>> getChildrenUnmodifiable()
        Description copied from interface: IVisualPart
        Returns an unmodifiable ObservableList of this part's children.
        Specified by:
        getChildrenUnmodifiable in interface IVisualPart<V extends javafx.scene.Node>
        Returns:
        A ObservableList of this part's children.
      • getHandlers

        public java.util.Map<AdapterKey<? extends org.eclipse.gef.mvc.fx.handlers.IHandler>,​org.eclipse.gef.mvc.fx.handlers.IHandler> getHandlers()
        Description copied from interface: IVisualPart
        Returns a Map of this part's handlers and their corresponding AdapterKeys.
        Specified by:
        getHandlers in interface IVisualPart<V extends javafx.scene.Node>
        Returns:
        A Map of this part's handlers and their corresponding AdapterKeys.
      • getParent

        public IVisualPart<? extends javafx.scene.Node> getParent()
        Description copied from interface: IVisualPart
        Returns the parent of this part.
        Specified by:
        getParent in interface IVisualPart<V extends javafx.scene.Node>
        Returns:
        The parent of this part.
      • getRoot

        public IRootPart<? extends javafx.scene.Node> getRoot()
        Description copied from interface: IVisualPart
        Returns the IRootPart. This method should only be called internally or by helpers such as edit policies. The root can be used to get the viewer.
        Specified by:
        getRoot in interface IVisualPart<V extends javafx.scene.Node>
        Returns:
        null or the IRootPart
      • getVisual

        public V getVisual()
        Description copied from interface: IVisualPart
        Returns this part's visual.
        Specified by:
        getVisual in interface IVisualPart<V extends javafx.scene.Node>
        Returns:
        This part's visual.
      • isRefreshVisual

        public boolean isRefreshVisual()
        Description copied from interface: IVisualPart
        Returns true if this part is allowed to refresh its visualization based on its content. Otherwise returns false.
        Specified by:
        isRefreshVisual in interface IVisualPart<V extends javafx.scene.Node>
        Returns:
        true if this part is allowed to refresh its visualization based on its content, otherwise false.
      • register

        protected void register​(IViewer viewer)
        Called when a link to the IViewer is obtained. Registers this IVisualPart for its "main" visual (i.e. the one returned by 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.
        Parameters:
        viewer - The IViewer to register at.
      • registerAtVisualPartMap

        protected void registerAtVisualPartMap​(IViewer viewer,
                                               V visual)
        Registers this part for the given visual in the visual-part-map of the given IViewer.
        Parameters:
        viewer - The IViewer of which the visual-part-map is extended.
        visual - The visual for which this part is registered in the viewer's visual-part-map.
      • removeChild

        public void removeChild​(IVisualPart<? extends javafx.scene.Node> child)
        Description copied from interface: IVisualPart
        Removes the given IVisualPart from the list of this part's children.
        Specified by:
        removeChild in interface IVisualPart<V extends javafx.scene.Node>
        Parameters:
        child - The IVisualPart which is removed from the list of this part's children.
      • removeChildren

        public void removeChildren​(java.util.List<? extends IVisualPart<? extends javafx.scene.Node>> children)
        Description copied from interface: IVisualPart
        Removes the given IVisualParts from the list of this part's children.
        Specified by:
        removeChildren in interface IVisualPart<V extends javafx.scene.Node>
        Parameters:
        children - The IVisualParts which are removed from the list of this part's children.
      • reorderChild

        public void reorderChild​(IVisualPart<? extends javafx.scene.Node> child,
                                 int index)
        Description copied from interface: IVisualPart
        Swaps the given IVisualPart with the part at the given index position within this part's list of children.
        Specified by:
        reorderChild in interface IVisualPart<V extends javafx.scene.Node>
        Parameters:
        child - The IVisualPart which is reordered.
        index - The index to which the part is reordered.
      • setAdapter

        public <T> void setAdapter​(T adapter)
        Specified by:
        setAdapter in interface IAdaptable
      • setAdapter

        public <T> void setAdapter​(T adapter,
                                   java.lang.String role)
        Specified by:
        setAdapter in interface IAdaptable
      • setRefreshVisual

        public void setRefreshVisual​(boolean isRefreshVisual)
        Description copied from interface: IVisualPart
        Allows to temporarily turn IVisualPart.refreshVisual() into a no-op operation. This may for instance be used to disable visual updates that are initiated by the model (in case of IContentParts) while interacting with the IVisualPart.
        Specified by:
        setRefreshVisual in interface IVisualPart<V extends javafx.scene.Node>
        Parameters:
        isRefreshVisual - Whether IVisualPart.refreshVisual() should perform updates of the visual (true) or behave like a no-op operation ( false).
      • unregister

        protected void unregister​(IViewer viewer)
        Called when the link to the IViewer is lost. Unregisters this IVisualPart for its "main" visual (i.e. the one returned by 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.
        Parameters:
        viewer - The IViewer to unregister from.
      • unregisterFromVisualPartMap

        protected void unregisterFromVisualPartMap​(IViewer viewer,
                                                   V visual)
        Removes the given visual from the visual-part-map of the given viewer.
        Parameters:
        viewer - The IViewer of which the visual-part-map is changed.
        visual - The visual which is removed from the visual-part-map.
      • unsetAdapter

        public <T> void unsetAdapter​(T adapter)
        Specified by:
        unsetAdapter in interface IAdaptable