net.sf.doolin.gui.window.support
Class AbstractGUIWindow<B>

java.lang.Object
  extended by net.sf.doolin.gui.window.support.AbstractGUIWindow<B>
Type Parameters:
B - Type of the window data
All Implemented Interfaces:
PropertyContainer, GUIWindow<B>
Direct Known Subclasses:
AbstractRootPaneGUIWindow

public abstract class AbstractGUIWindow<B>
extends Object
implements GUIWindow<B>

Utility ancestor for application windows.

Author:
Damien Coraboeuf

Constructor Summary
AbstractGUIWindow()
           
 
Method Summary
 void addGUIWindowListener(GUIWindowListener<B> listener)
          Adds a listener for the window
 void addView(GUIView<?> view)
          Registers a new view in this window
protected abstract  void build()
          Builds the window.
 void build(GUIApplication application, GUIWindowDescriptor<B> windowDescriptor, B model)
          Builds and initializes the window.
 boolean canClose()
          Tries to close all views
 void close()
          Notifies the window descriptor.
 ActionContext getActionContext()
          Gets the action context for this window
 GUIApplication getApplication()
          Gets the application.
 String getId()
          Gets the ID for this window
 Collection<? extends GUIView<?>> getOpenViews()
          List of open views
 Object getProperty(Object key)
          Retrieves a property from this view
<V> GUIView<V>
getView(String viewId)
          Gets an already opened view
 B getWindowData()
          Gets the model.
 GUIWindowDescriptor<B> getWindowDescriptor()
          Gets the window descriptor.
protected  List<GUIWindowListener<B>> getWindowListeners()
          Gets the list of window listeners, those of the descriptor plus the ones associated with this window.
 boolean isClosed()
          Checks if the window is closed
 void onPostCreate()
          Does nothing
 void removeView(GUIView<?> view)
          Hides a view
 void setProperty(Object key, Object value)
          Attaches a property to the view.
 void showView(GUIView<?> view)
          Activates a 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.window.GUIWindow
display, getWindowPanel, installMenuBar, installToolBar, setWindowIcon, setWindowTitle, uninstallMenuBar, uninstallToolBar
 

Constructor Detail

AbstractGUIWindow

public AbstractGUIWindow()
Method Detail

addGUIWindowListener

public void addGUIWindowListener(GUIWindowListener<B> listener)
Description copied from interface: GUIWindow
Adds a listener for the window

Specified by:
addGUIWindowListener in interface GUIWindow<B>
Parameters:
listener - Window listener

addView

public void addView(GUIView<?> view)
Description copied from interface: GUIWindow
Registers a new view in this window

Specified by:
addView in interface GUIWindow<B>
Parameters:
view - View to register

build

protected abstract void build()
Builds the window.

See Also:
getApplication(), getWindowData()

build

public void build(GUIApplication application,
                  GUIWindowDescriptor<B> windowDescriptor,
                  B model)
Builds and initializes the window. Builds and initializes the window.

Specified by:
build in interface GUIWindow<B>
Parameters:
application - the application
windowDescriptor - the window descriptor
model - the model

canClose

public boolean canClose()
Tries to close all views

Specified by:
canClose in interface GUIWindow<B>
Returns:
true if the window can be closed

close

public void close()
Notifies the window descriptor. Closes the window.

Specified by:
close in interface GUIWindow<B>

getActionContext

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

Specified by:
getActionContext in interface GUIWindow<B>
Returns:
Action context

getApplication

public GUIApplication getApplication()
Gets the application.

Specified by:
getApplication in interface GUIWindow<B>
Returns:
the application

getId

public String getId()
Gets the ID for this window

Specified by:
getId in interface GUIWindow<B>
Returns:
ID

getOpenViews

public Collection<? extends GUIView<?>> getOpenViews()
Description copied from interface: GUIWindow
List of open views

Specified by:
getOpenViews in interface GUIWindow<B>
Returns:
List of open views

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

getView

public <V> GUIView<V> getView(String viewId)
Description copied from interface: GUIWindow
Gets an already opened view

Specified by:
getView in interface GUIWindow<B>
Type Parameters:
V - Type of data for the view
Parameters:
viewId - View ID
Returns:
Already opened view or null.

getWindowData

public B getWindowData()
Gets the model.

Specified by:
getWindowData in interface GUIWindow<B>
Returns:
the model

getWindowDescriptor

public GUIWindowDescriptor<B> getWindowDescriptor()
Gets the window descriptor.

Specified by:
getWindowDescriptor in interface GUIWindow<B>
Returns:
the window descriptor

getWindowListeners

protected List<GUIWindowListener<B>> getWindowListeners()
Gets the list of window listeners, those of the descriptor plus the ones associated with this window.


removeView

public void removeView(GUIView<?> view)
Description copied from interface: GUIWindow
Hides a view

Specified by:
removeView in interface GUIWindow<B>
Parameters:
view - View to hide

isClosed

public boolean isClosed()
Description copied from interface: GUIWindow
Checks if the window is closed

Specified by:
isClosed in interface GUIWindow<B>
Returns:
true if the window is closed

onPostCreate

public void onPostCreate()
Does nothing

Specified by:
onPostCreate in interface GUIWindow<B>

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

showView

public void showView(GUIView<?> view)
Description copied from interface: GUIWindow
Activates a view

Specified by:
showView in interface GUIWindow<B>
Parameters:
view - View to activate


Copyright © 2011. All Rights Reserved.