Re: attach listeners/handlers to widget, then do some DOM-stuff - listeners gone?

2011-11-25 Thread Tomasz Gawel
paste some code to enable more valid answer ;) ... but probably the
matter is the fragment below

 then i attach the whole thing to a div. everything works except the
 handlers - they simply are never called.

if you create a panel (and some widget in its hierarchy) an then
attach the panel's element to do DOM with use of plain DOM methods
the domHandlers will never be inited (or sinked in gwt-dialekt ;))
- look at onAttach and addDomHandler methods source of widget for
more :).

-- 
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: future of gwt who use gwt

2011-10-25 Thread Tomasz Gawel
hi thomas,

thanks for link to infoq article about dart - so... it seems my guess
is possibly right :) - but it's long long way ahead.

as to mentioned issue with hashmap - i find it feature rather than
problem. and that case is even not java-javascript but ie specific
implementation issue.
and as to gwt - since this is gwt group - i liked very much the idea
of cross-compilation and possibility of maintaining big client side
application in java. although it was gwt where i came across it the
first time. but than i was not sure about it should try to mimic
common java libraries. maybe sticking only to java raw language but
with browser specific libriries would be a better solution? libraries
that vastly utilize something like JavaScriptObject class in current
implementation? maybe the wrong business policy was to target with gwt
at existing java developers rather than motivate existing javascript
developers to learn java :)?
but no tool is perfect - especially from its begining - and
imporovements are natural (notice java collections).
gwt is still young, and java at its age was imho less convincing
technology. if it is not due any legal/licensing strategy than i would
stick to java in gwt... if i were gooogle ;).

as to mysql - nice to see it on app engine - but this fact does not
undermine the possibility of willingness to became independent from
oracle owned technology.
since mysql community server is open source and GPL licensed, google
is no way dependent on oracle in that case. situation with java is
quite different, and as i remember some time ago microsoft tried to
make its own java, what has been effectively stopped by sun's sue and
trial, utlimately resulting in birth of c# :).

-- 
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: jquery?

2011-10-25 Thread Tomasz Gawel
hi,

main gwt strong point is maintainability, team work support, and
refactoring support which comes from java and java tools (and are not
specific to gwt) and are not available in javascript and not possible
be available in javascript.

javascript is extremely flexible and powerful scripting language - but
it is scripting language and becomes a nightmare to maintain large
scale application or written by team especially by team with big
rotation.

-- 
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: future of gwt who use gwt

2011-10-24 Thread Tomasz Gawel

I still don't understand the need for dart.

if it would be cross-compiled so where is the advantage over gwt? in
gwt we have the language that we allready know and tools that were
worked out over years.
if it will be incorporated into browser as virtual machine than just
why not to incorporate the jvm? licensing issues?

and another thing - javascript is extremely powerful scripting
language. (as far as it is used for scripting - max 300 lines of code
it's flexibility is a real power. when comes to maintaining bigger
apps this flexibility occurs to be serious flaw, but it the place
where gwt enters the play.

as i look closer at DART i start to suspect that probably it is not to
replace javascript but to replace java (and so avoid dependence to
oracle)
but do they think they can provide something better than java which
gained its maturity over years?


-- 
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: JSNI - interactive chart

2011-10-15 Thread Tomasz Gawel
it seems that it is not possible to write iframe's content directly in
html.
you can add it programatically which seems even more convenient (but i
wanted to avoid it do to some inconsistency between browser as to when
cotnentDocument of an iframe becames available to code - there can
happen some delay in some browser and onload event is called event if
this iframe does not load any remote content.)
so with this precaution here's the code:


static class YourChart extends Widget {

private static final String API_URL = http://ajax.googleapis.com/
ajax/static/modules/gviz/1.0/chart.js;
private HandlerRegistration handlerRegistration;

public YourChart(JSONObject userConf) {
this(userConf.toString());
}

public YourChart(final String userConf) {
final IFrameElement elem =
Document.get().createIFrameElement();

setElement(elem);

if(elem.getContentDocument() == null ||
elem.getContentDocument().getBody() == null){

handlerRegistration = addDomHandler(new LoadHandler(){

@Override
public void onLoad(LoadEvent event) {
initFrame(elem, userConf);
}

}, LoadEvent.getType());
}
else {
initFrame(elem, userConf);
}
}

private void initFrame(IFrameElement elem, String userConf) {
if(handlerRegistration != null){
handlerRegistration.removeHandler();
handlerRegistration = null;
}
Document cDoc = elem.getContentDocument();
BodyElement body = cDoc.getBody();
ScriptElement script = cDoc.createScriptElement(API_URL);
script.setInnerText(userConf);
body.appendChild(script);
}
}

-- 
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: Global Event Bus ?

2011-10-14 Thread Tomasz Gawel
If you want to pass objects between to separately compiled gwt modules
via javascript it can only be object that extend JavaScriptObject or
primitives.
but these can also be your custom overlay objects defined on both
sides.
for example when  module A knows about
com.google.gwt.core.client.JsDate and module B knows it either they
can pass this object over javascript and overlay it properly as
JsDate extends JavaScriptObject, but it is not valid as to plain java
objects as they are (or most possibly are) differently compiled on
both sides.
If you need to share a plain java objects you can make a JavaScript
wrapper over it and pass the wrapper js object to another module which
can treat it as overlay object - but as you see it is rather a
emergency hack than the solution to be use extensively :).

