Commit 897db4af by Michael Koch Committed by Michael Koch

2003-03-18 Michael Koch <konqueror@gmx.de>

	* java/awt/ScrollPane.java
	(ScrollPane): Rewrote for new ScrollPaneAdjustable.
	(getViewportSize): Likewise.
	(addNotify): Likewise.
	(removeNotify): Likewise.
	* java/awt/ScrollPaneAdjustable.java
	(ScrollPaneAdjustable): No longer extends Scrollbar.
	* java/beans/beancontext/BeanContextServices.java:
	Reformated.
	(getService): Added throws TooManyListenersException;
	* java/beans/beancontext/BeanContextServicesSupport.java:
	Reformated.

From-SVN: r64538
parent 8dfa3bb0
2003-03-18 Michael Koch <konqueror@gmx.de> 2003-03-18 Michael Koch <konqueror@gmx.de>
* java/awt/ScrollPane.java
(ScrollPane): Rewrote for new ScrollPaneAdjustable.
(getViewportSize): Likewise.
(addNotify): Likewise.
(removeNotify): Likewise.
* java/awt/ScrollPaneAdjustable.java
(ScrollPaneAdjustable): No longer extends Scrollbar.
* java/beans/beancontext/BeanContextServices.java:
Reformated.
(getService): Added throws TooManyListenersException;
* java/beans/beancontext/BeanContextServicesSupport.java:
Reformated.
2003-03-18 Michael Koch <konqueror@gmx.de>
* java/io/BufferedOutputStream.java, * java/io/BufferedOutputStream.java,
java/io/DataInput.java, java/io/DataInput.java,
java/io/DataInputStream.java, java/io/DataInputStream.java,
......
...@@ -153,8 +153,8 @@ ScrollPane(int scrollbarDisplayPolicy) ...@@ -153,8 +153,8 @@ ScrollPane(int scrollbarDisplayPolicy)
if (scrollbarDisplayPolicy != SCROLLBARS_NEVER) if (scrollbarDisplayPolicy != SCROLLBARS_NEVER)
{ {
hAdjustable = new ScrollPaneAdjustable(Scrollbar.HORIZONTAL); hAdjustable = new ScrollPaneAdjustable (this, Scrollbar.HORIZONTAL);
vAdjustable = new ScrollPaneAdjustable(Scrollbar.VERTICAL); vAdjustable = new ScrollPaneAdjustable (this, Scrollbar.VERTICAL);
} }
wheelScrollingEnabled = true; wheelScrollingEnabled = true;
...@@ -215,23 +215,17 @@ getVAdjustable() ...@@ -215,23 +215,17 @@ getVAdjustable()
* *
* @return The viewport size. * @return The viewport size.
*/ */
public Dimension public Dimension getViewportSize ()
getViewportSize()
{ {
Dimension viewsize = getSize(); Dimension viewsize = getSize ();
Insets insets = getInsets(); Insets insets = getInsets ();
viewsize.width = viewsize.width - (insets.left + insets.right); viewsize.width = (viewsize.width
viewsize.height = viewsize.height - (insets.top + insets.bottom); - (insets.left + insets.right)
- getVScrollbarWidth ());
ScrollPaneAdjustable v = (ScrollPaneAdjustable)getVAdjustable(); viewsize.height = (viewsize.height
ScrollPaneAdjustable h = (ScrollPaneAdjustable)getHAdjustable(); - (insets.top + insets.bottom)
- getHScrollbarHeight ());
if ((v != null) && v.isVisible()) return viewsize;
viewsize.width = viewsize.width - v.getSize().width;
if ((h != null) && h.isVisible())
viewsize.height = viewsize.height - v.getSize().height;
return(viewsize);
} }
/*************************************************************************/ /*************************************************************************/
...@@ -347,11 +341,7 @@ addNotify() ...@@ -347,11 +341,7 @@ addNotify()
return; return;
setPeer((ComponentPeer)getToolkit().createScrollPane(this)); setPeer((ComponentPeer)getToolkit().createScrollPane(this));
super.addNotify();
if (hAdjustable != null)
hAdjustable.addNotify();
if (vAdjustable != null)
vAdjustable.removeNotify();
} }
/*************************************************************************/ /*************************************************************************/
...@@ -362,11 +352,6 @@ addNotify() ...@@ -362,11 +352,6 @@ addNotify()
public void public void
removeNotify() removeNotify()
{ {
if (hAdjustable != null)
hAdjustable.removeNotify();
if (vAdjustable != null)
vAdjustable.removeNotify();
super.removeNotify(); super.removeNotify();
} }
......
...@@ -49,7 +49,6 @@ import java.io.Serializable; ...@@ -49,7 +49,6 @@ import java.io.Serializable;
* @since 1.4 * @since 1.4
*/ */
public class ScrollPaneAdjustable public class ScrollPaneAdjustable
extends Scrollbar
implements Adjustable, Serializable implements Adjustable, Serializable
{ {
private static final long serialVersionUID = -3359745691033257079L; private static final long serialVersionUID = -3359745691033257079L;
...@@ -60,13 +59,14 @@ public class ScrollPaneAdjustable ...@@ -60,13 +59,14 @@ public class ScrollPaneAdjustable
int minimum; int minimum;
int maximum; int maximum;
int visibleAmount; int visibleAmount;
int unitIncrement; int unitIncrement = 1;
int blockIncrement; int blockIncrement = 1;
AdjustmentListener adjustmentListener; AdjustmentListener adjustmentListener;
ScrollPaneAdjustable (int orientation) ScrollPaneAdjustable (ScrollPane sp, int orientation)
{ {
throw new Error ("not implemented"); this.sp = sp;
this.orientation = orientation;
} }
ScrollPaneAdjustable (ScrollPane sp, int orientation, int value, int minimum, ScrollPaneAdjustable (ScrollPane sp, int orientation, int value, int minimum,
......
...@@ -39,6 +39,7 @@ exception statement from your version. */ ...@@ -39,6 +39,7 @@ exception statement from your version. */
package java.beans.beancontext; package java.beans.beancontext;
import java.util.Iterator; import java.util.Iterator;
import java.util.TooManyListenersException;
/** /**
* Allows a <code>BeanContext</code> to provide services to its children. * Allows a <code>BeanContext</code> to provide services to its children.
...@@ -46,161 +47,172 @@ import java.util.Iterator; ...@@ -46,161 +47,172 @@ import java.util.Iterator;
* @specnote it is unclear whether a <code>BeanContextServices</code> * @specnote it is unclear whether a <code>BeanContextServices</code>
* should delegate unhandled requests to parents. I assume so. * should delegate unhandled requests to parents. I assume so.
* @author John Keiser * @author John Keiser
* @since JDK1.2 * @since 1.2
*/ */
public interface BeanContextServices extends BeanContext, BeanContextServicesListener { public interface BeanContextServices
/** extends BeanContext, BeanContextServicesListener
* Register a service to make it available to others. {
* This class may refuse to add the service based on whatever /**
* information it can gather, including whether the service * Register a service to make it available to others.
* provider is trusted. * This class may refuse to add the service based on whatever
* * information it can gather, including whether the service
* @param serviceClass the service class. * provider is trusted.
* @param provider the factory that will actually provide the service. *
* @return whether the service was added or not. * @param serviceClass the service class.
*/ * @param provider the factory that will actually provide the service.
public boolean addService(Class serviceClass, BeanContextServiceProvider provider); * @return whether the service was added or not.
*/
/** public boolean addService (Class serviceClass,
* Make it so that no one else can use this service. BeanContextServiceProvider provider);
* <P>
* /**
* If <code>revokeNow</code> is <code>false</code>, the only * Make it so that no one else can use this service.
* effect of this method is to make all subsequent calls to * <P>
* <code>getService()</code> on this service class fail. *
* <P> * If <code>revokeNow</code> is <code>false</code>, the only
* * effect of this method is to make all subsequent calls to
* If it is <code>true</code>, a message is also sent out to all * <code>getService()</code> on this service class fail.
* listeners on the service and all references to it are released. * <P>
* *
* @param serviceClass the service class to revoke. * If it is <code>true</code>, a message is also sent out to all
* @param provider the service provider providing the service class. * listeners on the service and all references to it are released.
* @param revokeNow whether to release all current references to *
* the service. * @param serviceClass the service class to revoke.
*/ * @param provider the service provider providing the service class.
public void revokeService(Class serviceClass, BeanContextServiceProvider provider, boolean revokeNow); * @param revokeNow whether to release all current references to
* the service.
/** */
* Release your copy of this service. public void revokeService (Class serviceClass,
* <P> BeanContextServiceProvider provider,
* boolean revokeNow);
* If all copies of the service's class have been relinquished by
* the requestor, the <code>BeanContextServiceRevokedListener</code> /**
* previously registered by <code>getService()</code> will be * Release your copy of this service.
* unregistered. * <P>
* *
* @param requestorChild the original <code>BeanContextChild</code> * If all copies of the service's class have been relinquished by
* requesting the service. * the requestor, the <code>BeanContextServiceRevokedListener</code>
* @param requestor the original requestor of the service. * previously registered by <code>getService()</code> will be
* @param service the service to relinquish * unregistered.
* @see #getService(java.beans.beancontext.BeanContextChild,java.lang.Object,java.lang.Class,java.lang.Object,java.beans.beancontext.BeanContextServiceRevokedListener) *
*/ * @param requestorChild the original <code>BeanContextChild</code>
public void releaseService(BeanContextChild requestorChild, Object requestor, Object service); * requesting the service.
* @param requestor the original requestor of the service.
/** * @param service the service to relinquish
* Get a service from this <code>BeanContextServices</code>. * @see #getService(java.beans.beancontext.BeanContextChild,java.lang.Object,java.lang.Class,java.lang.Object,java.beans.beancontext.BeanContextServiceRevokedListener)
* <P> */
* public void releaseService (BeanContextChild requestorChild, Object requestor,
* The specified listener will be registered to receive a Object service);
* revocation notice for the specified serviceClass. One
* notification per service class per requestor object will be /**
* sent. * Get a service from this <code>BeanContextServices</code>.
* <P> * <P>
* *
* The listener will be unregistered when all services that were * The specified listener will be registered to receive a
* obtained by that requestor for that service class are released. * revocation notice for the specified serviceClass. One
* <P> * notification per service class per requestor object will be
* * sent.
* If the requested service class is not available, or if this * <P>
* <code>BeanContextServices</code> object chooses not honor the *
* request because the service class has been revoked or for some * The listener will be unregistered when all services that were
* other reason, then this method will return <code>null</code>. * obtained by that requestor for that service class are released.
* <P> * <P>
* *
* This method may throw unchecked exceptions, so watch out. * If the requested service class is not available, or if this
* * <code>BeanContextServices</code> object chooses not honor the
* @specnote it is not specified what happens when two subsequent * request because the service class has been revoked or for some
* calls are made to <code>getService()</code> with the * other reason, then this method will return <code>null</code>.
* same requestor object and service class but different * <P>
* listeners. Which listener is to be notified? *
* * This method may throw unchecked exceptions, so watch out.
* @param requestorChild the <code>BeanContextChild</code> *
* associated with the requestor. Typically this will be * @specnote it is not specified what happens when two subsequent
* the same as the requestor itself, but since any * calls are made to <code>getService()</code> with the
* <code>Object</code>, even one outside the hierarchy, may * same requestor object and service class but different
* make a request, this parameter is necessary. Only weak * listeners. Which listener is to be notified?
* references to this will be retained, and it will never *
* be changed, only queried in a read-only manner. * @param requestorChild the <code>BeanContextChild</code>
* @param requestor the actual requestor of the service. Only * associated with the requestor. Typically this will be
* weak references to this will be retained, and it will * the same as the requestor itself, but since any
* never be changed, only queried in a read-only manner. * <code>Object</code>, even one outside the hierarchy, may
* @param serviceClass the <code>Class</code> of the service being * make a request, this parameter is necessary. Only weak
* requested. * references to this will be retained, and it will never
* @param serviceSelector a parameter to customize the service * be changed, only queried in a read-only manner.
* returned with. * @param requestor the actual requestor of the service. Only
* @param listener a listener that will be notified if the service * weak references to this will be retained, and it will
* being requested is revoked. * never be changed, only queried in a read-only manner.
* @return an instance of <code>serviceClass</code> (such that * @param serviceClass the <code>Class</code> of the service being
* <code>instanceof</code> serviceClass is true), or * requested.
* <code>null</code>. * @param serviceSelector a parameter to customize the service
*/ * returned with.
public Object getService(BeanContextChild requestorChild, Object requestor, Class serviceClass, Object serviceSelector, BeanContextServiceRevokedListener listener); * @param listener a listener that will be notified if the service
* being requested is revoked.
/** * @return an instance of <code>serviceClass</code> (such that
* Get a list of all service classes supported. * <code>instanceof</code> serviceClass is true), or
* <P> * <code>null</code>.
* */
* This method must synchronize on public Object getService (BeanContextChild requestorChild, Object requestor,
* <code>BeanContext.globalHierarchyLock</code>. Class serviceClass, Object serviceSelector,
* BeanContextServiceRevokedListener listener)
* @return a list of all service classes supported. throws TooManyListenersException;
* @see java.beans.beancontext.BeanContext#globalHierarchyLock
*/ /**
public Iterator getCurrentServiceClasses(); * Get a list of all service classes supported.
* <P>
/** *
* Get a list of valid service selectors for the specified service class. * This method must synchronize on
* <P> * <code>BeanContext.globalHierarchyLock</code>.
* *
* If the specified service class does not have a finite number of * @return a list of all service classes supported.
* valid service selectors, it should return <code>null</code>. * @see java.beans.beancontext.BeanContext#globalHierarchyLock
* If it takes a general <code>Integer</code> parameter, for */
* example, you may as well return <code>null</code> or the poor public Iterator getCurrentServiceClasses ();
* soul who called this method will be iterating all day.
* <P> /**
* * Get a list of valid service selectors for the specified service class.
* If it has no valid service selectors, it should still return an empty * <P>
* <code>Iterator</code>. *
* * If the specified service class does not have a finite number of
* @param serviceClass the service class to get selectors for. * valid service selectors, it should return <code>null</code>.
* @return a list of valid service selectors for the service * If it takes a general <code>Integer</code> parameter, for
* class, or <code>null</code>. * example, you may as well return <code>null</code> or the poor
*/ * soul who called this method will be iterating all day.
public Iterator getCurrentServiceSelectors(Class serviceClass); * <P>
*
/** * If it has no valid service selectors, it should still return an empty
* Tell whether the specified service class is available. * <code>Iterator</code>.
* Iff getService() could return a non-null value for the *
* specified service, this method will return <code>true</code>. * @param serviceClass the service class to get selectors for.
* * @return a list of valid service selectors for the service
* @param serviceClass the service class to check on. * class, or <code>null</code>.
* @return whether the specified service class is availabe. */
*/ public Iterator getCurrentServiceSelectors (Class serviceClass);
public boolean hasService(Class serviceClass);
/**
/** * Tell whether the specified service class is available.
* Add a listener on all adds and removes of services. * Iff getService() could return a non-null value for the
* @param listener the listener to add. * specified service, this method will return <code>true</code>.
*/ *
public void addBeanContextServicesListener(BeanContextServicesListener listener); * @param serviceClass the service class to check on.
* @return whether the specified service class is available.
/** */
* Remove a listener on all adds and removes of services. public boolean hasService (Class serviceClass);
* @specnote it is not certain whether this should remove this
* listener if it was specified in /**
* <code>getService()</code>. * Add a listener on all adds and removes of services.
* @param listener the listener to add. * @param listener the listener to add.
*/ */
public void removeBeanContextServicesListener(BeanContextServicesListener listener); public void
addBeanContextServicesListener (BeanContextServicesListener listener);
/**
* Remove a listener on all adds and removes of services.
* @specnote it is not certain whether this should remove this
* listener if it was specified in
* <code>getService()</code>.
* @param listener the listener to add.
*/
public void
removeBeanContextServicesListener (BeanContextServicesListener listener);
} }
...@@ -131,12 +131,14 @@ public class BeanContextServicesSupport ...@@ -131,12 +131,14 @@ public class BeanContextServicesSupport
this (peer, lcle, true, true); this (peer, lcle, true, true);
} }
public BeanContextServicesSupport (BeanContextServices peer, Locale lcle, boolean dtime) public BeanContextServicesSupport (BeanContextServices peer, Locale lcle,
boolean dtime)
{ {
this (peer, lcle, dtime, true); this (peer, lcle, dtime, true);
} }
public BeanContextServicesSupport (BeanContextServices peer, Locale lcle, boolean dtime, boolean visible) public BeanContextServicesSupport (BeanContextServices peer, Locale lcle,
boolean dtime, boolean visible)
{ {
throw new Error ("Not implemented"); throw new Error ("Not implemented");
} }
...@@ -146,12 +148,14 @@ public class BeanContextServicesSupport ...@@ -146,12 +148,14 @@ public class BeanContextServicesSupport
throw new Error ("Not implemented"); throw new Error ("Not implemented");
} }
public boolean addService (Class serviceClass, BeanContextServiceProvider bcsp) public boolean addService (Class serviceClass, BeanContextServiceProvider bcsp)
{ {
throw new Error ("Not implemented"); throw new Error ("Not implemented");
} }
protected boolean addService (Class serviceClass, BeanContextServiceProvider bcsp, boolean fireEvent) protected boolean addService (Class serviceClass,
BeanContextServiceProvider bcsp,
boolean fireEvent)
{ {
throw new Error ("Not implemented"); throw new Error ("Not implemented");
} }
...@@ -167,22 +171,26 @@ public class BeanContextServicesSupport ...@@ -167,22 +171,26 @@ public class BeanContextServicesSupport
{ {
throw new Error ("Not implemented"); throw new Error ("Not implemented");
} }
protected void childJustRemovedHook (Object child, BeanContextSupport.BCSChild bcsc)
protected void childJustRemovedHook (Object child,
BeanContextSupport.BCSChild bcsc)
{ {
throw new Error ("Not implemented"); throw new Error ("Not implemented");
} }
protected BeanContextSupport.BCSChild createBCSChild (Object targetChild, Object peer) protected BeanContextSupport.BCSChild createBCSChild (Object targetChild,
Object peer)
{ {
throw new Error ("Not implemented"); throw new Error ("Not implemented");
} }
protected BeanContextServicesSupport.BCSSServiceProvider createBCSSServiceProvider (Class sc, BeanContextServiceProvider bcsp) protected BeanContextServicesSupport.BCSSServiceProvider
createBCSSServiceProvider (Class sc, BeanContextServiceProvider bcsp)
{ {
throw new Error ("Not implemented"); throw new Error ("Not implemented");
} }
protected final void fireServiceAdded (BeanContextServiceAvailableEvent bcssae) protected final void fireServiceAdded (BeanContextServiceAvailableEvent bcssae)
{ {
throw new Error ("Not implemented"); throw new Error ("Not implemented");
} }
...@@ -192,12 +200,14 @@ public class BeanContextServicesSupport ...@@ -192,12 +200,14 @@ public class BeanContextServicesSupport
throw new Error ("Not implemented"); throw new Error ("Not implemented");
} }
protected final void fireServiceRevoked (BeanContextServiceRevokedEvent bcsre) protected final void
fireServiceRevoked (BeanContextServiceRevokedEvent bcsre)
{ {
throw new Error ("Not implemented"); throw new Error ("Not implemented");
} }
protected final void fireServiceRevoked (Class serviceClass, boolean revokeNow) protected final void fireServiceRevoked (Class serviceClass,
boolean revokeNow)
{ {
throw new Error ("Not implemented"); throw new Error ("Not implemented");
} }
...@@ -207,7 +217,8 @@ public class BeanContextServicesSupport ...@@ -207,7 +217,8 @@ public class BeanContextServicesSupport
throw new Error ("Not implemented"); throw new Error ("Not implemented");
} }
protected static final BeanContextServicesListener getChildBeanContextServicesListener (Object child) protected static final BeanContextServicesListener
getChildBeanContextServicesListener (Object child)
{ {
throw new Error ("Not implemented"); throw new Error ("Not implemented");
} }
...@@ -222,7 +233,9 @@ public class BeanContextServicesSupport ...@@ -222,7 +233,9 @@ public class BeanContextServicesSupport
throw new Error ("Not implemented"); throw new Error ("Not implemented");
} }
public Object getService (BeanContextChild child, Object requestor, Class serviceClass, Object serviceSelector, BeanContextServiceRevokedListener bcsrl) public Object getService (BeanContextChild child, Object requestor,
Class serviceClass, Object serviceSelector,
BeanContextServiceRevokedListener bcsrl)
throws TooManyListenersException throws TooManyListenersException
{ {
throw new Error ("Not implemented"); throw new Error ("Not implemented");
...@@ -248,17 +261,20 @@ public class BeanContextServicesSupport ...@@ -248,17 +261,20 @@ public class BeanContextServicesSupport
throw new Error ("Not implemented"); throw new Error ("Not implemented");
} }
public void releaseService (BeanContextChild child, Object requestor, Object service) public void releaseService (BeanContextChild child, Object requestor,
Object service)
{ {
throw new Error ("Not implemented"); throw new Error ("Not implemented");
} }
public void removeBeanContextServicesListener (BeanContextServicesListener bcsl) public void
removeBeanContextServicesListener (BeanContextServicesListener bcsl)
{ {
throw new Error ("Not implemented"); throw new Error ("Not implemented");
} }
public void revokeService (Class serviceClass, BeanContextServiceProvider bcsp, boolean revokeCurrentServicesNow) public void revokeService (Class serviceClass, BeanContextServiceProvider bcsp,
boolean revokeCurrentServicesNow)
{ {
throw new Error ("Not implemented"); throw new Error ("Not implemented");
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment