org.mockcentral.editor.nodes.expectation.part.wizard
Class ChildrenListEditor

java.lang.Object
  extended by org.mockcentral.editor.nodes.expectation.part.wizard.ChildrenListEditor
All Implemented Interfaces:
org.eclipse.jface.viewers.IDoubleClickListener

public class ChildrenListEditor
extends java.lang.Object
implements org.eclipse.jface.viewers.IDoubleClickListener

A class used to edit a list of SignaturePartBean child instances, for use by AbstractFieldEditor classes. This class is used to edit lists of constructor arguments, Collection entries and Array elements.

Author:
David Hutchinson

Constructor Summary
ChildrenListEditor(AbstractFieldEditor editor, org.mockcentral.editor.nodes.fixture.FixtureNode fixtureNode, org.mockcentral.server.SignaturePartBean parent, java.util.List<org.mockcentral.server.SignaturePartBean> children, org.eclipse.swt.widgets.Composite parentComposite, java.util.List<EditSignaturePartWizardDialog> enclosingDialogs)
          Creates a new instance.
 
Method Summary
protected  void addChild()
          Shows an EditSignaturePartDialog used to create a new Collection entry or constructor argument.
protected  void addDefaultConstructorArgs()
          Opens an AddConstructorArgsWizard to select a constructor and build matching default child values in one step.
protected  void createTableActions(org.eclipse.swt.widgets.Table table)
          Creates the Action instances for the popup menu for the table.
protected  void deleteSelectedChild(int index)
          Deletes the child instance at the selected index.
 void doubleClick(org.eclipse.jface.viewers.DoubleClickEvent event)
           
protected  void editChild(org.mockcentral.server.SignaturePartBean bean)
          Shows an EditSignaturePartDialog used to edit the selected Constructor argument, Collection entry or Array element.
protected  void fillContextMenu(org.eclipse.jface.action.IMenuManager manager, java.lang.Object selection, int selectionIndex, int tableSize)
          Adds dynamic content to the context menu.
protected  void moveEntryDown(int selectionIndex)
          Moves a child entry down within the list and updates the table.
protected  void moveEntryUp(int selectionIndex)
          Moves a child entry up within the list and updates the table.
 void setChildren(java.util.List<org.mockcentral.server.SignaturePartBean> children)
          Sets the list of child SignaturePartBean instances.
protected  void updatePrompts()
          Updates the user prompts on this editor.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ChildrenListEditor

public ChildrenListEditor(AbstractFieldEditor editor,
                          org.mockcentral.editor.nodes.fixture.FixtureNode fixtureNode,
                          org.mockcentral.server.SignaturePartBean parent,
                          java.util.List<org.mockcentral.server.SignaturePartBean> children,
                          org.eclipse.swt.widgets.Composite parentComposite,
                          java.util.List<EditSignaturePartWizardDialog> enclosingDialogs)
Creates a new instance.

Parameters:
editor - the AbstractFieldEditor enclosing this editor.
parent - the SignaturePartBean enclosing the list being edited.
children - the list of child SignaturePartBean objects being edited.
parentComposite - the parent Composite.
enclosingDialogs - the list of enclosing EditSignaturePartWizardDialog instances. SignaturePartBean can infinitely nest child instances in the constructorArgs and collectionEnries fields, so this field allows the dialogs used to edit these enclosed instances to be displayed in a tiled fashion.
Method Detail

setChildren

public void setChildren(java.util.List<org.mockcentral.server.SignaturePartBean> children)
Sets the list of child SignaturePartBean instances.

Parameters:
children - the list of child SignaturePartBean instances.

doubleClick

public void doubleClick(org.eclipse.jface.viewers.DoubleClickEvent event)
Specified by:
doubleClick in interface org.eclipse.jface.viewers.IDoubleClickListener

updatePrompts

protected void updatePrompts()
Updates the user prompts on this editor.


addChild

protected void addChild()
Shows an EditSignaturePartDialog used to create a new Collection entry or constructor argument.


deleteSelectedChild

protected void deleteSelectedChild(int index)
Deletes the child instance at the selected index.

Parameters:
index - the index

editChild

protected void editChild(org.mockcentral.server.SignaturePartBean bean)
Shows an EditSignaturePartDialog used to edit the selected Constructor argument, Collection entry or Array element.


addDefaultConstructorArgs

protected void addDefaultConstructorArgs()
Opens an AddConstructorArgsWizard to select a constructor and build matching default child values in one step.


createTableActions

protected void createTableActions(org.eclipse.swt.widgets.Table table)
Creates the Action instances for the popup menu for the table.


fillContextMenu

protected void fillContextMenu(org.eclipse.jface.action.IMenuManager manager,
                               java.lang.Object selection,
                               int selectionIndex,
                               int tableSize)
Adds dynamic content to the context menu.

Parameters:
manager - the IMenuManager providing the menu.

moveEntryUp

protected void moveEntryUp(int selectionIndex)
Moves a child entry up within the list and updates the table.

Parameters:
selectionIndex - the index of the entry to move.

moveEntryDown

protected void moveEntryDown(int selectionIndex)
Moves a child entry down within the list and updates the table.

Parameters:
selectionIndex - the index of the entry to move.