ch.uzh.ifi.attempto.preditor
Class PreditorWindow

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

public class PreditorWindow
extends WindowPane
implements nextapp.echo2.app.event.ActionListener, nextapp.echo2.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.echo2.app.WindowPane
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE, INPUT_CLOSE, PROPERTY_BACKGROUND_IMAGE, PROPERTY_BORDER, PROPERTY_CLOSABLE, PROPERTY_CLOSE_ICON, PROPERTY_CLOSE_ICON_INSETS, PROPERTY_DEFAULT_CLOSE_OPERATION, PROPERTY_HEIGHT, PROPERTY_ICON, PROPERTY_ICON_INSETS, PROPERTY_INSETS, PROPERTY_MAXIMUM_HEIGHT, PROPERTY_MAXIMUM_WIDTH, 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_BAR_INSETS, PROPERTY_TITLE_FONT, PROPERTY_TITLE_FOREGROUND, PROPERTY_TITLE_HEIGHT, PROPERTY_TITLE_INSETS, PROPERTY_WIDTH, Z_INDEX_CHANGED_PROPERTY
 
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
 
Fields inherited from interface nextapp.echo2.app.ModalSupport
MODAL_CHANGED_PROPERTY
 
Constructor Summary
PreditorWindow(java.lang.String title, Grammar grammar, MenuCreator menuCreator)
          Creates a new predictive editor window for the given grammar using the given menu creator.
 
Method Summary
 void actionPerformed(nextapp.echo2.app.event.ActionEvent e)
           
 void addActionListener(nextapp.echo2.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.
 java.util.ArrayList<TextElement> getPossibleNextTokens(java.lang.String... text)
          Returns a list of text elements that contain one of the given texts and that are possible next tokens.
 TextContainer getTextContainer()
          Returns the (partial) text that has been entered .
 void removeActionListener(nextapp.echo2.app.event.ActionListener actionListener)
          Removes the action-listener.
 void removeAllActionListeners()
          Removes all action-listeners.
 java.lang.String toString()
           
 void windowPaneClosing(nextapp.echo2.app.event.WindowPaneEvent e)
           
 
Methods inherited from class nextapp.echo2.app.WindowPane
addWindowPaneListener, fireWindowClosing, getBackgroundImage, getBorder, getCloseIcon, getCloseIconInsets, getDefaultCloseOperation, getHeight, getIcon, getIconInsets, getInsets, getMaximumHeight, getMaximumWidth, getMinimumHeight, getMinimumWidth, getPositionX, getPositionY, getTitle, getTitleBackground, getTitleBackgroundImage, getTitleBarInsets, getTitleFont, getTitleForeground, getTitleHeight, getTitleInsets, getWidth, getZIndex, isClosable, isModal, isMovable, isResizable, isValidChild, isValidParent, processInput, removeWindowPaneListener, setBackgroundImage, setBorder, setClosable, setCloseIcon, setCloseIconInsets, setDefaultCloseOperation, setHeight, setIcon, setIconInsets, setInsets, setMaximumHeight, setMaximumWidth, setMinimumHeight, setMinimumWidth, setModal, setMovable, setPositionX, setPositionY, setResizable, setTitle, setTitleBackground, setTitleBackgroundImage, setTitleBarInsets, setTitleFont, setTitleForeground, setTitleHeight, setTitleInsets, setWidth, setZIndex, userClose
 
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, wait, wait, wait
 

Constructor Detail

PreditorWindow

public PreditorWindow(java.lang.String title,
                      Grammar grammar,
                      MenuCreator menuCreator)
Creates a new predictive editor window for the given grammar using the given menu creator.

Parameters:
title - The title of the window.
grammar - The grammar to be used.
menuCreator - The menu creator to be used.
Method Detail

getTextContainer

public TextContainer getTextContainer()
Returns the (partial) text that has been entered .

Returns:
The (partial) text in the form of a text container.

getPossibleNextTokens

public java.util.ArrayList<TextElement> getPossibleNextTokens(java.lang.String... text)
Returns a list of text elements that contain one of the given texts and that are possible next tokens.

Parameters:
text - The content of the text elements to search for.
Returns:
The list of text elements.

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.echo2.app.event.ActionListener actionListener)
Adds a new action-listener.

Parameters:
actionListener - The new action-listener.

removeActionListener

public void removeActionListener(nextapp.echo2.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.echo2.app.event.ActionEvent e)
Specified by:
actionPerformed in interface nextapp.echo2.app.event.ActionListener

windowPaneClosing

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

toString

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


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