public void Init(GraphConversationDataControl conversation)
        {
            this.conversation = (GraphConversation)conversation.getConversation();

            ConversationNodeEditorFactory.Intance.ResetInstance();

            InitWindows();
        }
        public override bool duplicateElement(DataControl dataControl)
        {
            if (!(dataControl is GraphConversationDataControl))
            {
                return(false);
            }

            //try
            //{
            GraphConversation newElement = (GraphConversation)(((GraphConversation)(dataControl.getContent())).Clone());
            string            id         = newElement.getId();
            int i = 1;

            do
            {
                id = newElement.getId() + i;
                i++;
            } while (!controller.isElementIdValid(id, false));
            newElement.setId(id);
            conversationsList.Add(newElement);
            conversationsDataControlList.Add(new GraphConversationDataControl(newElement));
            controller.getIdentifierSummary().addConversationId(id);

            string oldId = ((GraphConversation)(dataControl.getContent())).getId();

            /*bool posConfigured = ConversationConfigData.isConversationConfig( oldId );
             * if (posConfigured) {
             *  for (int j = 0; j < newElement.getAllNodes( ).size( ); j++) {
             *      int centerX = ConversationConfigData.getNodeX( oldId, j
             *              );
             *      int centerY = ConversationConfigData.getNodeY( oldId, j );
             *      ConversationConfigData.setNodeX( id, j, centerX );
             *      ConversationConfigData.setNodeY( id, j, centerY );
             *  }
             * }*/
            GraphConversationDataControl g = (GraphConversationDataControl)dataControl;

            for (int j = 0; j < g.getAllNodes().Count; j++)
            {
                int centerX = g.getEditorX(g.getAllNodes()[j]);
                int centerY = g.getEditorY(g.getAllNodes()[j]);
                newElement.getAllNodes()[j].setEditorX(centerX);
                newElement.getAllNodes()[j].setEditorY(centerY);
            }


            return(true);
        }
예제 #3
0
        private void performAddElement(object sender, string conversationId)
        {
            // If some value was typed and the identifier is valid
            if (!controller.isElementIdValid(conversationId))
            {
                conversationId = controller.makeElementValid(conversationId);
            }

            Conversation            newConversation            = new GraphConversation(conversationId);
            ConversationDataControl newConversationDataControl = new GraphConversationDataControl((GraphConversation)newConversation);

            // Add the new conversation
            conversationsList.Add(newConversation);
            conversationsDataControlList.Add(newConversationDataControl);
            controller.IdentifierSummary.addId <Conversation>(conversationId);
        }