Vaadin 14 (Flow) - Binding - where can I get access to .setAsRequired(boolean) - vaadin14

As title. I am working on a Vaadin 14 application (final stages of upgrading from Vaadin 7).
One of the aspects I am currently looking at is updating some existing fields on a screen to control whether or not to enforce mandatory (asRequired) checks.
ie: if field A is populated, field B is mandatory, otherwise not mandatory. That kind of thing.
Looking at the API, it appears I should be able to do this.
https://vaadin.com/api/platform/14.5.1/com/vaadin/flow/data/binder/Binder.Binding.html
void setAsRequiredEnabled(boolean asRequiredEnabled)
Enable or disable asRequired validator. The validator is enabled by default.
The problem is, I cannot seem to find where I can get access to this function.
We are currently using Vaadin version 14.5.1.
The Binder and the Binding Builder both do not show this function.
I would appreciate any guidance. I just cannot seem to locate how to access this function, to control dynamic adjustments to the required validator.

As always, right after I posted the query, it took me slightly longer in experimenting with the Flow API to find the solution.
For anyone else trying to find this -
I found you get the Binding object from the Binder you are using as follows, which then can tweak this setting:
Binding binding = (Binding) binder.getBinding("property").get();
binding.setAsRequiredEnabled(true);

Related

Liferay 7 Eclipse IDE override default categories behaviour

I need to create a portlet in order to change the default category behaviour/interface in Liferay 7.
My objective is to duplicate assetcategory table, expand and change its columns, and use this new table as a reference for categories within Liferay backend.
Therefore there are three key points my portlet has to update:
The category organization UI to create/update category tables on
DB. I’m able to create a new Liferay module project (panel-app template) which can present the UI backend interface from the side menu and interact with the DB.
Override default category selection panel within web content
properties panel (metadata > category select). I can create a new
Liferay module project fragment to override the
com.liferay.asset.categories.selector.web, however I’ve noticed I can
select only one file path (eg. META-INF/resources/view.jsp)
Override default asset publisher filter behaviour in order to allow
my custom categories selection. I’ve not yet investigated this
point.
I’m currently stuck at point 2 because after creating a new Liferay module project fragment, set the target Host OSGI Bundle to com.liferay.asset.categories.selector.web (which I believe is the correct one, please correct me if it isn't) and selecting the overridden files as META-INF/resources/view.jsp, I can’t proceed to redraw the category selection interface.
Here my attempts:
Updating the code view.jsp (eg. adding some text string) I can correctly
see them in the portlet.
Removing/commenting all the code in view.jsp an error is shown:
Asset category selector is temporarily unavailable
Selecting all three files available to be overridden in the main
portlet wizard (META-INF/resources/view.jsp, init.jsp and
init-ext.jsp) and updating view.jsp (like the first example) nothing
happen in the portlet
Some screenshot below:
Case 1
Case 2
Case 3
I need to create a portlet in order to change the default category
behaviour/interface in Liferay 7. My objective is to duplicate
assetcategory table, expand and change its columns, and use this new
table as a reference for categories within Liferay backend.
Just this alone sounds like a humongous task, bigger than what would fit into a stackoverflow question.
AssetCategories are used in every single content type, e.g. WebContent, Blog Articles, Message Board Posts, Wiki Pages, Knowledgebase Articles etc.. Replacing such a vital component by your own implementation is something that will safely ruin your next upgrade experience, because there you'd have to do this again, bringing your code to whatever changes will be made in the next version. And this "upgrade" includes Security Patches.
Overall, your premise sounds to me like a x-y problem and I'd rather recommend that you step back from your intended solution and look for other options to meet your business requirements. There surely are some.
My recommendation: Rather add something to the platform than ripping out a very central and generic component, reimplementing it in a business-specific manner. If you need a different filtering than Asset Publisher provides: Build your own Asset Publisher and implement the business specific rules there. Or think again about organizing your content in a different way than you currently organize it.
Unless you're already a Liferay Core Developer and are asking for a hint on how to change the implementation for the next version. But your question history here doesn't look like it.

How to get type of LIveTile on Windows Phone 8?

I want to write a method which will change the main tile in my Windows Phone 8.
To access the main tile I'm using
var tile = ShellTile.ActiveTiles.FirstOrDefault();
But how do I know the type (Flip, Cycle, Iconic) of this tile? Because if I want to update the tile with
tile.Update(...);
And if I use the wrong type I will get an exception.
Thanks.
2 ideas you could try are:
1) Try/Catch the Update call and fallback to replacing the tile (delete the existing one)
See this blogpost.
2) Or add a query parameter in the NavigationUri like "&tileType=Cyclic" when creating it and then lookup for that parameter in the same property when updating it. See here.
Very weird though that the API does not expose any obvious way for someone to figure this out.

