ch.uzh.ifi.attempto.acewiki.gui.editor
Class FormPane

java.lang.Object
  extended by nextapp.echo2.app.Component
      extended by nextapp.echo2.app.ContentPane
          extended by ch.uzh.ifi.attempto.acewiki.gui.editor.FormPane
All Implemented Interfaces:
java.io.Serializable, java.util.EventListener, nextapp.echo2.app.event.ActionListener, nextapp.echo2.app.Pane, nextapp.echo2.app.PaneContainer, nextapp.echo2.app.RenderIdSupport
Direct Known Subclasses:
NounForm, NounOfForm, ProperNameForm, TrAdjForm, VerbForm

public abstract class FormPane
extends nextapp.echo2.app.ContentPane
implements nextapp.echo2.app.event.ActionListener

This abstract class contains the basic structure for forms to create and modify words (represented by ontology elements).

Author:
Tobias Kuhn
See Also:
Serialized Form

Field Summary
 
Fields inherited from class nextapp.echo2.app.ContentPane
PROPERTY_BACKGROUND_IMAGE, PROPERTY_HORIZONTAL_SCROLL, PROPERTY_INSETS, PROPERTY_VERTICAL_SCROLL
 
Fields inherited from class nextapp.echo2.app.Component
CHILDREN_CHANGED_PROPERTY, ENABLED_CHANGED_PROPERTY, FOCUS_TRAVERSAL_INDEX_CHANGED_PROPERTY, FOCUS_TRAVERSAL_PARTICIPANT_CHANGED_PROPERTY, LAYOUT_DIRECTION_CHANGED_PROPERTY, LOCALE_CHANGED_PROPERTY, PROPERTY_BACKGROUND, PROPERTY_FONT, PROPERTY_FOREGROUND, PROPERTY_LAYOUT_DATA, STYLE_CHANGED_PROPERTY, STYLE_NAME_CHANGED_PROPERTY, VISIBLE_CHANGED_PROPERTY
 
Constructor Summary
protected FormPane(WindowPane window, Wiki wiki, nextapp.echo2.app.event.ActionListener actionListener)
          Initializes the form pane.
 
Method Summary
 void actionPerformed(nextapp.echo2.app.event.ActionEvent e)
           
protected  void addRow(java.lang.String labelText, nextapp.echo2.app.Component component, java.lang.String explanation, boolean required)
          Adds a new row to the form.
protected  void finished(OntologyElement el)
          This method should be called when the saving process is finished successfully.
protected  void finished(OntologyElement el, int wordNumber)
          This method should be called when the saving process is finished successfully.
protected  Wiki getWiki()
          Returns the wiki instance.
protected static boolean isValidString(java.lang.String s)
          Returns true if the string is a valid to be used as a word form.
protected static java.lang.String normalize(java.lang.String s)
          Normalizes the string.
protected abstract  void save()
          This method should try to save the word with the current properties and should show error messages if this is not successful.
protected  void setIconRow(java.lang.String iconName, java.lang.String text)
          Sets the icon row.
protected  void showErrorMessage(java.lang.String text)
          Shows an error message.
 
Methods inherited from class nextapp.echo2.app.ContentPane
getBackgroundImage, getHorizontalScroll, getInsets, getVerticalScroll, isValidChild, isValidParent, processInput, setBackgroundImage, setHorizontalScroll, setInsets, setVerticalScroll
 
Methods inherited from class nextapp.echo2.app.Component
add, add, addPropertyChangeListener, addPropertyChangeListener, dispose, firePropertyChange, getApplicationInstance, getBackground, getComponent, getComponent, getComponentCount, getComponents, getEventListenerList, getFocusTraversalIndex, getFont, getForeground, getId, getIndexedProperty, getLayoutData, getLayoutDirection, getLocale, getParent, getProperty, getRenderId, getRenderIndexedProperty, getRenderIndexedProperty, getRenderLayoutDirection, getRenderLocale, getRenderProperty, getRenderProperty, getStyle, getStyleName, getVisibleComponent, getVisibleComponentCount, getVisibleComponents, hasEventListenerList, indexOf, init, isAncestorOf, isEnabled, isFocusTraversalParticipant, isRegistered, isRenderEnabled, isRenderVisible, isVisible, remove, remove, removeAll, removePropertyChangeListener, removePropertyChangeListener, setBackground, setEnabled, setFocusTraversalIndex, setFocusTraversalParticipant, setFont, setForeground, setId, setIndexedProperty, setLayoutData, setLayoutDirection, setLocale, setProperty, setRenderId, setStyle, setStyleName, setVisible, validate, verifyInput, visibleIndexOf
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FormPane

protected FormPane(WindowPane window,
                   Wiki wiki,
                   nextapp.echo2.app.event.ActionListener actionListener)
Initializes the form pane.

Parameters:
window - The host window.
wiki - The wiki instance.
actionListener - The actionlistener.
Method Detail

getWiki

protected Wiki getWiki()
Returns the wiki instance.

Returns:
The wiki instance.

save

protected abstract void save()
This method should try to save the word with the current properties and should show error messages if this is not successful. In the case of success, one of the finished-methods has to be called.

See Also:
finished(OntologyElement), finished(OntologyElement, int)

finished

protected void finished(OntologyElement el)
This method should be called when the saving process is finished successfully.

Parameters:
el - The created or modified ontology element.

finished

protected void finished(OntologyElement el,
                        int wordNumber)
This method should be called when the saving process is finished successfully.

Parameters:
el - The created or modified ontology element.
wordNumber - The word form id.

addRow

protected void addRow(java.lang.String labelText,
                      nextapp.echo2.app.Component component,
                      java.lang.String explanation,
                      boolean required)
Adds a new row to the form.

Parameters:
labelText - The text for the label shown on the left hand side of the component.
component - The component, i.e. a text field.
explanation - An explanation text shown under the component.
required - Defines whether the component should be marked as required.

setIconRow

protected void setIconRow(java.lang.String iconName,
                          java.lang.String text)
Sets the icon row. The icon row is shown at the top of the form and shows an icon of the ontological structure that is represented by the word. On the right hand side of the icon, an explanatory text is shown.

Parameters:
iconName - The name of the icon, one of "individual", "concept", or "role".
text - The explanatory text.

showErrorMessage

protected void showErrorMessage(java.lang.String text)
Shows an error message.

Parameters:
text - The error text.

actionPerformed

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

normalize

protected static java.lang.String normalize(java.lang.String s)
Normalizes the string. All white spaces are replaced by underscores. Afterwards, leading and trailing underscores are removed and successive underscores are replaced by just one underscore.

Parameters:
s - The string to be normalized.
Returns:
The normalized string.

isValidString

protected static boolean isValidString(java.lang.String s)
Returns true if the string is a valid to be used as a word form. The first character must be one of a-z, A-Z. The following characters have to be one of a-z, A-Z, 0-9, -, _.

Parameters:
s - The string to be checked for validity.
Returns:
true if the string is valid.


Copyright 2008, Attempto Group, University of Zurich (see http://attempto.ifi.uzh.ch)