Re: GWT, PHP, HTML 5

2009-10-10 Thread Brian Blain

You can deploy your GWT and PHP code on the same Apache Tomcat
instance

This article sums up how to call PHP 
http://angel.hurtado.googlepages.com/tutorialgwt2


On Oct 6, 1:18 pm, skorpiostinger  wrote:
> Hey Guys,
>
> I have been researching on GWT and PHP integration a while.
>
> The reason is - I need a simple, flexible client - side AJAX based
> Framework to develop and integrate web - based application into
> existing PHP application running @ Rackspace (Linux, PHP, MySQL).
>
> Is anyway to integrate GWT api's into PHP code or I need to call PHP
> scripts from GWT?
>
> Do I have to run Tomcat server, Apache at the same server? How they
> would interact between each other?
>
> I think the solution connected with JSON, Jetty, hosted server mode,
> but I am not sure.
>
> Here is php script:
>
> 
> echo "";
>
> // I need AJAX Editor to Save/Load Editable Text Box to load it unto
> MySQL DB.
>
> echo "AJAXEditor();";
>
> ?>
>
> How will it interact with HTML 5 manifest?
>
> Let me know if any questions.
>
> Thanks,
>
> Guys
>
> R
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en
-~--~~~~--~~--~--~---



Can GWT alone make a good application?

2009-10-10 Thread azure

Hi,
can GWT alone be used to make a good application (like library
management system)? Or, do you think that GWT is only for the UI and
the backend has to be something like Spring, PHP?

I am asking this question because I was able to make a simple login
application using GWT only. The username and password are sent via RPC
to the server side. There, I made the connection to the database and
checked the authentication information. Boolean is returned to the
client if the authentication was successful or not. Looking at this
example, I think that GWT alone can be used to make an application.

I also have another query related to the above application. Are the
entire RPC call and the code for connection to the database included
in the javascript file generated by GWT?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en
-~--~~~~--~~--~--~---



Re: Announcing GWT 2.0 Milestone 1

2009-10-10 Thread Alyxandor

Ok, I see where you're going, and I've been there  A few times.
No, seperate root entry points have completely separate obfuscation
patterns, and will never share java objects.  You CAN do it if you're
willing to collapse down to JSNI on every transaction, but this can be
costly and inefficient.

There are many roads open to you, and I personally recommend runAsync
() as it's the new, polished, officially supported method to make
monolithic apps WITHOUT using multiple frames.  I've made two seperate
modules that are designed to communicate through iframes and shared
JSNI objects.  In one, I extended onModuleLoad to use a communicator
interface, which accepts and sends JSNI objects using native methods
that rip out the javascript function from java mehtods, store them in
a namespace in the $wnd variables, so any two xModules with the same
global namespace string "hook up" the javascript objects in a very
dirty, hackish manner.  It worked, but it is a REAL pain to debug
because "some" browsers don't like to communicate through iframes like
others.  It also broke Opera and spent more time compiling the same
base code twice per iteration than I like to remember.  The key of
this method is to use static JSNI namespacing to create a common int,
double and String "interfacing" {but with JSNI, no interfaces are
used.  I just mean both sides of the iframe do stuff like {S:
2,S0:"Str1",S1:"Str2",I:1,I0:123}, and they just "know" how to access
the data}.  NO JAVA OBJECTS ARE TRANSLATABLE, so don't use them
without converting through JSON.

http://www.aiyx.info/xSrc.html#xSource/xBook.xFacets.client.xCommunicator.java
http://www.aiyx.info/xSrc.html#xSource/xBook.logickmal.client.xRNA.java
http://www.aiyx.info/xSrc.html#xSource/xBook.xModulus.client.xModule.java
http://www.aiyx.info/xSrc.html#xSource/xBook.logickmal.client.xDNA.java
http://www.aiyx.info/xSrc.html#xSource/xBook.logickmal.client.xLocus.java


A new method I used to communicate through frames was to use GWT
Exporter to create global JSNI copies of Java object prototypes {also
using static namespacing}, and rather than hook up parentRx(childTx())
<- js -> childRx(parentTx()) links, I export all the root tasks into
the root, parent iframe, and then use native methods to find the root
gwt window, and send primitive data through static native functions to
get some cross frame communication going.  This method is still buggy
and kind of ill because it has to store a reference to the modules
hidden iframe "scope" window, so ripped out java callbacks
{AsyncCallbacks} from the child window need to send the native window
{NOT $wnd} for context so the parent can wrap functions with stuff
like:
void xDo(JSO task,String x)/*-{
  task.job.call(task.wnd, x)
}-*/;
This method works, but there's a lot of boilerplate involved.  Once I
get a decent milestone to satisfy me, I'm going to try writing a
generator for this to make the static accessor functions, because as
it is, I've basically got to write the same code three times for each
function; once to do it, once to translate through JS, and another for
static accessor functions.

I'm telling you right now, unless you HAVE to use FRAMEs or an
existing API, you are wasting your time and the efficiency of your
code trying to compile multiple modules to communicate with each
other.  It's possible, but it's gross and now that runAsync is fully
Appengine compatible, your best best is to do everything in a single
module, and just build each frame as a "virtual frame", using two
runAsync() methods that build their elements using RootPanel.get
("id1") and RootPanel.get("id2") to put each module's implementation
into two divs that look and act like frames, but run in the same
environment.  To do this, you actually want THREE modules.  The root
module is what loads and builds the other two, plus it should access
the common interfaces and any common static functions so that the two
child modules don't have to include the code.  Then you can do
GWT.runAsync(EntryPoint1.class, new RunAsyncCallback(){
 public void onFailure();
 public void onSuccess(){
   GWT.create(EntryPoint1.class).onModuleLoad();
 }
});

http://code.google.com/p/xbook {source check out, look in the main src
folder, ai.yx.common.client.* }

This way, you can skip JSNI bridges, and just do regular java stuff
with static functions in common code area.  This reminds me, when you
want to include common code to multiple modules, you put it into a
separate client package and add a dummy .gwt.xml module definition
that does NOT use an entry point.  Think of module xml's like global
dependency / import maps.  You've got to import all your code properly
in java, but you've got to tell GWT exactly what packages you want to
access from which other packages, AND in what order to load them.
It's basically an extended classpath that GWT uses to trim deprecated
packages by only including what you need.  To make a common import
package, just put it in it's own client package,

Re: How to add different css for each tab in the TabPanel

2009-10-10 Thread Brian Blain

use addStyleName and CSS instead of directly setting properties, if
you decide later on that a different color is needed you wont have to
recompile code to have it change.

On Oct 10, 10:52 am, Mohamed Mansour  wrote:
> Hi, its basically just CSS, here is how you would do it directly in GWT, but
> I prefer separating the view from the code.
>   // Create a tab panel and populate with a few tabs.
>      TabPanel tabPanel = new TabPanel();     tabPanel.setPixelSize(500, 500);
>     // Tab content.
>      AbsolutePanel contentPanel = new AbsolutePanel();
>      contentPanel.setHeight("200px");
>      contentPanel.getElement().getStyle().setProperty("backgroundColor",
> "#FF");
>
>      // Tab widget.
>      HTML tabWidget = new HTML("Coloured Tab");
>      tabWidget.setWordWrap(false);
>      tabWidget.getElement().getStyle().setProperty("backgroundColor",
> "#FF");
>      tabPanel.add(contentPanel, tabWidget);     // Add the tab panel
> somewhere      someContainer.add(tabPanel);
>
>   - Mohamed Mansour
>
>
>
> On Sat, Oct 10, 2009 at 6:35 AM, maheshm1206  wrote:
>
> > The idea is to have each tab in the TabPanel look different.
> > For example, the first tab bg will be gray, second tab bg will be
> > black etc.
> > Thanks in advance for the help.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en
-~--~~~~--~~--~--~---