Dynamic list element in MvxDialogViewController

We have a dialog inheriting MvxDialogViewController containing two Sections - TheRadios and TheList.
In response to the user changing the radio within TheRadios, we repopulate TheList (in the view model).
How can we bind a Section of a MvxDialogViewController to a dynamic list?
Looking through all the mvvmcross samples I couldn't find an example of this being done. I considered inserting a MvxActionBasedTableViewSource into the relevant Section's TableView but the property is null.
If you do want to bind a list within a Dialog section to a list, then I believe this extension may help you - https://github.com/asednev/MvvmCross.AlexeysExtensions
I'm afraid it is for vNext rather than v3 currently, but I think it should port very easily - I think the only changes needed would be just a few namespace changes (if you do port it, then please send them a pull request with the changes)
Alternatively
it is open source, so it may give you alternative ideas
you could consider using a custom or manual binding to INotifyPropertyChanged in order to achieve the table changes you are looking to achieve

CRM 2011 javascript onchange event not working for system field in another organisation

I have some javascript code attached to the accounts entity. This code sets the requirement level of the primary contact attribute based on the value of a custom option set field showing various account types. This was developed on one server, where it worked, and so the solution was imported into another organisation where it now doesnt work.
It seems to be only on this field as i have changed the code to look at another field and that works fine. The error it gives is that the "Object doesn't support this property or method". Also what is strange is that the field doesn't appear in the list under the entity within the solution despite it being a system field.
The code i'm using is:
Xrm.Page.getAttribute("primarycontactid").setRequiredLevel("required");
Can anyone help me figure out what it's doing?
Thanks
EDIT: Found that the code is actually making the field required despite the error, but it's not displaying the * next to it. Also if I make the field required in it's settings then it does the same thing

Adding custom properties in CodedUI Test builder

I want to add custom properties of my control to CodedUI test builder. How can i achieve it?
I have used Automation provider to implement support for codedUI test in the control().Only the properties returned by the AutomationElementIdentifiers are visible in the assert window now, what should i do to include the other custom properties in it?
Please guide me to resolve this.
Thanks
The following is an example of adding custom properties to a link, but it applies to any other control.
HtmlHyperlink myLink;
myLink.SearchProperties.Add("InnerText", "Custom Inner Text", PropertyExpressionOperator.EqualTo);
I have never actually used the following and not sure if it even applies to coded-ui, but I know it exist.
myLink.SetProperty("PropertyName", "Something");
Thank you for your suggestion, unfortunately it doesn't works.
Finally i realize what is happening in my case, While using Automation Provider in a custom Control(like Grid) we can select the cells and can return only the properties supported by the AutomationElementIdentifiers, it is not possible to return the custom properties of the control to the test builder.
In case of control type i can return only the controltypes comes under the AutomationIdentifier.
So for my grid cell i used ControlType.Edit, but its not much helpful, the values in the Grid cells are not returned. So i decided implement the CodedUI support for my control as described in MSDN .
Thanks
Kalai

Resources