org.astrogrid.desktop.modules.adqlEditor.commands
Class EditTupleTextCommand

java.lang.Object
  extended by javax.swing.undo.AbstractUndoableEdit
      extended by org.astrogrid.desktop.modules.adqlEditor.commands.AbstractCommand
          extended by org.astrogrid.desktop.modules.adqlEditor.commands.EditTupleTextCommand
All Implemented Interfaces:
Serializable, UndoableEdit, CommandExec, CommandInfo

public class EditTupleTextCommand
extends AbstractCommand

Author:
jl99@star.le.ac.uk TODO To change the template for this generated type comment go to Window - Preferences - Java - Code Style - Code Templates
See Also:
Serialized Form

Nested Class Summary
private  class EditTupleTextCommand.ColumnReference
           
private  class EditTupleTextCommand.UpdateControls
           
 
Nested classes/interfaces inherited from interface org.astrogrid.desktop.modules.adqlEditor.commands.CommandExec
CommandExec.Result
 
Field Summary
private  HashMap<String,AdqlTree.TableData> fromTables
           
private static org.apache.commons.logging.Log log
           
private  String[] newValues
           
private  String[] oldValues
           
private  ArrayList<Object> references
           
private  ArrayList<AdqlNode> typeList
           
private  ArrayList<Object> updates
           
 
Fields inherited from class org.astrogrid.desktop.modules.adqlEditor.commands.AbstractCommand
adqlTree, childElement, childToken, childType, maxOccurs, minOccurs, parentToken, parentType, undoManager
 
Fields inherited from class javax.swing.undo.AbstractUndoableEdit
RedoName, UndoName
 
Fields inherited from interface org.astrogrid.desktop.modules.adqlEditor.commands.CommandExec
ERROR, FAILED, OK, WARNING
 
Constructor Summary
EditTupleTextCommand(AdqlTree adqlTree, UndoManager undoManager, AdqlNode target, HashMap<String,AdqlTree.TableData> fromTables)
           
 
Method Summary
private  CommandExec.Result _execute()
           
 void _redo()
           
private  boolean areEqual(String oldValue, String newValue)
           
private  void buildTypeList(AdqlNode parent, SchemaType type)
           
private  void crossValidateCreate(XmlObject element, String attributeName, String oldValue, String newValue)
           
private  void crossValidateDelete(XmlObject element, String attributeName, String oldValue, String newValue)
           
private  void crossValidateTableCreate(XmlObject tableElement, String attributeName, String oldAliasValue, String newAliasValue)
           
private  void crossValidateTableDelete(XmlObject tableElement, String attributeName, String oldValue, String newValue)
           
private  void crossValidateTableUpdate(XmlObject tableElement, String attributeName, String oldAliasValue, String newAliasValue)
           
private  void crossValidateUpdate(XmlObject element, String attributeName, String oldValue, String newValue)
           
 void die()
           
 CommandExec.Result execute()
           
 String[] getNewValues()
           
 String[] getOldValues()
           
 String getPresentationName()
           
private  ArrayList<Object> getReferences()
           
private  ArrayList<AdqlNode> getTypeList(String targetLocalName)
           
private  ArrayList<Object> getUpdates()
           
private  boolean isTableValidationRequired(XmlObject element, String attributeName)
           
private  boolean preValidateOK(XmlObject element, String attributeName, boolean attributeOptional, String oldValue, String newValue)
           
private  boolean preValidateTable(XmlObject tableElement, String attributeName, boolean attributeOptional, String oldAliasValue, String newAliasValue)
           
 void redo()
           
private  void resetTypeList()
           
 void setNewValues(String[] values)
           
 void setOldValue(String[] oldValues)
           
 void setSelectedValues(String[] values)
           
 String toString()
           
 void undo()
           
 
Methods inherited from class org.astrogrid.desktop.modules.adqlEditor.commands.AbstractCommand
addToEditStore, exchangeInEditStore, exchangeInEditStore, getChildDisplayName, getChildElement, getChildElementName, getChildEntry, getChildIndex, getChildMaxOccurs, getChildMinOccurs, getChildObject, getChildToken, getChildType, getFromEditStore, getMessages, getParentDisplayName, getParentElementName, getParentEntry, getParentObject, getParentToken, getParentType, isChildCascadeable, isChildColumnLinked, isChildDisallowed, isChildDrivenByEnumeratedAttribute, isChildDrivenByEnumeratedElement, isChildEnabled, isChildHeldInArray, isChildInPatternContext, isChildMandatorySingleton, isChildOptionalSingleton, isChildSupportedType, isChildTableLinked, isInitializedStatusGood, isInsertableIntoArray, isParentSuitablePasteTargetFor, setMessages
 
