src/solaris/classes/sun/awt/X11/XTextAreaPeer.java

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this --- 1,7 ---- /* ! * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this
*** 62,81 **** import sun.awt.CausedFocusEvent; import sun.awt.AWTAccessor; import sun.awt.SunToolkit; ! class XTextAreaPeer extends XComponentPeer implements TextAreaPeer { ! boolean editable; ! AWTTextPane textPane; ! AWTTextArea jtext; ! boolean firstChangeSkipped; ! ! private final JavaMouseEventHandler javaMouseEventHandler ! = new JavaMouseEventHandler( this ); /* FIXME */ public long filterEvents(long mask) { Thread.dumpStack(); --- 62,79 ---- import sun.awt.CausedFocusEvent; import sun.awt.AWTAccessor; import sun.awt.SunToolkit; ! final class XTextAreaPeer extends XComponentPeer implements TextAreaPeer { ! private final AWTTextPane textPane; ! private final AWTTextArea jtext; ! private final boolean firstChangeSkipped; ! private final JavaMouseEventHandler javaMouseEventHandler = ! new JavaMouseEventHandler(this); /* FIXME */ public long filterEvents(long mask) { Thread.dumpStack();
*** 96,115 **** /** * Create a Text area. */ XTextAreaPeer(TextArea target) { ! super( target ); // some initializations require that target be set even // though init(target) has not been called this.target = target; //ComponentAccessor.enableEvents(target,AWTEvent.MOUSE_WHEEL_EVENT_MASK); ! firstChangeSkipped = false; ! String text = ((TextArea)target).getText(); jtext = new AWTTextArea(text, this); jtext.setWrapStyleWord(true); jtext.getDocument().addDocumentListener(jtext); XToolkit.specialPeerMap.put(jtext,this); textPane = new AWTTextPane(jtext,this, target.getParent()); --- 94,112 ---- /** * Create a Text area. */ XTextAreaPeer(TextArea target) { ! super(target); // some initializations require that target be set even // though init(target) has not been called this.target = target; //ComponentAccessor.enableEvents(target,AWTEvent.MOUSE_WHEEL_EVENT_MASK); ! String text = target.getText(); jtext = new AWTTextArea(text, this); jtext.setWrapStyleWord(true); jtext.getDocument().addDocumentListener(jtext); XToolkit.specialPeerMap.put(jtext,this); textPane = new AWTTextPane(jtext,this, target.getParent());
*** 141,169 **** target.setForeground(SystemColor.textText); } setFont(font); int start = target.getSelectionStart(); int end = target.getSelectionEnd(); - - if (end > start) { - select(start, end); - } // Fix for 5100200 // Restoring Motif behaviour // Since the end position of the selected text can be greater then the length of the text, // so we should set caret to max position of the text ! int caretPosition = Math.min(end, text.length()); ! setCaretPosition(caretPosition); ! setEditable(target.isEditable()); - setScrollBarVisibility(); - // set the text of this object to the text of its target - setTextImpl(target.getText()); //?? should this be setText - // After this line we should not change the component's text firstChangeSkipped = true; } public void dispose() { --- 138,162 ---- target.setForeground(SystemColor.textText); } setFont(font); + // set the text of this object to the text of its target + setTextImpl(target.getText()); //?? should this be setText + int start = target.getSelectionStart(); int end = target.getSelectionEnd(); // Fix for 5100200 // Restoring Motif behaviour // Since the end position of the selected text can be greater then the length of the text, // so we should set caret to max position of the text ! setCaretPosition(Math.min(end, text.length())); ! if (end > start) { ! select(start, end); ! } setEditable(target.isEditable()); setScrollBarVisibility(); // After this line we should not change the component's text firstChangeSkipped = true; } public void dispose() {
*** 406,416 **** /** * @see java.awt.peer.TextComponentPeer */ public void setEditable(boolean editable) { - this.editable = editable; if (jtext != null) jtext.setEditable(editable); repaintText(); } /** --- 399,408 ----
*** 459,469 **** public void setText(String txt) { setTextImpl(txt); repaintText(); } ! protected boolean setTextImpl(String txt) { if (jtext != null) { // JTextArea.setText() posts two different events (remove & insert). // Since we make no differences between text events, // the document listener has to be disabled while // JTextArea.setText() is called. --- 451,461 ---- public void setText(String txt) { setTextImpl(txt); repaintText(); } ! private void setTextImpl(String txt) { if (jtext != null) { // JTextArea.setText() posts two different events (remove & insert). // Since we make no differences between text events, // the document listener has to be disabled while // JTextArea.setText() is called.
*** 472,482 **** if (firstChangeSkipped) { postEvent(new TextEvent(target, TextEvent.TEXT_VALUE_CHANGED)); } jtext.getDocument().addDocumentListener(jtext); } - return true; } /** * insert the text "txt on position "pos" in the array lines * @see java.awt.peer.TextAreaPeer --- 464,473 ----