-- 
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: Global Event Bus ?

2011-10-14 Thread Tomasz Gawel
package samples;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.JavaScriptObject;
import com.google.gwt.core.client.JsDate;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.json.client.JSONObject;
import com.google.gwt.json.client.JSONParser;
import com.google.gwt.json.client.JSONString;
import com.google.gwt.user.client.Timer;
import com.google.gwt.user.client.Window;

public class JsBus extends JavaScriptObject {

public static class JsHandlerRegistration extends JavaScriptObject
implements HandlerRegistration {
protected JsHandlerRegistration() {}
@Override
public native final void removeHandler() /*-{
this.removeHandler();
}-*/;
}

public static interface Callback {
void call(JavaScriptObject event);
}

public static final native JsBus getInstance() /*-{
var name = jsBusSingletonInstance;
return $wnd[name] || ($wnd[name] = (function(){
var _h = {};
return {
fire:function(key, evt){
if(_h[key]){
for(var 
i=0;i_h[key].length;i++){
try {
_h[key][i](evt);
}
catch(e) {}
}
}
},
addHandler:function(key, handler){
(_h[key] || (_h[key] = 
[])).push(handler);
return {
removeHandler:function(){
if(_h[key]){
for(var 
i=_h[key].length-1; i-1; i--){

if(_h[key][i] === handler){

_h[key].splice(i, 1);

if(_h[key].length == 0){

_h[key] = null;

delete _h[key];

}

return;
}
}
}
}
};
}
}
})());
}-*/;

protected JsBus() {}

public void fire(String key, JSONObject event) {
fire(key, event.getJavaScriptObject());
}

public native void fire(String key, JavaScriptObject event) /*-{
this.fire(key, event);
}-*/;

public native JsHandlerRegistration addHandler(String key, Callback
callback) /*-{
return this.addHandler(key, function(evt){

callback.@samples.JsBus.Callback::call(Lcom/google/gwt/core/client/
JavaScriptObject;)(evt);
});
}-*/;

}

class A implements EntryPoint {

@Override
public void onModuleLoad() {
final JsBus jsBus = JsBus.getInstance();
jsBus.addHandler(timer_in_b, new JsBus.Callback() {

@Override
public void call(JavaScriptObject event) {
Window.alert(event.JsDate 
cast().toLocaleTimeString());
}

});

new Timer() {

@Override
public void run() {
JSONObject event = new JSONObject();
event.put(message, new JSONString(Message 
from class A!));
event.put(data, JSONParser

.parseStrict({\someData\:[1,2,3]}));
jsBus.fire(event_from_A, event);
}
}.schedule(1);
}
}

