Index: branches/OKB (trunk integration)/HeuristicLab.Clients.OKB/3.3/OKBProblem.cs
===================================================================
--- branches/OKB (trunk integration)/HeuristicLab.Clients.OKB/3.3/OKBProblem.cs	(revision 5338)
+++ branches/OKB (trunk integration)/HeuristicLab.Clients.OKB/3.3/OKBProblem.cs	(revision 5344)
@@ -24,5 +24,4 @@
 using System.Drawing;
 using System.IO;
-using System.Linq;
 using HeuristicLab.Common;
 using HeuristicLab.Core;
@@ -32,32 +31,7 @@
 
 namespace HeuristicLab.Clients.OKB {
-  [Item("OKB Problem", "Represents a problem which is stored in the OKB.")]
+  [Item("OKB Problem", "A base class for problems which are stored in the OKB.")]
   [StorableClass]
-  public class OKBProblem : Item, IProblem, IStorableContent {
-    public string Filename { get; set; }
-
-    public override Image ItemImage {
-      get { return Problem == null ? HeuristicLab.Common.Resources.VSImageLibrary.Type : Problem.ItemImage; }
-    }
-
-    public string Name {
-      get { return Problem == null ? ItemName : Problem.Name; }
-      set { throw new NotSupportedException("Name cannot be changed."); }
-    }
-    public string Description {
-      get { return Problem == null ? ItemDescription : Problem.Description; }
-      set { throw new NotSupportedException("Description cannot be changed."); }
-    }
-    public bool CanChangeName {
-      get { return false; }
-    }
-    public bool CanChangeDescription {
-      get { return false; }
-    }
-
-    public IKeyedItemCollection<string, IParameter> Parameters {
-      get { return Problem == null ? null : Problem.Parameters; }
-    }
-
+  public abstract class OKBProblem : Item, IProblem {
     public virtual Type ProblemType {
       get { return typeof(IProblem); }
@@ -71,5 +45,5 @@
       get { return problem; }
       private set {
-        if (value == null) throw new ArgumentNullException("Problem");
+        if (value == null) throw new ArgumentNullException("Problem", "Problem cannot be null.");
         if (value != problem) {
           CancelEventArgs<string> e = new CancelEventArgs<string>(value.Name);
@@ -94,18 +68,41 @@
     }
 
+    public override Image ItemImage {
+      get { return Problem.ItemImage; }
+    }
+
+    public string Name {
+      get { return Problem.Name; }
+      set { throw new NotSupportedException("Name cannot be changed."); }
+    }
+    public string Description {
+      get { return Problem.Description; }
+      set { throw new NotSupportedException("Description cannot be changed."); }
+    }
+    public bool CanChangeName {
+      get { return false; }
+    }
+    public bool CanChangeDescription {
+      get { return false; }
+    }
+
+    public IKeyedItemCollection<string, IParameter> Parameters {
+      get { return Problem.Parameters; }
+    }
+
     public IParameter SolutionCreatorParameter {
-      get { return Problem == null ? null : Problem.SolutionCreatorParameter; }
+      get { return Problem.SolutionCreatorParameter; }
     }
     public ISolutionCreator SolutionCreator {
-      get { return Problem == null ? null : Problem.SolutionCreator; }
+      get { return Problem.SolutionCreator; }
     }
     public IParameter EvaluatorParameter {
-      get { return Problem == null ? null : Problem.EvaluatorParameter; }
+      get { return Problem.EvaluatorParameter; }
     }
     public IEvaluator Evaluator {
-      get { return Problem == null ? null : Problem.Evaluator; }
+      get { return Problem.Evaluator; }
     }
     public IEnumerable<IOperator> Operators {
-      get { return Problem == null ? Enumerable.Empty<IOperator>() : Problem.Operators; }
+      get { return Problem.Operators; }
     }
 
@@ -118,6 +115,9 @@
     [Storable(Name = "Problem")]
     private IProblem StorableProblem {
-      get { return Problem; }
-      set { Problem = value; }
+      get { return problem; }
+      set {
+        problem = value;
+        RegisterProblemEvents();
+      }
     }
     #endregion
@@ -129,12 +129,12 @@
       problemId = original.problemId;
       problem = cloner.Clone(original.problem);
-    }
-    protected OKBProblem()
+      RegisterProblemEvents();
+    }
+    protected OKBProblem(IProblem initialProblem)
       : base() {
+      if (initialProblem == null) throw new ArgumentNullException("initialProblem", "Initial problem cannot be null.");
       problemId = -1;
-    }
-
-    public override IDeepCloneable Clone(Cloner cloner) {
-      return new OKBProblem(this, cloner);
+      problem = initialProblem;
+      RegisterProblemEvents();
     }
 
@@ -154,8 +154,13 @@
 
     public void CollectParameterValues(IDictionary<string, IItem> values) {
-      if (Problem != null) Problem.CollectParameterValues(values);
+      Problem.CollectParameterValues(values);
     }
 
     #region Events
+    public event EventHandler ProblemChanged;
+    protected virtual void OnProblemChanged() {
+      EventHandler handler = ProblemChanged;
+      if (handler != null) handler(this, EventArgs.Empty);
+    }
     public event EventHandler<CancelEventArgs<string>> NameChanging;
     protected virtual void OnNameChanging(CancelEventArgs<string> e) {
@@ -171,9 +176,4 @@
     protected virtual void OnDescriptionChanged() {
       var handler = DescriptionChanged;
-      if (handler != null) handler(this, EventArgs.Empty);
-    }
-    public event EventHandler ProblemChanged;
-    protected virtual void OnProblemChanged() {
-      EventHandler handler = ProblemChanged;
       if (handler != null) handler(this, EventArgs.Empty);
     }
