Esempio n. 1
0
  /** Frees resources, clears references */
  public void dispose() {
    if (tempFloatingTimer != null) {
      tempFloatingTimer.stop();
    }

    if (initialized) {
      if (winListener != null) removeListener(winListener);
      if (cmpListener != null) c.removeComponentListener(cmpListener);

      wh.removeWindow(this, null);
      //			AbstractApplication.getApplication().addComponent( getClass().getName(), null );

      if (borrowMenuBar) {
        borrowMenuBar(null);
        wh.removeBorrowListener(this);
      }
      if (wh.getMenuBarBorrower() == this) wh.setMenuBarBorrower(null);
      if (ownMenuBar) {
        setJMenuBar(null);
        wh.getMenuBarRoot().destroy(this);
      }
    }

    if (w != null) {
      w.dispose();
    } else if (jif != null) {
      jif.dispose();
    }

    if (ggTitle != null) ggTitle.dispose();

    classPrefs = null;
    cmpListener = null;
    winListener = null;
  }
 @Override
 public void removeNotify() {
   super.removeNotify();
   Component parent = getParent();
   if (resizeHandler != null && parent != null) {
     parent.removeComponentListener(resizeHandler);
     resizeHandler = null;
   }
 }
 void uninstallListeners(Component component) {
   for (ComponentListener listener : componentListeners)
     component.removeComponentListener(listener);
   for (KeyListener listener : keyListeners) component.removeKeyListener(listener);
   for (MouseListener listener : mouseListeners) component.removeMouseListener(listener);
   for (MouseMotionListener listener : mouseMotionListeners)
     component.removeMouseMotionListener(listener);
   if (component instanceof Container) {
     Container container = (Container) component;
     container.removeContainerListener(containerListener);
     for (int iComp = container.getComponentCount(); iComp-- != 0; ) {
       uninstallListeners(container.getComponent(iComp));
     }
   }
 }
Esempio n. 4
0
    /** A |component| may have change its size. */
    protected void sizeMayHaveChanged(Component component) {
      logger.log(Level.FINER, "component = {0}", component);

      // assert component != null
      Integer h = new Integer(System.identityHashCode(component));

      this.logger.log(Level.FINER, "component = {0}, hash code = {1}", new Object[] {component, h});

      synchronized (this.waitedComponents) {
        if (!this.waitedComponents.contains(h)) {
          this.logger.log(Level.FINER, "Skip already known component: {0}", h);

          return;
        } // end of if

        Dimension s = component.getSize();

        logger.log(Level.FINER, "component size = {0}", s);

        this.waitedComponents.remove(h);
        component.removeComponentListener(this);

        if (isGreaterThan(s, this.commonSize)) {
          this.logger.finer("Skip lesser size");

          this.commonSize = s;

          if (this.componentRef != null) {
            this.componentRef.clear();
          } // end of if

          this.componentRef = new WeakReference<Object>(component);

          this.logger.log(Level.FINER, "Set new common size: {0}", this.commonSize);
        } // end of if
      } // end of sync

      // Finalize
      if (!this.waitedComponents.isEmpty()) {
        this.logger.log(Level.FINER, "Wait more component: {0}", this.waitedComponents.size());

        return;
      } // end of if

      this.waitedComponents.clear();

      bind();
    } // end of componentResized
 @Override
 protected void listeningStopped() {
   comp.removeComponentListener(handler);
   visible = false;
   handler = null;
 }
 /** @see Disposable#dispose() */
 @Override
 public void dispose() {
   // Unhook from component
   component.removeComponentListener(eventAdapter);
 }