Project

General

Profile

Download (1.65 KB) Statistics
| Branch: | Tag: | Revision:
1
/*******************************************************************************
2
 * Copyright 2005, CHISEL Group, University of Victoria, Victoria, BC, Canada.
3
 * All rights reserved. This program and the accompanying materials are made
4
 * available under the terms of the Eclipse Public License v1.0 which
5
 * accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 * 
8
 * Contributors: The Chisel Group, University of Victoria
9
 *******************************************************************************/
10
package org.eclipse.zest.layouts.algorithms;
11

    
12
import org.eclipse.zest.layouts.LayoutStyles;
13

    
14
/**
15
 * @version  2.0
16
 * @author   Casey Best and Rob Lintern (version 1.0 by Rob Lintern)
17
 */
18
public class VerticalLayoutAlgorithm extends GridLayoutAlgorithm {
19

    
20
	/**
21
	 * Veertical Layout Algorithm constructor with no styles.
22
	 *
23
	 */
24
	public VerticalLayoutAlgorithm() {
25
		this(LayoutStyles.NONE);
26
	}
27

    
28
	public VerticalLayoutAlgorithm(int styles) {
29
		super(styles);
30
	}
31

    
32
	/**
33
	 * Calculates and returns an array containing the number of columns, followed by the number of rows
34
	 */
35
	protected int[] calculateNumberOfRowsAndCols(int numChildren, double boundX, double boundY, double boundWidth, double boundHeight) {
36
		int cols = 1;
37
		int rows = numChildren;
38
		int[] result = { cols, rows };
39
		return result;
40
	}
41

    
42
	protected boolean isValidConfiguration(boolean asynchronous, boolean continueous) {
43
		if (asynchronous && continueous)
44
			return false;
45
		else if (asynchronous && !continueous)
46
			return true;
47
		else if (!asynchronous && continueous)
48
			return false;
49
		else if (!asynchronous && !continueous)
50
			return true;
51

    
52
		return false;
53
	}
54
}
(12-12/12)