Package org.mt4j.input.inputProcessors.componentProcessors

Examples of org.mt4j.input.inputProcessors.componentProcessors.AbstractCursorProcessor


      //sprich bei drag : 1 entry mit drag
      //bei rotate/scale : 2 entries aber kein drag entry mehr gebraucht
      SortedMap<AbstractCursorProcessor, Integer> m = lockSeekingProcessorsToPriority.headMap(ia);
      Set<AbstractCursorProcessor> k = m.keySet();
      for (Iterator<AbstractCursorProcessor> iterator = k.iterator(); iterator.hasNext();) {
        AbstractCursorProcessor processor = (AbstractCursorProcessor) iterator.next();
        logger.debug("itereating and removing old, lower priority processor: "  + processor);
        iterator.remove();
      }
     
      logger.debug("Cursor: " + this.getId() + " LOCKED sucessfully, send lock signal - Cursor priority was lower " + "(" + currentLockPriority +   ")" " than the gesture priority (" + ia.getLockPriority() + ")");
View Full Code Here


  private void cursorLockedByHigherPriorityGesture(AbstractCursorProcessor ia, int gesturePriority){
    if (!interestedProcessorsToPriority.isEmpty()){
      SortedMap<AbstractCursorProcessor, Integer> lesserPriorityGestureMap = interestedProcessorsToPriority.headMap(ia); //get analyzers with strictly lower priority than the locking one
      Set<AbstractCursorProcessor> lesserPriorityGestureKeys = lesserPriorityGestureMap.keySet();
      for (Iterator<AbstractCursorProcessor> iterator = lesserPriorityGestureKeys.iterator(); iterator.hasNext();) {
        AbstractCursorProcessor processor = (AbstractCursorProcessor) iterator.next();
        //Only send lock signal to the processors whos priority is lower than the current locking cursor priority
          if (processor instanceof AbstractCursorProcessor){
            AbstractCursorProcessor a = (AbstractCursorProcessor)processor;
            logger.debug("Cursor: " + this.getId() + " Sending cursor LOCKED signal to: " + a.getName());
          }
          processor.cursorLocked(this, ia);
      }
    }
  }
View Full Code Here

   * @param ia the ia
   */
  public void unregisterForLocking(AbstractCursorProcessor ia){
    Set<AbstractCursorProcessor> keys = interestedProcessorsToPriority.keySet();
    for (Iterator<AbstractCursorProcessor> iterator = keys.iterator(); iterator.hasNext();) {
      AbstractCursorProcessor inputAnalyzer = (AbstractCursorProcessor) iterator.next();
      if (inputAnalyzer.equals(ia)){
        iterator.remove();
      }
    }
//    if (interestedAnalyzersToPriority.containsKey(ia)){ //FIXME REMOVE, NOT RELIABLE - BUG?
//      interestedAnalyzersToPriority.remove(ia);
View Full Code Here

//      //remove the analyzer from the priority map in any case
//      lockSeekingAnalyzersToPriority.remove(ia);
//    }
      Set<AbstractCursorProcessor> keys = lockSeekingProcessorsToPriority.keySet();
      for (Iterator<AbstractCursorProcessor> iterator = keys.iterator(); iterator.hasNext();) {
        AbstractCursorProcessor inputProcessor = iterator.next();
        if (inputProcessor.equals(ia)){
          iterator.remove();
          logger.debug("Removed " + ia + " from lockSeekingAnalyzersToPriority list.");
        }
      }
   
      //dont send released signal if cursor was consumed by higher priority anyway
      //should actually not occur because we should only call release when we have a lock on the cursor
      if (beforeLockPriority > unlockingGesturePriority){
        logger.debug("Trying to unlock cursor, but cursor was already locked by higher priority.");
        return;
      }
     
      int afterRemoveLockPriority = this.getCurrentLockPriority();
      //Only send released signal if the priority really was lowered by releasing (there can be more than 1 lock with the same lock priority)
      if (beforeLockPriority > afterRemoveLockPriority){
        if (!interestedProcessorsToPriority.isEmpty()){
          //Get strictly smaller priority gestures than the one relreasing, so that the ones with same priority dont get a signal
          SortedMap<AbstractCursorProcessor, Integer> lesserPriorityGestureMap = interestedProcessorsToPriority.headMap(interestedProcessorsToPriority.lastKey());
//          SortedMap<IInputAnalyzer, Integer> lesserPriorityGestureMap = watchingAnalyzersToPriority.headMap(ia);
          Set<AbstractCursorProcessor> lesserPriorityGestureKeys = lesserPriorityGestureMap.keySet();
          for (Iterator<AbstractCursorProcessor> iterator = lesserPriorityGestureKeys.iterator(); iterator.hasNext();) {
            AbstractCursorProcessor processor = (AbstractCursorProcessor) iterator.next();
           
            //Only send released signal to the analyzers whos priority is higher than the current cursor priority
            //the current highest priority of the cursor can change when released is called on a gesture that successfully
            //locks this cursor, so check each loop iteration
            if (   processor.getLockPriority() <  unlockingGesturePriority //Only call on gestures with a lower priority than the one releasing the lock
                && this.getCurrentLockPriority()   <= processor.getLockPriority() //only call unLocked on analyzers with a lower or equal lockpriority
            ){
              processor.cursorUnlocked(this);
              //FIXME funktioniert das, wenn bei claim in anderer geste wieder was in die liste geadded wird etc?
            }
          }
        }
      }
View Full Code Here

  public void printLockSeekingAnalyzerList() {
    Set<AbstractCursorProcessor> claimed = lockSeekingProcessorsToPriority.keySet();
    logger.debug("Lock seeking processors list of cursor: " + this.getId());
    for (Iterator<AbstractCursorProcessor> iterator = claimed.iterator(); iterator.hasNext();) {
      AbstractCursorProcessor inputAnalyzer = (AbstractCursorProcessor) iterator.next();
      logger.debug(inputAnalyzer.getClass() + " " + " Priority: " + inputAnalyzer.getLockPriority());
    }
  }
View Full Code Here

  public void printInterestedAnalyzersList() {
    Set<AbstractCursorProcessor> watching = interestedProcessorsToPriority.keySet();
    logger.debug("Interested processors list of cursor: " + this.getId());
    for (Iterator<AbstractCursorProcessor> iterator = watching.iterator(); iterator.hasNext();) {
      AbstractCursorProcessor inputAnalyzer = (AbstractCursorProcessor) iterator.next();
      logger.debug(inputAnalyzer.getClass() + " " + " Priority: " + inputAnalyzer.getLockPriority());
    }
  }
View Full Code Here

TOP

Related Classes of org.mt4j.input.inputProcessors.componentProcessors.AbstractCursorProcessor

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.