ResultViewItem.cs :  » Development » MMC » Ironring » MMC » Nodes » C# / CSharp Open Source

Home
C# / CSharp Open Source
1.2.6.4 mono .net core
2.2.6.4 mono core
3.Aspect Oriented Frameworks
4.Bloggers
5.Build Systems
6.Business Application
7.Charting Reporting Tools
8.Chat Servers
9.Code Coverage Tools
10.Content Management Systems CMS
11.CRM ERP
12.Database
13.Development
14.Email
15.Forum
16.Game
17.GIS
18.GUI
19.IDEs
20.Installers Generators
21.Inversion of Control Dependency Injection
22.Issue Tracking
23.Logging Tools
24.Message
25.Mobile
26.Network Clients
27.Network Servers
28.Office
29.PDF
30.Persistence Frameworks
31.Portals
32.Profilers
33.Project Management
34.RSS RDF
35.Rule Engines
36.Script
37.Search Engines
38.Sound Audio
39.Source Control
40.SQL Clients
41.Template Engines
42.Testing
43.UML
44.Web Frameworks
45.Web Service
46.Web Testing
47.Wiki Engines
48.Windows Presentation Foundation
49.Workflows
50.XML Parsers
C# / C Sharp
C# / C Sharp by API
C# / CSharp Tutorial
C# / CSharp Open Source » Development » MMC 
MMC » Ironring » MMC » Nodes » ResultViewItem.cs
using System;
using System.Collections;
using System.Threading;
using Ironring.MMC.PropertyPages;
using Ironring.MMC.Core;

namespace Ironring.MMC.Nodes{
  /// <summary>
  /// Items in a listview modeled as seperate items. Note: the images are leached from
  /// the report-node image list: we don't want to re-load images everytime.
  /// </summary>
  public class ResultViewItem : IMMCSelected, IMMCPropertyPage 
  {    

    ///////////////////////////////////////////////////////////////////////
    //
    // Member variables
    //
    #region

    private readonly static System.Type _class = typeof(ResultViewItem);
    private SnapinBase _snapin;
    private ReportNode _node;
    private bool _selected;
    private String _displayName;
    private int _largeImage;
    private int _smallImage;
    private int _dummy1;
    private int _dummy2;
    private uint _itemID;  
    private PropertySheet _propsheet;
    private Hashtable _details = new Hashtable();
    private ArrayList _tasks = null;
    private ArrayList _menus = null;
    #endregion

    ///////////////////////////////////////////////////////////////////////
    //
    // Properties
    //

    /// <summary>
    /// 
    /// </summary>
    public static System.Type Class
    {
      get { return _class; }
    }

    #region
    /// <summary>
    /// Get a reference back to the snapin
    /// </summary>
    public SnapinBase SnapinBase 
    {
      get { return _snapin; }
    }

    /// <summary>
    /// Get a reference back to the node where we belong to
    /// </summary>
    public ReportNode Node 
    {
      get { return _node; }
    }

    /// <summary>
    /// Get/set the property sheet for this item.
    /// </summary>
    public PropertySheet PropertySheet 
    {
      get { return _propsheet; }
      set { this._propsheet = value; }
    }

    /// <summary>
    /// Get/set the displayname of this ResultViewItem
    /// </summary>
    public String DisplayName 
    {
      get { return _displayName; }
      set { _displayName = value; }
    }
    
    /// <summary>
    /// Get/set the selected status of this node
    /// </summary>
    public bool Selected 
    {
      get { return _selected; }
      set { _selected = value; }
    }

    /// <summary>
    /// Get/set the ItemID of this ResultViewItem
    /// </summary>
    public uint ItemID 
    {
      get { return this._itemID; }
      set { this._itemID = value; }
    }

    /// <summary>
    /// Get/set the details for this list-item. The keys are ResultViewItemColumn references, the values
    /// are the details (as Strings).
    /// </summary>
    public virtual Hashtable Details 
    {
      get { return this._details; }
      set { this._details = value; }
    }

    /// <summary>
    /// Get the index of the largeImage
    /// </summary>
    public virtual int LargeImage 
    {
      get { return this._largeImage; }
    }
    