GWT and re-Captcha

2009-10-10 Thread vacorda

This is sort of a refinement to:
http://groups.google.com/group/google-web-toolkit/browse_thread/thread/99c259aad06406c6/f7fb27b8fa47760d?lnk=gst&q=GWT+recaptcha#f7fb27b8fa47760d

The idea here is I wanted a captcha control that I can insert in my
GWT Dialogs. I have pasted the composite below to share. A little bit
of a hack because of the creation of "Label dummyLable = new Label();"
and manipulating the Element to set the ID attribute. Prerequisite to
using this control is to load the reCaptcha script:

http://api.recaptcha.net/js/
recaptcha_ajax.js">

public class CaptchaComposite extends Composite {
private Grid grid = new Grid(1, 1);
private static final String DIV_NAME = "recaptcha_div";

public CaptchaComposite() {

this.initWidget(grid);

Label dummyLable = new Label();
grid.setWidget(0, 0, dummyLable);
Element divElement = dummyLable.getElement();
divElement.setAttribute("id", DIV_NAME);
}

private void createChallenge() {
createNewChallengeJSNI();
}

public String getChallengeField() {
String value = getChallengeJSNI();
PMLogger.debug("challenge=" + value);
return value;
}
public String getResponse() {
String value = getResponseJSNI();
PMLogger.debug("response=" + value);
return value;
}


private native String getResponseJSNI()
/*-{
  return $wnd.Recaptcha.get_response();
}-*/;

private native String getChallengeJSNI()
/*-{
  return $wnd.Recaptcha.get_challenge();
}-*/;

private native void createNewChallengeJSNI()
/*-{
$wnd.Recaptcha.create("",
"recaptcha_div", {
   theme: "red",
   callback: $wnd.Recaptcha.focus_response_field
});
}-*/;

private native void reloadChallengeJSNI()
/*-{
$wnd.Recaptcha.reload();
}-*/;

private native void destroyJSNI()
/*-{
$wnd.Recaptcha.destroy();
}-*/;

public void createNewChallenge() {
reloadChallengeJSNI();
}

public void destroyCaptcha() {
destroyJSNI();
}

@Override
protected void onAttach() {
super.onAttach();
createChallenge();
}

}

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en
-~--~~~~--~~--~--~---



Re: Announcing GWT 2.0 Milestone 1

2009-10-10 Thread balachandra maddina
Hi Alyxandor,

  Thx a lot for very detailed explanation. infact, im using a similar
pattern you have explained regarding callback(its for a different case using
JSNI). but i have few questions here,

1. How can two Gwt Modules share a same interface(java class). i mean if i
put this common lib in some package other than client package the
compilation fails isnt it? even if i create two identical interface
definitions and place them in the client package of these different modules,
still the java package name would be different so i pass the interface
definition to one module from another module would the compiled javascript
be able to understand?

2. As these are two different modules, two will have two HTML files and im
loading these two modules as FRAME's in a parent window so if i invoke One
of the module and get the common lib code would the other module be able to
understand? please let me know if there a better way to load two different
modules in one container module.

Please let me know your views on the above two cases. your help is very much
appreciated.

Thank you,
bala.

On Sat, Oct 10, 2009 at 5:40 PM, Alyxandor <
a.revolution.ultra.b...@gmail.com> wrote:

>
> As to your questions about Module-A and Module-B, you don't HAVE to
> make the interfaces for Module-B available in Module-A; but if you
> also want to use those interfaces in Module-C, it will be more
> efficient to download the interfaces first, in Module-A, so both
> Module-B and Module-C can implement that interface knowing it won't
> have to duplicate the same boilerplate code.  I'm going to PRETTY
> compile, upload to appengine and inspect to verify my inferences, then
> post back here, or on a more relevant thread and just post a link.
>
> PS - The entry point I posted isn't terribly nice on the UI, as the
> cache.js files of both runAsync() calls block the js while they
> download; but it works so it makes me happy inside.  A better method
> would be to use one runAsync() to stick an animated "loading" gif on
> the center of the page, then use a single callback to build the main
> UI, whose buttons all call runAsync() on their first click.  ...Me
> thinks...
>
> PEACE!
>
> --Wise Words Woven With Will Wake Worlds--
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en
-~--~~~~--~~--~--~---



