gwt-fabridge is a utility for gwt to access adobe swf file. See the
following page
http://code.google.com/p/gwt-fabridge/

On Feb 4, 5:59 am, Charlie Collins <[email protected]> wrote:
> I don't know whatgwt-fabridgeis, but maybe that project has it's own
> support list you can use for issues such as this?  Not sure you will
> get much response here.
>
> On Feb 3, 4:00 pm, "Jihong Liu" <[email protected]> wrote:
>
>
>
> > Hi. I have a problem forgwt-fabridge. I think it may be a critical
> > issue forgwt-fabridge.
>
> > If a swf widget is added into a panel, and then add the panel into a
> > container. And then remove the panel from the container, and then add
> > the panel back into the container. Then the Null pointer error will
> > occur at onInitialization()caused by the swf widget. I did a test using
> > the FABridgeDemo. In the FABridgeDemo, I added a button for removing the
> > swf widget.
>
> > When start the program, first click the "Add new SWF", and everything is
> > ok. Then click the "Remove SWF", then the swf is removed. Then click the
> > "Add new SWF" again, then an error will happen.
>
> > I have tried many ways, the only way to make it work is to create the
> > swf widge again and using a different name if the widget has been
> > removed. For example:
>
> >     java.util.Date date = new java.util.Date();
>
> >     swfWidget = new
> > SWFABridgeWidget("app.swf",400,400,"example"+date.getTime());
>
> > But it is not good at all. And the behavior is not the same as other
> > regular gwt widgets. For other widgets, after they are put in a panel.
> > Then you can add/drop this panel into/from a container many times
> > without re-create the inside widgets.
>
> > I am really frustrated about this problem. Based on user's selection we
> > will add different panels into a container for display. It is really
> > painful if we have to create the swf widgets again if the panel has been
> > dropped from the container once.
>
> > I don't know whether the following code in
> > pl.rmalinowski.gwt2swf.client.ui.SWFWidge causes problem or not.
>
> > protected void onUnload() {
>
> >     // GWT.log("onUnload", null);
>
> >     getElement().removeChild(DOM.getFirstChild(getElement()));
>
> >     isSWFInjected = false;
>
> >     super.onUnload();
>
> >   }
>
> > The statement: getElement().removeChild(DOM.getFirstChild(getElement()))
> > removes the child from the widget. Thus after a swfwidget is removed
> > from a panel, and then add the swf back, no child there.
>
> > Following is the code in com.google.gwt.user.client.ui.ComplexPanel
>
> > @Override
>
> >   public boolean remove(Widget w) {
>
> >     // Validate.
>
> >     if (w.getParent() != this) {
>
> >       return false;
>
> >     }
>
> >     // Orphan.
>
> >     orphan(w);
>
> >     // Physical detach.
>
> >     Element elem = w.getElement();
>
> >     DOM.removeChild(DOM.getParent(elem), elem);
>
> >     // Logical detach.
>
> >     getChildren().remove(w);
>
> >     return true;
>
> >   }
>
> > It sounds to me that the different between two programs is that in
> > ComplexPanel, it removes the widget's element only, but in SWFWidge, it
> > removes the child of the widget's element.
>
> > Thank you very much!
>
> > Jihong Liu
>
> > Following is the source code which causes problem
>
> > package com.satmetrix.swfTest.client;
>
> > import org.argunet.gwt.fabridge.client.SWFABridgeWidget;
>
> > import org.argunet.gwt.fabridge.client.bridge.BridgeObject;
>
> > import org.argunet.gwt.fabridge.client.bridge.BridgeParameter;
>
> > import org.argunet.gwt.fabridge.client.bridge.BridgeParameterObject;
>
> > import org.argunet.gwt.fabridge.client.events.IInitializationListener;
>
> > import org.argunet.gwt.fabridge.client.events.ISWFListener;
>
> > import org.argunet.gwt.fabridge.client.utils.JSNIUtils;
>
> > import com.google.gwt.core.client.EntryPoint;
>
> > import com.google.gwt.core.client.JavaScriptObject;
>
> > import com.google.gwt.user.client.Window;
>
> > import com.google.gwt.user.client.ui.Button;
>
> > import com.google.gwt.user.client.ui.ClickListener;
>
> > import com.google.gwt.user.client.ui.Label;
>
> > import com.google.gwt.user.client.ui.RootPanel;
>
> > import com.google.gwt.user.client.ui.Widget;
>
> > public class FABridgeDemo implements EntryPoint, IInitializationListener
> > {
>
> >       private final Button addNewSwf = new Button("Add new SWF");
>
> >       private final Button removeSwf = new Button("Remove SWF");
>
> >       private final Button setCheckBox = new Button("Set Checkbox
> > property");
>
> >       private final Label sliderLabel = new Label("Slider Label");
>
> >       private SWFABridgeWidget swfWidget=null;
>
> >       private final Button createDataGrid = new Button("Create Data
> > Grid");
>
> >       /**
>
> >        * This is the entry point method.
>
> >        */
>
> >       public void onModuleLoad() {
>
> >             RootPanel.get().add(addNewSwf);
>
> >             RootPanel.get().add(removeSwf);
>
> >             RootPanel.get().add(setCheckBox);
>
> >             RootPanel.get().add(sliderLabel);
>
> >             RootPanel.get().add(createDataGrid);
>
> >             // adds new swfWidget to rootPanel
>
> >             addNewSwf.addClickListener(new ClickListener() {
>
> >                   public void onClick(Widget arg0) {
>
> >                         // set bridge name for FABridge
>
> >                       if (swfWidget==null) {
>
> >                           swfWidget = new
> > SWFABridgeWidget("app.swf",400,400,"example");
>
> >                         // add initialization listener
>
> > swfWidget.addInitializationListener(FABridgeDemo.this);
>
> >                       }
>
> >                         // add swfWidget to RootPanel
>
> >                         RootPanel.get().add(swfWidget);
>
> >                         //show swf movie
>
> >                         swfWidget.show();
>
> >                   }
>
> >             });
>
> >             removeSwf.addClickListener(new ClickListener() {
>
> >             public void onClick(Widget arg0) {
>
> >               RootPanel.get().remove(swfWidget);
>
> >             }
>
> >         });
>
> >             // changes checkbox status in swfWidget
>
> >             setCheckBox.addClickListener(new ClickListener() {
>
> >                   public void onClick(Widget arg0) {
>
> >                         // get check box
>
> >                         BridgeObject check =
> > swfWidget.root().getObject("check");
>
> >                         // get check box status
>
> >                         Boolean status = new
> > Boolean(check.getProperty("selected").getContent().toString());
>
> >                         // change check box status
>
> >                         check.setProperty("selected",
> > !status.booleanValue());
>
> >                   }
>
> >             });
>
> >             // creates new DataGrid in swfWidget
>
> >             createDataGrid.addClickListener(new ClickListener() {
>
> >                   public void onClick(Widget arg0) {
>
> >                         BridgeObject flexApp = swfWidget.root();
>
> >                         // create new data grid
>
> >                         BridgeObject grid =
> > swfWidget.create("mx.controls.DataGrid");
>
> >                         grid.addRef();
>
> >                         // create first column
>
> >                         BridgeObject col1 =
> > swfWidget.create("mx.controls.dataGridClasses.DataGridColumn");
>
> >                         col1.addRef();
>
> >                         col1.setProperty("dataField", "apples");
>
> >                         // create second column
>
> >                         BridgeObject col2 =
> > swfWidget.create("mx.controls.dataGridClasses.DataGridColumn");
>
> >                         col2.addRef();
>
> >                         col2.setProperty("dataField", "oranges");
>
> >                         // add columns to data grid
>
> >                         JavaScriptObject jsArray = JSNIUtils
>
> >                                     .convertArray(new JavaScriptObject[]
> > {
>
> >                                                 col1.getJSContent(),
> > col2.getJSContent() });
>
> >                         grid.setProperty("columns", jsArray);
>
> >                         grid.setProperty("width", 300);
>
> >                         // create first row
>
> >                         BridgeParameterObject row1 = new
> > BridgeParameterObject();
>
> >                         row1.addProperty("apples", 12);
>
> >                         row1.addProperty("oranges", 32);
>
> >                         // create second row
>
> >                         BridgeParameterObject row2 = new
> > BridgeParameterObject();
>
> >                         row2.addProperty("apples", 15);
>
> >                         row2.addProperty("oranges", 24);
>
> >                         // set dataProvider
>
> >                         grid.setProperty("dataProvider", JSNIUtils
>
> >                                     .convertArray(new JavaScriptObject[]
> > {
>
> >                                                 row1.getObject(),
> > row2.getObject() }));
>
> >                         // add grid to panel
>
> >                         BridgeParameter params = new BridgeParameter();
>
> >                         params.addParameter(grid.getJSContent());
>
> ...
>
> read more »- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to