Changeset 6925


Ignore:
Timestamp:
10/13/11 20:45:08 (9 years ago)
Author:
ascheibe
Message:

#1233 fixed bug in PermissionView "bugfix"

Location:
branches/HeuristicLab.Hive-3.4/sources
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.JobManager/3.3/Views/HiveJobPermissionListView.cs

    r6924 r6925  
    2121
    2222using System;
    23 using System.ComponentModel;
    2423using System.Windows.Forms;
    2524using HeuristicLab.Core.Views;
     
    4544      return new JobPermission() { JobId = this.hiveExperimentId };
    4645    }
    47 
    48     protected override void RegisterContentEvents() {
    49       base.RegisterContentEvents();
    50 
    51       if (Content != null) {
    52         foreach (JobPermission permission in Content) {
    53           permission.PropertyChanged += new PropertyChangedEventHandler(permission_PropertyChanged);
    54         }
    55       }
    56     }
    57 
    58     protected override void DeregisterContentEvents() {
    59       base.DeregisterContentEvents();
    60 
    61       if (Content != null) {
    62         foreach (JobPermission permission in Content) {
    63           permission.PropertyChanged -= new PropertyChangedEventHandler(permission_PropertyChanged);
    64         }
    65       }
    66     }
    67 
    68     protected override void Content_ItemsAdded(object sender, Collections.CollectionItemsChangedEventArgs<JobPermission> e) {
    69       base.Content_ItemsAdded(sender, e);
    70 
    71       foreach (JobPermission permission in e.Items) {
    72         permission.PropertyChanged += new PropertyChangedEventHandler(permission_PropertyChanged);
    73       }
    74     }
    75 
    76     protected override void Content_ItemsRemoved(object sender, Collections.CollectionItemsChangedEventArgs<JobPermission> e) {
    77       foreach (JobPermission permission in e.Items) {
    78         permission.PropertyChanged -= new PropertyChangedEventHandler(permission_PropertyChanged);
    79       }
    80     }
    81 
    82     protected override void Content_CollectionReset(object sender, Collections.CollectionItemsChangedEventArgs<JobPermission> e) {
    83       Content_ItemsRemoved(sender, e);
    84     }
    85 
    86     void permission_PropertyChanged(object sender, PropertyChangedEventArgs e) {
    87       OnContentChanged();
    88     }
    8946  }
    9047}
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.JobManager/3.3/Views/HiveJobPermissionView.Designer.cs

    r6924 r6925  
    6060      this.usernameTextBox.Size = new System.Drawing.Size(281, 20);
    6161      this.usernameTextBox.TabIndex = 3;
    62       this.usernameTextBox.Validating += new System.ComponentModel.CancelEventHandler(this.usernameTextBox_Validating);
     62      this.usernameTextBox.TextChanged += new System.EventHandler(this.usernameTextBox_TextChanged);
    6363      //
    6464      // permissionComboBox
     
    7272      this.permissionComboBox.Size = new System.Drawing.Size(281, 21);
    7373      this.permissionComboBox.TabIndex = 4;
    74       this.permissionComboBox.Validating += new System.ComponentModel.CancelEventHandler(this.permissionComboBox_Validating);
     74      this.permissionComboBox.SelectedValueChanged += new System.EventHandler(this.permissionComboBox_SelectedValueChanged);
    7575      //
    7676      // HiveJobPermissionView
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.JobManager/3.3/Views/HiveJobPermissionView.cs

    r6924 r6925  
    2020#endregion
    2121
    22 using System.ComponentModel;
    2322using HeuristicLab.Clients.Hive.Views;
    2423using HeuristicLab.MainForm;
     
    6261    }
    6362
    64     #region Child Control Events
    65 
    66     private void usernameTextBox_Validating(object sender, CancelEventArgs e) {
    67       Content.GrantedUserName = usernameTextBox.Text;
     63    private void usernameTextBox_TextChanged(object sender, System.EventArgs e) {
     64      if (Content != null) {
     65        Content.GrantedUserName = usernameTextBox.Text;
     66      }
    6867    }
    6968
    70     private void permissionComboBox_Validating(object sender, CancelEventArgs e) {
    71       Content.Permission = (Permission)permissionComboBox.SelectedItem;
     69    private void permissionComboBox_SelectedValueChanged(object sender, System.EventArgs e) {
     70      if (Content != null) {
     71        Content.Permission = (Permission)permissionComboBox.SelectedItem;
     72      }
    7273    }
    73     #endregion
    7474  }
    7575}
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.3/ServiceClients/JobPermission.cs

    r6756 r6925  
    3737    }
    3838
    39     #region Constructors and Cloning
    4039    public JobPermission() {
    4140      this.Permission = Permission.Read;
    42       this.PropertyChanged += new PropertyChangedEventHandler(HiveExperimentPermission_PropertyChanged);
     41    }
     42
     43    protected override void OnPropertyChanged(PropertyChangedEventArgs e) {
     44      base.OnPropertyChanged(e);
     45      if (e.PropertyName == "GrantedUserName" || e.PropertyName == "Permission") {
     46        HiveExperimentPermission_PropertyChanged(this, e);
     47      }
    4348    }
    4449
     
    5055      this.Permission = original.Permission;
    5156    }
     57
    5258    public override IDeepCloneable Clone(Cloner cloner) {
    5359      return new JobPermission(this, cloner);
    5460    }
    55     #endregion
    5661
    5762    private void HiveExperimentPermission_PropertyChanged(object sender, PropertyChangedEventArgs e) {
Note: See TracChangeset for help on using the changeset viewer.