Page Index Toggle Pages: [1] 2  Send TopicPrint
Hot Topic (More than 10 Replies) IconNodes (Read 9307 times)
kumarsrmt
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 23
Joined: Sep 29th, 2009
IconNodes
Sep 29th, 2009 at 5:31pm
Print Post  
can anybody provide
IconNodes sample project that comes with NetDiagram.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: IconNodes
Reply #1 - Sep 29th, 2009 at 6:12pm
Print Post  
You can find it in the VS2005 (.NET 2.0)\Samples\C#\IconNodes subfolder under the Netdiagram installation folder.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
kumarsrmt
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 23
Joined: Sep 29th, 2009
Re: IconNodes
Reply #2 - Oct 2nd, 2009 at 6:57pm
Print Post  
hi Stoyo
You are doing great help for me since 4 days..i am almost done..but finally i got 3 new requirements

1.how can add or remove shapes in shapelistbox(clinetside)

2.if i drag shape in to diagramview  it sets a place  ..i am unable to change that shape place..how can drag a shape from one palce to another place in diagramview

3.right now i am doing like this..when i right click on node it gives me custom properites after clicking on properits .it takes me to another page....is it possibel if i double click on node it directly takes me into another page?


i am using javaapllet in clientside

Thank you so much for your time
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: IconNodes
Reply #3 - Oct 3rd, 2009 at 9:19am
Print Post  
Hi,

1. Try this in the Flowcharter sample project:

Code
Select All
<script type="text/javascript">

function addShapesToList(shapelistApplet, shapeIdArray)
{
	var scriptHelper = shapelistApplet.getScriptHelper();
	var shapeList = shapelistApplet.getShapeListBox();
	for (i = 0; i < shapeIdArray.length; ++i)
	{
		var shape = scriptHelper.shapeFromId(shapeIdArray[i]);
		shapeList.addShape(shape);
	}
}

function removeShapeFromList(shapelistApplet, shapeId)
{
	var index = indexFromShapeId(shapelistApplet, shapeId);
	if (index > -1)
		shapelistApplet.getShapeListBox().removeShapeAt(index);
}

function indexFromShapeId(shapelistApplet, shapeId)
{
	var shapelist = shapelistApplet.getShapeListBox();
	for (i = 0; i < shapelist.getShapeCount(); ++i)
		if (shapelist.getShapeAt(i).getId() == shapeId)
			return i;

	return -1;
}

function testAddShapes()
{
	var applet = <%= shapeList.AppletElement %>;
	applet.getShapeListBox().clearShapes();
	addShapesToList(applet, [ "Rectangle", "Ellipse", "Process"]);
}

function testRemoveShape()
{
	var applet = <%= shapeList.AppletElement %>;
	removeShapeFromList(applet, "Rectangle");
}

</script> 

  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: IconNodes
Reply #4 - Oct 3rd, 2009 at 9:27am
Print Post  
2. Usually you must first click the shape once to select it and get its adjustment handles appear. Then you can move the shape by dragging the center handle. You could enable moving shapes without clicking them first by setting <ndiag:DiagramView ModificationStart="AutoHandles" />

3. Similar to how you handle NodeClickedScript to show a menu, you could handle NodeDoubleClickedScript to directly open the other page.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
kumarsrmt
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 23
Joined: Sep 29th, 2009
Re: IconNodes
Reply #5 - Oct 5th, 2009 at 8:31am
Print Post  
HI Stoyo,

      You have sent the javscript functions for the first point(Flowcharter Example).But I have to call those functions in an event.So please send for which event i have to call these functions.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: IconNodes
Reply #6 - Oct 5th, 2009 at 10:15am
Print Post  
These methods were called from the onclick of some buttons in my test app. I suppose you would call them from AppletStarted script or from some menu command handlers.
  
Back to top
 
IP Logged
 
kumarsrmt
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 23
Joined: Sep 29th, 2009
Re: IconNodes
Reply #7 - Oct 5th, 2009 at 3:08pm
Print Post  
HI Stoyo

