Class SoNodeKitListPart

  • All Implemented Interfaces:
    SafeDisposable

    public class SoNodeKitListPart
    extends SoNode
    Group node with restricted children. This node class is very similar to SoGroup with the exception that it specifies restrictions on the type of children that it allows. It is used by nodekits to restrict child types within list parts (see the reference page for SoBaseKit).

    By default, any kind of child may be added. Methods of this class allow you to restrict the type of allowable children, and to lock down the types so that this type list may no longer be altered.

    Inside the SoNodeKitListPart is a container node, which in turn contains the children . The container node is a hidden child, and the type of node used may be set with setContainerType(). In this way, you can make the nodekitlist behave like a group, a separator, or any other subclass of group. The container is not accessible so that the nodekitlist may retain control over what kinds of children are added.

    File format/default:

    NodeKitListPart {

      containerTypeName "Group"
      childTypeNames ""
      containerNode NULL
    }

    See Also:
    SoBaseKit SoNodeKit, SoNodeKitDetail SoNodeKitPath, SoNodekitCatalog, SoSceneKit, SoSeparatorKit, SoShapeKit, SoWrapperKit
    • Constructor Detail

      • SoNodeKitListPart

        public SoNodeKitListPart()
        Constructor.
    • Method Detail

      • getNumChildren

        public int getNumChildren()
        Returns the number of children in the nodekit. This is one of several functions used to edit the children. They parallel those of SoGroup, except that they always check the child types against those which are permissible. See SoGroup for details.
      • getContainerClass

        public java.lang.Class<? extends Inventor> getContainerClass()
        Gets the type of node used as the container .
      • removeChild

        public void removeChild​(SoNode child)
        Removes first instance of given child from nodekit. This is one of several functions used to edit the children. They parallel those of SoGroup, except that they always check the child types against those which are permissible. See SoGroup for details.
      • addChild

        public void addChild​(SoNode child)
        Adds child as last one in nodekit. This is one of several functions used to edit the children. They parallel those of SoGroup, except that they always check the child types against those which are permissible. See SoGroup for details.
      • replaceChild

        public void replaceChild​(int index,
                                 SoNode newChild)
        Replaces child with given index with new child. This is one of several functions used to edit the children. They parallel those of SoGroup, except that they always check the child types against those which are permissible. See SoGroup for details.
      • insertChild

        public void insertChild​(SoNode child,
                                int childIndex)
        Adds a child so that it becomes the one with the given index. This is one of several functions used to edit the children. They parallel those of SoGroup, except that they always check the child types against those which are permissible. See SoGroup for details.
      • findChild

        public int findChild​(SoNode child)
        Finds index of given child within nodekit. Returns -1 if not found. This is one of several functions used to edit the children. They parallel those of SoGroup, except that they always check the child types against those which are permissible. See SoGroup for details.
      • getChild

        public SoNode getChild​(int index)
        Returns the child node with the given index. This is one of several functions used to edit the children. They parallel those of SoGroup, except that they always check the child types against those which are permissible. See SoGroup for details.
      • removeChild

        public void removeChild​(int index)
        Removes child with given index from the nodekit. This is one of several functions used to edit the children. They parallel those of SoGroup, except that they always check the child types against those which are permissible. See SoGroup for details.
      • isTypeLocked

        public boolean isTypeLocked()
        Returns whether the permitted child types and the container type are locked (i.e. cannot be changed). See lockTypes()
      • isTypePermitted

        public boolean isTypePermitted​(java.lang.Class<? extends Inventor> typeToCheck)
        Returns whether a node of type typeToCheck may be added as a child.
      • addChildClass

        public void addChildClass​(java.lang.Class<? extends Inventor> typeToAdd)
        Permits the node type typeToAdd as a child. The first time the addChildType() method is called, the default of SoNode is overridden and only the new typeToAdd is permitted. In subsequent calls to addChildType(), the typeToAdd is added to the existing types.
      • setContainerClass

        public void setContainerClass​(java.lang.Class<? extends Inventor> newContainerType)
        Sets the type of node used as the container .
      • isChildPermitted

        public boolean isChildPermitted​(SoNode child)
        Returns whether the node child may be added to this list. This will return true if the type of child is one of the permissible child types.
      • replaceChild

        public void replaceChild​(SoNode oldChild,
                                 SoNode newChild)
        Replaces first instance of given child with new child. This is one of several functions used to edit the children. They parallel those of SoGroup, except that they always check the child types against those which are permissible. See SoGroup for details.
      • lockTypes

        public void lockTypes()
        This function permanently locks the permitted child types and the container type permanently. Calls to setContainerType() and addChildType() will have no effect after this function is called.
      • containerSet

        public void containerSet​(java.lang.String fieldDataString)
        Sends a string to the set() method on the container node. This is how you can set the value of a switch node if the container node is an SoSwitch, for example.