@SuppressWarnings("unchecked") private void readObject(ObjectInputStream s) throws ClassNotFoundException, IOException { s.defaultReadObject(); Object typeOrNull; while (null != (typeOrNull = s.readObject())) { if ("callback".equals(typeOrNull)) { Object handler = s.readObject(); String method = (String) s.readObject(); addActionListener(EventHandler.create(ActionListener.class, handler, method)); } else if (BooleanInvocationHandler.class.getName().equals(typeOrNull)) { Object handler = s.readObject(); String method = (String) s.readObject(); addItemListener(new BooleanInvocationHandler(handler, method)); } else { ClassLoader cl = Thread.currentThread().getContextClassLoader(); EventListener l = (EventListener) s.readObject(); addListener((Class<EventListener>)Class.forName((String)typeOrNull, true, cl), l); } } } }
/** * Registers a callback method when the Action corresponding to * the action id is invoked. When a Component that was constructed from the * Action identified by the action id invokes actionPerformed then the method * named will be invoked on the handler Object. * <p> * If the Action represented by the action id is a StateChangeAction, then * the method passed should take an int as an argument. The value of * getStateChange() on the ItemEvent object will be passed as the parameter. * * @param handler the object which will be perform the action * @param method the name of the method on the handler which will be called. */ public void registerCallback(Object handler, String method) { if (isStateAction()) { // Create a handler for toggle type actions. addItemListener(new BooleanInvocationHandler(handler, method)); } else { // Create a new ActionListener using the dynamic proxy API. addActionListener(EventHandler.create(ActionListener.class, handler, method)); } }
/** * Registers a callback method when the Action corresponding to * the action id is invoked. When a Component that was constructed from the * Action identified by the action id invokes actionPerformed then the method * named will be invoked on the handler Object. * <p> * If the Action represented by the action id is a StateChangeAction, then * the method passed should take an int as an argument. The value of * getStateChange() on the ItemEvent object will be passed as the parameter. * * @param handler the object which will be perform the action * @param method the name of the method on the handler which will be called. */ public void registerCallback(Object handler, String method) { if (isStateAction()) { // Create a handler for toogle type actions. addItemListener(new BooleanInvocationHandler(handler, method)); } else { // Create a new ActionListener using the dynamic proxy api. addActionListener((ActionListener)EventHandler.create(ActionListener.class, handler, method)); } }
/** * Registers a callback method when the Action corresponding to * the action id is invoked. When a Component that was constructed from the * Action identified by the action id invokes actionPerformed then the method * named will be invoked on the handler Object. * <p> * If the Action represented by the action id is a StateChangeAction, then * the method passed should take an int as an argument. The value of * getStateChange() on the ItemEvent object will be passed as the parameter. * * @param handler the object which will be perform the action * @param method the name of the method on the handler which will be called. */ public void registerCallback(Object handler, String method) { if (isStateAction()) { // Create a handler for toggle type actions. addItemListener(new BooleanInvocationHandler(handler, method)); } else { // Create a new ActionListener using the dynamic proxy API. addActionListener(EventHandler.create(ActionListener.class, handler, method)); } }
/** * Registers a callback method when the Action corresponding to * the action id is invoked. When a Component that was constructed from the * Action identified by the action id invokes actionPerformed then the method * named will be invoked on the handler Object. * <p> * If the Action represented by the action id is a StateChangeAction, then * the method passed should take an int as an argument. The value of * getStateChange() on the ItemEvent object will be passed as the parameter. * * @param handler the object which will be perform the action * @param method the name of the method on the handler which will be called. */ public void registerCallback(Object handler, String method) { if (isStateAction()) { // Create a handler for toggle type actions. addItemListener(new BooleanInvocationHandler(handler, method)); } else { // Create a new ActionListener using the dynamic proxy API. addActionListener(EventHandler.create(ActionListener.class, handler, method)); } }
@SuppressWarnings("unchecked") private void readObject(ObjectInputStream s) throws ClassNotFoundException, IOException { s.defaultReadObject(); Object typeOrNull; while (null != (typeOrNull = s.readObject())) { if ("callback".equals(typeOrNull)) { Object handler = s.readObject(); String method = (String) s.readObject(); addActionListener(EventHandler.create(ActionListener.class, handler, method)); } else if (BooleanInvocationHandler.class.getName().equals(typeOrNull)) { Object handler = s.readObject(); String method = (String) s.readObject(); addItemListener(new BooleanInvocationHandler(handler, method)); } else { ClassLoader cl = Thread.currentThread().getContextClassLoader(); EventListener l = (EventListener) s.readObject(); addListener((Class<EventListener>)Class.forName((String)typeOrNull, true, cl), l); } } } }
@SuppressWarnings("unchecked") private void readObject(ObjectInputStream s) throws ClassNotFoundException, IOException { s.defaultReadObject(); Object typeOrNull; while (null != (typeOrNull = s.readObject())) { if ("callback".equals(typeOrNull)) { Object handler = s.readObject(); String method = (String) s.readObject(); addActionListener(EventHandler.create(ActionListener.class, handler, method)); } else if (BooleanInvocationHandler.class.getName().equals(typeOrNull)) { Object handler = s.readObject(); String method = (String) s.readObject(); addItemListener(new BooleanInvocationHandler(handler, method)); } else { ClassLoader cl = Thread.currentThread().getContextClassLoader(); EventListener l = (EventListener) s.readObject(); addListener((Class<EventListener>)Class.forName((String)typeOrNull, true, cl), l); } } } }