ch.uzh.ifi.attempto.acewiki
Class Wiki

java.lang.Object
  extended by ch.uzh.ifi.attempto.acewiki.Wiki
All Implemented Interfaces:
echopoint.externalevent.ExternalEventListener, java.io.Serializable, java.util.EventListener, nextapp.echo.app.event.ActionListener

public class Wiki
extends java.lang.Object
implements nextapp.echo.app.event.ActionListener, echopoint.externalevent.ExternalEventListener

This class represents an AceWiki wiki instance (including its graphical user interface). There is such a wiki object for every wiki user.

Author:
Tobias Kuhn
See Also:
Serialized Form

Method Summary
 void actionPerformed(nextapp.echo.app.event.ActionEvent e)
           
 void back()
          Go to the previous page in the history.
 void clearCookie(java.lang.String name)
          Clears the given cookie on the client.
 void dispose()
          Cleans up when the object is no longer used.
 void enqueueStrongAsyncTask(java.lang.String title, java.lang.String message, Task task)
          Runs the task in an asynchronous way and shows a wait window while it is executed.
 void enqueueTask(java.lang.Runnable task)
          Runs the task without showing a wait window while it is executed.
 void enqueueWeakAsyncTask(Task task)
          Runs the task in an asynchronous way without showing a wait window.
 void externalEvent(echopoint.externalevent.ExternalEvent e)
           
 void forward()
          Go to the next page in the history.
 nextapp.echo.app.ApplicationInstance getApplication()
          Returns the application instance object of this wiki.
 nextapp.echo.app.ContentPane getContentPane()
          Returns the content pane containing the wiki GUI.
 java.lang.String getCookie(java.lang.String name)
          Returns the value of the cookie on the client, or "" if there is no such cookie.
 AceWikiEngine getEngine()
          Returns the AceWiki engine.
static nextapp.echo.app.ResourceImageReference getImage(java.lang.String fileName)
          Returns an image reference for a file in the AceWiki image directory with the given file name.
static java.lang.String getInfo(java.lang.String key)
          Returns information about AceWiki, like the version number and the release date.
 java.lang.String getLanguage()
          Returns the language of this wiki instance.
 LanguageHandler getLanguageHandler()
          Returns the language handler.
 Logger getLogger()
          Returns the logger object.
 Ontology getOntology()
          Returns the ontology;
 java.util.List<OntologyElement> getOntologyElements()
          Returns all ontology elements.
 OntologyExportManager getOntologyExportManager()
          Returns the ontology export manager.
 java.lang.String getParameter(java.lang.String paramName)
          Returns the value of the given parameter.
 User getUser()
          Returns the user of this wiki object.
 UserBase getUserBase()
          Returns the user base for this wiki.
 boolean isEditable()
          Returns whether the wiki is in the current situation editable.
 boolean isLoginEnabled()
          Returns whether the login features are enabled.
 boolean isLoginRequiredForEditing()
          Returns whether login is required for editing the wiki data.
 boolean isLoginRequiredForViewing()
          Returns whether login is required for viewing the wiki data.
 boolean isReadOnly()
          Returns true if this wiki is set to be read-only.
 boolean isUserRegistrationOpen()
          Returns whether the user registration is open to everyone.
 void lock(nextapp.echo.app.event.ActionListener lockedListener)
          This methods locks the general buttons of the wiki interface.
 void log(java.lang.String type, java.lang.String text)
          Writes the log entry to the log file.
 void login(User user, boolean stayLoggedIn)
          Logs in the given user.
 void logout()
          Logs out the current user.
 void refresh()
          Refreshes the current page.
 void removeWindow(nextapp.echo.app.WindowPane window)
          Removes the window.
 void setCookie(java.lang.String name, java.lang.String value)
          Sets a cookie on the client.
 void setUser(User user)
          Sets the user.
 void showAboutPage()
          Show the about page.
 void showCreatorWindow(java.lang.String type, int wordNumber, nextapp.echo.app.event.ActionListener actionListener)
          Shows a word creator window for the given word type and number.
 void showEditorWindow(OntologyElement element)
          Shows a word editor window.
 void showIndexPage()
          Show the index page.
 void showLoginWindow()
          Shows the login window.
 void showPage(OntologyElement e)
          Switches to the page of the given ontology element.
 void showPage(WikiPage page)
          Switches to the given page.
 void showSearchPage()
          Show the search page.
 void showStartPage()
          Show the start page.
 void showWindow(nextapp.echo.app.WindowPane window)
          Shows the window.
 void unlock()
          Unlocks the wiki interface, if it has been locked before.
 void update()
          Updates the GUI.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getContentPane

public nextapp.echo.app.ContentPane getContentPane()
Returns the content pane containing the wiki GUI.

Returns:
The content pane.

getApplication

public nextapp.echo.app.ApplicationInstance getApplication()
Returns the application instance object of this wiki.

Returns:
The application instance.

getParameter

public java.lang.String getParameter(java.lang.String paramName)
Returns the value of the given parameter. These parameters are defined in the web.xml file of the web application.

Parameters:
paramName - The parameter name.
Returns:
The value of the parameter.

isLoginEnabled

public boolean isLoginEnabled()
Returns whether the login features are enabled.

Returns:
true if login is enabled.

isLoginRequiredForViewing

public boolean isLoginRequiredForViewing()
Returns whether login is required for viewing the wiki data.

Returns:
true if login is required for viewing.

isLoginRequiredForEditing

public boolean isLoginRequiredForEditing()
Returns whether login is required for editing the wiki data.

Returns:
true if login is required for editing.

isUserRegistrationOpen

public boolean isUserRegistrationOpen()
Returns whether the user registration is open to everyone.

Returns:
true if the user registration is open.

isEditable

