private synchronized void startAnimation(
     JComponent component, Part part, State startState, State endState, long millis) {
   boolean isForwardAndReverse = false;
   if (endState == State.DEFAULTED) {
     isForwardAndReverse = true;
   }
   Map<Part, AnimationState> map = animationStateMap.get(component);
   if (millis <= 0) {
     if (map != null) {
       map.remove(part);
       if (map.size() == 0) {
         animationStateMap.remove(component);
       }
     }
     return;
   }
   if (map == null) {
     map = new EnumMap<Part, AnimationState>(Part.class);
     animationStateMap.put(component, map);
   }
   map.put(part, new AnimationState(startState, millis, isForwardAndReverse));
   if (!timer.isRunning()) {
     timer.start();
   }
 }
Пример #2
0
 public void setColumnComparator(Class type, Comparator comparator) {
   if (comparator == null) {
     columnComparators.remove(type);
   } else {
     columnComparators.put(type, comparator);
   }
 }
Пример #3
0
 /** Remove all references to a given window, including removing all manipulators from it. */
 public synchronized void unregisterWindow(AWTGLAutoDrawable window) {
   if (window == null) {
     return;
   }
   WindowInfo info = (WindowInfo) windowToInfoMap.get(window);
   if (info != null) {
     Object[] manips = info.manips.toArray();
     for (int i = 0; i < manips.length; i++) {
       removeManipFromWindow((Manip) manips[i], window);
     }
     windowToInfoMap.remove(window);
     removeMouseListeners(window);
   }
 }
 @Override
 public void removeUsage(@NotNull Usage usage) {
   final UsageNode node = myUsageNodes.remove(usage);
   if (node != NULL_NODE && node != null && !myPresentation.isDetachedMode()) {
     UIUtil.invokeLaterIfNeeded(
         new Runnable() {
           @Override
           public void run() {
             if (isDisposed) return;
             TreeModel treeModel = myTree.getModel();
             ((DefaultTreeModel) treeModel).removeNodeFromParent(node);
             ((GroupNode) myTree.getModel().getRoot()).removeUsage(node);
           }
         });
   }
 }
 public synchronized void actionPerformed(ActionEvent e) {
   java.util.List<JComponent> componentsToRemove = null;
   java.util.List<Part> partsToRemove = null;
   for (JComponent component : animationStateMap.keySet()) {
     component.repaint();
     if (partsToRemove != null) {
       partsToRemove.clear();
     }
     Map<Part, AnimationState> map = animationStateMap.get(component);
     if (!component.isShowing() || map == null || map.size() == 0) {
       if (componentsToRemove == null) {
         componentsToRemove = new ArrayList<JComponent>();
       }
       componentsToRemove.add(component);
       continue;
     }
     for (Part part : map.keySet()) {
       if (map.get(part).isDone()) {
         if (partsToRemove == null) {
           partsToRemove = new ArrayList<Part>();
         }
         partsToRemove.add(part);
       }
     }
     if (partsToRemove != null) {
       if (partsToRemove.size() == map.size()) {
         // animation is done for the component
         if (componentsToRemove == null) {
           componentsToRemove = new ArrayList<JComponent>();
         }
         componentsToRemove.add(component);
       } else {
         for (Part part : partsToRemove) {
           map.remove(part);
         }
       }
     }
   }
   if (componentsToRemove != null) {
     for (JComponent component : componentsToRemove) {
       animationStateMap.remove(component);
     }
   }
   if (animationStateMap.size() == 0) {
     timer.stop();
   }
 }
Пример #6
0
 public void removeFromMenu(String name) {
   if (menuItems == null) return;
   menuItems.remove(name);
   if (menuItems.isEmpty()) menuItems = null;
   if (popupMenu != null) createPopupMenu();
 }
Пример #7
0
 public synchronized void setVariable(String variable, String value) {
   if (value == null) variables.remove(value);
   else variables.put(variable, value);
 }