OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [tags/] [gnu-dev/] [fsf-gcc-snapshot-1-mar-12/] [or1k-gcc/] [libjava/] [classpath/] [java/] [awt/] [ScrollPaneAdjustable.java] - Diff between revs 771 and 783

Only display areas with differences | Details | Blame | View Log

Rev 771 Rev 783
/* ScrollPaneAdjustable.java -- Scrollbars for a ScrollPane
/* ScrollPaneAdjustable.java -- Scrollbars for a ScrollPane
   Copyright (C) 1999 Free Software Foundation, Inc.
   Copyright (C) 1999 Free Software Foundation, Inc.
 
 
This file is part of GNU Classpath.
This file is part of GNU Classpath.
 
 
GNU Classpath is free software; you can redistribute it and/or modify
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
the Free Software Foundation; either version 2, or (at your option)
any later version.
any later version.
 
 
GNU Classpath is distributed in the hope that it will be useful, but
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
General Public License for more details.
General Public License for more details.
 
 
You should have received a copy of the GNU General Public License
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING.  If not, write to the
along with GNU Classpath; see the file COPYING.  If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
02110-1301 USA.
 
 
Linking this library statically or dynamically with other modules is
Linking this library statically or dynamically with other modules is
making a combined work based on this library.  Thus, the terms and
making a combined work based on this library.  Thus, the terms and
conditions of the GNU General Public License cover the whole
conditions of the GNU General Public License cover the whole
combination.
combination.
 
 
As a special exception, the copyright holders of this library give you
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
independent module, the terms and conditions of the license of that
module.  An independent module is a module which is not derived from
module.  An independent module is a module which is not derived from
or based on this library.  If you modify this library, you may extend
or based on this library.  If you modify this library, you may extend
this exception to your version of the library, but you are not
this exception to your version of the library, but you are not
obligated to do so.  If you do not wish to do so, delete this
obligated to do so.  If you do not wish to do so, delete this
exception statement from your version. */
exception statement from your version. */
 
 
 
 
package java.awt;
package java.awt;
 
 
import java.awt.event.AdjustmentListener;
import java.awt.event.AdjustmentListener;
import java.io.Serializable;
import java.io.Serializable;
 
 
/**
/**
 * Need this class since the serialization spec for ScrollPane
 * Need this class since the serialization spec for ScrollPane
 * uses it.
 * uses it.
 *
 *
 * @author Aaron M. Renn (arenn@urbanophile.com)
 * @author Aaron M. Renn (arenn@urbanophile.com)
 * @since 1.4
 * @since 1.4
 */
 */
