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

Allow to serialize CanClose if set to true for LayoutAnchorable instance #187

Merged
merged 1 commit into from
Aug 21, 2020

Conversation

bdachev
Copy link
Contributor

@bdachev bdachev commented Aug 14, 2020

Hi Dirk, this one is a bit more risky so leaving up to you to decide whether to accept.

The problem here is that with the original code in LayoutContent CanClose could be serialized only if its value is false. Now in LayoutAnchorable the default of CanClose is altered to false but if for some reason you would like to change CanClose to true for LayoutAnchorable (i.e. to make some tools closable by behaviour) it won't be possible to serialize that change because serialization code in LayoutContent class would serialize only if value is false.
I added another field _canCloseDefault in LayoutContent and in serialization code CanClose is checked against that value to decide whether to save it. In LayoutAnchorable _canClose value is set to false by default but so is _canCloseDefault and the serializer will now save if the value is true.
It should be all good but there is a side effect of that change. Now for LayoutAnchorables CanClose will no longer be saved in XML by default because it is false and value equals to its default. That's in contrast with previous implementation which always saved CanClose for LayoutAnchorables because it was false.

@Dirkster99 Dirkster99 merged commit 4bed7c8 into Dirkster99:master Aug 21, 2020
@bdachev bdachev deleted the CanClose_serialization branch August 21, 2020 16:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants