Package limelight.util

Examples of limelight.util.Box


  }

  @Test
  public void consumableBoundsAreCachedAndRefreshed() throws Exception
  {
    final Box original = panel.getConsumableBounds();
    assertSame(panel.getConsumableBounds(), original);

    panel.clearCache();

    assertNotSame(panel.getConsumableBounds(), original);
View Full Code Here


    return height;
  }

  public void recalculateOffset(XOffsetStrategy xOffsetStrategy, YOffsetStrategy yOffsetStrategy)
  {
    Box boundingBox = getContainer().getConsumableBounds();
    Dimension textDimensions = getTextDimensions();

    int xOffset, yOffset;
    if(textDimensions.width < boundingBox.width)
      xOffset = getHorizontalAlignment().getX(textDimensions.width, boundingBox);
View Full Code Here

public class FittingYOffsetStrategy implements YOffsetStrategy
{
  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

public class CenteredXOffsetStrategy implements XOffsetStrategy
{
  public int calculateXOffset(limelight.ui.model.text.TextModel model)
  {
    int xOffset = model.getXOffset();
    Box boundingBox = model.getContainer().getConsumableBounds();
    int absoluteCaretX = model.getAbsoluteX(model.getCaretLocation());
    int relativeCaretX = absoluteCaretX + xOffset;

    if(relativeCaretX >= boundingBox.width || relativeCaretX < 0)
    {
View Full Code Here

      if(rectangle.width <= 0 || rectangle.height <= 0)
        continue;
      Graphics2D rootGraphics = root.getGraphics();
      if(rootGraphics != null)
      {
        doPaintJob(root, new Box(rectangle), rootGraphics);
      }
    }
  }
View Full Code Here

public class FittingXOffsetStrategy implements XOffsetStrategy
{
  public int calculateXOffset(limelight.ui.model.text.TextModel model)
  {
    int xOffset = model.getXOffset();
    Box boundingBox = model.getContainer().getConsumableBounds();
    int absoluteCaretX = model.getAbsoluteX(model.getCaretLocation());
    int relativeCaretX = absoluteCaretX + xOffset;

    if(relativeCaretX >= boundingBox.width)
      xOffset = (absoluteCaretX - boundingBox.width + model.getCaretWidth()) * -1;
 
View Full Code Here

    int x2 = getAbsoluteX(getSelectionLocation());
    int start = Math.min(x1, x2);
    int end = Math.max(x1, x2);

    ArrayList<Box> regions = new ArrayList<Box>();
    regions.add(new Box(start, 0, end - start, getLine().getHeight() + 1).translated(getOffset()));
    return regions;
  }
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

    {
      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

  {
    panel.setLocation(3, 3);
    panel.setSize(50, 50);
    panel.getStyle().setMargin(5);

    final Box bounds = panel.getMarginedBounds();

    assertEquals(5, bounds.x);
    assertEquals(5, bounds.y);
    assertEquals(40, bounds.width);
    assertEquals(40, bounds.height);
View Full Code Here

TOP

Related Classes of limelight.util.Box

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.