Free cookie consent management tool by TermsFeed Policy Generator

Changeset 3829 for trunk/sources


Ignore:
Timestamp:
05/18/10 02:03:24 (15 years ago)
Author:
swagner
Message:

Implemented reviewers' comments (#893)

Location:
trunk/sources
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Core.Views/3.3/CreateParameterDialog.Designer.cs

    r3306 r3829  
    3333    protected override void Dispose(bool disposing) {
    3434      if (disposing) {
    35         if (typeSelectorDialog != null) typeSelectorDialog.Dispose();
    3635        if (components != null) components.Dispose();
    3736      }
     
    4645    /// </summary>
    4746    private void InitializeComponent() {
    48       this.components = new System.ComponentModel.Container();
    4947      this.cancelButton = new System.Windows.Forms.Button();
    5048      this.okButton = new System.Windows.Forms.Button();
     
    5351      this.descriptionLabel = new System.Windows.Forms.Label();
    5452      this.descriptionTextBox = new System.Windows.Forms.TextBox();
    55       this.dataTypeLabel = new System.Windows.Forms.Label();
    56       this.dataTypeTextBox = new System.Windows.Forms.TextBox();
    57       this.setDataTypeButton = new System.Windows.Forms.Button();
    5853      this.parameterTypeSelector = new HeuristicLab.Core.Views.TypeSelector();
    59       this.toolTip = new System.Windows.Forms.ToolTip(this.components);
    6054      this.SuspendLayout();
    6155      //
     
    6458      this.cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
    6559      this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
    66       this.cancelButton.Location = new System.Drawing.Point(455, 450);
     60      this.cancelButton.Location = new System.Drawing.Point(455, 527);
    6761      this.cancelButton.Name = "cancelButton";
    6862      this.cancelButton.Size = new System.Drawing.Size(75, 23);
    69       this.cancelButton.TabIndex = 9;
     63      this.cancelButton.TabIndex = 6;
    7064      this.cancelButton.Text = "&Cancel";
    7165      this.cancelButton.UseVisualStyleBackColor = true;
     
    7670      this.okButton.DialogResult = System.Windows.Forms.DialogResult.OK;
    7771      this.okButton.Enabled = false;
    78       this.okButton.Location = new System.Drawing.Point(374, 450);
     72      this.okButton.Location = new System.Drawing.Point(374, 527);
    7973      this.okButton.Name = "okButton";
    8074      this.okButton.Size = new System.Drawing.Size(75, 23);
    81       this.okButton.TabIndex = 8;
     75      this.okButton.TabIndex = 5;
    8276      this.okButton.Text = "&OK";
    8377      this.okButton.UseVisualStyleBackColor = true;
     
    8781      this.nameLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
    8882      this.nameLabel.AutoSize = true;
    89       this.nameLabel.Location = new System.Drawing.Point(9, 289);
     83      this.nameLabel.Location = new System.Drawing.Point(9, 396);
    9084      this.nameLabel.Name = "nameLabel";
    9185      this.nameLabel.Size = new System.Drawing.Size(38, 13);
     
    9791      this.nameTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
    9892                  | System.Windows.Forms.AnchorStyles.Right)));
    99       this.nameTextBox.Location = new System.Drawing.Point(78, 286);
     93      this.nameTextBox.Location = new System.Drawing.Point(78, 393);
    10094      this.nameTextBox.Name = "nameTextBox";
    10195      this.nameTextBox.Size = new System.Drawing.Size(452, 20);
     
    106100      this.descriptionLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
    107101      this.descriptionLabel.AutoSize = true;
    108       this.descriptionLabel.Location = new System.Drawing.Point(9, 315);
     102      this.descriptionLabel.Location = new System.Drawing.Point(9, 422);
    109103      this.descriptionLabel.Name = "descriptionLabel";
    110104      this.descriptionLabel.Size = new System.Drawing.Size(63, 13);
     
    116110      this.descriptionTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
    117111                  | System.Windows.Forms.AnchorStyles.Right)));
    118       this.descriptionTextBox.Location = new System.Drawing.Point(78, 312);
     112      this.descriptionTextBox.Location = new System.Drawing.Point(78, 419);
    119113      this.descriptionTextBox.Multiline = true;
    120114      this.descriptionTextBox.Name = "descriptionTextBox";
     
    122116      this.descriptionTextBox.Size = new System.Drawing.Size(452, 102);
    123117      this.descriptionTextBox.TabIndex = 4;
    124       //
    125       // dataTypeLabel
    126       //
    127       this.dataTypeLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
    128       this.dataTypeLabel.AutoSize = true;
    129       this.dataTypeLabel.Location = new System.Drawing.Point(12, 425);
    130       this.dataTypeLabel.Name = "dataTypeLabel";
    131       this.dataTypeLabel.Size = new System.Drawing.Size(60, 13);
    132       this.dataTypeLabel.TabIndex = 5;
    133       this.dataTypeLabel.Text = "Data &Type:";
    134       //
    135       // dataTypeTextBox
    136       //
    137       this.dataTypeTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
    138                   | System.Windows.Forms.AnchorStyles.Right)));
    139       this.dataTypeTextBox.Enabled = false;
    140       this.dataTypeTextBox.Location = new System.Drawing.Point(78, 422);
    141       this.dataTypeTextBox.Name = "dataTypeTextBox";
    142       this.dataTypeTextBox.ReadOnly = true;
    143       this.dataTypeTextBox.Size = new System.Drawing.Size(422, 20);
    144       this.dataTypeTextBox.TabIndex = 6;
    145       //
    146       // setDataTypeButton
    147       //
    148       this.setDataTypeButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
    149       this.setDataTypeButton.Enabled = false;
    150       this.setDataTypeButton.Image = HeuristicLab.Common.Resources.VS2008ImageLibrary.Edit;
    151       this.setDataTypeButton.Location = new System.Drawing.Point(506, 420);
    152       this.setDataTypeButton.Name = "setDataTypeButton";
    153       this.setDataTypeButton.Size = new System.Drawing.Size(24, 24);
    154       this.setDataTypeButton.TabIndex = 7;
    155       this.toolTip.SetToolTip(this.setDataTypeButton, "Set Data Type");
    156       this.setDataTypeButton.UseVisualStyleBackColor = true;
    157       this.setDataTypeButton.Click += new System.EventHandler(this.setDataTypeButton_Click);
    158118      //
    159119      // parameterTypeSelector
     
    165125      this.parameterTypeSelector.Location = new System.Drawing.Point(12, 12);
    166126      this.parameterTypeSelector.Name = "parameterTypeSelector";
    167       this.parameterTypeSelector.Size = new System.Drawing.Size(518, 268);
     127      this.parameterTypeSelector.Size = new System.Drawing.Size(518, 375);
    168128      this.parameterTypeSelector.TabIndex = 0;
    169129      this.parameterTypeSelector.SelectedTypeChanged += new System.EventHandler(this.parameterTypeSelector_SelectedTypeChanged);
     
    175135      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
    176136      this.CancelButton = this.cancelButton;
    177       this.ClientSize = new System.Drawing.Size(542, 485);
    178       this.Controls.Add(this.setDataTypeButton);
     137      this.ClientSize = new System.Drawing.Size(542, 562);
    179138      this.Controls.Add(this.parameterTypeSelector);
    180139      this.Controls.Add(this.descriptionTextBox);
    181       this.Controls.Add(this.dataTypeTextBox);
    182140      this.Controls.Add(this.nameTextBox);
    183       this.Controls.Add(this.dataTypeLabel);
    184141      this.Controls.Add(this.descriptionLabel);
    185142      this.Controls.Add(this.nameLabel);
     
    207164    protected System.Windows.Forms.TextBox descriptionTextBox;
    208165    protected TypeSelector parameterTypeSelector;
    209     protected System.Windows.Forms.Label dataTypeLabel;
    210     protected System.Windows.Forms.TextBox dataTypeTextBox;
    211     protected System.Windows.Forms.Button setDataTypeButton;
    212     protected System.Windows.Forms.ToolTip toolTip;
    213166  }
    214167}
  • trunk/sources/HeuristicLab.Core.Views/3.3/CreateParameterDialog.cs

    r3758 r3829  
    2626namespace HeuristicLab.Core.Views {
    2727  public partial class CreateParameterDialog : Form {
    28     protected TypeSelectorDialog typeSelectorDialog;
    29 
    3028    public TypeSelector ParameterTypeSelector {
    3129      get { return parameterTypeSelector; }
     
    3432      get {
    3533        try {
    36           Type type = parameterTypeSelector.SelectedType;
    37           if (type.ContainsGenericParameters) {
    38             type = type.MakeGenericType((Type)dataTypeTextBox.Tag);
    39           }
    40           return (IParameter)Activator.CreateInstance(type, nameTextBox.Text, descriptionTextBox.Text);
     34          return (IParameter)Activator.CreateInstance(parameterTypeSelector.SelectedType, nameTextBox.Text, descriptionTextBox.Text);
    4135        }
    4236        catch (Exception ex) {
     
    5549    }
    5650
    57     protected virtual void setDataTypeButton_Click(object sender, EventArgs e) {
    58       if (typeSelectorDialog == null) {
    59         typeSelectorDialog = new TypeSelectorDialog();
    60         typeSelectorDialog.Caption = "Select Data Type";
    61         typeSelectorDialog.TypeSelector.Configure(typeof(IItem), true, true);
    62       }
    63 
    64       if (typeSelectorDialog.ShowDialog(this) == DialogResult.OK) {
    65         dataTypeTextBox.Text = typeSelectorDialog.TypeSelector.SelectedType.FullName;
    66         dataTypeTextBox.Tag = typeSelectorDialog.TypeSelector.SelectedType;
    67       }
    68       okButton.Enabled = dataTypeTextBox.Tag != null;
    69     }
    70 
    7151    protected virtual void parameterTypeSelector_SelectedTypeChanged(object sender, EventArgs e) {
    72       dataTypeTextBox.Text = "-";
    73       dataTypeTextBox.Tag = null;
    74       dataTypeTextBox.Enabled = false;
    75       setDataTypeButton.Enabled = false;
    76       okButton.Enabled = false;
    77 
    78       if (parameterTypeSelector.SelectedType != null) {
    79         if (parameterTypeSelector.SelectedType.ContainsGenericParameters) {
    80           dataTypeTextBox.Enabled = true;
    81           setDataTypeButton.Enabled = true;
    82         } else {
    83           okButton.Enabled = true;
    84         }
    85       }
     52      okButton.Enabled = (parameterTypeSelector.SelectedType != null) && !parameterTypeSelector.SelectedType.ContainsGenericParameters;
    8653    }
    8754  }
  • trunk/sources/HeuristicLab.Core.Views/3.3/ItemArrayView.cs

    r3775 r3829  
    205205                               (Content != null) && !Content.IsReadOnly && !ReadOnly;
    206206      removeButton.Enabled = itemsListView.SelectedItems.Count > 0 && (Content != null) && !Content.IsReadOnly && !ReadOnly;
     207      AdjustListViewColumnSizes();
    207208
    208209      if (itemsListView.SelectedItems.Count == 1) {
     
    391392            UpdateListViewItemText(listViewItem);
    392393        }
    393         AdjustListViewColumnSizes();
    394394      }
    395395    }
  • trunk/sources/HeuristicLab.Core.Views/3.3/ItemCollectionView.cs

    r3764 r3829  
    163163    protected virtual void itemsListView_SelectedIndexChanged(object sender, EventArgs e) {
    164164      removeButton.Enabled = (Content != null) && !Content.IsReadOnly && !ReadOnly && itemsListView.SelectedItems.Count > 0;
     165      AdjustListViewColumnSizes();
    165166      if (itemsListView.SelectedItems.Count == 1) {
    166167        T item = (T)itemsListView.SelectedItems[0].Tag;
     
    300301        foreach (ListViewItem listViewItem in GetListViewItemsForItem(item))
    301302          UpdateListViewItemText(listViewItem);
    302         AdjustListViewColumnSizes();
    303303      }
    304304    }
  • trunk/sources/HeuristicLab.Core.Views/3.3/ItemListView.cs

    r3775 r3829  
    199199      removeButton.Enabled = itemsListView.SelectedItems.Count > 0 &&
    200200                             (Content != null) && !Content.IsReadOnly && !ReadOnly;
     201      AdjustListViewColumnSizes();
    201202
    202203      if (itemsListView.SelectedItems.Count == 1) {
     
    392393            UpdateListViewItemText(listViewItem);
    393394        }
    394         AdjustListViewColumnSizes();
    395395      }
    396396    }
  • trunk/sources/HeuristicLab.Core.Views/3.3/TypeSelector.cs

    r3588 r3829  
    123123              else if (type.ContainsGenericParameters) typeNode.ImageIndex = 3;
    124124              else if (imageList.Images.ContainsKey(type.FullName)) typeNode.ImageIndex = imageList.Images.IndexOfKey(type.FullName);
    125               else if (typeof(IItem).IsAssignableFrom(type)) {
     125              else if (typeof(IItem).IsAssignableFrom(type) && !type.IsInterface && !type.IsAbstract) {
    126126                try {
    127127                  IItem item = (IItem)Activator.CreateInstance(type);
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionView.Designer.cs

    r3797 r3829  
    146146      this.itemsListView.View = System.Windows.Forms.View.Details;
    147147      this.itemsListView.SelectedIndexChanged += new System.EventHandler(this.itemsListView_SelectedIndexChanged);
    148       this.itemsListView.SizeChanged += new System.EventHandler(this.itemsListView_SizeChanged);
    149148      this.itemsListView.DoubleClick += new System.EventHandler(this.itemsListView_DoubleClick);
    150149      this.itemsListView.DragDrop += new System.Windows.Forms.DragEventHandler(this.itemsListView_DragDrop);
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionView.cs

    r3796 r3829  
    161161      ((IRun)listViewItem.Tag).ItemImageChanged += new EventHandler(Item_ItemImageChanged);
    162162      ((IRun)listViewItem.Tag).ToStringChanged += new EventHandler(Item_ToStringChanged);
     163      AdjustListViewColumnSizes();
    163164    }
    164165    protected virtual void RemoveListViewItem(ListViewItem listViewItem) {
     
    190191    protected virtual void itemsListView_SelectedIndexChanged(object sender, EventArgs e) {
    191192      removeButton.Enabled = itemsListView.SelectedItems.Count > 0 && (Content != null) && !Content.IsReadOnly && !ReadOnly;
     193      AdjustListViewColumnSizes();
    192194      if (itemsListView.SelectedItems.Count == 1) {
    193195        IRun item = (IRun)itemsListView.SelectedItems[0].Tag;
     
    198200        detailsGroupBox.Enabled = false;
    199201      }
    200     }
    201     protected virtual void itemsListView_SizeChanged(object sender, EventArgs e) {
    202       if (itemsListView.Columns.Count > 0)
    203         itemsListView.Columns[0].Width = Math.Max(0, itemsListView.Width - 25);
    204202    }
    205203    protected virtual void itemsListView_KeyDown(object sender, KeyEventArgs e) {
     
    346344        foreach (ListViewItem listViewItem in GetListViewItemsForItem(item))
    347345          UpdateListViewItemText(listViewItem);
     346        AdjustListViewColumnSizes();
    348347      }
    349348    }
     
    370369    #endregion
    371370
     371    #region Helpers
     372    protected virtual void AdjustListViewColumnSizes() {
     373      if (itemsListView.Items.Count > 0) {
     374        for (int i = 0; i < itemsListView.Columns.Count; i++) {
     375          itemsListView.Columns[i].AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent);
     376        }
     377      }
     378    }
     379    #endregion
    372380  }
    373381}
Note: See TracChangeset for help on using the changeset viewer.