de.uni_paderborn.fujaba.coobra.actions
Class CopyAction

java.lang.Object
  extended byjavax.swing.AbstractAction
      extended byde.uni_paderborn.fujaba.coobra.actions.CopyAction
All Implemented Interfaces:
javax.swing.Action, java.awt.event.ActionListener, java.lang.Cloneable, java.util.EventListener, java.io.Serializable

public class CopyAction
extends javax.swing.AbstractAction

Copy some ASGElements (changes to them) via CoObRA

Version:
$Revision: 1.16 $
Author:
$Author: lowende $
See Also:
Serialized Form

Nested Class Summary
static class CopyAction.CopyData
          Instances of this class store data for copying object with CoObRA
 
Nested classes inherited from class javax.swing.AbstractAction
 
Field Summary
private static CopyAction.CopyData clipboard
          what has been copied
private  java.util.Map compartmentLinks
          a map of compartment links:
either ("fieldName", null) to copy all objects that link to another copied object via fieldName
or (ObjectClass.class, "fieldName") to copy all objects that link to another copied object of class ObjectClass via fieldName
private  CopyAction.CopyData copyData
          data for copying
private static org.apache.log4j.Logger L
          Logger
(package private)  de.upb.tools.fca.FDuplicatedHashMap newValueToChangesMap
          map from object to all changes having the key as new value
private  java.util.Set possiblyIgnoredValues
          (possibly) ignored values when determining which changes to copy
 
Fields inherited from class javax.swing.AbstractAction
changeSupport, enabled
 
Fields inherited from interface javax.swing.Action
ACCELERATOR_KEY, ACTION_COMMAND_KEY, DEFAULT, LONG_DESCRIPTION, MNEMONIC_KEY, NAME, SHORT_DESCRIPTION, SMALL_ICON
 
Constructor Summary
CopyAction()
          Defines an Action object with a default description string and default icon.
CopyAction(CopyAction.CopyData copyData)
          Create a copy action with a specific data storage
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
          Invoked when the action occurs.
private  void addReferencedObjectsFromChanges(FElement element)
          add all objects referenced in changes that have element as new value
private  void addToCopyObjects(FElement element)
          Adds an element to the getCopyData().getCopyObjects() set.
 void copy()
          complete the CopyData with the copyObjects and copyChanges data.
static CopyAction.CopyData getClipboard()
           
 CopyAction.CopyData getCopyData()
           
private  void init()
          initialize sets
private  void putChangesIntoHashMap(java.util.Iterator it)
          adds changes to newValueToChangesMap
 
Methods inherited from class javax.swing.AbstractAction
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

clipboard

private static CopyAction.CopyData clipboard
what has been copied


possiblyIgnoredValues

private java.util.Set possiblyIgnoredValues
(possibly) ignored values when determining which changes to copy


compartmentLinks

private java.util.Map compartmentLinks
a map of compartment links:
either ("fieldName", null) to copy all objects that link to another copied object via fieldName
or (ObjectClass.class, "fieldName") to copy all objects that link to another copied object of class ObjectClass via fieldName


copyData

private CopyAction.CopyData copyData
data for copying


newValueToChangesMap

de.upb.tools.fca.FDuplicatedHashMap newValueToChangesMap
map from object to all changes having the key as new value


L

private static final org.apache.log4j.Logger L
Logger

Constructor Detail

CopyAction

public CopyAction(CopyAction.CopyData copyData)
Create a copy action with a specific data storage

Parameters:
copyData - where object to be copied reside (selectedObjects) and the data for copying will be entered

CopyAction

public CopyAction()
Defines an Action object with a default description string and default icon.

Method Detail

getClipboard

public static CopyAction.CopyData getClipboard()
Returns:
the CopyData that is the VMs clipboard

getCopyData

public CopyAction.CopyData getCopyData()
Returns:
the data for copying the objects

init

private void init()
initialize sets


actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
Invoked when the action occurs.

Parameters:
e - event that caused the action

copy

public void copy()
complete the CopyData with the copyObjects and copyChanges data. Objects are expected to be in the selectedObjects set.


addToCopyObjects

private void addToCopyObjects(FElement element)
Adds an element to the getCopyData().getCopyObjects() set. Recursively processes the added object to find compartments and ignored values.

Parameters:
element - what to copy

addReferencedObjectsFromChanges

private void addReferencedObjectsFromChanges(FElement element)
add all objects referenced in changes that have element as new value

Parameters:
element - ASGElement that was already added

putChangesIntoHashMap

private void putChangesIntoHashMap(java.util.Iterator it)
adds changes to newValueToChangesMap

Parameters:
it - iterator through changes