Re: Is it possible to send generic types over RPC?

2009-10-10 Thread Nathan Wells

Try this project:

http://code.google.com/p/gwt-dispatch/

On Oct 9, 12:17 pm, andreas_b  wrote:
> Hi.
>
> Thanks for your answer.
>
> That bug sure seems similar, but some of the comments suggest that my
> usecase has been solved. Not sure if it's the same error either.
> Isn't there a good work-around for this? Anyone who has solved this
> and can give me some advice?
>
> Thanks.
>
> BR, Andreas
>
> On 8 Okt, 16:10, Paul Robinson  wrote:
>
>
>
> > I believe you've found this 
> > bug:http://code.google.com/p/google-web-toolkit/issues/detail?id=2374
>
> > andreas_b wrote:
> > > Hi all.
>
> > > I have searched the forum and google for some answers, but have been
> > > unable to find a direct answer to my question. So sorry if this has
> > > been answered. In that case, please give me the link to that
> > > discussion.
>
> > > I'm working on a project where I need to send lots of different data
> > > object over RPC to save them in a database.
> > > I thought, hey let's use some generics and let the type extends
> > > Serializable.
>
> > > So I defined the synchronous method like this:
>
> > >  DBQueryResult saveObject(T aObject);
>
> > > and asynchronous version:
>
> > >  void saveObject(T aObject,
> > > AsyncCallback> callback);
>
> > > All data types that I pass to this method implements Serializable and
> > > I have verified that they can be sent when defining separate methods
> > > for them. DBQueryResult has also been successfully serialized and
> > > deserialized before I tried to make this generic.
>
> > > I get no compilation errors, but during runtime (in hosted mode)I get
> > > the following error:
>
> > > 2009-okt-08 10:21:42
> > > com.google.appengine.tools.development.ApiProxyLocalImpl log
> > > SEVERE: [1254997302431000] javax.servlet.ServletContext log:
> > > DataServiceImpl: An IncompatibleRemoteServiceException was thrown
> > > while processing this call.
> > > com.google.gwt.user.client.rpc.IncompatibleRemoteServiceException:
> > > This application is out of date, please click the refresh button on
> > > your browser. ( Could not locate requested method 'saveObject
> > > (java.io.Serializable)' in interface
> > > 'com.borglin.web.teamsite.client.servercomm.DataService' )
> > >    at com.google.gwt.user.server.rpc.RPC.decodeRequest(RPC.java:293)
> > >    at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall
> > > (RemoteServiceServlet.java:164)
> > >    at com.google.gwt.user.server.rpc.RemoteServiceServlet.doPost
> > > (RemoteServiceServlet.java:86)
> > >         .
>
> > > Is it not possible to use generics when defining RPC methods? Is there
> > > any other way to avoid having to define separate methods for each data
> > > object that I need to send over?
>
> > > Thanks in advance!
>
> > > BR, Andreas
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en
-~--~~~~--~~--~--~---



Re: Visualization / AJAX Loader problem

2009-10-10 Thread Alex

Thanks for the info.
Unfortunately re-ordering the load didn't solve the problem, but
removing the map from the load did.

Alex

