Example usage for java.beans EventHandler create

List of usage examples for java.beans EventHandler create

Introduction

In this page you can find the example usage for java.beans EventHandler create.

Prototype

public static <T> T create(Class<T> listenerInterface, Object target, String action, String eventPropertyName,
        String listenerMethodName) 

Source Link

Document

Creates an implementation of listenerInterface in which the method named listenerMethodName passes the value of the event expression, eventPropertyName , to the final method in the statement, action , which is applied to the target .

Usage

From source file:com.mac.tarchan.desktop.event.EventQuery.java

/**
 * ?????/*w  ww  .  j a  v  a  2  s  . c  o  m*/
 * 
 * @param target ?
 * @param action ?????????????
 * @param property ???????????? 
 * @return ??
 * @see #click(ActionListener)
 */
public EventQuery click(Object target, String action, String property) {
    //      System.out.format("target: %s [%s]\n", target.getClass().getName(), action);
    ActionListener actionPerformed = EventHandler.create(ActionListener.class, target, action, property,
            "actionPerformed");
    //      MouseListener mouseClicked = EventHandler.create(MouseListener.class, target, action, property, "mouseClicked");
    //      click(handler);
    //      for (Component child : list)
    //      {
    ////         System.out.format("click: %s [%s]\n", child.getName(), child.getClass().getName());
    //         if (child instanceof AbstractButton)
    //         {
    //            ((AbstractButton)child).addActionListener(actionPerformed);
    //         }
    //         else if (child instanceof Button)
    //         {
    //            ((Button)child).addActionListener(actionPerformed);
    //         }
    //         else if (child instanceof JTextField)
    //         {
    //            ((JTextField)child).addActionListener(actionPerformed);
    //         }
    //         else
    //         {
    //            child.addMouseListener(mouseClicked);
    //         }
    //      }
    //
    //      return this;
    return click(actionPerformed);
}

From source file:com.mac.tarchan.desktop.event.EventQuery.java

/**
 * ?????/*from ww w  .j a va2s .  com*/
 * 
 * @param target ?
 * @param action ?????????????
 * @param property ???????????? 
 * @return ??
 * @see MouseListener#mouseClicked(java.awt.event.MouseEvent)
 */
public EventQuery dblclick(Object target, String action, String property) {
    MouseListener mouseClicked = EventHandler.create(MouseListener.class, target, action, property,
            "mouseClicked");
    //      DoubleClickHandler dblclickHandler = new DoubleClickHandler(mouseClicked);
    //      for (Component child : list)
    //      {
    //         child.addMouseListener(dblclickHandler);
    //      }
    //
    //      return this;
    return dblclick(mouseClicked);
}

From source file:com.mac.tarchan.desktop.event.EventQuery.java

/**
 * ???????????/*from   w  w w  .java2s .co  m*/
 * 
 * @param target ?
 * @param action ?????????????
 * @param property ???????????? 
 * @return ??
 * @see HierarchyListener#hierarchyChanged(HierarchyEvent)
 * @see HierarchyEvent
 */
public EventQuery ready(Object target, String action, String property) {
    HierarchyListener hierarchyChanged = EventHandler.create(HierarchyListener.class, target, action, property,
            "hierarchyChanged");
    return ready(hierarchyChanged);
}

From source file:com.mac.tarchan.desktop.event.EventQuery.java

/**
 * ???????//from  w  w w.  ja  v a2 s. c  o  m
 * 
 * @param target ?
 * @param action ?????????????
 * @param property ???????????? 
 * @return ??
 * @see ComponentListener#componentShown(java.awt.event.ComponentEvent)
 */
public EventQuery show(Object target, String action, String property) {
    ComponentListener componentShown = EventHandler.create(ComponentListener.class, target, action, property,
            "componentShown");
    for (Component child : list) {
        child.addComponentListener(componentShown);
    }
    return this;
}

