Class JSR270HistoryManager
- java.lang.Object
-
- com.artenum.rosetta.implementation.JSR270HistoryManager
-
- All Implemented Interfaces:
HistoryManager
public class JSR270HistoryManager extends java.lang.Object implements HistoryManager
History Manager for JSR270 implementation
-
-
Constructor Summary
Constructors Constructor Description JSR270HistoryManager()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addEntry(java.lang.String newEntry)
Add a line or a block in historyvoid
display()
Display all history entries with line numbersjava.lang.String
getEntry(int entryIndex)
Gets an entry in the history by giving its numberjava.lang.String
getNextEntry(java.lang.String beg)
Gets next entry in the history by giving its beginningjava.lang.String
getPreviousEntry(java.lang.String beg)
Gets previous entry in the history by giving its beginningjava.lang.String
getTmpEntry()
Gets the currently edited command line before erasing itboolean
isInHistory()
Are we browsing history ?void
load()
Load history from a filevoid
reset()
Clears the historyvoid
save()
Save history to a filevoid
setInHistory(boolean status)
Sets the flag indicating if we are browsing historyvoid
setMaxEntryNumber(int numberOfEntries)
Set the maximum number of entries (lines/blocks) allowed in the historyvoid
setTmpEntry(java.lang.String currentCommandLine)
Saves the currently edited command line before erasing it
-
-
-
Method Detail
-
addEntry
public void addEntry(java.lang.String newEntry)
Description copied from interface:HistoryManager
Add a line or a block in history- Specified by:
addEntry
in interfaceHistoryManager
- Parameters:
newEntry
- the entry to be added at the end of the history
-
display
public void display()
Description copied from interface:HistoryManager
Display all history entries with line numbers- Specified by:
display
in interfaceHistoryManager
-
getEntry
public java.lang.String getEntry(int entryIndex)
Description copied from interface:HistoryManager
Gets an entry in the history by giving its number- Specified by:
getEntry
in interfaceHistoryManager
- Parameters:
entryIndex
- the index of the entry in the history- Returns:
- the entry
-
getNextEntry
public java.lang.String getNextEntry(java.lang.String beg)
Description copied from interface:HistoryManager
Gets next entry in the history by giving its beginning- Specified by:
getNextEntry
in interfaceHistoryManager
- Parameters:
beg
- the beginning of the entry (can be empty)- Returns:
- the entry
-
getPreviousEntry
public java.lang.String getPreviousEntry(java.lang.String beg)
Description copied from interface:HistoryManager
Gets previous entry in the history by giving its beginning- Specified by:
getPreviousEntry
in interfaceHistoryManager
- Parameters:
beg
- the beginning of the entry (can be empty)- Returns:
- the entry
-
getTmpEntry
public java.lang.String getTmpEntry()
Description copied from interface:HistoryManager
Gets the currently edited command line before erasing it- Specified by:
getTmpEntry
in interfaceHistoryManager
- Returns:
- the text currently edited by the user before going into history
-
isInHistory
public boolean isInHistory()
Description copied from interface:HistoryManager
Are we browsing history ?- Specified by:
isInHistory
in interfaceHistoryManager
- Returns:
- true if we are browing history, false else
-
load
public void load()
Description copied from interface:HistoryManager
Load history from a file- Specified by:
load
in interfaceHistoryManager
-
reset
public void reset()
Description copied from interface:HistoryManager
Clears the history- Specified by:
reset
in interfaceHistoryManager
-
save
public void save()
Description copied from interface:HistoryManager
Save history to a file- Specified by:
save
in interfaceHistoryManager
-
setInHistory
public void setInHistory(boolean status)
Description copied from interface:HistoryManager
Sets the flag indicating if we are browsing history- Specified by:
setInHistory
in interfaceHistoryManager
- Parameters:
status
- is true if we begin to browse the history, false if we stop browsing
-
setMaxEntryNumber
public void setMaxEntryNumber(int numberOfEntries)
Description copied from interface:HistoryManager
Set the maximum number of entries (lines/blocks) allowed in the history- Specified by:
setMaxEntryNumber
in interfaceHistoryManager
- Parameters:
numberOfEntries
- the number of entries to set
-
setTmpEntry
public void setTmpEntry(java.lang.String currentCommandLine)
Description copied from interface:HistoryManager
Saves the currently edited command line before erasing it- Specified by:
setTmpEntry
in interfaceHistoryManager
- Parameters:
currentCommandLine
- the text currently edited by the user
-
-