Search in sources :

Example 16 with Panel

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

the class StageMouseListener method mouseMoved.

public void mouseMoved(MouseEvent e) {
    if (getRoot() == null)
        return;
    Panel panel = panelFor(e.getPoint());
    if (panel != hooveredPanel)
        transition(panel, e);
    new MouseMovedEvent(e.getModifiers(), e.getPoint(), e.getClickCount()).dispatch(panel);
}
Also used : Panel(limelight.ui.Panel)

Example 17 with Panel

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

the class StageMouseListener method transition.

private void transition(Panel panel, MouseEvent e) {
    if (hooveredPanel == null) {
        new MouseEnteredEvent(e.getModifiers(), e.getPoint(), e.getClickCount()).dispatch(panel);
        enter(panel, panel, e);
    } else if (hooveredPanel.isDescendantOf(panel))
        exit(hooveredPanel, panel, e);
    else if (panel.isDescendantOf(hooveredPanel))
        enter(panel, hooveredPanel, e);
    else {
        Panel ancestor = hooveredPanel.getClosestCommonAncestor(panel);
        exit(hooveredPanel, ancestor, e);
        enter(panel, ancestor, e);
    }
    hooveredPanel = panel;
}
Also used : Panel(limelight.ui.Panel)

Example 18 with Panel

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

the class PanelEvent method dispatch.

public void dispatch(Panel panel) {
    if (source == null)
        setSource(panel);
    Panel previousRecipient = recipient;
    setRecipient(panel);
    final PanelEventHandler eventHandler = recipient.getEventHandler();
    eventHandler.dispatch(this);
    setRecipient(previousRecipient);
}
Also used : Panel(limelight.ui.Panel)

Example 19 with Panel

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

the class DropDownPanelTest method itemsIsSelectedOnMouseEnter.

@Test
public void itemsIsSelectedOnMouseEnter() throws Exception {
    panel.setChoicesVargs(1, 2, 3);
    new ButtonPushedEvent().dispatch(panel);
    final Panel item3 = panel.getPopup().getPopupList().getChildren().get(2);
    new MouseEnteredEvent(0, null, 0).dispatch(item3);
    assertEquals("3", panel.getPopup().getSelectedItem().getText());
}
Also used : Panel(limelight.ui.Panel) PropPanel(limelight.ui.model.PropPanel) Test(org.junit.Test)

Example 20 with Panel

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

the class ParentPanelTest method shouldGetOwnerOfPointWithNestedPanels.

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

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