From source file:com.mac.tarchan.desktop.event.EventQuery.java

/**
 * ?????????// w ww  .  j  a va 2 s. c  o  m
 * 
 * @param target ?
 * @param action ?????????????
 * @param property ???????????? 
 * @return ??
 * @see ComponentListener#componentHidden(java.awt.event.ComponentEvent)
 */
public EventQuery hide(Object target, String action, String property) {
    ComponentListener componentHidden = EventHandler.create(ComponentListener.class, target, action, property,
            "componentHidden");
    for (Component child : list) {
        child.addComponentListener(componentHidden);
    }
    return this;
}

From source file:com.mac.tarchan.desktop.event.EventQuery.java

/**
 * ?????????/*  w  ww.j a  va 2 s . co m*/
 * 
 * @param target ?
 * @param action ?????????????
 * @param property ???????????? 
 * @return ??
 * @see ComponentListener#componentResized(java.awt.event.ComponentEvent)
 */
public EventQuery resize(Object target, String action, String property) {
    ComponentListener componentResized = EventHandler.create(ComponentListener.class, target, action, property,
            "componentResized");
    for (Component child : list) {
        child.addComponentListener(componentResized);
    }
    return this;
}

From source file:com.mac.tarchan.desktop.event.EventQuery.java

/**
 * ????????//from   w ww.j a v  a 2s .  c o  m
 * 
 * @param target ?
 * @param action ?????????????
 * @param property ???????????? 
 * @return ??
 * @see ComponentListener#componentMoved(java.awt.event.ComponentEvent)
 */
public EventQuery move(Object target, String action, String property) {
    ComponentListener componentMoved = EventHandler.create(ComponentListener.class, target, action, property,
            "componentMoved");
    for (Component child : list) {
        child.addComponentListener(componentMoved);
    }
    return this;
}

From source file:com.mac.tarchan.desktop.event.EventQuery.java

/**
 * ????????????????????/*www. ja v a  2s  . c om*/
 * 
 * @param target ?
 * @param overAction ?????????????????????
 * @param outAction ????????????????????
 * @param property ???????????? 
 * @return ??
 * @see MouseListener#mouseEntered(java.awt.event.MouseEvent)
 * @see MouseListener#mouseExited(java.awt.event.MouseEvent)
 */
public EventQuery hover(Object target, String overAction, String outAction, String property) {
    MouseListener mouseEntered = EventHandler.create(MouseListener.class, target, overAction, property,
            "mouseEntered");
    MouseListener mouseExited = EventHandler.create(MouseListener.class, target, outAction, property,
            "mouseExited");
    for (Component child : list) {
        child.addMouseListener(mouseEntered);
        child.addMouseListener(mouseExited);
    }
    return this;
}

From source file:com.mac.tarchan.desktop.event.EventQuery.java

/**
 * ????????/*from   w  ww  . ja  v a 2 s  .  co m*/
 * 
 * @param target ?
 * @param action ?????????????
 * @param property ???????????? 
 * @return ??
 * @see FocusListener#focusGained(java.awt.event.FocusEvent)
 */
public EventQuery focus(Object target, String action, String property) {
    FocusListener focusGained = EventHandler.create(FocusListener.class, target, action, property,
            "focusGained");
    for (Component child : list) {
        child.addFocusListener(focusGained);
    }
    return this;
}

From source file:com.mac.tarchan.desktop.event.EventQuery.java

/**
 * ?????????????//from  w ww  . j  a v  a2  s.  c o  m
 * 
 * @param target ?
 * @param action ?????????????
 * @param property ???????????? 
 * @return ??
 * @see FocusListener#focusLost(java.awt.event.FocusEvent)
 */
public EventQuery blur(Object target, String action, String property) {
    FocusListener focusLost = EventHandler.create(FocusListener.class, target, action, property, "focusLost");
    for (Component child : list) {
        child.addFocusListener(focusLost);
    }
    return this;
}