Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/03/12 16:46:35 (12 years ago)
Author:
gkronber
Message:

#1847: merged r8084:8205 from trunk into GP move operators branch

Location:
branches/GP-MoveOperators
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/GP-MoveOperators

  • branches/GP-MoveOperators/HeuristicLab.Problems.Instances.Views/3.3/ProblemInstanceConsumerViewGeneric.Designer.cs

    r7967 r8206  
    5555      this.openFileDialog = new System.Windows.Forms.OpenFileDialog();
    5656      this.saveFileDialog = new System.Windows.Forms.SaveFileDialog();
    57       this.problemInstanceProviderSplitContainer = new System.Windows.Forms.SplitContainer();
    58       ((System.ComponentModel.ISupportInitialize)(this.problemInstanceProviderSplitContainer)).BeginInit();
    59       this.problemInstanceProviderSplitContainer.Panel1.SuspendLayout();
    60       this.problemInstanceProviderSplitContainer.Panel2.SuspendLayout();
    61       this.problemInstanceProviderSplitContainer.SuspendLayout();
     57      this.ProviderExportSplitContainer = new System.Windows.Forms.SplitContainer();
     58      this.ProviderImportSplitContainer = new System.Windows.Forms.SplitContainer();
     59      ((System.ComponentModel.ISupportInitialize)(this.ProviderExportSplitContainer)).BeginInit();
     60      this.ProviderExportSplitContainer.Panel1.SuspendLayout();
     61      this.ProviderExportSplitContainer.Panel2.SuspendLayout();
     62      this.ProviderExportSplitContainer.SuspendLayout();
     63      ((System.ComponentModel.ISupportInitialize)(this.ProviderImportSplitContainer)).BeginInit();
     64      this.ProviderImportSplitContainer.Panel1.SuspendLayout();
     65      this.ProviderImportSplitContainer.Panel2.SuspendLayout();
     66      this.ProviderImportSplitContainer.SuspendLayout();
    6267      this.SuspendLayout();
    6368      //
    6469      // problemInstanceProviderComboBox
    6570      //
    66       this.problemInstanceProviderComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
    67             | System.Windows.Forms.AnchorStyles.Right)));
     71      this.problemInstanceProviderComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     72                  | System.Windows.Forms.AnchorStyles.Right)));
    6873      this.problemInstanceProviderComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
    6974      this.problemInstanceProviderComboBox.FormattingEnabled = true;
    7075      this.problemInstanceProviderComboBox.Location = new System.Drawing.Point(50, 1);
    7176      this.problemInstanceProviderComboBox.Name = "problemInstanceProviderComboBox";
    72       this.problemInstanceProviderComboBox.Size = new System.Drawing.Size(171, 21);
     77      this.problemInstanceProviderComboBox.Size = new System.Drawing.Size(174, 21);
    7378      this.problemInstanceProviderComboBox.TabIndex = 16;
    7479      this.problemInstanceProviderComboBox.SelectedIndexChanged += new System.EventHandler(this.problemInstanceProviderComboBox_SelectedIndexChanged);
     
    7782      //
    7883      this.libraryInfoButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
    79       this.libraryInfoButton.Location = new System.Drawing.Point(227, -1);
     84      this.libraryInfoButton.Location = new System.Drawing.Point(230, -1);
    8085      this.libraryInfoButton.Name = "libraryInfoButton";
    8186      this.libraryInfoButton.Size = new System.Drawing.Size(24, 24);
     
    8893      //
    8994      this.libraryLabel.AutoSize = true;
    90       this.libraryLabel.Location = new System.Drawing.Point(4, 4);
     95      this.libraryLabel.Location = new System.Drawing.Point(3, 5);
    9196      this.libraryLabel.Name = "libraryLabel";
    9297      this.libraryLabel.Size = new System.Drawing.Size(41, 13);
     
    96101      // problemInstanceProviderViewHost
    97102      //
    98       this.problemInstanceProviderViewHost.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
    99             | System.Windows.Forms.AnchorStyles.Right)));
     103      this.problemInstanceProviderViewHost.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     104                  | System.Windows.Forms.AnchorStyles.Right)));
    100105      this.problemInstanceProviderViewHost.Caption = "View";
    101106      this.problemInstanceProviderViewHost.Content = null;
     
    112117      //
    113118      this.importButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
    114       this.importButton.Location = new System.Drawing.Point(257, -1);
     119      this.importButton.Location = new System.Drawing.Point(1, -1);
    115120      this.importButton.Name = "importButton";
    116121      this.importButton.Size = new System.Drawing.Size(24, 24);
     
    140145      this.saveFileDialog.Title = "Save RegressionInstance...";
    141146      //
    142       // problemInstanceProviderSplitContainer
    143       //
    144       this.problemInstanceProviderSplitContainer.FixedPanel = System.Windows.Forms.FixedPanel.Panel2;
    145       this.problemInstanceProviderSplitContainer.IsSplitterFixed = true;
    146       this.problemInstanceProviderSplitContainer.Location = new System.Drawing.Point(0, 0);
    147       this.problemInstanceProviderSplitContainer.Name = "problemInstanceProviderSplitContainer";
    148       //
    149       // problemInstanceProviderSplitContainer.Panel1
    150       //
    151       this.problemInstanceProviderSplitContainer.Panel1.Controls.Add(this.problemInstanceProviderComboBox);
    152       this.problemInstanceProviderSplitContainer.Panel1.Controls.Add(this.importButton);
    153       this.problemInstanceProviderSplitContainer.Panel1.Controls.Add(this.libraryLabel);
    154       this.problemInstanceProviderSplitContainer.Panel1.Controls.Add(this.libraryInfoButton);
    155       //
    156       // problemInstanceProviderSplitContainer.Panel2
    157       //
    158       this.problemInstanceProviderSplitContainer.Panel2.Controls.Add(this.exportButton);
    159       this.problemInstanceProviderSplitContainer.Size = new System.Drawing.Size(312, 22);
    160       this.problemInstanceProviderSplitContainer.SplitterDistance = 280;
    161       this.problemInstanceProviderSplitContainer.TabIndex = 20;
     147      // ProviderExportSplitContainer
     148      //
     149      this.ProviderExportSplitContainer.FixedPanel = System.Windows.Forms.FixedPanel.Panel2;
     150      this.ProviderExportSplitContainer.IsSplitterFixed = true;
     151      this.ProviderExportSplitContainer.Location = new System.Drawing.Point(0, 0);
     152      this.ProviderExportSplitContainer.Name = "ProviderExportSplitContainer";
     153      //
     154      // ProviderExportSplitContainer.Panel1
     155      //
     156      this.ProviderExportSplitContainer.Panel1.Controls.Add(this.ProviderImportSplitContainer);
     157      //
     158      // ProviderExportSplitContainer.Panel2
     159      //
     160      this.ProviderExportSplitContainer.Panel2.Controls.Add(this.exportButton);
     161      this.ProviderExportSplitContainer.Size = new System.Drawing.Size(312, 22);
     162      this.ProviderExportSplitContainer.SplitterDistance = 283;
     163      this.ProviderExportSplitContainer.TabIndex = 20;
     164      //
     165      // ProviderImportSplitContainer
     166      //
     167      this.ProviderImportSplitContainer.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     168                  | System.Windows.Forms.AnchorStyles.Right)));
     169      this.ProviderImportSplitContainer.FixedPanel = System.Windows.Forms.FixedPanel.Panel2;
     170      this.ProviderImportSplitContainer.IsSplitterFixed = true;
     171      this.ProviderImportSplitContainer.Location = new System.Drawing.Point(0, 0);
     172      this.ProviderImportSplitContainer.Name = "ProviderImportSplitContainer";
     173      //
     174      // ProviderImportSplitContainer.Panel1
     175      //
     176      this.ProviderImportSplitContainer.Panel1.Controls.Add(this.libraryLabel);
     177      this.ProviderImportSplitContainer.Panel1.Controls.Add(this.problemInstanceProviderComboBox);
     178      this.ProviderImportSplitContainer.Panel1.Controls.Add(this.libraryInfoButton);
     179      //
     180      // ProviderImportSplitContainer.Panel2
     181      //
     182      this.ProviderImportSplitContainer.Panel2.Controls.Add(this.importButton);
     183      this.ProviderImportSplitContainer.Size = new System.Drawing.Size(282, 23);
     184      this.ProviderImportSplitContainer.SplitterDistance = 253;
     185      this.ProviderImportSplitContainer.TabIndex = 21;
    162186      //
    163187      // ProblemInstanceConsumerViewGeneric
    164188      //
    165       this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    166189      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
    167       this.Controls.Add(this.problemInstanceProviderSplitContainer);
     190      this.Controls.Add(this.ProviderExportSplitContainer);
    168191      this.Controls.Add(this.problemInstanceProviderViewHost);
    169192      this.Name = "ProblemInstanceConsumerViewGeneric";
    170       this.problemInstanceProviderSplitContainer.Panel1.ResumeLayout(false);
    171       this.problemInstanceProviderSplitContainer.Panel1.PerformLayout();
    172       this.problemInstanceProviderSplitContainer.Panel2.ResumeLayout(false);
    173       ((System.ComponentModel.ISupportInitialize)(this.problemInstanceProviderSplitContainer)).EndInit();
    174       this.problemInstanceProviderSplitContainer.ResumeLayout(false);
     193      this.ProviderExportSplitContainer.Panel1.ResumeLayout(false);
     194      this.ProviderExportSplitContainer.Panel2.ResumeLayout(false);
     195      ((System.ComponentModel.ISupportInitialize)(this.ProviderExportSplitContainer)).EndInit();
     196      this.ProviderExportSplitContainer.ResumeLayout(false);
     197      this.ProviderImportSplitContainer.Panel1.ResumeLayout(false);
     198      this.ProviderImportSplitContainer.Panel1.PerformLayout();
     199      this.ProviderImportSplitContainer.Panel2.ResumeLayout(false);
     200      ((System.ComponentModel.ISupportInitialize)(this.ProviderImportSplitContainer)).EndInit();
     201      this.ProviderImportSplitContainer.ResumeLayout(false);
    175202      this.ResumeLayout(false);
    176203
     
    180207
    181208    protected System.Windows.Forms.ComboBox problemInstanceProviderComboBox;
    182     private System.Windows.Forms.Button libraryInfoButton;
    183     private System.Windows.Forms.Label libraryLabel;
     209    protected System.Windows.Forms.Button libraryInfoButton;
     210    protected System.Windows.Forms.Label libraryLabel;
    184211    protected MainForm.WindowsForms.ViewHost problemInstanceProviderViewHost;
    185     private System.Windows.Forms.ToolTip toolTip;
    186     private System.Windows.Forms.Button importButton;
    187     private System.Windows.Forms.Button exportButton;
     212    protected System.Windows.Forms.ToolTip toolTip;
     213    protected System.Windows.Forms.Button importButton;
     214    protected System.Windows.Forms.Button exportButton;
    188215    protected System.Windows.Forms.SaveFileDialog saveFileDialog;
    189216    protected System.Windows.Forms.OpenFileDialog openFileDialog;
    190     private System.Windows.Forms.SplitContainer problemInstanceProviderSplitContainer;
     217    protected System.Windows.Forms.SplitContainer ProviderExportSplitContainer;
     218    protected System.Windows.Forms.SplitContainer ProviderImportSplitContainer;
    191219  }
    192220}
  • branches/GP-MoveOperators/HeuristicLab.Problems.Instances.Views/3.3/ProblemInstanceConsumerViewGeneric.cs

    r8031 r8206  
    9292      problemInstanceProviderComboBox.Enabled = !ReadOnly && !Locked && Content != null && problemInstanceProviderComboBox.Items.Count > 0;
    9393      libraryInfoButton.Enabled = SelectedProvider != null && SelectedProvider.WebLink != null;
    94       importButton.Enabled = !ReadOnly && !Locked && Content != null && Consumer != null;
    95       exportButton.Enabled = !ReadOnly && !Locked && Content != null && Exporter != null;
    96       problemInstanceProviderSplitContainer.Panel2Collapsed = !exportButton.Enabled;
     94      importButton.Enabled = !ReadOnly && !Locked && Content != null && Consumer != null &&
     95                             GenericSelectedProvider != null && GenericSelectedProvider.CanImportData;
     96      ProviderImportSplitContainer.Panel2Collapsed = !importButton.Enabled;
     97      exportButton.Enabled = !ReadOnly && !Locked && Content != null && Exporter != null &&
     98                             GenericSelectedProvider != null && GenericSelectedProvider.CanExportData;
     99      ProviderExportSplitContainer.Panel2Collapsed = !exportButton.Enabled;
    97100    }
    98101
     
    131134        T instance = default(T);
    132135        try {
    133           instance = GenericSelectedProvider.LoadData(openFileDialog.FileName);
     136          instance = GenericSelectedProvider.ImportData(openFileDialog.FileName);
    134137        }
    135138        catch (Exception ex) {
     
    146149    }
    147150
    148     protected void exportButton_Click(object sender, EventArgs e) {
     151    protected virtual void exportButton_Click(object sender, EventArgs e) {
    149152      if (saveFileDialog.ShowDialog(this) == DialogResult.OK) {
    150153        try {
    151           GenericSelectedProvider.SaveData(GenericExporter.Export(), saveFileDialog.FileName);
     154          GenericSelectedProvider.ExportData(GenericExporter.Export(), saveFileDialog.FileName);
    152155        }
    153156        catch (Exception ex) {
     
    164167    protected void SetTooltip() {
    165168      toolTip.SetToolTip(problemInstanceProviderComboBox, GetProviderToolTip());
    166       toolTip.SetToolTip(importButton, "Open a " + GetProblemType() + " problem from file.");
     169      toolTip.SetToolTip(importButton, "Import a " + GetProblemType() + " problem from file.");
    167170      toolTip.SetToolTip(exportButton, "Export currently loaded " + GetProblemType() + " problem to a file.");
    168171      if (SelectedProvider.WebLink != null)
  • branches/GP-MoveOperators/HeuristicLab.Problems.Instances.Views/3.3/ProblemInstanceProviderViewGeneric.Designer.cs

    r8031 r8206  
    4646    private void InitializeComponent() {
    4747      this.components = new System.ComponentModel.Container();
    48       this.loadButton = new System.Windows.Forms.Button();
    4948      this.instanceLabel = new System.Windows.Forms.Label();
    5049      this.instancesComboBox = new System.Windows.Forms.ComboBox();
    5150      this.openFileDialog = new System.Windows.Forms.OpenFileDialog();
    52       this.toolTip = new System.Windows.Forms.ToolTip(this.components);
    5351      this.saveFileDialog = new System.Windows.Forms.SaveFileDialog();
    5452      this.SuspendLayout();
    55       //
    56       // loadButton
    57       //
    58       this.loadButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
    59       this.loadButton.Location = new System.Drawing.Point(667, -1);
    60       this.loadButton.Name = "loadButton";
    61       this.loadButton.Size = new System.Drawing.Size(24, 24);
    62       this.loadButton.TabIndex = 6;
    63       this.loadButton.Text = "Load";
    64       this.loadButton.UseVisualStyleBackColor = true;
    65       this.loadButton.Click += new System.EventHandler(this.loadButton_Click);
    6653      //
    6754      // instanceLabel
     
    7663      // instancesComboBox
    7764      //
    78       this.instancesComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
     65      this.instancesComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
    7966            | System.Windows.Forms.AnchorStyles.Right)));
    8067      this.instancesComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
     
    8269      this.instancesComboBox.Location = new System.Drawing.Point(60, 1);
    8370      this.instancesComboBox.Name = "instancesComboBox";
    84       this.instancesComboBox.Size = new System.Drawing.Size(601, 21);
     71      this.instancesComboBox.Size = new System.Drawing.Size(632, 21);
    8572      this.instancesComboBox.TabIndex = 7;
    8673      this.instancesComboBox.DataSourceChanged += new System.EventHandler(this.instancesComboBox_DataSourceChanged);
    87       this.instancesComboBox.SelectedIndexChanged += new System.EventHandler(this.instancesComboBox_SelectedIndexChanged);
     74      this.instancesComboBox.SelectionChangeCommitted += new System.EventHandler(instancesComboBox_SelectionChangeCommitted);
    8875      //
    8976      // openFileDialog
     
    10289      this.Controls.Add(this.instanceLabel);
    10390      this.Controls.Add(this.instancesComboBox);
    104       this.Controls.Add(this.loadButton);
    10591      this.Name = "ProblemInstanceProviderViewGeneric";
    10692      this.Size = new System.Drawing.Size(694, 21);
     
    10995
    11096    }
    111 
    11297    #endregion
    11398
    11499    protected System.Windows.Forms.OpenFileDialog openFileDialog;
    115     protected System.Windows.Forms.ToolTip toolTip;
    116     protected System.Windows.Forms.Button loadButton;
    117100    protected System.Windows.Forms.Label instanceLabel;
    118101    protected System.Windows.Forms.ComboBox instancesComboBox;
  • branches/GP-MoveOperators/HeuristicLab.Problems.Instances.Views/3.3/ProblemInstanceProviderViewGeneric.cs

    r8031 r8206  
    2424using System.Linq;
    2525using System.Windows.Forms;
    26 using HeuristicLab.Common.Resources;
    2726using HeuristicLab.MainForm;
    2827using HeuristicLab.MainForm.WindowsForms;
     28using HeuristicLab.PluginInfrastructure;
    2929
    3030namespace HeuristicLab.Problems.Instances.Views {
     
    5151    public ProblemInstanceProviderViewGeneric() {
    5252      InitializeComponent();
    53       loadButton.Text = String.Empty;
    54       loadButton.Image = VSImageLibrary.RefreshDocument;
    55       toolTip.SetToolTip(loadButton, "Load the selected problem.");
    5653    }
    5754
     
    7370        instanceLabel.Show();
    7471        instancesComboBox.Show();
    75         loadButton.Show();
    7672      } else {
    7773        instanceLabel.Hide();
    7874        instancesComboBox.Hide();
    79         loadButton.Hide();
    8075      }
    8176    }
     
    8479      base.SetEnabledStateOfControls();
    8580      instancesComboBox.Enabled = !ReadOnly && !Locked && Content != null && GenericConsumer != null;
    86       loadButton.Enabled = !ReadOnly && !Locked && Content != null && GenericConsumer != null && instancesComboBox.SelectedIndex >= 0;
    87     }
    88 
    89     protected virtual void loadButton_Click(object sender, EventArgs e) {
    90       var descriptor = (IDataDescriptor)instancesComboBox.SelectedItem;
    91       T instance = Content.LoadData(descriptor);
    92       try {
    93         GenericConsumer.Load(instance);
    94       }
    95       catch (Exception ex) {
    96         MessageBox.Show(String.Format("This problem does not support loading the instance {0}: {1}", descriptor.Name, Environment.NewLine + ex.Message), "Cannot load instance");
    97       }
    9881    }
    9982
     
    10487    }
    10588
    106     private void instancesComboBox_SelectedIndexChanged(object sender, System.EventArgs e) {
    107       SetEnabledStateOfControls();
     89    private void instancesComboBox_SelectionChangeCommitted(object sender, System.EventArgs e) {
     90      if (instancesComboBox.SelectedIndex >= 0) {
     91        var descriptor = (IDataDescriptor)instancesComboBox.SelectedItem;
     92        T instance = Content.LoadData(descriptor);
     93        try {
     94          GenericConsumer.Load(instance);
     95        }
     96        catch (Exception ex) {
     97          ErrorHandling.ShowErrorDialog(String.Format("This problem does not support loading the instance {0}", descriptor.Name), ex);
     98        }
     99      }
    108100    }
    109101  }
Note: See TracChangeset for help on using the changeset viewer.