Package limelight.ui.text

Examples of limelight.ui.text.TextLocation


  public void processMouseDragged(MouseDraggedEvent e)
  {
    Point mousePoint = e.getLocation();

    ArrayList<TypedLayout> lines = model.getLines();
    TextLocation tempLocation = model.getLocationAt(mousePoint);

    // TODO MDM - This needs work.  Ideally, the text will scroll smoothly, a pixel at a time, without the mouse moving.  The scoll speed increased as the mouse moves away.
    if(mousePoint.x < 3 && tempLocation.index > 0)
      tempLocation = tempLocation.moved(lines, -1);
    else if(mousePoint.x > (model.getContainer().getWidth() - 3) && tempLocation.atEnd(lines))
      tempLocation = tempLocation.moved(lines, +1);

    if(inWordSelectionMode)
      selectWord(tempLocation);
    else
      model.setCaretLocation(tempLocation, XOffsetStrategy.FITTING, YOffsetStrategy.FITTING);
View Full Code Here


  {
    if(model.isSelectionActivated())
      model.deleteSelection();
    else if(model.getCaretLocation().before(model.getEndLocation()))
    {
      TextLocation start = model.getCaretLocation();
      TextLocation end = start.moved(model.getLines(), 1);
      model.deleteEnclosedText(start, end);
    }
  }
View Full Code Here

  {
    if(model.isSelectionActivated())
      model.deleteSelection();
    else if(TextLocation.origin.before(model.getCaretLocation()))
    {
      TextLocation end = model.getCaretLocation();
      TextLocation start = end.moved(model.getLines(), -1);
      model.deleteEnclosedText(start, end);
    }
  }
View Full Code Here

    return model.getCaretLocation().index > 0 || canMoveUp(model);
  }

  private boolean canMoveRight(TextModel model)
  {
    final TextLocation caret = model.getCaretLocation();
    final TypedLayout line = model.getLines().get(caret.line);
    return caret.index < line.length() || canMoveDown(model);
  }
View Full Code Here

  public void processMousePressed(MousePressedEvent e)
  {
    final Panel panel = e.getRecipient();
    inWordSelectionMode = false;

    TextLocation location = model.getLocationAt(e.getLocation());
    model.startSelection(location);
    model.setCaretLocation(location, XOffsetStrategy.FITTING, YOffsetStrategy.FITTING);
    model.setCaretOn(true);

    handleMultipleClicks(e);
View Full Code Here

    return offset.y;
  }

  public int getX(int index)
  {
    TextLocation location = TextLocation.fromIndex(getLines(), index);
    return getX(location);
  }
View Full Code Here

  {
    ArrayList<TypedLayout> lines = getLines();
    int newLineNumber = caretLocation.line + lineDelta;
    if(newLineNumber >= 0 && newLineNumber < lines.size())
    {
      TextLocation origin = verticalOrigin != null ? verticalOrigin : caretLocation;
      int desiredX = lines.get(origin.line).getX(origin.index);

      TypedLayout newLine = lines.get(newLineNumber);
      int newIndex = newLine.getIndexAt(desiredX);

      TextLocation newLocation = TextLocation.at(newLineNumber, newIndex);
      setCaretLocation(newLocation);

      verticalOrigin = origin;
    }
  }
View Full Code Here

    setCaretLocation(TextLocation.at(getCaretLocation().line, 0));
  }

  public void sendCaretToEndOfLine()
  {
    final TextLocation caret = getCaretLocation();
    TypedLayout caretLine = getLines().get(caret.line);
    setCaretLocation(TextLocation.at(caret.line, caretLine.visibleLength()));
  }
View Full Code Here

{
  public int calculateYOffset(limelight.ui.model.text.TextModel model)
  {
    int yOffset = model.getYOffset();
    Box boundingBox = model.getContainer().getConsumableBounds();
    TextLocation caretLocation = model.getCaretLocation();
    int absoluteCaretY = model.getAbsoluteY(caretLocation);
    int relativeCaretY = absoluteCaretY + yOffset;
    TypedLayout caretLine = model.getLines().get(caretLocation.line);
    int caretHeight = caretLine.getHeight();
View Full Code Here

  }

  @Override
  public Box getCaretShape()
  {
    TextLocation caretLocation = getCaretLocation();
    TypedLayout line = getLines().get(caretLocation.line);
    Box caretShape = line.getCaretShape(caretLocation.index);
    caretShape.translate(getXOffset(line), getY(caretLocation));
    return caretShape;
  }
View Full Code Here

TOP

Related Classes of limelight.ui.text.TextLocation

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.