cz.cuni.pogamut.posh.widget.accept
Class AbstractAcceptAction<DROPPED extends cz.cuni.amis.pogamut.sposh.elements.PoshElement,TARGET extends cz.cuni.amis.pogamut.sposh.elements.PoshElement>

Package class diagram package AbstractAcceptAction
java.lang.Object
  extended by cz.cuni.pogamut.posh.widget.accept.AbstractAcceptAction<DROPPED,TARGET>
All Implemented Interfaces:
org.netbeans.api.visual.action.AcceptProvider
Direct Known Subclasses:
AcceptAP2Plan, AcceptAP2TA, AcceptCE2CE, AcceptComp2Plan, AcceptComp2TA, AcceptDrive2DC, AcceptDrive2Drive, AcceptGoal2DC, AcceptSense2CE, AcceptSense2Goal, AcceptSense2Sense, AcceptSense2Triggers, AcceptTA2TA

public abstract class AbstractAcceptAction<DROPPED extends cz.cuni.amis.pogamut.sposh.elements.PoshElement,TARGET extends cz.cuni.amis.pogamut.sposh.elements.PoshElement>
extends Object
implements org.netbeans.api.visual.action.AcceptProvider

Ancestor for accept providers of widgets.

Author:
Honza

Field Summary
protected  DataFlavor dataFlavor
           
protected  TARGET dataNode
           
protected static Logger log
           
protected  PoshWidget widget
           
 
Constructor Summary
protected AbstractAcceptAction(DataFlavor dataFlavor, TARGET dataNode)
          same as other constructor, but we don't require widget.
protected AbstractAcceptAction(DataFlavor dataFlavor, TARGET dataNode, PoshWidget widget)
          Create an abstract action in the widget widget that will do something to data node dataNode when transferable of same data flavor as dataFlavor is dropped onto widget.
 
Method Summary
 void accept(org.netbeans.api.visual.widget.Widget widget, Point point, Transferable transferable)
           
protected  void displayMessage(String message, int messageType)
          Display message using NotifyDescriptor.
 DataFlavor getDataFlavor()
          Get data flavor this accept provider accepts.
protected  int getIndexInList(List list, Object o)
          Get index of object in the list.
 org.netbeans.api.visual.action.ConnectorState isAcceptable(org.netbeans.api.visual.widget.Widget arg0, Point arg1, Transferable transferable)
           
protected abstract  void performAction(DROPPED droppedData)
          When deriving from this widget, implement what should actually be done in this function.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dataFlavor

protected DataFlavor dataFlavor

dataNode

protected TARGET extends cz.cuni.amis.pogamut.sposh.elements.PoshElement dataNode

widget

protected PoshWidget widget

log

protected static final Logger log
Constructor Detail

AbstractAcceptAction

protected AbstractAcceptAction(DataFlavor dataFlavor,
                               TARGET dataNode,
                               PoshWidget widget)
Create an abstract action in the widget widget that will do something to data node dataNode when transferable of same data flavor as dataFlavor is dropped onto widget.

Parameters:
dataFlavor - data flavor we are accepting, no multiple flavors accepted
dataNode - data node that will be used somehow when accept action happens.
widget - widget transferable is dropped onto for this accept provider to work.

AbstractAcceptAction

protected AbstractAcceptAction(DataFlavor dataFlavor,
                               TARGET dataNode)
same as other constructor, but we don't require widget.

Parameters:
dataFlavor -
dataNode -
Method Detail

isAcceptable

public final org.netbeans.api.visual.action.ConnectorState isAcceptable(org.netbeans.api.visual.widget.Widget arg0,
                                                                        Point arg1,
                                                                        Transferable transferable)
Specified by:
isAcceptable in interface org.netbeans.api.visual.action.AcceptProvider

accept

public final void accept(org.netbeans.api.visual.widget.Widget widget,
                         Point point,
                         Transferable transferable)
Specified by:
accept in interface org.netbeans.api.visual.action.AcceptProvider

getDataFlavor

public final DataFlavor getDataFlavor()
Get data flavor this accept provider accepts.

Returns:
data flavour passed in the constructor

performAction

protected abstract void performAction(DROPPED droppedData)
When deriving from this widget, implement what should actually be done in this function.

Parameters:
droppedData - Object that was stored in the Transferable, basically object that was dropped.

getIndexInList

protected final int getIndexInList(List list,
                                   Object o)
Get index of object in the list.

Parameters:
list - list of object where this function will look for object o.
o - object whos index we are looking for
Returns:
index of object o in the list or length of list if object wasn't found. XXX: ??? Javadoc is not consistent with what method does? Replace wiht List.indexOf?

displayMessage

protected final void displayMessage(String message,
                                    int messageType)
Display message using NotifyDescriptor.

Parameters:
messgae -
messageType - Type of message, from NotifyDescriptor.*_MESSAGE


Copyright © 2013 AMIS research group, Faculty of Mathematics and Physics, Charles University in Prague, Czech Republic. All Rights Reserved.