You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Gerald Fernando <ge...@gmail.com> on 2009/08/18 15:11:11 UTC

Shall we have(embed) a swf in wicket component(Panel or in wicket page).

Hello Friends,

Shall we have(embed) a swf in wicket component(Panel or in wicket page).
I have swf that shows chart for dynamic data.
i want to show my .swf file into wicket page or wicket panel
if possible please give me modal code.
I need urgent reply

-- 
Thanks&regards,
Gerald A

Re: Shall we have(embed) a swf in wicket component(Panel or in wicket page).

Posted by Gerald Fernando <ge...@gmail.com>.
Hi nino i used the code in following link

http://cwiki.apache.org/WICKET/object-container-adding-flash-to-a-wicket-application.html

 <wicket:panel>
    <object wicket:id="swf" data="res/test.swf" width="700"
height="70"style="float:
right; margin: 15px 0 0 0;"></object>
  </wicket:panel>

in this code what is meant by data?
my swf is residing in http://localhost:8080/charts/bin/chart.swf which is in
tomcat.

but am workig wicket in Eclipse
shall i provide this link to data=?
I dont know about modal window what is that
give me some detailed Explanation

Thanks&Regards,
Gerald A



On Fri, Aug 21, 2009 at 12:52 AM, nino martinez wael <
nino.martinez.wael@gmail.com> wrote:

