Skip to content

Commit

Permalink
Renamed Pref abbreviated classes to more verbose Preference. Removed …
Browse files Browse the repository at this point in the history
…old preference page classes not being used.
  • Loading branch information
erichschroeter committed Sep 23, 2011
1 parent 6798362 commit f900921
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 164 deletions.
41 changes: 0 additions & 41 deletions src/org/jpreferences/DefaultPreferencePage.java

This file was deleted.

104 changes: 0 additions & 104 deletions src/org/jpreferences/IPreferencePage.java

This file was deleted.

16 changes: 8 additions & 8 deletions src/org/jpreferences/PreferenceDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,8 @@ public void actionPerformed(ActionEvent e) {

private void deleteRows(int... rows) {
TableModel model = editTable.getModel();
if (model instanceof PrefTableModel) {
PrefTableModel prefModel = (PrefTableModel) model;
if (model instanceof PreferenceTableModel) {
PreferenceTableModel prefModel = (PreferenceTableModel) model;
for (int i = 0; i < rows.length; i++) {
prefModel.removeRow(rows[i]);
}
Expand All @@ -156,8 +156,8 @@ public void actionPerformed(ActionEvent e) {

private void addRow(String key, Object value) {
TableModel model = editTable.getModel();
if (model instanceof PrefTableModel) {
PrefTableModel prefModel = (PrefTableModel) model;
if (model instanceof PreferenceTableModel) {
PreferenceTableModel prefModel = (PreferenceTableModel) model;
prefModel.addRow(key, value);
}
}
Expand Down Expand Up @@ -300,10 +300,10 @@ protected JTree createTree(boolean userPreferences,
@Override
public void valueChanged(TreeSelectionEvent e) {
try {
PrefTreeNode node = (PrefTreeNode) e.getPath()
PreferenceTreeNode node = (PreferenceTreeNode) e.getPath()
.getLastPathComponent();
Preferences pref = node.getPrefObject();
editTable.setModel(new PrefTableModel(pref));
editTable.setModel(new PreferenceTableModel(pref));
} catch (ClassCastException ce) {
// System.out.println("Node not PrefTreeNode!");
editTable.setModel(new DefaultTableModel());
Expand Down Expand Up @@ -359,10 +359,10 @@ protected MutableTreeNode createRootNode(Preferences preference,
MutableTreeNode node = null;
try {
if (preference == null) {
node = new PrefTreeNode(defaultUser ? Preferences.userRoot()
node = new PreferenceTreeNode(defaultUser ? Preferences.userRoot()
: Preferences.systemRoot());
} else {
node = new PrefTreeNode(preference);
node = new PreferenceTreeNode(preference);
}
} catch (BackingStoreException e) {
e.printStackTrace();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,27 @@
import javax.swing.table.AbstractTableModel;

/**
* The <code>PrefTableModel</code> wraps a {@link Preferences} object to view
* and edit its children preferences.
* The <code>PreferenceTableModel</code> wraps a {@link Preferences} object to
* view and edit its children preferences.
*
* @author Erich Schroeter, http://www.roseindia.net/javatutorials/javaapi.shtml
*/
@SuppressWarnings("serial")
class PrefTableModel extends AbstractTableModel {
class PreferenceTableModel extends AbstractTableModel {

/** The preference object to wrap. */
private Preferences pref;
/** A reference to the preference keys. */
private String[] keys;

/**
* Constructs a <code>PrefTableModel</code> wrapping the specified
* Constructs a <code>PreferenceTableModel</code> wrapping the specified
* <code>pref</code>.
*
* @param pref
* the preference object to wrap
*/
public PrefTableModel(Preferences pref) {
public PreferenceTableModel(Preferences pref) {
this.pref = pref;
updateKeys();
pref.addPreferenceChangeListener(new PreferenceChangeListener() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,21 @@
import javax.swing.tree.TreeNode;

/**
* A <code>PrefTreeNode</code> wraps a {@link Preferences} object allowing it to
* be used in a {@link JTree}.
* A <code>PreferenceTreeNode</code> wraps a {@link Preferences} object allowing
* it to be used in a {@link JTree}.
*
* @author Erich Schroeter, http://www.roseindia.net/javatutorials/javaapi.shtml
*/
@SuppressWarnings("serial")
public class PrefTreeNode extends DefaultMutableTreeNode {
public class PreferenceTreeNode extends DefaultMutableTreeNode {

/** The preferences being wrapped. */
private Preferences pref;
/** The children node names. */
private String[] children;

/**
* Constructs a <code>PrefTreeNode</code> specifying the
* Constructs a <code>PreferenceTreeNode</code> specifying the
* <code>Preferences</code> node to be wrapped.
*
* @param pref
Expand All @@ -31,7 +31,7 @@ public class PrefTreeNode extends DefaultMutableTreeNode {
* if a failure in the backing store occurs, or inability to
* communicate with it
*/
public PrefTreeNode(Preferences pref) throws BackingStoreException {
public PreferenceTreeNode(Preferences pref) throws BackingStoreException {
this.pref = pref;
this.children = pref.childrenNames();
}
Expand Down Expand Up @@ -60,7 +60,7 @@ public TreeNode getChildAt(int index) {
TreeNode child = null;
if (index < children.length) {
try {
child = new PrefTreeNode(pref.node(children[index]));
child = new PreferenceTreeNode(pref.node(children[index]));
} catch (BackingStoreException e) {
e.printStackTrace();
child = new DefaultMutableTreeNode("Problem Child!");
Expand Down

0 comments on commit f900921

Please sign in to comment.