Method |
Description |
Constructor
|
public ShapeContainer()
Create a new PaintStyle object and sets it to paintStyle field.
|
getContainerType
|
public int getContainerType()
Returns SHAPE if the ShapeElement
of this ShapeContainer isn't a GroupElement.
Returns GROUP if the ShapeElement
of this ShapeContainer is a GroupElement.
|
getShapeId
|
public String getShapeId()
Returns the shapeId field.
|
setShapeId
|
public void setShapeId(String shapeId)
Sets the shapeId parameter to the shapeId field.
This method is called only from the SerializableElementUtil object when an ShapeContainer object is inverted from a file data
and the ContainerManager.backup method.
|
setNewShapeId
|
public void setShapeId(ContainerManager manager, boolean withChildren)
Parameters:
manager - ContainerManager object.
withChildren - If true and this object is a group of shapes, then sets new shape Ids
to the children of this object.
Processing;
This method creates the shape id and sets it to shapeId field. If the withChildren equals true
, then sets shape Ids to the children of this object.
Here, calls the ContainerManager.getUniqueSerialNumber
method to get the serial number, and calls the configureShapeId
method with the serial number to get shapeId.
|
configureShapeId
|
private String configureShapeId(int number)
Parameters:
number - The serial number.
Returns:
The string of the shapeId.
Processing;
Configures the shape Id using the returned value of the
ShapeElement.getShapeIdString
method and the numberparameter.
|
getSerialNumber |
public int getSerialNumber()
Returns:
The serial number which was generated by the
ContainerManager.getUniqueSerialNumber method.
Processing;
Gets the serial number from shapeId.
|
getSerialNumber
(static) |
public static int getSerialNumber(String shapeId)
Parameters:
shapeId - The shape id.
Returns:
Returns the serial number of this object.
Processing;
Gets the serial number from shapeId.
|
getContainerIndex |
public int getContainerIndex()
Returns the containerIndex field. |
setContainerIndex |
public void setContainerIndex(int containerIndex)
Sets the containerIndex parameter to the containerIndex field.
|
getParent
|
public ShapeContainer getParent()
Return the parent field.
|
setParent
|
public void setParent(ShapeContainer parent)
Sets the parent parameter to the parent field.
|
getTopParent
|
public ShapeContainer getTopParent()
Return this object if this object has no parent, otherwise return
the top parent by calling this method of the parent ShapeContainer recursively.
|
getElement
|
public ShapeElement getElement()
Returns the element field.
|
setElement
|
public void setElement(ShapeElement element)
Sets the element parameter to the element field.
|
getMode
|
public int getMode()
Returns the mode field. |
setMode
|
public void setMode(int mode)
Sets the mode parameter to the mode field.
|
setSelected
|
public void setSelected(boolean selected)
Sets the selected parameter to the selected field.
If the selected parameter equals false and the returned value of the isEditableTextBox equals true, then calls makeTextBoxEditable(false).
If the ShapeElement of this ShapeContainer is a GroupElement, then sets the parameter of selected to all the child ShapeContainer
objects. To list up all the child ShapeContainer objects, the getGroupedContainers method is used.
|
isSelected
|
public boolean isSelected()
Returns the selected field.
|
setVisible |
public void setVisible(boolean visible)
Sets the visible parameter to the visible field.
|
isVisible |
public boolean isVisible()
Returns the visible field. |
isClosed |
public boolean isClosed()
Returns true if the shape element of this ShapeContainer is a closed
shape (the boundary is closed).
|
isEditableTextBox
|
public boolean isEditableTextBox()
Returns true if this object has a TextBox and its TextBox is editable.
|
makeTextBoxEditable
|
public void makeTextBoxEditable(boolean activate)
If this ShapeContainer hasn't a text box, skips the following steps.
If the activate parameter equals true, then calls the following methods.
if(!this.isSelected()) this.setSelected(true);
this.getTextBox().activateMouseListener(true);
If the activate parameter equals false, then calls the following method.
this.getTextBox().activateMouseListener(false);
|
makeTextBoxEditable |
public void makeTextBoxEditable(Point2D point, int ctrl)
Parameters:
point - The clicked point by the mouse.
ctrl - 0/1/2
If the mouse was clicked with holding down Shift/Ctrl key, the ctrl is 1/2.
Processing:
This method is called by the SelectionLS.execSelection method when the inside of a text box was clicked.
If this ShapeContainer hasn't a text box, skips the following steps.
∙ If the activate equals true, then calls the following method.
this.getTextBox().activateMouseListener(true);
∙ Displays the text cursor (caret) at the nearest position to
the point in the text box.
Performs the same logic as the TextBox.mouseClicked method.
Calls the TextBox.getCaretPositionAtMouse method
to get the text cursor (caret) position.
Calls the TextBox.setCaretPositionOrSelection method
to set the text cursor (caret) position to the text box.
|
getChangeCode
|
public int getChangeCode()
Returns the changeCode field, if this object isn't a group of shapes, otherwise returns the changeCode
of the child ShapeContainer. The child ShapeContainers are got by the
getGroupedSingleShapeContainers method.
|
setChangeCode
|
public void setChangeCode(int code)
Sets the code parameter to the changeCode field.
|
resetChangeCode
|
public void resetChangeCode()
Resets the changeCode (Sets -1 to the changeCode).
|
setProperty |
public void setProperty(String key, Object object)
Parameters:
key - property key
object - property value
=>property
Processing:
Stores property key and value of this shape.
|
getProperty |
public Object getProperty(String key)
Parameters:
key - property key
Returns:
Returns the property value (object) by the specified property
key.
|
removeProperty |
public void removeProperty(String key)
Parameters:
key - property key
Processing:
Removes the property key and the value (object) from the property.
|
getBooleanProperty |
public boolean getBooleanProperty()
Returns:
Returns the boolean value of the key.
|
getPaintStyle |
public PaintStyle getPaintStyle()
Returns the paintStyle field. |
setPaintStyle |
public void setPaintStyle(PaintStyle paintStyle)
Sets the paintStyle parameter to the paintStyle field.
|
getColors |
public Color[] getColors()
Returns the array of the colors which are used in the PaintStyle object and the CommittedTextContainer object. |
hasTextBox |
public boolean hasTextBox()
Returns true if this ShapeContainer has a text box.
|
addTextBox |
public int addTextBox()
Returns:
0 - Normal end.
1 - A text box isn't added because this object represents a group.
2 - The type of the ShapeElemnt isn't allowd =>bug.
3 - The ShapeElemnt isn't closed.
4 - This object already has a text box.
5 - A textarea is not found =>bug.
6 - the created textArea is too small(The width or height is under 10px).
Processing:
Creates a new TextBox object
and sets it to the textBox field.
To set a text area(textArea) to the newly created TextBox,
this method calls the ShapeElement.createTextArea abstract method
and sets its reurn value to the TextBox as follow.
newTextBox.setTextArea(textArea);
Here the reurn value represents the textArea of the Rectangle2D.
=> User's guide
create TextBox, add/delete text box
|
addTextBox |
public void addTextBox(Rectangle2D textArea)
Parameters:
textArea - The rectangle in which a new text box is placed.
Processing:
This method is called by SerializableElementUtil
to convert the SerializableElement data
to the ShapeContainer and its subordinate objects.
This method creates a new TextBox object
and sets it to the textBox field.
And registers this object to the new TextBox
by the setShapeContainer method.
|
deleteTextBox |
public int deleteTextBox()
Sets null to the textBox field of this object.
|
getTextBox |
public TextBox getTextBox()
Returns the textBox field.
|
setTextBox |
public void setTextBox(TextBox textBox)
Sets the textBox parameter to the textBox field. |
setConnectorTarget
Permission
|
public void setConnectorTargetPermission(boolean permission)
Sets the permission parameter to the connectorTargetPermission field.
This method is not used currently.
|
setConnectorPermission
|
public void setConnectorPermission(boolean permission)
Sets the permission parameter to the connectorPermission field.
If the shape of this ShapeContainer isn't a line or a polyline, sets
false to the connectorPermission field.
Sets false in the CutShape. Set true in the MoveResizeShapeLS when an end point of a line or a polyline is moved.
This method is not used except the above currently.
|
isConnectorTarget
|
public boolean isConnectorTarget()
Returns the connectorTargetPermission field.
|
isConnector
|
public boolean isConnector()
Returns the connectorPermission field.
|
compare
|
public boolean compare(ShapeContainer container)
Return true if this object equals the container.
|
compare
|
public boolean compare(ShapeContainer[] containers)
Return true if this object equals any of the containers.
|
getGroupedContainers
|
public ShapeContainer[] getGroupedContainers()
Returns:
The array which stores this object and all the child objects.
The first element of the array stores this object.
Processing:
If the ShapeElement of this object is a single shape element (not group
element), then returns this object, else returns this object and all the
child objects. All the child objects are searched by the
GroupElement.getGroupedContainers method.
Search example of the GroupElement.getGroupedContainers:
If this object is the Single shape(No-0) in Figure 2, then returns Single shape(No-0).
If this object is Group(No-1), then returns the Group(No-1), Group(No-2),
Single shape(No-3), Single shape(No-4), Group(No-5), Single shape(No-6),
Single shape(No-7).
|
getGroupedSingleShape
Containers
|
public ShapeContainer[] getGroupedSingleShapeContainers()
Returns:
The array which stores this object or all the child objects of this excluding
group objects.
Processing:
If the ShapeElement of this object is a single shape element (not group
element), then returns this object, else returns this object and all the
child objects excluding group objects. All the child objects are searched
by the GroupElement.getGroupedSingleShapeContainers.
Example: If this object is the Single shape(No-0) in Figure 2, then returns Single shape(No-0) If this ShapeContainer is Group(No-1),
then returns the Single shape(No-3), Single shape(no-4), Single shape(no-6).
and , Single shape(no-7).
|
getGroupedTextBoxes
|
public TextBox[] getGroupedTextBoxes()
Returns:
The array of all the TextBox objects which are linked from this ShapeContainer object.
Processing
To list up all the TextBox objects, the getGroupedSingleShapeContainers method is used.
Example: If this ShapeContainer is the "Single shape 0" in Figure 2, then returns "TextBox 0". If this ShapeContainer is "Group
0", then returns the "TextBox 4" and "TextBox 2".
|
getGroupedTextBox
|
public TextBox getGroupedTextBox(String shapeId)
Returns:
The TextBox object which is linked from this ShapeContainer object and whose ShapeContainer
has the shapeId.
Processing:
To list up all the TextBox objects, the getGroupedTextBoxes method is used.
|
getGroupedPaintStyles
|
publpublic PaintStyle[] getGroupedPaintStyles()
Returns:
The array of all the PaintStyle objects which are linked from this object..
Processing
To list up all the PaintStyle objects, the getGroupedSingleShapeContainers method is eused.
Example: If this object is the "Single shape 0" in Figure 2, then returns "PaintStyle 0". If this ShapeContainer is "Group
0", then returns the "PaintStyle 3", "PaintStyle 4"
and "PaintStyle 2".
|
getGroupedPaintStyle
|
public PaintStyle getGroupedPaintStyle(String shapeId)
Returns:
The PaintStyle object which is linked from this object and whose ShapeContainer has
the shapeId.
Processing:
To list up all the PaintStyle objects, the getGroupedTextBoxes method is used.
|
getBoundingBox
|
public Rectangle2D getBoundingBox()
Returns the bounding box which encloses this shape.
Calls the ShapeElement.getBoundingBox method.
|
setTextBoxLayout
|
public void setTextBoxLayout(Insets textBoxInsets, int textAlign, double
lineSpace)
Parameters:
textBoxInsets - The inner margin of the text box.
textAlign - The text align. Left align: 0. Center Align; 1, Right align: 2.
lineSpace - The line space.
Processing:
Sets the parameters to the text box of this object. If the shape element
of this object is a group of shapes, then sets the attributes to all the
text boxes of the child objects of this object.
To list up all the child objects, the getGroupedSingleShapeContainers method is used.
|
setFillColor
|
public void setFillColor(Color fillColor)
Parameters:
fillColor - The fill color with which the inside of the shape is painted.
Processing:
Sets the fillColor to the shape element of this object. If this object is a group of
shapes, then sets the fillColor to all the shape elements of the child objects of this object.
To list up all the child objects, the getGroupedSingleShapeContainers method is used.
|
setLineColor
|
public void setLineColor(Color lineColor)
Parameters:
lineColor - The line color with which the boundary of the shape is painted.
Processing:
Sets the lineColor to the shape element of this object. If the shape element of this
object is a group, then sets the lineColor to all the shape elements of the child objects of this object.
To list up all the child objects, the getGroupedSingleShapeContainers method is used.
|
setLineWidth
|
public void setLineWidth(String lineWidth)
Parameters:
lineWidth - The line width of the boundary of the shape.
Processing:
Sets the lineWidth to the shape element of this object. If this object is a group, then
sets the ineWidth to all the shape elements of the child objects of this object.
To list up all the child objects, the getGroupedSingleShapeContainers method is used.
|
setLineStroke
|
public void setlineStroke(String lineStroke)
Parameters:
lineStroke - The line stroke of the boundary of the shape.
Processing:
Sets the lineStroke to the shape element of this object. If the shape element of this
object is a group, then sets the lineStroke to all the shape elements of the child objects of this object.
To list up all the child objects, the getGroupedSingleShapeContainers method is used.
|
setArrowStyle
|
public void setArrowStyle(String arrowStyle)
Parameters:
arrowStyle - The arrow style. This attribute is effective for a line and a polyline.
Processing:
Sets the arrowStyle to the shape element of this object. If the shape element of this
object is a group, then sets the arrowStyle to all the shape elements of the child objects of this object.
To list up all the child objects, the getGroupedSingleShapeContainers method is used.
|
drawShape
|
public void drawShape(Graphics g)
If the shape element of this object is a group, then draws the group by
the recursive call of the drawShape method, otherwise performs
the following.
∙ Drawing the shape element.
Calls the DrawShapeUtil.drawShapeElement method.
∙ Drawing the TextBox, if this object has a text box.
Calls the TextBox.drawTextBox method.
∙ Drawing the control points if the mode of this object equals Command.MODIFYING_SHAPE_MODEODE
Calls the DrawShapeUtil.drawSegmentModifiers method.
∙ Drawing the selection box and the resize handles if the parent of this
object is null.
Calls the DrawShapeUtil.drawSelection method.
=> Drawing the objects in ShapeContainer
|
clone
|
public Object clone()
Returns:
The clone of this object.
Processing:
∙ If the shape element of this object isn't a group, then performs the
following.
Creates a new ShapeContainer object and the clones of TextBox, PaintStyle
of this object and combines the clones with the new ShapeContainer object
by bi-directional links.
∙ If the shape element of this object is a group, then performs the following.
Creates a new ShapeContainer object and a new GroupElement object and them by a bi-directional link.
Gets the child objects from the GroupElement object of this object and creates the clones of the child objects. Then adds them to the
the new GroupElement object by the addChildren method.
: The shapeId of the cloned ShapeContainer equals the shapeId of this object.
|
toString
|
public String toString()
Returns the string representing this object.
|
toShortString
|
public String toShortString()
Returns the short string representing this object.
|