Search in sources :

Example 11 with Panel

use of limelight.ui.Panel in project limelight by slagyr.

the class StyleAttributeTest method setUp.

@Before
public void setUp() throws Exception {
    panel = new MockChangeablePanel();
    attribute = new StyleAttribute("NAME", new IntegerAttributeCompiler(), new SimpleIntegerValue(50));
    Context.instance().bufferedImageCache = new SimpleCache<Panel, BufferedImage>();
}
Also used : MockChangeablePanel(limelight.ui.model.MockChangeablePanel) Panel(limelight.ui.Panel) MockChangeablePanel(limelight.ui.model.MockChangeablePanel) SimpleIntegerValue(limelight.styles.values.SimpleIntegerValue) IntegerAttributeCompiler(limelight.styles.compiling.IntegerAttributeCompiler) BufferedImage(java.awt.image.BufferedImage) Before(org.junit.Before)

Example 12 with Panel

use of limelight.ui.Panel in project limelight by slagyr.

the class ParentPanelTest method removeRequiresUpdate.

@Test
public void removeRequiresUpdate() throws Exception {
    Panel child = new MockPanel();
    panel.add(child);
    resetFamilyLayouts();
    panel.remove(child);
    assertEquals(true, panel.needsLayout());
}
Also used : Panel(limelight.ui.Panel) MockPanel(limelight.ui.MockPanel) MockPanel(limelight.ui.MockPanel) Test(org.junit.Test)

Example 13 with Panel

use of limelight.ui.Panel in project limelight by slagyr.

the class ParentPanelTest method shouldGetOwnerOfPoint.

@Test
public void shouldGetOwnerOfPoint() throws Exception {
    Panel panel1 = new MockPanel();
    Panel panel2 = new MockPanel();
    panel1.setLocation(0, 0);
    panel1.setSize(100, 100);
    panel2.setLocation(100, 100);
    panel2.setSize(100, 100);
    panel.add(panel1);
    panel.add(panel2);
    assertSame(panel1, panel.getOwnerOfPoint(new Point(0, 0)));
    assertSame(panel2, panel.getOwnerOfPoint(new Point(100, 100)));
    assertSame(panel1, panel.getOwnerOfPoint(new Point(50, 50)));
    assertSame(panel2, panel.getOwnerOfPoint(new Point(150, 150)));
    assertSame(panel, panel.getOwnerOfPoint(new Point(150, 50)));
    assertSame(panel, panel.getOwnerOfPoint(new Point(50, 150)));
}
Also used : Panel(limelight.ui.Panel) MockPanel(limelight.ui.MockPanel) MockPanel(limelight.ui.MockPanel) Test(org.junit.Test)

Example 14 with Panel

use of limelight.ui.Panel in project limelight by slagyr.

the class PropPanelLayout method buildRows.

protected LinkedList<Row> buildRows(PropPanel panel) {
    LinkedList<Row> rows = new LinkedList<Row>();
    Row currentRow = newRow(panel, rows);
    for (Panel child : panel.getChildren()) {
        if (!(child instanceof ScrollBarPanel) && !child.isFloater()) {
            if (!currentRow.isEmpty() && !currentRow.fits(child)) {
                currentRow = newRow(panel, rows);
            }
            currentRow.add(child);
        }
    }
    return rows;
}
Also used : Panel(limelight.ui.Panel) ScrollBarPanel(limelight.ui.model.inputs.ScrollBarPanel) ScrollBarPanel(limelight.ui.model.inputs.ScrollBarPanel) LinkedList(java.util.LinkedList)

Example 15 with Panel

use of limelight.ui.Panel in project limelight by slagyr.

the class StageKeyListener method focusOn.

public void focusOn(Panel panel) {
    if (panel == null || panel == focusedPanel)
        return;
    Panel previouslyFocusPanel = focusedPanel;
    focusedPanel = panel;
    if (previouslyFocusPanel != null)
        new FocusLostEvent().dispatch(previouslyFocusPanel);
    new FocusGainedEvent().dispatch(panel);
}
Also used : InputPanel(limelight.ui.model.inputs.InputPanel) Panel(limelight.ui.Panel)

Aggregations

Panel (limelight.ui.Panel)38 Test (org.junit.Test)13 MockPanel (limelight.ui.MockPanel)12 PropPanel (limelight.ui.model.PropPanel)9 BufferedImage (java.awt.image.BufferedImage)4 java.util (java.util)2 MockChangeablePanel (limelight.ui.model.MockChangeablePanel)2 InputPanel (limelight.ui.model.inputs.InputPanel)2 ScrollBarPanel (limelight.ui.model.inputs.ScrollBarPanel)2 Box (limelight.util.Box)2 Before (org.junit.Before)2 LinkedList (java.util.LinkedList)1 FakeProduction (limelight.model.FakeProduction)1 FakePlayerRecruiter (limelight.model.api.FakePlayerRecruiter)1 IntegerAttributeCompiler (limelight.styles.compiling.IntegerAttributeCompiler)1 SimpleIntegerValue (limelight.styles.values.SimpleIntegerValue)1 BufferedImagePool (limelight.ui.BufferedImagePool)1 limelight.ui.events.panel (limelight.ui.events.panel)1 PanelEvent (limelight.ui.events.panel.PanelEvent)1 TextLocation (limelight.ui.text.TextLocation)1