Class ExpressionTextController

java.lang.Object
org.cyclops.integrateddynamics.core.logicprogrammer.client.ExpressionTextController

public abstract class ExpressionTextController extends Object
This handles the text manipulations in the expressions text box.
  • Field Details

  • Constructor Details

  • Method Details

    • getTextField

      public static ExpressionTextField getTextField(ContainerLogicProgrammerBase container)
      Parameters:
      container - The container.
      Returns:
      The text, which is kept in the screen, so it survives the panel being recreated.
    • getTextField

      public ExpressionTextField getTextField()
    • getEditor

      @Nullable protected abstract ExpressionEditor 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

      @Nullable public Expression parseText()
      Returns:
      The expression in the typed text, or null if it does not read as one, as read for the current text.
    • getParsedResult

      @Nullable public ExpressionTypeChecker.Result getParsedResult()
      Returns:
      The types of the expression in the typed text, or null if it does not read as one.
    • getParseError

      @Nullable public ExpressionParseException getParseError()
      Returns:
      Why the typed text does not read as an expression, or null if it does.
    • getParserContext

      public ExpressionParser.Context getParserContext()
    • printExact

      public String printExact(Expression expression)
      Parameters:
      expression - An expression.
      Returns:
      Its canonical form.
    • getRefType

      @Nullable public IValueType<?> getRefType(int variableId)
    • getLabel

      public String getLabel(int variableId)
    • getLabelIds

      public it.unimi.dsi.fastutil.ints.IntList getLabelIds(String label)
    • getDraftError

      @Nullable public ExpressionParseException 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)