Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

first draft at creating specific columns widths #1117

Draft
wants to merge 6 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public class BasicCohortDestination : IPluginCohortDestination
{
private string _privateIdentifier;
private string _releaseIdentifier;
private bool _initialized = false;

/// <summary>
/// The cohort blueprint we are trying to create.
Expand Down Expand Up @@ -203,7 +204,7 @@ public virtual void Dispose(IDataLoadEventListener listener, Exception pipelineF

int id = Request.ImportAsExtractableCohort(DeprecateOldCohortOnSuccess, MigrateUsages);

listener.OnNotify(this,new NotifyEventArgs(ProgressEventType.Information, "Cohort successfully comitted to destination and imported as an RDMP ExtractableCohort (ID="+id+" <- this is the ID of the reference pointer, the cohortDefinitionID of the actual cohort remains as you specified:"+Request.NewCohortDefinition.ID+")"));
listener.OnNotify(this,new NotifyEventArgs(ProgressEventType.Success, "Cohort successfully comitted to destination and imported as an RDMP ExtractableCohort (ID="+id+" <- this is the ID of the reference pointer, the cohortDefinitionID of the actual cohort remains as you specified:"+Request.NewCohortDefinition.ID+")"));
}

/// <summary>
Expand All @@ -222,18 +223,24 @@ public virtual void Abort(IDataLoadEventListener listener)
/// <param name="listener"></param>
public virtual void PreInitialize(ICohortCreationRequest value, IDataLoadEventListener listener)
{
Request = value;

var target = Request.NewCohortDefinition.LocationOfCohort;
if (_initialized == false)
{
Request = value;

var target = Request.NewCohortDefinition.LocationOfCohort;

var syntax = target.GetQuerySyntaxHelper();
_privateIdentifier = syntax.GetRuntimeName(target.PrivateIdentifierField);
_releaseIdentifier = syntax.GetRuntimeName(target.ReleaseIdentifierField);
var syntax = target.GetQuerySyntaxHelper();
_privateIdentifier = syntax.GetRuntimeName(target.PrivateIdentifierField);
_releaseIdentifier = syntax.GetRuntimeName(target.ReleaseIdentifierField);

_fk = syntax.GetRuntimeName(Request.NewCohortDefinition.LocationOfCohort.DefinitionTableForeignKeyField);
_fk = syntax.GetRuntimeName(Request.NewCohortDefinition.LocationOfCohort.DefinitionTableForeignKeyField);

listener.OnNotify(this, new NotifyEventArgs(ProgressEventType.Information, "CohortCreationRequest spotted, we will look for columns " + _privateIdentifier + " and " + _releaseIdentifier + " (both of which must be in the pipeline before we will allow the cohort to be submitted)"));
listener.OnNotify(this, new NotifyEventArgs(ProgressEventType.Information, "id column in table " + Request.NewCohortDefinition.LocationOfCohort.TableName + " is " + Request.NewCohortDefinition.LocationOfCohort.DefinitionTableForeignKeyField));

_initialized = true;
}

listener.OnNotify(this,new NotifyEventArgs(ProgressEventType.Information, "CohortCreationRequest spotted, we will look for columns " + _privateIdentifier + " and " + _releaseIdentifier + " (both of which must be in the pipeline before we will allow the cohort to be submitted)"));
listener.OnNotify(this,new NotifyEventArgs(ProgressEventType.Information, "id column in table " + Request.NewCohortDefinition.LocationOfCohort.TableName + " is " + Request.NewCohortDefinition.LocationOfCohort.DefinitionTableForeignKeyField));
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ public virtual void OnNotify(object sender, NotifyEventArgs e)
case ProgressEventType.Debug:
break;
case ProgressEventType.Information:
case ProgressEventType.Success:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I theres going to be a LOT of case statements like this you will need to update in RDMP to add a new value to this enum. Also the order of the Enum is important there are code which says things like if worst <= Warning so creating a value of Success that is higher than Error as a raw value is very bad. Adding the Success at the same level as Information will be a breaking change for plugins which will require full refresh so that they get the new enum value into the compiled dll (basically old dlls won't work with new RDMP after this change).

DataLoadInfo.LogProgress(Logging.DataLoadInfo.ProgressEventType.OnInformation, sender.ToString(), e.Message);
break;
case ProgressEventType.Warning:
Expand Down
3 changes: 1 addition & 2 deletions Rdmp.UI/ChecksUI/ChecksUI.Designer.cs

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

9 changes: 6 additions & 3 deletions Rdmp.UI/ChecksUI/ChecksUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,8 @@ public ChecksUI()
_timer.Tick += _timer_Tick;
_timer.Start();

RDMPCollectionCommonFunctionality.SetupColumnTracking(olvChecks, olvMessage, new Guid("5d62580d-2bee-420b-ab43-f40317769514"));
RDMPCollectionCommonFunctionality.SetupColumnTracking(olvChecks, olvResult, new Guid("18b26ae1-c35d-4e73-9dc5-88f15910c1f9"));
RDMPCollectionCommonFunctionality.SetupColumnTracking(olvChecks, olvEventDate, new Guid("28c13822-b4c0-4fa5-b20d-af612b076716"));
RDMPCollectionCommonFunctionality.SetupColumnTracking(olvChecks, olvResult, new Guid("18b26ae1-c35d-4e73-9dc5-88f15910c1f9"), 75, true);
RDMPCollectionCommonFunctionality.SetupColumnTracking(olvChecks, olvEventDate, new Guid("28c13822-b4c0-4fa5-b20d-af612b076716"), 115, true);
}

private void _timer_Tick(object sender, EventArgs e)
Expand All @@ -88,6 +87,10 @@ private void _timer_Tick(object sender, EventArgs e)
olvChecks.AddObjects(_results);
outOfDate = false;
}

olvMessage.AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent);
olvMessage.MinimumWidth = olvMessage.Width;
olvMessage.MinimumWidth = olvMessage.Width;
}