class B implements EntryPoint {

@Override
public void onModuleLoad() {

final Timer timer = 

Re: JSNI - interactive chart

2011-10-13 Thread Tomasz Gawel
chart.js script uses document.write() to write chart markup. in case
you put this dynamically in your HTML Widget's it would reload the
page (document.write behaviour).
the only possibility to create it on runtime in gwt is to put it into
generated iframe.

-- 
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: JSNI - interactive chart

2011-10-13 Thread Tomasz Gawel
public class TestChart implements EntryPoint {

static class YourChart extends Widget {
private static final String HTML_BEGIN = htmlhead/
headbodyscript type=\text/javascript\ src=\http://
ajax.googleapis.com/ajax/static/modules/gviz/1.0/chart.js\;
private static final String HTML_END = 
/script/body/html;

public YourChart(JSONObject userConf) {
this(userConf.toString());
}
public YourChart(String userConf) {
IFrameElement elem = 
Document.get().createIFrameElement();
elem.setInnerHTML(HTML_BEGIN + userConf + HTML_END);
setElement(elem);
}

}

@Override
public void onModuleLoad() {
JSONObject conf = new JSONObject(getConf());
RootPanel.get().add(new YourChart(conf));
}

private static native JavaScriptObject getConf() /*-{
return {
dataSourceUrl: //location.to.document,
options: {
vAxes: [{
min: null,
title: Hits,
max: null
}],
cat: false,
title: someMetric,
titleX: Date,
backgroundColor: #FF,
legend: right,
logScale: false,
reverseAxis: false,
hAxis: {
maxAlternation: 1
},
hasLabelsColumn: true,
isStacked: false,
width: 600,
height: 371
},
state: {},
chartType: ColumnChart,
chartName: Chart 1
};
}-*/;

}

-- 
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: native callback going into the eternal void

2011-10-13 Thread Tomasz Gawel
use double ()()

@com.webfair.gwt.components.client.CalendarBox::test() is only the
signature of method
to call it use @com.webfair.gwt.components.client.CalendarBox::test()
();

-- 
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: Full page in GWT or just parts?

2011-10-12 Thread Tomasz Gawel
@Uemit
you can write one module to be used in all pages and use code
splitting feature to download only what is needed by the particular
page.
i do that this way.
another habit i worked out over years using gwt is to use onModuleLoad
method only to register js callbacks. how does the module behave on
particular page is then scripted in javascript. however i had to
slightly enhance bootstraping script :).
generally my pattern is to write whole client logic with gwt (using
code splitting and merging modules as much as possible) an then
slighlty script it on page to customize its behaviour.


-- 
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: Convert Java bean Object to JSON in GWT 2.4

2011-10-12 Thread Tomasz Gawel
As to JSON:
Have you tried Google GSON library ? http://code.google.com/p/google-gson/

And second question:
Do you really need JSON?
RequestFactory does not suit your case?
http://code.google.com/intl/pl/webtoolkit/doc/latest/DevGuideRequestFactory.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: Adding external jar to client side

2011-10-12 Thread Tomasz Gawel
to include external gwt library in jar:

1. library jar should have gwt.xml inside it with arbitrary name
identyfing the lib. for example
file named YourLibrary.gwt.xml with contents as below:
module
   inherits name='com.google.gwt.user.User'/
/module

2. gwt.xml file in project that uses it should inherit it with:
inherits name=your.jndi.path.package.YourLibrary/ !-- note the
name is the same as gwt.xml in jar and package the jndi path to where
it exists --

3. make sure your has the library jar in classpath (in eclipse set it
in porject properties or pass it to javac when compiling).

it should work ;)

-- 
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: Adding external jar to client side

2011-10-12 Thread Tomasz Gawel

sorry in point 3 not javac but java -cp gwt-dev.jar:your-lib.jar
com.google.gwt.dev.Compiler (replace :  with ; on win) as its not
compiled with javac :)

-- 
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: Why widgets arent more flexible? inner widget, inner html, etc..

2011-10-11 Thread Tomasz Gawel
hi,
look at this thread: 
http://groups.google.com/group/google-web-toolkit/browse_thread/thread/c134d12aadd1e4f8

if you want to create custom widget that treats its node's content in
the way HTMLPanel does you probably need to write ElementParser.
in this case look at this post: 
http://cafebab3.blogspot.com/2010/01/non-intrusive-gwt-2-mod-2nd-part.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: Custom UIBinder Widget, problem expecting only widgets

