[ https://issues.apache.org/jira/browse/PIVOT-670?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12932678#action_12932678 ]
Frédéric VERGEZ edited comment on PIVOT-670 at 11/16/10 5:08 PM: ----------------------------------------------------------------- As i'm looking at the sources, agreed that it can have many impacts... But using listeners in many UI frameworks (GWT, RCP ...), i generally consider using a single/shared listener for distinct classes as a bad idea. Sorry to bother though, and thank you for all the good work done. Pivot is really, really making my day :) was (Author: ikarius): As i'm looking at the sources, agreed that it can have many impacts... But using listeners in many UI frameworks (GWT, RCP ...), i generally consider using a single/shared listener for distinct classes as a bad idea. > Generic types for listeners > --------------------------- > > Key: PIVOT-670 > URL: https://issues.apache.org/jira/browse/PIVOT-670 > Project: Pivot > Issue Type: Improvement > Environment: All > Reporter: Frédéric VERGEZ > Priority: Trivial > > Could listener interfaces have generic types ? > This would allow to be type safe in methods, and avoid objects casting. > For instance in a ComponentMouseListener: > public interface ComponentMouseListener<T extends Component> { > /** > * Component mouse button listener adapter. > */ > public static class Adapter implements ComponentMouseListener { > @Override > public boolean mouseMove(T component, int x, int y) { > return false; > } > @Override > public void mouseOver(T component) { > } > @Override > public void mouseOut(T component) { > } > } > /** > * Called when the mouse is moved over a component. > * > * @param component > * @param x > * @param y > * > * @return > * <tt>true</tt> to consume the event; <tt>false</tt> to allow it to > * propagate. > */ > public boolean mouseMove(T component, int x, int y); > /** > * Called when the mouse enters a component. > * > * @param component > */ > public void mouseOver(T component); > /** > * Called when the mouse exits a component. > * > * @param component > */ > public void mouseOut(T component); > } -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.