> Fernando remenber that the modal window are built with a div and
> javascript so if something does not take that in account it won't
> work, it could be something todo with the order of rendering dom.
>
> 2009/8/19 Fernando Wermus <fe...@gmail.com>:
>  > You can use SWFObject that is in the wiki. You also can use LightWindow
> to
> > show SWFObject.
> >
> > Look for SwfObject Javascript to make it to run and the examples.
> > Take care that this panel cannot be put in a modal Window, I tried and
> > failed.
> >
> >
> > Anyway I pasted below
> >
> > public class SWFObject extends AbstractBehavior implements
> > IHeaderContributor {
> >
> >  private static final CompressedResourceReference SWFOBJECT_JS =
> >      new CompressedResourceReference(SWFObject.class,
> "swfobject-2.1.js");
> >
> >  private static final long serialVersionUID = 1L;
> >
> >  private Map<String, String> parameters = new HashMap<String, String>();
> >
> >  private Map<String, String> attributes = new HashMap<String, String>();
> >
> >  private String version;
> >  private String flashUrl;
> >  private String width;
> >  private String height;
> >  private Component component;
> >
> >  @Override
> >    public void bind(Component component) {
> >        this.component = component;
> >        component.setOutputMarkupId(true);
> >  }
> >
> >  public void renderHead(IHeaderResponse response) {
> >    response.renderJavascriptReference(SWFOBJECT_JS);
> >
> >    final String id = component.getMarkupId();
> >    String parObj = buildDataObject(getParameters());
> >    String attObj = buildDataObject(getAttributes());
> >
> >    // embedSWF: function(swfUrlStr, replaceElemIdStr, widthStr,
> heightStr,
> > swfVersionStr, xiSwfUrlStr, flashvarsObj, parObj, attObj)
> >
> >    String js = String.format("swfobject.embedSWF('%s','%s', '%s', '%s',
> > '%s', '%s', %s, %s );",
> >        flashUrl, id, width, height, version, "expressInstall.swf",
> parObj,
> > attObj);
> >
> >    response.renderJavascript(js, null);
> >  }
> >
> >  /**
> >   * Construct.
> >   * <p/>
> >   * version can be a string in the format of
> > 'majorVersion.minorVersion.revision'.
> >   * An example would be: "6.0.65". Or you can just require the major
> > version, such as "6".
> >   *
> >   * @param flashUrl        The url of your swf file.
> >   * @param width           width of swf
> >   * @param height          height of movie
> >   * @param version         Flash version to support
> >   */
> >  public SWFObject(final String flashUrl, final int width, final int
> height,
> > final String version) {
> >    this(flashUrl, String.valueOf(width), String.valueOf(height),
> version);
> >  }
> >
> >  /**
> >   * Construct.
> >   * @param flashUrl        URL to load up for swf
> >   * @param width           width of swf
> >   * @param height          height of movie
> >   * @param version         Flash version to support
> >   */
> >  public SWFObject(final String flashUrl, final String width, final String
> > height, final String version) {
> >    if (flashUrl == null) {
> >      throw new IllegalArgumentException("Argument [flashUrl] cannot be
> > null");
> >    }
> >    this.flashUrl = flashUrl;
> >    this.width = width;
> >    this.height = height;
> >    this.version = version;
> >  }
> >
> >  private String buildDataObject(Map<String,String> data) {
> >    final String quote = "'";
> >    final String comma=",";
> >    if (data != null && !data.isEmpty()) {
> >      StringBuilder result = new StringBuilder();
> >      result.append("{");
> >      for (Map.Entry<String, String> e : getParameters().entrySet()) {
> >        result.append(quote).append(e.getKey()).append(quote + ":" +
> > quote).append(e.getValue()).append(quote).append(comma);
> >      }
> >      result.deleteCharAt(result.length() - 1);
> >      result.append("}");
> >      return result.toString();
> >    }
> >    return "{}";
> >  }
> >
> >  @Override
> >  public void onComponentTag(final Component component, final ComponentTag
> > tag) {
> >  }
> >
> >  protected Map<String, String> getParameters() {
> >    return parameters;
> >  }
> >
> >  public void addParameter(String name, String value) {
> >    parameters.put(name, value);
> >  }
> >
> >  protected Map<String, String> getAttributes() {
> >    return attributes;
> >  }
> >
> >  public void addAttribute(String name, String value) {
> >    attributes.put(name, value);
> >  }
> >
> > }
> >
> >
> > Here is a use of it
> >
> > public class PanelforSwf extends Panel implements IResourceListener {
> >
> >    private static final long serialVersionUID = 14614407827489706L;
> >    static final ResourceReference SWF_RESOURCE = new
> > ResourceReference(PanelPartido.class, "stadistic.swf" );
> >    final SWFObject swf;
> >    private String idInscripcion;
> >
> >    public PanelForSwf(String id, String width, String height) {
> >        super(id);
> >        String swfURL = RequestUtils.toAbsolutePath(
> > urlFor(SWF_RESOURCE).toString() );
> >        add(swf = new SWFObject( swfURL, width, height, "9.0.0"));
> >    }
> >    public PanelForSwf(String id, IModel modeloInscripcion) {
> >        this(id,"800","500");
> >    }
> >      @Override protected void onBeforeRender() {
> >        swf.addParameter("param2", someparameter);
> >        swf.addParameter("param1", someparameter);
> >        super.onBeforeRender();
> >      }
> >
> >    public void onResourceRequested() {
> >
> >    }
> >
> > }
> >
> >
> >
> > On Tue, Aug 18, 2009 at 10:41 PM, Gerald Fernando <
> > gerald.anto.fernando@gmail.com> wrote:
> >
> >> Nino sorry to say that i dont know that
> >> please tell me clear.
> >> if possible give some modal code
> >>
> >> Thanks&Regards,
> >> Gerald A
> >>
> >> On Tue, Aug 18, 2009 at 6:45 PM, nino martinez wael <
> >> nino.martinez.wael@gmail.com> wrote:
> >>
> >> > stuff the panel in to the modal window
> >> >
> >> > 2009/8/18 Gerald Fernando <ge...@gmail.com>:
> >> >  > Hello Friends,
> >> > >
> >> > > Shall we have(embed) a swf in wicket component(Panel or in wicket
> >> page).
> >> > > I have swf that shows chart for dynamic data.
> >> > > i want to show my .swf file into wicket page or wicket panel
> >> > > if possible please give me modal code.
> >> > > I need urgent reply
> >> > >
> >> > > --
> >> > > Thanks&regards,
> >> > > Gerald A
> >> > >
> >> >
> >> > ---------------------------------------------------------------------
> >> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> > For additional commands, e-mail: users-help@wicket.apache.org
> >> >
> >> >
> >>
> >>
> >> --
> >> Thanks&regards,
> >> Gerald A
> >>
> >
> >
> >
> > --
> > Fernando Wermus.
> >
> > www.linkedin.com/in/fernandowermus
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


-- 
Thanks&regards,
Gerald A

Re: Shall we have(embed) a swf in wicket component(Panel or in wicket page).

Posted by nino martinez wael <ni...@gmail.com>.
Fernando remenber that the modal window are built with a div and
javascript so if something does not take that in account it won't
work, it could be something todo with the order of rendering dom.

