de.cau.cs.kieler.ksbase.util
Class UserDialogUtil

java.lang.Object
  extended by de.cau.cs.kieler.ksbase.util.UserDialogUtil

public class UserDialogUtil
extends Object

Utility class to create question dialogs to the user. Can be used in Xtend transformations in JAVA extensions to get input from the user.

Rating red

Constructor Summary
UserDialogUtil()
           
 
Method Summary
 boolean getUserBoolean(String message)
          Give the user a yes/no choice.
 Float getUserFloat(String message, Float defaultValue)
          Get a float from the user.
 Integer getUserInt(String message, Integer defaultValue)
          Get an int from the user.
<T> T
getUserObjectFromList(String message, List<T> list)
          Give the user a choice from a list of elements.
 String getUserString(String message, String defaultValue)
          Get a string from the user.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UserDialogUtil

public UserDialogUtil()
Method Detail

getUserString

public String getUserString(String message,
                            String defaultValue)
Get a string from the user.

Parameters:
message - the message for the dialog
defaultValue - the default value
Returns:
the users choice, null if the user hit cancel

getUserInt

public Integer getUserInt(String message,
                          Integer defaultValue)
Get an int from the user.

Parameters:
message - the message for the dialog
defaultValue - the default value
Returns:
the user input, null if canceled

getUserFloat

public Float getUserFloat(String message,
                          Float defaultValue)
Get a float from the user.

Parameters:
message - the message for the dialog
defaultValue - the default value
Returns:
the user input, null if cancel

getUserBoolean

public boolean getUserBoolean(String message)
Give the user a yes/no choice.

Parameters:
message - the question
Returns:
true if the user clicked yes

getUserObjectFromList

public <T> T getUserObjectFromList(String message,
                                   List<T> list)
Give the user a choice from a list of elements.

Type Parameters:
T - the type of element
Parameters:
message - the message to display
list - the list of elements
Returns:
the users choice