Exemplo n.º 1
0
  public void loadBindingMap(InputMap im, ActionMap am) {
    results.append("Bound Actions\n");
    String unboundActions = "";
    String unboundInputKeys = "";
    Hashtable mi = buildReverseMap(im);
    Object[] k = am.allKeys();
    if (k != null) {
      for (int i = 0; i < k.length; i++) {
        if (mi.containsKey(k[i])) {
          results.append("  " + getActionName(k[i]));
          results.append(";" + mi.get(k[i]) + "\n");
        } else {
          unboundActions += ("  " + getActionName(k[i]) + "\n");
        }
      }
      results.append("\nUnbound Actions\n\n");
      results.append(unboundActions);
    }

    results.append("\nUnbound InputMap Entries\n");
    k = im.allKeys();
    if (k != null) {
      for (int i = 0; i < k.length; i++) {
        KeyStroke key = (KeyStroke) k[i];
        Object actionKey = im.get(key);
        if (am.get(actionKey) == null) {
          results.append("  " + im.get((KeyStroke) k[i]) + ": " + k[i] + "\n");
        }
      }
    }
  }
Exemplo n.º 2
0
 public void loadInputMap(InputMap im, String indent) {
   KeyStroke[] k = im.allKeys();
   if (k == null) {
     results.append(indent + "No InputMap defined\n");
   } else {
     results.append(indent + "\nInputMap (" + k.length + " local keys)\n");
   }
   if (k != null) {
     for (int i = 0; i < k.length; i++) {
       results.append(indent + "  Key:  " + k[i] + ", binding: " + im.get(k[i]) + "\n");
     }
   }
 }
Exemplo n.º 3
0
 private Hashtable buildReverseMap(InputMap im) {
   KeyStroke k[] = im.allKeys();
   Hashtable h = new Hashtable();
   if (k != null) {
     for (int i = 0; i < k.length; i++) {
       Object nk = im.get(k[i]);
       Object cv = h.get(nk);
       if (h.containsKey(nk)) {
         ((Vector) cv).add(k[i]);
       } else {
         Vector v = new Vector();
         v.add(k[i]);
         h.put(nk, v);
       }
     }
   }
   return h;
 }