2009/8/19 Fernando Wermus <fe...@gmail.com>:
> You can use SWFObject that is in the wiki. You also can use LightWindow to
> show SWFObject.
>
> Look for SwfObject Javascript to make it to run and the examples.
> Take care that this panel cannot be put in a modal Window, I tried and
> failed.
>
>
> Anyway I pasted below
>
> public class SWFObject extends AbstractBehavior implements
> IHeaderContributor {
>
>  private static final CompressedResourceReference SWFOBJECT_JS =
>      new CompressedResourceReference(SWFObject.class, "swfobject-2.1.js");
>
>  private static final long serialVersionUID = 1L;
>
>  private Map<String, String> parameters = new HashMap<String, String>();
>
>  private Map<String, String> attributes = new HashMap<String, String>();
>
>  private String version;
>  private String flashUrl;
>  private String width;
>  private String height;
>  private Component component;
>
>  @Override
>    public void bind(Component component) {
>        this.component = component;
>        component.setOutputMarkupId(true);
>  }
>
>  public void renderHead(IHeaderResponse response) {
>    response.renderJavascriptReference(SWFOBJECT_JS);
>
>    final String id = component.getMarkupId();
>    String parObj = buildDataObject(getParameters());
>    String attObj = buildDataObject(getAttributes());
>
>    // embedSWF: function(swfUrlStr, replaceElemIdStr, widthStr, heightStr,
> swfVersionStr, xiSwfUrlStr, flashvarsObj, parObj, attObj)
>
>    String js = String.format("swfobject.embedSWF('%s','%s', '%s', '%s',
> '%s', '%s', %s, %s );",
>        flashUrl, id, width, height, version, "expressInstall.swf", parObj,
> attObj);
>
>    response.renderJavascript(js, null);
>  }
>
>  /**
>   * Construct.
>   * <p/>
>   * version can be a string in the format of
> 'majorVersion.minorVersion.revision'.
>   * An example would be: "6.0.65". Or you can just require the major
> version, such as "6".
>   *
>   * @param flashUrl        The url of your swf file.
>   * @param width           width of swf
>   * @param height          height of movie
>   * @param version         Flash version to support
>   */
>  public SWFObject(final String flashUrl, final int width, final int height,
> final String version) {
>    this(flashUrl, String.valueOf(width), String.valueOf(height), version);
>  }
>
>  /**
>   * Construct.
>   * @param flashUrl        URL to load up for swf
>   * @param width           width of swf
>   * @param height          height of movie
>   * @param version         Flash version to support
>   */
>  public SWFObject(final String flashUrl, final String width, final String
> height, final String version) {
>    if (flashUrl == null) {
>      throw new IllegalArgumentException("Argument [flashUrl] cannot be
> null");
>    }
>    this.flashUrl = flashUrl;
>    this.width = width;
>    this.height = height;
>    this.version = version;
>  }
>
>  private String buildDataObject(Map<String,String> data) {
>    final String quote = "'";
>    final String comma=",";
>    if (data != null && !data.isEmpty()) {
>      StringBuilder result = new StringBuilder();
>      result.append("{");
>      for (Map.Entry<String, String> e : getParameters().entrySet()) {
>        result.append(quote).append(e.getKey()).append(quote + ":" +
> quote).append(e.getValue()).append(quote).append(comma);
>      }
>      result.deleteCharAt(result.length() - 1);
>      result.append("}");
>      return result.toString();
>    }
>    return "{}";
>  }
>
>  @Override
>  public void onComponentTag(final Component component, final ComponentTag
> tag) {
>  }
>
>  protected Map<String, String> getParameters() {
>    return parameters;
>  }
>
>  public void addParameter(String name, String value) {
>    parameters.put(name, value);
>  }
>
>  protected Map<String, String> getAttributes() {
>    return attributes;
>  }
>
>  public void addAttribute(String name, String value) {
>    attributes.put(name, value);
>  }
>
> }
>
>
> Here is a use of it
>
> public class PanelforSwf extends Panel implements IResourceListener {
>
>    private static final long serialVersionUID = 14614407827489706L;
>    static final ResourceReference SWF_RESOURCE = new
> ResourceReference(PanelPartido.class, "stadistic.swf" );
>    final SWFObject swf;
>    private String idInscripcion;
>
>    public PanelForSwf(String id, String width, String height) {
>        super(id);
>        String swfURL = RequestUtils.toAbsolutePath(
> urlFor(SWF_RESOURCE).toString() );
>        add(swf = new SWFObject( swfURL, width, height, "9.0.0"));
>    }
>    public PanelForSwf(String id, IModel modeloInscripcion) {
>        this(id,"800","500");
>    }
>      @Override protected void onBeforeRender() {
>        swf.addParameter("param2", someparameter);
>        swf.addParameter("param1", someparameter);
>        super.onBeforeRender();
>      }
>
>    public void onResourceRequested() {
>
>    }
>
> }
>
>
>
> On Tue, Aug 18, 2009 at 10:41 PM, Gerald Fernando <
> gerald.anto.fernando@gmail.com> wrote:
>
>> Nino sorry to say that i dont know that
>> please tell me clear.
>> if possible give some modal code
>>
>> Thanks&Regards,
>> Gerald A
>>
>> On Tue, Aug 18, 2009 at 6:45 PM, nino martinez wael <
>> nino.martinez.wael@gmail.com> wrote:
>>
>> > stuff the panel in to the modal window
>> >
>> > 2009/8/18 Gerald Fernando <ge...@gmail.com>:
>> >  > Hello Friends,
>> > >
>> > > Shall we have(embed) a swf in wicket component(Panel or in wicket
>> page).
>> > > I have swf that shows chart for dynamic data.
>> > > i want to show my .swf file into wicket page or wicket panel
>> > > if possible please give me modal code.
>> > > I need urgent reply
>> > >
>> > > --
>> > > Thanks&regards,
>> > > Gerald A
>> > >
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> > For additional commands, e-mail: users-help@wicket.apache.org
>> >
>> >
>>
>>
>> --
>> Thanks&regards,
>> Gerald A
>>
>
>
>
> --
> Fernando Wermus.
>
> www.linkedin.com/in/fernandowermus
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Shall we have(embed) a swf in wicket component(Panel or in wicket page).

