|
EchoPoint 1.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object nextapp.echoservlet.ComponentPeer echopoint.ui.util.EchoPointComponentPeer
EchoPointComponentPeer is provided as a base class for EchoPoint ComponentPeers. It has a number of methods that are common across a EchoPoint peers. Its also has an lazily created ImageManager and ToolTipPopUpSupportHelper, ready for subclasses to use.
It contains a number of helper methods that perform common tasks done by peers such as tracking image references and updating after property changes.
Field Summary | |
protected boolean |
renderedActive
can be set at render time to getComponent.isEnabled() and then checked at clientInput or clientAction to ensure a disabled component is just that. |
Constructor Summary | |
EchoPointComponentPeer()
|
Method Summary | |
static boolean |
addOnce(nextapp.echoservlet.html.Element parent,
nextapp.echoservlet.html.Element child,
java.lang.Object marker)
Adds a child element to the parent element, using a marker to ensure it is added only once. |
static boolean |
addOnce(int index,
nextapp.echoservlet.html.Element parent,
nextapp.echoservlet.html.Element child,
java.lang.Object marker)
This method adds a child element to a parent element only if the specified marker object is not present as a comment in the parent element. |
static void |
addScriptInclude(nextapp.echoservlet.RenderingContext rc,
nextapp.echoservlet.Service service)
Adds a script service into the HEAD of the HtmlDocument in the order in which they are encountered, as opposed to the Echo Set based approach which is a random order. |
static nextapp.echoservlet.ComponentPeer[] |
copyChildrenExcept(nextapp.echoservlet.ComponentPeer[] children,
nextapp.echoservlet.ComponentPeer exception)
Copies all entries in the children array except the specified exception. |
static nextapp.echoservlet.ComponentPeer[] |
copyChildrenExcept(nextapp.echoservlet.ComponentPeer[] children,
nextapp.echoservlet.ComponentPeer[] exceptions)
Copies all entries in the children array except for the ones in the exceptions array. |
nextapp.echoservlet.ComponentStyle |
forComponent()
Synonym for ComponentStyle.forComponent(this); |
nextapp.echoservlet.ComponentStyle |
forComponent(boolean findBackground)
Synonym for ComponentStyle.forComponent(this,findBackground); |
static nextapp.echoservlet.ComponentStyle |
forComponent(nextapp.echoservlet.ComponentPeer componentPeer)
Synonym for ComponentStyle.forComponent(peer); |
static nextapp.echoservlet.ComponentStyle |
forComponent(nextapp.echoservlet.ComponentPeer componentPeer,
boolean findBackground)
Synonym for ComponentStyle.forComponent(peer,findBackground); Will also set in MouseCursorable style properties if the component implements it. |
nextapp.echoservlet.ComponentPeer[] |
getChildren()
Returns the peers for all of the referenced component's visible children. |
nextapp.echo.ImageReference |
getImage(java.lang.String imageName)
This method returns an ImageReference if the image is currently managed by the ImageManager, or null if not. |
nextapp.echoservlet.image.ImageManager |
getImageManager()
Returns the ImageManager for this peer. |
java.lang.String |
getImageUri(nextapp.echoservlet.RenderingContext rc,
java.lang.String imageName)
This method will return and image URI if the named image is currently managed by ImageManager, or null if not. |
nextapp.echoservlet.ComponentPeer |
getPeer(nextapp.echo.Component c)
This version of getPeer returns a ComponentPeer for the given Component c or null if one cannot be found. |
static nextapp.echoservlet.ComponentPeer |
getPeer(nextapp.echoservlet.InstancePeer instancePeer,
nextapp.echo.Component c)
This static version of getPeer will return a peer object, given an InstancePeer. |
ToolTipPopUpSupportHelper |
getToolTipHelper()
Returns a ToolTipPopUpSupportHelper for creating tool tips |
static java.lang.String |
getUri(nextapp.echoservlet.RenderingContext rc,
nextapp.echoservlet.Service service)
Returns the URI string for a given service. |
static boolean |
hasBeenAdded(nextapp.echoservlet.html.Element parent,
java.lang.Object marker)
This method returns true if the specified marker object has been added as an HTML comment marker to the specified parent Element. |
void |
imageUpdate(nextapp.echo.event.ImageUpdateEvent e)
If an image changes, we redraw() the peer. |
void |
propertyChange(java.beans.PropertyChangeEvent evt)
Whenever a property changes, we call redraw() to cause the peer to be repainted. |
void |
registered()
This adds itself as a property change listener to the component, which calls redraw(), and then creates a ToolTipPopUpSupportHelper. |
void |
removeAllImages()
Removes all images from the image manager, if there is one. |
static void |
removeAllManagedImages(nextapp.echoservlet.image.ImageManager imageManager)
Removes all the images from an ImageManager in a concurrent modification safe way. |
static java.lang.String |
removeNewLinesAndJSQuote(java.lang.String s,
char quoteChar)
Strips new lines from the string writer and quotes any quoteChar characters for use in JavaScript |
static java.lang.String |
removeNewLinesAndJSQuote(java.io.StringWriter sw,
char quoteChar)
Strips new lines from the string writer and quotes any quoteChar characters for use in JavaScript |
void |
setImage(java.lang.String imageName,
nextapp.echo.ImageReference newImage)
Adds an image to the image manager, identified by imageName. |
void |
stateChanged(nextapp.echo.event.ChangeEvent e)
Redraws the peer when the state changes. |
void |
trackImage(java.lang.String componentPropertyOrFieldName)
This method is very similair to setImage(String, ImageReference) except it uses reflection to find the ImageReference property value. |
void |
unregistered()
This removes the property change listener and then calls toolTipHelper.unregistered();. |
Methods inherited from class nextapp.echoservlet.ComponentPeer |
addAncillaryService, generateId, getBackground, getChildCount, getComponent, getFont, getForeground, getId, getInstancePeer, getParent, redraw, removeAncillaryService, render |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface echopoint.ui.util.PeerDelegate |
getId |
Field Detail |
protected boolean renderedActive
Constructor Detail |
public EchoPointComponentPeer()
Method Detail |
public nextapp.echoservlet.ComponentPeer getPeer(nextapp.echo.Component c)
getPeer
in interface PeerDelegate
public static nextapp.echoservlet.ComponentPeer getPeer(nextapp.echoservlet.InstancePeer instancePeer, nextapp.echo.Component c)
instancePeer
- - the instancePeer to search for peersc
- - the component to search for a peer of
public static void addScriptInclude(nextapp.echoservlet.RenderingContext rc, nextapp.echoservlet.Service service)
rc
- - the RenderingContextservice
- - the Service to includepublic static boolean addOnce(int index, nextapp.echoservlet.html.Element parent, nextapp.echoservlet.html.Element child, java.lang.Object marker)
If it the marker is not present then the child is added to the
parent element and a HTML comment is added as well
for marker.toString()
. In this way it can
be detected if the child has been been added before.
An appropriate marker object is probably the Id() of the component peer or a string based on this Id().
index
- - the index where to add the elementparent
- - the parent Element to add the child tochild
- - the child Element to add to the parentmarker
- - an object on which .toString() will be applied.
Id
public static boolean addOnce(nextapp.echoservlet.html.Element parent, nextapp.echoservlet.html.Element child, java.lang.Object marker)
addOnce(int, Element, Element, Object)
public static boolean hasBeenAdded(nextapp.echoservlet.html.Element parent, java.lang.Object marker)
parent
- - the Element to check for the markermarker
- - an object on which .toString() will be applied.
addOnce(int, Element, Element, Object)
public static nextapp.echoservlet.ComponentPeer[] copyChildrenExcept(nextapp.echoservlet.ComponentPeer[] children, nextapp.echoservlet.ComponentPeer exception)
ComponentPeer
s
wihtout the exception. This may in fact be the original
array.
children
- - the children to copyexception
- - the one not to copy into the new array
public static nextapp.echoservlet.ComponentPeer[] copyChildrenExcept(nextapp.echoservlet.ComponentPeer[] children, nextapp.echoservlet.ComponentPeer[] exceptions)
ComponentPeer
s
wihtout the exceptions. This may in fact be the original
array.
children
- - the children to copyexceptions
- - the children not to copy into the new array
public static java.lang.String removeNewLinesAndJSQuote(java.io.StringWriter sw, char quoteChar)
public static java.lang.String removeNewLinesAndJSQuote(java.lang.String s, char quoteChar)
public void registered()
public void unregistered()
public void propertyChange(java.beans.PropertyChangeEvent evt)
In 99% of cases, this is actually what you want to do.
propertyChange
in interface java.beans.PropertyChangeListener
PropertyChangeListener.propertyChange(java.beans.PropertyChangeEvent)
public void stateChanged(nextapp.echo.event.ChangeEvent e)
stateChanged
in interface nextapp.echo.event.ChangeListener
ChangeListener.stateChanged(nextapp.echo.event.ChangeEvent)
public nextapp.echoservlet.ComponentStyle forComponent()
forComponent
in interface PeerDelegate
PeerDelegate.forComponent()
public nextapp.echoservlet.ComponentStyle forComponent(boolean findBackground)
forComponent
in interface PeerDelegate
PeerDelegate.forComponent(boolean)
public static nextapp.echoservlet.ComponentStyle forComponent(nextapp.echoservlet.ComponentPeer componentPeer)
public static nextapp.echoservlet.ComponentStyle forComponent(nextapp.echoservlet.ComponentPeer componentPeer, boolean findBackground)
public nextapp.echoservlet.ComponentPeer[] getChildren()
PeerDelegate
getChildren
in interface PeerDelegate
PeerDelegate.getChildren()
public void imageUpdate(nextapp.echo.event.ImageUpdateEvent e)
In 99% of cases, this is actually what you want to do.
imageUpdate
in interface nextapp.echo.event.ImageUpdateListener
ImageUpdateListener.imageUpdate(nextapp.echo.event.ImageUpdateEvent)
public static java.lang.String getUri(nextapp.echoservlet.RenderingContext rc, nextapp.echoservlet.Service service)
rc
- - the rendering context in playservice
- - the service to find the URI for
public ToolTipPopUpSupportHelper getToolTipHelper()
PeerDelegate
getToolTipHelper
in interface PeerDelegate
PeerDelegate.getToolTipHelper()
public nextapp.echoservlet.image.ImageManager getImageManager()
public java.lang.String getImageUri(nextapp.echoservlet.RenderingContext rc, java.lang.String imageName)
imageName
- - the name of the managed image
public nextapp.echo.ImageReference getImage(java.lang.String imageName)
imageName
- - the name of the managed image
public void removeAllImages()
public static void removeAllManagedImages(nextapp.echoservlet.image.ImageManager imageManager)
imageManager
- the imageManager to remove all images from.public void setImage(java.lang.String imageName, nextapp.echo.ImageReference newImage)
imageName
- A identifier that will be used for the added image.newImage
- The new image to be added.ImageManager.setImage(String, ImageReference)
public void trackImage(java.lang.String componentPropertyOrFieldName)
It allows for a shorthand method of setting an ImageReference property into the peer's ImageManager.
It also adds a PropertyChangeListener that "sets" the image into the image manager when a property change event happens with the same name.
So with one statement at say peer registration time, the image property is set into the ImageManager and tracked over time.
componentPropertyOrFieldName
- - the name of the ImageReference
property to track.
java.lang.RuntimeException
- - if the property name cannot be found or
its illegal to retrive its value.
|
EchoPoint 1.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |