Search in sources :

Example 91 with MouseEvent

use of javafx.scene.input.MouseEvent in project POL-POM-5 by PhoenicisOrg.

the class ListWidgetBase method select.

/**
 * Selects the {@link ListWidgetElement} which belongs to the given {@link E innerElement}
 *
 * @param innerElement The inner element
 */
public void select(E innerElement) {
    final MouseEvent event = new MouseEvent(MouseEvent.MOUSE_CLICKED, 0, 0, 0, 0, MouseButton.PRIMARY, 1, false, false, false, false, false, false, false, false, false, false, null);
    select(innerElement, event);
}
Also used : MouseEvent(javafx.scene.input.MouseEvent)

Example 92 with MouseEvent

use of javafx.scene.input.MouseEvent in project POL-POM-5 by PhoenicisOrg.

the class LibraryFeaturePanelSkin method createCombinedListWidget.

private CombinedListWidget<ShortcutDTO> createCombinedListWidget() {
    final FilteredList<ShortcutDTO> filteredShortcuts = ConcatenatedList.create(new MappedList<>(getControl().getCategories().sorted(Comparator.comparing(ShortcutCategoryDTO::getName)), ShortcutCategoryDTO::getShortcuts)).filtered(getControl().getFilter()::filter);
    filteredShortcuts.predicateProperty().bind(Bindings.createObjectBinding(() -> getControl().getFilter()::filter, getControl().getFilter().searchTermProperty(), getControl().getFilter().selectedShortcutCategoryProperty()));
    final SortedList<ShortcutDTO> sortedShortcuts = filteredShortcuts.sorted(Comparator.comparing(shortcut -> shortcut.getInfo().getName()));
    final ObservableList<ListWidgetElement<ShortcutDTO>> listWidgetEntries = new MappedList<>(sortedShortcuts, ListWidgetElement::create);
    final CombinedListWidget<ShortcutDTO> combinedListWidget = new CombinedListWidget<>(listWidgetEntries, this.selectedListWidget);
    // bind direction: controller property -> skin property
    getControl().selectedShortcutProperty().addListener((observable, oldValue, newValue) -> {
        if (newValue != null) {
            combinedListWidget.select(newValue);
        } else {
            combinedListWidget.deselect();
        }
    });
    // bind direction: skin property -> controller properties
    combinedListWidget.selectedElementProperty().addListener((observable, oldValue, newValue) -> {
        if (newValue != null) {
            final ShortcutDTO selectedItem = newValue.getItem();
            final MouseEvent event = newValue.getEvent();
            getControl().setSelectedShortcut(selectedItem);
            getControl().setOpenedDetailsPanel(new ShortcutInformation(selectedItem));
            if (event.getClickCount() == 2) {
                getControl().runShortcut(selectedItem);
            }
        } else {
            getControl().setSelectedShortcut(null);
            getControl().setOpenedDetailsPanel(new None());
        }
    });
    return combinedListWidget;
}
Also used : CombinedListWidget(org.phoenicis.javafx.components.common.widgets.control.CombinedListWidget) ShortcutCategoryDTO(org.phoenicis.library.dto.ShortcutCategoryDTO) StringBindings(org.phoenicis.javafx.utils.StringBindings) ObjectExpression(javafx.beans.binding.ObjectExpression) MappedList(org.phoenicis.javafx.collections.MappedList) MouseEvent(javafx.scene.input.MouseEvent) ShortcutEditing(org.phoenicis.javafx.components.library.panelstates.ShortcutEditing) Bindings(javafx.beans.binding.Bindings) SidebarBase(org.phoenicis.javafx.components.common.control.SidebarBase) org.phoenicis.javafx.components.library.control(org.phoenicis.javafx.components.library.control) ListWidgetElement(org.phoenicis.javafx.components.common.widgets.utils.ListWidgetElement) ShortcutInformation(org.phoenicis.javafx.components.library.panelstates.ShortcutInformation) ShortcutCreation(org.phoenicis.javafx.components.library.panelstates.ShortcutCreation) TabPane(javafx.scene.control.TabPane) None(org.phoenicis.javafx.components.common.panelstates.None) FeaturePanelSkin(org.phoenicis.javafx.components.common.skin.FeaturePanelSkin) ShortcutDTO(org.phoenicis.library.dto.ShortcutDTO) SwitchBinding(org.phoenicis.javafx.utils.SwitchBinding) SortedList(javafx.collections.transformation.SortedList) ListWidgetType(org.phoenicis.javafx.components.common.widgets.utils.ListWidgetType) ObjectProperty(javafx.beans.property.ObjectProperty) Node(javafx.scene.Node) FilteredList(javafx.collections.transformation.FilteredList) Localisation.tr(org.phoenicis.configuration.localisation.Localisation.tr) Observable(javafx.beans.Observable) JavaFxSettingsManager(org.phoenicis.javafx.settings.JavaFxSettingsManager) SimpleObjectProperty(javafx.beans.property.SimpleObjectProperty) Tab(javafx.scene.control.Tab) OpenDetailsPanel(org.phoenicis.javafx.components.common.panelstates.OpenDetailsPanel) DetailsPanel(org.phoenicis.javafx.components.common.control.DetailsPanel) Optional(java.util.Optional) ObjectBindings(org.phoenicis.javafx.utils.ObjectBindings) ObservableList(javafx.collections.ObservableList) ConcatenatedList(org.phoenicis.javafx.collections.ConcatenatedList) Comparator(java.util.Comparator) CombinedListWidget(org.phoenicis.javafx.components.common.widgets.control.CombinedListWidget) MouseEvent(javafx.scene.input.MouseEvent) ListWidgetElement(org.phoenicis.javafx.components.common.widgets.utils.ListWidgetElement) ShortcutInformation(org.phoenicis.javafx.components.library.panelstates.ShortcutInformation) ShortcutDTO(org.phoenicis.library.dto.ShortcutDTO) MappedList(org.phoenicis.javafx.collections.MappedList) ShortcutCategoryDTO(org.phoenicis.library.dto.ShortcutCategoryDTO) None(org.phoenicis.javafx.components.common.panelstates.None)

