def init ( self, parent ):
        """ Finishes initializing the editor by creating the underlying toolkit
            widget.
        """
        # Create a FormPanel and point it at a service.
        control = FormPanel()
        control.setAction( self.update_object )

        # Because we're going to add a FileUpload widget, we'll need to set the
        # form to use the POST method, and multipart MIME encoding.
        control.setEncoding( FormPanel.ENCODING_MULTIPART )
        control.setMethod( FormPanel.METHOD_POST )

        upload = FileUpload()
        upload.setName("File...")
        factory = self.factory
        control.add( upload )

        # Add a 'submit' button.
        control.add( Button("Submit", self) )

#        if factory.enter_set:
#            control.addFormHandler( self.update_object, "<Return>" )

#        control.addFocusListener( self.update_object )

#        if factory.auto_set:
#           control.addKeyboadListener( self.update_object )

#        parent.add( control )
        self.control = control
        self.set_tooltip()
    def init ( self, parent ):
        """ Finishes initializing the editor by creating the underlying toolkit
            widget.
        """
        control = FileUpload()
#        factory = self.factory

        control.onLoad( self.update_object )

        parent.add( control )
        self.control = control
        self.set_tooltip()
    def onModuleLoad(self):
        # Create a FormPanel and point it at a service.
        self.form = FormPanel()
        self.form.setAction("http://127.0.0.1/chat-service/test/")

        # Because we're going to add a FileUpload widget, we'll need to set the
        # form to use the POST method, and multipart MIME encoding.
        self.form.setEncoding(FormPanel.ENCODING_MULTIPART)
        self.form.setMethod(FormPanel.METHOD_POST)

        # Create a panel to hold all of the form widgets.
        panel = VerticalPanel()
        self.form.setWidget(panel)

        # Create a TextBox, giving it a name so that it will be submitted.
        self.tb = TextBox()
        self.tb.setName("textBoxFormElement")
        panel.add(self.tb)

        # Create a ListBox, giving it a name and some values to be associated with
        # its options.
        lb = ListBox()
        lb.setName("listBoxFormElement")
        lb.addItem("foo", "fooValue")
        lb.addItem("bar", "barValue")
        lb.addItem("baz", "bazValue")
        panel.add(lb)

        # Create a FileUpload widget.
        upload = FileUpload()
        upload.setName("uploadFormElement")
        panel.add(upload)

        # Add a 'submit' button.
        panel.add(Button("Submit", self))

        # Add an event handler to the form.
        self.form.addFormHandler(self)

        RootPanel().get().add(self.form)