void INMouseEventCallback.OnMouseEvent(NAspNetThinWebControl control, NBrowserMouseEventArgs e) { NThinDiagramControl diagramControl = (NThinDiagramControl)control; NNodeList nodes = diagramControl.HitTest(new NPointF(e.X, e.Y)); NNodeList shapes = nodes.Filter(TableShapeFilter); if (shapes.Count == 0) { diagramControl.Document.Tag = null; return; } NNodeList decorators = nodes.Filter(DecoratorFilter); if (decorators.Count > 0) { // Toggle the clicked show/hide subtree decorator and update the view ((NShowHideSubtreeDecorator)decorators[0]).ToggleState(); diagramControl.UpdateView(); } // Send a custom command NTableShape table = (NTableShape)shapes[0]; NEmployee employee = (NEmployee)table.Tag; diagramControl.AddCustomClientCommand(employee.GetData()); }
private void InitTableShape(NTableShape shape, NEmployee employee) { string stylesheetName = employee.Position.ToUpper(); if (stylesheetName.StartsWith("VP")) { stylesheetName = "VP"; } shape.Name = employee.Name; shape.Tag = employee; shape.InitTable(2, 2); shape.BeginUpdate(); shape.ShowGrid = false; shape.CellMargins = new Nevron.Diagram.NMargins(2); NTableColumn column = (NTableColumn)shape.Columns.GetChildAt(1); column.SizeMode = TableColumnSizeMode.Fixed; column.Width = 108; shape[0, 0].Margins = new Nevron.Diagram.NMargins(5); shape[0, 0].RowSpan = 2; shape[0, 0].Bitmap = new Bitmap(this.MapPathSecure(employee.PhotoFileName)); shape[0, 0].Borders = TableCellBorder.All; shape[1, 0].Text = employee.Position; shape[1, 1].Text = employee.Name; shape[1, 0].StyleSheetName = "POSITION"; shape[1, 1].StyleSheetName = "NAME"; shape.StyleSheetName = stylesheetName; shape.EndUpdate(); shape.Ports.DefaultInwardPortUniqueId = ((NPort)shape.Ports.GetChildByName("Bottom")).UniqueId; }
private void EventSinkService_NodeMouseDown(NNodeMouseEventArgs args) { if (args.Button != MouseButtons.Left || !(args.Node is NTableShape || args.Node is NGroupSampleUC)) { pEmployee.Visible = false; return; } INNode node = args.Node; while (!(node is NTableShape)) { node = node.ParentNode; } NEmployee employee = m_Dict[(NTableShape)node]; pbPhoto.Image = employee.Photo; lblName.Text = employee.Name; lblPosition.Text = employee.Position; lblBirthDate.Text = string.Format(CULTURE, "Birth Date: {0:MMMM dd, yyyy}", employee.BirthDate); lblSalary.Text = "Salary: " + employee.Salary.ToString("C", CULTURE); lblBiography.Text = employee.Biography; pEmployee.Visible = true; args.Handled = !(args.Node is NGroupSampleUC); }
protected void NDrawingView1_AsyncClick(object sender, EventArgs e) { NCallbackMouseEventArgs args = e as NCallbackMouseEventArgs; NNodeList nodes = NDrawingView1.HitTest(args); NNodeList shapes = nodes.Filter(TABLE_SHAPE_FILTER); if (shapes.Count == 0) { NDrawingView1.Document.Tag = null; return; } NNodeList decorators = nodes.Filter(DECORATOR_FILTER); if (decorators.Count > 0) { ((NShowHideSubtreeDecorator)decorators[0]).ToggleState(); } NTableShape table = (NTableShape)shapes[0]; NEmployee employee = (NEmployee)table.Tag; NDrawingView1.Document.Tag = employee; NDrawingView1.Document.SmartRefreshAllViews(); }
public NEmployee(NEmployee other) { Name = other.Name; Position = other.Position; BirthDate = other.BirthDate; Salary = other.Salary; Biography = other.Biography; PhotoFileName = other.PhotoFileName; }
protected void NDrawingView1_AsyncQueryCommandResult(object sender, EventArgs e) { NCallbackQueryCommandResultArgs args = e as NCallbackQueryCommandResultArgs; NCallbackCommand command = args.Command; NAjaxXmlTransportBuilder resultBuilder = args.ResultBuilder; switch (command.Name) { case "mouseClick": // build a custom response data section NEmployee employee = NDrawingView1.Document.Tag as NEmployee; if (employee == null) { return; } employee.SetAjaxData(resultBuilder); break; } }