Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.Data.Views/3.3/StringConvertibleMatrixView.cs @ 4709

Last change on this file since 4709 was 4709, checked in by mkommend, 13 years ago

Added StatusStrip in StringConvertibleMatrixView to diplay statistical information (ticket #1253).

File size: 22.0 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
4 *
5 * This file is part of HeuristicLab.
6 *
7 * HeuristicLab is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * HeuristicLab is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
19 */
20#endregion
21
22using System;
23using System.Collections.Generic;
24using System.ComponentModel;
25using System.Drawing;
26using System.Linq;
27using System.Text;
28using System.Windows.Forms;
29using HeuristicLab.Common;
30using HeuristicLab.MainForm;
31using HeuristicLab.MainForm.WindowsForms;
32
33namespace HeuristicLab.Data.Views {
34  [View("StringConvertibleMatrix View")]
35  [Content(typeof(IStringConvertibleMatrix), true)]
36  public partial class StringConvertibleMatrixView : AsynchronousContentView {
37    private int[] virtualRowIndizes;
38    private List<KeyValuePair<int, SortOrder>> sortedColumnIndizes;
39    private RowComparer rowComparer;
40
41    public new IStringConvertibleMatrix Content {
42      get { return (IStringConvertibleMatrix)base.Content; }
43      set { base.Content = value; }
44    }
45
46    public override bool ReadOnly {
47      get {
48        if ((Content != null) && Content.ReadOnly) return true;
49        return base.ReadOnly;
50      }
51      set { base.ReadOnly = value; }
52    }
53
54    private bool showRowsAndColumnsTextBox;
55    public bool ShowRowsAndColumnsTextBox {
56      get { return showRowsAndColumnsTextBox; }
57      set {
58        showRowsAndColumnsTextBox = value;
59        UpdateVisibilityOfTextBoxes();
60      }
61    }
62
63    private bool showStatisticalInformation;
64    public bool ShowStatisticalInformation {
65      get { return showStatisticalInformation; }
66      set {
67        showStatisticalInformation = value;
68        UpdateVisibilityOfStatisticalInformation();
69      }
70    }
71
72    public StringConvertibleMatrixView() {
73      InitializeComponent();
74      ShowRowsAndColumnsTextBox = true;
75      ShowStatisticalInformation = false;
76      errorProvider.SetIconAlignment(rowsTextBox, ErrorIconAlignment.MiddleLeft);
77      errorProvider.SetIconPadding(rowsTextBox, 2);
78      errorProvider.SetIconAlignment(columnsTextBox, ErrorIconAlignment.MiddleLeft);
79      errorProvider.SetIconPadding(columnsTextBox, 2);
80      sortedColumnIndizes = new List<KeyValuePair<int, SortOrder>>();
81      rowComparer = new RowComparer();
82    }
83
84    protected override void DeregisterContentEvents() {
85      Content.ItemChanged -= new EventHandler<EventArgs<int, int>>(Content_ItemChanged);
86      Content.Reset -= new EventHandler(Content_Reset);
87      Content.ColumnNamesChanged -= new EventHandler(Content_ColumnNamesChanged);
88      Content.RowNamesChanged -= new EventHandler(Content_RowNamesChanged);
89      base.DeregisterContentEvents();
90    }
91    protected override void RegisterContentEvents() {
92      base.RegisterContentEvents();
93      Content.ItemChanged += new EventHandler<EventArgs<int, int>>(Content_ItemChanged);
94      Content.Reset += new EventHandler(Content_Reset);
95      Content.ColumnNamesChanged += new EventHandler(Content_ColumnNamesChanged);
96      Content.RowNamesChanged += new EventHandler(Content_RowNamesChanged);
97    }
98
99    protected override void OnContentChanged() {
100      base.OnContentChanged();
101      if (Content == null) {
102        rowsTextBox.Text = "";
103        columnsTextBox.Text = "";
104        dataGridView.Rows.Clear();
105        dataGridView.Columns.Clear();
106        virtualRowIndizes = new int[0];
107      } else
108        UpdateData();
109    }
110
111    protected override void SetEnabledStateOfControls() {
112      base.SetEnabledStateOfControls();
113      rowsTextBox.Enabled = Content != null;
114      columnsTextBox.Enabled = Content != null;
115      dataGridView.Enabled = Content != null;
116      rowsTextBox.ReadOnly = ReadOnly;
117      columnsTextBox.ReadOnly = ReadOnly;
118      dataGridView.ReadOnly = ReadOnly;
119    }
120
121    private void UpdateData() {
122      rowsTextBox.Text = Content.Rows.ToString();
123      rowsTextBox.Enabled = true;
124      columnsTextBox.Text = Content.Columns.ToString();
125      columnsTextBox.Enabled = true;
126
127      //DataGridViews with rows but no columns are not allowed !
128      if (Content.Rows == 0 && dataGridView.RowCount != Content.Rows && !Content.ReadOnly)
129        Content.Rows = dataGridView.RowCount;
130      else
131        dataGridView.RowCount = Content.Rows;
132      if (Content.Columns == 0 && dataGridView.ColumnCount != Content.Columns && !Content.ReadOnly)
133        Content.Columns = dataGridView.ColumnCount;
134      else
135        dataGridView.ColumnCount = Content.Columns;
136      ClearSorting();
137
138      UpdateColumnHeaders();
139      UpdateRowHeaders();
140
141      dataGridView.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.ColumnHeader);
142      dataGridView.AutoResizeRowHeadersWidth(DataGridViewRowHeadersWidthSizeMode.AutoSizeToDisplayedHeaders);
143      dataGridView.Enabled = true;
144    }
145
146    protected void UpdateColumnHeaders() {
147      HashSet<string> visibleColumnNames = new HashSet<string>(dataGridView.Columns.OfType<DataGridViewColumn>()
148          .Where(c => c.Visible && !string.IsNullOrEmpty(c.HeaderText)).Select(c => c.HeaderText));
149
150      for (int i = 0; i < dataGridView.ColumnCount; i++) {
151        if (i < Content.ColumnNames.Count())
152          dataGridView.Columns[i].HeaderText = Content.ColumnNames.ElementAt(i);
153        else
154          dataGridView.Columns[i].HeaderText = "Column " + (i + 1);
155      }
156
157      foreach (DataGridViewColumn column in dataGridView.Columns)
158        column.Visible = visibleColumnNames.Contains(column.HeaderText) || visibleColumnNames.Count == 0;
159    }
160    protected void UpdateRowHeaders() {
161      int index = dataGridView.FirstDisplayedScrollingRowIndex;
162      if (index == -1) index = 0;
163      int updatedRows = 0;
164      int count = dataGridView.DisplayedRowCount(true);
165
166      while (updatedRows < count) {
167        if (virtualRowIndizes[index] < Content.RowNames.Count())
168          dataGridView.Rows[index].HeaderCell.Value = Content.RowNames.ElementAt(virtualRowIndizes[index]);
169        else
170          dataGridView.Rows[index].HeaderCell.Value = "Row " + (index + 1);
171        if (dataGridView.Rows[index].Visible)
172          updatedRows++;
173        index++;
174      }
175    }
176
177    private void Content_RowNamesChanged(object sender, EventArgs e) {
178      if (InvokeRequired)
179        Invoke(new EventHandler(Content_RowNamesChanged), sender, e);
180      else
181        UpdateRowHeaders();
182    }
183    private void Content_ColumnNamesChanged(object sender, EventArgs e) {
184      if (InvokeRequired)
185        Invoke(new EventHandler(Content_ColumnNamesChanged), sender, e);
186      else
187        UpdateColumnHeaders();
188    }
189    private void Content_ItemChanged(object sender, EventArgs<int, int> e) {
190      if (InvokeRequired)
191        Invoke(new EventHandler<EventArgs<int, int>>(Content_ItemChanged), sender, e);
192      else
193        dataGridView.InvalidateCell(e.Value2, e.Value);
194    }
195    private void Content_Reset(object sender, EventArgs e) {
196      if (InvokeRequired)
197        Invoke(new EventHandler(Content_Reset), sender, e);
198      else
199        UpdateData();
200    }
201
202    #region TextBox Events
203    private void rowsTextBox_Validating(object sender, CancelEventArgs e) {
204      if (ReadOnly || Locked)
205        return;
206      int i = 0;
207      if (!int.TryParse(rowsTextBox.Text, out i) || (i <= 0)) {
208        e.Cancel = true;
209        errorProvider.SetError(rowsTextBox, "Invalid Number of Rows (Valid values are positive integers larger than 0)");
210        rowsTextBox.SelectAll();
211      }
212    }
213    private void rowsTextBox_Validated(object sender, EventArgs e) {
214      if (!Content.ReadOnly) Content.Rows = int.Parse(rowsTextBox.Text);
215      errorProvider.SetError(rowsTextBox, string.Empty);
216    }
217    private void rowsTextBox_KeyDown(object sender, KeyEventArgs e) {
218      if (e.KeyCode == Keys.Enter || e.KeyCode == Keys.Return)
219        rowsLabel.Focus();  // set focus on label to validate data
220      if (e.KeyCode == Keys.Escape) {
221        rowsTextBox.Text = Content.Rows.ToString();
222        rowsLabel.Focus();  // set focus on label to validate data
223      }
224    }
225    private void columnsTextBox_Validating(object sender, CancelEventArgs e) {
226      if (ReadOnly || Locked)
227        return;
228      int i = 0;
229      if (!int.TryParse(columnsTextBox.Text, out i) || (i <= 0)) {
230        e.Cancel = true;
231        errorProvider.SetError(columnsTextBox, "Invalid Number of Columns (Valid values are positive integers larger than 0)");
232        columnsTextBox.SelectAll();
233      }
234    }
235    private void columnsTextBox_Validated(object sender, EventArgs e) {
236      if (!Content.ReadOnly) Content.Columns = int.Parse(columnsTextBox.Text);
237      errorProvider.SetError(columnsTextBox, string.Empty);
238    }
239    private void columnsTextBox_KeyDown(object sender, KeyEventArgs e) {
240      if (e.KeyCode == Keys.Enter || e.KeyCode == Keys.Return)
241        columnsLabel.Focus();  // set focus on label to validate data
242      if (e.KeyCode == Keys.Escape) {
243        columnsTextBox.Text = Content.Columns.ToString();
244        columnsLabel.Focus();  // set focus on label to validate data
245      }
246    }
247    #endregion
248
249    #region DataGridView Events
250    private void dataGridView_CellValidating(object sender, DataGridViewCellValidatingEventArgs e) {
251      if (!dataGridView.ReadOnly) {
252        string errorMessage;
253        if (Content != null && !Content.Validate(e.FormattedValue.ToString(), out errorMessage)) {
254          e.Cancel = true;
255          dataGridView.Rows[e.RowIndex].ErrorText = errorMessage;
256        }
257      }
258    }
259    private void dataGridView_CellParsing(object sender, DataGridViewCellParsingEventArgs e) {
260      if (!dataGridView.ReadOnly) {
261        string value = e.Value.ToString();
262        int rowIndex = virtualRowIndizes[e.RowIndex];
263        e.ParsingApplied = Content.SetValue(value, rowIndex, e.ColumnIndex);
264        if (e.ParsingApplied) e.Value = Content.GetValue(rowIndex, e.ColumnIndex);
265      }
266    }
267    private void dataGridView_CellEndEdit(object sender, DataGridViewCellEventArgs e) {
268      dataGridView.Rows[e.RowIndex].ErrorText = string.Empty;
269    }
270    private void dataGridView_CellValueNeeded(object sender, DataGridViewCellValueEventArgs e) {
271      if (Content != null && e.RowIndex < Content.Rows && e.ColumnIndex < Content.Columns) {
272        int rowIndex = virtualRowIndizes[e.RowIndex];
273        e.Value = Content.GetValue(rowIndex, e.ColumnIndex);
274      }
275    }
276
277    private void dataGridView_Scroll(object sender, System.Windows.Forms.ScrollEventArgs e) {
278      this.UpdateRowHeaders();
279    }
280    private void dataGridView_Resize(object sender, EventArgs e) {
281      this.UpdateRowHeaders();
282    }
283
284    private void dataGridView_KeyDown(object sender, KeyEventArgs e) {
285      if (!ReadOnly && e.Control && e.KeyCode == Keys.V)
286        PasteValuesToDataGridView();
287      else if (e.Control && e.KeyCode == Keys.C)
288        CopyValuesFromDataGridView();
289    }
290
291    private void CopyValuesFromDataGridView() {
292      if (dataGridView.SelectedCells.Count == 0) return;
293      StringBuilder s = new StringBuilder();
294      int minRowIndex = dataGridView.SelectedCells[0].RowIndex;
295      int maxRowIndex = dataGridView.SelectedCells[dataGridView.SelectedCells.Count - 1].RowIndex;
296      int minColIndex = dataGridView.SelectedCells[0].ColumnIndex;
297      int maxColIndex = dataGridView.SelectedCells[dataGridView.SelectedCells.Count - 1].ColumnIndex;
298
299      if (minRowIndex > maxRowIndex) {
300        int temp = minRowIndex;
301        minRowIndex = maxRowIndex;
302        maxRowIndex = temp;
303      }
304      if (minColIndex > maxColIndex) {
305        int temp = minColIndex;
306        minColIndex = maxColIndex;
307        maxColIndex = temp;
308      }
309
310      bool addRowNames = dataGridView.AreAllCellsSelected(false) && Content.RowNames.Count() > 0;
311      bool addColumnNames = dataGridView.AreAllCellsSelected(false) && Content.ColumnNames.Count() > 0;
312
313      //add colum names
314      if (addColumnNames) {
315        if (addRowNames)
316          s.Append('\t');
317
318        DataGridViewColumn column = dataGridView.Columns.GetFirstColumn(DataGridViewElementStates.Visible);
319        while (column != null) {
320          s.Append(column.HeaderText);
321          s.Append('\t');
322          column = dataGridView.Columns.GetNextColumn(column, DataGridViewElementStates.Visible, DataGridViewElementStates.None);
323        }
324        s.Remove(s.Length - 1, 1); //remove last tab
325        s.Append(Environment.NewLine);
326      }
327
328      for (int i = minRowIndex; i <= maxRowIndex; i++) {
329        int rowIndex = this.virtualRowIndizes[i];
330        if (addRowNames) {
331          s.Append(Content.RowNames.ElementAt(rowIndex));
332          s.Append('\t');
333        }
334
335        DataGridViewColumn column = dataGridView.Columns.GetFirstColumn(DataGridViewElementStates.Visible);
336        while (column != null) {
337          DataGridViewCell cell = dataGridView[column.Index, i];
338          if (cell.Selected) {
339            s.Append(Content.GetValue(rowIndex, column.Index));
340            s.Append('\t');
341          }
342
343          column = dataGridView.Columns.GetNextColumn(column, DataGridViewElementStates.Visible, DataGridViewElementStates.None);
344        }
345        s.Remove(s.Length - 1, 1); //remove last tab
346        s.Append(Environment.NewLine);
347      }
348      Clipboard.SetText(s.ToString());
349    }
350
351    private void PasteValuesToDataGridView() {
352      string[,] values = SplitClipboardString(Clipboard.GetText());
353      int rowIndex = 0;
354      int columnIndex = 0;
355      if (dataGridView.CurrentCell != null) {
356        rowIndex = dataGridView.CurrentCell.RowIndex;
357        columnIndex = dataGridView.CurrentCell.ColumnIndex;
358      }
359
360      for (int row = 0; row < values.GetLength(1); row++) {
361        if (row + rowIndex >= Content.Rows)
362          Content.Rows = Content.Rows + 1;
363        for (int col = 0; col < values.GetLength(0); col++) {
364          if (col + columnIndex >= Content.Columns)
365            Content.Columns = Content.Columns + 1;
366          Content.SetValue(values[col, row], row + rowIndex, col + columnIndex);
367        }
368      }
369      ClearSorting();
370    }
371    private string[,] SplitClipboardString(string clipboardText) {
372      clipboardText = clipboardText.Remove(clipboardText.Length - Environment.NewLine.Length);  //remove last newline constant
373      string[,] values = null;
374      string[] lines = clipboardText.Split(new string[] { Environment.NewLine }, StringSplitOptions.None);
375      string[] cells;
376      for (int i = 0; i < lines.Length; i++) {
377        cells = lines[i].Split('\t');
378        if (values == null)
379          values = new string[cells.Length, lines.Length];
380        for (int j = 0; j < cells.Length; j++)
381          values[j, i] = string.IsNullOrEmpty(cells[j]) ? string.Empty : cells[j];
382      }
383      return values;
384    }
385
386    private void dataGridView_ColumnHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e) {
387      if (Content != null) {
388        if (e.Button == MouseButtons.Left && Content.SortableView) {
389          bool addToSortedIndizes = (Control.ModifierKeys & Keys.Control) == Keys.Control;
390          SortOrder newSortOrder = SortOrder.Ascending;
391          if (sortedColumnIndizes.Any(x => x.Key == e.ColumnIndex)) {
392            SortOrder oldSortOrder = sortedColumnIndizes.Where(x => x.Key == e.ColumnIndex).First().Value;
393            int enumLength = Enum.GetValues(typeof(SortOrder)).Length;
394            newSortOrder = oldSortOrder = (SortOrder)Enum.Parse(typeof(SortOrder), ((((int)oldSortOrder) + 1) % enumLength).ToString());
395          }
396
397          if (!addToSortedIndizes)
398            sortedColumnIndizes.Clear();
399
400          if (sortedColumnIndizes.Any(x => x.Key == e.ColumnIndex)) {
401            int sortedIndex = sortedColumnIndizes.FindIndex(x => x.Key == e.ColumnIndex);
402            if (newSortOrder != SortOrder.None)
403              sortedColumnIndizes[sortedIndex] = new KeyValuePair<int, SortOrder>(e.ColumnIndex, newSortOrder);
404            else
405              sortedColumnIndizes.RemoveAt(sortedIndex);
406          } else
407            if (newSortOrder != SortOrder.None)
408              sortedColumnIndizes.Add(new KeyValuePair<int, SortOrder>(e.ColumnIndex, newSortOrder));
409          Sort();
410        }
411      }
412    }
413
414    protected virtual void ClearSorting() {
415      virtualRowIndizes = Enumerable.Range(0, Content.Rows).ToArray();
416      sortedColumnIndizes.Clear();
417      UpdateSortGlyph();
418    }
419
420    private void Sort() {
421      virtualRowIndizes = Sort(sortedColumnIndizes);
422      UpdateSortGlyph();
423      UpdateRowHeaders();
424      dataGridView.Invalidate();
425    }
426    protected virtual int[] Sort(IEnumerable<KeyValuePair<int, SortOrder>> sortedColumns) {
427      int[] newSortedIndex = Enumerable.Range(0, Content.Rows).ToArray();
428      if (sortedColumns.Count() != 0) {
429        rowComparer.SortedIndizes = sortedColumns;
430        rowComparer.Matrix = Content;
431        Array.Sort(newSortedIndex, rowComparer);
432      }
433      return newSortedIndex;
434    }
435    private void UpdateSortGlyph() {
436      foreach (DataGridViewColumn col in this.dataGridView.Columns)
437        col.HeaderCell.SortGlyphDirection = SortOrder.None;
438      foreach (KeyValuePair<int, SortOrder> p in sortedColumnIndizes)
439        this.dataGridView.Columns[p.Key].HeaderCell.SortGlyphDirection = p.Value;
440    }
441    #endregion
442
443    public class RowComparer : IComparer<int> {
444      public RowComparer() {
445      }
446
447      private List<KeyValuePair<int, SortOrder>> sortedIndizes;
448      public IEnumerable<KeyValuePair<int, SortOrder>> SortedIndizes {
449        get { return this.sortedIndizes; }
450        set { sortedIndizes = new List<KeyValuePair<int, SortOrder>>(value); }
451      }
452      private IStringConvertibleMatrix matrix;
453      public IStringConvertibleMatrix Matrix {
454        get { return this.matrix; }
455        set { this.matrix = value; }
456      }
457
458      public int Compare(int x, int y) {
459        int result = 0;
460        double double1, double2;
461        DateTime dateTime1, dateTime2;
462        TimeSpan timeSpan1, timeSpan2;
463        string string1, string2;
464
465        if (matrix == null)
466          throw new InvalidOperationException("Could not sort IStringConvertibleMatrix if the matrix member is null.");
467        if (sortedIndizes == null)
468          return 0;
469
470        foreach (KeyValuePair<int, SortOrder> pair in sortedIndizes.Where(p => p.Value != SortOrder.None)) {
471          string1 = matrix.GetValue(x, pair.Key);
472          string2 = matrix.GetValue(y, pair.Key);
473          if (double.TryParse(string1, out double1) && double.TryParse(string2, out double2))
474            result = double1.CompareTo(double2);
475          else if (DateTime.TryParse(string1, out dateTime1) && DateTime.TryParse(string2, out dateTime2))
476            result = dateTime1.CompareTo(dateTime2);
477          else if (TimeSpan.TryParse(string1, out timeSpan1) && TimeSpan.TryParse(string2, out timeSpan2))
478            result = timeSpan1.CompareTo(timeSpan2);
479          else {
480            if (string1 != null)
481              result = string1.CompareTo(string2);
482            else if (string2 != null)
483              result = string2.CompareTo(string1) * -1;
484          }
485          if (pair.Value == SortOrder.Descending)
486            result *= -1;
487          if (result != 0)
488            return result;
489        }
490        return result;
491      }
492    }
493
494    private void dataGridView_MouseClick(object sender, System.Windows.Forms.MouseEventArgs e) {
495      if (Content == null) return;
496      if (e.Button == MouseButtons.Right && Content.ColumnNames.Count() != 0)
497        contextMenu.Show(MousePosition);
498    }
499    private void ShowHideColumns_Click(object sender, EventArgs e) {
500      new ColumnsVisibilityDialog(this.dataGridView.Columns.Cast<DataGridViewColumn>()).ShowDialog();
501    }
502
503    private void UpdateVisibilityOfTextBoxes() {
504      rowsTextBox.Visible = columnsTextBox.Visible = showRowsAndColumnsTextBox;
505      rowsLabel.Visible = columnsLabel.Visible = showRowsAndColumnsTextBox;
506      UpdateDataGridViewSizeAndLocation();
507    }
508
509    private void UpdateVisibilityOfStatisticalInformation() {
510      statusStrip.Visible = showStatisticalInformation;
511      UpdateDataGridViewSizeAndLocation();
512    }
513
514    private void UpdateDataGridViewSizeAndLocation() {
515      int headerSize = columnsTextBox.Location.Y + columnsTextBox.Size.Height +
516       columnsTextBox.Margin.Bottom + dataGridView.Margin.Top;
517
518      int offset = showRowsAndColumnsTextBox ? headerSize : 0;
519      dataGridView.Location = new Point(0, offset);
520
521      int statusStripHeight = showStatisticalInformation ? statusStrip.Height : 0;
522      dataGridView.Size = new Size(Size.Width, Size.Height - offset - statusStripHeight);
523    }
524
525    private void dataGridView_SelectionChanged(object sender, EventArgs e) {
526      toolStripStatusLabel.Text = string.Empty;
527      if (dataGridView.SelectedCells.Count > 1) {
528        List<double> selectedValues = new List<double>();
529        foreach (DataGridViewCell cell in dataGridView.SelectedCells) {
530          double value;
531          if (!double.TryParse(cell.Value.ToString(), out value)) return;
532          selectedValues.Add(value);
533        }
534        if (selectedValues.Count > 1) {
535          StringBuilder labelText = new StringBuilder();
536          labelText.Append("Average: " + selectedValues.Average() + "    ");
537          labelText.Append("StdDev: " + selectedValues.StandardDeviation() + "    ");
538          labelText.Append("Sum: " + selectedValues.Sum() + "    ");
539          labelText.Append("Count: " + selectedValues.Count + "    ");
540          toolStripStatusLabel.Text = labelText.ToString();
541        }
542      }
543    }
544  }
545}
Note: See TracBrowser for help on using the repository browser.