[5634] | 1 | #region License Information
|
---|
| 2 | /* HeuristicLab
|
---|
| 3 | * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
|
---|
| 4 | *
|
---|
| 5 | * This file is part of HeuristicLab.
|
---|
| 6 | *
|
---|
| 7 | * HeuristicLab is free software: you can redistribute it and/or modify
|
---|
| 8 | * it under the terms of the GNU General Public License as published by
|
---|
| 9 | * the Free Software Foundation, either version 3 of the License, or
|
---|
| 10 | * (at your option) any later version.
|
---|
| 11 | *
|
---|
| 12 | * HeuristicLab is distributed in the hope that it will be useful,
|
---|
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
| 15 | * GNU General Public License for more details.
|
---|
| 16 | *
|
---|
| 17 | * You should have received a copy of the GNU General Public License
|
---|
| 18 | * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
|
---|
| 19 | */
|
---|
| 20 | #endregion
|
---|
| 21 |
|
---|
| 22 | using System;
|
---|
[5676] | 23 | using System.ComponentModel;
|
---|
[5634] | 24 | using System.Drawing;
|
---|
| 25 | using HeuristicLab.Common;
|
---|
| 26 | using HeuristicLab.Core;
|
---|
| 27 |
|
---|
| 28 | namespace HeuristicLab.Clients.Hive {
|
---|
| 29 |
|
---|
| 30 | public partial class HiveItem : IItem {
|
---|
| 31 |
|
---|
[5676] | 32 | public HiveItem() {
|
---|
| 33 | }
|
---|
[5634] | 34 |
|
---|
[5676] | 35 |
|
---|
[5634] | 36 | protected HiveItem(HiveItem original, Cloner cloner) {
|
---|
| 37 | this.Id = original.Id;
|
---|
| 38 | }
|
---|
| 39 |
|
---|
| 40 | public IDeepCloneable Clone(Cloner cloner) {
|
---|
| 41 | return new HiveItem(this, cloner);
|
---|
| 42 | }
|
---|
| 43 |
|
---|
| 44 | public object Clone() {
|
---|
| 45 | return Clone(new Cloner());
|
---|
| 46 | }
|
---|
| 47 |
|
---|
[5676] | 48 | protected void RaisePropertyChanged(string propertyName) {
|
---|
| 49 | OnPropertyChanged(new PropertyChangedEventArgs(propertyName));
|
---|
| 50 | if ((propertyName != "Id") && (propertyName != "Modified") && (propertyName != "ItemImage")) {
|
---|
| 51 | Modified = true;
|
---|
| 52 | }
|
---|
| 53 | }
|
---|
| 54 | protected virtual void OnPropertyChanged(PropertyChangedEventArgs e) {
|
---|
| 55 | PropertyChangedEventHandler handler = PropertyChanged;
|
---|
| 56 | if (handler != null) handler(this, e);
|
---|
| 57 | }
|
---|
| 58 |
|
---|
[5634] | 59 | #region IItem Members
|
---|
| 60 | public string ItemName {
|
---|
| 61 | get { return ItemAttribute.GetName(this.GetType()); }
|
---|
| 62 | }
|
---|
| 63 | public string ItemDescription {
|
---|
| 64 | get { return ItemAttribute.GetDescription(this.GetType()); }
|
---|
| 65 | }
|
---|
| 66 | public Version ItemVersion {
|
---|
| 67 | get { return ItemAttribute.GetVersion(this.GetType()); }
|
---|
| 68 | }
|
---|
| 69 | public Image ItemImage {
|
---|
| 70 | get { return HeuristicLab.Common.Resources.VSImageLibrary.Class; }
|
---|
| 71 | }
|
---|
[5676] | 72 |
|
---|
| 73 | private bool modified;
|
---|
| 74 | public bool Modified {
|
---|
| 75 | get { return modified; }
|
---|
| 76 | private set {
|
---|
| 77 | if (value != modified) {
|
---|
| 78 | modified = value;
|
---|
| 79 | OnModifiedChanged();
|
---|
| 80 | RaisePropertyChanged("Modified");
|
---|
| 81 | //OnItemImageChanged(); ??
|
---|
| 82 | //RaisePropertyChanged("ItemImage"); ??
|
---|
| 83 | }
|
---|
| 84 | }
|
---|
| 85 | }
|
---|
| 86 |
|
---|
[5634] | 87 | public event EventHandler ItemImageChanged;
|
---|
| 88 | protected virtual void OnItemImageChanged() {
|
---|
| 89 | EventHandler handler = ItemImageChanged;
|
---|
| 90 | if (handler != null) handler(this, EventArgs.Empty);
|
---|
| 91 | }
|
---|
| 92 | public event EventHandler ToStringChanged;
|
---|
| 93 | protected virtual void OnToStringChanged() {
|
---|
| 94 | EventHandler handler = ToStringChanged;
|
---|
| 95 | if (handler != null) handler(this, EventArgs.Empty);
|
---|
| 96 | }
|
---|
[5676] | 97 | public event EventHandler ModifiedChanged;
|
---|
| 98 | protected virtual void OnModifiedChanged() {
|
---|
| 99 | EventHandler handler = ModifiedChanged;
|
---|
| 100 | if (handler != null) handler(this, EventArgs.Empty);
|
---|
| 101 | }
|
---|
[5634] | 102 | public override string ToString() {
|
---|
| 103 | return ItemName;
|
---|
| 104 | }
|
---|
| 105 | #endregion
|
---|
| 106 | }
|
---|
| 107 | }
|
---|