Brought things up to date with the latest Jakarta Commons world order.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3058 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: BundledComponentRepository.java,v 1.32 2004/07/03 03:41:21 mdb Exp $
|
||||
// $Id: BundledComponentRepository.java,v 1.33 2004/07/13 16:34:49 mdb Exp $
|
||||
|
||||
package com.threerings.cast.bundle;
|
||||
|
||||
@@ -18,7 +18,7 @@ import com.samskivert.util.HashIntMap;
|
||||
import com.samskivert.util.IntIntMap;
|
||||
import com.samskivert.util.Tuple;
|
||||
|
||||
import org.apache.commons.collections.FilterIterator;
|
||||
import org.apache.commons.collections.iterators.FilterIterator;
|
||||
import org.apache.commons.collections.Predicate;
|
||||
|
||||
import com.threerings.resource.ResourceBundle;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: ActionRuleSet.java,v 1.2 2002/06/26 23:53:07 mdb Exp $
|
||||
// $Id: ActionRuleSet.java,v 1.3 2004/07/13 16:34:49 mdb Exp $
|
||||
|
||||
package com.threerings.cast.tools.xml;
|
||||
|
||||
@@ -60,14 +60,13 @@ public class ActionRuleSet extends RuleSetBase
|
||||
ActionSequence.class.getName());
|
||||
|
||||
// grab the name attribute from the <action> tag
|
||||
digester.addRule(_prefix + ACTION_PATH,
|
||||
new SetPropertyFieldsRule(digester));
|
||||
digester.addRule(_prefix + ACTION_PATH, new SetPropertyFieldsRule());
|
||||
|
||||
// grab the other attributes from their respective tags
|
||||
digester.addRule(_prefix + ACTION_PATH + "/framesPerSecond",
|
||||
new SetFieldRule(digester, "framesPerSecond"));
|
||||
new SetFieldRule("framesPerSecond"));
|
||||
|
||||
CallMethodSpecialRule origin = new CallMethodSpecialRule(digester) {
|
||||
CallMethodSpecialRule origin = new CallMethodSpecialRule() {
|
||||
public void parseAndSet (String bodyText, Object target)
|
||||
throws Exception {
|
||||
int[] coords = StringUtil.parseIntArray(bodyText);
|
||||
@@ -82,7 +81,7 @@ public class ActionRuleSet extends RuleSetBase
|
||||
};
|
||||
digester.addRule(_prefix + ACTION_PATH + "/origin", origin);
|
||||
|
||||
CallMethodSpecialRule orient = new CallMethodSpecialRule(digester) {
|
||||
CallMethodSpecialRule orient = new CallMethodSpecialRule() {
|
||||
public void parseAndSet (String bodyText, Object target)
|
||||
throws Exception {
|
||||
ActionSequence seq = ((ActionSequence)target);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: ClassRuleSet.java,v 1.2 2002/12/16 03:08:39 mdb Exp $
|
||||
// $Id: ClassRuleSet.java,v 1.3 2004/07/13 16:34:49 mdb Exp $
|
||||
|
||||
package com.threerings.cast.tools.xml;
|
||||
|
||||
@@ -56,13 +56,12 @@ public class ClassRuleSet extends RuleSetBase
|
||||
ComponentClass.class.getName());
|
||||
|
||||
// grab the attributes from the <class> tag
|
||||
digester.addRule(_prefix + CLASS_PATH,
|
||||
new SetPropertyFieldsRule(digester));
|
||||
digester.addRule(_prefix + CLASS_PATH, new SetPropertyFieldsRule());
|
||||
|
||||
// parse render priority overrides
|
||||
String opath = _prefix + CLASS_PATH + "/override";
|
||||
digester.addObjectCreate(opath, PriorityOverride.class.getName());
|
||||
SetPropertyFieldsRule rule = new SetPropertyFieldsRule(digester);
|
||||
SetPropertyFieldsRule rule = new SetPropertyFieldsRule();
|
||||
rule.addFieldParser("orients", new FieldParser() {
|
||||
public Object parse (String text) {
|
||||
String[] orients = StringUtil.parseStringArray(text);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: ColorPositoryParser.java,v 1.1 2003/01/31 23:10:45 mdb Exp $
|
||||
// $Id: ColorPositoryParser.java,v 1.2 2004/07/13 16:34:49 mdb Exp $
|
||||
|
||||
package com.threerings.media.image.tools.xml;
|
||||
|
||||
@@ -34,13 +34,14 @@ public class ColorPositoryParser extends CompiledConfigParser
|
||||
// create and configure class record instances
|
||||
String prefix = "colors/class";
|
||||
digest.addObjectCreate(prefix, ClassRecord.class.getName());
|
||||
digest.addRule(prefix, new SetPropertyFieldsRule(digest));
|
||||
digest.addRule(prefix, new SetPropertyFieldsRule());
|
||||
digest.addSetNext(prefix, "addClass", ClassRecord.class.getName());
|
||||
|
||||
// create and configure color record instances
|
||||
prefix += "/color";
|
||||
digest.addRule(prefix, new Rule(digest) {
|
||||
public void begin (Attributes attributes) throws Exception {
|
||||
digest.addRule(prefix, new Rule() {
|
||||
public void begin (String namespace, String name,
|
||||
Attributes attributes) throws Exception {
|
||||
// we want to inherit settings from the color class when
|
||||
// creating the record, so we do some custom stuff
|
||||
ColorRecord record = new ColorRecord();
|
||||
@@ -49,11 +50,11 @@ public class ColorPositoryParser extends CompiledConfigParser
|
||||
digester.push(record);
|
||||
}
|
||||
|
||||
public void end () throws Exception {
|
||||
public void end (String namespace, String name) throws Exception {
|
||||
digester.pop();
|
||||
}
|
||||
});
|
||||
digest.addRule(prefix, new SetPropertyFieldsRule(digest));
|
||||
digest.addRule(prefix, new SetPropertyFieldsRule());
|
||||
digest.addSetNext(prefix, "addColor", ColorRecord.class.getName());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: SoundManager.java,v 1.72 2004/02/26 18:42:51 ray Exp $
|
||||
// $Id: SoundManager.java,v 1.73 2004/07/13 16:34:49 mdb Exp $
|
||||
|
||||
package com.threerings.media.sound;
|
||||
|
||||
@@ -27,8 +27,7 @@ import javax.sound.sampled.LineUnavailableException;
|
||||
import javax.sound.sampled.SourceDataLine;
|
||||
import javax.sound.sampled.UnsupportedAudioFileException;
|
||||
|
||||
import org.apache.commons.io.StreamUtils;
|
||||
import org.apache.commons.lang.Constant;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
|
||||
import com.samskivert.util.Config;
|
||||
import com.samskivert.util.Interval;
|
||||
@@ -735,7 +734,7 @@ public class SoundManager
|
||||
InputStream stream = getTestClip(key);
|
||||
if (stream != null) {
|
||||
data = new byte[1][];
|
||||
data[0] = StreamUtils.streamAsBytes(stream, BUFFER_SIZE);
|
||||
data[0] = IOUtils.toByteArray(stream);
|
||||
|
||||
} else {
|
||||
// otherwise, randomize between all available sounds
|
||||
@@ -855,7 +854,7 @@ public class SoundManager
|
||||
}
|
||||
}
|
||||
|
||||
return StreamUtils.streamAsBytes(clipin, BUFFER_SIZE);
|
||||
return IOUtils.toByteArray(clipin);
|
||||
}
|
||||
|
||||
protected Config getConfig (SoundKey key)
|
||||
@@ -1271,13 +1270,13 @@ public class SoundManager
|
||||
protected HashMap _configs = new HashMap();
|
||||
|
||||
/** Signals to the queue to do different things. */
|
||||
protected Constant PLAY = new Constant("PLAY");
|
||||
protected Constant PLAYMUSIC = new Constant("PLAYMUSIC");
|
||||
protected Constant STOPMUSIC = new Constant("STOPMUSIC");
|
||||
protected Constant UPDATE_MUSIC_VOL = new Constant("UPDATE_MUSIC_VOL");
|
||||
protected Constant LOCK = new Constant("LOCK");
|
||||
protected Constant UNLOCK = new Constant("UNLOCK");
|
||||
protected Constant DIE = new Constant("DIE");
|
||||
protected String PLAY = new String("PLAY");
|
||||
protected String PLAYMUSIC = new String("PLAYMUSIC");
|
||||
protected String STOPMUSIC = new String("STOPMUSIC");
|
||||
protected String UPDATE_MUSIC_VOL = new String("UPDATE_MUSIC_VOL");
|
||||
protected String LOCK = new String("LOCK");
|
||||
protected String UNLOCK = new String("UNLOCK");
|
||||
protected String DIE = new String("DIE");
|
||||
|
||||
/** A pref that specifies a directory for us to get test sounds from. */
|
||||
protected static RuntimeAdjust.FileAdjust _testDir =
|
||||
@@ -1298,9 +1297,6 @@ public class SoundManager
|
||||
/** The queue size at which we start to ignore requests to play sounds. */
|
||||
protected static final int MAX_QUEUE_SIZE = 25;
|
||||
|
||||
/** The buffer size in bytes used when reading audio file data. */
|
||||
protected static final int BUFFER_SIZE = 1024 * 16;
|
||||
|
||||
/** Used to disable sound entirely. */
|
||||
protected static final boolean SOUND_ENABLED = true;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: TileSetBundler.java,v 1.19 2004/02/25 14:43:17 mdb Exp $
|
||||
// $Id: TileSetBundler.java,v 1.20 2004/07/13 16:34:49 mdb Exp $
|
||||
|
||||
package com.threerings.media.tile.bundle.tools;
|
||||
|
||||
@@ -20,7 +20,7 @@ import java.util.zip.Deflater;
|
||||
import javax.imageio.ImageIO;
|
||||
|
||||
import org.apache.commons.digester.Digester;
|
||||
import org.apache.commons.io.StreamUtils;
|
||||
import org.apache.commons.io.CopyUtils;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
import com.samskivert.io.NestableIOException;
|
||||
@@ -400,7 +400,7 @@ public class TileSetBundler
|
||||
} else {
|
||||
jar.putNextEntry(new JarEntry(imagePath));
|
||||
FileInputStream imgin = new FileInputStream(ifile);
|
||||
StreamUtils.pipe(imgin, jar);
|
||||
CopyUtils.copy(imgin, jar);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new NestableIOException(
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: ObjectTileSetRuleSet.java,v 1.10 2004/02/25 14:43:17 mdb Exp $
|
||||
// $Id: ObjectTileSetRuleSet.java,v 1.11 2004/07/13 16:34:49 mdb Exp $
|
||||
|
||||
package com.threerings.media.tile.tools.xml;
|
||||
|
||||
@@ -47,7 +47,7 @@ public class ObjectTileSetRuleSet extends SwissArmyTileSetRuleSet
|
||||
|
||||
digester.addRule(
|
||||
_prefix + TILESET_PATH + "/objectWidths",
|
||||
new CallMethodSpecialRule(digester) {
|
||||
new CallMethodSpecialRule() {
|
||||
public void parseAndSet (String bodyText, Object target)
|
||||
{
|
||||
int[] widths = StringUtil.parseIntArray(bodyText);
|
||||
@@ -57,7 +57,7 @@ public class ObjectTileSetRuleSet extends SwissArmyTileSetRuleSet
|
||||
|
||||
digester.addRule(
|
||||
_prefix + TILESET_PATH + "/objectHeights",
|
||||
new CallMethodSpecialRule(digester) {
|
||||
new CallMethodSpecialRule() {
|
||||
public void parseAndSet (String bodyText, Object target)
|
||||
{
|
||||
int[] heights = StringUtil.parseIntArray(bodyText);
|
||||
@@ -66,8 +66,7 @@ public class ObjectTileSetRuleSet extends SwissArmyTileSetRuleSet
|
||||
});
|
||||
|
||||
digester.addRule(
|
||||
_prefix + TILESET_PATH + "/xOrigins",
|
||||
new CallMethodSpecialRule(digester) {
|
||||
_prefix + TILESET_PATH + "/xOrigins", new CallMethodSpecialRule() {
|
||||
public void parseAndSet (String bodyText, Object target)
|
||||
{
|
||||
int[] xorigins = StringUtil.parseIntArray(bodyText);
|
||||
@@ -76,8 +75,7 @@ public class ObjectTileSetRuleSet extends SwissArmyTileSetRuleSet
|
||||
});
|
||||
|
||||
digester.addRule(
|
||||
_prefix + TILESET_PATH + "/yOrigins",
|
||||
new CallMethodSpecialRule(digester) {
|
||||
_prefix + TILESET_PATH + "/yOrigins", new CallMethodSpecialRule() {
|
||||
public void parseAndSet (String bodyText, Object target)
|
||||
{
|
||||
int[] yorigins = StringUtil.parseIntArray(bodyText);
|
||||
@@ -87,7 +85,7 @@ public class ObjectTileSetRuleSet extends SwissArmyTileSetRuleSet
|
||||
|
||||
digester.addRule(
|
||||
_prefix + TILESET_PATH + "/priorities",
|
||||
new CallMethodSpecialRule(digester) {
|
||||
new CallMethodSpecialRule() {
|
||||
public void parseAndSet (String bodyText, Object target)
|
||||
{
|
||||
byte[] prios = StringUtil.parseByteArray(bodyText);
|
||||
@@ -96,8 +94,7 @@ public class ObjectTileSetRuleSet extends SwissArmyTileSetRuleSet
|
||||
});
|
||||
|
||||
digester.addRule(
|
||||
_prefix + TILESET_PATH + "/zations",
|
||||
new CallMethodSpecialRule(digester) {
|
||||
_prefix + TILESET_PATH + "/zations", new CallMethodSpecialRule() {
|
||||
public void parseAndSet (String bodyText, Object target)
|
||||
{
|
||||
String[] zations = StringUtil.parseStringArray(bodyText);
|
||||
@@ -106,8 +103,7 @@ public class ObjectTileSetRuleSet extends SwissArmyTileSetRuleSet
|
||||
});
|
||||
|
||||
digester.addRule(
|
||||
_prefix + TILESET_PATH + "/xspots",
|
||||
new CallMethodSpecialRule(digester) {
|
||||
_prefix + TILESET_PATH + "/xspots", new CallMethodSpecialRule() {
|
||||
public void parseAndSet (String bodyText, Object target)
|
||||
{
|
||||
short[] xspots = StringUtil.parseShortArray(bodyText);
|
||||
@@ -116,8 +112,7 @@ public class ObjectTileSetRuleSet extends SwissArmyTileSetRuleSet
|
||||
});
|
||||
|
||||
digester.addRule(
|
||||
_prefix + TILESET_PATH + "/yspots",
|
||||
new CallMethodSpecialRule(digester) {
|
||||
_prefix + TILESET_PATH + "/yspots", new CallMethodSpecialRule() {
|
||||
public void parseAndSet (String bodyText, Object target)
|
||||
{
|
||||
short[] yspots = StringUtil.parseShortArray(bodyText);
|
||||
@@ -126,8 +121,7 @@ public class ObjectTileSetRuleSet extends SwissArmyTileSetRuleSet
|
||||
});
|
||||
|
||||
digester.addRule(
|
||||
_prefix + TILESET_PATH + "/sorients",
|
||||
new CallMethodSpecialRule(digester) {
|
||||
_prefix + TILESET_PATH + "/sorients", new CallMethodSpecialRule() {
|
||||
public void parseAndSet (String bodyText, Object target)
|
||||
{
|
||||
ObjectTileSet set = (ObjectTileSet)target;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: SwissArmyTileSetRuleSet.java,v 1.10 2004/02/25 14:43:17 mdb Exp $
|
||||
// $Id: SwissArmyTileSetRuleSet.java,v 1.11 2004/07/13 16:34:49 mdb Exp $
|
||||
|
||||
package com.threerings.media.tile.tools.xml;
|
||||
|
||||
@@ -42,8 +42,7 @@ public class SwissArmyTileSetRuleSet extends TileSetRuleSet
|
||||
super.addRuleInstances(digester);
|
||||
|
||||
digester.addRule(
|
||||
_prefix + TILESET_PATH + "/widths",
|
||||
new CallMethodSpecialRule(digester) {
|
||||
_prefix + TILESET_PATH + "/widths", new CallMethodSpecialRule() {
|
||||
public void parseAndSet (String bodyText, Object target)
|
||||
{
|
||||
int[] widths = StringUtil.parseIntArray(bodyText);
|
||||
@@ -52,8 +51,7 @@ public class SwissArmyTileSetRuleSet extends TileSetRuleSet
|
||||
});
|
||||
|
||||
digester.addRule(
|
||||
_prefix + TILESET_PATH + "/heights",
|
||||
new CallMethodSpecialRule(digester) {
|
||||
_prefix + TILESET_PATH + "/heights", new CallMethodSpecialRule() {
|
||||
public void parseAndSet (String bodyText, Object target)
|
||||
{
|
||||
int[] heights = StringUtil.parseIntArray(bodyText);
|
||||
@@ -63,7 +61,7 @@ public class SwissArmyTileSetRuleSet extends TileSetRuleSet
|
||||
|
||||
digester.addRule(
|
||||
_prefix + TILESET_PATH + "/tileCounts",
|
||||
new CallMethodSpecialRule(digester) {
|
||||
new CallMethodSpecialRule() {
|
||||
public void parseAndSet (String bodyText, Object target)
|
||||
{
|
||||
int[] tileCounts = StringUtil.parseIntArray(bodyText);
|
||||
@@ -72,8 +70,7 @@ public class SwissArmyTileSetRuleSet extends TileSetRuleSet
|
||||
});
|
||||
|
||||
digester.addRule(
|
||||
_prefix + TILESET_PATH + "/offsetPos",
|
||||
new CallMethodSpecialRule(digester) {
|
||||
_prefix + TILESET_PATH + "/offsetPos", new CallMethodSpecialRule() {
|
||||
public void parseAndSet (String bodyText, Object target)
|
||||
{
|
||||
int[] values = StringUtil.parseIntArray(bodyText);
|
||||
@@ -88,8 +85,7 @@ public class SwissArmyTileSetRuleSet extends TileSetRuleSet
|
||||
});
|
||||
|
||||
digester.addRule(
|
||||
_prefix + TILESET_PATH + "/gapSize",
|
||||
new CallMethodSpecialRule(digester) {
|
||||
_prefix + TILESET_PATH + "/gapSize", new CallMethodSpecialRule() {
|
||||
public void parseAndSet (String bodyText, Object target)
|
||||
{
|
||||
int[] values = StringUtil.parseIntArray(bodyText);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: XMLTileSetParser.java,v 1.8 2004/02/25 14:43:17 mdb Exp $
|
||||
// $Id: XMLTileSetParser.java,v 1.9 2004/07/13 16:34:49 mdb Exp $
|
||||
|
||||
package com.threerings.media.tile.tools.xml;
|
||||
|
||||
@@ -58,8 +58,7 @@ public class XMLTileSetParser
|
||||
// add a set next rule which will put tilesets with this prefix
|
||||
// into the array list that'll be on the top of the stack
|
||||
_digester.addRule(prefix + TileSetRuleSet.TILESET_PATH,
|
||||
new ValidatedSetNextRule(_digester,
|
||||
"add", Object.class,
|
||||
new ValidatedSetNextRule("add", Object.class,
|
||||
ruleset));
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: BaseTileSetRuleSet.java,v 1.10 2004/02/25 14:43:57 mdb Exp $
|
||||
// $Id: BaseTileSetRuleSet.java,v 1.11 2004/07/13 16:34:49 mdb Exp $
|
||||
|
||||
package com.threerings.miso.tile.tools.xml;
|
||||
|
||||
@@ -28,8 +28,7 @@ public class BaseTileSetRuleSet extends SwissArmyTileSetRuleSet
|
||||
super.addRuleInstances(digester);
|
||||
|
||||
digester.addRule(
|
||||
_prefix + TILESET_PATH + "/passable",
|
||||
new CallMethodSpecialRule(digester) {
|
||||
_prefix + TILESET_PATH + "/passable", new CallMethodSpecialRule() {
|
||||
public void parseAndSet (String bodyText, Object target)
|
||||
{
|
||||
int[] values = StringUtil.parseIntArray(bodyText);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: FringeConfigurationParser.java,v 1.9 2004/02/25 14:43:57 mdb Exp $
|
||||
// $Id: FringeConfigurationParser.java,v 1.10 2004/07/13 16:34:49 mdb Exp $
|
||||
|
||||
package com.threerings.miso.tile.tools.xml;
|
||||
|
||||
@@ -43,33 +43,30 @@ public class FringeConfigurationParser extends CompiledConfigParser
|
||||
{
|
||||
// configure top-level constraints
|
||||
String prefix = "fringe";
|
||||
digest.addRule(prefix, new SetPropertyFieldsRule(digest));
|
||||
digest.addRule(prefix, new SetPropertyFieldsRule());
|
||||
|
||||
// create and configure fringe config instances
|
||||
prefix += "/base";
|
||||
digest.addObjectCreate(prefix, FringeRecord.class.getName());
|
||||
|
||||
// you'd better match parens if you have any hope of wading
|
||||
// in these waters
|
||||
digest.addRule(prefix,
|
||||
new ValidatedSetNextRule(digest, "addFringeRecord",
|
||||
new ValidatedSetNextRule.Validator () {
|
||||
public boolean isValid (Object target) {
|
||||
if (((FringeRecord) target).isValid()) {
|
||||
return true;
|
||||
} else {
|
||||
Log.warning("A FringeRecord was not added " +
|
||||
"because it was improperly specified " +
|
||||
"[record=" + target + "].");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}) {
|
||||
|
||||
// parse the fringe record, converting tileset names to tileset
|
||||
// ids
|
||||
ValidatedSetNextRule.Validator val;
|
||||
val = new ValidatedSetNextRule.Validator() {
|
||||
public boolean isValid (Object target) {
|
||||
if (((FringeRecord) target).isValid()) {
|
||||
return true;
|
||||
} else {
|
||||
Log.warning("A FringeRecord was not added because it was " +
|
||||
"improperly specified [rec=" + target + "].");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
};
|
||||
ValidatedSetNextRule vrule;
|
||||
vrule = new ValidatedSetNextRule("addFringeRecord", val) {
|
||||
// parse the fringe record, converting tileset names to
|
||||
// tileset ids
|
||||
public void begin (Attributes attrs)
|
||||
throws Exception
|
||||
throws Exception
|
||||
{
|
||||
FringeRecord frec = (FringeRecord) digester.peek();
|
||||
|
||||
@@ -96,27 +93,29 @@ public class FringeConfigurationParser extends CompiledConfigParser
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
digest.addRule(prefix, vrule);
|
||||
|
||||
// create the tileset records in each fringe record
|
||||
prefix += "/tileset";
|
||||
digest.addObjectCreate(prefix, FringeTileSetRecord.class.getName());
|
||||
digest.addRule(prefix, new ValidatedSetNextRule(digest, "addTileset",
|
||||
new ValidatedSetNextRule.Validator() {
|
||||
public boolean isValid (Object target) {
|
||||
if (((FringeTileSetRecord) target).isValid()) {
|
||||
return true;
|
||||
} else {
|
||||
Log.warning("A FringeTileSetRecord was not added " +
|
||||
"because it was improperly specified.");
|
||||
return false;
|
||||
}
|
||||
|
||||
val = new ValidatedSetNextRule.Validator() {
|
||||
public boolean isValid (Object target) {
|
||||
if (((FringeTileSetRecord) target).isValid()) {
|
||||
return true;
|
||||
} else {
|
||||
Log.warning("A FringeTileSetRecord was not added because " +
|
||||
"it was improperly specified " +
|
||||
"[rec=" + target + "].");
|
||||
return false;
|
||||
}
|
||||
}) {
|
||||
|
||||
}
|
||||
};
|
||||
vrule = new ValidatedSetNextRule("addTileset", val) {
|
||||
// parse the fringe tilesetrecord, converting tileset names to ids
|
||||
public void begin (Attributes attrs)
|
||||
throws Exception
|
||||
throws Exception
|
||||
{
|
||||
FringeTileSetRecord f = (FringeTileSetRecord) digester.peek();
|
||||
|
||||
@@ -143,7 +142,8 @@ public class FringeConfigurationParser extends CompiledConfigParser
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
digest.addRule(prefix, vrule);
|
||||
}
|
||||
|
||||
protected TileSetIDBroker _idBroker;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: SimpleMisoSceneRuleSet.java,v 1.1 2003/02/12 07:21:50 mdb Exp $
|
||||
// $Id: SimpleMisoSceneRuleSet.java,v 1.2 2004/07/13 16:34:49 mdb Exp $
|
||||
|
||||
package com.threerings.miso.tools.xml;
|
||||
|
||||
@@ -34,21 +34,22 @@ public class SimpleMisoSceneRuleSet implements NestableRuleSet
|
||||
{
|
||||
// this creates the appropriate instance when we encounter our
|
||||
// prefix tag
|
||||
dig.addRule(prefix, new Rule(dig) {
|
||||
public void begin (Attributes attributes) throws Exception {
|
||||
dig.addRule(prefix, new Rule() {
|
||||
public void begin (String namespace, String name,
|
||||
Attributes attributes) throws Exception {
|
||||
digester.push(createMisoSceneModel());
|
||||
}
|
||||
public void end () throws Exception {
|
||||
public void end (String namespace, String name) throws Exception {
|
||||
digester.pop();
|
||||
}
|
||||
});
|
||||
|
||||
// set up rules to parse and set our fields
|
||||
dig.addRule(prefix + "/width", new SetFieldRule(dig, "width"));
|
||||
dig.addRule(prefix + "/height", new SetFieldRule(dig, "height"));
|
||||
dig.addRule(prefix + "/viewwidth", new SetFieldRule(dig, "vwidth"));
|
||||
dig.addRule(prefix + "/viewheight", new SetFieldRule(dig, "vheight"));
|
||||
dig.addRule(prefix + "/base", new SetFieldRule(dig, "baseTileIds"));
|
||||
dig.addRule(prefix + "/width", new SetFieldRule("width"));
|
||||
dig.addRule(prefix + "/height", new SetFieldRule("height"));
|
||||
dig.addRule(prefix + "/viewwidth", new SetFieldRule("vwidth"));
|
||||
dig.addRule(prefix + "/viewheight", new SetFieldRule("vheight"));
|
||||
dig.addRule(prefix + "/base", new SetFieldRule("baseTileIds"));
|
||||
|
||||
dig.addObjectCreate(prefix + "/objects", ArrayList.class.getName());
|
||||
dig.addObjectCreate(prefix + "/objects/object",
|
||||
@@ -56,10 +57,9 @@ public class SimpleMisoSceneRuleSet implements NestableRuleSet
|
||||
dig.addSetNext(prefix + "/objects/object", "add",
|
||||
Object.class.getName());
|
||||
|
||||
dig.addRule(prefix + "/objects/object",
|
||||
new SetPropertyFieldsRule(dig));
|
||||
dig.addRule(prefix + "/objects/object", new SetPropertyFieldsRule());
|
||||
|
||||
dig.addRule(prefix + "/objects", new CallMethodSpecialRule(dig) {
|
||||
dig.addRule(prefix + "/objects", new CallMethodSpecialRule() {
|
||||
public void parseAndSet (String bodyText, Object target)
|
||||
throws Exception
|
||||
{
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: SparseMisoSceneRuleSet.java,v 1.3 2004/02/25 14:43:57 mdb Exp $
|
||||
// $Id: SparseMisoSceneRuleSet.java,v 1.4 2004/07/13 16:34:49 mdb Exp $
|
||||
|
||||
package com.threerings.miso.tools.xml;
|
||||
|
||||
@@ -33,29 +33,28 @@ public class SparseMisoSceneRuleSet implements NestableRuleSet
|
||||
{
|
||||
// this creates the appropriate instance when we encounter our
|
||||
// prefix tag
|
||||
dig.addRule(prefix, new Rule(dig) {
|
||||
public void begin (Attributes attributes) throws Exception {
|
||||
dig.addRule(prefix, new Rule() {
|
||||
public void begin (String namespace, String name,
|
||||
Attributes attributes) throws Exception {
|
||||
digester.push(createMisoSceneModel());
|
||||
}
|
||||
public void end () throws Exception {
|
||||
public void end (String namespace, String name) throws Exception {
|
||||
digester.pop();
|
||||
}
|
||||
});
|
||||
|
||||
// set up rules to parse and set our fields
|
||||
dig.addRule(prefix + "/swidth", new SetFieldRule(dig, "swidth"));
|
||||
dig.addRule(prefix + "/sheight", new SetFieldRule(dig, "sheight"));
|
||||
dig.addRule(prefix + "/defTileSet",
|
||||
new SetFieldRule(dig, "defTileSet"));
|
||||
dig.addRule(prefix + "/swidth", new SetFieldRule("swidth"));
|
||||
dig.addRule(prefix + "/sheight", new SetFieldRule("sheight"));
|
||||
dig.addRule(prefix + "/defTileSet", new SetFieldRule("defTileSet"));
|
||||
|
||||
String sprefix = prefix + "/sections/section";
|
||||
dig.addObjectCreate(sprefix, Section.class.getName());
|
||||
dig.addRule(sprefix, new SetPropertyFieldsRule(dig));
|
||||
dig.addRule(sprefix + "/base", new SetFieldRule(dig, "baseTileIds"));
|
||||
dig.addRule(sprefix, new SetPropertyFieldsRule());
|
||||
dig.addRule(sprefix + "/base", new SetFieldRule("baseTileIds"));
|
||||
dig.addObjectCreate(sprefix + "/objects/object",
|
||||
ObjectInfo.class.getName());
|
||||
dig.addRule(sprefix + "/objects/object",
|
||||
new SetPropertyFieldsRule(dig));
|
||||
dig.addRule(sprefix + "/objects/object", new SetPropertyFieldsRule());
|
||||
dig.addSetNext(sprefix + "/objects/object", "addObject",
|
||||
ObjectInfo.class.getName());
|
||||
dig.addSetNext(sprefix, "setSection", Section.class.getName());
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
//
|
||||
// $Id: DropBoard.java,v 1.4 2004/02/25 14:48:44 mdb Exp $
|
||||
// $Id: DropBoard.java,v 1.5 2004/07/13 16:34:49 mdb Exp $
|
||||
|
||||
package com.threerings.puzzle.drop.data;
|
||||
|
||||
import java.awt.Point;
|
||||
import java.awt.Rectangle;
|
||||
|
||||
import org.apache.commons.lang.Strings;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
|
||||
import com.threerings.util.DirectionUtil;
|
||||
|
||||
@@ -513,7 +513,7 @@ public abstract class DropBoard extends Board
|
||||
str += "|" + formatPiece(opiece);
|
||||
}
|
||||
}
|
||||
buf.append(Strings.rightPad(str, padwid));
|
||||
buf.append(StringUtils.rightPad(str, padwid));
|
||||
}
|
||||
Log.warning(buf.toString());
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: SpotSceneRuleSet.java,v 1.4 2003/02/12 07:23:31 mdb Exp $
|
||||
// $Id: SpotSceneRuleSet.java,v 1.5 2004/07/13 16:34:49 mdb Exp $
|
||||
|
||||
package com.threerings.whirled.spot.tools.xml;
|
||||
|
||||
@@ -28,13 +28,12 @@ public class SpotSceneRuleSet implements NestableRuleSet
|
||||
digester.addObjectCreate(prefix, SpotSceneModel.class.getName());
|
||||
|
||||
// set up rules to parse and set our fields
|
||||
digester.addRule(prefix, new SetPropertyFieldsRule(digester));
|
||||
digester.addRule(prefix, new SetPropertyFieldsRule());
|
||||
|
||||
// create EditablePortal instances when we see <portal>
|
||||
digester.addObjectCreate(prefix + "/portal",
|
||||
EditablePortal.class.getName());
|
||||
digester.addRule(prefix + "/portal",
|
||||
new SetPropertyFieldsRule(digester));
|
||||
digester.addRule(prefix + "/portal", new SetPropertyFieldsRule());
|
||||
digester.addSetNext(prefix + "/portal", "addPortal",
|
||||
Portal.class.getName());
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: SceneRuleSet.java,v 1.4 2004/02/25 14:50:28 mdb Exp $
|
||||
// $Id: SceneRuleSet.java,v 1.5 2004/07/13 16:34:49 mdb Exp $
|
||||
|
||||
package com.threerings.whirled.tools.xml;
|
||||
|
||||
@@ -28,7 +28,7 @@ public class SceneRuleSet implements NestableRuleSet
|
||||
digester.addObjectCreate(prefix, getSceneClass().getName());
|
||||
|
||||
// set up rules to parse and set our fields
|
||||
digester.addRule(prefix, new SetPropertyFieldsRule(digester));
|
||||
digester.addRule(prefix, new SetPropertyFieldsRule());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user