1 19 20 25 26 package org.netbeans.modules.css.visual.model; 27 28 import java.util.StringTokenizer ; 29 30 35 public class TextDecorationData { 36 37 private boolean noDecorationEnabled = false; 38 private boolean underlineEnabled = false; 39 private boolean overlineEnabled = false; 40 private boolean lineThroughEnabled = false; 41 private boolean blinkEnabled = false; 42 43 44 public TextDecorationData() { 45 } 46 47 public void setDecoration(String decorationStr){ 48 StringTokenizer st = new StringTokenizer (decorationStr); 49 enableUnderline(false); 50 enableOverline(false); 51 enableLineThrough(false); 52 enableBlink(false); 53 enableNoDecoration(false); 54 while(st.hasMoreTokens()){ 55 String token = st.nextToken(); 56 if(token.trim().equals("underline")){ enableUnderline(true); 58 } 59 if(token.trim().equals("overline")){ enableOverline(true); 61 } 62 if(token.trim().equals("line-through")){ enableLineThrough(true); 64 } 65 if(token.trim().equals("blink")){ enableBlink(true); 67 } 68 if(token.trim().equals("none")){ enableNoDecoration(true); 70 } 71 } 72 } 73 74 77 public void enableUnderline(boolean underlineEnabled) { 78 this.underlineEnabled = underlineEnabled; 79 } 80 81 public boolean underlineEnabled() { 82 return underlineEnabled; 83 } 84 85 88 public void enableOverline(boolean overlineEnabled) { 89 this.overlineEnabled = overlineEnabled; 90 } 91 92 public boolean overlineEnabled() { 93 return overlineEnabled; 94 } 95 96 99 public void enableLineThrough(boolean lineThroughEnabled) { 100 this.lineThroughEnabled = lineThroughEnabled; 101 } 102 103 public boolean lineThroughEnabled() { 104 return lineThroughEnabled; 105 } 106 107 110 public void enableBlink(boolean blinkEnabled) { 111 this.blinkEnabled = blinkEnabled; 112 } 113 114 public boolean blinkEnabled() { 115 return blinkEnabled; 116 } 117 118 121 public void enableNoDecoration(boolean noDecorationEnabled) { 122 this.noDecorationEnabled = noDecorationEnabled; 123 if(noDecorationEnabled){ 124 enableUnderline(false); 125 enableOverline(false); 126 enableLineThrough(false); 127 enableBlink(false); 128 } 129 } 130 131 public boolean noDecorationEnabled() { 132 return noDecorationEnabled; 133 } 134 135 public String toString(){ 136 String textDecoration=""; 137 if(noDecorationEnabled){ 138 return "none"; } 140 if(underlineEnabled){ 141 textDecoration += " underline"; } 143 if(overlineEnabled){ 144 textDecoration += " overline"; } 146 if(lineThroughEnabled){ 147 textDecoration += " line-through"; } 149 if(blinkEnabled){ 150 textDecoration += " blink"; } 152 153 return textDecoration; 154 } 155 156 157 } 158 | Popular Tags |