private object ImageGetter(object rowObject)
Expand Down
23 changes: 13 additions & 10 deletions Rdmp.UI/Collections/DataExportCollectionUI.Designer.cs

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

11 changes: 8 additions & 3 deletions Rdmp.UI/Collections/DataExportCollectionUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,15 @@ public override void SetItemActivator(IActivateItems activator)
if (_isFirstTime)
{
CommonTreeFunctionality.SetupColumnTracking(olvName, new Guid("00a384ce-08fa-43fd-9cf3-7ddbbf5cec1c"));
CommonTreeFunctionality.SetupColumnTracking(olvProjectNumber, new Guid("2a1764d4-8871-4488-b068-8940b777f90e"));
CommonTreeFunctionality.SetupColumnTracking(olvCohortSource, new Guid("c4dabcc3-ccc9-4c9b-906b-e8106e8b616c"));
CommonTreeFunctionality.SetupColumnTracking(olvCohortVersion, new Guid("2d0f8d32-090d-4d2b-8cfe-b6d16f5cc419"));
CommonTreeFunctionality.SetupColumnTracking(olvProjectNumber, new Guid("2a1764d4-8871-4488-b068-8940b777f90e"), 116);
CommonTreeFunctionality.SetupColumnTracking(olvCohortSource, new Guid("c4dabcc3-ccc9-4c9b-906b-e8106e8b616c"), 102);
CommonTreeFunctionality.SetupColumnTracking(olvCohortVersion, new Guid("2d0f8d32-090d-4d2b-8cfe-b6d16f5cc419"), 69);
_isFirstTime = false;

//Set default column widths
olvProjectNumber.MinimumWidth = 33;
olvCohortSource.MinimumWidth = 33;
olvCohortVersion.MinimumWidth = 33;
}

SetupToolStrip();
Expand Down
5 changes: 5 additions & 0 deletions Rdmp.UI/Collections/Providers/CheckColumnProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ public class CheckColumnProvider

