ChartNamedElementCollection.cs 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. //
  2. // Authors:
  3. // Jonathan Pobst ([email protected])
  4. // Francis Fisher ([email protected])
  5. //
  6. // Copyright (C) 2009 Novell, Inc (http://www.novell.com)
  7. //
  8. // Permission is hereby granted, free of charge, to any person obtaining
  9. // a copy of this software and associated documentation files (the
  10. // "Software"), to deal in the Software without restriction, including
  11. // without limitation the rights to use, copy, modify, merge, publish,
  12. // distribute, sublicense, and/or sell copies of the Software, and to
  13. // permit persons to whom the Software is furnished to do so, subject to
  14. // the following conditions:
  15. //
  16. // The above copyright notice and this permission notice shall be
  17. // included in all copies or substantial portions of the Software.
  18. //
  19. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  20. // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  21. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  22. // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  23. // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  24. // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  25. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  26. using System;
  27. using System.Collections.Generic;
  28. namespace System.Windows.Forms.DataVisualization.Charting
  29. {
  30. public class ChartNamedElementCollection<T> : ChartElementCollection<T> where T : ChartNamedElement
  31. {
  32. public T this[string name] { //FIXME this should probably be indexed
  33. get{
  34. foreach (T el in this) {
  35. if (el.Name == name) {
  36. return el;
  37. }
  38. }
  39. throw new KeyNotFoundException (); //FIXME check what actual behaviour is in MS implementation
  40. }
  41. set{
  42. for(int i = 0; i<this.Count; i++)
  43. {
  44. T el = this[i];
  45. if (el.Name == name) {
  46. this.SetItem (i, value);
  47. return;
  48. }
  49. }
  50. throw new KeyNotFoundException (); //FIXME check what actual behaviour is in MS implementation
  51. }
  52. }
  53. protected virtual string NamePrefix { get; private set;}
  54. [MonoTODO]
  55. public virtual T FindByName (string name)
  56. {
  57. throw new NotImplementedException();
  58. }
  59. [MonoTODO]
  60. public int IndexOf (string name)
  61. {
  62. throw new NotImplementedException();
  63. }
  64. [MonoTODO]
  65. protected override void InsertItem (int index,T item)
  66. {
  67. throw new NotImplementedException();
  68. }
  69. [MonoTODO]
  70. public virtual bool IsUniqueName (string name)
  71. {
  72. throw new NotImplementedException();
  73. }
  74. [MonoTODO]
  75. public virtual string NextUniqueName ()
  76. {
  77. throw new NotImplementedException();
  78. }
  79. [MonoTODO]
  80. protected override void RemoveItem (int index)
  81. {
  82. throw new NotImplementedException();
  83. }
  84. [MonoTODO]
  85. protected override void SetItem (int index,T item)
  86. {
  87. throw new NotImplementedException();
  88. }
  89. }
  90. }