On Oct 10, 6:37 pm, Eric Ayers  wrote:
> Try re-ordering the load so that the Maps API is loaded first before the
> visualization API.  You might check on the Visualization API group.  There
> was a thread about this on the gwt-google-apis group as well.
>
>
>
> On Sat, Oct 10, 2009 at 12:01 PM, Alex  wrote:
>
> > Hi,
>
> > I've got a problem with the Visualization API. Until recently the code
> > below worked just fine. But now I get the error:
>
> > [ERROR] Unable to load module entry point class
> > gwtVisualiztion.client.GWTvisualization (see associated exception for
> > details)
> > com.google.gwt.core.client.JavaScriptException: (TypeError): Object
> > expected
> >  number: -2146823281
> >  description: Object expected
>
> > According to the FAQs this is caused by a problem with the AJAX loader
> > script. The script tag however is part of the html code and the script
> > can be reached with the browser.
> > Any suggestions what might be wrong / or how to solve the problem
> > avoiding writing Runnable Java classes?
>
> > Gr,
>
> > Alex
>
> > -
> > 
> >  > EN" "http://google-web-toolkit.googlecode.com/svn/tags/1.7.0/distro-
> > source/core/src/gwt-module.dtd">
> > 
> >  
> >  
>
> >  
> >  
> >  
> >  
> >  
> >  
>
> >  
> >  
>
> >  
> >  
> > 
>
> > -
> > package gwtVisualiztion.client;
>
> > import com.google.gwt.core.client.EntryPoint;
> > import com.google.gwt.user.client.ui.RootPanel;
> > import com.google.gwt.visualization.client.visualizations.GeoMap;
> > import
> > com.google.gwt.visualization.client.visualizations.GeoMap.Options;
>
> > public class GWTvisualization implements EntryPoint {
> >        private DataModel myData;
> >        private GeoMap myMap;
> >        private Options myMapOptions;
>
> >       �...@override
> >        public void onModuleLoad() {
> >                myData = new DataModel();
> >                myData.fillDataTable();
> >                myMapOptions = Options.create();
> >                myMapOptions.setDataMode(GeoMap.DataMode.REGIONS);
> >                myMapOptions.setRegion("world");
> >                myMapOptions.setHeight(600);
> >                myMapOptions.setWidth(800);
> >                myMap = new GeoMap(myData.getDataTable(), myMapOptions);
> >                RootPanel.get("main").add(myMap);
> >        }
> > }
>
> > -
>
> > package gwtVisualiztion.client;
>
> > import com.google.gwt.visualization.client.DataTable;
> > import
> > com.google.gwt.visualization.client.AbstractDataTable.ColumnType;
>
> > public class DataModel {
> >        private DataTable myData;
>
> >        public DataModel() {
> >                this.setupDataTable();
> >        }
>
> >        private void setupDataTable() {
> >                myData = DataTable.create();
> >                myData.addColumn(ColumnType.STRING, "Country");
> >                myData.addColumn(ColumnType.NUMBER, "waarde");
> >        }
>
> >        public void addtoDataTable(String vak, int cijfer) {
> >                int rownr = myData.addRow();
> >                myData.setValue(rownr, 0, vak);
> >                myData.setValue(rownr, 1, cijfer);
> >        }
>
> >        public void fillDataTable() {
> >                myData.addRows(5);
> >                myData.setValue(0, 0, "NL");
> >                myData.setValue(0, 1, 100);
> >                myData.setValue(1, 0, "Germany");
> >                myData.setValue(1, 1, 50);
> >                myData.setValue(2, 0, "United States");
> >                myData.setValue(2, 1, 70);
> >                myData.setValue(3, 0, "UK");
> >                myData.setValue(3, 1, 150);
> >                myData.setValue(4, 0, "Spain");
> >                myData.setValue(4, 1, 125);
> >        }
>
> >        public DataTable getDataTable() {
> >                return myData;
> >        }
> > }
>
> > -
>
> > 
>
> > 
> >  
> >    
> >     > href="GWTvisualization.css">
> >    Web Application Starter Project
> >     > src="gwtvisualization/gwtvisualization.nocache.js">
> >  
>
> >  
>
> >    
> >     > style="position:absolute;width:0;height:0;border:0">
>
> >    http://www.google.com/jsapi";> > script>
> >