Ignore:
Timestamp:
07/02/08 12:38:54 (16 years ago)
Author:
ra33
Message:

added functionality for dockable @v's

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/expeditee/items/Text.java

    r108 r115  
    3636 */
    3737public 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       
    3943        private String[] _processedText = null;
    4044
     
    344348         */
    345349        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];
    357355        }
    358356
    359357        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];
    371363        }
    372364
     
    10561048         * Updates the Polygon (rectangle) that surrounds this Text on the screen.
    10571049         */
    1058         protected void updatePolygon() {
     1050        public void updatePolygon() {
    10591051                // if there is no text, there is nothing to do
    10601052                if (_text == null)
     
    13031295                                        (float) _highlightThickness, CAP, JOIN);
    13041296                        g.setStroke(_highlightStroke);
    1305                         if (SelectedMode.Enclosed.equals(getSelectedMode()))
     1297                        if (HighlightMode.Enclosed.equals(getHighlightMode()))
    13061298                                g.fillPolygon(getPolygon());
    13071299                        else
     
    14591451                        if (isAnnotation())
    14601452                                return;
    1461                         if (!isLineEnd() && _text.length() > 0 && _text.charAt(0) == '*') {
     1453                        if (!isLineEnd() && _text.length() > 0 && _text.charAt(0) == DEFAULT_BULLET) {
    14621454                                newPoint.setLocation(insertText(""
    14631455                                                + (char) KeyEvent.VK_BACK_SPACE, mouseX, mouseY, 1));
     
    14771469                                                + (char) KeyEvent.VK_BACK_SPACE, mouseX, mouseY, 1));
    14781470                                newPoint
    1479                                                 .setLocation(insertText("* ", newPoint.x, newPoint.y, 0));
     1471                                                .setLocation(insertText( DEFAULT_BULLET_STRING, newPoint.x, newPoint.y, 0));
    14801472                        } else {
    14811473                                newPoint.setLocation(insertText(""
     
    17171709                super.setLink(frame);
    17181710        }
     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        }
    17191719}
Note: See TracChangeset for help on using the changeset viewer.