Lines Matching refs:graph

21 	var graph = editor.graph;
24 return Action.prototype.isEnabled.apply(this, arguments) && graph.isEnabled();
28 this.addAction('new...', function() { graph.openLink(ui.getUrl()); });
38 graph.popupMenuHandler.hideMenu();
40 var scale = graph.view.scale;
41 var tx = graph.view.translate.x;
42 var ty = graph.view.translate.y;
47 …if (Math.abs(scale - graph.view.scale) < 0.00001 && tx == graph.view.translate.x && ty == graph.vi…
49 ui.actions.get((graph.pageVisible) ? 'fitPage' : 'fitWindow').funct();
54 if (graph.isEnabled())
56 if (graph.isSelectionEmpty())
62 graph.startEditingAtCell();
82 editor.graph.setSelectionCells(editor.graph.importGraphModel(doc.documentElement));
107 this.addAction('preview', function() { mxUtils.show(graph, null, 10, 10); });
122 graph.removeCells(cells, false);
132 mxClipboard.cut(graph);
148 mxClipboard.copy(graph);
157 if (graph.isEnabled() && !graph.isCellLocked(graph.getDefaultParent()))
169 graph.getModel().beginUpdate();
176 graph.getModel().endUpdate();
181 mxClipboard.paste(graph);
195 mxClipboard.paste(graph);
209 includeEdges = includeEdges && graph.model.isEdge(cells[i]);
212 var t = graph.view.translate;
213 var s = graph.view.scale;
220 var geo = graph.getCellGeometry(cells[0]);
228 bb = (bb != null) ? bb : graph.getBoundingBoxFromGeometry(cells, includeEdges);
232 var x = Math.round(graph.snap(graph.popupMenuHandler.triggerX / s - dx));
233 var y = Math.round(graph.snap(graph.popupMenuHandler.triggerY / s - dy));
235 graph.cellsMoved(cells, x - bb.x, y - bb.y);
242 graph.getModel().beginUpdate();
245 pasteCellsHere(mxClipboard.paste(graph));
249 graph.getModel().endUpdate();
253 if (graph.isEnabled() && !graph.isCellLocked(graph.getDefaultParent()))
265 graph.getModel().beginUpdate();
272 graph.getModel().endUpdate();
298 var cell = graph.getSelectionCell();
300 if (graph.isEnabled() && cell != null && graph.getModel().isVertex(cell))
302 var geo = graph.getCellGeometry(cell);
313 if (graph.isEnabled() && !graph.isSelectionEmpty() && ui.copiedSize != null)
315 graph.getModel().beginUpdate();
319 var cells = graph.getResizableCells(graph.getSelectionCells());
323 if (graph.getModel().isVertex(cells[i]))
325 var geo = graph.getCellGeometry(cells[i]);
333 graph.getModel().setGeometry(cells[i], geo);
340 graph.getModel().endUpdate();
347 var cell = graph.getSelectionCell() || graph.getModel().getRoot();
349 if (graph.isEnabled() && cell != null)
364 var model = graph.getModel();
380 value.setAttribute('label', graph.convertValueToString(cell));
386 if (graph.isEnabled() && !graph.isSelectionEmpty() && ui.copiedValue != null)
392 var cells = graph.getEditableCells(graph.getSelectionCells());
416 graph.escape();
417 var select = graph.deleteCells(graph.getDeletableCells(graph.getSelectionCells()), includeEdges);
421 graph.setSelectionCells(select);
427 if (!graph.isSelectionEmpty())
429 graph.getModel().beginUpdate();
432 var cells = graph.getSelectionCells();
436 graph.cellLabelChanged(cells[i], '');
441 graph.getModel().endUpdate();
473 graph.setSelectionCells(graph.duplicateCells());
474 graph.scrollCellToVisible(graph.getSelectionCell());
486 graph.turnShapes(graph.getResizableCells(graph.getSelectionCells()),
491 var cell = graph.getSelectionCell();
493 if (graph.isEnabled() && cell != null)
495 graph.addSelectionCells(graph.getEdges(cell));
498 …this.addAction('selectVertices', function() { graph.selectVertices(null, true); }, null, null, Edi…
499 …this.addAction('selectEdges', function() { graph.selectEdges(); }, null, null, Editor.ctrlKey + '+…
500 …this.addAction('selectAll', function() { graph.selectAll(null, true); }, null, null, Editor.ctrlKe…
501 …this.addAction('selectNone', function() { graph.clearSelection(); }, null, null, Editor.ctrlKey + …
504 if (!graph.isSelectionEmpty())
506 graph.getModel().beginUpdate();
509 var cells = graph.getSelectionCells();
510 var style = graph.getCurrentCellStyle(graph.getSelectionCell());
512 graph.setCellStyles(mxConstants.STYLE_MOVABLE, value, cells);
513 graph.setCellStyles(mxConstants.STYLE_RESIZABLE, value, cells);
514 graph.setCellStyles(mxConstants.STYLE_ROTATABLE, value, cells);
515 graph.setCellStyles(mxConstants.STYLE_DELETABLE, value, cells);
516 graph.setCellStyles(mxConstants.STYLE_EDITABLE, value, cells);
517 graph.setCellStyles('connectable', value, cells);
521 graph.getModel().endUpdate();
527 this.addAction('home', function() { graph.home(); }, null, null, 'Shift+Home');
528 …this.addAction('exitGroup', function() { graph.exitGroup(); }, null, null, Editor.ctrlKey + '+Shif…
529 …this.addAction('enterGroup', function() { graph.enterGroup(); }, null, null, Editor.ctrlKey + '+Sh…
530 …this.addAction('collapse', function() { graph.foldCells(true); }, null, null, Editor.ctrlKey + '+H…
531 …this.addAction('expand', function() { graph.foldCells(false); }, null, null, Editor.ctrlKey + '+En…
536 graph.orderCells(false);
540 graph.orderCells(true);
544 graph.orderCells(false, null, true);
548 graph.orderCells(true, null, true);
552 if (graph.isEnabled())
554 var cells = mxUtils.sortCells(graph.getSelectionCells(), true);
556 if (cells.length == 1 && !graph.isTable(cells[0]) && !graph.isTableRow(cells[0]))
558 graph.setCellStyles('container', '1');
562 cells = graph.getCellsForGroup(cells);
566 graph.setSelectionCell(graph.groupCells(null, 0, cells));
573 if (graph.isEnabled())
575 var cells = graph.getEditableCells(graph.getSelectionCells());
577 graph.model.beginUpdate();
580 var temp = graph.ungroupCells();
587 if (graph.model.contains(cells[i]))
589 if (graph.model.getChildCount(cells[i]) == 0 &&
590 graph.model.isVertex(cells[i]))
592 graph.setCellStyles('container', '0', [cells[i]]);
602 graph.model.endUpdate();
607 graph.setSelectionCells(temp);
613 if (graph.isEnabled())
615 var cells = graph.getSelectionCells();
624 if (!graph.isTableRow(cells[i]) &&
625 !graph.isTableCell(cells[i]))
631 graph.removeCellsFromParent(temp);
638 if (graph.isEnabled())
640 graph.startEditingAtCell();
645 var cell = graph.getSelectionCell() || graph.getModel().getRoot();
650 var cell = graph.getSelectionCell();
652 if (graph.isEnabled() && cell != null && graph.isCellEditable(cell))
679 graph.setTooltipForCell(cell, newValue);
687 var link = graph.getLinkForCell(graph.getSelectionCell());
691 graph.openLink(link);
696 var cell = graph.getSelectionCell();
698 if (graph.isEnabled() && cell != null && graph.isCellEditable(cell))
700 var value = graph.getLinkForCell(cell) || '';
705 graph.setLinkForCell(cell, (link.length > 0) ? link : null);
706 graph.setAttributeForCell(cell, 'linkTarget', linkTarget);
707 }, true, graph.getLinkTargetForCell(cell));
712 if (graph.isEnabled() && !graph.isCellLocked(graph.getDefaultParent()))
714 graph.clearSelection();
720 if (graph.isEnabled() && !graph.isCellLocked(graph.getDefaultParent()))
729 var title = graph.getLinkTitle(link);
749 … var pt = graph.getCenterInsertPoint(graph.getBoundingBoxFromGeometry([linkCell], true));
753 graph.setAttributeForCell(linkCell, 'linkTarget', linkTarget);
754 graph.setLinkForCell(linkCell, link);
755 graph.cellSizeUpdated(linkCell, true);
757 graph.getModel().beginUpdate();
760 linkCell = graph.addCell(linkCell);
761 graph.fireEvent(new mxEventObject('cellsInserted', 'cells', [linkCell]));
765 graph.getModel().endUpdate();
768 graph.setSelectionCell(linkCell);
769 graph.scrollCellToVisible(graph.getSelectionCell());
776 if (graph.isEnabled())
778 if (graph.cellEditor.isContentEditing())
780 var elt = graph.getSelectedElement();
781 var link = graph.getParentByName(elt, 'A', graph.cellEditor.textarea);
804 graph.selectNode(link);
807 var selState = graph.cellEditor.saveSelection();
811 graph.cellEditor.restoreSelection(selState);
815 graph.insertLink(value);
819 else if (graph.isSelectionEmpty())
831 var cells = graph.getSelectionCells();
835 graph.getModel().beginUpdate();
842 if (graph.getModel().getChildCount(cell) > 0)
844 graph.updateGroupBounds([cell], 0, true);
848 graph.updateCellSize(cell);
854 graph.getModel().endUpdate();
860 graph.stopEditing();
862 var style = graph.getCommonStyle(graph.getSelectionCells());
865 graph.getModel().beginUpdate();
868 var cells = graph.getEditableCells(graph.getSelectionCells());
872 state = graph.getView().getState(cells[i]);
880 var label = graph.convertValueToString(state.cell);
891 temp.innerHTML = graph.sanitizeHtml(label);
894 graph.cellLabelChanged(state.cell, label);
895 graph.setCellStyles('html', value, [cells[i]]);
900 var label = mxUtils.htmlEntities(graph.convertValueToString(state.cell), false);
909 graph.cellLabelChanged(state.cell, graph.sanitizeHtml(label));
910 graph.setCellStyles('html', value, [cells[i]]);
920 graph.getModel().endUpdate();
925 var state = graph.getView().getState(graph.getSelectionCell());
928 graph.stopEditing();
935 graph.setCellStyles(mxConstants.STYLE_WHITE_SPACE, value);
940 var state = graph.getView().getState(graph.getSelectionCell());
951 graph.setCellStyles(mxConstants.STYLE_ROTATION, newValue);
961 graph.zoomTo(1);
966 if (graph.isFastZoomEnabled())
968 graph.lazyZoom(true, true, ui.buttonZoomDelay);
972 graph.zoomIn();
977 if (graph.isFastZoomEnabled())
979 graph.lazyZoom(false, true, ui.buttonZoomDelay);
983 graph.zoomOut();
988 var bounds = (graph.isSelectionEmpty()) ? graph.getGraphBounds() :
989 graph.getBoundingBox(graph.getSelectionCells())
990 var t = graph.view.translate;
991 var s = graph.view.scale;
998 if (graph.backgroundImage != null)
1002 graph.backgroundImage.width,
1003 graph.backgroundImage.height));
1008 graph.zoomTo(1);
1023 graph.fitWindow(bounds);
1028 if (!graph.pageVisible)
1033 var fmt = graph.pageFormat;
1034 var ps = graph.pageScale;
1035 var cw = graph.container.clientWidth - 10;
1036 var ch = graph.container.clientHeight - 10;
1038 graph.zoomTo(scale);
1040 if (mxUtils.hasScrollbars(graph.container))
1042 var pad = graph.getPagePadding();
1043 graph.container.scrollTop = pad.y * graph.view.scale - 1;
1044graph.container.scrollLeft = Math.min(pad.x * graph.view.scale, (graph.container.scrollWidth - gra…
1049 if (!graph.pageVisible)
1054 var fmt = graph.pageFormat;
1055 var ps = graph.pageScale;
1056 var cw = graph.container.clientWidth - 10;
1057 var ch = graph.container.clientHeight - 10;
1060 graph.zoomTo(scale);
1062 if (mxUtils.hasScrollbars(graph.container))
1064 var pad = graph.getPagePadding();
1065graph.container.scrollTop = Math.min(pad.y, (graph.container.scrollHeight - graph.container.client…
1066graph.container.scrollLeft = Math.min(pad.x, (graph.container.scrollWidth - graph.container.client…
1071 if (!graph.pageVisible)
1076 var fmt = graph.pageFormat;
1077 var ps = graph.pageScale;
1078 var cw = graph.container.clientWidth - 10;
1081 graph.zoomTo(scale);
1083 if (mxUtils.hasScrollbars(graph.container))
1085 var pad = graph.getPagePadding();
1086 graph.container.scrollLeft = Math.min(pad.x * graph.view.scale,
1087 (graph.container.scrollWidth - graph.container.clientWidth) / 2);
1092 …var dlg = new FilenameDialog(this.editorUi, parseInt(graph.getView().getScale() * 100), mxResource…
1098 graph.zoomTo(val / 100);
1106 …var dlg = new FilenameDialog(this.editorUi, parseInt(graph.pageScale * 100), mxResources.get('appl…
1116 graph.model.execute(change);
1127 graph.setGridEnabled(!graph.isGridEnabled());
1128 graph.defaultGridEnabled = graph.isGridEnabled();
1132 action.setSelectedCallback(function() { return graph.isGridEnabled(); });
1137 graph.graphHandler.guidesEnabled = !graph.graphHandler.guidesEnabled;
1141 action.setSelectedCallback(function() { return graph.graphHandler.guidesEnabled; });
1146 graph.tooltipHandler.setEnabled(!graph.tooltipHandler.isEnabled());
1150 action.setSelectedCallback(function() { return graph.tooltipHandler.isEnabled(); });
1157 change.foldingEnabled = !graph.foldingEnabled;
1159 graph.model.execute(change);
1162 action.setSelectedCallback(function() { return graph.foldingEnabled; });
1169 action.setSelectedCallback(function() { return graph.scrollbars; });
1172 ui.setPageVisible(!graph.pageVisible);
1175 action.setSelectedCallback(function() { return graph.pageVisible; });
1178 graph.connectionArrowsEnabled = !graph.connectionArrowsEnabled;
1182 action.setSelectedCallback(function() { return graph.connectionArrowsEnabled; });
1185 graph.setConnectable(!graph.connectionHandler.isEnabled());
1189 action.setSelectedCallback(function() { return graph.connectionHandler.isEnabled(); });
1192 graph.connectionHandler.setCreateTarget(!graph.connectionHandler.isCreateTarget());
1196 action.setSelectedCallback(function() { return graph.connectionHandler.isCreateTarget(); });
1217 graph.openLink(RESOURCES_PATH + '/help' + ext + '.html');
1240 if (fn != null && graph.cellEditor.isContentEditing())
1246 graph.stopEditing(false);
1248 graph.getModel().beginUpdate();
1251 var cells = graph.getEditableCells(graph.getSelectionCells());
1252 graph.toggleCellStyleFlags(mxConstants.STYLE_FONTSTYLE, style, cells);
1257 graph.updateLabelElements(cells, function(elt)
1263 graph.replaceElement(elt);
1269 graph.updateLabelElements(cells, function(elt)
1275 graph.replaceElement(elt);
1281 graph.updateLabelElements(cells, function(elt)
1287 graph.replaceElement(elt);
1294 if (graph.model.getChildCount(cells[i]) == 0)
1296 graph.autoSizeCell(cells[i], false);
1302 graph.getModel().endUpdate();
1325 graph.getModel().beginUpdate();
1328 graph.setCellStyles(mxConstants.STYLE_DASHED, null);
1329 graph.setCellStyles(mxConstants.STYLE_DASH_PATTERN, null);
1331 'values', [null, null], 'cells', graph.getSelectionCells()));
1335 graph.getModel().endUpdate();
1340 graph.getModel().beginUpdate();
1343 graph.setCellStyles(mxConstants.STYLE_DASHED, '1');
1344 graph.setCellStyles(mxConstants.STYLE_DASH_PATTERN, null);
1346 'values', ['1', null], 'cells', graph.getSelectionCells()));
1350 graph.getModel().endUpdate();
1355 graph.getModel().beginUpdate();
1358 graph.setCellStyles(mxConstants.STYLE_DASHED, '1');
1359 graph.setCellStyles(mxConstants.STYLE_DASH_PATTERN, '1 4');
1361 'values', ['1', '1 4'], 'cells', graph.getSelectionCells()));
1365 graph.getModel().endUpdate();
1370 graph.getModel().beginUpdate();
1373 graph.setCellStyles(mxConstants.STYLE_ROUNDED, '0');
1374 graph.setCellStyles(mxConstants.STYLE_CURVED, '0');
1376 'values', ['0', '0'], 'cells', graph.getSelectionCells()));
1380 graph.getModel().endUpdate();
1385 graph.getModel().beginUpdate();
1388 graph.setCellStyles(mxConstants.STYLE_ROUNDED, '1');
1389 graph.setCellStyles(mxConstants.STYLE_CURVED, '0');
1391 'values', ['1', '0'], 'cells', graph.getSelectionCells()));
1395 graph.getModel().endUpdate();
1400 if (!graph.isSelectionEmpty() && graph.isEnabled())
1402 graph.getModel().beginUpdate();
1405 var cells = graph.getSelectionCells();
1406 var style = graph.getCurrentCellStyle(cells[0]);
1409 graph.setCellStyles(mxConstants.STYLE_ROUNDED, value);
1410 graph.setCellStyles(mxConstants.STYLE_CURVED, null);
1412 'values', [value, '0'], 'cells', graph.getSelectionCells()));
1416 graph.getModel().endUpdate();
1422 graph.getModel().beginUpdate();
1425 graph.setCellStyles(mxConstants.STYLE_ROUNDED, '0');
1426 graph.setCellStyles(mxConstants.STYLE_CURVED, '1');
1428 'values', ['0', '1'], 'cells', graph.getSelectionCells()));
1432 graph.getModel().endUpdate();
1437 var state = graph.view.getState(graph.getSelectionCell());
1440 if (state != null && graph.getFoldingImage(state) != null)
1445 graph.setCellStyles('collapsible', value);
1447 'values', [value], 'cells', graph.getSelectionCells()));
1451 var cells = graph.getEditableCells(graph.getSelectionCells());
1455 var model = graph.getModel();
1462 graph.setCellStyle(mxUtils.trim(newValue), cells);
1471 if (graph.isEnabled() && !graph.isSelectionEmpty())
1473 ui.setDefaultStyle(graph.getSelectionCell());
1478 if (graph.isEnabled())
1485 var cell = graph.getSelectionCell();
1487 if (cell != null && graph.getModel().isEdge(cell))
1489 var handler = editor.graph.selectionCellsHandler.getHandler(cell);
1493 var t = graph.view.translate;
1494 var s = graph.view.scale;
1498 var parent = graph.getModel().getParent(cell);
1499 var pgeo = graph.getCellGeometry(parent);
1501 while (graph.getModel().isVertex(parent) && pgeo != null)
1506 parent = graph.getModel().getParent(parent);
1507 pgeo = graph.getCellGeometry(parent);
1510 var x = Math.round(graph.snap(graph.popupMenuHandler.triggerX / s - dx));
1511 var y = Math.round(graph.snap(graph.popupMenuHandler.triggerY / s - dy));
1532 var cells = graph.getSelectionCells();
1536 cells = graph.getEditableCells(graph.addAllEdges(cells));
1538 graph.getModel().beginUpdate();
1545 if (graph.getModel().isEdge(cell))
1547 var geo = graph.getCellGeometry(cell);
1552 graph.setCellStyles(mxConstants.STYLE_EXIT_X, null, [cell]);
1553 graph.setCellStyles(mxConstants.STYLE_EXIT_Y, null, [cell]);
1554 graph.setCellStyles(mxConstants.STYLE_ENTRY_X, null, [cell]);
1555 graph.setCellStyles(mxConstants.STYLE_ENTRY_Y, null, [cell]);
1564 graph.getModel().setGeometry(cell, geo);
1571 graph.getModel().endUpdate();
1577 if (graph.cellEditor.isContentEditing())
1584 if (graph.cellEditor.isContentEditing())
1591 if (graph.isEnabled() && !graph.isCellLocked(graph.getDefaultParent()))
1594 var state = graph.getView().getState(graph.getSelectionCell());
1602 var selectionState = graph.cellEditor.saveSelection();
1607 if (graph.cellEditor.isContentEditing())
1609 graph.cellEditor.restoreSelection(selectionState);
1610 graph.insertImage(newValue, w, h);
1614 var cells = graph.getSelectionCells();
1620 graph.getModel().beginUpdate();
1626 cells = [graph.insertVertex(graph.getDefaultParent(), null, '', 0, 0, w, h,
1628 var pt = graph.getCenterInsertPoint(graph.getBoundingBoxFromGeometry(cells, true));
1633 graph.fireEvent(new mxEventObject('cellsInserted', 'cells', select));
1636graph.setCellStyles(mxConstants.STYLE_IMAGE, (newValue.length > 0) ? newValue : null, cells);
1639 var style = graph.getCurrentCellStyle(cells[0]);
1643 graph.setCellStyles(mxConstants.STYLE_SHAPE, 'image', cells);
1647 graph.setCellStyles(mxConstants.STYLE_SHAPE, null, cells);
1650 if (graph.getSelectionCount() == 1)
1655 var geo = graph.getModel().getGeometry(cell);
1662 graph.getModel().setGeometry(cell, geo);
1669 graph.getModel().endUpdate();
1674 graph.setSelectionCells(select);
1675 graph.scrollCellToVisible(select[0]);
1679 }, graph.cellEditor.isContentEditing(), !graph.cellEditor.isContentEditing());