MVP nested presenters

2010-02-06 Thread Sydney
I try to implement the best practices discussed in the article "Large
scale application development and MVP". My application is designed
using several widgets:
MainContainerWidget: a DockLayoutPanel
NorthWidget: a widget in the north region of the main container
CenterWidget: a widget in the center region of the main container.
This widget is a composite of two widget (TopWidget and BottomWidget)
SouthWidget: a widget in the south region of the main container.

1/ I created a Presenter for each widget. The CenterPresenter contains
a TopPresenter and a BottomPresenter that are instanciated in the
constructor of CenterPresenter.

public CenterPresenter(HandlerManager eventBus, Display display) {
  this.eventBus = eventBus;
  this.display = display;
  topPresenter = new TopPresenter(eventBus, new TopWidget());
  bottomPresenter = new BottomPresenter(eventBus, new
BottomWidget());
}

@Override
public void go(HasWidgets container) {
bind();
container.clear();
container.add(display.asWidget());
}

private void bind() {
  topPresenter.bind();
  bottomPresenter.bind();
}

So basically when the CenterPresenter is created in the AppController
class, it would create all its child presenters and call the bind
methods. Does it seem a good approach or is there a better way?

-- 
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-tool...@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.



Click handler not called

2010-02-07 Thread Sydney
I have a problem with click handlers that are not called. I use the
MVP design explained in the article "Large scale application
development and MVP". I have a simple view which contains one button.
I also have another view that is just a container for that button.
It's just to simulate the problem. For each view I have a presenter.
In the AppController I have two ways to create the application, "test"
which uses the SimpleButtonPresenter, and "container" which uses the
ContainerPresenter. In the first case the handler is called but in the
second case it's not. The only difference between the two cases if
that in the second case, the button is inside a container. Do you have
an idea where the problem comes from?

AppController

public class AppController implements Presenter,
ValueChangeHandler {
private final HandlerManager eventBus;
private HasWidgets container;

public AppController(HandlerManager eventBus) {
this.eventBus = eventBus;
bind();
}

private void bind() {
History.addValueChangeHandler(this);
}

public void go(final HasWidgets container) {
this.container = container;

if ("".equals(History.getToken())) {
History.newItem("main");
} else {
History.fireCurrentHistoryState();
}
}

public void onValueChange(ValueChangeEvent event) {
String token = event.getValue();

if (token != null) {
Presenter presenter = null;

if (token.equals("main")) {
} else if ("test".equals(token)) {
presenter = new SimpleButtonPresenter(eventBus,
new SimpleButtonView());
} else if ("container".equals(token)) {
presenter = new ContainerPresenter(eventBus,
new ContainerView());
}

if (presenter != null) {
presenter.go(container);
}
}
}
}

The Views

public class SimpleButtonView extends Composite implements
SimpleButtonPresenter.Display {

private final Button btnClick;

public SimpleButtonView() {
DecoratorPanel container = new DecoratorPanel();
btnClick = new Button("Click Me");
container.add(btnClick);
this.initWidget(container);
}

@Override
public Widget asWidget() {
return this;
}

@Override
public HasClickHandlers getButton() {
return btnClick;
}

}

public class ContainerView extends Composite implements
ContainerPresenter.Display {

public ContainerView() {
DecoratorPanel container = new DecoratorPanel();
SimpleButtonView sbv = new SimpleButtonView();
container.add(sbv);
this.initWidget(container);
}

@Override
public Widget asWidget() {
return this;
}

}

The Presenters

public class SimpleButtonPresenter implements Presenter {

public interface Display {
HasClickHandlers getButton();

Widget asWidget();
}

private final HandlerManager eventBus;
private final Display display;

public SimpleButtonPresenter(HandlerManager eventBus, Display
view) {
this.eventBus = eventBus;
this.display = view;
}

@Override
public void go(HasWidgets container) {
bind();
container.clear();
container.add(display.asWidget());
}

public void bind() {
display.getButton().addClickHandler(new ClickHandler() {

@Override
public void onClick(ClickEvent event) {
System.out.println("Click");
}

});
}

}

public class ContainerPresenter implements Presenter {

public interface Display {
Widget asWidget();
}

private final HandlerManager eventBus;
private final Display display;
private final SimpleButtonPresenter simpleButtonPresenter;

public ContainerPresenter(HandlerManager eventBus, Display view) {
this.eventBus = eventBus;
this.display = view;
simpleButtonPresenter = new SimpleButtonPresenter(eventBus,
new SimpleButtonView());
}

@Override
public void go(HasWidgets container) {
bind();
container.clear();
container.add(display.asWidget());
}

public void bind() {
simpleButtonPresenter.bind();
}
}

-- 
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-tool...@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: MVP nested presenters

2010-02-08 Thread Sydney
Thanks for your insight. I was wondering how the flat lookup approach
would work. When the application starts the MainContainerPresenter
would be created and the go method would be called with a
RootLayoutPanel as a parameter. What I don't see is where the other
presenters would be created, and how to wire up everything together.
Also another topic I am experiencing problems is how to implement view
transition. For instance a click on a button can modify part of the
UI. I was thinking about using custom events (using the event bus)
that presenters would listen to.

On Feb 7, 12:17 pm, Jesse Dowdle  wrote:
> We have discussed this issue at length on our team, as we're building
> an application that will eventually grow to be quite large. There are
> certainly pros and cons to each approach (nesting presenters vs a flat
> lookup at the AppController level).
>
> Nested Pros
> Handy place to hook up a hierarchical location change framework
> Chain of responsibility for loading data (parents can load data from
> an rpc and pass it down to child presenters to ensure state is
> maintained)
> Easy re-use of groups of presenters, flexibility to mix and match.
> Plays well with nested display objects, so if you've got a TabPanel,
> each tab can be driven by a separate presenter and the panel itself
> can have a presenter to load data common to all tabs.
>
> Nested Cons
> Can be more difficult to analyze the layout of the application without
> a single class where all presenter relationships are defined
> Does not play well with view classes which have components that need
> to be driven by multiple presenters. For example, if you have a ui.xml
> with two main areas and you want a presenter to handle each, using
> nested presenters requires more spaghetti code that just having a
> couple of flat ones.
> It can be more difficult to write unit tests against parent
> presenters, because you have to take into account instantiation and
> operation of child presenters... This can impact the complexity of the
> mock objects you must create.
>
> Anyway, we've chosen to go with nested presenters, but I would say the
> vote on our team for this was split 4/2, so clearly even for us not
> everybody is in love with it.
>
> On Feb 5, 5:00 pm, Sydney  wrote:
>
>
>
> > I try to implement the best practices discussed in the article "Large
> > scale application development and MVP". My application is designed
> > using several widgets:
> > MainContainerWidget: a DockLayoutPanel
> > NorthWidget: a widget in the north region of the main container
> > CenterWidget: a widget in the center region of the main container.
> > This widget is a composite of two widget (TopWidget and BottomWidget)
> > SouthWidget: a widget in the south region of the main container.
>
> > 1/ I created a Presenter for each widget. The CenterPresenter contains
> > a TopPresenter and a BottomPresenter that are instanciated in the
> > constructor of CenterPresenter.
>
> >     public CenterPresenter(HandlerManager eventBus, Display display) {
> >       this.eventBus = eventBus;
> >       this.display = display;
> >       topPresenter = new TopPresenter(eventBus, new TopWidget());
> >       bottomPresenter = new BottomPresenter(eventBus, new
> > BottomWidget());
> >     }
>
> >     @Override
> >     public void go(HasWidgets container) {
> >         bind();
> >         container.clear();
> >         container.add(display.asWidget());
> >     }
>
> >     private void bind() {
> >       topPresenter.bind();
> >       bottomPresenter.bind();
> >     }
>
> > So basically when the CenterPresenter is created in the AppController
> > class, it would create all its child presenters and call the bind
> > methods. Does it seem a good approach or is there a better way?

-- 
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-tool...@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: MVP nested presenters

2010-02-08 Thread Sydney
For now I don't want to bring Gin or Guice into play because I want to
understand MVP. Then I will put DI to simplify things. Let's say I
have  a basic UI with a north region and a center region of a
DockLayoutPanel. The north region contains a button, when clicking
that button, the center region is updated. I defined the button and
the main layout by using UIBinder.





