SWT in eclipse version 4.1 add additional dialogs - eclipse

I am very new to swt and im my example I am using the following code for the shell and the display:
final GridLayout layout = new GridLayout(2, false);
parent.setLayout(layout);
I am trying to open a new ,'panel' as it is called in java, I think in swt it is a new display/dialog? when a button is pressed in the opening shell? I have looked everywhere for an example and I tried so much and cannot get it to work.
Any ideas on what I would put into my Listener?
Thanks,
Ann.

The equivalent to JPanel is a Composite in SWT. You should consider to read http://www.eclipse.org/swt/snippets/ for examples.
You may also check out http://www.eclipse.org/recommenders/ which might be of help when learning SWT.

Related

JflashPlayer in SwingNode

Is there any workaround to use DJNative's JflashPlayer in swingNode of JavaFX 8. I had worked with incorporating JflashPlayer in pureswing containers like JPanel. But when using java's new version- Java8 which has new added feature of embedding swing components in JavaFX using the SwingNode, I can embed JButton and whatever swing components to it, it is working fine. But DJNative's JflashPlayer cannot be embedded in SwingNode or it cannot be found working.
Can any one help me on this.

How to create dynamic view just like Adobe Flash Builder in eclipse RCP?

I am creating a RCP in Eclipse Indigo 3.7. I want an editor-view link just like Adobe Flash Builder Design editor and view properties field i.e on opening an editor, its related view should also open without changing perspective and on closing editor, view should dispose.
I tried placing placeholders for views in editor but had no luck.
Also tried adding listener to view part but didn't got satisfactory response.
Please help me with your response.
A code snippet will also be helpful..
Thank you in advance.
I have not tested this, but...
In createPartControl(...) you should call IWorkbenchPage.showView(String viewId, String secondaryId, int mode) and in dispose() you should call IWorkbenchPage.hideView(IViewPart view). The later viewPart is the return value from showView(...).

GWT Suggestbox with Smartgwt

I am facing a problem that I can't see the drop down list of the GWT Suggestbox.
I am adding a GWT Suggestbox into SmartGWT's VLayout. Then I can see the textbox of the Suggestbox. But when I input some data, I can't see the suggestions provided.
Is this because I am using the SmartGWT VLayout? Could anyone tell me how to solve it? Thanks.
Sorry, the above question is not clear enough. What I mean is I add a SuggestBox into a layout with small height. Then I can see the the SuggestBox's TextBox part and part of the suggestion and the rest of the suggestion seems hide under other layout. Below is my code:
VLayout mainLayout = new VLayout();
mainLayout.setHeight100();
mainLayout.setWidth100();
MultiWordSuggestOracle oracle = new MultiWordSuggestOracle();
oracle.add("a");
oracle.add("aa");
oracle.add("aaa");
oracle.add("aaaa");
oracle.add("aaaaa");
oracle.add("aaaaaa");
oracle.add("aaaaaaa");
SuggestBox box = new SuggestBox(oracle, new TextBox());
VLayout suggestBoxLayout = new VLayout();
suggestBoxLayout.setHeight("10%");
suggestBoxLayout.addMember(box);
VLayout body = new VLayout();
body.setBackgroundColor("#3B5998");
body.setHeight("90%");
mainLayout.addMember(body);
mainLayout.addMember(suggestBoxLayout);
So when I enter a into the SuggestBox, I can only see a, aa, aaa and the rest suggestions are hide by the body.
This may be zIndex related, but there's no reason to use GWT's SuggestBox and run into problems like this. Use SmartGWT's ComboBoxItem. If you don't want a drop-down control to appear at the end of the text entry area, call setShowPickerIcon(false).
With the help from Alain, I add .gwt-SuggestBoxPopup {z-index: 1000000;} into my CSS. Then I solve the problem.
It would be easier with little bit of code.
Before stopping to mix Smartgwt with Gwt I integrated some code which was using GWt suggestBox and it was working....
(Why don't you use the Smartgwt selectitem it does the job?)
Regards
Alain

How to use GWT designer with Eclipse GWT plugin?

Sorry but I see no way to use it at all!
If I create GWT project with sample code, then SDK is generating a page with a HTML table where positions for sample TextBox-es and Button are already marked. So, if I open sample file with GWT designer and move button slightly down-right, I will get errors during run.
If I create GWT project without sample code, then GWT designer appears to be unable to open file with empty GUI.
Is there any way to design GUI from scratch or to see GWT designer usage sample?
Thanks
The problem is when you want GWT to create sample code for you, it puts the container parts of layout hard-coded in your projects html file. The generated sample uses RootPanel.get("someId").add(someWidget); to access these containers. When you open designer and move these widgets around, designer generates RootPanel.get("someId").add(someWidget,left,top); which doesn't work with this method.
On another note, when you want to create a class from scratch and open it with designer, you can simply add a reference to RootPanel to get around "this is not a gui class issue" such as :
public class SimpleClass {
RootPanel r = RootPanel.get();
public SimpleClass() {}
}

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