Tabs -> spaces

git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@331 c613c5cb-e716-0410-b11b-feb51c14d237
This commit is contained in:
Dave Hoover
2007-06-26 00:07:57 +00:00
parent 1c92282772
commit 6b1066169f
35 changed files with 441 additions and 441 deletions
+4 -4
View File
@@ -35,24 +35,24 @@ public class Log
/** Convenience function. */ /** Convenience function. */
public static void debug (String message) public static void debug (String message)
{ {
log.fine(message); log.fine(message);
} }
/** Convenience function. */ /** Convenience function. */
public static void info (String message) public static void info (String message)
{ {
log.info(message); log.info(message);
} }
/** Convenience function. */ /** Convenience function. */
public static void warning (String message) public static void warning (String message)
{ {
log.warning(message); log.warning(message);
} }
/** Convenience function. */ /** Convenience function. */
public static void logStackTrace (Throwable t) public static void logStackTrace (Throwable t)
{ {
log.log(Level.WARNING, t.getMessage(), t); log.log(Level.WARNING, t.getMessage(), t);
} }
} }
+5 -5
View File
@@ -44,29 +44,29 @@ public class Log
{ {
/** The static log instance configured for use by this package. */ /** The static log instance configured for use by this package. */
public static com.samskivert.util.Log log = public static com.samskivert.util.Log log =
new com.samskivert.util.Log("micasa"); new com.samskivert.util.Log("micasa");
/** Convenience function. */ /** Convenience function. */
public static void debug (String message) public static void debug (String message)
{ {
log.debug(message); log.debug(message);
} }
/** Convenience function. */ /** Convenience function. */
public static void info (String message) public static void info (String message)
{ {
log.info(message); log.info(message);
} }
/** Convenience function. */ /** Convenience function. */
public static void warning (String message) public static void warning (String message)
{ {
log.warning(message); log.warning(message);
} }
/** Convenience function. */ /** Convenience function. */
public static void logStackTrace (Throwable t) public static void logStackTrace (Throwable t)
{ {
log.logStackTrace(com.samskivert.util.Log.WARNING, t); log.logStackTrace(com.samskivert.util.Log.WARNING, t);
} }
} }
@@ -86,8 +86,8 @@ public class ChatPanel extends JPanel
_ctx.getOccupantDirector().addOccupantObserver(this); _ctx.getOccupantDirector().addOccupantObserver(this);
GroupLayout gl = new VGroupLayout(GroupLayout.STRETCH); GroupLayout gl = new VGroupLayout(GroupLayout.STRETCH);
gl.setOffAxisPolicy(GroupLayout.STRETCH); gl.setOffAxisPolicy(GroupLayout.STRETCH);
setLayout(gl); setLayout(gl);
// create our scrolling chat text display // create our scrolling chat text display
_text = new JTextPane(); _text = new JTextPane();
@@ -172,13 +172,13 @@ public class ChatPanel extends JPanel
// documentation inherited // documentation inherited
public void actionPerformed (ActionEvent e) public void actionPerformed (ActionEvent e)
{ {
String cmd = e.getActionCommand(); String cmd = e.getActionCommand();
if (cmd.equals("send")) { if (cmd.equals("send")) {
sendText(); sendText();
} else { } else {
System.out.println("Unknown action event: " + cmd); System.out.println("Unknown action event: " + cmd);
} }
} }
// documentation inherited // documentation inherited
@@ -60,7 +60,7 @@ public class ClientController extends Controller
// documentation inherited // documentation inherited
public boolean handleAction (ActionEvent action) public boolean handleAction (ActionEvent action)
{ {
String cmd = action.getActionCommand(); String cmd = action.getActionCommand();
if (cmd.equals("logoff")) { if (cmd.equals("logoff")) {
// request that we logoff // request that we logoff
@@ -58,7 +58,7 @@ public class LogonPanel extends JPanel
_ctx = ctx; _ctx = ctx;
_msgs = _ctx.getMessageManager().getBundle("micasa.logon"); _msgs = _ctx.getMessageManager().getBundle("micasa.logon");
setLayout(new VGroupLayout()); setLayout(new VGroupLayout());
// stick the logon components into a panel that will stretch them // stick the logon components into a panel that will stretch them
// to a sensible width // to a sensible width
@@ -136,16 +136,16 @@ public class LogonPanel extends JPanel
public void actionPerformed (ActionEvent e) public void actionPerformed (ActionEvent e)
{ {
String cmd = e.getActionCommand(); String cmd = e.getActionCommand();
if (cmd.equals("skipToPassword")) { if (cmd.equals("skipToPassword")) {
_password.requestFocusInWindow(); _password.requestFocusInWindow();
} else if (cmd.equals("logon")) { } else if (cmd.equals("logon")) {
logon(); logon();
} else { } else {
System.out.println("Unknown action event: " + cmd); System.out.println("Unknown action event: " + cmd);
} }
} }
// documentation inherited from interface // documentation inherited from interface
@@ -62,8 +62,8 @@ public class MiCasaFrame
{ {
// remove the old panel // remove the old panel
getContentPane().removeAll(); getContentPane().removeAll();
// add the new one // add the new one
getContentPane().add(panel, BorderLayout.CENTER); getContentPane().add(panel, BorderLayout.CENTER);
// swing doesn't properly repaint after adding/removing children // swing doesn't properly repaint after adding/removing children
panel.revalidate(); panel.revalidate();
repaint(); repaint();
@@ -48,7 +48,7 @@ public class LobbyPanel
public LobbyPanel (MiCasaContext ctx, LobbyConfig config) public LobbyPanel (MiCasaContext ctx, LobbyConfig config)
{ {
// we want a five pixel border around everything // we want a five pixel border around everything
setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
// create our primary layout which divides the display in two // create our primary layout which divides the display in two
// horizontally // horizontally
@@ -73,7 +73,7 @@ public class TableItem
_self = ((BodyObject)ctx.getClient().getClientObject()).getVisibleName(); _self = ((BodyObject)ctx.getClient().getClientObject()).getVisibleName();
// now create our user interface // now create our user interface
setBorder(BorderFactory.createLineBorder(Color.black)); setBorder(BorderFactory.createLineBorder(Color.black));
setLayout(new GridBagLayout()); setLayout(new GridBagLayout());
GridBagConstraints gbc = new GridBagConstraints(); GridBagConstraints gbc = new GridBagConstraints();
@@ -79,9 +79,9 @@ public class TableListView extends JPanel
_tdtr.addSeatednessObserver(this); _tdtr.addSeatednessObserver(this);
// set up a layout manager // set up a layout manager
HGroupLayout gl = new HGroupLayout(HGroupLayout.STRETCH); HGroupLayout gl = new HGroupLayout(HGroupLayout.STRETCH);
gl.setOffAxisPolicy(HGroupLayout.STRETCH); gl.setOffAxisPolicy(HGroupLayout.STRETCH);
setLayout(gl); setLayout(gl);
// we have two lists of tables, one of tables being matchmade... // we have two lists of tables, one of tables being matchmade...
VGroupLayout pgl = new VGroupLayout(VGroupLayout.STRETCH); VGroupLayout pgl = new VGroupLayout(VGroupLayout.STRETCH);
@@ -93,7 +93,7 @@ public class TableListView extends JPanel
mgl.setOffAxisPolicy(VGroupLayout.STRETCH); mgl.setOffAxisPolicy(VGroupLayout.STRETCH);
mgl.setJustification(VGroupLayout.TOP); mgl.setJustification(VGroupLayout.TOP);
_matchList = new JPanel(mgl); _matchList = new JPanel(mgl);
_matchList.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); _matchList.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
panel.add(new JScrollPane(_matchList)); panel.add(new JScrollPane(_matchList));
// create and initialize the configurator interface // create and initialize the configurator interface
@@ -139,7 +139,7 @@ public class TableListView extends JPanel
panel.add(new JLabel("Games in progress"), VGroupLayout.FIXED); panel.add(new JLabel("Games in progress"), VGroupLayout.FIXED);
_playList = new JPanel(mgl); _playList = new JPanel(mgl);
_playList.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); _playList.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
panel.add(new JScrollPane(_playList)); panel.add(new JScrollPane(_playList));
add(panel); add(panel);
@@ -65,7 +65,7 @@ public class SimulatorController extends Controller
// documentation inherited // documentation inherited
public boolean handleAction (ActionEvent action) public boolean handleAction (ActionEvent action)
{ {
String cmd = action.getActionCommand(); String cmd = action.getActionCommand();
if (cmd.equals(LOGOFF)) { if (cmd.equals(LOGOFF)) {
// request that we logoff // request that we logoff
+4 -4
View File
@@ -36,24 +36,24 @@ public class Log
/** Convenience function. */ /** Convenience function. */
public static void debug (String message) public static void debug (String message)
{ {
log.fine(message); log.fine(message);
} }
/** Convenience function. */ /** Convenience function. */
public static void info (String message) public static void info (String message)
{ {
log.info(message); log.info(message);
} }
/** Convenience function. */ /** Convenience function. */
public static void warning (String message) public static void warning (String message)
{ {
log.warning(message); log.warning(message);
} }
/** Convenience function. */ /** Convenience function. */
public static void logStackTrace (Throwable t) public static void logStackTrace (Throwable t)
{ {
log.log(Level.WARNING, t.getMessage(), t); log.log(Level.WARNING, t.getMessage(), t);
} }
} }
+5 -5
View File
@@ -28,29 +28,29 @@ package com.threerings.parlor.card;
public class Log public class Log
{ {
public static com.samskivert.util.Log log = public static com.samskivert.util.Log log =
new com.samskivert.util.Log("card"); new com.samskivert.util.Log("card");
/** Convenience function. */ /** Convenience function. */
public static void debug (String message) public static void debug (String message)
{ {
log.debug(message); log.debug(message);
} }
/** Convenience function. */ /** Convenience function. */
public static void info (String message) public static void info (String message)
{ {
log.info(message); log.info(message);
} }
/** Convenience function. */ /** Convenience function. */
public static void warning (String message) public static void warning (String message)
{ {
log.warning(message); log.warning(message);
} }
/** Convenience function. */ /** Convenience function. */
public static void logStackTrace (Throwable t) public static void logStackTrace (Throwable t)
{ {
log.logStackTrace(com.samskivert.util.Log.WARNING, t); log.logStackTrace(com.samskivert.util.Log.WARNING, t);
} }
} }
+5 -5
View File
@@ -28,29 +28,29 @@ package com.threerings.puzzle;
public class Log public class Log
{ {
public static com.samskivert.util.Log log = public static com.samskivert.util.Log log =
new com.samskivert.util.Log("puzzle"); new com.samskivert.util.Log("puzzle");
/** Convenience function. */ /** Convenience function. */
public static void debug (String message) public static void debug (String message)
{ {
log.debug(message); log.debug(message);
} }
/** Convenience function. */ /** Convenience function. */
public static void info (String message) public static void info (String message)
{ {
log.info(message); log.info(message);
} }
/** Convenience function. */ /** Convenience function. */
public static void warning (String message) public static void warning (String message)
{ {
log.warning(message); log.warning(message);
} }
/** Convenience function. */ /** Convenience function. */
public static void logStackTrace (Throwable t) public static void logStackTrace (Throwable t)
{ {
log.logStackTrace(com.samskivert.util.Log.WARNING, t); log.logStackTrace(com.samskivert.util.Log.WARNING, t);
} }
} }
@@ -656,9 +656,9 @@ public abstract class PuzzleController extends GameController
if (cmd.equals(TOGGLE_CHATTING)) { if (cmd.equals(TOGGLE_CHATTING)) {
setChatting(!isChatting()); setChatting(!isChatting());
} else { } else {
return super.handleAction(action); return super.handleAction(action);
} }
return true; return true;
} }
@@ -44,7 +44,7 @@ public class DropBlockSprite extends DropSprite
public DropBlockSprite ( public DropBlockSprite (
DropBoardView view, int col, int row, int orient, int[] pieces) DropBoardView view, int col, int row, int orient, int[] pieces)
{ {
super(view, col, row, pieces, 0); super(view, col, row, pieces, 0);
_orient = orient; _orient = orient;
} }
@@ -63,7 +63,7 @@ public class DropBlockSprite extends DropSprite
DropBoardView view, int col, int row, int orient, int[] pieces, DropBoardView view, int col, int row, int orient, int[] pieces,
int renderOrder) int renderOrder)
{ {
super(view, col, row, pieces, 0, renderOrder); super(view, col, row, pieces, 0, renderOrder);
_orient = orient; _orient = orient;
} }
@@ -73,7 +73,7 @@ public class DropBlockSprite extends DropSprite
{ {
super.init(); super.init();
setOrientation(_orient); setOrientation(_orient);
} }
/** /**
@@ -151,18 +151,18 @@ public class DropBlockSprite extends DropSprite
*/ */
public void setOrientation (int orient) public void setOrientation (int orient)
{ {
super.setOrientation(orient); super.setOrientation(orient);
int edx = 0, edy = 0; int edx = 0, edy = 0;
if (orient == NORTH) { if (orient == NORTH) {
edy = -1; edy = -1;
} else if (orient == WEST) { } else if (orient == WEST) {
edx = -1; edx = -1;
} }
// update the sprite image offset // update the sprite image offset
setRowOffset(edy); setRowOffset(edy);
setColumnOffset(edx); setColumnOffset(edx);
// update the external piece position and drop block bounds // update the external piece position and drop block bounds
updateDropInfo(); updateDropInfo();
@@ -171,9 +171,9 @@ public class DropBlockSprite extends DropSprite
// documentation inherited // documentation inherited
public void toString (StringBuilder buf) public void toString (StringBuilder buf)
{ {
super.toString(buf); super.toString(buf);
buf.append(", erow=").append(_erow); buf.append(", erow=").append(_erow);
buf.append(", ecol=").append(_ecol); buf.append(", ecol=").append(_ecol);
} }
/** /**
@@ -231,11 +231,11 @@ public class DropBlockSprite extends DropSprite
*/ */
protected int calculateExternalRow () protected int calculateExternalRow ()
{ {
if (_orient == NORTH) { if (_orient == NORTH) {
return (_row - 1); return (_row - 1);
} else if (_orient == SOUTH) { } else if (_orient == SOUTH) {
return (_row + 1); return (_row + 1);
} else { } else {
return _row; return _row;
} }
} }
@@ -246,11 +246,11 @@ public class DropBlockSprite extends DropSprite
*/ */
protected int calculateExternalColumn () protected int calculateExternalColumn ()
{ {
if (_orient == WEST) { if (_orient == WEST) {
return (_col - 1); return (_col - 1);
} else if (_orient == EAST) { } else if (_orient == EAST) {
return (_col + 1); return (_col + 1);
} else { } else {
return _col; return _col;
} }
} }
@@ -410,7 +410,7 @@ public abstract class DropBoardView extends PuzzleBoardView
*/ */
public DropSprite createPieces (int col, int row, int[] pieces, int dist) public DropSprite createPieces (int col, int row, int[] pieces, int dist)
{ {
return new DropSprite(this, col, row, pieces, dist); return new DropSprite(this, col, row, pieces, dist);
} }
/** /**
@@ -539,9 +539,9 @@ public abstract class DropBoardView extends PuzzleBoardView
// documentation inherited // documentation inherited
public Dimension getPreferredSize () public Dimension getPreferredSize ()
{ {
int wid = _bwid * _pwid; int wid = _bwid * _pwid;
int hei = _bhei * _phei; int hei = _bhei * _phei;
return new Dimension(wid, hei); return new Dimension(wid, hei);
} }
/** /**
@@ -274,9 +274,9 @@ public abstract class DropControllerDelegate extends PuzzleControllerDelegate
} else if (cmd.equals(END_DROP_BLOCK)) { } else if (cmd.equals(END_DROP_BLOCK)) {
handleDropBlock(false); handleDropBlock(false);
} else { } else {
return super.handleAction(action); return super.handleAction(action);
} }
return true; return true;
} }
@@ -322,7 +322,7 @@ public abstract class DropControllerDelegate extends PuzzleControllerDelegate
if (checkBlockLanded(source, false, false)) { if (checkBlockLanded(source, false, false)) {
startBounceTimer(source); startBounceTimer(source);
} }
} }
return handled; return handled;
} }
@@ -355,7 +355,7 @@ public abstract class DropControllerDelegate extends PuzzleControllerDelegate
int fcol = col + (pos.x - bb.x); int fcol = col + (pos.x - bb.x);
// Log.info("Valid move [row=" + frow + ", col=" + col + "]."); // Log.info("Valid move [row=" + frow + ", col=" + col + "].");
_blocksprite.setBoardLocation(frow, fcol); _blocksprite.setBoardLocation(frow, fcol);
} }
} }
/** /**
@@ -386,8 +386,8 @@ public abstract class DropControllerDelegate extends PuzzleControllerDelegate
// ", col=" + info[1] + ", row=" + info[2] + // ", col=" + info[1] + ", row=" + info[2] +
// ", blocksprite=" + _blocksprite + "]."); // ", blocksprite=" + _blocksprite + "].");
// update the piece image // update the piece image
_dview.rotateDropBlock(_blocksprite, info[0]); _dview.rotateDropBlock(_blocksprite, info[0]);
// place the block in its newly rotated location // place the block in its newly rotated location
_blocksprite.setBoardLocation(info[2], info[1]); _blocksprite.setBoardLocation(info[2], info[1]);
@@ -72,8 +72,8 @@ public class DropSprite extends Sprite
_view = view; _view = view;
_col = col; _col = col;
_row = row; _row = row;
_pieces = pieces; _pieces = pieces;
_dist = (dist == 0) ? 1 : dist; _dist = (dist == 0) ? 1 : dist;
_orient = NORTH; _orient = NORTH;
_unit = _view.getPieceHeight(); _unit = _view.getPieceHeight();
setRenderOrder(renderOrder); setRenderOrder(renderOrder);
@@ -86,10 +86,10 @@ public class DropSprite extends Sprite
// size the bounds to fit our pieces // size the bounds to fit our pieces
updateBounds(); updateBounds();
// set up the piece location // set up the piece location
setBoardLocation(_row, _col); setBoardLocation(_row, _col);
// calculate vertical render offset based on the number of pieces // calculate vertical render offset based on the number of pieces
setRowOffset(-(_pieces.length - 1)); setRowOffset(-(_pieces.length - 1));
} }
/** /**
@@ -97,7 +97,7 @@ public class DropSprite extends Sprite
*/ */
public int getDistance () public int getDistance ()
{ {
return _dist; return _dist;
} }
/** /**
@@ -105,7 +105,7 @@ public class DropSprite extends Sprite
*/ */
public int getColumn () public int getColumn ()
{ {
return _col; return _col;
} }
/** /**
@@ -113,7 +113,7 @@ public class DropSprite extends Sprite
*/ */
public int getRow () public int getRow ()
{ {
return _row; return _row;
} }
/** /**
@@ -121,7 +121,7 @@ public class DropSprite extends Sprite
*/ */
public int[] getPieces () public int[] getPieces ()
{ {
return _pieces; return _pieces;
} }
/** /**
@@ -129,7 +129,7 @@ public class DropSprite extends Sprite
*/ */
public float getVelocity () public float getVelocity ()
{ {
return _vel; return _vel;
} }
/** /**
@@ -137,9 +137,9 @@ public class DropSprite extends Sprite
*/ */
public void setBoardLocation (int row, int col) public void setBoardLocation (int row, int col)
{ {
_row = row; _row = row;
_col = col; _col = col;
updatePosition(); updatePosition();
} }
/** /**
@@ -147,8 +147,8 @@ public class DropSprite extends Sprite
*/ */
public void setColumn (int col) public void setColumn (int col)
{ {
_col = col; _col = col;
updatePosition(); updatePosition();
} }
/** /**
@@ -156,8 +156,8 @@ public class DropSprite extends Sprite
*/ */
public void setRow (int row) public void setRow (int row)
{ {
_row = row; _row = row;
updatePosition(); updatePosition();
} }
/** /**
@@ -165,9 +165,9 @@ public class DropSprite extends Sprite
*/ */
public void setColumnOffset (int count) public void setColumnOffset (int count)
{ {
_offx = count; _offx = count;
updateRenderOffset(); updateRenderOffset();
updateRenderOrigin(); updateRenderOrigin();
} }
/** /**
@@ -175,9 +175,9 @@ public class DropSprite extends Sprite
*/ */
public void setRowOffset (int count) public void setRowOffset (int count)
{ {
_offy = count; _offy = count;
updateRenderOffset(); updateRenderOffset();
updateRenderOrigin(); updateRenderOrigin();
} }
/** /**
@@ -213,8 +213,8 @@ public class DropSprite extends Sprite
_rowstamp = now - msecs; _rowstamp = now - msecs;
} }
// update the velocity // update the velocity
_vel = velocity; _vel = velocity;
} }
/** /**
@@ -229,17 +229,17 @@ public class DropSprite extends Sprite
_dist = 1; _dist = 1;
} }
if (_stopstamp > 0) { if (_stopstamp > 0) {
// we're dropping from a stand-still // we're dropping from a stand-still
long delta = _view.getTimeStamp() - _stopstamp; long delta = _view.getTimeStamp() - _stopstamp;
_rowstamp += delta; _rowstamp += delta;
_stopstamp = 0; _stopstamp = 0;
} else { } else {
// we're continuing a previous drop, so make use of any // we're continuing a previous drop, so make use of any
// previously existing time // previously existing time
_rowstamp = _endstamp; _rowstamp = _endstamp;
} }
} }
/** /**
@@ -307,7 +307,7 @@ public class DropSprite extends Sprite
// documentation inherited // documentation inherited
public boolean inside (Shape shape) public boolean inside (Shape shape)
{ {
return shape.contains(_bounds); return shape.contains(_bounds);
} }
/** /**
@@ -324,8 +324,8 @@ public class DropSprite extends Sprite
return 0.0f; return 0.0f;
} }
long msecs = Math.max(0, timestamp - _rowstamp); long msecs = Math.max(0, timestamp - _rowstamp);
float travpix = msecs * _vel; float travpix = msecs * _vel;
float pctdone = (travpix / _unit); float pctdone = (travpix / _unit);
// Log.info("getPercentDone [timestamp=" + timestamp + // Log.info("getPercentDone [timestamp=" + timestamp +
@@ -333,7 +333,7 @@ public class DropSprite extends Sprite
// ", travpix=" + travpix + ", pctdone=" + pctdone + // ", travpix=" + travpix + ", pctdone=" + pctdone +
// ", vel=" + _vel + "]."); // ", vel=" + _vel + "].");
return pctdone; return pctdone;
} }
// documentation inherited // documentation inherited
@@ -373,7 +373,7 @@ public class DropSprite extends Sprite
// documentation inherited // documentation inherited
public void tick (long timestamp) public void tick (long timestamp)
{ {
super.tick(timestamp); super.tick(timestamp);
// initialize our rowstamp if we haven't done so already // initialize our rowstamp if we haven't done so already
if (_rowstamp == 0) { if (_rowstamp == 0) {
@@ -387,18 +387,18 @@ public class DropSprite extends Sprite
PieceMovedOp pmop = null; PieceMovedOp pmop = null;
// figure out how far along the current board coordinate we should be // figure out how far along the current board coordinate we should be
float pctdone = getPercentDone(timestamp); float pctdone = getPercentDone(timestamp);
if (pctdone >= 1.0f) { if (pctdone >= 1.0f) {
// note that we've reached the next row // note that we've reached the next row
advancePosition(); advancePosition();
// update remaining drop distance // update remaining drop distance
_dist--; _dist--;
// calculate any remaining time to be used // calculate any remaining time to be used
long used = (long)(_unit / _vel); long used = (long)(_unit / _vel);
_endstamp = _rowstamp + used; _endstamp = _rowstamp + used;
_rowstamp = _endstamp; _rowstamp = _endstamp;
// update our percent done because we've moved down a row // update our percent done because we've moved down a row
@@ -406,7 +406,7 @@ public class DropSprite extends Sprite
// inform observers that we've reached our destination // inform observers that we've reached our destination
pmop = new PieceMovedOp(this, timestamp, _col, _row); pmop = new PieceMovedOp(this, timestamp, _col, _row);
} }
// constrain the sprite's position to the destination row // constrain the sprite's position to the destination row
pctdone = Math.min(pctdone, 1.0f); pctdone = Math.min(pctdone, 1.0f);
@@ -453,11 +453,11 @@ public class DropSprite extends Sprite
{ {
super.toString(buf); super.toString(buf);
buf.append(", orient=").append(DirectionUtil.toShortString(_orient)); buf.append(", orient=").append(DirectionUtil.toShortString(_orient));
buf.append(", row=").append(_row); buf.append(", row=").append(_row);
buf.append(", col=").append(_col); buf.append(", col=").append(_col);
buf.append(", offx=").append(_offx); buf.append(", offx=").append(_offx);
buf.append(", offy=").append(_offy); buf.append(", offy=").append(_offy);
buf.append(", dist=").append(_dist); buf.append(", dist=").append(_dist);
} }
/** /**
@@ -467,7 +467,7 @@ public class DropSprite extends Sprite
{ {
_view.getPiecePosition(_col, _row, _srcPos); _view.getPiecePosition(_col, _row, _srcPos);
_view.getPiecePosition(_col, _row+1, _destPos); _view.getPiecePosition(_col, _row+1, _destPos);
setLocation(_srcPos.x, _srcPos.y); setLocation(_srcPos.x, _srcPos.y);
} }
// documentation inherited // documentation inherited
@@ -160,14 +160,14 @@ public class DropBoard extends Board
*/ */
public int getDropDistance (int col, int row) public int getDropDistance (int col, int row)
{ {
int dist = 0; int dist = 0;
for (int yy = row + 1; yy < _bhei; yy++) { for (int yy = row + 1; yy < _bhei; yy++) {
if (getPiece(col, yy) != PIECE_NONE) { if (getPiece(col, yy) != PIECE_NONE) {
return dist; return dist;
} }
dist++; dist++;
} }
return dist; return dist;
} }
/** /**
@@ -591,9 +591,9 @@ public class DropBoard extends Board
padwid *= 2; padwid *= 2;
} }
for (int y = 0; y < _bhei; y++) { for (int y = 0; y < _bhei; y++) {
StringBuilder buf = new StringBuilder(); StringBuilder buf = new StringBuilder();
for (int x = 0; x < _bwid; x++) { for (int x = 0; x < _bwid; x++) {
int piece = getPiece(x, y); int piece = getPiece(x, y);
String str = formatPiece(piece); String str = formatPiece(piece);
if (dother != null) { if (dother != null) {
@@ -603,9 +603,9 @@ public class DropBoard extends Board
} }
} }
buf.append(StringUtils.rightPad(str, padwid)); buf.append(StringUtils.rightPad(str, padwid));
} }
System.err.println(buf.toString()); System.err.println(buf.toString());
} }
} }
/** Returns a string representation of this instance. */ /** Returns a string representation of this instance. */
@@ -129,7 +129,7 @@ public abstract class DropManagerDelegate extends PuzzleManagerDelegate
*/ */
protected boolean dropPieces (DropBoard board) protected boolean dropPieces (DropBoard board)
{ {
return (_dropper.dropPieces(board, null) > 0); return (_dropper.dropPieces(board, null) > 0);
} }
/** /**
@@ -43,33 +43,33 @@ public class PieceDropper
*/ */
public static class PieceDropInfo public static class PieceDropInfo
{ {
/** The starting row of the bottom piece being dropped. */ /** The starting row of the bottom piece being dropped. */
public int row; public int row;
/** The column number. */ /** The column number. */
public int col; public int col;
/** The distance to drop the pieces. */ /** The distance to drop the pieces. */
public int dist; public int dist;
/** The pieces to be dropped. */ /** The pieces to be dropped. */
public int[] pieces; public int[] pieces;
/** /**
* Constructs a piece drop info object. * Constructs a piece drop info object.
*/ */
public PieceDropInfo (int col, int row, int dist) public PieceDropInfo (int col, int row, int dist)
{ {
this.col = col; this.col = col;
this.row = row; this.row = row;
this.dist = dist; this.dist = dist;
} }
/** Returns a string representation of this instance. */ /** Returns a string representation of this instance. */
public String toString () public String toString ()
{ {
return StringUtil.fieldsToString(this); return StringUtil.fieldsToString(this);
} }
} }
/** /**
@@ -100,11 +100,11 @@ public class PieceDropper
public int dropPieces (DropBoard board, DropObserver drobs) public int dropPieces (DropBoard board, DropObserver drobs)
{ {
int dropped = 0, bhei = board.getHeight(), bwid = board.getWidth(); int dropped = 0, bhei = board.getHeight(), bwid = board.getWidth();
for (int yy = bhei - 1; yy >= 0; yy--) { for (int yy = bhei - 1; yy >= 0; yy--) {
for (int xx = 0; xx < bwid; xx++) { for (int xx = 0; xx < bwid; xx++) {
dropped += dropPieces(board, xx, yy, drobs); dropped += dropPieces(board, xx, yy, drobs);
} }
} }
// if the board wants pieces to be dropped in to fill the gaps, do // if the board wants pieces to be dropped in to fill the gaps, do
// that now // that now
@@ -133,14 +133,14 @@ public class PieceDropper
protected int dropPieces ( protected int dropPieces (
DropBoard board, int xx, int yy, DropObserver drobs) DropBoard board, int xx, int yy, DropObserver drobs)
{ {
// skip empty or fixed pieces // skip empty or fixed pieces
int piece = board.getPiece(xx, yy); int piece = board.getPiece(xx, yy);
if (!_logic.isDroppablePiece(piece)) { if (!_logic.isDroppablePiece(piece)) {
return 0; return 0;
} }
int dropped = 0; int dropped = 0;
if (_logic.isConstrainedPiece(piece)) { if (_logic.isConstrainedPiece(piece)) {
// find out where this constrained block starts and ends // find out where this constrained block starts and ends
int start = _logic.getConstrainedEdge(board, xx, yy, LEFT); int start = _logic.getConstrainedEdge(board, xx, yy, LEFT);
int end = _logic.getConstrainedEdge(board, xx, yy, RIGHT); int end = _logic.getConstrainedEdge(board, xx, yy, RIGHT);
@@ -159,27 +159,27 @@ public class PieceDropper
for (int xpos = start; xpos <= end; xpos++) { for (int xpos = start; xpos <= end; xpos++) {
dist = Math.min(dist, board.getDropDistance(xpos, yy)); dist = Math.min(dist, board.getDropDistance(xpos, yy));
} }
if (dist == 0) { if (dist == 0) {
return 0; return 0;
} }
// scoot along the bottom edge of the block, noting the drop // scoot along the bottom edge of the block, noting the drop
// for each column // for each column
for (int xpos = start; xpos <= end; xpos++) { for (int xpos = start; xpos <= end; xpos++) {
piece = board.getPiece(xpos, yy); piece = board.getPiece(xpos, yy);
drop(board, piece, xpos, yy, yy + dist, drobs); drop(board, piece, xpos, yy, yy + dist, drobs);
dropped++; dropped++;
} }
} else { } else {
// get the distance to drop the pieces // get the distance to drop the pieces
int dist = board.getDropDistance(xx, yy); int dist = board.getDropDistance(xx, yy);
if (dist == 0) { if (dist == 0) {
return 0; return 0;
} }
drop(board, piece, xx, yy, yy + dist, drobs); drop(board, piece, xx, yy, yy + dist, drobs);
dropped++; dropped++;
} }
return dropped; return dropped;
} }
@@ -41,9 +41,9 @@ public class PointSet
*/ */
public PointSet (int rangeX, int rangeY) public PointSet (int rangeX, int rangeY)
{ {
_rangeX = rangeX; _rangeX = rangeX;
_rangeY = rangeY; _rangeY = rangeY;
_points = new boolean[rangeX][rangeY]; _points = new boolean[rangeX][rangeY];
} }
/** /**
@@ -57,12 +57,12 @@ public class PointSet
*/ */
public boolean add (int x, int y) public boolean add (int x, int y)
{ {
boolean present = _points[x][y]; boolean present = _points[x][y];
_points[x][y] = true; _points[x][y] = true;
if (!present) { if (!present) {
_count++; _count++;
} }
return present; return present;
} }
/** /**
@@ -72,11 +72,11 @@ public class PointSet
*/ */
public void addAll (PointSet set) public void addAll (PointSet set)
{ {
Iterator iter = set.iterator(); Iterator iter = set.iterator();
Point pt; Point pt;
while ((pt = (Point)iter.next()) != null) { while ((pt = (Point)iter.next()) != null) {
add(pt.x, pt.y); add(pt.x, pt.y);
} }
} }
/** /**
@@ -84,17 +84,17 @@ public class PointSet
*/ */
public void clear () public void clear ()
{ {
if (_count == 0) { if (_count == 0) {
// no need to clear anything // no need to clear anything
return; return;
} }
for (int xx = 0; xx < _rangeX; xx++) { for (int xx = 0; xx < _rangeX; xx++) {
for (int yy = 0; yy < _rangeY; yy++) { for (int yy = 0; yy < _rangeY; yy++) {
_points[xx][yy] = false; _points[xx][yy] = false;
} }
} }
_count = 0; _count = 0;
} }
/** /**
@@ -107,7 +107,7 @@ public class PointSet
*/ */
public boolean contains (int x, int y) public boolean contains (int x, int y)
{ {
return (_points[x][y]); return (_points[x][y]);
} }
/** /**
@@ -117,7 +117,7 @@ public class PointSet
*/ */
public boolean isEmpty () public boolean isEmpty ()
{ {
return (_count == 0); return (_count == 0);
} }
/** /**
@@ -131,7 +131,7 @@ public class PointSet
*/ */
public Iterator iterator () public Iterator iterator ()
{ {
return new PointIterator(); return new PointIterator();
} }
/** /**
@@ -145,12 +145,12 @@ public class PointSet
*/ */
public boolean remove (int x, int y) public boolean remove (int x, int y)
{ {
boolean present = _points[x][y]; boolean present = _points[x][y];
_points[x][y] = false; _points[x][y] = false;
if (present) { if (present) {
_count--; _count--;
} }
return present; return present;
} }
/** /**
@@ -160,7 +160,7 @@ public class PointSet
*/ */
public int size () public int size ()
{ {
return _count; return _count;
} }
/** /**
@@ -168,70 +168,70 @@ public class PointSet
*/ */
public String toString () public String toString ()
{ {
StringBuilder buf = new StringBuilder(); StringBuilder buf = new StringBuilder();
buf.append("["); buf.append("[");
Iterator iter = iterator(); Iterator iter = iterator();
Point val; Point val;
while ((val = (Point)iter.next()) != null) { while ((val = (Point)iter.next()) != null) {
buf.append("(").append(val.x); buf.append("(").append(val.x);
buf.append(",").append(val.y); buf.append(",").append(val.y);
buf.append(")"); buf.append(")");
if (iter.hasNext()) { if (iter.hasNext()) {
buf.append(", "); buf.append(", ");
} }
} }
return buf.append("]").toString(); return buf.append("]").toString();
} }
protected class PointIterator implements Iterator protected class PointIterator implements Iterator
{ {
public boolean hasNext () public boolean hasNext ()
{ {
return (_curCount < _count); return (_curCount < _count);
} }
public Object next () public Object next ()
{ {
if (_curCount == _count) { if (_curCount == _count) {
return null; return null;
} }
while (!_points[_curX][_curY]) { while (!_points[_curX][_curY]) {
advance(); advance();
} }
_curCount++; _curCount++;
_point.setLocation(_curX, _curY); _point.setLocation(_curX, _curY);
if (_curCount < _count) { if (_curCount < _count) {
advance(); advance();
} }
return _point; return _point;
} }
public void remove () public void remove ()
{ {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
protected void advance () protected void advance ()
{ {
if ((++_curX) >= _rangeX) { if ((++_curX) >= _rangeX) {
_curX = 0; _curX = 0;
_curY++; _curY++;
} }
if (_curY >= _rangeY) { if (_curY >= _rangeY) {
Log.warning("Advanced past point range."); Log.warning("Advanced past point range.");
_curY = 0; _curY = 0;
} }
} }
protected int _curCount = 0; protected int _curCount = 0;
protected int _curX = 0, _curY = 0; protected int _curX = 0, _curY = 0;
protected Point _point = new Point(); protected Point _point = new Point();
} }
/** The dimensions of the point array. */ /** The dimensions of the point array. */
+5 -5
View File
@@ -28,29 +28,29 @@ package com.threerings.stage;
public class Log public class Log
{ {
public static com.samskivert.util.Log log = public static com.samskivert.util.Log log =
new com.samskivert.util.Log("stage"); new com.samskivert.util.Log("stage");
/** Convenience function. */ /** Convenience function. */
public static void debug (String message) public static void debug (String message)
{ {
log.debug(message); log.debug(message);
} }
/** Convenience function. */ /** Convenience function. */
public static void info (String message) public static void info (String message)
{ {
log.info(message); log.info(message);
} }
/** Convenience function. */ /** Convenience function. */
public static void warning (String message) public static void warning (String message)
{ {
log.warning(message); log.warning(message);
} }
/** Convenience function. */ /** Convenience function. */
public static void logStackTrace (Throwable t) public static void logStackTrace (Throwable t)
{ {
log.logStackTrace(com.samskivert.util.Log.WARNING, t); log.logStackTrace(com.samskivert.util.Log.WARNING, t);
} }
} }
@@ -104,12 +104,12 @@ public class EditorApp implements Runnable
JPopupMenu.setDefaultLightWeightPopupEnabled(false); JPopupMenu.setDefaultLightWeightPopupEnabled(false);
// create and size the main application frame // create and size the main application frame
_frame = createEditorFrame(); _frame = createEditorFrame();
// create our frame manager // create our frame manager
_framemgr = FrameManager.newInstance(_frame); _framemgr = FrameManager.newInstance(_frame);
// create our myriad managers, repositories, etc. // create our myriad managers, repositories, etc.
_rmgr = new ResourceManager("rsrc"); _rmgr = new ResourceManager("rsrc");
// build up a simple ui for displaying progress // build up a simple ui for displaying progress
@@ -156,7 +156,7 @@ public class EditorApp implements Runnable
{ {
_msgmgr = new MessageManager("rsrc.i18n"); _msgmgr = new MessageManager("rsrc.i18n");
_imgr = new ImageManager(_rmgr, _frame); _imgr = new ImageManager(_rmgr, _frame);
_tilemgr = new EditorTileManager(_rmgr, _imgr); _tilemgr = new EditorTileManager(_rmgr, _imgr);
try { try {
_tsrepo = new BundledTileSetRepository(_rmgr, _imgr, "tilesets"); _tsrepo = new BundledTileSetRepository(_rmgr, _imgr, "tilesets");
@@ -175,7 +175,7 @@ public class EditorApp implements Runnable
_ctx = new EditorContextImpl(); _ctx = new EditorContextImpl();
// initialize the frame with the now-prepared context // initialize the frame with the now-prepared context
_frame.init(_ctx, target); _frame.init(_ctx, target);
// wire up our runtime adjustment editor // wire up our runtime adjustment editor
@@ -286,9 +286,9 @@ public class EditorApp implements Runnable
*/ */
protected class EditorContextImpl implements EditorContext protected class EditorContextImpl implements EditorContext
{ {
public MisoTileManager getTileManager () { public MisoTileManager getTileManager () {
return _tilemgr; return _tilemgr;
} }
public FrameManager getFrameManager () { public FrameManager getFrameManager () {
return _framemgr; return _framemgr;
@@ -334,13 +334,13 @@ public class EditorApp implements Runnable
} }
} }
public TileSetRepository getTileSetRepository () { public TileSetRepository getTileSetRepository () {
return _tsrepo; return _tsrepo;
} }
public ColorPository getColorPository () { public ColorPository getColorPository () {
return _colpos; return _colpos;
} }
public void enumerateSceneTypes (List types) { public void enumerateSceneTypes (List types) {
EditorApp.this.enumerateSceneTypes(types); EditorApp.this.enumerateSceneTypes(types);
@@ -36,21 +36,21 @@ public class EditorToolBarPanel extends JPanel implements ActionListener
{ {
public EditorToolBarPanel (TileManager tilemgr, EditorModel model) public EditorToolBarPanel (TileManager tilemgr, EditorModel model)
{ {
_model = model; _model = model;
// use of flowlayout positions the toolbar and floats properly // use of flowlayout positions the toolbar and floats properly
setLayout(new FlowLayout(FlowLayout.LEFT)); setLayout(new FlowLayout(FlowLayout.LEFT));
// get our toolbar icons // get our toolbar icons
UniformTileSet tbset = tilemgr.loadTileSet(ICONS_PATH, 40, 40); UniformTileSet tbset = tilemgr.loadTileSet(ICONS_PATH, 40, 40);
// create the toolbar // create the toolbar
JToolBar toolbar = new JToolBar(); JToolBar toolbar = new JToolBar();
// add all of the toolbar buttons // add all of the toolbar buttons
_buttons = new ArrayList(); _buttons = new ArrayList();
for (int ii = 0; ii < EditorModel.NUM_ACTIONS; ii++) { for (int ii = 0; ii < EditorModel.NUM_ACTIONS; ii++) {
// get the button icon images // get the button icon images
Tile tile = tbset.getTile(ii); Tile tile = tbset.getTile(ii);
if (tile != null) { if (tile != null) {
String cmd = EditorModel.CMD_ACTIONS[ii]; String cmd = EditorModel.CMD_ACTIONS[ii];
@@ -66,55 +66,55 @@ public class EditorToolBarPanel extends JPanel implements ActionListener
Log.warning("Unable to load toolbar icon " + Log.warning("Unable to load toolbar icon " +
"[index=" + ii + "]."); "[index=" + ii + "].");
} }
} }
// default to the first button // default to the first button
setSelectedButton((JButton)_buttons.get(0)); setSelectedButton((JButton)_buttons.get(0));
// add the toolbar // add the toolbar
add(toolbar); add(toolbar);
} }
protected JButton addButton (JToolBar toolbar, String cmd, String tip, protected JButton addButton (JToolBar toolbar, String cmd, String tip,
TileIcon icon) TileIcon icon)
{ {
// create the button and configure accordingly // create the button and configure accordingly
JButton button = new JButton(new DimmedIcon(icon)); JButton button = new JButton(new DimmedIcon(icon));
button.setSelectedIcon(icon); button.setSelectedIcon(icon);
button.addActionListener(this); button.addActionListener(this);
button.setActionCommand("tbar_" + cmd); button.setActionCommand("tbar_" + cmd);
button.setToolTipText(tip); button.setToolTipText(tip);
// add the button to the toolbar // add the button to the toolbar
toolbar.add(button); toolbar.add(button);
return button; return button;
} }
protected void setSelectedButton (JButton button) protected void setSelectedButton (JButton button)
{ {
for (int ii = 0; ii < _buttons.size(); ii++) { for (int ii = 0; ii < _buttons.size(); ii++) {
JButton tb = (JButton)_buttons.get(ii); JButton tb = (JButton)_buttons.get(ii);
tb.setSelected(tb == button); tb.setSelected(tb == button);
} }
} }
public void actionPerformed (ActionEvent e) public void actionPerformed (ActionEvent e)
{ {
String cmd = e.getActionCommand(); String cmd = e.getActionCommand();
if (cmd.startsWith("tbar")) { if (cmd.startsWith("tbar")) {
// select the chosen mode in the toolbar // select the chosen mode in the toolbar
setSelectedButton((JButton)e.getSource()); setSelectedButton((JButton)e.getSource());
// update the active mode in the model, stripping the // update the active mode in the model, stripping the
// "tbar_" prefix from the command string // "tbar_" prefix from the command string
_model.setActionMode(cmd.substring(5)); _model.setActionMode(cmd.substring(5));
} else { } else {
Log.warning("Unknown action command [cmd=" + cmd + "]."); Log.warning("Unknown action command [cmd=" + cmd + "].");
} }
} }
/** The buttons in the tool bar. */ /** The buttons in the tool bar. */
@@ -28,29 +28,29 @@ package com.threerings.stage.tools.editor;
public class Log public class Log
{ {
public static com.samskivert.util.Log log = public static com.samskivert.util.Log log =
new com.samskivert.util.Log("stage.tools.editor"); new com.samskivert.util.Log("stage.tools.editor");
/** Convenience function. */ /** Convenience function. */
public static void debug (String message) public static void debug (String message)
{ {
log.debug(message); log.debug(message);
} }
/** Convenience function. */ /** Convenience function. */
public static void info (String message) public static void info (String message)
{ {
log.info(message); log.info(message);
} }
/** Convenience function. */ /** Convenience function. */
public static void warning (String message) public static void warning (String message)
{ {
log.warning(message); log.warning(message);
} }
/** Convenience function. */ /** Convenience function. */
public static void logStackTrace (Throwable t) public static void logStackTrace (Throwable t)
{ {
log.logStackTrace(com.samskivert.util.Log.WARNING, t); log.logStackTrace(com.samskivert.util.Log.WARNING, t);
} }
} }
@@ -62,22 +62,22 @@ public class ObjectEditorDialog extends JInternalFrame
_ctx = ctx; _ctx = ctx;
_panel = panel; _panel = panel;
// get a handle on the top-level panel // get a handle on the top-level panel
JPanel top = (JPanel)getContentPane(); JPanel top = (JPanel)getContentPane();
// set up a layout manager for the panel // set up a layout manager for the panel
VGroupLayout gl = new VGroupLayout( VGroupLayout gl = new VGroupLayout(
VGroupLayout.STRETCH, VGroupLayout.STRETCH, 5, VGroupLayout.CENTER); VGroupLayout.STRETCH, VGroupLayout.STRETCH, 5, VGroupLayout.CENTER);
top.setLayout(gl); top.setLayout(gl);
top.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); top.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
// object action editor elements // object action editor elements
JPanel sub = new JPanel(new HGroupLayout(HGroupLayout.STRETCH)); JPanel sub = new JPanel(new HGroupLayout(HGroupLayout.STRETCH));
sub.add(new JLabel("Object action command:"), HGroupLayout.FIXED); sub.add(new JLabel("Object action command:"), HGroupLayout.FIXED);
sub.add(_action = new JTextField()); sub.add(_action = new JTextField());
_action.addActionListener(this); _action.addActionListener(this);
_action.setActionCommand("ok"); _action.setActionCommand("ok");
top.add(sub); top.add(sub);
// create the priority slider // create the priority slider
sub = new JPanel(new HGroupLayout(HGroupLayout.STRETCH)); sub = new JPanel(new HGroupLayout(HGroupLayout.STRETCH));
@@ -95,13 +95,13 @@ public class ObjectEditorDialog extends JInternalFrame
zations.add(_secondary = new JComboBox(NO_CHOICES)); zations.add(_secondary = new JComboBox(NO_CHOICES));
top.add(zations); top.add(zations);
// create our OK/Cancel buttons // create our OK/Cancel buttons
sub = HGroupLayout.makeButtonBox(HGroupLayout.CENTER); sub = HGroupLayout.makeButtonBox(HGroupLayout.CENTER);
EditorDialogUtil.addButton(this, sub, "OK", "ok"); EditorDialogUtil.addButton(this, sub, "OK", "ok");
EditorDialogUtil.addButton(this, sub, "Cancel", "cancel"); EditorDialogUtil.addButton(this, sub, "Cancel", "cancel");
top.add(sub); top.add(sub);
pack(); pack();
} }
/** /**
@@ -112,7 +112,7 @@ public class ObjectEditorDialog extends JInternalFrame
*/ */
public void prepare (SceneObject scobj) public void prepare (SceneObject scobj)
{ {
_scobj = scobj; _scobj = scobj;
// set our title to the name of the tileset and the tile index // set our title to the name of the tileset and the tile index
String title; String title;
@@ -152,10 +152,10 @@ public class ObjectEditorDialog extends JInternalFrame
configureZations(_secondary, szations, configureZations(_secondary, szations,
_scobj.info.getSecondaryZation()); _scobj.info.getSecondaryZation());
// select the text edit field and focus it // select the text edit field and focus it
_action.setCaretPosition(0); _action.setCaretPosition(0);
_action.moveCaretPosition(atext.length()); _action.moveCaretPosition(atext.length());
_action.requestFocusInWindow(); _action.requestFocusInWindow();
} }
protected Object[] computeZations (String[] zations, int index) protected Object[] computeZations (String[] zations, int index)
@@ -198,7 +198,7 @@ public class ObjectEditorDialog extends JInternalFrame
// documentation inherited from interface // documentation inherited from interface
public void actionPerformed (ActionEvent e) public void actionPerformed (ActionEvent e)
{ {
String cmd = e.getActionCommand(); String cmd = e.getActionCommand();
if (cmd.equals("ok")) { if (cmd.equals("ok")) {
_scobj.info.action = _action.getText(); _scobj.info.action = _action.getText();
@@ -48,29 +48,29 @@ public class PortalDialog extends JInternalFrame
*/ */
public PortalDialog () public PortalDialog ()
{ {
super("Edit Portal", true); super("Edit Portal", true);
// get a handle on the top-level panel // get a handle on the top-level panel
JPanel top = (JPanel)getContentPane(); JPanel top = (JPanel)getContentPane();
// set up a layout manager for the panel // set up a layout manager for the panel
VGroupLayout gl = new VGroupLayout(VGroupLayout.STRETCH); VGroupLayout gl = new VGroupLayout(VGroupLayout.STRETCH);
gl.setOffAxisPolicy(VGroupLayout.STRETCH); gl.setOffAxisPolicy(VGroupLayout.STRETCH);
top.setLayout(gl); top.setLayout(gl);
top.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); top.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
// add the dialog instruction text // add the dialog instruction text
top.add(new JLabel("Enter settings for this portal:")); top.add(new JLabel("Enter settings for this portal:"));
// create a panel to contain the portal name info // create a panel to contain the portal name info
JPanel sub = new JPanel(new HGroupLayout(HGroupLayout.STRETCH)); JPanel sub = new JPanel(new HGroupLayout(HGroupLayout.STRETCH));
sub.add(new JLabel("Portal name:", SwingConstants.RIGHT)); sub.add(new JLabel("Portal name:", SwingConstants.RIGHT));
// create and add the portal name text entry field // create and add the portal name text entry field
sub.add(_portalText = new JTextField()); sub.add(_portalText = new JTextField());
// add the portal name info to the top-level panel // add the portal name info to the top-level panel
top.add(sub); top.add(sub);
// create a check box to allow making this the default // create a check box to allow making this the default
// entrance portal // entrance portal
@@ -79,14 +79,14 @@ public class PortalDialog extends JInternalFrame
_entrance.setActionCommand("entrance"); _entrance.setActionCommand("entrance");
top.add(_entrance); top.add(_entrance);
// create a panel to contain the OK/Cancel buttons // create a panel to contain the OK/Cancel buttons
sub = new JPanel(new HGroupLayout()); sub = new JPanel(new HGroupLayout());
EditorDialogUtil.addButton(this, sub, "OK", "ok"); EditorDialogUtil.addButton(this, sub, "OK", "ok");
// add the buttons to the top-level panel // add the buttons to the top-level panel
top.add(sub); top.add(sub);
pack(); pack();
} }
/** /**
@@ -97,26 +97,26 @@ public class PortalDialog extends JInternalFrame
*/ */
public void prepare (StageScene scene, EditablePortal port) public void prepare (StageScene scene, EditablePortal port)
{ {
_port = port; _port = port;
_scene = scene; _scene = scene;
// if the location is already a portal, fill the text entry field // if the location is already a portal, fill the text entry field
// with the current scene name, else clear it // with the current scene name, else clear it
String text = port.name; String text = port.name;
_portalText.setText(text); _portalText.setText(text);
// select the text edit field // select the text edit field
_portalText.setCaretPosition(0); _portalText.setCaretPosition(0);
_portalText.moveCaretPosition(text.length()); _portalText.moveCaretPosition(text.length());
// select the default entrance check box appropriately // select the default entrance check box appropriately
Portal entry = _scene.getDefaultEntrance(); Portal entry = _scene.getDefaultEntrance();
_entrance.setSelected(entry == null || _entrance.setSelected(entry == null ||
entry.portalId == _port.portalId); entry.portalId == _port.portalId);
// request the keyboard focus so that the destination scene // request the keyboard focus so that the destination scene
// name can be typed immediately // name can be typed immediately
_portalText.requestFocusInWindow(); _portalText.requestFocusInWindow();
} }
/** /**
@@ -124,17 +124,17 @@ public class PortalDialog extends JInternalFrame
*/ */
public void actionPerformed (ActionEvent e) public void actionPerformed (ActionEvent e)
{ {
String cmd = e.getActionCommand(); String cmd = e.getActionCommand();
if (cmd.equals("entrance")) { if (cmd.equals("entrance")) {
_entrance.setSelected(_entrance.isSelected()); _entrance.setSelected(_entrance.isSelected());
} else if (cmd.equals("ok")) { } else if (cmd.equals("ok")) {
handleSubmit(); handleSubmit();
} else { } else {
Log.warning("Unknown action command [cmd=" + cmd + "]."); Log.warning("Unknown action command [cmd=" + cmd + "].");
} }
} }
/** /**
@@ -142,7 +142,7 @@ public class PortalDialog extends JInternalFrame
*/ */
protected void handleSubmit () protected void handleSubmit ()
{ {
// get the destination scene name // get the destination scene name
_port.name = _portalText.getText(); _port.name = _portalText.getText();
// update the scene's default entrance // update the scene's default entrance
@@ -160,10 +160,10 @@ public class PortalDialog extends JInternalFrame
// documentation inherited // documentation inherited
protected void processKeyEvent (KeyEvent e) protected void processKeyEvent (KeyEvent e)
{ {
switch (e.getKeyCode()) { switch (e.getKeyCode()) {
case KeyEvent.VK_ENTER: handleSubmit(); break; case KeyEvent.VK_ENTER: handleSubmit(); break;
case KeyEvent.VK_ESCAPE: setVisible(false); break; case KeyEvent.VK_ESCAPE: setVisible(false); break;
} }
} }
/** The scene. */ /** The scene. */
@@ -45,12 +45,12 @@ public class EditorDialogUtil
* @param cmd the action command. * @param cmd the action command.
*/ */
public static void addButton (ActionListener l, Container container, public static void addButton (ActionListener l, Container container,
String name, String cmd) String name, String cmd)
{ {
JButton button = new JButton(name); JButton button = new JButton(name);
button.addActionListener(l); button.addActionListener(l);
button.setActionCommand(cmd); button.setActionCommand(cmd);
container.add(button); container.add(button);
} }
/** /**
@@ -63,10 +63,10 @@ public class EditorDialogUtil
*/ */
public static JComboBox getOrientationComboBox (ActionListener l) public static JComboBox getOrientationComboBox (ActionListener l)
{ {
JComboBox box = new JComboBox(DirectionUtil.getDirectionNames()); JComboBox box = new JComboBox(DirectionUtil.getDirectionNames());
box.addActionListener(l); box.addActionListener(l);
box.setActionCommand("orient"); box.setActionCommand("orient");
return box; return box;
} }
/** /**
@@ -90,8 +90,8 @@ public class EditorDialogUtil
{ {
center(parent, dialog); center(parent, dialog);
parent.getLayeredPane().add(dialog, JLayeredPane.POPUP_LAYER); parent.getLayeredPane().add(dialog, JLayeredPane.POPUP_LAYER);
dialog.setVisible(true); dialog.setVisible(true);
} }
/** /**
* Removes the supplied dialog from its parent container, but does not * Removes the supplied dialog from its parent container, but does not
@@ -86,17 +86,17 @@ public class ViewerApp
_rmgr = new ResourceManager("rsrc"); _rmgr = new ResourceManager("rsrc");
_rmgr.initBundles(null, "config/resource/manager.properties", null); _rmgr.initBundles(null, "config/resource/manager.properties", null);
_imgr = new ImageManager(_rmgr, _frame); _imgr = new ImageManager(_rmgr, _frame);
_tilemgr = new MisoTileManager(_rmgr, _imgr); _tilemgr = new MisoTileManager(_rmgr, _imgr);
_tilemgr.setTileSetRepository( _tilemgr.setTileSetRepository(
new BundledTileSetRepository(_rmgr, _imgr, "tilesets")); new BundledTileSetRepository(_rmgr, _imgr, "tilesets"));
_colpos = ColorPository.loadColorPository(_rmgr); _colpos = ColorPository.loadColorPository(_rmgr);
_crepo = new BundledComponentRepository(_rmgr, _imgr, "components"); _crepo = new BundledComponentRepository(_rmgr, _imgr, "components");
_mesgmgr = new MessageManager("rsrc.i18n"); _mesgmgr = new MessageManager("rsrc.i18n");
_frame = new ViewerFrame(gc); _frame = new ViewerFrame(gc);
_framemgr = FrameManager.newInstance(_frame); _framemgr = FrameManager.newInstance(_frame);
StageContext ctx = new ContextImpl(); StageContext ctx = new ContextImpl();
_frame.init(ctx, new CharacterManager(_imgr, _crepo)); _frame.init(ctx, new CharacterManager(_imgr, _crepo));
// grab our argument // grab our argument
@@ -124,9 +124,9 @@ public class ViewerApp
return _framemgr; return _framemgr;
} }
public MisoTileManager getTileManager () { public MisoTileManager getTileManager () {
return _tilemgr; return _tilemgr;
} }
// documentation inherited from interface // documentation inherited from interface
public ResourceManager getResourceManager () { public ResourceManager getResourceManager () {
@@ -62,7 +62,7 @@ public class ViewerFrame extends ManagedJFrame
*/ */
public ViewerFrame (GraphicsConfiguration gc) public ViewerFrame (GraphicsConfiguration gc)
{ {
super(gc); super(gc);
// set up the frame options // set up the frame options
setTitle("Scene Viewer"); setTitle("Scene Viewer");
@@ -104,7 +104,7 @@ public class ViewerFrame extends ManagedJFrame
public void init (StageContext ctx, CharacterManager charmgr) public void init (StageContext ctx, CharacterManager charmgr)
{ {
_panel = new ViewerScenePanel(ctx, charmgr); _panel = new ViewerScenePanel(ctx, charmgr);
getContentPane().add(_panel, BorderLayout.CENTER); getContentPane().add(_panel, BorderLayout.CENTER);
} }
/** /**
@@ -61,7 +61,7 @@ public class ViewerScenePanel extends StageScenePanel
*/ */
public ViewerScenePanel (StageContext ctx, CharacterManager charmgr) public ViewerScenePanel (StageContext ctx, CharacterManager charmgr)
{ {
super(ctx, new Controller() { super(ctx, new Controller() {
}); });
_charmgr = charmgr; _charmgr = charmgr;
@@ -76,7 +76,7 @@ public class ViewerScenePanel extends StageScenePanel
_sprite = createSprite(_descUser); _sprite = createSprite(_descUser);
setFollowsPathable(_sprite, CENTER_ON_PATHABLE); setFollowsPathable(_sprite, CENTER_ON_PATHABLE);
PerformanceMonitor.register(this, "paint", 1000); PerformanceMonitor.register(this, "paint", 1000);
} }
// documentation inherited // documentation inherited
@@ -158,8 +158,8 @@ public class ViewerScenePanel extends StageScenePanel
// documentation inherited // documentation inherited
public void paint (Graphics g) public void paint (Graphics g)
{ {
super.paint(g); super.paint(g);
PerformanceMonitor.tick(this, "paint"); PerformanceMonitor.tick(this, "paint");
} }
// documentation inherited // documentation inherited
@@ -197,14 +197,14 @@ public class ViewerScenePanel extends StageScenePanel
{ {
// get the path from here to there // get the path from here to there
LineSegmentPath path = (LineSegmentPath)getPath(s, x, y, false); LineSegmentPath path = (LineSegmentPath)getPath(s, x, y, false);
if (path == null) { if (path == null) {
s.cancelMove(); s.cancelMove();
return false; return false;
} }
// start the sprite moving along the path // start the sprite moving along the path
path.setVelocity(100f/1000f); path.setVelocity(100f/1000f);
s.move(path); s.move(path);
return true; return true;
} }
+5 -5
View File
@@ -28,7 +28,7 @@ package com.threerings.whirled;
public class Log public class Log
{ {
public static com.samskivert.util.Log log = public static com.samskivert.util.Log log =
new com.samskivert.util.Log("whirled"); new com.samskivert.util.Log("whirled");
/** Convenience function. */ /** Convenience function. */
public static boolean debug () public static boolean debug ()
@@ -40,24 +40,24 @@ public class Log
/** Convenience function. */ /** Convenience function. */
public static void debug (String message) public static void debug (String message)
{ {
log.debug(message); log.debug(message);
} }
/** Convenience function. */ /** Convenience function. */
public static void info (String message) public static void info (String message)
{ {
log.info(message); log.info(message);
} }
/** Convenience function. */ /** Convenience function. */
public static void warning (String message) public static void warning (String message)
{ {
log.warning(message); log.warning(message);
} }
/** Convenience function. */ /** Convenience function. */
public static void logStackTrace (Throwable t) public static void logStackTrace (Throwable t)
{ {
log.logStackTrace(com.samskivert.util.Log.WARNING, t); log.logStackTrace(com.samskivert.util.Log.WARNING, t);
} }
} }
@@ -28,29 +28,29 @@ package com.threerings.whirled.spot;
public class Log public class Log
{ {
public static com.samskivert.util.Log log = public static com.samskivert.util.Log log =
new com.samskivert.util.Log("whirled.spot"); new com.samskivert.util.Log("whirled.spot");
/** Convenience function. */ /** Convenience function. */
public static void debug (String message) public static void debug (String message)
{ {
log.debug(message); log.debug(message);
} }
/** Convenience function. */ /** Convenience function. */
public static void info (String message) public static void info (String message)
{ {
log.info(message); log.info(message);
} }
/** Convenience function. */ /** Convenience function. */
public static void warning (String message) public static void warning (String message)
{ {
log.warning(message); log.warning(message);
} }
/** Convenience function. */ /** Convenience function. */
public static void logStackTrace (Throwable t) public static void logStackTrace (Throwable t)
{ {
log.logStackTrace(com.samskivert.util.Log.WARNING, t); log.logStackTrace(com.samskivert.util.Log.WARNING, t);
} }
} }
@@ -28,29 +28,29 @@ package com.threerings.whirled.zone;
public class Log public class Log
{ {
public static com.samskivert.util.Log log = public static com.samskivert.util.Log log =
new com.samskivert.util.Log("whirled.zone"); new com.samskivert.util.Log("whirled.zone");
/** Convenience function. */ /** Convenience function. */
public static void debug (String message) public static void debug (String message)
{ {
log.debug(message); log.debug(message);
} }
/** Convenience function. */ /** Convenience function. */
public static void info (String message) public static void info (String message)
{ {
log.info(message); log.info(message);
} }
/** Convenience function. */ /** Convenience function. */
public static void warning (String message) public static void warning (String message)
{ {
log.warning(message); log.warning(message);
} }
/** Convenience function. */ /** Convenience function. */
public static void logStackTrace (Throwable t) public static void logStackTrace (Throwable t)
{ {
log.logStackTrace(com.samskivert.util.Log.WARNING, t); log.logStackTrace(com.samskivert.util.Log.WARNING, t);
} }
} }