public class SimpleButtonWidget extends Composite implements
SimpleButtonPresenter.Display {

private static SimpleButtonWidgetUiBinder uiBinder =
GWT.create(SimpleButtonWidgetUiBinder.class);

interface SimpleButtonWidgetUiBinder extends
UiBinder {
}

@UiField
Button clickMeButton;

public SimpleButtonWidget() {
initWidget(uiBinder.createAndBindUi(this));
}

@Override
public Widget asWidget() {
return this;
}

@Override
public HasClickHandlers getButton() {
return clickMeButton;
}

}




public class MainAppContainer extends Composite implements
MainAppContainerPresenter.Display {

private static MainAppContainerUiBinder uiBinder =
GWT.create(MainAppContainerUiBinder.class);

interface MainAppContainerUiBinder extends
UiBinder {
}

@UiField
SimpleButtonWidget simpleButton;

public MainAppContainer() {
initWidget(uiBinder.createAndBindUi(this));
}

@Override
public Widget asWidget() {
return this;
}

}

Now the presenters:

public class SimpleButtonPresenter implements Presenter {

public interface Display {
HasClickHandlers getButton();

Widget asWidget();
}

private final HandlerManager eventBus;
private final Display display;

public SimpleButtonPresenter(HandlerManager eventBus, Display
view) {
this.eventBus = eventBus;
this.display = view;
}

@Override
public void go(HasWidgets container) {
bind();
container.clear();
container.add(display.asWidget());
}

public void bind() {
System.out.println(display.getButton().addClickHandler(
new ClickHandler() {

@Override
public void onClick(ClickEvent event) {
System.out.println("Click");
}

}));
System.out.println("Click Registered");
}

}

public class MainAppContainerPresenter implements Presenter {

public interface Display {
Widget asWidget();
}

private final HandlerManager eventBus;
private final Display display;

private final SimpleButtonPresenter simpleButtonPresenter;

public MainAppContainerPresenter(HandlerManager eventBus, Display
view) {
this.eventBus = eventBus;
this.display = view;
simpleButtonPresenter = new SimpleButtonPresenter(eventBus,
new SimpleButtonWidget());
}

@Override
public void go(HasWidgets container) {
bind();
container.clear();
container.add(display.asWidget());
}

public void bind() {
simpleButtonPresenter.bind();
}
}

The App Controller:
presenter = new MainAppContainerPresenter(eventBus, new
MainAppContainer());
presenter.go(container);

When the MainAppContainerPresenter is created, a MainAppContainer is
passed which also creates a SimpleButtonWidget. Now inside the
constructor of MainAppContainerPresenter, I create a
SimpleButtonPresenter along with a SimpleButtonWidget. I am sure I am
doing something wrong because I guess I should only create one
SimpleButtonWidget and it should be linked to the
SimpleButtonPresenter.

When I click on the button I want to update the center region of the
DockLayoutPanel. In the click handler I will fire a custom event using
the event bus. Who should listen to that event, the presenter that
will have to update its content, in that case
MainAppContainerPresenter? In the presenter which captures that event,
how do I get a hold of a specific region of the DockLayoutPanel in the
Display interface?

I am sorry to ask so much questions but I struggle with the MVP
pattern.

On Feb 8, 2:28 pm, Joe Cheng  wrote:
> On my project I used Gin to wire up nested presenters/views, it is very
> nice. I wouldn't dream of doing large-scale MVP now without dependency
> injection--it really takes a lot of tedious wiring code out. This book
> helped a lot for 
> me:http://www.amazon.com/Dependency-Injection-Dhanji-R-Prasanna/dp/19339...
>
>
>
> On Mon, Feb 8, 2010 at 10:55 AM, Sydney  wrote:
> > Thanks for your insight. I was wondering how the flat lookup approach
> > would work. When the application starts the MainContainerPresenter
> > would be created and the go method would be called with a
> > RootLayoutPanel as a parameter. What I don't see is where the other
> > presenters would be created, and how to wire u

Re: Click handler not called

2010-02-10 Thread Sydney
I found out the problem. When I created the SimpleButtonPresenter in
the ContainerPresenter constructor, I created the SimpleButtonView but
it was not the one displayed on the screen. The one displayed on the
screen was the one created in the ContainerView. The fix:

In ContainerPresenter:

public interface Display {
Widget asWidget();

SimpleButtonPresenter.Display getSimpleButtonDisplay();
}
In the constructor
simpleButtonPresenter = new SimpleButtonPresenter(eventBus,
display.getSimpleButtonDisplay());

In ContainerView:
@Override
public Display getSimpleButtonDisplay() {
return sbv;
}

