Skip to content

Commit

Permalink
Fix typo 'datset', add readonly
Browse files Browse the repository at this point in the history
  • Loading branch information
jas88 committed Dec 5, 2023
1 parent 3975933 commit 86f5b42
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 49 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public ProposeExecutionWhenTargetIsDataset(IActivateItems itemActivator) : base(

public override void Activate(Dataset target)
{
ItemActivator.Activate<DatsetConfigurationUI, Dataset>(target);
ItemActivator.Activate<DatasetConfigurationUI, Dataset>(target);
}

[CanBeNull]
Expand Down
56 changes: 28 additions & 28 deletions Rdmp.UI/PieCharts/CatalogueToDatasetLinkagePieChartUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,40 +32,40 @@ namespace Rdmp.UI.PieCharts;
/// </summary>
public partial class CatalogueToDatasetLinkagePieChartUI : RDMPUserControl, IDashboardableControl
{
private ToolStripButton btnSingleCatalogue = new("Single", CatalogueIcons.Catalogue.ImageToBitmap())
private readonly ToolStripButton _btnSingleCatalogue = new("Single", CatalogueIcons.Catalogue.ImageToBitmap())
{ Name = "btnSingleCatalogue" };

private ToolStripButton btnAllCatalogues =
private readonly ToolStripButton _btnAllCatalogues =
new("All", CatalogueIcons.AllCataloguesUsedByLoadMetadataNode.ImageToBitmap()) { Name = "btnAllCatalogues" };

private ToolStripButton btnRefresh = new("Refresh", FamFamFamIcons.text_list_bullets.ImageToBitmap())
private readonly ToolStripButton _btnRefresh = new("Refresh", FamFamFamIcons.text_list_bullets.ImageToBitmap())
{ Name = "btnRefresh" };

private ToolStripLabel toolStripLabel1 = new("Type:") { Name = "toolStripLabel1" };
private readonly ToolStripLabel _toolStripLabel1 = new("Type:") { Name = "toolStripLabel1" };

private ToolStripButton btnShowLabels = new("Labels", FamFamFamIcons.text_align_left.ImageToBitmap())
private readonly ToolStripButton _btnShowLabels = new("Labels", FamFamFamIcons.text_align_left.ImageToBitmap())
{ Name = "btnShowLabels", CheckOnClick = true };

private List<ToolStripMenuItem> _flagOptions = new();
private readonly List<ToolStripMenuItem> _flagOptions = new();

public CatalogueToDatasetLinkagePieChartUI()
{
InitializeComponent();

btnViewDataTable.Image = CatalogueIcons.TableInfo.ImageToBitmap();

btnAllCatalogues.Click += btnAllCatalogues_Click;
btnSingleCatalogue.Click += btnSingleCatalogue_Click;
btnShowLabels.CheckStateChanged += btnShowLabels_CheckStateChanged;
btnRefresh.Click += btnRefresh_Click;
_btnAllCatalogues.Click += btnAllCatalogues_Click;
_btnSingleCatalogue.Click += btnSingleCatalogue_Click;
_btnShowLabels.CheckStateChanged += btnShowLabels_CheckStateChanged;
_btnRefresh.Click += btnRefresh_Click;

//put edit mode on for the designer
NotifyEditModeChange(false);
}

private void SetupFlags()
{
if (!firstTime)
if (!_firstTime)
return;

AddFlag("Non Extractable Catalogues", c => c.IncludeNonExtractableCatalogues,
Expand All @@ -84,7 +84,7 @@ private void SetupFlags()
(c, r) => c.IncludeInternalCatalogueItems = r);
AddFlag("Deprecated Catalogue Items", c => c.IncludeDeprecatedCatalogueItems,
(c, r) => c.IncludeDeprecatedCatalogueItems = r);
firstTime = false;
_firstTime = false;
}

private void AddFlag(string caption, Func<GoodBadCataloguePieChartObjectCollection, bool> getProp,
Expand Down Expand Up @@ -181,7 +181,7 @@ public void RefreshBus_RefreshObject(object sender, RefreshObjectEventArgs e)
}

private bool _bLoading;
private bool firstTime = true;
private bool _firstTime = true;

public void SetCollection(IActivateItems activator, IPersistableObjectCollection collection)
{
Expand All @@ -190,19 +190,19 @@ public void SetCollection(IActivateItems activator, IPersistableObjectCollection

_collection = (GoodBadCataloguePieChartObjectCollection)collection;

if (firstTime)
if (_firstTime)
SetupFlags();

btnAllCatalogues.Checked = !_collection.IsSingleCatalogueMode;
btnSingleCatalogue.Checked = _collection.IsSingleCatalogueMode;
btnShowLabels.Checked = _collection.ShowLabels;
_btnAllCatalogues.Checked = !_collection.IsSingleCatalogueMode;
_btnSingleCatalogue.Checked = _collection.IsSingleCatalogueMode;
_btnShowLabels.Checked = _collection.ShowLabels;

CommonFunctionality.Add(btnAllCatalogues);
CommonFunctionality.Add(toolStripLabel1);
CommonFunctionality.Add(btnAllCatalogues);
CommonFunctionality.Add(btnSingleCatalogue);
CommonFunctionality.Add(btnShowLabels);
CommonFunctionality.Add(btnRefresh);
CommonFunctionality.Add(_btnAllCatalogues);
CommonFunctionality.Add(_toolStripLabel1);
CommonFunctionality.Add(_btnAllCatalogues);
CommonFunctionality.Add(_btnSingleCatalogue);
CommonFunctionality.Add(_btnShowLabels);
CommonFunctionality.Add(_btnRefresh);

foreach (var mi in _flagOptions)
CommonFunctionality.AddToMenu(mi);
Expand Down Expand Up @@ -245,8 +245,8 @@ public void NotifyEditModeChange(bool isEditModeOn)

private void btnAllCatalogues_Click(object sender, EventArgs e)
{
btnAllCatalogues.Checked = true;
btnSingleCatalogue.Checked = false;
_btnAllCatalogues.Checked = true;
_btnSingleCatalogue.Checked = false;
_collection.SetAllCataloguesMode();
GenerateChart();
SaveCollectionChanges();
Expand All @@ -260,8 +260,8 @@ private void btnSingleCatalogue_Click(object sender, EventArgs e)
}, Activator.RepositoryLocator.CatalogueRepository.GetAllObjects<Catalogue>(), out var selected)) return;
_collection.SetSingleCatalogueMode(selected);

btnAllCatalogues.Checked = false;
btnSingleCatalogue.Checked = true;
_btnAllCatalogues.Checked = false;
_btnSingleCatalogue.Checked = true;

SaveCollectionChanges();
GenerateChart();
Expand All @@ -282,7 +282,7 @@ private void SaveCollectionChanges()

private void btnShowLabels_CheckStateChanged(object sender, EventArgs e)
{
_collection.ShowLabels = btnShowLabels.Checked;
_collection.ShowLabels = _btnShowLabels.Checked;

chart1.Series[0]["PieLabelStyle"] = _collection.ShowLabels ? "Inside" : "Disabled";
SaveCollectionChanges();
Expand Down
9 changes: 1 addition & 8 deletions Rdmp.UI/SimpleDialogs/Datasets/CreateNewDatasetUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,11 @@ namespace Rdmp.UI.SimpleDialogs.Datasets;

public partial class CreateNewDatasetUI : RDMPForm
{
private IActivateItems _activator;
private readonly IActivateItems _activator;
public CreateNewDatasetUI(IActivateItems activator, ExecuteCommandCreateNewDatasetUI command) : base(activator)
{
_activator = activator;
InitializeComponent();

}

private void CreateNewDatasetUI_Load(object sender, EventArgs e)
{

}

private void btnCancel_Click(object sender, EventArgs e)
Expand All @@ -28,7 +22,6 @@ private void btnCancel_Click(object sender, EventArgs e)

private void btnCreate_Click(object sender, EventArgs e)
{

var cmd = new ExecuteCommandCreateDataset(_activator,tbName.Text,tbDOI.Text,tbSource.Text);
cmd.Execute();
Close();
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,25 @@
using Rdmp.UI.ItemActivation;

namespace Rdmp.UI.SubComponents;
public partial class DatsetConfigurationUI : DatsetConfigurationUI_Design, IRefreshBusSubscriber
public partial class DatasetConfigurationUI : DatsetConfigurationUI_Design, IRefreshBusSubscriber
{
DatasetConfigurationUICommon Common;
private readonly DatasetConfigurationUICommon _common;

public DatsetConfigurationUI()
public DatasetConfigurationUI()
{
InitializeComponent();
Common = new DatasetConfigurationUICommon();
_common = new DatasetConfigurationUICommon();
}

public override void SetDatabaseObject(IActivateItems activator, Dataset databaseObject)
{
base.SetDatabaseObject(activator, databaseObject);
Common.Dataset = databaseObject;
_common.Dataset = databaseObject;

var catalogues = databaseObject.CatalogueRepository.GetAllObjectsWhere<ColumnInfo>("Dataset_ID", databaseObject.ID).SelectMany(ci => ci.CatalogueItems).ToList().Select(ci => ci.CatalogueName).Distinct();
if(catalogues.Count() < 1)
var catalogues = databaseObject.CatalogueRepository
.GetAllObjectsWhere<ColumnInfo>("Dataset_ID", databaseObject.ID).SelectMany(static ci => ci.CatalogueItems)
.Select(static ci => ci.CatalogueName).Distinct().ToList();
if(catalogues.Count < 1)
{
lblDatasetUsage.Text = "This dataset is not linked to data yet.";
}
Expand All @@ -35,10 +37,10 @@ public override void SetDatabaseObject(IActivateItems activator, Dataset databas
lblDatasetUsage.Text = $"This dataset is used in the following catalogues:{Environment.NewLine}{catalogueString}";
}

Bind(tbName, "Text", "Name", c => c.Name);
Bind(tbDOI, "Text", "DigitalObjectIdentifier", c => c.DigitalObjectIdentifier);
Bind(tbSource, "Text", "Source", c => c.Source);
Bind(tbFolder, "Text", "Folder", c => c.Folder);
Bind(tbName, "Text", "Name", static c => c.Name);
Bind(tbDOI, "Text", "DigitalObjectIdentifier", static c => c.DigitalObjectIdentifier);
Bind(tbSource, "Text", "Source", static c => c.Source);
Bind(tbFolder, "Text", "Folder", static c => c.Folder);
var s = GetObjectSaverButton();
s.SetupFor(this, databaseObject, activator);
GetObjectSaverButton()?.Enable(false);
Expand Down

0 comments on commit 86f5b42

Please sign in to comment.