Primefaces Dialog Framework and Growl messages - jsf

I'm using Primefaces 6.1 Dialog Framework. I'm wondering if there's a way to use a general growl for nested dialogs.
I could use a growl in one of the child dialogs but it displays the messages inside the boundaries of the iframe and not on the top-right corner of the window.
Here's an example:
main.xhtml > dialog1.xhtml > dialog2.xhtml
So, I'm in main, then I open dialog1 to view some data and then dialog2, which is kind of a tiny CRUD page.
When there's an error in this last page, I want to display the error message on the top-right corner of the WINDOW (not the iframe), just like it would do in the main page.
I don't know if it's a bug/issue or I'm just dumb, but I'm running out of ideas. Is there a way to accomplish this?
Thanks in advance!
(I can't provide the code now, but if it's really neccesary i'd edit this a put a simple example).

Related

Customized error message on loading error of PDF in PDFTron

I am working with PDFTron - WebViewer,
Want to know how to handle PDF loading errors and showing customized message, in case of web-viewer
Regards
Bhupesh
The easiest way to do this right now is to modify the ErrorModal component in the UI and replace the error messages there. You'll need to string match the old message and replace it with your own.
The component is located at ui/src/components/ErrorModal/ErrorModal.js and you'll want to change the onError function.
This link describes more about how to edit and build the UI https://www.pdftron.com/documentation/web/guides/ui/advanced-customization
WebViewer has methods that let you display a modal Warning message box, which can be dismissed with its Confirm button or a click outside the dialog, or you can display a modal Error box which has no dismiss buttons and requires you to hit [F5] to refresh the page.
https://www.pdftron.com/api/web/UI.html#.showWarningMessage
https://www.pdftron.com/api/web/UI.html#.displayErrorMessage
Using these is more straightforward than editing the UI code from the pdftron github repo.

Modal launch button with actionlistener

I've been trying to use a f:setPropertyActionListener on a Bootstrap modal launch button but it doesn't work at all. Tags a and button don't support it so I don't know what to do now.
I need to set an id of an item in a bean I have when I push the modal launch button, so I can then confirm delete that item using the modal.
I've searched here and on other sites and I've found a lot of solutions to my specific problem using Javascript but I have no idea about that :/
Thanks in advance.

moving from javascript window.open to Rich:ModalPanel

In my web application currently there are many pop up windows made by various JS function which i would like to replace with Rich:ModalPanel (I'm using Myfaces 2.0.12 and RichFaces 3.3.3). Below is a typical example i like to replace:
window.open("<%=basePath1%>jsp/custhistory.faces?userid="+pk);
where pk is the value retried from a hidden input such as <h:inputHidden id="userPk" value="#{1234}"/> inside the javascript function and then added to the end of the url above.
Looking at few RichFaces ModalPanel examples (and demos) i can't figure out how i can make the above work using ModalPanel. Can someone please provide an example or a link to a resource o
I have been using Richfaces 4, but the same theory should apply.
The modal panel is essentially a div that can be shown or hidden, so you could add a <ui:include> in there if you specifically need (or want) the panel to be a seperate file.
The modal panel is rendered as part of your page, but is styled as display:none I believe. If this is triggered by a client action you can call the Richfaces API to show the panel on command.
For instance instead of a command(Link|Button) triggering Richfaces.$('elName').show() it could trigger your js function which sets and values/params your modal panel needs and then call .show() itself.
Note: IE and firefox had a truly modal popup. This is not truly modal and javascript will process in the background, and if you do not give focus to the popup panel if the user types it will interact with the application in the background.
I had used a modal js popup to prompt a user with a yes/no question int his type of idiom
if(askUser("some question?")=='yes'){
//some code to do if yes
}else{
//some code to do if no
}
Depending on how generic you want this popup, that is not really possible without using an event that is fired and defining an event handler for that event to handle the rest of the function.

Can Popup page use DOM elements created in Background Page

Actually, I want to store some data in background page and the popup page just show that part of data say Data as a div element created in background page document.createElement("div"). Here, the background page will register some listeners to the tab update and change the Data elements accordingly. What the popup will do is to get that Data and appendit use the document.appendChild(Data).
(The purpose I intend is this will cause the popup changes immediately while the tab updage is triggered.)
However, the elements are shown as usual, what I am facing very headache is I have registered the onclick for the div object in backgroundpage as onclick="chrome.extension.getBackgroundPage().somefunc()". However, the first time, all the click will triger the right behavior but after the popup loses foucs and get focus again, all the click won't work.
I try to put something like change the onclick="somefunc()" and leave the func within the script of popup page. And there I want to log whether it is called by console.log("clicked"). Here, something unbelievable happens, the function is succefully trigerred BUT the console is null here, I cannot even call chrome.extension.getBackgroundPage() as well.
Here are a list of questions, maybe very hard to express for me...
1. Whether I can reuse the DOM element from the background page to the popup page directly by appendChild(chrome.extension.getBackgroundPage().getElementById()?
2.Will the onclick event registered in the background page still work in the popup pages?
3. What's the problem with the problem I am encountering? I have tried many ways to find out the reason but all in vain at last...
Best Regards,
If you need any more information, please let me know.
(PS: I am wonderning if it is called something like the event propogation, however, I am not an expert in this two pages communicating...)

How to create a popup for edit button in JSF page in jDeveloper 12c?

How to create a popup for edit button in JSF page in Oracle jDeveloper 12c?
There is nothing special about JDeveloper 12c when it comes to working with popups. You can see a sample here that automatically migrates to 12c:
http://andrejusb.blogspot.co.uk/2009/11/crud-operations-in-oracle-adf-11g-table.html
Drag and drop popup onto the form from component palette. Design as needed. Make note of popup ID. D&D Operation (from component palette) > Show Popup Behavior onto button. Set popup id to id of previously created popup. Select method to launch, like action. Google is your friend here. Search "ADF Popup" - lots of hits, like this. Remember to upvote those of us who take time to help you here.

Resources