|
||||||||||
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
fr.umlv.unitex.GenericGraphicalZone
public abstract class GenericGraphicalZone
This class describes a component on which a graph can be drawn.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
javax.swing.JComponent.AccessibleJComponent |
Field Summary | |
---|---|
int |
EDITING_MODE
Indicates mouse's editing mode |
java.util.ArrayList |
graphBoxes
ArrayList containing all the graph's boxes |
int |
Height
Height of the drawing area. |
boolean |
isGrid
Indicates if a grid be drawn in backend |
boolean |
modified
Indicates if the graph contains unsaved modifications. |
int |
nPixels
Indicates the size of the grid's cells |
javax.swing.JInternalFrame |
parentFrame
JInternalFrame that contains this component |
double |
scaleFactor
Zoom factor |
java.util.ArrayList |
selectedBoxes
ArrayList containing the current selected boxes |
javax.swing.JTextField |
texte
Text field in which the content of boxes can be edited. |
int |
Width
Width of the drawing area. |
Fields inherited from class javax.swing.JComponent |
---|
TOOL_TIP_TEXT_KEY, 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.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
GenericGraphicalZone(int w,
int h,
javax.swing.JTextField t,
javax.swing.JInternalFrame p)
Constructs a new GenericGraphicalZone . |
|
GenericGraphicalZone(int w,
int h,
javax.swing.JTextField t,
TextAutomatonFrame p)
Constructs a new GenericGraphicalZone . |
Method Summary | |
---|---|
void |
addBox(GenericGraphBox g)
Adds a graph box to the graph |
void |
addReverseTransitionsFromSelectedBoxes(GenericGraphBox src)
Adds transitions from a specified graph box to all selected boxes |
void |
addTransitionsFromSelectedBoxes(GenericGraphBox dest,
boolean save)
Adds transitions from all selected boxes to a specified graph box |
void |
addUndoableEditListener(javax.swing.event.UndoableEditListener listener)
|
void |
drawAllBoxes(java.awt.Graphics2D gr)
Draws all boxes of the graph |
void |
drawAllTransitions(java.awt.Graphics2D gr)
Draws all graph's transitions |
void |
drawGrid(java.awt.Graphics2D f)
Draws the grid of the graph if the isGrid field is set to
true |
void |
drawTransitionsFromMousePointerToSelectedBoxes(java.awt.Graphics2D gr)
Adds transitions from the last mouse click position to all selected boxes |
void |
drawTransitionsFromSelectedBoxesToMousePointer(java.awt.Graphics2D gr)
Adds transitions from all selected boxes to the last mouse click position |
java.awt.Rectangle |
getClipZone()
|
int |
getSelectedBox(int x,
int y)
Finds the box that is selected by a click |
java.util.ArrayList |
getSelectedBoxes()
|
java.util.ArrayList |
getTransitionTo(GenericGraphBox dest)
Removes all transitions that go to a specified graph box |
void |
HBottomAlign()
Aligns horizontally all selected boxes on the lower box |
void |
HCenterAlign()
Aligns horizontally all selected boxes on the average Y coordinate of these boxes |
void |
HTopAlign()
Aligns horizontally all selected boxes on the upper box |
void |
initText(java.lang.String s)
Sets the text field content |
void |
pasteSelection(MultipleSelection m)
Paste a graph box selection in the graph. |
void |
postEdit(javax.swing.undo.UndoableEdit e)
|
void |
removeSelected()
Remove all selected graph boxes |
void |
removeTransitionsToSelected()
Removes all transitions that go selected graph boxes |
void |
removeTransitionTo(GenericGraphBox dest)
Removes all transitions that go to a specified graph box |
void |
removeUndoableEditListener(javax.swing.event.UndoableEditListener listener)
|
void |
selectAllBoxes()
Select all graph boxes |
void |
selectByRectangle(int x,
int y,
int w,
int h)
Selects all graph boxes that have a non empty intersection with a selection rectangle |
void |
setClipZone(java.awt.Rectangle r)
|
void |
setGrid(boolean b)
Sets the isGrid field |
void |
setGrid(boolean b,
int n)
Sets the isGrid field |
void |
setModified(boolean b)
Indicates if the graph must be marked as modified are not |
void |
setRightToLeft(boolean b)
Indicates if the graph must be drawn from right to left or not. |
void |
setTextForSelected(java.lang.String s)
Sets the content for all selected graph boxes |
void |
translateAllSelectedBoxes(int dx,
int dy)
Translates all selected graph boxes |
void |
unSelectAllBoxes()
Unselect all selected graph boxes |
void |
updateAllBoxes()
Updates all graph's boxes |
void |
validateTextField()
Validates the text field content |
void |
VCenterAlign()
Aligns vertically all selected boxes on the average X coordinate of these boxes |
void |
VLeftAlign()
Aligns vertically all selected boxes on the leftmost box |
void |
VRightAlign()
Aligns vertically all selected boxes on the rightmost box |
Methods inherited from class javax.swing.JComponent |
---|
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, 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, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI |
Methods inherited from class java.awt.Container |
---|
add, add, add, add, add, addContainerListener, 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, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate |
Methods inherited from class java.awt.Component |
---|
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, 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, 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 |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public boolean modified
public int Width
public int Height
public javax.swing.JTextField texte
public java.util.ArrayList selectedBoxes
public java.util.ArrayList graphBoxes
public boolean isGrid
public int nPixels
public javax.swing.JInternalFrame parentFrame
JInternalFrame
that contains this component
public double scaleFactor
public int EDITING_MODE
Constructor Detail |
---|
public GenericGraphicalZone(int w, int h, javax.swing.JTextField t, javax.swing.JInternalFrame p)
GenericGraphicalZone
.
w
- width of the drawing areah
- heig ht of the drawing areat
- text field to edit box contentsp
- frame that contains the componentpublic GenericGraphicalZone(int w, int h, javax.swing.JTextField t, TextAutomatonFrame p)
GenericGraphicalZone
.
w
- width of the drawing areah
- height of the drawing areat
- text field to edit box contentsp
- frame that contains the componentMethod Detail |
---|
public void addBox(GenericGraphBox g)
g
- the graph boxpublic void pasteSelection(MultipleSelection m)
m
- the graph box selectionpublic void initText(java.lang.String s)
s
- the new contentpublic void validateTextField()
public void setModified(boolean b)
b
- true
if the graph must be marked as modified,
false
otherwisepublic void removeTransitionTo(GenericGraphBox dest)
dest
- the target graph boxpublic java.util.ArrayList getTransitionTo(GenericGraphBox dest)
dest
- the target graph box
public void removeTransitionsToSelected()
public void removeSelected()
public void setTextForSelected(java.lang.String s)
s
- the new contentpublic int getSelectedBox(int x, int y)
x
- X coordinate of the clicky
- Y coordinate of the click
graphBoxes
vector,
or -1 if no box was selected by the clickpublic void unSelectAllBoxes()
public void selectAllBoxes()
public void selectByRectangle(int x, int y, int w, int h)
x
- X coordinate of the selection rectangley
- Y coordinate of the selection rectanglew
- width of the selection rectangleh
- height of the selection rectanglepublic void translateAllSelectedBoxes(int dx, int dy)
dx
- value to be added to X coordinatesdy
- value to be added to Y coordinatespublic void addTransitionsFromSelectedBoxes(GenericGraphBox dest, boolean save)
dest
- the target graph boxsave
- True if we went to save the state for do undo actionpublic void addReverseTransitionsFromSelectedBoxes(GenericGraphBox src)
src
- the source graph boxpublic void drawAllTransitions(java.awt.Graphics2D gr)
gr
- the graphical contextpublic void drawTransitionsFromMousePointerToSelectedBoxes(java.awt.Graphics2D gr)
gr
- the graphical contextpublic void drawTransitionsFromSelectedBoxesToMousePointer(java.awt.Graphics2D gr)
gr
- the graphical contextpublic void drawAllBoxes(java.awt.Graphics2D gr)
gr
- the graphical contextpublic void drawGrid(java.awt.Graphics2D f)
isGrid
field is set to
true
f
- the graphical contextpublic void HTopAlign()
public void HCenterAlign()
public void HBottomAlign()
public void VLeftAlign()
public void VCenterAlign()
public void VRightAlign()
public void setGrid(boolean b)
isGrid
field
b
- true
if the graph must be marked as modified,
false
otherwisepublic void setGrid(boolean b, int n)
isGrid
field
b
- true
if the graph must be marked as modified,
false
otherwisen
- size of grid's cellspublic void updateAllBoxes()
public void setRightToLeft(boolean b)
b
- true
if the graph must be drawn from right to
left, false
otherwisepublic void addUndoableEditListener(javax.swing.event.UndoableEditListener listener)
public void removeUndoableEditListener(javax.swing.event.UndoableEditListener listener)
public void postEdit(javax.swing.undo.UndoableEdit e)
public java.util.ArrayList getSelectedBoxes()
public java.awt.Rectangle getClipZone()
public void setClipZone(java.awt.Rectangle r)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |