Interface PanelDefinition

  • All Known Subinterfaces:
    CustomPanelDefinition
    All Known Implementing Classes:
    CustomPanelDefinitionImpl, PanelDefinitionImpl

    @JsType
    public interface PanelDefinition
    Describes a physical region within a Workbench Perspective. Panels have a set physical size that they occupy, which is divided up between any panel decorations (a tab bar or dropdown list is common), one or more Parts (generally Editors or Screens), one of which can be visible at a time, and also child Panel Definitions, all of which are visible simultaneously.
    • Field Detail

      • PARENT_CHOOSES_TYPE

        static final String PARENT_CHOOSES_TYPE
        Special value for getPanelType(). When adding a new child panel to a parent panel, if the child panel has this type, the parent can create any type of PanelPresenter it likes. Typically, each panel type will have some constant default child type that it uses in this scenario.
        See Also:
        Constant Field Values
    • Method Detail

      • getElementId

        String getElementId()
        Returns the DOM ID that will be given to a panel created from this definition. If null, no ID attribute will be set on a panel created from this definition.
      • setElementId

        void setElementId​(String id)
        Specifies the DOM ID that should be given to the live panel's element. Applications are responsible for ensuring the ID values are unique among all live panels.
        Parameters:
        id - the DOM ID to give the panel when it is created. If null, no ID will be set on the panel.
      • addPart

        void addPart​(PartDefinition part)
        Specifies content that should be put in this panel's main display area when it is materialized. The content to add is specified by a PartDefinition, at the core of which is a PlaceRequest that identifies a WorkbenchActivity (either a screen or an editor).

        If the given part already belongs to an existing panel, it will be removed from that panel by a call to removePart(part).

        Parameters:
        part - The Part to add. Must not be null. The part's place must specify a WorkbenchActivity bean.
      • addPart

        @JsMethod(name="addPartById")
        PartDefinition addPart​(String partSpec)
        Specifies content that should be put in this panel's main display area when it is materialized.

        This is a convenience method equivalent to addPart(new PartDefinitionImpl(DefaultPlaceRequest.parse(partSpec))).

        Parameters:
        partSpec - An PlaceRequest ID with optional parameters, encoded as specified in DefaultPlaceRequest.parse(CharSequence). Must not be null. The place ID must specify a WorkbenchActivity bean (either a screen or an editor).
        Returns:
        the PartDefinition object that was created and added to this panel definition.
      • removePart

        boolean removePart​(PartDefinition part)
        Removes the given part definition from this panel definition.
        Parameters:
        part - The Part to be removed
        Returns:
        true if the part was found and removed; false if it did not belong to this panel in the first place.
      • getParts

        Set<PartDefinition> getParts()
        Get the Parts contained in the Panel
        Returns:
        The parts
      • getChildren

        List<PanelDefinition> getChildren()
        Returns this panel's immediate child panels.
        Returns:
        a snapshot of the current child list. The list is not modifiable, and will not change as panels are added and removed from this panel. The returned list is never null.
      • insertChild

        void insertChild​(Position position,
                         PanelDefinition panel)
        Insert a Panel as an immediate child at the given Position. If this Panel already has a child at the specified position the existing Panel at that position becomes a child of the Panel being added at the same Position.
        Parameters:
        position - The Position to add the child
        panel - The child Panel
      • appendChild

        @JsMethod(name="appendChildAtPosition")
        void appendChild​(Position position,
                         PanelDefinition panel)
        Append a Panel at the first empty child position. If this Panel already has a child at the specified position the descendants are followed until an empty position is found.
        Parameters:
        position - The Position to add the child
        panel - The child Panel
      • appendChild

        void appendChild​(PanelDefinition panel)
        Append a Panel at the first empty child position. If this Panel already has a child at the specified position the descendants are followed until an empty position is found.
        Parameters:
        panel - The child Panel
      • getParent

        PanelDefinition getParent()
        Return the parent panel, or null if isRoot()} returns true.
        Returns:
        a parent panel definition or null if at the top of the hierarchy
      • getChild

        PanelDefinition getChild​(Position position)
        Get the Panel's immediate child Panel at the given Position
        Parameters:
        position - The child Panel's Position
        Returns:
        The child Panel or null, if a child does not exist at the given Position
      • removeChild

        void removeChild​(Position position)
        Remove a child from the Panel
        Parameters:
        position -
      • isRoot

        boolean isRoot()
        Is this Panel the root of the Perspective definition
        Returns:
        True if the Panel is the root
      • getPanelType

        String getPanelType()
        Specifies the WorkbenchPanelPresenter implementation that should be used when adding this panel to the UI. Must refer to a Dependent-scoped Errai IOC bean type.
        Returns:
        fully-qualified class name of the WorkbenchPanelPresenter implementation to use. Must not be null, but may be the special value PARENT_CHOOSES_TYPE.
      • setPanelType

        void setPanelType​(String fqcn)
        Specifies the WorkbenchPanelPresenter implementation that should be used when adding this panel to the UI. Must refer to a Dependent-scoped Errai IOC bean type.
        Parameters:
        fqcn - fully-qualified class name of the WorkbenchPanelPresenter implementation to use. Must not be null, but may be the special value PARENT_CHOOSES_TYPE.
      • getHeight

        @JsIgnore
        Integer getHeight()
        Get the height of the Panel in pixels
        Returns:
        The height, or null if not set
      • setHeight

        default void setHeight​(int height)
        Set the height of this panel in pixels using a primitive int to make this method exportable to JS.
        Parameters:
        width - The width to set.
      • getHeightAsInt

        default int getHeightAsInt()
        Get the height of this panel in pixels as a primitive int to make this method exportable to JS.
        Returns:
        The height, or -1 if not set.
      • setHeight

        @JsIgnore
        void setHeight​(Integer height)
        Set the height of this panel in pixels.
        Parameters:
        height - The height to set. If null, the existing height value is retained.
      • getWidth

        @JsIgnore
        Integer getWidth()
        Get the width of this panel in pixels.
        Returns:
        The width, or null if not set.
      • setWidth

        default void setWidth​(int width)
        Set the width of this panel in pixels using a primitive int to make this method exportable to JS.
        Parameters:
        width - The width to set.
      • getWidthAsInt

        default int getWidthAsInt()
        Get the width of this panel in pixels as a primitive int to make this method exportable to JS.
        Returns:
        The width, or -1 if not set.
      • setWidth

        @JsIgnore
        void setWidth​(Integer width)
        Set the width of this panel in pixels.
        Parameters:
        width - The width to set. If null, the existing width value is retained.
      • getMinHeight

        @JsIgnore
        Integer getMinHeight()
        Get the minimum height of this panel in pixels.
        Returns:
        The minimum height, or null if not set.
      • setMinHeight

        @JsIgnore
        void setMinHeight​(Integer minHeight)
        Set the minimum height of the Panel in pixels
        Parameters:
        minHeight - The minimum height, or null if not set
      • getMinHeightAsInt

        default int getMinHeightAsInt()
        Get the minimum width of this panel in pixels as a primitive int to make this method exportable to JS.
        Returns:
        The height, or -1 if not set.
      • getMinWidth

        @JsIgnore
        Integer getMinWidth()
        Get the minimum width of the Panel in pixels
        Returns:
        The minimum width, or null if not set
      • setMinWidth

        @JsIgnore
        void setMinWidth​(Integer minWidth)
        Set the minimum width of the Panel in pixels
        Parameters:
        minWidth - The width, or null if not set
      • getMinWidthAsInt

        default int getMinWidthAsInt()
        Get the minimum width of this panel in pixels as a primitive int to make this method exportable to JS.
        Returns:
        The width, or -1 if not set.
      • getPosition

        Position getPosition()
        Get the Position of the Panel relate to it's Parent

        TODO remove this. parent panels should track the positions of their children; making it a property of the child is error-prone when moving panels around in the UI.

        Returns:
        The Position of the Panel
      • setPosition

        void setPosition​(Position position)
        Set the Position of the Panel relative to it's parent.

        TODO remove this. parent panels should track the positions of their children; making it a property of the child is error-prone when moving panels around in the UI.

        Parameters:
        position - The Position of the Panel relative to it's parent
      • isMaximized

        boolean isMaximized()
        Has the Panel been expanded to a maximum size
        Returns:
        true If maximized
      • setContextDefinition

        void setContextDefinition​(ContextDefinition contextDefinition)
      • setContextDisplayMode

        void setContextDisplayMode​(ContextDisplayMode contextDisplayMode)
      • asString

        default String asString()
        Invokes #toString() but exported to JavaScript so it can be invoked from different scripts.