echopoint.ui
Class TitleBarUI

java.lang.Object
  extended by nextapp.echoservlet.AbstractComponentPeer
      extended by echopoint.ui.util.EchoPointComponentPeer
          extended by echopoint.ui.TitleBarUI
All Implemented Interfaces:
PeerDelegate, java.beans.PropertyChangeListener, java.io.Serializable, java.util.EventListener, ChangeListener, ImageUpdateListener, ClientActionProducer, ClientInputProducer, ComponentPeer

public class TitleBarUI
extends EchoPointComponentPeer
implements ClientActionProducer, ClientInputProducer

TitleBarUI is the backend peer class for the component TitleBar.

This has a client mode and a server side mode for the pressing of the expand/collapse buttons. In client side mode it runs a JS function to change the expansion images and also called a special inserted function to do anything else. The state of the expansionness is also saved via the ClientInputProducer interface.

The client mode is there as a convenience for other compoents such as ExpandableSection.

In server side mode, clicks result in an action back to the peer that changes the state of the TitleBar model, which in turns redraws the component.

By default the TitleBar is rendered as NOT draggable. However if you call setDraggable("htmlId") then the title bar will be rendered to allow dragging around of the specified HTML element. Make sure you put position:absolute/relative on the element to ensure it can be moved via JS.

See Also:
Serialized Form

Field Summary
 
Fields inherited from interface nextapp.echoservlet.ComponentPeer
IGNORE_PROPERTY_CHANGE
 
Constructor Summary
TitleBarUI()
           
 
Method Summary
 void clientAction(java.lang.String action)
          Called when the user causes an action from the client.
 void clientInput(java.lang.String input)
          Called when the client state has to be saved.
 void propertyChange(java.beans.PropertyChangeEvent e)
          Whenever a property changes, we call redraw() to cause the peer to be repainted.
static void register()
          Registers the Component with its peer bindings
 void registered()
          This adds itself as a property change listener to the component, which calls redraw(), and then creates a ToolTipPopUpSupportHelper.
 void render(RenderingContext rc, Element parent)
          A method that should be overridden for the ComponentPeer to produce HTML output.
 void setClientMode(boolean newClientMode, java.lang.String newHideElementStr)
          Puts the TitleBar peer into client mode or not.
 void setDraggable(java.lang.String dragElementStr, java.lang.String dragCustomFunction, java.lang.String dragContextStr, boolean useDragBackground, boolean useDragWindow)
          Sets the title bar as being draggable.
 void unregistered()
          This removes the property change listener and then calls toolTipHelper.unregistered();.
 
Methods inherited from class echopoint.ui.util.EchoPointComponentPeer
addOnce, addOnce, addScriptInclude, copyChildrenExcept, copyChildrenExcept, forComponent, forComponent, forComponent, forComponent, getChildren, getImage, getImageManager, getImageUri, getPeer, getPeer, getToolTipHelper, getUri, hasBeenAdded, imageUpdate, removeAllImages, removeAllManagedImages, removeNewLinesAndJSQuote, removeNewLinesAndJSQuote, setImage, stateChanged, trackImage
 
Methods inherited from class nextapp.echoservlet.AbstractComponentPeer
addAncillaryService, generateId, getCalculatedBackground, getCalculatedFont, getCalculatedForeground, getChildCount, getComponent, getFocusedElementId, getId, getInstancePeer, getParentComponentPeer, redraw, registerAncillaryServices, removeAncillaryService, setComponent, setId, setInstancePeer, unregisterAncillaryServices
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface nextapp.echoservlet.ClientInputProducer
getId
 
Methods inherited from interface echopoint.ui.util.PeerDelegate
getId
 

Constructor Detail

TitleBarUI

public TitleBarUI()
Method Detail

register

public static void register()
Registers the Component with its peer bindings


clientAction

public void clientAction(java.lang.String action)
Description copied from interface: ClientActionProducer
Called when the user causes an action from the client.

Specified by:
clientAction in interface ClientActionProducer
Parameters:
action - The action command generated by the client.
See Also:
ClientActionProducer.clientAction(java.lang.String)

clientInput

public void clientInput(java.lang.String input)
Called when the client state has to be saved. Will only be called when the titlebar UI is in client mode.

Specified by:
clientInput in interface ClientInputProducer
Parameters:
input - The data in the hidden input field in the controller form as last known.
See Also:
ClientInputProducer.clientInput(java.lang.String)

propertyChange

public void propertyChange(java.beans.PropertyChangeEvent e)
Description copied from class: EchoPointComponentPeer
Whenever a property changes, we call redraw() to cause the peer to be repainted.

In 99% of cases, this is actually what you want to do.

Specified by:
propertyChange in interface java.beans.PropertyChangeListener
Overrides:
propertyChange in class EchoPointComponentPeer
See Also:
PropertyChangeListener.propertyChange(java.beans.PropertyChangeEvent)

registered

public void registered()
Description copied from class: EchoPointComponentPeer
This adds itself as a property change listener to the component, which calls redraw(), and then creates a ToolTipPopUpSupportHelper.

Specified by:
registered in interface ComponentPeer
Overrides:
registered in class EchoPointComponentPeer
See Also:
EchoPointComponentPeer.registered()

unregistered

public void unregistered()
Description copied from class: EchoPointComponentPeer
This removes the property change listener and then calls toolTipHelper.unregistered();. If there is an ImageManager, then all images are removed.

Specified by:
unregistered in interface ComponentPeer
Overrides:
unregistered in class EchoPointComponentPeer
See Also:
EchoPointComponentPeer.unregistered()

render

public void render(RenderingContext rc,
                   Element parent)
Description copied from interface: ComponentPeer
A method that should be overridden for the ComponentPeer to produce HTML output.

Specified by:
render in interface ComponentPeer
Overrides:
render in class AbstractComponentPeer
Parameters:
rc - A rendering context provided by the Connection.
parent - The element that will contain content rendered by this ComponentPeer.
See Also:
ComponentPeer.render(nextapp.echoservlet.RenderingContext, nextapp.echoservlet.html.Element)

setClientMode

public void setClientMode(boolean newClientMode,
                          java.lang.String newHideElementStr)
Puts the TitleBar peer into client mode or not. The hideElement is the html element to hide or shown when the titlebar is expanded or collapsed. This can be null in which case nothing is hidden or shown.

Parameters:
newClientMode -
newHideElementStr -

setDraggable

public void setDraggable(java.lang.String dragElementStr,
                         java.lang.String dragCustomFunction,
                         java.lang.String dragContextStr,
                         boolean useDragBackground,
                         boolean useDragWindow)
Sets the title bar as being draggable. This will then drag the HTML element passed in. If this value is null, then nothing will be draggable.

Parameters:
dragElementStr - - the id of the HTML element to drag
dragCustomFunction - - custom EPBE drag function
dragContextStr - - the custom JS drag context obejct
useDragBackground - - wheteher to use a drag background
useDragWindow - - whether to use a drag window at all