1 package com.sharkysoft.printf.engine;
2
3 import com.sharkysoft.util.EnumeratedType;
4
5 /***
6 * Text cropping styles.
7 *
8 * <p><b>Details:</b> <code>CroppingMode</code> is an enumeration of text
9 * cropping modes. Cropping occurs when text larger than the field in which it
10 * is displayed.</p>
11 *
12 * @author Sharky
13 */
14 public final class CroppingMode extends EnumeratedType
15 {
16
17 /***
18 * Initializes type-safe object value.
19 *
20 * <p><b>Details:</b> This constructor initializes type-<wbr>safe object
21 * values.</p>
22 *
23 * @param inValue magic int value
24 * @param isString string form
25 */
26 private CroppingMode(int inValue, String isString)
27 {
28 super(inValue, isString);
29 }
30
31 /***
32 * No cropping.
33 *
34 * <p><b>Details:</b> <code>NONE</code> indicates the text is not cropped.</p>
35 */
36 public static final int NONE = 0;
37
38 /***
39 * No cropping.
40 *
41 * <p><b>Details:</b> <code>gpNone</code> is a type-<wbr>safe representation
42 * of <code>NONE</code>.</p>
43 */
44 public static final CroppingMode gpNone = new CroppingMode(NONE, "NONE");
45
46 /***
47 * Right cropping.
48 *
49 * <p><b>Details:</b> <code>RIGHT</code> indicates that the right-<wbr>most
50 * portion of the text is cropped.</p>
51 */
52 public static final int RIGHT = 1;
53
54 /***
55 * Right cropping.
56 *
57 * <p><b>Details:</b> <code>gpRight</code> is a type-<wbr>safe representation
58 * of <code>RIGHT</code>.</p>
59 */
60 public static final CroppingMode gpRight = new CroppingMode(RIGHT, "RIGHT");
61
62 /***
63 * Left cropping.
64 *
65 * <p><b>Details:</b> <code>LEFT</code> indicates that the left-<wbr>most
66 * portion of the text is cropped.</p>
67 */
68 public static final int LEFT = 2;
69
70 /***
71 * Left cropping.
72 *
73 * <p><b>Details:</b> <code>gpLeft</code> is a type-<wbr>safe representation
74 * of <code>LEFT</code>.</p>
75 */
76 public static final CroppingMode gpLeft = new CroppingMode(LEFT, "LEFT");
77
78 /***
79 * Middle cropping.
80 *
81 * <p><b>Details:</b> <code>MIDDLE</code> indicates that a center portion of
82 * the text may be cropped (and perhaps replaced with ellipses).</p>
83 */
84 public static final int MIDDLE = 3;
85
86 /***
87 * Middle cropping.
88 *
89 * <p><b>Details:</b> <code>gpMiddle</code> is a type-<wbr>safe representation
90 * of <code>MIDDLE</code>.</p>
91 */
92 public static final CroppingMode gpMiddle = new CroppingMode(MIDDLE, "MIDDLE");
93
94 /***
95 * Converts int value to object value.
96 *
97 * <p><b>Details:</b> <code>forInt</code> returns the type-<wbr>safe object
98 * value corresponding to the given <code>int</code> value.</p>
99 *
100 * @param inValue int value
101 * @return type-safe object value
102 */
103 public static CroppingMode forInt(int inValue)
104 {
105 return (CroppingMode) EnumeratedType.toEnumeratedType(inValue);
106 }
107
108 }
109