ch.uzh.ifi.attempto.preditor
Class PreditorWindow

java.lang.Object
  extended by nextapp.echo.app.Component
      extended by nextapp.echo.app.WindowPane
          extended by ch.uzh.ifi.attempto.preditor.PreditorWindow
All Implemented Interfaces:
java.io.Serializable, java.util.EventListener, nextapp.echo.app.event.ActionListener, nextapp.echo.app.event.WindowPaneListener, nextapp.echo.app.FloatingPane, nextapp.echo.app.ModalSupport, nextapp.echo.app.Pane, nextapp.echo.app.PaneContainer, nextapp.echo.app.RenderIdSupport

public class PreditorWindow
extends nextapp.echo.app.WindowPane
implements nextapp.echo.app.event.ActionListener, nextapp.echo.app.event.WindowPaneListener

This class represents a predictive editor window. The predictive editor enables easy creation of texts that comply with a certain grammar. The users can create such a text word-by-word by clicking on one of different menu items. The menu items are structured into menu blocks each of which has a name that is displayed above the menu block.

Author:
Tobias Kuhn
See Also:
Serialized Form

Field Summary
 
Fields inherited from class nextapp.echo.app.WindowPane
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE, INPUT_CLOSE, INPUT_MAXIMIZE, INPUT_MINIMIZE, PROPERTY_BACKGROUND_IMAGE, PROPERTY_BORDER, PROPERTY_CLOSABLE, PROPERTY_CLOSE_ICON, PROPERTY_CLOSE_ICON_INSETS, PROPERTY_CLOSE_ROLLOVER_ICON, PROPERTY_CONTENT_HEIGHT, PROPERTY_CONTENT_WIDTH, PROPERTY_CONTROLS_INSETS, PROPERTY_CONTROLS_SPACING, PROPERTY_DEFAULT_CLOSE_OPERATION, PROPERTY_HEIGHT, PROPERTY_ICON, PROPERTY_ICON_INSETS, PROPERTY_INSETS, PROPERTY_MAXIMIZE_ENABLED, PROPERTY_MAXIMIZE_ICON, PROPERTY_MAXIMIZE_ICON_INSETS, PROPERTY_MAXIMIZE_ROLLOVER_ICON, PROPERTY_MAXIMUM_HEIGHT, PROPERTY_MAXIMUM_WIDTH, PROPERTY_MINIMIZE_ENABLED, PROPERTY_MINIMIZE_ICON, PROPERTY_MINIMIZE_ICON_INSETS, PROPERTY_MINIMIZE_ROLLOVER_ICON, PROPERTY_MINIMUM_HEIGHT, PROPERTY_MINIMUM_WIDTH, PROPERTY_MOVABLE, PROPERTY_POSITION_X, PROPERTY_POSITION_Y, PROPERTY_RESIZABLE, PROPERTY_TITLE, PROPERTY_TITLE_BACKGROUND, PROPERTY_TITLE_BACKGROUND_IMAGE, PROPERTY_TITLE_FONT, PROPERTY_TITLE_FOREGROUND, PROPERTY_TITLE_HEIGHT, PROPERTY_TITLE_INSETS, PROPERTY_WIDTH, PROPERTY_Z_INDEX
 
Fields inherited from class nextapp.echo.app.Component
CHILD_VISIBLE_CHANGED_PROPERTY, CHILDREN_CHANGED_PROPERTY, ENABLED_CHANGED_PROPERTY, FOCUS_NEXT_ID_CHANGED_PROPERTY, FOCUS_PREVIOUS_ID_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
 
Fields inherited from interface nextapp.echo.app.ModalSupport
MODAL_CHANGED_PROPERTY
 
Constructor Summary
PreditorWindow(java.lang.String title, PredictiveParser parser)
          Creates a new predictive editor window using the given predictive parser.
 
