|
||||||||||
| 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
com.xj.anylogic.engine.presentation.Panel
public class Panel
The class is responsible for displaying the experiment or active object presentation. The animation may be drawn frame by frame, each frame is a snapshot of the experiment state taken at a particular moment. Regular frames mode is started when during a refresh the panel discovers that the experiment state is RUNNING, and stops when, during a frame paining the experiment state is not RUNNING. The frame painting may be quite time consuming, so presentation drawing and the simulation itself may compete for the CPU. There are two modes frames can be painted: fixed frame rate when the panel tries to display a particular number of frames per second regardless how long does it take, and adaptive frame management when the panel tries to maintain a certain CPU time balance between the presentation and simulation. You can control the frame management as well as zoom, offsets and rendering options of the picture using the panel API.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class javax.swing.JComponent |
|---|
javax.swing.JComponent.AccessibleJComponent |
| Nested classes/interfaces inherited from class java.awt.Component |
|---|
java.awt.Component.BaselineResizeBehavior |
| Field Summary | |
|---|---|
static int |
ANIM_ANTIALIASING
The anti-aliasing painting option |
static int |
ANIM_BOUNDS_CLIPPING_COMPLEX_XJAL
increase performance by skipping drawing of shapes which are outside of visible area - for shapes with complex bounds computation (like polylines) This constant is an internal AnyLogic option and is a subject to change in any further release. |
static int |
ANIM_BOUNDS_CLIPPING_XJAL
increase performance by skipping drawing of shapes which are outside of visible area. |
static int |
ANIM_ENHANCED_MODEL_ELEMENTS_DRAWING
The enhanced model elements drawing mode for the presentation panel |
static int |
INSPECT_GENERAL_xjal
|
static int |
INSPECT_READ_ONLY_xjal
|
com.xj.anylogic.engine.internal.PanelInternals |
internals
This field shouldn't be accessed by user is public due to technical reasons |
| 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 |
| Method Summary | |
|---|---|
void |
addInspect_xjal(double x,
double y,
Presentable p,
java.lang.String name,
int mode)
Creates an inspect window at a particular location for an element of a Presentable object. |
void |
addInspect(double x,
double y,
Presentable p,
java.lang.String name)
Creates an inspect window at a particular location for an element of a Presentable object. |
void |
addNotify()
|
void |
browseEmbeddedObject(double x,
double y,
ActiveObject ao,
java.lang.String name)
Sets the embedded object to be displayed by the presentation panel. |
void |
componentHidden(java.awt.event.ComponentEvent e)
A method of ComponentListener interface. |
void |
componentMoved(java.awt.event.ComponentEvent e)
A method of ComponentListener interface. |
void |
componentResized(java.awt.event.ComponentEvent e)
A method of ComponentListener interface. |
void |
componentShown(java.awt.event.ComponentEvent e)
A method of ComponentListener interface. |
java.awt.image.BufferedImage |
getBufferedImage()
Returns the buffered image used by the panel to do off-screen painting. |
double |
getFrameManagementBalance()
Returns the currently set balance between the CPU time available to presentation frame painting and the simulation (applies only in adaptive mode). |
double |
getFrameRate()
Returns the number of frames to be painted per second in fixed mode, regardless of what mode is set. |
ImageCache |
getImageCache()
Returns the image cache associated with this panel. |
double |
getOffsetX()
Returns the current x offset (in the model coordinates) of the presentation origin (0,0) from the top left corner of the panel. |
double |
getOffsetY()
Returns the current y offset (in the model coordinates) of the presentation origin (0,0) from the top left corner of the panel. |
Presentable |
getPresentable()
Returns the object currently displayed by the panel. |
ShapeControlManager |
getShapeControlManager()
Returns the control manager responsible for displaying the controls within the panel. |
double |
getZoom()
Returns the current zoom (top-level scale of the presentation, same for x and y axes). |
void |
goHome()
Resets scale and offsets to their default values: 1 for scale and 0 for both offsets. |
boolean |
isAnimationParameterEnabled(int parameter)
Tests if the given animation parameter enabled for this panel |
boolean |
isAntiAliasingEnabled()
Tests if anti-aliasing is on. |
boolean |
isEnhancedModelElementsAnimationEnabled()
Deprecated. may be removed in the next release. Please use isAnimationParameterEnabled(Panel. instead |
boolean |
isFrameManagementAdaptive()
Returns the mode of the frame management |
boolean |
isPanningEnabled()
Tests if mouse panning is enabled. |
boolean |
isZoomEnabled()
Tests if zoom from the GUI is enabled. |
void |
mouseClicked(java.awt.event.MouseEvent e)
A method of MouseListener interface. |
void |
mouseDragged(java.awt.event.MouseEvent e)
A method of MouseMotionListener interface. |
void |
mouseEntered(java.awt.event.MouseEvent e)
A method of MouseListener interface. |
void |
mouseExited(java.awt.event.MouseEvent e)
A method of MouseListener interface. |
void |
mouseMoved(java.awt.event.MouseEvent e)
A method of MouseMotionListener interface. |
void |
mousePressed(java.awt.event.MouseEvent e)
A method of MouseListener interface. |
void |
mouseReleased(java.awt.event.MouseEvent e)
A method of MouseListener interface. |
void |
mouseWheelMoved(java.awt.event.MouseWheelEvent e)
A method of MouseWheelListener interface. |
void |
navigateTo(ViewArea viewpoint)
Shows the given viewpoint in the model animation panel |
void |
paintComponent(java.awt.Graphics g)
Is called by Swing to paint the panel. |
void |
remove(java.awt.Component comp)
|
void |
remove(int index)
|
void |
removeNotify()
|
void |
restore(java.util.List<?> storedInspects,
java.util.List<?> openInspects)
This method should not be called by user |
void |
setAnimationParameterEnabled(int parameter,
boolean enabled)
Sets animation drawing parameter for this panel |
void |
setAntiAliasingEnabled(boolean yes)
Sets the anti-aliasing painting option. |
void |
setEnhancedModelElementsAnimationEnabled(boolean yes)
Deprecated. may be removed in the next release. Please use setAnimationParameterEnabled(Panel. instead |
void |
setFrameManagementAdaptive(boolean yes)
Sets the mode of presentation frame painting management. |
void |
setFrameManagementBalance(double balance)
Sets the balance between the CPU time available to presentation frame painting and the simulation (applies only in adaptive mode). |
void |
setFrameRate(double rate)
Sets the frame rate. |
void |
setOffsets(double offx,
double offy)
Sets the x and y offsets (in the model coordinates) of the presentation origin (0,0) from the top left corner of the panel. |
void |
setOffsetX(int offx)
Sets the x offset (in the model coordinates) of the presentation origin (0,0) from the top left corner of the panel. |
void |
setOffsetY(int offy)
Sets the y offset (in the model coordinates) of the presentation origin (0,0) from the top left corner of the panel. |
void |
setPanningEnabled(boolean yes)
Enables or disables panning with mouse right+drag, but does not affect programmatic changes of offsets that are always possible. |
void |
setPopupMenu_xjal(javax.swing.JMenuItem... additionalItems)
This method shouldn't be called by user and may be removed in future releases. |
void |
setZoom(double z)
Zooms the presentation in or out. |
void |
setZoomEnabled(boolean yes)
Enables or disables zoom initiated from the GUI (button. mouse, or keyboard), but does not affect programmatic changes of zoom that are always possible. |
void |
write(java.io.ObjectOutputStream os)
This method should not be called by user |
double |
xFromScreen(int x)
Converts a given screen (panel) x coordinate to presentable x coordinate |
int |
xToScreen(double x)
Converts a given presentable x coordinate to screen (panel) x coordinate |
double |
yFromScreen(int y)
Converts a given screen (panel) y coordinate to presentable x coordinate |
int |
yToScreen(double y)
Converts a given presentable y coordinate to screen (panel) y coordinate |
| Methods inherited from class javax.swing.JPanel |
|---|
getAccessibleContext, getUI, getUIClassID, setUI, updateUI |
| Methods inherited from class javax.swing.JComponent |
|---|
addAncestorListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, 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, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, 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 |
| 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, 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 static final int INSPECT_GENERAL_xjal
public static final int INSPECT_READ_ONLY_xjal
public static final int ANIM_ANTIALIASING
setAnimationParameterEnabled(int, boolean),
Constant Field Valuespublic static final int ANIM_ENHANCED_MODEL_ELEMENTS_DRAWING
setAnimationParameterEnabled(int, boolean),
Constant Field Valuespublic static final int ANIM_BOUNDS_CLIPPING_XJAL
setAnimationParameterEnabled(int, boolean),
Constant Field Valuespublic static final int ANIM_BOUNDS_CLIPPING_COMPLEX_XJAL
setAnimationParameterEnabled(int, boolean),
Constant Field Valuespublic final com.xj.anylogic.engine.internal.PanelInternals internals
| Method Detail |
|---|
public Presentable getPresentable()
public void setFrameManagementAdaptive(boolean yes)
yes - if true, the frame rate is adjusted automaticallypublic boolean isFrameManagementAdaptive()
public void setFrameRate(double rate)
rate - the number of frames to be painted per secondpublic double getFrameRate()
public void setFrameManagementBalance(double balance)
balance - the new value for balancepublic double getFrameManagementBalance()
public void setZoomEnabled(boolean yes)
yes - if true, zoom is enabled, if false - disabledpublic boolean isZoomEnabled()
public void setZoom(double z)
z - the new zoom valuepublic double getZoom()
public void setOffsets(double offx,
double offy)
offx - the new x offset valueoffy - the new y offset valuepublic void setOffsetX(int offx)
offx - the new x offset valuepublic double getOffsetX()
public void setOffsetY(int offy)
offy - the new y offset valuepublic double getOffsetY()
public void goHome()
public int xToScreen(double x)
x - the presentable x coordinate
public int yToScreen(double y)
y - the presentable y coordinate
public double xFromScreen(int x)
x - the panel x coordinate
public double yFromScreen(int y)
y - the panel y coordinate
public void setPanningEnabled(boolean yes)
yes - if true, panning is enabled, if false - disabledpublic boolean isPanningEnabled()
public void setAntiAliasingEnabled(boolean yes)
yes - if true, anti-aliasing is turned on, if false - offpublic boolean isAntiAliasingEnabled()
@Deprecated public void setEnhancedModelElementsAnimationEnabled(boolean yes)
setAnimationParameterEnabled(Panel.ANIM_ENHANCED_MODEL_ELEMENTS_DRAWING, enabled) instead
@Deprecated public boolean isEnhancedModelElementsAnimationEnabled()
isAnimationParameterEnabled(Panel.ANIM_ENHANCED_MODEL_ELEMENTS_DRAWING) instead
public void setAnimationParameterEnabled(int parameter,
boolean enabled)
parameter - one of Panel.ANIM_* constantsenabled - true to turn on, false
to turn offpublic boolean isAnimationParameterEnabled(int parameter)
parameter - one of Panel.ANIM_* constants
true if the given animation parameter is enabled
for this panel. false otherwisepublic java.awt.image.BufferedImage getBufferedImage()
public ShapeControlManager getShapeControlManager()
public ImageCache getImageCache()
public void addInspect(double x,
double y,
Presentable p,
java.lang.String name)
x - the x coordinate in the presentable object systemy - the y coordinate in the presentable object systemp - the Presentable object whose element is being inspectedname - the name of the element being inspected
public void addInspect_xjal(double x,
double y,
Presentable p,
java.lang.String name,
int mode)
x - the x coordinate in the presentable object systemy - the y coordinate in the presentable object systemp - the Presentable object whose element is being inspectedname - the name of the element being inspectedmode - may be set to Panel.INSPECT_READ_ONLY_xjal for the
editing to be prohibited for this inspect
public void browseEmbeddedObject(double x,
double y,
ActiveObject ao,
java.lang.String name)
name in the
ActiveObject object. If the embedded object is replicated,
first element (if any exists) is shown
x - the x coordinate in the active object object systemy - the y coordinate in the active object object systemao - the ActiveObject object whose embeddedObject is being browsedname - the name of the embedded object being browsed
public void write(java.io.ObjectOutputStream os)
throws java.io.IOException
java.io.IOException
public void restore(java.util.List<?> storedInspects,
java.util.List<?> openInspects)
throws java.io.IOException,
java.lang.ClassNotFoundException
java.io.IOException
java.lang.ClassNotFoundExceptionpublic void addNotify()
addNotify in class javax.swing.JComponentpublic void removeNotify()
removeNotify in class javax.swing.JComponentpublic void paintComponent(java.awt.Graphics g)
paintComponent in class javax.swing.JComponentpublic void navigateTo(ViewArea viewpoint)
viewpoint - the viewpoint to showpublic void remove(java.awt.Component comp)
remove in class java.awt.Containerpublic void remove(int index)
remove in class java.awt.Containerpublic void componentResized(java.awt.event.ComponentEvent e)
componentResized in interface java.awt.event.ComponentListenerpublic void componentMoved(java.awt.event.ComponentEvent e)
componentMoved in interface java.awt.event.ComponentListenerpublic void componentHidden(java.awt.event.ComponentEvent e)
componentHidden in interface java.awt.event.ComponentListenerpublic void componentShown(java.awt.event.ComponentEvent e)
componentShown in interface java.awt.event.ComponentListenerpublic void mouseWheelMoved(java.awt.event.MouseWheelEvent e)
mouseWheelMoved in interface java.awt.event.MouseWheelListenerpublic void mousePressed(java.awt.event.MouseEvent e)
mousePressed in interface java.awt.event.MouseListenerpublic void mouseReleased(java.awt.event.MouseEvent e)
mouseReleased in interface java.awt.event.MouseListenerpublic void setPopupMenu_xjal(javax.swing.JMenuItem... additionalItems)
public void mouseClicked(java.awt.event.MouseEvent e)
mouseClicked in interface java.awt.event.MouseListenerpublic void mouseEntered(java.awt.event.MouseEvent e)
mouseEntered in interface java.awt.event.MouseListenerpublic void mouseExited(java.awt.event.MouseEvent e)
mouseExited in interface java.awt.event.MouseListenerpublic void mouseDragged(java.awt.event.MouseEvent e)
mouseDragged in interface java.awt.event.MouseMotionListenerpublic void mouseMoved(java.awt.event.MouseEvent e)
mouseMoved in interface java.awt.event.MouseMotionListener
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||