1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package net.sourceforge.jeuclid.context;
20
21 import net.sourceforge.jeuclid.LayoutContext;
22
23
24
25
26 public class InlineLayoutContext implements LayoutContext {
27
28 private final LayoutContext parentLayoutContext;
29
30 private final boolean increaseIfAlreadyInline;
31
32
33
34
35
36
37
38 public InlineLayoutContext(final LayoutContext parent) {
39 this.parentLayoutContext = parent;
40 this.increaseIfAlreadyInline = false;
41 }
42
43
44
45
46
47
48
49
50
51 public InlineLayoutContext(final LayoutContext parent,
52 final boolean increase) {
53 this.parentLayoutContext = parent;
54 this.increaseIfAlreadyInline = increase;
55 }
56
57
58 public Object getParameter(final Parameter which) {
59 Object retVal;
60 if (Parameter.DISPLAY.equals(which)) {
61 retVal = Display.INLINE;
62 } else if (this.increaseIfAlreadyInline
63 && (Parameter.SCRIPTLEVEL.equals(which))
64 && (Display.INLINE.equals(this.parentLayoutContext
65 .getParameter(Parameter.DISPLAY)))) {
66 retVal = ((Integer) this.parentLayoutContext
67 .getParameter(Parameter.SCRIPTLEVEL)) + 1;
68 } else {
69 retVal = this.parentLayoutContext.getParameter(which);
70 }
71 return retVal;
72 }
73 }