jdk/src/macosx/classes/sun/lwawt/LWTextComponentPeer.java
changeset 20153 d5bf90bfcb6d
parent 13993 8b3fe3d8badb
child 20435 543c1c7dd21a
equal deleted inserted replaced
20152:3ef8620dce9b 20153:d5bf90bfcb6d
     1 /*
     1 /*
     2  * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
    42 import javax.swing.event.DocumentEvent;
    42 import javax.swing.event.DocumentEvent;
    43 import javax.swing.event.DocumentListener;
    43 import javax.swing.event.DocumentListener;
    44 import javax.swing.text.Document;
    44 import javax.swing.text.Document;
    45 import javax.swing.text.JTextComponent;
    45 import javax.swing.text.JTextComponent;
    46 
    46 
       
    47 /**
       
    48  * Lightweight implementation of {@link TextComponentPeer}. Provides useful
       
    49  * methods for {@link LWTextAreaPeer} and {@link LWTextFieldPeer}
       
    50  */
    47 abstract class LWTextComponentPeer<T extends TextComponent, D extends JComponent>
    51 abstract class LWTextComponentPeer<T extends TextComponent, D extends JComponent>
    48         extends LWComponentPeer<T, D>
    52         extends LWComponentPeer<T, D>
    49         implements DocumentListener, TextComponentPeer, InputMethodListener {
    53         implements DocumentListener, TextComponentPeer, InputMethodListener {
    50 
       
    51 
    54 
    52     private volatile boolean firstChangeSkipped;
    55     private volatile boolean firstChangeSkipped;
    53 
    56 
    54     LWTextComponentPeer(final T target,
    57     LWTextComponentPeer(final T target,
    55                         final PlatformComponent platformComponent) {
    58                         final PlatformComponent platformComponent) {
   216     public final void removeUpdate(final DocumentEvent e) {
   219     public final void removeUpdate(final DocumentEvent e) {
   217         postTextEvent();
   220         postTextEvent();
   218     }
   221     }
   219 
   222 
   220     @Override
   223     @Override
   221     public void inputMethodTextChanged(InputMethodEvent event) {
   224     public void inputMethodTextChanged(final InputMethodEvent event) {
   222         synchronized (getDelegateLock()) {
   225         synchronized (getDelegateLock()) {
   223             AWTAccessor.getComponentAccessor().processEvent(getTextComponent(), event);
   226             AWTAccessor.getComponentAccessor().processEvent(getTextComponent(), event);
   224         }
   227         }
   225     }
   228     }
   226 
   229 
   227     @Override
   230     @Override
   228     public void caretPositionChanged(InputMethodEvent event) {
   231     public void caretPositionChanged(final InputMethodEvent event) {
   229         synchronized (getDelegateLock()) {
   232         synchronized (getDelegateLock()) {
   230             AWTAccessor.getComponentAccessor().processEvent(getTextComponent(), event);
   233             AWTAccessor.getComponentAccessor().processEvent(getTextComponent(), event);
   231         }
   234         }
   232     }
   235     }
   233 }
   236 }