full style refresh of Sirius diagram elements [message #1783435] |
Tue, 13 March 2018 06:53 |
jingjing wang Messages: 28 Registered: July 2017 |
Junior Member |
|
|
Hi
We find that there is a time-consuming process in the diagram refresh operation. When editing in a diagram which has sevral thousands elements, such as creating an new elment, DDiagramSynchronizer.refreshOperation() will refresh all elements style in the diagram. The code fragment of element style refresh show in the below:
private void handleKeptNodes(final DragAndDropTarget viewContainer, final SetIntersection<AbstractDNodeCandidate> status, Collection<AbstractDNode> keptNodes, boolean border,
IProgressMonitor monitor) {
final Iterable<AbstractDNodeCandidate> keptNodeCandidates = status.getKeptElements();
try {
monitor.beginTask(Messages.DDiagramSynchronizer_refreshNodesMsg, Iterables.size(keptNodeCandidates));
for (final AbstractDNodeCandidate keptCandidate : keptNodeCandidates) {
handleKeptNode(viewContainer, keptCandidate, keptNodes, border, new SubProgressMonitor(monitor, 1));
} } finally {
monitor.done();
}
}
private AbstractDNode handleKeptNode(final DragAndDropTarget viewContainer, AbstractDNodeCandidate keptCandidate, final Collection<AbstractDNode> keptNodes, boolean border,
IProgressMonitor monitor) {
/* The element is already here. */
AbstractDNode keptNode = keptCandidate.getOriginalElement();
try {
monitor.beginTask(Messages.DDiagramSynchronizer_nodeRefreshMsg, 3);
final AbstractNodeMapping nodeMapping = keptCandidate.getMapping();
if (keptNode instanceof DDiagramElementContainer && nodeMapping instanceof ContainerMapping) {
final ContainerMapping keptNodeMapping = (ContainerMapping) nodeMapping;
/* handle list attribute change on mapping */
keptNode = handleListAttributeChangeOnMapping(keptNode, keptNodeMapping, viewContainer, new SubProgressMonitor(monitor, 1));
if (keptNode instanceof DNodeContainer) {
DNodeContainer dnc = (DNodeContainer) keptNode;
ContainerLayout childrenPresentation = keptNodeMapping.getChildrenPresentation();
if (dnc.getChildrenPresentation() != childrenPresentation) {
dnc.setChildrenPresentation(childrenPresentation);
}
}
} else if (!border && viewContainer instanceof DDiagramElementContainer && nodeMapping instanceof NodeMapping) {
/* Handle list attribute change on container mapping */
keptNode = handleListAttributeChangeOnContainerMapping(keptNode, nodeMapping, (DDiagramElementContainer) viewContainer, new SubProgressMonitor(monitor, 1));
}
this.sync.refresh(keptNode);
monitor.worked(1);
this.sync.refreshStyle(keptNode, nodeMapping);
monitor.worked(1); keptNodes.add(keptNode);
} finally {
monitor.done();
}
return keptNode;
}
So we want to know why refresh all elements style in the diagram even if just modifying one element in the diagram. Maybe just refresh the modified diagram element style is OK, this can also improve editing feedback speed in large diagram.
So if anyone can give your help, and answer it? Thank you very much! I'm waiting for your answer.
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02962 seconds