org.jhotdraw.io
Class BoundedRangeInputStream
- java.lang.Object
-
- java.io.InputStream
-
- java.io.FilterInputStream
-
- org.jhotdraw.io.BoundedRangeInputStream
-
- All Implemented Interfaces:
- java.io.Closeable, java.lang.AutoCloseable, javax.swing.BoundedRangeModel
public class BoundedRangeInputStream extends java.io.FilterInputStream implements javax.swing.BoundedRangeModelThis input stream implements the BoundedRangeModel and allows the observation of the input reading process.
-
-
Constructor Summary
Constructors Constructor and Description BoundedRangeInputStream(java.io.InputStream in)Create a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidaddChangeListener(javax.swing.event.ChangeListener l)Adds a ChangeListener to the model's listener list.intgetExtent()Returns the model's extent, the length of the inner range that begins at the model's value.intgetMaximum()Returns the model's maximum.intgetMinimum()Returns the minimum acceptable value.intgetValue()Returns the current read position.booleangetValueIsAdjusting()Returns true if the current changes to the value property are part of a series of changes.intread()OverridesFilterInputStream.readto update the value after the read.intread(byte[] b)OverridesFilterInputStream.readto update the value after the read.intread(byte[] b, int off, int len)OverridesFilterInputStream.readto update the value after the read.voidremoveChangeListener(javax.swing.event.ChangeListener l)Removes a ChangeListener.voidreset()OverridesFilterInputStream.resetto reset the progress monitor as well as the stream.voidsetExtent(int newExtent)Ignored: The extent is always zero.voidsetMaximum(int newMaximum)Ignored: The maximum of an input stream can not be changed.voidsetMinimum(int newMinimum)Ignored: The minimum of an input stream is always zero.voidsetRangeProperties(int value, int extent, int min, int max, boolean adjusting)Ignored: All values depend on the input stream.voidsetValue(int newValue)Ignored: The value is always zero.voidsetValueIsAdjusting(boolean b)This attribute indicates that any upcoming changes to the value of the model should be considered a single event.longskip(long n)OverridesFilterInputStream.skipto update the value after the skip.
-
-
-
Constructor Detail
-
BoundedRangeInputStream
public BoundedRangeInputStream(java.io.InputStream in)
Create a new instance.
-
-
Method Detail
-
read
public int read() throws java.io.IOExceptionOverridesFilterInputStream.readto update the value after the read.- Overrides:
readin classjava.io.FilterInputStream- Throws:
java.io.IOException
-
read
public int read(byte[] b) throws java.io.IOExceptionOverridesFilterInputStream.readto update the value after the read.- Overrides:
readin classjava.io.FilterInputStream- Throws:
java.io.IOException
-
read
public int read(byte[] b, int off, int len) throws java.io.IOExceptionOverridesFilterInputStream.readto update the value after the read.- Overrides:
readin classjava.io.FilterInputStream- Throws:
java.io.IOException
-
skip
public long skip(long n) throws java.io.IOExceptionOverridesFilterInputStream.skipto update the value after the skip.- Overrides:
skipin classjava.io.FilterInputStream- Throws:
java.io.IOException
-
reset
public void reset() throws java.io.IOExceptionOverridesFilterInputStream.resetto reset the progress monitor as well as the stream.- Overrides:
resetin classjava.io.FilterInputStream- Throws:
java.io.IOException
-
getMinimum
public int getMinimum()
Returns the minimum acceptable value.- Specified by:
getMinimumin interfacejavax.swing.BoundedRangeModel- Returns:
- the value of the minimum property
- See Also:
setMinimum(int)
-
setMinimum
public void setMinimum(int newMinimum)
Ignored: The minimum of an input stream is always zero. Sets the model's minimum to newMinimum. The other three properties may be changed as well, to ensure that:minimum <= value <= value+extent <= maximum
Notifies any listeners if the model changes.
- Specified by:
setMinimumin interfacejavax.swing.BoundedRangeModel- Parameters:
newMinimum- the model's new minimum- See Also:
getMinimum(),addChangeListener(javax.swing.event.ChangeListener)
-
getMaximum
public int getMaximum()
Returns the model's maximum. Note that the upper limit on the model's value is (maximum - extent).- Specified by:
getMaximumin interfacejavax.swing.BoundedRangeModel- Returns:
- the value of the maximum property.
- See Also:
setMaximum(int),setExtent(int)
-
setMaximum
public void setMaximum(int newMaximum)
Ignored: The maximum of an input stream can not be changed. # Sets the model's maximum to newMaximum. The other three properties may be changed as well, to ensure thatminimum <= value <= value+extent <= maximum
Notifies any listeners if the model changes.
- Specified by:
setMaximumin interfacejavax.swing.BoundedRangeModel- Parameters:
newMaximum- the model's new maximum- See Also:
getMaximum(),addChangeListener(javax.swing.event.ChangeListener)
-
getValue
public int getValue()
Returns the current read position. Returns the model's current value. Note that the upper limit on the model's value ismaximum - extentand the lower limit isminimum.- Specified by:
getValuein interfacejavax.swing.BoundedRangeModel- Returns:
- the model's value
- See Also:
setValue(int)
-
setValue
public void setValue(int newValue)
Ignored: The value is always zero. Sets the model's current value tonewValueifnewValuesatisfies the model's constraints. Those constraints are:minimum <= value <= value+extent <= maximum
Otherwise, ifnewValueis less thanminimumit's set tominimum, if its greater thanmaximumthen it's set tomaximum, and if it's greater thanvalue+extentthen it's set tovalue+extent.When a BoundedRange model is used with a scrollbar the value specifies the origin of the scrollbar knob (aka the "thumb" or "elevator"). The value usually represents the origin of the visible part of the object being scrolled.
Notifies any listeners if the model changes.
- Specified by:
setValuein interfacejavax.swing.BoundedRangeModel- Parameters:
newValue- the model's new value- See Also:
getValue()
-
setValueIsAdjusting
public void setValueIsAdjusting(boolean b)
This attribute indicates that any upcoming changes to the value of the model should be considered a single event. This attribute will be set to true at the start of a series of changes to the value, and will be set to false when the value has finished changing. Normally this allows a listener to only take action when the final value change in committed, instead of having to do updates for all intermediate values.Sliders and scrollbars use this property when a drag is underway.
- Specified by:
setValueIsAdjustingin interfacejavax.swing.BoundedRangeModel- Parameters:
b- true if the upcoming changes to the value property are part of a series
-
getValueIsAdjusting
public boolean getValueIsAdjusting()
Returns true if the current changes to the value property are part of a series of changes.- Specified by:
getValueIsAdjustingin interfacejavax.swing.BoundedRangeModel- Returns:
- the valueIsAdjustingProperty.
- See Also:
setValueIsAdjusting(boolean)
-
getExtent
public int getExtent()
Returns the model's extent, the length of the inner range that begins at the model's value.- Specified by:
getExtentin interfacejavax.swing.BoundedRangeModel- Returns:
- the value of the model's extent property
- See Also:
setExtent(int),setValue(int)
-
setExtent
public void setExtent(int newExtent)
Ignored: The extent is always zero.- Specified by:
setExtentin interfacejavax.swing.BoundedRangeModel
-
setRangeProperties
public void setRangeProperties(int value, int extent, int min, int max, boolean adjusting)Ignored: All values depend on the input stream.- Specified by:
setRangePropertiesin interfacejavax.swing.BoundedRangeModel
-
addChangeListener
public void addChangeListener(javax.swing.event.ChangeListener l)
Adds a ChangeListener to the model's listener list.- Specified by:
addChangeListenerin interfacejavax.swing.BoundedRangeModel- Parameters:
l- the ChangeListener to add- See Also:
removeChangeListener(javax.swing.event.ChangeListener)
-
removeChangeListener
public void removeChangeListener(javax.swing.event.ChangeListener l)
Removes a ChangeListener.- Specified by:
removeChangeListenerin interfacejavax.swing.BoundedRangeModel- Parameters:
l- the ChangeListener to remove- See Also:
addChangeListener(javax.swing.event.ChangeListener),BoundedRangeModel.removeChangeListener(javax.swing.event.ChangeListener)
-
-
DataMelt 3.0 © DataMelt by jWork.ORG