|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JLabel
verinec.gui.core.NwComponent
verinec.gui.core.NwNode
verinec.gui.core.PCNode
public class PCNode
Represents a node of the network.
Do not create directly, but use VerinecStudio.addNode(int,int)
A node must know its interfaces and be able to calculate the positions for
new interfaces.
A node can be created from XML definition or as a new node that is added to the XML.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class verinec.gui.core.NwNode |
|---|
NwNode.MoveKeyListener |
| Nested classes/interfaces inherited from class verinec.gui.core.NwComponent |
|---|
NwComponent.Mouse |
| Nested classes/interfaces inherited from class javax.swing.JLabel |
|---|
JLabel.AccessibleJLabel |
| Nested classes/interfaces inherited from class javax.swing.JComponent |
|---|
JComponent.AccessibleJComponent |
| Nested classes/interfaces inherited from class java.awt.Container |
|---|
Container.AccessibleAWTContainer |
| Nested classes/interfaces inherited from class java.awt.Component |
|---|
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy |
| Field Summary | |
|---|---|
private static String |
defaultIcon
|
private boolean |
deleting
To know if the node is currently being deleted. |
static int |
IF_ABOVE
Interface is to be placed above node. |
static int |
IF_BELOW
Interface is to be placed below node. |
static int |
IF_LEFT
Interface is to be placed on the left side of node. |
static int |
IF_RIGHT
Interface is to be placed on the right side of node. |
private Vector[] |
interfaces
array of the 4 sides of the node for interfaces. |
| Fields inherited from class verinec.gui.core.NwNode |
|---|
dragged |
| Fields inherited from class verinec.gui.core.NwComponent |
|---|
componentIcon, componentIconNeg, config, drawPanel, gui, pos, selection, type |
| Fields inherited from class javax.swing.JLabel |
|---|
labelFor |
| Fields inherited from class javax.swing.JComponent |
|---|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
| Fields inherited from class java.awt.Component |
|---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
| Fields inherited from interface javax.swing.SwingConstants |
|---|
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST |
| Fields inherited from interface java.awt.image.ImageObserver |
|---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| Constructor Summary | |
|---|---|
PCNode(Element config,
VerinecStudio gui)
Use to create a node from a JDom definition element. |
|
PCNode(int posX,
int posY,
VerinecStudio gui)
Do not use outside VerinecStudio, but use VerinecStudio.addNode(int,int)
Creates a new node with no interfaces and a random number as name. |
|
| Method Summary | |
|---|---|
protected static Element |
createElement(int posX,
int posY)
Creates a skeleton of a minimal node Element. |
NwInterface |
createInterface(int type)
Creates and adds an interface of the specified type to the node. |
void |
delete()
Deletes the component and all its interfaces. |
String |
getDomain()
The domain this host is in. |
private Point |
getInterfacePosition(int side,
int pos,
int sidecount)
Get the location for the pos-th interface on specified side of the node. |
Vector |
getInterfaces()
Returns a Vector containing all the interfaces attached to this node. |
private int |
getMaxInterfaceCount()
Get the largest number of interfaces found on one side. |
String |
getName()
Get the name of this node. |
private int |
getNextInterfaceSide()
Get the next side to put an interface at. |
int |
getType()
Get the network type - which is invalid for a node. |
protected void |
guiAddInterface(NwInterface iface,
int side)
Add an interface to the graphical representation of the node. |
protected void |
guiRemoveInterface(NwInterface iface,
int side)
Remove an interface to the graphical representation of the node. |
protected void |
removeInterface(NwInterface nwInterface)
Removes the specified interface from the node and - if needed - resizes the node. |
private void |
scale(int correction)
Changes the size of the node by 2*correction pixels. |
void |
setBounds(int x,
int y,
int w,
int h)
Moves the node and all its interfaces. |
void |
setInterfaceSide(NwInterface i,
int oldside,
int newside)
Set on which side an interface should be located. |
| Methods inherited from class verinec.gui.core.NwNode |
|---|
addNodeinfoElement, createNodeInfo, getLayoutChild, initialize, resizeComponent |
| Methods inherited from class verinec.gui.core.NwComponent |
|---|
addContextMenu, addContextMenuSeparator, changeIcon, getAbsX, getAbsY, getConfig, getDefaultSize, getRandomId, isSelected, moveComponent, resizeDefaultSize, setBounds, setLocation, setLocation, setSelected, showIcon |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
private static String defaultIcon
private Vector[] interfaces
public static final int IF_RIGHT
public static final int IF_BELOW
public static final int IF_LEFT
public static final int IF_ABOVE
private boolean deleting
| Constructor Detail |
|---|
public PCNode(int posX,
int posY,
VerinecStudio gui)
VerinecStudio.addNode(int,int)
Creates a new node with no interfaces and a random number as name.
posX - The horizontal postition of the node.posY - The vertical postition of the node.gui - The main application.
public PCNode(Element config,
VerinecStudio gui)
VerinecNamespaces.NS_NODE
Does not register the XML in the VerinecStudio node tree.
config - The XML element containing the node.gui - The main application.| Method Detail |
|---|
public int getType()
getType in class NwComponentRuntimeException - Always throws a RuntimeException.NetworkTypes
protected static Element createElement(int posX,
int posY)
posX - the x postition of the node.posY - the y postition of the node.
public final void setBounds(int x,
int y,
int w,
int h)
setBounds in class NwNodex - Top left corner x coordinatey - Top left corner y coordinatew - With of componenth - Height of componentpublic final void delete()
delete in class NwComponentpublic final Vector getInterfaces()
public void setInterfaceSide(NwInterface i,
int oldside,
int newside)
i - The interface to change.oldside - The side the interface is currently located on.newside - The side to move the interface to.public final String getName()
VerinecStudio.nwComponentStateChanged(NwComponent).
getName in class Componentpublic final String getDomain()
protected final void removeInterface(NwInterface nwInterface)
nwInterface - the interface that shall be removed.public final NwInterface createInterface(int type)
type - The network type. Must be one of NetworkTypes.getTypes()
NetworkTypes
protected void guiAddInterface(NwInterface iface,
int side)
iface - The interface to add.side - The side to add the interface on (one of IF_ABOVE, IF_RIGHT, IF_BELOW, IF_LEFT).
protected void guiRemoveInterface(NwInterface iface,
int side)
iface - The interface to remove.side - The side the interface is located (one of IF_ABOVE, IF_RIGHT, IF_BELOW, IF_LEFT).private final int getNextInterfaceSide()
private void scale(int correction)
correction - Modification of node size in pixels, may be negative to make node smaller.
private Point getInterfacePosition(int side,
int pos,
int sidecount)
side - Side of the node.pos - Position in the list on that side.sidecount - The number of nodes this side will have. (Needed in case the interface is to be added.)
private int getMaxInterfaceCount()
|
Copyright © 2005 Verinec, DIUF | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||