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