Changeset 115 for trunk/src/org/expeditee/items/Text.java
- Timestamp:
- 07/02/08 12:38:54 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/expeditee/items/Text.java
r108 r115 36 36 */ 37 37 public class Text extends Item { 38 38 public static String LINE_SEPARATOR = System.getProperty("line.separator"); 39 public static char[] BULLETS = {'\u2219' , '\u2218', '\u2217'}; 40 private static char DEFAULT_BULLET = BULLETS[2]; 41 private static String DEFAULT_BULLET_STRING = DEFAULT_BULLET + " "; 42 39 43 private String[] _processedText = null; 40 44 … … 344 348 */ 345 349 private char getNextBullet(char bullet) { 346 switch (bullet) { 347 case '*': 348 return '>'; 349 case '>': 350 return '+'; 351 case '+': 352 return 'o'; 353 case 'o': 354 return '*'; 355 } 356 return bullet; 350 for(int i = 0; i < BULLETS.length - 1; i++){ 351 if(BULLETS[i]== bullet) 352 return BULLETS[i+1]; 353 } 354 return BULLETS[0]; 357 355 } 358 356 359 357 private char getPreviousBullet(char bullet) { 360 switch (bullet) { 361 case '*': 362 return 'o'; 363 case '>': 364 return '*'; 365 case '+': 366 return '>'; 367 case 'o': 368 return '+'; 369 } 370 return bullet; 358 for(int i = 1; i < BULLETS.length; i++){ 359 if(BULLETS[i]== bullet) 360 return BULLETS[i - 1]; 361 } 362 return BULLETS[BULLETS.length - 1]; 371 363 } 372 364 … … 1056 1048 * Updates the Polygon (rectangle) that surrounds this Text on the screen. 1057 1049 */ 1058 p rotectedvoid updatePolygon() {1050 public void updatePolygon() { 1059 1051 // if there is no text, there is nothing to do 1060 1052 if (_text == null) … … 1303 1295 (float) _highlightThickness, CAP, JOIN); 1304 1296 g.setStroke(_highlightStroke); 1305 if ( SelectedMode.Enclosed.equals(getSelectedMode()))1297 if (HighlightMode.Enclosed.equals(getHighlightMode())) 1306 1298 g.fillPolygon(getPolygon()); 1307 1299 else … … 1459 1451 if (isAnnotation()) 1460 1452 return; 1461 if (!isLineEnd() && _text.length() > 0 && _text.charAt(0) == '*') {1453 if (!isLineEnd() && _text.length() > 0 && _text.charAt(0) == DEFAULT_BULLET) { 1462 1454 newPoint.setLocation(insertText("" 1463 1455 + (char) KeyEvent.VK_BACK_SPACE, mouseX, mouseY, 1)); … … 1477 1469 + (char) KeyEvent.VK_BACK_SPACE, mouseX, mouseY, 1)); 1478 1470 newPoint 1479 .setLocation(insertText( "* ", newPoint.x, newPoint.y, 0));1471 .setLocation(insertText( DEFAULT_BULLET_STRING, newPoint.x, newPoint.y, 0)); 1480 1472 } else { 1481 1473 newPoint.setLocation(insertText("" … … 1717 1709 super.setLink(frame); 1718 1710 } 1711 1712 public static boolean isBulletChar(char c) { 1713 for(int i = 0; i < BULLETS.length; i++){ 1714 if(BULLETS[i]== c) 1715 return true; 1716 } 1717 return c== '*' || c == '+' || c == '>' || c == '-' || c == 'o'; 1718 } 1719 1719 }
Note:
See TracChangeset
for help on using the changeset viewer.