@@ -0,0 +1,2750 @@
+package edu.colorado.csdms.wmt.client.ui.panel;%0A%0Aimport com.google.gwt.event.dom.client.ClickEvent;%0Aimport com.google.gwt.event.dom.client.ClickHandler;%0Aimport com.google.gwt.user.client.Window;%0Aimport com.google.gwt.user.client.ui.Grid;%0Aimport com.google.gwt.user.client.ui.HTML;%0Aimport com.google.gwt.user.client.ui.HasHorizontalAlignment;%0Aimport com.google.gwt.user.client.ui.PopupPanel;%0Aimport com.google.gwt.user.client.ui.VerticalPanel;%0A%0Aimport edu.colorado.csdms.wmt.client.data.ComponentJSO;%0A%0A/**%0A * A panel that displays WMT component metadata (id, url, author, etc.).%0A * %0A * @author Mark Piper (mark.piper@colorado.edu)%0A */%0Apublic class ComponentInformationPanel extends PopupPanel %7B%0A%0A  private static String%5B%5D LABELS = %7B%22title%22, %22summary%22, %22url%22, %22author%22%7D;%0A  private Grid grid;%0A  private ComponentJSO componentJSO;%0A%0A  /**%0A   * Makes a new %7B@link ComponentInformationPanel%7D.%0A   * %0A   * @param componentJSO the panel displays information for this component%0A   */%0A  public ComponentInformationPanel(ComponentJSO componentJSO) %7B%0A%0A    super(true); // autohide%0A    this.componentJSO = componentJSO;%0A    this.setStyleName(%22wmt-PopupPanel%22);%0A%0A    grid = new Grid(LABELS.length, 1);%0A    grid.setStyleName(%22wmt-Label%22);%0A    grid.setCellPadding(5); // px%0A    %0A    VerticalPanel contents = new VerticalPanel();%0A    contents.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);%0A    contents.setWidth(%2235em%22);%0A    contents.add(grid);    %0A    this.add(contents);%0A    %0A    // Populate the panel with component information.%0A    populatePanel();%0A  %7D%0A%0A  public void populatePanel() %7B%0A    String title = componentJSO.getName();%0A    if (componentJSO.getVersion() != null) %7B%0A      title += %22 v%22 + componentJSO.getVersion();%0A    %7D%0A    if (componentJSO.getDoi() != null) %7B%0A      title += %22 (%22 + componentJSO.getDoi() + %22)%22;%0A    %7D%0A    title = %22%3Cb%3E%22 + title + %22%3C/b%3E%22;%0A    String url = %22%3Ca href='%22 + componentJSO.getURL() + %22'%3E%22 %0A        + componentJSO.getURL() + %22%3C/a%3E%22;%0A    String author = (componentJSO.getAuthor() == null) %0A        ? %22 %22 : componentJSO.getAuthor();%0A    String%5B%5D info = %7Btitle, componentJSO.getSummary(), url, %0A        %22Model developer: %22 + author%7D;%0A%0A    HTML urlHtml = null;%0A    for (int i = 0; i %3C LABELS.length; i++) %7B%0A      if (url.equals(info%5Bi%5D)) %7B%0A        urlHtml = new HTML(info%5Bi%5D);%0A        grid.setWidget(i, 0, urlHtml);%0A      %7D else %7B%0A        grid.setWidget(i, 0, new HTML(info%5Bi%5D));%0A      %7D%0A    %7D%0A    %0A    /*%0A     *  Intercepts the click on the component URL and opens it in a new tab.%0A     */%0A    urlHtml.addClickHandler(new ClickHandler() %7B%0A      @Override%0A      public void onClick(ClickEvent event) %7B%0A        event.preventDefault();%0A        Window.open(componentJSO.getURL(), %22componentInfo%22, null);%0A      %7D%0A    %7D);%0A%0A  %7D%0A%7D%0A

Make a menu panel for displaying component information