Changeset 1611


Ignore:
Timestamp:
04/20/09 15:21:05 (12 years ago)
Author:
epitzer
Message:

Reset/Re-initialize persistence configuration within GUI. (#548)

Location:
trunk/sources/HeuristicLab.Persistence.GUI/3.3
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Persistence.GUI/3.3/PersistenceConfigurationForm.Designer.cs

    r1530 r1611  
    2424    /// </summary>
    2525    private void InitializeComponent() {
    26       System.Windows.Forms.Button updateButton;
     26      this.updateButton = new System.Windows.Forms.Button();
    2727      this.configurationTabs = new System.Windows.Forms.TabControl();
    28       updateButton = new System.Windows.Forms.Button();
     28      this.buttonPanel = new System.Windows.Forms.TableLayoutPanel();
     29      this.resetButton = new System.Windows.Forms.Button();
     30      this.buttonPanel.SuspendLayout();
    2931      this.SuspendLayout();
    3032      //
    3133      // updateButton
    3234      //
    33       updateButton.Dock = System.Windows.Forms.DockStyle.Bottom;
    34       updateButton.Location = new System.Drawing.Point(0, 555);
    35       updateButton.Name = "updateButton";
    36       updateButton.Size = new System.Drawing.Size(597, 25);
    37       updateButton.TabIndex = 1;
    38       updateButton.Text = "Define Configuration";
    39       updateButton.UseVisualStyleBackColor = true;
    40       updateButton.Click += new System.EventHandler(this.updateButton_Click);
     35      this.updateButton.Dock = System.Windows.Forms.DockStyle.Fill;
     36      this.updateButton.Location = new System.Drawing.Point(296, 6);
     37      this.updateButton.Name = "updateButton";
     38      this.updateButton.Size = new System.Drawing.Size(282, 25);
     39      this.updateButton.TabIndex = 1;
     40      this.updateButton.Text = "&Define";
     41      this.updateButton.UseVisualStyleBackColor = true;
     42      this.updateButton.Click += new System.EventHandler(this.updateButton_Click);
    4143      //
    4244      // configurationTabs
    4345      //
    44       this.configurationTabs.Dock = System.Windows.Forms.DockStyle.Fill;
    45       this.configurationTabs.Location = new System.Drawing.Point(0, 0);
     46      this.configurationTabs.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     47                  | System.Windows.Forms.AnchorStyles.Left)
     48                  | System.Windows.Forms.AnchorStyles.Right)));
     49      this.configurationTabs.Location = new System.Drawing.Point(0, -1);
    4650      this.configurationTabs.Name = "configurationTabs";
    4751      this.configurationTabs.SelectedIndex = 0;
    48       this.configurationTabs.Size = new System.Drawing.Size(597, 580);
     52      this.configurationTabs.Size = new System.Drawing.Size(584, 573);
    4953      this.configurationTabs.TabIndex = 0;
     54      //
     55      // buttonPanel
     56      //
     57      this.buttonPanel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
     58                  | System.Windows.Forms.AnchorStyles.Right)));
     59      this.buttonPanel.AutoSize = true;
     60      this.buttonPanel.CausesValidation = false;
     61      this.buttonPanel.CellBorderStyle = System.Windows.Forms.TableLayoutPanelCellBorderStyle.InsetDouble;
     62      this.buttonPanel.ColumnCount = 2;
     63      this.buttonPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
     64      this.buttonPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
     65      this.buttonPanel.Controls.Add(this.updateButton, 1, 0);
     66      this.buttonPanel.Controls.Add(this.resetButton, 0, 0);
     67      this.buttonPanel.Location = new System.Drawing.Point(0, 572);
     68      this.buttonPanel.Name = "buttonPanel";
     69      this.buttonPanel.RowCount = 1;
     70      this.buttonPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
     71      this.buttonPanel.Size = new System.Drawing.Size(584, 37);
     72      this.buttonPanel.TabIndex = 2;
     73      //
     74      // resetButton
     75      //
     76      this.resetButton.Dock = System.Windows.Forms.DockStyle.Fill;
     77      this.resetButton.Location = new System.Drawing.Point(6, 6);
     78      this.resetButton.Name = "resetButton";
     79      this.resetButton.Size = new System.Drawing.Size(281, 25);
     80      this.resetButton.TabIndex = 2;
     81      this.resetButton.Text = "&Reset All";
     82      this.resetButton.UseVisualStyleBackColor = true;
     83      this.resetButton.Click += new System.EventHandler(this.resetButton_Click);
    5084      //
    5185      // PersistenceConfigurationForm
     
    5387      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    5488      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
    55       this.ClientSize = new System.Drawing.Size(597, 580);
    56       this.Controls.Add(updateButton);
     89      this.ClientSize = new System.Drawing.Size(582, 609);
     90      this.Controls.Add(this.buttonPanel);
    5791      this.Controls.Add(this.configurationTabs);
    5892      this.Name = "PersistenceConfigurationForm";
    59       this.Text = "PersistenceConfigurationForm";     
     93      this.Text = "PersistenceConfigurationForm";
     94      this.buttonPanel.ResumeLayout(false);
    6095      this.ResumeLayout(false);
     96      this.PerformLayout();
    6197
    6298    }
     
    65101
    66102    private System.Windows.Forms.TabControl configurationTabs;
     103    private System.Windows.Forms.TableLayoutPanel buttonPanel;
     104    private System.Windows.Forms.Button resetButton;
     105    private System.Windows.Forms.Button updateButton;
    67106  }
    68107}
  • trunk/sources/HeuristicLab.Persistence.GUI/3.3/PersistenceConfigurationForm.cs

    r1566 r1611  
    2020    private readonly Dictionary<string, Type> typeNameTable;
    2121    private readonly Dictionary<Type, string> reverseTypeNameTable;
     22    private bool underConstruction;
    2223
    2324    public PersistenceConfigurationForm() {
     
    2829      typeNameTable = new Dictionary<string, Type>();
    2930      reverseTypeNameTable = new Dictionary<Type, string>();
     31      underConstruction = true;
     32      InitializeTooltips();
    3033      InitializeNameTables();
    3134      initializeConfigPages();
    3235      UpdateFromConfigurationService();
     36      underConstruction = false;
     37      UpdatePreview();
     38    }
     39
     40    private void InitializeTooltips() {
     41      ToolTip tooltip = new ToolTip() {
     42        AutoPopDelay = 5000,
     43        InitialDelay = 1000,
     44        ReshowDelay = 500,
     45        ShowAlways = true
     46      };
     47      tooltip.SetToolTip(resetButton,
     48        "Clear all custom configurations from memory.\r\n" +
     49        "The saved configuration will still be used next\r\n" +
     50        "time if you don't save (define) this change.");
     51      tooltip.SetToolTip(updateButton,
     52        "Define configuration for currently active format\r\n" +
     53        "and save to disk.");
    3354    }
    3455
     
    112133          Name = "CheckBox",
    113134          Dock = DockStyle.Fill,
    114           Enabled = false,
    115135        };
    116136        horizontalSplit.Panel2.Controls.Add(checkBox);
     
    246266    }
    247267
     268    private void UpdatePreview() {
     269      if (underConstruction)
     270        return;
     271      ListBox checkBox = (ListBox)GetActiveControl("CheckBox");
     272      IFormat activeFormat = (IFormat)configurationTabs.SelectedTab.Tag;
     273      if (activeFormat != null && checkBox != null) {
     274        checkBox.Items.Clear();
     275        Configuration activeConfig = GetActiveConfiguration();
     276        foreach (var formatter in activeConfig.Formatters) {
     277          checkBox.Items.Add(formatter.GetType().Name + " (F)");
     278        }
     279        foreach (var decomposer in activeConfig.Decomposers)
     280          checkBox.Items.Add(decomposer.GetType().Name + " (D)");
     281      }
     282    }
     283
     284
    248285    void gridView_CellValueChanged(object sender, DataGridViewCellEventArgs e) {
    249286      UpdatePreview();
     
    292329    }
    293330
    294     private void UpdatePreview() {
    295       ListBox checkBox = (ListBox)GetActiveControl("CheckBox");
    296       IFormat activeFormat = (IFormat)configurationTabs.SelectedTab.Tag;
    297       if (activeFormat != null && checkBox != null) {
    298         checkBox.Items.Clear();
    299         Configuration activeConfig = GetActiveConfiguration();
    300         foreach (var formatter in activeConfig.Formatters) {
    301           checkBox.Items.Add(formatter.GetType().Name + " (F)");
    302         }
    303         foreach (var decomposer in activeConfig.Decomposers)
    304           checkBox.Items.Add(decomposer.GetType().Name + " (D)");
    305       }
    306     }
    307331
    308332    private void decomposerList_ItemChecked(object sender, ItemCheckedEventArgs e) {
     
    370394    }
    371395
     396    private void resetButton_Click(object sender, EventArgs e) {
     397      ConfigurationService.Instance.Reset();
     398      underConstruction = true;
     399      UpdateFromConfigurationService();
     400      underConstruction = false;
     401      UpdatePreview();
     402    }
     403
    372404  }
    373405
  • trunk/sources/HeuristicLab.Persistence.GUI/3.3/PersistenceConfigurationForm.resx

    r1530 r1611  
    118118    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
    119119  </resheader>
    120   <metadata name="updateButton.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
    121     <value>False</value>
    122   </metadata>
    123120</root>
Note: See TracChangeset for help on using the changeset viewer.