2011-10-10 Thread Tomasz Gawel
hi,
as far as gwt 2.1. HTMLPanel was treated somohow special by uibinder.
(i'm not sure if it hasn't changed in newer versions)
normally a widget in ui binder could contain text or html when
implemented hasText and hasHTML interfaces. then the content of the
node in ui.xml was parsed as text or html. however it was not allowed
to contain subwidgets. on the other hand side if a widget implemented
hasWidgets interface (so it was a panel :)) it contents in ui.xml has
been parsed as widgets to be added to that panel.
but HTMLPanel had its own dedicated parser in uibinder:
com.google.gwt.uibinder.elementparsers.HTMLPanelParser, which was
aware of how to parse both widgets-markup and plain-html. but widgets
which inherited from HTMLParser has not been handled by that parser.

but coming back to your particular example :) - if yuo only need a
html markup (not widgets) inside your widget, do not inherit from
HTMLPanel but use HTML widget instead, or Composite and implement
hasHTML.

-- 
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: iframe with GWT

2011-10-05 Thread Tomasz Gawel
and the example without a line of JSNI :)
but be aware of same-domain restriction when retrieving reference
iframe's content.

public class IframeStyleExample implements EntryPoint {

public static StyleElement addStyleSheet(FrameElement frameElement,
String cssText) {

Document contentDocument = frameElement.getContentDocument();
Element targetElement = 
contentDocument.getElementsByTagName(head)
.getItem(0);

if(targetElement == null){
targetElement = contentDocument.getDocumentElement()
.getFirstChildElement();

if(targetElement == null){
contentDocument.insertFirst(targetElement = 
contentDocument
.createElement(head));
}
}

StyleElement styleElement = 
contentDocument.createStyleElement();
styleElement.setType(text/css);
styleElement.setCssText(cssText);

targetElement.insertFirst(styleElement);

return styleElement;
}

@Override
public void onModuleLoad() {

final Frame frame = new Frame();

frame.addLoadHandler(new LoadHandler() {

@Override
public void onLoad(LoadEvent event) {
FrameElement frameElement = 
frame.getElement().cast();
addStyleSheet(frameElement,
div {background: #ff;});

}
});

}

}

-- 
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: How to intercept GWT RPC

2011-10-05 Thread Tomasz Gawel

If you work with spring you probably have a spring controller that
extends RemoteServiceServlet implementation. (look at this topic
comment)
you can stick interceptor on handleRequest method as normally in
Spring you would do :).

or if you need to get some piece of information from decoded payload -
you must override one of RemoteServiceServlet methods - but
interceptor would not be possible as they are called internally.

-- 
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: Using Spring servlets in GWT web apps

2011-10-03 Thread Tomasz Gawel
as to gwt-rpc simply make your RemoteServiceServlet implementation
also implement Spring's Controller interface. The rest goes
straightforward. Simply call doPost in your handleRequest
implementation and return null (no ModelAndView needed as doPost from
RemoteServiceServlet writes all needed directly into response).

for example see: 
http://code.google.com/p/google-web-toolkit-incubator/wiki/IntegratingWithSpring
(however the explanation (in comment) why to return null from
handleRequest seems to be incorrect for me)

as to other than rpc i simply used to paste module script tag into the
view (jsp or velocity) :).

-- 
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-contrib] Re: Hosted mode without plugin

2011-10-03 Thread Tomasz Gawel
Fresh idea.
and what about implementing debugger in an applet? :)

-- 
http://groups.google.com/group/Google-Web-Toolkit-Contributors


MVP widgets where to put support for i18n - into view or presenter

2011-08-19 Thread Tomasz Gawel
Hi,
as MVP pattern suits perfectly when it comes to designing gwt widgets
(e.g. widgets - as presenter and layout inner class as view - for
more about see http://www.youtube.com/watch?v=PDuhR18-EdM) i still
have a dillema where to put support for messages (with possibility to
change messages in runtime) - presenter or view? Please share your
experience in the subject if you could. :)
thanks.

ps. i use application-wide messeages incjected to uibinder templates
with ui:with field=... not automatically generated uibinder messages
- as i need them in java and templates.

-- 
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: UIBinder for inner class

2011-08-19 Thread Tomasz Gawel
use @UiTemplate annotation to point where the ui.xml file exists.
ui template can accept relative path or full package JNDI path
(however eclipse plugin sometimes behaves quirky with custom paths)

for example:

