public void handlePanelSpecificButtons(ActionEvent e) { if (e.getSource() == this.view.getCaptureButton()) { // capture button String currentPanelName = this.view.getCurrentPanelName(); if (currentPanelName.equals(SmartTestingView.FACE_LOGIN_PANEL)) { this.model.addImageCaptured(facialThread.getFaceFromImage()); this.view.hideFacialWindow(); } else if (currentPanelName.equals(SmartTestingView.FACE_REGISTRATION_PANEL)) { if (this.model.getImagesCapturedCounter() < REQ_IMAGES_NEEDED) { this.model.addImageCaptured(facialThread.getFaceFromImage()); this.view.setImagesNeededField( Integer.toString(REQ_IMAGES_NEEDED - this.model.getImagesCapturedCounter())); } else { this.view.hideFacialWindow(); } } } else if (e.getSource() == this.view.getSubmitButton()) { // submit button keystrokeProc.submitButtonPressed(); } else if (e.getSource() == this.view.getResetButton()) { keystrokeProc.reset(); } else if (e.getSource() == this.view.getContinueButton()) { generateURL(); openLink(); finished = true; this.view.setFacialUpdaterParentClosing(); } else if (e.getSource() == this.view.getLoginButton()) { loginProcess = true; registrationProcess = false; this.view.addLoginCards(); this.view.goToNextCard(); this.view.setCaptureButtonAL(this); this.view.setResetButtonAL(this); this.view.setContinueButtonAL(this); this.model.initializeFacesCapturedArray(); this.keystrokeProc.setUserLoggingIn(true); this.view.setInputFieldKeyAdapter(keys); enableFlowButtons(); panelChanged = true; } else if (e.getSource() == this.view.getRegisterButton()) { registrationProcess = true; loginProcess = false; this.view.addRegistrationCards(); this.view.goToNextCard(); this.view.setCaptureButtonAL(this); this.view.setResetButtonAL(this); this.view.setContinueButtonAL(this); this.model.initializeFacesCapturedArray(); this.keystrokeProc.setUserLoggingIn(false); this.view.setInputFieldKeyAdapter(keys); enableFlowButtons(); panelChanged = true; } else if (e.getSource() == this.view.getOkButton()) { this.view.closePopupWindow(); } }
public void checkCurrentPanel() { String currentPanelName = this.view.getCurrentPanelName(); if (!currentPanelName.equals(SmartTestingView.INITIAL_PANEL)) { this.view.setBackButtonEnabled(true); } switch (currentPanelName) { case SmartTestingView.LOGIN_PANEL: if (facialThread == null && !threadStarted) { this.view.createFacialLoginFrame(); facialThread = this.view.getFacialUpdater(); facialThread.start(); threadStarted = true; } break; case SmartTestingView.REGISTRATION_PANEL: if (facialThread == null && !threadStarted) { this.view.createFacialRegistrationFrame(); facialThread = this.view.getFacialUpdater(); facialThread.start(); threadStarted = true; } break; case SmartTestingView.FACE_LOGIN_PANEL: if (facialThread != null && threadStarted) { this.view.setLocationFacialCapture(); this.view.showFacialFrame(); } break; case SmartTestingView.FACE_REGISTRATION_PANEL: if (facialThread != null && threadStarted) { this.view.setLocationFacialCapture(); this.view.showFacialFrame(); } break; case SmartTestingView.INITIAL_PANEL: this.view.setBackButtonEnabled(false); break; case SmartTestingView.KEYSTROKE_LOGIN_PANEL: keystrokeProc.userLoggingIn(); // grabs the data stored in the model this.view.getNextButton().setText("Finish"); break; case SmartTestingView.KEYSTROKE_REGISTRATION_PANEL: this.view.getNextButton().setText("Finish"); break; case SmartTestingView.SUCCESSFUL_LOGIN: disableFlowButtons(); break; case SmartTestingView.SUCCESSFUL_REGISTRATION: disableFlowButtons(); break; } }