Class SimEnvGraphPanel
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
net.simplace.ui.panel.FWDefaultPanel
net.simplace.client.sim.graphpanel.SimEnvGraphPanel
- All Implemented Interfaces:
ActionListener, ImageObserver, MenuContainer, Printable, Serializable, EventListener, Accessible
Graph editor (JUNG) showing a solution as graph: resources, SimComponents and outputs as vertices, the links
between their variables as edges. Optionally shows the solution tree and allows step-wise simulation runs.
- Author:
- Andreas Enders
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class JPanel
JPanel.AccessibleJPanelNested classes/interfaces inherited from class JComponent
JComponent.AccessibleJComponentNested classes/interfaces inherited from class Container
Container.AccessibleAWTContainerNested classes/interfaces inherited from class Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy -
Field Summary
FieldsFields inherited from class FWDefaultPanel
iFunctionalityFields inherited from class JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWFields inherited from class Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTFields inherited from interface ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTHFields inherited from interface Printable
NO_SUCH_PAGE, PAGE_EXISTS -
Constructor Summary
ConstructorsConstructorDescriptionSimEnvGraphPanel(String aXMLFilePath, FWAbstractFunctionality aFunctionality, boolean aCreateButtonPanel, boolean doShowResources, boolean doShowOutput, boolean aReadonly, boolean aEditEnabled, boolean aShowSolutionTree) Creates a session for the solution file and shows its graph.SimEnvGraphPanel(net.simplace.sim.FWSimSolution aSolution) Creates an editable graph for an existing solution (without functionality and session). -
Method Summary
Modifier and TypeMethodDescriptionvoidaddSimFieldContainer(net.simplace.sim.util.FWSimFieldContainer aFieldContainer) Adds a field container as vertex and creates the links from its inputs (SimComponents) or rules (outputs).voidaddSimFieldContainers(net.simplace.sim.util.FWSimFieldContainer[] aCaptionArray) voidaddSimLink(net.simplace.sim.model.SimFieldLink aSimFieldLink, net.simplace.sim.model.SimVarLink aSimVarLink) Adds a variable link to the edge and to the solution (invalid links are logged).protected voidback()Back: if the solution was changed, it is saved first (or the changes are discarded) - seeconfirmLeave().voidAnimates the transition from the current to the new layout.booleaneditInputs(net.simplace.sim.model.FWSimComponent aComponent, String aSourceFilter) Opens the input dialog of a SimComponent and updates the edges if inputs were changed (#62).booleaneditRules(net.simplace.sim.model.FWSimComponent aComponent) Opens the editor of a SimpleSimComponent or DefaultManagement and updates the edges if it was changed (#62).edu.uci.ics.jung.graph.Graph<net.simplace.sim.util.FWSimFieldContainer, net.simplace.sim.model.SimFieldLink> ArrayList<net.simplace.sim.io.output.FWSimOutputAdapter> net.simplace.sim.util.MultiHashMap<net.simplace.sim.util.FWSimFieldContainer, net.simplace.sim.model.SimFieldLink> net.simplace.sim.FWSimSessionnet.simplace.sim.FWSimSimulationnet.simplace.sim.FWSimSolutionprotected voidgo()Next: if the solution was changed, it is saved first (or the changes are discarded) - seeconfirmLeave().static booleanhasEditableInputs(net.simplace.sim.util.FWSimFieldContainer aContainer) voidCreates the layout selected in the layout combo box and animates the transition to it.booleanisVisible(net.simplace.sim.util.FWSimFieldContainer aFieldContainer) intprint(Graphics graphics, PageFormat pageFormat, int pageIndex) voidRebuilds the edges to all SimComponents, e.g.voidrefreshInputLinks(net.simplace.sim.model.FWSimComponent aComponent) Rebuilds the edges to a SimComponent after its inputs were changed (#62).voidremoveSimFieldContainer(net.simplace.sim.util.FWSimFieldContainer aFieldContainer) Removes a field container from the graph and the solution.voidremoveSimLink(net.simplace.sim.model.SimFieldLink aSimFieldLink, net.simplace.sim.model.SimVarLink aSimVarLink) Removes a variable link from the edge and from the solution.voidChanges the order of execution by the places of the SimComponents on the circle (#62): the components shown are sorted by their angle on the circle (starting right, clockwise as placed), components not shown as vertex (e.g.booleanbooleanstatic voidwriteJPEGImage(File file, JPanel aPanel) copy the visible part of the graph to a file as a jpeg imageMethods inherited from class FWDefaultPanel
actionPerformed, cancel, export, getFunctionality, getLocaleValue, info, print, reset, setBackButtonEnabled, setCancelButtonEnabled, setComponentToView, setExportButtonEnabled, setGoButtonEnabled, setInfoButtonEnabled, setPrintButtonEnabled, setResetButtonEnabledMethods inherited from class JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUIMethods inherited from class JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, 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, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, 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, updateMethods inherited from class 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, transferFocusDownCycle, validate, validateTreeMethods inherited from class 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, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, 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, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
Field Details
-
jcb
The LayoutClass selection Combo
-
-
Constructor Details
-
SimEnvGraphPanel
public SimEnvGraphPanel(String aXMLFilePath, FWAbstractFunctionality aFunctionality, boolean aCreateButtonPanel, boolean doShowResources, boolean doShowOutput, boolean aReadonly, boolean aEditEnabled, boolean aShowSolutionTree) Creates a session for the solution file and shows its graph. The session is stored in the observable parameter named byresultParamKey.- Parameters:
aXMLFilePath- path of the solution fileaFunctionality- the functionality shown by this panelaCreateButtonPanel- whether the navigation buttons are showndoShowResources- whether resources are shown initiallydoShowOutput- whether outputs are shown initiallyaReadonly- iftruethe edit mode cannot be switched onaEditEnabled- whether the panel starts in edit modeaShowSolutionTree- whether the solution tree is shown left of the graph
-
SimEnvGraphPanel
public SimEnvGraphPanel(net.simplace.sim.FWSimSolution aSolution) Creates an editable graph for an existing solution (without functionality and session).- Parameters:
aSolution- the solution
-
-
Method Details
-
reorderByPosition
public void reorderByPosition()Changes the order of execution by the places of the SimComponents on the circle (#62): the components shown are sorted by their angle on the circle (starting right, clockwise as placed), components not shown as vertex (e.g. in a group) keep their position. Then the components are placed on the circle again. -
go
protected void go()Next: if the solution was changed, it is saved first (or the changes are discarded) - seeconfirmLeave().- Overrides:
goin classFWDefaultPanel
-
back
protected void back()Back: if the solution was changed, it is saved first (or the changes are discarded) - seeconfirmLeave().- Overrides:
backin classFWDefaultPanel
-
refreshAllInputLinks
public void refreshAllInputLinks()Rebuilds the edges to all SimComponents, e.g. after variables of a component were changed which others use (#62). -
editRules
public boolean editRules(net.simplace.sim.model.FWSimComponent aComponent) Opens the editor of a SimpleSimComponent or DefaultManagement and updates the edges if it was changed (#62).- Parameters:
aComponent- the component- Returns:
trueif changed
-
refreshInputLinks
public void refreshInputLinks(net.simplace.sim.model.FWSimComponent aComponent) Rebuilds the edges to a SimComponent after its inputs were changed (#62).- Parameters:
aComponent- the component
-
hasEditableInputs
public static boolean hasEditableInputs(net.simplace.sim.util.FWSimFieldContainer aContainer) - Parameters:
aContainer- a container of the graph- Returns:
trueif its inputs can be edited with the input dialog: SimComponents whose configuration element is kept when saving (not DefaultManagement, simple or analytics components)
-
editInputs
Opens the input dialog of a SimComponent and updates the edges if inputs were changed (#62).- Parameters:
aComponent- the componentaSourceFilter- initial filter of the sources, may benull- Returns:
trueif inputs were changed
-
addSimFieldContainers
public void addSimFieldContainers(net.simplace.sim.util.FWSimFieldContainer[] aCaptionArray) throws net.simplace.sim.exceptions.DuplicateSimFieldException - Parameters:
aCaptionArray- field containers to add- Throws:
net.simplace.sim.exceptions.DuplicateSimFieldException- if a container name is already used
-
addSimFieldContainer
public void addSimFieldContainer(net.simplace.sim.util.FWSimFieldContainer aFieldContainer) throws net.simplace.sim.exceptions.DuplicateSimFieldException Adds a field container as vertex and creates the links from its inputs (SimComponents) or rules (outputs).- Parameters:
aFieldContainer- the field container- Throws:
net.simplace.sim.exceptions.DuplicateSimFieldException- if the container name is already used
-
removeSimFieldContainer
public void removeSimFieldContainer(net.simplace.sim.util.FWSimFieldContainer aFieldContainer) Removes a field container from the graph and the solution.- Parameters:
aFieldContainer- the field container
-
getOutputAdapters
- Returns:
- Output Adapters
-
writeJPEGImage
-
print
- Specified by:
printin interfacePrintable- Throws:
PrinterException- See Also:
-
doTransition
public void doTransition()Animates the transition from the current to the new layout. -
addSimLink
public void addSimLink(net.simplace.sim.model.SimFieldLink aSimFieldLink, net.simplace.sim.model.SimVarLink aSimVarLink) Adds a variable link to the edge and to the solution (invalid links are logged).- Parameters:
aSimFieldLink- the edgeaSimVarLink- the variable link
-
removeSimLink
public void removeSimLink(net.simplace.sim.model.SimFieldLink aSimFieldLink, net.simplace.sim.model.SimVarLink aSimVarLink) Removes a variable link from the edge and from the solution.- Parameters:
aSimFieldLink- the edgeaSimVarLink- the variable link
-
getSimFieldMap
-
getSimSolution
public net.simplace.sim.FWSimSolution getSimSolution()- Returns:
- the SolutionObject
-
getSimFieldLinksMap
public net.simplace.sim.util.MultiHashMap<net.simplace.sim.util.FWSimFieldContainer, net.simplace.sim.model.SimFieldLink> getSimFieldLinksMap()- Returns:
- the simfieldmap
-
getGraphPanel
public edu.uci.ics.jung.graph.Graph<net.simplace.sim.util.FWSimFieldContainer, net.simplace.sim.model.SimFieldLink> getGraphPanel()- Returns:
- the hypergraph
-
getSimSession
public net.simplace.sim.FWSimSession getSimSession()- Returns:
- the simSession
-
isVisible
public boolean isVisible(net.simplace.sim.util.FWSimFieldContainer aFieldContainer) - Parameters:
aFieldContainer- the field container- Returns:
- if Field should be visible (outputs and resources depend on the show toggles)
-
showOutputs
public boolean showOutputs()- Returns:
- if outputs should be shown
-
showResources
public boolean showResources()- Returns:
- if resources should be shown
-
initializeLayout
public void initializeLayout()Creates the layout selected in the layout combo box and animates the transition to it. -
getSimSimulation
public net.simplace.sim.FWSimSimulation getSimSimulation()- Returns:
- the current simulation object
-