|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.awt.Component java.awt.Container javax.swing.JComponent javax.swing.JPanel entorno.grafo.DrawingArea
Clase: DrawingArea Funcion: Clase del area de dibujo.
Nested Class Summary |
---|
Nested classes inherited from class javax.swing.JPanel |
---|
javax.swing.JPanel.AccessibleJPanel |
Nested classes inherited from class javax.swing.JComponent |
---|
javax.swing.JComponent.AccessibleJComponent |
Nested classes inherited from class java.awt.Container |
---|
java.awt.Container.AccessibleAWTContainer |
Nested classes inherited from class java.awt.Component |
---|
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
Field Summary | |
---|---|
int |
ADD_EDGE
|
int |
ADD_NODE
|
private int |
clickAction
the current action to take when a click occurs in this drawing area |
private GraphGUI |
controller
|
int |
DIRECTED_PROPERTY
|
private int |
EDGE_ARROW_SIZE
|
private double |
escala
|
Graph |
graph
|
private int |
maxAction
|
int |
MOVE_NODE
|
private int |
MULTI_EDGE_SEP_SIZE
|
private int |
nextNodeIndex
|
int |
NO_ACTION
|
private int |
nodeRadius
|
private java.util.HashSet |
nodos_selecc
|
int |
PREDEFINIR
|
private java.awt.Dimension |
preferredSize
|
private java.awt.print.PageFormat |
printerPageFormat
|
private java.awt.Point |
pto_click_nodo
|
private java.awt.Point |
pto_final
|
private java.awt.Point |
pto_origen
|
int |
REMOVE_EDGE
|
int |
REMOVE_NODE
|
int |
RENOMBRAR
|
private boolean |
seleccionando
|
private Graph.Node |
startNode
|
java.lang.String[] |
statusTexts
the messages to display in the status bar for each click action |
private Graph.Node |
stopNode
|
boolean |
verDefinicionFull
|
boolean |
verInc_BOOL
|
boolean |
verInc_UP
|
boolean |
verPredefinidos
|
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 java.awt.print.Printable |
---|
NO_SUCH_PAGE, PAGE_EXISTS |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
DrawingArea(GraphGUI controller)
Constructor. |
Method Summary | |
---|---|
private void |
actualizarNodosSelecc(java.awt.Point pto_destino)
|
boolean |
addEdge(Graph.Node n1,
Graph.Node n2)
Añade una arista al Grafo n1 : nodo comienzo n2 : nodo final Devuelve true si la arista se ha añadido bien |
boolean |
addNode(java.awt.Point position)
Añade un nodo al grafo Devuelve true si el nodo se ha añadido bien |
private float |
distance(java.awt.Point point1,
java.awt.Point point2)
Devuelve la distancia entre 2 puntos |
private void |
drawCurve(java.awt.Graphics g,
java.awt.Point start,
java.awt.Point mid,
java.awt.Point stop)
Dibuja una curva desde start, pasando por mid y terminando en stop |
private void |
drawEdge(java.awt.Graphics g,
Graph.Node node,
Graph.Edge edge)
Dibuja 1 arista en el grafo. |
private void |
drawNode(java.awt.Graphics g,
Graph.Node node)
Dibuja un nodo en el grafo |
private boolean |
estaNodoEnArea(Graph.Node n,
java.awt.Rectangle a)
|
private Graph.Node |
findNodeAtPosition(java.awt.Point position)
Encuentro el nodo dado en la posición Devuelve el nodo encontrado o null si no lo ha encontrado |
double |
getEscala()
|
java.awt.Dimension |
getPreferredSize()
|
int |
getRadioNodo()
|
private boolean |
isSeleccionando()
|
private java.awt.Point |
keepNodeInside(java.awt.Point position)
Ajusta la posición del nodo si es necesario para que quepa en el area. |
private void |
moverNodosSelecc(int dist_x,
int dist_y)
|
void |
newGraph()
|
void |
paintComponent(java.awt.Graphics g)
Método que pinta en el area de dibujo el grafico 'g' |
int |
print(java.awt.Graphics g,
java.awt.print.PageFormat pf,
int pi)
Imprime el grafo g con el formato de pagina pf y el nº de pagina pi. |
void |
printerSetup()
|
void |
printThis()
|
boolean |
randomGraph()
|
boolean |
removeNode(java.awt.Point position)
Borra un nodo del grafo que esté en la posición dada Devuelve true si el nodo ha sido borrado |
void |
resetGraph()
|
void |
setClickAction(int action)
|
void |
setEscala(double newEscala)
|
void |
setGraph(Graph g)
|
void |
setNextNodeIndex()
|
void |
setProperty(int prop,
boolean state)
Establece las propiedades del grafo. |
void |
setRadioNodo(int r)
|
private void |
setSeleccionando(boolean v)
|
Methods inherited from class javax.swing.JPanel |
---|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI |
Methods inherited from class javax.swing.JComponent |
---|
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update |
Methods inherited from class java.awt.Container |
---|
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree |
Methods inherited from class java.awt.Component |
---|
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private GraphGUI controller
public Graph graph
public boolean verPredefinidos
public boolean verDefinicionFull
public boolean verInc_BOOL
public boolean verInc_UP
private double escala
private Graph.Node startNode
private Graph.Node stopNode
private int nextNodeIndex
private java.awt.Dimension preferredSize
private int nodeRadius
private java.awt.Point pto_click_nodo
private java.awt.Point pto_origen
private java.awt.Point pto_final
private java.util.HashSet nodos_selecc
private boolean seleccionando
private final int EDGE_ARROW_SIZE
private final int MULTI_EDGE_SEP_SIZE
private java.awt.print.PageFormat printerPageFormat
public final int DIRECTED_PROPERTY
public final int NO_ACTION
public final int ADD_NODE
public final int ADD_EDGE
public final int MOVE_NODE
public final int REMOVE_NODE
public final int REMOVE_EDGE
public final int RENOMBRAR
public final int PREDEFINIR
private final int maxAction
private int clickAction
public final java.lang.String[] statusTexts
Constructor Detail |
---|
public DrawingArea(GraphGUI controller)
Method Detail |
---|
private void setSeleccionando(boolean v)
private boolean isSeleccionando()
private void moverNodosSelecc(int dist_x, int dist_y)
private boolean estaNodoEnArea(Graph.Node n, java.awt.Rectangle a)
private void actualizarNodosSelecc(java.awt.Point pto_destino)
public void setEscala(double newEscala)
public double getEscala()
public void setRadioNodo(int r)
public int getRadioNodo()
public void setGraph(Graph g)
public void paintComponent(java.awt.Graphics g)
paintComponent
in class javax.swing.JComponent
public java.awt.Dimension getPreferredSize()
getPreferredSize
in class javax.swing.JComponent
public void printerSetup()
public void printThis()
public int print(java.awt.Graphics g, java.awt.print.PageFormat pf, int pi) throws java.awt.print.PrinterException
print
in interface java.awt.print.Printable
java.awt.print.PrinterException
public void newGraph()
public boolean randomGraph()
public void setClickAction(int action)
public void resetGraph()
public void setProperty(int prop, boolean state)
public void setNextNodeIndex()
private java.awt.Point keepNodeInside(java.awt.Point position)
public boolean addNode(java.awt.Point position)
public boolean addEdge(Graph.Node n1, Graph.Node n2)
public boolean removeNode(java.awt.Point position)
private Graph.Node findNodeAtPosition(java.awt.Point position)
private float distance(java.awt.Point point1, java.awt.Point point2)
private void drawNode(java.awt.Graphics g, Graph.Node node)
private void drawEdge(java.awt.Graphics g, Graph.Node node, Graph.Edge edge)
private void drawCurve(java.awt.Graphics g, java.awt.Point start, java.awt.Point mid, java.awt.Point stop)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |