[Picross-commit] SF.net SVN: picross:[117] branches/engine_split
Status: Pre-Alpha
Brought to you by:
yvan_norsa
From: <yva...@us...> - 2013-01-14 13:23:57
|
Revision: 117 http://sourceforge.net/p/picross/code/117 Author: yvan_norsa Date: 2013-01-14 13:23:53 +0000 (Mon, 14 Jan 2013) Log Message: ----------- more android version Modified Paths: -------------- branches/engine_split/android/src/picross/specific/activities/PicrossActivityUI.java branches/engine_split/android/src/picross/specific/game/random/ui/RandomGameMediator.java branches/engine_split/android/src/picross/specific/game/random/ui/RandomGameModeUI.java branches/engine_split/android/src/picross/specific/game/random/ui/RandomGameUI.java branches/engine_split/android/src/picross/specific/game/simple/ui/SimpleGameModeUI.java branches/engine_split/android/src/picross/specific/game/ui/GameMediator.java branches/engine_split/android/src/picross/specific/game/ui/GameUI.java branches/engine_split/android/src/picross/specific/game/ui/UIGameMode.java branches/engine_split/android/src/picross/specific/ui/GameMenuUI.java branches/engine_split/android/src/picross/specific/ui/PicrossMediator.java branches/engine_split/swing/src/picross/specific/grid/ui/GridController.java branches/engine_split/swing/src/picross/specific/grid/ui/GridMediator.java branches/engine_split/swing/src/picross/specific/grid/ui/GridUI.java branches/engine_split/swing/src/picross/specific/grid/ui/UIBox.java Added Paths: ----------- branches/engine_split/android/src/picross/specific/game/random/ui/RandomGameController.java branches/engine_split/android/src/picross/specific/game/ui/GameController.java branches/engine_split/android/src/picross/specific/grid/ branches/engine_split/android/src/picross/specific/grid/ui/ branches/engine_split/android/src/picross/specific/grid/ui/GridController.java branches/engine_split/android/src/picross/specific/grid/ui/GridMediator.java branches/engine_split/android/src/picross/specific/grid/ui/GridUI.java branches/engine_split/android/src/picross/specific/grid/ui/HintBoxInfos.java branches/engine_split/android/src/picross/specific/grid/ui/UIBox.java branches/engine_split/common/src/picross/common/grid/ui/AbstractGridMediator.java branches/engine_split/common/src/picross/specific/grid/ branches/engine_split/common/src/picross/specific/grid/ui/ branches/engine_split/common/src/picross/specific/grid/ui/GridController.java branches/engine_split/common/src/picross/specific/grid/ui/GridUI.java branches/engine_split/common/src/picross/specific/grid/ui/UIBox.java Modified: branches/engine_split/android/src/picross/specific/activities/PicrossActivityUI.java =================================================================== --- branches/engine_split/android/src/picross/specific/activities/PicrossActivityUI.java 2013-01-14 10:48:50 UTC (rev 116) +++ branches/engine_split/android/src/picross/specific/activities/PicrossActivityUI.java 2013-01-14 13:23:53 UTC (rev 117) @@ -73,10 +73,14 @@ @Override public void displayMessage(String msg) { PicrossLogHelper.getLogger().debug("displayMessage(" + msg + ")"); + + // FIXME + /* AlertDialog.Builder builder = new AlertDialog.Builder(this.activity); builder.setMessage(msg) .setTitle("Picross"); AlertDialog dialog = builder.create(); + */ } /** {@inheritDoc} */ Added: branches/engine_split/android/src/picross/specific/game/random/ui/RandomGameController.java =================================================================== --- branches/engine_split/android/src/picross/specific/game/random/ui/RandomGameController.java (rev 0) +++ branches/engine_split/android/src/picross/specific/game/random/ui/RandomGameController.java 2013-01-14 13:23:53 UTC (rev 117) @@ -0,0 +1,70 @@ +/* + * $Id$ + * + * Copyright (c) 2007-2011 + * + * 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.specific.game.random.ui; + +import picross.specific.game.ui.GameController; + +/** + * Controller for the random game UI. + * + * @author Y. Norsa + */ +final class RandomGameController extends GameController { + /*** Constant ***/ + + /** Command asking to create another grid. */ + static final String NEXT_CMD = "NEXT_CMD"; + + /** Random game command. */ + static final String RANDOM_GAME_CMD = "RANDOM_GAME_CMD"; + + /*** Method overloaded from the class Controller ***/ + + /** {@inheritDoc} */ + // FIXME + /* + @Override + public void actionPerformed(ActionEvent e) { + String cmd = e.getActionCommand(); + + if (cmd.equals(RandomGameController.NEXT_CMD)) { + this.fireEventPerformed(cmd); + + return; + } + + super.actionPerformed(e); + } + */ +} Property changes on: branches/engine_split/android/src/picross/specific/game/random/ui/RandomGameController.java ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Modified: branches/engine_split/android/src/picross/specific/game/random/ui/RandomGameMediator.java =================================================================== --- branches/engine_split/android/src/picross/specific/game/random/ui/RandomGameMediator.java 2013-01-14 10:48:50 UTC (rev 116) +++ branches/engine_split/android/src/picross/specific/game/random/ui/RandomGameMediator.java 2013-01-14 13:23:53 UTC (rev 117) @@ -37,7 +37,7 @@ import picross.engine.game.random.RandomPicrossModel; -//import picross.specific.game.ui.GameController; +import picross.specific.game.ui.GameController; import picross.specific.game.ui.GameMediator; import picross.specific.game.ui.GameUI; @@ -47,52 +47,51 @@ import picross.specific.ui.MenuController; +import android.content.Context; + /** * This object handles a random grid game. * * @author Y. Norsa */ public final class RandomGameMediator extends GameMediator { + public RandomGameMediator(Context context) { + super(context); + } + /*** Methods overloaded from the class GameMediator ***/ /** {@inheritDoc} */ - /* @Override protected GameUI initView(int width, int height, GridView gridView, MenuController controller) { - return new RandomGameUI(width, height, gridView, + return new RandomGameUI(this.context, width, height, gridView, controller); } - */ + /** {@inheritDoc} */ - // FIXME - /* @Override protected GameController initController() { return new RandomGameController(); } - */ + /** {@inheritDoc} */ @Override protected PicrossGrid initModel() { - // FIXME - //return new RandomPicrossModel(); - return null; + return new RandomPicrossModel(); } /** {@inheritDoc} */ @Override public void eventPerformed(SimpleEvent e) { String cmd = e.getCommandName(); - // FIXME - /* if (cmd.equals(RandomGameController.NEXT_CMD)) { this.fireEventPerformed(RandomGameModeUI.getRandomGameCommand()); return; } - */ + // We want to relay other events, such as GRID_FILLED_CMD super.eventPerformed(e); } Modified: branches/engine_split/android/src/picross/specific/game/random/ui/RandomGameModeUI.java =================================================================== --- branches/engine_split/android/src/picross/specific/game/random/ui/RandomGameModeUI.java 2013-01-14 10:48:50 UTC (rev 116) +++ branches/engine_split/android/src/picross/specific/game/random/ui/RandomGameModeUI.java 2013-01-14 13:23:53 UTC (rev 117) @@ -47,6 +47,8 @@ import picross.specific.activities.R; +import android.content.Context; + /** * Random game mode. * @@ -73,8 +75,8 @@ * * @return a game command for a new random grid */ - public static GameCommand getRandomGameCommand() { - return new GameCommand(new RandomGameMediator()); + public static GameCommand getRandomGameCommand(Context context) { + return new GameCommand(new RandomGameMediator(context)); } /*** Method implanted from the interface GameMode ***/ @@ -82,9 +84,9 @@ /** {@inheritDoc} */ @Override //public SimpleButton<JButton> getButton() { - public PicrossButton getButton() { + public PicrossButton getButton(Context context) { SimpleEvent event = - new SimpleEvent(RandomGameModeUI.getRandomGameCommand()); + new SimpleEvent(RandomGameModeUI.getRandomGameCommand(context)); // FIXME /* ImageIcon icon = Modified: branches/engine_split/android/src/picross/specific/game/random/ui/RandomGameUI.java =================================================================== --- branches/engine_split/android/src/picross/specific/game/random/ui/RandomGameUI.java 2013-01-14 10:48:50 UTC (rev 116) +++ branches/engine_split/android/src/picross/specific/game/random/ui/RandomGameUI.java 2013-01-14 13:23:53 UTC (rev 117) @@ -41,6 +41,8 @@ import picross.specific.ui.MenuController; +import android.content.Context; + /** * Custom UI for a random game. * @@ -62,9 +64,9 @@ * @param grid the grid * @param controller the UI controller */ - RandomGameUI(int width, int height, GridView grid, + RandomGameUI(Context context, int width, int height, GridView grid, MenuController controller) { - super(width, height, grid, controller); + super(context, width, height, grid, controller); // FIXME /* Modified: branches/engine_split/android/src/picross/specific/game/simple/ui/SimpleGameModeUI.java =================================================================== --- branches/engine_split/android/src/picross/specific/game/simple/ui/SimpleGameModeUI.java 2013-01-14 10:48:50 UTC (rev 116) +++ branches/engine_split/android/src/picross/specific/game/simple/ui/SimpleGameModeUI.java 2013-01-14 13:23:53 UTC (rev 117) @@ -50,6 +50,8 @@ import picross.specific.activities.R; +import android.content.Context; + /** * Simple game mode. * @@ -74,7 +76,7 @@ /** {@inheritDoc} */ @Override //public SimpleButton<JButton> getButton() { - public PicrossButton getButton() { + public PicrossButton getButton(Context context) { //ImageIcon icon = //PicrossUIHelper.getLocalizedImage(SimpleGameModeUI.SELECT_BUTTON_IMAGE); SimpleEvent event = Added: branches/engine_split/android/src/picross/specific/game/ui/GameController.java =================================================================== --- branches/engine_split/android/src/picross/specific/game/ui/GameController.java (rev 0) +++ branches/engine_split/android/src/picross/specific/game/ui/GameController.java 2013-01-14 13:23:53 UTC (rev 117) @@ -0,0 +1,81 @@ +/* + * $Id$ + * + * Copyright (c) 2008-2011 + * + * 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.specific.game.ui; + +import fr.cle.mmvcs.Controller; +import fr.cle.mmvcs.SimpleEvent; + +import picross.engine.PicrossLogger; +import picross.engine.PicrossLogHelper; + +import picross.common.ui.PicrossController; + +import picross.specific.ui.MenuController; + +/** + * Controller for the game. + * + * @author Y. Norsa + */ +public class GameController extends MenuController {//implements ActionListener { + /*** Static field ***/ + + /** The class' logger. */ + private static PicrossLogger log = PicrossLogHelper.getLogger(); + + /*** Method overloaded from the class Controller ***/ + + /** {@inheritDoc} */ + @Override + public void eventPerformed(SimpleEvent e) { } + + /*** Method implanted from the interface ActionListener ***/ + + /** {@inheritDoc} */ + // FIXME + /* + @Override + public void actionPerformed(ActionEvent e) { + GameController.log.debug("actionPerformed(" + e + ")"); + + String cmd = e.getActionCommand(); + + if (cmd.equals(PicrossController.QUIT_CMD)) { + this.fireEventPerformed(cmd); + return; + } + } + */ +} + Property changes on: branches/engine_split/android/src/picross/specific/game/ui/GameController.java ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Modified: branches/engine_split/android/src/picross/specific/game/ui/GameMediator.java =================================================================== --- branches/engine_split/android/src/picross/specific/game/ui/GameMediator.java 2013-01-14 10:48:50 UTC (rev 116) +++ branches/engine_split/android/src/picross/specific/game/ui/GameMediator.java 2013-01-14 13:23:53 UTC (rev 117) @@ -42,12 +42,16 @@ import picross.engine.grid.PicrossGrid; -//import picross.specific.grid.ui.GridMediator; +import picross.specific.grid.ui.GridMediator; import picross.common.grid.ui.GridView; import picross.common.grid.ui.IGridMediator; import picross.common.game.ui.GameView; +import android.content.Context; + +import picross.specific.ui.MenuController; + public abstract class GameMediator extends Mediateur { /*** Static field ***/ @@ -57,13 +61,19 @@ /*** Fields ***/ /** The game view. */ - //private GameUI view; + private GameUI view; /** The game grid. */ private IGridMediator grid; - /*** Abstrac method ***/ + protected Context context; + public GameMediator(Context androidContext) { + this.context = androidContext; + } + + /*** Abstract method ***/ + /** * Creates the model. * @@ -77,7 +87,7 @@ /** {@inheritDoc} */ @Override public void eventPerformed(SimpleEvent e) { - //GameMediator.log.debug("eventPerformed(" + e + ")"); + GameMediator.log.debug("eventPerformed(" + e + ")"); this.fireEventPerformed(e); } @@ -95,19 +105,16 @@ final int width = model.getWidth(); final int height = model.getHeight(); - /* - this.grid = new GridMediator(width, height, + + this.grid = new GridMediator(this.context, width, height, model.getData()); - */ - // FIXME - //this.grid.addSimpleListener(this); + this.grid.addSimpleListener(this); - //final GameController controller = this.initController(); - // FIXME - //controller.addSimpleListener(this); + final GameController controller = this.initController(); + controller.addSimpleListener(this); // The view has to be init'ed on the EDT - //this.view = this.initView(width, height, this.grid.getView(), controller); + this.view = this.initView(width, height, this.grid.getView(), controller); } /** @@ -119,28 +126,27 @@ * @param controller controller for the grid buttons * @return view containing the grid */ - /* protected GameUI initView(int width, int height, GridView gridView, - ActionListener controller) { - return new GameUI(width, height, gridView, controller); + MenuController controller) { + return new GameUI(this.context, width, height, gridView, controller); } -*/ + /** * Initialises the controller. * * @return the created controller */ - /* + protected GameController initController() { return new GameController(); } - */ + /** * Returns the game view. * * @return the view */ - /* public final GameView getView() { + public final GameView getView() { return this.view; - }*/ } +} Modified: branches/engine_split/android/src/picross/specific/game/ui/GameUI.java =================================================================== --- branches/engine_split/android/src/picross/specific/game/ui/GameUI.java 2013-01-14 10:48:50 UTC (rev 116) +++ branches/engine_split/android/src/picross/specific/game/ui/GameUI.java 2013-01-14 13:23:53 UTC (rev 117) @@ -41,9 +41,12 @@ import picross.common.game.ui.GameView; +import picross.specific.ui.PicrossButton; +import android.content.Context; + import picross.specific.ui.MenuController; -import picross.specific.ui.PicrossButton; +import picross.specific.ui.PicrossAndroidView; /** * The game UI. @@ -51,17 +54,19 @@ * @author Y. Norsa */ // FIXME -public class GameUI /*extends JPanel*/ implements GameView { +public class GameUI extends PicrossAndroidView +/*extends JPanel*/ +implements GameView { /*** Constant ***/ - /** Serialisation ID. */ - private static final long serialVersionUID = 5888877041010228476L; /*** Field ***/ /** Panel holding the buttons. */ //private JPanel buttonsPanel; + private Context context; + /*** Constructor ***/ /** @@ -73,9 +78,11 @@ * @param listener listener for the buttons */ //public GameUI(int width, int height, JPanel grid, - public GameUI(int width, int height, GridView grid, + public GameUI(Context context, int width, int height, GridView grid, MenuController listener) { - super(); + super(context); + + this.context = context; // FIXME /* this.setLayout(new BorderLayout()); Modified: branches/engine_split/android/src/picross/specific/game/ui/UIGameMode.java =================================================================== --- branches/engine_split/android/src/picross/specific/game/ui/UIGameMode.java 2013-01-14 10:48:50 UTC (rev 116) +++ branches/engine_split/android/src/picross/specific/game/ui/UIGameMode.java 2013-01-14 13:23:53 UTC (rev 117) @@ -41,6 +41,8 @@ import picross.specific.ui.PicrossButton; +import android.content.Context; + /** * Service describing a game mode. * @@ -53,6 +55,6 @@ * @return a button that can be added to a menu */ //SimpleButton<JButton> getButton(); - PicrossButton getButton(); + PicrossButton getButton(Context context); } Added: branches/engine_split/android/src/picross/specific/grid/ui/GridController.java =================================================================== --- branches/engine_split/android/src/picross/specific/grid/ui/GridController.java (rev 0) +++ branches/engine_split/android/src/picross/specific/grid/ui/GridController.java 2013-01-14 13:23:53 UTC (rev 117) @@ -0,0 +1,245 @@ +/* + * $Id$ + * + * Copyright (c) 2007-2011 + * + * 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.specific.grid.ui; + +import fr.cle.mmvcs.Controller; +import fr.cle.mmvcs.SimpleEvent; + +import picross.common.grid.ui.FillCommand; +import picross.common.grid.ui.PaintCommand; +import picross.common.grid.ui.RepaintLeftHintsCommand; +import picross.common.grid.ui.RepaintTopHintsCommand; + +import picross.engine.grid.GridAction; + +import picross.common.grid.ui.GridCommands; + +/** + * Grid controller. + * + * @author Y. Norsa + */ +public final class GridController extends Controller + // FIXME +{//implements MouseListener, MouseMotionListener { + + /*** Fields ***/ + + /** The view to which the controller is attached. */ + private GridUI view = null; + + /** Indicates wether the erase mode is "on" or not. */ + private boolean eraseMode; + + /*** Method overloaded from the class Controller ***/ + + /** {@inheritDoc} */ + @Override + public void eventPerformed(SimpleEvent e) { + String cmd = e.getCommandName(); + + if (cmd.equals(GridCommands.GRID_FILLED_CMD)) { + this.view.rolloverEnded(); + this.view.disableGrid(); + + return; + } + + if (cmd.equals(GridCommands.PAINT_CMD)) { + PaintCommand command = (PaintCommand) e.getCommand(); + this.view.repaint(command.getRow(), command.getColumn()); + + return; + } + + if (cmd.equals(GridCommands.REPAINT_TOP_HINTS_CMD)) { + int col = ((RepaintTopHintsCommand) e.getCommand()).getColumn(); + this.view.repaintColHints(col); + + return; + } + + if (cmd.equals(GridCommands.REPAINT_LEFT_HINTS_CMD)) { + int row = ((RepaintLeftHintsCommand) e.getCommand()).getRow(); + this.view.repaintRowHints(row); + + return; + } + + if (cmd.equals(GridCommands.ERASE_MODE_CMD)) { + this.eraseMode = true; + return; + } + } + + /*** Methods implanted from the interface MouseListener ***/ + + /** {@inheritDoc} */ + /* + @Override + public void mouseClicked(MouseEvent e) { } + */ + /** {@inheritDoc} */ + /* + @Override + public void mouseEntered(MouseEvent e) { } + */ + /** {@inheritDoc} */ + /* + @Override + public void mouseExited(MouseEvent e) { + this.view.rolloverEnded(); + this.view.highlightEnded(); + } + */ + /** {@inheritDoc} */ + /* + @Override + public void mousePressed(MouseEvent e) { + this.view.rolloverEnded(); + } + */ + /** {@inheritDoc} */ + // FIXME + /* + @Override + public void mouseReleased(MouseEvent e) { + this.checkAndFill(e); + this.eraseMode = false; + this.fireEventPerformed(GridCommands.END_ACTION_CMD); + } + */ + /*** Methods implanted from the interface MouseMotionListener ***/ + + /** {@inheritDoc} */ + // FIXME + /* + @Override + public void mouseDragged(MouseEvent e) { + this.checkAndFill(e); + } + */ + /** {@inheritDoc} */ + // FIXME + /* + @Override + public void mouseMoved(MouseEvent e) { + Point point = e.getPoint(); + + if (this.view.isInGrid(point)) { + int row = this.view.getRow(point); + int column = this.view.getColumn(point); + + this.view.setRollover(row, column); + } else { + this.view.rolloverEnded(); + } + } + */ + /*** Methods ***/ + + /** + * Checks if the mouse current click's location is inside the grid + * and eventually fills the corresponding box. + * + * @param e mouse event to handle + */ + + // FIXME + /* + private void checkAndFill(MouseEvent e) { + int modifiers = e.getModifiers(); + + if (modifiers != MouseEvent.BUTTON1_MASK + && modifiers != MouseEvent.BUTTON3_MASK) { + + return; + } + + Point point = e.getPoint(); + + if (this.view.isInGrid(point)) { + int row = this.view.getRow(point); +- int column = this.view.getColumn(point); + + GridAction type; + + if (this.eraseMode) { + type = GridAction.EMPTY; + } else { + type = GridController.modifiersToType(modifiers); + } + + this.view.rolloverHighlight(row, column); + + this.fireEventPerformed(GridCommands.FILL_CMD, + new FillCommand(row, column, type)); + } else { + this.view.highlightEnded(); + } + } + */ + /** + * Converts a mouse click to an action. + * + * @param modifiers mouse event modifiers + * @return corresponding action, or -1 + */ + // FIXME + /* + private static GridAction modifiersToType(int modifiers) { + switch (modifiers) { + case MouseEvent.BUTTON1_MASK: + return GridAction.CHECK; + + case MouseEvent.BUTTON3_MASK: + return GridAction.CROSS; + + default: + return GridAction.UNKNOWN; + } + } + */ + /*** Accessor ***/ + + /** + * Allows to set the view. + * + * @param view view to which this controller is attached + */ + public void setView(GridUI view) { + this.view = view; + } +} + Property changes on: branches/engine_split/android/src/picross/specific/grid/ui/GridController.java ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Added: branches/engine_split/android/src/picross/specific/grid/ui/GridMediator.java =================================================================== --- branches/engine_split/android/src/picross/specific/grid/ui/GridMediator.java (rev 0) +++ branches/engine_split/android/src/picross/specific/grid/ui/GridMediator.java 2013-01-14 13:23:53 UTC (rev 117) @@ -0,0 +1,56 @@ +/* + * $Id$ + * + * Copyright (c) 2007-2011 + * + * 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.specific.grid.ui; + +import picross.common.grid.ui.AbstractGridMediator; + +import android.content.Context; + +import picross.engine.PicrossException; + +/** + * Picross grid mediator. + * + * @author Y. Norsa + */ +public final class GridMediator extends AbstractGridMediator { + private Context context; + + public GridMediator(Context context, final int width, final int height, boolean[][] data) throws PicrossException { + super(width, height, data); + + this.context = context; + } +} + Property changes on: branches/engine_split/android/src/picross/specific/grid/ui/GridMediator.java ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Added: branches/engine_split/android/src/picross/specific/grid/ui/GridUI.java =================================================================== --- branches/engine_split/android/src/picross/specific/grid/ui/GridUI.java (rev 0) +++ branches/engine_split/android/src/picross/specific/grid/ui/GridUI.java 2013-01-14 13:23:53 UTC (rev 117) @@ -0,0 +1,766 @@ +/* + * $Id$ + * + * Copyright (c) 2007-2011 + * + * 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.specific.grid.ui; + +import java.io.FileNotFoundException; + +import java.util.ArrayList; +import java.util.List; + +import picross.common.grid.ui.GridView; + +import picross.specific.ui.PicrossUIHelper; + +import picross.engine.grid.Box; +import picross.engine.grid.CompletedHints; +import picross.engine.grid.GridModel; + +/** + * Grid UI. + * + * @author Y. Norsa + */ +public final class GridUI /*extends JPanel*/ implements GridView { + /*** Constants ***/ + + /** Space left before the top hints. */ + private static final int TOP_HINTS = 10; + + /** Space left after the left hints. */ + private static final int LEFT_HINTS = 10; + + /** Color of the hints text. */ + //private static final Color HINT_TEXT_COLOR = new Color(233, 246, 255); + + /** Color of a completed hint text. */ + //private static final Color COMPLETED_HINT_COLOR = new Color(208, 215, 217); + + /** Font used for the hints. */ + /* + private static final Font HINT_FONT = + new Font("Sans Serif", Font.BOLD, 10); + */ + /** A box width. */ + private static final int BOX_WIDTH = 25; + + /** A box height. */ + private static final int BOX_HEIGHT = 25; + + /** Extra space at the right end of the grid. */ + private static final int RIGHT_SPACE = 5; + + /** Extra space at the bottom of the grid. */ + private static final int BOTTOM_SPACE = 5; + + /** Text used to compute the high hints boxes size. */ + private static final String HIGH_SAMPLE_HINT = "88"; + + /** Text used to compute the low hints boxes size. */ + private static final String LOW_SAMPLE_HINT = "8"; + + /** Hint box icon. */ + private static final String HINT_BOX_ICON = "hint.png"; + + /** Space between hint boxes. */ + private static final int HINTS_SPACE = 2; + + /** Boxes blocks color. */ + //private static final Color BLOCKS_COLOR = new Color(131, 155, 200); + + /** A block width. */ + private static final int BLOCK_WIDTH = 5; + + /** A block height. */ + private static final int BLOCK_HEIGHT = 5; + + /*** Fields ***/ + + /** Grid width. */ + private int width; + + /** Grid height. */ + private int height; + + /** Columns hints. */ + private int[][] colData; + + /** Rows hints. */ + private int[][] rowData; + + /** Amount of space left before the grid. */ + private int leftBoundary; + + /** Position of the right end of the grid. */ + private int rightBoundary; + + /** Amount of space left before the grid. */ + private int topBoundary; + + /** Position of the bottom end of the grid. */ + private int bottomBoundary; + + /** Top hints boxes. */ + private transient HintBoxInfos[] topHints; + + /** Left hints boxes. */ + private transient HintBoxInfos[] leftHints; + + /** Current state of the grid. */ + private transient UIBox[][] boxes; + + /** Current rolled-over box. */ + private transient UIBox rollover; + + /** Controller attached to this view. */ + private transient GridController controller; + + /** Hint box icon. */ + //private ImageIcon hintBoxIcon; + + /** X coordinate of the beginning of a top hints row. */ + private int topHintsX; + + /** Space left between two top hints. */ + private int topHintsDecal; + + /** Y coordinate of the beginning of a left hints column. */ + private int leftHintsY; + + /** Space left between two left hints. */ + private int leftHintsDecal; + + /** Used to center a hint vertically. */ + private int centerHintHeight; + + /** Used to center a low hint horizontally. */ + private int centerLowHintWidth; + + /** Used to center a high hint horizontally. */ + private int centerHighHintWidth; + + /** Boxes blocks. */ + //private List<Line2D> blocksLines; + + /** List of completed hints. */ + private transient CompletedHints completedHints; + + /** Index of the currently highlighted row. */ + private int rolloverRow = -1; + + /** Index of the currently highlighted column. */ + private int rolloverColumn = -1; + + /*** Constructor ***/ + + /** + * Constructor. + * + * @param width grid width + * @param height grid height + * @param boxes current state of the grid + * @param colData columns hints + * @param rowData rows hints + * @param completedHints list of completed hints + * @param controller controller for the grid + */ + public GridUI(int width, int height, + UIBox[][] boxes, + int[][] colData, + int[][] rowData, + CompletedHints completedHints, + GridController controller) { + // FIXME + //super(true); + + this.controller = controller; + + // FIXME + /* + this.addMouseListener(this.controller); + this.addMouseMotionListener(this.controller); + + this.setBackground(Color.WHITE); + this.setOpaque(true); + */ + this.width = width; + this.height = height; + + this.colData = colData; + this.rowData = rowData; + + this.completedHints = completedHints; + + // Contain the state of the grid + this.boxes = boxes; + } + + /*** Method overloaded from JPanel ***/ + + /** {@inheritDoc} */ + // FIXME + /* + @Override + protected void paintComponent(Graphics g) { + super.paintComponent(g); + + Graphics2D newG = (Graphics2D) g.create(); + + Rectangle clipRect = newG.getClipBounds(); + + for (int i = 0; i < this.topHints.length; i++) { + if (this.topHints[i].intersects(clipRect)) { + this.drawTopHints(newG, i); + } + } + + for (int i = 0; i < this.leftHints.length; i++) { + if (this.leftHints[i].intersects(clipRect)) { + this.drawLeftHints(newG, i); + } + } + + // Paints the boxes + for (int i = 0; i < this.width; i++) { + for (int j = 0; j < this.height; j++) { + Rectangle currentRect = this.boxes[i][j].getRect(); + + if (currentRect.intersects(clipRect)) { + if (this.boxes[i][j] == this.rollover) { + this.boxes[i][j].getRolloverIcon() + .paintIcon(this, newG, + currentRect.x, currentRect.y); + } else { + this.boxes[i][j].getIcon().paintIcon(this, newG, + currentRect.x, + currentRect.y); + } + } + } + } + + // Draws the blocks + newG.setColor(GridUI.BLOCKS_COLOR); + + for (Line2D line : this.blocksLines) { + newG.draw(line); + } + + newG.dispose(); + } + */ + /*** Methods ***/ + + /** + * Initializes various stuff. + * + * @throws FileNotFoundException if an image is missing + */ + public void init() throws FileNotFoundException { + // FIXME + /* + // Computes the size of a hint + FontRenderContext frc = new FontRenderContext(null, true, true); + + // High hint (> 10) + Rectangle2D textBounds = + GridUI.HINT_FONT.getStringBounds(GridUI.HIGH_SAMPLE_HINT, frc); + int hintHeight = (int) textBounds.getHeight(); + int highHintWidth = (int) textBounds.getWidth(); + + // Low hint + textBounds = GridUI.HINT_FONT.getStringBounds(GridUI.LOW_SAMPLE_HINT, + frc); + int lowHintWidth = (int) textBounds.getWidth(); + + this.hintBoxIcon = PicrossUIHelper.getImage(GridUI.HINT_BOX_ICON); + + int hintBoxWidth = this.hintBoxIcon.getIconWidth(); + int hintBoxHeight = this.hintBoxIcon.getIconHeight(); + + this.leftHintsDecal = hintBoxWidth + GridUI.HINTS_SPACE; + this.topHintsDecal = hintBoxHeight + GridUI.HINTS_SPACE; + + // Now computes the grid boundaries + + this.leftBoundary = GridUI.LEFT_HINTS + + (this.rowData[0].length * this.leftHintsDecal); + + this.rightBoundary = this.leftBoundary + + (this.width * GridUI.BOX_WIDTH); + + this.topBoundary = GridUI.TOP_HINTS + + (this.colData[0].length * this.topHintsDecal); + + this.bottomBoundary = this.topBoundary + + (this.height * GridUI.BOX_HEIGHT); + + // Space occupied by the hints + this.topHints = new HintBoxInfos[this.width]; + + for (int i = 0; i < this.topHints.length; i++) { + this.topHints[i] = new HintBoxInfos(); + + this.topHints[i].setRect(new Rectangle(this.leftBoundary + + (i * GridUI.BOX_WIDTH), 0, + GridUI.BOX_WIDTH, + this.topBoundary)); + } + + this.leftHints = new HintBoxInfos[this.height]; + + for (int i = 0; i < this.leftHints.length; i++) { + this.leftHints[i] = new HintBoxInfos(); + + this.leftHints[i].setRect(new Rectangle(0, this.topBoundary + + (i * GridUI.BOX_HEIGHT), + this.leftBoundary, + GridUI.BOX_HEIGHT)); + } + + this.topHintsX = this.leftBoundary + + (GridUI.BOX_WIDTH / 2) - (hintBoxWidth / 2); + + this.leftHintsY = this.topBoundary + + (GridUI.BOX_HEIGHT / 2) - (hintBoxHeight / 2); + + this.centerHintHeight = + (hintBoxHeight / 2) + (hintHeight / 2); + this.centerLowHintWidth = + (hintBoxWidth / 2) - (lowHintWidth / 2); + this.centerHighHintWidth = + (hintBoxWidth / 2) - (highHintWidth / 2); + */ + for (int i = 0; i < this.width; i++) { + for (int j = 0; j < this.height; j++) { + /* + * We compute here the rectangle corresponding to each box + * so we'll be able + * to redraw only what is needed + */ + // FIXME + /* + this.boxes[i][j] + .setRect(new Rectangle(this.leftBoundary + + (i * GridUI.BOX_WIDTH), + this.topBoundary + + (j * GridUI.BOX_WIDTH), + GridUI.BOX_WIDTH, + GridUI.BOX_HEIGHT)); + */ + } + } + + + // FIXME + /* + this.initBlocks(); + this.initTopHints((GridUI.BOX_WIDTH / 2) - (hintBoxWidth / 2)); + this.initLeftHints((GridUI.BOX_HEIGHT / 2) - (hintBoxHeight / 2)); + + this.setPreferredSize(new Dimension(this.rightBoundary + + GridUI.RIGHT_SPACE, + this.bottomBoundary + + GridUI.BOTTOM_SPACE)); + */ + } + + /** Precomputes the blocks lines. */ + private void initBlocks() { + // FIXME + /* + this.blocksLines = new ArrayList<Line2D>(); + + this.blocksLines.add(new Line2D.Double(this.leftBoundary, + this.topBoundary, + this.leftBoundary, + this.bottomBoundary)); + this.blocksLines.add(new Line2D.Double(this.leftBoundary, + this.topBoundary, + this.rightBoundary, + this.topBoundary)); + this.blocksLines.add(new Line2D.Double(this.rightBoundary, + this.bottomBoundary, + this.leftBoundary, + this.bottomBoundary)); + this.blocksLines.add(new Line2D.Double(this.rightBoundary, + this.bottomBoundary, + this.rightBoundary, + this.topBoundary)); + + int boxWidth = GridUI.BLOCK_WIDTH * GridUI.BOX_WIDTH; + int boxHeight = GridUI.BLOCK_HEIGHT * GridUI.BOX_HEIGHT; + + int i = 1; + int currentY = this.topBoundary + boxHeight; + + while ((i + GridUI.BLOCK_HEIGHT) <= this.height) { + this.blocksLines.add(new Line2D.Double(this.leftBoundary, + currentY, + this.rightBoundary, + currentY)); + + currentY += boxHeight; + i += GridUI.BLOCK_HEIGHT; + } + + i = 1; + int currentX = this.leftBoundary + boxWidth; + + while ((i + GridUI.BLOCK_WIDTH) <= this.width) { + this.blocksLines.add(new Line2D.Double(currentX, + this.topBoundary, + currentX, + this.bottomBoundary)); + + currentX += boxWidth; + i += GridUI.BLOCK_WIDTH; + } + */ + } + + /** + * Precomputes the top hints boxes. + * + * @param topHintsStart coordinate where the boxes begin + */ + private void initTopHints(int topHintsStart) { + // FIXME + /* + for (int k = 0; k < this.topHints.length; k++) { + this.topHints[k].setBox( + new BufferedImage(GridUI.BOX_WIDTH, this.topBoundary, + BufferedImage.TYPE_INT_RGB)); + + Graphics2D g2d = this.topHints[k].createBoxGraphics(); + g2d.setColor(Color.WHITE); + g2d.fillRect(0, 0, + this.topHints[k].getWidth(), + this.topHints[k].getHeight()); + + int y = 0; + + // Column hints are in reverse order + for (int i = (this.colData[0].length - 1); i >= 0; i--) { + if (this.colData[k][i] != GridModel.EMPTY_HINT) { + this.hintBoxIcon.paintIcon(this, g2d, topHintsStart, y); + } + + y += this.topHintsDecal; + } + }*/ + } + + /** + * Precomputes the left hints boxes. + * + * @param leftHintsStart coordinate where the boxes begin + */ + private void initLeftHints(int leftHintsStart) { + // FIXME + /* + for (int k = 0; k < this.leftHints.length; k++) { + this.leftHints[k].setBox( + new BufferedImage(this.leftBoundary, GridUI.BOX_HEIGHT, + BufferedImage.TYPE_INT_RGB)); + + Graphics2D g2d = this.leftHints[k].createBoxGraphics(); + g2d.setColor(Color.WHITE); + g2d.fillRect(0, 0, + this.leftHints[k].getWidth(), + this.leftHints[k].getHeight()); + + int x = 0; + + for (int j = 0; j < this.rowData[k].length; j++) { + if (this.rowData[k][j] != GridModel.EMPTY_HINT) { + this.hintBoxIcon.paintIcon(this, g2d, x, leftHintsStart); + } + + x += this.leftHintsDecal; + } + }*/ + } + + /** + * Draws the top hints. + * + * @param g the graphics context + */ + // FIXME + /* + private void drawTopHints(Graphics g, int col) { + g.drawImage(this.topHints[col].getBox(), + this.topHints[col].getX(), this.topHints[col].getY(), + null); + + g.setFont(GridUI.HINT_FONT); + + int x = this.topHintsX + (col * GridUI.BOX_WIDTH); + int y = 0; + + for (int i = this.colData[0].length - 1; i >= 0; i--) { + if (this.colData[col][i] != GridModel.EMPTY_HINT) { + this.drawHint(g, this.colData[col][i], x, y, + this.completedHints.isColHintComplete(col, i), + (this.rolloverColumn == col)); + } + + y += this.topHintsDecal; + } + } + */ + /** + * Draws the left hints. + * + * @param g the graphics context + */ + // FIXME + /* + private void drawLeftHints(Graphics g, int row) { + g.drawImage(this.leftHints[row].getBox(), + this.leftHints[row].getX(), this.leftHints[row].getY(), + null); + + g.setFont(GridUI.HINT_FONT); + + int y = this.leftHintsY + (row * GridUI.BOX_HEIGHT); + int x = 0; + + for (int j = 0; j < this.rowData[row].length; j++) { + if (this.rowData[row][j] != GridModel.EMPTY_HINT) { + this.drawHint(g, this.rowData[row][j], x, y, + this.completedHints.isRowHintComplete(row, j), + (this.rolloverRow == row)); + } + + x += this.leftHintsDecal; + } + } + */ + /** + * Draws a hint. + * + * @param g the graphics context + * @param value hint value + * @param x X coordinate + * @param y Y coordinate + */ + // FIXME + /* + private void drawHint(Graphics g, int value, int x, int y, + boolean complete, boolean rollover) { + if (!rollover) { + if (complete) { + g.setColor(GridUI.COMPLETED_HINT_COLOR); + } else { + g.setColor(GridUI.HINT_TEXT_COLOR); + } + } else { + if (complete) { + g.setColor(new Color(255, 122, 0)); + } else { + g.setColor(Color.ORANGE); + } + } + + y += this.centerHintHeight; + + if (value < 10) { + x += this.centerLowHintWidth; + g.drawString(String.valueOf(value), x, y); + } else { + x += this.centerHighHintWidth; + g.drawString(String.valueOf(value), x, y); + } + } + */ + /** + * This methods tells wether a point is inside the grid or not. + * + * @param point point to be tested + * @return boolean telling if the point is inside the grid + */ + // FIXME + /* + boolean isInGrid(Point point) { + double x = point.getX(); + double y = point.getY(); + + return (x >= this.leftBoundary && x < this.rightBoundary + && y >= this.topBoundary && y < this.bottomBoundary); + } + */ + /** + * Allows to get the row number corresponding to a point inside the grid. + * + * @param point a point inside the grid + * @return the row corresponding to the point + */ + // FIXME + /* + int getRow(Point point) { + double y = point.getY() - this.topBoundary; + + return (int) (y / GridUI.BOX_HEIGHT); + } + */ + /** + * Allows to get the column number corresponding to a point + * inside the grid. + * + * @param point a point inside the grid + * @return the column corresponding to the point + */ + // FIXME + /* + int getColumn(Point point) { + double x = point.getX() - this.leftBoundary; + + return (int) (x / GridUI.BOX_WIDTH); + } + */ + /** Removes the listeners to disable the grid. */ + void disableGrid() { + // FIXME + /* + this.removeMouseListener(this.controller); + this.removeMouseMotionListener(this.controller); + */ + } + + /** + * Repaints a box. + * + * @param row row of the box + * @param column column of the box + */ + void repaint(int row, int column) { + // FIXME + //this.repaint(this.boxes[column][row].getRect()); + } + + /** + * Allows to set the current rolled-over box. + * + * @param row row of the box + * @param column column of the box + */ + void setRollover(int row, int column) { + /* + this.rolloverEnded(); + this.rollover = this.boxes[column][row]; + this.repaint(this.rollover.getRect()); + + this.rolloverHighlight(row, column); + */ + } + /** + * Sets the currently highlighted row and column. + * + * @param row row's index to highlight + * @param column column's index to highlight + */ + void rolloverHighlight(int row, int column) { + /* + if ((this.rolloverColumn != column) || (this.rolloverRow != row)) { + this.repaintColHints(this.rolloverColumn); + this.repaintRowHints(this.rolloverRow); + + this.rolloverColumn = column; + this.rolloverRow = row; + + this.repaintColHints(this.rolloverColumn); + this.repaintRowHints(this.rolloverRow); + } + */ + } + /** Indicates that no box is currently rolled over. */ + + void rolloverEnded() { + /* + if (this.rollover != null) { + */ + /* + * Save the old rolled-over box so we can draw it + * in its initial state + */ + /* + Rectangle rect = this.rollover.getRect(); + + this.rollover = null; + this.repaint(rect); + } + + this.highlightEnded(); + */ + } + + /** Ends the highlight. */ + void highlightEnded() { + /* + this.repaintColHints(this.rolloverColumn); + this.repaintRowHints(this.rolloverRow); + + this.rolloverColumn = -1; + this.rolloverRow = -1; + */ + } + /** Repaints top hints. */ + void repaintColHints(int col) { + // FIXME + /* + if (col < 0 || col >= this.width) { + return; + } + + this.repaint(this.topHints[col].getRect()); + */ + } + + /** Repaints left hints. */ + void repaintRowHints(int row) { + // FIXME + /* + if (row < 0 || row >= this.height) { + return; + } + + this.repaint(this.leftHints[row].getRect()); + */ + } + + public void updateBox(int row, int col, Box box) { + this.boxes[row][col].updateState(box); + } +} Property changes on: branches/engine_split/android/src/picross/specific/grid/ui/GridUI.java ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Added: branches/engine_split/android/src/picross/specific/grid/ui/HintBoxInfos.java =================================================================== --- branches/engine_split/android/src/picross/specific/grid/ui/HintBoxInfos.java (rev 0) +++ branches/engine_split/android/src/picross/specific/grid/ui/HintBoxInfos.java 2013-01-14 13:23:53 UTC (rev 117) @@ -0,0 +1,147 @@ +/* + * $Id$ + * + * Copyright (c) 2008-2011 + * + * 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.specific.grid.ui; + +/** + * Informations about a hint box. + * + * @author Y. Norsa + */ +final class HintBoxInfos { + /*** Field ***/ + + /** The rectangle taken by the box. */ + //private Rectangle rect = null; + + /** Pre-rendered image of the box. */ + //private BufferedImage box = null; + + /*** Methods ***/ + + /** + * Determines if the box's rectangle intersects with another. + * + * @param rectangle the rectangle to test + * @return boolean indicating wether the two rectangles intersect + * with each other + *//* + boolean intersects(Rectangle rectangle) { + return this.rect.intersects(rectangle); + }*/ + + /** + * Creates and return a <code>Graphics2D</code> object corresponding + * to the box. + * + * @return graphical object corresponding to the box + *//* + Graphics2D createBoxGraphics() { + return this.box.createGraphics(); + }*/ + + /** + * Returns the rectangle's width. + * + * @return width of the box's rectangle + *//* + int getWidth() { + return this.rect.width; + }*/ + + /** + * Returns the rectangle's height. + * + * @return height of the box's rectangle + *//* + int getHeight() { + return this.rect.height; + }*/ + + /** + * Return the rectangle's X coordinate. + * + * @return X coordinate for the rectangle + *//* + int getX() { + return this.rect.x; + }*/ + + /** + * Return the rectangle's Y coordinate. + * + * @return Y coordinate for the rectangle + *//* + int getY() { + return this.rect.y; + }*/ + + /*** Accessors ***/ + + /** + * Sets the rectangle occupied by the box. + * + * @param newRect the box's rectangle + *//* + void setRect(Rectangle newRect) { + this.rect = newRect; + }*/ + + /** + * Sets the box's image. + * + * @param newBox pre-rendered image of the box + *//* + void setBox(BufferedImage newBox) { + this.box = newBox; + }*/ + + /** + * Return the box. + * + * @return the rectangle occupied by the box + *//* + Rectangle getRect() { + return this.rect; + }*/ + + /** + * Return th... [truncated message content] |