Code sample for creating and showing a simple popup in gwt which has some styling, is centred in the browser and which contains a single string and a single button to close/hide the popup:
final PopupPanel popup = new PopupPanel(false);
popup.addStyleName(Resources.instance.styles().popup());
Button btnClose = new Button("Close");
btnClose.addClickHandler(new ClickHandler()
{
@Override
public void onClick(ClickEvent event) { popup.hide(); }
});
FlowPanel fpPopupContents = new FlowPanel();
fpPopupContents.add(new Label("My message"));
fpPopupContents.add(btnClose);
popup.setWidget(fpPopupContents);
popup.center();
Showing posts with label gwt. Show all posts
Showing posts with label gwt. Show all posts
Tuesday, 26 July 2011
Tuesday, 19 July 2011
GWT: When the browser's scrollbars don't show...
... try adding the overflow:auto css property to your root view. For example,
(1) Define the .overflowAuto style in your styles.css file, as follows:
.overflowAuto { overflow:auto; }
(2) Declare it in your Styles.java file, as follows:
public String overflowAuto();
(3) Add it to your outermost HTMLPanel's styles in RootView.ui.xml, as follows:
<g:HTMLPanel addStyleNames="{res.styles.overflowAuto}">
That should work. The problem seems to arise when using LayoutPanels (and similar panels?) but haven't investigated it thoroughly so just an inkling.
(1) Define the .overflowAuto style in your styles.css file, as follows:
.overflowAuto { overflow:auto; }
(2) Declare it in your Styles.java file, as follows:
public String overflowAuto();
(3) Add it to your outermost HTMLPanel's styles in RootView.ui.xml, as follows:
<g:HTMLPanel addStyleNames="{res.styles.overflowAuto}">
That should work. The problem seems to arise when using LayoutPanels (and similar panels?) but haven't investigated it thoroughly so just an inkling.
Thursday, 24 February 2011
How to debug a facebook app using eclipse (gwt)
Steps to get a facebook app (written using google web toolkit) to run on the Visual Studio server and be picked up by the Eclipse debugger:
(1) Go to app developer page (e.g. http://www.facebook.com/developers/apps.php?app_id=168754973148732).
(2) Check and edit app settings as necessary. Look out for Facebook Integration settings (and Canvas URL setting) in particular. (Example Canvas URL value: http://127.0.0.1:21024/fb/)
(3) Navigate to app (Canvas Page) and append "index.html" or similar page to url. (Example Canvas Page value: http://apps.facebook.com/gskallitest/) Reload page.
(4) Use Google Chrome or Mozilla Firefox 'Inspect Element' tool to select the app in the page (it might not be visible but will be present in the html markup).
(5) Find the app iframe in the page html markup and pull out the src url. Bung in between "...index.html?" and "signed_request=..." the text "gwt.codesvr=127.0.0.1:9997&".
(6) Stick this modified url into your browser and assuming you have your gwt project running/debugging on Eclipse you're good to debug :)>
Note: When running the facebook project on eclipse (as a web application), uncheck the 'run built-in server' option from the Debug Configurations dialog ('Server' tab) and specify instead the server url to run from ('GWT' tab), i.e. the Canvas URL as specified in step 2.
ps. Remember to change the facebook app settings (step 2) back after testing/debugging. In particular: the Canvas URL setting which should be http://alli2.gsk.kickstartdigital.co.uk/fb/ or similar.
(1) Go to app developer page (e.g. http://www.facebook.com/developers/apps.php?app_id=168754973148732).
(2) Check and edit app settings as necessary. Look out for Facebook Integration settings (and Canvas URL setting) in particular. (Example Canvas URL value: http://127.0.0.1:21024/fb/)
(3) Navigate to app (Canvas Page) and append "index.html" or similar page to url. (Example Canvas Page value: http://apps.facebook.com/gskallitest/) Reload page.
(4) Use Google Chrome or Mozilla Firefox 'Inspect Element' tool to select the app in the page (it might not be visible but will be present in the html markup).
(5) Find the app iframe in the page html markup and pull out the src url. Bung in between "...index.html?" and "signed_request=..." the text "gwt.codesvr=127.0.0.1:9997&".
(6) Stick this modified url into your browser and assuming you have your gwt project running/debugging on Eclipse you're good to debug :)>
Note: When running the facebook project on eclipse (as a web application), uncheck the 'run built-in server' option from the Debug Configurations dialog ('Server' tab) and specify instead the server url to run from ('GWT' tab), i.e. the Canvas URL as specified in step 2.
ps. Remember to change the facebook app settings (step 2) back after testing/debugging. In particular: the Canvas URL setting which should be http://alli2.gsk.kickstartdigital.co.uk/fb/ or similar.
Subscribe to:
Posts (Atom)