Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic set a id to shape (Read 4751 times)
gurram
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 11
Joined: Oct 1st, 2009
set a id to shape
Oct 1st, 2009 at 3:39pm
Print Post  
Hi
How can i set id to shape..like if i draged one shape
how can it take id because i am trying to dispaly some data in back side..each shape has different data..each shape represents w warehouse..if i cilck on ashap itshould diaplya that ware house data..can please tell me how can i set id for each shape
  
Back to top
 
IP Logged
 
Mohammad
YaBB Newbies
*
Offline


Hello everybody :)

Posts: 32
Joined: Oct 2nd, 2009
Re: set a id to shape
Reply #1 - Oct 2nd, 2009 at 1:56am
Print Post  
You should use Tag property of each DiagramNode. If ClientSideMode is JavaApplet you can use the following sample code:

function onNodeCreated(sender, args){
args.getNode().setTag(getUniqueId);
}

function getUniqueId(){
var dateObject = new Date();
var uniqueId = dateObject.getFullYear() + "" + dateObject.getMonth() + "" +
dateObject.getDate() + "" +
dateObject.getTime();
return uniqueId;
}

If ClientSideMode is ImageMap you could assign unique id to Tag property in server side.

hope that helps
Mohammad
  
Back to top
 
IP Logged
 
gurram
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 11
Joined: Oct 1st, 2009
Re: set a id to shape
Reply #2 - Oct 2nd, 2009 at 5:26am
Print Post  
Code
Select All
<%@ 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>NetDiagram: FlowCharter sample</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.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());
	 }
}
}
function onCellClicked(sender, args)
{

if (args.getCell().getText() == "Properties")
{
myRef = window.open('http://localhost:1812/Flowcharter/Windows.aspx','mywin',
'left=20,top=20,width=500,height=500,toolbar=1,resizable=0');



}

function onNodeCreated(sender, args){
 args.getNode().setTag(getUniqueId);
}

function getUniqueId(){
   var dateObject = new Date();
   var uniqueId = dateObject.getFullYear() + "" + dateObject.getMonth() + "" +
 dateObject.getDate() + "" +
 dateObject.getTime();
   return uniqueId;
}


</script>
</head>
<body>
    <form id="form1" runat="server">


	 <ndiag:DiagramView ID="diagramView" runat="server" Style="left: 0px; width: 480px;
	     position: absolute; top: 0px; height: 480px" NodeClickedScript="onNodeClicked" CellClickedScript="onCellClicked" NodeCreatedScript="onNodeCreated" />


	 <ndiag:ShapeListBox ID="shapeList" runat="server" Style="left: 480px; width: 160px;
	     position: absolute; top: 0px; height: 320px; background-color: white" />
	 <ndiag:Overview ID="ovw" runat="server" DiagramViewID="diagramView" Style="left: 480px; width: 160px;
	     position: absolute; top: 320px; height: 160px" />
	 <asp:Button ID="btnSave" runat="server" OnClick="btnSave_Click" Style="left: 10px;
		position: absolute; top: 490px" Text="Save" Width="111px" />
	  <asp:Button ID="btnLoad" runat="server" Style="left: 354px; position: absolute; top: 490px"
		Text="Load" Width="111px" OnClick="btnLoad_Click" />
	  &nbsp;
	  <asp:TextBox ID="tbFileName" runat="server" Style="left: 127px; position: absolute;
		top: 492px">untitled.fc</asp:TextBox>
	  <asp:DropDownList ID="listFileNames" runat="server" Style="left: 472px; position: absolute;
		top: 492px" Width="171px">
	  </asp:DropDownList>
    </form>
</body>
</html>






 






I want to store this Uniqueid
in database
how can i call
in server side?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: set a id to shape
Reply #3 - Oct 2nd, 2009 at 10:14am
Print Post  
If the Tag is a string value, the control transfers it automatically between the client and the server. So, you should be able to get the ID through the item.Tag property.
  
Back to top
 
IP Logged
 
gurram
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 11
Joined: Oct 1st, 2009
Re: set a id to shape
Reply #4 - Oct 2nd, 2009 at 2:19pm
Print Post  
Iam using the Daigram view in that iam uisng the shapenode class.So Iam getting the shapes of flowchart at run time.Iam also setting uniqueid for each shape of flow chart like this

function onNodeCreated(sender, args){

  args.getNode().setTag(getUniqueId);
}

function getUniqueId(){
    var dateObject = new Date();
    var uniqueId = dateObject.getFullYear() + "" + dateObject.getMonth() + "" +
dateObject.getDate() + "" +
dateObject.getTime();
    return uniqueId;
}


After getting uniqueid from function I want the send the unique value to another window using the below code

function onCellClicked(sender, args)

{



     if (args.getCell().getText() == "Add Location")

     {

     myRef = window.open('Default2.aspx?Uniqueid=1','mywin',

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


     }

}


In the above Iam usiing the another window Defalut.aspx?Uniqueid=*****

Can u  please suggest me how to call the unique id
Marked as ***** above
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: set a id to shape
Reply #5 - Oct 2nd, 2009 at 3:03pm
Print Post  
You should add parentheses after getUniqueId in onNodeCreated:

args.getNode().setTag(getUniqueId());

Then if using the "currentNode" variable from the menu code, the url should look like:

"Default2.aspx?Uniqueid="+currentNode.getTag().toString()
« Last Edit: Oct 2nd, 2009 at 5:50pm by Stoyo »  
Back to top
 
IP Logged
 
gurram
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 11
Joined: Oct 1st, 2009
Re: set a id to shape
Reply #6 - Oct 5th, 2009 at 4:17pm
Print Post  
hi stoyo.

how can i change background colours in diagramview  and also for node backgrounds...

how can i get text font largr and colors
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: set a id to shape
Reply #7 - Oct 5th, 2009 at 6:03pm
Print Post  
Hi,

Set the BackBrush and ShapeBrush properties of the Diagram object that's displayed inside the DiagramView. You can as well set the Brush property of individual nodes.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint