Class LineSelection

java.lang.Object
io.github.jbastgen.stemma.app.git.LineSelection

public final class LineSelection extends Object
The lines the user has selected in the diff of the working tree (feature 50): the keys of the lines (+12, -7, see Hunks.ChangeLine) of one section of the diff, the unstaged or the staged changes. It outlives the diff view, which is made again whenever the repository view is drawn, and belongs to one file: another file starts with nothing selected. Pure, no JavaFX.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    The section of the lines: "stage" for the unstaged changes (they can be staged or discarded), "unstage" for the staged ones.
    int
    The row that was clicked last; the start of a range made with Shift.
    void
    Forgets all lines and the anchor.
    boolean
    contains(String section, String key)
    Whether the line is selected in this section.
    void
    forOwner(String newOwner)
    Starts over when the diff is of another file or commit than the one the selection was made in.
    boolean
    Whether no line is selected.
    The keys, in the order they were selected.
    void
    paint(String section, Collection<String> range, boolean select, int row)
    Selects or unselects a range of lines (as one drag or a click with Shift does); lines of the other section replace the selection.
    void
    retain(Set<String> existing)
    Takes lines out of the selection, for example those that are gone from the diff after something was staged.
    int
    How many lines are selected.
    boolean
    toggle(String section, String key, int row)
    Selects or unselects one line; a line of the other section replaces the selection.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • LineSelection

      public LineSelection()
  • Method Details

    • forOwner

      public void forOwner(String newOwner)
      Starts over when the diff is of another file or commit than the one the selection was made in.
    • clear

      public void clear()
      Forgets all lines and the anchor.
    • isEmpty

      public boolean isEmpty()
      Whether no line is selected.
    • size

      public int size()
      How many lines are selected.
    • action

      public String action()
      The section of the lines: "stage" for the unstaged changes (they can be staged or discarded), "unstage" for the staged ones.
    • keys

      public Set<String> keys()
      The keys, in the order they were selected.
    • contains

      public boolean contains(String section, String key)
      Whether the line is selected in this section.
    • anchor

      public int anchor()
      The row that was clicked last; the start of a range made with Shift.
    • toggle

      public boolean toggle(String section, String key, int row)
      Selects or unselects one line; a line of the other section replaces the selection. Returns whether the line is selected now.
    • paint

      public void paint(String section, Collection<String> range, boolean select, int row)
      Selects or unselects a range of lines (as one drag or a click with Shift does); lines of the other section replace the selection.
    • retain

      public void retain(Set<String> existing)
      Takes lines out of the selection, for example those that are gone from the diff after something was staged.