|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--sam.ui.RulingInterface
Generic ruling interface type. A ruling interface is in charge of parsing command-line and interactively prompt the user for missing parameters
Nested Class Summary | |
static class |
RulingInterface.AccessMode
File access mode |
Field Summary | |
static RulingInterface.AccessMode |
FILE
Access mode for a readable or writable file |
static RulingInterface.AccessMode |
READABLE_DIRECTORY
Access mode for a readable and traversable directory |
static RulingInterface.AccessMode |
READABLE_FILE
Access mode for a readable file |
static RulingInterface.AccessMode |
READABLE_FILE_OR_DIRECTORY
|
static RulingInterface.AccessMode |
WRITABLE_DIRECTORY
Access mode for a readable and traversable directory |
static RulingInterface.AccessMode |
WRITABLE_FILE
Access mode for a writable or creatable file |
Constructor Summary | |
RulingInterface()
|
Method Summary | |
protected abstract java.lang.String |
choose(java.lang.String title,
java.lang.String[] values)
Prompts the user for entering a string. |
sam.cipher.Specification[] |
chooseCiphers(sam.cipher.Specification[] ciphers)
Prompts the user to choose the ciphers and enter the corresponding passwords in ciphering mode. |
int |
chooseInteger(java.lang.String title,
int[] values,
int suggestedValue)
Prompts the user for choosing an integer among several ones. |
java.lang.String |
chooseString(java.lang.String title,
java.lang.String[] values,
java.lang.String suggestedValue)
Prompts the user for choosing a string among several ones. |
protected abstract sam.cipher.Specification[] |
enterCiphers(java.lang.String title,
sam.cipher.Specification[] ciphers,
boolean canAddCiphers)
Prompts the user for entering the ciphers/passwords. |
protected abstract java.io.File |
enterFileOrDirectory(java.lang.String title,
java.io.File suggestedValue,
RulingInterface.AccessMode mode)
Prompts the user for entering a file name. |
protected abstract int |
enterInteger(java.lang.String title,
int suggestedValue,
int min,
int max)
Prompts the user for entering an integral number. |
sam.cipher.Specification[] |
enterPasswords(sam.cipher.Specification[] ciphers)
Prompts the user to enter the password for specified ciphers in deciphering mode. |
protected abstract java.lang.String |
enterString(java.lang.String title,
java.lang.String suggestedValue)
Prompts the user for entering a string. |
java.io.File |
getFileOrDirectory(java.lang.String title,
java.io.File suggestedValue,
RulingInterface.AccessMode mode)
Gets a file or directory and ensures it can be read/written as required |
java.io.File |
getFileOrDirectory(java.lang.String title,
java.lang.String suggestedValue,
RulingInterface.AccessMode mode)
Gets a file or directory and ensures it can be read/written as required |
int |
getInteger(java.lang.String title,
int suggestedValue,
int min,
int max)
Gets a user-supplied integral number. |
java.lang.String |
getString(java.lang.String title,
java.lang.String suggestedValue)
Gets a user-supplied string. |
void |
test()
Simple test code. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final RulingInterface.AccessMode FILE
public static final RulingInterface.AccessMode READABLE_FILE
public static final RulingInterface.AccessMode WRITABLE_FILE
public static final RulingInterface.AccessMode READABLE_DIRECTORY
public static final RulingInterface.AccessMode WRITABLE_DIRECTORY
public static final RulingInterface.AccessMode READABLE_FILE_OR_DIRECTORY
Constructor Detail |
public RulingInterface()
Method Detail |
protected abstract java.lang.String enterString(java.lang.String title, java.lang.String suggestedValue)
title
- the title (or type) of the value to be chosensuggestedValue
- the suggested (yet invalid) value
In current implementation this will always be null
since this is the
only "invalid" String
public java.lang.String getString(java.lang.String title, java.lang.String suggestedValue)
title
- the title (or type) of the value to be chosensuggestedValue
- the suggested value to be returned if not null
protected abstract int enterInteger(java.lang.String title, int suggestedValue, int min, int max) throws java.lang.NumberFormatException
title
- the title (or type) of the value to be chosensuggestedValue
- the suggested number to be returned if validmin
- the minimum allowed value, or Integer.MIN_VALUE
max
- the maximum allowed value, or Integer.MAX_VALUE
java.lang.NumberFormatException
public final int getInteger(java.lang.String title, int suggestedValue, int min, int max)
title
- the title (or type) of the value to be chosensuggestedValue
- the suggested number to be returned if validmin
- the minimum allowed value, or Integer.MIN_VALUE
max
- the maximum allowed value, or Integer.MAX_VALUE
protected abstract java.io.File enterFileOrDirectory(java.lang.String title, java.io.File suggestedValue, RulingInterface.AccessMode mode)
title
- the title (or type) of the directory to be chosensuggestedValue
- the suggested (yet invalid) file or directory to be returnedmode
- the required access mode for this filepublic java.io.File getFileOrDirectory(java.lang.String title, java.lang.String suggestedValue, RulingInterface.AccessMode mode)
title
- the title (or type) of the directory to be chosensuggestedValue
- the suggested (yet invalid) file or directory to be returnedmode
- the required access mode for this filepublic java.io.File getFileOrDirectory(java.lang.String title, java.io.File suggestedValue, RulingInterface.AccessMode mode)
title
- the title (or type) of the directory to be chosensuggestedValue
- the suggested (yet invalid) file or directory to be returnedmode
- the required access mode for this filepublic int chooseInteger(java.lang.String title, int[] values, int suggestedValue)
title
- the title (or type) of the value to be chosenvalues
- the list of allowed valuessuggestedValue
- the suggested value to be returned on cancelpublic java.lang.String chooseString(java.lang.String title, java.lang.String[] values, java.lang.String suggestedValue)
title
- the title (or type) of the value to be chosenvalues
- the list of allowed valuessuggestedValue
- the suggested value to be returned on cancel
null
if cancelled or
if values
is null
protected abstract java.lang.String choose(java.lang.String title, java.lang.String[] values)
title
- the title (or type) of the value to be chosenvalues
- the list of allowed valuespublic final sam.cipher.Specification[] enterPasswords(sam.cipher.Specification[] ciphers)
ciphers
- the suggested ciphers listpublic final sam.cipher.Specification[] chooseCiphers(sam.cipher.Specification[] ciphers)
ciphers
- the suggested ciphers listprotected abstract sam.cipher.Specification[] enterCiphers(java.lang.String title, sam.cipher.Specification[] ciphers, boolean canAddCiphers)
title
- the non-null
titleciphers
- the suggested ciphers list or null
if none specifiedcanAddCiphers
- wether the user can add/remove ciphers or simply supply passwordspublic void test()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |