1
|
/*******************************************************************************
|
2
|
* Copyright (c) 2004, 2010 IBM Corporation and others.
|
3
|
* All rights reserved. This program and the accompanying materials
|
4
|
* are made available under the terms of the Eclipse Public License v1.0
|
5
|
* which accompanies this distribution, and is available at
|
6
|
* http://www.eclipse.org/legal/epl-v10.html
|
7
|
*
|
8
|
* Contributors:
|
9
|
* IBM Corporation - initial API and implementation
|
10
|
*******************************************************************************/
|
11
|
|
12
|
package org.eclipse.draw2d;
|
13
|
|
14
|
/**
|
15
|
* Classes which implement this interface provide callback hooks for various
|
16
|
* layout related events.
|
17
|
* <P>
|
18
|
* Instances can be hooked to figures by calling
|
19
|
* {@link IFigure#addLayoutListener(LayoutListener)}. Listeners will be made
|
20
|
* aware of various steps of the layout mechanism, and even have the opportunity
|
21
|
* to prevent normal layout from occurring.
|
22
|
*
|
23
|
* @since 3.1
|
24
|
*/
|
25
|
public interface LayoutListener {
|
26
|
|
27
|
/**
|
28
|
* A stub implementation which implements all of the declared methods.
|
29
|
*
|
30
|
* @since 3.1
|
31
|
*/
|
32
|
class Stub implements LayoutListener {
|
33
|
|
34
|
/**
|
35
|
* Stub which does nothing.
|
36
|
*
|
37
|
* @see LayoutListener#invalidate(IFigure)
|
38
|
*/
|
39
|
public void invalidate(IFigure container) {
|
40
|
}
|
41
|
|
42
|
/**
|
43
|
* Stub which does nothing.
|
44
|
*
|
45
|
* @see LayoutListener#layout(IFigure)
|
46
|
*/
|
47
|
public boolean layout(IFigure container) {
|
48
|
return false;
|
49
|
}
|
50
|
|
51
|
/**
|
52
|
* Stub which does nothing.
|
53
|
*
|
54
|
* @see LayoutListener#postLayout(IFigure)
|
55
|
*/
|
56
|
public void postLayout(IFigure container) {
|
57
|
}
|
58
|
|
59
|
/**
|
60
|
* Stub which does nothing.
|
61
|
*
|
62
|
* @see LayoutListener#remove(IFigure)
|
63
|
*/
|
64
|
public void remove(IFigure child) {
|
65
|
}
|
66
|
|
67
|
/**
|
68
|
* Stub which does nothing.
|
69
|
*
|
70
|
* @see LayoutListener#setConstraint(IFigure, java.lang.Object)
|
71
|
*/
|
72
|
public void setConstraint(IFigure child, Object constraint) {
|
73
|
}
|
74
|
|
75
|
}
|
76
|
|
77
|
/**
|
78
|
* Called when a container has been invalidated.
|
79
|
*
|
80
|
* @param container
|
81
|
* the invalidated Figure
|
82
|
* @since 3.1
|
83
|
*/
|
84
|
void invalidate(IFigure container);
|
85
|
|
86
|
/**
|
87
|
* Called prior to layout occurring. A listener may intercept a layout by
|
88
|
* returning <code>true</code>. If the layout is intercepted, the
|
89
|
* container's <code>LayoutManager</code> will not receive a layout call.
|
90
|
*
|
91
|
* @param container
|
92
|
* the figure incurring a layout
|
93
|
* @return <code>true</code> if the layout has been intercepted by the
|
94
|
* listener
|
95
|
* @since 3.1
|
96
|
*/
|
97
|
boolean layout(IFigure container);
|
98
|
|
99
|
/**
|
100
|
* Called after layout has occurred.
|
101
|
*
|
102
|
* @since 3.1
|
103
|
* @param container
|
104
|
* the figure incurring a layout
|
105
|
*/
|
106
|
void postLayout(IFigure container);
|
107
|
|
108
|
/**
|
109
|
* Called when a child is about to be removed from its parent.
|
110
|
*
|
111
|
* @since 3.1
|
112
|
* @param child
|
113
|
* the child being removed
|
114
|
*/
|
115
|
void remove(IFigure child);
|
116
|
|
117
|
/**
|
118
|
* Called when a child's constraint is initialized or updated.
|
119
|
*
|
120
|
* @param child
|
121
|
* the child being updated
|
122
|
* @param constraint
|
123
|
* the child's new constraint
|
124
|
* @since 3.1
|
125
|
*/
|
126
|
void setConstraint(IFigure child, Object constraint);
|
127
|
|
128
|
}
|