public class SomeWidget extends Composite {

public static interface UI {
Label getLabel();
TextBox getTextField();
Button getSaveButton();
}

public static class DefaultUI implements UI {

@UiTemplate(your.package.SomeWidget.ui.xml)
static interface DefaultUiBinder extends UiBinderHTMLPanel,
DefaultUI {}
static DefaultUiBinder defaultUiBinder =
GWT.create(DefaultUiBinder.class);




On 19 Sie, 10:15, saurabh saurabh saurabh.bl...@gmail.com wrote:
 Hi everyone,
                   I want know can we have UIBinder for inner class. If
 yes how to declare it.

-- 
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: MVP in the Real World

2011-08-19 Thread Tomasz Gawel
I used to implement every more complex widget as pair Presenter-View
(view as inner class).

-- 
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: JQuery like animation

2011-08-19 Thread Tomasz Gawel
1. But Animation class in gwt seems to be quite handy. All you need is
bunch of custom interpolation functions. But these are easy to be
taken from MooTools (i did take se below :)) - (easing functions in
jquery behave slightly different so simple rewriting it in java drops
off).

2. Manuel - great respect for GWT-Query - actually the biggest thing i
find missing in gwt is support for dom-programming and lack of built-
in selector engine. But I agree with Guy that jquery-like syntax is
not necessarily an advantage :)

/** from mootools **/
public static interface Interpolation {

public static class Power implements Interpolation {
protected double power;
public Power(double power){
this.power = power;
}
@Override public double interpolate(double progress) {
return Math.pow(progress, power);
}
}

public static class Back implements Interpolation {
protected double mute = 1.618;
public Back(double mute){
this.mute = mute;
}
@Override public double interpolate(double progress) {
return Math.pow(progress, 2) * ((mute + 1) * progress
- mute);
}
}

public static class Elastic implements Interpolation {
protected double mute = 1;
public Elastic(double mute) {
this.mute = mute;
}
@Override public double interpolate(double progress) {
return Math.pow(2, 10 * --progress) * Math.cos(20 *
progress * Math.PI * mute / 3);
}
}

public static final Interpolation ELASTIC = new Elastic(1);

public static final Interpolation BACK = new Back(1.618);

public static final Interpolation QUAD = new Power(2);

public static final Interpolation CUBIC = new Power(3);

public static final Interpolation QUART = new Power(4);

public static final Interpolation QUINT = new Power(5);

public static final Interpolation LINEAR = new Interpolation()
{
@Override public double interpolate(double progress) {
return progress;
}
};

public static final Interpolation EXPO = new Interpolation() {
@Override public double interpolate(double progress) {
return Math.pow(2, 8 * (progress - 1));
}
};

public static final Interpolation CIRC = new Interpolation() {
@Override public double interpolate(double progress) {
return 1 - Math.sin(Math.acos(progress));
}
};

public static final Interpolation SINE = new Interpolation() {
@Override public double interpolate(double progress) {
return 1 - Math.cos(progress * Math.PI / 2);
}
};

public static final Interpolation BOUNCE = new Interpolation()
{
@Override public double interpolate(double progress) {
double value;
for (double a = 0, b = 1; true; a += b, b /= 2){
if (progress = (7 - 4 * a) / 11){
value = b * b - Math.pow((11 - 6 * a - 11 *
progress) / 4, 2);
break;
}
}
return value;
}
};


double interpolate(double progress);
}

-- 
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: use ui:text from

2011-08-11 Thread Tomasz Gawel
not exactly,

ui:name and ui:description
are for messages that uibinder generates from templates (e.g.: the
default set messages - the other you should provide anyway as files).
the proper how-to is in the link to docs you gave above.

ui:text is used when you have messages in resources that you expose to
uibinder template. (which is for example what i prefer to do)
than you us eit like this:

ui:UiBinder xmlns:ui=urn:ui:com.google.gwt.uibinder
xmlns:g=urn:import:com.google.gwt.user.client.ui
ui:with field='msg'
type='com.tomaszgawel.client.YourWidget.Messages'/
g:HTMLPanel
   span
  ui:text from={msg.hello}/
/spans
g:InlineLabel text={msg.world} /
/g:HTMLPanel
/ui:UiBinder


in java you have sth like that:
public class YourWidget extends Composite {
//messages interface does not need to extend any of
com.google.gwt.i18n.client.* iterfaces but it probably will ;)

