List of usage examples for javafx.scene.input MouseEvent MOUSE_CLICKED
EventType MOUSE_CLICKED
To view the source code for javafx.scene.input MouseEvent MOUSE_CLICKED.
Click Source Link
From source file:Main.java
@Override public void start(Stage stage) { stage.setTitle("Menu Sample"); Scene scene = new Scene(new VBox(), 400, 350); scene.setFill(Color.OLDLACE); name.setFont(new Font("Verdana Bold", 22)); binName.setFont(new Font("Arial Italic", 10)); pic.setFitHeight(150);//from w w w.jav a2 s. c om pic.setPreserveRatio(true); description.setWrapText(true); description.setTextAlignment(TextAlignment.JUSTIFY); shuffle(); MenuBar menuBar = new MenuBar(); // --- Graphical elements final VBox vbox = new VBox(); vbox.setAlignment(Pos.CENTER); vbox.setSpacing(10); vbox.setPadding(new Insets(0, 10, 0, 10)); vbox.getChildren().addAll(name, binName, pic, description); // --- Menu File Menu menuFile = new Menu("File"); MenuItem add = new MenuItem("Shuffle", new ImageView(new Image("src/menusample/new.png"))); add.setOnAction(new EventHandler<ActionEvent>() { public void handle(ActionEvent t) { shuffle(); vbox.setVisible(true); } }); MenuItem clear = new MenuItem("Clear"); clear.setAccelerator(KeyCombination.keyCombination("Ctrl+X")); clear.setOnAction(new EventHandler<ActionEvent>() { public void handle(ActionEvent t) { vbox.setVisible(false); } }); MenuItem exit = new MenuItem("Exit"); exit.setOnAction(new EventHandler<ActionEvent>() { public void handle(ActionEvent t) { System.exit(0); } }); menuFile.getItems().addAll(add, clear, new SeparatorMenuItem(), exit); // --- Menu Edit Menu menuEdit = new Menu("Edit"); Menu menuEffect = new Menu("Picture Effect"); final ToggleGroup groupEffect = new ToggleGroup(); for (Entry effect : effects) { RadioMenuItem itemEffect = new RadioMenuItem((String) effect.getKey()); itemEffect.setUserData(effect.getValue()); itemEffect.setToggleGroup(groupEffect); menuEffect.getItems().add(itemEffect); } final MenuItem noEffects = new MenuItem("No Effects"); noEffects.setDisable(true); noEffects.setOnAction(new EventHandler<ActionEvent>() { public void handle(ActionEvent t) { pic.setEffect(null); groupEffect.getSelectedToggle().setSelected(false); noEffects.setDisable(true); } }); groupEffect.selectedToggleProperty().addListener(new ChangeListener<Toggle>() { public void changed(ObservableValue ov, Toggle old_toggle, Toggle new_toggle) { if (groupEffect.getSelectedToggle() != null) { Effect effect = (Effect) groupEffect.getSelectedToggle().getUserData(); pic.setEffect(effect); noEffects.setDisable(false); } else { noEffects.setDisable(true); } } }); menuEdit.getItems().addAll(menuEffect, noEffects); // --- Menu View Menu menuView = new Menu("View"); CheckMenuItem titleView = createMenuItem("Title", name); CheckMenuItem binNameView = createMenuItem("Binomial name", binName); CheckMenuItem picView = createMenuItem("Picture", pic); CheckMenuItem descriptionView = createMenuItem("Decsription", description); menuView.getItems().addAll(titleView, binNameView, picView, descriptionView); menuBar.getMenus().addAll(menuFile, menuEdit, menuView); // --- Context Menu final ContextMenu cm = new ContextMenu(); MenuItem cmItem1 = new MenuItem("Copy Image"); cmItem1.setOnAction(new EventHandler<ActionEvent>() { public void handle(ActionEvent e) { Clipboard clipboard = Clipboard.getSystemClipboard(); ClipboardContent content = new ClipboardContent(); content.putImage(pic.getImage()); clipboard.setContent(content); } }); cm.getItems().add(cmItem1); pic.addEventHandler(MouseEvent.MOUSE_CLICKED, new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent e) { if (e.getButton() == MouseButton.SECONDARY) cm.show(pic, e.getScreenX(), e.getScreenY()); } }); ((VBox) scene.getRoot()).getChildren().addAll(menuBar, vbox); stage.setScene(scene); stage.show(); }
From source file:edu.kit.trufflehog.view.jung.visualization.FXVisualizationViewer.java
synchronized private void initVertex(INode vertex) { if (vertex.getAddress().isMulticast()) { return;//from w w w.java 2s . c om } final IRenderer renderer = vertex.getComponent(ViewComponent.class).getRenderer(); final Shape nodeShape = renderer.getShape(); //nodeShape.addEventFilter( MouseEvent.MOUSE_PRESSED, nodeGestures.getOnMousePressedEventHandler()); //nodeShape.addEventFilter( MouseEvent.MOUSE_DRAGGED, nodeGestures.getOnMouseDraggedEventHandler()); //nodeShape.setCache(false); //nodeShape.setCacheHint(CacheHint.); final NodeStatisticsComponent nsc = vertex.getComponent(NodeStatisticsComponent.class); final DoubleBinding nodeSize = MyBindings .divideIntToDouble(nsc.getCommunicationCountProperty(), port.getMaxThroughputProperty()).add(1); nodeShape.scaleXProperty().bind(nodeSize); nodeShape.scaleYProperty().bind(nodeSize); nodeShape.setLayoutX(layout.transform(vertex).getX()); nodeShape.setLayoutY(layout.transform(vertex).getY()); /////////// // LABEL // /////////// Label nodeLabel = new Label(); // cast the shapes to circles (because right now i know they are circles) //TODO make this for arbitrary shapes final Circle nodeCircle = (Circle) nodeShape; /* final DoubleProperty labelX = new SimpleDoubleProperty(); final DoubleProperty labelY = new SimpleDoubleProperty();*/ //labelX.bind(nodeShape.layoutXProperty().add(nodeCircle.radiusProperty().multiply(nodeShape.scaleXProperty()))); //labelY.bind(nodeShape.layoutYProperty().add(nodeCircle.radiusProperty().multiply(nodeShape.scaleYProperty()))); //nodeLabel.layoutXProperty().bindBidirectionalWithOffset(labelX); //nodeLabel.layoutYProperty().bindBidirectionalWithOffset(labelY); //nodeLabel.layoutXProperty().bind(nodeShape.layoutXProperty().add(nodeCircle.radiusProperty().multiply(nodeShape.scaleXProperty()))); nodeLabel.textFillProperty().bind(new SimpleObjectProperty<>(Color.WHITE)); //MyBindings.bindBidirectionalWithOffset(nodeLabel.layoutXProperty(), nodeShape.layoutXProperty(), nodeCircle.radiusProperty().multiply(nodeShape.scaleXProperty())); //MyBindings.bindBidirectionalWithOffset(nodeLabel.layoutYProperty(), nodeShape.layoutYProperty(), nodeCircle.radiusProperty().multiply(nodeShape.scaleYProperty())); nodeLabel.layoutXProperty().bind(nodeShape.layoutXProperty().add(nodeShape.translateXProperty()) .add(nodeCircle.radiusProperty().multiply(nodeShape.scaleXProperty()))); nodeLabel.layoutYProperty().bind(nodeShape.layoutYProperty().add(nodeShape.translateYProperty()) .add(nodeCircle.radiusProperty().multiply(nodeShape.scaleYProperty()))); NodeInfoComponent nic = vertex.getComponent(NodeInfoComponent.class); if (nic != null) { nodeLabel.textProperty().bind(nic.toStringBinding()); } nodeLabel.scaleXProperty().bind(Bindings.divide(1, canvas.scaleXProperty())); nodeLabel.scaleYProperty().bind(Bindings.divide(1, canvas.scaleYProperty())); nodeLabel.addEventFilter(MouseEvent.MOUSE_PRESSED, nodeGestures.getOnMousePressedEventHandler(vertex)); nodeLabel.addEventFilter(MouseEvent.MOUSE_DRAGGED, nodeGestures.getOnMouseDraggedEventHandler(vertex)); nodeLabel.addEventFilter(MouseEvent.MOUSE_RELEASED, nodeGestures.getOnMouseReleasedEventHandler(vertex)); nodeShape.addEventFilter(MouseEvent.MOUSE_PRESSED, nodeGestures.getOnMousePressedEventHandler(vertex)); nodeShape.addEventFilter(MouseEvent.MOUSE_DRAGGED, nodeGestures.getOnMouseDraggedEventHandler(vertex)); nodeShape.addEventFilter(MouseEvent.MOUSE_RELEASED, nodeGestures.getOnMouseReleasedEventHandler(vertex)); nodeShape.addEventFilter(MouseEvent.MOUSE_CLICKED, nodeGestures.getOnMouseClickedEventHandler(vertex)); canvas.getChildren().addAll(nodeLabel, nodeShape); }
From source file:com.github.drbookings.ui.controller.MainController.java
private void initTableViewContextMenus() { final ContextMenu menu = new ContextMenu(); final MenuItem mi1 = new MenuItem("Delete"); final MenuItem mi2 = new MenuItem("Add"); final MenuItem mi3 = new MenuItem("Modify"); mi1.setOnAction(event -> {//from w w w .j a va 2 s . com Platform.runLater(() -> deleteSelected()); }); mi2.setOnAction(event -> { Platform.runLater(() -> addBooking()); }); mi3.setOnAction(event -> { Platform.runLater(() -> showModifyBookingDialog()); }); menu.getItems().addAll(mi2, mi1, mi3); tableView.setContextMenu(menu); tableView.addEventHandler(MouseEvent.MOUSE_CLICKED, t -> { if (t.getButton() == MouseButton.SECONDARY) { menu.show(tableView, t.getScreenX(), t.getScreenY()); } }); }
From source file:de.bayern.gdi.gui.Controller.java
/** * Handle the service selection.// w w w .j a va 2s .c o m * * @param event The mouse click event. */ @FXML protected void handleServiceSelect(MouseEvent event) { if (event.getEventType().equals(MouseEvent.MOUSE_CLICKED)) { if (event.getClickCount() == 1) { clearUserNamePassword(); ServiceModel serviceModel = (ServiceModel) this.serviceList.getSelectionModel().getSelectedItems() .get(0); if (serviceModel != null) { serviceSelection.setDisable(true); serviceURL.getScene().setCursor(Cursor.WAIT); setStatusTextUI(I18n.format("status.checking-auth")); Task task = new Task() { protected Integer call() { try { selectService(serviceModel.getItem()); return 0; } finally { serviceSelection.setDisable(false); serviceURL.getScene().setCursor(Cursor.DEFAULT); } } }; Thread th = new Thread(task); th.setDaemon(true); th.start(); } } else if (event.getClickCount() > 1) { clearUserNamePassword(); resetGui(); } } }
From source file:net.sourceforge.pmd.util.fxdesigner.XPathPanelController.java
private void initGenerateXPathFromStackTrace() { ContextMenu menu = new ContextMenu(); MenuItem item = new MenuItem("Generate from stack trace..."); item.setOnAction(e -> {/* w ww . j a va 2s . c om*/ try { Stage popup = new Stage(); FXMLLoader loader = new FXMLLoader(DesignerUtil.getFxml("generate-xpath-from-stack-trace.fxml")); Parent root = loader.load(); Button button = (Button) loader.getNamespace().get("generateButton"); TextArea area = (TextArea) loader.getNamespace().get("stackTraceArea"); ValidationSupport validation = new ValidationSupport(); validation.registerValidator(area, Validator.createEmptyValidator("The stack trace may not be empty")); button.disableProperty().bind(validation.invalidProperty()); button.setOnAction(f -> { DesignerUtil.stackTraceToXPath(area.getText()).ifPresent(xpathExpressionArea::replaceText); popup.close(); }); popup.setScene(new Scene(root)); popup.initStyle(StageStyle.UTILITY); popup.initModality(Modality.WINDOW_MODAL); popup.initOwner(designerRoot.getMainStage()); popup.show(); } catch (IOException e1) { throw new RuntimeException(e1); } }); menu.getItems().add(item); xpathExpressionArea.addEventHandler(MouseEvent.MOUSE_CLICKED, t -> { if (t.getButton() == MouseButton.SECONDARY) { menu.show(xpathExpressionArea, t.getScreenX(), t.getScreenY()); } }); }
From source file:org.pdfsam.ui.selection.LoadingStatusIndicator.java
public LoadingStatusIndicator(PdfDocumentDescriptorProvider descriptorProvider, String ownerModule) { requireNotNull(descriptorProvider,/*from w w w .j a v a2 s . c om*/ "Cannot create LoadingStatusIndicator with a null PdfDocumentDescriptorProvider"); this.ownerModule = defaultString(ownerModule); this.popup = new PasswordFieldPopup(getOwnerModule()); this.descriptorProvider = descriptorProvider; this.addEventFilter(MouseEvent.MOUSE_CLICKED, (e) -> { if (loadingStatus.get() == ENCRYPTED) { showPasswordRequest(); } else if (loadingStatus.get() == WITH_ERRORS) { eventStudio().broadcast(new ShowStageRequest(), "LogStage"); } }); loadingStatus.addListener((o, oldVal, newVal) -> updateIndicator(newVal)); this.getStyleClass().addAll("encryption-status"); this.icon.setText(""); icon.setTextAlignment(TextAlignment.CENTER); icon.setAlignment(Pos.CENTER); this.setGraphic(icon); rotate.setByAngle(360); rotate.setCycleCount(Animation.INDEFINITE); rotate.setInterpolator(Interpolator.LINEAR); }
From source file:org.samcrow.frameviewer.trajectory.ui.FrameController.java
/** * Called when a mouse event is received. Subclasses should override * this method. The default implementation does nothing. * <p>//from w w w . ja v a2 s . c o m * @param event The mouse event * @param framePosition The position of the event in frame coordinates */ public void handleMouseEvent(MouseEvent event, Point2D framePosition) { final EventType<? extends Event> type = event.getEventType(); if (type == MouseEvent.MOUSE_PRESSED) { handleMousePressed(event, framePosition); } else if (type == MouseEvent.MOUSE_RELEASED) { handleMouseReleased(event, framePosition); } else if (type == MouseEvent.MOUSE_CLICKED && event.isStillSincePress()) { handleMouseClicked(event, framePosition); } else if (type == MouseEvent.MOUSE_MOVED) { handleMouseMoved(event, framePosition); } else if (type == MouseEvent.MOUSE_DRAGGED) { handleMouseDragged(event, framePosition); } }
From source file:org.shiftedit.gui.preview.html.RemoteHTMLPreviewController.java
private void setupConnectionTable() { // Cell click handler tableCellMouseEventHandler = (MouseEvent t) -> { TableCell c = (TableCell) t.getSource(); int index = c.getIndex(); // Send ping request on double click if (t.getClickCount() == 2) { tableModel.get(index).ping(); }//from w w w .j av a2s . c o m }; // Cell factory Callback<TableColumn, TableCell> cellFactory = (TableColumn p) -> { TextFieldTableCell cell = new TextFieldTableCell(); cell.addEventFilter(MouseEvent.MOUSE_CLICKED, new WeakEventHandler<>(tableCellMouseEventHandler)); return cell; }; // Remote address TableColumn remoteAddressCol = new TableColumn( getResourceBundle().getString("builtin.plugin.preview.remote_html.remote_address")); remoteAddressCol.setMinWidth(100); remoteAddressCol.setCellValueFactory(new PropertyValueFactory<>("remoteAddress")); remoteAddressCol.setCellFactory(cellFactory); connectionTable.getColumns().add(remoteAddressCol); // User agent TableColumn userAgentCol = new TableColumn( getResourceBundle().getString("builtin.plugin.preview.remote_html.user_agent")); userAgentCol.setMinWidth(200); userAgentCol.setCellValueFactory(new PropertyValueFactory<>("userAgent")); userAgentCol.setCellFactory(cellFactory); connectionTable.getColumns().add(userAgentCol); // Rendering time TableColumn renderingTimeCol = new TableColumn( getResourceBundle().getString("builtin.plugin.preview.remote_html.rendering_time")); renderingTimeCol.setMinWidth(200); renderingTimeCol.setCellValueFactory(new PropertyValueFactory<>("renderingTime")); renderingTimeCol.setCellFactory(cellFactory); connectionTable.getColumns().add(renderingTimeCol); connectionTable.setPlaceholder( new Label(getResourceBundle().getString("builtin.plugin.preview.remote_html.no_connection"))); connectionTable.setItems(tableModel); }
From source file:org.sleuthkit.autopsy.imageanalyzer.gui.GroupPane.java
/** * called automatically during constructor by FXMLConstructor. * * checks that FXML loading went ok and performs additional setup *///from w w w.j av a2s . c o m @FXML void initialize() { assert gridView != null : "fx:id=\"tilePane\" was not injected: check your FXML file 'GroupPane.fxml'."; assert grpCatSplitMenu != null : "fx:id=\"grpCatSplitMenu\" was not injected: check your FXML file 'GroupHeader.fxml'."; assert grpTagSplitMenu != null : "fx:id=\"grpTagSplitMenu\" was not injected: check your FXML file 'GroupHeader.fxml'."; assert headerToolBar != null : "fx:id=\"headerToolBar\" was not injected: check your FXML file 'GroupHeader.fxml'."; assert segButton != null : "fx:id=\"previewList\" was not injected: check your FXML file 'GroupHeader.fxml'."; assert slideShowToggle != null : "fx:id=\"segButton\" was not injected: check your FXML file 'GroupHeader.fxml'."; assert tileToggle != null : "fx:id=\"tileToggle\" was not injected: check your FXML file 'GroupHeader.fxml'."; grouping.addListener(new InvalidationListener() { private void updateFiles() { final ObservableList<Long> fileIds = grouping.get().fileIds(); Platform.runLater(() -> { gridView.setItems(FXCollections.observableArrayList(fileIds)); }); resetHeaderString(); } @Override public void invalidated(Observable o) { getScrollBar().ifPresent((scrollBar) -> { scrollBar.setValue(0); }); //set the embeded header resetHeaderString(); //and assign fileIDs to gridView if (grouping.get() == null) { Platform.runLater(gridView.getItems()::clear); } else { grouping.get().fileIds().addListener((Observable observable) -> { updateFiles(); }); updateFiles(); } } }); //configure flashing glow animation on next unseen group button flashAnimation.setCycleCount(Timeline.INDEFINITE); flashAnimation.setAutoReverse(true); //configure gridView cell properties gridView.cellHeightProperty().bind(Toolbar.getDefault().sizeSliderValue().add(75)); gridView.cellWidthProperty().bind(Toolbar.getDefault().sizeSliderValue().add(75)); gridView.setCellFactory((GridView<Long> param) -> new DrawableCell()); //configure toolbar properties HBox.setHgrow(spacer, Priority.ALWAYS); spacer.setMinWidth(Region.USE_PREF_SIZE); ArrayList<MenuItem> grpTagMenues = new ArrayList<>(); for (final TagName tn : TagUtils.getNonCategoryTagNames()) { MenuItem menuItem = createGrpTagMenuItem(tn); grpTagMenues.add(menuItem); } try { grpTagSplitMenu.setText(TagUtils.getFollowUpTagName().getDisplayName()); grpTagSplitMenu.setOnAction(createGrpTagMenuItem(TagUtils.getFollowUpTagName()).getOnAction()); } catch (TskCoreException tskCoreException) { LOGGER.log(Level.WARNING, "failed to load FollowUpTagName", tskCoreException); } grpTagSplitMenu.setGraphic(new ImageView(DrawableAttribute.TAGS.getIcon())); grpTagSplitMenu.getItems().setAll(grpTagMenues); ArrayList<MenuItem> grpCategoryMenues = new ArrayList<>(); for (final Category cat : Category.values()) { MenuItem menuItem = createGrpCatMenuItem(cat); grpCategoryMenues.add(menuItem); } grpCatSplitMenu.setText(Category.FIVE.getDisplayName()); grpCatSplitMenu.setGraphic(new ImageView(DrawableAttribute.CATEGORY.getIcon())); grpCatSplitMenu.getItems().setAll(grpCategoryMenues); grpCatSplitMenu.setOnAction(createGrpCatMenuItem(Category.FIVE).getOnAction()); Runnable syncMode = () -> { switch (groupViewMode.get()) { case SLIDE_SHOW: slideShowToggle.setSelected(true); break; case TILE: tileToggle.setSelected(true); break; } }; syncMode.run(); //make togle states match view state groupViewMode.addListener((o) -> { syncMode.run(); }); slideShowToggle.toggleGroupProperty().addListener((o) -> { slideShowToggle.getToggleGroup().selectedToggleProperty() .addListener((observable, oldToggle, newToggle) -> { if (newToggle == null) { oldToggle.setSelected(true); } }); }); //listen to toggles and update view state slideShowToggle.setOnAction((ActionEvent t) -> { activateSlideShowViewer(globalSelectionModel.lastSelectedProperty().get()); }); tileToggle.setOnAction((ActionEvent t) -> { activateTileViewer(); }); controller.viewState().addListener((ObservableValue<? extends GroupViewState> observable, GroupViewState oldValue, GroupViewState newValue) -> { setViewState(newValue); }); addEventFilter(KeyEvent.KEY_PRESSED, tileKeyboardNavigationHandler); gridView.addEventHandler(MouseEvent.MOUSE_CLICKED, new EventHandler<MouseEvent>() { private ContextMenu buildContextMenu() { ArrayList<MenuItem> menuItems = new ArrayList<>(); menuItems.add(CategorizeAction.getPopupMenu()); menuItems.add(AddDrawableTagAction.getInstance().getPopupMenu()); Collection<? extends ContextMenuActionsProvider> menuProviders = Lookup.getDefault() .lookupAll(ContextMenuActionsProvider.class); for (ContextMenuActionsProvider provider : menuProviders) { for (final Action act : provider.getActions()) { if (act instanceof Presenter.Popup) { Presenter.Popup aact = (Presenter.Popup) act; menuItems.add(SwingMenuItemAdapter.create(aact.getPopupPresenter())); } } } final MenuItem extractMenuItem = new MenuItem("Extract File(s)"); extractMenuItem.setOnAction((ActionEvent t) -> { SwingUtilities.invokeLater(() -> { TopComponent etc = WindowManager.getDefault() .findTopComponent(ImageAnalyzerTopComponent.PREFERRED_ID); ExtractAction.getInstance().actionPerformed(new java.awt.event.ActionEvent(etc, 0, null)); }); }); menuItems.add(extractMenuItem); ContextMenu contextMenu = new ContextMenu(menuItems.toArray(new MenuItem[] {})); contextMenu.setAutoHide(true); return contextMenu; } @Override public void handle(MouseEvent t) { switch (t.getButton()) { case PRIMARY: if (t.getClickCount() == 1) { globalSelectionModel.clearSelection(); if (contextMenu != null) { contextMenu.hide(); } } t.consume(); break; case SECONDARY: if (t.getClickCount() == 1) { selectAllFiles(); } if (contextMenu == null) { contextMenu = buildContextMenu(); } contextMenu.hide(); contextMenu.show(GroupPane.this, t.getScreenX(), t.getScreenY()); t.consume(); break; } } }); // Platform.runLater(() -> { ActionUtils.configureButton(nextGroupAction, nextButton); final EventHandler<ActionEvent> onAction = nextButton.getOnAction(); nextButton.setOnAction((ActionEvent event) -> { flashAnimation.stop(); nextButton.setEffect(null); onAction.handle(event); }); ActionUtils.configureButton(forwardAction, forwardButton); ActionUtils.configureButton(backAction, backButton); // }); nextGroupAction.disabledProperty().addListener( (ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) -> { nextButton.setEffect(newValue ? null : DROP_SHADOW); if (newValue == false) { flashAnimation.play(); } else { flashAnimation.stop(); } }); //listen to tile selection and make sure it is visible in scroll area //TODO: make sure we are testing complete visability not just bounds intersection globalSelectionModel.lastSelectedProperty().addListener((observable, oldFileID, newFileId) -> { if (groupViewMode.get() == GroupViewMode.SLIDE_SHOW) { slideShowPane.setFile(newFileId); } else { scrollToFileID(newFileId); } }); setViewState(controller.viewState().get()); }
From source file:org.sleuthkit.autopsy.imagegallery.gui.drawableviews.GroupPane.java
/** * called automatically during constructor by FXMLConstructor. * * checks that FXML loading went ok and performs additional setup */// w w w .j av a 2 s . c o m @FXML @NbBundle.Messages({ "GroupPane.gridViewContextMenuItem.extractFiles=Extract File(s)", "GroupPane.bottomLabel.displayText=Group Viewing History: ", "GroupPane.hederLabel.displayText=Tag Selected Files:", "GroupPane.catContainerLabel.displayText=Categorize Selected File:", "GroupPane.catHeadingLabel.displayText=Category:" }) void initialize() { assert cat0Toggle != null : "fx:id=\"cat0Toggle\" was not injected: check your FXML file 'SlideShowView.fxml'."; assert cat1Toggle != null : "fx:id=\"cat1Toggle\" was not injected: check your FXML file 'SlideShowView.fxml'."; assert cat2Toggle != null : "fx:id=\"cat2Toggle\" was not injected: check your FXML file 'SlideShowView.fxml'."; assert cat3Toggle != null : "fx:id=\"cat3Toggle\" was not injected: check your FXML file 'SlideShowView.fxml'."; assert cat4Toggle != null : "fx:id=\"cat4Toggle\" was not injected: check your FXML file 'SlideShowView.fxml'."; assert cat5Toggle != null : "fx:id=\"cat5Toggle\" was not injected: check your FXML file 'SlideShowView.fxml'."; assert gridView != null : "fx:id=\"tilePane\" was not injected: check your FXML file 'GroupPane.fxml'."; assert catSelectedSplitMenu != null : "fx:id=\"grpCatSplitMenu\" was not injected: check your FXML file 'GroupHeader.fxml'."; assert tagSelectedSplitMenu != null : "fx:id=\"grpTagSplitMenu\" was not injected: check your FXML file 'GroupHeader.fxml'."; assert headerToolBar != null : "fx:id=\"headerToolBar\" was not injected: check your FXML file 'GroupHeader.fxml'."; assert segButton != null : "fx:id=\"previewList\" was not injected: check your FXML file 'GroupHeader.fxml'."; assert slideShowToggle != null : "fx:id=\"segButton\" was not injected: check your FXML file 'GroupHeader.fxml'."; assert tileToggle != null : "fx:id=\"tileToggle\" was not injected: check your FXML file 'GroupHeader.fxml'."; for (Category cat : Category.values()) { ToggleButton toggleForCategory = getToggleForCategory(cat); toggleForCategory.setBorder(new Border( new BorderStroke(cat.getColor(), BorderStrokeStyle.SOLID, CORNER_RADII_2, BORDER_WIDTHS_2))); toggleForCategory.getStyleClass().remove("radio-button"); toggleForCategory.getStyleClass().add("toggle-button"); toggleForCategory.selectedProperty().addListener((ov, wasSelected, toggleSelected) -> { if (toggleSelected && slideShowPane != null) { slideShowPane.getFileID().ifPresent(fileID -> { selectionModel.clearAndSelect(fileID); new CategorizeAction(controller, cat, ImmutableSet.of(fileID)).handle(null); }); } }); } //configure flashing glow animation on next unseen group button flashAnimation.setCycleCount(Timeline.INDEFINITE); flashAnimation.setAutoReverse(true); //configure gridView cell properties DoubleBinding cellSize = controller.thumbnailSizeProperty().add(75); gridView.cellHeightProperty().bind(cellSize); gridView.cellWidthProperty().bind(cellSize); gridView.setCellFactory((GridView<Long> param) -> new DrawableCell()); BooleanBinding isSelectionEmpty = Bindings.isEmpty(selectionModel.getSelected()); catSelectedSplitMenu.disableProperty().bind(isSelectionEmpty); tagSelectedSplitMenu.disableProperty().bind(isSelectionEmpty); Platform.runLater(() -> { try { TagSelectedFilesAction followUpSelectedACtion = new TagSelectedFilesAction( controller.getTagsManager().getFollowUpTagName(), controller); tagSelectedSplitMenu.setText(followUpSelectedACtion.getText()); tagSelectedSplitMenu.setGraphic(followUpSelectedACtion.getGraphic()); tagSelectedSplitMenu.setOnAction(followUpSelectedACtion); } catch (TskCoreException tskCoreException) { LOGGER.log(Level.WARNING, "failed to load FollowUpTagName", tskCoreException); //NON-NLS } tagSelectedSplitMenu.showingProperty().addListener(showing -> { if (tagSelectedSplitMenu.isShowing()) { List<MenuItem> selTagMenues = Lists.transform( controller.getTagsManager().getNonCategoryTagNames(), tagName -> GuiUtils.createAutoAssigningMenuItem(tagSelectedSplitMenu, new TagSelectedFilesAction(tagName, controller))); tagSelectedSplitMenu.getItems().setAll(selTagMenues); } }); }); CategorizeSelectedFilesAction cat5SelectedAction = new CategorizeSelectedFilesAction(Category.FIVE, controller); catSelectedSplitMenu.setOnAction(cat5SelectedAction); catSelectedSplitMenu.setText(cat5SelectedAction.getText()); catSelectedSplitMenu.setGraphic(cat5SelectedAction.getGraphic()); catSelectedSplitMenu.showingProperty().addListener(showing -> { if (catSelectedSplitMenu.isShowing()) { List<MenuItem> categoryMenues = Lists.transform(Arrays.asList(Category.values()), cat -> GuiUtils.createAutoAssigningMenuItem(catSelectedSplitMenu, new CategorizeSelectedFilesAction(cat, controller))); catSelectedSplitMenu.getItems().setAll(categoryMenues); } }); slideShowToggle.getStyleClass().remove("radio-button"); slideShowToggle.getStyleClass().add("toggle-button"); tileToggle.getStyleClass().remove("radio-button"); tileToggle.getStyleClass().add("toggle-button"); bottomLabel.setText(Bundle.GroupPane_bottomLabel_displayText()); headerLabel.setText(Bundle.GroupPane_hederLabel_displayText()); catContainerLabel.setText(Bundle.GroupPane_catContainerLabel_displayText()); catHeadingLabel.setText(Bundle.GroupPane_catHeadingLabel_displayText()); //show categorization controls depending on group view mode headerToolBar.getItems().remove(catSegmentedContainer); groupViewMode.addListener((ObservableValue<? extends GroupViewMode> observable, GroupViewMode oldValue, GroupViewMode newValue) -> { if (newValue == GroupViewMode.SLIDE_SHOW) { headerToolBar.getItems().remove(catSplitMenuContainer); headerToolBar.getItems().add(catSegmentedContainer); } else { headerToolBar.getItems().remove(catSegmentedContainer); headerToolBar.getItems().add(catSplitMenuContainer); } }); //listen to toggles and update view state slideShowToggle .setOnAction(onAction -> activateSlideShowViewer(selectionModel.lastSelectedProperty().get())); tileToggle.setOnAction(onAction -> activateTileViewer()); controller.viewState().addListener((observable, oldViewState, newViewState) -> setViewState(newViewState)); addEventFilter(KeyEvent.KEY_PRESSED, tileKeyboardNavigationHandler); gridView.addEventHandler(MouseEvent.MOUSE_CLICKED, new MouseHandler()); ActionUtils.configureButton(undoAction, undoButton); ActionUtils.configureButton(redoAction, redoButton); ActionUtils.configureButton(forwardAction, forwardButton); ActionUtils.configureButton(backAction, backButton); ActionUtils.configureButton(nextGroupAction, nextButton); /* * the next button does stuff in the GroupPane that next action does'nt * know about, so do that stuff and then delegate to nextGroupAction */ final EventHandler<ActionEvent> onAction = nextButton.getOnAction(); nextButton.setOnAction(actionEvent -> { flashAnimation.stop(); nextButton.setEffect(null); onAction.handle(actionEvent); }); nextGroupAction.disabledProperty().addListener((Observable observable) -> { boolean newValue = nextGroupAction.isDisabled(); nextButton.setEffect(newValue ? null : DROP_SHADOW); if (newValue) {//stop on disabled flashAnimation.stop(); } else { //play when enabled flashAnimation.play(); } }); //listen to tile selection and make sure it is visible in scroll area selectionModel.lastSelectedProperty().addListener((observable, oldFileID, newFileId) -> { if (groupViewMode.get() == GroupViewMode.SLIDE_SHOW && slideShowPane != null) { slideShowPane.setFile(newFileId); } else { scrollToFileID(newFileId); } }); setViewState(controller.viewState().get()); }