    /// <summary>
    /// Get the index of he SmallImage
    /// </summary>
    public virtual int SmallImage 
    {
      get { return this._smallImage; }
    }

    /// <summary>
    /// Get/set TopLevel menus for this node (MenuItem).    
    /// </summary>
    public virtual ArrayList Menus 
    {
      get { return _menus; }
      set { _menus = value; }
    }


    /// <summary>
    /// Return all Tasks for this node (MenuItem).
    /// FIXME: are there any task thingies available from the mmc side ?
    /// is this even possible?
    /// </summary>    
    public virtual ArrayList Tasks 
    {
      get { return _tasks; }
      set { _tasks = value;}
    }
    #endregion

    ////////////////////////////////////////////////////////////////////////////
    //
    // Constructors
    //
    #region
    /// <summary>
    /// System.Type.GetType() is misdesigned. creating and getting the type
    /// at least gives us a Typecheck! This constructor exists just for that
    /// purpose.
    /// </summary>
    internal ResultViewItem() 
    {
    }

    /// <summary>
    /// Create a new resultview item for the given snapin/node with the given display name.
    /// </summary>
    /// <param name="snapin">The snapin</param>
    /// <param name="node">The reportnode-ext</param>
    /// <param name="displayName">The display name for the item. This is the only guaranteed visible column.</param>
    public ResultViewItem(SnapinBase snapin, ReportNode node, String displayName) : this(snapin, node, displayName, "", "") 
    {
    }

    /// <summary>
    /// Extended constructor with picture support!
    /// </summary>
    /// <param name="snapin">The snapin</param>
    /// <param name="node">The reportnode</param>
    /// <param name="displayName">The display name for the item. This is the only guaranteed visible column.</param>
    /// <param name="smallImageName">The name of the small-image. Should be available in the report node</param>
    /// <param name="largeImageName">The name of the large-image. Should be available in the report node</param>
    public ResultViewItem(SnapinBase snapin, ReportNode node, String displayName, String smallImageName, String largeImageName) 
    {
      _snapin = snapin;    
      _displayName = displayName;
      _node = node;
      if(node.ResultPaneImages == null) 
      {
        node.ResultPaneImages = new ImageList();
      }
      _largeImage = node.ResultPaneImages.Add(largeImageName);
      _smallImage = node.ResultPaneImages.Add(smallImageName);
      _dummy1 = node.ResultPaneImages.Add(largeImageName);
      _dummy2 = node.ResultPaneImages.Add(smallImageName);
    }
    #endregion

    /// <summary>
    /// Add detail for the given column.
    /// </summary>
    /// <param name="col">The column object</param>
    /// <param name="detail">The detail-text</param>
    public virtual void AddDetail(ResultViewColumn col, String detail) 
    {
      this.Details.Add(col, detail);
    }

    /// <summary>
    /// Remove all details.
    /// </summary>
    public virtual void ClearDetail() 
    {
      this.Details.Clear();
    }

    /// <summary>
    /// Callback from the reportnodeext to get the details for a given item/subitem.
    /// </summary>
    /// <param name="key">The columnname we are looking for</param>
    /// <returns>The details for the column</returns>
    public virtual String GetDetail(ResultViewColumn key) 
    {
      return (String)this._details[key];
    }

    #region IMMCPropertyPage Members
    protected ArrayList m_propertypages = new ArrayList();
    public virtual ArrayList PropertyPages 
    {
      get { return m_propertypages; }
      set { m_propertypages = value;}
    }

    #endregion

    /// <summary>
    /// Called when this item is selected. Note: it might be called twice
    /// due to unforseen bugs.
    /// </summary>
    /// <remarks>The default implementation does nothing</remarks>
    public virtual void OnSelect() 
    {
      // Called when this item is selected. We do nothing in the default implementation.
    }

    /// <summary>
    /// Called when this item is selected. Note: it might be called twice
    /// due to unforseen bugs.
    /// </summary>
    /// <remarks>The default implementation does nothing</remarks>
    public virtual void OnDeselect() 
    {
      // Called when this item is selected. We do nothing in the default implementation.
    }
  }
}
www.java2v.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.