1 19 20 package jxl.format; 21 22 25 public final class Orientation 26 { 27 30 private int value; 31 32 35 private String string; 36 37 40 private static Orientation[] orientations = new Orientation[0]; 41 42 47 protected Orientation(int val, String s) 48 { 49 value = val; string = s; 50 51 Orientation[] oldorients = orientations; 52 orientations = new Orientation[oldorients.length + 1]; 53 System.arraycopy(oldorients, 0, orientations, 0, oldorients.length); 54 orientations[oldorients.length] = this; 55 } 56 57 62 public int getValue() 63 { 64 return value; 65 } 66 67 70 public String getDescription() 71 { 72 return string; 73 } 74 75 81 public static Orientation getOrientation(int val) 82 { 83 for (int i = 0 ; i < orientations.length ; i++) 84 { 85 if (orientations[i].getValue() == val) 86 { 87 return orientations[i]; 88 } 89 } 90 91 return HORIZONTAL; 92 } 93 94 95 98 public static Orientation HORIZONTAL = new Orientation(0, "horizontal"); 99 103 public static Orientation VERTICAL = new Orientation(0xff, "vertical"); 104 108 public static Orientation PLUS_90 = new Orientation(90, "up 90"); 109 113 public static Orientation MINUS_90 = new Orientation(180, "down 90"); 114 118 public static Orientation PLUS_45 = new Orientation(45, "up 45"); 119 123 public static Orientation MINUS_45 = new Orientation(135, "down 45"); 124 128 public static Orientation STACKED = new Orientation(255, "stacked"); 129 130 } 131 132 133 134 135 136 137 138 139 140 | Popular Tags |