public class ScrollPaneAdjustable
public class ScrollPaneAdjustable
  implements Adjustable, Serializable
  implements Adjustable, Serializable
{
{
  private static final long serialVersionUID = -3359745691033257079L;
  private static final long serialVersionUID = -3359745691033257079L;
 
 
  ScrollPane sp;
  ScrollPane sp;
  int orientation;
  int orientation;
  int value;
  int value;
  int minimum;
  int minimum;
  int maximum;
  int maximum;
  int visibleAmount;
  int visibleAmount;
  int unitIncrement = 1;
  int unitIncrement = 1;
  int blockIncrement = 1;
  int blockIncrement = 1;
  AdjustmentListener adjustmentListener;
  AdjustmentListener adjustmentListener;
 
 
  private transient boolean valueIsAdjusting = false;
  private transient boolean valueIsAdjusting = false;
 
 
  ScrollPaneAdjustable (ScrollPane sp, int orientation)
  ScrollPaneAdjustable (ScrollPane sp, int orientation)
  {
  {
    this.sp = sp;
    this.sp = sp;
    this.orientation = orientation;
    this.orientation = orientation;
  }
  }
 
 
  ScrollPaneAdjustable (ScrollPane sp, int orientation, int value, int minimum,
  ScrollPaneAdjustable (ScrollPane sp, int orientation, int value, int minimum,
                        int maximum, int visibleAmount, int unitIncrement,
                        int maximum, int visibleAmount, int unitIncrement,
                        int blockIncrement)
                        int blockIncrement)
  {
  {
    this.sp = sp;
    this.sp = sp;
    this.orientation = orientation;
    this.orientation = orientation;
    this.value = value;
    this.value = value;
    this.minimum = minimum;
    this.minimum = minimum;
    this.maximum = maximum;
    this.maximum = maximum;
    this.visibleAmount = visibleAmount;
    this.visibleAmount = visibleAmount;
    this.unitIncrement = unitIncrement;
    this.unitIncrement = unitIncrement;
    this.blockIncrement = blockIncrement;
    this.blockIncrement = blockIncrement;
  }
  }
 
 
  public void addAdjustmentListener (AdjustmentListener listener)
  public void addAdjustmentListener (AdjustmentListener listener)
  {
  {
    if (listener == null)
    if (listener == null)
      return;
      return;
    adjustmentListener = AWTEventMulticaster.add (adjustmentListener, listener);
    adjustmentListener = AWTEventMulticaster.add (adjustmentListener, listener);
  }
  }
 
 
  public void removeAdjustmentListener (AdjustmentListener listener)
  public void removeAdjustmentListener (AdjustmentListener listener)
  {
  {
    if (listener == null)
    if (listener == null)
      return;
      return;
    adjustmentListener = AWTEventMulticaster.remove (adjustmentListener, listener);
    adjustmentListener = AWTEventMulticaster.remove (adjustmentListener, listener);
  }
  }
 
 
  public AdjustmentListener[] getAdjustmentListeners ()
  public AdjustmentListener[] getAdjustmentListeners ()
  {
  {
    return (AdjustmentListener[]) AWTEventMulticaster.getListeners
    return (AdjustmentListener[]) AWTEventMulticaster.getListeners
                               (adjustmentListener, AdjustmentListener.class);
                               (adjustmentListener, AdjustmentListener.class);
  }
  }
 
 
  public int getBlockIncrement ()
  public int getBlockIncrement ()
  {
  {
    return blockIncrement;
    return blockIncrement;
  }
  }
 
 
  public int getMaximum ()
  public int getMaximum ()
  {
  {
    return maximum;
    return maximum;
  }
  }
 
 
  public int getMinimum ()
  public int getMinimum ()
  {
  {
    return minimum;
    return minimum;
  }
  }
 
 
  public int getOrientation ()
  public int getOrientation ()
  {
  {
    return orientation;
    return orientation;
  }
  }
 
 
  public int getUnitIncrement ()
  public int getUnitIncrement ()
  {
  {
    return unitIncrement;
    return unitIncrement;
  }
  }
 
 
  public int getValue ()
  public int getValue ()
  {
  {
    return value;
    return value;
  }
  }
 
 
  public int getVisibleAmount ()
  public int getVisibleAmount ()
  {
  {
    return visibleAmount;
    return visibleAmount;
  }
  }
 
 
  public void setBlockIncrement (int blockIncrement)
  public void setBlockIncrement (int blockIncrement)
  {
  {
    this.blockIncrement = blockIncrement;
    this.blockIncrement = blockIncrement;
  }
  }
 
 
  /**
  /**
   * This method should never be called.
   * This method should never be called.
   *
   *
   * @param maximum The maximum value to be set.
   * @param maximum The maximum value to be set.
   * @throws AWTError Always throws this error when called.
   * @throws AWTError Always throws this error when called.
   */
   */
  public void setMaximum (int maximum) throws AWTError
  public void setMaximum (int maximum) throws AWTError
  {
  {
    throw new AWTError("Can be set by scrollpane only");
    throw new AWTError("Can be set by scrollpane only");
  }
  }
 
 
  /**
  /**
   * This method should never be called.
   * This method should never be called.
   *
   *
   * @param minimum The minimum value to be set.
   * @param minimum The minimum value to be set.
   * @throws AWTError Always throws this error when called.
   * @throws AWTError Always throws this error when called.
   */
   */
  public void setMinimum (int minimum)
  public void setMinimum (int minimum)
  {
  {
    throw new AWTError("Can be set by scrollpane only");
    throw new AWTError("Can be set by scrollpane only");
  }
  }
 
 
  public void setUnitIncrement (int unitIncrement)
  public void setUnitIncrement (int unitIncrement)
  {
  {
    this.unitIncrement = unitIncrement;
    this.unitIncrement = unitIncrement;
  }
  }
 
 
  public void setValue (int value)
  public void setValue (int value)
  {
  {
    this.value = value;
    this.value = value;
 
 
    if (value < minimum)
    if (value < minimum)
      minimum = value;
      minimum = value;
 
 
    if (value > maximum)
    if (value > maximum)
      maximum = value;
      maximum = value;
  }
  }
 
 
  /**
  /**
   * This method should never be called.
   * This method should never be called.
   *
   *
   * @param visibleAmount The visible amount to be set.
   * @param visibleAmount The visible amount to be set.
   * @throws AWTError Always throws this error when called.
   * @throws AWTError Always throws this error when called.
   */
   */
  public void setVisibleAmount (int visibleAmount)
  public void setVisibleAmount (int visibleAmount)
  {
  {
    throw new AWTError("Can be set by scrollpane only");
    throw new AWTError("Can be set by scrollpane only");
  }
  }
 
 
  public String paramString ()
  public String paramString ()
  {
  {
    return paramStringHelper()
    return paramStringHelper()
         + ",[" + getMinimum() + ".." + getMaximum()
         + ",[" + getMinimum() + ".." + getMaximum()
         + "],val=" + getValue()
         + "],val=" + getValue()
         + ",vis=" + getVisibleAmount()
         + ",vis=" + getVisibleAmount()
         + ",unit=" + getUnitIncrement()
         + ",unit=" + getUnitIncrement()
         + ",block=" + getBlockIncrement()
         + ",block=" + getBlockIncrement()
         + ",isAdjusting=" + valueIsAdjusting;
         + ",isAdjusting=" + valueIsAdjusting;
  }
  }
 
 
  private String paramStringHelper()
  private String paramStringHelper()
  {
  {
    if (getOrientation() == HORIZONTAL)
    if (getOrientation() == HORIZONTAL)
      return "horizontal";
      return "horizontal";
    else
    else
      return "vertical";
      return "vertical";
  }
  }
 
 
  public String toString()
  public String toString()
  {
  {
    return getClass().getName() + "[" + paramString() + "]";
    return getClass().getName() + "[" + paramString() + "]";
  }
  }
 
 
  /**
  /**
   * Returns true if the value is in the process of changing.
   * Returns true if the value is in the process of changing.
   *
   *
   * @since 1.4
   * @since 1.4
   */
   */
  public boolean getValueIsAdjusting ()
  public boolean getValueIsAdjusting ()
  {
  {
    return valueIsAdjusting;
    return valueIsAdjusting;
  }
  }
 
 
  /**
  /**
   * Sets the value of valueIsAdjusting.
   * Sets the value of valueIsAdjusting.
   *
   *
   * @since 1.4
   * @since 1.4
   */
   */
  public void setValueIsAdjusting (boolean valueIsAdjusting)
  public void setValueIsAdjusting (boolean valueIsAdjusting)
  {
  {
    this.valueIsAdjusting = valueIsAdjusting;
    this.valueIsAdjusting = valueIsAdjusting;
  }
  }
 
 
} // class ScrollPaneAdjustable
} // class ScrollPaneAdjustable
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.