On Feb 7, 10:51 am, Sydney  wrote:
> I have a problem with click handlers that are not called. I use the
> MVP design explained in the article "Large scale application
> development and MVP". I have a simple view which contains one button.
> I also have another view that is just a container for that button.
> It's just to simulate the problem. For each view I have a presenter.
> In the AppController I have two ways to create the application, "test"
> which uses the SimpleButtonPresenter, and "container" which uses the
> ContainerPresenter. In the first case the handler is called but in the
> second case it's not. The only difference between the two cases if
> that in the second case, the button is inside a container. Do you have
> an idea where the problem comes from?
>
> AppController
>
> public class AppController implements Presenter,
> ValueChangeHandler {
>     private final HandlerManager eventBus;
>     private HasWidgets container;
>
>     public AppController(HandlerManager eventBus) {
>         this.eventBus = eventBus;
>         bind();
>     }
>
>     private void bind() {
>         History.addValueChangeHandler(this);
>     }
>
>     public void go(final HasWidgets container) {
>         this.container = container;
>
>         if ("".equals(History.getToken())) {
>             History.newItem("main");
>         } else {
>             History.fireCurrentHistoryState();
>         }
>     }
>
>     public void onValueChange(ValueChangeEvent event) {
>         String token = event.getValue();
>
>         if (token != null) {
>             Presenter presenter = null;
>
>             if (token.equals("main")) {
>             } else if ("test".equals(token)) {
>                 presenter = new SimpleButtonPresenter(eventBus,
>                         new SimpleButtonView());
>             } else if ("container".equals(token)) {
>                 presenter = new ContainerPresenter(eventBus,
>                         new ContainerView());
>             }
>
>             if (presenter != null) {
>                 presenter.go(container);
>             }
>         }
>     }
>
> }
>
> The Views
>
> public class SimpleButtonView extends Composite implements
>         SimpleButtonPresenter.Display {
>
>     private final Button btnClick;
>
>     public SimpleButtonView() {
>         DecoratorPanel container = new DecoratorPanel();
>         btnClick = new Button("Click Me");
>         container.add(btnClick);
>         this.initWidget(container);
>     }
>
>     @Override
>     public Widget asWidget() {
>         return this;
>     }
>
>     @Override
>     public HasClickHandlers getButton() {
>         return btnClick;
>     }
>
> }
>
> public class ContainerView extends Composite implements
>         ContainerPresenter.Display {
>
>     public ContainerView() {
>         DecoratorPanel container = new DecoratorPanel();
>         SimpleButtonView sbv = new SimpleButtonView();
>         container.add(sbv);
>         this.initWidget(container);
>     }
>
>     @Override
>     public Widget asWidget() {
>         return this;
>     }
>
> }
>
> The Presenters
>
> public class SimpleButtonPresenter implements Presenter {
>
>     public interface Display {
>         HasClickHandlers getButton();
>
>         Widget asWidget();
>     }
>
>     private final HandlerManager eventBus;
>     private final Display display;
>
>     public SimpleButtonPresenter(HandlerManager eventBus, Display
> view) {
>         this.eventBus = eventBus;
>         this.display = view;
>     }
>
>     @Override
>     public void go(HasWidgets container) {
>         bind();
>         container.clear();
>         container.add(display.asWidget());
>     }
>
>     public void bind() {
>         display.getButton().addClickHandler(new ClickHandler() {
>
>             @Overr

[Newb] Local Datastore

2010-08-10 Thread Sydney
Hello

I want to setup a local datastore but I don’t know where I should put
the following code:
final LocalServiceTestHelper helper = new
LocalServiceTestHelper(
new
LocalDatastoreServiceTestConfig().setBackingStoreLocation(
"WEB-INF\\local-db.bin").setNoStorage(false));
helper.setUp();

Ideally I want that code to be executed at the startup of the
application.

Thanks

-- 
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-tool...@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.



Problem with subclass serialization

2010-08-24 Thread Sydney
I have RPC service that return an object of type GameEvent that
extends from Event (abstract). When I get the object on the client
side, all the properties inherited from Event (eventId, copyEventId,
gameTimeGMT) are set to null whereas on the server side, these
properties have values.

public class GameEvent extends Event implements IsSerializable {
private String homeTeam;
private String awayTeam;

public GameEvent() {
}

}

// Annotation are from the twig-persist framework which should not
impact the serialization process.
public abstract class Event implements IsSerializable {
@Key
private String eventId;
@Index
private String copyEventId;
private Date gameTimeGMT;
protected Event() {
}
}

-- 
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-tool...@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.



MVP pattern and dynamic widgets

2010-09-19 Thread Sydney
My question is related to the MVP pattern. I have a VerticalPanel in
which I add several CheckBox. The UI is build on the fly since it
depends on the user settings. The user clicks some of the checkboxes
and in my presenter I would like to know which one are selected. What
should I put in my view interface of the presenter. My current
approach is the following:

The presenter:

public interface MyView {
  HasWidgets getTagsContainer();
  void showTagsContainer(); // Do a setVisible in the view
  HasValue getCheckBox(int i); // Return the ith checkbox
}

// Build the UI in the fly
HasWidgets tagsContainer = getView().getTagsContainer();
tagsContainer.clear();
for (Tag tag : currentUser.getTags()) {
  tagsContainer.add(new CheckBox(tag.getTagName()));
}
getView().showTagsContainer();

The user clicks on some of the checkboxes

// Find the one which are checked
int i=0;
for(Tag tag: currentUser.getTags()) {
  boolean checked = getView().getCheckBox(i).getValue();
  i++;
}

What do you think of my approach? Is there a better way to achieve it?
I am learning the MVP pattern, so I try to get the best practices.

-- 
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-tool...@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: MVP pattern and dynamic widgets

2010-09-20 Thread Sydney
@daniel

I created the map but how do you register the value change handler on
the checkboxes? Do you do it in the view or in the presenter? My guess
is that it must be done in the presenter but how do you get a
reference to the checkboxes?

I was thinking of adding these methods in the view.

// Same as before but with Map creation
public void initTagsContainer(List tags) {
map = new HashMap
tagsContainer.clear();
for (Tag tag : tags) {
CheckBox checkbox = new CheckBox(tag.getTagName());
tagsContainer.add(checkbox);
map.put(tag, checkbox);
}
}

public List> getTagsCheckBoxes() {
  List> handlers = new
ArrayList>();
  for(Tag key:map.keySet()) {
handlers.add(map.get(key));
  }
  return handlers;
}

@cyij

Your approach is good. I might use it but before I want to see how I
can avoid the loop like daniel suggested.

On Sep 19, 10:01 pm, احمد عبدلله  wrote:
> 2010/9/19, Sydney :
>
>
>
> > My question is related to the MVP pattern. I have a VerticalPanel in
> > which I add several CheckBox. The UI is build on the fly since it
> > depends on the user settings. The user clicks some of the checkboxes
> > and in my presenter I would like to know which one are selected. What
> > should I put in my view interface of the presenter. My current
> > approach is the following:
>
> > The presenter:
>
> > public interface MyView {
> >   HasWidgets getTagsContainer();
> >   void showTagsContainer(); // Do a setVisible in the view
> >   HasValue getCheckBox(int i); // Return the ith checkbox
> > }
>
> > // Build the UI in the fly
> > HasWidgets tagsContainer = getView().getTagsContainer();
> > tagsContainer.clear();
> > for (Tag tag : currentUser.getTags()) {
> >   tagsContainer.add(new CheckBox(tag.getTagName()));
> > }
> > getView().showTagsContainer();
>
> > The user clicks on some of the checkboxes
>
> > // Find the one which are checked
> > int i=0;
> > for(Tag tag: currentUser.getTags()) {
> >   boolean checked = getView().getCheckBox(i).getValue();
> >   i++;
> > }
>
> > What do you think of my approach? Is there a better way to achieve it?
> > I am learning the MVP pattern, so I try to get the best practices.
>
> > --
> > 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-tool...@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.

-- 
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-tool...@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.



InterfaceGenerator and @external

2010-10-02 Thread Sydney
I use the InterfaceGenerator with my CSS file but the output is not a
valid Java class. The goal is to style all my Button so I
redefined .gwt-Button
Do you have the same issue?

test.css
@external .gwt-Button {
padding: 6px 10px;
}


The call
InterfaceGenerator -standalone -typeName
com.app.client.view.MyCssDebug -css src/com/app/client/view/test.css

The output

// DO NOT EDIT
// Automatically generated by
com.google.gwt.resources.css.InterfaceGenerator
package com.app.client.view;
import com.google.gwt.resources.client.CssResource;
import com.google.gwt.resources.client.CssResource.ClassName;
interface MyCssDebug extends CssResource {

  @ClassName("10px;\r\n")
  String 0px();

  @ClassName("6px")
  String px();

  @ClassName("gwt-Button")
  String gwtButton();

  @ClassName("{\r\n padding:")
  String Padding();
}

-- 
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-tool...@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: InterfaceGenerator and @external

2010-10-02 Thread Sydney
My CSS file was wrong. I fixed it. Sorry for the trouble.

@external gwt-Button;

.gwt-Button {
padding: 6px 10px;
}



On Oct 2, 5:43 pm, Sydney  wrote:
> I use the InterfaceGenerator with my CSS file but the output is not a
> valid Java class. The goal is to style all my Button so I
> redefined .gwt-Button
> Do you have the same issue?
>
> test.css
> @external .gwt-Button {
>         padding: 6px 10px;
>
> }
>
> The call
> InterfaceGenerator -standalone -typeName
> com.app.client.view.MyCssDebug -css src/com/app/client/view/test.css
>
> The output
>
> // DO NOT EDIT
> // Automatically generated by
> com.google.gwt.resources.css.InterfaceGenerator
> package com.app.client.view;
> import com.google.gwt.resources.client.CssResource;
> import com.google.gwt.resources.client.CssResource.ClassName;
> interface MyCssDebug extends CssResource {
>
>   @ClassName("10px;\r\n")
>   String 0px();
>
>   @ClassName("6px")
>   String px();
>
>   @ClassName("gwt-Button")
>   String gwtButton();
>
>   @ClassName("{\r\n        padding:")
>   String Padding();
>
>
>
>
>
>
>
> }

-- 
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-tool...@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.



equals and hashCode methods server and client side

2010-12-03 Thread Sydney
Hello,

I organized my project using a standard approach:
src/client
src/server
src/shared

I put my model classes into src/shared because they are used in RPC
calls. In some of them I generated the equals and hashCode methods
using eclipse. Then when I run my app I have an exception about
Float.floatToIntBits() method that does not exist in Float. I
understand why I got this exception because that method is not
supported client side. So I was wondering how I could replace that
method.

Snippet of hashCode(); alpha and beta are defined as float.

@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + Float.floatToIntBits(alpha);
result = prime * result + Float.floatToIntBits(beta);
result = prime * result
+ ((timestamp == null) ? 0 : timestamp.hashCode());
return result;
}

-- 
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-tool...@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.



CellBrowser reset and sizing

2010-12-12 Thread Sydney
I have a CellBrowser that gets populated correctly. It has 3 levels of
data. I would like to be able to reset the state of the CellBrowser.
At the init, only level 1 is displayed but after the user does some
selections, all 3 levels are displayed. I have a reset button that
when you click on it should reset the CellBrowser and shows only level
1, level 2 and 3 should disappear. Refreshing the model does not
repaint the widget. Is it possible to reset the widget without
recreating it?

I also would like to be able to set the size (width) of the different
level. First and second columns would be 25/25 and the last one 50%.

Thanks

-- 
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-tool...@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.



Manipulate localized date on the server side

2010-12-12 Thread Sydney
I want to track when a facility has been accessed, so I have a class
Facility that contains a List. The dates are stored in the
datastore just by calling a new Date() on the server side, so they are
stored in GMT timezone.

Now different people wants report on how many times a month the
facility has been accessed. The tricky part is that they want it in
their timezones.

For instance the facility has been accessed on 12/01 at 1:30 AM GMT

The event occurs in December for someone who lives in the UK but in
November for someone in the US. The report would show:
UK locale: November 0 December 1
US locale: November 1 December 0

My Facility class is in the shared folder so it can be used client and
server side. I have a RPC call that reads all entries and count them by
month. The problem is that the dates are in GMT, so the event above
will be counted for December for all users. Also I can’t use Calendar,
SimpleDateFormat, neither DateTimeFormat.

Another way to do that is to return the list of dates to the client,
and do the counting client side, so I can use DateTimeFormat, so the
date would be localized. The problem is that it increases the amount of
data sent over the wire.

So How do you manipulate GMT dates on the server side when the result
should be localized?


Thanks

-- 
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-tool...@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: Manipulate localized date on the server side

2010-12-14 Thread Sydney
Well not much response on that topic, so let me explain in a better way my 
problem. I have the class Facility in shared folder (client and server).

public class Facility {
  private List logs;
  // getter, setter
}

public class Log {
  private Date date;
  // getter, setter
}

I would like to run this method server side. Right now it does not take 
account for locale and is a method of Facility:

public Map countAccess() {
  SimpleDateFormat smf = new SimpleDateFormat("M");
  Map mapAccess = new HashMap();
  for(Log log: logs) {
String currentMonth = smf.format(log.getDate());
Integer count = mapAccess.get(currentMonth);
if(count == null) {
  count = 1;
}
mapAccess.put(currentMonth, count);
  }
  return mapAccess;
}

The facility has been accessed only once on 12/01/10 at 1:30 GMT, several 
users would have different report:
locale en-US: November 1, December 0
locale fr-FR: Novembre 0, Decembre 1

1/ I understand that to use this algorithm it needs to be executed on the 
server side, but the method is part of an object Facility that can be shared 
client and server side. Where should I put this method to be able to run it 
on the server side? Also this version does not use any locale, so how can I 
get the client locale?

2/ Another solution is to return the list of date and run the algorithm on 
the client side by using DateTimeFormat but I am wondering if it's a good 
solution since you have to send a lot of data over the wire.

Thanks

-- 
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-tool...@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: Manipulate localized date on the server side

2010-12-15 Thread Sydney
My problem is not really how to store the date. I store them as GMT. My 
question is more about where should I run the code to process these dates in 
a localized manner. Either I do it on the server side to avoid sending too 
much data over the wire. In that case I need to get the client locale and 
timezone. Or I do it on the client side and I just have to process the date 
with DateTimeFormat. I think the first solution is more efficient in term of 
data transfered but the second one is easier to implement.

-- 
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-tool...@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: Manipulate localized date on the server side

2010-12-16 Thread Sydney
So I ended up grabbing the client timezone:

private String getClientTimezone() {
Date now = new Date();
String timezone = DateTimeFormat.getFormat("").format(now);
return timezone;
}

and pass it to my action and on the server side 

Calendar cal = Calendar.getInstance(TimeZone.getTimeZone(timezone));

to convert the GMT time to the client timezone.

-- 
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-tool...@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.



TreeViewModel and AsyncDataProvider

2010-12-25 Thread Sydney
I have a 3 level CellBrowser. Everything is working fine using a 
ListDataProvider except that it's too long to grab the data from the server. 
So I want to use the AsyncDataProvider to fetch only the data that the user 
actually needs. Basically what I want to do is when the user selects the 
level1 value, the level2 provider executes a RPC call to get the level2 data 
based on the selected level1 parent. The problem is that the onRangeChanged 
method is called before the onSelectionChange, so when the RPC call is done 
the level1 value is still null. What is the proper way to use 
AsyncDataProvider to grab the level2 data depending on the level1 selected 
value?


public class SportTreeModel implements TreeViewModel, Handler {
  private AsyncDataProvider level1Provider;
  private AsyncDataProvider level2Provider;
  private final SingleSelectionModel level1SelectionModel;
  // In the construtor I create these objets
  // In getNodeInfo I link a cell with the data provider and the selection 
model
  
@Override
public void onSelectionChange(SelectionChangeEvent event) {
Object src = event.getSource();
if (src == level1SelectionModel) {
Level1Node level1 = level1SelectionModel.getSelectedObject();
((MyAsyncLevel2Provider) 
level2Provider).setLevel1(level1.getValue());
}
}
}

Thanks



-- 
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-tool...@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: TreeViewModel and AsyncDataProvider

2010-12-26 Thread Sydney
Perfect I overlooked the fact that when the level1 node is selected, the 
call to getNodeInfo provides the current seleced level1 node.
Thanks 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-tool...@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.



CellTable SelectionCell or only text within a column

2011-02-11 Thread Sydney
In a column of a CellTable I would like to display either a combo box list 
or just a String depending on the value. I could just disable the combo box 
in the case I don't want the value to be editable but I was wondering if 
there was a way to display different type of cell (SelectionCell and 
Cell) depending on a value.

-- 
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.



Hash user id from Users service

2011-03-13 Thread Sydney
Hello, 

In one of my RPC, I return the user ID, so it is available client side. The 
documentation states that we should hash this user ID.

*Note:* Every user has the same user ID for all App Engine applications. If 
your app uses the user ID in public data, such as by including it in a URL 
parameter, you should use a hash algorithm with a "salt" value added to 
obscure the ID. Exposing raw IDs could allow someone to associate a user's 
activity in one app with that in another, or get the user's email address by 
coercing the user to sign in to another app.

The way it would work is to hash the ID server side and send the hashed ID 
to the client. When the client send the information back, the server would 
unhash the ID. My point is that the hash/unhash operations are done on the 
server. Now what algorithm should I use?

Thanks
Sydney

-- 
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.



apache commons-math

2011-05-08 Thread Sydney
I want to use the Fraction and FractionFormat from apache commons-math on 
the client side but the lib is not compatible with GWT.

[ERROR] [portfolio] - Line 82: No source code is available for type 
org.apache.commons.math.fraction.FractionFormat; did you forget to inherit a 
required module? 
[ERROR] [portfolio] - Line 83: No source code is available for type 
org.apache.commons.math.fraction.Fraction; did you forget to inherit a 
required module?

The only operations I need are:
Create a Fraction from a double and vice-versa
Format the Fraction as a String

Is there a port of that lib for GWT? If not I guess I will need to write it 
by myself, do you know the name of the algorithm used by that library.

-- 
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.



Action on a ImageResourceCell

2011-05-29 Thread Sydney
In a CellTable, I want to show an image, and when the user clicks on it, I 
remove the row from the table. I created a custom cell that extends from 
ImageResourceCell, but I don't know how to process the click:

public ClickableImageResourceCell() {
consumedEvents = new HashSet();
consumedEvents.add("click");
}

@Override
public Set getConsumedEvents() {
return consumedEvents;
}

@Override
public void onBrowserEvent(Context context, Element parent,
ImageResource value, NativeEvent event,
ValueUpdater valueUpdater) {
super.onBrowserEvent(context, parent, value, event, valueUpdater);
if ("click".equals(event.getType())) {
onEnterKeyDown(context, parent, value, event, valueUpdater);
}
}

@Override
protected void onEnterKeyDown(Context context, Element parent,
ImageResource value, NativeEvent event,
ValueUpdater valueUpdater) {
if (valueUpdater != null) {
valueUpdater.update(value);
}
}

-- 
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: Action on a ImageResourceCell

2011-05-31 Thread Sydney
I actually followed this tutorial and now it works fine: 
http://webcentersuite.blogspot.com/2011/03/custom-gwt-clickable-cell-with-images.html

-- 
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: Action on a ImageResourceCell

2011-05-31 Thread Sydney
In a CellTable

-- 
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: Action on a ImageResourceCell

2011-06-01 Thread Sydney
See my implementation:
http://pastie.org/2003461
http://pastie.org/2003467

The call to add the column:

// Remove Bet Column
ClickableImageResourceCell removeCell = new 
ClickableImageResourceCell();
Column removeColumn = new Column(removeCell) {
@Override
public YourObject getValue(YourObject obj) {
return obj;
}
};
removeCell.setUpdater(this);


I use a ValueUpdater instead of a FieldUpdater. The class containing the 
CellTable implements ValueUpdater, I guess you can do the same 
with FieldUpdater.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/Y0htcThZVUp2ekVK.
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.



RequestFactory exception when creating a proxy

2011-06-03 Thread Sydney
An exception is thrown when I try to create a proxy:

myRequestProvider.get().create(MyDomainDomain.class);

java.lang.IllegalArgumentException: Unknown proxy type 
com.app.shared.proxy.MyDomainProxy
at 
com.google.web.bindery.requestfactory.shared.impl.AbstractRequestContext.createProxy(AbstractRequestContext.java:411)
at 
com.google.web.bindery.requestfactory.shared.impl.AbstractRequestContext.create(AbstractRequestContext.java:401)

with MyDomainProxy

@ProxyFor(MyDomain.class)
public interface MyDomainProxy extends EntityProxy {

String getProperty();

void setProperty(String property);

}


and MyDomain class

// DatastoreObject handles a Long id and a version
public class MyDomain extends DatastoreObject {

private String property;

public MyDomain() {
}

public String getProperty() {
return property;
}

public void setProperty(String property) {
this.property = property;
}

}

Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/cm14eFBoakdUVkVK.
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.



RequestFactory proxy displayed by a CellTable

2011-06-05 Thread Sydney
I have a domain object defined as:

public class MyObject {
  private AnotherObject property;
  ... // getters/setters
}

I have a custom cell defined as:

public class MyTextColumn extends TextColumn {
@Override
public String getValue(MyObjectProxy my) {
return Util.getAsString(my.getProperty);
}
}

I have a ListDataProvider associated to a CellTable.

To create a MyObjectProxy I do:

MyRequest request = MyRequestProvider.get();
MyObjectProxy x = request.create(MyObjectProxy.class);
AnotherObjectProxy y = request.create(AnotherObject.class);
x.setProperty(y);
...

I add this object to the list data provider and it works fine. Now if I do 
the same thing again (2 MyObjectProxy in the list), the cell table return an 
IllegalArgumentException in the return Util.getAsString(my.getProperty);. I 
tried to use the same request to create all the proxies but I have the same 
exception.

java.lang.IllegalArgumentException: Attempting to edit an EntityProxy 
previously edited by another RequestContext

I want to be able to create a List of MyObject proxy and display them in a 
CellTable. When the user is done adding the MyObject(s), he will click on a 
button that will persists the all these MyObject. 

Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/REktbGhheE81azBK.
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: RequestFactory proxy displayed by a CellTable

2011-06-06 Thread Sydney
I use the same MyRequest object to create the proxies. I don't call any fire 
method because I want to create all MyObjectProxy proxies and then save them 
in one call. The reason I need to do that is that I want to process them 
before saving them. Basically the sequence is the following:

create 1 proxy
add it to the list data provider
WORKS fine
create another proxy with the same request
add it to the list data provider (so now I have 2)
EXCEPTION thrown by the custom column

I don't get the exception because I am not editing the proxy, the exception 
is on a getter.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/SGpTbDk0NXhwcFVK.
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: RequestFactory proxy displayed by a CellTable

2011-06-06 Thread Sydney
I fixed the problem, I was using another request to modify a proxy. Since 
the request were different, it causes the exception.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/bUIwS2V4ZWpCeG9K.
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.



Different type for rows in a CellTable

2011-06-10 Thread Sydney
I want to display a list of Order in a CellTable along with the detail of 
each order. In that example I have 2 orders that each has 2 products.

06/10/2011 | Order # 1505 | | | $150.00
Empty | Product 1 | 5 | 10 | $50.00
Empty | Product 2 | 10 | 10 | $100.00
05/10/2011 | Order # 1504 | | | $150.00
Empty | Product 1 | 5 | 10 | $50.00
Empty | Product 2 | 10 | 10 | $100.00

Is there a way to display different type for rows in a CellTable? The 
CellTable would be a CellTable. OrderProxy contains a 
List.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/9FB8lAC99H4J.
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.



RequestFactory Injection in the Locator

2011-06-19 Thread Sydney
I need to inject a DatastoreObject (Twig) into a Locator. The problem is 
that the Locator is created by a clazz.newInstance() method so the default 
constructor is used.

public class TwigLocator extends Locator {

   private ObjectDatastore datastore;

   public TwigLocator() {
   System.out.println(datastore);
   }

   @Inject
   public TwigLocator(final ObjectDatastore datastore) {
   this.datastore = datastore;
   }

}

>From LocatorServiceLayer

 private  T newInstance(Class clazz, Class base) {
   Throwable ex;
   try {
 return clazz.newInstance();
   } catch (InstantiationException e) {
 ex = e;
   } catch (IllegalAccessException e) {
 ex = e;
   }
   return this. die(ex,
   "Could not instantiate %s %s. Is it default-instantiable?",
   base.getSimpleName(), clazz.getCanonicalName());
 }

Do you know how I can modify the way the Locator is created? I guess 
creating the Locator this way would call the constructor with injection public 
TwigLocator(final ObjectDatastore datastore)

private  T newInstance(Class clazz, Class base) {

return GuiceConfig.getInjectorReference().getInstance(clazz); 
}

Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/GCeBIBTuC8MJ.
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: Not getting value for nested proxy

2011-06-22 Thread Sydney
See http://code.google.com/webtoolkit/doc/latest/DevGuideRequestFactory.html
 
When querying the server, RequestFactory does not automatically populate 
relations in the object graph. To do this, use the with() method on a 
request and specify the related property name as a String:

I guess you are missing the with part.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/MWupyHH1GNUJ.
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.



CellBrowser RF The requested entity is not available on the server

2011-06-29 Thread Sydney
I have a CellBrowser with RF to fetch the data. I have 3 levels (A, B, C), 
when selecting a value in the A list, the correct B list shows correctly. 
Then when selecting a value in the B list, I got this exception:

Caused by: java.lang.RuntimeException: Server Error: The requested entity is 
not available on the server
at 
com.google.web.bindery.requestfactory.shared.Receiver.onFailure(Receiver.java:36)

@Override
protected void onRangeChanged(HasData display) {
final Range range = display.getVisibleRange();
// b is the selected value from the B list of type BProxy
cRequestProvider.get().fetchRange(range.getStart(),
range.getLength(), b).fire(...);

I tried to do the same request but without the b parameter, and I don't have 
the exception anymore. So I guess it's coming from the b proxy. Do you have 
any idea?

@Override
protected void onRangeChanged(HasData display) {
final Range range = display.getVisibleRange();
cRequestProvider.get().fetchRange1(range.getStart(),
range.getLength()).fire(...);

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/kuaIKcnRuE4J.
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.



RequestFactory several locators for a domain object

2011-07-13 Thread Sydney
I want to be able to use different locators for the same domain object. I 
use Twig and it has an option to load an object fully or partially. When I 
run the lite request, the wrong locator (TwigLocator) is used instead of 
TwigLiteLocator. My current implementation is:

Proxies

@ProxyFor(value = MyDomain.class, locator = TwigLocator.class)
public interface MyDomainProxy extends EntityProxy {}

@ProxyFor(value = MyDomain.class, locator = TwigLiteLocator.class)
public interface MyDomainLiteProxy extends EntityProxy {}

Request

@Service(value = MyDao.class, locator = DaoServiceLocator.class)
public interface MyRequest extends RequestContext {
Request> fetchRange(Integer start, Integer length);
Request getCount();
Request> fetchRangeLite(Integer start, Integer 
length);
}

DAO

public List fetchRange(Integer start, Integer length) {
  ...   
}

public List fetchRangeLite(Integer start, Integer length) {
  ...   
}


-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/QsOW5kNGwo4J.
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: format dates in specific timezone

2011-08-25 Thread Sydney
TimeZone.createTimeZone(TimeZoneInfo.buildTimeZoneData(TimeZoneConstants.europeParis()));
Not tested

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/2CFXq7ELh9EJ.
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: format dates in specific timezone

2011-08-25 Thread Sydney
If you want to use GMT+1 timezone style I guess you need to do some kind of 
mapping.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/VadH7rLAvHUJ.
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.



Display imported data on the client side

2011-09-06 Thread Sydney
I need to build an import feature for my app. I use gwtupload to send the 
file to the server and process it. The processing creates domain objects 
that needs to be displayed on the client side.

CSV file
name, age
Jim, 14
John, 34
Sue, 45
after processing I would have a list of 3 Person object.

I use RequestFactory so my domain object (Person) are on the server, and I 
have proxies (PersonProxy) on the client side. My first idea was to use JSON 
but then I don’t think it will be possible to create the proxies from the 
JSON. My other idea was to store the created domain objects and then remove 
the ones that the user does not want to import. The server would send the 
ids of the "temporary" stored objects to the client and then on the client I 
would send a RF request to fetch the objects and get the proxies.

How would you pass the created domain objects from the server to the client?
Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/ZzdX443be38J.
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.



Request Factory and com.google.appengine.api.datastore.Text type

2011-09-10 Thread Sydney
In my application the user can upload a CSV file to import data. The first 
implementation was to process the content on the server side. The issue is 
that it can take more than 30s to process, so I decided to do the processing 
on the client side. The process consists in extracting data from the file 
and present them to the user, so he can decide what to import.

With the new implementation the file is uploaded and the content is saved in 
the datastore as a com.google.appengine.api.datastore.Text. When the upload 
is done, the client gets the id of an object called ImportResult that 
contains some information on the uploaded file. Now I want to get the 
content of that file to process, so I have a RF call to get an 
ImportResultProxy object: importResultRequest.readById(importId).fire(new 
Receiver() {...}). The issue is that the Text type is not 
valid for a proxy. So I was wondering how you would do to get the content of 
the uploaded file.

public class ImportResult extends DatastoreObject implements Serializable {
private Text content;
@Index
private Date timestamp;
}

@ProxyFor(value = ImportResult.class, locator = TwigLocator.class)
public interface ImportResultProxy extends EntityProxy {
Long getId();
Text getContent();
}

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/D_y2ozMGF7EJ.
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: Request Factory and com.google.appengine.api.datastore.Text type

2011-09-11 Thread Sydney
The reason is that String are limited to 500 characters in the datastore. 
Using a TextArea could be a solution. Anyway I would be interested in trying 
the upload on the client side. Do you ave any pointers on getting the file's 
content on the client-side. I googled it but found nothing except some .NET 
Active X solution.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/CArCvPfB9LAJ.
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: Request Factory and com.google.appengine.api.datastore.Text type

2011-09-11 Thread Sydney
I also found that link that is saying it's not possible. The link is pretty 
recent: 
http://stackoverflow.com/questions/6599023/gwt-client-side-file-uploads

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/xKUt8Uj8dB4J.
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.



RequestFactory: Share a method between the client and the server

2012-02-11 Thread Sydney
Hello, 

I want to run the same method on the client and server side. The reason is 
that the user can call that method when interacting with the UI, but the 
same method can also be called at a later time by a Task on the server 
side. I already wrote the method using the proxy object. I wanted to know 
if there is a way to call the same method on the server side (no proxy) 
without duplicating the code. 

What is the best practice?

Example:

MyObject is a domain object in the server package
MyObjectProxy is the proxy for MyObject

The method that uses the proxies called on the client side.
public static int sum(MyObjectProxy proxy) {
  return proxy.getA() + proxy.getB();
}

I want the same method but for the server side with the following signature:
public static int sum(MyObject domain) {
  return domain.getA() + domain.getB();
}

Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/q4mCoAKYy4kJ.
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: RequestFactory Could not parse payload: payload[0] = N

2013-02-06 Thread Sydney
If you have a test case to reproduce that issue, you can provide it to that 
issue on google app engine: 
https://code.google.com/p/googleappengine/issues/detail?id=8471

On Friday, January 18, 2013 9:23:52 PM UTC+1, El Mentecato Mayor wrote:
>
> I should have thought of that, sorry. Unfortunately (fortunately for me), 
> I don't see the error anymore. Lots of things changed in the mean time 
> (source code and db schema) as this project is under heavy development. 
> Yes, I could go back-trace using my repository and maybe make it fail 
> again, but time is a scarce commodity, so I choose to continue development.
>
> I did notice one anomaly the day it happened, not sure it's related to the 
> issue; I had a copy of a src directory under my WEB-INF folder, (I blame 
> eclipse, but who knows, could have been user-error; me), which I deleted. 
> I'll make sure to capture the payload if I see this again.
>
>
> On Wednesday, January 16, 2013 1:47:11 PM UTC-5, Thomas Broyer wrote:
>>
>> Would be great if any of you could log the request payload when this 
>> error happens.
>> In the mean time, we might want to modify the RequestFactoryServlet to 
>> log the payload when there's an unrecoverable error, in addition to the 
>> exception.
>> Could you please open an issue? (if there's none already)
>>
>> On Wednesday, January 16, 2013 7:08:44 PM UTC+1, El Mentecato Mayor wrote:
>>>
>>> Just saw this error myself as well, slightly different message:
>>>
>>> Unexpected error: java.lang.RuntimeException: Could not parse payload: 
>>> payload[0] = I
>>>
>>> using GWT 2.5 and no GAE. Stacktrace is exactly the same though. Don't 
>>> know why or what it means, just that I get it so far when a specific 
>>> request is made. Has anybody found out what this means?
>>>
>>> On Monday, January 14, 2013 11:17:27 AM UTC-5, Nick Siderakis wrote:
>>>>
>>>> Hey Sydney, I've been seeing the same error message recently. Did you 
>>>> figure it out?
>>>>
>>>>
>>>> On Saturday, July 28, 2012 3:46:00 PM UTC-4, Sydney wrote:
>>>>>
>>>>> After deploying my app on appengine, I get the following exception: 
>>>>>
>>>>> com.google.web.bindery.requestfactory.server.RequestFactoryServlet 
>>>>> doPost: Unexpected error
>>>>> java.lang.RuntimeException: Could not parse payload: payload[0] = N
>>>>> at 
>>>>> com.google.web.bindery.autobean.vm.impl.JsonSplittable.create(JsonSplittable.java:70)
>>>>> at 
>>>>> com.google.web.bindery.autobean.shared.impl.StringQuoter.create(StringQuoter.java:46)
>>>>> at 
>>>>> com.google.web.bindery.autobean.shared.ValueCodex$Type$7.encode(ValueCodex.java:122)
>>>>> at 
>>>>> com.google.web.bindery.autobean.shared.ValueCodex.encode(ValueCodex.java:315)
>>>>> at 
>>>>> com.google.web.bindery.autobean.shared.impl.AutoBeanCodexImpl$ValueCoder.extractSplittable(AutoBeanCodexImpl.java:500)
>>>>> at 
>>>>> com.google.web.bindery.autobean.shared.impl.AbstractAutoBean.setProperty(AbstractAutoBean.java:277)
>>>>> at 
>>>>> com.google.web.bindery.autobean.vm.impl.ProxyAutoBean.setProperty(ProxyAutoBean.java:253)
>>>>> at 
>>>>> com.google.web.bindery.autobean.vm.impl.BeanPropertyContext.set(BeanPropertyContext.java:44)
>>>>> at 
>>>>> com.google.web.bindery.requestfactory.server.Resolver$PropertyResolver.visitValueProperty(Resolver.java:154)
>>>>> at 
>>>>> com.google.web.bindery.autobean.vm.impl.ProxyAutoBean.traverseProperties(ProxyAutoBean.java:289)
>>>>> at 
>>>>> com.google.web.bindery.autobean.shared.impl.AbstractAutoBean.traverse(AbstractAutoBean.java:166)
>>>>> at 
>>>>> com.google.web.bindery.autobean.shared.impl.AbstractAutoBean.accept(AbstractAutoBean.java:101)
>>>>> at 
>>>>> com.google.web.bindery.requestfactory.server.Resolver.resolveClientValue(Resolver.java:395)
>>>>> at 
>>>>> com.google.web.bindery.requestfactory.server.SimpleRequestProcessor.processInvocationMessages(SimpleRequestProcessor.java:483)
>>>>> at 
>>>>> com.google.web.bindery.requestfactory.server.SimpleRequestProcessor.process(SimpleRequestProcessor.java:225)
>>>>> at 
>>>>> com.google.web.bindery.requestfactory.server.SimpleRequestProcessor.process(SimpleRequestProcessor.java:127)
>>>>> at 
>>>>> com.google.web.bindery.requestfactory.server.RequestFactoryServlet.doPost(RequestFactoryServlet.java:133)
>>>>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
>>>>>
>>>>> Any idea of what the exception means? Thanks
>>>>>
>>>>

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




Thread Management with Request Factory

2012-04-22 Thread Sydney
I am interested in the thread management when using request factory. I 
organize my server code in a way that a business service depends on a DAO 
layer that depends on an object datastore instance (object on which you can 
call datastore operations - I use Twig).

On the client side when I fire a request, the service locator creates a new 
instance of the service along with its dependencies in the same Thread. I 
tried to run the same request every 15 seconds. I noticed that the service 
is only created once, not per request. I also noticed that after a certain 
number of times, the Thread changed. This is an issue for me because Twig 
requires that the object datastore must be run in the same Thread as the 
one it was created.

Is it the normal behaviour? if not what could be the reason?

Log trace (the number is the thread id):
29: New service from service locator
29: New Dao
29: Using datastore 
com.google.code.twig.annotation.AnnotationObjectDatastore@7fba5980
29 New class MyServiceImpl
29: Call service method
29: Using datastore 
com.google.code.twig.annotation.AnnotationObjectDatastore@7fba5980
29: Call service method
29: Using datastore 
com.google.code.twig.annotation.AnnotationObjectDatastore@7fba5980
29: Call service method
29: Using datastore 
com.google.code.twig.annotation.AnnotationObjectDatastore@7fba5980
29: Call service method
29: Using datastore 
com.google.code.twig.annotation.AnnotationObjectDatastore@7fba5980
29: Call service method
29: Using datastore 
com.google.code.twig.annotation.AnnotationObjectDatastore@7fba5980
29: Call service method
29: Using datastore 
com.google.code.twig.annotation.AnnotationObjectDatastore@7fba5980
29: Call service method
29: Using datastore 
com.google.code.twig.annotation.AnnotationObjectDatastore@7fba5980
22: Call service method
22: Using datastore 
com.google.code.twig.annotation.AnnotationObjectDatastore@7fba5980
Datastore Thread: 29 - Current Thread: 22 

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/D35OPVzOP9MJ.
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: Paypal Integration / JNSI

2012-05-28 Thread Sydney
public static native void paypalClose() /*-{
if (top && top.opener && top.opener.top) {
top.opener.top.dgFlow.closeFlow();
top.close();
} else if (top) {
top.dgFlow.closeFlow();
top.close();
}
}-*/;


On Sunday, May 27, 2012 8:21:25 PM UTC+2, Mayumi wrote:
>
> How did you end up fixing this?
>
> On Saturday, 12 May 2012 08:41:58 UTC-5, Sydney wrote:
>>
>> I use the Paypal Adaptive API. So far I managed to display the paypal 
>> page using a lightbox. But I have a problem when trying to close the 
>> lightbox. I failed in Step 4
>>
>> *3. Include the PayPal JavaScript functions from dg.js.*
>> *
>> *
>> *https://www.paypalobjects.com/js/external/dg.js"</a>;>*
>> **
>> *
>> *
>> *4. Create an embedded flow object and associate it with your payment 
>> form or button.*
>> *
>> *
>> **
>> *var dgFlow = new PAYPAL.apps.DGFlow({ trigger: 'submitBtn' });*
>> **
>> *
>> *
>> *After Completing This Task:
>> *
>> *
>> *
>> *On the pages you identify as the return and cancel URLs in the Pay API 
>> operation, you must*
>> *include the PayPal JavaScript functions from dg.js and close the PayPal 
>> window, as in the*
>> *following example:*
>> *
>> *
>> *dgFlow = top.dgFlow || top.opener.top.dgFlow;*
>> *dgFlow.closeFlow();*
>> *top.close();*
>>
>> *What I did:*
>>
>> For step 4, I call the following JNSI method:
>>
>> private native void paypalLight() /*-{
>> var dgFlow = new $wnd.PAYPAL.apps.DGFlow({
>> trigger : 'submitBtn'
>> });
>> }-*/;
>>
>> The paypal page is displayed in the lightbox, than I click the cancel 
>> button. My cancelURL is 
>> http://127.0.0.1:/xxx.html?gwt.codesvr=127.0.0.1:9997#!homePage;cancel=trueand
>>  in this page I process the cancel parameter by calling the following 
>> JNSI:
>>
>> public static native void paypalClose() /*-{
>> dgFlow = $wnd.top.dgFlow || $wnd.top.opener.top.dgFlow;
>> dgFlow.closeFlow();
>> $wnd.top.close();
>> }-*/;
>>
>> When I cancel the transaction, the cancelUrl gets called, and the 
>> paypalClose method is called. I get the error: (TypeError): $wnd.top.opener 
>> is null.
>>
>> Any ideas?
>> Thanks
>>
>>
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/BxOaaYXbf08J.
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: Paypal Integration / JNSI

2012-05-28 Thread Sydney
When the user cancels or finishes the purchase, Paypal redirects the user 
to a page within the iframe or popup window. My cancel URL looks like this 
http://127.0.0.1:/xxx.html?gwt.codesvr=127.0.0.1:9997#!homePage;cancel=true.
 
I am using GWTP so the following code should give you an idea on how it 
works:

@Override
public void prepareFromRequest(PlaceRequest placeRequest) {
super.prepareFromRequest(placeRequest);
String cancel = placeRequest.getParameter("cancel", "");
if ("true".equals(cancel)) {
paypalClose();
}
}

public static native void paypalClose() /*-{
if (top && top.opener && top.opener.top) {
top.opener.top.dgFlow.closeFlow();
top.close();
} else if (top) {
top.dgFlow.closeFlow();
top.close();
}
}-*/;

top.close() will close the paypal flow (iframe or popup window).

On Monday, May 28, 2012 5:06:23 PM UTC+2, Mayumi wrote:
>
> Thank you so much for the reply!
>
> So you're calling JSNI above from the return/cancel page correct?
> If so are you doing something like window.parent. paypalClose() from 
> inside the IFRAME that paypal insert
> the return/cancel pages from?
>
> Thanks!
>
> On Monday, 28 May 2012 03:42:58 UTC-5, Sydney wrote:
>>
>> public static native void paypalClose() /*-{
>> if (top && top.opener && top.opener.top) {
>> top.opener.top.dgFlow.closeFlow();
>> top.close();
>> } else if (top) {
>> top.dgFlow.closeFlow();
>> top.close();
>> }
>> }-*/;
>>
>>
>> On Sunday, May 27, 2012 8:21:25 PM UTC+2, Mayumi wrote:
>>>
>>> How did you end up fixing this?
>>>
>>> On Saturday, 12 May 2012 08:41:58 UTC-5, Sydney wrote:
>>>>
>>>> I use the Paypal Adaptive API. So far I managed to display the paypal 
>>>> page using a lightbox. But I have a problem when trying to close the 
>>>> lightbox. I failed in Step 4
>>>>
>>>> *3. Include the PayPal JavaScript functions from dg.js.*
>>>> *
>>>> *
>>>> *https://www.paypalobjects.com/js/external/dg.js"</a>;>*
>>>> **
>>>> *
>>>> *
>>>> *4. Create an embedded flow object and associate it with your payment 
>>>> form or button.*
>>>> *
>>>> *
>>>> **
>>>> *var dgFlow = new PAYPAL.apps.DGFlow({ trigger: 'submitBtn' });*
>>>> **
>>>> *
>>>> *
>>>> *After Completing This Task:
>>>> *
>>>> *
>>>> *
>>>> *On the pages you identify as the return and cancel URLs in the Pay 
>>>> API operation, you must*
>>>> *include the PayPal JavaScript functions from dg.js and close the 
>>>> PayPal window, as in the*
>>>> *following example:*
>>>> *
>>>> *
>>>> *dgFlow = top.dgFlow || top.opener.top.dgFlow;*
>>>> *dgFlow.closeFlow();*
>>>> *top.close();*
>>>>
>>>> *What I did:*
>>>>
>>>> For step 4, I call the following JNSI method:
>>>>
>>>> private native void paypalLight() /*-{
>>>> var dgFlow = new $wnd.PAYPAL.apps.DGFlow({
>>>> trigger : 'submitBtn'
>>>> });
>>>> }-*/;
>>>>
>>>> The paypal page is displayed in the lightbox, than I click the cancel 
>>>> button. My cancelURL is 
>>>> http://127.0.0.1:/xxx.html?gwt.codesvr=127.0.0.1:9997#!homePage;cancel=trueand
>>>>  in this page I process the cancel parameter by calling the following 
>>>> JNSI:
>>>>
>>>> public static native void paypalClose() /*-{
>>>> dgFlow = $wnd.top.dgFlow || $wnd.top.opener.top.dgFlow;
>>>> dgFlow.closeFlow();
>>>> $wnd.top.close();
>>>> }-*/;
>>>>
>>>> When I cancel the transaction, the cancelUrl gets called, and the 
>>>> paypalClose method is called. I get the error: (TypeError): 
>>>> $wnd.top.opener 
>>>> is null.
>>>>
>>>> Any ideas?
>>>> Thanks
>>>>
>>>>
>>>>
>>>>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/PA18WxkN3MoJ.
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 2.4 Javascript exception when selecting an element in a CellBrowser

2012-07-28 Thread Sydney


My application works fine in DevMode but after deployment on appengine, I 
get JavascriptException. I have a CellBrowser with 3 levels. What is 
strange is that the exception only occurs on some element of the first and 
third level. The behavior is correct, meaning that when I select a first 
level element, the corresponding elements shows in the second level. I have 
a class that implements UncaughtExceptionHandler where I log the stack 
trace: 

@Override
public void onUncaughtException(Throwable e) {
StringBuffer sb = new StringBuffer();

sb.append("Exception type: " + e.getClass()).append("\n");
sb.append("Message: ").append(e.getMessage()).append("\n");
Window.alert(sb.toString());
if (e instanceof JavaScriptException) {

Window.alert("JSException");
if (e.getStackTrace().length == 0) {
e.fillInStackTrace();
}
sb.append(e.getClass()).append(" - ").append(e.getMessage()).append(
"\n");
for (StackTraceElement stackTrace : e.getStackTrace()) {
sb.append(stackTrace.getClassName()).append(".").append(
stackTrace.getMethodName()).append("(").append(
stackTrace.getFileName()).append(":").append(
stackTrace.getLineNumber()).append(")");
sb.append("\n");
}
Window.alert(sb.toString());
}

When the exception occurs after selecting one element of the CellBrowser, 
the log is: 

Exception type: class com.google.gwt.core.client.JavaScriptException
Message: (TypeError): Cannot read property 'firstChild' of undefined
class com.google.gwt.core.client.JavaScriptException - (TypeError): Cannot read 
property 'firstChild' of undefined
Unknown.com_google_gwt_dom_client_DOMImpl_$getFirstChildElement__Lcom_google_gwt_dom_client_DOMImpl_2Lcom_google_gwt_dom_client_Element_2Lcom_google_gwt_dom_client_Element_2(null:-1)
Unknown.com_google_gwt_user_cellview_client_CellBrowser$BrowserCellList_getCellParent__Lcom_google_gwt_dom_client_Element_2Lcom_google_gwt_dom_client_Element_2(null:-1)
Unknown.com_google_gwt_user_cellview_client_CellList_resetFocusOnCell__Z(null:-1)
Unknown.com_google_gwt_user_cellview_client_AbstractHasData$View$1_execute__V(null:-1)
Unknown.com_google_gwt_core_client_impl_SchedulerImpl_runScheduledTasks__Lcom_google_gwt_core_client_JsArray_2Lcom_google_gwt_core_client_JsArray_2Lcom_google_gwt_core_client_JsArray_2(null:-1)
Unknown.com_google_gwt_core_client_impl_SchedulerImpl_$flushPostEventPumpCommands__Lcom_google_gwt_core_client_impl_SchedulerImpl_2V(null:-1)
Unknown.com_google_gwt_core_client_impl_SchedulerImpl$Flusher_execute__Z(null:-1)
Unknown.com_google_gwt_core_client_impl_SchedulerImpl_execute__Lcom_google_gwt_core_client_Scheduler$RepeatingCommand_2Z(null:-1)
Unknown.com_google_gwt_core_client_impl_Impl_apply__Ljava_lang_Object_2Ljava_lang_Object_2Ljava_lang_Object_2Ljava_lang_Object_2(null:-1)
Unknown.com_google_gwt_core_client_impl_Impl_entry0__Ljava_lang_Object_2Ljava_lang_Object_2Ljava_lang_Object_2Ljava_lang_Object_2(null:-1)

Do you know if it's a problem with my code, or if it's a GWT compiler bug? 

I also try to run the compiled version of my app locally but I always get 
the message `GWT module may need to be (re)compiled). I don't understand 
because in Eclipse click I run the Gwt Compile Project command.

Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/GUGZlTjhQkwJ.
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.



RequestFactory Could not parse payload: payload[0] = N

2012-07-28 Thread Sydney


After deploying my app on appengine, I get the following exception: 

com.google.web.bindery.requestfactory.server.RequestFactoryServlet doPost: 
Unexpected error
java.lang.RuntimeException: Could not parse payload: payload[0] = N
at 
com.google.web.bindery.autobean.vm.impl.JsonSplittable.create(JsonSplittable.java:70)
at 
com.google.web.bindery.autobean.shared.impl.StringQuoter.create(StringQuoter.java:46)
at 
com.google.web.bindery.autobean.shared.ValueCodex$Type$7.encode(ValueCodex.java:122)
at 
com.google.web.bindery.autobean.shared.ValueCodex.encode(ValueCodex.java:315)
at 
com.google.web.bindery.autobean.shared.impl.AutoBeanCodexImpl$ValueCoder.extractSplittable(AutoBeanCodexImpl.java:500)
at 
com.google.web.bindery.autobean.shared.impl.AbstractAutoBean.setProperty(AbstractAutoBean.java:277)
at 
com.google.web.bindery.autobean.vm.impl.ProxyAutoBean.setProperty(ProxyAutoBean.java:253)
at 
com.google.web.bindery.autobean.vm.impl.BeanPropertyContext.set(BeanPropertyContext.java:44)
at 
com.google.web.bindery.requestfactory.server.Resolver$PropertyResolver.visitValueProperty(Resolver.java:154)
at 
com.google.web.bindery.autobean.vm.impl.ProxyAutoBean.traverseProperties(ProxyAutoBean.java:289)
at 
com.google.web.bindery.autobean.shared.impl.AbstractAutoBean.traverse(AbstractAutoBean.java:166)
at 
com.google.web.bindery.autobean.shared.impl.AbstractAutoBean.accept(AbstractAutoBean.java:101)
at 
com.google.web.bindery.requestfactory.server.Resolver.resolveClientValue(Resolver.java:395)
at 
com.google.web.bindery.requestfactory.server.SimpleRequestProcessor.processInvocationMessages(SimpleRequestProcessor.java:483)
at 
com.google.web.bindery.requestfactory.server.SimpleRequestProcessor.process(SimpleRequestProcessor.java:225)
at 
com.google.web.bindery.requestfactory.server.SimpleRequestProcessor.process(SimpleRequestProcessor.java:127)
at 
com.google.web.bindery.requestfactory.server.RequestFactoryServlet.doPost(RequestFactoryServlet.java:133)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)

Any idea of what the exception means? Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/XAVb0BF6u9AJ.
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: GWT 2.4 Javascript exception when selecting an element in a CellBrowser

2012-08-02 Thread Sydney
The problem was "Why I get this exception for no reason?". I finally fixed 
the issue by redeploying the application and cleaning the browser cache.

On Wednesday, August 1, 2012 12:48:56 AM UTC+2, Joseph Lust wrote:
>
> Sydney,
>
> Do you know if it's a problem with my code, or if it's a GWT compiler bug?
>
>
> Trying to understand the issue here. You are trying to catch uncaught 
> exceptions, and display your customized error, right? What you provided as 
> the output looks pretty close to what I'd expect the code you wrote to do. 
> Can you explain how this trace is different from the message you're trying 
> to create, that is, what the 'problem' is?
>
>
>
> Sincerely,
> Joseph
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/kKb2Sc2XN4wJ.
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: facebook authentication

2012-08-09 Thread Sydney
https://github.com/fernandezpablo85/scribe-java/

On Tuesday, August 7, 2012 4:37:44 PM UTC+2, aamonten wrote:
>
> Hi,
> developing an app and would like to use facebook api to do user 
> authentication. Does any has a pointer about how to do this integrated with 
> GWT?
>
> thanks
> Alejandro
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/5lpNJMCAm0YJ.
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: GWT future

2012-08-09 Thread Sydney
gwtp should release a 0.8 or 1.0 version soon. 
See https://groups.google.com/d/topic/gwt-platform/h-4KPGKFIoM/discussion

On Wednesday, August 8, 2012 10:23:04 PM UTC+2, David wrote:
>
> That would be gwt-platform as in "gwtP"  
> http://code.google.com/p/gwt-platform.
>
> I'm not looking for comparisons to other MVP solutions.  I'm just 
> wondering if gwtP is something that will continue to be developed.
> thanks.  
>
>
>
> On Wednesday, August 8, 2012 1:20:19 PM UTC-4, Stevko wrote:
>>
>> David,
>> Its a "BUY-long"  on my list. 
>> Seeing the huge line of peeps waiting for the "history & future" session 
>> was a sure signal that there is a lot of interest (outside of google).
>> The volume of GWT recruiter hits on my LinkedIn profile means there is 
>> new work being done,
>> Moving to an external F/OSS respository and master commiters will 
>> increase the velocity of the framework rather than waiting months & years 
>> for google to vet the commits to protect the stability of their internal 
>> systems.  (see my signature for my philosophy) 
>> Not to say its a sure bet. Growing up is hard to do...
>>
>>
>>
>> On Wed, Aug 8, 2012 at 7:56 AM, David  wrote:
>>
>>> Anyone have insight as to the future of gwt-platform?
>>>
>>>
>>
>>
>> -- 
>> -- A. Stevko
>> ===
>> "If everything seems under control, you're just not going fast enough." 
>> M. Andretti
>>
>>
>>
>>
>>
>>  

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/Nen0TW0U0G8J.
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.