JAC project
AOPSYS
CEDRIC & LIP6 labs

org.objectweb.jac.aspects.gui.swing
Class SwingDisplay

java.lang.Object
  |
  +--org.objectweb.jac.aspects.gui.swing.SwingDisplay
All Implemented Interfaces:
CustomizedDisplay, Display

public class SwingDisplay
extends Object
implements CustomizedDisplay


Constructor Summary
SwingDisplay(ViewFactory factory)
           
 
Method Summary
 void addTimedoutDialog(DialogView dialog)
          Add a dialog to the list of timedout dialogs
 boolean addViewFor(Object substance)
           
 boolean addViewFor(Object substance, String title, String header, Object parent, boolean okButton, boolean cancelButton, boolean closeButton)
          Adds a view for a given Jac object.
 void applicationStarted()
          Notifies the display that a new application has just started.
 void close()
          Closes this display.
 void closeWindow(View window)
          Close a window.
 void fullRefresh()
          Rebuilds all customized GUI windows.
 CustomizedView getCustomizedView(String customizedID)
          Returns a CustomizedView identified by its id
 Collection getCustomizedViews()
          Returns a collection of all CustomizedViews contained in the display.
 String getDisplayID()
          Gets the ID (a unique string identifier) of the current display.
 ViewFactory getFactory()
          Returns the ViewFactory of the display.
 void newObject(Object newObject)
          Notifies the display that a new object has been created.
 void openView(Object object)
          Shows the given object on the display by opening a new core view.
 void refresh()
          Refresh the display.
 void saveStreamToFile(Reader reader)
          show a save dialog and save the stream into the selected file
 void setDisplayID(String displayID)
          Sets the ID (a unique string identifier) of the current display.
 void show(Object object)
          Shows the given object on the display.
 void showCustomized(String id, Object object)
          Show a customized Gui.
 void showCustomized(String id, Object object, Map panels)
          Show a customized Gui.
 void showError(String message, String title)
          Show an error message to the user.
 boolean showInput(Object substance, AbstractMethodItem method, Object[] parameters)
          Asks the user to fill the parameters to prepare the invocation of the given method.
 void showMessage(String message, String title)
          Show a message to the user.
 boolean showMessage(String message, String title, boolean okButton, boolean cancelButton, boolean closeButton)
          Displays a message to the user.
 boolean showModal(Object object, String viewType, String[] viewParams, String title, String header, Object parent, boolean okButton, boolean cancelButton, boolean closeButton)
           
 boolean showModal(Object object, String title, String header, Object parent, boolean okButton, boolean cancelButton, boolean closeButton)
          Shows the given object on the display and waits for a user input.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SwingDisplay

public SwingDisplay(ViewFactory factory)
Method Detail

addTimedoutDialog

public void addTimedoutDialog(DialogView dialog)
Description copied from interface: CustomizedDisplay
Add a dialog to the list of timedout dialogs

Specified by:
addTimedoutDialog in interface CustomizedDisplay
Parameters:
dialog - the timedout dialog

closeWindow

public void closeWindow(View window)
Description copied from interface: CustomizedDisplay
Close a window.

Specified by:
closeWindow in interface CustomizedDisplay
Parameters:
window - view window to close

fullRefresh

public void fullRefresh()
Description copied from interface: Display
Rebuilds all customized GUI windows.

Specified by:
fullRefresh in interface Display

showCustomized

public void showCustomized(String id,
                           Object object,
                           Map panels)
Description copied from interface: Display
Show a customized Gui.

Specified by:
showCustomized in interface Display
Parameters:
id - the id of the customized GUI to show
object - the CustomizedGUI to show
panels - contents of panels ( panelID -> object)
See Also:
CustomizedGUI

showCustomized

public void showCustomized(String id,
                           Object object)
Description copied from interface: Display
Show a customized Gui.

Specified by:
showCustomized in interface Display
Parameters:
id - the id of the customized GUI to show
object - the CustomizedGUI to show
See Also:
CustomizedGUI

getCustomizedView

public CustomizedView getCustomizedView(String customizedID)
Description copied from interface: CustomizedDisplay
Returns a CustomizedView identified by its id

Specified by:
getCustomizedView in interface CustomizedDisplay
Parameters:
customizedID - the id of the CustomizedView
Returns:
the customized if exists, null otherwise

getCustomizedViews

public Collection getCustomizedViews()
Description copied from interface: CustomizedDisplay
Returns a collection of all CustomizedViews contained in the display.

Specified by:
getCustomizedViews in interface CustomizedDisplay
Returns:
all the customized of the display

getFactory

public ViewFactory getFactory()
Description copied from interface: CustomizedDisplay
Returns the ViewFactory of the display.