Thank u for your reply..BUt i could n.t understand the last message you post.Can you explain in deatail how can i add or removea shop..do we have these in any sample project...can  you please explain this.

Thanks
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: IconNodes
Reply #8 - Oct 5th, 2009 at 6:15pm
Print Post  
Hi,

You need only the first three methods, and could call them from the AppletStartedScript, or from some event handlers for UI elements on your page. testAdd and testRemove were just something I used to test the former methods.

You need these methods only if you must update the shape list dynamically. If you always use the same shapes, you could delete the ones you don't need from the ShapeDesigner tool, and save the remaining ones to a shape library file whose URL you specify in ShapeListbox.ShapeLibraryLocation.

Stoyan
  
Back to top
 
IP Logged
 
kumarsrmt
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 23
Joined: Sep 29th, 2009
Re: IconNodes
Reply #9 - Oct 5th, 2009 at 7:11pm
Print Post  

   Hi,

     We used one method addShapesToList in AppletStartedScript event of shapelist.But how can i add or remove the new shape in to my shapelist.please Can u explain
  
Back to top
 
IP Logged
 
kumarsrmt
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 23
Joined: Sep 29th, 2009
Re: IconNodes
Reply #10 - Oct 5th, 2009 at 8:11pm
Print Post  
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<%@ Register Assembly="MindFusion.Diagramming.WebForms" Namespace="MindFusion.Diagramming.WebForms" TagPrefix="ndiag" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title>Untitled Page</title>
     <script language="javascript" type="text/javascript">

    function onNodeClicked(sender, args)

{

if (args.getMouseButton() == 3)
showContextMenu(args.getNode(), args.getMousePosition());
var menu = null;

var currentNode;

function showContextMenu(node, mousePos)

{

      var applet = <%= diagramView.AppletElement %>;

      var scriptHelper = applet.getScriptHelper();

      var diagView = applet.getDiagramView();

      var diagram = diagView.getDiagram();

      currentNode = node;

      if (!menu)

      {

              menu = diagram.getFactory().createTableNode(mousePos.getX(), mousePos.getY(), 20, 20);

              menu.setRowCount(2);

              menu.setColumnCount(1);

              menu.getCell(0, 0).setText("Properties");

              //menu.getCell(0, 1).setText("Add Order");

              menu.setCaptionHeight(0);

              menu.setCaption("");

              menu.resizeToFitText(true);

              menu.setCellFrameStyle(1);

              menu.setBrush(scriptHelper.createSolidBrush(255, 255, 255));

      }else

      {

              menu.setVisible(true);

              menu.moveTo(mousePos.getX(), mousePos.getY());

      }

}
var node = args.getNode();
       node.setText("edit me!");
       <%=diagramView.AppletElement%>.getDiagramView().beginEdit(node);



//function onCellClicked(sender, args)

//{// if (args.getCell().getText() == "Properties")

     // {

     myRef = window.open('Windows.aspx?PageFlag=' + document.getElementById("tbFileName").value,'mywin',

'left=20,top=20,width=500,height=500,toolbar=1,resizable=0');


     //}

//}
}

function onNodeCreated(sender, args){


  args.getNode().setTag(getUniqueId());
  //var node = args.getNode();
      //node.setText("edit me!");
      //<%=diagramView.AppletElement%>.getDiagramView().beginEdit(node);

 

}

