/** try to register PropertyChangeListener to instance to fire its changes. * @param bean */ private void initPList (Object bean, BeanInfo bInfo, BeanNode.Descriptor descr) { EventSetDescriptor[] descs = bInfo.getEventSetDescriptors(); try { Method setter = null; for (int i = 0; descs != null && i < descs.length; i++) { setter = descs[i].getAddListenerMethod(); if (setter != null && setter.getName().equals("addPropertyChangeListener")) { // NOI18N propertyChangeListener = new PropL(createSupportedPropertyNames(descr)); setter.invoke(bean, new Object[] {WeakListeners.propertyChange(propertyChangeListener, bean)}); setSettingsInstance(bean); } } } catch (Exception ex) { // ignore } }
private void _addEvent( Hashtable<String, EventSetDescriptor> events, EventSetDescriptor descriptor ) { String key = descriptor.getName() + descriptor.getListenerType(); if (descriptor.getName().equals("propertyChange")) { _propertyChangeSource = true; } EventSetDescriptor oldDescriptor = events.get(key); if (oldDescriptor == null) { events.put(key, descriptor); return; } EventSetDescriptor composite = _createMergedEventSetDescriptor( oldDescriptor, descriptor); events.put(key, composite); }
static EventSetDescriptor __createMergedEventSetStub( EventSetDescriptor oldDescriptor, MethodDescriptor[] listenerDescriptors ) { try { EventSetDescriptor stubDescriptor = new EventSetDescriptor( oldDescriptor.getName(), oldDescriptor.getListenerType(), listenerDescriptors, oldDescriptor.getAddListenerMethod(), oldDescriptor.getRemoveListenerMethod()); // set the unicast attribute stubDescriptor.setUnicast(oldDescriptor.isUnicast()); return stubDescriptor; } catch (Exception e) { // _LOG.severe(e); return null; } }
public static void main(String[] args) throws IntrospectionException, NoSuchMethodException { EventSetDescriptor esd = new EventSetDescriptor( "foo", FooListener.class, new Method[] { FooListener.class.getMethod("fooHappened", EventObject.class), FooListener.class.getMethod("moreFooHappened", EventObject.class, Object.class), FooListener.class.getMethod("lessFooHappened"), }, Bean.class.getMethod("addFooListener", FooListener.class), Bean.class.getMethod("removeFooListener", FooListener.class) ); System.gc(); for (Method method : esd.getListenerMethods()) { System.out.println(method); } }
public static void main(String[] args) throws Exception { Class<?> bt = Accessor.getBeanType(); Class<?> lt = Accessor.getListenerType(); // test PropertyDescriptor PropertyDescriptor pd = new PropertyDescriptor("boolean", bt); test(pd.getReadMethod()); test(pd.getWriteMethod()); // test IndexedPropertyDescriptor IndexedPropertyDescriptor ipd = new IndexedPropertyDescriptor("indexed", bt); test(ipd.getReadMethod()); test(ipd.getWriteMethod()); test(ipd.getIndexedReadMethod()); test(ipd.getIndexedWriteMethod()); // test EventSetDescriptor EventSetDescriptor esd = new EventSetDescriptor(bt, "test", lt, "process"); test(esd.getAddListenerMethod()); test(esd.getRemoveListenerMethod()); test(esd.getGetListenerMethod()); test(esd.getListenerMethods()); }
@Override public EventSetDescriptor[] getEventSetDescriptors() { EventSetDescriptor[] es = new EventSetDescriptor[2]; try { es[iAction] = new EventSetDescriptor( TestClass.class, "actionListener", java.awt.event.ActionListener.class, new String[] {"actionPerformed"}, "addActionListener", "removeActionListener"); es[iMouse] = new EventSetDescriptor( TestClass.class, "mouseListener", java.awt.event.MouseListener.class, new String[] {"mouseClicked", "mousePressed", "mouseReleased", "mouseEntered", "mouseExited"}, "addMouseListener", "removeMouseListener"); } catch(IntrospectionException e) { e.printStackTrace(); } return es; }
private static EventSetDescriptor[] getEdescriptor(){ EventSetDescriptor[] eventSets = new EventSetDescriptor[14]; try { eventSets[EVENT_ancestorListener] = new EventSetDescriptor ( com.talent.aio.examples.im.client.ui.component.MyTextArea.class, "ancestorListener", javax.swing.event.AncestorListener.class, new String[] {"ancestorAdded", "ancestorRemoved", "ancestorMoved"}, "addAncestorListener", "removeAncestorListener" ); // NOI18N eventSets[EVENT_caretListener] = new EventSetDescriptor ( com.talent.aio.examples.im.client.ui.component.MyTextArea.class, "caretListener", javax.swing.event.CaretListener.class, new String[] {"caretUpdate"}, "addCaretListener", "removeCaretListener" ); // NOI18N eventSets[EVENT_componentListener] = new EventSetDescriptor ( com.talent.aio.examples.im.client.ui.component.MyTextArea.class, "componentListener", java.awt.event.ComponentListener.class, new String[] {"componentResized", "componentMoved", "componentShown", "componentHidden"}, "addComponentListener", "removeComponentListener" ); // NOI18N eventSets[EVENT_containerListener] = new EventSetDescriptor ( com.talent.aio.examples.im.client.ui.component.MyTextArea.class, "containerListener", java.awt.event.ContainerListener.class, new String[] {"componentAdded", "componentRemoved"}, "addContainerListener", "removeContainerListener" ); // NOI18N eventSets[EVENT_focusListener] = new EventSetDescriptor ( com.talent.aio.examples.im.client.ui.component.MyTextArea.class, "focusListener", java.awt.event.FocusListener.class, new String[] {"focusGained", "focusLost"}, "addFocusListener", "removeFocusListener" ); // NOI18N eventSets[EVENT_hierarchyBoundsListener] = new EventSetDescriptor ( com.talent.aio.examples.im.client.ui.component.MyTextArea.class, "hierarchyBoundsListener", java.awt.event.HierarchyBoundsListener.class, new String[] {"ancestorMoved", "ancestorResized"}, "addHierarchyBoundsListener", "removeHierarchyBoundsListener" ); // NOI18N eventSets[EVENT_hierarchyListener] = new EventSetDescriptor ( com.talent.aio.examples.im.client.ui.component.MyTextArea.class, "hierarchyListener", java.awt.event.HierarchyListener.class, new String[] {"hierarchyChanged"}, "addHierarchyListener", "removeHierarchyListener" ); // NOI18N eventSets[EVENT_inputMethodListener] = new EventSetDescriptor ( com.talent.aio.examples.im.client.ui.component.MyTextArea.class, "inputMethodListener", java.awt.event.InputMethodListener.class, new String[] {"inputMethodTextChanged", "caretPositionChanged"}, "addInputMethodListener", "removeInputMethodListener" ); // NOI18N eventSets[EVENT_keyListener] = new EventSetDescriptor ( com.talent.aio.examples.im.client.ui.component.MyTextArea.class, "keyListener", java.awt.event.KeyListener.class, new String[] {"keyTyped", "keyPressed", "keyReleased"}, "addKeyListener", "removeKeyListener" ); // NOI18N eventSets[EVENT_mouseListener] = new EventSetDescriptor ( com.talent.aio.examples.im.client.ui.component.MyTextArea.class, "mouseListener", java.awt.event.MouseListener.class, new String[] {"mouseClicked", "mousePressed", "mouseReleased", "mouseEntered", "mouseExited"}, "addMouseListener", "removeMouseListener" ); // NOI18N eventSets[EVENT_mouseMotionListener] = new EventSetDescriptor ( com.talent.aio.examples.im.client.ui.component.MyTextArea.class, "mouseMotionListener", java.awt.event.MouseMotionListener.class, new String[] {"mouseDragged", "mouseMoved"}, "addMouseMotionListener", "removeMouseMotionListener" ); // NOI18N eventSets[EVENT_mouseWheelListener] = new EventSetDescriptor ( com.talent.aio.examples.im.client.ui.component.MyTextArea.class, "mouseWheelListener", java.awt.event.MouseWheelListener.class, new String[] {"mouseWheelMoved"}, "addMouseWheelListener", "removeMouseWheelListener" ); // NOI18N eventSets[EVENT_propertyChangeListener] = new EventSetDescriptor ( com.talent.aio.examples.im.client.ui.component.MyTextArea.class, "propertyChangeListener", java.beans.PropertyChangeListener.class, new String[] {"propertyChange"}, "addPropertyChangeListener", "removePropertyChangeListener" ); // NOI18N eventSets[EVENT_vetoableChangeListener] = new EventSetDescriptor ( com.talent.aio.examples.im.client.ui.component.MyTextArea.class, "vetoableChangeListener", java.beans.VetoableChangeListener.class, new String[] {"vetoableChange"}, "addVetoableChangeListener", "removeVetoableChangeListener" ); // NOI18N } catch(IntrospectionException e) { e.printStackTrace(); }//GEN-HEADEREND:Events // Here you can add code for customizing the event sets array. return eventSets; }
private static EventSetDescriptor[] getEdescriptor(){ EventSetDescriptor[] eventSets = new EventSetDescriptor[15]; try { eventSets[EVENT_ancestorListener] = new EventSetDescriptor ( com.talent.aio.examples.im.client.ui.component.MsgTextAreaJPopupMenu.class, "ancestorListener", javax.swing.event.AncestorListener.class, new String[] {"ancestorAdded", "ancestorRemoved", "ancestorMoved"}, "addAncestorListener", "removeAncestorListener" ); // NOI18N eventSets[EVENT_componentListener] = new EventSetDescriptor ( com.talent.aio.examples.im.client.ui.component.MsgTextAreaJPopupMenu.class, "componentListener", java.awt.event.ComponentListener.class, new String[] {"componentResized", "componentMoved", "componentShown", "componentHidden"}, "addComponentListener", "removeComponentListener" ); // NOI18N eventSets[EVENT_containerListener] = new EventSetDescriptor ( com.talent.aio.examples.im.client.ui.component.MsgTextAreaJPopupMenu.class, "containerListener", java.awt.event.ContainerListener.class, new String[] {"componentAdded", "componentRemoved"}, "addContainerListener", "removeContainerListener" ); // NOI18N eventSets[EVENT_focusListener] = new EventSetDescriptor ( com.talent.aio.examples.im.client.ui.component.MsgTextAreaJPopupMenu.class, "focusListener", java.awt.event.FocusListener.class, new String[] {"focusGained", "focusLost"}, "addFocusListener", "removeFocusListener" ); // NOI18N eventSets[EVENT_hierarchyBoundsListener] = new EventSetDescriptor ( com.talent.aio.examples.im.client.ui.component.MsgTextAreaJPopupMenu.class, "hierarchyBoundsListener", java.awt.event.HierarchyBoundsListener.class, new String[] {"ancestorMoved", "ancestorResized"}, "addHierarchyBoundsListener", "removeHierarchyBoundsListener" ); // NOI18N eventSets[EVENT_hierarchyListener] = new EventSetDescriptor ( com.talent.aio.examples.im.client.ui.component.MsgTextAreaJPopupMenu.class, "hierarchyListener", java.awt.event.HierarchyListener.class, new String[] {"hierarchyChanged"}, "addHierarchyListener", "removeHierarchyListener" ); // NOI18N eventSets[EVENT_inputMethodListener] = new EventSetDescriptor ( com.talent.aio.examples.im.client.ui.component.MsgTextAreaJPopupMenu.class, "inputMethodListener", java.awt.event.InputMethodListener.class, new String[] {"inputMethodTextChanged", "caretPositionChanged"}, "addInputMethodListener", "removeInputMethodListener" ); // NOI18N eventSets[EVENT_keyListener] = new EventSetDescriptor ( com.talent.aio.examples.im.client.ui.component.MsgTextAreaJPopupMenu.class, "keyListener", java.awt.event.KeyListener.class, new String[] {"keyTyped", "keyPressed", "keyReleased"}, "addKeyListener", "removeKeyListener" ); // NOI18N eventSets[EVENT_menuKeyListener] = new EventSetDescriptor ( com.talent.aio.examples.im.client.ui.component.MsgTextAreaJPopupMenu.class, "menuKeyListener", javax.swing.event.MenuKeyListener.class, new String[] {"menuKeyTyped", "menuKeyPressed", "menuKeyReleased"}, "addMenuKeyListener", "removeMenuKeyListener" ); // NOI18N eventSets[EVENT_mouseListener] = new EventSetDescriptor ( com.talent.aio.examples.im.client.ui.component.MsgTextAreaJPopupMenu.class, "mouseListener", java.awt.event.MouseListener.class, new String[] {"mouseClicked", "mousePressed", "mouseReleased", "mouseEntered", "mouseExited"}, "addMouseListener", "removeMouseListener" ); // NOI18N eventSets[EVENT_mouseMotionListener] = new EventSetDescriptor ( com.talent.aio.examples.im.client.ui.component.MsgTextAreaJPopupMenu.class, "mouseMotionListener", java.awt.event.MouseMotionListener.class, new String[] {"mouseDragged", "mouseMoved"}, "addMouseMotionListener", "removeMouseMotionListener" ); // NOI18N eventSets[EVENT_mouseWheelListener] = new EventSetDescriptor ( com.talent.aio.examples.im.client.ui.component.MsgTextAreaJPopupMenu.class, "mouseWheelListener", java.awt.event.MouseWheelListener.class, new String[] {"mouseWheelMoved"}, "addMouseWheelListener", "removeMouseWheelListener" ); // NOI18N eventSets[EVENT_popupMenuListener] = new EventSetDescriptor ( com.talent.aio.examples.im.client.ui.component.MsgTextAreaJPopupMenu.class, "popupMenuListener", javax.swing.event.PopupMenuListener.class, new String[] {"popupMenuWillBecomeVisible", "popupMenuWillBecomeInvisible", "popupMenuCanceled"}, "addPopupMenuListener", "removePopupMenuListener" ); // NOI18N eventSets[EVENT_propertyChangeListener] = new EventSetDescriptor ( com.talent.aio.examples.im.client.ui.component.MsgTextAreaJPopupMenu.class, "propertyChangeListener", java.beans.PropertyChangeListener.class, new String[] {"propertyChange"}, "addPropertyChangeListener", "removePropertyChangeListener" ); // NOI18N eventSets[EVENT_vetoableChangeListener] = new EventSetDescriptor ( com.talent.aio.examples.im.client.ui.component.MsgTextAreaJPopupMenu.class, "vetoableChangeListener", java.beans.VetoableChangeListener.class, new String[] {"vetoableChange"}, "addVetoableChangeListener", "removeVetoableChangeListener" ); // NOI18N } catch(IntrospectionException e) { e.printStackTrace(); }//GEN-HEADEREND:Events // Here you can add code for customizing the event sets array. return eventSets; }
public ExplicitBeanInfo(BeanDescriptor beanDescriptor, BeanInfo[] additionalBeanInfo, PropertyDescriptor[] propertyDescriptors, int defaultPropertyIndex, EventSetDescriptor[] eventSetDescriptors, int defaultEventIndex, MethodDescriptor[] methodDescriptors, Image[] icons) { this.beanDescriptor = beanDescriptor; this.additionalBeanInfo = additionalBeanInfo; this.propertyDescriptors = propertyDescriptors; this.defaultPropertyIndex = defaultPropertyIndex; this.eventSetDescriptors = eventSetDescriptors; this.defaultEventIndex = defaultEventIndex; this.methodDescriptors = methodDescriptors; this.icons = icons; }
void findAddRemovePairs(BeanInfoEmbryo b) throws IntrospectionException { Enumeration listenerEnum = listenerMethods.keys(); while(listenerEnum.hasMoreElements()) { DoubleKey k = (DoubleKey)listenerEnum.nextElement(); Method[] m = (Method[])listenerMethods.get(k); if(m[ADD] != null && m[REMOVE] != null) { EventSetDescriptor e = new EventSetDescriptor(Introspector.decapitalize(k.getName()), k.getType(), k.getType().getMethods(), m[ADD],m[REMOVE]); e.setUnicast(ArrayHelper.contains(m[ADD].getExceptionTypes(),java.util.TooManyListenersException.class)); if(!b.hasEvent(e)) { b.addEvent(e); } } } }
/** * Get the event set descriptors pertinent to data sources * * @return an <code>EventSetDescriptor[]</code> value */ @Override public EventSetDescriptor[] getEventSetDescriptors() { try { List<EventSetDescriptor> descriptors = new ArrayList<EventSetDescriptor>(); for (EventSetDescriptor es : super.getEventSetDescriptors()) { descriptors.add(es); } descriptors.add(new EventSetDescriptor(CSVToARFFHadoopJob.class, "dataSet", DataSourceListener.class, "acceptDataSet")); descriptors.add(new EventSetDescriptor(CSVToARFFHadoopJob.class, "image", ImageListener.class, "acceptImage")); return descriptors.toArray(new EventSetDescriptor[descriptors.size()]); } catch (Exception ex) { ex.printStackTrace(); } return null; }
/** * Get the event set descriptors pertinent to data sources * * @return an <code>EventSetDescriptor[]</code> value */ @Override public EventSetDescriptor[] getEventSetDescriptors() { try { List<EventSetDescriptor> descriptors = new ArrayList<EventSetDescriptor>(); for (EventSetDescriptor es : super.getEventSetDescriptors()) { descriptors.add(es); } } catch (Exception ex) { ex.printStackTrace(); } return null; }
/** * Get the event set descriptors pertinent to data sources * * @return an <code>EventSetDescriptor[]</code> value */ @Override public EventSetDescriptor[] getEventSetDescriptors() { try { List<EventSetDescriptor> descriptors = new ArrayList<EventSetDescriptor>(); for (EventSetDescriptor es : super.getEventSetDescriptors()) { descriptors.add(es); } descriptors.add(new EventSetDescriptor(WekaClassifierHadoopJob.class, "text", TextListener.class, "acceptText")); descriptors.add(new EventSetDescriptor(WekaClassifierHadoopJob.class, "batchClassifier", BatchClassifierListener.class, "acceptClassifier")); return descriptors.toArray(new EventSetDescriptor[descriptors.size()]); } catch (Exception ex) { ex.printStackTrace(); } return null; }
/** * Get the event set descriptors pertinent to data sources * * @return an <code>EventSetDescriptor[]</code> value */ @Override public EventSetDescriptor[] getEventSetDescriptors() { try { List<EventSetDescriptor> descriptors = new ArrayList<EventSetDescriptor>(); for (EventSetDescriptor es : super.getEventSetDescriptors()) { descriptors.add(es); } descriptors.add(new EventSetDescriptor( WekaClassifierEvaluationHadoopJob.class, "text", TextListener.class, "acceptText")); descriptors.add(new EventSetDescriptor( WekaClassifierEvaluationHadoopJob.class, "dataSet", DataSourceListener.class, "acceptDataSet")); return descriptors.toArray(new EventSetDescriptor[descriptors.size()]); } catch (Exception ex) { ex.printStackTrace(); } return null; }
/** * Get the event set descriptors pertinent to data sources * * @return an <code>EventSetDescriptor[]</code> value */ @Override public EventSetDescriptor[] getEventSetDescriptors() { try { List<EventSetDescriptor> descriptors = new ArrayList<EventSetDescriptor>(); for (EventSetDescriptor es : super.getEventSetDescriptors()) { descriptors.add(es); } descriptors.add(new EventSetDescriptor(KMeansClustererHadoopJob.class, "text", TextListener.class, "acceptText")); descriptors.add(new EventSetDescriptor(KMeansClustererHadoopJob.class, "batchClusterer", BatchClustererListener.class, "acceptClusterer")); return descriptors.toArray(new EventSetDescriptor[descriptors.size()]); } catch (Exception ex) { ex.printStackTrace(); } return null; }
/** * Get the event set descriptors for this bean * * @return an <code>EventSetDescriptor[]</code> value */ public EventSetDescriptor [] getEventSetDescriptors() { try { EventSetDescriptor [] esds = { new EventSetDescriptor(IncrementalClassifierEvaluator.class, "chart", ChartListener.class, "acceptDataPoint"), new EventSetDescriptor(IncrementalClassifierEvaluator.class, "text", TextListener.class, "acceptText") }; return esds; } catch (Exception ex) { ex.printStackTrace(); } return null; }
/** * Get the event set descriptors for this bean * * @return an <code>EventSetDescriptor[]</code> value */ public EventSetDescriptor [] getEventSetDescriptors() { // hide all gui events try { EventSetDescriptor [] esds = { new EventSetDescriptor(DataVisualizer.class, "image", ImageListener.class, "acceptImage") }; return esds; } catch (Exception ex) { ex.printStackTrace(); } return null; }
/** * Returns the event set descriptors * * @return an <code>EventSetDescriptor[]</code> value */ public EventSetDescriptor [] getEventSetDescriptors() { try { EventSetDescriptor [] esds = { new EventSetDescriptor(DataSource.class, "instance", InstanceListener.class, "acceptInstance"), new EventSetDescriptor(DataSource.class, "dataSet", DataSourceListener.class, "acceptDataSet") }; return esds; } catch (Exception ex) { ex.printStackTrace(); } return null; }
private DefaultActionGroup prepareActionGroup(final List<RadComponent> selection) { final DefaultActionGroup actionGroup = new DefaultActionGroup(); final EventSetDescriptor[] eventSetDescriptors; try { BeanInfo beanInfo = Introspector.getBeanInfo(selection.get(0).getComponentClass()); eventSetDescriptors = beanInfo.getEventSetDescriptors(); } catch (IntrospectionException e) { LOG.error(e); return null; } EventSetDescriptor[] sortedDescriptors = new EventSetDescriptor[eventSetDescriptors.length]; System.arraycopy(eventSetDescriptors, 0, sortedDescriptors, 0, eventSetDescriptors.length); Arrays.sort(sortedDescriptors, new Comparator<EventSetDescriptor>() { public int compare(final EventSetDescriptor o1, final EventSetDescriptor o2) { return o1.getListenerType().getName().compareTo(o2.getListenerType().getName()); } }); for(EventSetDescriptor descriptor: sortedDescriptors) { actionGroup.add(new MyCreateListenerAction(selection, descriptor)); } return actionGroup; }
/** * Returns the event set descriptors * * @return an <code>EventSetDescriptor[]</code> value */ @Override public EventSetDescriptor[] getEventSetDescriptors() { try { EventSetDescriptor[] esds = { new EventSetDescriptor(DataSource.class, "instance", InstanceListener.class, "acceptInstance"), new EventSetDescriptor(DataSource.class, "dataSet", DataSourceListener.class, "acceptDataSet") }; return esds; } catch (Exception ex) { ex.printStackTrace(); } return null; }
public EventSetDescriptor [] getEventSetDescriptors() { try { EventSetDescriptor [] esds = { new EventSetDescriptor(TrainingSetProducer.class, "trainingSet", TrainingSetListener.class, "acceptTrainingSet"), new EventSetDescriptor(TestSetProducer.class, "testSet", TestSetListener.class, "acceptTestSet") }; return esds; } catch (Exception ex) { ex.printStackTrace(); } return null; }
/** * Returns the event set descriptors * * @return an <code>EventSetDescriptor[]</code> value */ public EventSetDescriptor [] getEventSetDescriptors() { try { EventSetDescriptor [] esds = { new EventSetDescriptor(DataSource.class, "instance", InstanceListener.class, "acceptInstance") }; return esds; } catch (Exception ex) { ex.printStackTrace(); } return null; }
/** * Get the event set descriptors for this bean * * @return an <code>EventSetDescriptor[]</code> value */ public EventSetDescriptor [] getEventSetDescriptors() { try { EventSetDescriptor [] esds = { new EventSetDescriptor(DataVisualizer.class, "dataSet", DataSourceListener.class, "acceptDataSet"), new EventSetDescriptor(DataVisualizer.class, "image", ImageListener.class, "acceptImage") }; return esds; } catch (Exception ex) { ex.printStackTrace(); } return null; }
/** * Get the event set descriptors pertinent to data sources * * @return an <code>EventSetDescriptor[]</code> value */ public EventSetDescriptor [] getEventSetDescriptors() { try { EventSetDescriptor [] esds = { new EventSetDescriptor(DataSource.class, "dataSet", DataSourceListener.class, "acceptDataSet"), new EventSetDescriptor(DataSource.class, "instance", InstanceListener.class, "acceptInstance") }; return esds; } catch (Exception ex) { ex.printStackTrace(); } return null; }
/** * Returns a vector of BeanInstances that can be considered as outputs (or the * right-hand side of a sub-flow) * * @param subset the sub-flow to examine * @return a Vector of outputs of the sub-flow */ public static Vector<Object> outputs(Vector<Object> subset, Integer... tab) { Vector<Object> result = new Vector<Object>(); for (int i = 0; i < subset.size(); i++) { BeanInstance temp = (BeanInstance) subset.elementAt(i); if (checkForTarget(temp, subset, tab)) { // now check source constraint if (checkSourceConstraint(temp, subset, tab)) { // now check that this bean can actually produce some events try { BeanInfo bi = Introspector.getBeanInfo(temp.getBean().getClass()); EventSetDescriptor[] esd = bi.getEventSetDescriptors(); if (esd != null && esd.length > 0) { result.add(temp); } } catch (IntrospectionException ex) { // quietly ignore } } } } return result; }
/** * Get the event set descriptors for this bean * * @return an <code>EventSetDescriptor[]</code> value */ public EventSetDescriptor [] getEventSetDescriptors() { // hide all gui events try { EventSetDescriptor [] esds = { new EventSetDescriptor(ModelPerformanceChart.class, "image", ImageListener.class, "acceptImage") }; return esds; } catch (Exception ex) { ex.printStackTrace(); return null; } }
/** * Returns true if, at this time, the object will accept a connection with * respect to the supplied EventSetDescriptor * * @param esd the EventSetDescriptor * @return true if the object will accept a connection */ @Override public boolean connectionAllowed(EventSetDescriptor esd) { Vector<BeanInstance> targets = getSuitableTargets(esd); for (int i = 0; i < targets.size(); i++) { BeanInstance input = targets.elementAt(i); if (input.getBean() instanceof BeanCommon) { // if (((BeanCommon)input.getBean()).connectionAllowed(esd.getName())) { if (((BeanCommon) input.getBean()).connectionAllowed(esd)) { return true; } } else { return true; } } return false; }
/** * Returns the event set descriptors * * @return an <code>EventSetDescriptor[]</code> value */ public EventSetDescriptor [] getEventSetDescriptors() { try { EventSetDescriptor [] esds = { new EventSetDescriptor(DataSource.class, "dataSet", DataSourceListener.class, "acceptDataSet"), new EventSetDescriptor(DataSource.class, "instance", InstanceListener.class, "acceptInstance"), new EventSetDescriptor(TrainingSetProducer.class, "trainingSet", TrainingSetListener.class, "acceptTrainingSet"), new EventSetDescriptor(TestSetProducer.class, "testSet", TestSetListener.class, "acceptTestSet") }; return esds; } catch (Exception ex) { ex.printStackTrace(); } return null; }
public EventSetDescriptor [] getEventSetDescriptors() { try { EventSetDescriptor [] esds = { new EventSetDescriptor(Clusterer.class, "batchClusterer", BatchClustererListener.class, "acceptClusterer"), new EventSetDescriptor(Clusterer.class, "graph", GraphListener.class, "acceptGraph"), new EventSetDescriptor(Clusterer.class, "text", TextListener.class, "acceptText"), new EventSetDescriptor(Clusterer.class, "configuration", ConfigurationListener.class, "acceptConfiguration") }; return esds; } catch (Exception ex) { ex.printStackTrace(); } return null; }
Event(RADComponent component, EventSetDescriptor eventSetDescriptor, Method listenerMethod) { this.component = component; this.eventSetDescriptor = eventSetDescriptor; this.listenerMethod = listenerMethod; }