code: @Override
    public void updateFromUIDL(UIDL uidl, ApplicationConnection client)
    {
  
      // This call should be made first. 
      // It handles sizes, captions, tooltips, etc. automatically.
      if(client.updateComponent(this, uidl, true))
      {
        // If client.updateComponent returns true there has been no changes and we
        // do not need to update anything.
        return;
      }
  
      // Save reference to server connection object to be able to send
      // user interaction later
      //this.gClient = client;
  
      // Save the client side identifier (paintable id) for the widget
      //paintableId = uidl.getId();
  
      if(context != null)
      {
        Iterator<Object> it = uidl.getChildIterator();
        while(it.hasNext())
        {
          UIDL child = (UIDL) it.next();
  
          if("clear".equals(child.getTag()))
          {
            context.clearRect(0, 0, context.getCanvas().getWidth(), context.getCanvas().getHeight());
          }
          else if("line".equals(child.getTag()))
          {
            context.setGlobalAlpha(1.0);
            context.setLineWidth(1.0);
            context.setStrokeStyle("black");
            context.beginPath();
            context.moveTo(child.getIntAttribute("from_x"),
              child.getIntAttribute("from_y"));
            context.lineTo(child.getIntAttribute("to_x"),
              child.getIntAttribute("to_y"));
            context.closePath();
            context.stroke();
          }
          // todo: more commands :)
        }
  
      }
    }
docs: Called whenever an update is received from the server