|
JAC project AOPSYS CEDRIC & LIP6 labs |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.objectweb.jac.aspects.gui.web.WebDisplay
This class provides a server for web clients using a thin client
protocol and implements the Display
interface to
assume data inputs and outputs between JAC objects and web clients.
This inferface is typically used by Java web clients and more
specifically by servlets. The implementation provided by JAC is
JacServlet
.
Field Summary | |
static String |
REQUEST
|
static String |
RESPONSE
|
Constructor Summary | |
WebDisplay(ViewFactory factory,
String sessionId)
Create a new web display |
Method Summary | |
void |
addTimedoutDialog(DialogView dialog)
Add a dialog to the list of timedout dialogs |
void |
applicationStarted()
Notifies the display that a new application has just started. |
Object[] |
buildParameterValues(AbstractMethodItem method,
String[] params)
|
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. |
static HttpServer |
getHttpServer()
|
static JacRequest |
getRequest()
Returns the current JacRequest contained in the context. |
static HttpServletResponse |
getResponse()
Returnsx the servlet response of the current collaboration |
String |
getServletName()
Returns the name of the servlet |
Session |
getSession()
|
View |
getView(String id)
Returns the view registered with a given id |
String |
getViewID(View view)
Gets the ID of a registered view. |
boolean |
isTimedout(String viewID)
Tells wether a view ID corresponds to a timedout dialog |
void |
newObject(Object object)
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. |
static void |
readValues(DisplayContext editors,
JacRequest request,
boolean commit)
Read values of field editors from http request |
void |
refresh()
Refresh the display. |
String |
registerView(View view)
Compute an id for a view and register it. |
void |
setDisplayID(String displayID)
Sets the ID (a unique string identifier) of the current display. |
static void |
setRequest(JacRequest request)
Sets the current JacRequest in the context. |
static void |
setResponse(HttpServletResponse response)
Set the servlet response for the current collaboration |
void |
setServletName(String name)
Set the name of the servlet |
void |
show(Object object)
Shows the given object on the display. |
protected void |
show(Object object,
boolean newWindow)
|
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 title,
String message)
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 title,
String message)
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. |
boolean |
showModal(View objectView,
DisplayContext context,
String title,
String header,
Object parent,
boolean okButton,
boolean cancelButton,
boolean closeButton)
|
void |
showStatus(String message)
|
static void |
startWebServer()
Start the web server if it is not already started |
static void |
startWebServer(String application,
String[] guiIDs,
int defaultPort)
Start JAC's internal webserver. |
void |
unregisterView(View view)
Unregister a view. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final String RESPONSE
public static final String REQUEST
Constructor Detail |
public WebDisplay(ViewFactory factory, String sessionId)
factory
- the ViewFactory of the displaysessionId
- the sessionId of the displayMethod Detail |
public static void setResponse(HttpServletResponse response)
response
- the servlet response objectpublic static HttpServletResponse getResponse()
public static void setRequest(JacRequest request)
request
- the JacRequetspublic static JacRequest getRequest()
public static void readValues(DisplayContext editors, JacRequest request, boolean commit)
editors
- field editors for which to read the valuerequest
- the http request where to read values fromcommit
- if true, commit() will be called on the field
editors after readValue()HTMLEditor.readValue(Object)
,
HTMLEditor.commit()
public void fullRefresh()
Display
fullRefresh
in interface Display
public void showCustomized(String id, Object object)
Display
showCustomized
in interface Display
id
- the id of the customized GUI to showobject
- the CustomizedGUI to showCustomizedGUI
public void showCustomized(String id, Object object, Map panels)
Display
showCustomized
in interface Display
id
- the id of the customized GUI to showobject
- the CustomizedGUI to showpanels
- contents of panels ( panelID -> object)CustomizedGUI
public void show(Object object)
Display
The showed object is considered as a result.
On contrary to showModal
, this method does not
stop the client thread execution.
show
in interface Display
object
- the object to showprotected void show(Object object, boolean newWindow)
public void openView(Object object)
Display
On contrary to showModal
, this method does not
stop the client thread execution.
openView
in interface Display
object
- the object to showpublic void newObject(Object object)
Display
Depending on the display's nature and functionality, this notification can simply be ignored.
newObject
in interface Display
object
- the newly created objectpublic boolean showModal(Object object, String title, String header, Object parent, boolean okButton, boolean cancelButton, boolean closeButton)
Display
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).
showModal
in interface Display
object
- the object to showtitle
- the window title if a window is openedheader
- a header messageparent
- the parent windowokButton
- if true, a validation button is addedcancelButton
- if true, a cancellation button is addedcloseButton
- if true, a closing button is added
public boolean showModal(Object object, String viewType, String[] viewParams, String title, String header, Object parent, boolean okButton, boolean cancelButton, boolean closeButton)
showModal
in interface Display
public boolean showModal(View objectView, DisplayContext context, String title, String header, Object parent, boolean okButton, boolean cancelButton, boolean closeButton)
public boolean showInput(Object substance, AbstractMethodItem method, Object[] parameters)
Display
This operation stops the client thread.
showInput
in interface Display
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
public boolean showMessage(String message, String title, boolean okButton, boolean cancelButton, boolean closeButton)
Display
showMessage
in interface Display
title
- the window title if a window is openedokButton
- if true, a validation button is addedcancelButton
- if true, a cancellation button is addedcloseButton
- if true, a closing button is added
public void showMessage(String title, String message)
Display
showMessage
in interface Display
Display.showError(String,String)
public void showError(String title, String message)
Display
showError
in interface Display
Display.showMessage(String,String)
public void showStatus(String message)
public void applicationStarted()
Display
At this step, all the root objects of the application have been created and it is time to open the main view if any.
applicationStarted
in interface Display
public CustomizedView getCustomizedView(String customizedID)
CustomizedDisplay
getCustomizedView
in interface CustomizedDisplay
customizedID
- the id of the CustomizedView
public Collection getCustomizedViews()
CustomizedDisplay
getCustomizedViews
in interface CustomizedDisplay
public ViewFactory getFactory()
CustomizedDisplay
A view factory implements the creation methods for different visualisation supports (e.g. SWING, WEB, ...).
getFactory
in interface CustomizedDisplay
public String getDisplayID()
Display
getDisplayID
in interface Display
public void setDisplayID(String displayID)
Display
setDisplayID
in interface Display
displayID
- a string (should be unique)public void close()
Display
close
in interface Display
public Object[] buildParameterValues(AbstractMethodItem method, String[] params)
public void refresh()
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).
refresh
in interface Display
WebDisplay
public static HttpServer getHttpServer()
public static void startWebServer(String application, String[] guiIDs, int defaultPort) throws IOException, MultiException
application
- name of the applicationguiIDs
- name of windows. gui_name[:port]defaultPort
- default TCP port on which to listen
IOException
MultiException
public static void startWebServer() throws MultiException
MultiException
public String registerView(View view)
view
- the view to register
unregisterView(View)
,
getView(String)
public void unregisterView(View view)
view
- the view to registerregisterView(View)
public View getView(String id)
id
- the id of the view
registerView(View)
public String getViewID(View view)
view
- the view
public void addTimedoutDialog(DialogView dialog)
CustomizedDisplay
addTimedoutDialog
in interface CustomizedDisplay
dialog
- the timedout dialogpublic boolean isTimedout(String viewID)
public void setServletName(String name)
name
- the name of the servletpublic String getServletName()
public void closeWindow(View window)
CustomizedDisplay
closeWindow
in interface CustomizedDisplay
window
- view window to closepublic Session getSession()
|
Contact JAC development team: Renaud Pawlak Lionel Seinturier Laurent Martelli |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |