public class Utilities
extends java.lang.Object
| Constructor and Description |
|---|
Utilities() |
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
choiceBox(java.util.List<java.lang.String> choices,
java.lang.String title,
java.lang.String header,
java.lang.String content)
Shows a choice box where the user can pick among preset options.
|
static javafx.scene.control.ButtonType |
confirmationBox(java.lang.String title,
java.lang.String header,
java.lang.String message) |
static IEntity |
copyEntity(IEntity entity)
Creates an IEntity copy of the given IEntity with the same specs,
components, and component values.
|
static javafx.scene.control.ContextMenu |
createContextMenu(java.util.Map<java.lang.String,javafx.event.EventHandler<javafx.event.ActionEvent>> menuMap) |
static java.util.List<java.lang.String> |
getAllFromDirectory(java.lang.String directoryLocation)
Gets all file names from a given directory.
|
static java.util.List<javafx.stage.FileChooser.ExtensionFilter> |
getImageFilters() |
static javafx.scene.control.Button |
makeButton(java.lang.String name,
javafx.event.EventHandler<javafx.event.ActionEvent> handler)
Makes a button with a given name and event.
|
static javafx.scene.control.ComboBox<java.lang.String> |
makeComboBox(java.lang.String prompt,
java.util.List<java.lang.String> choices,
javafx.event.EventHandler<javafx.event.ActionEvent> event)
Creates and returns a string combo box with the following features:
|
static javafx.scene.control.TableView<java.lang.String> |
makeSingleColumnTable(java.lang.String title,
double width) |
static javafx.scene.control.Slider |
makeSlider(javafx.beans.value.ChangeListener<java.lang.Number> listener,
double start,
double end,
double currVal)
Creates a new slider, setting all necessary intervals and locations.
|
static javafx.scene.control.TextField |
makeTextArea(java.lang.String prompt)
Creates and returns a text area with the following features:
|
static javafx.scene.control.TitledPane |
makeTitledPane(java.lang.String title,
javafx.scene.Node content,
boolean collapsable)
Creates a Titled Pane, with all content already inside.
|
static java.io.File |
promptAndGetFile(javafx.stage.FileChooser.ExtensionFilter extension,
java.lang.String prompt)
Prompts a file chooser box for the user to choose a file with ONE
extension filter
|
static java.io.File |
promptAndGetFile(java.util.List<javafx.stage.FileChooser.ExtensionFilter> filters,
java.lang.String prompt)
Prompts a file chooser box for the user to choose a file with MULTIPLE
extension filters
|
static boolean |
showAlert(java.lang.String title,
java.lang.String header,
java.lang.String message,
javafx.scene.control.Alert.AlertType type)
Show an alert with a certain message and a given type.
|
static void |
showError(java.lang.String title,
java.lang.String message)
Show an error with a certain message.
|
static java.lang.String |
userInputBox(java.lang.String title,
java.lang.String prompt)
Shows a text input dialog where user can enter in text of their choosing.
|
public static boolean showAlert(java.lang.String title,
java.lang.String header,
java.lang.String message,
javafx.scene.control.Alert.AlertType type)
String - title: title of alert, could be nullString - header: header for the alert, could be nullString - message: longer message further describing the alert, could be
null (though all three above shouldn't be null at the same
time or the alert is useless)AlertType - type: type of alert to display, i.e. ERROR, INFORMATION,
CONFIRMATIONpublic static void showError(java.lang.String title,
java.lang.String message)
error - messagepublic static javafx.scene.control.TableView<java.lang.String> makeSingleColumnTable(java.lang.String title,
double width)
public static javafx.scene.control.Button makeButton(java.lang.String name,
javafx.event.EventHandler<javafx.event.ActionEvent> handler)
String - name: name of buttonEventHandler - handler: action/method to occur when button is pressedpublic static javafx.scene.control.ComboBox<java.lang.String> makeComboBox(java.lang.String prompt,
java.util.List<java.lang.String> choices,
javafx.event.EventHandler<javafx.event.ActionEvent> event)
String - prompt the name of the combo boxList - choices choices in the combo boxEventHandler - event event/method to occur when the combo box is selectedpublic static javafx.scene.control.TextField makeTextArea(java.lang.String prompt)
String - prompt writing in text areapublic static java.io.File promptAndGetFile(javafx.stage.FileChooser.ExtensionFilter extension,
java.lang.String prompt)
ExtensionFilter - extension: file extension that the user can choose from, all
others are not allowedString - prompt: prompt for the file chooser boxpublic static java.io.File promptAndGetFile(java.util.List<javafx.stage.FileChooser.ExtensionFilter> filters,
java.lang.String prompt)
List - filters: file extensions that the user can choose from, all
others are not allowedString - prompt: prompt for the file chooser boxpublic static java.lang.String userInputBox(java.lang.String title,
java.lang.String prompt)
String - title: title for input dialogSting - prompt: detailed message to the user about the input boxpublic java.lang.String choiceBox(java.util.List<java.lang.String> choices,
java.lang.String title,
java.lang.String header,
java.lang.String content)
List - choices: choices given to the user in the dialogueString - title: title of dialogue, could be nullString - header: header for the dialogue, could be nullString - content: longer message further describing the dialogue, could
be null (all three shouldn't be null at once or dialogue is
useless)public static javafx.scene.control.TitledPane makeTitledPane(java.lang.String title,
javafx.scene.Node content,
boolean collapsable)
String - title: Title that will appear on the top of the PaneNode - content: Content to be added. It can be a Group or a VBox or
HBox.boolean - collapsable: If it's collapsable, the pane will not be
expanded. If it isn't, it will.public static javafx.scene.control.ButtonType confirmationBox(java.lang.String title,
java.lang.String header,
java.lang.String message)
public static java.util.List<java.lang.String> getAllFromDirectory(java.lang.String directoryLocation)
directoryLocation - String path to a file directorypublic static IEntity copyEntity(IEntity entity)
IEntity - entity: given IEntity to copypublic static java.util.List<javafx.stage.FileChooser.ExtensionFilter> getImageFilters()
public static javafx.scene.control.ContextMenu createContextMenu(java.util.Map<java.lang.String,javafx.event.EventHandler<javafx.event.ActionEvent>> menuMap)
public static javafx.scene.control.Slider makeSlider(javafx.beans.value.ChangeListener<java.lang.Number> listener,
double start,
double end,
double currVal)
ChangeListener - the changeImage the slider is listening to and event/method it calls when the changeImage occursstart - the start of the slider rangeend - the end of the slider rangeincr - the increment of the slider range