GNU Classpath (0.19) | ||
Frames | No Frames |
1: /* ComponentView.java -- 2: Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc. 3: 4: This file is part of GNU Classpath. 5: 6: GNU Classpath is free software; you can redistribute it and/or modify 7: it under the terms of the GNU General Public License as published by 8: the Free Software Foundation; either version 2, or (at your option) 9: any later version. 10: 11: GNU Classpath is distributed in the hope that it will be useful, but 12: WITHOUT ANY WARRANTY; without even the implied warranty of 13: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14: General Public License for more details. 15: 16: You should have received a copy of the GNU General Public License 17: along with GNU Classpath; see the file COPYING. If not, write to the 18: Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 19: 02110-1301 USA. 20: 21: Linking this library statically or dynamically with other modules is 22: making a combined work based on this library. Thus, the terms and 23: conditions of the GNU General Public License cover the whole 24: combination. 25: 26: As a special exception, the copyright holders of this library give you 27: permission to link this library with independent modules to produce an 28: executable, regardless of the license terms of these independent 29: modules, and to copy and distribute the resulting executable under 30: terms of your choice, provided that you also meet, for each linked 31: independent module, the terms and conditions of the license of that 32: module. An independent module is a module which is not derived from 33: or based on this library. If you modify this library, you may extend 34: this exception to your version of the library, but you are not 35: obligated to do so. If you do not wish to do so, delete this 36: exception statement from your version. */ 37: 38: package javax.swing.text; 39: 40: import java.awt.Component; 41: import java.awt.Graphics; 42: import java.awt.Shape; 43: 44: /** 45: * A {@link View} implementation that is able to render arbitrary 46: * {@link Component}s. This uses the attribute 47: * {@link StyleConstants#ComponentAttribute} to determine the 48: * <code>Component</code> that should be rendered. This <code>Component</code> 49: * becomes a direct child of the <code>JTextComponent</code> that contains 50: * this <code>ComponentView</code>, so this view must not be shared between 51: * multiple <code>JTextComponent</code>s. 52: * 53: * @author original author unknown 54: * @author Roman Kennke (roman@kennke.org) 55: */ 56: // FIXME: This class is a complete stub and needs to be implemented properly. 57: public class ComponentView extends View 58: { 59: /** 60: * Creates a new instance of <code>ComponentView</code> for the specified 61: * <code>Element</code>. 62: * 63: * @param elem the element that this <code>View</code> is rendering 64: */ 65: public ComponentView(Element elem) 66: { 67: super(elem); 68: } 69: 70: /** 71: * Creates the <code>Component</code> that this <code>View</code> is 72: * rendering. The <code>Component</code> is determined using 73: * the {@link StyleConstants#ComponentAttribute} of the associated 74: * <code>Element</code>. 75: * 76: * @return the component that is rendered 77: */ 78: protected Component createComponent() 79: { 80: return StyleConstants.getComponent(getElement().getAttributes()); 81: } 82: 83: /** 84: * Returns the alignment of this <code>View</code> along the specified axis. 85: * 86: * @param axis either {@link View#X_AXIS} or {@link View#Y_AXIS} 87: * 88: * @return the alignment of this <code>View</code> along the specified axis 89: */ 90: public float getAlignment(int axis) 91: { 92: return 0; 93: } 94: 95: /** 96: * Returns the <code>Component</code> that is rendered by this 97: * <code>ComponentView</code>. 98: * 99: * @return the <code>Component</code> that is rendered by this 100: * <code>ComponentView</code> 101: */ 102: public final Component getComponent() 103: { 104: return null; 105: } 106: 107: /** 108: * Returns the maximum span of this <code>View</code> along the specified 109: * axis. 110: * 111: * This will return {@link Component#getMaximumSize()} for the specified 112: * axis. 113: * 114: * @return the maximum span of this <code>View</code> along the specified 115: * axis 116: */ 117: public float getMaximumSpan(int axis) 118: { 119: return 0; 120: } 121: 122: public float getMinimumSpan(int axis) 123: { 124: // TODO: Implement this properly. 125: return 0; 126: } 127: 128: public float getPreferredSpan(int axis) 129: { 130: // TODO: Implement this properly. 131: return 0; 132: } 133: 134: public Shape modelToView(int pos, Shape a, Position.Bias b) 135: throws BadLocationException 136: { 137: // TODO: Implement this properly. 138: return null; 139: } 140: 141: public void paint(Graphics g, Shape a) 142: { 143: // TODO: Implement this properly. 144: } 145: 146: public void setParent(View p) 147: { 148: // TODO: Implement this properly. 149: } 150: 151: public void setSize(float width, float height) 152: { 153: // TODO: Implement this properly. 154: } 155: 156: public int viewToModel(float x, float y, Shape a, Position.Bias[] bias) 157: { 158: // TODO: Implement this properly. 159: return 0; 160: } 161: 162: /** 163: * Maps coordinates from the <code>View</code>'s space into a position 164: * in the document model. 165: * 166: * @param x the x coordinate in the view space 167: * @param y the y coordinate in the view space 168: * @param a the allocation of this <code>View</code> 169: * @param b the bias to use 170: * 171: * @return the position in the document that corresponds to the screen 172: * coordinates <code>x, y</code> 173: */ 174: public int viewToModel(float x, float y, Shape a, Position.Bias b) 175: { 176: // FIXME: Implement this properly. 177: return 0; 178: } 179: }
GNU Classpath (0.19) |