Package de.offis.faint.gui.events

Examples of de.offis.faint.gui.events.EventRenamePerson


        return "Name";
      }
     
      public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
        if (!aValue.equals(Constants.UNKNOWN_FACE) && !aValue.equals("")){
          mainFrame.eventDispatcher.dispatchEvent(new EventRenamePerson(getValueAt(rowIndex, columnIndex).toString(), aValue.toString()));
          int row = table.getRowSorter().convertRowIndexToView(getRowForValue(aValue.toString()));
          table.changeSelection(row,columnIndex,false,false);
          repaint();
        }
      }
View Full Code Here


      mainFrame.browserTab.getImagePanel().getClassificationPanel().repaint();
    }
   
    // Rename a person
    else if (incomingEvent instanceof EventRenamePerson){
      EventRenamePerson event = (EventRenamePerson) incomingEvent;
      MainController.getInstance().getFaceDB().renameAnnotation(event.getOldName(), event.getNewName());
      mainFrame.browserTab.getAnnotationPanel().updateFromModel();
      mainFrame.browserTab.getImagePanel().getClassificationPanel().updateFromModel();
      mainFrame.faceDBTab.getPersonPanel().updateFromModel();
    }
   
        // Change training flag of region
    else if (incomingEvent instanceof EventModifyTrainingData){
      EventModifyTrainingData event = (EventModifyTrainingData) incomingEvent;
      event.getRegion().setUsedForTraining(event.getValue())
    }

   
    // Add a new person to the database
    else if (incomingEvent instanceof EventAddKnownPerson){
      EventAddKnownPerson event = (EventAddKnownPerson) incomingEvent;
      MainController.getInstance().getFaceDB().put(null, event.getName());
    }
   
    // Selected region changed
    else if (incomingEvent instanceof EventRegionSelectionChanged){
      EventRegionSelectionChanged event = (EventRegionSelectionChanged) incomingEvent;
      Region newRegion = event.getRegion();
     
      if (newRegion != null){
        ImageModel image = new ImageModel(newRegion.getImage());
        if (currentImage == null || !currentImage.equals(image))
        {
          dispatchEvent(new EventOpenImage(image));
         
          if (currentImage == null || !currentImage.equals(image))
            newRegion = null;
        }
      }
     
      if (currentRegion == null || !currentRegion.equals(newRegion)){
        currentRegion = newRegion;
        mainFrame.browserTab.getImagePanel().setSelectedRegion(newRegion);
        mainFrame.browserTab.getAnnotationPanel().setSelectedRegion(newRegion);
      }
     
      // Make sure browser tab is active
      if (currentRegion != null)
        this.dispatchEvent(new EventShowTab(MainFrame.TAB.BROWSER));
    }
   
    // AnnotationPanel has to be updated
    else if (incomingEvent instanceof EventUpdateAnnotationPanel) {
      mainFrame.browserTab.getAnnotationPanel().updateFromModel();     
    }
   
    // Delete selected region
    else if (incomingEvent instanceof EventDeleteRegion) {
      EventDeleteRegion event = (EventDeleteRegion) incomingEvent;
     
      // Delete region from database
      MainController.getInstance().getFaceDB().deleteRegion(event.getRegion());
     
      // Update view
      if (event.getRegion().getImage().equals(currentImage.getFile().getAbsolutePath())){
       
        mainFrame.browserTab.getAnnotationPanel().updateFromModel();
        mainFrame.browserTab.getImagePanel().repaint();
      }     
    }

    // Run Face Detection on current image
    else if (incomingEvent instanceof EventDetectFacesOnCurrentImage) {
     
      DetectionDialog dialog = mainFrame.browserTab.getDetectionDialog();
     
      dialog.performDetection(this.currentImage);
    }
   
    // Run Face Recognition on selected region
    else if (incomingEvent instanceof EventRecognizeFace) {
      EventRecognizeFace event = (EventRecognizeFace) incomingEvent;
     
      mainFrame.setEnabled(false);
     
      HashMap<String, Integer> recognitionResult = (MainController.getInstance().recognizeFace(event.getRegion()));
     
      if (this.currentRegion == event.getRegion())
        mainFrame.browserTab.getImagePanel().getClassificationPanel().updateRecognitionData(recognitionResult);
     
      mainFrame.setEnabled(true);
    }
   
    // Change minimum size of scan window
    else if (incomingEvent instanceof EventChangeScanWindowSize) {
        EventChangeScanWindowSize event = (EventChangeScanWindowSize) incomingEvent;
      MainController.getInstance().setScanWindowSize(event.getNewSize());
      mainFrame.browserTab.getImagePanel().repaint();
    }
   
    // Update menu bar
    else if (incomingEvent instanceof EventUpdateMenuBar) {
      EventUpdateMenuBar event = (EventUpdateMenuBar) incomingEvent;
      mainFrame.browserTab.getMenuBar().update(event.isDetectionAllowed());
    }
   
    // Shut down application and save settings
    else if (incomingEvent instanceof EventShutdownMainFrame) {
        MainController.getInstance().getDetectionHotSpot().serializeContent();
View Full Code Here

TOP

Related Classes of de.offis.faint.gui.events.EventRenamePerson

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.