I have an Eclipse RCP application. When the application is started I want to immediately present the user with a login dialog. Where is the best place to do this?
I've tried to use various hooks in the WorkbenchAdvisor and WorkbenchWindowAdvisor, but all of these open a dialog before the application had a task bar icon. In this case the dialog can easily be moved behind other windows and there will be no visual indication that the application is open, and the user might open several instances of the application by mistake.
I could force the dialog to be on top, but that's not a good solution. I want a proper modal dialog. A good example of such a dialog is Firefox's "save page as" dialog. When this dialog is present it is always in front of the main browser window; you must complete or close the dialog before you can effectively resume browsing the web. However, this "save page as" dialog doesn't force itself to be on top of every window, just the browser.
You can make a splash screen your login dialog: see an example here.
First: Is it allowed to have multiple instances open? If not, you have to implement independent from the Login-Dialog-Problem something that prevents opening several instance. Take a look here (btw: I made good experiences with the server-socket thing).
Second: If you overwrite #postWindowOpen in your ApplicationWorkbenchWindowAdvisor the application is up and running (including task-item). The only drawback is that your views are already opened, you have to reload them after a successful login.
Related
I need to close the Browser Window Tab, please note not the window widget but the Browser window tab, using ZK framework version CE-9.0.0.
I have already tried the following code segments but no luck:
Clients.confirmClose(null);
Executions.deactivate(page.getDesktop());
page.setComplete(true);
page.removeComponents();
page.invalidate();
Is there any API or way to achieve this using ZK and/or JavaScript?
Is there any way to get the reference to the browser window tab, so that it can be closed programmatically, in ZK and/or JavaScript?
Please note: This window tab is opened manually & not by JavaScript or any other program.
Thanks,
RAS
Close the browser tab from a server directly is not allowed. But you can show a modal window to ask a user to close a browser tab like:
<zk xmlns:ca="client/attribute">
...
<window mode="modal" title="Close the browser tab">
<button label="Yes" ca:onClick="window.close();"/>
</window>
</zk>
Because close() is invoked by users, it will close the browser tab. This could be an alternative. Although it doesn't close a browser tab directly, the modal window covers the whole page. Users can't do anything but to click "yes", so I think most users will just click "yes" to close.
I found it works in Chrome 80, but will fail at Chrome 81. So it's not a good way
The JS to close a window is window.close(), this is a well documented standard browser API. (also answered here)
From a ZK application (server-side) you can call this script via:
Clients.evalJavaScript("window.close()");
However this browser API has strict limitations: In modern browsers you can only close windows via close() that were also opened by javascript. So you can't close the current window in case the user navigated there manually - no way around that, except for using an old browser, which I won't recommend.
e.g. that's what you'll get in Chrome (#81)
I'm trying to develop a macOS app that performs operations on a file when the user chooses to do so. My goal is to let a user right-click a file, select my app from the list of services so that the app will pop open a UI with things like configuration options, etc.
A prime example would be Evernote's "Add to Evernote"; when a user clicks it, the Evernote app opens and saves the file there. In addition, I need to switch control to the UI, so that the user can input some settings, before performing any file operations.
The place where I'm stuck now is how to get the app/UI open when the user clicks it from the contextual menu, as well as keeping the UI hidden initially. From some googling, I think what I need to make is an agent? I'm not really sure.
Any help would be appreciated, thanks!
I am making an Excel add-in by Excel JavaScript API. There is a button in this add-in, clicking on it launches popup = window.open("https://localhost:3000/#/new/", "popup", "width=1000, height=1100") and popups a browser window.
Closing the workbook or the add-in will NOT systematically close the popup. So at the moment, if I open a workbook and the add-in again, and click on the button, another browser window will popup.
I am thinking if it is possible to always use the same popup for all the excel/add-in instances. We could use localstorage to share information among different excel/add-in instances, but I am not sure if it is possible to save the popup/window there.
Does anyone have any good idea to achieve this?
For Office Add-ins, you should be using the built in Dialog API. This API ensures popups are properly handled regardless of platform (i.e. across browsers, mobile and desktop clients).
The Dialog object supports a close method, allowing you to close any open dialogs from the parent taskpane.
I want to close an UI5 app by pushing the navigation button.
Is this possible ?
Btw: How can I close the app by not closing the tab?
Thanks
Because the app is in fact a "simple" web page, the concept of closing it is somewhat loose. Some ideas that you could try, depending on what you want to achieve:
Try and close the tab, but this will generally not work, because you can only close tabs that you created yourself (see Close Current Tab).
Open the blank page by using window.open("about:blank", "_self");
Open the home page of the browser by using window.home(); (see Sending user to their browser's Home Page using Javascript)
Trigger a "Back" navigation outside of your app (such that the page that was open before your app will be shown). You can use window.go(steps) to go forward / backward in the browser history by a number of steps (negative indicates that you are going backwards). It might be tricky to get the correct number of steps that you have to go back if you have hash-based routing in your app (you could use sap.ui.core.routing.History or a similar mechanism).
I need to open an url on a new and single tab chrome window, as you would normally do with window.open and "_blank", but when done inside a chrome app, the url is opened in a new tab of an already running chrome, ignoring all the window features options (width, height, etc).
Are we doing something wrong or is this a chrome app constrain? Any way to solve it?
Best regards
Sergio
You have two options.
Use a proper API to open a tab, chrome.browser.openTab, but that doesn't give you an ability to open it in a separate window. Such an option would probably be a nice addition, you can try submitting a feature request for it.
Open an app window with a local HTML file that embeds the required web content inside a <webview>. You then have full control over appearance, but lose access to browser's conveniences like cookie/password store of the current user, and have to implement some things yourself like dialog boxes.
I'm afraid a Chrome app cannot interact with the browser itself in a more detailed way by design.