Posted by Fernando Wermus <fe...@gmail.com>.
You can use SWFObject that is in the wiki. You also can use LightWindow to
show SWFObject.

Look for SwfObject Javascript to make it to run and the examples.
Take care that this panel cannot be put in a modal Window, I tried and
failed.


Anyway I pasted below

public class SWFObject extends AbstractBehavior implements
IHeaderContributor {

  private static final CompressedResourceReference SWFOBJECT_JS =
      new CompressedResourceReference(SWFObject.class, "swfobject-2.1.js");

  private static final long serialVersionUID = 1L;

  private Map<String, String> parameters = new HashMap<String, String>();

  private Map<String, String> attributes = new HashMap<String, String>();

  private String version;
  private String flashUrl;
  private String width;
  private String height;
  private Component component;

  @Override
    public void bind(Component component) {
        this.component = component;
        component.setOutputMarkupId(true);
  }

  public void renderHead(IHeaderResponse response) {
    response.renderJavascriptReference(SWFOBJECT_JS);

    final String id = component.getMarkupId();
    String parObj = buildDataObject(getParameters());
    String attObj = buildDataObject(getAttributes());

    // embedSWF: function(swfUrlStr, replaceElemIdStr, widthStr, heightStr,
swfVersionStr, xiSwfUrlStr, flashvarsObj, parObj, attObj)

    String js = String.format("swfobject.embedSWF('%s','%s', '%s', '%s',
'%s', '%s', %s, %s );",
        flashUrl, id, width, height, version, "expressInstall.swf", parObj,
attObj);

    response.renderJavascript(js, null);
  }

  /**
   * Construct.
   * <p/>
   * version can be a string in the format of
'majorVersion.minorVersion.revision'.
   * An example would be: "6.0.65". Or you can just require the major
version, such as "6".
   *
   * @param flashUrl        The url of your swf file.
   * @param width           width of swf
   * @param height          height of movie
   * @param version         Flash version to support
   */
  public SWFObject(final String flashUrl, final int width, final int height,
final String version) {
    this(flashUrl, String.valueOf(width), String.valueOf(height), version);
  }

  /**
   * Construct.
   * @param flashUrl        URL to load up for swf
   * @param width           width of swf
   * @param height          height of movie
   * @param version         Flash version to support
   */
  public SWFObject(final String flashUrl, final String width, final String
height, final String version) {
    if (flashUrl == null) {
      throw new IllegalArgumentException("Argument [flashUrl] cannot be
null");
    }
    this.flashUrl = flashUrl;
    this.width = width;
    this.height = height;
    this.version = version;
  }

  private String buildDataObject(Map<String,String> data) {
    final String quote = "'";
    final String comma=",";
    if (data != null && !data.isEmpty()) {
      StringBuilder result = new StringBuilder();
      result.append("{");
      for (Map.Entry<String, String> e : getParameters().entrySet()) {
        result.append(quote).append(e.getKey()).append(quote + ":" +
quote).append(e.getValue()).append(quote).append(comma);
      }
      result.deleteCharAt(result.length() - 1);
      result.append("}");
      return result.toString();
    }
    return "{}";
  }

  @Override
  public void onComponentTag(final Component component, final ComponentTag
tag) {
  }

  protected Map<String, String> getParameters() {
    return parameters;
  }

  public void addParameter(String name, String value) {
    parameters.put(name, value);
  }

  protected Map<String, String> getAttributes() {
    return attributes;
  }

  public void addAttribute(String name, String value) {
    attributes.put(name, value);
  }

}