Method Summary
 void actionPerformed(nextapp.echo.app.event.ActionEvent e)
           
 void addActionListener(nextapp.echo.app.event.ActionListener actionListener)
          Adds a new action-listener.
 void addText(java.lang.String text)
          Reads the text and adds it to the end of the current text as far as possible.
 void addTextElement(TextElement te)
          Adds the text element to the end of the text.
 void clearTokens()
          Removes all tokens.
 MenuCreator getMenuCreator()
          Returns the menu creator.
 PredictiveParser getPredictiveParser()
          Returns the predictive parser.
 TextContainer getTextContainer()
          Returns a copy of the text container object that contains the (partial) text that has been entered.
 TextOperator getTextOperator()
          Returns the text operator.
 int getTokenCount()
          Returns the number of tokens of the current (partial) text.
 void init()
           
 boolean isPossibleNextToken(java.lang.String token)
          Returns whether the given token is a possible next token.
 boolean isTextComplete()
          Returns true if the current text is a complete statement.
 void removeActionListener(nextapp.echo.app.event.ActionListener actionListener)
          Removes the action-listener.
 void removeAllActionListeners()
          Removes all action-listeners.
 void removeLastToken()
          Removes the last token.
 void setClearButtonVisible(boolean visible)
          Shows or hides the "clear" button.
 void setLogger(Logger logger)
          Sets the logger.
 void setMenuCreator(MenuCreator menuCreator)
          Sets the menu creator.
 void setTextAreaEndText(java.lang.String textAreaEndText)
          Sets the text to be shown in the text area at the end of the text entered by the user.
 void setTextAreaStartText(java.lang.String textAreaStartText)
          Sets the text to be shown in the text area in front of the text entered by the user.
 void setTextOperator(TextOperator textOperator)
          Sets the text operator.
 java.lang.String toString()
           
 void windowPaneClosing(nextapp.echo.app.event.WindowPaneEvent e)
           
 
Methods inherited from class nextapp.echo.app.WindowPane
addWindowPaneListener, fireWindowClosing, fireWindowMaximized, fireWindowMinimized, getBackgroundImage, getBorder, getCloseIcon, getCloseIconInsets, getCloseRolloverIcon, getContentHeight, getContentWidth, getControlsInsets, getControlsSpacing, getDefaultCloseOperation, getHeight, getIcon, getIconInsets, getInsets, getMaximizeIcon, getMaximizeIconInsets, getMaximizeRolloverIcon, getMaximumHeight, getMaximumWidth, getMinimizeIcon, getMinimizeIconInsets, getMinimizeRolloverIcon, getMinimumHeight, getMinimumWidth, getPositionX, getPositionY, getTitle, getTitleBackground, getTitleBackgroundImage, getTitleFont, getTitleForeground, getTitleHeight, getTitleInsets, getWidth, getZIndex, isClosable, isMaximizeEnabled, isMinimizeEnabled, isModal, isMovable, isResizable, isValidChild, isValidParent, processInput, removeWindowPaneListener, setBackgroundImage, setBorder, setClosable, setCloseIcon, setCloseIconInsets, setCloseRolloverIcon, setContentHeight, setContentWidth, setControlsInsets, setControlsSpacing, setDefaultCloseOperation, setHeight, setIcon, setIconInsets, setInsets, setMaximizeEnabled, setMaximizeIcon, setMaximizeIconInsets, setMaximizeRolloverIcon, setMaximumHeight, setMaximumWidth, setMinimizeEnabled, setMinimizeIcon, setMinimizeIconInsets, setMinimizeRolloverIcon, setMinimumHeight, setMinimumWidth, setModal, setMovable, setPositionX, setPositionY, setResizable, setTitle, setTitleBackground, setTitleBackgroundImage, setTitleFont, setTitleForeground, setTitleHeight, setTitleInsets, setWidth, setZIndex, userClose, userMaximize, userMinimize
 
Methods inherited from class nextapp.echo.app.Component
add, add, addPropertyChangeListener, addPropertyChangeListener, dispose, firePropertyChange, get, getApplicationInstance, getBackground, getComponent, getComponent, getComponentCount, getComponents, getEventListenerList, getFocusNextId, getFocusPreviousId, getFont, getForeground, getId, getIndex, getLayoutData, getLayoutDirection, getLocale, getLocalStyle, getParent, getRenderId, getRenderIndexedProperty, getRenderIndexedProperty, getRenderLocale, getRenderProperty, getRenderProperty, getStyle, getStyleName, getVisibleComponent, getVisibleComponentCount, getVisibleComponents, hasEventListenerList, indexOf, isAncestorOf, isEnabled, isFocusTraversalParticipant, isRegistered, isRenderEnabled, isRenderVisible, isVisible, remove, remove, removeAll, removePropertyChangeListener, removePropertyChangeListener, set, setBackground, setComponents, setEnabled, setFocusNextId, setFocusPreviousId, setFocusTraversalParticipant, setFont, setForeground, setId, setIndex, setLayoutData, setLayoutDirection, setLocale, setRenderId, setStyle, setStyleName, setVisible, validate, verifyInput, visibleIndexOf
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PreditorWindow

