View Javadoc

1   /*
2    *  File: TBViewer.java 
3    *  Copyright (c) 2004-2007  Peter Kliem (Peter.Kliem@jaret.de)
4    *  A commercial license is available, see http://www.jaret.de.
5    *
6    *  This program is free software; you can redistribute it and/or modify
7    *  it under the terms of the GNU General Public License as published by
8    *  the Free Software Foundation; either version 2 of the License, or
9    *  (at your option) any later version.
10   *
11   *  This program is distributed in the hope that it will be useful,
12   *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13   *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14   *  GNU General Public License for more details.
15   *
16   *  You should have received a copy of the GNU General Public License
17   *  along with this program; if not, write to the Free Software
18   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19   */
20  package de.jaret.util.ui.timebars.swt;
21  
22  import java.util.List;
23  
24  import org.eclipse.jface.viewers.DoubleClickEvent;
25  import org.eclipse.jface.viewers.ISelection;
26  import org.eclipse.jface.viewers.StructuredViewer;
27  import org.eclipse.swt.events.MouseEvent;
28  import org.eclipse.swt.events.MouseListener;
29  import org.eclipse.swt.widgets.Control;
30  import org.eclipse.swt.widgets.Widget;
31  
32  /**
33   * Jface StructuredViewer for the TimeBarViewer. Naming is odd due to historical reasons. This is not yet a complete
34   * implementation.
35   * 
36   * @author Peter Kliem
37   * @version $Id: TBViewer.java 800 2008-12-27 22:27:33Z kliem $
38   */
39  public class TBViewer extends StructuredViewer {
40      /** the underlying timebarviewer. */
41      protected TimeBarViewer _tbv;
42  
43      /** this pointer. */
44      protected TBViewer _this;
45  
46      /**
47       * Constructor.
48       * 
49       * @param tbv timebarviewer that should be wrapped
50       */
51      public TBViewer(TimeBarViewer tbv) {
52          _tbv = tbv;
53          _this = this;
54          super.hookControl(_tbv);
55          _tbv.addMouseListener(new MouseListener() {
56  
57              public void mouseDoubleClick(MouseEvent e) {
58                  DoubleClickEvent event = new DoubleClickEvent(_this, getSelection());
59                  fireDoubleClick(event);
60              }
61  
62              public void mouseDown(MouseEvent e) {
63              }
64  
65              public void mouseUp(MouseEvent e) {
66              }
67  
68          });
69      }
70  
71      /**
72       * {@inheritDoc}
73       */
74      @Override
75      public Control getControl() {
76          return _tbv;
77      }
78  
79      /**
80       * {@inheritDoc}
81       */
82      @Override
83      public Object getInput() {
84          return _tbv.getModel();
85      }
86  
87      /**
88       * {@inheritDoc}
89       */
90      @Override
91      public ISelection getSelection() {
92          return _tbv.getSelection();
93      }
94  
95      /**
96       * {@inheritDoc}
97       */
98      @Override
99      public void refresh() {
100         _tbv.redraw();
101     }
102 
103     /**
104      * {@inheritDoc}
105      */
106     @Override
107     public void setSelection(ISelection selection, boolean reveal) {
108         // TODO reveal
109         _tbv.setSelection(selection);
110     }
111 
112     /**
113      * {@inheritDoc}
114      */
115     @Override
116     protected Widget doFindInputItem(Object element) {
117         return null;
118     }
119 
120     /**
121      * {@inheritDoc}
122      */
123     @Override
124     protected Widget doFindItem(Object element) {
125         return null;
126     }
127 
128     /**
129      * {@inheritDoc}
130      */
131     @Override
132     protected void doUpdateItem(Widget item, Object element, boolean fullMap) {
133 
134     }
135 
136     /**
137      * {@inheritDoc}
138      */
139     @Override
140     protected List getSelectionFromWidget() {
141         // TODO Auto-generated method stub
142         return null;
143     }
144 
145     /**
146      * {@inheritDoc}
147      */
148     @Override
149     protected void internalRefresh(Object element) {
150         // TODO Auto-generated method stub
151 
152     }
153 
154     /**
155      * {@inheritDoc}
156      */
157     @Override
158     public void reveal(Object element) {
159         // TODO Auto-generated method stub
160 
161     }
162 
163     /**
164      * {@inheritDoc}
165      */
166     @Override
167     protected void setSelectionToWidget(List l, boolean reveal) {
168         // TODO Auto-generated method stub
169 
170     }
171 
172 }