Changeset 2273
- Timestamp:
- 2001-04-03T21:36:37+12:00 (23 years ago)
- Location:
- trunk/java-client/org/nzdl/gsdl
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/java-client/org/nzdl/gsdl/SimpleGraphicalClient/CSFrame.java
r2260 r2273 153 153 case QUIT_ID: 154 154 System.out.println("quit chosen from menu"); 155 //save preferences not in dialog 156 searchPanel.savePrefs(); 155 157 dispose(); // free resources 156 158 System.exit(0); // exit program -
trunk/java-client/org/nzdl/gsdl/SimpleGraphicalClient/SearchPanel.java
r2270 r2273 142 142 searchTextFieldPanel.add(searchTextField); 143 143 144 145 String queryType = NzdlConstants.DEFAULT_QUERY_TYPE; 146 System.err.println("default queryType = " + queryType); 147 if (NzdlPreferences.getInstance().isString(NzdlConstants.QUERYTYPE)) { 148 queryType = NzdlPreferences.getInstance().getString(NzdlConstants.QUERYTYPE); 149 } 150 System.err.println("queryType = " + queryType); 151 boolean stemming = NzdlConstants.DEFAULT_STEMMING; 152 if (NzdlPreferences.getInstance().isBoolean(NzdlConstants.STEMMING)) 153 stemming = NzdlPreferences.getInstance().getBoolean(NzdlConstants.STEMMING); 154 boolean caseFolding = NzdlConstants.DEFAULT_CASE_FOLDING; 155 if (NzdlPreferences.getInstance().isBoolean(NzdlConstants.CASE_FOLDING)) 156 caseFolding = NzdlPreferences.getInstance().getBoolean(NzdlConstants.CASE_FOLDING); 157 144 158 optionsPanel = new JPanel(); 145 159 … … 148 162 rankedRadioButton = new JRadioButton("ranked"); 149 163 rankedRadioButton.setActionCommand(rankedRadioButton.getText()); 150 rankedRadioButton.setSelected( rankedRadioButton.getText() == NzdlConstants.DEFAULT_QUERY_TYPE);164 rankedRadioButton.setSelected(queryType.equals(rankedRadioButton.getText())); 151 165 rankedRadioButton.setToolTipText("Display results in a ranked list"); 152 166 153 167 booleanRadioButton = new JRadioButton("boolean"); 154 168 booleanRadioButton.setActionCommand(booleanRadioButton.getText()); 155 booleanRadioButton.setSelected( booleanRadioButton.getText() == NzdlConstants.DEFAULT_QUERY_TYPE);169 booleanRadioButton.setSelected(queryType.equals(booleanRadioButton.getText())); 156 170 booleanRadioButton.setToolTipText("Allows the use of Boolean operators: AND(&) OR(|) and NOT(!)"); 157 171 buttonGroup = new ButtonGroup(); … … 160 174 queryTypePanel.add(rankedRadioButton); 161 175 queryTypePanel.add(booleanRadioButton); 162 163 stemCheckBox = new JCheckBox("Stemming", true);176 177 stemCheckBox = new JCheckBox("Stemming", stemming); 164 178 stemCheckBox.setToolTipText("Strip endings such as '...ing', '...ed'"); 165 caseFoldCheckBox = new JCheckBox("Match case", false);179 caseFoldCheckBox = new JCheckBox("Match case", caseFolding); 166 180 caseFoldCheckBox.setToolTipText("Only match when the case is the same"); 167 181 … … 416 430 } 417 431 418 419 } //end SearchPanel 432 /* 433 * save prefs not in preferencesDialog 434 */ 435 public void savePrefs() { 436 NzdlPreferences.getInstance().setBoolean(NzdlConstants.STEMMING,stemCheckBox.isSelected()); 437 NzdlPreferences.getInstance().setBoolean(NzdlConstants.CASE_FOLDING,caseFoldCheckBox.isSelected()); 438 NzdlPreferences.getInstance().setString(NzdlConstants.QUERYTYPE,buttonGroup.getSelection().getActionCommand()); 439 } //savePrefs 440 441 442 } //end SearchPanel -
trunk/java-client/org/nzdl/gsdl/util/NzdlConstants.java
r2270 r2273 27 27 * @author Aziz Mahoui ([email protected]) 28 28 * @author Gordon Paynter ([email protected]) 29 * @author Dave Nichols ([email protected]) 29 30 * @version $Revision$ 30 31 */ … … 41 42 int DEFAULT_END_RESULTS = 10; 42 43 int DEFAULT_MAX_DOCS = 200; 44 45 /* preferences not under explicit dialog/user control */ 46 47 String STEMMING = "stemming"; 48 String CASE_FOLDING = "casefolding"; 49 String QUERYTYPE = "querytype"; 50 43 51 44 52 /* Preference Strings */ -
trunk/java-client/org/nzdl/gsdl/util/NzdlPreferences.java
r2270 r2273 97 97 getInstance().save(); 98 98 } 99 100 101 public static boolean isBoolean(String key) { 102 String value = (String) getInstance()._preferences.get(key); 103 if (value == null) 104 return false; 105 return true; 106 } 107 99 108 /** 100 109 * Get a String preference … … 109 118 return value; 110 119 } 120 121 public static boolean isString(String key){ 122 //String value = (String) getInstance()._preferences.get(key); 123 if (getInstance()._preferences.get(key) == null ) 124 return false; 125 else 126 return true; 127 } 128 129 130 111 131 /** 112 132 * Set a String preference
Note:
See TracChangeset
for help on using the changeset viewer.