Class DefaultArea

    • Constructor Detail

      • DefaultArea

        public DefaultArea​(Area src)
      • DefaultArea

        public DefaultArea​(Box box)
      • DefaultArea

        public DefaultArea​(List<Box> boxList)
    • Method Detail

      • setName

        public void setName​(String name)
        Sets the name of the area. The name is used when the area information is displayed using toString()
        Specified by:
        setName in interface Area
        Parameters:
        name - The new area name
      • getName

        public String getName()
        Description copied from interface: Area
        Obtains the area name.
        Specified by:
        getName in interface Area
        Returns:
        the area name set previously using Area.setName(String) or a default name when nothing has been previously set.
      • getAreaTree

        public AreaTree getAreaTree()
        Description copied from interface: Area
        Obtains the tree the node belongs to.
        Specified by:
        getAreaTree in interface Area
        Returns:
        the tree or null when the node does not form part of any tree.
      • getContentBounds

        public Rectangular getContentBounds()
      • getLevel

        public int getLevel()
        Description copied from interface: Area
        Area grouping level. Area level 0 corresponds to the areas formed by boxes, greater numbers represent greater level of grouping (artificial areas).
        Specified by:
        getLevel in interface Area
        Returns:
        the area level
      • setLevel

        public void setLevel​(int level)
        Description copied from interface: Area
        Sets the area level. Area level 0 corresponds to the areas formed by boxes, greater numbers represent greater level of grouping (artificial areas).
        Specified by:
        setLevel in interface Area
        Parameters:
        level - the new level to set.
      • getTopology

        public AreaTopology getTopology()
        Description copied from interface: Area
        Returns the topology of this area.
        Specified by:
        getTopology in interface Area
        Returns:
        The area topology.
      • updateTopologies

        public void updateTopologies()
        Description copied from interface: Area
        Updates the topologies of the child areas. This should be called when some nodes have been inserted, removed or changed in this area.
        Specified by:
        updateTopologies in interface Area
      • createTopology

        protected AreaTopology createTopology()
        Creates a topology for this area. This method should be overriden when another topology implementation is used. By default, it returns the default grid-based topology. When another topology is used, the invalidateTopology() function should be overriden as well.
        Returns:
        The created topology for this area
      • invalidateTopology

        protected void invalidateTopology()
        Marks the topology as dirty when the list of areas has been altered.
      • getEffectiveBackgroundColor

        public Color getEffectiveBackgroundColor()
        Description copied from interface: Area
        Obtains the effective background color visible under the area.
        Specified by:
        getEffectiveBackgroundColor in interface Area
        Returns:
        The background color.
      • getText

        public String getText()
        Description copied from interface: Area
        Returns the complete text contained in this area and its sub areas concatenated using the default concatenator defined by Concatenators.getDefaultAreaConcatenator().
        Specified by:
        getText in interface Area
        Returns:
        A text string (possibly empty)
      • getText

        public String getText​(String separator)
        Description copied from interface: Area
        Returns the complete text contained in this area and its sub area. The individual areas are separated by the given string separator.
        Specified by:
        getText in interface Area
        Parameters:
        separator - the string separating the individual areas
        Returns:
        A text string (possibly empty)
      • getText

        public String getText​(AreaConcatenator concatenator)
        Description copied from interface: Area
        Returns the complete text contained in this area and its sub areas concatenated using the specified concatenator.
        Specified by:
        getText in interface Area
        Parameters:
        concatenator - The concatenator to be used to join the areas (and boxes in leaf areas)
        Returns:
        A text string (possibly empty)
      • isReplaced

        public boolean isReplaced()
        Description copied from interface: Area
        Checks whether this area is formed by replaced boxes.
        Specified by:
        isReplaced in interface Area
        Returns:
        true if the area contains replaced boxes only
      • addBox

        public void addBox​(Box box)
        Description copied from interface: Area
        Adds a new box to the area.
        Specified by:
        addBox in interface Area
        Parameters:
        box - the box to add
      • getBoxes

        public List<Box> getBoxes()
        Returns a vector of boxes that are inside of this area
        Specified by:
        getBoxes in interface Area
        Returns:
        A vector containing the Box objects
      • getAllBoxes

        public List<Box> getAllBoxes()
        Obtains all the boxes from this area and all the child areas.
        Specified by:
        getAllBoxes in interface Area
        Returns:
        The list of boxes
      • getBoxText

        public String getBoxText()
        Deprecated.
        Depracated in favor of getBoxText(BoxConcatenator).
        Returns the text string represented by a concatenation of all the boxes contained directly in this area (no subareas)
      • getBoxText

        public String getBoxText​(BoxConcatenator concat)
        Returns the text string represented by a concatenation of all the boxes contained directly in this area (no subareas)
      • removeBox

        public void removeBox​(Box box)
        Removes the given box from the given area. This does not change the size of the area.
        Parameters:
        box - the box to be removed
      • removeBoxes

        public void removeBoxes​(Collection<Box> box)
        Removes the given boxes from the given area. This does not change the size of the area.
        Parameters:
        box - the collection of boxes to be removed
      • addTag

        public void addTag​(Tag tag,
                           float support)
        Description copied from interface: Taggable
        Adds a tag to this area. If the tag is already assigned to the area, the greater of the original and new support will be used.
        Specified by:
        addTag in interface Taggable
        Parameters:
        tag - The tag to be added.
        support - The assigned tag support from 0.0 to 1.0
      • hasTag

        public boolean hasTag​(Tag tag)
        Description copied from interface: Taggable
        Tests whether the area has this tag.
        Specified by:
        hasTag in interface Taggable
        Parameters:
        tag - the tag to be tested.
        Returns:
        true if the area has this tag
      • hasTag

        public boolean hasTag​(Tag tag,
                              float minSupport)
        Description copied from interface: Taggable
        Tests whether the area has this tag with a support greater or equal to the specified value.
        Specified by:
        hasTag in interface Taggable
        Parameters:
        tag - the tag to be tested
        minSupport - minimal required support
        Returns:
        true if the area has this tag
      • getSupportedTags

        public Set<Tag> getSupportedTags​(float minSupport)
        Description copied from interface: Taggable
        Obtains all the tags with the support greater or equal to the specified value.
        Specified by:
        getSupportedTags in interface Taggable
        Parameters:
        minSupport - minimal required support
        Returns:
        a set of tags with at least the minimal support (possibly empty)
      • getTagSupport

        public float getTagSupport​(Tag tag)
        Description copied from interface: Taggable
        Obtains the support of the given tag assignment
        Specified by:
        getTagSupport in interface Taggable
        Parameters:
        tag - The tag to be tested
        Returns:
        The support of the given tag in the range 0.0 to 1.0. Returns 0.0 when the tag is not assigned to this area.
      • getMostSupportedTag

        public Tag getMostSupportedTag()
        Description copied from interface: Taggable
        Obtains the tag with the greatest support that is assigned to this area.
        Specified by:
        getMostSupportedTag in interface Taggable
        Returns:
        The tag with the greatest support or null if there are no tags assigned to this area
      • removeAllTags

        public void removeAllTags​(Collection<Tag> c)
        Removes all tags that belong to the given collection.
        Parameters:
        c - A collection of tags to be removed.
      • removeTag

        public void removeTag​(Tag tag)
        Removes the specific tag
        Specified by:
        removeTag in interface Taggable
        Parameters:
        tag -
      • containsTag

        public boolean containsTag​(Tag tag)
        Tests whether the area or any of its direct child areas have the given tag.
        Parameters:
        tag - the tag to be tested.
        Returns:
        true if the area or its direct child areas have the given tag
      • getTags

        public Map<Tag,​Float> getTags()
        Obtains the set of tags assigned to the area.
        Specified by:
        getTags in interface Taggable
        Returns:
        a set of tags
      • setHorizontalSeparator

        public void setHorizontalSeparator​(boolean hsep)
      • isHorizontalSeparator

        public boolean isHorizontalSeparator()
        Description copied from interface: Area
        Checks whether the area can be interpreted as a horizontal separator.
        Specified by:
        isHorizontalSeparator in interface Area
        Returns:
        true when this area is a horizontal separator
      • setVerticalSeparator

        public void setVerticalSeparator​(boolean vsep)
      • isVerticalSeparator

        public boolean isVerticalSeparator()
        Description copied from interface: Area
        Checks whether the area can be interpreted as a vertical separator.
        Specified by:
        isVerticalSeparator in interface Area
        Returns:
        true when this area is a vertical separator
      • isSeparator

        public boolean isSeparator()
        Description copied from interface: Area
        Checks whether the area can be interpreted as any kind of separator.
        Specified by:
        isSeparator in interface Area
        Returns:
        true when this area is a separator
      • isExplicitlySeparated

        public boolean isExplicitlySeparated()
        Description copied from interface: Area
        When set to true, the area is considered to be separated from other areas explicitly, i.e. independently on its real borders or background. This is usually used for some new superareas.
        Specified by:
        isExplicitlySeparated in interface Area
        Returns:
        true, if the area is explicitly separated
      • setExplicitlySeparated

        public void setExplicitlySeparated​(boolean explicitlySeparated)
        Description copied from interface: Area
        When set to true, the area is considered to be separated from other areas explicitly, i.e. independently on its real borders or background. This is usually used for some new superareas.
        Specified by:
        setExplicitlySeparated in interface Area
        Parameters:
        explicitlySeparated - true, if the area should be explicitly separated
      • createSuperArea

        public Area createSuperArea​(Rectangular gp,
                                    List<Area> selected,
                                    String name)
        Description copied from interface: Area
        Creates a new subarea from a specified region of the area and moves the selected child nodes to the new area.
        Specified by:
        createSuperArea in interface Area
        Parameters:
        gp - the subarea bounds
        selected - nodes to be moved to the new area
        name - the name (identification) of the new area
        Returns:
        the new AreaNode created in the tree or null, if nothing was created
      • insertParent

        public void insertParent​(Area newParent,
                                 Area child)
        Description copied from interface: Area
        Inserts a new area as a new parent of the given child area. The given area is replaced by the new parent and it becomes a child area of the parent.
        Specified by:
        insertParent in interface Area
        Parameters:
        newParent - the new parent area (replacement)
        child - the child area that should be replaced
      • copy

        public Area copy()
        Description copied from interface: Area
        Creates a copy of the area and makes it a next sibling of the source area.
        Specified by:
        copy in interface Area
        Returns:
        the new area
      • setGridPosition

        public void setGridPosition​(Rectangular gp)
        Sets the grid position of this area within the parent topology.
        Specified by:
        setGridPosition in interface Area
        Parameters:
        gp - the new grid position
      • getGridPosition

        public Rectangular getGridPosition()
        Gets the grid position of this area within the parent topology.
        Specified by:
        getGridPosition in interface Area
        Returns:
        the grid position or a unit rectangle when there is no parent
      • getBoxDescription

        protected String getBoxDescription​(Box box)
        Obtains a box description used as the default area name when the area is created from a box.
        Parameters:
        box -
        Returns:
      • recomputeTextStyle

        protected void recomputeTextStyle()
        Recomputes the average text style after some boxes or child areas have been added, removed or changed (e.g. added or removed boxes).
        Overrides:
        recomputeTextStyle in class DefaultTreeContentRect<Area>