Changeset 32695
- Timestamp:
- 2018-12-16T20:59:37+13:00 (5 years ago)
- Location:
- main/trunk/gli/src/org/greenstone/gatherer
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/gli/src/org/greenstone/gatherer/Gatherer.java
r32689 r32695 761 761 }*/ 762 762 763 // if we're tutorial testing GLI, want names assigned to the GUI components 764 if(TestingPreparation.TEST_MODE) { 765 g_man.setName("GUIManager"); // g_man has a name "frame0" assigned automatically 766 // setNamesRecursively won't assign a name if one is already set 767 // Setting explicitly since GUIManager is preferred for its name 768 TestingPreparation.setNamesRecursively("", g_man); 769 TestingPreparation.printComponentNames(g_man, ""); 770 } 763 // if we're tutorial testing GLI, want names assigned to the GUI components 764 TestingPreparation.setNamesRecursively(g_man); 765 771 766 772 767 // If there was a collection left open last time, reopen it -
main/trunk/gli/src/org/greenstone/gatherer/gui/GUIManager.java
r32691 r32695 960 960 { 961 961 OpenCollectionDialog dialog = new OpenCollectionDialog(); 962 TestingPreparation.setNamesRecursively(dialog); 963 962 964 dialog.setComponentOrientation(Dictionary.getOrientation()); 963 965 if (dialog.display() == OpenCollectionDialog.OK_OPTION) { -
main/trunk/gli/src/org/greenstone/gatherer/gui/TestingPreparation.java
r32689 r32695 6 6 7 7 public class TestingPreparation { 8 public static boolean TEST_MODE = false;9 8 public static boolean TEST_MODE = true; // TODO: set to true for debugging. Reset to false when committing to svn 9 public static boolean DEBUGGING_TEST_MODE = true; 10 10 11 11 /* … … 21 21 - https://stackoverflow.com/questions/28639294/in-java-how-to-get-name-of-component-which-is-clicked 22 22 */ 23 public static void setNamesRecursively(Component root) { 24 if(!TEST_MODE) return; 25 26 // setNamesRecursively won't assign a name if one is already set 27 // But GUIManager for instance g_man has a name "frame0" assigned automatically 28 // Setting explicitly since GUIManager is preferred for its name 29 30 // Workaround to force replacement of non-informative names like frame0 for GUIManager 31 // and dialog0 for OpenCollectioNDialog 32 // Workaround is to not check if name already set for root, but to set it ourselves 33 String className = root.getClass().getSimpleName(); 34 root.setName(className); 35 36 setNamesRecursively("", root); 37 if (DEBUGGING_TEST_MODE) printComponentNames(root, ""); 38 } 39 23 40 public static void setNamesRecursively(String prefix, Component root) { 24 41 if(!TEST_MODE) return; … … 110 127 111 128 112 // For debugging swing Component names assigned with Container's setName() 129 // For debugging swing Component names assigned with Container's setName() 113 130 public static void printComponentNames(Component root, String tabbing) { 114 131 if(!TEST_MODE) return;
Note:
See TracChangeset
for help on using the changeset viewer.