Ejemplo n.º 1
0
  /**
   * <b>uDOM:</b> This method allows the removal of event listeners from the event target.
   *
   * @param type Specifies the event type of the EventListener being removed.
   * @param listener The listener parameter indicates the EventListener to be removed.
   * @param useCapture Specifies whether the EventListener being removed was registered as a
   *     capturing listener or not.
   */
  public void removeEventListener(
      java.lang.String type, org.w3c.dom.events.EventListener listener, boolean useCapture) {

    int i = listeners.indexOf(listener, 0);
    if (i > 0) {
      listeners.removeElementAt(i);
    }
  }
Ejemplo n.º 2
0
 /**
  * Mueve un nodo a la posición dada entre el conjunto de nodos que están a su mismo nivel.
  *
  * @param parent Nodo padre
  * @param node Nodo hijo a mover
  * @param newPos Nueva posición
  */
 public void moveNode(SVGNode parent, SVGNode node, int newPos) {
   TinyVector children = parent.children;
   if (children != null) {
     if (newPos >= 0 && newPos < children.count) {
       logger.debug("Moviendo nodo...");
       int curPos = children.indexOf(node, 0); // Posicion actual del nodo a mover
       logger.debug("Posicion actual: " + curPos + ", posicion nueva: " + newPos);
       if (curPos == -1) return;
       if (curPos < newPos) {
         // Desplazamiento hacia delante de los nodos hermanos
         for (int i = curPos; i < newPos; i++) {
           children.data[i] = children.data[i + 1];
         }
       } else if (curPos > newPos) {
         // Desplazamiento hacia atras de los nodos hermanos
         for (int i = curPos; i > newPos; i--) {
           children.data[i] = children.data[i - 1];
         }
       }
       // Insercion del nodo en su nueva posicion
       children.data[newPos] = node;
     }
   }
 }