Class UnitNodeWrapper

  • All Implemented Interfaces:
    CellObject, CellObject2, SupportsClipboard, SupportsEmphasizing

    public class UnitNodeWrapper
    extends DefaultNodeWrapper
    implements CellObject2, SupportsClipboard
    A UnitNodeWrapper serves as an abstraction layer between a tree cell renderer and the unit to render. It manages a list of icons and text(s) that are to be displayed. It maintains a UnitNodeWrapper.UnitNodeWrapperDrawPolicy adapter which governs many of the object's properties.
    Version:
    $Revision: 288 $
    Author:
    $Author: $
    • Constructor Detail

      • UnitNodeWrapper

        public UnitNodeWrapper​(Unit u,
                               java.lang.String prfx,
                               long num,
                               long mod)
        Creates a new UnitNodeWrapper object. The text for the unit is generated from the unit's name and ID and from the arguments.
        Parameters:
        u - The unit
        prfx - A text that is displayed in front of the name
        num - The number of persons
        mod - The modified number of persons
      • UnitNodeWrapper

        public UnitNodeWrapper​(Unit u,
                               java.lang.String text)
        Creates a new UnitNodeWrapper with specified text.
        Parameters:
        u - The unit
        text - The text that is displayed for the unit
    • Method Detail

      • getUnit

        public Unit getUnit()
        Returns the unit represented by the wrapper.
      • toString

        public java.lang.String toString()
        Returns a string representation of the object, which is either pre-set by the constructor or generated from the unit name, id, amount and modified amount (if applicable).
        Specified by:
        toString in interface CellObject
        Overrides:
        toString in class java.lang.Object
        Returns:
        String representation of this CellObject
      • addAdditionalIcon

        public void addAdditionalIcon​(java.lang.String icon)
        Specifies an additional icon that is displayed in front of the unit text.
      • getIconNames

        public java.util.List<java.lang.String> getIconNames()
        Returns null.
        Specified by:
        getIconNames in interface CellObject
        Returns:
        list of icon names or null if no icons shall be displayed.
        See Also:
        CellObject.getIconNames()
      • isShowingAdditional

        public boolean isShowingAdditional()
        Returns the according option of the draw policy.
      • isShowingContainerIcons

        public boolean isShowingContainerIcons()
        Returns the accordant option of the draw policy.
      • isShowingSkillIcons

        public boolean isShowingSkillIcons()
        Returns the accordant option of the draw policy.
      • isShowingOtherIcons

        public boolean isShowingOtherIcons()
        Returns the accordant option of the draw policy.
      • isShowingIconText

        public boolean isShowingIconText()
        Returns the accordant option of the draw policy.
      • isShowingSkillsLessThanOne

        public boolean isShowingSkillsLessThanOne()
        Return true iff skills with level less than one should be shown.
        Returns:
        true iff skills with level less than one should be shown
      • isShowingSkillsLessThanTwo

        public boolean isShowingSkillsLessThanTwo()
        Return true iff skills with level less than two should be shown.
        Returns:
        true iff skills with level less than two should be shown
      • numberOfShownSkills

        public int numberOfShownSkills()
        Returns the maximum number of skill icons that should be shown.
        Returns:
        The maximum number of skill icons that should be shown.
      • isShowingExpectedOnly

        public boolean isShowingExpectedOnly()
        Returns the accordant option of the draw policy.
      • isShowingChanges

        public boolean isShowingChanges()
        Returns the accordant option of the draw policy.
      • isShowingChangesStyled

        public boolean isShowingChangesStyled()
        Returns the accordant option of the draw policy.
      • isShowingChangesText

        public boolean isShowingChangesText()
        Returns the accordant option of the draw policy.
      • isShowingCategorized

        public boolean isShowingCategorized()
        Returns the accordant option of the draw policy.
      • isShowingCategorized

        public boolean isShowingCategorized​(int type)
        Returns the accordant option of the draw policy.
      • setReverseOrder

        public void setReverseOrder​(boolean bool)
        Specifies if the icons should be displayed in reverse order. This overrides the settings if the UnitNodeWrapper.UnitNodeWrapperDrawPolicy.
        Parameters:
        bool -
      • reverseOrder

        public boolean reverseOrder()
        Returns true if the icons should be displayed in reverse order.
        Specified by:
        reverseOrder in interface CellObject2
      • clearBuffer

        public void clearBuffer()
        Clears the collection of icons and indicates that it should be re-created.
      • setText

        public void setText​(java.lang.String text)