/** * Maps {@code JComponent.addAncestorListener(AncestorListener)} * through queue */ public void addAncestorListener(final AncestorListener ancestorListener) { runMapping(new MapVoidAction("addAncestorListener") { @Override public void map() { ((JComponent) getSource()).addAncestorListener(ancestorListener); } }); }
/** * Maps {@code JComponent.removeAncestorListener(AncestorListener)} * through queue */ public void removeAncestorListener(final AncestorListener ancestorListener) { runMapping(new MapVoidAction("removeAncestorListener") { @Override public void map() { ((JComponent) getSource()).removeAncestorListener(ancestorListener); } }); }
/** * Fires an AncestorEvent to this component's and all of its child * component's AncestorListeners. * * @param ancestor the component that triggered the event * @param id the kind of ancestor event that should be fired */ void fireAncestorEvent(JComponent ancestor, int id) { // Fire event for registered ancestor listeners of this component. AncestorListener[] listeners = getAncestorListeners(); if (listeners.length > 0) { AncestorEvent ev = new AncestorEvent(this, id, ancestor, ancestor.getParent()); for (int i = 0; i < listeners.length; i++) { switch (id) { case AncestorEvent.ANCESTOR_MOVED: listeners[i].ancestorMoved(ev); break; case AncestorEvent.ANCESTOR_ADDED: listeners[i].ancestorAdded(ev); break; case AncestorEvent.ANCESTOR_REMOVED: listeners[i].ancestorRemoved(ev); break; } } } // Dispatch event to all children. int numChildren = getComponentCount(); for (int i = 0; i < numChildren; i++) { Component child = getComponent(i); if (! (child instanceof JComponent)) continue; JComponent jc = (JComponent) child; jc.fireAncestorEvent(ancestor, id); } }
private void fireAncestorEvent(int eventID, Container ancestor, Container ancestorParent) { final AncestorListener[] listeners = getAncestorListeners(); AncestorEvent ancestorEvent = new AncestorEvent(JComponent.this, eventID, ancestor, ancestorParent); for (int i = 0; i < listeners.length; i++) { if (eventID == AncestorEvent.ANCESTOR_ADDED) { listeners[i].ancestorAdded(ancestorEvent); } else if (eventID == AncestorEvent.ANCESTOR_REMOVED) { listeners[i].ancestorRemoved(ancestorEvent); } else if (eventID == AncestorEvent.ANCESTOR_MOVED) { listeners[i].ancestorMoved(ancestorEvent); } } }
/** * Uninstalls any existing component updater from component */ public static void uninstall ( JComponent component ) { for ( AncestorListener listener : component.getAncestorListeners () ) { if ( listener instanceof UpdateTimer ) { component.removeAncestorListener ( listener ); } } }
/** * Checks if component has any component updater installed */ public static boolean isInstalled ( JComponent component ) { for ( AncestorListener listener : component.getAncestorListeners () ) { if ( listener instanceof UpdateTimer ) { return true; } } return false; }
public AncestorListener getAncestorListener() { return ancestorListener; }
/** Overridden to do nothing for performance reasons */ public @Override void addAncestorListener(AncestorListener l) { if (swingRendering) { super.addAncestorListener(l); } }
void addAncestorListener(AncestorListener l) { }
void removeAncestorListener(AncestorListener l) { }
AncestorListener[] getAncestorListeners() { return null; }
public void addAncestorListener(final AncestorListener listener) { if(listener == null){ return; } list.add(AncestorListener.class, listener); }
public void removeAncestorListener(final AncestorListener listener) { if(listener == null){ return; } list.remove(AncestorListener.class, listener); }
public AncestorListener[] getAncestorListeners() { return list.getListeners(AncestorListener.class); }
@Override public AncestorListener[] getAncestorListeners() { return JBroTableHeader.this.getAncestorListeners(); }
@Override public void removeAncestorListener( AncestorListener listener ) { JBroTableHeader.this.removeAncestorListener( listener ); }
@Override public void addAncestorListener( AncestorListener listener ) { JBroTableHeader.this.addAncestorListener( listener ); }
public void removeAncestorListener(AncestorListener ancestorListener) { listenerList.remove(AncestorListener.class, ancestorListener); removeAncestorComponentNotifier(); }
public void addAncestorListener(AncestorListener ancestorListener) { addAncestorComponentNotifier(); listenerList.add(AncestorListener.class, ancestorListener); }
public AncestorListener[] getAncestorListeners() { return getListeners(AncestorListener.class); }
public String convertToString(Object comp, String key, Object value) { Accessible component = (Accessible) comp; if (value == null) return "null"; if ("actionlisteners".equals(key)) return JFCUtil.getListenerNames(ActionListener.class, value); else if ("ancestorlisteners".equals(key)) return JFCUtil.getListenerNames(AncestorListener.class, value); else if ("componentlisteners".equals(key)) return JFCUtil.getListenerNames(ComponentListener.class, value); else if ("windowlisteners".equals(key)) return JFCUtil.getListenerNames(WindowListener.class, value); else if ("containerlisteners".equals(key)) return JFCUtil.getListenerNames(ContainerListener.class, value); else if ("focuslisteners".equals(key)) return JFCUtil.getListenerNames(FocusListener.class, value); else if ("hierarchyboundslisteners".equals(key)) return JFCUtil.getListenerNames(HierarchyBoundsListener.class, value); else if ("hierarchylisteners".equals(key)) return JFCUtil.getListenerNames(HierarchyListener.class, value); else if ("inputmethodlisteners".equals(key)) return JFCUtil.getListenerNames(InputMethodListener.class, value); else if ("keylisteners".equals(key)) return JFCUtil.getListenerNames(KeyListener.class, value); else if ("mouselisteners".equals(key)) return JFCUtil.getListenerNames(MouseListener.class, value); else if ("mousemotionlisteners".equals(key)) return JFCUtil.getListenerNames(MouseMotionListener.class, value); else if ("mousewheellisteners".equals(key)) return JFCUtil.getListenerNames(MouseWheelListener.class, value); else if ("propertychangelisteners".equals(key)) return JFCUtil.getListenerNames(PropertyChangeListener.class, value); else if ("vetoablechangelisteners".equals(key)) return JFCUtil.getListenerNames(VetoableChangeListener.class, value); else if ("class".equals(key)) return JFCUtil.getComponentClassName(component); else if ("icon".equals(key)) return JFCUtil.getIconName(component); else if ("layout".equals(key)) return JFCUtil.getLayoutName(component); return value.toString(); }
public void addAncestorListener(AncestorListener arg0) { InstrumentedUILog.add("1"); super.addAncestorListener(arg0); }
public AncestorListener[] getAncestorListeners() { InstrumentedUILog.add("25"); return super.getAncestorListeners(); }
public void removeAncestorListener(AncestorListener arg0) { InstrumentedUILog.add("89"); super.removeAncestorListener(arg0); }
public AncestorListener[] getAncestorListeners() { InstrumentedUILog .add(new Object[] { "JTextComponent.getAncestorListeners" }); return super.getAncestorListeners(); }
public void addAncestorListener(AncestorListener arg0) { InstrumentedUILog.add(new Object[] { "JTextComponent.addAncestorListener", arg0 }); super.addAncestorListener(arg0); }
public void removeAncestorListener(AncestorListener arg0) { InstrumentedUILog.add(new Object[] { "JTextComponent.removeAncestorListener", arg0 }); super.removeAncestorListener(arg0); }