public boolean isEditable()
Returns whether the wiki is in the current situation editable. This depends on the fact whether a user is logged in and whether login is required for editing the wiki data.

Returns:
true if the wiki is editable.

isReadOnly

public boolean isReadOnly()
Returns true if this wiki is set to be read-only.

Returns:
true if this wiki is read-only.

showWindow

public void showWindow(nextapp.echo.app.WindowPane window)
Shows the window.

Parameters:
window - The window to be shown.

showEditorWindow

public void showEditorWindow(OntologyElement element)
Shows a word editor window.

Parameters:
element - The ontology element to be edited.

showCreatorWindow

public void showCreatorWindow(java.lang.String type,
                              int wordNumber,
                              nextapp.echo.app.event.ActionListener actionListener)
Shows a word creator window for the given word type and number.

Parameters:
type - The word type.
wordNumber - The word number.
actionListener - The actionlistener.

removeWindow

public void removeWindow(nextapp.echo.app.WindowPane window)
Removes the window.

Parameters:
window - The window to be removed.

showLoginWindow

public void showLoginWindow()
Shows the login window.


showPage

public void showPage(WikiPage page)
Switches to the given page.

Parameters:
page - The page to switch to.

showPage

public void showPage(OntologyElement e)
Switches to the page of the given ontology element.

Parameters:
e - The ontology element the page of which should be shown.

back

public void back()
Go to the previous page in the history.


forward

public void forward()
Go to the next page in the history.


showStartPage

public void showStartPage()
Show the start page.


showIndexPage

public void showIndexPage()
Show the index page.


showSearchPage

public void showSearchPage()
Show the search page.


showAboutPage

public void showAboutPage()
Show the about page.


getOntology

public Ontology getOntology()
Returns the ontology;

Returns:
The ontology.

getOntologyExportManager

public OntologyExportManager getOntologyExportManager()
Returns the ontology export manager.

Returns:
The ontology export manager.

getUserBase

public UserBase getUserBase()
Returns the user base for this wiki.

Returns:
The user base.

getOntologyElements

public java.util.List<OntologyElement> getOntologyElements()
Returns all ontology elements. The list is a copy of the internal list.

Returns:
A list of all ontology elements.

update

public void update()
Updates the GUI.


refresh

public void refresh()
Refreshes the current page.


actionPerformed

public void actionPerformed(nextapp.echo.app.event.ActionEvent e)
Specified by:
actionPerformed in interface nextapp.echo.app.event.ActionListener

externalEvent

public void externalEvent(echopoint.externalevent.ExternalEvent e)
Specified by:
externalEvent in interface echopoint.externalevent.ExternalEventListener

log

public void log(java.lang.String type,
                java.lang.String text)
Writes the log entry to the log file.

Parameters:
type - The type of the log entry.
text - The text of the log entry.

login

public void login(User user,
                  boolean stayLoggedIn)
Logs in the given user.

Parameters:
user - The user to log in.
stayLoggedIn - Defines whether the user should stay logged in or not.

logout

public void logout()
Logs out the current user.


getUser

public User getUser()
Returns the user of this wiki object.

Returns:
The user.

setUser

public void setUser(User user)
Sets the user.

Parameters:
user - The user.

setCookie

public void setCookie(java.lang.String name,
                      java.lang.String value)
Sets a cookie on the client.

Parameters:
name - The name of the cookie.
value - The value of the cookie.

clearCookie

public void clearCookie(java.lang.String name)
Clears the given cookie on the client.

Parameters:
name - The name of the cookie.

getCookie

public java.lang.String getCookie(java.lang.String name)
Returns the value of the cookie on the client, or "" if there is no such cookie.

Parameters:
name - The name of the cookie.
Returns:
The value of the cookie.

getEngine

public AceWikiEngine getEngine()
Returns the AceWiki engine.

Returns:
The AceWiki engine.

getLanguage

public java.lang.String getLanguage()
Returns the language of this wiki instance.

Returns:
The name of the language.

getLanguageHandler

public LanguageHandler getLanguageHandler()
Returns the language handler.

Returns:
The language handler.

getLogger

public Logger getLogger()
Returns the logger object.

Returns:
The logger object.

enqueueTask

public void enqueueTask(java.lang.Runnable task)
Runs the task without showing a wait window while it is executed.

Parameters:
task - The task.

enqueueStrongAsyncTask

public void enqueueStrongAsyncTask(java.lang.String title,
                                   java.lang.String message,
                                   Task task)
Runs the task in an asynchronous way and shows a wait window while it is executed. The task is treated as a strong task that takes precedence over weak tasks.

Parameters:
title - The title of the wait window.
message - The message of the wait window.
task - The task.

enqueueWeakAsyncTask

public void enqueueWeakAsyncTask(Task task)
Runs the task in an asynchronous way without showing a wait window. The task is treated as a weak task that can be overtaken by strong tasks.

Parameters:
task - The task.

getInfo

public static java.lang.String getInfo(java.lang.String key)
Returns information about AceWiki, like the version number and the release date. This information is read from the file "acewiki.properties".

Parameters:
key - The key string.
Returns:
The value for the given key.

dispose

public void dispose()
Cleans up when the object is no longer used.


lock

public void lock(nextapp.echo.app.event.ActionListener lockedListener)
This methods locks the general buttons of the wiki interface. When one of these buttons is pressed, the locked-listener is called.

Parameters:
lockedListener - The listener to be called when one of the buttons is pressed.

unlock

public void unlock()
Unlocks the wiki interface, if it has been locked before.


getImage

public static nextapp.echo.app.ResourceImageReference getImage(java.lang.String fileName)
Returns an image reference for a file in the AceWiki image directory with the given file name.

Parameters:
fileName - The name of the image file.
Returns:
The image reference.


Copyright 2008-2012, AceWiki developers