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 7007765
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T21:38:58+00:00 2026-05-27T21:38:58+00:00

I am writing a test to see how event handlers should work but it

  • 0

I am writing a test to see how event handlers should work but it seems I am doing something wrong here because I cannot see the added Widget to the flextable 🙁

Here is my code snippet

Composite A:

B b=new B();
Button addItemButton = new Button("+");
        addItemButton.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent event) {
                Window.alert("Hello world!");
                b.addItem(itemTable);
            }

        });

Composite B:

public void addItem(FlexTable itemTable)
    {



        itemTable.add(new C());
    }

Composite C:

...

Button removeRow=new Button();
removeButton.addClickHandler(new ClickHandler() {
                public void onClick(ClickEvent event) {

                    itemTable.removeRow(?);
                }

            });

I mean nothing adds to the itemTable when I run it as GWT app in my default Internet Browser. How to refresh ItemTable or something to see its added or removed rows?

Any useful comments are appreciated

  • 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-05-27T21:38:58+00:00Added an answer on May 27, 2026 at 9:38 pm

    You need to look more closely at the GWT Stocks example. This is the code section which actually adds the row:

     // Add the stock to the table.
        int row = stocksFlexTable.getRowCount();
        stocks.add(symbol);
        stocksFlexTable.setText(row, 0, symbol);
    

    The call to stocksFlexTable.setText() is what creates the row in the table and sets the text. So your code for B and C should look more like this:

    //In Composite B
    public void addItem(FlexTable itemTable) {  
      int row = itemTable.getRowCount();
      itemTable.setText(row, 0, symbol);
      itemTable.add(new C(row));
    }
    
    //In Composite C, the constructor saves the int argument as the field 'row'
    Button removeRow=new Button();
    removeButton.addClickHandler(new ClickHandler() {
      public void onClick(ClickEvent event) {
        itemTable.removeRow(C.this.row);
      }
    });
    

    If you just want to stack a bunch of widgets on top of each other (so if you don’t create more than one column in the table), you should just use the VerticalPanel. It’s add() method will do what you were expecting.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing a bash script and I need a test to see whether a
I'm writing a test to see if my getHibernateTemplate().delete(x) works. Now I've discovered that
I writing test cases for Android apps using Robotium. One of my test cases
In writing Test case as I know, first step/task is to identify the Test
I'm writing test code that needs to clean up the entities it creates when
I'm fairly new to writing test cases and this will be my first major
We want to design a simple domain specific language for writing test scripts to
Writing a test app to emulate PIO lines, I have a very simple Python/Tk
I'm writing a test case where I'm trying to use mockito to avoid entering
I am writing a test using easymock + powermock, the reason I am using

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.