List of usage examples for javafx.collections ObservableMap keySet
Set<K> keySet();
From source file:dpfmanager.shell.interfaces.gui.component.report.ReportsView.java
public void addFormatIcons() { colFormats.setCellFactory(// w w w . j av a 2s . c o m new Callback<TableColumn<ReportRow, ObservableMap<String, String>>, TableCell<ReportRow, ObservableMap<String, String>>>() { @Override public TableCell<ReportRow, ObservableMap<String, String>> call( TableColumn<ReportRow, ObservableMap<String, String>> param) { TableCell<ReportRow, ObservableMap<String, String>> cell = new TableCell<ReportRow, ObservableMap<String, String>>() { @Override public void updateItem(ObservableMap<String, String> item, boolean empty) { super.updateItem(item, empty); if (!empty && item != null) { HBox box = new HBox(); box.setSpacing(3); box.setAlignment(Pos.CENTER_LEFT); for (String i : item.keySet()) { ImageView icon = new ImageView(); icon.setId("but" + i); icon.setFitHeight(20); icon.setFitWidth(20); icon.setImage(new Image("images/formats/" + i + ".png")); icon.setCursor(Cursor.HAND); String type = i; String path = item.get(i); icon.setOnMouseClicked(new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent event) { ArrayMessage am = new ArrayMessage(); am.add(GuiConfig.PERSPECTIVE_SHOW, new UiMessage()); am.add(GuiConfig.PERSPECTIVE_SHOW + "." + GuiConfig.COMPONENT_SHOW, new ShowMessage(type, path)); getContext().send(GuiConfig.PERSPECTIVE_SHOW, am); } }); ContextMenu contextMenu = new ContextMenu(); javafx.scene.control.MenuItem download = new javafx.scene.control.MenuItem( "Download report"); contextMenu.getItems().add(download); icon.setOnContextMenuRequested(new EventHandler<ContextMenuEvent>() { public void handle(ContextMenuEvent e) { contextMenu.show(icon, e.getScreenX(), e.getScreenY()); } }); box.getChildren().add(icon); } setGraphic(box); } else { setGraphic(null); } } }; return cell; } }); }