Project

General

Profile

Download (3.78 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;
11

    
12
import java.util.Comparator;
13
import java.util.List;
14

    
15
import org.eclipse.zest.layouts.progress.ProgressListener;
16

    
17
/**
18
 * A simple interface used by all layouts.
19
 * 
20
 * Each layout Algorithm must implement the applyLayoutInternal method which actually compute the layout
21
 * 
22
 * @author Casey Best
23
 * @author Ian Bull
24
 */
25
public interface LayoutAlgorithm {
26

    
27
	/**
28
	 * Apply the layout to the given entities.  The entities will be moved and resized based
29
	 * on the algorithm.
30
	 * 
31
	 * @param entitiesToLayout Apply the algorithm to these entities
32
	 * @param relationshipsToConsider Only consider these relationships when applying the algorithm.
33
	 * @param x The left side of the bounds in which the layout can place the entities.
34
	 * @param y The top side of the bounds in which the layout can place the entities.
35
	 * @param width The width of the bounds in which the layout can place the entities.
36
	 * @param height The height of the bounds in which the layout can place the entities.
37
	 * @param asynchronous Should the algorithm run Asynchronously
38
	 */
39
	public void applyLayout(LayoutEntity[] entitiesToLayout, LayoutRelationship[] relationshipsToConsider, double x, double y, double width, double height, boolean asynchronous, boolean continuous) throws InvalidLayoutConfiguration;
40

    
41
	/**
42
	 * Returns whether or not the algorithm is currenly running
43
	 * @return True if a layout algorithm is currenly running, false otherwise
44
	 */
45
	public boolean isRunning();
46

    
47
	/**
48
	 * Determines the order in which the objects should be displayed.
49
	 * Note: Some algorithms force a specific order, in which case
50
	 * this comparator will be ignored.
51
	 */
52
	public void setComparator(Comparator comparator);
53

    
54
	/**
55
	 * Filters the entities and relationships to apply the layout on
56
	 */
57
	public void setFilter(Filter filter);
58

    
59
	/**
60
	 * Set the width to height ratio you want the entities to use
61
	 * Note: Each layout is responsible for ensuring this ratio is used.
62
	 * Note: By default the layout will use a ratio of 1.0 for each entity.
63
	 */
64
	public void setEntityAspectRatio(double ratio);
65

    
66
	/**
67
	 * Returns the width to height ratio this layout will use to set the size of the entities.
68
	 * Note: By default the layout will use a ratio of 1.0 for each entity.
69
	 */
70
	public double getEntityAspectRatio();
71

    
72
	/**
73
	 * A layout algorithm could take an uncomfortable amout of time to complete.  To relieve some of
74
	 * the mystery, the layout algorithm will notify each ProgressListener of its progress. 
75
	 */
76
	public void addProgressListener(ProgressListener listener);
77

    
78
	/**
79
	 * Removes the given progress listener, preventing it from receiving any more updates.
80
	 */
81
	public void removeProgressListener(ProgressListener listener);
82

    
83
	/**
84
	 * Makes a request to this layout algorithm to stop running.
85
	 */
86
	public void stop();
87

    
88
	/**
89
	 * Sets the style for this layout algorithm.  This will overwrite any other style set.
90
	 * @param style
91
	 */
92
	public void setStyle(int style);
93

    
94
	/**
95
	 * 
96
	 * @return
97
	 */
98
	public int getStyle();
99

    
100
	public void addEntity(LayoutEntity entity);
101

    
102
	public void addRelationship(LayoutRelationship relationship);
103

    
104
	public void removeEntity(LayoutEntity entity);
105

    
106
	public void removeRelationship(LayoutRelationship relationship);
107

    
108
	public void removeRelationships(List relationships);
109

    
110
}
(3-3/12)