View Javadoc

1   /*
2      Copyright 2002-2006 Martin van den Bemt
3   
4      Licensed under the Apache License, Version 2.0 (the "License");
5      you may not use this file except in compliance with the License.
6      You may obtain a copy of the License at
7   
8          http://www.apache.org/licenses/LICENSE-2.0
9   
10     Unless required by applicable law or agreed to in writing, software
11     distributed under the License is distributed on an "AS IS" BASIS,
12     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13     See the License for the specific language governing permissions and
14     limitations under the License.
15  */
16  package org.xulux.guilayer.swing.listeners;
17  
18  import java.awt.event.MouseEvent;
19  import java.awt.event.MouseListener;
20  
21  import org.xulux.api.core.PartRequest;
22  import org.xulux.api.gui.IWidget;
23  import org.xulux.rules.Rule;
24  import org.xulux.rules.impl.WidgetRequestImpl;
25  import org.xulux.utils.ClassLoaderUtils;
26  
27  /**
28   * 
29   */
30  public class MouseDoubleClickTreeListener implements MouseListener {
31  
32  	IWidget widget = null;
33  	/**
34  	 * 
35  	 */
36  	public MouseDoubleClickTreeListener(IWidget widget) {
37  		this.widget = widget;
38  	}
39  
40  	/**
41  	 * @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent)
42  	 */
43  	public void mouseClicked(MouseEvent e) {
44  		if (e.getClickCount() == 2) {
45  			processDoubleClick();
46  		}
47  	}
48  	
49  	public void processDoubleClick() {
50  		String strRule = widget.getProperty("doubleclick");
51  		Rule rule = (Rule) ClassLoaderUtils.getObjectFromClassString(strRule);
52  		rule.setOwner(widget);
53          WidgetRequestImpl impl = new WidgetRequestImpl(widget, PartRequest.NO_ACTION);
54          rule.post(impl);
55  	}
56  
57  	/**
58  	 * @see java.awt.event.MouseListener#mousePressed(java.awt.event.MouseEvent)
59  	 */
60  	public void mousePressed(MouseEvent e) {
61  	}
62  
63  	/**
64  	 * @see java.awt.event.MouseListener#mouseReleased(java.awt.event.MouseEvent)
65  	 */
66  	public void mouseReleased(MouseEvent e) {
67  	}
68  
69  	/**
70  	 * @see java.awt.event.MouseListener#mouseEntered(java.awt.event.MouseEvent)
71  	 */
72  	public void mouseEntered(MouseEvent e) {
73  	}
74  
75  	/**
76  	 * @see java.awt.event.MouseListener#mouseExited(java.awt.event.MouseEvent)
77  	 */
78  	public void mouseExited(MouseEvent e) {
79  	}
80  
81  }