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);
}
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;
}
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;
}
Aggregations