├── LICENSE.txt ├── README.md ├── build.xml ├── extra ├── MySCXMLListener.java ├── edge-editing.png ├── find-tool.png ├── fsm-editor.jar ├── legend.png ├── node-menu.png ├── restrictedStates.xml ├── sample-restriction-config.png └── scxmlConstraints.xsd ├── fsm-editor ├── .project ├── build.xml ├── info.txt ├── src │ └── com │ │ └── mxgraph │ │ └── examples │ │ ├── config │ │ ├── ObjectFactory.java │ │ └── SCXMLConstraints.java │ │ └── swing │ │ ├── SCXMLGraphEditor.java │ │ ├── editor │ │ ├── DefaultFileFilter.java │ │ ├── fileimportexport │ │ │ ├── DOTImportExport.java │ │ │ ├── HTMLImportExport.java │ │ │ ├── IImportExport.java │ │ │ ├── IMGImportExport.java │ │ │ ├── ImportExportPicker.java │ │ │ ├── MXEImportExport.java │ │ │ ├── OutSource.java │ │ │ ├── SCXMLEdge.java │ │ │ ├── SCXMLImportExport.java │ │ │ ├── SCXMLNode.java │ │ │ ├── SVGImportExport.java │ │ │ └── VMLImportExport.java │ │ ├── scxml │ │ │ ├── MyUndoManager.java │ │ │ ├── SCXMLAnalyzer.java │ │ │ ├── SCXMLChangeHandler.java │ │ │ ├── SCXMLEditorActions.java │ │ │ ├── SCXMLEditorMenuBar.java │ │ │ ├── SCXMLEditorPopupMenu.java │ │ │ ├── SCXMLFileChoser.java │ │ │ ├── SCXMLGraph.java │ │ │ ├── SCXMLGraphComponent.java │ │ │ ├── SCXMLGraphHandler.java │ │ │ ├── SCXMLKeyboardHandler.java │ │ │ ├── SCXMLTransferHandler.java │ │ │ ├── StayOpenCheckBoxMenuItemUI.java │ │ │ ├── TextDialog.java │ │ │ ├── UndoJTextField.java │ │ │ ├── UndoJTextPane.java │ │ │ ├── eleditor │ │ │ │ ├── EditorKeyboardHandler.java │ │ │ │ ├── SCXMLEdgeEditor.java │ │ │ │ ├── SCXMLElementEditor.java │ │ │ │ ├── SCXMLNodeEditor.java │ │ │ │ ├── SCXMLOutEdgeOrderEditor.java │ │ │ │ └── SCXMLOutsourcingEditor.java │ │ │ ├── listener │ │ │ │ └── SCXMLListener.java │ │ │ └── search │ │ │ │ ├── SCXMLSearch.java │ │ │ │ └── SCXMLSearchTool.java │ │ └── utils │ │ │ ├── AbstractActionWrapper.java │ │ │ ├── IOUtils.java │ │ │ ├── ListCellSelector.java │ │ │ ├── Pair.java │ │ │ └── XMLUtils.java │ │ ├── handler │ │ └── SCXMLConnectionHandler.java │ │ ├── images │ │ ├── actor.png │ │ ├── alignbottom.gif │ │ ├── aligncenter.gif │ │ ├── alignleft.gif │ │ ├── alignmiddle.gif │ │ ├── alignright.gif │ │ ├── aligntop.gif │ │ ├── arrow.gif │ │ ├── arrow.png │ │ ├── bell.png │ │ ├── block_end.gif │ │ ├── block_start.gif │ │ ├── bold.gif │ │ ├── bottom.gif │ │ ├── box.png │ │ ├── cancel_end.png │ │ ├── cancel_intermediate.png │ │ ├── center.gif │ │ ├── classic_end.gif │ │ ├── classic_start.gif │ │ ├── cloud.png │ │ ├── collapse.gif │ │ ├── connect.gif │ │ ├── connect.png │ │ ├── connector.gif │ │ ├── copy.gif │ │ ├── cube_green.png │ │ ├── cut.gif │ │ ├── cylinder.png │ │ ├── delete.gif │ │ ├── diagram.gif │ │ ├── diamond_end.gif │ │ ├── diamond_start.gif │ │ ├── doubleellipse.png │ │ ├── down.gif │ │ ├── dude3.png │ │ ├── earth.png │ │ ├── ellipse.png │ │ ├── entity.gif │ │ ├── entity.png │ │ ├── error.png │ │ ├── event.png │ │ ├── event_end.png │ │ ├── event_intermediate.png │ │ ├── expand.gif │ │ ├── fillcolor.gif │ │ ├── fit.gif │ │ ├── font.gif │ │ ├── fontcolor.gif │ │ ├── fork.png │ │ ├── gear.png │ │ ├── group.gif │ │ ├── hexagon.png │ │ ├── hline.png │ │ ├── house.gif │ │ ├── house.png │ │ ├── image.gif │ │ ├── inclusive.png │ │ ├── italic.gif │ │ ├── left.gif │ │ ├── linecolor.gif │ │ ├── link.png │ │ ├── maximize.gif │ │ ├── merge.png │ │ ├── message.png │ │ ├── message_end.png │ │ ├── message_intermediate.png │ │ ├── middle.gif │ │ ├── minimize.gif │ │ ├── multiple.png │ │ ├── new.gif │ │ ├── open.gif │ │ ├── open_end.gif │ │ ├── open_start.gif │ │ ├── outline.gif │ │ ├── oval_end.gif │ │ ├── oval_start.gif │ │ ├── package.png │ │ ├── pagesetup.gif │ │ ├── pan.gif │ │ ├── paste.gif │ │ ├── plain.gif │ │ ├── preferences.gif │ │ ├── preview.gif │ │ ├── print.gif │ │ ├── printer.png │ │ ├── rectangle.png │ │ ├── redo.gif │ │ ├── resize.gif │ │ ├── rhombus.png │ │ ├── right.gif │ │ ├── rounded.png │ │ ├── rule.png │ │ ├── save.gif │ │ ├── saveas.gif │ │ ├── select.gif │ │ ├── server.png │ │ ├── straight.gif │ │ ├── straight.png │ │ ├── swimlane.png │ │ ├── terminate.png │ │ ├── timer.png │ │ ├── toback.gif │ │ ├── tofront.gif │ │ ├── top.gif │ │ ├── tree.gif │ │ ├── triangle.png │ │ ├── undo.gif │ │ ├── ungroup.gif │ │ ├── up.gif │ │ ├── vertical.gif │ │ ├── vertical.png │ │ ├── workplace.png │ │ ├── wrench.png │ │ ├── zoom.gif │ │ ├── zoomactual.gif │ │ ├── zoomin.gif │ │ └── zoomout.gif │ │ └── resources │ │ ├── basic-style.xml │ │ ├── default-style.xml │ │ ├── editor.properties │ │ ├── editor_de.properties │ │ └── editor_zh-CN.properties └── svn.version ├── jgraphx ├── .project ├── LICENSE.txt ├── build.xml └── src │ └── com │ └── mxgraph │ ├── analysis │ ├── mxConstantCostFunction.java │ ├── mxDistanceCostFunction.java │ ├── mxFibonacciHeap.java │ ├── mxGraphAnalysis.java │ ├── mxICostFunction.java │ ├── mxUnionFind.java │ └── package.html │ ├── canvas │ ├── mxBasicCanvas.java │ ├── mxGraphics2DCanvas.java │ ├── mxHtmlCanvas.java │ ├── mxICanvas.java │ ├── mxImageCanvas.java │ ├── mxSvgCanvas.java │ ├── mxVmlCanvas.java │ └── package.html │ ├── io │ ├── mxCellCodec.java │ ├── mxCodec.java │ ├── mxCodecRegistry.java │ ├── mxModelCodec.java │ ├── mxObjectCodec.java │ ├── mxStylesheetCodec.java │ └── package.html │ ├── layout │ ├── hierarchical │ │ ├── model │ │ │ ├── mxGraphAbstractHierarchyCell.java │ │ │ ├── mxGraphHierarchyEdge.java │ │ │ ├── mxGraphHierarchyModel.java │ │ │ ├── mxGraphHierarchyNode.java │ │ │ └── mxGraphHierarchyRank.java │ │ ├── mxHierarchicalLayout.java │ │ └── stage │ │ │ ├── mxCoordinateAssignment.java │ │ │ ├── mxHierarchicalLayoutStage.java │ │ │ ├── mxMedianHybridCrossingReduction.java │ │ │ └── mxMinimumCycleRemover.java │ ├── mxCircleLayout.java │ ├── mxClusterLayout.java │ ├── mxCompactTreeLayout.java │ ├── mxEdgeLabelLayout.java │ ├── mxFastOrganicLayout.java │ ├── mxGraphLayout.java │ ├── mxIGraphLayout.java │ ├── mxOrganicLayout.java │ ├── mxParallelEdgeLayout.java │ ├── mxPartitionLayout.java │ ├── mxStackLayout.java │ ├── orthogonal │ │ ├── model │ │ │ ├── mxOrthogonalModel.java │ │ │ ├── mxPointPair.java │ │ │ ├── mxPointSequence.java │ │ │ └── mxSegment.java │ │ └── mxOrthogonalLayout.java │ └── package.html │ ├── model │ ├── mxCell.java │ ├── mxCellPath.java │ ├── mxGeometry.java │ ├── mxGraphModel.java │ ├── mxICell.java │ ├── mxIGraphModel.java │ └── package.html │ ├── reader │ ├── mxGraphViewImageReader.java │ ├── mxGraphViewReader.java │ └── package.html │ ├── resources │ ├── graph.properties │ └── graph_de.properties │ ├── sharing │ ├── mxSession.java │ ├── mxSharedDiagram.java │ └── package.html │ ├── swing │ ├── handler │ │ ├── mxCellHandler.java │ │ ├── mxCellMarker.java │ │ ├── mxCellTracker.java │ │ ├── mxConnectionHandler.java │ │ ├── mxEdgeHandler.java │ │ ├── mxElbowEdgeHandler.java │ │ ├── mxGraphHandler.java │ │ ├── mxGraphTransferHandler.java │ │ ├── mxInsertHandler.java │ │ ├── mxKeyboardHandler.java │ │ ├── mxPanningHandler.java │ │ ├── mxRotationHandler.java │ │ ├── mxRubberband.java │ │ ├── mxSubHandler.java │ │ ├── mxVertexHandler.java │ │ └── package.html │ ├── images │ │ ├── collapsed.gif │ │ ├── expanded.gif │ │ └── warning.gif │ ├── mxGraphComponent.java │ ├── mxGraphOutline.java │ ├── package.html │ ├── util │ │ ├── CellSelector.java │ │ ├── mxCellOverlay.java │ │ ├── mxGraphActions.java │ │ ├── mxGraphTransferable.java │ │ ├── mxICellOverlay.java │ │ ├── mxMouseControl.java │ │ └── package.html │ └── view │ │ ├── mxCellEditor.java │ │ ├── mxICellEditor.java │ │ ├── mxInteractiveCanvas.java │ │ └── package.html │ ├── util │ ├── StringUtils.java │ ├── mxCellRenderer.java │ ├── mxConstants.java │ ├── mxEvent.java │ ├── mxEventObject.java │ ├── mxEventSource.java │ ├── mxImage.java │ ├── mxLighweightLabel.java │ ├── mxLighweightTextPane.java │ ├── mxPoint.java │ ├── mxRectangle.java │ ├── mxResources.java │ ├── mxUndoManager.java │ ├── mxUndoableEdit.java │ ├── mxUtils.java │ └── package.html │ ├── validation │ └── Validator.java │ └── view │ ├── mxCellState.java │ ├── mxEdgeStyle.java │ ├── mxGraph.java │ ├── mxGraphSelectionModel.java │ ├── mxGraphView.java │ ├── mxLayoutManager.java │ ├── mxMultiplicity.java │ ├── mxPerimeter.java │ ├── mxSpaceManager.java │ ├── mxStyleRegistry.java │ ├── mxStylesheet.java │ ├── mxSwimlaneManager.java │ ├── mxTemporaryCellStates.java │ └── package.html └── lib ├── commons-cli-1.2.jar ├── dom4j.jar ├── jaxb-api-2.3.0.jar ├── jgraphx.jar ├── lucene-core-3.6.1.jar └── rsyntaxtextarea.jar /LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright 2017 Fabrizio Morbini 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | 15 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | This is an attempt to build a graphical user interface for 2 | editing SCXML finite state machines. 3 | 4 | We are using the JGraphX library as a base and we started 5 | by modifying the graph editor application included as an 6 | example with JGraphX. 7 | 8 | Main features: 9 | * edit of scxml networks 10 | * support for src and xi:include 11 | * search function using Apache Lucene 12 | * autolayout and possibility to save manual layout 13 | * export to DOT (graphviz) format 14 | * scxml listener that highlights and logs events as they happen during the finite state machine execution. (see https://github.com/fmorbini/scxmlgui/blob/master/extra/MySCXMLListener.java as an example of an Apache scxml listener class that sends the proper messages to the editor) 15 | 16 | A [short guide](https://github.com/fmorbini/scxmlgui/blob/wiki/Guide.md) is available. 17 | 18 | **Main issues/TODOs**: see the [Issues](https://github.com/fmorbini/scxmlgui/issues) tab. 19 | * Please consider contributing to the code when submitting an issue, as i have very limited time to work on this project and help is appreciated. Thanks! 20 | 21 | **To test**: execute the latest jar (requires at least Java 1.6) https://github.com/fmorbini/scxmlgui/blob/master/extra/fsm-editor.jar 22 | 23 | **To compile**: cd in the root directory (trunk) and run "ant". 24 | 25 | Here some **screenshots**: 26 | 27 | Editor window for edge properties: 28 | 29 | ![edge editing](https://github.com/fmorbini/scxmlgui/blob/master/extra/edge-editing.png) 30 | 31 | Context menu to select edit operations on a node: 32 | 33 | ![node menu](https://github.com/fmorbini/scxmlgui/blob/master/extra/node-menu.png) 34 | 35 | The find tool in action: 36 | 37 | ![find tool](https://github.com/fmorbini/scxmlgui/blob/master/extra/find-tool.png) 38 | -------------------------------------------------------------------------------- /build.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | git master hash: ${repository.version} 44 | git master hash: ${repository.version} 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /extra/MySCXMLListener.java: -------------------------------------------------------------------------------- 1 | package edu.usc.ict.simcoach.dialogue.scxml; 2 | 3 | import java.io.IOException; 4 | import java.io.InputStream; 5 | import java.io.PrintWriter; 6 | import java.net.Socket; 7 | import java.net.UnknownHostException; 8 | import java.util.HashMap; 9 | import java.util.HashSet; 10 | import java.util.concurrent.LinkedBlockingQueue; 11 | 12 | import org.apache.commons.scxml.SCXMLListener; 13 | import org.apache.commons.scxml.model.Transition; 14 | import org.apache.commons.scxml.model.TransitionTarget; 15 | 16 | public class MySCXMLListener extends Thread implements SCXMLListener { 17 | 18 | HashMap> activeTransitions=new HashMap>(); 19 | private LinkedBlockingQueue events=new LinkedBlockingQueue(); 20 | private Socket socket; 21 | private PrintWriter out; 22 | private InputStream in; 23 | private String server; 24 | private int port; 25 | 26 | public MySCXMLListener(String server,int port) { 27 | super(); 28 | this.server=server; 29 | this.port=port; 30 | reconnect(); 31 | activeTransitions.clear(); 32 | events.clear(); 33 | start(); 34 | } 35 | 36 | public void run() { 37 | while (true) { 38 | if (!events.isEmpty() && checkConnection()) { 39 | try { 40 | String event=events.take(); 41 | System.out.println(event); 42 | out.println(event); 43 | } catch (InterruptedException e) { 44 | e.printStackTrace(); 45 | } 46 | } 47 | } 48 | } 49 | 50 | private boolean reconnect() { 51 | try { 52 | socket = new Socket(server, port); 53 | socket.setSoTimeout(5000); 54 | out = new PrintWriter(socket.getOutputStream(), true); 55 | in = socket.getInputStream(); 56 | return true; 57 | } catch (Exception e) { 58 | socket=null; 59 | out=null; 60 | in=null; 61 | return false; 62 | } 63 | } 64 | private boolean connected() { 65 | try { 66 | return !((socket==null) || (in.read()<0)); 67 | } catch (IOException e) { 68 | return false; 69 | } 70 | } 71 | private boolean checkConnection() { 72 | return connected() || reconnect(); 73 | } 74 | 75 | @Override 76 | public void onEntry(TransitionTarget state) { 77 | try { 78 | sendActiveState(state); 79 | } catch (InterruptedException e) { 80 | e.printStackTrace(); 81 | } 82 | } 83 | 84 | @Override 85 | public void onExit(TransitionTarget state) { 86 | try { 87 | sendInactiveState(state); 88 | } catch (InterruptedException e) { 89 | e.printStackTrace(); 90 | } 91 | } 92 | 93 | @Override 94 | public void onTransition(TransitionTarget from, TransitionTarget to,Transition tr) { 95 | assert(from.equals(tr.getParent())); 96 | assert(tr.getTargets().contains(to)||tr.getTargets().isEmpty()); 97 | try { 98 | sendActiveTransition(from,to,tr); 99 | } catch (InterruptedException e) { 100 | e.printStackTrace(); 101 | } 102 | if (!activeTransitions.containsKey(to)) { 103 | HashSet set = new HashSet(); 104 | set.add(tr); 105 | activeTransitions.put(to, set); 106 | } else { 107 | HashSet set = activeTransitions.get(to); 108 | set.add(tr); 109 | } 110 | } 111 | 112 | private void sendActiveState(TransitionTarget state) throws InterruptedException { 113 | events.put("1 "+state.getId()); 114 | HashSet set = activeTransitions.get(state); 115 | if (set!=null) { 116 | for(Transition tr:set) { 117 | sendInactiveTransition(state,tr); 118 | } 119 | } 120 | } 121 | private void sendInactiveState(TransitionTarget state) throws InterruptedException { 122 | events.put("0 "+state.getId()); 123 | HashSet set = activeTransitions.get(state); 124 | if (set!=null) { 125 | for(Transition tr:set) { 126 | sendInactiveTransition(state,tr); 127 | } 128 | } 129 | } 130 | private void sendActiveTransition(TransitionTarget from, TransitionTarget to, Transition tr) throws InterruptedException { 131 | events.put("3 "+from.getId()+" -> "+to.getId()); 132 | } 133 | private void sendInactiveTransition(TransitionTarget to,Transition tr) throws InterruptedException { 134 | events.put("2 "+tr.getParent().getId()+" -> "+to.getId()); 135 | } 136 | } 137 | -------------------------------------------------------------------------------- /extra/edge-editing.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/extra/edge-editing.png -------------------------------------------------------------------------------- /extra/find-tool.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/extra/find-tool.png -------------------------------------------------------------------------------- /extra/fsm-editor.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/extra/fsm-editor.jar -------------------------------------------------------------------------------- /extra/legend.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/extra/legend.png -------------------------------------------------------------------------------- /extra/node-menu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/extra/node-menu.png -------------------------------------------------------------------------------- /extra/restrictedStates.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | blue 5 | first test restriction 6 | 7 | documentation of possible_event1 8 | 9 | 10 | documentation of possible_event2 11 | 12 | 13 | documentation of eventA 14 | 15 | 16 | documentation of eventB 17 | 18 | 19 | documentation of eventC 20 | 21 | 22 | documentation of eventD 23 | 24 | 25 | documentation of eventE 26 | 27 | 28 | documentation of eventF 29 | 30 | 31 | start event aaaaaaaaaaaaaa aaaaaa aaaaaa aaaaaa aaaaaa aaaaabbb bbbbbb bbbb bbbbb bbbbb bbbbbb bbbbbbbb bbbbbb cccc cccccc ccc cccccc 32 | 33 | 34 | stop event 35 | 36 | 37 | resume event 38 | 39 | 40 | cancel event 41 | 42 | 43 | save event 44 | 45 | 46 | exit event 47 | 48 | 49 | undo event 50 | 51 | 52 | redo event 53 | 54 | 55 | 56 | blue 57 | second test restriction 58 | 59 | documentation of possible_event3 60 | 61 | 62 | documentation of possible_event4 63 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /extra/sample-restriction-config.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/extra/sample-restriction-config.png -------------------------------------------------------------------------------- /extra/scxmlConstraints.xsd: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /fsm-editor/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | fsm-editor 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.jdt.core.javanature 16 | 17 | 18 | -------------------------------------------------------------------------------- /fsm-editor/build.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | ]]> 91 | 92 | 93 | 94 | 95 | 96 | 97 | -------------------------------------------------------------------------------- /fsm-editor/info.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/info.txt -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/config/ObjectFactory.java: -------------------------------------------------------------------------------- 1 | // 2 | // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.6 3 | // See http://java.sun.com/xml/jaxb 4 | // Any modifications to this file will be lost upon recompilation of the source schema. 5 | // Generated on: 2012.09.24 at 01:55:46 PM CEST 6 | // 7 | 8 | 9 | package com.mxgraph.examples.config; 10 | 11 | import javax.xml.bind.annotation.XmlRegistry; 12 | 13 | 14 | /** 15 | * This object contains factory methods for each 16 | * Java content interface and Java element interface 17 | * generated in the test package. 18 | *

An ObjectFactory allows you to programatically 19 | * construct new instances of the Java representation 20 | * for XML content. The Java representation of XML 21 | * content can consist of schema derived interfaces 22 | * and classes representing the binding of schema 23 | * type definitions, element declarations and model 24 | * groups. Factory methods for each of these are 25 | * provided in this class. 26 | * 27 | */ 28 | @XmlRegistry 29 | public class ObjectFactory { 30 | 31 | 32 | /** 33 | * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: test 34 | * 35 | */ 36 | public ObjectFactory() { 37 | } 38 | 39 | /** 40 | * Create an instance of {@link SCXMLConstraints } 41 | * 42 | */ 43 | public SCXMLConstraints createSCXMLConstraints() { 44 | return new SCXMLConstraints(); 45 | } 46 | 47 | /** 48 | * Create an instance of {@link SCXMLConstraints.RestrictedState } 49 | * 50 | */ 51 | public SCXMLConstraints.RestrictedState createSCXMLConstraintsRestrictedState() { 52 | return new SCXMLConstraints.RestrictedState(); 53 | } 54 | 55 | /** 56 | * Create an instance of {@link SCXMLConstraints.RestrictedState.PossibleEvent } 57 | * 58 | */ 59 | public SCXMLConstraints.RestrictedState.PossibleEvent createSCXMLConstraintsRestrictedStatePossibleEvent() { 60 | return new SCXMLConstraints.RestrictedState.PossibleEvent(); 61 | } 62 | 63 | } 64 | -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/editor/fileimportexport/DOTImportExport.java: -------------------------------------------------------------------------------- 1 | package com.mxgraph.examples.swing.editor.fileimportexport; 2 | 3 | import java.io.IOException; 4 | import java.util.LinkedList; 5 | import java.util.Queue; 6 | 7 | import javax.swing.JFileChooser; 8 | 9 | import com.mxgraph.examples.config.SCXMLConstraints; 10 | import com.mxgraph.examples.swing.editor.scxml.SCXMLGraph; 11 | import com.mxgraph.model.mxCell; 12 | import com.mxgraph.model.mxIGraphModel; 13 | import com.mxgraph.swing.mxGraphComponent; 14 | import com.mxgraph.util.mxUtils; 15 | import com.mxgraph.view.mxGraph; 16 | import com.mxgraph.view.mxGraphView; 17 | 18 | public class DOTImportExport implements IImportExport { 19 | 20 | @Override 21 | public Object buildEdgeValue() { 22 | // TODO Auto-generated method stub 23 | return null; 24 | } 25 | 26 | @Override 27 | public Object buildNodeValue() { 28 | // TODO Auto-generated method stub 29 | return null; 30 | } 31 | 32 | @Override 33 | public Boolean canExport() { 34 | return true; 35 | } 36 | 37 | @Override 38 | public Boolean canImport() { 39 | return false; 40 | } 41 | 42 | @Override 43 | public Object cloneValue(Object value) { 44 | // TODO Auto-generated method stub 45 | return null; 46 | } 47 | 48 | @Override 49 | public void read(String from, mxGraphComponent graphComponent,JFileChooser fc, SCXMLConstraints restrictedConstraints) throws IOException { 50 | // TODO Auto-generated method stub 51 | 52 | } 53 | 54 | @Override 55 | public void write(mxGraphComponent from, String into) throws IOException { 56 | mxGraph graph = from.getGraph(); 57 | mxGraphView view = graph.getView(); 58 | mxIGraphModel model = graph.getModel(); 59 | mxCell root=(mxCell) model.getRoot(); 60 | if ((root!=null) && (root.getChildCount()==1)) root=(mxCell) root.getChildAt(0); 61 | if (root!=null) { 62 | String dot=mxVertex2DOTString(view,root,new StringBuffer(),true); 63 | System.out.println(dot); 64 | mxUtils.writeFile(dot, into); 65 | } 66 | } 67 | 68 | public mxCell getSimpleChildOf(mxCell n) { 69 | Queue list=new LinkedList(); 70 | list.add(n); 71 | while(!list.isEmpty()) { 72 | mxCell x=list.poll(); 73 | int l=x.getChildCount(); 74 | for (int i=0;i "+realEnd+" ["+((ltail!=null)?ltail+",":"")+((lhead!=null)?lhead+",":"")+" label=\""+edgeLabel+"\"];"); 125 | } 126 | } 127 | if (isRoot) ret+=transitions.toString(); 128 | ret+=close; 129 | return ret; 130 | } 131 | 132 | @Override 133 | public void clearInternalID2NodesAndSCXMLID2Nodes() { 134 | // TODO Auto-generated method stub 135 | 136 | } 137 | } 138 | -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/editor/fileimportexport/HTMLImportExport.java: -------------------------------------------------------------------------------- 1 | package com.mxgraph.examples.swing.editor.fileimportexport; 2 | 3 | import java.io.IOException; 4 | 5 | import javax.swing.JFileChooser; 6 | 7 | import com.mxgraph.examples.config.SCXMLConstraints; 8 | import com.mxgraph.swing.mxGraphComponent; 9 | import com.mxgraph.util.mxCellRenderer; 10 | import com.mxgraph.util.mxUtils; 11 | import com.mxgraph.view.mxGraph; 12 | 13 | public class HTMLImportExport implements IImportExport { 14 | 15 | @Override 16 | public Boolean canExport() { 17 | return true; 18 | } 19 | 20 | @Override 21 | public Boolean canImport() { 22 | return false; 23 | } 24 | 25 | @Override 26 | public void read(String from, mxGraphComponent graphComponent,JFileChooser fc, SCXMLConstraints restrictedConstraints) throws IOException { 27 | } 28 | 29 | @Override 30 | public void write(mxGraphComponent from, String into) throws IOException { 31 | mxGraph graph=from.getGraph(); 32 | mxUtils.writeFile(mxUtils.getXml(mxCellRenderer.createHtmlDocument(graph, null, 1, null, null).getDocumentElement()), into); 33 | } 34 | 35 | @Override 36 | public Object buildNodeValue() { 37 | return null; 38 | } 39 | 40 | @Override 41 | public Object cloneValue(Object value) { 42 | return null; 43 | } 44 | 45 | @Override 46 | public Object buildEdgeValue() { 47 | return null; 48 | } 49 | 50 | @Override 51 | public void clearInternalID2NodesAndSCXMLID2Nodes() { 52 | // TODO Auto-generated method stub 53 | 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/editor/fileimportexport/IImportExport.java: -------------------------------------------------------------------------------- 1 | package com.mxgraph.examples.swing.editor.fileimportexport; 2 | 3 | import javax.swing.JFileChooser; 4 | 5 | import com.mxgraph.examples.config.SCXMLConstraints; 6 | import com.mxgraph.swing.mxGraphComponent; 7 | 8 | public interface IImportExport { 9 | public abstract Boolean canImport(); 10 | public abstract Boolean canExport(); 11 | public abstract void read(String from,mxGraphComponent graphComponent, JFileChooser fc, SCXMLConstraints restrictedConstraints) throws Exception; 12 | public abstract void write(mxGraphComponent graphComponent,String into) throws Exception; 13 | public abstract Object buildNodeValue(); 14 | public abstract Object buildEdgeValue(); 15 | public abstract Object cloneValue(Object value); 16 | public void clearInternalID2NodesAndSCXMLID2Nodes(); 17 | } 18 | -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/editor/fileimportexport/IMGImportExport.java: -------------------------------------------------------------------------------- 1 | package com.mxgraph.examples.swing.editor.fileimportexport; 2 | 3 | import java.awt.Color; 4 | import java.awt.image.BufferedImage; 5 | import java.io.File; 6 | 7 | import javax.imageio.ImageIO; 8 | import javax.swing.JFileChooser; 9 | import javax.swing.JOptionPane; 10 | 11 | import com.mxgraph.examples.config.SCXMLConstraints; 12 | import com.mxgraph.swing.mxGraphComponent; 13 | import com.mxgraph.util.mxCellRenderer; 14 | import com.mxgraph.util.mxResources; 15 | import com.mxgraph.view.mxGraph; 16 | 17 | public class IMGImportExport implements IImportExport { 18 | 19 | @Override 20 | public Boolean canExport() { 21 | return true; 22 | } 23 | 24 | @Override 25 | public Boolean canImport() { 26 | return false; 27 | } 28 | 29 | @Override 30 | public void read(String from, mxGraphComponent graphComponent,JFileChooser fc, SCXMLConstraints restrictedConstraints) throws Exception { 31 | } 32 | 33 | @Override 34 | public void write(mxGraphComponent graphComponent, String into) throws Exception { 35 | Color bg = null; 36 | String ext = into.substring(into.lastIndexOf('.') + 1); 37 | if ((!ext.equalsIgnoreCase("gif") && !ext.equalsIgnoreCase("png")) 38 | || JOptionPane.showConfirmDialog( 39 | graphComponent, mxResources 40 | .get("transparentBackground")) != JOptionPane.YES_OPTION) 41 | { 42 | bg = graphComponent.getBackground(); 43 | } 44 | write(graphComponent,into,ext,bg); 45 | } 46 | public void write(mxGraphComponent graphComponent,String into,String format,Color bg) throws Exception { 47 | mxGraph graph = graphComponent.getGraph(); 48 | BufferedImage image = mxCellRenderer.createBufferedImage(graph, null, 1, bg, 49 | graphComponent.isAntiAlias(), null, 50 | graphComponent.getCanvas()); 51 | 52 | if (image != null) 53 | { 54 | if (!ImageIO.write(image,format,new File(into))) { 55 | throw new Exception(mxResources.get("invalidImageFormat"+": '"+format+"'")); 56 | } 57 | } 58 | else 59 | { 60 | throw new Exception(mxResources.get("noImageData")); 61 | } 62 | } 63 | 64 | @Override 65 | public Object buildNodeValue() { 66 | return null; 67 | } 68 | 69 | @Override 70 | public Object buildEdgeValue() { 71 | // TODO Auto-generated method stub 72 | return null; 73 | } 74 | 75 | @Override 76 | public Object cloneValue(Object value) { 77 | return null; 78 | } 79 | 80 | @Override 81 | public void clearInternalID2NodesAndSCXMLID2Nodes() { 82 | // TODO Auto-generated method stub 83 | 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/editor/fileimportexport/MXEImportExport.java: -------------------------------------------------------------------------------- 1 | package com.mxgraph.examples.swing.editor.fileimportexport; 2 | 3 | import java.io.IOException; 4 | 5 | import javax.swing.JFileChooser; 6 | 7 | import org.w3c.dom.Document; 8 | 9 | import com.mxgraph.examples.config.SCXMLConstraints; 10 | import com.mxgraph.io.mxCodec; 11 | import com.mxgraph.swing.mxGraphComponent; 12 | import com.mxgraph.util.mxUtils; 13 | import com.mxgraph.view.mxGraph; 14 | 15 | public class MXEImportExport implements IImportExport { 16 | 17 | @Override 18 | public Boolean canExport() { 19 | return true; 20 | } 21 | 22 | @Override 23 | public Boolean canImport() { 24 | return true; 25 | } 26 | 27 | @Override 28 | public void read(String from, mxGraphComponent graphComponent,JFileChooser fc, SCXMLConstraints restrictedConstraints) throws Exception { 29 | Document document = mxUtils.parseXMLString(mxUtils.readFile(from),false,false); 30 | mxCodec codec = new mxCodec(document); 31 | codec.decode(document.getDocumentElement(),graphComponent.getGraph().getModel()); 32 | } 33 | 34 | @Override 35 | public void write(mxGraphComponent from, String into) throws IOException { 36 | mxGraph graph=from.getGraph(); 37 | mxCodec codec = new mxCodec(); 38 | String xml = mxUtils.getXml(codec.encode(graph.getModel())); 39 | mxUtils.writeFile(xml, into); 40 | } 41 | 42 | @Override 43 | public Object buildNodeValue() { 44 | return null; 45 | } 46 | 47 | @Override 48 | public Object buildEdgeValue() { 49 | return null; 50 | } 51 | 52 | @Override 53 | public Object cloneValue(Object value) { 54 | return value; 55 | } 56 | 57 | @Override 58 | public void clearInternalID2NodesAndSCXMLID2Nodes() { 59 | // TODO Auto-generated method stub 60 | 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/editor/fileimportexport/OutSource.java: -------------------------------------------------------------------------------- 1 | package com.mxgraph.examples.swing.editor.fileimportexport; 2 | 3 | import java.io.Serializable; 4 | 5 | public class OutSource implements Serializable { 6 | 7 | private static final long serialVersionUID = 1L; 8 | public enum OUTSOURCETYPE {SRC,XINC}; 9 | 10 | private OUTSOURCETYPE type; 11 | private String location; 12 | public OutSource(OUTSOURCETYPE t,String l) { 13 | setLocation(l); 14 | setType(t); 15 | } 16 | public OUTSOURCETYPE getType() { 17 | return type; 18 | } 19 | public String getLocation() { 20 | return location; 21 | } 22 | public void setLocation(String location) { 23 | this.location = location; 24 | } 25 | public void setType(OUTSOURCETYPE type) { 26 | this.type = type; 27 | } 28 | @Override 29 | public boolean equals(Object obj) { 30 | if (obj instanceof OutSource) { 31 | OutSource objOutSource=(OutSource)obj; 32 | return (obj!=null && ((objOutSource.location!=null && objOutSource.location.equals(location)) || 33 | (objOutSource.location==null)) 34 | && ((objOutSource.type!=null && objOutSource.type.equals(type)) || 35 | (objOutSource.type==null))); 36 | } else return super.equals(obj); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/editor/fileimportexport/SVGImportExport.java: -------------------------------------------------------------------------------- 1 | package com.mxgraph.examples.swing.editor.fileimportexport; 2 | 3 | import java.io.IOException; 4 | 5 | import javax.swing.JFileChooser; 6 | 7 | import com.mxgraph.examples.config.SCXMLConstraints; 8 | import com.mxgraph.swing.mxGraphComponent; 9 | import com.mxgraph.util.mxCellRenderer; 10 | import com.mxgraph.util.mxUtils; 11 | import com.mxgraph.view.mxGraph; 12 | 13 | public class SVGImportExport implements IImportExport { 14 | 15 | @Override 16 | public Boolean canExport() { 17 | return true; 18 | } 19 | 20 | @Override 21 | public Boolean canImport() { 22 | return false; 23 | } 24 | 25 | @Override 26 | public void read(String from, mxGraphComponent graphComponent,JFileChooser fc, SCXMLConstraints restrictedConstraints) throws IOException { 27 | } 28 | 29 | @Override 30 | public void write(mxGraphComponent from, String into) throws IOException { 31 | mxGraph graph=from.getGraph(); 32 | mxUtils.writeFile(mxUtils.getXml(mxCellRenderer.createSvgDocument(graph, null, 1, null, null).getDocumentElement()), into); 33 | } 34 | 35 | @Override 36 | public Object buildNodeValue() { 37 | return null; 38 | } 39 | 40 | @Override 41 | public Object buildEdgeValue() { 42 | return null; 43 | } 44 | 45 | @Override 46 | public Object cloneValue(Object value) { 47 | return null; 48 | } 49 | 50 | @Override 51 | public void clearInternalID2NodesAndSCXMLID2Nodes() { 52 | // TODO Auto-generated method stub 53 | 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/editor/fileimportexport/VMLImportExport.java: -------------------------------------------------------------------------------- 1 | package com.mxgraph.examples.swing.editor.fileimportexport; 2 | 3 | import java.io.IOException; 4 | 5 | import javax.swing.JFileChooser; 6 | 7 | import com.mxgraph.examples.config.SCXMLConstraints; 8 | import com.mxgraph.swing.mxGraphComponent; 9 | import com.mxgraph.util.mxCellRenderer; 10 | import com.mxgraph.util.mxUtils; 11 | import com.mxgraph.view.mxGraph; 12 | 13 | public class VMLImportExport implements IImportExport { 14 | 15 | @Override 16 | public Boolean canExport() { 17 | return true; 18 | } 19 | 20 | @Override 21 | public Boolean canImport() { 22 | return false; 23 | } 24 | 25 | @Override 26 | public void read(String from, mxGraphComponent graphComponent,JFileChooser fc, SCXMLConstraints restrictedConstraints) throws IOException { 27 | } 28 | 29 | @Override 30 | public void write(mxGraphComponent from, String into) throws IOException { 31 | mxGraph graph=from.getGraph(); 32 | mxUtils.writeFile(mxUtils.getXml(mxCellRenderer.createVmlDocument(graph, null, 1, null, null).getDocumentElement()), into); 33 | } 34 | 35 | @Override 36 | public Object buildNodeValue() { 37 | return null; 38 | } 39 | 40 | @Override 41 | public Object buildEdgeValue() { 42 | return null; 43 | } 44 | 45 | @Override 46 | public Object cloneValue(Object value) { 47 | return null; 48 | } 49 | 50 | @Override 51 | public void clearInternalID2NodesAndSCXMLID2Nodes() { 52 | // TODO Auto-generated method stub 53 | 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/editor/scxml/MyUndoManager.java: -------------------------------------------------------------------------------- 1 | package com.mxgraph.examples.swing.editor.scxml; 2 | 3 | import java.util.Vector; 4 | 5 | import javax.swing.undo.CannotUndoException; 6 | import javax.swing.undo.UndoManager; 7 | import javax.swing.undo.UndoableEdit; 8 | 9 | public class MyUndoManager extends UndoManager { 10 | 11 | private static final long serialVersionUID = 1L; 12 | 13 | public Vector getEdits() { 14 | return edits; 15 | } 16 | protected UndoableEdit getNextUndoableEdit() { 17 | int size = edits.size( ); 18 | for (int i=size-1;i>=0;i--) { 19 | UndoableEdit u = (UndoableEdit)edits.elementAt(i); 20 | if (u.canUndo( ) && u.isSignificant( )) 21 | return u; 22 | } 23 | return null; 24 | } 25 | protected UndoableEdit getInitialEdit() { 26 | return (edits.isEmpty())?null:edits.elementAt(0); 27 | } 28 | 29 | public synchronized void undoTo(UndoableEdit to, boolean excludeTo) { 30 | int size = edits.size( ); 31 | for (int i=size-1;i>=0;i--) { 32 | UndoableEdit u = (UndoableEdit)edits.elementAt(i); 33 | if (canUndo()) { 34 | if ((u==to) && excludeTo) return; 35 | else undo(); 36 | } 37 | if (u==to) return; 38 | } 39 | } 40 | public synchronized void redoTo(UndoableEdit to, boolean excludeTo) { 41 | int size = edits.size( ); 42 | for (int i=0;i localHashSetOfCells=new HashSet(); 32 | 33 | /** 34 | * 35 | */ 36 | private static final long serialVersionUID = -8451338653189373347L; 37 | 38 | /** 39 | * 40 | */ 41 | public boolean isEnabled() 42 | { 43 | return graphComponent.getGraph().isDropEnabled(); 44 | } 45 | 46 | @Override 47 | public void reset() { 48 | super.reset(); 49 | localHashSetOfCells.clear(); 50 | } 51 | 52 | @Override 53 | protected boolean isValidState(mxCellState state) { 54 | if (cells!=null) { 55 | if (localHashSetOfCells.isEmpty() && (cells.length>0)) localHashSetOfCells.addAll(Arrays.asList(cells)); 56 | mxCell targetCell=(mxCell) state.getCell(); 57 | while(targetCell!=null) { 58 | // avoid cycles. return invalid if the drop target is a child of one of the moved nodes. 59 | if (localHashSetOfCells.contains(targetCell)) return false; 60 | else targetCell=(mxCell) targetCell.getParent(); 61 | } 62 | } 63 | return true; 64 | } 65 | 66 | /** 67 | * 68 | */ 69 | public Object getCell(MouseEvent e) 70 | { 71 | TransferHandler th = graphComponent.getTransferHandler(); 72 | boolean isLocal = th instanceof mxGraphTransferHandler 73 | && ((mxGraphTransferHandler) th).isLocalDrag(); 74 | 75 | mxGraph graph = graphComponent.getGraph(); 76 | Object cell = super.getCell(e); 77 | Object[] cells = (isLocal) ? graph.getSelectionCells() 78 | : dragCells; 79 | cell = graph.getDropTarget(cells, e.getPoint(), cell); 80 | boolean clone = graphComponent.isCloneEvent(e) && cloneEnabled; 81 | 82 | if (isLocal && cell != null && cells.length > 0 && !clone 83 | && graph.getModel().getParent(cells[0]) == cell) 84 | { 85 | cell = null; 86 | } 87 | 88 | return cell; 89 | } 90 | 91 | }; 92 | 93 | // Swimlane content area will not be transparent drop targets 94 | marker.setSwimlaneContentEnabled(true); 95 | 96 | return marker; 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/editor/scxml/SCXMLKeyboardHandler.java: -------------------------------------------------------------------------------- 1 | package com.mxgraph.examples.swing.editor.scxml; 2 | 3 | import javax.swing.ActionMap; 4 | import javax.swing.InputMap; 5 | import javax.swing.JComponent; 6 | import javax.swing.KeyStroke; 7 | 8 | import com.mxgraph.swing.mxGraphComponent; 9 | import com.mxgraph.swing.handler.mxKeyboardHandler; 10 | import com.mxgraph.swing.util.mxGraphActions; 11 | import com.mxgraph.swing.util.mxGraphActions.DeleteAction; 12 | 13 | /** 14 | * @author Administrator 15 | * 16 | */ 17 | public class SCXMLKeyboardHandler extends mxKeyboardHandler 18 | { 19 | 20 | /** 21 | * 22 | * @param graphComponent 23 | */ 24 | public SCXMLKeyboardHandler(mxGraphComponent graphComponent) 25 | { 26 | super(graphComponent); 27 | } 28 | 29 | /** 30 | * Return JTree's input map. 31 | */ 32 | protected InputMap getInputMap(int condition) 33 | { 34 | InputMap map = super.getInputMap(condition); 35 | 36 | if ((condition == JComponent.WHEN_FOCUSED ) && map != null) 37 | { 38 | map.put(KeyStroke.getKeyStroke("control S"), "save"); 39 | map.put(KeyStroke.getKeyStroke("control shift S"), "saveAs"); 40 | map.put(KeyStroke.getKeyStroke("control N"), "new"); 41 | map.put(KeyStroke.getKeyStroke("control O"), "open"); 42 | map.put(KeyStroke.getKeyStroke("DELETE"), "delete"); 43 | map.put(KeyStroke.getKeyStroke("control Z"), "undo"); 44 | map.put(KeyStroke.getKeyStroke("control Y"), "redo"); 45 | map.put(KeyStroke.getKeyStroke("control shift V"), "selectVertices"); 46 | map.put(KeyStroke.getKeyStroke("control shift E"), "selectEdges"); 47 | map.put(KeyStroke.getKeyStroke("control A"), "selectAll"); 48 | map.put(KeyStroke.getKeyStroke("ESCAPE"), "selectNone"); 49 | map.put(KeyStroke.getKeyStroke("control PAGE_UP"), "zoomIN"); 50 | map.put(KeyStroke.getKeyStroke("control PAGE_DOWN"), "zoomOUT"); 51 | map.put(KeyStroke.getKeyStroke("control F"), "find"); 52 | } 53 | 54 | return map; 55 | } 56 | 57 | /** 58 | * Return the mapping between JTree's input map and JGraph's actions. 59 | */ 60 | protected ActionMap createActionMap() 61 | { 62 | ActionMap map = super.createActionMap(); 63 | 64 | map.put("save", new SCXMLEditorActions.SaveAction(false)); 65 | map.put("saveAs", new SCXMLEditorActions.SaveAction(true)); 66 | map.put("new", new SCXMLEditorActions.NewSCXMLAction()); 67 | map.put("open", new SCXMLEditorActions.OpenAction()); 68 | map.put("delete",new SCXMLEditorActions.SCXMLDelete()); 69 | map.put("undo", new SCXMLEditorActions.HistoryAction(true)); 70 | map.put("redo", new SCXMLEditorActions.HistoryAction(false)); 71 | map.put("selectVertices", mxGraphActions.getSelectVerticesAction()); 72 | map.put("selectEdges", mxGraphActions.getSelectEdgesAction()); 73 | map.put("selectAll", mxGraphActions.getSelectAllAction()); 74 | map.put("selectNone", mxGraphActions.getSelectNoneAction()); 75 | map.put("zoomIN", new SCXMLEditorActions.ZoomIN()); 76 | map.put("zoomOUT", new SCXMLEditorActions.ZoomOUT()); 77 | map.put("find", new SCXMLEditorActions.ShowSCXMLFindTool()); 78 | map.put("edit", new SCXMLEditorActions.EditSelectedCellAction(null)); 79 | return map; 80 | } 81 | 82 | } 83 | -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/editor/scxml/SCXMLTransferHandler.java: -------------------------------------------------------------------------------- 1 | package com.mxgraph.examples.swing.editor.scxml; 2 | 3 | import java.awt.Component; 4 | import java.awt.Container; 5 | import java.awt.datatransfer.DataFlavor; 6 | import java.awt.datatransfer.Transferable; 7 | import java.awt.datatransfer.UnsupportedFlavorException; 8 | import java.awt.event.ActionEvent; 9 | import java.io.File; 10 | import java.io.IOException; 11 | import java.util.List; 12 | 13 | import javax.swing.JComponent; 14 | import javax.swing.JOptionPane; 15 | import javax.swing.TransferHandler; 16 | 17 | import com.mxgraph.examples.swing.SCXMLGraphEditor; 18 | import com.mxgraph.examples.swing.editor.scxml.SCXMLEditorActions.OpenAction; 19 | import com.mxgraph.swing.handler.mxGraphTransferHandler; 20 | import com.mxgraph.util.mxResources; 21 | 22 | public class SCXMLTransferHandler extends mxGraphTransferHandler { 23 | 24 | @Override 25 | public boolean canImport(JComponent comp, DataFlavor[] flavors) 26 | { 27 | if (super.canImport(comp, flavors)) 28 | return true; 29 | else { 30 | for (int i = 0; i < flavors.length; i++) 31 | { 32 | if (flavors[i] != null 33 | && flavors[i].equals(DataFlavor.javaFileListFlavor)) 34 | { 35 | return true; 36 | } 37 | } 38 | 39 | return false; 40 | } 41 | } 42 | 43 | @Override 44 | public boolean importData(TransferHandler.TransferSupport support) { 45 | try { 46 | Transferable t = support.getTransferable(); 47 | SCXMLGraphEditor editor = getEditorFromComponent(support.getComponent()); 48 | 49 | List l = (List)t.getTransferData(DataFlavor.javaFileListFlavor); 50 | 51 | int num=l.size(); 52 | if (num>0) { 53 | File f=l.get(0); 54 | if (num>1) { 55 | JOptionPane.showMessageDialog(editor, 56 | "Importing only first file: "+f, 57 | mxResources.get("warning"), 58 | JOptionPane.WARNING_MESSAGE); 59 | } 60 | OpenAction action = new OpenAction(f); 61 | action.actionPerformed(new ActionEvent(editor, 0, "", 0)); 62 | } 63 | } catch (UnsupportedFlavorException e) { 64 | return super.importData(support); 65 | } catch (IOException e) { 66 | return false; 67 | } catch (Exception e) { 68 | e.printStackTrace(); 69 | } 70 | 71 | return true; 72 | } 73 | 74 | public static SCXMLGraphEditor getEditorFromComponent(Component c) { 75 | Container p=null; 76 | do { 77 | if (c instanceof SCXMLGraphEditor) return (SCXMLGraphEditor) c; 78 | } while ((c=c.getParent())!=null); 79 | return null; 80 | } 81 | 82 | } 83 | -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/editor/scxml/StayOpenCheckBoxMenuItemUI.java: -------------------------------------------------------------------------------- 1 | package com.mxgraph.examples.swing.editor.scxml; 2 | 3 | // from http://forums.sun.com/thread.jspa?threadID=5366636 4 | 5 | import javax.swing.MenuSelectionManager; 6 | import javax.swing.plaf.basic.BasicCheckBoxMenuItemUI; 7 | 8 | class StayOpenCheckBoxMenuItemUI extends BasicCheckBoxMenuItemUI { 9 | @Override 10 | protected void doClick(MenuSelectionManager msm) { 11 | menuItem.doClick(0); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/editor/scxml/TextDialog.java: -------------------------------------------------------------------------------- 1 | package com.mxgraph.examples.swing.editor.scxml; 2 | 3 | import java.awt.BorderLayout; 4 | import java.awt.GridBagConstraints; 5 | import java.awt.GridBagLayout; 6 | import java.awt.Window; 7 | import java.awt.event.ActionEvent; 8 | import java.awt.event.ActionListener; 9 | import java.awt.event.WindowEvent; 10 | import java.awt.event.WindowListener; 11 | 12 | import javax.swing.JButton; 13 | import javax.swing.JDialog; 14 | import javax.swing.JFrame; 15 | import javax.swing.JPanel; 16 | import javax.swing.JScrollPane; 17 | import javax.swing.JTextArea; 18 | 19 | import com.mxgraph.util.StringUtils; 20 | import com.mxgraph.util.mxResources; 21 | 22 | public class TextDialog extends JDialog implements ActionListener, WindowListener { 23 | public TextDialog(Window parent, String title,String content,ModalityType modal) { 24 | super(parent,modal); 25 | setTitle(title); 26 | JPanel contentPane = new JPanel(new BorderLayout()); 27 | populateGUI(contentPane,content); 28 | contentPane.setOpaque(true); 29 | 30 | addWindowListener(this); 31 | 32 | //Create and set up the window. 33 | setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); 34 | setContentPane(contentPane); 35 | 36 | //Display the window. 37 | pack(); 38 | setLocationRelativeTo(parent); 39 | setVisible(true); 40 | } 41 | 42 | private void populateGUI(JPanel contentPane, String content) { 43 | JButton okButton = new JButton(mxResources.get("ok")); 44 | okButton.setActionCommand("OK"); 45 | okButton.addActionListener(this); 46 | 47 | //Create the list and put it in a scroll pane. 48 | JTextArea textArea = new JTextArea(Math.max(StringUtils.getRows(content), 10),Math.max(StringUtils.getColumns(content),10)); 49 | textArea.setText(content); 50 | textArea.setEditable(false); 51 | JScrollPane textPane = new JScrollPane(textArea); 52 | 53 | contentPane.setLayout(new GridBagLayout()); 54 | 55 | //Add Components to this panel. 56 | GridBagConstraints c = new GridBagConstraints(); 57 | c.gridwidth = GridBagConstraints.REMAINDER; 58 | c.fill = GridBagConstraints.BOTH; 59 | c.weightx = 1.0; 60 | c.weighty = 1.0; 61 | contentPane.add(textPane, c); 62 | 63 | c.fill = GridBagConstraints.NONE; 64 | c.weightx = 0; 65 | c.weighty = 0; 66 | contentPane.add(okButton, c); 67 | } 68 | 69 | @Override 70 | public void actionPerformed(ActionEvent e) { 71 | String cmd=e.getActionCommand(); 72 | if (cmd.equals("OK")) { 73 | dispose(); 74 | } 75 | } 76 | 77 | @Override 78 | public void windowActivated(WindowEvent arg0) { 79 | // TODO Auto-generated method stub 80 | 81 | } 82 | 83 | @Override 84 | public void windowClosed(WindowEvent arg0) { 85 | // TODO Auto-generated method stub 86 | 87 | } 88 | 89 | @Override 90 | public void windowClosing(WindowEvent arg0) { 91 | dispose(); 92 | } 93 | 94 | @Override 95 | public void windowDeactivated(WindowEvent arg0) { 96 | // TODO Auto-generated method stub 97 | 98 | } 99 | 100 | @Override 101 | public void windowDeiconified(WindowEvent arg0) { 102 | // TODO Auto-generated method stub 103 | 104 | } 105 | 106 | @Override 107 | public void windowIconified(WindowEvent arg0) { 108 | // TODO Auto-generated method stub 109 | 110 | } 111 | 112 | @Override 113 | public void windowOpened(WindowEvent arg0) { 114 | // TODO Auto-generated method stub 115 | 116 | } 117 | } 118 | -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/editor/scxml/eleditor/EditorKeyboardHandler.java: -------------------------------------------------------------------------------- 1 | package com.mxgraph.examples.swing.editor.scxml.eleditor; 2 | 3 | import javax.swing.ActionMap; 4 | import javax.swing.InputMap; 5 | import javax.swing.JComponent; 6 | import javax.swing.KeyStroke; 7 | import javax.swing.text.DefaultEditorKit; 8 | 9 | public class EditorKeyboardHandler { 10 | 11 | private SCXMLElementEditor editor; 12 | 13 | public EditorKeyboardHandler(SCXMLElementEditor e) 14 | { 15 | editor=e; 16 | updateInputMap(editor.getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW)); 17 | } 18 | 19 | public void updateInputMap(InputMap map) 20 | { 21 | map.put(KeyStroke.getKeyStroke("control Z"), "undo"); 22 | map.put(KeyStroke.getKeyStroke("control Y"), "redo"); 23 | map.put(KeyStroke.getKeyStroke("control A"), "selectAll"); 24 | map.put(KeyStroke.getKeyStroke("CUT"), "cut"); 25 | map.put(KeyStroke.getKeyStroke("control C"), "copy"); 26 | map.put(KeyStroke.getKeyStroke("COPY"), "copy"); 27 | map.put(KeyStroke.getKeyStroke("control V"), "paste"); 28 | map.put(KeyStroke.getKeyStroke("PASTE"), "paste"); 29 | map.put(KeyStroke.getKeyStroke("ESCAPE"), "close"); 30 | } 31 | 32 | ActionMap map=null; 33 | public ActionMap updateActionMap() 34 | { 35 | if (map==null) { 36 | map = new ActionMap(); 37 | editor.getRootPane().setActionMap(map); 38 | } 39 | 40 | map.put("undo", editor.getActionByName(SCXMLElementEditor.undoAction)); 41 | map.put("redo", editor.getActionByName(SCXMLElementEditor.redoAction)); 42 | map.put("selectAll", editor.getActionByName(DefaultEditorKit.selectAllAction)); 43 | map.put("cut", editor.getActionByName(DefaultEditorKit.cutAction)); 44 | map.put("copy", editor.getActionByName(DefaultEditorKit.copyAction)); 45 | map.put("paste", editor.getActionByName(DefaultEditorKit.pasteAction)); 46 | map.put("close", editor.closeAction); 47 | return map; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/editor/utils/AbstractActionWrapper.java: -------------------------------------------------------------------------------- 1 | package com.mxgraph.examples.swing.editor.utils; 2 | 3 | import java.awt.event.ActionEvent; 4 | 5 | import javax.swing.AbstractAction; 6 | import javax.swing.Action; 7 | import javax.swing.ImageIcon; 8 | 9 | public class AbstractActionWrapper extends AbstractAction { 10 | 11 | private Action action; 12 | private Object eventSource; 13 | 14 | public AbstractActionWrapper(Object es, String name, Action a, ImageIcon icon) { 15 | super(name,icon); 16 | action=a; 17 | eventSource=es; 18 | } 19 | 20 | public void setInternalAction(Action a) { 21 | action=a; 22 | } 23 | public Action getInternalAction() { 24 | return action; 25 | } 26 | 27 | @Override 28 | public void actionPerformed(ActionEvent e) { 29 | action.actionPerformed(new ActionEvent(eventSource, e.getID(), e.getActionCommand())); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/editor/utils/IOUtils.java: -------------------------------------------------------------------------------- 1 | package com.mxgraph.examples.swing.editor.utils; 2 | 3 | import java.io.File; 4 | import java.io.FileInputStream; 5 | import java.io.FileOutputStream; 6 | import java.io.IOException; 7 | import java.nio.channels.FileChannel; 8 | 9 | public class IOUtils { 10 | public static void copyFile(File in, File out) throws IOException { 11 | FileChannel inChannel = new FileInputStream(in).getChannel(); 12 | FileChannel outChannel = new FileOutputStream(out).getChannel(); 13 | try { 14 | inChannel.transferTo(0, inChannel.size(),outChannel); 15 | } catch (IOException e) { 16 | throw e; 17 | } finally { 18 | if (inChannel != null) inChannel.close(); 19 | if (outChannel != null) outChannel.close(); 20 | } 21 | } 22 | public static void appendFileTo(File in, File out) throws IOException { 23 | FileChannel inChannel = new FileInputStream(in).getChannel(); 24 | FileChannel outChannel = new FileOutputStream(out,true).getChannel(); 25 | try { 26 | inChannel.transferTo(0, inChannel.size(),outChannel); 27 | } catch (IOException e) { 28 | throw e; 29 | } finally { 30 | if (inChannel != null) inChannel.close(); 31 | if (outChannel != null) outChannel.close(); 32 | } 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/editor/utils/ListCellSelector.java: -------------------------------------------------------------------------------- 1 | package com.mxgraph.examples.swing.editor.utils; 2 | 3 | import javax.swing.DefaultListModel; 4 | import javax.swing.JList; 5 | import javax.swing.event.ListSelectionEvent; 6 | 7 | import com.mxgraph.examples.swing.editor.scxml.SCXMLGraphComponent; 8 | import com.mxgraph.model.mxCell; 9 | import com.mxgraph.swing.util.CellSelector; 10 | 11 | public class ListCellSelector extends CellSelector { 12 | private JList list; 13 | protected DefaultListModel listModel; 14 | 15 | public ListCellSelector(JList list,SCXMLGraphComponent gc) { 16 | super(gc); 17 | this.list=list; 18 | listModel=(DefaultListModel) list.getModel(); 19 | } 20 | 21 | public mxCell getCellFromListElement(int selectedIndex) { 22 | return (mxCell) listModel.get(selectedIndex); 23 | } 24 | 25 | public void handleSelectEvent(ListSelectionEvent e) { 26 | if (e.getValueIsAdjusting() == false) { 27 | int selectedIndex = list.getSelectedIndex(); 28 | 29 | if ((selectedIndex>=0) && (selectedIndex implements Serializable { 7 | private static final long serialVersionUID = 1L; 8 | public Pair(T f, S s) 9 | { 10 | first = f; 11 | second = s; 12 | } 13 | 14 | public T getFirst() 15 | { 16 | return first; 17 | } 18 | 19 | public S getSecond() 20 | { 21 | return second; 22 | } 23 | 24 | public void setFirst(T f) { 25 | first=f; 26 | } 27 | public void setSecond(S s) { 28 | second=s; 29 | } 30 | 31 | public String toString() 32 | { 33 | return "(" + first.toString() + ", " + second.toString() + ")"; 34 | } 35 | 36 | @Override 37 | public boolean equals(Object other) { 38 | if (other instanceof Pair) { 39 | return ((getFirst()!=null) && getFirst().equals(((Pair) other).getFirst()) && 40 | (getSecond()!=null) && getSecond().equals(((Pair) other).getSecond())); 41 | } else return false; 42 | } 43 | 44 | @Override 45 | public int hashCode() { 46 | return (getFirst()+"||"+getSecond()).hashCode(); 47 | } 48 | 49 | private T first; 50 | private S second; 51 | } 52 | -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/handler/SCXMLConnectionHandler.java: -------------------------------------------------------------------------------- 1 | package com.mxgraph.examples.swing.handler; 2 | 3 | import java.awt.Component; 4 | import java.awt.event.MouseEvent; 5 | 6 | import com.mxgraph.examples.swing.SCXMLGraphEditor; 7 | import com.mxgraph.examples.swing.editor.fileimportexport.SCXMLNode; 8 | import com.mxgraph.examples.swing.editor.scxml.SCXMLGraphComponent; 9 | import com.mxgraph.model.mxCell; 10 | import com.mxgraph.swing.handler.mxConnectionHandler; 11 | import com.mxgraph.util.mxPoint; 12 | import com.mxgraph.view.mxGraph; 13 | 14 | public class SCXMLConnectionHandler extends mxConnectionHandler { 15 | 16 | /** 17 | * 18 | */ 19 | private static final long serialVersionUID = 592305036573256904L; 20 | 21 | public SCXMLConnectionHandler(SCXMLGraphComponent graphComponent) { 22 | super(graphComponent); 23 | } 24 | 25 | @Override 26 | public Object createTargetVertex(MouseEvent e, Object source) { 27 | mxGraph graph = graphComponent.getGraph(); 28 | SCXMLGraphEditor editor = getEditor(e); 29 | SCXMLGraphComponent gc = editor.getGraphComponent(); 30 | mxPoint point = graphComponent.getPointForEvent(e); 31 | mxCell parent = (mxCell) gc.getCellAt((int) point.getX(), 32 | (int) point.getY()); 33 | SCXMLNode value = (SCXMLNode) editor.getCurrentFileIO() 34 | .buildNodeValue(); 35 | mxCell createdCell = (mxCell) graph.insertVertex(parent, 36 | value.getInternalID(), value, point.getX() - 50, 37 | point.getY() - 50, 75, 75, value.getStyle()); 38 | 39 | return createdCell; 40 | } 41 | 42 | private SCXMLGraphEditor getEditor(MouseEvent e) { 43 | if (e.getSource() instanceof Component) { 44 | Component component = (Component) e.getSource(); 45 | 46 | while (component != null 47 | && !(component instanceof SCXMLGraphEditor)) { 48 | component = component.getParent(); 49 | } 50 | 51 | return (SCXMLGraphEditor) component; 52 | } 53 | 54 | return null; 55 | } 56 | 57 | } 58 | -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/actor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/actor.png -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/alignbottom.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/alignbottom.gif -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/aligncenter.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/aligncenter.gif -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/alignleft.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/alignleft.gif -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/alignmiddle.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/alignmiddle.gif -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/alignright.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/alignright.gif -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/aligntop.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/aligntop.gif -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/arrow.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/arrow.gif -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/arrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/arrow.png -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/bell.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/bell.png -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/block_end.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/block_end.gif -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/block_start.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/block_start.gif -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/bold.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/bold.gif -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/bottom.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/bottom.gif -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/box.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/box.png -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/cancel_end.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/cancel_end.png -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/cancel_intermediate.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/cancel_intermediate.png -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/center.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/center.gif -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/classic_end.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/classic_end.gif -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/classic_start.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/classic_start.gif -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/cloud.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/cloud.png -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/collapse.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/collapse.gif -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/connect.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/connect.gif -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/connect.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/connect.png -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/connector.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/connector.gif -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/copy.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/copy.gif -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/cube_green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/cube_green.png -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/cut.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/cut.gif -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/cylinder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/cylinder.png -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/delete.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/delete.gif -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/diagram.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/diagram.gif -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/diamond_end.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/diamond_end.gif -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/diamond_start.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/diamond_start.gif -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/doubleellipse.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/doubleellipse.png -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/down.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/down.gif -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/dude3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/dude3.png -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/earth.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/earth.png -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/ellipse.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/ellipse.png -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/entity.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/entity.gif -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/entity.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/entity.png -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/error.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/error.png -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/event.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/event.png -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/event_end.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/event_end.png -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/event_intermediate.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/event_intermediate.png -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/expand.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/expand.gif -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/fillcolor.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/fillcolor.gif -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/fit.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/fit.gif -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/font.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/font.gif -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/fontcolor.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/fontcolor.gif -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/fork.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/fork.png -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/gear.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/gear.png -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/group.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/group.gif -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/hexagon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/hexagon.png -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/hline.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/hline.png -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/house.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/house.gif -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/house.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/house.png -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/image.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/image.gif -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/inclusive.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/inclusive.png -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/italic.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/italic.gif -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/left.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/left.gif -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/linecolor.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/linecolor.gif -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/link.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/link.png -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/maximize.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/maximize.gif -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/merge.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/merge.png -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/message.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/message.png -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/message_end.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/message_end.png -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/message_intermediate.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/message_intermediate.png -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/middle.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/middle.gif -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/minimize.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/minimize.gif -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/multiple.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/multiple.png -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/new.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/new.gif -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/open.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/open.gif -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/open_end.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/open_end.gif -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/open_start.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/open_start.gif -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/outline.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/outline.gif -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/oval_end.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/oval_end.gif -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/oval_start.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/oval_start.gif -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/package.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/package.png -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/pagesetup.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/pagesetup.gif -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/pan.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/pan.gif -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/paste.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/paste.gif -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/plain.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/plain.gif -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/preferences.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/preferences.gif -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/preview.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/preview.gif -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/print.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/print.gif -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/printer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/printer.png -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/rectangle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/rectangle.png -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/redo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/redo.gif -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/resize.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/resize.gif -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/rhombus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/rhombus.png -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/right.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/right.gif -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/rounded.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/rounded.png -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/rule.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/rule.png -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/save.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/save.gif -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/saveas.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/saveas.gif -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/select.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/select.gif -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/server.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/server.png -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/straight.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/straight.gif -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/straight.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/straight.png -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/swimlane.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/swimlane.png -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/terminate.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/terminate.png -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/timer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/timer.png -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/toback.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/toback.gif -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/tofront.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/tofront.gif -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/top.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/top.gif -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/tree.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/tree.gif -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/triangle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/triangle.png -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/undo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/undo.gif -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/ungroup.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/ungroup.gif -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/up.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/up.gif -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/vertical.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/vertical.gif -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/vertical.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/vertical.png -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/workplace.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/workplace.png -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/wrench.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/wrench.png -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/zoom.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/zoom.gif -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/zoomactual.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/zoomactual.gif -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/zoomin.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/zoomin.gif -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/images/zoomout.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/images/zoomout.gif -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/resources/basic-style.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/resources/default-style.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/resources/editor_de.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/src/com/mxgraph/examples/swing/resources/editor_de.properties -------------------------------------------------------------------------------- /fsm-editor/src/com/mxgraph/examples/swing/resources/editor_zh-CN.properties: -------------------------------------------------------------------------------- 1 | shapes=Shapes 2 | images=Images 3 | symbols=Symbols 4 | file=File 5 | new=New 6 | openFile=Open File 7 | save=\u4FDD\u5B58 8 | saveAs=Save As 9 | pageSetup=Page Setup 10 | print=Print 11 | exit=Exit 12 | edit=Edit 13 | undo=Undo 14 | redo=Redo 15 | cut=Cut 16 | copy=Copy 17 | paste=Paste 18 | delete=Delete 19 | selectAll=Select All 20 | selectNone=Select None 21 | warning=Warning 22 | view=View 23 | pageLayout=Page Layout 24 | antialias=Antialias 25 | grid=Grid 26 | rulers=Rulers 27 | zoom=Zoom 28 | custom=Custom 29 | zoomIn=Zoom In 30 | zoomOut=Zoom Out 31 | page=Page 32 | width=Width 33 | actualSize=Actual Size 34 | format=Format 35 | alignment=Alignment 36 | left=Left 37 | center=Center 38 | right=Right 39 | top=Top 40 | middle=Middle 41 | bottom=Bottom 42 | fontcolor=Fontcolor 43 | linecolor=Linecolor 44 | fillcolor=Fillcolor 45 | gradient=Gradient 46 | label=Label 47 | labelFill=Label Fill 48 | labelBorder=Label Border 49 | position=Position 50 | shadow=Shadow 51 | opacity=Opacity 52 | textOpacity=Text opacity 53 | hide=Hide 54 | connector=Connector 55 | line=Line 56 | straight=Straight 57 | horizontal=Horizontal 58 | vertical=Vertical 59 | entityRelation=Entity Relation 60 | arrow=Arrow 61 | plain=Plain 62 | rounded=Rounded 63 | dashed=Dashed 64 | linewidth=Linewidth 65 | linestart=Linestart 66 | open=Open 67 | classic=Classic 68 | block=Block 69 | diamond=Diamond 70 | oval=Oval 71 | none=None 72 | size=Size 73 | lineend=Lineend 74 | spacing=Spacing 75 | sourceSpacing=Source spacing 76 | targetSpacing=target spacing 77 | perimeter=Perimeter 78 | global=Global 79 | direction=Direction 80 | north=North 81 | east=East 82 | south=South 83 | west=West 84 | rotateLabel=Rotate Label 85 | rotation=Rotation 86 | image=Image 87 | style=Style 88 | shape=Shape 89 | home=Home 90 | enterGroup=Enter group 91 | exitGroup=Exit group 92 | group=Group 93 | ungroup=Ungroup 94 | removeFromGroup=Remove from group 95 | collapse=Collapse 96 | expand=Expand 97 | toBack=To Back 98 | toFront=To Front 99 | align=Align 100 | autosize=Autosize 101 | diagram=Diagram 102 | outline=Outline 103 | background=Background 104 | backgroundColor=Background Color 105 | backgroundImage=Background Image 106 | pageBackground=Page background 107 | layout=Layout 108 | verticalHierarchical=Vertical Hierarchical 109 | horizontalHierarchical=Horizontal Hierarchical 110 | verticalPartition=Vertical Partition 111 | horizontalPartition=Horizontal Partition 112 | verticalStack=Vertical Stack 113 | horizontalStack=Horizontal Stack 114 | verticalTree=Vertical Tree 115 | horizontalTree=Horizontal Tree 116 | parallelEdges=Parallel Edges 117 | placeEdgeLabels=Edge Labels 118 | organicLayout=Organic 119 | circleLayout=Circle 120 | selection=Selection 121 | selectPath=Select Path 122 | selectDirectedPath=Select Directed Path 123 | selectTree=Select Tree 124 | selectDirectedTree=Select Directed Tree 125 | stylesheet=Stylesheet 126 | basicStyle=Basic Style 127 | defaultStyle=Default Style 128 | options=Options 129 | display=Display 130 | buffering=Buffering 131 | dirty=Dirty 132 | centerPage=Center Page 133 | centerZoom=Center Zoom 134 | zoomToSelection=Zoom to Selection 135 | preferPageSize=Prefer Pagesize 136 | pageBreaks=Page Breaks 137 | tolerance=Tolerance 138 | gridSize=Grid Size 139 | gridColor=Grid Color 140 | dot=Dot 141 | line=Line 142 | cross=Cross 143 | dragAndDrop=Drag and Drop 144 | dragEnabled=Drag Enabled 145 | dropEnabled=Drop Enabled 146 | imagePreview=Image Preview 147 | labels=Labels 148 | htmlLabels=HTML Labels 149 | showLabels=Show Labels 150 | moveEdgeLabels=Move Edge Labels 151 | moveVertexLabels=Move Vertex Labels 152 | handleReturn=Handle Return 153 | connections=Connections 154 | connectable=Connectable 155 | connectableEdges=Connectable Edges 156 | createTarget=Create Target 157 | connectMode=Connect Mode 158 | validation=Validation 159 | allowDanglingEdges=Allow Dangling Edges 160 | cloneInvalidEdges=Clone Invalid Edges 161 | allowLoops=Allow Loops 162 | multigraph=Multigraph 163 | disconnectOnMove=Disconnect on Move 164 | window=Window 165 | help=Help 166 | aboutGraphEditor=About mxGraph Editor 167 | magnifyPage=Magnify Page 168 | selectVertices=Select Vertices 169 | selectEdges=Select Edges 170 | newDiagram=New Diagram 171 | ready=Ready. 172 | scale=Scale 173 | value=Value 174 | file=File 175 | allImages=All Images 176 | overwriteExistingFile=Overwrite existing file? 177 | transparentBackground=Transparent Background? 178 | noImageData=No Image Data 179 | noSourceAndTargetSelected=No source and target selected. 180 | enterWarningMessage=Enter warning message 181 | noCellSelected=No cell selected. 182 | loseChanges=Lose Changes? 183 | noLayout=This layout is not available in the open source- and demo-version. 184 | -------------------------------------------------------------------------------- /fsm-editor/svn.version: -------------------------------------------------------------------------------- 1 | git master hash: 98f5d94 -------------------------------------------------------------------------------- /jgraphx/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | jgraphx 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.jdt.core.javanature 16 | 17 | 18 | -------------------------------------------------------------------------------- /jgraphx/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2001-2009, JGraph Ltd 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without modification, 5 | are permitted provided that the following conditions are met: 6 | 7 | Redistributions of source code must retain the above copyright notice, this list 8 | of conditions and the following disclaimer. 9 | Redistributions in binary form must reproduce the above copyright notice, this 10 | list of conditions and the following disclaimer in the documentation and/or 11 | other materials provided with the distribution. 12 | Neither the name of JGraph Ltd nor the names of its contributors may be used 13 | to endorse or promote products derived from this software without specific prior written permission. 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 18 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 20 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 21 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 22 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 23 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | -------------------------------------------------------------------------------- /jgraphx/build.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /jgraphx/src/com/mxgraph/analysis/mxConstantCostFunction.java: -------------------------------------------------------------------------------- 1 | /** 2 | * $Id: mxConstantCostFunction.java,v 1.1 2009/10/16 14:35:58 david Exp $ 3 | * Copyright (c) 2007, Gaudenz Alder 4 | */ 5 | package com.mxgraph.analysis; 6 | 7 | import com.mxgraph.analysis.mxICostFunction; 8 | import com.mxgraph.view.mxCellState; 9 | 10 | /** 11 | * Implements a cost function for a constant cost per traversed cell. 12 | */ 13 | public class mxConstantCostFunction implements mxICostFunction 14 | { 15 | 16 | /** 17 | * 18 | */ 19 | protected double cost = 0; 20 | 21 | /** 22 | * 23 | * @param cost 24 | */ 25 | public mxConstantCostFunction(double cost) 26 | { 27 | this.cost = cost; 28 | } 29 | 30 | /** 31 | * 32 | */ 33 | public double getCost(mxCellState state) 34 | { 35 | return cost; 36 | } 37 | 38 | } -------------------------------------------------------------------------------- /jgraphx/src/com/mxgraph/analysis/mxDistanceCostFunction.java: -------------------------------------------------------------------------------- 1 | /** 2 | * $Id: mxDistanceCostFunction.java,v 1.1 2009/10/16 14:35:58 david Exp $ 3 | * Copyright (c) 2007-2009, JGraph Ltd 4 | */ 5 | package com.mxgraph.analysis; 6 | 7 | import com.mxgraph.util.mxPoint; 8 | import com.mxgraph.view.mxCellState; 9 | 10 | /** 11 | * Implements a cost function for the Euclidean length of an edge. 12 | */ 13 | public class mxDistanceCostFunction implements mxICostFunction 14 | { 15 | 16 | /** 17 | * Returns the Euclidean length of the edge defined by the absolute 18 | * points in the given state or 0 if no points are defined. 19 | */ 20 | public double getCost(mxCellState state) 21 | { 22 | double cost = 0; 23 | int pointCount = state.getAbsolutePointCount(); 24 | 25 | if (pointCount > 0) 26 | { 27 | mxPoint last = state.getAbsolutePoint(0); 28 | 29 | for (int i = 1; i < pointCount; i++) 30 | { 31 | mxPoint point = state.getAbsolutePoint(i); 32 | cost += point.getPoint().distance(last.getPoint()); 33 | last = point; 34 | } 35 | } 36 | 37 | return cost; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /jgraphx/src/com/mxgraph/analysis/mxICostFunction.java: -------------------------------------------------------------------------------- 1 | /** 2 | * $Id: mxICostFunction.java,v 1.1 2009/10/16 14:35:58 david Exp $ 3 | * Copyright (c) 2007, Gaudenz Alder 4 | */ 5 | package com.mxgraph.analysis; 6 | 7 | import com.mxgraph.view.mxCellState; 8 | 9 | /** 10 | * The cost function takes a cell and returns it's cost as a double. Two typical 11 | * examples of cost functions are the euclidian length of edges or a constant 12 | * number for each edge. To use one of the built-in cost functions, use either 13 | * new mxDistanceCostFunction(graph) or 14 | * new mxConstantCostFunction(1). 15 | */ 16 | public interface mxICostFunction 17 | { 18 | 19 | /** 20 | * Evaluates the cost of the given cell state. 21 | * 22 | * @param state The cell state to be evaluated 23 | * @return Returns the cost to traverse the given cell state. 24 | */ 25 | double getCost(mxCellState state); 26 | 27 | } 28 | -------------------------------------------------------------------------------- /jgraphx/src/com/mxgraph/analysis/mxUnionFind.java: -------------------------------------------------------------------------------- 1 | /** 2 | * $Id: mxUnionFind.java,v 1.2 2009/11/24 12:00:28 gaudenz Exp $ 3 | * Copyright (c) 2007, Gaudenz Alder 4 | */ 5 | package com.mxgraph.analysis; 6 | 7 | import java.util.Hashtable; 8 | import java.util.Map; 9 | 10 | /** 11 | * Implements a union find structure that uses union by rank and path 12 | * compression. The union by rank guarantees worst case find time of O(log N), 13 | * while Tarjan shows that in combination with path compression (halving) the 14 | * average time for an arbitrary sequence of m >= n operations is 15 | * O(m*alpha(m,n)), where alpha is the inverse of the Ackermann function, 16 | * defined as follows: 17 | * alpha(m,n) = min{i >= 1 | A(i, floor(m/n)) > log n} for m >= n >= 1 18 | * Which yields almost constant time for each individual operation. 19 | */ 20 | public class mxUnionFind 21 | { 22 | 23 | /** 24 | * Maps from elements to nodes 25 | */ 26 | protected Map nodes = new Hashtable(); 27 | 28 | /** 29 | * Constructs a union find structure and initializes it with the specified 30 | * elements. 31 | * 32 | * @param elements 33 | */ 34 | public mxUnionFind(Object[] elements) 35 | { 36 | for (int i = 0; i < elements.length; i++) 37 | { 38 | nodes.put(elements[i], new Node()); 39 | } 40 | } 41 | 42 | /** 43 | * Returns the node that represents element. 44 | */ 45 | public Node getNode(Object element) 46 | { 47 | return nodes.get(element); 48 | } 49 | 50 | /** 51 | * Returns the set that contains node. This implementation 52 | * provides path compression by halving. 53 | */ 54 | public Node find(Node node) 55 | { 56 | while (node.getParent().getParent() != node.getParent()) 57 | { 58 | Node t = node.getParent().getParent(); 59 | node.setParent(t); 60 | node = t; 61 | } 62 | 63 | return node.getParent(); 64 | } 65 | 66 | /** 67 | * Unifies the sets a and b in constant time 68 | * using a union by rank on the tree size. 69 | */ 70 | public void union(Node a, Node b) 71 | { 72 | Node set1 = find(a); 73 | Node set2 = find(b); 74 | 75 | if (set1 != set2) 76 | { 77 | // Limits the worst case runtime of a find to O(log N) 78 | if (set1.getSize() < set2.getSize()) 79 | { 80 | set2.setParent(set1); 81 | set1.setSize(set1.getSize() + set2.getSize()); 82 | } 83 | else 84 | { 85 | set1.setParent(set2); 86 | set2.setSize(set1.getSize() + set2.getSize()); 87 | } 88 | } 89 | } 90 | 91 | /** 92 | * Returns true if element a and element b are not in the same set. This 93 | * uses getNode and then find to determine the elements set. 94 | * 95 | * @param a The first element to compare. 96 | * @param b The second element to compare. 97 | * @return Returns true if a and b are in the same set. 98 | * 99 | * @see #getNode(Object) 100 | */ 101 | public boolean differ(Object a, Object b) 102 | { 103 | Node set1 = find(getNode(a)); 104 | Node set2 = find(getNode(b)); 105 | 106 | return set1 != set2; 107 | } 108 | 109 | /** 110 | * A class that defines the identity of a set. 111 | */ 112 | public class Node 113 | { 114 | 115 | /** 116 | * Reference to the parent node. Root nodes point to themselves. 117 | */ 118 | protected Node parent = this; 119 | 120 | /** 121 | * The size of the tree. Initial value is 1. 122 | */ 123 | protected int size = 1; 124 | 125 | /** 126 | * @return Returns the parent node 127 | */ 128 | public Node getParent() 129 | { 130 | return parent; 131 | } 132 | 133 | /** 134 | * @param parent The parent node to set. 135 | */ 136 | public void setParent(Node parent) 137 | { 138 | this.parent = parent; 139 | } 140 | 141 | /** 142 | * @return Returns the size. 143 | */ 144 | public int getSize() 145 | { 146 | return size; 147 | } 148 | 149 | /** 150 | * @param size The size to set. 151 | */ 152 | public void setSize(int size) 153 | { 154 | this.size = size; 155 | } 156 | } 157 | } -------------------------------------------------------------------------------- /jgraphx/src/com/mxgraph/analysis/package.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | This package provides various algorithms for graph analysis, such as 4 | shortest path and minimum spanning tree. 5 | 6 | 7 | -------------------------------------------------------------------------------- /jgraphx/src/com/mxgraph/canvas/mxBasicCanvas.java: -------------------------------------------------------------------------------- 1 | package com.mxgraph.canvas; 2 | 3 | import java.awt.Point; 4 | import java.util.Map; 5 | 6 | import com.mxgraph.util.mxConstants; 7 | import com.mxgraph.util.mxUtils; 8 | 9 | public abstract class mxBasicCanvas implements mxICanvas 10 | { 11 | 12 | /** 13 | * Defines the default value for the imageBasePath in all GDI canvases. 14 | * Default is an empty string. 15 | */ 16 | public static String DEFAULT_IMAGEBASEPATH = ""; 17 | 18 | /** 19 | * Defines the base path for images with relative paths. Trailing slash 20 | * is required. Default value is DEFAULT_IMAGEBASEPATH. 21 | */ 22 | protected String imageBasePath = DEFAULT_IMAGEBASEPATH; 23 | 24 | /** 25 | * Specifies the current translation. Default is (0,0). 26 | */ 27 | protected Point translate = new Point(); 28 | 29 | /** 30 | * Specifies the current scale. Default is 1. 31 | */ 32 | protected double scale = 1; 33 | 34 | /** 35 | * Specifies whether labels should be painted. Default is true. 36 | */ 37 | protected boolean drawLabels = true; 38 | 39 | /** 40 | * 41 | */ 42 | public void setTranslate(int dx, int dy) 43 | { 44 | translate.setLocation(dx, dy); 45 | } 46 | 47 | /** 48 | * 49 | */ 50 | public Point getTranslate() 51 | { 52 | return translate; 53 | } 54 | 55 | /** 56 | * 57 | */ 58 | public void setScale(double scale) 59 | { 60 | this.scale = scale; 61 | } 62 | 63 | /** 64 | * 65 | */ 66 | public double getScale() 67 | { 68 | return scale; 69 | } 70 | 71 | /** 72 | * 73 | */ 74 | public void setDrawLabels(boolean drawLabels) 75 | { 76 | this.drawLabels = drawLabels; 77 | } 78 | 79 | /** 80 | * 81 | */ 82 | public String getImageBasePath() 83 | { 84 | return imageBasePath; 85 | } 86 | 87 | /** 88 | * 89 | */ 90 | public void setImageBasePath(String imageBasePath) 91 | { 92 | this.imageBasePath = imageBasePath; 93 | } 94 | 95 | /** 96 | * 97 | */ 98 | public boolean isDrawLabels() 99 | { 100 | return drawLabels; 101 | } 102 | 103 | /** 104 | * Gets the image path from the given style. If the path is relative (does 105 | * not start with a slash) then it is appended to the imageBasePath. 106 | */ 107 | protected String getImageForStyle(Map style) 108 | { 109 | String filename = mxUtils.getString(style, mxConstants.STYLE_IMAGE); 110 | 111 | if (filename != null && !filename.startsWith("/")) 112 | { 113 | filename = imageBasePath + filename; 114 | } 115 | 116 | return filename; 117 | } 118 | 119 | } 120 | -------------------------------------------------------------------------------- /jgraphx/src/com/mxgraph/canvas/mxICanvas.java: -------------------------------------------------------------------------------- 1 | /** 2 | * $Id: mxICanvas.java,v 1.19 2010/01/13 10:43:46 gaudenz Exp $ 3 | * Copyright (c) 2007, Gaudenz Alder 4 | */ 5 | package com.mxgraph.canvas; 6 | 7 | import java.awt.Point; 8 | import java.util.List; 9 | import java.util.Map; 10 | 11 | import com.mxgraph.util.mxPoint; 12 | 13 | /** 14 | * Defines the requirements for a canvas that paints the vertices and edges of 15 | * a graph. 16 | */ 17 | public interface mxICanvas 18 | { 19 | /** 20 | * Sets the translation for the following drawing requests. 21 | */ 22 | void setTranslate(int x, int y); 23 | 24 | /** 25 | * Returns the current translation. 26 | * 27 | * @return Returns the current translation. 28 | */ 29 | Point getTranslate(); 30 | 31 | /** 32 | * Sets the scale for the following drawing requests. 33 | */ 34 | void setScale(double scale); 35 | 36 | /** 37 | * Returns the scale. 38 | */ 39 | double getScale(); 40 | 41 | /** 42 | * Draws the given vertex. 43 | * 44 | * @param x X-coordinate of the vertex. 45 | * @param y Y-coordinate of the vertex. 46 | * @param width Width of the vertex. 47 | * @param height Height of the vertex. 48 | * @param style Style of the vertex. 49 | * @return Optional object that represents the vertex. 50 | */ 51 | Object drawVertex(int x, int y, int width, int height, 52 | Map style); 53 | 54 | /** 55 | * Draws the given edge. 56 | * 57 | * @param pts List of mxPoints that make up the edge. 58 | * @param style Style of the edge. 59 | * @return Optional object that represents the edge. 60 | */ 61 | Object drawEdge(List pts, Map style); 62 | 63 | /** 64 | * Draws the given label. 65 | * 66 | * @param label String that represents the label. 67 | * @param x X-coordinate of the label. 68 | * @param y Y-coordinate of the label. 69 | * @param width Width of the label. 70 | * @param height Height of the label. 71 | * @param style Style of the label. 72 | * @param isHtml Specifies if the label contains HTML markup. 73 | * @return Optional object that represents the label. 74 | */ 75 | Object drawLabel(String label, int x, int y, int width, int height, 76 | Map style, boolean isHtml); 77 | 78 | } 79 | -------------------------------------------------------------------------------- /jgraphx/src/com/mxgraph/canvas/mxImageCanvas.java: -------------------------------------------------------------------------------- 1 | /** 2 | * $Id: mxImageCanvas.java,v 1.5 2010/01/13 10:43:46 gaudenz Exp $ 3 | * Copyright (c) 2007, Gaudenz Alder 4 | */ 5 | package com.mxgraph.canvas; 6 | 7 | import java.awt.Color; 8 | import java.awt.Graphics2D; 9 | import java.awt.Point; 10 | import java.awt.image.BufferedImage; 11 | import java.util.List; 12 | import java.util.Map; 13 | 14 | import com.mxgraph.util.mxPoint; 15 | import com.mxgraph.util.mxUtils; 16 | 17 | /** 18 | * An implementation of a canvas that uses Graphics2D for painting. To use an 19 | * image canvas for an existing graphics canvas and create an dimage the 20 | * following code is used: 21 | * 22 | * BufferedImage image = mxCellRenderer.createBufferedImage(graph, cells, 1, Color.white, true, null, canvas); 23 | */ 24 | public class mxImageCanvas implements mxICanvas 25 | { 26 | 27 | /** 28 | * 29 | */ 30 | protected mxGraphics2DCanvas canvas; 31 | 32 | /** 33 | * 34 | */ 35 | protected Graphics2D previousGraphics; 36 | 37 | /** 38 | * 39 | */ 40 | protected BufferedImage image; 41 | 42 | /** 43 | * 44 | */ 45 | public mxImageCanvas(mxGraphics2DCanvas canvas, int width, int height, 46 | Color background, boolean antiAlias) 47 | { 48 | this.canvas = canvas; 49 | previousGraphics = canvas.getGraphics(); 50 | image = mxUtils.createBufferedImage(width, height, background); 51 | 52 | if (image != null) 53 | { 54 | Graphics2D g = (Graphics2D) image.createGraphics(); 55 | mxUtils.setAntiAlias(g, antiAlias, true); 56 | canvas.setGraphics(g); 57 | } 58 | } 59 | 60 | /** 61 | * 62 | */ 63 | public mxGraphics2DCanvas getGraphicsCanvas() 64 | { 65 | return canvas; 66 | } 67 | 68 | /** 69 | * 70 | */ 71 | public BufferedImage getImage() 72 | { 73 | return image; 74 | } 75 | 76 | /** 77 | * 78 | */ 79 | public Object drawEdge(List pts, Map style) 80 | { 81 | return canvas.drawEdge(pts, style); 82 | } 83 | 84 | /** 85 | * 86 | */ 87 | public Object drawLabel(String label, int x, int y, int w, int h, 88 | Map style, boolean isHtml) 89 | { 90 | return canvas.drawLabel(label, x, y, w, h, style, isHtml); 91 | } 92 | 93 | /** 94 | * 95 | */ 96 | public Object drawVertex(int x, int y, int w, int h, 97 | Map style) 98 | { 99 | return canvas.drawVertex(x, y, w, h, style); 100 | } 101 | 102 | /** 103 | * 104 | */ 105 | public double getScale() 106 | { 107 | return canvas.getScale(); 108 | } 109 | 110 | /** 111 | * 112 | */ 113 | public Point getTranslate() 114 | { 115 | return canvas.getTranslate(); 116 | } 117 | 118 | /** 119 | * 120 | */ 121 | public void setScale(double scale) 122 | { 123 | canvas.setScale(scale); 124 | } 125 | 126 | /** 127 | * 128 | */ 129 | public void setTranslate(int dx, int dy) 130 | { 131 | canvas.setTranslate(dx, dy); 132 | } 133 | 134 | /** 135 | * 136 | */ 137 | public BufferedImage destroy() 138 | { 139 | BufferedImage tmp = image; 140 | 141 | canvas.getGraphics().dispose(); 142 | canvas.setGraphics(previousGraphics); 143 | 144 | previousGraphics = null; 145 | canvas = null; 146 | image = null; 147 | 148 | return tmp; 149 | } 150 | 151 | } 152 | -------------------------------------------------------------------------------- /jgraphx/src/com/mxgraph/canvas/package.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | This package contains various implementations for painting a graph using 4 | different technologies, such as Graphics2D, HTML, SVG or VML. 5 | 6 | 7 | -------------------------------------------------------------------------------- /jgraphx/src/com/mxgraph/io/mxModelCodec.java: -------------------------------------------------------------------------------- 1 | /** 2 | * $Id: mxModelCodec.java,v 1.5 2009/12/05 14:03:03 gaudenz Exp $ 3 | * Copyright (c) 2006, Gaudenz Alder 4 | */ 5 | package com.mxgraph.io; 6 | 7 | import java.util.Map; 8 | 9 | import org.w3c.dom.Element; 10 | import org.w3c.dom.Node; 11 | 12 | import com.mxgraph.model.mxGraphModel; 13 | import com.mxgraph.model.mxICell; 14 | 15 | /** 16 | * Codec for mxGraphModels. This class is created and registered 17 | * dynamically at load time and used implicitely via mxCodec 18 | * and the mxCodecRegistry. 19 | */ 20 | public class mxModelCodec extends mxObjectCodec 21 | { 22 | 23 | /** 24 | * Constructs a new model codec. 25 | */ 26 | public mxModelCodec() 27 | { 28 | this(new mxGraphModel()); 29 | } 30 | 31 | /** 32 | * Constructs a new model codec for the given template. 33 | */ 34 | public mxModelCodec(Object template) 35 | { 36 | this(template, null, null, null); 37 | } 38 | 39 | /** 40 | * Constructs a new model codec for the given arguments. 41 | */ 42 | public mxModelCodec(Object template, String[] exclude, String[] idrefs, 43 | Map mapping) 44 | { 45 | super(template, exclude, idrefs, mapping); 46 | } 47 | 48 | /** 49 | * Encode the given mxGraphModel by writing a (flat) XML sequence 50 | * of cell nodes as produced by the mxCellCodec. The sequence is 51 | * wrapped-up in a node with the name root. 52 | */ 53 | public Node encode(mxCodec enc, Object obj) 54 | { 55 | Node node = null; 56 | 57 | if (obj instanceof mxGraphModel) 58 | { 59 | mxGraphModel model = (mxGraphModel) obj; 60 | String name = mxCodecRegistry.getName(obj); 61 | 62 | node = enc.document.createElement(name); 63 | Node rootNode = enc.document.createElement("root"); 64 | 65 | enc.encodeCell((mxICell) model.getRoot(), rootNode, true); 66 | node.appendChild(rootNode); 67 | } 68 | 69 | return node; 70 | } 71 | 72 | /** 73 | * Reads the cells into the graph model. All cells are children of the root 74 | * element in the node. 75 | */ 76 | public Node beforeDecode(mxCodec dec, Node node, Object into) 77 | { 78 | if (node instanceof Element) 79 | { 80 | Element elt = (Element) node; 81 | mxGraphModel model = null; 82 | 83 | if (into instanceof mxGraphModel) 84 | { 85 | model = (mxGraphModel) into; 86 | } 87 | else 88 | { 89 | model = new mxGraphModel(); 90 | } 91 | 92 | // Reads the cells into the graph model. All cells 93 | // are children of the root element in the node. 94 | Node root = elt.getElementsByTagName("root").item(0); 95 | mxICell rootCell = null; 96 | 97 | if (root != null) 98 | { 99 | Node tmp = root.getFirstChild(); 100 | 101 | while (tmp != null) 102 | { 103 | mxICell cell = dec.decodeCell(tmp, true); 104 | 105 | if (cell != null && cell.getParent() == null) 106 | { 107 | rootCell = cell; 108 | } 109 | 110 | tmp = tmp.getNextSibling(); 111 | } 112 | 113 | root.getParentNode().removeChild(root); 114 | } 115 | 116 | // Sets the root on the model if one has been decoded 117 | if (rootCell != null) 118 | { 119 | model.setRoot(rootCell); 120 | } 121 | } 122 | 123 | return node; 124 | } 125 | 126 | } 127 | -------------------------------------------------------------------------------- /jgraphx/src/com/mxgraph/io/package.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | This package contains all classes for input/output. 4 | 5 | 6 | -------------------------------------------------------------------------------- /jgraphx/src/com/mxgraph/layout/hierarchical/model/mxGraphHierarchyRank.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2005, David Benson 3 | * 4 | * All rights reserved. 5 | * 6 | * This file is licensed under the JGraph software license, a copy of which 7 | * will have been provided to you in the file LICENSE at the root of your 8 | * installation directory. If you are unable to locate this file please 9 | * contact JGraph sales for another copy. 10 | */ 11 | package com.mxgraph.layout.hierarchical.model; 12 | 13 | import java.util.LinkedHashSet; 14 | 15 | /** 16 | * An abstraction of a rank in the hierarchy layout. Should be ordered, perform 17 | * remove in constant time and contains in constant time 18 | */ 19 | public class mxGraphHierarchyRank extends LinkedHashSet 20 | { 21 | 22 | /** 23 | * 24 | */ 25 | private static final long serialVersionUID = -2781491210687143878L; 26 | } 27 | -------------------------------------------------------------------------------- /jgraphx/src/com/mxgraph/layout/hierarchical/stage/mxHierarchicalLayoutStage.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2005, David Benson 3 | * 4 | * All rights reserved. 5 | * 6 | * This file is licensed under the JGraph software license, a copy of which 7 | * will have been provided to you in the file LICENSE at the root of your 8 | * installation directory. If you are unable to locate this file please 9 | * contact JGraph sales for another copy. 10 | */ 11 | package com.mxgraph.layout.hierarchical.stage; 12 | 13 | /** 14 | * The specific layout interface for hierarchical layouts. It adds a 15 | * run method with a parameter for the hierarchical layout model 16 | * that is shared between the layout stages. 17 | */ 18 | public interface mxHierarchicalLayoutStage 19 | { 20 | 21 | /** 22 | * Takes the graph detail and configuration information within the facade 23 | * and creates the resulting laid out graph within that facade for further 24 | * use. 25 | */ 26 | public void execute(Object parent); 27 | 28 | } 29 | -------------------------------------------------------------------------------- /jgraphx/src/com/mxgraph/layout/mxClusterLayout.java: -------------------------------------------------------------------------------- 1 | package com.mxgraph.layout; 2 | 3 | import java.util.HashSet; 4 | 5 | import com.mxgraph.layout.hierarchical.mxHierarchicalLayout; 6 | import com.mxgraph.model.mxCell; 7 | import com.mxgraph.view.mxGraph; 8 | 9 | public class mxClusterLayout extends mxGraphLayout { 10 | 11 | HashSetinternalClusterID2DoneLayout; // clsters already layed-out 12 | mxIGraphLayout clusterLayout; // layout to apply to each cluster 13 | mxGraph graph; 14 | 15 | public mxClusterLayout(mxIGraphLayout cl,mxGraph g) { 16 | super(g); 17 | clusterLayout=cl; 18 | internalClusterID2DoneLayout=new HashSet(); 19 | graph=g; 20 | } 21 | 22 | public mxClusterLayout(mxGraph g) { 23 | super(g); 24 | graph=g; 25 | clusterLayout=new mxHierarchicalLayout(g); 26 | internalClusterID2DoneLayout=new HashSet(); 27 | } 28 | 29 | public HashSet findAllClustersRootedAt(mxGraph graph,mxCell parent, int depth) { 30 | return findAllClustersRootedAt(graph,parent,new HashSet(),depth); 31 | } 32 | public HashSet findAllClustersRootedAt(mxGraph graph,mxCell parent,HashSet result, int depth) { 33 | if (graph.isSwimlane(parent)) result.add(parent); 34 | if (depth!=0) { 35 | int numChildren=parent.getChildCount(); 36 | for(int i=0;i clusters = findAllClustersRootedAt(graph, root,depth); 53 | for (mxCell cluster:clusters) { 54 | handleLayoutInThisCluster(cluster,clusters,depth); 55 | } 56 | System.out.println("Done cluster layout"); 57 | } 58 | 59 | private void handleLayoutInThisCluster(mxCell cluster, HashSet clusters, int depth) { 60 | String id=cluster.getId(); 61 | //System.out.println("considering cluster: "+cluster.getValue()); 62 | if (!internalClusterID2DoneLayout.contains(id)) { 63 | int numChildren=cluster.getChildCount(); 64 | for(int i=0;i edges = new ArrayList(); 37 | List vertices = new ArrayList(); 38 | int childCount = model.getChildCount(parent); 39 | 40 | for (int i = 0; i < childCount; i++) 41 | { 42 | Object cell = model.getChildAt(parent, i); 43 | mxCellState state = view.getState(cell); 44 | 45 | if (state != null) 46 | { 47 | if (!isVertexIgnored(cell)) 48 | { 49 | vertices.add(state); 50 | } 51 | else if (!isEdgeIgnored(cell)) 52 | { 53 | edges.add(state); 54 | } 55 | } 56 | } 57 | 58 | placeLabels(vertices.toArray(), edges.toArray()); 59 | } 60 | 61 | /** 62 | * 63 | */ 64 | protected void placeLabels(Object[] v, Object[] e) 65 | { 66 | mxIGraphModel model = graph.getModel(); 67 | 68 | // Moves the vertices to build a circle. Makes sure the 69 | // radius is large enough for the vertices to not 70 | // overlap 71 | model.beginUpdate(); 72 | try 73 | { 74 | for (int i = 0; i < e.length; i++) 75 | { 76 | mxCellState edge = (mxCellState) e[i]; 77 | 78 | if (edge != null && edge.getLabelBounds() != null) 79 | { 80 | for (int j = 0; j < v.length; j++) 81 | { 82 | mxCellState vertex = (mxCellState) v[j]; 83 | 84 | if (vertex != null) 85 | { 86 | avoid(edge, vertex); 87 | } 88 | } 89 | } 90 | } 91 | } 92 | finally 93 | { 94 | model.endUpdate(); 95 | } 96 | } 97 | 98 | /** 99 | * 100 | */ 101 | protected void avoid(mxCellState edge, mxCellState vertex) 102 | { 103 | mxIGraphModel model = graph.getModel(); 104 | Rectangle labRect = edge.getLabelBounds().getRectangle(); 105 | Rectangle vRect = vertex.getRectangle(); 106 | 107 | if (labRect.intersects(vRect)) 108 | { 109 | int dy1 = -labRect.y - labRect.height + vRect.y; 110 | int dy2 = -labRect.y + vRect.y + vRect.height; 111 | 112 | int dy = (Math.abs(dy1) < Math.abs(dy2)) ? dy1 : dy2; 113 | 114 | int dx1 = -labRect.x - labRect.width + vRect.x; 115 | int dx2 = -labRect.x + vRect.x + vRect.width; 116 | 117 | int dx = (Math.abs(dx1) < Math.abs(dx2)) ? dx1 : dx2; 118 | 119 | if (Math.abs(dx) < Math.abs(dy)) 120 | { 121 | dy = 0; 122 | } 123 | else 124 | { 125 | dx = 0; 126 | } 127 | 128 | mxGeometry g = model.getGeometry(edge.getCell()); 129 | 130 | if (g != null) 131 | { 132 | g = (mxGeometry) g.clone(); 133 | 134 | if (g.getOffset() != null) 135 | { 136 | g.getOffset().setX(g.getOffset().getX() + dx); 137 | g.getOffset().setY(g.getOffset().getY() + dy); 138 | } 139 | else 140 | { 141 | g.setOffset(new mxPoint(dx, dy)); 142 | } 143 | 144 | model.setGeometry(edge.getCell(), g); 145 | } 146 | } 147 | } 148 | 149 | } 150 | -------------------------------------------------------------------------------- /jgraphx/src/com/mxgraph/layout/mxIGraphLayout.java: -------------------------------------------------------------------------------- 1 | /** 2 | * $Id: mxIGraphLayout.java,v 1.6 2009/02/21 13:39:16 gaudenz Exp $ 3 | * Copyright (c) 2007, Gaudenz Alder 4 | */ 5 | package com.mxgraph.layout; 6 | 7 | /** 8 | * Defines the requirements for an object that implements a graph layout. 9 | */ 10 | public interface mxIGraphLayout 11 | { 12 | 13 | /** 14 | * Executes the layout for the children of the specified parent. 15 | * 16 | * @param parent Parent cell that contains the children to be layed out. 17 | */ 18 | void execute(Object parent); 19 | 20 | /** 21 | * Notified when a cell is being moved in a parent that has automatic 22 | * layout to update the cell state (eg. index) so that the outcome of the 23 | * layout will position the vertex as close to the point (x, y) as 24 | * possible. 25 | * 26 | * @param cell Cell which is being moved. 27 | * @param x X-coordinate of the new cell location. 28 | * @param y Y-coordinate of the new cell location. 29 | */ 30 | void moveCell(Object cell, double x, double y); 31 | 32 | } 33 | -------------------------------------------------------------------------------- /jgraphx/src/com/mxgraph/layout/orthogonal/model/mxOrthogonalModel.java: -------------------------------------------------------------------------------- 1 | /** 2 | * $Id: mxOrthogonalModel.java,v 1.1 2009/11/25 12:36:37 david Exp $ 3 | * Copyright (c) 2008-2009, JGraph Ltd 4 | */ 5 | package com.mxgraph.layout.orthogonal.model; 6 | 7 | import com.mxgraph.view.mxGraph; 8 | 9 | /** 10 | * A custom graph model 11 | */ 12 | public class mxOrthogonalModel 13 | { 14 | public mxOrthogonalModel(mxGraph graph) 15 | { 16 | // 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /jgraphx/src/com/mxgraph/layout/orthogonal/model/mxPointPair.java: -------------------------------------------------------------------------------- 1 | /** 2 | * $Id: mxPointPair.java,v 1.1 2008/10/02 12:49:11 gaudenz Exp $ 3 | * Copyright (c) 2008, Gaudenz Alder 4 | */ 5 | package com.mxgraph.layout.orthogonal.model; 6 | 7 | /** 8 | * 9 | */ 10 | public class mxPointPair 11 | { 12 | 13 | } 14 | -------------------------------------------------------------------------------- /jgraphx/src/com/mxgraph/layout/orthogonal/model/mxPointSequence.java: -------------------------------------------------------------------------------- 1 | /** 2 | * $Id: mxPointSequence.java,v 1.1 2008/10/02 12:49:11 gaudenz Exp $ 3 | * Copyright (c) 2008, Gaudenz Alder 4 | */ 5 | package com.mxgraph.layout.orthogonal.model; 6 | 7 | /** 8 | * 9 | */ 10 | public class mxPointSequence 11 | { 12 | 13 | } 14 | -------------------------------------------------------------------------------- /jgraphx/src/com/mxgraph/layout/orthogonal/model/mxSegment.java: -------------------------------------------------------------------------------- 1 | /** 2 | * $Id: mxSegment.java,v 1.1 2008/10/02 12:49:11 gaudenz Exp $ 3 | * Copyright (c) 2008, Gaudenz Alder 4 | */ 5 | package com.mxgraph.layout.orthogonal.model; 6 | 7 | /** 8 | * 9 | */ 10 | public class mxSegment 11 | { 12 | 13 | } 14 | -------------------------------------------------------------------------------- /jgraphx/src/com/mxgraph/layout/orthogonal/mxOrthogonalLayout.java: -------------------------------------------------------------------------------- 1 | /** 2 | * $Id: mxOrthogonalLayout.java,v 1.2 2009/11/25 12:37:20 david Exp $ 3 | * Copyright (c) 2008-2009, JGraph Ltd 4 | */ 5 | package com.mxgraph.layout.orthogonal; 6 | 7 | import com.mxgraph.layout.mxGraphLayout; 8 | import com.mxgraph.layout.orthogonal.model.mxOrthogonalModel; 9 | import com.mxgraph.view.mxGraph; 10 | 11 | /** 12 | * 13 | */ 14 | /** 15 | * 16 | */ 17 | public class mxOrthogonalLayout extends mxGraphLayout 18 | { 19 | 20 | /** 21 | * 22 | */ 23 | protected mxOrthogonalModel orthModel; 24 | 25 | /** 26 | * Whether or not to route the edges along grid lines only, if the grid 27 | * is enabled. Default is false 28 | */ 29 | protected boolean routeToGrid = false; 30 | 31 | /** 32 | * 33 | */ 34 | public mxOrthogonalLayout(mxGraph graph) 35 | { 36 | super(graph); 37 | orthModel = new mxOrthogonalModel(graph); 38 | } 39 | 40 | /** 41 | * 42 | */ 43 | public void execute(Object parent) 44 | { 45 | // Create the rectangulation 46 | 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /jgraphx/src/com/mxgraph/layout/package.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | This package contains various graph layouts. 4 | 5 | 6 | -------------------------------------------------------------------------------- /jgraphx/src/com/mxgraph/model/mxCellPath.java: -------------------------------------------------------------------------------- 1 | /** 2 | * $Id: mxCellPath.java,v 1.6 2009/11/17 14:36:09 gaudenz Exp $ 3 | * Copyright (c) 2007, Gaudenz Alder 4 | */ 5 | package com.mxgraph.model; 6 | 7 | import java.util.StringTokenizer; 8 | import java.util.regex.Pattern; 9 | 10 | /** 11 | * Implements a mechanism for temporary cell Ids. 12 | */ 13 | public class mxCellPath 14 | { 15 | 16 | /** 17 | * Defines the separator between the path components. Default is 18 | * .. 19 | */ 20 | public static String PATH_SEPARATOR = "."; 21 | 22 | /** 23 | * Creates the cell path for the given cell. The cell path is a 24 | * concatenation of the indices of all cells on the (finite) path to 25 | * the root, eg. "0.0.0.1". 26 | * 27 | * @param cell Cell whose path should be returned. 28 | * @return Returns the string that represents the path. 29 | */ 30 | public static String create(mxICell cell) 31 | { 32 | String result = ""; 33 | 34 | if (cell != null) 35 | { 36 | mxICell parent = cell.getParent(); 37 | 38 | while (parent != null) 39 | { 40 | int index = parent.getIndex(cell); 41 | result = index + mxCellPath.PATH_SEPARATOR + result; 42 | 43 | cell = parent; 44 | parent = cell.getParent(); 45 | } 46 | } 47 | 48 | return (result.length() > 1) ? result.substring(0, result.length() - 1) 49 | : ""; 50 | } 51 | 52 | /** 53 | * Returns the path for the parent of the cell represented by the given 54 | * path. Returns null if the given path has no parent. 55 | * 56 | * @param path Path whose parent path should be returned. 57 | */ 58 | public static String getParentPath(String path) 59 | { 60 | if (path != null) 61 | { 62 | int index = path.lastIndexOf(mxCellPath.PATH_SEPARATOR); 63 | 64 | if (index >= 0) 65 | { 66 | return path.substring(0, index); 67 | } 68 | else if (path.length() > 0) 69 | { 70 | return ""; 71 | } 72 | } 73 | 74 | return null; 75 | } 76 | 77 | /** 78 | * Returns the cell for the specified cell path using the given root as the 79 | * root of the path. 80 | * 81 | * @param root Root cell of the path to be resolved. 82 | * @param path String that defines the path. 83 | * @return Returns the cell that is defined by the path. 84 | */ 85 | public static mxICell resolve(mxICell root, String path) 86 | { 87 | mxICell parent = root; 88 | String[] tokens = path.split(Pattern.quote(PATH_SEPARATOR)); 89 | 90 | for (int i = 0; i < tokens.length; i++) 91 | { 92 | parent = parent.getChildAt(Integer.parseInt(tokens[i])); 93 | } 94 | 95 | return parent; 96 | } 97 | 98 | /** 99 | * Compares the given cell paths and returns -1 if cp1 is smaller, 0 if 100 | * cp1 is equal and 1 if cp1 is greater than cp2. 101 | */ 102 | public static int compare(String cp1, String cp2) 103 | { 104 | StringTokenizer p1 = new StringTokenizer(cp1, mxCellPath.PATH_SEPARATOR); 105 | StringTokenizer p2 = new StringTokenizer(cp2, mxCellPath.PATH_SEPARATOR); 106 | int comp = 0; 107 | 108 | while (p1.hasMoreTokens() && 109 | p2.hasMoreTokens()) 110 | { 111 | String t1 = p1.nextToken(); 112 | String t2 = p2.nextToken(); 113 | 114 | if (!t1.equals(t2)) 115 | { 116 | if (t1.length() == 0 || 117 | t2.length() == 0) 118 | { 119 | comp = t1.compareTo(t2); 120 | } 121 | else 122 | { 123 | comp = Integer.valueOf(t1).compareTo(Integer.valueOf(t2)); 124 | } 125 | 126 | break; 127 | } 128 | } 129 | 130 | // Compares path length if both paths are equal to this point 131 | if (comp == 0) 132 | { 133 | int t1 = p1.countTokens(); 134 | int t2 = p2.countTokens(); 135 | 136 | if (t1 != t2) 137 | { 138 | comp = (t1 > t2) ? 1 : -1; 139 | } 140 | } 141 | 142 | return comp; 143 | } 144 | 145 | } 146 | -------------------------------------------------------------------------------- /jgraphx/src/com/mxgraph/model/package.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | This package contains the classes that define a graph model. 4 | 5 | 6 | -------------------------------------------------------------------------------- /jgraphx/src/com/mxgraph/reader/package.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | This package contains the classes required to turn an encoded mxGraphView 4 | into an image using SAX and without having to create a graph model. 5 | 6 | 7 | -------------------------------------------------------------------------------- /jgraphx/src/com/mxgraph/resources/graph.properties: -------------------------------------------------------------------------------- 1 | alreadyConnected=Nodes already connected 2 | containsValidationErrors=Contains validation errors 3 | collapse-expand=Collapse/Expand 4 | doubleClickOrientation=Doubleclick to change orientation 5 | -------------------------------------------------------------------------------- /jgraphx/src/com/mxgraph/resources/graph_de.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/jgraphx/src/com/mxgraph/resources/graph_de.properties -------------------------------------------------------------------------------- /jgraphx/src/com/mxgraph/sharing/mxSharedDiagram.java: -------------------------------------------------------------------------------- 1 | package com.mxgraph.sharing; 2 | 3 | import java.util.ArrayList; 4 | import java.util.Iterator; 5 | import java.util.List; 6 | 7 | /** 8 | * Implements a diagram that may be shared among multiple sessions. 9 | */ 10 | public class mxSharedDiagram 11 | { 12 | 13 | /** 14 | * Defines the requirements for an object that listens to changes on the 15 | * shared diagram. 16 | */ 17 | public interface mxDiagramChangeListener 18 | { 19 | 20 | /** 21 | * Fires when the shared diagram was changed. 22 | * 23 | * @param sender Session where the change was received from. 24 | * @param xml XML string that represents the change. 25 | */ 26 | void diagramChanged(Object sender, String xml); 27 | } 28 | 29 | /** 30 | * Holds a list of diagram change listeners. 31 | */ 32 | protected List diagramChangeListeners; 33 | 34 | /** 35 | * Holds the initial state of the diagram. 36 | */ 37 | protected String initialState; 38 | 39 | /** 40 | * Holds the history of all changes of initial state. 41 | */ 42 | protected StringBuffer history = new StringBuffer(); 43 | 44 | /** 45 | * Constructs a new diagram with the given initial state. 46 | * 47 | * @param initialState Initial state of the diagram. 48 | */ 49 | public mxSharedDiagram(String initialState) 50 | { 51 | this.initialState = initialState; 52 | } 53 | 54 | /** 55 | * Returns the initial state of the diagram. 56 | */ 57 | public String getInitialState() 58 | { 59 | return initialState; 60 | } 61 | 62 | /** 63 | * Clears the history of all changes. 64 | */ 65 | public synchronized void clearHistory() 66 | { 67 | history = new StringBuffer(); 68 | } 69 | 70 | /** 71 | * Returns the history of all changes as a string. 72 | */ 73 | public synchronized String getDelta() 74 | { 75 | return history.toString(); 76 | } 77 | 78 | /** 79 | * Appends the given string to the history and dispatches the change to all 80 | * sessions that are listening to this shared diagram. 81 | * 82 | * @param sender Session where the change originated from. 83 | * @param xml XML string that represents the change. 84 | */ 85 | public void dispatch(Object sender, String xml) 86 | { 87 | synchronized (this) 88 | { 89 | history.append(xml); 90 | } 91 | 92 | dispatchDiagramChangeEvent(sender, xml); 93 | } 94 | 95 | /** 96 | * Adds the given listener to the list of diagram change listeners. 97 | * 98 | * @param listener Diagram change listener to be added. 99 | */ 100 | public void addDiagramChangeListener(mxDiagramChangeListener listener) 101 | { 102 | if (diagramChangeListeners == null) 103 | { 104 | diagramChangeListeners = new ArrayList(); 105 | } 106 | 107 | diagramChangeListeners.add(listener); 108 | } 109 | 110 | /** 111 | * Removes the given listener from the list of diagram change listeners. 112 | * 113 | * @param listener Diagram change listener to be removed. 114 | */ 115 | public void removeDiagramChangeListener(mxDiagramChangeListener listener) 116 | { 117 | if (diagramChangeListeners != null) 118 | { 119 | diagramChangeListeners.remove(listener); 120 | } 121 | } 122 | 123 | /** 124 | * Dispatches the given event information to all diagram change listeners. 125 | * 126 | * @param sender Session where the change was received from. 127 | * @param xml XML string that represents the change. 128 | */ 129 | void dispatchDiagramChangeEvent(Object sender, String xml) 130 | { 131 | if (diagramChangeListeners != null) 132 | { 133 | Iterator it = diagramChangeListeners 134 | .iterator(); 135 | 136 | while (it.hasNext()) 137 | { 138 | mxDiagramChangeListener listener = it.next(); 139 | listener.diagramChanged(sender, xml); 140 | } 141 | } 142 | } 143 | 144 | } 145 | -------------------------------------------------------------------------------- /jgraphx/src/com/mxgraph/sharing/package.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | This package contains all classes required for concurrent diagram editing 4 | by multiple clients. 5 | 6 | 7 | -------------------------------------------------------------------------------- /jgraphx/src/com/mxgraph/swing/handler/mxCellTracker.java: -------------------------------------------------------------------------------- 1 | /** 2 | * $Id: mxCellTracker.java,v 1.2 2009/11/24 12:00:29 gaudenz Exp $ 3 | * Copyright (c) 2008, Gaudenz Alder 4 | */ 5 | package com.mxgraph.swing.handler; 6 | 7 | import java.awt.Color; 8 | import java.awt.event.MouseEvent; 9 | import java.awt.event.MouseListener; 10 | import java.awt.event.MouseMotionListener; 11 | 12 | import com.mxgraph.swing.mxGraphComponent; 13 | 14 | /** 15 | * Event handler that highlights cells. Inherits from mxCellMarker. 16 | */ 17 | public class mxCellTracker extends mxCellMarker implements MouseListener, 18 | MouseMotionListener 19 | { 20 | 21 | /** 22 | * 23 | */ 24 | private static final long serialVersionUID = 7372144804885125688L; 25 | 26 | /** 27 | * Constructs an event handler that highlights cells. 28 | */ 29 | public mxCellTracker(mxGraphComponent graphComponent, Color color) 30 | { 31 | super(graphComponent, color); 32 | 33 | graphComponent.getGraphControl().addMouseListener(this); 34 | graphComponent.getGraphControl().addMouseMotionListener(this); 35 | } 36 | 37 | /** 38 | * 39 | */ 40 | public void destroy() 41 | { 42 | graphComponent.getGraphControl().removeMouseListener(this); 43 | graphComponent.getGraphControl().removeMouseMotionListener(this); 44 | } 45 | 46 | /* 47 | * (non-Javadoc) 48 | * @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent) 49 | */ 50 | public void mouseClicked(MouseEvent e) 51 | { 52 | // empty 53 | } 54 | 55 | /* 56 | * (non-Javadoc) 57 | * @see java.awt.event.MouseListener#mouseEntered(java.awt.event.MouseEvent) 58 | */ 59 | public void mouseEntered(MouseEvent e) 60 | { 61 | // empty 62 | } 63 | 64 | /* 65 | * (non-Javadoc) 66 | * @see java.awt.event.MouseListener#mouseExited(java.awt.event.MouseEvent) 67 | */ 68 | public void mouseExited(MouseEvent e) 69 | { 70 | // empty 71 | } 72 | 73 | /* 74 | * (non-Javadoc) 75 | * @see java.awt.event.MouseListener#mousePressed(java.awt.event.MouseEvent) 76 | */ 77 | public void mousePressed(MouseEvent e) 78 | { 79 | // empty 80 | } 81 | 82 | /* 83 | * (non-Javadoc) 84 | * @see java.awt.event.MouseListener#mouseReleased(java.awt.event.MouseEvent) 85 | */ 86 | public void mouseReleased(MouseEvent e) 87 | { 88 | reset(); 89 | } 90 | 91 | /* 92 | * (non-Javadoc) 93 | * @see java.awt.event.MouseMotionListener#mouseDragged(java.awt.event.MouseEvent) 94 | */ 95 | public void mouseDragged(MouseEvent e) 96 | { 97 | // empty 98 | } 99 | 100 | /* 101 | * (non-Javadoc) 102 | * @see java.awt.event.MouseMotionListener#mouseMoved(java.awt.event.MouseEvent) 103 | */ 104 | public void mouseMoved(MouseEvent e) 105 | { 106 | process(e); 107 | } 108 | 109 | } 110 | -------------------------------------------------------------------------------- /jgraphx/src/com/mxgraph/swing/handler/mxElbowEdgeHandler.java: -------------------------------------------------------------------------------- 1 | /** 2 | * $Id: mxElbowEdgeHandler.java,v 1.10 2010/01/29 09:07:01 gaudenz Exp $ 3 | * Copyright (c) 2008, Gaudenz Alder 4 | */ 5 | package com.mxgraph.swing.handler; 6 | 7 | import java.awt.Point; 8 | import java.awt.Rectangle; 9 | import java.awt.event.MouseEvent; 10 | import java.util.List; 11 | 12 | import com.mxgraph.model.mxGeometry; 13 | import com.mxgraph.swing.mxGraphComponent; 14 | import com.mxgraph.util.mxConstants; 15 | import com.mxgraph.util.mxPoint; 16 | import com.mxgraph.util.mxResources; 17 | import com.mxgraph.view.mxCellState; 18 | import com.mxgraph.view.mxGraphView; 19 | 20 | /** 21 | * @author Administrator 22 | * 23 | */ 24 | public class mxElbowEdgeHandler extends mxEdgeHandler 25 | { 26 | 27 | /** 28 | * 29 | * @param graphComponent 30 | * @param state 31 | */ 32 | public mxElbowEdgeHandler(mxGraphComponent graphComponent, mxCellState state) 33 | { 34 | super(graphComponent, state); 35 | } 36 | 37 | /** 38 | * Hook for subclassers to return tooltip texts for certain points on the 39 | * handle. 40 | */ 41 | public String getToolTipText(MouseEvent e) 42 | { 43 | int index = getIndexAt(e.getX(), e.getY()); 44 | 45 | if (index == 1) 46 | { 47 | return mxResources.get("doubleClickOrientation"); 48 | } 49 | 50 | return null; 51 | } 52 | 53 | /** 54 | * 55 | */ 56 | protected boolean isFlipEvent(MouseEvent e) 57 | { 58 | return e.getClickCount() == 2 && index == 1; 59 | } 60 | 61 | /** 62 | * Returns true if the given index is the index of the last handle. 63 | */ 64 | public boolean isLabel(int index) 65 | { 66 | return index == 3; 67 | } 68 | 69 | /** 70 | * 71 | */ 72 | protected Rectangle[] createHandles() 73 | { 74 | p = createPoints(state); 75 | Rectangle[] h = new Rectangle[4]; 76 | 77 | mxPoint p0 = state.getAbsolutePoint(0); 78 | mxPoint pe = state.getAbsolutePoint(state.getAbsolutePointCount() - 1); 79 | 80 | h[0] = createHandle(p0.getPoint()); 81 | h[2] = createHandle(pe.getPoint()); 82 | 83 | // Creates the middle green edge handle 84 | mxGeometry geometry = graphComponent.getGraph().getModel().getGeometry( 85 | state.getCell()); 86 | List points = geometry.getPoints(); 87 | Point pt = null; 88 | 89 | if (points == null || points.isEmpty()) 90 | { 91 | pt = new Point((int) (Math.round(p0.getX()) + Math 92 | .round((pe.getX() - p0.getX()) / 2)), (int) (Math.round(p0 93 | .getY()) + Math.round((pe.getY() - p0.getY()) / 2))); 94 | } 95 | else 96 | { 97 | mxGraphView view = graphComponent.getGraph().getView(); 98 | pt = view.transformControlPoint(state, (mxPoint) points.get(0)) 99 | .getPoint(); 100 | } 101 | 102 | // Create the green middle handle 103 | h[1] = createHandle(pt); 104 | 105 | // Creates the yellow label handle 106 | h[3] = createHandle(state.getAbsoluteOffset().getPoint(), 107 | mxConstants.LABEL_HANDLE_SIZE); 108 | 109 | // Makes handle slightly bigger if the yellow label handle 110 | // exists and intersects this green handle 111 | if (isHandleVisible(3) && h[1].intersects(h[3])) 112 | { 113 | h[1] = createHandle(pt, mxConstants.HANDLE_SIZE + 3); 114 | } 115 | 116 | return h; 117 | } 118 | 119 | } 120 | -------------------------------------------------------------------------------- /jgraphx/src/com/mxgraph/swing/handler/mxInsertHandler.java: -------------------------------------------------------------------------------- 1 | package com.mxgraph.swing.handler; 2 | 3 | import com.mxgraph.swing.util.mxMouseControl; 4 | 5 | public class mxInsertHandler extends mxMouseControl 6 | { 7 | 8 | /** 9 | * 10 | */ 11 | private static final long serialVersionUID = -4340933811269254910L; 12 | } 13 | -------------------------------------------------------------------------------- /jgraphx/src/com/mxgraph/swing/handler/mxPanningHandler.java: -------------------------------------------------------------------------------- 1 | /** 2 | * $Id: mxPanningHandler.java,v 1.4 2009/11/24 12:00:29 gaudenz Exp $ 3 | * Copyright (c) 2008, Gaudenz Alder 4 | */ 5 | package com.mxgraph.swing.handler; 6 | 7 | import java.awt.Point; 8 | import java.awt.Rectangle; 9 | import java.awt.event.MouseEvent; 10 | 11 | import com.mxgraph.swing.mxGraphComponent; 12 | import com.mxgraph.swing.util.mxMouseControl; 13 | 14 | /** 15 | * 16 | */ 17 | public class mxPanningHandler extends mxMouseControl 18 | { 19 | 20 | /** 21 | * 22 | */ 23 | private static final long serialVersionUID = 7969814728058376339L; 24 | 25 | /** 26 | * 27 | */ 28 | protected mxGraphComponent graphComponent; 29 | 30 | /** 31 | * 32 | */ 33 | protected transient Point start; 34 | 35 | /** 36 | * 37 | * @param graphComponent 38 | */ 39 | public mxPanningHandler(mxGraphComponent graphComponent) 40 | { 41 | this.graphComponent = graphComponent; 42 | 43 | graphComponent.getGraphControl().add(this); 44 | graphComponent.getGraphControl().addMouseListener(this); 45 | graphComponent.getGraphControl().addMouseMotionListener(this); 46 | } 47 | 48 | /** 49 | * 50 | */ 51 | public void mousePressed(MouseEvent e) 52 | { 53 | if (isEnabled() && !e.isConsumed() && graphComponent.isPanningEvent(e) 54 | && !e.isPopupTrigger()) 55 | { 56 | start = e.getPoint(); 57 | } 58 | } 59 | 60 | /** 61 | * 62 | */ 63 | public void mouseDragged(MouseEvent e) 64 | { 65 | if (!e.isConsumed() && start != null) 66 | { 67 | int dx = e.getX() - start.x; 68 | int dy = e.getY() - start.y; 69 | 70 | Rectangle r = graphComponent.getViewport().getViewRect(); 71 | 72 | int right = r.x + ((dx > 0) ? 0 : r.width) - dx; 73 | int bottom = r.y + ((dy > 0) ? 0 : r.height) - dy; 74 | 75 | graphComponent.getGraphControl().scrollRectToVisible( 76 | new Rectangle(right, bottom, 1, 1)); 77 | 78 | e.consume(); 79 | } 80 | } 81 | 82 | /** 83 | * 84 | */ 85 | public void mouseReleased(MouseEvent e) 86 | { 87 | if (!e.isConsumed() && start != null) 88 | { 89 | int dx = Math.abs(start.x - e.getX()); 90 | int dy = Math.abs(start.y - e.getY()); 91 | 92 | if (graphComponent.isSignificant(dx, dy)) 93 | { 94 | e.consume(); 95 | } 96 | } 97 | 98 | start = null; 99 | } 100 | 101 | } 102 | -------------------------------------------------------------------------------- /jgraphx/src/com/mxgraph/swing/handler/mxRotationHandler.java: -------------------------------------------------------------------------------- 1 | package com.mxgraph.swing.handler; 2 | 3 | import com.mxgraph.swing.mxGraphComponent; 4 | import com.mxgraph.view.mxCellState; 5 | 6 | /** 7 | * Placeholder for rotation handler 8 | */ 9 | public class mxRotationHandler extends mxCellHandler 10 | { 11 | public mxRotationHandler(mxGraphComponent graphComponent, mxCellState state) { 12 | super(graphComponent, state); 13 | // TODO Auto-generated constructor stub 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /jgraphx/src/com/mxgraph/swing/handler/package.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | This package contains all classes required for mouse event handling in 4 | JFC/Swing. The classes implement rubberband selection, mouse tracking, 5 | creating connections, handling vertices and edges, moving cells, panning 6 | and keystroke handling. 7 | 8 | 9 | -------------------------------------------------------------------------------- /jgraphx/src/com/mxgraph/swing/images/collapsed.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/jgraphx/src/com/mxgraph/swing/images/collapsed.gif -------------------------------------------------------------------------------- /jgraphx/src/com/mxgraph/swing/images/expanded.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/jgraphx/src/com/mxgraph/swing/images/expanded.gif -------------------------------------------------------------------------------- /jgraphx/src/com/mxgraph/swing/images/warning.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/jgraphx/src/com/mxgraph/swing/images/warning.gif -------------------------------------------------------------------------------- /jgraphx/src/com/mxgraph/swing/package.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | This package contains the main component for JFC/Swing, namely the graph 4 | component and the outline component. 5 | 6 | 7 | -------------------------------------------------------------------------------- /jgraphx/src/com/mxgraph/swing/util/CellSelector.java: -------------------------------------------------------------------------------- 1 | package com.mxgraph.swing.util; 2 | 3 | import java.util.HashMap; 4 | import java.util.List; 5 | import java.util.Map.Entry; 6 | 7 | import com.mxgraph.model.mxCell; 8 | import com.mxgraph.model.mxGraphModel.mxStyleChange; 9 | import com.mxgraph.model.mxIGraphModel; 10 | import com.mxgraph.swing.mxGraphComponent; 11 | import com.mxgraph.swing.handler.mxCellMarker; 12 | import com.mxgraph.util.mxEvent; 13 | import com.mxgraph.util.mxEventObject; 14 | import com.mxgraph.util.mxEventSource.mxIEventListener; 15 | import com.mxgraph.view.mxCellState; 16 | import com.mxgraph.view.mxGraph; 17 | import com.mxgraph.view.mxGraphView; 18 | 19 | public class CellSelector { 20 | protected HashMap currentSelectedCells=new HashMap(); 21 | protected mxGraphComponent gc; 22 | private mxGraph graph; 23 | private mxGraphView view; 24 | private mxIGraphModel model; 25 | private boolean withScroll; 26 | private boolean selectSetAsValid=true; 27 | 28 | public CellSelector(final mxGraphComponent gc,final boolean withScroll) { 29 | this.gc=gc; 30 | this.graph=gc.getGraph(); 31 | this.view=graph.getView(); 32 | this.model=graph.getModel(); 33 | this.withScroll=withScroll; 34 | mxIEventListener updateListener=new mxIEventListener() { 35 | @Override 36 | public void invoke(Object sender, mxEventObject evt) { 37 | //System.out.println("Updating marker because of event: "+evt.getName()+" change: "+evt.getProperties()); 38 | 39 | Object changes=evt.getProperty("changes"); 40 | if (changes!=null && changes instanceof List) { 41 | for(Object change:((List)changes)) { 42 | if (change !=null && change instanceof mxStyleChange) { 43 | Object cell=((mxStyleChange)change).getCell(); 44 | mxCellState state = view.getState(cell, false); 45 | if (currentSelectedCells.containsKey(cell)) { 46 | mxCellMarker thisCellSelector = currentSelectedCells.get(cell); 47 | thisCellSelector.unmark(); 48 | thisCellSelector.process(state, thisCellSelector.getMarkerColor(null, state, selectSetAsValid), selectSetAsValid); 49 | thisCellSelector.mark(); 50 | } 51 | } 52 | } 53 | } 54 | for(Entry el:currentSelectedCells.entrySet()) { 55 | el.getValue().unmark(); 56 | el.getValue().mark(); 57 | } 58 | } 59 | }; 60 | 61 | view.addListener(mxEvent.SCALE_AND_TRANSLATE, updateListener); 62 | view.addListener(mxEvent.SCALE, updateListener); 63 | view.addListener(mxEvent.TRANSLATE, updateListener); 64 | model.addListener(mxEvent.CHANGE, updateListener); 65 | } 66 | 67 | public CellSelector(mxGraphComponent gc) { 68 | this(gc,true); 69 | } 70 | 71 | public void selectCell(mxCell c) { 72 | if (c!=null) { 73 | mxCellMarker thisCellSelector=currentSelectedCells.get(c); 74 | mxCellState state=view.getState(c); 75 | if (thisCellSelector==null) { 76 | thisCellSelector=new mxCellMarker(gc); 77 | currentSelectedCells.put(c,thisCellSelector); 78 | thisCellSelector.process(state, thisCellSelector.getMarkerColor(null, state, selectSetAsValid), selectSetAsValid); 79 | thisCellSelector.mark(); 80 | if (withScroll) gc.scrollCellToVisible(c, true); 81 | } else { 82 | thisCellSelector.process(state, thisCellSelector.getMarkerColor(null, state, selectSetAsValid), selectSetAsValid); 83 | thisCellSelector.mark(); 84 | } 85 | } 86 | } 87 | public void unselectCell(mxCell c) { 88 | mxCellMarker thisCellSelector=currentSelectedCells.get(c); 89 | if (thisCellSelector!=null) { 90 | thisCellSelector.unmark(); 91 | currentSelectedCells.remove(c); 92 | } 93 | } 94 | public void toggleSelection(mxCell c) { 95 | if ((c!=null) && (!currentSelectedCells.containsKey(c))) selectCell(c); 96 | else unselectCell(c); 97 | } 98 | 99 | public void unselectAll() { 100 | for(Entry el:currentSelectedCells.entrySet()) { 101 | el.getValue().unmark(); 102 | } 103 | currentSelectedCells.clear(); 104 | } 105 | } 106 | -------------------------------------------------------------------------------- /jgraphx/src/com/mxgraph/swing/util/mxCellOverlay.java: -------------------------------------------------------------------------------- 1 | package com.mxgraph.swing.util; 2 | 3 | import java.awt.Cursor; 4 | import java.awt.Graphics; 5 | 6 | import javax.swing.ImageIcon; 7 | import javax.swing.JComponent; 8 | 9 | import com.mxgraph.util.mxConstants; 10 | import com.mxgraph.util.mxPoint; 11 | import com.mxgraph.util.mxRectangle; 12 | import com.mxgraph.view.mxCellState; 13 | 14 | public class mxCellOverlay extends JComponent implements mxICellOverlay 15 | { 16 | 17 | /** 18 | * 19 | */ 20 | private static final long serialVersionUID = 921991820491141221L; 21 | 22 | /** 23 | * 24 | */ 25 | protected ImageIcon imageIcon; 26 | 27 | /** 28 | * Holds the horizontal alignment for the overlay. 29 | * Default is ALIGN_RIGHT. For edges, the overlay 30 | * always appears in the center of the edge. 31 | */ 32 | protected Object align = mxConstants.ALIGN_RIGHT; 33 | 34 | /** 35 | * Holds the vertical alignment for the overlay. 36 | * Default is bottom. For edges, the overlay 37 | * always appears in the center of the edge. 38 | */ 39 | protected Object verticalAlign = mxConstants.ALIGN_BOTTOM; 40 | 41 | /** 42 | * Defines the overlapping for the overlay, that is, 43 | * the proportional distance from the origin to the 44 | * point defined by the alignment. Default is 0.5. 45 | */ 46 | protected double defaultOverlap = 0.5; 47 | 48 | /** 49 | * 50 | */ 51 | public mxCellOverlay(ImageIcon icon, String warning) 52 | { 53 | this.imageIcon = icon; 54 | setToolTipText(warning); 55 | setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); 56 | } 57 | 58 | /** 59 | * 60 | */ 61 | public void paint(Graphics g) 62 | { 63 | g.drawImage(imageIcon.getImage(), 0, 0, getWidth(), getHeight(), this); 64 | } 65 | 66 | /* 67 | * (non-Javadoc) 68 | * @see com.mxgraph.swing.util.mxIOverlay#getBounds(com.mxgraph.view.mxCellState) 69 | */ 70 | public mxRectangle getBounds(mxCellState state) 71 | { 72 | boolean isEdge = state.getView().getGraph().getModel().isEdge( 73 | state.getCell()); 74 | double s = state.getView().getScale(); 75 | mxPoint pt = null; 76 | 77 | int w = imageIcon.getIconWidth(); 78 | int h = imageIcon.getIconHeight(); 79 | 80 | if (isEdge) 81 | { 82 | int n = state.getAbsolutePointCount(); 83 | 84 | if (n % 2 == 1) 85 | { 86 | pt = state.getAbsolutePoint(n / 2 + 1); 87 | } 88 | else 89 | { 90 | int idx = n / 2; 91 | mxPoint p0 = state.getAbsolutePoint(idx - 1); 92 | mxPoint p1 = state.getAbsolutePoint(idx); 93 | pt = new mxPoint(p0.getX() + (p1.getX() - p0.getX()) / 2, p0 94 | .getY() 95 | + (p1.getY() - p0.getY()) / 2); 96 | } 97 | } 98 | else 99 | { 100 | pt = new mxPoint(); 101 | 102 | if (align.equals(mxConstants.ALIGN_LEFT)) 103 | { 104 | pt.setX(state.getX()); 105 | } 106 | else if (align.equals(mxConstants.ALIGN_CENTER)) 107 | { 108 | pt.setX(state.getX() + state.getWidth() / 2); 109 | } 110 | else 111 | { 112 | pt.setX(state.getX() + state.getWidth()); 113 | } 114 | 115 | if (verticalAlign.equals(mxConstants.ALIGN_TOP)) 116 | { 117 | pt.setY(state.getY()); 118 | } 119 | else if (verticalAlign.equals(mxConstants.ALIGN_MIDDLE)) 120 | { 121 | pt.setY(state.getY() + state.getHeight() / 2); 122 | } 123 | else 124 | { 125 | pt.setY(state.getY() + state.getHeight()); 126 | } 127 | } 128 | 129 | return new mxRectangle(pt.getX() - w * defaultOverlap * s, pt.getY() 130 | - h * defaultOverlap * s, w * s, h * s); 131 | } 132 | 133 | } 134 | -------------------------------------------------------------------------------- /jgraphx/src/com/mxgraph/swing/util/mxICellOverlay.java: -------------------------------------------------------------------------------- 1 | package com.mxgraph.swing.util; 2 | 3 | import com.mxgraph.util.mxRectangle; 4 | import com.mxgraph.view.mxCellState; 5 | 6 | public interface mxICellOverlay 7 | { 8 | 9 | /** 10 | * 11 | */ 12 | mxRectangle getBounds(mxCellState state); 13 | 14 | } 15 | -------------------------------------------------------------------------------- /jgraphx/src/com/mxgraph/swing/util/mxMouseControl.java: -------------------------------------------------------------------------------- 1 | /** 2 | * $Id: mxMouseControl.java,v 1.2 2009/11/24 12:00:29 gaudenz Exp $ 3 | * Copyright (c) 2008, Gaudenz Alder 4 | */ 5 | package com.mxgraph.swing.util; 6 | 7 | import java.awt.event.MouseEvent; 8 | import java.awt.event.MouseListener; 9 | import java.awt.event.MouseMotionListener; 10 | 11 | import javax.swing.JComponent; 12 | 13 | /** 14 | * 15 | */ 16 | public class mxMouseControl extends JComponent implements MouseMotionListener, 17 | MouseListener 18 | { 19 | 20 | /** 21 | * 22 | */ 23 | private static final long serialVersionUID = -6413162217897819199L; 24 | 25 | public void mouseDragged(MouseEvent e) 26 | { 27 | // empty 28 | } 29 | 30 | public void mousePressed(MouseEvent e) 31 | { 32 | // empty 33 | } 34 | 35 | public void mouseReleased(MouseEvent e) 36 | { 37 | // empty 38 | } 39 | 40 | public void mouseMoved(MouseEvent e) 41 | { 42 | // empty 43 | } 44 | 45 | public void mouseClicked(MouseEvent e) 46 | { 47 | // empty 48 | } 49 | 50 | public void mouseEntered(MouseEvent e) 51 | { 52 | // empty 53 | } 54 | 55 | public void mouseExited(MouseEvent e) 56 | { 57 | // empty 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /jgraphx/src/com/mxgraph/swing/util/package.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | This package contains all utility classes that require JFC/Swing, namely for 4 | mouse event handling, drag and drop, actions and overlays. 5 | 6 | 7 | -------------------------------------------------------------------------------- /jgraphx/src/com/mxgraph/swing/view/mxICellEditor.java: -------------------------------------------------------------------------------- 1 | /** 2 | * $Id: mxICellEditor.java,v 1.1 2008/09/26 14:47:41 gaudenz Exp $ 3 | * Copyright (c) 2008, Gaudenz Alder 4 | */ 5 | package com.mxgraph.swing.view; 6 | 7 | import java.util.EventObject; 8 | 9 | /** 10 | * 11 | */ 12 | public interface mxICellEditor 13 | { 14 | 15 | /** 16 | * Returns the cell that is currently being edited. 17 | */ 18 | public Object getEditingCell(); 19 | 20 | /** 21 | * Starts editing the given cell. 22 | */ 23 | public void startEditing(Object cell, EventObject trigger); 24 | 25 | /** 26 | * Stops the current editing. 27 | */ 28 | public void stopEditing(boolean cancel); 29 | 30 | } 31 | -------------------------------------------------------------------------------- /jgraphx/src/com/mxgraph/swing/view/mxInteractiveCanvas.java: -------------------------------------------------------------------------------- 1 | package com.mxgraph.swing.view; 2 | 3 | import java.awt.Polygon; 4 | import java.awt.Rectangle; 5 | 6 | import com.mxgraph.canvas.mxGraphics2DCanvas; 7 | import com.mxgraph.swing.mxGraphComponent; 8 | import com.mxgraph.util.mxConstants; 9 | import com.mxgraph.util.mxPoint; 10 | import com.mxgraph.util.mxUtils; 11 | import com.mxgraph.view.mxCellState; 12 | 13 | public class mxInteractiveCanvas extends mxGraphics2DCanvas 14 | { 15 | /** 16 | * 17 | */ 18 | public boolean contains(mxGraphComponent graphComponent, Rectangle rect, 19 | mxCellState state) 20 | { 21 | return state != null && state.getX() >= rect.x 22 | && state.getY() >= rect.y 23 | && state.getX() + state.getWidth() <= rect.x + rect.width 24 | && state.getY() + state.getHeight() <= rect.y + rect.height; 25 | } 26 | 27 | /** 28 | * 29 | */ 30 | public boolean intersects(mxGraphComponent graphComponent, Rectangle rect, 31 | mxCellState state) 32 | { 33 | if (state != null) 34 | { 35 | // Checks if the label intersects 36 | if (state.getLabelBounds() != null 37 | && state.getLabelBounds().getRectangle().intersects(rect)) 38 | { 39 | return true; 40 | } 41 | 42 | int pointCount = state.getAbsolutePointCount(); 43 | 44 | // Checks if the segments of the edge intersect 45 | if (pointCount > 0) 46 | { 47 | rect = (Rectangle) rect.clone(); 48 | int tolerance = graphComponent.getTolerance(); 49 | rect.grow(tolerance/5, tolerance/5); 50 | mxPoint p0 = state.getAbsolutePoint(0); 51 | 52 | // Handles the special arrow line shape 53 | if (mxUtils.getString(state.getStyle(), 54 | mxConstants.STYLE_SHAPE, "").equals( 55 | mxConstants.SHAPE_ARROW)) 56 | { 57 | mxPoint pe = state.getAbsolutePoint(state 58 | .getAbsolutePointCount() - 1); 59 | Polygon poly = createArrow(p0, pe); 60 | 61 | return poly.intersects(rect); 62 | } 63 | else 64 | { 65 | for (int i = 0; i < pointCount; i++) 66 | { 67 | mxPoint p1 = state.getAbsolutePoint(i); 68 | 69 | if (rect.intersectsLine(p0.getX(), p0.getY(), 70 | p1.getX(), p1.getY())) 71 | { 72 | return true; 73 | } 74 | 75 | p0 = p1; 76 | } 77 | } 78 | } 79 | else 80 | { 81 | // Checks if the bounds of the shape intersect 82 | return state.getRectangle().intersects(rect); 83 | } 84 | } 85 | 86 | return false; 87 | } 88 | 89 | /** 90 | * Returns true if the given point is inside the content area of the given 91 | * swimlane. (The content area of swimlanes is transparent to events.) This 92 | * implementation does not check if the given state is a swimlane, it is 93 | * assumed that the caller has checked this before using this method. 94 | */ 95 | public boolean hitSwimlaneContent(mxGraphComponent graphComponent, 96 | mxCellState swimlane, int x, int y) 97 | { 98 | if (swimlane != null) 99 | { 100 | int start = (int) Math.max(2, Math.round(mxUtils.getInt(swimlane.getStyle(), 101 | mxConstants.STYLE_STARTSIZE, mxConstants.DEFAULT_STARTSIZE) 102 | * graphComponent.getGraph().getView().getScale())); 103 | Rectangle rect = swimlane.getRectangle(); 104 | 105 | if (mxUtils.isTrue(swimlane.getStyle(), 106 | mxConstants.STYLE_HORIZONTAL, true)) 107 | { 108 | rect.y += start; 109 | rect.height -= start; 110 | } 111 | else 112 | { 113 | rect.x += start; 114 | rect.width -= start; 115 | } 116 | 117 | return rect.contains(x, y); 118 | } 119 | 120 | return false; 121 | } 122 | 123 | } 124 | -------------------------------------------------------------------------------- /jgraphx/src/com/mxgraph/swing/view/package.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | This package contains all classes required for interaction, namely the 4 | mxCellEditor used for in-place editing and the mxInteractiveCanvas, which 5 | defines the requirements for a canvas that supports hit-detection on shapes. 6 | 7 | 8 | -------------------------------------------------------------------------------- /jgraphx/src/com/mxgraph/util/StringUtils.java: -------------------------------------------------------------------------------- 1 | package com.mxgraph.util; 2 | 3 | 4 | public class StringUtils { 5 | 6 | public static boolean isEmptyString(String s) { 7 | return ((s==null) || (s.length()==0)); 8 | } 9 | 10 | public static String removeLeadingSpaces(String in) { 11 | return in.replaceAll("^[\\s]+", ""); 12 | } 13 | public static String removeTrailingSpaces(String in) { 14 | return in.replaceAll("[\\s]+$", ""); 15 | } 16 | public static String removeMultiSpaces(String in) { 17 | return in.replaceAll("[\\s]{2,}", " "); 18 | } 19 | public static String removeLeadingAndTrailingSpaces(String in) { 20 | return removeLeadingSpaces(removeTrailingSpaces(in)); 21 | } 22 | public static String cleanupSpaces(String in) { 23 | return removeLeadingAndTrailingSpaces(removeMultiSpaces(in)); 24 | } 25 | public static int getRows(String s) { 26 | if (s==null) return 0; 27 | else { 28 | int count=1; 29 | int length=s.length(); 30 | for(int i=0;icount) { 43 | count=i-previ; 44 | } 45 | previ=i; 46 | } 47 | return count; 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /jgraphx/src/com/mxgraph/util/mxEventObject.java: -------------------------------------------------------------------------------- 1 | /** 2 | * $Id: mxEventObject.java,v 1.4 2009/12/01 15:21:30 gaudenz Exp $ 3 | * Copyright (c) 2007, Gaudenz Alder 4 | */ 5 | package com.mxgraph.util; 6 | 7 | import java.util.Hashtable; 8 | import java.util.Map; 9 | 10 | /** 11 | * Base class for objects that dispatch named events. 12 | */ 13 | public class mxEventObject 14 | { 15 | 16 | /** 17 | * Holds the name of the event. 18 | */ 19 | protected String name; 20 | 21 | /** 22 | * Holds the properties of the event. 23 | */ 24 | protected Map properties; 25 | 26 | /** 27 | * Holds the consumed state of the event. Default is false. 28 | */ 29 | protected boolean consumed = false; 30 | 31 | /** 32 | * Constructs a new event for the given name. 33 | */ 34 | public mxEventObject(String name) 35 | { 36 | this(name, (Object[]) null); 37 | } 38 | 39 | /** 40 | * Constructs a new event for the given name and properties. The optional 41 | * properties are specified using a sequence of keys and values, eg. 42 | * new mxEventObject("eventName", key1, val1, .., keyN, valN)) 43 | */ 44 | public mxEventObject(String name, Object... args) 45 | { 46 | this.name = name; 47 | properties = new Hashtable(); 48 | 49 | if (args != null) 50 | { 51 | for (int i = 0; i < args.length; i += 2) 52 | { 53 | if (args[i + 1] != null) 54 | { 55 | properties.put(String.valueOf(args[i]), args[i + 1]); 56 | } 57 | } 58 | } 59 | } 60 | 61 | /** 62 | * Returns the name of the event. 63 | */ 64 | public String getName() 65 | { 66 | return name; 67 | } 68 | 69 | /** 70 | * 71 | */ 72 | public Map getProperties() 73 | { 74 | return properties; 75 | } 76 | 77 | /** 78 | * 79 | */ 80 | public Object getProperty(String key) 81 | { 82 | return properties.get(key); 83 | } 84 | 85 | /** 86 | * Returns true if the event has been consumed. 87 | */ 88 | public boolean isConsumed() 89 | { 90 | return consumed; 91 | } 92 | 93 | /** 94 | * Consumes the event. 95 | */ 96 | public void consume() 97 | { 98 | consumed = true; 99 | } 100 | 101 | } 102 | -------------------------------------------------------------------------------- /jgraphx/src/com/mxgraph/util/mxEventSource.java: -------------------------------------------------------------------------------- 1 | /** 2 | * $Id: mxEventSource.java,v 1.11 2010/01/29 10:16:30 gaudenz Exp $ 3 | * Copyright (c) 2007, Gaudenz Alder 4 | */ 5 | package com.mxgraph.util; 6 | 7 | import java.util.ArrayList; 8 | import java.util.List; 9 | 10 | /** 11 | * Base class for objects that dispatch named events. 12 | */ 13 | public class mxEventSource 14 | { 15 | 16 | /** 17 | * Defines the requirements for an object that listens to an event source. 18 | */ 19 | public interface mxIEventListener 20 | { 21 | 22 | /** 23 | * Called when the graph model has changed. 24 | * 25 | * @param sender Reference to the source of the event. 26 | * @param evt Event object to be dispatched. 27 | */ 28 | void invoke(Object sender, mxEventObject evt); 29 | 30 | } 31 | 32 | /** 33 | * Holds the event names and associated listeners in an array. The array 34 | * contains the event name followed by the respective listener for each 35 | * registered listener. 36 | */ 37 | protected transient List eventListeners = null; 38 | 39 | /** 40 | * Holds the source object for this event source. 41 | */ 42 | protected Object eventSource; 43 | 44 | /** 45 | * Specifies if events can be fired. Default is true. 46 | */ 47 | protected boolean eventsEnabled = true; 48 | 49 | /** 50 | * Constructs a new event source using this as the source object. 51 | */ 52 | public mxEventSource() 53 | { 54 | this(null); 55 | } 56 | 57 | /** 58 | * Constructs a new event source for the given source object. 59 | */ 60 | public mxEventSource(Object source) 61 | { 62 | setEventSource(source); 63 | } 64 | 65 | /** 66 | * 67 | */ 68 | public Object getEventSource() 69 | { 70 | return eventSource; 71 | } 72 | 73 | /** 74 | * 75 | */ 76 | public void setEventSource(Object value) 77 | { 78 | this.eventSource = value; 79 | } 80 | 81 | /** 82 | * 83 | */ 84 | public boolean isEventsEnabled() 85 | { 86 | return eventsEnabled; 87 | } 88 | 89 | /** 90 | * 91 | */ 92 | public void setEventsEnabled(boolean eventsEnabled) 93 | { 94 | this.eventsEnabled = eventsEnabled; 95 | } 96 | 97 | /** 98 | * Binds the specified function to the given event name. If no event name 99 | * is given, then the listener is registered for all events. 100 | */ 101 | public void addListener(String eventName, mxIEventListener listener) 102 | { 103 | if (eventListeners == null) 104 | { 105 | eventListeners = new ArrayList(); 106 | } 107 | 108 | eventListeners.add(eventName); 109 | eventListeners.add(listener); 110 | } 111 | 112 | /** 113 | * Function: removeListener 114 | * 115 | * Removes all occurances of the given listener from the list of listeners. 116 | */ 117 | public void removeListener(mxIEventListener listener) 118 | { 119 | removeListener(listener, null); 120 | } 121 | 122 | /** 123 | * Function: removeListener 124 | * 125 | * Removes all occurances of the given listener from the list of listeners. 126 | */ 127 | public void removeListener(mxIEventListener listener, String eventName) 128 | { 129 | if (eventListeners != null) 130 | { 131 | for (int i = eventListeners.size() - 2; i > 1; i -= 2) 132 | { 133 | if (eventListeners.get(i + 1) == listener 134 | && (eventName == null || String.valueOf( 135 | eventListeners.get(i)).equals(eventName))) 136 | { 137 | eventListeners.remove(i + 1); 138 | eventListeners.remove(i); 139 | } 140 | } 141 | } 142 | } 143 | 144 | /** 145 | * Dispatches the given event name with this object as the event source. 146 | * fireEvent(new mxEventObject("eventName", key1, val1, .., keyN, valN)) 147 | * 148 | */ 149 | public void fireEvent(mxEventObject evt) 150 | { 151 | //System.out.println("firing event ("+this.getClass().getSimpleName()+")"+evt.name+" "+evt.properties); 152 | //System.out.println(Arrays.asList(Thread.currentThread().getStackTrace())); 153 | fireEvent(evt, null); 154 | } 155 | 156 | /** 157 | * Dispatches the given event name, passing all arguments after the given 158 | * name to the registered listeners for the event. 159 | */ 160 | public void fireEvent(mxEventObject evt, Object sender) 161 | { 162 | if (eventListeners != null && !eventListeners.isEmpty() 163 | && isEventsEnabled()) 164 | { 165 | if (sender == null) 166 | { 167 | sender = getEventSource(); 168 | } 169 | 170 | if (sender == null) 171 | { 172 | sender = this; 173 | } 174 | 175 | for (int i = 0; i < eventListeners.size(); i += 2) 176 | { 177 | String listen = (String) eventListeners.get(i); 178 | 179 | if (listen == null || listen.equals(evt.getName())) 180 | { 181 | ((mxIEventListener) eventListeners.get(i + 1)).invoke( 182 | sender, evt); 183 | } 184 | } 185 | } 186 | } 187 | 188 | } 189 | -------------------------------------------------------------------------------- /jgraphx/src/com/mxgraph/util/mxImage.java: -------------------------------------------------------------------------------- 1 | /** 2 | * $Id: mxImage.java,v 1.2 2009/11/24 12:00:28 gaudenz Exp $ 3 | * Copyright (c) 2007, Gaudenz Alder 4 | */ 5 | package com.mxgraph.util; 6 | 7 | import java.io.Serializable; 8 | 9 | /** 10 | * Implements a 2-dimensional point with double precision coordinates. 11 | */ 12 | public class mxImage implements Serializable, Cloneable 13 | { 14 | 15 | /** 16 | * 17 | */ 18 | private static final long serialVersionUID = 8541229679513497585L; 19 | 20 | /** 21 | * Holds the path or URL for the image. 22 | */ 23 | protected String src; 24 | 25 | /** 26 | * Holds the image width and height. 27 | */ 28 | protected int width, height; 29 | 30 | /** 31 | * Constructs a new point at (0, 0). 32 | */ 33 | public mxImage(String src, int width, int height) 34 | { 35 | this.src = src; 36 | this.width = width; 37 | this.height = height; 38 | } 39 | 40 | /** 41 | * @return the src 42 | */ 43 | public String getSrc() 44 | { 45 | return src; 46 | } 47 | 48 | /** 49 | * @param src the src to set 50 | */ 51 | public void setSrc(String src) 52 | { 53 | this.src = src; 54 | } 55 | 56 | /** 57 | * @return the width 58 | */ 59 | public int getWidth() 60 | { 61 | return width; 62 | } 63 | 64 | /** 65 | * @param width the width to set 66 | */ 67 | public void setWidth(int width) 68 | { 69 | this.width = width; 70 | } 71 | 72 | /** 73 | * @return the height 74 | */ 75 | public int getHeight() 76 | { 77 | return height; 78 | } 79 | 80 | /** 81 | * @param height the height to set 82 | */ 83 | public void setHeight(int height) 84 | { 85 | this.height = height; 86 | } 87 | 88 | } 89 | -------------------------------------------------------------------------------- /jgraphx/src/com/mxgraph/util/mxLighweightLabel.java: -------------------------------------------------------------------------------- 1 | /** 2 | * $Id: mxLighweightLabel.java,v 1.1 2010/02/25 21:38:24 gaudenz Exp $ 3 | * Copyright (c) 2007, Gaudenz Alder 4 | */ 5 | package com.mxgraph.util; 6 | 7 | import java.awt.Font; 8 | import java.awt.Rectangle; 9 | 10 | import javax.swing.JLabel; 11 | 12 | /** 13 | * @author Administrator 14 | * 15 | */ 16 | public class mxLighweightLabel extends JLabel 17 | { 18 | 19 | /** 20 | * 21 | */ 22 | private static final long serialVersionUID = -6771477489533614010L; 23 | 24 | /** 25 | * 26 | */ 27 | protected static mxLighweightLabel sharedInstance; 28 | 29 | /** 30 | * Initializes the shared instance. 31 | */ 32 | static 33 | { 34 | try 35 | { 36 | sharedInstance = new mxLighweightLabel(); 37 | } 38 | catch (Exception e) 39 | { 40 | // ignore 41 | } 42 | } 43 | 44 | /** 45 | * 46 | */ 47 | public static mxLighweightLabel getSharedInstance() 48 | { 49 | return sharedInstance; 50 | } 51 | 52 | /** 53 | * 54 | * 55 | */ 56 | public mxLighweightLabel() 57 | { 58 | setFont(new Font(mxConstants.DEFAULT_FONTFAMILY, 0, 59 | mxConstants.DEFAULT_FONTSIZE)); 60 | } 61 | 62 | /** 63 | * Overridden for performance reasons. 64 | * 65 | */ 66 | public void validate() 67 | { 68 | } 69 | 70 | /** 71 | * Overridden for performance reasons. 72 | * 73 | */ 74 | public void revalidate() 75 | { 76 | } 77 | 78 | /** 79 | * Overridden for performance reasons. 80 | * 81 | */ 82 | public void repaint(long tm, int x, int y, int width, int height) 83 | { 84 | } 85 | 86 | /** 87 | * Overridden for performance reasons. 88 | * 89 | */ 90 | public void repaint(Rectangle r) 91 | { 92 | } 93 | 94 | /** 95 | * Overridden for performance reasons. 96 | * 97 | */ 98 | protected void firePropertyChange(String propertyName, Object oldValue, 99 | Object newValue) 100 | { 101 | // Strings get interned... 102 | if (propertyName == "text") 103 | { 104 | super.firePropertyChange(propertyName, oldValue, newValue); 105 | } 106 | } 107 | 108 | /** 109 | * Overridden for performance reasons. 110 | * 111 | */ 112 | public void firePropertyChange(String propertyName, byte oldValue, 113 | byte newValue) 114 | { 115 | } 116 | 117 | /** 118 | * Overridden for performance reasons. 119 | * 120 | */ 121 | public void firePropertyChange(String propertyName, char oldValue, 122 | char newValue) 123 | { 124 | } 125 | 126 | /** 127 | * Overridden for performance reasons. 128 | * 129 | */ 130 | public void firePropertyChange(String propertyName, short oldValue, 131 | short newValue) 132 | { 133 | } 134 | 135 | /** 136 | * Overridden for performance reasons. 137 | * 138 | */ 139 | public void firePropertyChange(String propertyName, int oldValue, 140 | int newValue) 141 | { 142 | } 143 | 144 | /** 145 | * Overridden for performance reasons. 146 | * 147 | */ 148 | public void firePropertyChange(String propertyName, long oldValue, 149 | long newValue) 150 | { 151 | } 152 | 153 | /** 154 | * Overridden for performance reasons. 155 | * 156 | */ 157 | public void firePropertyChange(String propertyName, float oldValue, 158 | float newValue) 159 | { 160 | } 161 | 162 | /** 163 | * Overridden for performance reasons. 164 | * 165 | */ 166 | public void firePropertyChange(String propertyName, double oldValue, 167 | double newValue) 168 | { 169 | } 170 | 171 | /** 172 | * Overridden for performance reasons. 173 | * 174 | */ 175 | public void firePropertyChange(String propertyName, boolean oldValue, 176 | boolean newValue) 177 | { 178 | } 179 | 180 | } 181 | -------------------------------------------------------------------------------- /jgraphx/src/com/mxgraph/util/mxLighweightTextPane.java: -------------------------------------------------------------------------------- 1 | /** 2 | * $Id: mxLighweightTextPane.java,v 1.2 2010/02/26 08:22:51 gaudenz Exp $ 3 | * Copyright (c) 2007, Gaudenz Alder 4 | */ 5 | package com.mxgraph.util; 6 | 7 | import java.awt.Rectangle; 8 | 9 | import javax.swing.JTextPane; 10 | import javax.swing.text.DefaultStyledDocument; 11 | 12 | /** 13 | * @author Administrator 14 | * 15 | */ 16 | public class mxLighweightTextPane extends JTextPane 17 | { 18 | 19 | /** 20 | * 21 | */ 22 | private static final long serialVersionUID = -6771477489533614010L; 23 | 24 | /** 25 | * 26 | */ 27 | protected static mxLighweightTextPane sharedInstance; 28 | 29 | /** 30 | * Initializes the shared instance. 31 | */ 32 | static 33 | { 34 | try 35 | { 36 | sharedInstance = new mxLighweightTextPane(); 37 | } 38 | catch (Exception e) 39 | { 40 | // ignore 41 | } 42 | } 43 | 44 | /** 45 | * 46 | */ 47 | public static mxLighweightTextPane getSharedInstance() 48 | { 49 | return sharedInstance; 50 | } 51 | 52 | /** 53 | * 54 | * 55 | */ 56 | public mxLighweightTextPane() 57 | { 58 | super(new DefaultStyledDocument()); 59 | setOpaque(false); 60 | setBorder(null); 61 | } 62 | 63 | /** 64 | * Overridden for performance reasons. 65 | * 66 | */ 67 | public void validate() 68 | { 69 | } 70 | 71 | /** 72 | * Overridden for performance reasons. 73 | * 74 | */ 75 | public void revalidate() 76 | { 77 | } 78 | 79 | /** 80 | * Overridden for performance reasons. 81 | * 82 | */ 83 | public void repaint(long tm, int x, int y, int width, int height) 84 | { 85 | } 86 | 87 | /** 88 | * Overridden for performance reasons. 89 | * 90 | */ 91 | public void repaint(Rectangle r) 92 | { 93 | } 94 | 95 | /** 96 | * Overridden for performance reasons. 97 | * 98 | */ 99 | protected void firePropertyChange(String propertyName, Object oldValue, 100 | Object newValue) 101 | { 102 | // Strings get interned... 103 | if (propertyName == "document") 104 | { 105 | super.firePropertyChange(propertyName, oldValue, newValue); 106 | } 107 | } 108 | 109 | /** 110 | * Overridden for performance reasons. 111 | * 112 | */ 113 | public void firePropertyChange(String propertyName, byte oldValue, 114 | byte newValue) 115 | { 116 | } 117 | 118 | /** 119 | * Overridden for performance reasons. 120 | * 121 | */ 122 | public void firePropertyChange(String propertyName, char oldValue, 123 | char newValue) 124 | { 125 | } 126 | 127 | /** 128 | * Overridden for performance reasons. 129 | * 130 | */ 131 | public void firePropertyChange(String propertyName, short oldValue, 132 | short newValue) 133 | { 134 | } 135 | 136 | /** 137 | * Overridden for performance reasons. 138 | * 139 | */ 140 | public void firePropertyChange(String propertyName, int oldValue, 141 | int newValue) 142 | { 143 | } 144 | 145 | /** 146 | * Overridden for performance reasons. 147 | * 148 | */ 149 | public void firePropertyChange(String propertyName, long oldValue, 150 | long newValue) 151 | { 152 | } 153 | 154 | /** 155 | * Overridden for performance reasons. 156 | * 157 | */ 158 | public void firePropertyChange(String propertyName, float oldValue, 159 | float newValue) 160 | { 161 | } 162 | 163 | /** 164 | * Overridden for performance reasons. 165 | * 166 | */ 167 | public void firePropertyChange(String propertyName, double oldValue, 168 | double newValue) 169 | { 170 | } 171 | 172 | /** 173 | * Overridden for performance reasons. 174 | * 175 | */ 176 | public void firePropertyChange(String propertyName, boolean oldValue, 177 | boolean newValue) 178 | { 179 | } 180 | 181 | } 182 | -------------------------------------------------------------------------------- /jgraphx/src/com/mxgraph/util/mxPoint.java: -------------------------------------------------------------------------------- 1 | /** 2 | * $Id: mxPoint.java,v 1.5 2009/11/24 12:00:28 gaudenz Exp $ 3 | * Copyright (c) 2007, Gaudenz Alder 4 | */ 5 | package com.mxgraph.util; 6 | 7 | import java.awt.Point; 8 | import java.awt.geom.Point2D; 9 | import java.io.Serializable; 10 | 11 | /** 12 | * Implements a 2-dimensional point with double precision coordinates. 13 | */ 14 | public class mxPoint implements Serializable, Cloneable 15 | { 16 | 17 | /** 18 | * 19 | */ 20 | private static final long serialVersionUID = 6554231393215892186L; 21 | 22 | /** 23 | * Holds the x- and y-coordinates of the point. Default is 0. 24 | */ 25 | protected double x, y; 26 | 27 | /** 28 | * Constructs a new point at (0, 0). 29 | */ 30 | public mxPoint() 31 | { 32 | this(0, 0); 33 | } 34 | 35 | /** 36 | * Constructs a new point at the location of the given point. 37 | * 38 | * @param point Point that specifies the location. 39 | */ 40 | public mxPoint(Point2D point) 41 | { 42 | this(point.getX(), point.getY()); 43 | } 44 | 45 | /** 46 | * Constructs a new point at the location of the given point. 47 | * 48 | * @param point Point that specifies the location. 49 | */ 50 | public mxPoint(mxPoint point) 51 | { 52 | this(point.getX(), point.getY()); 53 | } 54 | 55 | /** 56 | * Constructs a new point at (x, y). 57 | * 58 | * @param x X-coordinate of the point to be created. 59 | * @param y Y-coordinate of the point to be created. 60 | */ 61 | public mxPoint(double x, double y) 62 | { 63 | setX(x); 64 | setY(y); 65 | } 66 | 67 | /** 68 | * Returns the x-coordinate of the point. 69 | * 70 | * @return Returns the x-coordinate. 71 | */ 72 | public double getX() 73 | { 74 | return x; 75 | } 76 | 77 | /** 78 | * Sets the x-coordinate of the point. 79 | * 80 | * @param value Double that specifies the new x-coordinate. 81 | */ 82 | public void setX(double value) 83 | { 84 | x = value; 85 | } 86 | 87 | /** 88 | * Returns the x-coordinate of the point. 89 | * 90 | * @return Returns the x-coordinate. 91 | */ 92 | public double getY() 93 | { 94 | return y; 95 | } 96 | 97 | /** 98 | * Sets the x-coordinate of the point. 99 | * 100 | * @param value Double that specifies the new x-coordinate. 101 | */ 102 | public void setY(double value) 103 | { 104 | y = value; 105 | } 106 | 107 | /** 108 | * Returns the coordinates as a new point. 109 | * 110 | * @return Returns a new point for the location. 111 | */ 112 | public Point getPoint() 113 | { 114 | return new Point((int) Math.round(x), (int) Math.round(y)); 115 | } 116 | 117 | /** 118 | * 119 | * Returns true if the given object equals this rectangle. 120 | */ 121 | public boolean equals(Object obj) 122 | { 123 | if (obj instanceof mxPoint) 124 | { 125 | mxPoint pt = (mxPoint) obj; 126 | 127 | return pt.getX() == getX() && pt.getY() == getY(); 128 | } 129 | 130 | return false; 131 | } 132 | 133 | /** 134 | * Returns a new instance of the same point. 135 | */ 136 | public Object clone() 137 | { 138 | mxPoint clone; 139 | 140 | try 141 | { 142 | clone = (mxPoint) super.clone(); 143 | } 144 | catch (CloneNotSupportedException e) 145 | { 146 | clone = new mxPoint(); 147 | } 148 | 149 | clone.setX(getX()); 150 | clone.setY(getY()); 151 | 152 | return clone; 153 | } 154 | 155 | public String toString() { 156 | return "mxPoint ["+x+","+y+"]"; 157 | } 158 | 159 | } 160 | -------------------------------------------------------------------------------- /jgraphx/src/com/mxgraph/util/mxResources.java: -------------------------------------------------------------------------------- 1 | package com.mxgraph.util; 2 | 3 | import java.util.Iterator; 4 | import java.util.LinkedList; 5 | import java.util.Locale; 6 | import java.util.MissingResourceException; 7 | import java.util.PropertyResourceBundle; 8 | import java.util.ResourceBundle; 9 | 10 | public class mxResources 11 | { 12 | 13 | /** 14 | * Ordered list of the inserted resource bundles. 15 | */ 16 | protected static LinkedList bundles = new LinkedList(); 17 | 18 | /** 19 | * Returns the bundles. 20 | * 21 | * @return Returns the bundles. 22 | */ 23 | public static LinkedList getBundles() 24 | { 25 | return bundles; 26 | } 27 | 28 | /** 29 | * Sets the bundles. 30 | * 31 | * @param value 32 | * The bundles to set. 33 | */ 34 | public static void setBundles(LinkedList value) 35 | { 36 | bundles = value; 37 | } 38 | 39 | /** 40 | * Adds a resource bundle. 41 | * 42 | * @param basename 43 | * The basename of the resource bundle to add. 44 | */ 45 | public static void add(String basename) 46 | { 47 | bundles.addFirst(PropertyResourceBundle.getBundle(basename)); 48 | } 49 | 50 | /** 51 | * Adds a resource bundle. 52 | * 53 | * @param basename 54 | * The basename of the resource bundle to add. 55 | */ 56 | public static void add(String basename, Locale locale) 57 | { 58 | bundles.addFirst(PropertyResourceBundle.getBundle(basename, locale)); 59 | } 60 | 61 | /** 62 | * 63 | */ 64 | public static String get(String key) 65 | { 66 | return get(key, null, null); 67 | } 68 | 69 | /** 70 | * 71 | */ 72 | public static String get(String key, String defaultValue) 73 | { 74 | return get(key, null, defaultValue); 75 | } 76 | 77 | /** 78 | * Returns the value for the specified resource key. 79 | */ 80 | public static String get(String key, String[] params) 81 | { 82 | return get(key, params, null); 83 | } 84 | 85 | /** 86 | * Returns the value for the specified resource key. 87 | */ 88 | public static String get(String key, String[] params, String defaultValue) 89 | { 90 | String value = getResource(key); 91 | 92 | // Applies default value if required 93 | if (value == null) 94 | { 95 | value = defaultValue; 96 | } 97 | 98 | // Replaces the placeholders with the values in the array 99 | if (value != null && params != null) 100 | { 101 | StringBuffer result = new StringBuffer(); 102 | String index = null; 103 | 104 | for (int i = 0; i < value.length(); i++) 105 | { 106 | char c = value.charAt(i); 107 | 108 | if (c == '{') 109 | { 110 | index = ""; 111 | } 112 | else if (index != null && c == '}') 113 | { 114 | int tmp = Integer.parseInt(index) - 1; 115 | 116 | if (tmp >= 0 && tmp < params.length) 117 | { 118 | result.append(params[tmp]); 119 | } 120 | 121 | index = null; 122 | } 123 | else if (index != null) 124 | { 125 | index += c; 126 | } 127 | else 128 | { 129 | result.append(c); 130 | } 131 | } 132 | 133 | value = result.toString(); 134 | } 135 | 136 | return value; 137 | } 138 | 139 | /** 140 | * Returns the value for key by searching the resource 141 | * bundles in inverse order or null if no value can be found 142 | * for key. 143 | */ 144 | protected static String getResource(String key) 145 | { 146 | Iterator it = bundles.iterator(); 147 | 148 | while (it.hasNext()) 149 | { 150 | try 151 | { 152 | return it.next().getString(key); 153 | } 154 | catch (MissingResourceException mrex) 155 | { 156 | // continue 157 | } 158 | } 159 | 160 | return null; 161 | } 162 | 163 | } 164 | -------------------------------------------------------------------------------- /jgraphx/src/com/mxgraph/util/package.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | This package provides utility classes such as mxConstants, mxUtils, mxPoint 4 | and mxRectangle as well as all classes for custom events and the undo 5 | history. 6 | 7 | 8 | -------------------------------------------------------------------------------- /jgraphx/src/com/mxgraph/view/mxStyleRegistry.java: -------------------------------------------------------------------------------- 1 | /** 2 | * $Id: mxStyleRegistry.java,v 1.4 2010/01/13 10:43:46 gaudenz Exp $ 3 | * Copyright (c) 2007, Gaudenz Alder 4 | */ 5 | package com.mxgraph.view; 6 | 7 | import java.util.Hashtable; 8 | import java.util.Iterator; 9 | import java.util.Map; 10 | 11 | import com.mxgraph.util.mxConstants; 12 | 13 | /** 14 | * Singleton class that acts as a global converter from string to object values 15 | * in a style. This is currently only used to perimeters and edge styles. 16 | */ 17 | public class mxStyleRegistry 18 | { 19 | 20 | /** 21 | * Maps from strings to objects. 22 | */ 23 | protected static Map values = new Hashtable(); 24 | 25 | // Registers the known object styles 26 | static 27 | { 28 | putValue(mxConstants.EDGESTYLE_ELBOW, mxEdgeStyle.ElbowConnector); 29 | putValue(mxConstants.EDGESTYLE_ENTITY_RELATION, 30 | mxEdgeStyle.EntityRelation); 31 | putValue(mxConstants.EDGESTYLE_LOOP, mxEdgeStyle.Loop); 32 | putValue(mxConstants.EDGESTYLE_SIDETOSIDE, mxEdgeStyle.SideToSide); 33 | putValue(mxConstants.EDGESTYLE_TOPTOBOTTOM, mxEdgeStyle.TopToBottom); 34 | 35 | putValue(mxConstants.PERIMETER_ELLIPSE, mxPerimeter.EllipsePerimeter); 36 | putValue(mxConstants.PERIMETER_RECTANGLE, 37 | mxPerimeter.RectanglePerimeter); 38 | putValue(mxConstants.PERIMETER_RHOMBUS, mxPerimeter.RhombusPerimeter); 39 | putValue(mxConstants.PERIMETER_TRIANGLE, mxPerimeter.TrianglePerimeter); 40 | } 41 | 42 | /** 43 | * Puts the given object into the registry under the given name. 44 | */ 45 | public static void putValue(String name, Object value) 46 | { 47 | values.put(name, value); 48 | } 49 | 50 | /** 51 | * Returns the value associated with the given name. 52 | */ 53 | public static Object getValue(String name) 54 | { 55 | return values.get(name); 56 | } 57 | 58 | /** 59 | * Returns the name for the given value. 60 | */ 61 | public static String getName(Object value) 62 | { 63 | Iterator> it = values.entrySet().iterator(); 64 | 65 | while (it.hasNext()) 66 | { 67 | Map.Entry entry = it.next(); 68 | 69 | if (entry.getValue() == value) 70 | { 71 | return entry.getKey(); 72 | } 73 | } 74 | 75 | return null; 76 | } 77 | 78 | } 79 | -------------------------------------------------------------------------------- /jgraphx/src/com/mxgraph/view/mxTemporaryCellStates.java: -------------------------------------------------------------------------------- 1 | package com.mxgraph.view; 2 | 3 | import java.util.Hashtable; 4 | 5 | import com.mxgraph.model.mxCell; 6 | import com.mxgraph.util.mxRectangle; 7 | 8 | public class mxTemporaryCellStates 9 | { 10 | /** 11 | * 12 | */ 13 | protected mxGraphView view; 14 | 15 | /** 16 | * 17 | */ 18 | protected Hashtable oldStates; 19 | 20 | /** 21 | * 22 | */ 23 | protected mxRectangle oldBounds; 24 | 25 | /** 26 | * 27 | */ 28 | protected double oldScale; 29 | 30 | /** 31 | * Constructs a new temporary cell states instance. 32 | */ 33 | public mxTemporaryCellStates(mxGraphView view) 34 | { 35 | this(view, 1, null); 36 | } 37 | 38 | /** 39 | * Constructs a new temporary cell states instance. 40 | */ 41 | public mxTemporaryCellStates(mxGraphView view, double scale) 42 | { 43 | this(view, scale, null); 44 | } 45 | 46 | /** 47 | * Constructs a new temporary cell states instance. 48 | */ 49 | public mxTemporaryCellStates(mxGraphView view, double scale, Object[] cells) 50 | { 51 | this.view = view; 52 | 53 | // Stores the previous state 54 | oldBounds = view.getGraphBounds(); 55 | oldStates = view.getStates(); 56 | oldScale = view.getScale(); 57 | 58 | // Creates space for the new states 59 | view.setStates(new Hashtable()); 60 | view.setScale(scale); 61 | 62 | if (cells != null) 63 | { 64 | // Creates virtual parent state for validation 65 | mxCellState state = view.createState(new mxCell()); 66 | 67 | // Validates the vertices and edges without adding them to 68 | // the model so that the original cells are not modified 69 | for (int i = 0; i < cells.length; i++) 70 | { 71 | view.validateBounds(state, cells[i]); 72 | } 73 | 74 | double minX = 0; 75 | double minY = 0; 76 | double maxX = 0; 77 | double maxY = 0; 78 | 79 | for (int i = 0; i < cells.length; i++) 80 | { 81 | mxRectangle bounds = view.validatePoints(state, cells[i]); 82 | 83 | // TODO: Fix initial 0 for minX, minY (should be null) 84 | minX = Math.min(minX, bounds.getX()); 85 | minY = Math.min(minY, bounds.getY()); 86 | maxX = Math.max(maxX, bounds.getX() + bounds.getWidth()); 87 | maxY = Math.max(maxY, bounds.getY() + bounds.getHeight()); 88 | } 89 | 90 | view.setGraphBounds(new mxRectangle(minX, minY, maxX - minX, maxY 91 | - minY)); 92 | } 93 | } 94 | 95 | /** 96 | * Destroys the cell states and restores the state of the graph view. 97 | */ 98 | public void destroy() 99 | { 100 | view.setScale(oldScale); 101 | view.setStates(oldStates); 102 | view.setGraphBounds(oldBounds); 103 | } 104 | 105 | } 106 | -------------------------------------------------------------------------------- /jgraphx/src/com/mxgraph/view/package.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | This package implements the graph component, represented by the mxGraph 4 | class. The graph holds an mxGraphModel which contains mxCells and caches the 5 | state of the cells in mxGraphView. The cells are painted using a canvas from 6 | the canvas package. The style of the graph is represented by the mxStylesheet 7 | class. 8 | 9 | 10 | -------------------------------------------------------------------------------- /lib/commons-cli-1.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/lib/commons-cli-1.2.jar -------------------------------------------------------------------------------- /lib/dom4j.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/lib/dom4j.jar -------------------------------------------------------------------------------- /lib/jaxb-api-2.3.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/lib/jaxb-api-2.3.0.jar -------------------------------------------------------------------------------- /lib/jgraphx.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/lib/jgraphx.jar -------------------------------------------------------------------------------- /lib/lucene-core-3.6.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/lib/lucene-core-3.6.1.jar -------------------------------------------------------------------------------- /lib/rsyntaxtextarea.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/lib/rsyntaxtextarea.jar --------------------------------------------------------------------------------