001    package org.hackystat.projectbrowser.page.telemetry.inputpanel;
002    
003    import org.apache.wicket.markup.html.form.Button;
004    import org.apache.wicket.markup.html.form.Form;
005    import org.apache.wicket.markup.html.panel.Panel;
006    import org.hackystat.projectbrowser.ProjectBrowserSession;
007    import org.hackystat.projectbrowser.page.ProjectBrowserBasePage;
008    
009    /**
010     * Panel to let user select the project and telemetry to display.
011     * @author Shaoxuan Zhang
012     */
013    public class TelemetryInputPanel extends Panel {
014    
015      /** Support serialization. */
016      private static final long serialVersionUID = 1L;
017      
018      /**
019       * @param id the wicket id.
020       * @param page the page this panel is attached to.
021       */
022      public TelemetryInputPanel(String id, ProjectBrowserBasePage page) {
023        super(id);
024        add(new TelemetryInputForm("inputForm", page));
025        
026        Button cancelButton = new Button("cancel") {
027          /** Support serialization. */
028          public static final long serialVersionUID = 1L;
029          @Override
030          public void onSubmit() {
031            ProjectBrowserSession.get().getTelemetrySession().cancelDataUpdate();
032          }
033          @Override
034          public boolean isEnabled() {
035            return ProjectBrowserSession.get().getTelemetrySession().getDataModel().isInProcess();
036          }
037        };
038        add(new Form("cancelForm").add(cancelButton));
039      }
040    
041    }