Results 1 to 2 of 2

Thread: AsyncCallback return a HorizontalPanel to a DisclosurePanel

  1. #1
    Sencha User
    Join Date
    Aug 2016
    Location
    Australia
    Posts
    1
    Vote Rating
    0
      0  

    Default AsyncCallback return a HorizontalPanel to a DisclosurePanel

    I want to return a HorizontalPanel to a DisclosurePanel from an AsyncCallback on the client side. The code I have is (note the commented out addressDisclosurePanel.add(addressHorizontalPanel) which is the part I need to work):

    private DisclosurePanel addressDisclosurePanel(String nameId) {
    final DisclosurePanel addressDisclosurePanel = new DisclosurePanel("Address");

    //Get the Addresses
    AsyncCallback<List<Address>> callback = new GetAddressHandler<List<Address>>(PersonalDetailsView.this);
    rpc.getAddressList(nameId, callback);

    //addressDisclosurePanel.add(addressHorizontalPanel);

    return addressDisclosurePanel;
    }

    class GetAddressHandler<T> implements AsyncCallback<List<Address>> {
    //Get the list of Addresses.
    PersonalDetailsView view;

    final HorizontalPanel addressHorizontalPanel = new HorizontalPanel();

    public GetAddressHandler(PersonalDetailsView view) {
    this.view = view;
    }

    public void onFailure(Throwable ex) {
    System.out.println("RPC call failed - GetAddressHandler - Notify Administrator.");
    Window.alert("Connection failed - please retry.");
    }
    public void onSuccess(List<Address> result) {
    Window.alert("Render address.");
    addressHorizontalPanel.add(view.renderAddresses(result));
    }
    }

    private FlexTable renderAddresses(List<Address> addressList) {
    //Load each TabPanel with Addresses
    Window.alert("get address.");

    final FlexTable flexTableAddress = new FlexTable();

    if (addressList == null || addressList.isEmpty()) {
    //Add a place to add an address

    //Address Type
    final Label lblAddressType = new Label("Address Type:");
    lblAddressType.setStyleName("gwt-Label-Login");
    flexTableAddress.setWidget(0, 0, lblAddressType);

    final TextBox textBoxAddressType = new TextBox();
    textBoxAddressType.setStyleName("gwt-TextBox");
    textBoxAddressType.setWidth("300px");
    flexTableAddress.setWidget(0, 1, textBoxAddressType);

    }else{
    int row = 0;
    //
    //Create a place to display each Address and allow update
    //
    for (final Address eachAddress : addressList) {
    //Store key
    final String addId = eachAddress.getAddId();
    Window.alert("addId = " + addId);

    //Address Type
    final Label lblAddressType = new Label("Address Type:");
    lblAddressType.setStyleName("gwt-Label-Login");
    flexTableAddress.setWidget(row, 0, lblAddressType);

    final TextBox textBoxAddressType = new TextBox();
    textBoxAddressType.setText(eachAddress.getAddType());
    textBoxAddressType.setStyleName("gwt-TextBox");
    textBoxAddressType.setWidth("300px");
    flexTableAddress.setWidget(row, 1, textBoxAddressType);

    row++;
    }
    }
    return flexTableAddress;
    }

    Regards,

    Glyn

  2. #2
    Sencha User
    Join Date
    Feb 2017
    Posts
    2
    Vote Rating
    0
      0  

    Default

    i hope you will get help
    my programs website i hope to visit it and download all programs you need free : -http://www.downloadprogramsline.com/

Similar Threads

  1. AsyncCallback
    By Mike_javaJunior in forum Ext GWT: Q&A
    Replies: 1
    Last Post: 26 Feb 2013, 3:58 AM
  2. DisclosurePanel equivalent
    By subapat in forum Ext GWT: Help & Discussion (1.x)
    Replies: 1
    Last Post: 8 Jan 2009, 1:21 PM
  3. AsyncCallback its possible create a new?
    By fother in forum Ext GWT: Help & Discussion (1.x)
    Replies: 2
    Last Post: 17 Nov 2008, 7:29 AM
  4. Replies: 5
    Last Post: 22 Jun 2008, 12:19 PM
  5. DataCallback vs. AsyncCallback?
    By jgindin in forum Community Discussion
    Replies: 1
    Last Post: 29 Apr 2008, 7:11 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •