Source for javax.swing.text.IconView

   1: /* IconView.java -- A view to render icons
   2:    Copyright (C) 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: 
  39: package javax.swing.text;
  40: 
  41: import java.awt.Graphics;
  42: import java.awt.Shape;
  43: 
  44: // TODO: Implement this class.
  45: public class IconView
  46:   extends View
  47: {
  48: 
  49:   /**
  50:    * Creates a new <code>IconView</code> for the given <code>Element</code>.
  51:    *
  52:    * @param element the element that is rendered by this IconView
  53:    */
  54:   public IconView(Element element)
  55:   {
  56:     super(element);
  57:   }
  58: 
  59:   /**
  60:    * Renders the <code>Element</code> that is associated with this
  61:    * <code>View</code>.
  62:    *
  63:    * @param g the <code>Graphics</code> context to render to
  64:    * @param a the allocated region for the <code>Element</code>
  65:    */
  66:   public void paint(Graphics g, Shape a)
  67:   {
  68:     // TODO: Implement me.
  69:   }
  70: 
  71:   /**
  72:    * Returns the preferred span of the content managed by this
  73:    * <code>View</code> along the specified <code>axis</code>.
  74:    *
  75:    * @param axis the axis
  76:    *
  77:    * @return the preferred span of this <code>View</code>.
  78:    */
  79:   public float getPreferredSpan(int axis)
  80:   {
  81:     // TODO: Implement me.
  82:     return 0F;
  83:   }
  84: 
  85:   /**
  86:    * Maps a position in the document into the coordinate space of the View.
  87:    * The output rectangle usually reflects the font height but has a width
  88:    * of zero.
  89:    *
  90:    * @param pos the position of the character in the model
  91:    * @param a the area that is occupied by the view
  92:    * @param b either {@link Position.Bias#Forward} or
  93:    *        {@link Position.Bias#Backward} depending on the preferred
  94:    *        direction bias. If <code>null</code> this defaults to
  95:    *        <code>Position.Bias.Forward</code>
  96:    *
  97:    * @return a rectangle that gives the location of the document position
  98:    *         inside the view coordinate space
  99:    *
 100:    * @throws BadLocationException if <code>pos</code> is invalid
 101:    * @throws IllegalArgumentException if b is not one of the above listed
 102:    *         valid values
 103:    */
 104:   public Shape modelToView(int pos, Shape a, Position.Bias b)
 105:     throws BadLocationException
 106:   {
 107:     // Implement me.
 108:     return null;
 109:   }
 110: 
 111:   /**
 112:    * Maps coordinates from the <code>View</code>'s space into a position
 113:    * in the document model.
 114:    *
 115:    * @param x the x coordinate in the view space
 116:    * @param y the y coordinate in the view space
 117:    * @param a the allocation of this <code>View</code>
 118:    * @param b the bias to use
 119:    *
 120:    * @return the position in the document that corresponds to the screen
 121:    *         coordinates <code>x, y</code>
 122:    */
 123:   public int viewToModel(float x, float y, Shape a, Position.Bias[] b)
 124:   {
 125:     // FIXME: not implemented
 126:     return 0;
 127:   }
 128: }