1 7 package javax.swing.plaf.basic; 8 9 import java.util.*; 10 import java.awt.*; 11 import java.awt.event.*; 12 import java.awt.font.*; 13 import java.awt.datatransfer.*; 14 import java.awt.dnd.*; 15 import java.awt.im.InputContext ; 16 import java.beans.*; 17 import java.io.*; 18 import java.net.*; 19 import javax.swing.*; 20 import javax.swing.plaf.*; 21 import javax.swing.text.*; 22 import javax.swing.event.*; 23 import javax.swing.border.Border ; 24 import javax.swing.plaf.UIResource ; 25 import sun.swing.DefaultLookup; 26 import sun.awt.AppContext; 27 import javax.swing.plaf.basic.DragRecognitionSupport.BeforeDrag ; 28 29 94 public abstract class BasicTextUI extends TextUI implements ViewFactory { 95 96 99 public BasicTextUI() { 100 painted = false; 101 } 102 103 111 protected Caret createCaret() { 112 return new BasicCaret(); 113 } 114 115 123 protected Highlighter createHighlighter() { 124 return new BasicHighlighter(); 125 } 126 127 135 protected String getKeymapName() { 136 String nm = getClass().getName(); 137 int index = nm.lastIndexOf('.'); 138 if (index >= 0) { 139 nm = nm.substring(index+1, nm.length()); 140 } 141 return nm; 142 } 143 144 161 protected Keymap createKeymap() { 162 String nm = getKeymapName(); 163 Keymap map = JTextComponent.getKeymap(nm); 164 if (map == null) { 165 Keymap parent = JTextComponent.getKeymap(JTextComponent.DEFAULT_KEYMAP); 166 map = JTextComponent.addKeymap(nm, parent); 167 String prefix = getPropertyPrefix(); 168 Object o = DefaultLookup.get(editor, this, 169 prefix + ".keyBindings"); 170 if ((o != null) && (o instanceof JTextComponent.KeyBinding[])) { 171 JTextComponent.KeyBinding[] bindings = (JTextComponent.KeyBinding[]) o; 172 JTextComponent.loadKeymap(map, bindings, getComponent().getActions()); 173 } 174 } 175 return map; 176 } 177 178 189 protected void propertyChange(PropertyChangeEvent evt) { 190 } 191 192 199 protected abstract String getPropertyPrefix(); 200 201 212 protected void installDefaults() 213 { 214 String prefix = getPropertyPrefix(); 215 Font f = editor.getFont(); 216 if ((f == null) || (f instanceof UIResource )) { 217 editor.setFont(UIManager.getFont(prefix + ".font")); 218 } 219 220 Color bg = editor.getBackground(); 221 if ((bg == null) || (bg instanceof UIResource )) { 222 editor.setBackground(UIManager.getColor(prefix + ".background")); 223 } 224 225 Color fg = editor.getForeground(); 226 if ((fg == null) || (fg instanceof UIResource )) { 227 editor.setForeground(UIManager.getColor(prefix + ".foreground")); 228 } 229 230 Color color = editor.getCaretColor(); 231 if ((color == null) || (color instanceof UIResource )) { 232 editor.setCaretColor(UIManager.getColor(prefix + ".caretForeground")); 233 } 234 235 Color s = editor.getSelectionColor(); 236 if ((s == null) || (s instanceof UIResource )) { 237 editor.setSelectionColor(UIManager.getColor(prefix + ".selectionBackground")); 238 } 239 240 Color sfg = editor.getSelectedTextColor(); 241 if ((sfg == null) || (sfg instanceof UIResource )) { 242 editor.setSelectedTextColor(UIManager.getColor(prefix + ".selectionForeground")); 243 } 244 245 Color dfg = editor.getDisabledTextColor(); 246 if ((dfg == null) || (dfg instanceof UIResource )) { 247 editor.setDisabledTextColor(UIManager.getColor(prefix + ".inactiveForeground")); 248 } 249 250 Border b = editor.getBorder(); 251 if ((b == null) || (b instanceof UIResource )) { 252 editor.setBorder(UIManager.getBorder(prefix + ".border")); 253 } 254 255 Insets margin = editor.getMargin(); 256 if (margin == null || margin instanceof UIResource ) { 257 editor.setMargin(UIManager.getInsets(prefix + ".margin")); 258 } 259 } 260 261 private void installDefaults2() { 262 editor.addMouseListener(dragListener); 263 editor.addMouseMotionListener(dragListener); 264 265 String prefix = getPropertyPrefix(); 266 267 Caret caret = editor.getCaret(); 268 if (caret == null || caret instanceof UIResource ) { 269 caret = createCaret(); 270 editor.setCaret(caret); 271 272 int rate = DefaultLookup.getInt(getComponent(), this, prefix + ".caretBlinkRate", 500); 273 caret.setBlinkRate(rate); 274 } 275 276 Highlighter highlighter = editor.getHighlighter(); 277 if (highlighter == null || highlighter instanceof UIResource ) { 278 editor.setHighlighter(createHighlighter()); 279 } 280 281 TransferHandler th = editor.getTransferHandler(); 282 if (th == null || th instanceof UIResource ) { 283 editor.setTransferHandler(getTransferHandler()); 284 } 285 DropTarget dropTarget = editor.getDropTarget(); 286 if (dropTarget instanceof UIResource ) { 287 if (defaultDropTargetListener == null) { 288 defaultDropTargetListener = new TextDropTargetListener(); 289 } 290 try { 291 dropTarget.addDropTargetListener(defaultDropTargetListener); 292 } catch (TooManyListenersException tmle) { 293 } 295 } 296 } 297 298 306 protected void uninstallDefaults() 307 { 308 editor.removeMouseListener(dragListener); 309 editor.removeMouseMotionListener(dragListener); 310 311 if (editor.getCaretColor() instanceof UIResource ) { 312 editor.setCaretColor(null); 313 } 314 315 if (editor.getSelectionColor() instanceof UIResource ) { 316 editor.setSelectionColor(null); 317 } 318 319 if (editor.getDisabledTextColor() instanceof UIResource ) { 320 editor.setDisabledTextColor(null); 321 } 322 323 if (editor.getSelectedTextColor() instanceof UIResource ) { 324 editor.setSelectedTextColor(null); 325 } 326 327 if (editor.getBorder() instanceof UIResource ) { 328 editor.setBorder(null); 329 } 330 331 if (editor.getMargin() instanceof UIResource ) { 332 editor.setMargin(null); 333 } 334 335 if (editor.getCaret() instanceof UIResource ) { 336 editor.setCaret(null); 337 } 338 339 if (editor.getHighlighter() instanceof UIResource ) { 340 editor.setHighlighter(null); 341 } 342 343 if (editor.getTransferHandler() instanceof UIResource ) { 344 editor.setTransferHandler(null); 345 } 346 } 347 348 351 protected void installListeners() { 352 } 353 354 357 protected void uninstallListeners() { 358 } 359 360 protected void installKeyboardActions() { 361 editor.setKeymap(createKeymap()); 364 365 InputMap km = getInputMap(); 366 if (km != null) { 367 SwingUtilities.replaceUIInputMap(editor, JComponent.WHEN_FOCUSED, 368 km); 369 } 370 371 ActionMap map = getActionMap(); 372 if (map != null) { 373 SwingUtilities.replaceUIActionMap(editor, map); 374 } 375 376 updateFocusAcceleratorBinding(false); 377 } 378 379 382 InputMap getInputMap() { 383 InputMap map = new InputMapUIResource(); 384 385 InputMap shared = 386 (InputMap)DefaultLookup.get(editor, this, 387 getPropertyPrefix() + ".focusInputMap"); 388 if (shared != null) { 389 map.setParent(shared); 390 } 391 return map; 392 } 393 394 398 void updateFocusAcceleratorBinding(boolean changed) { 399 char accelerator = editor.getFocusAccelerator(); 400 401 if (changed || accelerator != '\0') { 402 InputMap km = SwingUtilities.getUIInputMap 403 (editor, JComponent.WHEN_IN_FOCUSED_WINDOW); 404 405 if (km == null && accelerator != '\0') { 406 km = new ComponentInputMapUIResource(editor); 407 SwingUtilities.replaceUIInputMap(editor, JComponent. 408 WHEN_IN_FOCUSED_WINDOW, km); 409 ActionMap am = getActionMap(); 410 SwingUtilities.replaceUIActionMap(editor, am); 411 } 412 if (km != null) { 413 km.clear(); 414 if (accelerator != '\0') { 415 km.put(KeyStroke.getKeyStroke(accelerator, 416 ActionEvent.ALT_MASK), 417 "requestFocus"); 418 } 419 } 420 } 421 } 422 423 424 432 433 void updateFocusTraversalKeys() { 434 438 EditorKit editorKit = getEditorKit(editor); 439 if ( editorKit != null 440 && editorKit instanceof DefaultEditorKit) { 441 Set storedForwardTraversalKeys = editor. 442 getFocusTraversalKeys(KeyboardFocusManager. 443 FORWARD_TRAVERSAL_KEYS); 444 Set storedBackwardTraversalKeys = editor. 445 getFocusTraversalKeys(KeyboardFocusManager. 446 BACKWARD_TRAVERSAL_KEYS); 447 Set forwardTraversalKeys = 448 new HashSet(storedForwardTraversalKeys); 449 Set backwardTraversalKeys = 450 new HashSet(storedBackwardTraversalKeys); 451 if (editor.isEditable()) { 452 forwardTraversalKeys. 453 remove(KeyStroke.getKeyStroke(KeyEvent.VK_TAB, 0)); 454 backwardTraversalKeys. 455 remove(KeyStroke.getKeyStroke(KeyEvent.VK_TAB, 456 InputEvent.SHIFT_MASK)); 457 } else { 458 forwardTraversalKeys.add(KeyStroke. 459 getKeyStroke(KeyEvent.VK_TAB, 0)); 460 backwardTraversalKeys. 461 add(KeyStroke. 462 getKeyStroke(KeyEvent.VK_TAB, InputEvent.SHIFT_MASK)); 463 } 464 LookAndFeel.installProperty(editor, 465 "focusTraversalKeysForward", 466 forwardTraversalKeys); 467 LookAndFeel.installProperty(editor, 468 "focusTraversalKeysBackward", 469 backwardTraversalKeys); 470 } 471 472 } 473 474 478 TransferHandler getTransferHandler() { 479 return defaultTransferHandler; 480 } 481 482 485 ActionMap getActionMap() { 486 String mapName = getPropertyPrefix() + ".actionMap"; 487 ActionMap map = (ActionMap)UIManager.get(mapName); 488 489 if (map == null) { 490 map = createActionMap(); 491 if (map != null) { 492 UIManager.getLookAndFeelDefaults().put(mapName, map); 493 } 494 } 495 ActionMap componentMap = new ActionMapUIResource(); 496 componentMap.put("requestFocus", new FocusAction()); 497 506 if (getEditorKit(editor) instanceof DefaultEditorKit) { 507 if (map != null) { 508 Object obj = map.get(DefaultEditorKit.insertBreakAction); 509 if (obj != null 510 && obj instanceof DefaultEditorKit.InsertBreakAction) { 511 Action action = new TextActionWrapper((TextAction)obj); 512 componentMap.put(action.getValue(Action.NAME),action); 513 } 514 } 515 } 516 if (map != null) { 517 componentMap.setParent(map); 518 } 519 return componentMap; 520 } 521 522 526 ActionMap createActionMap() { 527 ActionMap map = new ActionMapUIResource(); 528 Action[] actions = editor.getActions(); 529 int n = actions.length; 531 for (int i = 0; i < n; i++) { 532 Action a = actions[i]; 533 map.put(a.getValue(Action.NAME), a); 534 } 536 map.put(TransferHandler.getCutAction().getValue(Action.NAME), 537 TransferHandler.getCutAction()); 538 map.put(TransferHandler.getCopyAction().getValue(Action.NAME), 539 TransferHandler.getCopyAction()); 540 map.put(TransferHandler.getPasteAction().getValue(Action.NAME), 541 TransferHandler.getPasteAction()); 542 return map; 543 } 544 545 protected void uninstallKeyboardActions() { 546 editor.setKeymap(null); 547 SwingUtilities.replaceUIInputMap(editor, JComponent. 548 WHEN_IN_FOCUSED_WINDOW, null); 549 SwingUtilities.replaceUIActionMap(editor, null); 550 } 551 552 560 protected void paintBackground(Graphics g) { 561 g.setColor(editor.getBackground()); 562 g.fillRect(0, 0, editor.getWidth(), editor.getHeight()); 563 } 564 565 572 protected final JTextComponent getComponent() { 573 return editor; 574 } 575 576 583 protected void modelChanged() { 584 ViewFactory f = rootView.getViewFactory(); 586 Document doc = editor.getDocument(); 587 Element elem = doc.getDefaultRootElement(); 588 setView(f.create(elem)); 589 } 590 591 598 protected final void setView(View v) { 599 rootView.setView(v); 600 painted = false; 601 editor.revalidate(); 602 editor.repaint(); 603 } 604 605 625 protected void paintSafely(Graphics g) { 626 painted = true; 627 Highlighter highlighter = editor.getHighlighter(); 628 Caret caret = editor.getCaret(); 629 630 if (editor.isOpaque()) { 632 paintBackground(g); 633 } 634 635 if (highlighter != null) { 637 highlighter.paint(g); 638 } 639 640 Rectangle alloc = getVisibleEditorRect(); 642 if (alloc != null) { 643 rootView.paint(g, alloc); 644 } 645 646 if (caret != null) { 648 caret.paint(g); 649 } 650 } 651 652 654 677 public void installUI(JComponent c) { 678 if (c instanceof JTextComponent) { 679 editor = (JTextComponent) c; 680 681 installDefaults(); 683 installDefaults2(); 684 685 LookAndFeel.installProperty(editor, "opaque", Boolean.TRUE); 689 LookAndFeel.installProperty(editor, "autoscrolls", Boolean.TRUE); 690 691 editor.addPropertyChangeListener(updateHandler); 693 Document doc = editor.getDocument(); 694 if (doc == null) { 695 editor.setDocument(getEditorKit(editor).createDefaultDocument()); 699 } else { 700 doc.addDocumentListener(updateHandler); 701 modelChanged(); 702 } 703 704 installListeners(); 706 installKeyboardActions(); 707 708 LayoutManager oldLayout = editor.getLayout(); 709 if ((oldLayout == null) || (oldLayout instanceof UIResource )) { 710 editor.setLayout(updateHandler); 713 } 714 715 } else { 716 throw new Error ("TextUI needs JTextComponent"); 717 } 718 } 719 720 727 public void uninstallUI(JComponent c) { 728 editor.removePropertyChangeListener(updateHandler); 730 editor.getDocument().removeDocumentListener(updateHandler); 731 732 painted = false; 734 uninstallDefaults(); 735 rootView.setView(null); 736 c.removeAll(); 737 LayoutManager lm = c.getLayout(); 738 if (lm instanceof UIResource ) { 739 c.setLayout(null); 740 } 741 742 uninstallKeyboardActions(); 744 uninstallListeners(); 745 746 editor = null; 747 } 748 749 759 public void update(Graphics g, JComponent c) { 760 paint(g, c); 761 } 762 763 774 public final void paint(Graphics g, JComponent c) { 775 if ((rootView.getViewCount() > 0) && (rootView.getView(0) != null)) { 776 Document doc = editor.getDocument(); 777 if (doc instanceof AbstractDocument) { 778 ((AbstractDocument)doc).readLock(); 779 } 780 try { 781 paintSafely(g); 782 } finally { 783 if (doc instanceof AbstractDocument) { 784 ((AbstractDocument)doc).readUnlock(); 785 } 786 } 787 } 788 } 789 790 802 public Dimension getPreferredSize(JComponent c) { 803 Document doc = editor.getDocument(); 804 Insets i = c.getInsets(); 805 Dimension d = c.getSize(); 806 807 if (doc instanceof AbstractDocument) { 808 ((AbstractDocument)doc).readLock(); 809 } 810 try { 811 if ((d.width > (i.left + i.right)) && (d.height > (i.top + i.bottom))) { 812 rootView.setSize(d.width - i.left - i.right, d.height - i.top - i.bottom); 813 } 814 else if (d.width == 0 && d.height == 0) { 815 rootView.setSize(Integer.MAX_VALUE, Integer.MAX_VALUE); 818 } 819 d.width = (int) Math.min((long) rootView.getPreferredSpan(View.X_AXIS) + 820 (long) i.left + (long) i.right, Integer.MAX_VALUE); 821 d.height = (int) Math.min((long) rootView.getPreferredSpan(View.Y_AXIS) + 822 (long) i.top + (long) i.bottom, Integer.MAX_VALUE); 823 } finally { 824 if (doc instanceof AbstractDocument) { 825 ((AbstractDocument)doc).readUnlock(); 826 } 827 } 828 return d; 829 } 830 831 837 public Dimension getMinimumSize(JComponent c) { 838 Document doc = editor.getDocument(); 839 Insets i = c.getInsets(); 840 Dimension d = new Dimension(); 841 if (doc instanceof AbstractDocument) { 842 ((AbstractDocument)doc).readLock(); 843 } 844 try { 845 d.width = (int) rootView.getMinimumSpan(View.X_AXIS) + i.left + i.right; 846 d.height = (int) rootView.getMinimumSpan(View.Y_AXIS) + i.top + i.bottom; 847 } finally { 848 if (doc instanceof AbstractDocument) { 849 ((AbstractDocument)doc).readUnlock(); 850 } 851 } 852 return d; 853 } 854 855 861 public Dimension getMaximumSize(JComponent c) { 862 Document doc = editor.getDocument(); 863 Insets i = c.getInsets(); 864 Dimension d = new Dimension(); 865 if (doc instanceof AbstractDocument) { 866 ((AbstractDocument)doc).readLock(); 867 } 868 try { 869 d.width = (int) Math.min((long) rootView.getMaximumSpan(View.X_AXIS) + 870 (long) i.left + (long) i.right, Integer.MAX_VALUE); 871 d.height = (int) Math.min((long) rootView.getMaximumSpan(View.Y_AXIS) + 872 (long) i.top + (long) i.bottom, Integer.MAX_VALUE); 873 } finally { 874 if (doc instanceof AbstractDocument) { 875 ((AbstractDocument)doc).readUnlock(); 876 } 877 } 878 return d; 879 } 880 881 883 884 894 protected Rectangle getVisibleEditorRect() { 895 Rectangle alloc = editor.getBounds(); 896 if ((alloc.width > 0) && (alloc.height > 0)) { 897 alloc.x = alloc.y = 0; 898 Insets insets = editor.getInsets(); 899 alloc.x += insets.left; 900 alloc.y += insets.top; 901 alloc.width -= insets.left + insets.right; 902 alloc.height -= insets.top + insets.bottom; 903 return alloc; 904 } 905 return null; 906 } 907 908 921 public Rectangle modelToView(JTextComponent tc, int pos) throws BadLocationException { 922 return modelToView(tc, pos, Position.Bias.Forward); 923 } 924 925 938 public Rectangle modelToView(JTextComponent tc, int pos, Position.Bias bias) throws BadLocationException { 939 Document doc = editor.getDocument(); 940 if (doc instanceof AbstractDocument) { 941 ((AbstractDocument)doc).readLock(); 942 } 943 try { 944 Rectangle alloc = getVisibleEditorRect(); 945 if (alloc != null) { 946 rootView.setSize(alloc.width, alloc.height); 947 Shape s = rootView.modelToView(pos, alloc, bias); 948 if (s != null) { 949 return s.getBounds(); 950 } 951 } 952 } finally { 953 if (doc instanceof AbstractDocument) { 954 ((AbstractDocument)doc).readUnlock(); 955 } 956 } 957 return null; 958 } 959 960 973 public int viewToModel(JTextComponent tc, Point pt) { 974 return viewToModel(tc, pt, discardBias); 975 } 976 977 990 public int viewToModel(JTextComponent tc, Point pt, 991 Position.Bias[] biasReturn) { 992 int offs = -1; 993 Document doc = editor.getDocument(); 994 if (doc instanceof AbstractDocument) { 995 ((AbstractDocument)doc).readLock(); 996 } 997 try { 998 Rectangle alloc = getVisibleEditorRect(); 999 if (alloc != null) { 1000 rootView.setSize(alloc.width, alloc.height); 1001 offs = rootView.viewToModel(pt.x, pt.y, alloc, biasReturn); 1002 } 1003 } finally { 1004 if (doc instanceof AbstractDocument) { 1005 ((AbstractDocument)doc).readUnlock(); 1006 } 1007 } 1008 return offs; 1009 } 1010 1011 1028 public int getNextVisualPositionFrom(JTextComponent t, int pos, 1029 Position.Bias b, int direction, Position.Bias[] biasRet) 1030 throws BadLocationException{ 1031 Document doc = editor.getDocument(); 1032 if (doc instanceof AbstractDocument) { 1033 ((AbstractDocument)doc).readLock(); 1034 } 1035 try { 1036 if (painted) { 1037 Rectangle alloc = getVisibleEditorRect(); 1038 if (alloc != null) { 1039 rootView.setSize(alloc.width, alloc.height); 1040 } 1041 return rootView.getNextVisualPositionFrom(pos, b, alloc, direction, 1042 biasRet); 1043 } 1044 } finally { 1045 if (doc instanceof AbstractDocument) { 1046 ((AbstractDocument)doc).readUnlock(); 1047 } 1048 } 1049 return -1; 1050 } 1051 1052 1062 public void damageRange(JTextComponent tc, int p0, int p1) { 1063 damageRange(tc, p0, p1, Position.Bias.Forward, Position.Bias.Backward); 1064 } 1065 1066 1073 public void damageRange(JTextComponent t, int p0, int p1, 1074 Position.Bias p0Bias, Position.Bias p1Bias) { 1075 if (painted) { 1076 Rectangle alloc = getVisibleEditorRect(); 1077 if (alloc != null) { 1078 Document doc = t.getDocument(); 1079 if (doc instanceof AbstractDocument) { 1080 ((AbstractDocument)doc).readLock(); 1081 } 1082 try { 1083 rootView.setSize(alloc.width, alloc.height); 1084 Shape toDamage = rootView.modelToView(p0, p0Bias, 1085 p1, p1Bias, alloc); 1086 Rectangle rect = (toDamage instanceof Rectangle) ? 1087 (Rectangle)toDamage : toDamage.getBounds(); 1088 editor.repaint(rect.x, rect.y, rect.width, rect.height); 1089 } catch (BadLocationException e) { 1090 } finally { 1091 if (doc instanceof AbstractDocument) { 1092 ((AbstractDocument)doc).readUnlock(); 1093 } 1094 } 1095 } 1096 } 1097 } 1098 1099 1106 public EditorKit getEditorKit(JTextComponent tc) { 1107 return defaultKit; 1108 } 1109 1110 1128 public View getRootView(JTextComponent tc) { 1129 return rootView; 1130 } 1131 1132 1133 1141 public String getToolTipText(JTextComponent t, Point pt) { 1142 if (!painted) { 1143 return null; 1144 } 1145 Document doc = editor.getDocument(); 1146 String tt = null; 1147 Rectangle alloc = getVisibleEditorRect(); 1148 1149 if (alloc != null) { 1150 if (doc instanceof AbstractDocument) { 1151 ((AbstractDocument)doc).readLock(); 1152 } 1153 try { 1154 tt = rootView.getToolTipText(pt.x, pt.y, alloc); 1155 } finally { 1156 if (doc instanceof AbstractDocument) { 1157 ((AbstractDocument)doc).readUnlock(); 1158 } 1159 } 1160 } 1161 return tt; 1162 } 1163 1164 1166 1176 public View create(Element elem) { 1177 return null; 1178 } 1179 1180 1192 public View create(Element elem, int p0, int p1) { 1193 return null; 1194 } 1195 1196 public static class BasicCaret extends DefaultCaret implements UIResource {} 1197 1198 public static class BasicHighlighter extends DefaultHighlighter implements UIResource {} 1199 1200 1201 1203 private static final EditorKit defaultKit = new DefaultEditorKit(); 1204 transient JTextComponent editor; 1205 transient boolean painted; 1206 transient RootView rootView = new RootView(); 1207 transient UpdateHandler updateHandler = new UpdateHandler(); 1208 private static final TransferHandler defaultTransferHandler = new TextTransferHandler(); 1209 private static DropTargetListener defaultDropTargetListener = null; 1210 private final DragListener dragListener = getDragListener(); 1211 private static final Position.Bias[] discardBias = new Position.Bias[1]; 1212 1213 1217 class RootView extends View { 1218 1219 RootView() { 1220 super(null); 1221 } 1222 1223 void setView(View v) { 1224 View oldView = view; 1225 view = null; 1226 if (oldView != null) { 1227 oldView.setParent(null); 1230 } 1231 if (v != null) { 1232 v.setParent(this); 1233 } 1234 view = v; 1235 } 1236 1237 1242 public AttributeSet getAttributes() { 1243 return null; 1244 } 1245 1246 1255 public float getPreferredSpan(int axis) { 1256 if (view != null) { 1257 return view.getPreferredSpan(axis); 1258 } 1259 return 10; 1260 } 1261 1262 1271 public float getMinimumSpan(int axis) { 1272 if (view != null) { 1273 return view.getMinimumSpan(axis); 1274 } 1275 return 10; 1276 } 1277 1278 1287 public float getMaximumSpan(int axis) { 1288 return Integer.MAX_VALUE; 1289 } 1290 1291 1309 public void preferenceChanged(View child, boolean width, boolean height) { 1310 editor.revalidate(); 1311 } 1312 1313 1320 public float getAlignment(int axis) { 1321 if (view != null) { 1322 return view.getAlignment(axis); 1323 } 1324 return 0; 1325 } 1326 1327 1333 public void paint(Graphics g, Shape allocation) { 1334 if (view != null) { 1335 Rectangle alloc = (allocation instanceof Rectangle) ? 1336 (Rectangle)allocation : allocation.getBounds(); 1337 setSize(alloc.width, alloc.height); 1338 view.paint(g, allocation); 1339 } 1340 } 1341 1342 1347 public void setParent(View parent) { 1348 throw new Error ("Can't set parent on root view"); 1349 } 1350 1351 1359 public int getViewCount() { 1360 return 1; 1361 } 1362 1363 1369 public View getView(int n) { 1370 return view; 1371 } 1372 1373 1383 public int getViewIndex(int pos, Position.Bias b) { 1384 return 0; 1385 } 1386 1387 1399 public Shape getChildAllocation(int index, Shape a) { 1400 return a; 1401 } 1402 1403 1411 public Shape modelToView(int pos, Shape a, Position.Bias b) throws BadLocationException { 1412 if (view != null) { 1413 return view.modelToView(pos, a, b); 1414 } 1415 return null; 1416 } 1417 1418 1437 public Shape modelToView(int p0, Position.Bias b0, int p1, Position.Bias b1, Shape a) throws BadLocationException { 1438 if (view != null) { 1439 return view.modelToView(p0, b0, p1, b1, a); 1440 } 1441 return null; 1442 } 1443 1444 1454 public int viewToModel(float x, float y, Shape a, Position.Bias[] bias) { 1455 if (view != null) { 1456 int retValue = view.viewToModel(x, y, a, bias); 1457 return retValue; 1458 } 1459 return -1; 1460 } 1461 1462 1479 public int getNextVisualPositionFrom(int pos, Position.Bias b, Shape a, 1480 int direction, 1481 Position.Bias[] biasRet) 1482 throws BadLocationException { 1483 if( view != null ) { 1484 int nextPos = view.getNextVisualPositionFrom(pos, b, a, 1485 direction, biasRet); 1486 if(nextPos != -1) { 1487 pos = nextPos; 1488 } 1489 else { 1490 biasRet[0] = b; 1491 } 1492 } 1493 return pos; 1494 } 1495 1496 1504 public void insertUpdate(DocumentEvent e, Shape a, ViewFactory f) { 1505 if (view != null) { 1506 view.insertUpdate(e, a, f); 1507 } 1508 } 1509 1510 1518 public void removeUpdate(DocumentEvent e, Shape a, ViewFactory f) { 1519 if (view != null) { 1520 view.removeUpdate(e, a, f); 1521 } 1522 } 1523 1524 1532 public void changedUpdate(DocumentEvent e, Shape a, ViewFactory f) { 1533 if (view != null) { 1534 view.changedUpdate(e, a, f); 1535 } 1536 } 1537 1538 1543 public Document getDocument() { 1544 return editor.getDocument(); 1545 } 1546 1547 1552 public int getStartOffset() { 1553 if (view != null) { 1554 return view.getStartOffset(); 1555 } 1556 return getElement().getStartOffset(); 1557 } 1558 1559 1564 public int getEndOffset() { 1565 if (view != null) { 1566 return view.getEndOffset(); 1567 } 1568 return getElement().getEndOffset(); 1569 } 1570 1571 1576 public Element getElement() { 1577 if (view != null) { 1578 return view.getElement(); 1579 } 1580 return editor.getDocument().getDefaultRootElement(); 1581 } 1582 1583 1592 public View breakView(int axis, float len, Shape a) { 1593 throw new Error ("Can't break root view"); 1594 } 1595 1596 1603 public int getResizeWeight(int axis) { 1604 if (view != null) { 1605 return view.getResizeWeight(axis); 1606 } 1607 return 0; 1608 } 1609 1610 1616 public void setSize(float width, float height) { 1617 if (view != null) { 1618 view.setSize(width, height); 1619 } 1620 } 1621 1622 1630 public Container getContainer() { 1631 return editor; 1632 } 1633 1634 1647 public ViewFactory getViewFactory() { 1648 EditorKit kit = getEditorKit(editor); 1649 ViewFactory f = kit.getViewFactory(); 1650 if (f != null) { 1651 return f; 1652 } 1653 return BasicTextUI.this; 1654 } 1655 1656 private View view; 1657 1658 } 1659 1660 1668 class UpdateHandler implements PropertyChangeListener, DocumentListener, LayoutManager2, UIResource { 1669 1670 1672 1676 public final void propertyChange(PropertyChangeEvent evt) { 1677 Object oldValue = evt.getOldValue(); 1678 Object newValue = evt.getNewValue(); 1679 String propertyName = evt.getPropertyName(); 1680 if ((oldValue instanceof Document) || (newValue instanceof Document)) { 1681 if (oldValue != null) { 1682 ((Document)oldValue).removeDocumentListener(this); 1683 i18nView = false; 1684 } 1685 if (newValue != null) { 1686 ((Document)newValue).addDocumentListener(this); 1687 if ("document" == propertyName) { 1688 setView(null); 1689 BasicTextUI.this.propertyChange(evt); 1690 modelChanged(); 1691 return; 1692 } 1693 } 1694 modelChanged(); 1695 } 1696 if ("focusAccelerator" == propertyName) { 1697 updateFocusAcceleratorBinding(true); 1698 } else if ("componentOrientation" == propertyName) { 1699 modelChanged(); 1702 } else if ("font" == propertyName) { 1703 modelChanged(); 1704 } else if ("transferHandler" == propertyName) { 1705 DropTarget dropTarget = editor.getDropTarget(); 1706 if (dropTarget instanceof UIResource ) { 1707 if (defaultDropTargetListener == null) { 1708 defaultDropTargetListener = new TextDropTargetListener(); 1709 } 1710 try { 1711 dropTarget.addDropTargetListener(defaultDropTargetListener); 1712 } catch (TooManyListenersException tmle) { 1713 } 1715 } 1716 } else if ("editable" == propertyName) { 1717 modelChanged(); 1718 } 1719 BasicTextUI.this.propertyChange(evt); 1720 } 1721 1722 1724 1734 public final void insertUpdate(DocumentEvent e) { 1735 Document doc = e.getDocument(); 1736 Object o = doc.getProperty("i18n"); 1737 if (o instanceof Boolean ) { 1738 Boolean i18nFlag = (Boolean ) o; 1739 if (i18nFlag.booleanValue() != i18nView) { 1740 i18nView = i18nFlag.booleanValue(); 1742 modelChanged(); 1743 return; 1744 } 1745 } 1746 1747 Rectangle alloc = (painted) ? getVisibleEditorRect() : null; 1749 rootView.insertUpdate(e, alloc, rootView.getViewFactory()); 1750 } 1751 1752 1762 public final void removeUpdate(DocumentEvent e) { 1763 Rectangle alloc = (painted) ? getVisibleEditorRect() : null; 1764 rootView.removeUpdate(e, alloc, rootView.getViewFactory()); 1765 } 1766 1767 1777 public final void changedUpdate(DocumentEvent e) { 1778 Rectangle alloc = (painted) ? getVisibleEditorRect() : null; 1779 rootView.changedUpdate(e, alloc, rootView.getViewFactory()); 1780 } 1781 1782 1784 1790 public void addLayoutComponent(String name, Component comp) { 1791 } 1793 1794 1798 public void removeLayoutComponent(Component comp) { 1799 if (constraints != null) { 1800 constraints.remove(comp); 1802 } 1803 } 1804 1805 1812 public Dimension preferredLayoutSize(Container parent) { 1813 return null; 1815 } 1816 1817 1823 public Dimension minimumLayoutSize(Container parent) { 1824 return null; 1826 } 1827 1828 1841 public void layoutContainer(Container parent) { 1842 if ((constraints != null) && (! constraints.isEmpty())) { 1843 Rectangle alloc = getVisibleEditorRect(); 1844 if (alloc != null) { 1845 Document doc = editor.getDocument(); 1846 if (doc instanceof AbstractDocument) { 1847 ((AbstractDocument)doc).readLock(); 1848 } 1849 try { 1850 rootView.setSize(alloc.width, alloc.height); 1851 Enumeration components = constraints.keys(); 1852 while (components.hasMoreElements()) { 1853 Component comp = (Component) components.nextElement(); 1854 View v = (View) constraints.get(comp); 1855 Shape ca = calculateViewPosition(alloc, v); 1856 if (ca != null) { 1857 Rectangle compAlloc = (ca instanceof Rectangle) ? 1858 (Rectangle) ca : ca.getBounds(); 1859 comp.setBounds(compAlloc); 1860 } 1861 } 1862 } finally { 1863 if (doc instanceof AbstractDocument) { 1864 ((AbstractDocument)doc).readUnlock(); 1865 } 1866 } 1867 } 1868 } 1869 } 1870 1871 1874 Shape calculateViewPosition(Shape alloc, View v) { 1875 int pos = v.getStartOffset(); 1876 View child = null; 1877 for (View parent = rootView; (parent != null) && (parent != v); parent = child) { 1878 int index = parent.getViewIndex(pos, Position.Bias.Forward); 1879 alloc = parent.getChildAllocation(index, alloc); 1880 child = parent.getView(index); 1881 } 1882 return (child != null) ? alloc : null; 1883 } 1884 1885 1893 public void addLayoutComponent(Component comp, Object constraint) { 1894 if (constraint instanceof View) { 1895 if (constraints == null) { 1896 constraints = new Hashtable(7); 1897 } 1898 constraints.put(comp, constraint); 1899 } 1900 } 1901 1902 1908 public Dimension maximumLayoutSize(Container target) { 1909 return null; 1911 } 1912 1913 1920 public float getLayoutAlignmentX(Container target) { 1921 return 0.5f; 1922 } 1923 1924 1931 public float getLayoutAlignmentY(Container target) { 1932 return 0.5f; 1933 } 1934 1935 1939 public void invalidateLayout(Container target) { 1940 } 1941 1942 1947 private Hashtable constraints; 1948 1949 private boolean i18nView = false; 1950 } 1951 1952 1955 class TextActionWrapper extends TextAction { 1956 public TextActionWrapper(TextAction action) { 1957 super((String )action.getValue(Action.NAME)); 1958 this.action = action; 1959 } 1960 1965 public void actionPerformed(ActionEvent e) { 1966 action.actionPerformed(e); 1967 } 1968 public boolean isEnabled() { 1969 return (editor == null || editor.isEditable()) ? action.isEnabled() : false; 1970 } 1971 TextAction action = null; 1972 } 1973 1974 1975 1978 class FocusAction extends AbstractAction { 1979 1980 public void actionPerformed(ActionEvent e) { 1981 editor.requestFocus(); 1982 } 1983 1984 public boolean isEnabled() { 1985 return editor.isEditable(); 1986 } 1987 } 1988 1989 private static DragListener getDragListener() { 1990 synchronized(DragListener.class) { 1991 DragListener listener = 1992 (DragListener)AppContext.getAppContext(). 1993 get(DragListener.class); 1994 1995 if (listener == null) { 1996 listener = new DragListener(); 1997 AppContext.getAppContext().put(DragListener.class, listener); 1998 } 1999 2000 return listener; 2001 } 2002 } 2003 2004 2008 static class DragListener extends MouseInputAdapter 2009 implements BeforeDrag { 2010 2011 private boolean dragStarted; 2012 2013 public void dragStarting(MouseEvent me) { 2014 dragStarted = true; 2015 } 2016 2017 public void mousePressed(MouseEvent e) { 2018 JTextComponent c = (JTextComponent)e.getSource(); 2019 if (c.getDragEnabled()) { 2020 dragStarted = false; 2021 if (isDragPossible(e) && DragRecognitionSupport.mousePressed(e)) { 2022 e.consume(); 2023 } 2024 } 2025 } 2026 2027 public void mouseReleased(MouseEvent e) { 2028 JTextComponent c = (JTextComponent)e.getSource(); 2029 if (c.getDragEnabled()) { 2030 if (dragStarted) { 2031 e.consume(); 2032 } 2033 2034 DragRecognitionSupport.mouseReleased(e); 2035 } 2036 } 2037 2038 public void mouseDragged(MouseEvent e) { 2039 JTextComponent c = (JTextComponent)e.getSource(); 2040 if (c.getDragEnabled()) { 2041 if (dragStarted || DragRecognitionSupport.mouseDragged(e, this)) { 2042 e.consume(); 2043 } 2044 } 2045 } 2046 2047 2054 protected boolean isDragPossible(MouseEvent e) { 2055 JTextComponent c = (JTextComponent)e.getSource(); 2056 if (c.isEnabled()) { 2057 Caret caret = c.getCaret(); 2058 int dot = caret.getDot(); 2059 int mark = caret.getMark(); 2060 if (dot != mark) { 2061 Point p = new Point(e.getX(), e.getY()); 2062 int pos = c.viewToModel(p); 2063 2064 int p0 = Math.min(dot, mark); 2065 int p1 = Math.max(dot, mark); 2066 if ((pos >= p0) && (pos < p1)) { 2067 return true; 2068 } 2069 } 2070 } 2071 return false; 2072 } 2073 } 2074 2075 2079 static class TextDropTargetListener extends BasicDropTargetListener { 2080 2081 2085 protected void saveComponentState(JComponent comp) { 2086 JTextComponent c = (JTextComponent) comp; 2087 Caret caret = c.getCaret(); 2088 dot = caret.getDot(); 2089 mark = caret.getMark(); 2090 visible = caret instanceof DefaultCaret ? 2091 ((DefaultCaret)caret).isActive() : 2092 caret.isVisible(); 2093 caret.setVisible(true); 2094 } 2095 2096 2100 protected void restoreComponentState(JComponent comp) { 2101 JTextComponent c = (JTextComponent) comp; 2102 Caret caret = c.getCaret(); 2103 caret.setDot(mark); 2104 caret.moveDot(dot); 2105 caret.setVisible(visible); 2106 } 2107 2108 2112 protected void restoreComponentStateForDrop(JComponent comp) { 2113 JTextComponent c = (JTextComponent) comp; 2114 Caret caret = c.getCaret(); 2115 caret.setVisible(visible); 2116 } 2117 2118 2122 protected void updateInsertionLocation(JComponent comp, Point p) { 2123 JTextComponent c = (JTextComponent) comp; 2124 c.setCaretPosition(c.viewToModel(p)); 2125 } 2126 2127 int dot; 2128 int mark; 2129 boolean visible; 2130 } 2131 2132 static class TextTransferHandler extends TransferHandler implements UIResource { 2133 2134 private JTextComponent exportComp; 2135 private boolean shouldRemove; 2136 private int p0; 2137 private int p1; 2138 2139 2151 protected DataFlavor getImportFlavor(DataFlavor[] flavors, JTextComponent c) { 2152 DataFlavor plainFlavor = null; 2153 DataFlavor refFlavor = null; 2154 DataFlavor stringFlavor = null; 2155 2156 if (c instanceof JEditorPane) { 2157 for (int i = 0; i < flavors.length; i++) { 2158 String mime = flavors[i].getMimeType(); 2159 if (mime.startsWith(((JEditorPane)c).getEditorKit().getContentType())) { 2160 return flavors[i]; 2161 } else if (plainFlavor == null && mime.startsWith("text/plain")) { 2162 plainFlavor = flavors[i]; 2163 } else if (refFlavor == null && mime.startsWith("application/x-java-jvm-local-objectref") 2164 && flavors[i].getRepresentationClass() == java.lang.String .class) { 2165 refFlavor = flavors[i]; 2166 } else if (stringFlavor == null && flavors[i].equals(DataFlavor.stringFlavor)) { 2167 stringFlavor = flavors[i]; 2168 } 2169 } 2170 if (plainFlavor != null) { 2171 return plainFlavor; 2172 } else if (refFlavor != null) { 2173 return refFlavor; 2174 } else if (stringFlavor != null) { 2175 return stringFlavor; 2176 } 2177 return null; 2178 } 2179 2180 2181 for (int i = 0; i < flavors.length; i++) { 2182 String mime = flavors[i].getMimeType(); 2183 if (mime.startsWith("text/plain")) { 2184 return flavors[i]; 2185 } else if (refFlavor == null && mime.startsWith("application/x-java-jvm-local-objectref") 2186 && flavors[i].getRepresentationClass() == java.lang.String .class) { 2187 refFlavor = flavors[i]; 2188 } else if (stringFlavor == null && flavors[i].equals(DataFlavor.stringFlavor)) { 2189 stringFlavor = flavors[i]; 2190 } 2191 } 2192 if (refFlavor != null) { 2193 return refFlavor; 2194 } else if (stringFlavor != null) { 2195 return stringFlavor; 2196 } 2197 return null; 2198 } 2199 2200 2203 protected void handleReaderImport(Reader in, JTextComponent c, boolean useRead) 2204 throws BadLocationException, IOException { 2205 if (useRead) { 2206 int startPosition = c.getSelectionStart(); 2207 int endPosition = c.getSelectionEnd(); 2208 int length = endPosition - startPosition; 2209 EditorKit kit = c.getUI().getEditorKit(c); 2210 Document doc = c.getDocument(); 2211 if (length > 0) { 2212 doc.remove(startPosition, length); 2213 } 2214 kit.read(in, doc, startPosition); 2215 } else { 2216 char[] buff = new char[1024]; 2217 int nch; 2218 boolean lastWasCR = false; 2219 int last; 2220 StringBuffer sbuff = null; 2221 2222 while ((nch = in.read(buff, 0, buff.length)) != -1) { 2225 if (sbuff == null) { 2226 sbuff = new StringBuffer (nch); 2227 } 2228 last = 0; 2229 for(int counter = 0; counter < nch; counter++) { 2230 switch(buff[counter]) { 2231 case '\r': 2232 if (lastWasCR) { 2233 if (counter == 0) { 2234 sbuff.append('\n'); 2235 } else { 2236 buff[counter - 1] = '\n'; 2237 } 2238 } else { 2239 lastWasCR = true; 2240 } 2241 break; 2242 case '\n': 2243 if (lastWasCR) { 2244 if (counter > (last + 1)) { 2245 sbuff.append(buff, last, counter - last - 1); 2246 } 2247 lastWasCR = false; 2250 last = counter; 2251 } 2252 break; 2253 default: 2254 if (lastWasCR) { 2255 if (counter == 0) { 2256 sbuff.append('\n'); 2257 } else { 2258 buff[counter - 1] = '\n'; 2259 } 2260 lastWasCR = false; 2261 } 2262 break; 2263 } 2264 } 2265 if (last < nch) { 2266 if (lastWasCR) { 2267 if (last < (nch - 1)) { 2268 sbuff.append(buff, last, nch - last - 1); 2269 } 2270 } else { 2271 sbuff.append(buff, last, nch - last); 2272 } 2273 } 2274 } 2275 if (lastWasCR) { 2276 sbuff.append('\n'); 2277 } 2278 c.replaceSelection(sbuff != null ? sbuff.toString() : ""); 2279 } 2280 } 2281 2282 2284 2296 public int getSourceActions(JComponent c) { 2297 if (c instanceof JPasswordField && 2298 c.getClientProperty("JPasswordField.cutCopyAllowed") != 2299 Boolean.TRUE) { 2300 return NONE; 2301 } 2302 2303 return ((JTextComponent)c).isEditable() ? COPY_OR_MOVE : COPY; 2304 } 2305 2306 2315 protected Transferable createTransferable(JComponent comp) { 2316 exportComp = (JTextComponent)comp; 2317 shouldRemove = true; 2318 p0 = exportComp.getSelectionStart(); 2319 p1 = exportComp.getSelectionEnd(); 2320 return (p0 != p1) ? (new TextTransferable(exportComp, p0, p1)) : null; 2321 } 2322 2323 2332 protected void exportDone(JComponent source, Transferable data, int action) { 2333 if (shouldRemove && action == MOVE) { 2336 TextTransferable t = (TextTransferable)data; 2337 t.removeText(); 2338 } 2339 2340 exportComp = null; 2341 } 2342 2343 2354 public boolean importData(JComponent comp, Transferable t) { 2355 JTextComponent c = (JTextComponent)comp; 2356 2357 if (c == exportComp && c.getCaretPosition() >= p0 && c.getCaretPosition() <= p1) { 2362 shouldRemove = false; 2363 return true; 2364 } 2365 2366 boolean imported = false; 2367 DataFlavor importFlavor = getImportFlavor(t.getTransferDataFlavors(), c); 2368 if (importFlavor != null) { 2369 try { 2370 boolean useRead = false; 2371 if (comp instanceof JEditorPane) { 2372 JEditorPane ep = (JEditorPane)comp; 2373 if (!ep.getContentType().startsWith("text/plain") && 2374 importFlavor.getMimeType().startsWith(ep.getContentType())) { 2375 useRead = true; 2376 } 2377 } 2378 InputContext ic = c.getInputContext(); 2379 if (ic != null) { 2380 ic.endComposition(); 2381 } 2382 Reader r = importFlavor.getReaderForText(t); 2383 handleReaderImport(r, c, useRead); 2384 imported = true; 2385 } catch (UnsupportedFlavorException ufe) { 2386 } catch (BadLocationException ble) { 2387 } catch (IOException ioe) { 2388 } 2389 } 2390 return imported; 2391 } 2392 2393 2403 public boolean canImport(JComponent comp, DataFlavor[] flavors) { 2404 JTextComponent c = (JTextComponent)comp; 2405 if (!(c.isEditable() && c.isEnabled())) { 2406 return false; 2407 } 2408 return (getImportFlavor(flavors, c) != null); 2409 } 2410 2411 2420 static class TextTransferable extends BasicTransferable { 2421 2422 TextTransferable(JTextComponent c, int start, int end) { 2423 super(null, null); 2424 2425 this.c = c; 2426 2427 Document doc = c.getDocument(); 2428 2429 try { 2430 p0 = doc.createPosition(start); 2431 p1 = doc.createPosition(end); 2432 2433 plainData = c.getSelectedText(); 2434 2435 if (c instanceof JEditorPane) { 2436 JEditorPane ep = (JEditorPane)c; 2437 2438 mimeType = ep.getContentType(); 2439 2440 if (mimeType.startsWith("text/plain")) { 2441 return; 2442 } 2443 2444 StringWriter sw = new StringWriter(p1.getOffset() - p0.getOffset()); 2445 ep.getEditorKit().write(sw, doc, p0.getOffset(), p1.getOffset() - p0.getOffset()); 2446 2447 if (mimeType.startsWith("text/html")) { 2448 htmlData = sw.toString(); 2449 } else { 2450 richText = sw.toString(); 2451 } 2452 } 2453 } catch (BadLocationException ble) { 2454 } catch (IOException ioe) { 2455 } 2456 } 2457 2458 void removeText() { 2459 if ((p0 != null) && (p1 != null) && (p0.getOffset() != p1.getOffset())) { 2460 try { 2461 Document doc = c.getDocument(); 2462 doc.remove(p0.getOffset(), p1.getOffset() - p0.getOffset()); 2463 } catch (BadLocationException e) { 2464 } 2465 } 2466 } 2467 2468 2470 2474 protected DataFlavor[] getRicherFlavors() { 2475 if (richText == null) { 2476 return null; 2477 } 2478 2479 try { 2480 DataFlavor[] flavors = new DataFlavor[3]; 2481 flavors[0] = new DataFlavor(mimeType + ";class=java.lang.String"); 2482 flavors[1] = new DataFlavor(mimeType + ";class=java.io.Reader"); 2483 flavors[2] = new DataFlavor(mimeType + ";class=java.io.InputStream;charset=unicode"); 2484 return flavors; 2485 } catch (ClassNotFoundException cle) { 2486 } 2488 2489 return null; 2490 } 2491 2492 2495 protected Object getRicherData(DataFlavor flavor) throws UnsupportedFlavorException { 2496 if (richText == null) { 2497 return null; 2498 } 2499 2500 if (String .class.equals(flavor.getRepresentationClass())) { 2501 return richText; 2502 } else if (Reader.class.equals(flavor.getRepresentationClass())) { 2503 return new StringReader(richText); 2504 } else if (InputStream.class.equals(flavor.getRepresentationClass())) { 2505 return new StringBufferInputStream(richText); 2506 } 2507 throw new UnsupportedFlavorException(flavor); 2508 } 2509 2510 Position p0; 2511 Position p1; 2512 String mimeType; 2513 String richText; 2514 JTextComponent c; 2515 } 2516 2517 } 2518 2519} 2520 2521 | Popular Tags |