GWT open.window on top window - gwt

I am using GWT in my projects, when I use the open.window the window opens in the back not in the front. I can find nothing to fix this. I've tried something called the z-index, but there is next to no documentation about this. And it didn't work.

Set focus on a new window. Probably via some kind of JSNI method which will contain something like this $wnd.focus().

Related

LWUIT menuBar refreshTheme not working?

I'd like to dynamically change the text of a Command depending on some state, so normally I went to Google and LWUIT blogs said that using refreshTheme() on MenuBar should do the trick.
So I used the following code, but it sadly didn't work
if (isPlaying) {
playButton.setCommandName("Pause");
}else{
playButton.setCommandName("Play");
}
this.getMenuBar().refreshTheme();
Is there something wrong with my code? Or did I misunderstand something?
It won't refresh. The text of the button is set when the command is placed so you can't do that.
You will need to use removeCommand(cmd) followed by addCommand(newCmd).
Furthermore, refreshTheme() has absolutely nothing to do with anything.

How to programmatically change help contents in Eclipse?

I have an eclipse plugin and I would like to programmatically disable help content TOC's based on a variable I define. In a nut shell, I want to prevent some help docs from showing up in the help contents if a specific type of user is accessing the plugin.
Preferably I would like to do this in the ApplicationWorkbenchAdvisor somewhere.
One thought would be to modify the "primary" value to be false if the variable were set.
Not sure if it would work, but try using the org.eclipse.ui.activities extension point. The tutorial from Vogella tells it is possible to hide only UI elements like wizards, views and so on, but it is from 2009.. Not sure if hiding TOC is now possible. If you try it out, would be nice to give a feedback ;)

Opening a new Window with a Widget in GWT

Before you start shooting me down i have checked for answers and i have googled till my fingers bled but i havent been able to find a simple, concise answer. So im asking again for all those that might have this problem.
Question: how to open a new window with a formpanel in side.
Context: i have an app that lists lots of items, i want someone to edit an entry, i want a new window to open so they can edit properties then hit save. A standard thing you find in a lot of applications.
Architecture:
I have one client module called UI, it has a dozen classes that draw widgets and fill a main area when selected from a menu. I have a single html page called UI.html which has the tag in the head. Thats it.
Options Ive Seen
Call Window.Open() but you need to define a html file. I dont have one. I can create an empty one but how do you inject a widget in to it ?
use jsni $wnd to create a new window and get a reference to it. But how do i inject a form panel into it ??
use a popuppanel. They look sucky - plus if opening a window through JS is quite simple i would expect it to be in gwt.
Maybe im miss understanding how to use GWT i dont know.
Any help would be appreciated
Thanks
The way i got this to work is as follows:
i wrote a jsni method to open a new window
public static native BodyElement getBodyElement() /*-{
var win = window.open("", "win", "width=940,height=400,status=1,resizeable=1,scrollbars=1"); // a window object
win.document.open("text/html", "replace");
i added a basic body to the new window and returned the body element
win.document.write("<HTML><HEAD>"+css1+css2+"</HEAD><BODY><div class=\"mainpanel\"><div style=\"width: 100%; height: 54px;\"><div id=\"mainbody\"class=\"mainbody\" style=\"width: 100%;\"></div></div></div></BODY></HTML>");
win.document.close();
win.focus();
return win.document.body;
}-*/;
i then called this method from my main java method
BodyElement bdElement = getBodyElement();
I then injected my panel which has lots of widgets into the returned body element
SystemConfiguration config = new SystemConfiguration(); bdElement.getOwnerDocument().getElementById("mainbody").appendChild(config.getElement());
I agree with Bogdan: Use a DialogBox.
If you can't, you Window.open() as you mentioned in option 1:
Create another GWT module, and form.html that will load it
Window.open("form.html?entry=54")
Have the form gwt module read from the URL, load the entry, allow it to be edited, and provide Save and Cancel buttons
Close the popup when Save or Cancel is clicked
Can't you just use a DialogBox?
Example

avoid chrome popup extension to close

Is there a function that allow me to select text when the extension
stays open. Normally when I Use the extension popup and I Click outside the
extension the extension close. Is there a wat to avoid this.
Thank you so much
Unfortunately there is currently no way to keep the popup open once you focus out of it. This is by design.
If you would like to always show something while interacting with the page, perhaps the experimental Info bars or even Desktop Notifications would work?
Hope that helped!
The only way to keep it open is to right click over the extension icon (button) and select "Inspect popup" the extension popup then show up and remain open but of course the debugger window show and this not a fix obviously still it will maybe inspire a hack... if someone is skilled enough and share the solution with all of us.
I encountered the same problem and I've thought of a possible solution (though not tested it):
Use your background.html to store the content of the popup action and upon loading the popup, you fetch the content via the default messaging for chrome extensions.
When doing all kinds of other stuff, like XHR's or something, I think you should do that in background.html too, so the requests won't abort if you close and you can do something with the result. Then when a user re-opens the popup, he'll see the result of his previous action instead of the default screen.
Anyone tried something like did already?
As far as I know you can't persist a pop up menu but my workaround has been using a content script to append a menu on page load. After the menu is appended you can toggle the menu via messaging between the background script and the content script.
If you want to encapsulate the menu from the page it's deployed on you could wrap your menu in an iframe. This could add complexity to your project since you would have to deal with cross origin issues and permissions.
There is an alternative hack for this. You can make use of chrome local storage to store the metadata as needed. Upon restart you can read that metadata and render the desired content. You will also probably clear that metadata after you have completed performing the operations based on that.

open a pop up window without using javascript

how to open a pop up window in code behind(C#) without using javascript.
Besides the fact that popups piss off a lot of people, it is not really possible to do so (if you don't consider target="_blank") without using javascript. Code written in code behind only generates client side code (which can include javascript) or executes some serverside stuff.
There might be other workarounds using flash or silverlight but I'm not sure about that. Maybe if you clarify your goal a little bit more I can give a better solution to your problem.
That is impossible because of "The code behind runs on the server; you need the popup to appear on the client machine. Therefore your code behind can't trigger a popup".
Alternatively, you can show a panel in the page as pop-up window, by seting it's z-index and giving absolute position.
The code behind runs on the server; you need the popup to appear on the client machine. Therefore your code behind can't trigger a popup.
Also, if you use javascript you'll probably find that the client's popup blocker prevents the new window from appearing (unless the popup happens as a direct response to a click - without posting back - in which case you can use <a target="_blank"...> if you really don't like javascript).
I do not think that is possible . what you can do offcourse is to open a new window with defined small width/height and all menus are stripped...
Just add attributes to a link button or to a button in code behind. Try this code to page load or to the button event handler.
Button1.Attributes.Add("onclick","javascript: SP.UI.ModalDialog.showModalDialog
({ url: 'PopUp.aspx', title: 'Pop Up Window', width: 600, height: 500 }); return false;");