Package com.totsp.gwittir.client.jsni

Examples of com.totsp.gwittir.client.jsni.JavaScriptObjectDecorator


     
    });
  }
 
  public final void setLocal(String name, Map<String, String> values){
    JavaScriptObjectDecorator decorator = new JavaScriptObjectDecorator();
    for(Entry<String, String> entry : values.entrySet()){
      decorator.setStringProperty(entry.getKey(), entry.getValue() );
    }
    this.setLocalNative(name, decorator.getObject());
   
  }
View Full Code Here


    this.setLocalNative(name, decorator.getObject());
   
  }
 
  public final Map<String,String> getLocal(String name){
    JavaScriptObjectDecorator decorator = new JavaScriptObjectDecorator(this.getLocalNative(name));
    HashMap<String,String> results = new HashMap<String, String>();
    for(String key : decorator.getProperties() ){
      results.put(key, decorator.getStringProperty(key));
    }
    return results;
  }
View Full Code Here

            url +="id="+this.user+"&";
        }
        JSONServiceInvoker.invoke(url, "jsonFlickrFeed", new JSONCallback(){
            public void onJSONResult(JavaScriptObjectDecorator decorator) {
                setTitle( decorator.getStringProperty("title") );
                JavaScriptObjectDecorator items = decorator.getJavaScriptObjectProperty("items");
                List photos = new ArrayList();
                for( int i=0; i < items.getIntProperty("length"); i++ ){
                    JavaScriptObjectDecorator item = items.getJavaScriptObjectProperty(i+"");
                    FlickrPhoto p = new FlickrPhoto();
                    p.setTitle(item.getStringProperty("title") );
                    p.setMedium( item.getJavaScriptObjectProperty("media").getStringProperty("m"));
                    String author = item.getStringProperty("author");
                    author = author.substring( author.indexOf("(") + 1, author.lastIndexOf(")") );
                    p.setAuthor(author);
                    photos.add( p );
                }
                setPhotos(photos);
View Full Code Here

    public final JavaScriptObjectDecorator[] getRows(){
        JavaScriptObjectDecorator[] result = new JavaScriptObjectDecorator[this.getRowCount()];
        if( this.getRowCount() > 0){
          for(int i=0; i < result.length; i++ ){
              result[i] = new JavaScriptObjectDecorator( this.item(i));
          }
        }
        return result;
    }
View Full Code Here

        JavaScriptObject jsParams = convertParameters(parameters);
        this.nativeExecuteSql(sql, jsParams, callback);
    }

    private final static JavaScriptObject convertParameters(Object[] parameters) {
        JavaScriptObjectDecorator d = new JavaScriptObjectDecorator(JavaScriptObjectDecorator.newArray());

        for (int i = 0; (parameters != null) && (i < parameters.length); i++) {
            Object p = parameters[i];

            if (p instanceof String) {
                d.setStringProperty(Integer.toString(i), (String) p);
            } else if (p instanceof Integer) {
                d.setIntegerProperty(Integer.toString(i), (Integer) p);
            } else if (p instanceof Date) {
                d.setJavaScriptObjectProperty(Integer.toString(i),
                    longAsInt(Long.toString(((Date) p).getTime())));
            } else if (p instanceof Float) {
                d.setFloatProperty(Integer.toString(i), (Float) p);
            } else if (p instanceof Double) {
                d.setFloatProperty(Integer.toString(i), (Float) p);
            }
        }

        return d.getObject();
    }
View Full Code Here

        JavaScriptObject jsParams = convertParameters(parameters);
        this.nativeExecuteSql(sql, jsParams, callback);
    }

    private final static JavaScriptObject convertParameters(Object[] parameters) {
        JavaScriptObjectDecorator d = new JavaScriptObjectDecorator(JavaScriptObjectDecorator.newArray());

        for (int i = 0; (parameters != null) && (i < parameters.length); i++) {
            Object p = parameters[i];

            if (p instanceof String) {
                d.setStringProperty(Integer.toString(i), (String) p);
            } else if (p instanceof Integer) {
                d.setIntegerProperty(Integer.toString(i), (Integer) p);
            } else if (p instanceof Date) {
                d.setJavaScriptObjectProperty(Integer.toString(i),
                    longAsInt(Long.toString(((Date) p).getTime())));
            } else if (p instanceof Float) {
                d.setFloatProperty(Integer.toString(i), (Float) p);
            } else if (p instanceof Double) {
                d.setFloatProperty(Integer.toString(i), (Float) p);
            }
        }

        return d.getObject();
    }
View Full Code Here

    public final native int getRowCount()/*-{ return this.rows.length }-*/;

    public final JavaScriptObjectDecorator[] getRows(){
        JavaScriptObjectDecorator[] result = new JavaScriptObjectDecorator[this.getRowCount()];
        JavaScriptObjectDecorator instance = new JavaScriptObjectDecorator(this).getJavaScriptObjectProperty("rows");
        for(int i=0; i < result.length; i++ ){
            result[i] = instance.getJavaScriptObjectProperty(Integer.toString(i));
        }
        return result;
    }
View Full Code Here

TOP

Related Classes of com.totsp.gwittir.client.jsni.JavaScriptObjectDecorator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.