View Javadoc

1   /*--------------------------------------------------------------------------
2    *  Copyright 2008 utgenome.org
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  //--------------------------------------
17  // utgb-widget Project
18  //
19  // TrackPanel.java
20  // Since: Apr 24, 2008
21  //
22  // $URL$ 
23  // $Author$
24  //--------------------------------------
25  package org.utgenome.gwt.widget.client;
26  
27  import com.google.gwt.user.client.ui.Composite;
28  import com.google.gwt.user.client.ui.Widget;
29  
30  /**
31   * A common interface for the UTGB track panel widget
32   * 
33   * @author leo
34   * 
35   */
36  /**
37   * @author leo
38   * 
39   */
40  public abstract class TrackFrame extends Composite {
41  
42  	public static final int BUTTON_RELOAD = 1;
43  	public static final int BUTTON_CONFIG = 1 << 1;
44  	public static final int BUTTON_ADJUSTHEIGHT = 1 << 2;
45  	public static final int BUTTON_MINIMIZE = 1 << 3;
46  	public static final int BUTTON_CLOSE = 1 << 4;
47  	public static final int BUTTON_ALL = BUTTON_RELOAD | BUTTON_CONFIG | BUTTON_ADJUSTHEIGHT | BUTTON_MINIMIZE | BUTTON_CLOSE;
48  
49  	/**
50  	 * Set the visibility of the specified button
51  	 * 
52  	 * @param buttonSet
53  	 *            set of buttons (OR value of BUTTON_RELOAD, BUTTON_CONFIG, BUTTON_ADJUSTHEIGHT, BUTTON_MINIMIZE,
54  	 *            BUTTON_CLOSE)
55  	 * @param visible
56  	 */
57  	public abstract void setVisible(int buttonSet, boolean visible);
58  
59  	public abstract void showCloseButton(boolean show);
60  
61  	public abstract void showConfigButton(boolean show);
62  
63  	public abstract void showMinimizeButton(boolean show);
64  
65  	public abstract void showAdjustHightButton(boolean show);
66  
67  	public abstract void showReloadButton(boolean show);
68  
69  	/**
70  	 * Set the track title
71  	 * 
72  	 * @param title
73  	 */
74  	public abstract void setTrackTitle(String title);
75  
76  	/**
77  	 * Gets the track title
78  	 * 
79  	 * @return
80  	 */
81  	public abstract String getTrackTitle();
82  
83  	// button listner
84  	public abstract void addTrackButtonListener(TrackButtonListener listener);
85  
86  	/**
87  	 * Start or stop the rotation of the loading button.
88  	 * 
89  	 * @param loading
90  	 *            true: start rotate, false: stop rotate
91  	 */
92  	public abstract void setLoading(boolean loading);
93  
94  	/**
95  	 * Set the track content widget
96  	 * 
97  	 * @param w
98  	 */
99  	public abstract void setTrackContent(Widget w);
100 
101 	/**
102 	 * Get the draggable part of this widget
103 	 * 
104 	 * @return
105 	 */
106 	public abstract Widget getDraggableWidget();
107 
108 	/**
109 	 * Enable resize of the track width
110 	 * 
111 	 * @param enable
112 	 */
113 	public abstract void enableResizeWidth(boolean enable);
114 
115 	/**
116 	 * Enable resize of the track height
117 	 * 
118 	 * @param enable
119 	 */
120 	public abstract void enableResizeHeight(boolean enable);
121 
122 	
123 	/**
124 	 * Set the track frame width. Use this method instead of {@link Widget#setWidth(String)}.
125 	 * @param pixelWidth
126 	 */
127 	public abstract void setWidth(int pixelWidth);
128 	
129 	/**
130 	 * @param pixelHeight
131 	 */
132 	public abstract void setHeight(int pixelHeight);
133 	
134 	
135 	public void setWidth(String width)
136 	{
137 		throw new UnsupportedOperationException("setWidth(String) cannot be used. Instead, use setWidth(int)");		
138 	}
139 	
140 	public void setHeight(String height)
141 	{
142 		throw new UnsupportedOperationException("setHeight(String) cannot be used. Instead, use setHeight(int)");
143 	}
144 	
145 	public void setSize(int pixelWidth, int pixelHeight)
146 	{
147 		setWidth(pixelWidth);
148 		setHeight(pixelHeight);
149 	}
150 	
151 	public void setSize(String width, String height)
152 	{
153 		throw new UnsupportedOperationException("setSize(String, String) cannot be used. Instead, use setSize(int, int)");
154 	}
155 	
156 	
157 	
158 }