Class AddPopup
java.lang.Object
javafx.stage.Window
javafx.stage.PopupWindow
javafx.stage.Popup
no.ntnu.idatt1002.demo.view.components.AddPopup
- All Implemented Interfaces:
javafx.event.EventTarget
public class AddPopup
extends javafx.stage.Popup
A popup for adding items to the inventory.
TODO: Make this class be able to add recipes. Maybe make a superclas?
-
Property Summary
Properties inherited from class javafx.stage.PopupWindow
anchorLocation, anchorX, anchorY, autoFix, autoHide, consumeAutoHidingEvents, hideOnEscape, onAutoHide, ownerNode, ownerWindowProperties inherited from class javafx.stage.Window
eventDispatcher, focused, forceIntegerRenderScale, height, onCloseRequest, onHidden, onHiding, onShowing, onShown, opacity, outputScaleX, outputScaleY, renderScaleX, renderScaleY, scene, showing, width, x, y -
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceA callback for when the form is submitted.Nested classes/interfaces inherited from class javafx.stage.PopupWindow
javafx.stage.PopupWindow.AnchorLocation -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate AddPopup.OnAddprivate javafx.scene.text.Textprivate String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T> Field<T> Adds a new field to the popup.private voidaddItem()Adds an item to the inventory.private voidrender()Set the callback for when the form is submitted.voidsetSpecialPrompt(javafx.scene.text.Text text, Consumer<Void> onAction) Set a special prompt at the bottom of the popup.Methods inherited from class javafx.stage.Popup
getContentMethods inherited from class javafx.stage.PopupWindow
anchorLocationProperty, anchorXProperty, anchorYProperty, autoFixProperty, autoHideProperty, consumeAutoHidingEventsProperty, getAnchorLocation, getAnchorX, getAnchorY, getConsumeAutoHidingEvents, getOnAutoHide, getOwnerNode, getOwnerWindow, hide, hideOnEscapeProperty, isAutoFix, isAutoHide, isHideOnEscape, onAutoHideProperty, ownerNodeProperty, ownerWindowProperty, setAnchorLocation, setAnchorX, setAnchorY, setAutoFix, setAutoHide, setConsumeAutoHidingEvents, setHideOnEscape, setOnAutoHide, setScene, show, show, showMethods inherited from class javafx.stage.Window
addEventFilter, addEventHandler, buildEventDispatchChain, centerOnScreen, eventDispatcherProperty, fireEvent, focusedProperty, forceIntegerRenderScaleProperty, getEventDispatcher, getHeight, getOnCloseRequest, getOnHidden, getOnHiding, getOnShowing, getOnShown, getOpacity, getOutputScaleX, getOutputScaleY, getProperties, getRenderScaleX, getRenderScaleY, getScene, getUserData, getWidth, getWindows, getX, getY, hasProperties, heightProperty, isFocused, isForceIntegerRenderScale, isShowing, onCloseRequestProperty, onHiddenProperty, onHidingProperty, onShowingProperty, onShownProperty, opacityProperty, outputScaleXProperty, outputScaleYProperty, removeEventFilter, removeEventHandler, renderScaleXProperty, renderScaleYProperty, requestFocus, sceneProperty, setEventDispatcher, setEventHandler, setForceIntegerRenderScale, setHeight, setOnCloseRequest, setOnHidden, setOnHiding, setOnShowing, setOnShown, setOpacity, setRenderScaleX, setRenderScaleY, setUserData, setWidth, setX, setY, show, showingProperty, sizeToScene, widthProperty, xProperty, yProperty
-
Field Details
-
onAdd
-
fields
-
type
-
specialPrompt
private javafx.scene.text.Text specialPrompt
-
-
Constructor Details
-
AddPopup
Constructor for the AddPopup.
-
-
Method Details
-
render
private void render() -
addField
Adds a new field to the popup.- Type Parameters:
T- the type of the field- Parameters:
field- the field to add- Returns:
- the field
-
addItem
private void addItem()Adds an item to the inventory. -
setOnAdd
Set the callback for when the form is submitted.- Parameters:
cb- the callback- Returns:
- this input field
-
setSpecialPrompt
Set a special prompt at the bottom of the popup.This is useful for displaying a clickable text that performs an action. Closes the popup when clicked.
- Parameters:
text- the text to displayonAction- the action to perform when the text is clicked
-