Class ExpressionTextController
java.lang.Object
org.cyclops.integrateddynamics.core.logicprogrammer.client.ExpressionTextController
This handles the text manipulations in the expressions text box.
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected -
Method Summary
Modifier and TypeMethodDescriptionvoidApply typed text that is not applied yet, such as when the gui closes.protected abstract voidApply the typed text if it reads as an expression.booleancancel()Stop typing, applying valid text and reverting other text, as for Escape.booleancharTyped(net.minecraft.client.input.CharacterEvent evt) Handle a typed character while the text has focus.voidcopyText()voidprotected abstract voidWrite the expression in its canonical form.protected abstract ExpressionEditorgetLabel(int variableId) it.unimi.dsi.fastutil.ints.IntListgetLabelIds(String label) IValueType<?> getRefType(int variableId) static ExpressionTextFieldgetTextField(ContainerLogicProgrammerBase container) booleanisDraft()static booleanisRedoKey(net.minecraft.client.input.KeyEvent evt) static booleanisUndoKey(net.minecraft.client.input.KeyEvent evt) booleankeyPressed(net.minecraft.client.input.KeyEvent evt) Handle a key while the text has focus.printExact(Expression expression) protected abstract voidredo()voidtick()Apply typed text once typing pauses, or when the panel is hidden, where the text can not be seen.protected abstract voidundo()Revert typed text that is not applied yet, or otherwise go back one change.
-
Field Details
-
container
-
-
Constructor Details
-
ExpressionTextController
-
-
Method Details
-
getTextField
- Parameters:
container- The container.- Returns:
- The text, which is kept in the screen, so it survives the panel being recreated.
-
getTextField
-
getEditor
- Returns:
- The expression that the text belongs to, or null if there is none.
-
applyText
protected abstract void applyText()Apply the typed text if it reads as an expression. This can make another element active, which replaces the panel, so it is not done while rendering. -
undo
protected abstract void undo()Revert typed text that is not applied yet, or otherwise go back one change. -
redo
protected abstract void redo() -
formatText
protected abstract void formatText()Write the expression in its canonical form. -
isDraft
public boolean isDraft()- Returns:
- If text was typed that is not applied yet.
-
parseText
- Returns:
- The expression in the typed text, or null if it does not read as one, as read for the current text.
-
getParsedResult
- Returns:
- The types of the expression in the typed text, or null if it does not read as one.
-
getParseError
- Returns:
- Why the typed text does not read as an expression, or null if it does.
-
getParserContext
-
printExact
- Parameters:
expression- An expression.- Returns:
- Its canonical form.
-
getRefType
-
getLabel
-
getLabelIds
-
getDraftError
- Returns:
- Why typed text that is not applied yet does not read as an expression, or null if there is none.
-
focusText
public void focusText() -
tick
public void tick()Apply typed text once typing pauses, or when the panel is hidden, where the text can not be seen. Called each tick, outside of rendering. -
applyPendingText
public void applyPendingText()Apply typed text that is not applied yet, such as when the gui closes. -
cancel
public boolean cancel()Stop typing, applying valid text and reverting other text, as for Escape.- Returns:
- If the text had focus or was typed.
-
copyText
public void copyText() -
charTyped
public boolean charTyped(net.minecraft.client.input.CharacterEvent evt) Handle a typed character while the text has focus.- Returns:
- If it was handled.
-
keyPressed
public boolean keyPressed(net.minecraft.client.input.KeyEvent evt) Handle a key while the text has focus.- Returns:
- If it was handled, which is any key, so keys such as the inventory key do not close the gui while typing.
-
isUndoKey
public static boolean isUndoKey(net.minecraft.client.input.KeyEvent evt) -
isRedoKey
public static boolean isRedoKey(net.minecraft.client.input.KeyEvent evt)
-