Changeset 37224
- Timestamp:
- 2023-01-31T11:50:39+13:00 (15 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/gli/src/org/greenstone/gatherer/gui/GatherPane.java
r20877 r37224 92 92 /** The button used to create a new folder in the collection tree. */ 93 93 private JButton new_folder = null; 94 /** The button used to add a new file in the collection tree */ 95 private JButton new_file = null; 94 96 /** The label shown at the top of the collection tree. */ 95 97 private JLabel collection_label = null; … … 139 141 new_folder.setMinimumSize(MIN_SIZE); 140 142 new_folder.setPreferredSize(MIN_SIZE); 143 144 new_file = new GLIButton(JarTools.getImage("folder.gif"), Dictionary.get("Collection.New_File_Tooltip")); 145 new_file.addActionListener(this); 146 new_file.setEnabled(false); 147 new_file.setMinimumSize(MIN_SIZE); 148 new_file.setPreferredSize(MIN_SIZE); 141 149 142 150 } … … 165 173 } 166 174 } 167 // If a user has clicked on new_folder create a new folder under 175 // If a user has clicked on new_folder/new_file, create a new folder 176 // or upload a new file under 168 177 // whatever node is selected. 169 else if(event.getSource() == new_folder && collection_tree != null) { 178 else if((event.getSource() == new_folder || event.getSource() == new_file) && collection_tree != null) { 179 boolean adding_folder = false; // folder or file? 180 if (event.getSource() == new_folder) { 181 adding_folder = true; 182 } 170 183 int count = collection_tree.getSelectionCount(); 171 184 boolean error = false; … … 174 187 CollectionTreeNode node = (CollectionTreeNode) path.getLastPathComponent(); 175 188 if (node.getAllowsChildren()) { 176 Gatherer.f_man.newFolder(collection_tree, node); 189 if (adding_folder) { 190 Gatherer.f_man.newFolder(collection_tree, node); 191 } else { 192 Gatherer.f_man.newCollectionFile(collection_tree, node); 193 } 177 194 } 178 195 else { … … 180 197 CollectionTreeNode parent = (CollectionTreeNode) node.getParent(); 181 198 if (parent!=null && parent.getAllowsChildren()) { 182 Gatherer.f_man.newFolder(collection_tree, parent); 199 if (adding_folder) { 200 Gatherer.f_man.newFolder(collection_tree, parent); 201 } else { 202 Gatherer.f_man.newCollectionFile(collection_tree, node); 203 } 183 204 } else { 184 205 error = true; … … 192 213 // instead of an error, we now create a new folder at the root 193 214 CollectionTreeNode node = (CollectionTreeNode) collection_tree.getModel().getRoot(); 194 Gatherer.f_man.newFolder(collection_tree, node); 215 if (adding_folder) { 216 Gatherer.f_man.newFolder(collection_tree, node); 217 } else { 218 Gatherer.f_man.newCollectionFile(collection_tree, node); 219 } 195 220 } 196 221 } … … 344 369 345 370 button_pane.add(new_folder); 371 button_pane.add(new_file); 346 372 button_pane.add(recycle_bin); 347 373 … … 429 455 collection_filter.setEnabled(collection_loaded); 430 456 new_folder.setEnabled(collection_loaded); 457 new_file.setEnabled(collection_loaded); 431 458 } 432 459
Note:
See TracChangeset
for help on using the changeset viewer.