Here is a use of it

public class PanelforSwf extends Panel implements IResourceListener {

    private static final long serialVersionUID = 14614407827489706L;
    static final ResourceReference SWF_RESOURCE = new
ResourceReference(PanelPartido.class, "stadistic.swf" );
    final SWFObject swf;
    private String idInscripcion;

    public PanelForSwf(String id, String width, String height) {
        super(id);
        String swfURL = RequestUtils.toAbsolutePath(
urlFor(SWF_RESOURCE).toString() );
        add(swf = new SWFObject( swfURL, width, height, "9.0.0"));
    }
    public PanelForSwf(String id, IModel modeloInscripcion) {
        this(id,"800","500");
    }
      @Override protected void onBeforeRender() {
        swf.addParameter("param2", someparameter);
        swf.addParameter("param1", someparameter);
        super.onBeforeRender();
      }

    public void onResourceRequested() {

    }

}



On Tue, Aug 18, 2009 at 10:41 PM, Gerald Fernando <
gerald.anto.fernando@gmail.com> wrote:

> Nino sorry to say that i dont know that
> please tell me clear.
> if possible give some modal code
>
> Thanks&Regards,
> Gerald A
>
> On Tue, Aug 18, 2009 at 6:45 PM, nino martinez wael <
> nino.martinez.wael@gmail.com> wrote:
>
> > stuff the panel in to the modal window
> >
> > 2009/8/18 Gerald Fernando <ge...@gmail.com>:
> >  > Hello Friends,
> > >
> > > Shall we have(embed) a swf in wicket component(Panel or in wicket
> page).
> > > I have swf that shows chart for dynamic data.
> > > i want to show my .swf file into wicket page or wicket panel
> > > if possible please give me modal code.
> > > I need urgent reply
> > >
> > > --
> > > Thanks&regards,
> > > Gerald A
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
>
>
> --
> Thanks&regards,
> Gerald A
>



-- 
Fernando Wermus.

www.linkedin.com/in/fernandowermus

Re: Shall we have(embed) a swf in wicket component(Panel or in wicket page).

Posted by Gerald Fernando <ge...@gmail.com>.
Nino sorry to say that i dont know that
please tell me clear.
if possible give some modal code

Thanks&Regards,
Gerald A

On Tue, Aug 18, 2009 at 6:45 PM, nino martinez wael <
nino.martinez.wael@gmail.com> wrote:

> stuff the panel in to the modal window
>
> 2009/8/18 Gerald Fernando <ge...@gmail.com>:
>  > Hello Friends,
> >
> > Shall we have(embed) a swf in wicket component(Panel or in wicket page).
> > I have swf that shows chart for dynamic data.
> > i want to show my .swf file into wicket page or wicket panel
> > if possible please give me modal code.
> > I need urgent reply
> >
> > --
> > Thanks&regards,
> > Gerald A
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


-- 
Thanks&regards,
Gerald A

Re: Shall we have(embed) a swf in wicket component(Panel or in wicket page).

Posted by nino martinez wael <ni...@gmail.com>.
stuff the panel in to the modal window

2009/8/18 Gerald Fernando <ge...@gmail.com>:
> Hello Friends,
>
> Shall we have(embed) a swf in wicket component(Panel or in wicket page).
> I have swf that shows chart for dynamic data.
> i want to show my .swf file into wicket page or wicket panel
> if possible please give me modal code.
> I need urgent reply
>
> --
> Thanks&regards,
> Gerald A
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org