Method
|
Description
|
getUniqueSerialNumber
|
public int getUniqueSerialNumber()
Return the serial number used for creating the shapeId of
a ShapeContainer.
The serial number is given by adding 1 to the return value of the getMaxSerialNumber method below.
|
getMaxSerialNumber
|
public int getMaxSerialNumber()
Returns the max value among the serial numbers which are retrieve from
the ShapeContainer objects stored in the
ContainerList. The serial number can be retrieved by the
ShapeContainer.getSerialNumber method.
:
The shapeId is an identifier of a shape object
which is configured from a key word - a string representing a type of a shape element -
and a serial number, for example "Rectangle (No-1)". |
getContainerList
|
public ArrayList getContainerList()
Returns the ContainerList.
|
setContainerList
|
public void setContainerList(ArrayList containerList)
Parameters:
containerList - The ArrayList object.
Processing:
Sets the containerList to the ContainerList.
This method is called by the PageManager to change the page to be displayed.
|
size
|
public int size()
Return the size of the ContainerList.
|
clear
|
public void clear()
Clears the ContainerList.
|
setContainerIndex>
|
private void setContainerIndex(ShapeContainer container)
Parameters:
container - The ShapeContainer object.
Processing:
Calls the getContainerIndex method of this class
and calls the ShapeContainer.setContainerIndex method of the container.
=>
Index of ContainerList on this page.
|
getContainerIndex
|
private int getContainerIndex(ShapeContainer container)
Parameters:
container - The ShapeContainer object.
Processing:
Returns the index of the container in ContainerList.
|
addContainer
|
public void addContainer(ShapeContainer container)
Parameters:
container - The ShapeContainer object.
Processing:
Adds the container to the ContainerList.
This method calls the setContainerIndex methods.
If the undoSetup field is true,
then calls the undoSetupOfAddOrDelete method of this class.
|
addContainer
|
public void addContainer(int index, ShapeContainer container)
Parameters:
index - The index of the ContainerList.
container - The ShapeContainer object.
Processing:
Adds the ontainer at the position of the index in the ContainerList.
This method calls the setContainerIndex methods.
If the undoSetup field is true,
then calls the undoSetupOfAddOrDelete method of this class.
|
deleteContainer
|
public void deleteContainer(ShapeContainer container)
Parameters:
container - The ShapeContainer object.
Processing:
Removes the container from the ContainerList.
This method calls the setContainerIndex method before removing.
If the undoSetup field is true,
then calls the undoSetupOfAddOrDelete method of this class.
|
deleteContainer
|
public void deleteContainer(int index)
Parameters:
index - The index of the ContainerList.
Processing:
Removes the ShapeContainer object specified
by the index from the ContainerList.
This method calls the setContainerIndex method before removing.
If the undoSetup field is true,
then calls the undoSetupOfAddOrDelete method of this class.
|
deleteContainer
|
public void deleteContainer(String shapeId)
Parameters:
shapeId - The shapeId of an
ShapeContainer object
Processing:
Removes the ShapeContainer object specified
by the shapeId from the ContainerList.
This method calls the setContainerIndex method before removing.
If the undoSetup field is true,
then calls the undoSetupOfAddOrDelete method of this class.
|
getContainer
|
public ShapeContainer getContainer(int index)
Parameters:
index - The index of the ContainerList.
Processing:
Returns the ShapeContainer object at the index in the
ContainerList.
This method calls the setContainerIndex method
and if the undoSetup field is true,
calls the backup method.
|
getContainer
|
public ShapeContainer getContainer(String shapeId)
Parameters:
shapeId - The shapeId of an
ShapeContainer object
Processing:
Returns the ShapeContainer object specified by the shapeId.
This method searches child ShapeContainers of the ShapeContainer in the
ContainerList by the shapeId.
This method calls the setContainerIndex method
and if the undoSetup field is true,
calls the backup method.
|
getContainers
|
public ShapeContainer[] getContainers()
Returns the array of all the ShapeContainer objects
in the ContainerList.
This method calls the setContainerIndex method
and if the undoSetup field is true,
calls the backup method.
|
getSelectedContainers
|
public ShapeContainer[] getSelectedContainers()
Returns the array of the selected ShapeContainer objects in the
ContainerList.
This method calls the setContainerIndex method
and if the undoSetup field is true,
calls the backup method.
|
getAllShapeContainers
|
public Vector getAllShapeContainers()
Returns all ShapeContainers to a Vector.
In the Figure 1.1, 1.2, 1.3 described above, for example, the sequence of
Round_Rectangle(No-0), Group(No-1), Group(No-2), Rectangle(No-3), Rectangle(No-4), Group(No-5),
Rectangle(No-6), Rectangle(No-7),Line(No-8), Line(No-9), Rectangle(No-10), Rectangle(No-11),
Line(No-12) and Line(No-13) are returned in this order.
This order is related to the z-order, that is, the Round_Rectangle(No-0) is backmost and the Line(No-13)is in front.
: the z-order => user's guide
z-order of shapes
|
getAllSigleShapeContainers
|
public ShapeContainer[] getAllSigleShapeContainers(boolean selectedOnly)
Parameters:
selectedOnly - If true, then returns the selected single shape objects, otherwise returns
the all the single shape objects.
Returns:
Returns the array of the (selected) ShapeContainer objects
each of which has a single shape element.
Processing:
To get all the child ShapeContainer objects in a group, t
he getGroupedSingleShapeContainers method
of the ShapeContainer is used.
This method calls the setContainerIndex method
and if the undoSetup field is true,
calls the backup method.
Example: Returns Round_Rectangle(No-0), Rectangle(No-3), Rectangle(No-4),
Rectangle(No-6), Rectangle(No-7), Line(No-8), Line(No-9), Rectangle(No-10), Rectangle(No-11),
Line(No-12) and Line(No-13), if the selectedOnly is false in Figure 1.1, 1.2, 1.3.
|
renumberContainerList
|
public void renumberContainerList()
Renumber the serial number in ShapeContainer.shapeId
|
getEditableTextBox
|
public ShapeContainer getEditableTextBox()
Returns the ShapeContainer object with an editable (active)
TextBox.
|
makeAllTextBoxesUneditable
|
public void makeAllTextBoxesUneditable()
Makes all the TextBox objects uneditable.
|
swapContainers
|
public void swapContainers(ShapeContainer container1, ShapeContainer
container2)
Exchanges the positions of the container1 and container2 in the ContainerList.
This method is used for changing the z -orders of two shapes.
|
group
|
public ShapeContainer group(ShapeContainer[] containers)
Parameters:
containers - The ShapeContainer objects to be grouped.
Returns:
∙ Creates a new ShapeContainer object
and a new GroupElement object.
∙ Registers the containers to the new GroupElement.
∙ Adds the new ShapeContainer object to the ContainerList by the
addContainer method.
The position in ContainerList is the same as the maximum position of the
ShapeContainer objects specified by the parameter.
∙ Deletes the containers from the ContainrList.
|
ungroup
|
public void unGroup(ShapeContainer groupContainer)
Parameters:
groupContainer - The ShapeContainer objects of a group..
Returns:
∙ Checks that the groupContainer has a GroupElement.
If not, then this method returns, otherwise executes the following steps.
∙ Retrieves the child ShapeContainer objects
which are registered in the GroupElement and adds them to the ContainerList
by the addContainer method.
The position in ContainerList is the same as the groupContainer.
∙ Sets "selected" to the the child ShapeContainer objects.
∙ Deletes the groupContainer from the ContainerList.
|
undoSetupStart
|
public void undoSetupStart()
Sets true to the undoSetup field to declare starting undo setup.
Hereafter, whenever the getContainer
or its family method is called, the ContainerManager creates a clone of the ShapeContainer to be returned
and stores the clone to the BackupContainerList by the
backup method.
This action is to save the backup of the shape before changed.
For all the ShapeContainer objects in the ContainerList
and all their child ShapeContainer objects, calls the resetChangeCode method.
=>
Undo support function
|
undoSetupStart
|
public void undoSetupStart(ShapeContainer[] containers)
Parameters:
containers - The ShapeContainer objects.
Processing:
Performs the same processing as the above method.
In addition, calls the backup method to save the clones of the containers to the BackupContainerList.
|
backup
|
private void backup(ShapeContainer container)
Parameters:
container - The ShapeContainer object.
Processing:
Saves the clone of the container to the BackupContainerList.
|
backup
|
private void backup(ShapeContainer[] containers)
Parameters:
containers - The ShapeContainer objects.
Processing:
Saves the clones of the containers to the BackupContainerList.
|
getBackup
|
private ShapeContainer getBackup(String shapeId)
Parameters:
shapeId - The shapeId of an
ShapeContainer object
Returns the ShapeContainer object in the BackupContainerList
whose shapeId matches to the given shapeId.
|
undoSetupOfAddOrDelete
|
public void undoSetupOfAddOrDelete(int type, ShapeContainer container)
Parameters:
type - UndoConstants.ADD or UndoConstants.DELETE.
container - The ShapeContainer object.
Processing:
This method performs the operation of the undo setup for adding the container to the
ContainerList and for deleting container from the
ContainerList. The details are as follow.
This method is called by the addContainer method, the
deleteContainer method
and their family methods if the undoSetup field is true.
If this method is called by the addContainer method
and its family method, this method creates a new
UndoableDrawEdit.CreateContainer object
and registers it to the UndoDrawManager.
And if this method is called by the deleteContainer method
and its family method, this method creates a new
UndoableDrawEdit.DeleteContainer object
and registers it to the UndoDrawManager.
|
undoSetupEnd
|
public void undoSetupEnd()
This method declares ending undo setup and performs the operation of the
undo setup for an changed ShapeContainer object. The undo setup
for adding or deleting and ShapeContainer is done by the
undoSetupOfAddOrDelete method,
therefore this method sets up other types of changes. The types of changes are defined in the
UndoConstants class.
If a change occurs in an ShapeContainer,
a TextBox or a PaintStyle,
then the corresponding method sets the change code by using the
setChangeCode method of
the ShapeContainer.
Then this method calls the appropriate method according to the change code.
∙ If the change is UndoConstants.CONTAINER,
SHAPE,
or SIZE_POSITION,
then calls the undoSetupEndOfContainer method.
∙ If the change is UndoConstants.TEXTBOX,
then calls the undoSetupEndOfTextBox method.
∙ If the change is UndoConstants.PAINTSTYLE,
then calls the undoSetupEndOfPaintStyle method.
Finally, this method clears the undoSetup field,
undoEdit field
and the BackupContainerList.
|
undoSetupEndOfContainer
|
private boolean undoSetupEndOfContainer(ShapeContainer container)
Parameters:
container - The ShapeContainer object.
Processing:
Gets the clone of the container - the ShapeContainer object before changed -
rom the BackupContainerList.
Then creates a new UndoableDrawEdit.ChangeContainer object
for the container and its clone, and adds it to the UndoDrawManager.
: The container allows to be a group object.
|
undoSetupEndOfTextBox
|
private boolean undoSetupEndOfTextBox(ShapeContainer container)
Parameters:
container - The ShapeContainer object.
Processing:
Gets the clone of the container from the BackupContainerList
and gets all the TextBox objects of the child ShapeContainer objects of the container
by the getGroupedTextBoxes method.
Also gets the clones of the TextBox objects by the getGroupedTextBox method
of the clone of the container.
Then creates a new UndoableDrawEdit.ChangeTextBox object
for all the TextBox objects and their clones, and adds them to the
UndoDrawManager.
: The container allows to be a group object.
|
undoSetupEndOfPaintStyle
|
private boolean undoSetupEndOfPaintStyle(ShapeContainer container)
Parameters:
container - The ShapeContainer object.
Processing:
Gets the clone of the container from the BackupContainerList
and gets all the TextBox objects of the child ShapeContainer objects of the
container by the getGroupedPaintStyles method.
Also gets the clones of the TextBox objects by the getGroupedPaintStyle method
of the clone of the container.
Then creates a new UndoableDrawEdit.ChangePaintStyle object
for all the PaintStyle objects and their clones, and adds them to the
UndoDrawManager.
: The container allows to be a group object.
|
printContainers
|
public void printContainers()
This method is for debug. Prints out all the ShapeContainer object in
the ContainerList.
|
toString
|
public String toString()
Returns the string representing this object. The string is the print out of the printContainers methods.
|