interface Messages extends ConstantsWithLookup {
String world();
String hello();
}

@UiField Messages msg; //messages must be ui:field - if you allready
have an instance of messages use @UiField(provided = true)

that's all :)

-- 
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: use ui:text from

2011-08-11 Thread Tomasz Gawel
but to the original question ;)

you don,t need ui:text markup at all :).
ui:text element has been introduced because you could not use
{messages.messageKey} in plain text not as attribute. as title is an
attribute it is not needed in that case.

just write:

span title={msg.yourTitleMessage}ui:text from={msg.someText} /
/span

-- 
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: Create Canvas widget from CanvasElement

2011-08-11 Thread Tomasz Gawel
i suppose it's a bug . in majority of widgets constructor with Element
argument is protected.
even a comment in source code of canvas it should be protected not
private:

  /**
   * Protected constructor. Use {@link #createIfSupported()} to create
a Canvas.
   */
  private Canvas(CanvasElement element) {
setElement(element);
  }

i think you should raise the issue in gwt-contributors group.

-- 
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: xxx.ui.xml is not in GWT client package

2011-07-27 Thread Tomasz Gawel
And did you try to take use of @UiTemplate annotation to point the
actual location of ui.xml file?

-- 
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: After using Context menu, how to trigger the browsers default one? (on, say, an image)

2011-07-27 Thread Tomasz Gawel
unregistering the ContextMenuHandler does not work?


I assume you have sth like this:

class YourWidget extends Composite implements ContextMenuHandler {

HandlerRegistration registration;

public YourWidget(){

final HTML html =
new HTML(divRight-click here please 
;)/div);
Button setCustomMenuButton = new Button(Set Custom Menu);
Button setNativeMenuButton = new Button(Set Native Menu);

setCustomMenuButton.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
registration = addDomHandler(YourWidget.this,
ContextMenuEvent.getType());
}
});

setNativeMenuButton.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
registration.removeHandler();
}
});

FlowPanel mainPanel = new FlowPanel();
initWidget(mainPanel);

mainPanel.add(html);
mainPanel.add(setCustomMenuButton);
mainPanel.add(setNativeMenuButton);

}

@Override
public void onContextMenu(ContextMenuEvent event) {
final int x = event.getNativeEvent().getClientX() +
Window.getScrollLeft();
final int y = event.getNativeEvent().getClientY() +
Window.getScrollTop();
final PopupPanel popup = new PopupPanel(true, true);
popup.add(new HTML(my context menu));
popup.setPopupPositionAndShow(new PositionCallback() {
@Override
public void setPosition(int offsetWidth,
int offsetHeight) {
popup.setPopupPosition(x, y);
}
});
}
}

-- 
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: Declare an array of panels in UiBinder

2011-07-25 Thread Tomasz Gawel
Assuming you do not use FocusPanel in other cases in this Widget just
anototate addSlot with @UiFactory and return newly created slot from
it:

@UiFactory FocusPanel void addSlot() {
final FocusPanel fp = new FocusPanel();
vp.add(fp);
return fp;
}


this will cause uibinder to call this method instead of FocusPanel's
constructor.

-- 
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: Declare an array of panels in UiBinder

2011-07-25 Thread Tomasz Gawel
Sorry i haven't noticed vp is panel not list ;)
so in java you have sth like that:

ListFocusPanel slots;
@UiField FlowPanel slotTargetPanel;

@UiFactory FocusPanel void addSlot() {
   FocusPanel slot = new FocusPanel();
   slots.add(slot);
   return slot;
}

in ui.xml:

!-- your root ui element --
g:HTMLPanel
div
pSome sample html .../p

g:FlowPanel ui:field=slotTargetPanel
g:FocusPanel/
g:FocusPanel/
g:FocusPanel/
/g:FlowPanel
!-- slots will contain now 3 elements --

g:HTMLSome sample widget/g:HTML
/div
/g:HTMLPanel


in fact slotTargetPanel is not needed for that - you could stick
Focuspanels anywhere in your ui file - as you have an uifactory method
for creatign FlowPanels.

-- 
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: Declare an array of panels in UiBinder

2011-07-25 Thread Tomasz Gawel
Yes, you're right. It's a mistake. I copied your method signature and
forgot to remove void after adding FocusPanel as a return type.

-- 
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: GWT frameworks?

