Package limelight.ui.text

Examples of limelight.ui.text.TypedLayout


  }

  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


  }

  @Override
  public Dimension getTextDimensions()
  {
    TypedLayout activeLayout = getLines().get(0);
    return new Dimension(activeLayout.getWidth(), activeLayout.getHeight());
  }
View Full Code Here

  public int getAbsoluteY(TextLocation location)
  {
    int height = 0;
    for(int i = 0; i < location.line; i++)
    {
      TypedLayout layout = getLines().get(i);
      height += layout.getHeightWithLeading();
    }
    return height;
  }
View Full Code Here

    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

  }

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

    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();

    if(caretHeight > boundingBox.height)
      yOffset = (caretHeight - boundingBox.height) / -2;
    else if(relativeCaretY + caretHeight >= boundingBox.height)
      yOffset = -absoluteCaretY - caretHeight + boundingBox.height;
View Full Code Here

  }

  @Override
  public TextLocation getLocationAt(Point point)
  {
    TypedLayout layout = getLine();
    int index = layout.getIndexAt(point.x - getXOffset());
    return TextLocation.at(0, index);
  }
View Full Code Here

  {
    int remainingY = point.y - getYOffset();
    ArrayList<TypedLayout> lines = getLines();
    for(int lineNumber = 0; lineNumber < lines.size(); lineNumber++)
    {
      TypedLayout line = lines.get(lineNumber);
      int lineHeight = line.getHeight();
      if(lineHeight > remainingY)
      {
        int lineIndex = line.getIndexAt(point.x - getXOffset(line));
        return TextLocation.at(lineNumber, lineIndex);
      }
      else
      {
        remainingY -= lineHeight;
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

    ArrayList<TypedLayout> lines = getLines();
    int y = getY(start);
    for(int i = start.line; i <= end.line; i++)
    {
      TypedLayout line = lines.get(i);
      int startX = i == start.line ? line.getX(start.index) + getXOffset(line) : 0;
      int endX = i == end.line ? line.getX(end.index) + getXOffset(line) : getContainer().getWidth();

      regions.add(new Box(startX, y, endX - startX, line.getHeight()));

      y += line.getHeight() + line.getLeading();
    }

    return regions;
  }
View Full Code Here

TOP

Related Classes of limelight.ui.text.TypedLayout

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.