Whitespace

git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@1015 c613c5cb-e716-0410-b11b-feb51c14d237
This commit is contained in:
Dave Hoover
2010-11-19 21:31:29 +00:00
parent b17e9ccee5
commit 0ed154d0c3
5 changed files with 96 additions and 152 deletions
@@ -645,8 +645,8 @@ public class DropBoard extends Board
{ {
// make sure the target board is a valid target // make sure the target board is a valid target
if (board.getWidth() != _bwid || board.getHeight() != _bhei) { if (board.getWidth() != _bwid || board.getHeight() != _bhei) {
log.warning("Can't copy board into destination board with different dimensions " + log.warning("Can't copy board into destination board with different dimensions",
"[src=" + this + ", dest=" + board + "]."); "src", this, "dest", board);
return; return;
} }
@@ -75,8 +75,8 @@ import com.threerings.stage.tools.xml.StageSceneWriter;
import static com.threerings.stage.Log.log; import static com.threerings.stage.Log.log;
/** /**
* A scene editor application that provides facilities for viewing, * A scene editor application that provides facilities for viewing, editing, and saving the scene
* editing, and saving the scene templates that comprise a game. * templates that comprise a game.
*/ */
public class EditorApp implements Runnable public class EditorApp implements Runnable
{ {
@@ -104,8 +104,7 @@ public class EditorApp implements Runnable
log.info("Opened debug log '" + dlog + "'."); log.info("Opened debug log '" + dlog + "'.");
} catch (IOException ioe) { } catch (IOException ioe) {
log.warning("Failed to open debug log [path=" + dlog + log.warning("Failed to open debug log", "path", dlog, "error", ioe);
", error=" + ioe + "].");
} }
} }
@@ -153,7 +152,7 @@ public class EditorApp implements Runnable
} }
public void initializationFailed (Exception e) { public void initializationFailed (Exception e) {
log.warning("Failed unpacking bundles [e=" + e + "].", e); log.warning("Failed unpacking bundles", "e", e, e);
} }
}; };
// we want our methods called on the AWT thread // we want our methods called on the AWT thread
@@ -170,11 +169,9 @@ public class EditorApp implements Runnable
try { try {
_tsrepo = new BundledTileSetRepository(_rmgr, _imgr, "tilesets"); _tsrepo = new BundledTileSetRepository(_rmgr, _imgr, "tilesets");
_tilemgr.setTileSetRepository(_tsrepo); _tilemgr.setTileSetRepository(_tsrepo);
_crepo = new BundledComponentRepository( _crepo = new BundledComponentRepository(_rmgr, _imgr, "components");
_rmgr, _imgr, "components");
} catch (IOException e) { } catch (IOException e) {
log.warning("Exception loading tilesets and and icon manager " + log.warning("Exception loading tilesets and and icon manager", "Exception", e);
"[Exception=" + e + "].");
return; return;
} }
@@ -197,8 +194,8 @@ public class EditorApp implements Runnable
} }
/** /**
* Given a subdirectory name (that should correspond to the calling * Given a subdirectory name (that should correspond to the calling service), returns a file
* service), returns a file path that can be used to store local data. * path that can be used to store local data.
*/ */
public static String localDataDir (String subdir) public static String localDataDir (String subdir)
{ {
@@ -218,16 +215,13 @@ public class EditorApp implements Runnable
*/ */
public void run () public void run ()
{ {
// enter full-screen exclusive mode if available and if we have // enter full-screen exclusive mode if available and if we have the right display mode
// the right display mode GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsEnvironment env =
GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice gd = env.getDefaultScreenDevice(); GraphicsDevice gd = env.getDefaultScreenDevice();
DisplayMode pmode = null; DisplayMode pmode = null;
try { try {
DisplayMode cmode = gd.getDisplayMode(); DisplayMode cmode = gd.getDisplayMode();
pmode = ModeUtil.getDisplayMode( pmode = ModeUtil.getDisplayMode(gd, cmode.getWidth(), cmode.getHeight(), 16, 15);
gd, cmode.getWidth(), cmode.getHeight(), 16, 15);
} catch (Throwable t) { } catch (Throwable t) {
// Win98 seems to choke on its own vomit when we attempt to // Win98 seems to choke on its own vomit when we attempt to
// enumerate the available display modes; yay! // enumerate the available display modes; yay!
@@ -236,8 +230,7 @@ public class EditorApp implements Runnable
if (_viewFullScreen.getValue() && gd.isFullScreenSupported() && if (_viewFullScreen.getValue() && gd.isFullScreenSupported() &&
pmode != null) { pmode != null) {
log.info("Switching to screen mode " + log.info("Switching to screen mode", "mode", ModeUtil.toString(pmode));
"[mode=" + ModeUtil.toString(pmode) + "].");
// set the frame to undecorated, full-screen // set the frame to undecorated, full-screen
_frame.setUndecorated(true); _frame.setUndecorated(true);
gd.setFullScreenWindow(_frame); gd.setFullScreenWindow(_frame);
@@ -264,8 +257,7 @@ public class EditorApp implements Runnable
} }
/** /**
* Derived classes can override this method and add additional scene * Derived classes can override this method and add additional scene types.
* types.
*/ */
protected void enumerateSceneTypes (List<String> types) protected void enumerateSceneTypes (List<String> types)
{ {
@@ -288,9 +280,8 @@ public class EditorApp implements Runnable
} }
/** /**
* The implementation of the EditorContext interface that provides * The implementation of the EditorContext interface that provides handles to the config and
* handles to the config and manager objects that offer commonly * manager objects that offer commonly used services.
* used services.
*/ */
protected class EditorContextImpl implements EditorContext protected class EditorContextImpl implements EditorContext
{ {
@@ -333,9 +324,8 @@ public class EditorApp implements Runnable
public String xlate (String bundle, String message) { public String xlate (String bundle, String message) {
MessageBundle mbundle = _msgmgr.getBundle(bundle); MessageBundle mbundle = _msgmgr.getBundle(bundle);
if (mbundle == null) { if (mbundle == null) {
log.warning("Requested to translate message with " + log.warning("Requested to translate message with non-existent bundle",
"non-existent bundle [bundle=" + bundle + "bundle", bundle, "message", message);
", message=" + message + "].");
return message; return message;
} else { } else {
return mbundle.xlate(message); return mbundle.xlate(message);
@@ -60,9 +60,8 @@ import com.threerings.stage.data.StageScene;
import com.threerings.stage.tools.editor.util.EditorContext; import com.threerings.stage.tools.editor.util.EditorContext;
/** /**
* The scene info panel presents the user with options to select the * The scene info panel presents the user with options to select the scene layer to edit, and
* scene layer to edit, and whether to display tile coordinates and * whether to display tile coordinates and locations in the scene view.
* locations in the scene view.
*/ */
public class SceneInfoPanel extends JPanel public class SceneInfoPanel extends JPanel
implements ActionListener implements ActionListener
@@ -70,8 +69,7 @@ public class SceneInfoPanel extends JPanel
/** /**
* Constructs the scene info panel. * Constructs the scene info panel.
*/ */
public SceneInfoPanel (EditorContext ctx, EditorModel model, public SceneInfoPanel (EditorContext ctx, EditorModel model, EditorScenePanel svpanel)
EditorScenePanel svpanel)
{ {
_ctx = ctx; _ctx = ctx;
_svpanel = svpanel; _svpanel = svpanel;
@@ -100,8 +98,7 @@ public class SceneInfoPanel extends JPanel
ctx.enumerateSceneTypes(types); ctx.enumerateSceneTypes(types);
types.sort(); types.sort();
types.add(0, ""); types.add(0, "");
hbox.add(createLabel("Scene type:", hbox.add(createLabel("Scene type:", _scenetype = new JComboBox(types.toArray())));
_scenetype = new JComboBox(types.toArray())));
_scenetype.addActionListener(this); _scenetype.addActionListener(this);
vert.add(hbox); vert.add(hbox);
@@ -164,16 +161,14 @@ public class SceneInfoPanel extends JPanel
} }
/** /**
* Prior to the color classes popup popping up, recompute the possible * Prior to the color classes popup popping up, recompute the possible values.
* values.
*/ */
protected void recomputeColorClasses () protected void recomputeColorClasses ()
{ {
// add all possible colorization names to the list // add all possible colorization names to the list
final TileManager tilemgr = _ctx.getTileManager(); final TileManager tilemgr = _ctx.getTileManager();
final TreeSet<String> set = Sets.newTreeSet(); final TreeSet<String> set = Sets.newTreeSet();
StageMisoSceneModel msmodel = StageMisoSceneModel.getSceneModel( StageMisoSceneModel msmodel = StageMisoSceneModel.getSceneModel(_scene.getSceneModel());
_scene.getSceneModel());
msmodel.visitObjects(new ObjectVisitor() { msmodel.visitObjects(new ObjectVisitor() {
public void visit (ObjectInfo info) { public void visit (ObjectInfo info) {
int tsid = TileUtil.getTileSetId(info.tileId); int tsid = TileUtil.getTileSetId(info.tileId);
@@ -198,8 +193,7 @@ public class SceneInfoPanel extends JPanel
}); });
Object selected = _colorClasses.getSelectedItem(); Object selected = _colorClasses.getSelectedItem();
DefaultComboBoxModel model = DefaultComboBoxModel model = (DefaultComboBoxModel) _colorClasses.getModel();
(DefaultComboBoxModel) _colorClasses.getModel();
model.removeAllElements(); model.removeAllElements();
for (String zation : set) { for (String zation : set) {
model.addElement(zation); model.addElement(zation);
@@ -210,15 +204,14 @@ public class SceneInfoPanel extends JPanel
} }
/** /**
* Show which color Ids are available for the currently selected * Show which color Ids are available for the currently selected colorization class, and
* colorization class, and select the selected one. * select the selected one.
*/ */
protected void configureColorIds (String cclass) protected void configureColorIds (String cclass)
{ {
_colorIds.removeActionListener(this); _colorIds.removeActionListener(this);
try { try {
DefaultComboBoxModel model = DefaultComboBoxModel model = (DefaultComboBoxModel) _colorIds.getModel();
(DefaultComboBoxModel) _colorIds.getModel();
model.removeAllElements(); model.removeAllElements();
if (cclass == null) { if (cclass == null) {
return; return;
@@ -75,8 +75,8 @@ import com.threerings.stage.tools.editor.util.TileSetUtil;
import static com.threerings.stage.Log.log; import static com.threerings.stage.Log.log;
/** /**
* The tile info panel presents the user with options to select the * The tile info panel presents the user with options to select the tile to be applied to the
* tile to be applied to the scene. * scene.
*/ */
public class TileInfoPanel extends JSplitPane public class TileInfoPanel extends JSplitPane
implements ListSelectionListener, TreeSelectionListener, EditorModelListener implements ListSelectionListener, TreeSelectionListener, EditorModelListener
@@ -133,21 +133,18 @@ public class TileInfoPanel extends JSplitPane
_tsettree = new JTree(root); _tsettree = new JTree(root);
// don't draw any funny little icons in the tree // don't draw any funny little icons in the tree
DefaultTreeCellRenderer cellrend = DefaultTreeCellRenderer cellrend = (DefaultTreeCellRenderer) _tsettree.getCellRenderer();
(DefaultTreeCellRenderer) _tsettree.getCellRenderer();
cellrend.setLeafIcon(null); cellrend.setLeafIcon(null);
cellrend.setOpenIcon(null); cellrend.setOpenIcon(null);
cellrend.setClosedIcon(null); cellrend.setClosedIcon(null);
// tree- only let one thing be selected, and let us know when it haps // tree- only let one thing be selected, and let us know when it haps
_tsettree.getSelectionModel().setSelectionMode( _tsettree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
TreeSelectionModel.SINGLE_TREE_SELECTION);
_tsettree.addTreeSelectionListener(this); _tsettree.addTreeSelectionListener(this);
// create a scrollpane to hold the tree // create a scrollpane to hold the tree
SafeScrollPane scrolly = new SafeScrollPane(_tsettree); SafeScrollPane scrolly = new SafeScrollPane(_tsettree);
scrolly.setVerticalScrollBarPolicy( scrolly.setVerticalScrollBarPolicy(SafeScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
SafeScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
DefaultListModel qmodel = new DefaultListModel(); DefaultListModel qmodel = new DefaultListModel();
for (int ii=0; ii < 10; ii++) { for (int ii=0; ii < 10; ii++) {
@@ -159,9 +156,7 @@ public class TileInfoPanel extends JSplitPane
_quickList.setCellRenderer(new DefaultListCellRenderer() { _quickList.setCellRenderer(new DefaultListCellRenderer() {
@Override @Override
public Component getListCellRendererComponent ( public Component getListCellRendererComponent (
JList list, Object value, int index, boolean isSelected, JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
boolean cellHasFocus)
{
// put the key number in front of each element // put the key number in front of each element
Component result = super.getListCellRendererComponent( Component result = super.getListCellRendererComponent(
list, value, index, isSelected, cellHasFocus); list, value, index, isSelected, cellHasFocus);
@@ -184,8 +179,7 @@ public class TileInfoPanel extends JSplitPane
// wrap the table in a scrollpane for lengthy tilesets // wrap the table in a scrollpane for lengthy tilesets
_scroller = new SafeScrollPane(_tiletable); _scroller = new SafeScrollPane(_tiletable);
_scroller.setVerticalScrollBarPolicy( _scroller.setVerticalScrollBarPolicy(SafeScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
SafeScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
// add the tile table as the entire east side // add the tile table as the entire east side
setRightComponent(_scroller); setRightComponent(_scroller);
@@ -217,8 +211,7 @@ public class TileInfoPanel extends JSplitPane
{ {
ctx.getKeyDispatcher().addGlobalKeyListener(new KeyAdapter() { ctx.getKeyDispatcher().addGlobalKeyListener(new KeyAdapter() {
@Override @Override
public void keyTyped (KeyEvent e) public void keyTyped (KeyEvent e) {
{
char keychar = e.getKeyChar(); char keychar = e.getKeyChar();
if ((keychar < '0') || (keychar > '9')) { if ((keychar < '0') || (keychar > '9')) {
return; return;
@@ -232,8 +225,7 @@ public class TileInfoPanel extends JSplitPane
return; return;
} }
_quickList.clearSelection(); _quickList.clearSelection();
DefaultListModel model = DefaultListModel model = (DefaultListModel) _quickList.getModel();
(DefaultListModel) _quickList.getModel();
int olddex = model.indexOf(_curTrec); int olddex = model.indexOf(_curTrec);
if (olddex != -1) { if (olddex != -1) {
model.set(olddex, ""); model.set(olddex, "");
@@ -292,8 +284,8 @@ public class TileInfoPanel extends JSplitPane
Object uobj = node.getUserObject(); Object uobj = node.getUserObject();
if (!(uobj instanceof TileSetRecord)) { if (!(uobj instanceof TileSetRecord)) {
log.info("Eh? Non-TileSetRecord leaf [obj=" + uobj + log.info("Eh? Non-TileSetRecord leaf",
", class=" + StringUtil.shortClassName(uobj) + "]."); "obj", uobj, "class", StringUtil.shortClassName(uobj));
return; return;
} }
@@ -303,8 +295,7 @@ public class TileInfoPanel extends JSplitPane
} }
/** /**
* Called when a tileset is selected, either via the tree * Called when a tileset is selected, either via the tree or the recent list.
* or the recent list.
*/ */
protected void tileSetSelected (TileSetRecord trec) protected void tileSetSelected (TileSetRecord trec)
{ {
@@ -313,8 +304,7 @@ public class TileInfoPanel extends JSplitPane
_curTrec = trec; _curTrec = trec;
_model.setLayerIndex(trec.layer); _model.setLayerIndex(trec.layer);
// update the model to reflect new tile set and select tile // update the model to reflect new tile set and select tile zero by default
// zero by default
_settingTileOurselves = true; _settingTileOurselves = true;
_model.setTile(trec.tileSet, trec.tileSetId, 0); _model.setTile(trec.tileSet, trec.tileSetId, 0);
_settingTileOurselves = false; _settingTileOurselves = false;
@@ -324,8 +314,7 @@ public class TileInfoPanel extends JSplitPane
// _quickList.removeListSelectionListener(this); // _quickList.removeListSelectionListener(this);
// // add it to the recent list // // add it to the recent list
// DefaultListModel recentModel = (DefaultListModel) // DefaultListModel recentModel = (DefaultListModel) _quickList.getModel();
// _quickList.getModel();
// recentModel.removeElement(trec); // recentModel.removeElement(trec);
// recentModel.add(0, trec); // recentModel.add(0, trec);
// _quickList.setSelectedIndex(0); // _quickList.setSelectedIndex(0);
@@ -340,8 +329,7 @@ public class TileInfoPanel extends JSplitPane
{ {
// trim the tilesets back to remove any previous test tiles // trim the tilesets back to remove any previous test tiles
for (int ii=0; ii < 2; ii++) { for (int ii=0; ii < 2; ii++) {
for (int jj=_layerSets.get(ii).size() - 1; jj >= _layerLengths[ii]; for (int jj=_layerSets.get(ii).size() - 1; jj >= _layerLengths[ii]; jj--) {
jj--) {
_layerSets.get(ii).remove(jj); _layerSets.get(ii).remove(jj);
} }
} }
@@ -372,8 +360,7 @@ public class TileInfoPanel extends JSplitPane
} }
/** /**
* The layer has changed, update the tree to reflect the tilesets * The layer has changed, update the tree to reflect the tilesets now available.
* now available.
*/ */
public void updateTileSetTree () public void updateTileSetTree ()
{ {
@@ -430,14 +417,13 @@ public class TileInfoPanel extends JSplitPane
/** /**
* Recursively add tilesets to the tree. * Recursively add tilesets to the tree.
* *
* @param prefix The portion of the full tileset name that we've * @param prefix The portion of the full tileset name that we've already parsed, it
* already parsed, it corresponds to the node we're adding to. * corresponds to the node we're adding to.
* @param position The position in the array from whence to start adding. * @param position The position in the array from whence to start adding.
* @return the number of elements added to 'node' from 'list'. * @return the number of elements added to 'node' from 'list'.
*/ */
protected int addNodes (DefaultMutableTreeNode node, protected int addNodes (DefaultMutableTreeNode node, TileSetRecord[] list, String prefix,
TileSetRecord[] list, String prefix, int position, int position, ArrayList<TreePath> expand)
ArrayList<TreePath> expand)
{ {
int prefixlen = prefix.length(); int prefixlen = prefix.length();
@@ -454,16 +440,13 @@ public class TileInfoPanel extends JSplitPane
int dex = name.indexOf('/', prefixlen); int dex = name.indexOf('/', prefixlen);
if (dex == -1) { if (dex == -1) {
// nope, just add this item to the node. // nope, just add this item to the node.
DefaultMutableTreeNode item = new DefaultMutableTreeNode( DefaultMutableTreeNode item = new DefaultMutableTreeNode(list[ii]);
list[ii]);
node.add(item); node.add(item);
// oh, we're so sneaky! // oh, we're so sneaky!
// if the item we're adding has the same TileSetRecord // if the item we're adding has the same TileSetRecord as the previously selected
// as the previously selected item, we're going to want to // item, we're going to want to select it..
// select it.. if ((_selected != null) && (list[ii].equals(_selected.getUserObject()))) {
if ((_selected != null) &&
(list[ii].equals(_selected.getUserObject()))) {
_selected = item; _selected = item;
} }
@@ -474,8 +457,7 @@ public class TileInfoPanel extends JSplitPane
} else { } else {
// new category! // new category!
String catname = name.substring(prefixlen, dex); String catname = name.substring(prefixlen, dex);
DefaultMutableTreeNode category = DefaultMutableTreeNode category = new DefaultMutableTreeNode(catname);
new DefaultMutableTreeNode(catname);
node.add(category); node.add(category);
// if we have further categories below, start expanded // if we have further categories below, start expanded
@@ -484,8 +466,7 @@ public class TileInfoPanel extends JSplitPane
} }
// recurse.. // recurse..
ii += addNodes(category, list, name.substring(0, dex + 1), ii += addNodes(category, list, name.substring(0, dex + 1), ii, expand);
ii, expand);
} }
} }
@@ -497,14 +478,12 @@ public class TileInfoPanel extends JSplitPane
*/ */
protected void updateTileTable () protected void updateTileTable ()
{ {
// get the table width before we update the table model since // get the table width before we update the table model since updating the model seems to
// updating the model seems to reset the table width to an // reset the table width to an incorrect default
// incorrect default
TableColumn tcol = _tiletable.getColumnModel().getColumn(0); TableColumn tcol = _tiletable.getColumnModel().getColumn(0);
_tablewid = tcol.getWidth() - (2 * EDGE_TILE_H); _tablewid = tcol.getWidth() - (2 * EDGE_TILE_H);
// clear out the old selection because we're going to change // clear out the old selection because we're going to change tilesets
// tilesets
_tiletable.clearSelection(); _tiletable.clearSelection();
// update the table model with the new tile set tiles // update the table model with the new tile set tiles
@@ -526,7 +505,7 @@ public class TileInfoPanel extends JSplitPane
// select the selected tile // select the selected tile
int tid = _model.getTileId(); int tid = _model.getTileId();
_tiletable.setRowSelectionInterval(tid, tid); _tiletable.setRowSelectionInterval(tid, tid);
if (_scroller != null) { if (_scroller != null) {
// scroll to the selected tile // scroll to the selected tile
@@ -580,8 +559,8 @@ public class TileInfoPanel extends JSplitPane
} }
/** /**
* Returns the height of the given tile image after scaling to fit * Returns the height of the given tile image after scaling to fit within the width of the
* within the width of the tile table. * tile table.
*/ */
protected int getScaledTileImageHeight (Image img) protected int getScaledTileImageHeight (Image img)
{ {
@@ -595,46 +574,39 @@ public class TileInfoPanel extends JSplitPane
} }
/** /**
* Extends the {@link AbstractTableModel} to encapsulate the table * Extends the {@link AbstractTableModel} to encapsulate the table layout and display options
* layout and display options required when displaying the tiles in * required when displaying the tiles in the currently selected tileset.
* the currently selected tileset.
*/ */
protected class TileTableModel extends AbstractTableModel protected class TileTableModel extends AbstractTableModel
{ {
/** /**
* Called when the tile set associated with the table has been * Called when the tile set associated with the table has been changed. Clears the cached
* changed. Clears the cached image icons used to display each * image icons used to display each cell and updates the number of rows in the table to
* cell and updates the number of rows in the table to properly * properly deal with tile sets of varying sizes.
* deal with tile sets of varying sizes.
*/ */
public synchronized void updateTileSet () public synchronized void updateTileSet () {
{
int numTiles = getTileCount(); int numTiles = getTileCount();
_icons = new ImageIcon[numTiles]; _icons = new ImageIcon[numTiles];
fireTableRowsInserted(0, numTiles); fireTableRowsInserted(0, numTiles);
} }
// documentation inherited // documentation inherited
public int getColumnCount () public int getColumnCount () {
{
return 1; return 1;
} }
@Override @Override
public String getColumnName (int columnIndex) public String getColumnName (int columnIndex) {
{
return null; return null;
} }
// documentation inherited // documentation inherited
public int getRowCount () public int getRowCount () {
{
return getTileCount(); return getTileCount();
} }
// documentation inherited // documentation inherited
public Object getValueAt (int row, int col) public Object getValueAt (int row, int col) {
{
// return the icon immediately if it's already cached // return the icon immediately if it's already cached
if (_icons[row] != null) { if (_icons[row] != null) {
return _icons[row]; return _icons[row];
@@ -646,16 +618,14 @@ public class TileInfoPanel extends JSplitPane
int hei = getScaledTileImageHeight(img); int hei = getScaledTileImageHeight(img);
if (hei != img.getHeight(null)) { if (hei != img.getHeight(null)) {
img = img.getScaledInstance( img = img.getScaledInstance(_tablewid, hei, Image.SCALE_SMOOTH);
_tablewid, hei, Image.SCALE_SMOOTH);
} }
return (_icons[row] = new ImageIcon(img)); return (_icons[row] = new ImageIcon(img));
} }
@Override @Override
public Class<?> getColumnClass (int c) public Class<?> getColumnClass (int c) {
{
// return the object associated with the column to force // return the object associated with the column to force
// rendering of our icon images rather than straight text // rendering of our icon images rather than straight text
return getValueAt(0, c).getClass(); return getValueAt(0, c).getClass();
@@ -675,8 +645,7 @@ public class TileInfoPanel extends JSplitPane
public TileSet tileSet; public TileSet tileSet;
public String shortname; public String shortname;
public TileSetRecord (int layer, int tileSetId, TileSet tileSet) public TileSetRecord (int layer, int tileSetId, TileSet tileSet) {
{
this.layer = layer; this.layer = layer;
this.tileSetId = tileSetId; this.tileSetId = tileSetId;
this.tileSet = tileSet; this.tileSet = tileSet;
@@ -690,25 +659,21 @@ public class TileInfoPanel extends JSplitPane
} }
} }
public String fullname () public String fullname () {
{
return tileSet.getName(); return tileSet.getName();
} }
@Override @Override
public String toString () public String toString () {
{
return shortname; return shortname;
} }
public int compareTo (TileSetRecord o) public int compareTo (TileSetRecord o) {
{
return fullname().compareToIgnoreCase(o.fullname()); return fullname().compareToIgnoreCase(o.fullname());
} }
@Override @Override
public boolean equals (Object o) public boolean equals (Object o) {
{
if (o instanceof TileSetRecord) { if (o instanceof TileSetRecord) {
TileSetRecord tsr = (TileSetRecord) o; TileSetRecord tsr = (TileSetRecord) o;
return ((tsr.layer == layer) && (tsr.tileSetId == tileSetId)); return ((tsr.layer == layer) && (tsr.tileSetId == tileSetId));
@@ -717,8 +682,7 @@ public class TileInfoPanel extends JSplitPane
} }
@Override @Override
public int hashCode () public int hashCode () {
{
return Objects.hashCode(layer, tileSetId); return Objects.hashCode(layer, tileSetId);
} }
} }
@@ -732,7 +696,7 @@ public class TileInfoPanel extends JSplitPane
protected static final int EDGE_TILE_V = 4; protected static final int EDGE_TILE_V = 4;
/** An ArrayList of TileSetRecords for each layer. */ /** An ArrayList of TileSetRecords for each layer. */
protected Map<Integer,List<TileSetRecord>> _layerSets = Maps.newHashMap(); protected Map<Integer, List<TileSetRecord>> _layerSets = Maps.newHashMap();
/** Map of tileset ID to TreePath. */ /** Map of tileset ID to TreePath. */
protected Map<Integer, TreePath> _idToTreePathMap = Maps.newHashMap(); protected Map<Integer, TreePath> _idToTreePathMap = Maps.newHashMap();
@@ -101,9 +101,8 @@ public class SpotSceneRegistry extends SceneRegistry
// look up the scene manager for the specified scene // look up the scene manager for the specified scene
SpotSceneManager smgr = (SpotSceneManager)getSceneManager(sceneId); SpotSceneManager smgr = (SpotSceneManager)getSceneManager(sceneId);
if (smgr == null) { if (smgr == null) {
log.warning("User requested cluster chat in non-existent scene " + log.warning("User requested cluster chat in non-existent scene",
"[user=" + message.speaker + ", sceneId=" + sceneId + "user", message.speaker, "sceneId", sceneId, "message", message);
", message=" + message + "].");
return; return;
} }
@@ -120,9 +119,9 @@ public class SpotSceneRegistry extends SceneRegistry
BodyObject body = (BodyObject)caller; BodyObject body = (BodyObject)caller;
int cSceneId = ScenePlace.getSceneId(body); int cSceneId = ScenePlace.getSceneId(body);
if (cSceneId != sceneId) { if (cSceneId != sceneId) {
log.info("Ignoring stale traverse portal request [caller=" + caller.who() + log.info("Ignoring stale traverse portal request",
", oSceneId=" + sceneId + ", portalId=" + portalId + "caller", caller.who(), "oSceneId", sceneId, "portalId", portalId,
", cSceneId=" + cSceneId + "]."); "cSceneId", cSceneId);
listener.requestCancelled(); listener.requestCancelled();
return; return;
} }
@@ -130,9 +129,8 @@ public class SpotSceneRegistry extends SceneRegistry
// obtain the source scene // obtain the source scene
SpotSceneManager srcmgr = (SpotSceneManager)getSceneManager(sceneId); SpotSceneManager srcmgr = (SpotSceneManager)getSceneManager(sceneId);
if (srcmgr == null) { if (srcmgr == null) {
log.warning("Traverse portal missing source scene " + log.warning("Traverse portal missing source scene",
"[user=" + body.who() + ", sceneId=" + sceneId + "user", body.who(), "sceneId", sceneId, "portalId", portalId);
", portalId=" + portalId + "].");
throw new InvocationException(SpotCodes.INTERNAL_ERROR); throw new InvocationException(SpotCodes.INTERNAL_ERROR);
} }
@@ -148,9 +146,9 @@ public class SpotSceneRegistry extends SceneRegistry
// make sure this portal has valid info // make sure this portal has valid info
if (dest == null || !dest.isValid()) { if (dest == null || !dest.isValid()) {
log.warning("Traverse portal with invalid portal", "user", body.who(), log.warning("Traverse portal with invalid portal",
"scene", srcmgr.where(), "pid", portalId, "portal", dest, "user", body.who(), "scene", srcmgr.where(), "pid", portalId, "portal", dest,
"portals", rss.getPortals()); "portals", rss.getPortals());
throw new InvocationException(SpotCodes.NO_SUCH_PORTAL); throw new InvocationException(SpotCodes.NO_SUCH_PORTAL);
} }
@@ -167,16 +165,16 @@ public class SpotSceneRegistry extends SceneRegistry
BodyObject source = (BodyObject)caller; BodyObject source = (BodyObject)caller;
int cSceneId = ScenePlace.getSceneId(source); int cSceneId = ScenePlace.getSceneId(source);
if (cSceneId != sceneId) { if (cSceneId != sceneId) {
log.info("Rejecting changeLocation for invalid scene [user=" + source.who() + log.info("Rejecting changeLocation for invalid scene",
", insid=" + cSceneId + ", wantsid=" + sceneId + ", loc=" + loc + "]."); "user", source.who(), "insid", cSceneId, "wantsid", sceneId, "loc", loc);
throw new InvocationException(SpotCodes.INVALID_LOCATION); throw new InvocationException(SpotCodes.INVALID_LOCATION);
} }
// look up the scene manager for the specified scene // look up the scene manager for the specified scene
SpotSceneManager smgr = (SpotSceneManager)getSceneManager(sceneId); SpotSceneManager smgr = (SpotSceneManager)getSceneManager(sceneId);
if (smgr == null) { if (smgr == null) {
log.warning("User requested to change location from non-existent scene " + log.warning("User requested to change location from non-existent scene",
"[user=" + source.who() + ", sceneId=" + sceneId + ", loc=" + loc +"]."); "user", source.who(), "sceneId", sceneId, "loc", loc);
throw new InvocationException(SpotCodes.INTERNAL_ERROR); throw new InvocationException(SpotCodes.INTERNAL_ERROR);
} }
@@ -198,9 +196,8 @@ public class SpotSceneRegistry extends SceneRegistry
// look up the scene manager for the specified scene // look up the scene manager for the specified scene
SpotSceneManager smgr = (SpotSceneManager)getSceneManager(sceneId); SpotSceneManager smgr = (SpotSceneManager)getSceneManager(sceneId);
if (smgr == null) { if (smgr == null) {
log.warning("User requested to join cluster from non-existent scene " + log.warning("User requested to join cluster from non-existent scene",
"[user=" + source.who() + ", sceneId=" + sceneId + "user", source.who(), "sceneId", sceneId, "foid", friendOid);
", foid=" + friendOid +"].");
throw new InvocationException(SpotCodes.INTERNAL_ERROR); throw new InvocationException(SpotCodes.INTERNAL_ERROR);
} }