Common Custom EditorTask
Common_CustomEditorTask_VBNet\CustomEditorTask_VBNet\CustomEditExistingFeaturePanel.vb
' Copyright 2010 ESRI
' 
' All rights reserved under the copyright laws of the United States
' and applicable international laws, treaties, and conventions.
' 
' You may freely redistribute and use this sample code, with or
' without modification, provided you include the original copyright
' notice and use restrictions.
' 
' See the use restrictions.
' 

Imports Microsoft.VisualBasic
Imports System
Namespace CustomEditorTask_VBNet
  Public Class CustomEditExistingFeaturePanel
    Inherits ESRI.ArcGIS.ADF.ArcGISServer.Editor.EditExistingFeaturePanel
    Public Sub New(ByVal editorTask As ESRI.ArcGIS.ADF.ArcGISServer.Editor.EditorTask)
      MyBase.New(editorTask)
    End Sub

    ' Add custom tools to the standard toolbar on the EditExistingFeaturePanel
    Protected Overrides Function CreateToolbars() As System.Collections.Generic.List(Of ESRI.ArcGIS.ADF.Web.UI.WebControls.Toolbar)
      Dim editorToolbarList As System.Collections.Generic.List(Of ESRI.ArcGIS.ADF.Web.UI.WebControls.Toolbar) = MyBase.CreateToolbars()

      ' Add the ClipFeatures tool to the standard toolbar on the EditExistingFeaturePanel
      Dim clipEditorTool As ESRI.ArcGIS.ADF.ArcGISServer.Editor.Tools.EditorTool = New ESRI.ArcGIS.ADF.ArcGISServer.Editor.Tools.EditorTool("Clip", Me.ParentEditor.MapID, False, ESRI.ArcGIS.ADF.ArcGISServer.Editor.Tools.ToolGeometry.Line Or ESRI.ArcGIS.ADF.ArcGISServer.Editor.Tools.ToolGeometry.Polygon, 1)
      clipEditorTool.ClientAction = ESRI.ArcGIS.ADF.Web.UI.WebControls.Constants.HTML_DRAG_RECTANGLE
      clipEditorTool.DefaultImage = Me.Page.ClientScript.GetWebResourceUrl(GetType(CustomEditorTask), "clip.png")
      clipEditorTool.SelectedImage = Me.Page.ClientScript.GetWebResourceUrl(GetType(CustomEditorTask), "clip_ON.png")
      clipEditorTool.HoverImage = Me.Page.ClientScript.GetWebResourceUrl(GetType(CustomEditorTask), "clip_OVER.png")
      clipEditorTool.ToolTip = "Clip feature(s)"
      clipEditorTool.ServerActionAssembly = "CustomEditorTask_VBNet"
      clipEditorTool.ServerActionClass = "CustomEditorTask_VBNet.ClipFeatures"

      editorToolbarList(0).ToolbarItems.Add(clipEditorTool)

      ' Add the PolygonToLine command to the standard toolbar on the EditExistingFeaturePanel
      Dim polygonToLineCommand As ESRI.ArcGIS.ADF.ArcGISServer.Editor.Tools.EditorCommand = New ESRI.ArcGIS.ADF.ArcGISServer.Editor.Tools.EditorCommand("PolygonToLine", ESRI.ArcGIS.ADF.ArcGISServer.Editor.Tools.ToolGeometry.Polygon, 1)
      polygonToLineCommand.DefaultImage = Me.Page.ClientScript.GetWebResourceUrl(GetType(CustomEditorTask), "polygon2line.png")
      polygonToLineCommand.SelectedImage = Me.Page.ClientScript.GetWebResourceUrl(GetType(CustomEditorTask), "polygon2line_ON.png")
      polygonToLineCommand.HoverImage = Me.Page.ClientScript.GetWebResourceUrl(GetType(CustomEditorTask), "polygon2line_OVER.png")
      polygonToLineCommand.ToolTip = "Convert polygon feature(s) to polylines"
      polygonToLineCommand.ServerActionAssembly = "CustomEditorTask_VBNet"
      polygonToLineCommand.ServerActionClass = "CustomEditorTask_VBNet.PolygonToLine"

      editorToolbarList(0).ToolbarItems.Add(polygonToLineCommand)

      ' Increase toolbar width to accommodate the added tools
      Dim oldWidth As Double = editorToolbarList(0).Width.Value
      editorToolbarList(0).Width = New System.Web.UI.WebControls.Unit(oldWidth + 70, System.Web.UI.WebControls.UnitType.Pixel)

      Return editorToolbarList
    End Function
  End Class
End Namespace