[Picross-commit] SF.net SVN: picross: [87] trunk
Status: Pre-Alpha
Brought to you by:
yvan_norsa
|
From: <yva...@us...> - 2008-05-16 07:28:03
|
Revision: 87
http://picross.svn.sourceforge.net/picross/?rev=87&view=rev
Author: yvan_norsa
Date: 2008-05-16 00:28:03 -0700 (Fri, 16 May 2008)
Log Message:
-----------
clean-up, refactorisation
Modified Paths:
--------------
trunk/lib/mmvcs.jar
trunk/src/picross/PicrossUI.java
trunk/src/picross/app/PicrossAppUI.java
trunk/src/picross/applet/PicrossApplet.java
trunk/src/picross/game/GameController.java
trunk/src/picross/game/GameMediator.java
trunk/src/picross/game/GameUI.java
trunk/src/picross/game/random/RandomGameMediator.java
trunk/src/picross/game/random/RandomGameUI.java
trunk/src/picross/grid/GridController.java
trunk/src/picross/grid/GridMediator.java
trunk/src/picross/grid/GridUI.java
trunk/src/picross/grid/IGridMediator.java
trunk/src/picross/grid/tests/IGridMediatorStub.java
trunk/src/picross/menus/MenuUI.java
Added Paths:
-----------
trunk/src/picross/PicrossView.java
trunk/src/picross/game/GameView.java
trunk/src/picross/grid/GridView.java
Modified: trunk/lib/mmvcs.jar
===================================================================
(Binary files differ)
Modified: trunk/src/picross/PicrossUI.java
===================================================================
--- trunk/src/picross/PicrossUI.java 2008-05-14 12:50:47 UTC (rev 86)
+++ trunk/src/picross/PicrossUI.java 2008-05-16 07:28:03 UTC (rev 87)
@@ -1,7 +1,7 @@
/*
* $Id$
*
- * Copyright (c) 2007
+ * Copyright (c) 2007-2008
*
* This software is governed by the CeCILL license under French law and
* abiding by the rules of distribution of free software. You can use,
@@ -33,8 +33,6 @@
package picross;
-import javax.swing.JPanel;
-
/**
* Main window.
*
@@ -46,7 +44,7 @@
*
* @param content new content panel
*/
- void setContent(JPanel content);
+ void setContent(PicrossView content);
/**
* Displays a message box.
Added: trunk/src/picross/PicrossView.java
===================================================================
--- trunk/src/picross/PicrossView.java (rev 0)
+++ trunk/src/picross/PicrossView.java 2008-05-16 07:28:03 UTC (rev 87)
@@ -0,0 +1,58 @@
+/*
+ * $Id$
+ *
+ * Copyright (c) 2008
+ *
+ * This software is governed by the CeCILL license under French law and
+ * abiding by the rules of distribution of free software. You can use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty and the software's author, the holder of the
+ * economic rights, and the successive licensors have only limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading, using, modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean that it is complicated to manipulate, and that also
+ * therefore means that it is reserved for developers and experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and, more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ */
+
+
+package picross;
+
+/**
+ * @author Y. Norsa
+ */
+public interface PicrossView {
+ /*** Constante ***/
+
+ /*** Champ statique ***/
+
+ /*** Champ ***/
+
+ /*** Constructeur ***/
+
+ /**
+ * Constructeur.
+ */
+ /*
+ PicrossView() {
+ }
+ */
+
+ /*** M\xE9thode ***/
+}
+
Property changes on: trunk/src/picross/PicrossView.java
___________________________________________________________________
Name: svn:keywords
+ Id
Modified: trunk/src/picross/app/PicrossAppUI.java
===================================================================
--- trunk/src/picross/app/PicrossAppUI.java 2008-05-14 12:50:47 UTC (rev 86)
+++ trunk/src/picross/app/PicrossAppUI.java 2008-05-16 07:28:03 UTC (rev 87)
@@ -33,11 +33,13 @@
package picross.app;
+import java.awt.Container;
+
import javax.swing.JFrame;
import javax.swing.JOptionPane;
-import javax.swing.JPanel;
import picross.PicrossUI;
+import picross.PicrossView;
/**
* Main window of the application version.
@@ -67,8 +69,8 @@
/** {@inheritDoc} */
@Override
- public void setContent(JPanel content) {
- this.setContentPane(content);
+ public void setContent(PicrossView content) {
+ this.setContentPane((Container) content);
this.pack();
}
Modified: trunk/src/picross/applet/PicrossApplet.java
===================================================================
--- trunk/src/picross/applet/PicrossApplet.java 2008-05-14 12:50:47 UTC (rev 86)
+++ trunk/src/picross/applet/PicrossApplet.java 2008-05-16 07:28:03 UTC (rev 87)
@@ -33,13 +33,15 @@
package picross.applet;
+import java.awt.Container;
+
import javax.swing.JApplet;
import javax.swing.JOptionPane;
-import javax.swing.JPanel;
import javax.swing.SwingUtilities;
import picross.PicrossMediator;
import picross.PicrossUI;
+import picross.PicrossView;
/**
* Main class of the applet version.
@@ -91,8 +93,8 @@
/** {@inheritDoc} */
@Override
- public void setContent(JPanel content) {
- this.setContentPane(content);
+ public void setContent(PicrossView content) {
+ this.setContentPane((Container) content);
this.validate();
}
Modified: trunk/src/picross/game/GameController.java
===================================================================
--- trunk/src/picross/game/GameController.java 2008-05-14 12:50:47 UTC (rev 86)
+++ trunk/src/picross/game/GameController.java 2008-05-16 07:28:03 UTC (rev 87)
@@ -71,7 +71,6 @@
if (cmd.equals(PicrossController.QUIT_CMD)) {
this.fireEventPerformed(cmd);
-
return;
}
}
Modified: trunk/src/picross/game/GameMediator.java
===================================================================
--- trunk/src/picross/game/GameMediator.java 2008-05-14 12:50:47 UTC (rev 86)
+++ trunk/src/picross/game/GameMediator.java 2008-05-16 07:28:03 UTC (rev 87)
@@ -38,7 +38,6 @@
import java.awt.event.ActionListener;
-import javax.swing.JPanel;
import javax.swing.SwingUtilities;
//import org.apache.log4j.Logger;
@@ -47,6 +46,8 @@
import picross.PicrossGrid;
import picross.grid.GridMediator;
+import picross.grid.GridView;
+import picross.grid.IGridMediator;
/**
* Handles a game.
@@ -59,11 +60,14 @@
/** The class' logger. */
//private static Logger log = Logger.getLogger(GameMediator.class);
- /*** Field ***/
+ /*** Fields ***/
/** The game view. */
private GameUI view;
+ /** The game grid. */
+ private IGridMediator grid;
+
/*** Abstrac method ***/
/**
@@ -98,9 +102,9 @@
final int width = model.getWidth();
final int height = model.getHeight();
- final GridMediator grid = new GridMediator(width, height,
+ this.grid = new GridMediator(width, height,
model.getData());
- grid.addSimpleListener(this);
+ this.grid.addSimpleListener(this);
final GameController controller = this.initController();
controller.addSimpleListener(this);
@@ -109,9 +113,10 @@
SwingUtilities.invokeLater(new Runnable() {
public void run() {
GameMediator.this.view =
- GameMediator.this.initView(width, height,
- grid.getView(),
- controller);
+ GameMediator.this
+ .initView(width, height,
+ GameMediator.this.grid.getView(),
+ controller);
}
});
}
@@ -125,7 +130,7 @@
* @param controller controller for the grid buttons
* @return view containing the grid
*/
- protected GameUI initView(int width, int height, JPanel gridView,
+ protected GameUI initView(int width, int height, GridView gridView,
ActionListener controller) {
return new GameUI(width, height, gridView, controller);
}
@@ -144,7 +149,7 @@
*
* @return the view
*/
- public final JPanel getView() {
+ public final GameView getView() {
return this.view;
}
}
Modified: trunk/src/picross/game/GameUI.java
===================================================================
--- trunk/src/picross/game/GameUI.java 2008-05-14 12:50:47 UTC (rev 86)
+++ trunk/src/picross/game/GameUI.java 2008-05-16 07:28:03 UTC (rev 87)
@@ -37,6 +37,7 @@
import java.awt.BorderLayout;
import java.awt.Color;
+import java.awt.Component;
import java.awt.FlowLayout;
import java.awt.event.ActionListener;
@@ -49,12 +50,14 @@
import picross.PicrossController;
+import picross.grid.GridView;
+
/**
* The game UI.
*
* @author Y. Norsa
*/
-public class GameUI extends JPanel {
+public class GameUI extends JPanel implements GameView {
/*** Constant ***/
/** Serialisation ID. */
@@ -75,7 +78,8 @@
* @param grid the grid
* @param listener listener for the buttons
*/
- public GameUI(int width, int height, JPanel grid,
+ //public GameUI(int width, int height, JPanel grid,
+ public GameUI(int width, int height, GridView grid,
ActionListener listener) {
super();
@@ -115,7 +119,7 @@
topPanel.add(contentPanel, BorderLayout.LINE_START);
this.add(topPanel, BorderLayout.PAGE_START);
- this.add(grid, BorderLayout.CENTER);
+ this.add((Component) grid, BorderLayout.CENTER);
}
/*** Method ***/
Added: trunk/src/picross/game/GameView.java
===================================================================
--- trunk/src/picross/game/GameView.java (rev 0)
+++ trunk/src/picross/game/GameView.java 2008-05-16 07:28:03 UTC (rev 87)
@@ -0,0 +1,60 @@
+/*
+ * $Id$
+ *
+ * Copyright (c) 2008
+ *
+ * This software is governed by the CeCILL license under French law and
+ * abiding by the rules of distribution of free software. You can use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty and the software's author, the holder of the
+ * economic rights, and the successive licensors have only limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading, using, modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean that it is complicated to manipulate, and that also
+ * therefore means that it is reserved for developers and experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and, more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ */
+
+
+package picross.game;
+
+import picross.PicrossView;
+
+/**
+ * @author Y. Norsa
+ */
+public interface GameView extends PicrossView {
+ /*** Constante ***/
+
+ /*** Champ statique ***/
+
+ /*** Champ ***/
+
+ /*** Constructeur ***/
+
+ /**
+ * Constructeur.
+ */
+ /*
+ GameView() {
+ }
+ */
+
+ /*** M\xE9thode ***/
+}
+
Property changes on: trunk/src/picross/game/GameView.java
___________________________________________________________________
Name: svn:keywords
+ Id
Modified: trunk/src/picross/game/random/RandomGameMediator.java
===================================================================
--- trunk/src/picross/game/random/RandomGameMediator.java 2008-05-14 12:50:47 UTC (rev 86)
+++ trunk/src/picross/game/random/RandomGameMediator.java 2008-05-16 07:28:03 UTC (rev 87)
@@ -37,8 +37,6 @@
import java.awt.event.ActionListener;
-import javax.swing.JPanel;
-
//import org.apache.log4j.Logger;
import picross.PicrossGrid;
@@ -47,6 +45,8 @@
import picross.game.GameMediator;
import picross.game.GameUI;
+import picross.grid.GridView;
+
/**
* This object handles a random grid game.
*
@@ -62,7 +62,7 @@
/** {@inheritDoc} */
@Override
- protected GameUI initView(int width, int height, JPanel gridView,
+ protected GameUI initView(int width, int height, GridView gridView,
ActionListener controller) {
return new RandomGameUI(width, height, gridView,
controller);
@@ -71,10 +71,7 @@
/** {@inheritDoc} */
@Override
protected GameController initController() {
- RandomGameController controller = new RandomGameController();
- controller.addSimpleListener(this);
-
- return controller;
+ return new RandomGameController();
}
/** {@inheritDoc} */
Modified: trunk/src/picross/game/random/RandomGameUI.java
===================================================================
--- trunk/src/picross/game/random/RandomGameUI.java 2008-05-14 12:50:47 UTC (rev 86)
+++ trunk/src/picross/game/random/RandomGameUI.java 2008-05-16 07:28:03 UTC (rev 87)
@@ -38,10 +38,11 @@
import java.awt.event.ActionListener;
import javax.swing.JButton;
-import javax.swing.JPanel;
import picross.game.GameUI;
+import picross.grid.GridView;
+
/**
* Custom UI for a random game.
*
@@ -63,7 +64,7 @@
* @param grid the grid
* @param controller the UI controller
*/
- RandomGameUI(int width, int height, JPanel grid,
+ RandomGameUI(int width, int height, GridView grid,
ActionListener controller) {
super(width, height, grid, controller);
Modified: trunk/src/picross/grid/GridController.java
===================================================================
--- trunk/src/picross/grid/GridController.java 2008-05-14 12:50:47 UTC (rev 86)
+++ trunk/src/picross/grid/GridController.java 2008-05-16 07:28:03 UTC (rev 87)
@@ -117,12 +117,14 @@
if (cmd.equals(GridController.REPAINT_TOP_HINTS_CMD)) {
int col = ((RepaintTopHintsCommand) e.getCommand()).getColumn();
this.view.repaintColHints(col);
+
return;
}
if (cmd.equals(GridController.REPAINT_LEFT_HINTS_CMD)) {
int row = ((RepaintLeftHintsCommand) e.getCommand()).getRow();
this.view.repaintRowHints(row);
+
return;
}
Modified: trunk/src/picross/grid/GridMediator.java
===================================================================
--- trunk/src/picross/grid/GridMediator.java 2008-05-14 12:50:47 UTC (rev 86)
+++ trunk/src/picross/grid/GridMediator.java 2008-05-16 07:28:03 UTC (rev 87)
@@ -40,7 +40,6 @@
import java.lang.reflect.InvocationTargetException;
-import javax.swing.JPanel;
import javax.swing.SwingUtilities;
//import org.apache.log4j.Logger;
@@ -157,15 +156,13 @@
/** {@inheritDoc} */
@Override
public void repaintColHints(int column) {
- this.fireEventPerformed(//GridController.REPAINT_TOP_HINTS_CMD);
- new RepaintTopHintsCommand(column));
+ this.fireEventPerformed(new RepaintTopHintsCommand(column));
}
/** {@inheritDoc} */
@Override
public void repaintRowHints(int row) {
- this.fireEventPerformed(//GridController.REPAINT_LEFT_HINTS_CMD);
- new RepaintLeftHintsCommand(row));
+ this.fireEventPerformed(new RepaintLeftHintsCommand(row));
}
/** {@inheritDoc} */
@@ -181,7 +178,7 @@
*
* @return the grid view
*/
- public JPanel getView() {
+ public GridView getView() {
return this.view;
}
}
Modified: trunk/src/picross/grid/GridUI.java
===================================================================
--- trunk/src/picross/grid/GridUI.java 2008-05-14 12:50:47 UTC (rev 86)
+++ trunk/src/picross/grid/GridUI.java 2008-05-16 07:28:03 UTC (rev 87)
@@ -65,7 +65,7 @@
*
* @author Y. Norsa
*/
-final class GridUI extends JPanel {
+final class GridUI extends JPanel implements GridView {
/*** Constants ***/
/** Serialisation ID. */
Added: trunk/src/picross/grid/GridView.java
===================================================================
--- trunk/src/picross/grid/GridView.java (rev 0)
+++ trunk/src/picross/grid/GridView.java 2008-05-16 07:28:03 UTC (rev 87)
@@ -0,0 +1,41 @@
+/*
+ * $Id$
+ *
+ * Copyright (c) 2008
+ *
+ * This software is governed by the CeCILL license under French law and
+ * abiding by the rules of distribution of free software. You can use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty and the software's author, the holder of the
+ * economic rights, and the successive licensors have only limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading, using, modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean that it is complicated to manipulate, and that also
+ * therefore means that it is reserved for developers and experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and, more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ */
+
+
+package picross.grid;
+
+/**
+ * @author Y. Norsa
+ */
+public interface GridView { }
+
+
Property changes on: trunk/src/picross/grid/GridView.java
___________________________________________________________________
Name: svn:keywords
+ Id
Modified: trunk/src/picross/grid/IGridMediator.java
===================================================================
--- trunk/src/picross/grid/IGridMediator.java 2008-05-14 12:50:47 UTC (rev 86)
+++ trunk/src/picross/grid/IGridMediator.java 2008-05-16 07:28:03 UTC (rev 87)
@@ -33,10 +33,14 @@
package picross.grid;
+import fr.cle.mmvcs.IMediateur;
+
/**
+ * Mediator for the grid.
+ *
* @author Y. Norsa
*/
-public interface IGridMediator {
+public interface IGridMediator extends IMediateur {
/**
* Asks to repaint a box.
*
@@ -56,5 +60,12 @@
/** Enables the erase mode. */
void setEraseMode();
+
+ /**
+ * Returns the grid view.
+ *
+ * @return view of the grid
+ */
+ GridView getView();
}
Modified: trunk/src/picross/grid/tests/IGridMediatorStub.java
===================================================================
--- trunk/src/picross/grid/tests/IGridMediatorStub.java 2008-05-14 12:50:47 UTC (rev 86)
+++ trunk/src/picross/grid/tests/IGridMediatorStub.java 2008-05-16 07:28:03 UTC (rev 87)
@@ -33,6 +33,10 @@
package picross.grid.tests;
+import fr.cle.mmvcs.SimpleEvent;
+import fr.cle.mmvcs.SimpleListener;
+
+import picross.grid.GridView;
import picross.grid.IGridMediator;
/**
@@ -66,5 +70,16 @@
public void congratulations() { }
public void setEraseMode() { }
+
+ public GridView getView() {
+ return null;
+ }
+
+ public void eventPerformed(SimpleEvent e) {
+ }
+
+ public void addSimpleListener(SimpleListener listener) { }
+
+ public void removeSimpleListener(SimpleListener listener) { }
}
Modified: trunk/src/picross/menus/MenuUI.java
===================================================================
--- trunk/src/picross/menus/MenuUI.java 2008-05-14 12:50:47 UTC (rev 86)
+++ trunk/src/picross/menus/MenuUI.java 2008-05-16 07:28:03 UTC (rev 87)
@@ -54,13 +54,14 @@
import picross.MissingImageException;
import picross.Picross;
+import picross.PicrossView;
/**
* Base class for menus.
*
* @author Y. Norsa
*/
-public abstract class MenuUI extends JPanel {
+public abstract class MenuUI extends JPanel implements PicrossView {
/*** Constants ***/
/** Background image. */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|