|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.awt.Component | +--java.awt.Container | +--java.awt.Panel | +--Workspace
The workspace class is the panel where all of the gates are drawn, this is basically what the user sees, adding gates, moving gates etc.
Inner classes inherited from class java.awt.Component |
java.awt.Component.AWTTreeLock |
Field Summary | |
(package private) java.awt.Image |
buffer
|
(package private) boolean |
calculate
|
(package private) java.awt.Graphics |
g
|
(package private) java.util.Vector |
gates
|
(package private) int |
height
|
(package private) java.util.Vector |
macros
|
(package private) boolean |
stateChange
|
(package private) int |
width
|
Fields inherited from class java.awt.Container |
component,
containerListener,
layoutMgr,
ncomponents |
Fields inherited from class java.awt.Component |
actionListenerK,
adjustmentListenerK,
appContext,
background,
BOTTOM_ALIGNMENT,
CENTER_ALIGNMENT,
componentListener,
componentListenerK,
componentOrientation,
containerListenerK,
cursor,
dropTarget,
enabled,
eventMask,
focusListener,
focusListenerK,
font,
foreground,
hasFocus,
height,
incRate,
inputMethodListener,
inputMethodListenerK,
isInc,
isPacked,
itemListenerK,
keyListener,
keyListenerK,
LEFT_ALIGNMENT,
locale,
LOCK,
minSize,
mouseListener,
mouseListenerK,
mouseMotionListener,
mouseMotionListenerK,
newEventsOnly,
ownedWindowK,
parent,
peer,
peerFont,
popups,
prefSize,
RIGHT_ALIGNMENT,
textListenerK,
TOP_ALIGNMENT,
valid,
visible,
width,
windowListenerK,
x,
y |
Constructor Summary | |
(package private) |
Workspace(int _width,
int _height)
Workspace constructor - calls the awt.Panel constructor, and sets the szie of the workspace |
Method Summary | |
java.lang.Object |
addObject(int id,
int tool,
int x,
int y,
java.lang.Object macroGroup_,
int attr)
Adds an object to the workspace (gate, input, or macro), by giving the location the object should be placed at, what kind of object it is, and that objects id |
void |
buffer()
Creates the image buffer - must be called before Workspace can be used. |
(package private) void |
clear()
|
boolean |
connect(java.lang.Object source_,
java.lang.Object destination_,
boolean loading)
Connects two gates - First makes sure both objects are gates. |
boolean |
disconnect(java.lang.Object source_,
java.lang.Object destination_)
Takes two gates, and makes sure there is a connection between them, if so removes that connection. |
(package private) void |
drawCalculate()
draws the output value of each gate |
(package private) void |
drawConnection(GraphicGate source,
GraphicGate destination,
int inputLocation)
draws the connection between two gates |
(package private) void |
drawMacroBox(Macro currentMacro)
draws a box around all the gates in a macro |
java.util.Vector |
getGates()
returns the Vector used to store all gates on workspace |
java.util.Vector |
getMacros()
returns the Vector used to store all macros on workspace |
java.awt.Dimension |
getMaximumSize()
Gets the maximum panel height and width |
java.awt.Dimension |
getMinimumSize()
Gets the minimum panel height and width |
java.lang.Object |
getObjectAtLoc(int x,
int y)
Takes in a location (x, y coordinates) and returns an object if an object was clicked on. |
java.awt.Dimension |
getPreferredSize()
Gets the preferred panel height and width |
void |
moveGate(java.lang.Object target_,
int x,
int y)
Moves the gate to the new location |
void |
moveObject(java.lang.Object target_,
int x,
int y)
Check that the target is of type gate first - then move it to the new location. |
void |
paint(java.awt.Graphics graphics)
Handles the buffered version of the paint method |
(package private) void |
redrawWorkspace()
redraws the entire workspace, to update all graphics objects locations |
void |
reinitialize()
Remove everything from the workspace |
void |
removeGate(java.lang.Object target_)
Checks that target is of type gate first - then removes it, by setting pointers from other gates to it to null, and then removing it |
void |
removeObject(java.lang.Object target_,
CircuitDiagram cd)
Checks first to see if the object to be removed is a gate and then sees if it is in a macro or not. |
(package private) void |
toggleInput(java.lang.Object target_)
Toggles the input value of an input object |
void |
update(java.awt.Graphics graphics)
Handles the buffered version of the update method |
Methods inherited from class java.awt.Panel |
|
Methods inherited from class java.awt.Container |
add,
add,
add,
add,
add,
addContainerListener,
addImpl,
applyOrientation,
countComponents,
deliverEvent,
dispatchEventImpl,
dispatchEventToSelf,
doLayout,
eventEnabled,
findComponentAt,
findComponentAt,
getAlignmentX,
getAlignmentY,
getComponent,
getComponentAt,
getComponentAt,
getComponentCount,
getComponents_NoClientCode,
getComponents,
getCursorTarget,
getInsets,
getLayout,
getMouseEventTarget,
getWindow,
insets,
invalidate,
invalidateTree,
isAncestorOf,
layout,
lightweightPrint,
list,
list,
locate,
minimumSize,
nextFocus,
paintComponents,
paramString,
postProcessKeyEvent,
postsOldMouseEvents,
preferredSize,
preProcessKeyEvent,
print,
printComponents,
processContainerEvent,
processEvent,
proxyEnableEvents,
proxyRequestFocus,
remove,
remove,
removeAll,
removeContainerListener,
removeNotify,
setCursor,
setFocusOwner,
setFont,
setLayout,
transferFocus,
updateCursor,
validate,
validateTree |
Methods inherited from class java.awt.Component |
action,
add,
addComponentListener,
addFocusListener,
addInputMethodListener,
addKeyListener,
addMouseListener,
addMouseMotionListener,
addPropertyChangeListener,
addPropertyChangeListener,
areInputMethodsEnabled,
bounds,
checkImage,
checkImage,
coalesceEvents,
contains,
contains,
createImage,
createImage,
disable,
disableEvents,
dispatchEvent,
enable,
enable,
enableEvents,
enableInputMethods,
firePropertyChange,
getBackground,
getBounds,
getBounds,
getColorModel,
getComponentOrientation,
getCursor,
getDropTarget,
getFont_NoClientCode,
getFont,
getFontMetrics,
getForeground,
getGraphics,
getHeight,
getInputContext,
getInputMethodRequests,
getIntrinsicCursor,
getLocale,
getLocation,
getLocation,
getLocationOnScreen,
getName,
getNativeContainer,
getParent_NoClientCode,
getParent,
getPeer,
getSize,
getSize,
getToolkit,
getToolkitImpl,
getTreeLock,
getWidth,
getX,
getY,
gotFocus,
handleEvent,
hasFocus,
hide,
imageUpdate,
inside,
isDisplayable,
isDoubleBuffered,
isEnabled,
isEnabledImpl,
isFocusTraversable,
isLightweight,
isOpaque,
isShowing,
isValid,
isVisible,
keyDown,
keyUp,
list,
list,
list,
location,
lostFocus,
mouseDown,
mouseDrag,
mouseEnter,
mouseExit,
mouseMove,
mouseUp,
move,
nextFocus,
paintAll,
postEvent,
prepareImage,
prepareImage,
printAll,
processComponentEvent,
processFocusEvent,
processInputMethodEvent,
processKeyEvent,
processMouseEvent,
processMouseMotionEvent,
remove,
removeComponentListener,
removeFocusListener,
removeInputMethodListener,
removeKeyListener,
removeMouseListener,
removeMouseMotionListener,
removePropertyChangeListener,
removePropertyChangeListener,
repaint,
repaint,
repaint,
repaint,
requestFocus,
reshape,
resize,
resize,
setBackground,
setBounds,
setBounds,
setComponentOrientation,
setDropTarget,
setEnabled,
setForeground,
setLocale,
setLocation,
setLocation,
setName,
setSize,
setSize,
setVisible,
show,
show,
size,
toString,
transferFocus |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Field Detail |
java.awt.Image buffer
java.awt.Graphics g
int width
int height
java.util.Vector gates
java.util.Vector macros
boolean stateChange
boolean calculate
Constructor Detail |
Workspace(int _width, int _height)
_width
- width of workspace_height
- height of workspaceMethod Detail |
public void reinitialize()
public java.lang.Object getObjectAtLoc(int x, int y)
x
- x coordinatey
- y coordinatepublic java.lang.Object addObject(int id, int tool, int x, int y, java.lang.Object macroGroup_, int attr)
id
- object idtool
- type of gate being passed inx
- x coordinatey
- y coordinatemacroGroup
- macro group being passed inint
- optional attribute intpublic void moveObject(java.lang.Object target_, int x, int y)
target_
- gate to be movedx
- x coordinate of new locationy
- y coordinate of new locationpublic void moveGate(java.lang.Object target_, int x, int y)
target_
- gate to be movedx
- x coordinate of new locationy
- y coordinate of new locationpublic void removeObject(java.lang.Object target_, CircuitDiagram cd)
target_
- gate to be removedcd
- parent CircuitDiagrampublic void removeGate(java.lang.Object target_)
target_
- gate to be removedpublic boolean connect(java.lang.Object source_, java.lang.Object destination_, boolean loading)
source_
- gate giving outputdestination_
- gate taking in inputloading
- is this connection being made from apublic boolean disconnect(java.lang.Object source_, java.lang.Object destination_)
source_
- source gatedestination_
- destination gatevoid toggleInput(java.lang.Object target_)
target_
- input object to be toggledvoid drawCalculate()
public java.util.Vector getGates()
public java.util.Vector getMacros()
void drawConnection(GraphicGate source, GraphicGate destination, int inputLocation)
source
- source gatedestination
- destination gateinputLocation
- location on image of input link isvoid drawMacroBox(Macro currentMacro)
void redrawWorkspace()
public java.awt.Dimension getPreferredSize()
public java.awt.Dimension getMinimumSize()
public java.awt.Dimension getMaximumSize()
public void buffer()
void clear()
public void update(java.awt.Graphics graphics)
graphics
- the graphics object to draw the buffer topublic void paint(java.awt.Graphics graphics)
graphics
- the graphics object to draw the buffer to
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |