Example usage for javafx.scene.input KeyCode CONTROL

List of usage examples for javafx.scene.input KeyCode CONTROL

Introduction

In this page you can find the example usage for javafx.scene.input KeyCode CONTROL.

Prototype

KeyCode CONTROL

To view the source code for javafx.scene.input KeyCode CONTROL.

Click Source Link

Document

Constant for the Ctrl key.

Usage

From source file:org.eclipse.jubula.rc.javafx.driver.RobotJavaFXImpl.java

/**
 * @param clickModifier//w ww.ja va2s  .  co m
 *            the click modifier to use for this click
 * @return an array of modifiers to press before click and release after
 *         click
 */
private int[] getModifierMask(ClickModifier clickModifier) {
    int[] modifier = new int[0];
    if (clickModifier.hasModifiers(ClickModifier.M1)) {
        modifier = ArrayUtils.add(modifier, KeyCode.CONTROL.impl_getCode());
    }
    if (clickModifier.hasModifiers(ClickModifier.M2)) {
        modifier = ArrayUtils.add(modifier, KeyCode.SHIFT.impl_getCode());
    }
    if (clickModifier.hasModifiers(ClickModifier.M3)) {
        modifier = ArrayUtils.add(modifier, KeyCode.ALT.impl_getCode());
    }
    if (clickModifier.hasModifiers(ClickModifier.M4)) {
        modifier = ArrayUtils.add(modifier, KeyCode.META.impl_getCode());
    }
    return modifier;
}

From source file:org.pdfsam.ui.selection.multiple.SelectionTableTest.java

@Test
public void multipleSelect() throws Exception {
    HitTestListener<SelectionChangedEvent> listener = new HitTestListener<SelectionChangedEvent>() {
        @Override//ww  w . j  a  va2s.co m
        public void onEvent(SelectionChangedEvent event) {
            super.onEvent(event);
            assertFalse(event.isSingleSelection());
        }
    };
    populate();
    click("temp.pdf").press(KeyCode.CONTROL);
    eventStudio().add(SelectionChangedEvent.class, listener, MODULE);
    click("temp3.pdf");
    release(KeyCode.CONTROL);
    assertTrue(listener.isHit());
}

From source file:org.pdfsam.ui.selection.multiple.SelectionTableTest.java

@Test
public void clearSelectionByClick() throws Exception {
    populate();//  w w  w . j av a  2s  .  c  o  m
    click("temp.pdf");
    SelectionTable victim = find("#victim");
    assertEquals(1, victim.getSelectionModel().getSelectedIndices().size());
    Listener<SelectionChangedEvent> listener = mock(Listener.class);
    ArgumentCaptor<SelectionChangedEvent> captor = ArgumentCaptor.forClass(SelectionChangedEvent.class);
    eventStudio().add(SelectionChangedEvent.class, listener, MODULE);
    press(KeyCode.CONTROL).click("temp.pdf");
    assertTrue(victim.getSelectionModel().getSelectedIndices().isEmpty());
    release(KeyCode.CONTROL);
    verify(listener).onEvent(captor.capture());
    assertTrue(captor.getValue().isClearSelection());
}

From source file:org.pdfsam.ui.selection.multiple.SelectionTableTest.java

@Test
@Ignore("Fails on CI server")
// TODO/*  w w w.  j ava2 s .  co m*/
public void removeMultiple() throws Exception {
    populate();
    click("temp.pdf").press(KeyCode.CONTROL).click("temp3.pdf").release(KeyCode.CONTROL);
    FXTestUtils.invokeAndWait(() -> {
        eventStudio().broadcast(new RemoveSelectedEvent(), MODULE);
    }, 2);
    SelectionTable victim = find("#victim");
    assertEquals(2, victim.getItems().size());
    assertEquals(1, victim.getSelectionModel().getSelectedIndices().size());
}