ZK: Modal window not working properly when exception is thrown - dialog

The problem I have is pictured in this fiddle I created:
If you click on the Order coffee button, I've forced a Runtime Exception to be thrown within the doAfterCompose method of the modal window's controller. As you can see the modal window gets appended at the bottom of the page. This, aside from being ugly, allows the user to click again the Order Cofee button, which causes the famous "Not unique ID in space" error.
Is there any way to prevent the window from being created when an Exception is thrown?

You can call setPage(null) method on your component.

Related

Why does my error message display quickly, then disappear right away

I have a save button on my xpage. I have field edits inside of the button. I did that because when I put the edit in the field validation, it runs when I open a new xpage. Either way though, I have an Error Message control on the form. When I click the save button, it flashes yellow then disappears. Why is this occurring? It's simple code:
if(getComponent("ExpAmt").getValue() == null) {
#WarningMessage("You must enter an Amount for this expense");
return false;
}
Partial refresh message box displays saying:
An error occurred while updating some of the page.
Unable to load http://localhost/DB.nsf/xpForm.xsp?$$ajaxid=view%3A_id1%3A_id3%3A_id4%3ApanelAll status: 0
There is a partial refresh in your ccApplicationLayout that runs onClientLoad. It was immediately refreshing the panel after the page was loaded which caused the flashing effect. Removing this solved the issue.

coded ui the controls become blocked (hidden) after new page loads

The controls in the page become blocked (hidden) after the new page loads. Error message :
Test method GUIAutomation.CodedUITest1.CodedUITestMethod1 threw exception:
Microsoft.VisualStudio.TestTools.UITest.Extension.FailedToPerformActionOnHiddenControlException: Cannot perform 'Click' on the hidden control.
The root cause of this issue is: coded UI store the previous parameters of the window. When appeared the new window. Coded UI must have new search criteria for this new window. If the window have the same of search criteria. You must create the new instance of the window in coded UI.
Example:
SystemMessagePage message = new SystemMessagePage();
message.CloseExistMessage(); \\Close system message
If appeared the new system message window, we can't close this window by call of the method message.CloseExistMessage();.
To close a new system message window we must create a new instance of the window and repeat the previous code.
SystemMessagePage message = new SystemMessagePage();
message.CloseExistMessage(); \\Close system message

Saving the states of JavaFX controls on exit

I have a bunch of control objects (TextBoxes, to be precise) that get injected into my code using the #FXML annotation during the FXML load.
I would like to save the states of these controls, specifically the text values, when the user closes the Scene by clicking the close box on the title bar.
However, when I trap the CloseRequest event in an OnCloseRequest handler I find that the values of the control variables are null (the original injection works, so this is something that happens in between the loading of the FXML and the calling of OnCloseRequest).
Can anyone explain this behavior and/or suggest how I can get the functionality that I want?
TIA
onCloseRequest is
Called when there is an external request to close this Window. ...
(from Javadoc). One of the meanings of "external request" is when you close the window through OS native window close button. The closeRequest event is not triggered through the programmatic stage.close() or stage.hide() calls. So consider to handle onHiding or onHidden events.
Otherwise post your OnCloseRequest handler code.

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...)

Dismissing A ModalViewController With PageCurl

I've a modal view controller presented with page curl style. Everything works fine, but, if I click the page curled at top of the page, the modal view gets dismissed without any input.
Now, I could accept this behavior but I need to do some operation when it happens. How can I catch the event to do my stuff?
I assume you are talking about the half-page curl effect? If so, you could probably catch the event of it dismissing the modal view by implementing/overriding the following method in the ViewController that is doing the presenting...
- (void)dismissModalViewControllerAnimated:(BOOL)animated {
NSLog(#"Executing Own operation before dismissing!");
[super dismissModalViewControllerAnimated:animated];
}
Do your operation either before of after the call the the super method depending on if you want to execute it before or after the view is dismissed. I didn't get a chance to try this out so let me know if it works.

Resources