[jboss-user] [JBoss Seam] - Re: Changing Seam component properties via Remoting

dkane do-not-reply at jboss.com
Mon Jul 23 09:52:38 EDT 2007


There is a lot of code, so only key points : 

Seam Component interface : 

@Local 
  | public interface MapImageA4J
  | {
  |   public void setXc(int xc);
  |   public int getXc();
  |   public void setYc(int yc);
  |   public int getYc();
  |   public void setWidth(int width);
  |   public int getWidth();
  |   public void setHeight(int height);
  |   public int getHeight();
  |   public void setScale(int scale);
  |   public int getScale();
  |   public void drawImage(OutputStream out, Object data) throws Exception;
  |   
  |   @WebRemote
  |   public void zoom(double xPercent, double yPercent, double widthPercent,   double heightPercent);
  |   
  |   // this method is being called via Remoting and changes values of properties xc, yc, scale, etc. 
  | 
  | 
  |   public void left(); 
  |   public void right();
  |   public void up();
  |   public void down();
  |   public void zoomIn();
  |   public void zoomOut();
  |   public void destroy();
  | }
  | 


Web - page fragment : 

 
  |     
  |     <s:link action="#{map.left}" value="left"/><br/>
  |     <s:link action="#{map.right}" value="right"/><br/>
  |     <s:link action="#{map.up}" value="top"/><br/>
  |     <s:link action="#{map.down}" value="bottom"/><br/>
  |     <s:link action="#{map.zoomIn}" value="zoom in"/><br/>    
  |     <s:link action="#{map.zoomOut}" value="zoom out"/><br/>        
  |     
  |     <!-- links above works fine and image is being rerendered -->
  | 
  |     <a4j:mediaOutput id="a4map"
  |                      element="img" 
  |                      cacheable="false" 
  |                      session="true" 
  |                      createContent="#{map.drawImage}" 
  |                      mimeType="image/gif"     
  |                      onmousedown="mapStartZoom(event)"
  |                      onmousemove="mapMouseMove(event)" 
  |                      onmouseup="mapMouseUp(event)" 
  |                      /> 
  | 

And, the problem point : end of  "onmouseup" handler (Javascript): 

function mapStopZoom(evt)
  | {       
  |    //... some calculation ...   
  | 
  | Seam.Component.getInstance("map").zoom(xLeftPercent,yTopPercent,widthPercent,heightPercent);
  | } 
  | 

zoom method is being called via Remoting, but when I click e.g. "up" or "down" after zoom results falls back. 

I've raised the similar issue in ajax4jsf forum, because I beleive the problem is impossibility to rerender  mediaOutput right after remoting call. 
So far have not found a way to rerender a4j object from plain JavaScript. 

http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4066643#4066643


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4066658#4066658

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4066658



More information about the jboss-user mailing list