org.codehaus.mojo.pomtools.console.screens
Class AbstractModelScreen

java.lang.Object
  extended by org.codehaus.mojo.pomtools.console.screens.AbstractModelScreen
All Implemented Interfaces:
ConsoleScreen
Direct Known Subclasses:
AbstractEditListItemScreen, ConfirmYesNoScreen, EditBooleanScreen, EditListScreen, EditLovScreen, EditStringListValueScreen, EditStringScreen, EditVersionScreen, ErrorMessageScreen, HelpScreen, ListDependenciesScreen, ListProjectsScreen, ListTransitiveDependenciesScreen, ModelValidationScreen

public abstract class AbstractModelScreen
extends Object
implements ConsoleScreen

Version:
$Id: AbstractModelScreen.java 2166 2006-07-18 21:32:16Z carlos $
Author:
David Hawkins

Nested Class Summary
protected  class AbstractModelScreen.OptionsPane
          Simple wrapper for LabeledList that prints the box below:
 
Field Summary
protected static String KEY_DELETE_ITEM
           
protected static String KEY_NEW_ITEM
           
protected static String MODIFIED_LABEL
           
protected static String NEWLINE
           
static String NULL_VALUE
           
static String PRESS_ENTER_TO_CONTINUE
           
 
Constructor Summary
AbstractModelScreen(String name)
           
 
Method Summary
protected  ConsoleScreenDisplay createDisplay(String contents, String prompt)
           
protected  ConsoleScreenDisplay createDisplay(String contents, String prompt, boolean includeHelp)
           
protected static String decorateModifiedLabel(String label, boolean modified)
          Returns the supplied label with a "**" appended if the modified parameter is true.
protected  void doRevert(ConsoleEvent event)
           
protected  void doSave(ConsoleEvent event)
           
 ConsoleEventDispatcher getDefaultEventDispatcher()
           
 ConsoleEventDispatcher getDefaultEventManager(boolean includeDefaultListener)
           
protected  String getFieldNameHeader(String fieldName)
           
protected  String getHeader()
           
protected  String getHeader(String s)
           
protected  String getHeader(String s, boolean printProjectName)
           
 String getHelpText()
           
protected  PomToolsPluginContext getModelContext()
           
protected  String getModifiedLabel(String label, boolean modified)
          Returns a bold label if the terminal supports formatting and the item is modified.
 String getName()
           
protected  Terminal getTerminal()
           
 int getTerminalWidth()
           
protected  boolean isModified()
           
protected  boolean isNumberInRange(String input, int min, int max)
           
protected  String numberPrompt(int n)
           
 void setHelpText(String helpText)
           
 void setTerminalWidth(int terminalWidth)
           
protected  String strPrompt(String s)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.codehaus.mojo.pomtools.console.toolkit.ConsoleScreen
getDisplay, getEventDispatcher
 

Field Detail

NULL_VALUE

public static final String NULL_VALUE
See Also:
Constant Field Values

PRESS_ENTER_TO_CONTINUE

public static final String PRESS_ENTER_TO_CONTINUE
See Also:
Constant Field Values

NEWLINE

protected static final String NEWLINE
See Also:
Constant Field Values

KEY_NEW_ITEM

protected static final String KEY_NEW_ITEM
See Also:
Constant Field Values

KEY_DELETE_ITEM

protected static final String KEY_DELETE_ITEM
See Also:
Constant Field Values

MODIFIED_LABEL

protected static final String MODIFIED_LABEL
See Also:
Constant Field Values
Constructor Detail

AbstractModelScreen

public AbstractModelScreen(String name)
Method Detail

getName

public String getName()
Specified by:
getName in interface ConsoleScreen

getHeader

protected String getHeader()

getHeader

protected String getHeader(String s)

getFieldNameHeader

protected String getFieldNameHeader(String fieldName)

getHeader

protected String getHeader(String s,
                           boolean printProjectName)

createDisplay

protected ConsoleScreenDisplay createDisplay(String contents,
                                             String prompt)

createDisplay

protected ConsoleScreenDisplay createDisplay(String contents,
                                             String prompt,
                                             boolean includeHelp)

numberPrompt

protected String numberPrompt(int n)

strPrompt

protected String strPrompt(String s)

isNumberInRange

protected boolean isNumberInRange(String input,
                                  int min,
                                  int max)

isModified

protected boolean isModified()

decorateModifiedLabel

protected static String decorateModifiedLabel(String label,
                                              boolean modified)
Returns the supplied label with a "**" appended if the modified parameter is true.


getModifiedLabel

protected String getModifiedLabel(String label,
                                  boolean modified)
Returns a bold label if the terminal supports formatting and the item is modified. It the terminal does not support formatting, the value is simply decorated with a "**"

Parameters:
label -
modified -
Returns:

getDefaultEventDispatcher

public ConsoleEventDispatcher getDefaultEventDispatcher()
                                                 throws ConsoleExecutionException
Throws:
ConsoleExecutionException

getDefaultEventManager

public ConsoleEventDispatcher getDefaultEventManager(boolean includeDefaultListener)

doSave

protected void doSave(ConsoleEvent event)
               throws ConsoleExecutionException
Throws:
ConsoleExecutionException

doRevert

protected void doRevert(ConsoleEvent event)
                 throws ConsoleExecutionException
Throws:
ConsoleExecutionException

getModelContext

protected PomToolsPluginContext getModelContext()

getTerminalWidth

public int getTerminalWidth()

setTerminalWidth

public void setTerminalWidth(int terminalWidth)

getHelpText

public String getHelpText()
Specified by:
getHelpText in interface ConsoleScreen

setHelpText

public void setHelpText(String helpText)

getTerminal

protected Terminal getTerminal()


Copyright © 2011 The Codehaus. All Rights Reserved.