1802N/A/*
3579N/A * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
1802N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1802N/A *
1802N/A * This code is free software; you can redistribute it and/or modify it
1802N/A * under the terms of the GNU General Public License version 2 only, as
1802N/A * published by the Free Software Foundation. Oracle designates this
1802N/A * particular file as subject to the "Classpath" exception as provided
1802N/A * by Oracle in the LICENSE file that accompanied this code.
1802N/A *
1802N/A * This code is distributed in the hope that it will be useful, but WITHOUT
1802N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1802N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
1802N/A * version 2 for more details (a copy is included in the LICENSE file that
1802N/A * accompanied this code).
1802N/A *
1802N/A * You should have received a copy of the GNU General Public License version
1802N/A * 2 along with this work; if not, write to the Free Software Foundation,
2362N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
2362N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
1802N/A * or visit www.oracle.com if you need additional information or have any
1802N/A * questions.
1802N/A */
1802N/A
1802N/Apackage com.apple.laf;
2035N/A
3579N/Aimport java.awt.*;
1802N/Aimport java.awt.event.FocusListener;
1802N/A
1802N/Aimport javax.swing.*;
2035N/Aimport javax.swing.plaf.ComponentUI;
1802N/Aimport javax.swing.plaf.basic.BasicEditorPaneUI;
2035N/Aimport javax.swing.text.*;
1802N/A
1802N/Apublic class AquaEditorPaneUI extends BasicEditorPaneUI {
2035N/A public static ComponentUI createUI(final JComponent c){
1802N/A return new AquaEditorPaneUI();
1802N/A }
1802N/A
2035N/A boolean oldDragState = false;
1802N/A protected void installDefaults(){
1802N/A super.installDefaults();
1802N/A if(!GraphicsEnvironment.isHeadless()){
1802N/A oldDragState = getComponent().getDragEnabled();
1802N/A getComponent().setDragEnabled(true);
1802N/A }
1802N/A }
1802N/A
2035N/A protected void uninstallDefaults(){
2035N/A if(!GraphicsEnvironment.isHeadless()){
3043N/A getComponent().setDragEnabled(oldDragState);
3043N/A }
3043N/A super.uninstallDefaults();
1802N/A }
1802N/A
2035N/A FocusListener focusListener;
2035N/A protected void installListeners(){
2035N/A super.installListeners();
2035N/A focusListener = createFocusListener();
2035N/A getComponent().addFocusListener(focusListener);
2035N/A }
1802N/A
2035N/A protected void installKeyboardActions() {
2035N/A super.installKeyboardActions();
2035N/A AquaKeyBindings bindings = AquaKeyBindings.instance();
2035N/A bindings.setDefaultAction(getKeymapName());
2035N/A final JTextComponent c = getComponent();
2035N/A bindings.installAquaUpDownActions(c);
2035N/A }
2035N/A
2035N/A protected void uninstallListeners(){
2035N/A getComponent().removeFocusListener(focusListener);
2035N/A super.uninstallListeners();
2035N/A }
2035N/A
2035N/A protected FocusListener createFocusListener(){
1802N/A return new AquaFocusHandler();
1802N/A }
2035N/A
1802N/A protected Caret createCaret(){
2035N/A final Window owningWindow = SwingUtilities.getWindowAncestor(getComponent());
2035N/A final AquaCaret returnValue = new AquaCaret(owningWindow, getComponent());
1802N/A return returnValue;
1802N/A }
1802N/A
1802N/A protected Highlighter createHighlighter(){
1802N/A return new AquaHighlighter();
1802N/A }
1802N/A}
1802N/A