Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Allowing user to change swimlane header text - ImageMap mode (Read 3924 times)
jlj30
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 183
Joined: Sep 4th, 2011
Allowing user to change swimlane header text - ImageMap mode
Jun 8th, 2012 at 6:39pm
Print Post  
Hi,

I have event handlers for onNodeClicked and onLinkClicked which launch a popup dialog that allows the user to change some of the textual attributes of the shape or link. That is working fine.

I would like to do something similar to allow the user to change the Title of the swimlane Header.
The onCellClicked event doesn't seem to be be applicable.

Is there some technique I can use to accomplish this, or do I need to add a custom button/action outside of the diagram?

Thanks

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Allowing user to change swimlane header text - ImageMap mode
Reply #1 - Jun 11th, 2012 at 8:25am
Print Post  
Hi,

The CellClickedScript is called when you click on TableNode's cell. There is no such event raised for the LaneGrid at this time. You could add a ClickedScript that calls the grid's cellFromPoint method to find out if a swimlane's header has been clicked.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
jlj30
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 183
Joined: Sep 4th, 2011
Re: Allowing user to change swimlane header text - ImageMap mode
Reply #2 - Jun 12th, 2012 at 1:11pm
Print Post  
Hi,

I was going to ask you for some sample code for the Javascript, but it looks like the event does not even fire.  Does ImageMap mode support this event?

Here's my diagram declaration and the simple script I'm calling:

<ndiag:DiagramView ID="DiagramView1" runat="server" ClientSideMode="ImageMap" JarLocation="./JDiagram.jar"
                    Behavior="DoNothing" OnNodeClicked="OnNodeClicked" OnLinkClicked="OnLinkClicked" ClickedScript="chgSwimLaneHeader">
                </ndiag:DiagramView>
                <ndiag:InteractivityExtender ID="InteractivityExtender1" runat="server" TargetControlID="DiagramView1" />

function chgSwimLaneHeader(sender, args)
            {
                alert("Hello");
            }

The function is NOT being invoked when I click anywhere on the diagram - in my case on the swimlane header title text.

Suggestions?

Thanks

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Allowing user to change swimlane header text - ImageMap mode
Reply #3 - Jun 12th, 2012 at 4:44pm
Print Post  
Hi,

This is raised only in Java mode. At this time you could add a Transparent node that covers the grid and handle its NodeClicked event to detect header clicks in ImageMap mode.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
jlj30
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 183
Joined: Sep 4th, 2011
Re: Allowing user to change swimlane header text - ImageMap mode
Reply #4 - Jun 24th, 2012 at 7:06pm
Print Post  
Hi,

It would appear that I could access the cell on top of which I want to place this node, but the doc indicates that I should use the Grid.Item Property, but my grid does not seem to have an Item property.

Could you provide me with some code to add this transparent node - please.

Help.

Thanks

Jim
  
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: Allowing user to change swimlane header text - ImageMap mode
Reply #5 - Jun 25th, 2012 at 8:24am
Print Post  
Hi,

Try the following solution:

1. Create a locked, transparent node on top of the entire lane grid:

Code
Select All
// Obtain the bounding rectangle of the grid
RectangleF gridBounds = RectangleF.Union(
	diagram.LaneGrid.GetColumnHeaderBounds(),
	diagram.LaneGrid.GetRowHeaderBounds());
ShapeNode node = diagram.Factory.CreateShapeNode(gridBounds);
// A tag used to identify this special node
node.Tag = "hit-test layer";
// Make sure the node is at the bottom of the z-order
node.ZBottom();
// Lock and hide the node; also turn off rendering of disabled handles
node.Transparent = true;
node.Locked = true;
node.EnabledHandles = AdjustmentHandles.None;
diagram.ShowDisabledHandles = false; 


2. Handle the DiagramView.NodeClicked event and use the following code in the event handler to recognize clicks on the special node created above:

Code
Select All
if (e.Node.Tag as string == "hit-test layer")
{
	RectangleF bounds = RectangleF.Empty;
	Header header = diagramView.Diagram.LaneGrid.GetHeaderFromPoint(e.MousePosition, ref bounds);
	if (header != null)
		header.Title = "clicked";
} 


Make sure you are using an InteractivityExtender, otherwise the mouse coordinates supplied to the event handler will be (0, 0). You can use hidden fields to pass information about the clicked header to the client side for further processing (such as opening an edit box).

I hope this helps.

Regards,
Meppy
  
Back to top
 
IP Logged
 
jlj30
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 183
Joined: Sep 4th, 2011
Re: Allowing user to change swimlane header text - ImageMap mode
Reply #6 - Jun 25th, 2012 at 9:21pm
Print Post  
Hi Meppy,

Excellent.  I adapted your code slightly to just include the GetRowHeaderBounds, and it works great.

Many thanks

Jim
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint