newntui/discovermdi/src/disgraphnode.cpp
//------------------------------------------------------------------------------------
// This method will evaluate "accessGet" server script passing this
// node entity as a parameter.It will assign the ID's for all newly
// created nodes (which are indexes in the global set), will assign
// to all new nodes the script which will extract the name from the 
// entity ("accessNodeName"),will assign to all newly created nodes
// the script which will return image index receving the node entity
// as an argument, will assing the script to extract node fields, 
// extract the name and image index from the field. Thee styles will
// be assigned to the new nodes : unselected,selected and focused
// styles.
// The "accessGet" script will return a list of indexes for the 
// newly created nodes in the global server array.
//------------------------------------------------------------------------------------
This method will evaluate "accessGet" server script passing this
node entity as a parameter.It will assign the ID's for all newly
created nodes (which are indexes in the global set), will assign
to all new nodes the script which will extract the name from the
entity ("accessNodeName"),will assign to all newly created nodes
the script which will return image index receving the node entity
as an argument, will assing the script to extract node fields,
extract the name and image index from the field. Thee styles will
be assigned to the new nodes : unselected,selected and focused
styles.
The "accessGet" script will return a list of indexes for the
newly created nodes in the global server array.
This method will evaluate " accessGet " server script passing this node entity as a parameter . It will assign the ID ' s for all newly created nodes ( which are indexes in the global set ) will assign to all new nodes the script which will extract the name from the entity ( " accessNodeName " ) will assign to all newly created nodes the script which will return image index receving the node entity as an argument will assing the script to extract node fields extract the name and image index from the field . Thee styles will be assigned to the new nodes : unselected selected and focused styles . The " accessGet " script will return a list of indexes for the newly created nodes in the global server array .
void CDisGraphNode::CreateParentNodes(CString* accessCreateChildren, 
									 CString* accessCreateParent,
				                     CString* accessCreateFields,
					                 CString* accessGetNodeName,
					                 CString* accessGetFieldName,
					                 CString* accessGetNodeImage,
					                 CString* accessGetFieldImage,
					                 CString* accessTestChildren,
					                 CString* accessTestParents,
					                 CNodeProperties* nodeUnselected,
					                 CNodeProperties* nodeSelected,
					                 CNodeProperties* nodeFocused,
					                 CEdgeProperties* edgeUnselected,
					                 CEdgeProperties* edgeSelected,
					                 CEdgeProperties* edgeFocused) {
CString command;
CString result;
int* nodeIDs;
register i;
   if(m_ParentsCreated == TRUE) return;
   CString childrenCreator;
   CString parentsCreator;
   CString fieldsCreator;
   CString nodeNameExtractor;
   CString fieldNameExtractor;
   CString nodeImageExtractor;
   CString fieldImageExtractor;
   CString testChildren;
   CString testParents;
   if(accessCreateChildren!=NULL) childrenCreator=*accessCreateChildren;
   else childrenCreator = m_ChildrenCreator;
   if(accessCreateParent!=NULL) parentsCreator=*accessCreateParent;
   else parentsCreator = m_ParentsCreator;
   if(accessCreateFields!=NULL) fieldsCreator=*accessCreateFields;
   else fieldsCreator = m_FieldsCreator;
   if(accessGetNodeName!=NULL) nodeNameExtractor=*accessGetNodeName;
   else nodeNameExtractor = m_NodeNameExtractor;
   if(accessGetFieldName!=NULL) fieldNameExtractor=*accessGetFieldName;
   else fieldNameExtractor = m_FieldNameExtractor;
   if(accessGetNodeImage!=NULL) nodeImageExtractor=*accessGetNodeImage;
   else nodeImageExtractor = m_NodeImageExtractor;
   if(accessGetFieldImage!=NULL) fieldImageExtractor=*accessGetFieldImage;
   else fieldImageExtractor = m_FieldImageExtractor;
   if(accessTestChildren!=NULL) testChildren=*accessTestChildren;
   else testChildren = m_ChildTestScript;
   if(accessTestParents!=NULL) testParents=*accessTestParents;
   else testParents = m_ParentTestScript;
   CNodeProperties* pNodeUnselected;
   CNodeProperties* pNodeSelected;
   CNodeProperties* pNodeFocused;
   CEdgeProperties* pEdgeUnselected;
   CEdgeProperties* pEdgeSelected;
   CEdgeProperties* pEdgeFocused;
   if(nodeUnselected!=NULL) pNodeUnselected = nodeUnselected;
   else pNodeUnselected = m_NodeUnselected;
   if(nodeSelected!=NULL) pNodeSelected = nodeSelected;
   else pNodeSelected = m_NodeSelected;
   if(nodeFocused!=NULL) pNodeFocused = nodeFocused;
   else pNodeFocused = m_NodeFocused;
   if(edgeUnselected!=NULL) pEdgeUnselected = edgeUnselected;
   else pEdgeUnselected = m_EdgeUnselected;
   if(edgeSelected!=NULL) pEdgeSelected = edgeSelected;
   else pEdgeSelected = m_EdgeSelected;
   if(edgeFocused!=NULL) pEdgeFocused = edgeFocused;
   else pEdgeFocused = m_EdgeFocused;
   command.Format("%s %u",parentsCreator,m_NodeID);
   result = m_ParentGraph->Evaluate(command);
   int nodesAmount = m_ParentGraph->ParseCreationResults(result,&nodeIDs);
   if(nodesAmount==0) return;
   for(i=0;i<nodesAmount;i++) {
	   CDisGraphNode* pNode;
	   pNode=m_ParentGraph->FindNodeWithID(nodeIDs[i]);
	   if(pNode==NULL) {
	       pNode = (CDisGraphNode *)m_ParentGraph->addNode();
	       pNode->SetNode( nodeIDs[i],
					       childrenCreator,
					       parentsCreator,
					       fieldsCreator,
					       nodeNameExtractor,
                           fieldNameExtractor,
                           nodeImageExtractor,
                           fieldImageExtractor,
					       testChildren,
					       testParents,
					       pNodeUnselected,
					       pNodeSelected,
					       pNodeFocused,
					       pEdgeUnselected,
					       pEdgeSelected,
					       pEdgeFocused
					     );
	       pNode->m_ChildNode=FALSE;
	       pNode->m_ParentNode=TRUE;
	       pNode->ExtractFields();
	       pNode->ExtractName();
	       pNode->ExtractNodeKind();
	       pNode->ExtractParentChildEnable();
	       pNode->SetChildrenCreated(TRUE);
	   }
	   CDisGraphEdge* pEdge;
	   pEdge = (CDisGraphEdge *)m_ParentGraph->addEdge(pNode,this);
	   pEdge->Port();
	   pEdge->SetEdge(0,pEdgeUnselected,pEdgeSelected,pEdgeFocused);
   }
   delete nodeIDs;
   m_ParentsCreated = TRUE;
   m_Collapsed=FALSE;
}
void CDisGraphNode :: CreateParentNodes ( CString * accessCreateChildren , CString * accessCreateParent , CString * accessCreateFields , CString * accessGetNodeName , CString * accessGetFieldName , CString * accessGetNodeImage , CString * accessGetFieldImage , CString * accessTestChildren , CString * accessTestParents , CNodeProperties * nodeUnselected , CNodeProperties * nodeSelected , CNodeProperties * nodeFocused , CEdgeProperties * edgeUnselected , CEdgeProperties * edgeSelected , CEdgeProperties * edgeFocused ) { CString command ; CString result ; int * nodeIDs ; register i ; if ( m_ParentsCreated == TRUE ) return ; CString childrenCreator ; CString parentsCreator ; CString fieldsCreator ; CString nodeNameExtractor ; CString fieldNameExtractor ; CString nodeImageExtractor ; CString fieldImageExtractor ; CString testChildren ; CString testParents ; if ( accessCreateChildren != NULL ) childrenCreator = * accessCreateChildren ; else childrenCreator = m_ChildrenCreator ; if ( accessCreateParent != NULL ) parentsCreator = * accessCreateParent ; else parentsCreator = m_ParentsCreator ; if ( accessCreateFields != NULL ) fieldsCreator = * accessCreateFields ; else fieldsCreator = m_FieldsCreator ; if ( accessGetNodeName != NULL ) nodeNameExtractor = * accessGetNodeName ; else nodeNameExtractor = m_NodeNameExtractor ; if ( accessGetFieldName != NULL ) fieldNameExtractor = * accessGetFieldName ; else fieldNameExtractor = m_FieldNameExtractor ; if ( accessGetNodeImage != NULL ) nodeImageExtractor = * accessGetNodeImage ; else nodeImageExtractor = m_NodeImageExtractor ; if ( accessGetFieldImage != NULL ) fieldImageExtractor = * accessGetFieldImage ; else fieldImageExtractor = m_FieldImageExtractor ; if ( accessTestChildren != NULL ) testChildren = * accessTestChildren ; else testChildren = m_ChildTestScript ; if ( accessTestParents != NULL ) testParents = * accessTestParents ; else testParents = m_ParentTestScript ; CNodeProperties * pNodeUnselected ; CNodeProperties * pNodeSelected ; CNodeProperties * pNodeFocused ; CEdgeProperties * pEdgeUnselected ; CEdgeProperties * pEdgeSelected ; CEdgeProperties * pEdgeFocused ; if ( nodeUnselected != NULL ) pNodeUnselected = nodeUnselected ; else pNodeUnselected = m_NodeUnselected ; if ( nodeSelected != NULL ) pNodeSelected = nodeSelected ; else pNodeSelected = m_NodeSelected ; if ( nodeFocused != NULL ) pNodeFocused = nodeFocused ; else pNodeFocused = m_NodeFocused ; if ( edgeUnselected != NULL ) pEdgeUnselected = edgeUnselected ; else pEdgeUnselected = m_EdgeUnselected ; if ( edgeSelected != NULL ) pEdgeSelected = edgeSelected ; else pEdgeSelected = m_EdgeSelected ; if ( edgeFocused != NULL ) pEdgeFocused = edgeFocused ; else pEdgeFocused = m_EdgeFocused ; command . Format ( " " , parentsCreator , m_NodeID ) ; result = m_ParentGraph -> Evaluate ( command ) ; int nodesAmount = m_ParentGraph -> ParseCreationResults ( result , & nodeIDs ) ; if ( nodesAmount == 0 ) return ; for ( i = 0 ; i < nodesAmount ; i ++ ) { CDisGraphNode * pNode ; pNode = m_ParentGraph -> FindNodeWithID ( nodeIDs [ i ] ) ; if ( pNode == NULL ) { pNode = ( CDisGraphNode * ) m_ParentGraph -> addNode ( ) ; pNode -> SetNode ( nodeIDs [ i ] , childrenCreator , parentsCreator , fieldsCreator , nodeNameExtractor , fieldNameExtractor , nodeImageExtractor , fieldImageExtractor , testChildren , testParents , pNodeUnselected , pNodeSelected , pNodeFocused , pEdgeUnselected , pEdgeSelected , pEdgeFocused ) ; pNode -> m_ChildNode = FALSE ; pNode -> m_ParentNode = TRUE ; pNode -> ExtractFields ( ) ; pNode -> ExtractName ( ) ; pNode -> ExtractNodeKind ( ) ; pNode -> ExtractParentChildEnable ( ) ; pNode -> SetChildrenCreated ( TRUE ) ; } CDisGraphEdge * pEdge ; pEdge = ( CDisGraphEdge * ) m_ParentGraph -> addEdge ( pNode , this ) ; pEdge -> Port ( ) ; pEdge -> SetEdge ( 0 , pEdgeUnselected , pEdgeSelected , pEdgeFocused ) ; } delete nodeIDs ; m_ParentsCreated = TRUE ; m_Collapsed = FALSE ; }
This method will evaluate "accessGet" server script passing this
node entity as a parameter.It will assign the ID's for all newly
created nodes (which are indexes in the global set), will assign
to all new nodes the script which will extract the name from the
entity ("accessNodeName"),will assign to all newly created nodes
the script which will return image index receving the node entity
as an argument, will assing the script to extract node fields,
extract the name and image index from the field.
This method will evaluate " accessGet " server script passing this node entity as a parameter . It will assign the ID ' s for all newly created nodes ( which are indexes in the global set ) will assign to all new nodes the script which will extract the name from the entity ( " accessNodeName " ) will assign to all newly created nodes the script which will return image index receving the node entity as an argument will assing the script to extract node fields extract the name and image index from the field .
// Determining which scripts will be assigned to children // Script to create children // Script to create parent // Script to create node fields // Script to extract node name // Script to extract field name // Script to extract node image // Script to extract field image // Script to test if the node has children // Script to test if node has parents // Determining which propertires we will use // Nodes // Edges // this script will create entities set from the given one and will // place all entities to the global graph array. It will return the // list of new entities indexes to create related client nodes. // Maybe this node is in the graph ? // Inserting child nodes into the graph // Adding parent-child connections // removing new nodes IDs array created by ParseCreationResults