Clover coverage report - Maven Clover report
Coverage timestamp: Thu Oct 11 2007 08:41:48 CEST
file stats: LOC: 71   Methods: 10
NCLOC: 43   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
AbstractCreationTool.java 0% 0% 0% 0%
coverage
 1    /*
 2    * Copyright (C) 2007 Eric MIGNOT - mignots.eric@free.fr
 3    *
 4    * This library is free software; you can redistribute it and/or
 5    * modify it under the terms of the GNU Lesser General Public
 6    * License as published by the Free Software Foundation; either
 7    * version 2.1 of the License, or (at your option) any later version.
 8    *
 9    * This library is distributed in the hope that it will be useful,
 10    * but WITHOUT ANY WARRANTY; without even the implied warranty of
 11    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 12    * Lesser General Public License for more details.
 13    *
 14    * You should have received a copy of the GNU Lesser General Public
 15    * License along with this library; if not, write to the Free Software
 16    * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 17    */
 18    package org.ericmignot.modeler.gui.palette;
 19   
 20    import java.awt.event.MouseEvent;
 21   
 22    import org.ericmignot.modeler.action.CreationAction;
 23    import org.ericmignot.modeler.data.BusinessObject;
 24    import org.ericmignot.modeler.gui.workarea.Item;
 25    import org.ericmignot.modeler.util.action.NotifyableAction;
 26   
 27    public abstract class AbstractCreationTool extends PaletteTool
 28    {
 29   
 30  0 public final boolean shouldWorkAreaRegister()
 31    {
 32  0 return true;
 33    }
 34  0 public final boolean shouldItemRegister(Item item)
 35    {
 36  0 return false;
 37    }
 38  0 public final void registerItem(Item item){}
 39  0 public final void unregisterItem(Item item){}
 40   
 41  0 public void mousePressed(MouseEvent e){e.consume();}
 42  0 public final void itemPressed(Item item, int x, int y) {}
 43   
 44  0 public void mouseDragged(MouseEvent e) {e.consume();}
 45  0 public final void itemDragged(int x, int y) {}
 46   
 47   
 48  0 public void mouseReleased(MouseEvent e)
 49    {
 50  0 if (e.isConsumed()) return;
 51  0 double zoom = this.getController().getZoomFactor();
 52  0 int x = (int) (e.getX() / zoom);
 53  0 int y = (int) (e.getY() / zoom);
 54   
 55  0 this.workAreaReleased(x, y);
 56  0 this.getController().treatExecute(this.manageReleased());
 57  0 e.consume();
 58   
 59    }
 60  0 public final NotifyableAction manageReleased()
 61    {
 62  0 CreationAction action = new CreationAction(
 63    this.getController().getModel(), this.buildBusinessObject());
 64  0 action.setDoEvent(this.getDoEvent());
 65  0 action.setUndoEvent(this.getUndoEvent());
 66  0 return action;
 67    }
 68   
 69    public abstract void workAreaReleased(int x, int y);
 70    public abstract BusinessObject buildBusinessObject();
 71    }