src/share/classes/javax/swing/text/html/FrameView.java

Print this page


   1 /*
   2  * Copyright (c) 1998, 2006, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   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
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


 441     }
 442 
 443     /**
 444      * Determines the maximum span for this view along an
 445      * axis.
 446      *
 447      * @param axis may be either <code>View.X_AXIS</code> or
 448      *  <code>View.Y_AXIS</code>
 449      * @return the preferred span; given that we do not
 450      * support resizing of frames, the maximum span returned
 451      * is the same as the preferred span
 452      *
 453      */
 454     public float getMaximumSpan(int axis) {
 455         return Integer.MAX_VALUE;
 456     }
 457 
 458     /** Editor pane rendering frame of HTML document
 459      *  It uses the same editor kits classes as outermost JEditorPane
 460      */

 461     class FrameEditorPane extends JEditorPane implements FrameEditorPaneTag {
 462         public EditorKit getEditorKitForContentType(String type) {
 463             EditorKit editorKit = super.getEditorKitForContentType(type);
 464             JEditorPane outerMostJEditorPane = null;
 465             if ((outerMostJEditorPane = getOutermostJEditorPane()) != null) {
 466                 EditorKit inheritedEditorKit = outerMostJEditorPane.getEditorKitForContentType(type);
 467                 if (! editorKit.getClass().equals(inheritedEditorKit.getClass())) {
 468                     editorKit = (EditorKit) inheritedEditorKit.clone();
 469                     setEditorKitForContentType(type, editorKit);
 470                 }
 471             }
 472             return editorKit;
 473         }
 474 
 475         FrameView getFrameView() {
 476             return FrameView.this;
 477         }
 478     }
 479 }
   1 /*
   2  * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   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
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


 441     }
 442 
 443     /**
 444      * Determines the maximum span for this view along an
 445      * axis.
 446      *
 447      * @param axis may be either <code>View.X_AXIS</code> or
 448      *  <code>View.Y_AXIS</code>
 449      * @return the preferred span; given that we do not
 450      * support resizing of frames, the maximum span returned
 451      * is the same as the preferred span
 452      *
 453      */
 454     public float getMaximumSpan(int axis) {
 455         return Integer.MAX_VALUE;
 456     }
 457 
 458     /** Editor pane rendering frame of HTML document
 459      *  It uses the same editor kits classes as outermost JEditorPane
 460      */
 461     @SuppressWarnings("serial") // Superclass is not serializable across versions
 462     class FrameEditorPane extends JEditorPane implements FrameEditorPaneTag {
 463         public EditorKit getEditorKitForContentType(String type) {
 464             EditorKit editorKit = super.getEditorKitForContentType(type);
 465             JEditorPane outerMostJEditorPane = null;
 466             if ((outerMostJEditorPane = getOutermostJEditorPane()) != null) {
 467                 EditorKit inheritedEditorKit = outerMostJEditorPane.getEditorKitForContentType(type);
 468                 if (! editorKit.getClass().equals(inheritedEditorKit.getClass())) {
 469                     editorKit = (EditorKit) inheritedEditorKit.clone();
 470                     setEditorKitForContentType(type, editorKit);
 471                 }
 472             }
 473             return editorKit;
 474         }
 475 
 476         FrameView getFrameView() {
 477             return FrameView.this;
 478         }
 479     }
 480 }