|
|||||||||
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.JPanel
kaapo.gui.diagramview.DiagramPanel
public class DiagramPanel
This class handles all the painting routines of the diagram. It also handles element-operations such as element adding, moving and removing and connection-operations such as adding, removing and re-positioning.
Class constructs edit objects described in
Command
-package and
uses ProjectManager
to execute them.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class javax.swing.JPanel |
---|
JPanel.AccessibleJPanel |
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 |
---|
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.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
DiagramPanel(Diagram diagram,
ProjectManager pm)
Constructs a new DiagramPanel |
Method Summary | |
---|---|
Dimension |
getPreferredSize()
Returns the size which covers all the elements added to panel |
void |
mouseClicked(MouseEvent e)
|
void |
mouseDragged(MouseEvent e)
|
void |
mouseEntered(MouseEvent e)
|
void |
mouseExited(MouseEvent e)
|
void |
mouseMoved(MouseEvent e)
|
void |
mousePressed(MouseEvent e)
|
void |
mouseReleased(MouseEvent e)
|
protected void |
paintComponent(Graphics g)
Paints the panel |
void |
removeObserver()
This method should be called before disposing an observer. |
void |
setSelectedTool(Class tool)
Method to set the toolpanel to be used to detect element-types for adding elements to the panel |
void |
update(Observable subject,
Object message)
This method is called whenever the observed object is changed. |
Methods inherited from class javax.swing.JPanel |
---|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public DiagramPanel(Diagram diagram, ProjectManager pm)
diagram
- A Diagram which this DiagramPanel representspm
- ProjectManager which executes the actionsMethod Detail |
---|
protected void paintComponent(Graphics g)
paintComponent
in class JComponent
JComponent.paintComponent(java.awt.Graphics)
public void setSelectedTool(Class tool)
tool
- ToolPanel giving the element-classespublic void mousePressed(MouseEvent e)
mousePressed
in interface MouseListener
public void mouseMoved(MouseEvent e)
mouseMoved
in interface MouseMotionListener
public void mouseReleased(MouseEvent e)
mouseReleased
in interface MouseListener
public void mouseDragged(MouseEvent e)
mouseDragged
in interface MouseMotionListener
public void mouseClicked(MouseEvent e)
mouseClicked
in interface MouseListener
public void mouseEntered(MouseEvent e)
mouseEntered
in interface MouseListener
public void mouseExited(MouseEvent e)
mouseExited
in interface MouseListener
public Dimension getPreferredSize()
getPreferredSize
in class JComponent
JComponent.getPreferredSize()
public void removeObserver()
Observer
The reason for this is that the observer will remain in memory as long as there is references to it in it's observables' observer list. Observer will also receive updates until it's removed from all lists.
removeObserver
in interface Observer
Observer.removeObserver()
public void update(Observable subject, Object message)
Observer
It's safe to modify the subject's observer list from update method. It won't affect the current notify round though, but the next.
update
in interface Observer
subject
- the subject that fires the updatemessage
- the message delivered to observerObserver.update(kaapo.Observable, java.lang.Object)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |