Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Members are not added to VStack in deployed mode

    Hello,

    I've written a VSTack extending widget that downloads tweets from Twitter, and shows them in a timeline (I created a Timeline widget that is). I created a custom DataSource that does the hooking up to the Twitter API, to integrate with SmartGWT DataBoundComponents easier.

    Now here's the strange thing: it works on development mode, not on deployed mode, eventhough:

    1. The SmartClient Dev Console says that the RPC worked, and that the tweets arrived at the client. Also, some log statements tell me there are 20 items in the RecordList.
    2. There is definitely code that adds it to a container (Each tweet is a custom Widget, and it definitely gets added to the Timeline VStack)
    3. Deployed mode Dev Console says that the DOM is empty, ie. tweets are not added to the VStack.
    4. The logs indicate that this loop is not executed, eventhough it should, because the first log statement does say 'Fetched 20 tweets from Twitter':

    Code:
    Log.debug("Fetched: "+rl.getLength()+ " tweets from Twitter."); //rl.getLength() logs to be '20'
    tweets.clear();
    for(int i = 0; i < rl.getLength(); i++){
        Record r = rl.get(i);
        Log.debug("Tweet with id: "+r.getAttributeAsString("id")); //this statement is never logged.
        TwitterEntryWidget w = new TwitterEntryWidget(r,post);
        tweets.put(r.getAttributeAsString("id"), w);
        timeline.addEntry(r.getAttributeAsDate("createdAt"), w, TWITTER, r.getAttribute("id"), r.getAttribute("tweet"));
    
    }
    
    //timeline.addEntry does the adding to the VStack, using addMember()
    I am using SmartClient Version: SC_SNAPSHOT-2011-11-10/PowerEdition Deployment (built 2011-11-10)

    In similar fashion I implemented a Facebook connection that shows FB messages in a timeline. In fact they get aggregated in a single timeline. And the FB things DO work, while architecture-wise they are similar.

    Any idea what this could be? I know this is not a testcase, but are there Developer Console settings that I can use to investigate what happens?
    Last edited by Sytematic; 16 Nov 2011, 05:56.

    #2
    From this little information, the only thing we can suggest is that invalid mixing of core GWT widgets / API calls (eg RootPanel.clear()) has caused GWT to delete the SmartGWT-generated DOM. If you look at the Watch Tab and see that SmartGWT is showing the component hierarchy as you expect but there's just no DOM at all, this is very likely to be the reason.

    Comment


      #3
      I got more information by adding more log statements.

      It looks like, on creation of the first TwitterEntryWidget (a widget showing one tweet), this goes wrong, and fails silently:

      Code:
      public static String addSpanElements(String tweet, String id){
      		//parse the tweet var for links, #hashtags, @usernames
      		// add <span>'s around it, that can be styled 
      				
      		//parse hashtags
      		tweet = tweet.replaceAll("([\\s]*)[#]+([\\w]+)", "$1<span id=\"hashtag___"+id+"___$2\" class=\"social-dashboard-twitter-hashtag\">#$2</span>"); // the ( ) capture the tag in a backreference $1
      	//parse usernames
      		tweet = tweet.replaceAll("([\\s]*)[@]+([\\w]+)", "$1<span id=\"user___"+id+"___$2\" class=\"social-dashboard-twitter-user\">@$2</span>"); // the ( ) capture the tag in a backreference $1
      		//parse links
      		tweet = tweet.replaceAll("(?i)\\b((?:[a-z][\\w-]+:(?:/{1,3}|[a-z0-9%])|www\\d{0,3}[.]|[a-z0-9.\\-]+[.][a-z]{2,4}/)(?:[^\\s()<>]+|\\(([^\\s()<>]+|(\\([^\\s()<>]+\\)))*\\))+(?:\\(([^\\s()<>]+|(\\([^\\s()<>]+\\)))*\\)|[^\\s`!()\\[\\]{};:'\".,<>?«»“”‘’]))", "<a href=\"$0\" target=\"_blank\">$0</a>");
      		
      		return tweet;
      }
      that is supposed to add some classnames etc to the tweets (the result of this static method serves as contents in a HTMLFLow object). Appearantly these replaceAll functions and regular expressions fail silently, or do not work when deployed (which makes sense since JS regexes are not exactly teh same as Java regexes, i guess).

      I removed them for the time being.

      Thanks for the previous response.
      Last edited by Sytematic; 16 Nov 2011, 11:51.

      Comment

      Working...
      X