Common Custom EditorTask
Common_CustomEditorTask_VBNet\CustomEditorTask_VBNet\CustomEditExistingFeatureEditor.vb
' Copyright 2007 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
Imports System.Collections.Generic
Imports System.Text
Imports ESRI.ArcGIS.ADF.ArcGISServer.Editor
Imports ESRI.ArcGIS.ADF.ArcGISServer.Editor.Tools
Imports System.Web.UI.WebControls
Imports ESRI.ArcGIS.ADF.Web.UI.WebControls

Namespace CustomEditorTask_VBNet
  Public Class CustomEditExistingFeatureEditor
    Inherits EditExistingFeaturePanel
    Public Sub New(ByVal task As EditorTask)
      MyBase.New(task)
    End Sub

    Protected Overrides Function CreateToolbars() As List(Of ESRI.ArcGIS.ADF.Web.UI.WebControls.Toolbar)
      Dim toolbars As List(Of ESRI.ArcGIS.ADF.Web.UI.WebControls.Toolbar) = MyBase.CreateToolbars()

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

        toolbars(0).ToolbarItems.Add(clip)

        ' add polygon to line command to the standard toolbar in the editorpanel
        Dim ptl As EditorCommand = New EditorCommand("PolygonToLine", ToolGeometry.Polygon, 1)
            ptl.DefaultImage = Me.Page.ClientScript.GetWebResourceUrl(GetType(CustomEditorTask), "polygon2line.png")
            ptl.SelectedImage = Me.Page.ClientScript.GetWebResourceUrl(GetType(CustomEditorTask), "polygon2line_ON.png")
            ptl.HoverImage = Me.Page.ClientScript.GetWebResourceUrl(GetType(CustomEditorTask), "polygon2line_OVER.png")
        ptl.ToolTip = "Convert polygon feature(s) to polylines"
        ptl.ServerActionAssembly = "CustomEditorTask_VBNet"
        ptl.ServerActionClass = "CustomEditorTask_VBNet.PolygonToLine"

        toolbars(0).ToolbarItems.Add(ptl)

        Dim oldwidth As Double = toolbars(0).Width.Value
        toolbars(0).Width = New Unit(oldwidth + 70, UnitType.Pixel)

        Return toolbars
    End Function
  End Class
End Namespace