Mercurial > projects > dwt-addons
comparison dwtx/draw2d/BorderLayout.d @ 103:2d6540440fe6
Replace static ctors with lazy init.
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sun, 03 Aug 2008 17:01:51 +0200 |
parents | 95307ad235d9 |
children |
comparison
equal
deleted
inserted
replaced
102:0de61c6f08ca | 103:2d6540440fe6 |
---|---|
29 { | 29 { |
30 | 30 |
31 /** | 31 /** |
32 * Constant to be used as a constraint for child figures | 32 * Constant to be used as a constraint for child figures |
33 */ | 33 */ |
34 public static const Integer CENTER; | 34 private static Integer CENTER_; |
35 /** | 35 public static Integer CENTER(){ |
36 * Constant to be used as a constraint for child figures | 36 if( !initStaticCtor_done ) initStaticCtor(); |
37 */ | 37 return CENTER_; |
38 public static const Integer TOP; | 38 } |
39 /** | 39 /** |
40 * Constant to be used as a constraint for child figures | 40 * Constant to be used as a constraint for child figures |
41 */ | 41 */ |
42 public static const Integer BOTTOM; | 42 private static Integer TOP_; |
43 /** | 43 public static Integer TOP(){ |
44 * Constant to be used as a constraint for child figures | 44 if( !initStaticCtor_done ) initStaticCtor(); |
45 */ | 45 return TOP_; |
46 public static const Integer LEFT; | 46 } |
47 /** | 47 /** |
48 * Constant to be used as a constraint for child figures | 48 * Constant to be used as a constraint for child figures |
49 */ | 49 */ |
50 public static const Integer RIGHT; | 50 private static Integer BOTTOM_; |
51 | 51 public static Integer BOTTOM(){ |
52 static this(){ | 52 if( !initStaticCtor_done ) initStaticCtor(); |
53 CENTER = new Integer(PositionConstants.CENTER); | 53 return BOTTOM_; |
54 TOP = new Integer(PositionConstants.TOP); | 54 } |
55 BOTTOM = new Integer(PositionConstants.BOTTOM); | 55 /** |
56 LEFT = new Integer(PositionConstants.LEFT); | 56 * Constant to be used as a constraint for child figures |
57 RIGHT = new Integer(PositionConstants.RIGHT); | 57 */ |
58 private static Integer LEFT_; | |
59 public static Integer LEFT(){ | |
60 if( !initStaticCtor_done ) initStaticCtor(); | |
61 return LEFT_; | |
62 } | |
63 /** | |
64 * Constant to be used as a constraint for child figures | |
65 */ | |
66 private static Integer RIGHT_; | |
67 public static Integer RIGHT(){ | |
68 if( !initStaticCtor_done ) initStaticCtor(); | |
69 return RIGHT_; | |
70 } | |
71 | |
72 private static bool initStaticCtor_done = false; | |
73 private static void initStaticCtor(){ | |
74 synchronized( BorderLayout.classinfo ){ | |
75 if( !initStaticCtor_done ){ | |
76 CENTER_ = new Integer(PositionConstants.CENTER); | |
77 TOP_ = new Integer(PositionConstants.TOP); | |
78 BOTTOM_ = new Integer(PositionConstants.BOTTOM); | |
79 LEFT_ = new Integer(PositionConstants.LEFT); | |
80 RIGHT_ = new Integer(PositionConstants.RIGHT); | |
81 initStaticCtor_done = true; | |
82 } | |
83 } | |
58 } | 84 } |
59 | 85 |
60 private IFigure center, left, top, bottom, right; | 86 private IFigure center, left, top, bottom, right; |
61 private int vGap = 0, hGap = 0; | 87 private int vGap = 0, hGap = 0; |
62 | 88 |