From: <aki...@us...> - 2006-12-17 12:24:20
|
Revision: 1128 http://svn.sourceforge.net/gridarta/?rev=1128&view=rev Author: akirschbaum Date: 2006-12-17 04:24:20 -0800 (Sun, 17 Dec 2006) Log Message: ----------- Unify code. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMapTileList.java trunk/daimonin/src/daieditor/CMapTileList.java Modified: trunk/crossfire/src/cfeditor/CMapTileList.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapTileList.java 2006-12-17 12:16:48 UTC (rev 1127) +++ trunk/crossfire/src/cfeditor/CMapTileList.java 2006-12-17 12:24:20 UTC (rev 1128) @@ -95,8 +95,8 @@ /** * Create a CMapTileList. - * @param mainControl MainControl, used for some icons. - * @param mainView View to attach to. + * @param mainControl MainControl, used for icons + * @param mainView MainView, used for updating UI */ public CMapTileList(final CMainControl mainControl, final CMainView mainView) { this.mainControl = mainControl; @@ -112,11 +112,11 @@ scrollPane.getViewport().setScrollMode(SIMPLE_SCROLL_MODE); add(scrollPane, BorderLayout.CENTER); - final JPanel dummy = new JPanel(); + final JPanel arrows = new JPanel(); if (mainView.isMapTileListBottom()) { - dummy.setLayout(new GridLayout(2, 1)); + arrows.setLayout(new GridLayout(2, 1)); } - final JScrollPane scrollPane2 = new JScrollPane(dummy); + final JScrollPane scrollPane2 = new JScrollPane(arrows); scrollPane2.setVerticalScrollBarPolicy(VERTICAL_SCROLLBAR_NEVER); scrollPane2.setHorizontalScrollBarPolicy(HORIZONTAL_SCROLLBAR_NEVER); scrollPane2.getViewport().setScrollMode(SIMPLE_SCROLL_MODE); @@ -141,7 +141,7 @@ buttonDown.setVerticalTextPosition(SwingConstants.BOTTOM); buttonDown.setHorizontalTextPosition(SwingConstants.CENTER); if (!mainView.isMapTileListBottom()) { - dummy.add(buttonDown, BorderLayout.EAST); + arrows.add(buttonDown, BorderLayout.EAST); } final CFancyButton buttonUp = new CFancyButton(null, "Move Tile Position Up", @@ -158,10 +158,10 @@ buttonUp.setVerticalTextPosition(SwingConstants.BOTTOM); buttonUp.setHorizontalTextPosition(SwingConstants.CENTER); if (!mainView.isMapTileListBottom()) { - dummy.add(buttonUp, BorderLayout.WEST); + arrows.add(buttonUp, BorderLayout.WEST); } else { - dummy.add(buttonUp); - dummy.add(buttonDown); + arrows.add(buttonUp); + arrows.add(buttonDown); } list.addListSelectionListener(new ListSelectionListener() { @@ -375,14 +375,14 @@ */ private int addInvObjects(final GameObject node, final GameObject gameObject) { int selListCounter = -1; - for (final GameObject invItem : node.getHead()) { - if (invItem == gameObject) { + for (final GameObject invObject : node.getHead()) { + if (invObject == gameObject) { selListCounter = listCounter; } listCounter++; - model.addElement(invItem); + model.addElement(invObject); - final int tmpListCounter = addInvObjects(invItem, gameObject); + final int tmpListCounter = addInvObjects(invObject, gameObject); if (tmpListCounter != -1) { selListCounter = tmpListCounter; } Modified: trunk/daimonin/src/daieditor/CMapTileList.java =================================================================== --- trunk/daimonin/src/daieditor/CMapTileList.java 2006-12-17 12:16:48 UTC (rev 1127) +++ trunk/daimonin/src/daieditor/CMapTileList.java 2006-12-17 12:24:20 UTC (rev 1128) @@ -58,6 +58,7 @@ import net.sf.japi.swing.ActionFactory; import net.sf.japi.swing.ActionMethod; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; /** * The panel that displays the arches of the currently selected map square. @@ -90,11 +91,10 @@ private transient MapSquare<GameObject> currentSquare; /** - * Creates a CMapTileList. - * @param mainControl MainControl, used for icons. - * @param mainView MainView, used for updating UI. + * Create a CMapTileList. + * @param mainControl MainControl, used for icons + * @param mainView MainView, used for updating UI */ - /** Build Panel. */ public CMapTileList(final CMainControl mainControl, final CMainView mainView) { this.mainControl = mainControl; this.mainView = mainView; @@ -283,7 +283,7 @@ * Return the currently selected GameObject within this list (currently selected MapSquare). * @return the currently selected GameObject */ - public GameObject getMapTileSelection() { + @Nullable public GameObject getMapTileSelection() { return (GameObject) list.getSelectedValue(); } @@ -393,14 +393,14 @@ */ private int addInvObjects(final GameObject node, final GameObject gameObject) { int selListCounter = -1; - for (GameObject arch : node.reverse()) { - if (arch == gameObject) { + for (final GameObject invObject : node.reverse()) { + if (invObject == gameObject) { selListCounter = listCounter; } listCounter++; - model.addElement(arch); + model.addElement(invObject); - final int tmpListCounter = addInvObjects(arch, gameObject); + final int tmpListCounter = addInvObjects(invObject, gameObject); if (tmpListCounter != -1) { selListCounter = tmpListCounter; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |