com.aspose.slides
Class SmartArtNodeCollection

java.lang.Object
  extended by com.aspose.slides.SmartArtNodeCollection
All Implemented Interfaces:
com.aspose.ms.System.Collections.IEnumerable, ISmartArtNodeCollection, java.lang.Iterable

public class SmartArtNodeCollection
extends java.lang.Object
implements ISmartArtNodeCollection

Represents a collection of a SmartArt nodes.


Method Summary
 ISmartArtNode addNode()
           Add new smart art node or sub node.
 ISmartArtNode addNodeByPosition(int position)
           Add new node in the selected position of nodes collection
 void copyTo(com.aspose.ms.System.Array array, int index)
           Copies all elements from the collection to the specified array.
 ISmartArtNode get_Item(int index)
           Returns node by index
 int getCount()
           Returns count of nodes in collection
 ISmartArtNode getNodeByPosition(int position)
           Get node by position between siblings
 java.lang.Object getSyncRoot()
           Returns a synchronization root.
 boolean isSynchronized()
           Returns a value indicating whether access to the collection is synchronized (thread-safe).
 com.aspose.ms.System.Collections.IEnumerator iterator()
           Returns an enumerator for the entire collection.
 void removeNode(int index)
           Remove node or sub node by index
 void removeNode(ISmartArtNode node)
           Remove node or sub node
 boolean removeNodeByPosition(int position)
           Remove node from selected position
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getCount

public int getCount()

Returns count of nodes in collection

Specified by:
getCount in interface ISmartArtNodeCollection

get_Item

public ISmartArtNode get_Item(int index)

Returns node by index

Specified by:
get_Item in interface ISmartArtNodeCollection
Parameters:
index - The zero-based index of the element
Returns:

getNodeByPosition

public ISmartArtNode getNodeByPosition(int position)

Get node by position between siblings


 
 [C#]
 SmartArt smart = pres.Slides[0].Shapes.AddSmartArt(0, 0, 400, 400, SmartArtLayoutType.StackedList);
 SmartArtNode node = smart.AllNodes[0];
 SmartArtNode chNode = node.ChildNodes.GetNodeByPosition(3);
 
 [Visual Basic]
 Private smart As SmartArt = pres.Slides(0).Shapes.AddSmartArt(0, 0, 400, 400, SmartArtLayoutType.StackedList)
 Private node As SmartArtNode = smart.AllNodes(0)
 Private chNode As SmartArtNode = node.ChildNodes.GetNodeByPosition(3)
 

Specified by:
getNodeByPosition in interface ISmartArtNodeCollection
Parameters:
position - Zero-based position
Returns:
First matched node, -or- null if node with this position does not exist

addNode

public ISmartArtNode addNode()

Add new smart art node or sub node.


 
 [C#]
 Presentation pres = new Presentation("demo.pptx");
 SmartArt smart = (SmartArt) pres.Slides[0].Shapes[0];
 SmartArtNode exNode = smart.AllNodes[0];
 SmartArtNode newNode = exNode.ChildNodes.AddNode();
 
 [Visual Basic]
 Private pres As New Presentation("demo.pptx")
 Private smart As SmartArt = DirectCast(pres.Slides(0).Shapes(0), SmartArt)
 Private exNode As SmartArtNode = smart.AllNodes(0)
 Private newNode As SmartArtNode = exNode.ChildNodes.AddNode()
 

Specified by:
addNode in interface ISmartArtNodeCollection
Returns:
Added node

removeNode

public void removeNode(int index)

Remove node or sub node by index

Specified by:
removeNode in interface ISmartArtNodeCollection
Parameters:
index - Zero-based index of node
Throws:
com.aspose.ms.System.ArgumentOutOfRangeException - index is less than 0. -or- index is equal to or greater than siblings count

removeNode

public void removeNode(ISmartArtNode node)

Remove node or sub node


 
 [C#]
 Presentation pres = new Presentation("demo.pptx");
 SmartArt smart = (SmartArt) pres.Slides[0].Shapes[0];
 if (smart.AllNodes.Count > 0 )
        {
            SmartArtNode node =  smart.AllNodes[0];
            smart.AllNodes.RemoveNode(node);
        }
 
 [Visual Basic]
 Dim pres As New Presentation("demo.pptx")
 Dim smart As SmartArt = DirectCast(pres.Slides(0).Shapes(0), SmartArt)
 If smart.AllNodes.Count > 0 Then
        Dim node As SmartArtNode = smart.AllNodes(0)
        smart.AllNodes.RemoveNode(node)
 End If
 

Specified by:
removeNode in interface ISmartArtNodeCollection
Parameters:
node - Node to remove

removeNodeByPosition

public boolean removeNodeByPosition(int position)

Remove node from selected position


 
 [C#]
 SmartArt smart = pres.Slides[0].Shapes.AddSmartArt(0, 0, 400, 400, SmartArtLayoutType.StackedList);
 SmartArtNode node = smart.AllNodes[0];
 if (node.ChildNodes.Count >=5)
 {
   node.ChildNodes.RemoveNodeByPosition(3);
 }
 
 [Visual Basic]
 Dim smart As SmartArt = pres.Slides(0).Shapes.AddSmartArt(0, 0, 400, 400, SmartArtLayoutType.StackedList)
 Dim node As SmartArtNode = smart.AllNodes(0)
 If node.ChildNodes.Count >= 5 Then
        node.ChildNodes.RemoveNodeByPosition(3)
 End If
 

Specified by:
removeNodeByPosition in interface ISmartArtNodeCollection
Parameters:
position -
Returns:
True if removed successfully, otherwise false

addNodeByPosition

public ISmartArtNode addNodeByPosition(int position)

Add new node in the selected position of nodes collection


 
 [C#]
 SmartArt smart = pres.Slides[0].Shapes.AddSmartArt(0, 0, 400, 400, SmartArtLayoutType.StackedList);
 SmartArtNode node = smart.AllNodes[0];
 SmartArtNode chNode = node.ChildNodes.AddNodeByPosition(2);
 
 [Visual Basic]
 Private smart As SmartArt = pres.Slides(0).Shapes.AddSmartArt(0, 0, 400, 400, SmartArtLayoutType.StackedList)
 Private node As SmartArtNode = smart.AllNodes(0)
 Private chNode As SmartArtNode = node.ChildNodes.AddNodeByPosition(2)
 

Specified by:
addNodeByPosition in interface ISmartArtNodeCollection
Parameters:
position - Zero-base node position
Returns:
Added node
Throws:
com.aspose.ms.System.ArgumentOutOfRangeException - position is less than 0

iterator

public com.aspose.ms.System.Collections.IEnumerator iterator()

Returns an enumerator for the entire collection.

Specified by:
iterator in interface com.aspose.ms.System.Collections.IEnumerable
Specified by:
iterator in interface java.lang.Iterable
Returns:

copyTo

public void copyTo(com.aspose.ms.System.Array array,
                   int index)

Copies all elements from the collection to the specified array.

Parameters:
array -
index -

isSynchronized

public boolean isSynchronized()

Returns a value indicating whether access to the collection is synchronized (thread-safe).


getSyncRoot

public java.lang.Object getSyncRoot()

Returns a synchronization root. Readonly object.