use of javafx.scene.control.MenuItem in project Gargoyle by callakrsos.
the class DAOLoaderController method menuHistoryOnAction.
/**
* 히스토리 이력을 살펴보는경우 사용
*
* @작성자 : KYJ
* @작성일 : 2015. 11. 6.
* @param event
*/
public void menuHistoryOnAction(ActionEvent event) {
Map<String, Object> selectedItem = tbSrchDao.getSelectionModel().getSelectedItem();
if (selectedItem == null)
return;
String packageName = ValueUtil.emptyThan(selectedItem.get("PACKAGE_NAME"), "").toString();
String className = ValueUtil.emptyThan(selectedItem.get("CLASS_NAME"), "").toString();
// Stage primaryStage = SharedMemory.getPrimaryStage();
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("packageName", packageName);
paramMap.put("className", className);
try {
List<TbmSysDaoMethodsHDVO> select = listHistoryItems(paramMap);
CommonsBaseGridView<TbmSysDaoMethodsHDVO> commonsBaseGridView = new CommonsBaseGridView<>(TbmSysDaoMethodsHDVO.class, select);
TableViewSelectionModel<TbmSysDaoMethodsHDVO> selectionModel = commonsBaseGridView.getSelectionModel();
selectionModel.setSelectionMode(SelectionMode.MULTIPLE);
BorderPane borderPane = new BorderPane();
Label value = new Label("History");
value.setStyle("-fx-font-size:75px");
borderPane.setTop(value);
SqlKeywords sqlKeyword = new SqlKeywords();
borderPane.setBottom(sqlKeyword);
SplitPane splitPane = new SplitPane(commonsBaseGridView, sqlKeyword);
splitPane.setOrientation(Orientation.VERTICAL);
borderPane.setCenter(splitPane);
commonsBaseGridView.setOnMouseClicked(ev -> {
if (ev.getClickCount() == 2) {
try {
TbmSysDaoMethodsHDVO selectedItem2 = commonsBaseGridView.getSelectionModel().getSelectedItem();
String histTsp = selectedItem2.getHistTsp();
String sqlBody = getSqlBody(histTsp);
sqlKeyword.setContent(sqlBody);
} catch (Exception e) {
LOGGER.error(ValueUtil.toString(e));
}
}
});
MenuItem compare = new MenuItem("Compare.");
compare.setDisable(true);
compare.setOnAction(ev -> {
ObservableList<TbmSysDaoMethodsHDVO> selectedItems = commonsBaseGridView.getSelectionModel().getSelectedItems();
if (selectedItems.size() == 2) {
compare(selectedItems.get(0), selectedItems.get(1));
}
});
ContextMenu historyContextMenu = new ContextMenu(compare);
historyContextMenu.setOnShowing(ev -> {
if (selectionModel.getSelectedItems().size() == 2) {
compare.setDisable(false);
} else {
compare.setDisable(true);
}
});
commonsBaseGridView.setContextMenu(historyContextMenu);
Scene scene = new Scene(borderPane);
Stage stage = new Stage();
stage.initOwner(SharedMemory.getPrimaryStage());
stage.setScene(scene);
stage.show();
} catch (Exception e) {
e.printStackTrace();
}
}
use of javafx.scene.control.MenuItem in project jabref by JabRef.
the class GroupTreeController method createContextMenuForGroup.
private ContextMenu createContextMenuForGroup(GroupNodeViewModel group) {
ContextMenu menu = new ContextMenu();
MenuItem editGroup = new MenuItem(Localization.lang("Edit group"));
editGroup.setOnAction(event -> {
menu.hide();
viewModel.editGroup(group);
});
MenuItem addSubgroup = new MenuItem(Localization.lang("Add subgroup"));
addSubgroup.setOnAction(event -> {
menu.hide();
viewModel.addNewSubgroup(group);
});
MenuItem removeGroupAndSubgroups = new MenuItem(Localization.lang("Remove group and subgroups"));
removeGroupAndSubgroups.setOnAction(event -> viewModel.removeGroupAndSubgroups(group));
MenuItem removeGroupKeepSubgroups = new MenuItem(Localization.lang("Remove group, keep subgroups"));
removeGroupKeepSubgroups.setOnAction(event -> viewModel.removeGroupKeepSubgroups(group));
MenuItem removeSubgroups = new MenuItem(Localization.lang("Remove subgroups"));
removeSubgroups.setOnAction(event -> viewModel.removeSubgroups(group));
MenuItem addEntries = new MenuItem(Localization.lang("Add selected entries to this group"));
addEntries.setOnAction(event -> viewModel.addSelectedEntries(group));
MenuItem removeEntries = new MenuItem(Localization.lang("Remove selected entries from this group"));
removeEntries.setOnAction(event -> viewModel.removeSelectedEntries(group));
MenuItem sortAlphabetically = new MenuItem(Localization.lang("Sort all subgroups (recursively)"));
sortAlphabetically.setOnAction(event -> viewModel.sortAlphabeticallyRecursive(group));
menu.getItems().add(editGroup);
menu.getItems().add(new SeparatorMenuItem());
menu.getItems().addAll(addSubgroup, removeSubgroups, removeGroupAndSubgroups, removeGroupKeepSubgroups);
menu.getItems().add(new SeparatorMenuItem());
menu.getItems().addAll(addEntries, removeEntries);
menu.getItems().add(new SeparatorMenuItem());
menu.getItems().add(sortAlphabetically);
return menu;
}
use of javafx.scene.control.MenuItem in project jabref by JabRef.
the class EditorMenus method getNameMenu.
public static List<MenuItem> getNameMenu(TextArea textArea) {
MenuItem normalizeNames = new MenuItem(Localization.lang("Normalize to BibTeX name format"));
//normalizeNames.setTooltip(Localization.lang("If possible, normalize this list of names to conform to standard BibTeX name formatting"))
normalizeNames.setOnAction(event -> textArea.setText(new NormalizeNamesFormatter().format(textArea.getText())));
return Collections.singletonList(normalizeNames);
}
use of javafx.scene.control.MenuItem in project jabref by JabRef.
the class EditorMenus method getDOIMenu.
public static List<MenuItem> getDOIMenu(TextArea textArea) {
AbstractAction copyDoiUrlAction = new CopyDoiUrlAction(textArea);
MenuItem copyDoiUrlMenuItem = new MenuItem((String) copyDoiUrlAction.getValue(Action.NAME));
copyDoiUrlMenuItem.setOnAction(event -> copyDoiUrlAction.actionPerformed(null));
List<MenuItem> menuItems = new ArrayList<>();
menuItems.add(copyDoiUrlMenuItem);
menuItems.add(new SeparatorMenuItem());
return menuItems;
}
use of javafx.scene.control.MenuItem in project jabref by JabRef.
the class ProtectedTermsMenu method updateFiles.
private void updateFiles() {
externalFiles.getItems().clear();
for (ProtectedTermsList list : Globals.protectedTermsLoader.getProtectedTermsLists()) {
if (!list.isInternalList()) {
MenuItem fileItem = new MenuItem(list.getDescription());
fileItem.setOnAction(event -> {
String selectedText = opener.getSelectedText();
if ((selectedText != null) && !selectedText.isEmpty()) {
list.addProtectedTerm(selectedText);
}
});
externalFiles.getItems().add(fileItem);
}
}
externalFiles.getItems().add(new SeparatorMenuItem());
MenuItem addToNewFileItem = new MenuItem(Localization.lang("New") + "...");
addToNewFileItem.setOnAction(event -> {
NewProtectedTermsFileDialog dialog = new NewProtectedTermsFileDialog(JabRefGUI.getMainFrame(), Globals.protectedTermsLoader);
dialog.setVisible(true);
if (dialog.isOKPressed()) {
Globals.prefs.setProtectedTermsPreferences(Globals.protectedTermsLoader);
}
});
externalFiles.getItems().add(addToNewFileItem);
}
Aggregations