Methods inherited from class javax.swing.undo.AbstractUndoableEdit
addEdit, canRedo, canUndo, getRedoPresentationName, getUndoPresentationName, isSignificant, replaceEdit
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

log

private static final org.apache.commons.logging.Log log

fromTables

private HashMap<String,AdqlTree.TableData> fromTables

oldValues

private String[] oldValues

newValues

private String[] newValues

updates

private ArrayList<Object> updates

references

private ArrayList<Object> references

typeList

private ArrayList<AdqlNode> typeList
Constructor Detail

EditTupleTextCommand

public EditTupleTextCommand(AdqlTree adqlTree,
                            UndoManager undoManager,
                            AdqlNode target,
                            HashMap<String,AdqlTree.TableData> fromTables)
Parameters:
target -
source -
Method Detail

setNewValues

public void setNewValues(String[] values)

setSelectedValues

public void setSelectedValues(String[] values)

execute

public CommandExec.Result execute()
Specified by:
execute in interface CommandExec
Overrides:
execute in class AbstractCommand

_execute

private CommandExec.Result _execute()

getReferences

private ArrayList<Object> getReferences()

getUpdates

private ArrayList<Object> getUpdates()

die

public void die()
Specified by:
die in interface UndoableEdit
Overrides:
die in class AbstractUndoableEdit

redo

public void redo()
          throws CannotRedoException
Specified by:
redo in interface UndoableEdit
Overrides:
redo in class AbstractUndoableEdit
Throws:
CannotRedoException

_redo

public void _redo()
           throws CannotRedoException
Throws:
CannotRedoException

undo

public void undo()
          throws CannotUndoException
Specified by:
undo in interface UndoableEdit
Overrides:
undo in class AbstractUndoableEdit
Throws:
CannotUndoException

getPresentationName

public String getPresentationName()
Specified by:
getPresentationName in interface UndoableEdit
Overrides:
getPresentationName in class AbstractUndoableEdit

getOldValues

public String[] getOldValues()
Returns:
the oldValue

setOldValue

public void setOldValue(String[] oldValues)
Parameters:
oldValue - the oldValue to set

getNewValues

public String[] getNewValues()
Returns:
the newValue

areEqual

private boolean areEqual(String oldValue,
                         String newValue)

preValidateOK

private boolean preValidateOK(XmlObject element,
                              String attributeName,
                              boolean attributeOptional,
                              String oldValue,
                              String newValue)

crossValidateDelete

private void crossValidateDelete(XmlObject element,
                                 String attributeName,
                                 String oldValue,
                                 String newValue)

crossValidateUpdate

private void crossValidateUpdate(XmlObject element,
                                 String attributeName,
                                 String oldValue,
                                 String newValue)

crossValidateCreate

private void crossValidateCreate(XmlObject element,
                                 String attributeName,
                                 String oldValue,
                                 String newValue)

isTableValidationRequired

private boolean isTableValidationRequired(XmlObject element,
                                          String attributeName)

crossValidateTableDelete

private void crossValidateTableDelete(XmlObject tableElement,
                                      String attributeName,
                                      String oldValue,
                                      String newValue)

crossValidateTableUpdate

private void crossValidateTableUpdate(XmlObject tableElement,
                                      String attributeName,
                                      String oldAliasValue,
                                      String newAliasValue)

crossValidateTableCreate

private void crossValidateTableCreate(XmlObject tableElement,
                                      String attributeName,
                                      String oldAliasValue,
                                      String newAliasValue)

preValidateTable

private boolean preValidateTable(XmlObject tableElement,
                                 String attributeName,
                                 boolean attributeOptional,
                                 String oldAliasValue,
                                 String newAliasValue)

getTypeList

private ArrayList<AdqlNode> getTypeList(String targetLocalName)

buildTypeList

private void buildTypeList(AdqlNode parent,
                           SchemaType type)

resetTypeList

private void resetTypeList()

toString

public String toString()
Overrides:
toString in class AbstractCommand


Copyright © 2002-2010 AstroGrid. All Rights Reserved.