Class NetObject
The bubble object which is the main object . A bubble accept a free label that can be moved by the user , 2 small fixed labels (one centered and one at the bottom left) and can have extensions : A list of named parameters associated to a string value. You can also specifie the maximum number of incoming/outgoing links and its shape. The coordinates of a bubble are in GRID unit.
The text object which is a free label moveable by the user. You can also specify a font for this object. The text object does not accept links , extensions , small fixed labels and shape. The coordinates for a text object a in pixel.
Important: It is not recommended to subclass this NetObject class because it would be too complex to provide a full overridable interface including file,undo and clipboard management. Nevertheless, when using the NetEditor in non editable mode, it is possible either to override NetEditor.loadFile() or NetEditor.addObject() to convert loaded NetObject into a new type. As there is no undo or clipboard operation, your objects will not be affected.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intCenter label justificationstatic final intLeft label justificationstatic final intRight label justificationstatic final intBubble pbjectstatic final intFree label object -
Constructor Summary
ConstructorsConstructorDescriptionNetObject(int type, int userType, int maxInput, int maxOutput, int x, int y) Construct a NetObject. -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd the given object to the children list.voidClear the children listgetChildAt(int idx) Returns child at the specified index.intgetColor()getExtendedParam(int extIdx) Returns the value of the specified extended param, an empty string if not found.getExtendedParam(String name) Returns the value of the specified extended param, an empty string if not found.intgetExtendedParamIndex(String name) intintgetLabel()intintgetName()Get object name.getParentAt(int idx) Returns the parent object at the specified index.intbooleanintgetShape()intgetSize()intgetType()intintintbooleanbooleanvoidpaint(Graphics2D g) Paint this NetObject.voidpaintLink(Graphics2D g, NetObject child, boolean drawArrow) Paint the link beetween this object and child.voidremoveChild(int i) Remove the specified child from the children list.voidRemove the specified child from the children list.voidSets the label displayed at the bottom left of this object.voidSets the label displayed at the center of this object.voidSets the background (fill color) of this object (when parent NetEditor is not editable)voidsetEditableShape(boolean b) Set the editable shape properties.voidsetExtendedParam(int extIdx, String value) Sets the extended param value.voidsetExtendedParam(String name, String value) Sets the extended param value.voidsetExtensionList(String[] names) Sets the list of extended parameter name for this bubble object.voidsetJustify(int i) Sets the label justification of this object.voidSets the free label of this object.voidSets the free labelsvoidsetSelected(boolean s) Select or not this NetObject within the editor.voidsetShape(int s) Sets the shape of this objectvoidsetSize(int size) Sets the object sizevoidsetTextFont(Font f) Set the font of this object.voidSets the user value for external usage
-
Field Details
-
OBJECT_BUBBLE
public static final int OBJECT_BUBBLEBubble pbject- See Also:
-
OBJECT_TEXT
public static final int OBJECT_TEXTFree label object- See Also:
-
JUSTIFY_LEFT
public static final int JUSTIFY_LEFTLeft label justification- See Also:
-
JUSTIFY_RIGHT
public static final int JUSTIFY_RIGHTRight label justification- See Also:
-
JUSTIFY_CENTER
public static final int JUSTIFY_CENTERCenter label justification- See Also:
-
-
Constructor Details
-
NetObject
public NetObject(int type, int userType, int maxInput, int maxOutput, int x, int y) Construct a NetObject.- Parameters:
type- Type of this NetObjectuserType- User defined type of this NetObjectmaxInput- Maximum number of incoming link for this bubblemaxOutput- Maximum number of outgoing link for this bubblex- x coordinates (GRID coordinates for BUBBLE , pixel for TEXT)y- y coordinates ...- See Also:
-
-
Method Details
-
addChild
Add the given object to the children list.- Parameters:
o- Child object
-
removeChild
Remove the specified child from the children list.- Parameters:
o- Child object to remove
-
removeChild
public void removeChild(int i) Remove the specified child from the children list.- Parameters:
i- Child index
-
getChildrenNumber
public int getChildrenNumber()- Returns:
- the number of children.
-
getChildAt
Returns child at the specified index.- Parameters:
idx- Child index- Returns:
- Child NetObject
-
clearChildren
public void clearChildren()Clear the children list -
getParentNumber
public int getParentNumber()- Returns:
- the number of parent
-
getParentAt
Returns the parent object at the specified index.- Parameters:
idx- Parent index- Returns:
- Parent NetObject
-
isParentOf
- Parameters:
o- NetObject- Returns:
- true if this object is parent of o
-
isChildOf
- Parameters:
o- NetObject- Returns:
- true if this object is child of o
-
getLabel
- Returns:
- the label
-
setLabel
Sets the free label of this object.- Parameters:
value- Label
-
setLabel
Sets the free labels- Parameters:
value- Labels
-
getName
Get object name.- Returns:
- 'Bubble' or 'Text'
-
getType
public int getType()- Returns:
- the type of this NetObject.
- See Also:
-
getUserType
public int getUserType()- Returns:
- the user defined type.
-
setShape
public void setShape(int s) Sets the shape of this object- Parameters:
s- Shape- See Also:
-
getShape
public int getShape()- Returns:
- shape of this object
-
setEditableShape
public void setEditableShape(boolean b) Set the editable shape properties.- Parameters:
b- True to make the shape editable (via the NetObjectDlg), false otherwise.
-
setJustify
public void setJustify(int i) Sets the label justification of this object.- Parameters:
i- Justify value- See Also:
-
getJustify
public int getJustify()- Returns:
- current justification
- See Also:
-
getMaxInput
public int getMaxInput()- Returns:
- maximum number of incoming link
-
getMaxOutput
public int getMaxOutput()- Returns:
- maximum number of outgoing link
-
setCenterLabel
Sets the label displayed at the center of this object. It uses the NetEditor small font.- Parameters:
s- Label
-
setBottomLabel
Sets the label displayed at the bottom left of this object. It uses the NetEditor small font.- Parameters:
s- Label
-
setColor
Sets the background (fill color) of this object (when parent NetEditor is not editable)- Parameters:
c- Background color
-
getColor
- Returns:
- the background (fill color) of this object (when parent NetEditor is not editable)
-
setSize
public void setSize(int size) Sets the object size- Parameters:
size- Object size
-
getSize
public int getSize()- Returns:
- the object size
-
setUserValue
Sets the user value for external usage- Parameters:
v- User value
-
getUserValue
- Returns:
- the user value
-
setExtensionList
Sets the list of extended parameter name for this bubble object. Text does not accept extensions.- Parameters:
names- List of names
-
setExtendedParam
Sets the extended param value.- Parameters:
name- Param namevalue- Param value- See Also:
-
setExtendedParam
Sets the extended param value.- Parameters:
extIdx- Index of the extensions.value- param value- See Also:
-
getExtendedParam
Returns the value of the specified extended param, an empty string if not found.- Parameters:
name- Param name- Returns:
- param value
- See Also:
-
getExtendedParam
Returns the value of the specified extended param, an empty string if not found.- Parameters:
extIdx- Index of the extensions.- Returns:
- param value
- See Also:
-
getExtendedParamNumber
public int getExtendedParamNumber()- Returns:
- the number of extensions
-
getExtendedParamIndex
- Parameters:
name- Param name- Returns:
- the index of the specified extended param , -1 when not found
-
setTextFont
Set the font of this object. Only TEXT object accept font- Parameters:
f- Font
-
getTextFont
- Returns:
- the font of this object
-
getXOrigin
public int getXOrigin()- Returns:
- X pixel coordinates.Returns a valid value only if this object has been inserted in a NetEditor.
-
getYOrigin
public int getYOrigin()- Returns:
- Y pixel coordinates.Returns a valid value only if this object has been inserted in a NetEditor.
-
setSelected
public void setSelected(boolean s) Select or not this NetObject within the editor.- Parameters:
s- True to select, false otherwise
-
getSelected
public boolean getSelected()- Returns:
- True if this NetObject is selected.
-
paintLink
Paint the link beetween this object and child.- Parameters:
g- Graphics objectchild- child objectdrawArrow- true to draw arrow
-
paint
Paint this NetObject.- Parameters:
g- Graphics object
-