1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package pl.edu.agh.cast.editor;
19
20 import org.eclipse.draw2d.PositionConstants;
21 import org.eclipse.gef.ui.palette.FlyoutPaletteComposite;
22 import org.eclipse.gef.ui.palette.FlyoutPaletteComposite.FlyoutPreferences;
23
24
25
26
27
28
29 public class DefaultFlayoutPreferences implements FlyoutPreferences {
30
31
32
33
34 private int dockLocation = PositionConstants.EAST;
35
36
37
38
39 private int paletteState = FlyoutPaletteComposite.STATE_PINNED_OPEN;
40
41
42
43
44 private int paletteWidth = 150;
45
46
47
48
49
50
51 public int getDockLocation() {
52 return dockLocation;
53 }
54
55
56
57
58
59
60 public int getPaletteState() {
61 return paletteState;
62 }
63
64
65
66
67
68
69 public int getPaletteWidth() {
70 return paletteWidth;
71 }
72
73
74
75
76
77
78 public void setDockLocation(int location) {
79 if (location != PositionConstants.EAST && location != PositionConstants.WEST){
80 throw new IllegalArgumentException("The dock location might be only EAST or WEST.");
81 }
82 this.dockLocation = location;
83 }
84
85
86
87
88
89
90 public void setPaletteState(int state) {
91 if (state != FlyoutPaletteComposite.STATE_PINNED_OPEN && state != FlyoutPaletteComposite.STATE_COLLAPSED){
92 throw new IllegalArgumentException(
93 "The palette state might be only PINNED_OPEN or COLLAPSED.");
94 }
95 this.paletteState = state;
96 }
97
98
99
100
101
102
103 public void setPaletteWidth(int width) {
104 if(width < 0){
105 throw new IllegalArgumentException("The width must be at least 0.");
106 }
107 this.paletteWidth = width;
108 }
109
110 }