Search in sources :

Example 1 with ScrollBarPanel

use of limelight.ui.model.inputs.ScrollBarPanel in project limelight by slagyr.

the class ScrollBarPainterTest method setUpVertically.

private void setUpVertically() {
    scrollBar = new ScrollBarPanel(ScrollBarPanel.VERTICAL);
    scrollBar.setSize(15, 100);
    scrollBar.setValue(0);
    scrollBar.configure(1, 100);
    graphics = new MockGraphics();
    images = ScrollBarPainter.verticalImages;
}
Also used : MockGraphics(limelight.ui.MockGraphics) ScrollBarPanel(limelight.ui.model.inputs.ScrollBarPanel)

Example 2 with ScrollBarPanel

use of limelight.ui.model.inputs.ScrollBarPanel in project limelight by slagyr.

the class PropPanelTest method shouldGetOwnerOfPointGivesPriorityToScrollBars.

@Test
public void shouldGetOwnerOfPointGivesPriorityToScrollBars() throws Exception {
    panel.setSize(100, 100);
    MockPanel child = new MockPanel();
    child.setSize(100, 100);
    child.setLocation(0, 0);
    panel.add(child);
    panel.addVerticalScrollBar();
    ScrollBarPanel vertical = panel.getVerticalScrollbar();
    vertical.setSize(15, 100);
    vertical.setLocation(85, 0);
    panel.addHorizontalScrollBar();
    ScrollBarPanel horizontal = panel.getHorizontalScrollbar();
    horizontal.setSize(100, 15);
    horizontal.setLocation(0, 85);
    assertSame(child, panel.getOwnerOfPoint(new Point(0, 0)));
    assertSame(child, panel.getOwnerOfPoint(new Point(50, 50)));
    assertSame(vertical, panel.getOwnerOfPoint(new Point(90, 50)));
    assertSame(horizontal, panel.getOwnerOfPoint(new Point(50, 90)));
}
Also used : ScrollBarPanel(limelight.ui.model.inputs.ScrollBarPanel) Test(org.junit.Test)

Example 3 with ScrollBarPanel

use of limelight.ui.model.inputs.ScrollBarPanel in project limelight by slagyr.

the class PropPanelLayout method layoutScrollBars.

//  private boolean hasNonScrollBarChildren(PropPanel panel)
//  {
//    List<Panel> children = panel.getChildren();
//    if(children.size() == 0)
//      return false;
//    else if(children.size() == 1)
//      return !(children.contains(panel.getVerticalScrollbar()) || children.contains(panel.getHorizontalScrollbar()));
//    else if(children.size() == 2)
//      return !(children.contains(panel.getVerticalScrollbar()) && children.contains(panel.getHorizontalScrollbar()));
//    else
//      return true;
//  }
private void layoutScrollBars(PropPanel panel, Dimension consumedDimensions) {
    ScrollBarPanel vertical = panel.getVerticalScrollbar();
    ScrollBarPanel horizontal = panel.getHorizontalScrollbar();
    Box area = panel.getChildConsumableBounds();
    if (vertical != null) {
        vertical.setHeight(area.height);
        vertical.setLocation(area.right() + 1, area.y);
        vertical.configure(area.height, consumedDimensions.height);
    }
    if (horizontal != null) {
        horizontal.setWidth(area.width);
        horizontal.setLocation(area.x, area.bottom() + 1);
        horizontal.configure(area.width, consumedDimensions.width);
    }
}
Also used : ScrollBarPanel(limelight.ui.model.inputs.ScrollBarPanel) Box(limelight.util.Box)

Example 4 with ScrollBarPanel

use of limelight.ui.model.inputs.ScrollBarPanel in project limelight by slagyr.

the class PropPanel method addVerticalScrollBar.

public void addVerticalScrollBar() {
    verticalScrollbar = new ScrollBarPanel(ScrollBarPanel.VERTICAL);
    add(verticalScrollbar);
    childConsumableBounds = null;
}
Also used : ScrollBarPanel(limelight.ui.model.inputs.ScrollBarPanel)

Example 5 with ScrollBarPanel

use of limelight.ui.model.inputs.ScrollBarPanel in project limelight by slagyr.

the class PropPanel method addHorizontalScrollBar.

public void addHorizontalScrollBar() {
    horizontalScrollbar = new ScrollBarPanel(ScrollBarPanel.HORIZONTAL);
    add(horizontalScrollbar);
    childConsumableBounds = null;
}
Also used : ScrollBarPanel(limelight.ui.model.inputs.ScrollBarPanel)

Aggregations

ScrollBarPanel (limelight.ui.model.inputs.ScrollBarPanel)9 MockGraphics (limelight.ui.MockGraphics)2 Test (org.junit.Test)2 LinkedList (java.util.LinkedList)1 Lock (java.util.concurrent.locks.Lock)1 Panel (limelight.ui.Panel)1 Box (limelight.util.Box)1