Style fixes and import pruning. Beware, CheckStyle is (finally) coming to town.

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5240 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2008-07-18 18:32:59 +00:00
parent 45f0f9d8b7
commit e41dda3018
37 changed files with 103 additions and 110 deletions
@@ -38,11 +38,11 @@ public interface AdminService extends InvocationService
* Delivers a successful response to a {@link #getConfigInfo}
* request.
*/
public void gotConfigInfo (String[] keys, int[] oids);
void gotConfigInfo (String[] keys, int[] oids);
}
/**
* Requests the list of config objects.
*/
public void getConfigInfo (Client client, ConfigInfoListener listener);
void getConfigInfo (Client client, ConfigInfoListener listener);
}
@@ -78,13 +78,13 @@ public class AsStringFieldEditor extends FieldEditor
} else if (_field.getType().equals(int[].class)) {
return StringUtil.parseIntArray(_value.getText());
} else if (_field.getType().equals(float[].class)) {
return StringUtil.parseFloatArray(_value.getText());
} else if (_field.getType().equals(long[].class)) {
return StringUtil.parseLongArray(_value.getText());
} else if (_field.getType().equals(Boolean.TYPE)) {
return new Boolean(_value.getText().equalsIgnoreCase("true"));
@@ -35,7 +35,7 @@ import com.threerings.presents.dobj.DObject;
import com.threerings.presents.util.PresentsContext;
/**
* Provides "editing" of boolean fields
* Provides "editing" of boolean fields.
*/
public class BooleanFieldEditor extends FieldEditor
{
@@ -58,7 +58,7 @@ public class ConfigEditorPanel extends JPanel
_defaultPane = defaultPane;
setLayout(new VGroupLayout(VGroupLayout.STRETCH, VGroupLayout.STRETCH,
5, VGroupLayout.CENTER));
VGroupLayout.DEFAULT_GAP, VGroupLayout.CENTER));
// create our objects tabbed pane
add(_oeditors = new JTabbedPane(JTabbedPane.LEFT));
@@ -39,9 +39,9 @@ import static com.threerings.admin.Log.log;
*/
public class ConfigObjectManager implements AdminService.ConfigInfoListener
{
public ConfigObjectManager(Client client)
public ConfigObjectManager (Client client)
{
_serverconfig = new HashMap<String,ConfigObject>();
_serverconfig = new HashMap<String, ConfigObject>();
_client = client;
_client.addClientObserver(new ClientAdapter() {
public void clientWillLogon (Client client) {
@@ -62,7 +62,7 @@ public class ConfigObjectManager implements AdminService.ConfigInfoListener
}
/**
* Returns the ConfigObject identified by the given key
* Returns the ConfigObject identified by the given key.
*/
public ConfigObject getServerConfig (String key)
{
@@ -87,16 +87,16 @@ public class ConfigObjectManager implements AdminService.ConfigInfoListener
/**
* Convenience: generate a getConfigInfo request to the AdminService from the external class,
* instead from within the anonymous inner class
* instead from within the anonymous inner class.
*/
protected void getConfigInfo()
protected void getConfigInfo ()
{
_service.getConfigInfo(_client, this);
}
/**
* This class takes care of the details of subscribing to and placing an individual
* ConfigObject that the server knows about into a HashMap
* ConfigObject that the server knows about into a HashMap.
*/
protected class ConfigObjectSubscriber implements Subscriber<ConfigObject>
{
@@ -133,28 +133,28 @@ public class ConfigObjectManager implements AdminService.ConfigInfoListener
_serverconfig.remove(_key);
}
/** The object that we are tracking */
/** The object that we are tracking. */
protected ConfigObject _cobj;
/** The name of the config object that we are subscribing to */
/** The name of the config object to which we are subscribing. */
protected String _key;
/** The oid of the object that we're tracking */
/** The oid of the object that we're tracking. */
protected int _oid;
}
/** An array of handlers that each subscribe to a single ConfigObject */
/** An array of handlers that each subscribe to a single ConfigObject. */
protected ConfigObjectSubscriber[] _csubscribers;
/** Our local copy of the server-side runtime configuration */
protected HashMap<String,ConfigObject> _serverconfig;
/** Our local copy of the server-side runtime configuration. */
protected HashMap<String, ConfigObject> _serverconfig;
/** Our distributed object manager */
/** Our distributed object manager. */
protected DObjectManager _dobjmgr;
/** Our admin service that we're using to fetch data */
/** Our admin service that we're using to fetch data. */
protected AdminService _service;
/** Our client object */
/** Our client object. */
protected Client _client;
}
@@ -125,7 +125,7 @@ public class DSetEditor extends JPanel
public Dimension getPreferredSize ()
{
Dimension d = super.getPreferredSize();
d.height = Math.min(d.height, 200);
d.height = Math.min(d.height, MIN_HEIGHT);
return d;
}
@@ -193,8 +193,8 @@ public class DSetEditor extends JPanel
// documentation inherited from interface ActionListener
public void actionPerformed (ActionEvent event)
{
CommandEvent ce = (CommandEvent) event;
_setter.updateSet(_setName, (DSet.Entry) ce.getArgument());
CommandEvent ce = (CommandEvent)event;
_setter.updateSet(_setName, (DSet.Entry)ce.getArgument());
}
protected void refreshData ()
@@ -223,4 +223,7 @@ public class DSetEditor extends JPanel
/** The table used to edit. */
protected ObjectEditorTable _table;
/** The minimum height for our editor UI. */
protected static final int MIN_HEIGHT = 200;
}
@@ -105,8 +105,7 @@ public abstract class FieldEditor extends JPanel
try {
_object.changeAttribute(_field.getName(), value);
} catch (ObjectAccessException oae) {
log.warning("Failed to update field " + _field.getName() +
": "+ oae);
log.warning("Failed to update field " + _field.getName() + ": " + oae);
}
}
}
@@ -30,7 +30,6 @@ import com.samskivert.swing.ScrollablePanel;
import com.samskivert.swing.VGroupLayout;
import com.samskivert.swing.util.SwingUtil;
import com.threerings.presents.dobj.DObject;
import com.threerings.presents.dobj.ObjectAccessException;
import com.threerings.presents.dobj.Subscriber;
import com.threerings.presents.util.PresentsContext;
@@ -60,8 +59,8 @@ public class ObjectEditorPanel extends ScrollablePanel
public ObjectEditorPanel (PresentsContext ctx, String key, int oid)
{
super(new VGroupLayout(VGroupLayout.NONE, VGroupLayout.STRETCH,
5, VGroupLayout.TOP));
setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
VGroupLayout.DEFAULT_GAP, VGroupLayout.TOP));
setBorder(BorderFactory.createEmptyBorder(BORDER, BORDER, BORDER, BORDER));
// keep this business around
_ctx = ctx;
@@ -127,4 +126,6 @@ public class ObjectEditorPanel extends ScrollablePanel
protected String _key;
protected SafeSubscriber<ConfigObject> _safesub;
protected ConfigObject _object;
protected static final int BORDER = 5;
}
@@ -48,13 +48,13 @@ public class PulldownFieldEditor extends FieldEditor
/**
* Construct a pulldown choice.
*/
public Choice (String displayName, Object value)
public Choice (String displayName, Object val)
{
if (displayName == null) {
throw new NullPointerException("displayName cannot be null.");
}
_name = displayName;
this.value = value;
value = val;
}
// documentation inherited
@@ -117,14 +117,14 @@ public class PulldownFieldEditor extends FieldEditor
if (obj == null) {
return null;
}
return ((Choice) obj).value;
return ((Choice)obj).value;
}
// documentation inherited
protected void displayValue (Object value)
{
for (int ii = _value.getItemCount() - 1; ii >= 0; ii--) {
Choice choice = (Choice) _value.getItemAt(ii);
Choice choice = (Choice)_value.getItemAt(ii);
if (ObjectUtil.equals(value, choice.value)) {
_value.setSelectedIndex(ii);
return;
@@ -33,7 +33,6 @@ import com.samskivert.util.StringUtil;
import com.threerings.io.ObjectInputStream;
import com.threerings.io.ObjectOutputStream;
import com.threerings.io.Streamable;
import com.threerings.presents.dobj.AccessController;
import com.threerings.presents.dobj.AttributeChangeListener;
import com.threerings.presents.dobj.AttributeChangedEvent;
import com.threerings.presents.dobj.DObject;
@@ -79,7 +78,7 @@ public abstract class ConfigRegistry
/**
* Creates a ConfigRegistry.
*
*
* @param transitioning if true, serialized Streamable instances stored in the registry will
* be written back out immediately to allow them to be transitioned to new class names.
*/
@@ -143,9 +142,9 @@ public abstract class ConfigRegistry
{
public DObject object;
public ObjectRecord (DObject object)
public ObjectRecord (DObject obj)
{
this.object = object;
object = obj;
}
public void init ()
@@ -238,7 +237,7 @@ public abstract class ConfigRegistry
} else if (value instanceof String[]) {
setValue(key, (String[])value);
} else if (value instanceof long[]) {
setValue(key, (long[]) value);
setValue(key, (long[])value);
} else {
log.info("Unable to flush config obj change [cobj=" + object.getClass().getName() +
", key=" + key + ", type=" + value.getClass().getName() +
@@ -310,7 +309,7 @@ public abstract class ConfigRegistry
Object deserializedValue = oin.readObject();
field.set(object, deserializedValue);
if (_transitioning) {
// Use serialize rather than serializeAttribute so we don't get
// Use serialize rather than serializeAttribute so we don't get
// ObjectAccessExceptions
serialize(key, nameToKey(key), deserializedValue);
}
@@ -404,8 +403,8 @@ public abstract class ConfigRegistry
}
/** A mapping from identifying key to config object. */
protected HashMap<String,ObjectRecord> _configs = new HashMap<String,ObjectRecord>();
protected HashMap<String, ObjectRecord> _configs = new HashMap<String, ObjectRecord>();
/** If we need to transition serialized Streamables to a new class format in init.. */
protected boolean _transitioning;
}
@@ -59,10 +59,10 @@ public class DatabaseConfigRegistry extends ConfigRegistry
{
this(ctx, invoker, false);
}
/**
* Creates a configuration registry and prepares it for operation.
*
*
* @param ctx will provide access to our database.
* @param invoker this will be used to perform all database activity (except first time
* initialization) so as to avoid blocking the distributed object thread.
@@ -40,6 +40,7 @@ public class PrefsConfigRegistry extends ConfigRegistry
return new PrefsObjectRecord(path, object);
}
/** Stores preferences using the Java preferences system. */
protected class PrefsObjectRecord extends ObjectRecord
{
public PrefsConfig config;
@@ -28,6 +28,9 @@ import com.samskivert.jdbc.depot.annotation.Entity;
import com.samskivert.jdbc.depot.annotation.Id;
import com.samskivert.jdbc.depot.expression.ColumnExp;
/**
* Stores information about a configuration entry in the database.
*/
@Entity(name="CONFIG")
public class ConfigRecord extends PersistentRecord
{
@@ -45,7 +45,7 @@ public class ConfigRepository extends DepotRepository
/**
* Loads up the configuration data for the specified object.
*
*
* @return a map containing field/value pairs for all stored configuration data.
*/
public HashMap<String,String> loadConfig (String node, String object)