net.sf.doolin.gui.view.support
Class AbstractGUIView<V>

java.lang.Object
  extended by net.sf.doolin.gui.view.support.AbstractGUIView<V>
Type Parameters:
V - Type of object for the view
All Implemented Interfaces:
PropertyContainer, GUIView<V>
Direct Known Subclasses:
DefaultGUIView

public abstract class AbstractGUIView<V>
extends Object
implements GUIView<V>

Abstract view

Author:
Damien Coraboeuf

Constructor Summary
AbstractGUIView(GUIWindow<?> parentWindow, GUIViewDescriptor<V> viewDescriptor, V model)
          Constructor.
 
Method Summary
 void addViewListener(GUIViewListener<V> listener)
          Adds a listener for the view life-cycle
 void close()
          Actually closes the view
 boolean close(boolean force)
          Delegates to the view descriptor.
protected  void fireClosed()
          Fires that this view is closed.
protected  void fireInit()
          Fires that this view is initialised.
protected  void fireShown()
          Fires that this view is shown.
 ActionContext getActionContext()
          Gets the action context for this view
 GUIApplication getApplication()
          Gets the application.
 String getID()
          Gets the ID for the view
 GUIWindow<?> getParentWindow()
          Gets the parent window.
 Object getProperty(Object key)
          Retrieves a property from this view
 V getViewData()
          Gets the model.
 GUIViewDescriptor<V> getViewDescriptor()
          Gets the view descriptor.
protected  Collection<GUIViewListener<V>> getViewListenerArray()
          Gets the list of view listeners
 void init()
          This method when the view is created.
 boolean isClosed()
          Returns true if the view is closed.
 void removeViewListener(GUIViewListener<V> listener)
          Removes a listener for the view life-cycle
 void setProperty(Object key, Object value)
          Attaches a property to the view.
 void show()
          Shows the view
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.sf.doolin.gui.view.GUIView
getViewComponent, installToolBar
 

Constructor Detail

AbstractGUIView

public AbstractGUIView(GUIWindow<?> parentWindow,
                       GUIViewDescriptor<V> viewDescriptor,
                       V model)
Constructor.

Parameters:
parentWindow - Parent window
model - View model
viewDescriptor - the view descriptor
Method Detail

addViewListener

public void addViewListener(GUIViewListener<V> listener)
Description copied from interface: GUIView
Adds a listener for the view life-cycle

Specified by:
addViewListener in interface GUIView<V>
Parameters:
listener - Listener to add

close

public void close()
Description copied from interface: GUIView
Actually closes the view

Specified by:
close in interface GUIView<V>

close

public boolean close(boolean force)
Delegates to the view descriptor. Closes the view

Specified by:
close in interface GUIView<V>
Parameters:
force - true if the view must be closed.
Returns:
true if the view could be closed

fireClosed

protected void fireClosed()
Fires that this view is closed.

See Also:
GUIViewListener.onViewClosed(GUIView)

fireInit

protected void fireInit()
Fires that this view is initialised.

See Also:
GUIViewListener.onViewInit(GUIView)

fireShown

protected void fireShown()
Fires that this view is shown.

See Also:
GUIViewListener.onViewShown(GUIView)

getActionContext

public ActionContext getActionContext()
Description copied from interface: GUIView
Gets the action context for this view

Specified by:
getActionContext in interface GUIView<V>
Returns:
Action context

getApplication

public GUIApplication getApplication()
Gets the application.

Specified by:
getApplication in interface GUIView<V>
Returns:
the application

getID

public String getID()
Gets the ID for the view

Specified by:
getID in interface GUIView<V>
Returns:
ID
See Also:
GUIViewDescriptor.getID(Object)

getParentWindow

public GUIWindow<?> getParentWindow()
Gets the parent window.

Specified by:
getParentWindow in interface GUIView<V>
Returns:
the parent window

getProperty

public Object getProperty(Object key)
Retrieves a property from this view

Specified by:
getProperty in interface PropertyContainer
Parameters:
key - Property key
Returns:
Property value or null if not defined

getViewData

public V getViewData()
Gets the model.

Specified by:
getViewData in interface GUIView<V>
Returns:
the model

getViewDescriptor

public GUIViewDescriptor<V> getViewDescriptor()
Gets the view descriptor..

Specified by:
getViewDescriptor in interface GUIView<V>
Returns:
the view descriptor

getViewListenerArray

protected Collection<GUIViewListener<V>> getViewListenerArray()
Gets the list of view listeners

Returns:
View listeners

init

public void init()
Description copied from interface: GUIView
This method when the view is created.

Specified by:
init in interface GUIView<V>

isClosed

public boolean isClosed()
Description copied from interface: GUIView
Returns true if the view is closed.

Specified by:
isClosed in interface GUIView<V>
Returns:
true if the view is closed.

removeViewListener

public void removeViewListener(GUIViewListener<V> listener)
Description copied from interface: GUIView
Removes a listener for the view life-cycle

Specified by:
removeViewListener in interface GUIView<V>
Parameters:
listener - Listener to remove

setProperty

public void setProperty(Object key,
                        Object value)
Attaches a property to the view. If the value is null, the property will be removed from the view instead.

Specified by:
setProperty in interface PropertyContainer
Parameters:
key - Property key
value - Property value

show

public void show()
Description copied from interface: GUIView
Shows the view

Specified by:
show in interface GUIView<V>


Copyright © 2011. All Rights Reserved.