Ignore:
Timestamp:
05/10/18 16:04:51 (6 years ago)
Author:
davidb
Message:

Reworking of the code-base to separate logic from graphics. This version of Expeditee now supports a JFX graphics as an alternative to SWING

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/expeditee/items/widgets/RubbishBin.java

    r1005 r1102  
    44import java.awt.event.ActionListener;
    55
    6 import org.expeditee.gui.DisplayIO;
    7 import org.expeditee.gui.FrameMouseActions;
     6import org.expeditee.gio.gesture.StandardGestureActions;
     7import org.expeditee.gui.DisplayController;
    88import org.expeditee.gui.FreeItems;
    99import org.expeditee.items.Item;
    1010import org.expeditee.items.Text;
    1111
    12 //When the Rubbish Bin Widget is clicked by any of the mouse buttons, whatever is currently being picked up by the mouse is destroyed
    13 public class RubbishBin extends ButtonWidget{   
    14                
    15         public RubbishBin(Text source, String[] args){ 
    16                                        
     12/**
     13 * When the Rubbish Bin Widget is clicked by any of the mouse buttons,
     14 * whatever is currently being picked up by the mouse is destroyed.
     15 *
     16 * @author cts16
     17 */
     18public class RubbishBin extends ButtonWidget
     19{       
     20        public RubbishBin(Text source, String[] args)
     21        {
    1722                super(80, "org/expeditee/assets/images/bin.svg", source, args);
    1823
    19                 clicked_.addActionListener(new ActionListener() {
    20                 public void actionPerformed(ActionEvent e) {   
     24                clicked_.addActionListener(new ActionListener()
     25                {
     26                public void actionPerformed(ActionEvent e)
     27                {       
    2128                       
    2229                }         
    23              });               
     30                });             
    2431        }
    25         public boolean ItemsLeftClickDropped() {
    26                
     32       
     33        public boolean ItemsLeftClickDropped()
     34        {
    2735                //Find what the mouse was holding at the time and delete it
    2836                Item freeItems = FreeItems.getItemAttachedToCursor();
    29                 if( freeItems != null){
    30                         freeItems.setParent(DisplayIO.getCurrentFrame());
     37               
     38                if( freeItems != null) {
     39                        freeItems.setParent(DisplayController.getCurrentFrame());
    3140                       
    32                         try{
    33                        
    34                         FrameMouseActions.delete(freeItems);           
    35                         }
    36                         catch(Exception e){
    37                                
     41                        try {
     42                                StandardGestureActions.delete(freeItems, null, null, false);           
     43                        } catch(Exception e) {
    3844                                e.printStackTrace();
    3945                        }                       
    4046                }
     47               
    4148                return true;
    4249        }
    4350       
    4451        @Override
    45         protected String[] getArgs() {
     52        protected String[] getArgs()
     53        {
    4654                // TODO Auto-generated method stub
    4755                return null;
    4856        }
    49         //this should be a generic method for any widget that is clicked while an item is being held
    50         public boolean itemHeldWhileClicked(InteractiveWidget iw){
    51                        
     57       
     58        /**
     59         * This should be a generic method for any widget that is clicked while an item is being held.
     60         */
     61        public boolean itemHeldWhileClicked(Widget iw)
     62        {
    5263                ItemsLeftClickDropped();
    53                 return true;
    54                        
    55         }
    56         public boolean getdropInteractableStatus(){
     64               
    5765                return true;
    5866        }
    5967       
     68        public boolean getdropInteractableStatus()
     69        {
     70                return true;
     71        }
    6072}
Note: See TracChangeset for help on using the changeset viewer.