2011-07-25 Thread Tomasz Gawel
still nobody mentioned gwt-query - which btw is truely a framework.
while i dont like it's jquery-like naming convention - i stay
impressed with the code itself, especially selector engine ;).
as to gxt and smart gwt - it was not sth i was looking for so i
abandoned using it.

gwt itself is a framework - and while i am not fully convinced to it's
swing-like widget/panel architecture (and gxt or smart gwt made it
even worse), i got used to it.
what i found really missing in gwt was selector engine. moreover, it's
fast growing framework, and thus leaving less area for frameworks.

pure javascript frameworks in much level originated from a necessity
to cover browser differences, and its it's not the case with 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: Declare an array of panels in UiBinder

2011-07-25 Thread Tomasz Gawel
Alex, But if your widgets are to be inserted at runtime what you
expect to define in uibinder template? a list or an array? it's not
the right place because these are visiual templates, and a visual
container for widgets is just a panel (or a div if u use htmlpanel as
root container),
Have i missed the point? but i don't understand the issue

-- 
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: Error in ant build

2011-07-24 Thread Tomasz Gawel
Petr,
.. but it seems you probably have a typo ;)
 property name=gwt.entrypoint.class
value=org.heller.build.demo.clien.AntBuildDemo / (or your packeage
has name clien not client ;))

-- 
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: Load compiled GWT module in a GWT application !

2011-07-23 Thread Tomasz Gawel
hi Saeed,

wrap a gagdet with iframe and public javascript api.
in application that loads the simply make native wrapper to gadget
api.


-- 
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: Sub-classing UiBinder based Widgets

2011-07-22 Thread Tomasz Gawel
@Alex,
When you extend Composite not Widget/UiObject, you init it with
initWidget() not setElement - you cannot provide UI implementations
that takes use of existing DOM Nodes in html page. without this
exception thera no other differences.

-- 
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: How to get readyState from GWT Frame object?

2011-07-22 Thread Tomasz Gawel
hi,

try something like this: (I'm not sure if there is any built in
solution but this native patch should work ;) )

public class ReadyStateWatch {
public static enum ReadyState {
COMPLETE {
@Override public String toString() { return complete; 
}
},
LOADING {
@Override public String toString() { return loading; }
},
INTERACTIVE {
@Override public String toString() { return 
interactive; }
},
UNINITIALIZED {
@Override public String toString() { return 
uninitialized; }
}
}
Frame iframe;

public ReadyStateWatch(Frame iframe){
this.iframe = iframe;
addNativeReadyStateWatch(this, 
iframe.getElement().IFrameElement
cast());
}

public HandlerRegistration addReadyStateChangeHandler(
ValueChangeHandlerReadyState handler) {
return iframe.addHandler(handler, ValueChangeEvent.getType());
}

public ReadyState getReadyState(){
try {
return
ReadyState.valueOf(iframe.getElement().getPropertyString(readyState));
}
catch (Exception e) {
return null;
}
}

@SuppressWarnings(unused) //used in native function
private void fireReadyStateChange(){
iframe.fireEvent(new 
ValueChangeEventReadyState(getReadyState())
{});
}

private static native void addNativeReadyStateWatch(ReadyStateWatch
self, IFrameElement e) /*-{
var handleStateChange = function(){

se...@com.your.package.ReadyStateWatch::fireReadyStateChange()();
};
if (e.addEventListener) {
e.addEventListener(onreadystatechange, 
handleStateChange, false);
}else if (e.attachEvent) {
e.attachEvent(onreadystatechange,handleStateChange);
}else{
e.onreadystatechange=handleStateChange;
}
}-*/;
}

-- 
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: How to get readyState from GWT Frame object?

2011-07-22 Thread Tomasz Gawel
and sample usage:

class UsageExample {
public static void useItLikeThat(){
Frame frame = new Frame(http://www.example.com/example.pdf;);
new ReadyStateWatch(frame).addReadyStateChangeHandler(
new ValueChangeHandlerReadyState() {
@Override public void 
onValueChange(ValueChangeEventReadyState
event) {
switch(event.getValue()){
case COMPLETE:
Window.alert(I am loaded);
break;
case INTERACTIVE:
case LOADING:
case UNINITIALIZED:
}
}
});
}
}

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