I implemented Help in RCP 4 using below code Help Link. I opened the help as a new browser . But I unable to close this browser when close the main window. How to close help browser automatically in RCP4?
Remember the browser that the help system is using:
IBrowser browser = BaseHelpSystem.getHelpBrowser(true);
browser.displayURL(helpURL);
and when you are done call
if (browser.isCloseSupported()) {
browser.close();
}
But it looks like most external browsers return false for isCloseSupported
Related
I am working on a Hospital front desk ADF project, here I need to generate visit slips these dont require print preview.I want to get to print the slips without any print dialogs nor do I want a popup window. I tried lot of stuff found on the net but nothing solid has come up..
Tried this.print on the Jasper report, tried the same through Java but I am getting dialog.
I am working on an intranet so the security aspect is out of the discussion so how so I make this work?
This is a suggestion rather than an answer, but I can't write comments before I get 50 points of reputation (thank you for the warm welcome, StackOverflow!) - maybe one of these will help:
1) Printing an html file using java without showing print dialog to the user
2) How would I suppress the print dialog in this example?
I was able to perform the silent print, I used a popup window to call a servlet which generated the required visit slip and displayd the same on the pop window. For the silent print I used
exporter.setParameter(JRPdfExporterParameter.PDF_JAVASCRIPT, "this.print({bUI: false,bSilent: false,bShrinkToFit: true,printParams:this.getPrintParams().constants.interactionLevel.silent});this.close();");
I had to make a couple of changes to IE, I added my url to the trusted site option in IE. I enabled js in acrobat and also pointed acrobat to the trusted sites in IE. This resolved silent print but am stuck with another issue..
I am not being able to close the window once print is done.. I tried this..
"var win = window.open('PrintPopUp.jsf','_blank',\"height=300,width=200,scrollbars=no," +
"status=no, resizable=no, screenx=0, screeny=0\");win.onclick=function(){setTimeout(function(){win.close();\n},9000);}
But its not working in IE 11.. any suggestions?
Well I found out a way to do this..
JRPdfExporter exporter = new JRPdfExporter();
exporter.setParameter(JRPdfExporterParameter.PDF_JAVASCRIPT,
"var pp = this.getPrintParams();pp.interactive=pp.constants.interactionLevel.silent;pp.NumCopies=1; this.disclosed= true ;this.print({bUI: false,bSilent: false,bShrinkToFit: true,printParams:pp});");
This adds pdf javascript to the generated pdf..
Once the pdf is displayed on the popup page it performs the silent print.. Hope this helps someone in the future..
My webstart runs fine whenever there is internet connection. It also runs fine when I disconnect from wifi. But it does not work if my computer is connected to public wifi (ie. coffeeshop, airport, etc) such that if I open a browser it forwards me to a html page that asks me to click on a button to connect to internet.
Basically Java webstart thinks that the html welcome page is the new update to my jnlp file so it replaces my jnlp with the welcome page html. Of course that will fail to parse, so I get a parse error and I cannot recover from it unless I completely remove my webstart application from cache and re-download and re-install it.
Has anyone else experienced this? Is there a way to prevent this issue?
I submitted a bug report to OpenJDK:
https://bugs.openjdk.java.net/browse/JDK-8079874
Unfortunately it's marked as incomplete. Evidently I wasn't clear about what the problem is. I'll try to get in touch with them to see which part is not clear.
Is there a way to detect if a browser window is closed using GWT. For example a window opened through GWT using this code:
Window.open("some_url", "__blank", null);
I need to detect wether this windows opened through gwt is closed. Is there a way to do that?
I think, it is a real problem making it cross-browser.
GWT has
Window.addCloseHandler(new CloseHandler<Window>() {
public void onClose(CloseEvent<Window> windowCloseEvent) {
}
});
Which handles the onunload event(occurs before the browser closes the document).
However it does not work for handling browser close event with all browsers, because when refreshing the page, this event is fired as well.
Since GWT also generates JavaScript see this article: Window Close Event of Browser
Here is conclusion of that article:
Conclusion
As we have already discussed that there is no 100% fool proof way to
detect the browser close event in a lot of cases, the above technique
can fail. For example if the user kills the browser's process from
task manager, there could be many more cases. Yet in a lot of cases,
this technique can be handy. Best of luck and happy programming.
I am trying to download a file from server. The normal GWT RPC call doesnot allow me to do that, and hence I wrote a servlet to do that job for me. From the client side, I am creating a Frame object, and I set the servlet URL in it, and add that frame Object in my root panel.
When I execute this in IE, a window pops up asking for Save/Open file.
But when I execute the same in a Firefox or a Google Chrome browser, nothing is happing.
I am not getting any request on my servlet/server side.
Here is a slice of the code :-
String servletUrl = "http://localhost:13080/Browser/ui/dataExportServlet?level=ZERO";
Frame frame = new Frame(servletUrl);
frame.setVisible(false);
RootPanel.get().add(frame);
So, can someone please help me out.
This might be related to same origin policy.
Are both servlet and webapp running on port 13080?
If they differ, SOP might fail this.
If I understand correctly, IE has a more relaxed policy so it might work there but not in chrome.
See http://en.wikipedia.org/wiki/Same_origin_policy and Can I disable SOP (Same Origin Policy) on any browser for development?
In Chrome, you can use the Developer Tools (CTRL + SHIFT + I) to check if the IFrame is being added to the HTML, and if the frame's source is being set properly. You should also be able to see what content has been loaded into the iframe.
Alternately, set a breakpoint in your servlet to see if the iframe is being hit at all from Chrome.
I got the solution for this issue.
I removed the frames and added the following code :-
com.google.gwt.user.client.Window.open(url, "CSVDownload", "");
Now, this opens a new browser window, and then I get the pop-up to open/save the server side file in all 3 web-browsers. (IE, Mozilla FireFox, Chrome).
Thanks a lot!!!
We've got an Eclipse RAP application that's behaving a bit strangely in Firefox - two distinct problems.
When you browse around, you can click on a button in one part of the system. This opens a popup window like so:
IWorkbenchBrowserSupport bs;
bs = PlatformUI.getWorkbench().getBrowserSupport();
int style = IWorkbenchBrowserSupport.AS_EXTERNAL;
IWebBrowser b = bs.createBrowser(style, getRandomID(), "Hello world", "");
b.openURL(new URL(...));
where the URL is another servlet in the application. This servlet is in the same runtime, but has nothing to do with RAP - it takes a binary blob from in-memory storage and dumps it in the output stream.
Problem 1: This causes the HTTP session to die in firefox, and shows the "session expired" RAP error page with a link to restart the session.
Problem 2: Now, when you click on the link to restart the session, it shows the application's dialog again, but the session expired error is shown again the moment you do anything. This prevents the user from using the system again, unless Firefox is closed down completely and restarted. A quick peek with FireBug reveals that the JSESSIONID passed by Firefox does not change.
Has anyone seen this before?
How long is the dumping of the stream to the output? May it cause a timeout? As RAP uses Javascript calls, it might be much shorter than the normal timeout time.
For problem 2: Firefox caches a lot of things; and if the Javascript execution hangs, it might cause such problems.
Are these problems present in other browsers? It might be a good idea to check with the internal browser (or any other browser with a different rendering engine).
It turns out that if a RAP application opens a popup window pointing to a servlet in the application itself, inside the current HTTP servlet context, the session is killed. Fixed by creating a dummy HTTP context for the servlet in question.
If you need to deliver content from within the same application, you should use a service handler instead. See this FAQ:
http://wiki.eclipse.org/RAP/FAQ#How_to_provide_download_link.3F