A view factory implements the creation methods for different visualisation supports (e.g. SWING, WEB, ...).

Specified by:
getFactory in interface CustomizedDisplay
Returns:
the factory that is used for this display

show

public void show(Object object)
Description copied from interface: Display
Shows the given object on the display.

The showed object is considered as a result.

On contrary to showModal, this method does not stop the client thread execution.

Specified by:
show in interface Display
Parameters:
object - the object to show

showModal

public boolean showModal(Object object,
                         String viewType,
                         String[] viewParams,
                         String title,
                         String header,
                         Object parent,
                         boolean okButton,
                         boolean cancelButton,
                         boolean closeButton)
Specified by:
showModal in interface Display

showModal

public boolean showModal(Object object,
                         String title,
                         String header,
                         Object parent,
                         boolean okButton,
                         boolean cancelButton,
                         boolean closeButton)
Description copied from interface: Display
Shows the given object on the display and waits for a user input.

On contrary to show, this method stops the client thread execution and waits for a user input to continue (as an OK button click or a key pressing).

Specified by:
showModal in interface Display
Parameters:
object - the object to show
title - the window title if a window is opened
header - a header message
parent - the parent window
okButton - if true, a validation button is added
cancelButton - if true, a cancellation button is added
closeButton - if true, a closing button is added
Returns:
false if the user canceled

openView

public void openView(Object object)
Description copied from interface: Display
Shows the given object on the display by opening a new core view.

On contrary to showModal, this method does not stop the client thread execution.

Specified by:
openView in interface Display
Parameters:
object - the object to show

showInput

public boolean showInput(Object substance,
                         AbstractMethodItem method,
                         Object[] parameters)
Description copied from interface: Display
Asks the user to fill the parameters to prepare the invocation of the given method.

This operation stops the client thread.

Specified by:
showInput in interface Display
Parameters:
substance - the object that contains the method (null if a constructor)
parameters - the parameters values; as an input, they can be set by the client to fill default values for these parameters; as an output, they must be used by the client as the actual parameter values to call the given method
Returns:
false if the user canceled

getDisplayID

public String getDisplayID()
Description copied from interface: Display
Gets the ID (a unique string identifier) of the current display.

Specified by:
getDisplayID in interface Display
Returns:
a string

setDisplayID

public void setDisplayID(String displayID)
Description copied from interface: Display
Sets the ID (a unique string identifier) of the current display.

Specified by:
setDisplayID in interface Display
Parameters:
displayID - a string (should be unique)

showMessage

public boolean showMessage(String message,
                           String title,
                           boolean okButton,
                           boolean cancelButton,
                           boolean closeButton)
Description copied from interface: Display
Displays a message to the user.

Specified by:
showMessage in interface Display
Parameters:
title - the window title if a window is opened
okButton - if true, a validation button is added
cancelButton - if true, a cancellation button is added
closeButton - if true, a closing button is added
Returns:
false if the user canceled

showMessage

public void showMessage(String message,
                        String title)
Description copied from interface: Display
Show a message to the user.

Specified by:
showMessage in interface Display
See Also:
Display.showError(String,String)

showError

public void showError(String message,
                      String title)
Description copied from interface: Display
Show an error message to the user.

Specified by:
showError in interface Display
See Also:
Display.showMessage(String,String)

refresh

public void refresh()
Description copied from interface: Display
Refresh the display.

This method is useful for some kind of displays when the refresh operation cannot be done automatically when the displayed objects states change (e.g. a web display).

Specified by:
refresh in interface Display
See Also:
WebDisplay

newObject

public void newObject(Object newObject)
Description copied from interface: Display
Notifies the display that a new object has been created.

Depending on the display's nature and functionality, this notification can simply be ignored.

Specified by:
newObject in interface Display
Parameters:
newObject - the newly created object

applicationStarted

public void applicationStarted()
Description copied from interface: Display
Notifies the display that a new application has just started.

At this step, all the root objects of the application have been created and it is time to open the main view if any.

Specified by:
applicationStarted in interface Display

close

public void close()
Description copied from interface: Display
Closes this display.

Specified by:
close in interface Display

saveStreamToFile

public void saveStreamToFile(Reader reader)
show a save dialog and save the stream into the selected file

Parameters:
reader - the stream to save

addViewFor

public boolean addViewFor(Object substance)

addViewFor

public boolean addViewFor(Object substance,
                          String title,
                          String header,
                          Object parent,
                          boolean okButton,
                          boolean cancelButton,
                          boolean closeButton)
Adds a view for a given Jac object.

Parameters:
substance - the object to add a view for
Returns:
true if the OK button or the close button were clicked.

Contact JAC development team:
Renaud Pawlak
Lionel Seinturier
Laurent Martelli