Primefaces make messages or growl modal/confirmable? - primefaces

Prerequisites:
- JSF 2.1
- Primefaces 5.2
- Glassfish 3.1
Story:
I need my user to confirm FacesMessages of the errortype before he is allowed to keep working. For this i need some sort of modal message or dialog.
Question:
Is there some way of makeing a p:messages or a p:growl modal and confirmable?
What i've tried so far:
I've created a modal dialog which contains a p:messages component and a button to confirm/close the dialog again. The problematic with this solution is, that i have a lot of cases errormessages are shown and i have to open the dialog for each one individually. Besides that some errormessages are created by validators, some by the "required"-flag and some directly in the code. This makes it even harder to cover all cases. Id prefer to put the function into the component which displays the message (growl or messages).

Related

CompositeComponent Primefaces Dialog appendTo ="#(body)" not working

I'm using PF 5.1.5 and made some composite components with dialogs which all should be modal and appended to body (so the dialog is really modal). This works when I use dialogs in plain pages, but not if I use them in composite components. I think because the #(body) tag references to the composite component itself? Anyone got a solution?

Content Dialog template in Visual Studio C#

I'm starting to learn Windows 8.1 phone development and I am trying to get the Content Dialog template to work inside a Pivot page. Work some reason, when I try to get the Add app bar button to navigate to the ContentDialog.xaml page, it is not displaying, but I see the navigate go to the ContentDialog constructor where the this.InitializeComponent() occurs.
I am finding very little online in way of examples on this template, so I am at a loss as to what I am missing. I understand that the ContentDialog page that was created from the template is inheriting from ContentDialog and not Page, but I'm not sure if this is still supposed to be directly accessed or if this XAML is supposed to be inside another "Page" XAML file.
Can someone please help.
The code looks like this in the Pivot page when the click event is selected:
Frame.Navigate(typeof(ContentDialog1));
I really haven't even touched the ContentDialog template from it's default yet, so it is set up like a set password page.
Thanks in advance
UPDATE
I found the answer to my question above. apparently, because it is a Content control, it needs to be called like a normal dialog would need to be called in it's code behind. I think my missconseption was that I thought it being "a template", that when I called it with the navigation calls that it would already have everything needed to get fired. You can also add the Content control to an existing page if you would like.
In either scenario, you need to add a method similar to this in your XAML.CS file.
private async void OpenDialog()
{
await this.contentStuff.ShowAsync();
}
You then need to call this method in the constructor. Then, when called, your dialog will appear.
Hope this helps others just starting out.

error dialog with scrollable area to display big multiline message?

I need to display error dialog (with standart red cross image) with message and Ok button.
Message is pretty big (like stack-trace) so I need to display it in scrollable area.
Should I write such dialog from scratch or swing contains something that I can reuse?
upd: found unswer myself http://www.javalobby.org/java/forums/t19012.html
The easiest way is to use TaskDialog framework. You can create all kinds of dialogs including the following:
The exception dialog can be called via
TaskDialogs.showException(e);
See Task Dialog for more details
You can use this component
The source code is all there, you just need to copy and paste code. No need to install a framework.

Primefaces - using dialogs and layouts

I have a (JSF 2.0/ Primefaces 2.2RC-SNAPSHOT) app that has
<p:layout>
I use a lot of dialog in my application and before the newest version of primefaces came out there was no way to display a dialog with a modal on top of the layout without putting the dialogs outside of the tags.
So I did just that. The issue I am having now is I am noticing that constructors and postcontructs are being called when my application is loaded. This is because the view with the layout is being loaded and therefore all my dialogs are being loaded.
I don't want these constructors being called until I am actually dealing with the appropriate views in my application.
I have been testing the appendToBody attribute on the
<p:dialog>
tag but it seems really buggy. Everything works fine on the initial rendering of a view. I can open a dialog close it etc and it works fine. If I navigate away to another view and then come back to the initial view and open the dialog, everything is running off the page. The dialog window is in the correct place but the content is not.
My question is 1. Is there a way I can have the dialog windows outside of my layout as a child of the
<h:body>
without having all the managed bean constructors associated with them initiated when the application loads?
Or does anyone know how to fix the alignment issue when using the appendToBody tag? Thanks.
When using layout and dialog, I usually place my dialogs outside of the layout as a direct child of the body element. I have a special ui:insert part in my page template for this.
appendToBody was added to make this easier, if it doesn't work well for you, give this approach a try. I know modal dialogs and layout can work this way.
without having all the managed bean constructors associated with them
initiated when the application loads
Maybe the managedbean gets loaded when your dialog is rendered.
Try rendering the dialog only after the button click, perhaps byputting rendered="#{mybean.flagLoadMyDialog}" on the dialog, and set the flagLoadMyDialog when the button is clicked using ajax.
Also remember to ajax-update the dialog after the button click.

ASP.NET 4 UpdatePanel breaking change

I am porting an ASP.NET application from 3.5SP1 to 4.0. The application works perfectly in 3.5SP1. In 4.0, I am seeing a difference in UpdatePanel behavior.
We have a simple user control with a testbox, a button, and some text. The user control lives inside an UpdatePanel with UpdateMode="Conditional" and ChildAsTriggers="true".
Users type into the textbox and click the button. We do a search. If we find something, content elsewhere on the page is updated - this works great. If we don't find it, we change the text in the user control. That change never appears.
So I know the button and logic is working. The user control does not own the UpdatePanel it lives in, and it would be nice if it didn't have to. But even though the button is raising an event back to the server, the update panel content is not updating.
Has anyone seen this?
My problem turned out to be 4.0's new client-ID mechanism. Check out the new features here.
4.0 defaults to 'Inherit' while 'autoID' is the 'old' behavior. By adding this to the web.config pages element:
clientIDMode="AutoID"
my problem went away. I'm not wild about forcing backward-compatible behavior but until I can sort thru all the control relationhips this will have to do.