public class NetObject
extends java.lang.Object
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.
Here are the possible bubble shapes:
Modifier and Type | Field and Description |
---|---|
static int |
JUSTIFY_CENTER
Center label justification
|
static int |
JUSTIFY_LEFT
Left label justification
|
static int |
JUSTIFY_RIGHT
Right label justification
|
static int |
OBJECT_BUBBLE
Bubble pbject
|
static int |
OBJECT_TEXT
Free label object
|
Constructor and Description |
---|
NetObject(int type,
int userType,
int maxInput,
int maxOutput,
int x,
int y)
Construct a NetObject.
|
Modifier and Type | Method and Description |
---|---|
void |
addChild(NetObject o)
Add the given object to the children list.
|
void |
clearChildren()
Clear the children list
|
NetObject |
getChildAt(int idx)
Returns child at the specified index.
|
int |
getChildrenNumber()
Returns the number of children.
|
java.awt.Color |
getColor()
Gets the background (fill color) of this object (when parent NetEditor is not editable)
|
java.lang.String |
getExtendedParam(int extIdx)
Returns the value of the specified extended param, an empty string if not found.
|
java.lang.String |
getExtendedParam(java.lang.String name)
Returns the value of the specified extended param, an empty string if not found.
|
int |
getExtendedParamIndex(java.lang.String name)
Returns the index of the specified extended param , -1 when not found
|
int |
getExtendedParamNumber()
Returns the number of extensions
|
int |
getJustify()
Returns current justification
|
java.lang.String |
getLabel()
Returns the label
|
int |
getMaxInput()
Returns maximum number of incoming link
|
int |
getMaxOutput()
Returns maximum number of outgoing link
|
java.lang.String |
getName()
Get object name.
|
NetObject |
getParentAt(int idx)
Returns the parent object at the specified index.
|
int |
getParentNumber()
Returns the number of parent
|
boolean |
getSelected() |
int |
getShape()
Returns shape of this object
|
int |
getSize()
Gets the object size
|
java.awt.Font |
getTextFont()
Get the font of this object
|
int |
getType()
Return the type of this NetObject.
|
int |
getUserType()
Returns the user defined type.
|
java.lang.Object |
getUserValue()
Returns the user value
|
int |
getXOrigin()
Returns X pixel coordinates.Returns a valid value only if
this object has been inserted in a NetEditor.
|
int |
getYOrigin()
Returns Y pixel coordinates.Returns a valid value only if
this object has been inserted in a NetEditor.
|
boolean |
isChildOf(NetObject o)
Returns true if this object is child of o
|
boolean |
isParentOf(NetObject o)
Returns true if this object is parent of o
|
void |
paint(java.awt.Graphics2D g)
Paint this NetObject.
|
void |
paintLink(java.awt.Graphics2D g,
NetObject child,
boolean drawArrow)
Paint the link beetween this object and child.
|
void |
removeChild(int i)
Remove the specified child from the children list.
|
void |
removeChild(NetObject o)
Remove the specified child from the children list.
|
void |
setBottomLabel(java.lang.String s)
Sets the label displayed at the bottom left of this object.
|
void |
setCenterLabel(java.lang.String s)
Sets the label displayed at the center of this object.
|
void |
setColor(java.awt.Color c)
Sets the background (fill color) of this object (when parent NetEditor is not editable)
|
void |
setEditableShape(boolean b)
Set the editable shape properties.
|
void |
setExtendedParam(int extIdx,
java.lang.String value)
Sets the extended param value.
|
void |
setExtendedParam(java.lang.String name,
java.lang.String value)
Sets the extended param value.
|
void |
setExtensionList(java.lang.String[] names)
Sets the list of extended parameter name for this bubble object.
|
void |
setJustify(int i)
Sets the label justification of this object.
|
void |
setLabel(java.lang.String value)
Sets the free label of this object.
|
void |
setLabel(java.lang.String[] value)
Sets the free lablel
|
void |
setSelected(boolean s)
Select or not this NetObject within the editor.
|
void |
setShape(int s)
Sets the shape of this object
|
void |
setSize(int size)
Sets the object size
|
void |
setTextFont(java.awt.Font f)
Set the font of this object.
|
void |
setUserValue(java.lang.Object v)
Sets the user value for external usage
|
public static final int OBJECT_BUBBLE
public static final int OBJECT_TEXT
public static final int JUSTIFY_LEFT
public static final int JUSTIFY_RIGHT
public static final int JUSTIFY_CENTER
public NetObject(int type, int userType, int maxInput, int maxOutput, int x, int y)
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 ...OBJECT_BUBBLE
,
OBJECT_TEXT
public void addChild(NetObject o)
o
- Child objectpublic void removeChild(NetObject o)
o
- Child object to removepublic void removeChild(int i)
i
- Child indexpublic int getChildrenNumber()
public NetObject getChildAt(int idx)
idx
- Child indexpublic void clearChildren()
public int getParentNumber()
public NetObject getParentAt(int idx)
idx
- Parent indexpublic boolean isParentOf(NetObject o)
public boolean isChildOf(NetObject o)
public java.lang.String getLabel()
public void setLabel(java.lang.String value)
value
- Labelpublic void setLabel(java.lang.String[] value)
public java.lang.String getName()
public int getType()
OBJECT_BUBBLE
,
OBJECT_TEXT
public int getUserType()
public void setShape(int s)
s
- ShapeNetShape
public int getShape()
public void setEditableShape(boolean b)
b
- True to make the shape editable (via the NetObjectDlg), false otherwise.public void setJustify(int i)
JUSTIFY_LEFT
,
JUSTIFY_RIGHT
,
JUSTIFY_CENTER
public int getJustify()
setJustify(int)
public int getMaxInput()
public int getMaxOutput()
public void setCenterLabel(java.lang.String s)
public void setBottomLabel(java.lang.String s)
public void setColor(java.awt.Color c)
public java.awt.Color getColor()
public void setSize(int size)
public int getSize()
public void setUserValue(java.lang.Object v)
public java.lang.Object getUserValue()
public void setExtensionList(java.lang.String[] names)
names
- List of namespublic void setExtendedParam(java.lang.String name, java.lang.String value)
name
- Param namevalue
- Param valuesetExtensionList(java.lang.String[])
public void setExtendedParam(int extIdx, java.lang.String value)
extIdx
- Index of the extensions.value
- param valuesetExtensionList(java.lang.String[])
public java.lang.String getExtendedParam(java.lang.String name)
name
- Param namesetExtensionList(java.lang.String[])
public java.lang.String getExtendedParam(int extIdx)
extIdx
- Index of the extensions.setExtensionList(java.lang.String[])
public int getExtendedParamNumber()
public int getExtendedParamIndex(java.lang.String name)
public void setTextFont(java.awt.Font f)
f
- Fontpublic java.awt.Font getTextFont()
public int getXOrigin()
public int getYOrigin()
public void setSelected(boolean s)
s
- True to select, false otherwisepublic boolean getSelected()
public void paintLink(java.awt.Graphics2D g, NetObject child, boolean drawArrow)
g
- Graphics objectchild
- child objectdrawArrow
- true to draw arrowpublic void paint(java.awt.Graphics2D g)
g
- Graphics object