Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8712629
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T05:08:56+00:00 2026-06-13T05:08:56+00:00

I am using gwt editor framework to bind form in gwt. I was able

  • 0

I am using gwt editor framework to bind form in gwt. I was able to bind form successfully, but my problem is I need to write too many code. I think using generic will shorten my code but I couldn’t do it.

The code for EditVendorWorkflow is almost same, the only difference is this two line

interface Driver extends  SimpleBeanEditorDriver<Vendor, VendorEditor>{}
private VendorEditor editor;

Example, If I write a PersonEditor the corresponding EditPersonWorkflow code will have

interface Driver extends  SimpleBeanEditorDriver<Person, PersonEditor>{}
private PersonEditor editor;

So basically there is a repetition.

Any Help is appreciable.

public class EditVendorWorkflow{
      interface Driver extends  SimpleBeanEditorDriver<Vendor, VendorEditor>{}

      Driver driver = GWT.create(Driver.class);

      private VendorEditor editor;

      void edit(Vendor p) {
        driver.initialize(editor);
        driver.edit(p);
      }

      void save() {
        Vendor edited = driver.flush();
        //doSomethingWithEditedVendor(edited);

      }

    public void initialize(VendorEditor editor) {
        this.editor = editor;
    }
}


public class VendorEditor extends Composite implements Editor<Vendor> {

    private static VendorEditorUiBinder uiBinder = GWT
            .create(VendorEditorUiBinder.class);
    @UiField Button save;
    @UiField TextBox address;
    @UiField TextBox contactName;
    @UiField ValueBoxEditorDecorator<String> contactMobileNo;
    @Path("department.name")
    @UiField TextBox deptName;
    interface VendorEditorUiBinder extends UiBinder<Widget, VendorEditor> {
    }

    private final EditVendorWorkflow vendorDriver;
    public VendorEditor(Vendor p) {
        initWidget(uiBinder.createAndBindUi(this));
        vendorDriver = GWT.create(EditVendorWorkflow.class);
        vendorDriver.initialize(this);
        vendorDriver.edit(p);
    }


    @UiHandler("save")
    void onSaveClick(ClickEvent event) {
        vendorDriver.save();
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T05:08:58+00:00Added an answer on June 13, 2026 at 5:08 am

    Something along the following lines should do the job:

    public class EditWorkflow<O, E extends Editor<O>> {
    
        SimpleBeanEditorDriver<O, E> driver; 
    
        private E editor;
    
        void edit(O p) {
            driver.initialize(editor);
            driver.edit(p);
        }
    
        void save() {
            O edited = driver.flush();
            //doSomethingWithEditedObject(edited);
        }
    
        public void initialize(E editor, SimpleBeanEditorDriver<O, E> driver) {
            this.editor = editor;
            this.driver = driver;
        }
    
    }
    

    But unfortunately, GWT.create() can only accept a class literal, which cannot be generic. So, I guess still you have to create your Driver interfaces somewhere. I added a driver parameter to initialize() so that you can call GWT.create() outside and pass the result in.

    If you have some codes that specific to Vendor or Person, you can abstract them in abstract methods like

    protected abstract void doSomethingWithEditedObject(O object); 
    

    and implement them in subclasses of EditWorkflow.

    If you go on to create subclasses of EditWorkflow, you can put Driver interfaces inside their respective EditWorkflow class

    public class EditVendorWorkflow extends EditWorkflow<Vendor, VendorEditor> {
    
        interface Driver extends  SimpleBeanEditorDriver<Vendor, VendorEditor>{}
    
        public void initialize(VendorEditor editor) {
            super.initialize(editor, GWT.create(Driver.class));
        }
    
        @Override
        protected void doSomethingWithEditedObject(Vendor object) {
            // Code specific to class Vendor...
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using gwt-platform and tried to implement GWT's editor framework. But I don't get
Im moving first steps today on GWT framework. I need to understand (using the
While using GWT FormPanel, after submitting the form, it posts form but does not
I am using the GWT 2.4 Editor framework. I have everything working with errors
I am using GWT/JAVA for development. I have following problem: I want to remove
We are using GWT and take advantage of History framework. Everything works fine in
I am using GWT to write a simple app. Ive divided the view into
When using GWT 2.0.x and SmartGWT 2.2 Code as simple as: public class SmartGwtTest
I'm using GWT 2.3 and I have json-p requests in my code similar to
We are using GWT 2.4.0. We are using Grid in our application. But we

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.