|
Gridarta Editor
|
Manages the contents of a recent or bookmark menu. More...
Collaboration diagram for net.sf.gridarta.gui.mapmenu.MapMenu:Classes | |
| class | DeletedNode |
| Result value consisting of a TreeNode and its location (directory). More... | |
Public Member Functions | |
| void | addMapMenuEntry (@NotNull final String directory, @NotNull final MapMenuEntry mapMenuEntry) |
| Adds a MapMenuEntry to this menu. More... | |
| TreePath | addMapMenuEntry (@NotNull final String directory, @NotNull final DefaultMutableTreeNode treeNode) |
| Adds a DefaultMutableTreeNode to this menu. More... | |
| DeletedNode | getDeletedNode (final boolean delete) |
| Returns the last deleted node. More... | |
| DefaultMutableTreeNode | getOrCreateDirectory (@NotNull final MutableTreeNode this2, @NotNull final String path) |
| Returns the MapMenuEntryDir for a given path. More... | |
| DefaultMutableTreeNode | getRoot () |
| Returns the root node. More... | |
| TreePath | insertNodeInto (@NotNull final MapMenuEntry mapEntry, @NotNull final DefaultMutableTreeNode parent, final int index) |
| Inserts a new node into the tree. More... | |
| void | load () |
| Loads the contents from preferences. More... | |
| MapMenu (@NotNull final String key, @NotNull final PathManager pathManager) | |
| Creates a new instance. More... | |
| JTree | newTree () |
| Creates a new JTree for this map menu. More... | |
| void | removeNode (@NotNull final DefaultMutableTreeNode treeNode) |
| Removes a node from the tree. More... | |
| void | save () |
| Saves the contents to preferences if modified since last save. More... | |
| void | saveAlways () |
| Saves the contents to preferences. More... | |
| int | size () |
| Returns the number of entries in this menu. More... | |
Private Member Functions | |
| String | getDirectory (@NotNull final TreeNode treeNode) |
| Returns the directory of a TreeNode. More... | |
| int | saveEntries (@NotNull final DefaultMutableTreeNode treeNode, final int startIndex, @NotNull final String directory) |
| Saves a TreeNode instance's contents to preferences. More... | |
| int | size (@NotNull final TreeNode root) |
| Returns the number of entries in a sub-tree. More... | |
Private Attributes | |
| final Deque< DeletedNode > | deletedNodes = new ArrayDeque<>() |
| Recently deleted nodes. More... | |
| final MapMenuLoader | mapMenuLoader |
| The MapMenuLoader for loading/storing the menu contents. More... | |
| final DefaultMutableTreeNode | root = new DefaultMutableTreeNode(new MapMenuEntryDir("Bookmarks"), true) |
| The root node of treeModel. More... | |
| final DefaultTreeModel | treeModel = new DefaultTreeModel(root) |
| The DefaultTreeModel that contains all menu entries. More... | |
| final TreeModelListener | treeModelListener |
| The TreeModelListener attached to treeModel for detecting modifications. More... | |
| boolean | treeModelModified |
| Whether treeModel has been modified since last save. More... | |
Static Private Attributes | |
| static final Category | LOG = Logger.getLogger(MapMenu.class) |
| The Logger for printing log messages. More... | |
Manages the contents of a recent or bookmark menu.
Definition at line 44 of file MapMenu.java.
| net.sf.gridarta.gui.mapmenu.MapMenu.MapMenu | ( | @NotNull final String | key, |
| @NotNull final PathManager | pathManager | ||
| ) |
Creates a new instance.
| key | the preferences key prefix |
| pathManager | the path manager instance |
Definition at line 115 of file MapMenu.java.
| void net.sf.gridarta.gui.mapmenu.MapMenu.addMapMenuEntry | ( | @NotNull final String | directory, |
| @NotNull final MapMenuEntry | mapMenuEntry | ||
| ) |
Adds a MapMenuEntry to this menu.
| directory | the directory to add to |
| mapMenuEntry | the map menu entry TypeMayBeWeakened |
Definition at line 209 of file MapMenu.java.
Referenced by net.sf.gridarta.gui.dialog.bookmarks.ManageBookmarksDialog< G, A, R >.doUnDeleteBookmark(), net.sf.gridarta.gui.mapmenu.MapMenu.load(), and net.sf.gridarta.gui.mapmenu.MapMenuPreferencesTest.test3().
Here is the caller graph for this function:| TreePath net.sf.gridarta.gui.mapmenu.MapMenu.addMapMenuEntry | ( | @NotNull final String | directory, |
| @NotNull final DefaultMutableTreeNode | treeNode | ||
| ) |
Adds a DefaultMutableTreeNode to this menu.
| directory | the directory to add to |
| treeNode | the tree node |
Definition at line 221 of file MapMenu.java.
References net.sf.gridarta.gui.mapmenu.MapMenu.getOrCreateDirectory(), net.sf.gridarta.utils.StringUtils.PATTERN_SLASH, and net.sf.gridarta.gui.mapmenu.MapMenu.root.
Here is the call graph for this function:| DeletedNode net.sf.gridarta.gui.mapmenu.MapMenu.getDeletedNode | ( | final boolean | delete | ) |
Returns the last deleted node.
| delete | whether to delete the returned node |
Definition at line 343 of file MapMenu.java.
Referenced by net.sf.gridarta.gui.dialog.bookmarks.ManageBookmarksDialog< G, A, R >.doUnDeleteBookmark().
Here is the caller graph for this function:
|
private |
Returns the directory of a TreeNode.
| treeNode | the tree node |
Definition at line 320 of file MapMenu.java.
References net.sf.gridarta.gui.mapmenu.MapMenuEntry.getTitle(), and net.sf.gridarta.gui.mapmenu.MapMenuEntry.toString().
Referenced by net.sf.gridarta.gui.mapmenu.MapMenu.removeNode().
Here is the call graph for this function:
Here is the caller graph for this function:| DefaultMutableTreeNode net.sf.gridarta.gui.mapmenu.MapMenu.getOrCreateDirectory | ( | @NotNull final MutableTreeNode | this2, |
| @NotNull final String | path | ||
| ) |
Returns the MapMenuEntryDir for a given path.
If more than one matching path exists the last one is returned.
| this2 | the tree node to insert into |
| path | the path; must not contain '/' |
Definition at line 244 of file MapMenu.java.
References net.sf.gridarta.gui.mapmenu.MapMenuEntry.allowsChildren(), net.sf.gridarta.gui.mapmenu.MapMenuEntry.getTitle(), and net.sf.gridarta.gui.mapmenu.MapMenuEntryDir.isValidDirectory().
Referenced by net.sf.gridarta.gui.mapmenu.MapMenu.addMapMenuEntry(), net.sf.gridarta.gui.mapmenu.MapMenuTest.testSubDir1(), and net.sf.gridarta.gui.mapmenu.MapMenuTest.testSubDir2().
Here is the call graph for this function:
Here is the caller graph for this function:| DefaultMutableTreeNode net.sf.gridarta.gui.mapmenu.MapMenu.getRoot | ( | ) |
Returns the root node.
Definition at line 390 of file MapMenu.java.
References net.sf.gridarta.gui.mapmenu.MapMenu.root.
Referenced by net.sf.gridarta.gui.mapmenu.TestMapMenuPreferences.addEntry(), net.sf.gridarta.gui.mapmenu.BookmarksMapMenuPreferences.addEntry(), net.sf.gridarta.gui.mapmenu.RecentMapMenuPreferences.addEntry(), net.sf.gridarta.gui.dialog.bookmarks.ManageBookmarksDialog< G, A, R >.doEditBookmark(), net.sf.gridarta.gui.dialog.bookmarks.ManageBookmarksDialog< G, A, R >.doNewDirectory(), net.sf.gridarta.gui.dialog.bookmarks.ManageBookmarksDialog< G, A, R >.doRemoveBookmark(), net.sf.gridarta.gui.mapmenu.MapMenuPreferencesTest.test2(), net.sf.gridarta.gui.mapmenu.MapMenuPreferencesTest.test3(), net.sf.gridarta.gui.mapmenu.MapMenuTest.testSubDir1(), and net.sf.gridarta.gui.mapmenu.MapMenuTest.testSubDir2().
Here is the caller graph for this function:| TreePath net.sf.gridarta.gui.mapmenu.MapMenu.insertNodeInto | ( | @NotNull final MapMenuEntry | mapEntry, |
| @NotNull final DefaultMutableTreeNode | parent, | ||
| final int | index | ||
| ) |
Inserts a new node into the tree.
| mapEntry | the map entry to add |
| parent | the parent node to add to |
| index | the index to add at |
Definition at line 280 of file MapMenu.java.
References net.sf.gridarta.gui.mapmenu.MapMenu.save().
Referenced by net.sf.gridarta.gui.mapmenu.TestMapMenuPreferences.addEntry(), net.sf.gridarta.gui.mapmenu.BookmarksMapMenuPreferences.addEntry(), net.sf.gridarta.gui.mapmenu.RecentMapMenuPreferences.addEntry(), and net.sf.gridarta.gui.dialog.bookmarks.ManageBookmarksDialog< G, A, R >.doNewDirectory().
Here is the call graph for this function:
Here is the caller graph for this function:| void net.sf.gridarta.gui.mapmenu.MapMenu.load | ( | ) |
Loads the contents from preferences.
Definition at line 127 of file MapMenu.java.
References net.sf.gridarta.gui.mapmenu.MapMenu.addMapMenuEntry(), net.sf.gridarta.gui.mapmenu.MapMenuLoader.loadEntry(), and net.sf.gridarta.gui.mapmenu.MapMenuLoader.loadNumEntries().
Referenced by net.sf.gridarta.gui.mapmenu.MapMenuManager< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.initRecent(), net.sf.gridarta.gui.mapmenu.MapMenuPreferencesTest.test2(), and net.sf.gridarta.gui.mapmenu.MapMenuPreferencesTest.test3().
Here is the call graph for this function:
Here is the caller graph for this function:| JTree net.sf.gridarta.gui.mapmenu.MapMenu.newTree | ( | ) |
| void net.sf.gridarta.gui.mapmenu.MapMenu.removeNode | ( | @NotNull final DefaultMutableTreeNode | treeNode | ) |
Removes a node from the tree.
| treeNode | the tree node to remove TypeMayBeWeakened |
Definition at line 295 of file MapMenu.java.
References net.sf.gridarta.gui.mapmenu.MapMenu.getDirectory(), and net.sf.gridarta.gui.mapmenu.MapMenu.save().
Referenced by net.sf.gridarta.gui.dialog.bookmarks.ManageBookmarksDialog< G, A, R >.doRemoveBookmark().
Here is the call graph for this function:
Here is the caller graph for this function:| void net.sf.gridarta.gui.mapmenu.MapMenu.save | ( | ) |
Saves the contents to preferences if modified since last save.
Definition at line 149 of file MapMenu.java.
References net.sf.gridarta.gui.mapmenu.MapMenu.saveAlways().
Referenced by net.sf.gridarta.gui.mapmenu.MapMenu.insertNodeInto(), net.sf.gridarta.gui.mapmenu.MapMenu.removeNode(), and net.sf.gridarta.gui.dialog.bookmarks.ManageBookmarksDialog< G, A, R >.setValue().
Here is the call graph for this function:
Here is the caller graph for this function:| void net.sf.gridarta.gui.mapmenu.MapMenu.saveAlways | ( | ) |
Saves the contents to preferences.
Definition at line 161 of file MapMenu.java.
References net.sf.gridarta.gui.mapmenu.MapMenuLoader.loadNumEntries(), net.sf.gridarta.gui.mapmenu.MapMenuLoader.removeEntry(), net.sf.gridarta.gui.mapmenu.MapMenu.saveEntries(), and net.sf.gridarta.gui.mapmenu.MapMenuLoader.saveNumEntries().
Referenced by net.sf.gridarta.gui.mapmenu.MapMenu.save(), net.sf.gridarta.gui.mapmenu.MapMenuPreferencesTest.test2(), and net.sf.gridarta.gui.mapmenu.MapMenuPreferencesTest.test3().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Saves a TreeNode instance's contents to preferences.
| treeNode | the tree node instance |
| startIndex | the preference index for saving the first entry |
| directory | the directory of the tree node |
Definition at line 177 of file MapMenu.java.
References net.sf.gridarta.gui.mapmenu.MapMenuLoader.Type.DIR, net.sf.gridarta.model.mapmodel.MapFile.getFile(), net.sf.gridarta.gui.mapmenu.MapMenuEntryMap.getMapFile(), net.sf.gridarta.gui.mapmenu.MapMenuEntry.getTitle(), net.sf.gridarta.gui.mapmenu.MapMenuLoader.Type.MAP, net.sf.gridarta.gui.mapmenu.MapMenuLoader.saveEntry(), and net.sf.gridarta.gui.mapmenu.MapMenuEntry.visit().
Referenced by net.sf.gridarta.gui.mapmenu.MapMenu.saveAlways().
Here is the call graph for this function:
Here is the caller graph for this function:| int net.sf.gridarta.gui.mapmenu.MapMenu.size | ( | ) |
Returns the number of entries in this menu.
Definition at line 351 of file MapMenu.java.
Referenced by net.sf.gridarta.gui.mapmenu.MapMenu.size(), net.sf.gridarta.gui.mapmenu.MapMenuPreferencesTest.test2(), and net.sf.gridarta.gui.mapmenu.MapMenuManagerTest.testSaveBookmarks().
Here is the caller graph for this function:
|
private |
Returns the number of entries in a sub-tree.
| root | the root of the sub-tree |
Definition at line 360 of file MapMenu.java.
References net.sf.gridarta.gui.mapmenu.MapMenuEntry.allowsChildren(), and net.sf.gridarta.gui.mapmenu.MapMenu.size().
Here is the call graph for this function:
|
private |
Recently deleted nodes.
The first node is the last deleted node.
Definition at line 74 of file MapMenu.java.
|
staticprivate |
The Logger for printing log messages.
Definition at line 50 of file MapMenu.java.
|
private |
The MapMenuLoader for loading/storing the menu contents.
Definition at line 56 of file MapMenu.java.
|
private |
The root node of treeModel.
Definition at line 62 of file MapMenu.java.
Referenced by net.sf.gridarta.gui.mapmenu.MapMenu.addMapMenuEntry(), and net.sf.gridarta.gui.mapmenu.MapMenu.getRoot().
|
private |
The DefaultTreeModel that contains all menu entries.
Definition at line 68 of file MapMenu.java.
|
private |
The TreeModelListener attached to treeModel for detecting modifications.
Definition at line 86 of file MapMenu.java.
|
private |
Whether treeModel has been modified since last save.
Definition at line 79 of file MapMenu.java.