View Javadoc

1   /*--------------------------------------------------------------------------
2    *  Copyright 2007 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  // GenomeBrowser Project
18  //
19  // TrackFrameState.java
20  // Since: Jul 23, 2007
21  //
22  // $URL$ 
23  // $Author$
24  //--------------------------------------
25  package org.utgenome.gwt.utgb.client.track;
26  
27  public class TrackFrameState {
28  	private boolean isPacked = true;
29  	private boolean isMinimized = false;
30  	private int minFrameHeight = DEFAULT_MIN_TRACKFRAME_HEIGHT;
31  	private int previousFrameHeight = DEFAULT_MIN_TRACKFRAME_HEIGHT;
32  	private int currentHeight;
33  		
34  	public static final int	DEFAULT_MIN_TRACKFRAME_HEIGHT	= 18;
35  
36  	public boolean isPacked() {
37  		return isPacked;
38  	}
39  
40  	public void setPacked(boolean isPacked) {
41  		this.isPacked = isPacked;
42  	}
43  
44  	public boolean isMinimized() {
45  		return isMinimized;
46  	}
47  
48  	public void setMinimized(boolean isMinimized) {
49  		this.isMinimized = isMinimized;
50  	}
51  
52  	public int getMinFrameHeight() {
53  		return minFrameHeight;
54  	}
55  
56  	public void setMinFrameHeight(int minFrameHeight) {
57  		this.minFrameHeight = Math.max(minFrameHeight, DEFAULT_MIN_TRACKFRAME_HEIGHT);
58  	}
59  
60  	public int getPreviousFrameHeight() {
61  		return previousFrameHeight;
62  	}
63  
64  	public void setPreviousFrameHeight(int previousFrameHeight) {
65  		this.previousFrameHeight = Math.max(minFrameHeight, previousFrameHeight);
66  	}
67  	
68  	
69  	public int resizeFrameHeight(int height)
70  	{
71  		int newHeight = height;
72  		if(isMinimized()) 
73  		{
74  			if(height < DEFAULT_MIN_TRACKFRAME_HEIGHT)
75  				newHeight = DEFAULT_MIN_TRACKFRAME_HEIGHT;
76  		}
77  		else
78  		{
79  			if(height < minFrameHeight)
80  				newHeight = minFrameHeight;
81  		}
82  		return newHeight;
83  	}
84  
85  	
86  }
87  
88  
89  
90