Example 93 with MouseEvent

use of javafx.scene.input.MouseEvent in project Board-Instrumentation-Framework by intel.

the class AboutBox method Setup.

private static Pane Setup(Stage stage) {
    // TaskManager TASKMAN = TaskManager.getTaskManager();
    ConfigurationReader CONFIG = ConfigurationReader.GetConfigReader();
    GridPane grid = new GridPane();
    URL resource = AboutBox.class.getResource("About.png");
    Image img = new Image(resource.toString());
    ImageView aboutImg = new ImageView(img);
    Button OKBtn = new Button("OK");
    Label By = new Label("by");
    Label Author = new Label("Patrick Kutch");
    Label With = new Label("with Brian Johnson");
    Label With2 = new Label("and Michael Shearer");
    Label Where = new Label("https://github.com/PatrickKutch");
    Label DataCount = new Label("Datapoints: " + Integer.toString(DataManager.getDataManager().NumberOfRegisteredDatapoints()));
    Author.setAlignment(Pos.CENTER);
    GridPane.setHalignment(Author, HPos.CENTER);
    GridPane.setHalignment(By, HPos.CENTER);
    GridPane.setHalignment(With, HPos.CENTER);
    GridPane.setHalignment(With2, HPos.CENTER);
    GridPane.setHalignment(Where, HPos.CENTER);
    Label VerLabel = new Label(Version.getVersion());
    Label Widgets = new Label("Number of Widgets - " + Integer.toString(BaseWidget.getWidgetCount()));
    Label Tasks = new Label("Number of Tasks - " + Integer.toString(BaseTask.getTaskCount()));
    long freeMem = Runtime.getRuntime().freeMemory();
    long totalMem = Runtime.getRuntime().maxMemory();
    long usedMem = totalMem - freeMem;
    usedMem /= 1024.0;
    String MBMemStr = NumberFormat.getNumberInstance(Locale.US).format(usedMem / 1024);
    Label MemUsage = new Label("Mem usage (MB) - " + MBMemStr);
    int newBottom = 1;
    grid.setAlignment(Pos.CENTER);
    grid.add(aboutImg, 1, newBottom++);
    grid.add(By, 1, newBottom++);
    grid.add(Author, 1, newBottom++);
    grid.add(With, 1, newBottom++);
    grid.add(With2, 1, newBottom++);
    grid.add(Where, 1, newBottom++);
    grid.add(new Label(" "), 1, newBottom++);
    if (CONFIG.getConfiguration().GetApplicationID().length() > 0) {
        Label ID = new Label("ID : " + CONFIG.getConfiguration().GetApplicationID());
        grid.add(ID, 1, newBottom++);
    }
    grid.add(VerLabel, 1, newBottom++);
    grid.add(Widgets, 1, newBottom++);
    grid.add(Tasks, 1, newBottom++);
    grid.add(DataCount, 1, newBottom++);
    grid.add(MemUsage, 1, newBottom++);
    GridPane.setHalignment(OKBtn, HPos.CENTER);
    // grid.add(new Label(" "), 1, newBottom++);
    newBottom = AboutBox.SetupExtraInfoPane(grid, newBottom++, 1);
    Slider objSlider = new Slider(.25, 3, CONFIG.getConfiguration().getScaleFactor());
    objSlider.valueProperty().bindBidirectional(CONFIG.getConfiguration().getScaleProperty());
    grid.add(objSlider, 1, newBottom++);
    objSlider.setVisible(false);
    aboutImg.setOnMouseClicked(new EventHandler<MouseEvent>() {

        @Override
        public void handle(MouseEvent event) {
            if (event.isShiftDown()) {
                objSlider.setVisible(true);
            }
        }
    });
    grid.add(OKBtn, 1, newBottom);
    grid.setStyle("-fx-padding: 5; -fx-background-color: cornsilk; -fx-border-width:5; -fx-border-color: linear-gradient(to bottom, chocolate, derive(chocolate, 50%));");
    OKBtn.setOnAction(new EventHandler<ActionEvent>() {

        @Override
        public void handle(ActionEvent t) {
            stage.close();
        }
    });
    // place on correct screen.
    int xPos = (int) (CONFIG.getConfiguration().getPrimaryScreen().getVisualBounds().getMinX());
    int yPos = (int) (CONFIG.getConfiguration().getPrimaryScreen().getVisualBounds().getMinY());
    stage.setX(xPos);
    stage.setY(yPos);
    // and center it.
    stage.centerOnScreen();
    return grid;
}
Also used : GridPane(javafx.scene.layout.GridPane) MouseEvent(javafx.scene.input.MouseEvent) Slider(javafx.scene.control.Slider) ActionEvent(javafx.event.ActionEvent) Label(javafx.scene.control.Label) Image(javafx.scene.image.Image) URL(java.net.URL) Button(javafx.scene.control.Button) ImageView(javafx.scene.image.ImageView) ConfigurationReader(kutch.biff.marvin.configuration.ConfigurationReader)

Aggregations

MouseEvent (javafx.scene.input.MouseEvent)93 KeyCode (javafx.scene.input.KeyCode)33 Scene (javafx.scene.Scene)32 Group (javafx.scene.Group)29 PerspectiveCamera (javafx.scene.PerspectiveCamera)23 PointLight (javafx.scene.PointLight)22 Rotate (javafx.scene.transform.Rotate)21 List (java.util.List)20 EventHandler (javafx.event.EventHandler)19 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)17 Color (javafx.scene.paint.Color)16 AnimationTimer (javafx.animation.AnimationTimer)14 Image (javafx.scene.image.Image)13 Font (javafx.scene.text.Font)13 ArrayList (java.util.ArrayList)12 Pane (javafx.scene.layout.Pane)12 KeyFrame (javafx.animation.KeyFrame)10 Timeline (javafx.animation.Timeline)10 Insets (javafx.geometry.Insets)10 ImageView (javafx.scene.image.ImageView)10