public PreditorWindow(java.lang.String title,
                      PredictiveParser parser)
Creates a new predictive editor window using the given predictive parser.

Parameters:
title - The title of the window.
parser - The predictive parser to be used. Do not modify this object while the preditor window is active!
Method Detail

setMenuCreator

public void setMenuCreator(MenuCreator menuCreator)
Sets the menu creator. DefaultMenuCreator is used by default.

Parameters:
menuCreator - The menu creator.

getMenuCreator

public MenuCreator getMenuCreator()
Returns the menu creator.

Returns:
The menu creator.

setTextOperator

public void setTextOperator(TextOperator textOperator)
Sets the text operator. DefaultTextOperator is used by default.

Parameters:
textOperator - The text operator.

getTextOperator

public TextOperator getTextOperator()
Returns the text operator.

Returns:
The text operator.

setClearButtonVisible

public void setClearButtonVisible(boolean visible)
Shows or hides the "clear" button.

Parameters:
visible - true to show the "clear" button; false to hide it.

setTextAreaStartText

public void setTextAreaStartText(java.lang.String textAreaStartText)
Sets the text to be shown in the text area in front of the text entered by the user. The default is an empty string.

Parameters:
textAreaStartText - The text, possibly enriched with HTML tags.

setTextAreaEndText

public void setTextAreaEndText(java.lang.String textAreaEndText)
Sets the text to be shown in the text area at the end of the text entered by the user. The default are three gray dots "...".

Parameters:
textAreaEndText - The text, possibly enriched with HTML tags.

getTextContainer

public TextContainer getTextContainer()
Returns a copy of the text container object that contains the (partial) text that has been entered.

Returns:
A copy of the text container object.

getTokenCount

public int getTokenCount()
Returns the number of tokens of the current (partial) text.

Returns:
The number of tokens.

isPossibleNextToken

public boolean isPossibleNextToken(java.lang.String token)
Returns whether the given token is a possible next token.

Parameters:
token - The token.
Returns:
true if it is a possible next token.

addTextElement

public void addTextElement(TextElement te)
Adds the text element to the end of the text.

Parameters:
te - The text element to be added.

addText

public void addText(java.lang.String text)
Reads the text and adds it to the end of the current text as far as possible.

Parameters:
text - The text to be added.

addActionListener

public void addActionListener(nextapp.echo.app.event.ActionListener actionListener)
Adds a new action-listener.

Parameters:
actionListener - The new action-listener.

removeActionListener

public void removeActionListener(nextapp.echo.app.event.ActionListener actionListener)
Removes the action-listener.

Parameters:
actionListener - The action-listener to be removed.

removeAllActionListeners

public void removeAllActionListeners()
Removes all action-listeners.


actionPerformed

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

removeLastToken

public void removeLastToken()
Removes the last token.


clearTokens

public void clearTokens()
Removes all tokens.


isTextComplete

public boolean isTextComplete()
Returns true if the current text is a complete statement.

Returns:
true if the current text is a complete statement.

getPredictiveParser

public PredictiveParser getPredictiveParser()
Returns the predictive parser. Do not modify this object while the preditor window is active!

Returns:
The predictive parser.

windowPaneClosing

public void windowPaneClosing(nextapp.echo.app.event.WindowPaneEvent e)
Specified by:
windowPaneClosing in interface nextapp.echo.app.event.WindowPaneListener

init

public void init()
Overrides:
init in class nextapp.echo.app.Component

setLogger

public void setLogger(Logger logger)
Sets the logger.

Parameters:
logger - The logger object or null.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright 2008-2012, AceWiki developers