public const string ChecksColumnName = "Checks";

public int DefaultColumnWidth = 68;
public bool IsFixedWidth = false;

public CheckColumnProvider(TreeListView tree, ICoreIconProvider iconProvider)
{
_tree = tree;
Expand All @@ -38,6 +41,8 @@ public OLVColumn CreateColumn()
toReturn.Text = ChecksColumnName;
toReturn.ImageGetter = CheckImageGetter;
toReturn.IsEditable = false;
toReturn.TextAlign = HorizontalAlignment.Center;
toReturn.MinimumWidth = 33;

return toReturn;
}
Expand Down
6 changes: 4 additions & 2 deletions Rdmp.UI/Collections/Providers/FavouriteColumnProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ public class FavouriteColumnProvider
private Bitmap _starFull;
private Bitmap _starHollow;


public int DefaultColumnWidth = 21;
public bool IsFixedWidth = true;

public FavouriteColumnProvider(IActivateItems activator,TreeListView tlv)
{
Expand All @@ -41,7 +42,8 @@ public FavouriteColumnProvider(IActivateItems activator,TreeListView tlv)
public OLVColumn CreateColumn()
{
_olvFavourite = new OLVColumn("Favourite", null);
_olvFavourite.Text = "Favourite";
_olvFavourite.Text = "Favourites";
_olvFavourite.ShowTextInHeader = false;
_olvFavourite.ImageGetter += FavouriteImageGetter;
_olvFavourite.IsEditable = false;
_olvFavourite.Sortable = true;
Expand Down
6 changes: 6 additions & 0 deletions Rdmp.UI/Collections/Providers/IDColumnProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using BrightIdeasSoftware;
using MapsDirectlyToDatabaseTable;
using Rdmp.Core.Curation.Data;
using System.Windows.Forms;

namespace Rdmp.UI.Collections.Providers
{
Expand All @@ -18,6 +19,9 @@ public class IDColumnProvider
{
private readonly TreeListView _tree;

public int DefaultColumnWidth = 40;
public bool IsFixedWidth = false;

public IDColumnProvider(TreeListView tree)
{
_tree = tree;
Expand Down Expand Up @@ -46,6 +50,8 @@ public OLVColumn CreateColumn()
toReturn.IsVisible = false;
toReturn.AspectGetter += IDColumnAspectGetter;
toReturn.IsEditable = false;
toReturn.TextAlign = HorizontalAlignment.Right;
toReturn.MinimumWidth = 40;
return toReturn;
}
}
Expand Down
29 changes: 20 additions & 9 deletions Rdmp.UI/Collections/RDMPCollectionCommonFunctionality.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,20 +106,31 @@ public partial class RDMPCollectionCommonFunctionality : IRefreshBusSubscriber
/// </summary>
/// <param name="col"></param>
/// <param name="g"></param>
public void SetupColumnTracking(OLVColumn col, Guid g)
/// <param name="defaultWidth"></param>
/// <param name="isFixedWidth"></param>
public void SetupColumnTracking(OLVColumn col, Guid g, int? defaultWidth = null, bool isFixedWidth = false)
{
SetupColumnTracking(Tree, col, g);
SetupColumnTracking(Tree, col, g, defaultWidth, isFixedWidth);
}
public void SetupColumnTracking(OLVColumn col, string columnUniqueIdentifier)
{
SetupColumnTracking(Tree, col, columnUniqueIdentifier);
}

/// <inheritdoc cref="SetupColumnTracking(OLVColumn, Guid)"/>
public static void SetupColumnTracking(ObjectListView view, OLVColumn col, Guid g)
/// <inheritdoc cref="SetupColumnTracking(OLVColumn, Guid, int?, bool)"/>
public static void SetupColumnTracking(ObjectListView view, OLVColumn col, Guid g, int? defaultWidth = null, bool isFixedWidth = false)
{
col.Width = UserSettings.GetColumnWidth(g);
view.ColumnWidthChanged += (s, e) => UserSettings.SetColumnWidth(g, col.Width);
if (isFixedWidth)
{
col.Width = defaultWidth.Value;
col.MinimumWidth = defaultWidth.Value;
col.MaximumWidth = defaultWidth.Value;
}
else
{
col.Width = UserSettings.GetColumnWidth(g, defaultWidth);
view.ColumnWidthChanged += (s, e) => UserSettings.SetColumnWidth(g, col.Width);
}

col.IsVisible = UserSettings.GetColumnVisible(g);
col.VisibilityChanged += (s, e) => UserSettings.SetColumnVisible(g, ((OLVColumn)s).IsVisible);
Expand Down Expand Up @@ -245,7 +256,7 @@ public void SetUp(RDMPCollection collection, TreeListView tree, IActivateItems a
FavouriteColumnProvider = new FavouriteColumnProvider(_activator, tree);
FavouriteColumn = FavouriteColumnProvider.CreateColumn();

SetupColumnTracking(FavouriteColumn, new Guid("ab25aa56-957c-4d1b-b395-48299be8e467"));
SetupColumnTracking(FavouriteColumn, new Guid("ab25aa56-957c-4d1b-b395-48299be8e467"), FavouriteColumnProvider.DefaultColumnWidth, FavouriteColumnProvider.IsFixedWidth);
}

if (settings.AddIDColumn)
Expand All @@ -254,7 +265,7 @@ public void SetUp(RDMPCollection collection, TreeListView tree, IActivateItems a
IDColumn = IDColumnProvider.CreateColumn();

Tree.AllColumns.Add(IDColumn);
SetupColumnTracking(IDColumn, new Guid("9d567d9c-06f5-41b6-9f0d-e630a0e23f3a"));
SetupColumnTracking(IDColumn, new Guid("9d567d9c-06f5-41b6-9f0d-e630a0e23f3a"), IDColumnProvider.DefaultColumnWidth, IDColumnProvider.IsFixedWidth);
Tree.RebuildColumns();
}

Expand All @@ -263,7 +274,7 @@ public void SetUp(RDMPCollection collection, TreeListView tree, IActivateItems a
CheckColumnProvider = new CheckColumnProvider(tree, _activator.CoreIconProvider);
CheckColumn = CheckColumnProvider.CreateColumn();

SetupColumnTracking(CheckColumn, new Guid("8d9c6a0f-82a8-4f4e-b058-e3017d8d60e0"));
SetupColumnTracking(CheckColumn, new Guid("8d9c6a0f-82a8-4f4e-b058-e3017d8d60e0"), CheckColumnProvider.DefaultColumnWidth, CheckColumnProvider.IsFixedWidth);

Tree.AllColumns.Add(CheckColumn);
Tree.RebuildColumns();
Expand Down
4 changes: 2 additions & 2 deletions Rdmp.UI/DataRelease/DataReleaseUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,8 @@ public override void SetDatabaseObject(IActivateItems activator, Project databas
AddCheckColumn = false
});

_commonFunctionality.SetupColumnTracking(olvName, new Guid("2d09c1d2-b4a7-400f-9003-d23e43cd3d75"));
_commonFunctionality.SetupColumnTracking(olvReleaseability, new Guid("2f0ca398-a0d5-4e13-bb40-a2c817d4179a"));
_commonFunctionality.SetupColumnTracking(olvName, new Guid("2d09c1d2-b4a7-400f-9003-d23e43cd3d75"), 250);
_commonFunctionality.SetupColumnTracking(olvReleaseability, new Guid("2f0ca398-a0d5-4e13-bb40-a2c817d4179a"), 200);
}

_childProvider = (DataExportChildProvider)Activator.CoreChildProvider;
Expand Down
8 changes: 5 additions & 3 deletions Rdmp.UI/Progress/ProgressUI.Designer.cs

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

Loading