function getUniqueId(){

    var dateObject = new Date();
    var uniqueId = dateObject.getFullYear() + "" + dateObject.getMonth() + "" +
dateObject.getDate() + "" +
dateObject.getTime();
//alert(uniqueId); 
    //return uniqueId;
    document.getElementById("tbFileName").value=uniqueId; 
   
}
function ontextedit(sender, args){
var node = args.getNode();
   node.setText("edit me!");
  <%=diagramView.AppletElement%>.getDiagramView().beginEdit(node);
   }
   
   function addShapesToList(shapelistApplet, shapeIdArray)
{
var scriptHelper = shapelistApplet.getScriptHelper();
var shapeList = shapelistApplet.getShapeListBox();
for (i = 0; i < shapeIdArray.length; ++i)
{
var shape = scriptHelper.shapeFromId(shapeIdArray[i]);
shapeList.addShape(shape);
}
}
</script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
       &nbsp;&nbsp;
       <asp:Button ID="btnSave" runat="server" OnClick="btnSave_Click" Style="left: 10px;
           position: absolute; top: 685px" Text="Save" Width="111px" />
       <asp:Button ID="btnLoad" runat="server" OnClick="btnLoad_Click" Style="left: 354px;
           position: absolute; top: 685px" Text="Load" Width="111px" />
       &nbsp;
       <asp:TextBox ID="tbFileName" runat="server" Style="left: 127px; position: absolute;
           top: 685px">untitled.fc</asp:TextBox>
       <asp:DropDownList ID="listFileNames" runat="server" Style="left: 472px; position: absolute;
           top: 685px" Width="171px">
       </asp:DropDownList>
         <ndiag:DiagramView ID="diagramView" runat="server" Style="left: 4px; width: 650px;
           position: absolute; top: 3px; height: 650px" NodeDoubleClickedScript="onNodeClicked" NodeCreatedScript="onNodeCreated" NodeModifiedScript="ontextedit" ModificationStart="AutoHandles" BackColor="Blue" BorderColor="Cyan" Font-Bold="True" Font-Names="Arial" Font-Size="Large" InplaceEditFont="Arial, 15.75pt, style=Bold" AppletStartedScript="addShapesToList" >
             <Diagram RowHighlightBrush="s:#FFB9D1EA" />
         </ndiag:DiagramView>
       <ndiag:ShapeListBox ID="shapeList" runat="server" Style="left: 656px; width: 160px;
           position: absolute; top: -4px; height:650px; background-color: white" AllowRemove="True" BackColor="Olive" BorderColor="Blue" Font-Bold="False" Font-Size="Medium" ForeColor="Cyan" ShapeFillColor="White" AppletStartedScript="addShapesToList" />

       <ndiag:Overview ID="ovw" runat="server" DiagramViewID="diagramView" Style="left: 650px; width: 160px;
           position: absolute; top: 650px; height: 160px" />
    </div>
    </form>
</body>
</html>

[/code]

can you suggetsme how can it works
We used one method addShapesToList in AppletStartedScript event of shapelist.But how can i add or remove the new shape in to my shapelist.hwhat are the next steps w e need to folow and how can it works..thank you so much for your time
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: IconNodes
Reply #11 - Oct 6th, 2009 at 4:54am
Print Post  
I cannot understand what you need. If you can call addShapesToList to add shapes from the AppletStartedScript, you can call it the same way from other event handlers.
  
Back to top
 
IP Logged
 
kumarsrmt
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 23
Joined: Sep 29th, 2009
Re: IconNodes
Reply #12 - Oct 6th, 2009 at 11:42am
Print Post  
Iam adding the method in shaplist like <ndiag:ShapeListBox ID="shapeList" runat="server" Style="left: 656px; width: 160px;
          position: absolute; top: -4px; height:650px; background-color: white" AllowRemove="True" BackColor="Olive" BorderColor="Blue" Font-Bold="False" Font-Size="Medium" ForeColor="Cyan" ShapeFillColor="White" AppletStartedScript="addShapesToList" />

After running the page Iam getting the same tools in the shapelist box.Can i know How can i add the new shape to the shapelist box    For example I will add one image by browsing the folder and upload in the server.  For This one how can i upload the new shape in the new shape in the shape list box.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: IconNodes
Reply #13 - Oct 6th, 2009 at 12:32pm
Print Post  
addShapesToList expects some arguments, but AppletStartedScript is called without ones. You should create a no-args functions that calls addShapesToList with the required parameters (similar to testAddShapes above), and set that function as AppeltStartedScript.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
kumarsrmt
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 23
Joined: Sep 29th, 2009
Re: IconNodes
Reply #14 - Oct 6th, 2009 at 2:44pm
Print Post  
thank you stoyo

so i can't add shapes to shape list box in clientside?

ok if i want to remove someshapes  which event i have to call
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: [1] 2 
Send TopicPrint