Skip to content

Commit

Permalink
JBPM-8263 - Handle missing SVG image (#1306)
Browse files Browse the repository at this point in the history
  • Loading branch information
cristianonicolai committed Feb 28, 2019
1 parent c32dd32 commit e41ebbe
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
Expand Up @@ -64,7 +64,7 @@ public void displayImage(final String svgContent, final String containerId) {
}

public void expandDiagramContainer() {
view.expandDiagramContanier();
view.expandDiagramContainer();
}

@WorkbenchPartTitle
Expand Down
Expand Up @@ -23,7 +23,7 @@
public interface ProcessDiagramWidgetView extends HasBusyIndicator,
IsWidget {

void expandDiagramContanier();
void expandDiagramContainer();

void displayImage(String svgContent);

Expand Down
Expand Up @@ -187,7 +187,7 @@ public void hideBusyIndicator() {
}

@Override
public void expandDiagramContanier() {
public void expandDiagramContainer() {
diagramContainerDiv.classList.remove("col-md-10");
diagramContainerDiv.classList.add("col-md-12");
}
Expand Down
Expand Up @@ -148,7 +148,7 @@ public void onProcessNodeChange(@ForEvent("change") Event e) {
public void hideNodeActions() {
nodeActionsPanel.classList.remove("col-md-2");
nodeActionsPanel.classList.add("hidden");
diagram.expandDiagramContanier();
diagram.expandDiagramContainer();
}

@Override
Expand Down Expand Up @@ -181,7 +181,13 @@ protected void renderBadges() {

final D3 d3 = D3.Builder.get();

final D3 svg = d3.select("#processDiagramDiv svg");
final D3.Selection svg = d3.select("#processDiagramDiv svg");

if(svg.empty()){
//Couldn't find SVG element
return;
}

final D3.DOMRect svgRect = svg.node().getBoundingClientRect();
if(svgRect.getWidth() == 0 && svgRect.getHeight() == 0){
//SVG not visible
Expand Down

0 comments on commit e41ebbe

Please sign in to comment.