Prune trailing whitespace & foreachize loops.
git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@824 ed5b42cb-e716-0410-a449-f6a68f950b19
This commit is contained in:
@@ -125,7 +125,7 @@ public class CompositedMaskedImage extends CompositedMultiFrameImage
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return the x offset into the source image for the image at index
|
||||
*/
|
||||
|
||||
@@ -66,7 +66,7 @@ public class CompositedShadowImage extends CompositedMultiFrameImage
|
||||
public int getYOrigin (int index) {
|
||||
return _sources[0].frames.getYOrigin(_orient, index);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected CompositedMirage createCompositedMirage (int index) {
|
||||
// Always use a CompositedVolatileMirage for ShadowImage since we need to draw into it.
|
||||
@@ -91,7 +91,7 @@ public class CompositedShadowImage extends CompositedMultiFrameImage
|
||||
bounds.setBounds(getX(index), getY(index), _images[index].getWidth(),
|
||||
_images[index].getHeight());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return the x offset into the source image for the image at index
|
||||
*/
|
||||
|
||||
@@ -41,7 +41,7 @@ public interface FrameProvider
|
||||
* Returns the file path of the animation frames (in the eight sprite directions) for the
|
||||
* specified action of the specified component. May return a path to the default action or
|
||||
* null if the specified action does not exist for the specified component.
|
||||
*
|
||||
*
|
||||
* @param existentPaths the set of all paths for which there are valid frames.
|
||||
*/
|
||||
public String getFramePath (
|
||||
|
||||
@@ -68,7 +68,7 @@ public class BundleUtil
|
||||
*
|
||||
* @exception IOException thrown if an I/O error occurs while reading the object from the
|
||||
* bundle.
|
||||
*/
|
||||
*/
|
||||
public static Object loadObject (ResourceBundle bundle, String path, boolean wipeOnFailure)
|
||||
throws IOException, ClassNotFoundException
|
||||
{
|
||||
|
||||
@@ -47,8 +47,8 @@ public class DumpBundle
|
||||
System.exit(-1);
|
||||
}
|
||||
|
||||
for (int i = 0; i < args.length; i++) {
|
||||
File file = new File(args[i]);
|
||||
for (String arg : args) {
|
||||
File file = new File(arg);
|
||||
try {
|
||||
ResourceBundle bundle = new FileResourceBundle(file);
|
||||
|
||||
@@ -69,7 +69,7 @@ public class DumpBundle
|
||||
dumpTable("components: ", comps);
|
||||
|
||||
} catch (Exception e) {
|
||||
System.err.println("Error dumping bundle [path=" + args[i] +
|
||||
System.err.println("Error dumping bundle [path=" + arg +
|
||||
", error=" + e + "].");
|
||||
e.printStackTrace();
|
||||
}
|
||||
@@ -81,5 +81,5 @@ public class DumpBundle
|
||||
if (table != null) {
|
||||
System.out.println(prefix + StringUtil.toString(table.entrySet().iterator()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,8 +95,8 @@ public class ClassRuleSet extends RuleSetBase
|
||||
public Object parse (String text) {
|
||||
String[] orients = StringUtil.parseStringArray(text);
|
||||
ArrayIntSet oset = new ArrayIntSet();
|
||||
for (int ii = 0; ii < orients.length; ii++) {
|
||||
oset.add(DirectionUtil.fromShortString(orients[ii]));
|
||||
for (String orient : orients) {
|
||||
oset.add(DirectionUtil.fromShortString(orient));
|
||||
}
|
||||
return oset;
|
||||
}
|
||||
|
||||
@@ -168,7 +168,7 @@ public class IconManager
|
||||
|
||||
/** A cache of our icon tilesets. */
|
||||
protected Map<String, TileSet> _icons = new LRUHashMap<String, TileSet>(ICON_CACHE_SIZE);
|
||||
|
||||
|
||||
/** The suffix we append to an icon set name to obtain the tileset
|
||||
* image path configuration parameter. */
|
||||
protected static final String PATH_SUFFIX = ".path";
|
||||
|
||||
@@ -143,7 +143,7 @@ public class TimerView
|
||||
|
||||
// Stop any current processing
|
||||
stop();
|
||||
|
||||
|
||||
// Record the timer's full duration and effective start time
|
||||
_duration = duration;
|
||||
|
||||
@@ -185,7 +185,7 @@ public class TimerView
|
||||
|
||||
// Prevent it from being unpaused
|
||||
_lastUpdate = Long.MIN_VALUE;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Pause the timer from processing.
|
||||
|
||||
@@ -118,7 +118,7 @@ public abstract class Animation extends AbstractMedia
|
||||
{
|
||||
removeObserver(obs);
|
||||
}
|
||||
|
||||
|
||||
/** Whether the animation is finished. */
|
||||
protected boolean _finished = false;
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ public class GleamAnimation extends Animation
|
||||
/**
|
||||
* Creates a gleam animation with the supplied sprite. The sprite will be faded to the
|
||||
* specified color and then back again.
|
||||
*
|
||||
*
|
||||
* @param fadeIn if true, the sprite itself will be faded in as we fade up to the gleam color
|
||||
* and the gleam color will fade out, leaving just the sprite imagery.
|
||||
*/
|
||||
@@ -59,7 +59,7 @@ public class GleamAnimation extends Animation
|
||||
* Creates a gleam animation with the supplied sprite. The sprite will be faded to the
|
||||
* specified color and then back again. The sprite may be already added to the supplied sprite
|
||||
* manager or not, but when the animation is complete, it will have been added.
|
||||
*
|
||||
*
|
||||
* @param fadeIn if true, the sprite itself will be faded in as we fade up to the gleam color
|
||||
* and the gleam color will fade out, leaving just the sprite imagery.
|
||||
*/
|
||||
@@ -74,7 +74,7 @@ public class GleamAnimation extends Animation
|
||||
_downmillis = downmillis;
|
||||
_fadeIn = fadeIn;
|
||||
}
|
||||
|
||||
|
||||
@Override // documentation inherited
|
||||
public void tick (long timestamp)
|
||||
{
|
||||
|
||||
@@ -154,7 +154,7 @@ public class ScaleAnimation extends Animation
|
||||
}
|
||||
|
||||
// Smooth out the image scaling
|
||||
//
|
||||
//
|
||||
// FIXME: Should this be turned off when the painting is done?
|
||||
gfx.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
|
||||
RenderingHints.VALUE_INTERPOLATION_BILINEAR);
|
||||
|
||||
@@ -59,7 +59,7 @@ public class SpriteAnimation extends Animation
|
||||
_sprite.move(_path);
|
||||
_path = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paint (Graphics2D gfx)
|
||||
|
||||
@@ -40,7 +40,7 @@ public class FadeEffect
|
||||
}
|
||||
|
||||
// save things off
|
||||
_startAlpha = alpha;
|
||||
_startAlpha = alpha;
|
||||
_step = step;
|
||||
_target = target;
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ public class BufferedMirage implements Mirage
|
||||
{
|
||||
this(image, 1);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param percentageOfDataBuffer - the percentage of image's data buffer used by image for use
|
||||
* in getEstimatedMemory. ie if this image is a subimage of another image, and they share a
|
||||
@@ -81,7 +81,7 @@ public class BufferedMirage implements Mirage
|
||||
{
|
||||
return _image;
|
||||
}
|
||||
|
||||
|
||||
protected float _percentageOfDataBuffer;
|
||||
|
||||
protected BufferedImage _image;
|
||||
|
||||
@@ -44,7 +44,7 @@ public class CompositeMirage implements Mirage
|
||||
for (Mirage m : _mirages) {
|
||||
mem += m.getEstimatedMemoryUsage();
|
||||
}
|
||||
|
||||
|
||||
return mem;
|
||||
}
|
||||
|
||||
|
||||
@@ -256,7 +256,7 @@ public class ImageUtil
|
||||
// */
|
||||
// public static Area createImageMask (BufferedImage src)
|
||||
// {
|
||||
// Raster srcdata = src.getData();
|
||||
// Raster srcdata = src.getData();
|
||||
// int wid = src.getWidth(), hei = src.getHeight();
|
||||
// Log.info("creating area of (" + wid + ", " + hei + ")");
|
||||
// Area a = new Area(new Rectangle(wid, hei));
|
||||
|
||||
@@ -43,7 +43,7 @@ public class MirageIcon implements Icon
|
||||
{
|
||||
_mirage.paint((Graphics2D)g, x, y);
|
||||
}
|
||||
|
||||
|
||||
// documentation inherited from interface
|
||||
public int getIconWidth()
|
||||
{
|
||||
|
||||
@@ -58,7 +58,7 @@ package com.threerings.media.image;
|
||||
* nodes in the reduced tree.<p>
|
||||
*
|
||||
* Here is the copyright notice from ImageMagick:
|
||||
*
|
||||
*
|
||||
* <pre>
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
% Permission is hereby granted, free of charge, to any person obtaining a %
|
||||
@@ -283,9 +283,9 @@ public class Quantize {
|
||||
% written permission from ISI.
|
||||
%
|
||||
*/
|
||||
|
||||
|
||||
final static boolean QUICK = false;
|
||||
|
||||
|
||||
final static int MAX_RGB = 255;
|
||||
final static int MAX_NODES = 266817;
|
||||
final static int MAX_TREE_DEPTH = 8;
|
||||
@@ -308,7 +308,7 @@ public class Quantize {
|
||||
|
||||
/**
|
||||
* Reduce the image to the given number of colors.
|
||||
*
|
||||
*
|
||||
* @param pixels an in/out parameter that should initially contain
|
||||
* [A]RGB values but that will contain color palette indicies upon return.
|
||||
*
|
||||
@@ -321,7 +321,7 @@ public class Quantize {
|
||||
cube.assignment();
|
||||
return cube.colormap;
|
||||
}
|
||||
|
||||
|
||||
static class Cube {
|
||||
int pixels[][];
|
||||
int max_colors;
|
||||
@@ -329,7 +329,7 @@ public class Quantize {
|
||||
|
||||
// do we have transparent pixels?
|
||||
boolean hasTrans = false;
|
||||
|
||||
|
||||
Node root;
|
||||
int depth;
|
||||
|
||||
@@ -358,7 +358,7 @@ public class Quantize {
|
||||
} else if (depth < 2) {
|
||||
depth = 2;
|
||||
}
|
||||
|
||||
|
||||
root = new Node(this);
|
||||
}
|
||||
|
||||
@@ -506,7 +506,7 @@ public class Quantize {
|
||||
colormap = new int[colors];
|
||||
colors = 0;
|
||||
root.colormap();
|
||||
|
||||
|
||||
int pixels[][] = this.pixels;
|
||||
|
||||
int width = pixels.length;
|
||||
@@ -515,7 +515,7 @@ public class Quantize {
|
||||
Search search = new Search();
|
||||
|
||||
int transPad = hasTrans ? 1 : 0;
|
||||
|
||||
|
||||
// convert to indexed color
|
||||
for (int x = width; x-- > 0; ) {
|
||||
for (int y = height; y-- > 0; ) {
|
||||
@@ -587,7 +587,7 @@ public class Quantize {
|
||||
|
||||
// the pixel count for this node and all children
|
||||
long number_pixels;
|
||||
|
||||
|
||||
// the pixel count for this node
|
||||
int unique;
|
||||
// the sum of all pixels contained in this node
|
||||
@@ -606,12 +606,12 @@ public class Quantize {
|
||||
this.level = 0;
|
||||
|
||||
this.number_pixels = Long.MAX_VALUE;
|
||||
|
||||
|
||||
this.mid_red = (MAX_RGB + 1) >> 1;
|
||||
this.mid_green = (MAX_RGB + 1) >> 1;
|
||||
this.mid_blue = (MAX_RGB + 1) >> 1;
|
||||
}
|
||||
|
||||
|
||||
Node(Node parent, int id, int level) {
|
||||
this.cube = parent.cube;
|
||||
this.parent = parent;
|
||||
|
||||
@@ -40,10 +40,10 @@ public class ButtonSprite extends Sprite
|
||||
{
|
||||
/** The normal, square button style. */
|
||||
public static final int NORMAL = 0;
|
||||
|
||||
|
||||
/** The rounded button style. */
|
||||
public static final int ROUNDED = 1;
|
||||
|
||||
|
||||
/**
|
||||
* Constructs a button sprite.
|
||||
*
|
||||
@@ -78,7 +78,7 @@ public class ButtonSprite extends Sprite
|
||||
* @param commandArgument the button's command argument
|
||||
*/
|
||||
public ButtonSprite (Label label, int style, int arcWidth, int arcHeight,
|
||||
Color backgroundColor, Color alternateColor, String actionCommand,
|
||||
Color backgroundColor, Color alternateColor, String actionCommand,
|
||||
Object commandArgument)
|
||||
{
|
||||
_label = label;
|
||||
@@ -90,7 +90,7 @@ public class ButtonSprite extends Sprite
|
||||
_actionCommand = actionCommand;
|
||||
_commandArgument = commandArgument;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns a reference to the label displayed by this sprite.
|
||||
*/
|
||||
@@ -106,17 +106,17 @@ public class ButtonSprite extends Sprite
|
||||
{
|
||||
// invalidate the old...
|
||||
invalidate();
|
||||
|
||||
|
||||
// size the bounds to fit our label
|
||||
Dimension size = _label.getSize();
|
||||
_bounds.width = size.width + PADDING*2 +
|
||||
_bounds.width = size.width + PADDING*2 +
|
||||
(_style == ROUNDED ? _arcWidth : 0);
|
||||
_bounds.height = size.height + PADDING*2;
|
||||
|
||||
|
||||
// ...and the new
|
||||
invalidate();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the style of this button.
|
||||
*/
|
||||
@@ -125,7 +125,7 @@ public class ButtonSprite extends Sprite
|
||||
_style = style;
|
||||
updateBounds();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the style of this button.
|
||||
*/
|
||||
@@ -133,16 +133,16 @@ public class ButtonSprite extends Sprite
|
||||
{
|
||||
return _style;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the arc width for rounded buttons.
|
||||
*/
|
||||
public void setArcWidth (int arcWidth)
|
||||
public void setArcWidth (int arcWidth)
|
||||
{
|
||||
_arcWidth = arcWidth;
|
||||
updateBounds();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the arc width for rounded buttons.
|
||||
*/
|
||||
@@ -150,16 +150,16 @@ public class ButtonSprite extends Sprite
|
||||
{
|
||||
return _arcWidth;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the arc height for rounded buttons.
|
||||
*/
|
||||
public void setArcHeight (int arcHeight)
|
||||
public void setArcHeight (int arcHeight)
|
||||
{
|
||||
_arcHeight = arcHeight;
|
||||
updateBounds();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the arc height for rounded buttons.
|
||||
*/
|
||||
@@ -167,7 +167,7 @@ public class ButtonSprite extends Sprite
|
||||
{
|
||||
return _arcHeight;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the background color of this button.
|
||||
*/
|
||||
@@ -175,7 +175,7 @@ public class ButtonSprite extends Sprite
|
||||
{
|
||||
_backgroundColor = backgroundColor;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the background color of this button.
|
||||
*/
|
||||
@@ -183,7 +183,7 @@ public class ButtonSprite extends Sprite
|
||||
{
|
||||
return _backgroundColor;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the action command generated by this button.
|
||||
*/
|
||||
@@ -191,13 +191,13 @@ public class ButtonSprite extends Sprite
|
||||
{
|
||||
_actionCommand = actionCommand;
|
||||
}
|
||||
|
||||
|
||||
// documentation inherited from interface CommandSprite
|
||||
public String getActionCommand ()
|
||||
{
|
||||
return _actionCommand;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the command argument generated by this button.
|
||||
*/
|
||||
@@ -205,13 +205,13 @@ public class ButtonSprite extends Sprite
|
||||
{
|
||||
_commandArgument = commandArgument;
|
||||
}
|
||||
|
||||
|
||||
// documentation inherited from interface CommandSprite
|
||||
public Object getCommandArgument ()
|
||||
{
|
||||
return _commandArgument;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets whether or not this button is enabled.
|
||||
*/
|
||||
@@ -222,13 +222,13 @@ public class ButtonSprite extends Sprite
|
||||
invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// documentation inherited from interface DisableableSprite
|
||||
public boolean isEnabled ()
|
||||
{
|
||||
return _enabled;
|
||||
}
|
||||
|
||||
|
||||
// documentation inherited from interface ArmingSprite
|
||||
public void setArmed (boolean pressed)
|
||||
{
|
||||
@@ -237,15 +237,15 @@ public class ButtonSprite extends Sprite
|
||||
invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
/**
|
||||
* Checks whether or not this button appears pressed.
|
||||
*/
|
||||
public boolean isArmed ()
|
||||
{
|
||||
return _pressed;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void init ()
|
||||
{
|
||||
@@ -271,17 +271,17 @@ public class ButtonSprite extends Sprite
|
||||
{
|
||||
Color baseTextColor = _label.getTextColor(),
|
||||
baseAlternateColor = _label.getAlternateColor();
|
||||
|
||||
|
||||
if (!_enabled) {
|
||||
_label.setTextColor(baseTextColor.darker());
|
||||
_label.setAlternateColor(baseAlternateColor.darker());
|
||||
}
|
||||
|
||||
|
||||
switch (_style) {
|
||||
case NORMAL:
|
||||
gfx.setColor(_enabled ? _backgroundColor :
|
||||
_backgroundColor.darker());
|
||||
gfx.fill3DRect(_bounds.x, _bounds.y, _bounds.width,
|
||||
gfx.fill3DRect(_bounds.x, _bounds.y, _bounds.width,
|
||||
_bounds.height, !_pressed);
|
||||
_label.render(gfx, _bounds.x + (_pressed ? PADDING :
|
||||
PADDING - 1), _bounds.y + (_pressed ? PADDING :
|
||||
@@ -296,7 +296,7 @@ public class ButtonSprite extends Sprite
|
||||
// draw foreground
|
||||
gfx.setColor(_enabled ? _backgroundColor :
|
||||
_backgroundColor.darker());
|
||||
int innerBoundsX = _bounds.x+1, innerBoundsY = _bounds.y+1,
|
||||
int innerBoundsX = _bounds.x+1, innerBoundsY = _bounds.y+1,
|
||||
innerBoundsWidth = _bounds.width-2,
|
||||
innerBoundsHeight = _bounds.height-2,
|
||||
innerBoundsArcWidth = _arcWidth-2,
|
||||
@@ -327,28 +327,28 @@ public class ButtonSprite extends Sprite
|
||||
innerBoundsArcWidth, innerBoundsArcHeight, 0, 90);
|
||||
gfx.drawLine(innerBoundsX + innerBoundsWidth - 1,
|
||||
innerBoundsY + innerBoundsArcHeight/2,
|
||||
innerBoundsX + innerBoundsWidth - 1, innerBoundsY +
|
||||
innerBoundsX + innerBoundsWidth - 1, innerBoundsY +
|
||||
innerBoundsHeight - innerBoundsArcHeight/2);
|
||||
// draw the lower left (light when pressed)
|
||||
gfx.setColor(_pressed ? brighter : darker);
|
||||
gfx.drawLine(innerBoundsX, innerBoundsY +
|
||||
innerBoundsArcHeight/2, innerBoundsX,
|
||||
innerBoundsY + innerBoundsHeight -
|
||||
innerBoundsY + innerBoundsHeight -
|
||||
innerBoundsArcHeight/2);
|
||||
gfx.drawArc(innerBoundsX, innerBoundsY + innerBoundsHeight -
|
||||
innerBoundsArcHeight - 1,
|
||||
innerBoundsArcWidth, innerBoundsArcHeight, 180, 90);
|
||||
gfx.drawLine(innerBoundsX + innerBoundsArcWidth/2,
|
||||
innerBoundsY + innerBoundsHeight - 1,
|
||||
innerBoundsX + innerBoundsWidth - innerBoundsArcWidth/2,
|
||||
innerBoundsY + innerBoundsHeight - 1,
|
||||
innerBoundsX + innerBoundsWidth - innerBoundsArcWidth/2,
|
||||
innerBoundsY + innerBoundsHeight - 1);
|
||||
SwingUtil.restoreAntiAliasing(gfx, aaState);
|
||||
_label.render(gfx, _bounds.x + PADDING + _arcWidth/2 -
|
||||
(_pressed ? 2 : 1),
|
||||
_label.render(gfx, _bounds.x + PADDING + _arcWidth/2 -
|
||||
(_pressed ? 2 : 1),
|
||||
_bounds.y + PADDING + (_pressed ? 1 : 0));
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (!_enabled) {
|
||||
_label.setTextColor(baseTextColor);
|
||||
_label.setAlternateColor(baseAlternateColor);
|
||||
@@ -357,34 +357,34 @@ public class ButtonSprite extends Sprite
|
||||
|
||||
/** The number of pixels to add between the text and the border. */
|
||||
protected static final int PADDING = 2;
|
||||
|
||||
|
||||
/** The label associated with this sprite. */
|
||||
protected Label _label;
|
||||
|
||||
|
||||
/** The button style. */
|
||||
protected int _style;
|
||||
|
||||
|
||||
/** The width of the corner arcs for rounded rectangle buttons. */
|
||||
protected int _arcWidth;
|
||||
|
||||
|
||||
/** The height of the corner arcs for rounded rectangle buttons. */
|
||||
protected int _arcHeight;
|
||||
|
||||
|
||||
/** The action command generated by this button. */
|
||||
protected String _actionCommand;
|
||||
|
||||
|
||||
/** The command argument generated by this button. */
|
||||
protected Object _commandArgument;
|
||||
|
||||
|
||||
/** The background color of this sprite. */
|
||||
protected Color _backgroundColor;
|
||||
|
||||
|
||||
/** The alternate (outline) color of this sprite. */
|
||||
protected Color _alternateColor;
|
||||
|
||||
|
||||
/** Whether or not the button is currently enabled. */
|
||||
protected boolean _enabled = true;
|
||||
|
||||
|
||||
/** Whether or not the button is currently pressed. */
|
||||
protected boolean _pressed;
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ public class LabelSprite extends Sprite
|
||||
_bounds.width = size.width;
|
||||
_bounds.height = size.height;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void init ()
|
||||
{
|
||||
@@ -81,7 +81,7 @@ public class LabelSprite extends Sprite
|
||||
}
|
||||
|
||||
// size the bounds to fit our label
|
||||
updateBounds();
|
||||
updateBounds();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -40,7 +40,7 @@ public class OrientableImageSprite extends ImageSprite
|
||||
*/
|
||||
public OrientableImageSprite ()
|
||||
{}
|
||||
|
||||
|
||||
/**
|
||||
* Creates a new orientable image sprite.
|
||||
*
|
||||
@@ -50,7 +50,7 @@ public class OrientableImageSprite extends ImageSprite
|
||||
{
|
||||
super(image);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Creates a new orientable image sprite.
|
||||
*
|
||||
@@ -60,91 +60,91 @@ public class OrientableImageSprite extends ImageSprite
|
||||
{
|
||||
super(frames);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Computes and returns the rotation transform for this
|
||||
* sprite.
|
||||
*
|
||||
* @return the newly computed rotation transform
|
||||
*/
|
||||
*/
|
||||
private AffineTransform getRotationTransform ()
|
||||
{
|
||||
double theta;
|
||||
|
||||
|
||||
switch (_orient) {
|
||||
case NORTH:
|
||||
default:
|
||||
theta = 0.0;
|
||||
break;
|
||||
|
||||
|
||||
case SOUTH:
|
||||
theta = Math.PI;
|
||||
break;
|
||||
|
||||
|
||||
case EAST:
|
||||
theta = Math.PI*0.5;
|
||||
break;
|
||||
|
||||
|
||||
case WEST:
|
||||
theta = -Math.PI*0.5;
|
||||
break;
|
||||
|
||||
|
||||
case NORTHEAST:
|
||||
theta = Math.PI*0.25;
|
||||
break;
|
||||
|
||||
|
||||
case NORTHWEST:
|
||||
theta = -Math.PI*0.25;
|
||||
break;
|
||||
|
||||
|
||||
case SOUTHEAST:
|
||||
theta = Math.PI*0.75;
|
||||
break;
|
||||
|
||||
|
||||
case SOUTHWEST:
|
||||
theta = -Math.PI*0.75;
|
||||
break;
|
||||
|
||||
|
||||
case NORTHNORTHEAST:
|
||||
theta = -Math.PI*0.125;
|
||||
break;
|
||||
|
||||
|
||||
case NORTHNORTHWEST:
|
||||
theta = Math.PI*0.125;
|
||||
break;
|
||||
|
||||
|
||||
case SOUTHSOUTHEAST:
|
||||
theta = -Math.PI*0.875;
|
||||
break;
|
||||
|
||||
|
||||
case SOUTHSOUTHWEST:
|
||||
theta = Math.PI*0.875;
|
||||
break;
|
||||
|
||||
|
||||
case EASTNORTHEAST:
|
||||
theta = -Math.PI*0.375;
|
||||
break;
|
||||
|
||||
|
||||
case EASTSOUTHEAST:
|
||||
theta = -Math.PI*0.625;
|
||||
break;
|
||||
|
||||
|
||||
case WESTNORTHWEST:
|
||||
theta = Math.PI*0.375;
|
||||
break;
|
||||
|
||||
|
||||
case WESTSOUTHWEST:
|
||||
theta = Math.PI*0.625;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
return AffineTransform.getRotateInstance(
|
||||
theta,
|
||||
(_ox - _oxoff) + _frames.getWidth(_frameIdx)/2,
|
||||
(_oy - _oyoff) + _frames.getHeight(_frameIdx)/2
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void accomodateFrame (int frameIdx, int width, int height)
|
||||
{
|
||||
@@ -156,39 +156,39 @@ public class OrientableImageSprite extends ImageSprite
|
||||
height
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
area.transform(getRotationTransform());
|
||||
|
||||
|
||||
_bounds = area.getBounds();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setOrientation (int orient)
|
||||
{
|
||||
super.setOrientation(orient);
|
||||
|
||||
|
||||
layout();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void paint (Graphics2D graphics)
|
||||
{
|
||||
AffineTransform at = graphics.getTransform();
|
||||
|
||||
|
||||
graphics.transform(getRotationTransform());
|
||||
|
||||
|
||||
if (_frames != null) {
|
||||
_frames.paintFrame(
|
||||
graphics,
|
||||
_frameIdx,
|
||||
_ox - _oxoff,
|
||||
graphics,
|
||||
_frameIdx,
|
||||
_ox - _oxoff,
|
||||
_oy - _oyoff
|
||||
);
|
||||
}
|
||||
else {
|
||||
super.paint(graphics);
|
||||
}
|
||||
|
||||
|
||||
graphics.setTransform(at);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ public class SpriteIcon implements Icon
|
||||
y + _sprite.getYOffset() + _padding);
|
||||
_sprite.paint((Graphics2D)g);
|
||||
}
|
||||
|
||||
|
||||
// documentation inherited from interface
|
||||
public int getIconWidth ()
|
||||
{
|
||||
|
||||
@@ -98,7 +98,7 @@ public class SpriteManager extends AbstractMediaManager
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add a sprite to the set of sprites managed by this manager.
|
||||
*
|
||||
|
||||
@@ -101,8 +101,8 @@ public class SwissArmyTileSet extends TileSet
|
||||
{
|
||||
// compute our number of tiles
|
||||
_numTiles = 0;
|
||||
for (int i = 0; i < _tileCounts.length; i++) {
|
||||
_numTiles += _tileCounts[i];
|
||||
for (int count : _tileCounts) {
|
||||
_numTiles += count;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ public class TileIcon implements Icon
|
||||
{
|
||||
_tile.paint((Graphics2D)g, x, y);
|
||||
}
|
||||
|
||||
|
||||
// documentation inherited from interface
|
||||
public int getIconWidth ()
|
||||
{
|
||||
|
||||
@@ -40,7 +40,7 @@ import static com.threerings.media.Log.log;
|
||||
* it can provide a tileset repository which loads up tilesets using whatever repository mechanism
|
||||
* is implemented by the supplied repository. In the latter case, tilesets are loaded by a unique
|
||||
* identifier.
|
||||
*
|
||||
*
|
||||
* <p> Loading tilesets by hand is intended for things like toolbar icons or games with a single
|
||||
* set of tiles (think Stratego, for example). Loading tilesets from a repository supports games
|
||||
* with vast numbers of tiles to which more tiles may be added on the fly (think the tiles for an
|
||||
@@ -51,7 +51,7 @@ public class TileManager
|
||||
/**
|
||||
* Creates a tile manager and provides it with a reference to the image manager from which it
|
||||
* will load tileset images.
|
||||
*
|
||||
*
|
||||
* @param imgr the image manager via which the tile manager will decode and cache images.
|
||||
*/
|
||||
public TileManager (ImageManager imgr)
|
||||
@@ -145,9 +145,9 @@ public class TileManager
|
||||
/**
|
||||
* Returns the tileset with the specified id. Tilesets are fetched from the tileset repository
|
||||
* supplied via {@link #setTileSetRepository}, and are subsequently cached.
|
||||
*
|
||||
*
|
||||
* @param tileSetId the unique identifier for the desired tileset.
|
||||
*
|
||||
*
|
||||
* @exception NoSuchTileSetException thrown if no tileset exists with the specified id or if
|
||||
* an underlying error occurs with the tileset repository's persistence mechanism.
|
||||
*/
|
||||
@@ -169,7 +169,7 @@ public class TileManager
|
||||
|
||||
/**
|
||||
* Returns the tileset with the specified name.
|
||||
*
|
||||
*
|
||||
* @throws NoSuchTileSetException if no tileset with the specified name is available via our
|
||||
* configured tile set repository.
|
||||
*/
|
||||
@@ -191,7 +191,7 @@ public class TileManager
|
||||
|
||||
/**
|
||||
* Returns the {@link Tile} object with the specified fully qualified tile id.
|
||||
*
|
||||
*
|
||||
* @see TileUtil#getFQTileId
|
||||
*/
|
||||
public Tile getTile (int fqTileId)
|
||||
@@ -203,7 +203,7 @@ public class TileManager
|
||||
/**
|
||||
* Returns the {@link Tile} object with the specified fully qualified tile id. The supplied
|
||||
* colorizer will be used to recolor the tile.
|
||||
*
|
||||
*
|
||||
* @see TileUtil#getFQTileId
|
||||
*/
|
||||
public Tile getTile (int fqTileId, TileSet.Colorizer rizer)
|
||||
@@ -214,10 +214,10 @@ public class TileManager
|
||||
|
||||
/**
|
||||
* Returns the {@link Tile} object from the specified tileset at the specified index.
|
||||
*
|
||||
*
|
||||
* @param tileSetId the tileset id.
|
||||
* @param tileIndex the index of the tile to be retrieved.
|
||||
*
|
||||
*
|
||||
* @return the tile object.
|
||||
*/
|
||||
public Tile getTile (int tileSetId, int tileIndex, TileSet.Colorizer rizer)
|
||||
|
||||
@@ -88,21 +88,21 @@ public class DirectoryTileSetBundler extends TileSetBundler
|
||||
// write the trimmed tileset image to the destination output stream
|
||||
File outFile = new File(target, imagePath);
|
||||
FileOutputStream fout = null;
|
||||
|
||||
|
||||
if (outFile.lastModified() > newestMod) {
|
||||
// Our file's newer than the newest bundle mod - up to date.
|
||||
// So don't actually do anything
|
||||
|
||||
|
||||
// TODO: Ideally, we'd like to skip re-trimming altogether, since that's
|
||||
// expensive, but for the moment, we're at least doing half as much by
|
||||
// not writing out the trimmed image.
|
||||
|
||||
|
||||
} else {
|
||||
// It's changed, so let's open the file & do all that jazz
|
||||
outFile.getParentFile().mkdirs();
|
||||
fout = new FileOutputStream(outFile);
|
||||
}
|
||||
|
||||
|
||||
TrimmedObjectTileSet tset =
|
||||
TrimmedObjectTileSet.trimObjectTileSet((ObjectTileSet)set, fout, "png");
|
||||
tset.setImagePath(imagePath);
|
||||
|
||||
@@ -49,17 +49,17 @@ public class DumpBundle
|
||||
System.exit(-1);
|
||||
}
|
||||
|
||||
for (int i = 0; i < args.length; i++) {
|
||||
for (String arg : args) {
|
||||
// oh the hackery
|
||||
if (args[i].equals("-tiles")) {
|
||||
if (arg.equals("-tiles")) {
|
||||
dumpTiles = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
File file = new File(args[i]);
|
||||
File file = new File(arg);
|
||||
try {
|
||||
TileSetBundle tsb = null;
|
||||
if (args[i].endsWith(".jar")) {
|
||||
if (arg.endsWith(".jar")) {
|
||||
ResourceBundle bundle = new FileResourceBundle(file);
|
||||
tsb = BundleUtil.extractBundle(bundle);
|
||||
tsb.init(bundle);
|
||||
@@ -81,7 +81,7 @@ public class DumpBundle
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
System.err.println("Error dumping bundle [path=" + args[i] +
|
||||
System.err.println("Error dumping bundle [path=" + arg +
|
||||
", error=" + e + "].");
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
@@ -173,7 +173,7 @@ public class ObjectTileSetRuleSet extends SwissArmyTileSetRuleSet
|
||||
set.setSpotOrients(sorients);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
digester.addRule(
|
||||
_path + "/constraints",
|
||||
new CallMethodSpecialRule() {
|
||||
|
||||
@@ -52,7 +52,7 @@ public abstract class TileSetRuleSet
|
||||
public String getPath(){
|
||||
return _path;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Instructs the tileset rule set to match tilesets with the supplied
|
||||
* prefix. For example, passing a prefix of
|
||||
@@ -129,9 +129,9 @@ public abstract class TileSetRuleSet
|
||||
*/
|
||||
protected abstract Class<? extends TileSet> getTileSetClass ();
|
||||
|
||||
/** The tileset path we append to the prefix to get the full path. */
|
||||
/** The tileset path we append to the prefix to get the full path. */
|
||||
protected String _tilesetPath = TILESET_PATH;
|
||||
|
||||
|
||||
/** The full path at which me match our tilesets. */
|
||||
protected String _path;
|
||||
}
|
||||
|
||||
@@ -47,11 +47,11 @@ public class UniformTileSetRuleSet extends TileSetRuleSet
|
||||
public UniformTileSetRuleSet(){
|
||||
this(TILESET_PATH);
|
||||
}
|
||||
|
||||
|
||||
public UniformTileSetRuleSet(String tilesetPath){
|
||||
_tilesetPath = tilesetPath;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void addRuleInstances (Digester digester)
|
||||
{
|
||||
|
||||
@@ -71,12 +71,12 @@ public class ModeUtil
|
||||
|
||||
// but we only add modes that meet our minimum requirements
|
||||
TreeSet<DisplayMode> mset = new TreeSet<DisplayMode>(mcomp);
|
||||
for (int i = 0; i < modes.length; i++) {
|
||||
if (modes[i].getWidth() == width &&
|
||||
modes[i].getHeight() == height &&
|
||||
modes[i].getBitDepth() >= minimumDepth &&
|
||||
modes[i].getRefreshRate() <= 75) {
|
||||
mset.add(modes[i]);
|
||||
for (DisplayMode mode : modes) {
|
||||
if (mode.getWidth() == width &&
|
||||
mode.getHeight() == height &&
|
||||
mode.getBitDepth() >= minimumDepth &&
|
||||
mode.getRefreshRate() <= 75) {
|
||||
mset.add(mode);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ public class SceneBlockResolver extends LoopingThread
|
||||
{
|
||||
super("SceneBlockResolver");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Queues up a scene block for resolution.
|
||||
*/
|
||||
@@ -51,7 +51,7 @@ public class SceneBlockResolver extends LoopingThread
|
||||
_queue.append(block);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Temporarily suspends the scene block resolution thread.
|
||||
*/
|
||||
|
||||
@@ -259,7 +259,7 @@ public class SceneObject
|
||||
refreshObjectTile(panel.getSceneMetrics(), panel.getTileManager(),
|
||||
panel.getColorizer(info));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reloads and recolorizes our object tile. It is not intended for the actual object tile used
|
||||
* by a scene object to change in its lifetime, only attributes of that object like its
|
||||
|
||||
@@ -23,8 +23,8 @@ package com.threerings.miso.client;
|
||||
|
||||
import java.awt.Rectangle;
|
||||
|
||||
/**
|
||||
* Exposes an operation to be applied to tiles by {@link TileOpApplicator}.
|
||||
/**
|
||||
* Exposes an operation to be applied to tiles by {@link TileOpApplicator}.
|
||||
*/
|
||||
public interface TileOp
|
||||
{
|
||||
|
||||
@@ -130,8 +130,7 @@ public class SimpleMisoSceneModel extends MisoSceneModel
|
||||
public void getObjects (Rectangle region, ObjectSet set)
|
||||
{
|
||||
// first look for intersecting interesting objects
|
||||
for (int ii = 0; ii < objectInfo.length; ii++) {
|
||||
ObjectInfo info = objectInfo[ii];
|
||||
for (ObjectInfo info : objectInfo) {
|
||||
if (region.contains(info.x, info.y)) {
|
||||
set.insert(info);
|
||||
}
|
||||
|
||||
@@ -81,8 +81,7 @@ public class SimpleMisoSceneWriter implements NestableWriter
|
||||
}
|
||||
|
||||
// write our uninteresting object tile information
|
||||
for (int ii = 0; ii < model.objectInfo.length; ii++) {
|
||||
ObjectInfo info = model.objectInfo[ii];
|
||||
for (ObjectInfo info : model.objectInfo) {
|
||||
AttributesImpl attrs = new AttributesImpl();
|
||||
attrs.addAttribute("", "tileId", "", "",
|
||||
String.valueOf(info.tileId));
|
||||
|
||||
@@ -96,8 +96,8 @@ public class SparseMisoSceneWriter implements NestableWriter
|
||||
}
|
||||
|
||||
// write our interesting object tile information
|
||||
for (int ii = 0; ii < sect.objectInfo.length; ii++) {
|
||||
writeInterestingObject(sect.objectInfo[ii], writer);
|
||||
for (ObjectInfo element : sect.objectInfo) {
|
||||
writeInterestingObject(element, writer);
|
||||
}
|
||||
writer.endElement("objects");
|
||||
writer.endElement("section");
|
||||
@@ -106,7 +106,7 @@ public class SparseMisoSceneWriter implements NestableWriter
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes <code>info</code> out to <code>writer</code>.
|
||||
* Writes <code>info</code> out to <code>writer</code>.
|
||||
*/
|
||||
public static void writeInterestingObject (ObjectInfo info, DataWriter writer)
|
||||
throws SAXException
|
||||
|
||||
@@ -154,13 +154,13 @@ public class Handler extends URLStreamHandler
|
||||
String[] bits = StringUtil.split(query, "&");
|
||||
int width = -1, height = -1, tidx = -1;
|
||||
try {
|
||||
for (int ii = 0; ii < bits.length; ii++) {
|
||||
if (bits[ii].startsWith("width=")) {
|
||||
width = Integer.parseInt(bits[ii].substring(6));
|
||||
} else if (bits[ii].startsWith("height=")) {
|
||||
height = Integer.parseInt(bits[ii].substring(7));
|
||||
} else if (bits[ii].startsWith("tile=")) {
|
||||
tidx = Integer.parseInt(bits[ii].substring(5));
|
||||
for (String bit : bits) {
|
||||
if (bit.startsWith("width=")) {
|
||||
width = Integer.parseInt(bit.substring(6));
|
||||
} else if (bit.startsWith("height=")) {
|
||||
height = Integer.parseInt(bit.substring(7));
|
||||
} else if (bit.startsWith("tile=")) {
|
||||
tidx = Integer.parseInt(bit.substring(5));
|
||||
}
|
||||
}
|
||||
} catch (NumberFormatException nfe) {
|
||||
|
||||
@@ -122,7 +122,7 @@ public class BrowserUtil
|
||||
}
|
||||
|
||||
// if we're on windows, make a last ditch effort
|
||||
String[] cmd = new String[] {
|
||||
String[] cmd = new String[] {
|
||||
"C:\\Program Files\\Internet Explorer\\" +
|
||||
"IEXPLORE.EXE", "\"" + _url.toString() + "\""};
|
||||
Process process = Runtime.getRuntime().exec(cmd);
|
||||
|
||||
@@ -232,7 +232,7 @@ public abstract class IdleTracker
|
||||
protected static final int ABANDONED = 2;
|
||||
|
||||
// we want to observe all mouse and keyboard events
|
||||
protected static final long EVENT_MASK =
|
||||
protected static final long EVENT_MASK =
|
||||
AWTEvent.MOUSE_EVENT_MASK |
|
||||
AWTEvent.MOUSE_MOTION_EVENT_MASK |
|
||||
AWTEvent.MOUSE_WHEEL_EVENT_MASK |
|
||||
|
||||
@@ -35,7 +35,7 @@ public interface KeyTranslator
|
||||
* or both.
|
||||
*/
|
||||
public boolean hasCommand (int keyCode);
|
||||
|
||||
|
||||
/**
|
||||
* Returns whether there is an action command for the key corresponding to the given character
|
||||
* in the case of a keyTyped event corresponding to it.
|
||||
@@ -47,7 +47,7 @@ public interface KeyTranslator
|
||||
* the given key code, or <code>null</code> if there is no associated command.
|
||||
*/
|
||||
public String getPressCommand (int keyCode);
|
||||
|
||||
|
||||
/**
|
||||
* Returns the action command string associated with a key press of the given character,
|
||||
* or <code>null</code> if there is no associated command.
|
||||
@@ -59,19 +59,19 @@ public interface KeyTranslator
|
||||
* the given key code, or <code>null</code> if there is no associated command.
|
||||
*/
|
||||
public String getReleaseCommand (int keyCode);
|
||||
|
||||
|
||||
/**
|
||||
* Returns the action command string associated with a key release of the given character,
|
||||
* or <code>null</code> if there is no associated command.
|
||||
*/
|
||||
public String getReleaseCommand (char ch);
|
||||
|
||||
|
||||
/**
|
||||
* Returns the number of times each second that key presses are to be automatically repeated
|
||||
* while the key is held down, or <code>0</code> to disable auto-repeat for the key.
|
||||
*/
|
||||
public int getRepeatRate (int keyCode);
|
||||
|
||||
|
||||
/**
|
||||
* Returns the number of times each second that key presses are to be automatically repeated
|
||||
* while the key is held down, or <code>0</code> to disable auto-repeat for the key.
|
||||
@@ -89,7 +89,7 @@ public interface KeyTranslator
|
||||
* specified key.
|
||||
*/
|
||||
public long getRepeatDelay (char ch);
|
||||
|
||||
|
||||
/**
|
||||
* Returns an iterator that iterates over the available press commands.
|
||||
*/
|
||||
|
||||
@@ -49,7 +49,7 @@ public class Keyboard
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the native keyboard interface is available.
|
||||
* Returns whether the native keyboard interface is available.
|
||||
*/
|
||||
public static boolean isAvailable ()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user