Package org.codehaus.enunciate.samples.petclinic.client.schema

Examples of org.codehaus.enunciate.samples.petclinic.client.schema.Owner


                grid.getCellFormatter().setHorizontalAlignment(0, 3, HasAlignment.ALIGN_CENTER);
                grid.getRowFormatter().setStyleName(0, "clinic-tables-header");
                int row = 1;
                Iterator<Owner> it = collection.iterator();
                while (it.hasNext()) {
                  final Owner owner = it.next();
                  final Label nameLabel = new Label(owner.getFirstName() + " " + owner.getLastName());
                  nameLabel.addStyleName("clinic-clickable");
                  nameLabel.addClickListener(new ClickListener() {
                    public void onClick(Widget widget) {
                      final DialogBox detailsPanel = new DialogBox(true);
                      final VerticalPanel petList = new VerticalPanel();
                      petList.add(new Label("Pets of " + nameLabel.getText() + ":"));
                      detailsPanel.setWidget(petList);
                      detailsPanel.setPopupPositionAndShow(new PopupPanel.PositionCallback() {
                        public void setPosition(int offsetWidth, int offsetHeight) {
                          detailsPanel.setPopupPosition(nameLabel.getAbsoluteLeft(), nameLabel.getAbsoluteTop());
                        }
                      });
                      Iterator petsIt = owner.getPetIds().iterator();
                      while (petsIt.hasNext()) {
                        final Integer petId = (Integer) petsIt.next();
                        clinic.loadPet(petId.intValue(), new AsyncCallback<Pet>() {
                          public void onSuccess(Pet response) {
                            petList.add(new Label("A " + response.getType().getName() + " named " + response.getName() + "."));
                          }

                          public void onFailure(Throwable throwable) {
                            petList.add(new Label("Error loading pet " + petId + ": " + throwable.getMessage()));
                          }
                        });
                      }
                    }
                  });
                  grid.setWidget(row, 0, nameLabel);
                  grid.setWidget(row, 1, new Label(owner.getTelephone()));
                  grid.setWidget(row, 2, new Label(owner.getAddress()));
                  grid.setWidget(row, 3, new Label(owner.getCity()));
                  row++;
                }
              }
            }
View Full Code Here

TOP

Related Classes of org.codehaus.enunciate.samples.petclinic.client.schema.Owner

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.