private SidePanelSection createConceptGraphArcsSidePanelSection(
      ViewContentDisplay contentDisplay) {

    assert ((DropEnabledViewContentDisplay) contentDisplay).getDelegate() instanceof Graph
        : "invalid content display type " + contentDisplay;

    Graph graphViewContentDisplay =
        (Graph) ((DropEnabledViewContentDisplay) contentDisplay).getDelegate();

    VerticalPanel panel = new VerticalPanel();
    Iterable<ArcItemContainer> arcItemContainers = graphViewContentDisplay.getArcItemContainers();
    for (final ArcItemContainer arcItemContainer : arcItemContainers) {
      String arcTypeId = arcItemContainer.getArcType().getArcTypeID();
      String label = "unknown";
      if (DirectConceptMappingArcType.ID.equals(arcTypeId)) {
        label = "Mapping Relationship";
        panel.add(createArcTypeContainerControl(label, arcItemContainer));
      } else if (MappingArcType.ID.equals(arcTypeId)) {
        label = "Mapping";

        // disabled the options to edit the style of the arcs of the
        // Mapping Nodes - likely to be permanent
        // panel.add(createArcTypeContainerControl(label,
        // arcItemContainer));
      } else if (ConceptArcType.ID.equals(arcTypeId)) {
        label = "Is-A Relationship";
        panel.add(createArcTypeContainerControl(label, arcItemContainer));
      } else if (CompositionArcType.ID.equals(arcTypeId)) {
        label = "Part-Of Relationship";
        panel.add(createArcTypeContainerControl(label, arcItemContainer));
      }
    }

    return new SidePanelSection("Arcs", panel);
  }
  private SidePanelSection createOntologyGraphArcsSidePanelSection(
      ViewContentDisplay contentDisplay) {

    assert ((DropEnabledViewContentDisplay) contentDisplay).getDelegate() instanceof Graph
        : "invalid content display type " + contentDisplay;

    Graph graphViewContentDisplay =
        (Graph) ((DropEnabledViewContentDisplay) contentDisplay).getDelegate();

    VerticalPanel panel = new VerticalPanel();
    Iterable<ArcItemContainer> arcItemContainers = graphViewContentDisplay.getArcItemContainers();
    for (final ArcItemContainer arcItemContainer : arcItemContainers) {
      String arcTypeId = arcItemContainer.getArcType().getArcTypeID();
      String label = "unknown";
      if (OntologyMappingArcType.ID.equals(arcTypeId)) {
        label = "Ontology Mapping";
        panel.add(createArcTypeContainerControl(label, arcItemContainer));
      }
    }

    return new SidePanelSection("Arcs", panel);
  }
  // TODO extract & move
  private VerticalPanel createArcTypeContainerControl(
      String label, final ArcItemContainer arcItemContainer) {

    final TextBox arcColorText = new TextBox();
    arcColorText.setText(arcItemContainer.getArcColor());

    final ListBox arcStyleDropDown = new ListBox();
    arcStyleDropDown.setVisibleItemCount(1);
    arcStyleDropDown.addItem(ArcSettings.ARC_STYLE_SOLID);
    arcStyleDropDown.addItem(ArcSettings.ARC_STYLE_DASHED);
    arcStyleDropDown.addItem(ArcSettings.ARC_STYLE_DOTTED);
    String arcStyle = arcItemContainer.getArcStyle();
    if (ArcSettings.ARC_STYLE_DOTTED.equals(arcStyle)) {
      arcStyleDropDown.setSelectedIndex(2);
    } else if (ArcSettings.ARC_STYLE_DASHED.equals(arcStyle)) {
      arcStyleDropDown.setSelectedIndex(1);
    } else {
      arcStyleDropDown.setSelectedIndex(0);
    }

    final ListBox arcHeadDropDown = new ListBox();
    arcHeadDropDown.setVisibleItemCount(1);
    arcHeadDropDown.addItem(ArcSettings.ARC_HEAD_NONE);
    arcHeadDropDown.addItem(ArcSettings.ARC_HEAD_TRIANGLE_EMPTY);
    arcHeadDropDown.addItem(ArcSettings.ARC_HEAD_TRIANGLE_FULL);
    String arcHead = arcItemContainer.getArcHead();
    if (ArcSettings.ARC_HEAD_TRIANGLE_FULL.equals(arcHead)) {
      arcHeadDropDown.setSelectedIndex(2);
    } else if (ArcSettings.ARC_HEAD_TRIANGLE_EMPTY.equals(arcHead)) {
      arcHeadDropDown.setSelectedIndex(1);
    } else if (ArcSettings.ARC_HEAD_NONE.equals(arcHead)) {
      arcHeadDropDown.setSelectedIndex(0);
    }

    final String defaultEntry = "Default";
    final ListBox arcThicknessDropDown = new ListBox();
    arcThicknessDropDown.setVisibleItemCount(1);
    arcThicknessDropDown.addItem(defaultEntry);
    arcThicknessDropDown.addItem("1");
    arcThicknessDropDown.addItem("2");
    arcThicknessDropDown.addItem("3");
    arcThicknessDropDown.addItem("4");
    arcThicknessDropDown.addItem("5");
    arcThicknessDropDown.setSelectedIndex(0);

    final Button updateButton = new Button("Update Arcs");
    updateButton.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            arcItemContainer.setArcColor(arcColorText.getText());
            arcItemContainer.setArcStyle(
                arcStyleDropDown.getItemText(arcStyleDropDown.getSelectedIndex()));

            String selectedThicknessText =
                arcThicknessDropDown.getItemText(arcThicknessDropDown.getSelectedIndex());
            if (selectedThicknessText.equals(defaultEntry)) {
              arcItemContainer.setArcThicknessLevel(0);
            } else {
              arcItemContainer.setArcThicknessLevel(Integer.parseInt(selectedThicknessText));
            }

            arcItemContainer.setArcHead(
                arcHeadDropDown.getItemText(arcHeadDropDown.getSelectedIndex()));
          }
        });

    final CheckBox visibleCheckBox = new CheckBox("Arcs Visible");
    visibleCheckBox.setValue(true);
    visibleCheckBox.addValueChangeHandler(
        new ValueChangeHandler<Boolean>() {
          @Override
          public void onValueChange(ValueChangeEvent<Boolean> event) {
            boolean value = visibleCheckBox.getValue();
            updateButton.setEnabled(value);
            arcStyleDropDown.setEnabled(value);
            arcHeadDropDown.setEnabled(value);
            arcThicknessDropDown.setEnabled(value);
            arcColorText.setEnabled(value);
            arcItemContainer.setVisible(value);
          }
        });

    VerticalPanel containerPanel = new VerticalPanel();

    containerPanel.add(new Label(label));
    containerPanel.add(visibleCheckBox);
    containerPanel.add(new Label("Arc Color"));
    containerPanel.add(arcColorText);
    containerPanel.add(new Label("Arc Style"));
    containerPanel.add(arcStyleDropDown);
    containerPanel.add(new Label("Arc Head"));
    containerPanel.add(arcHeadDropDown);
    containerPanel.add(new Label("Arc Thickness"));
    containerPanel.add(arcThicknessDropDown);
    containerPanel.add(updateButton);

    // Handler runs and removes itself internally.
    @SuppressWarnings("unused")
    Handler handler =
        new Handler() {
          private HandlerRegistration register = arcColorText.addAttachHandler(this);

          @Override
          public void onAttachOrDetach(AttachEvent event) {
            $(arcColorText).as(Enhance).colorBox(ColorPickerType.SIMPLE);
            // Only want this run once, so let's do a trick to remove it.
            register.removeHandler();
          }
        };

    return containerPanel;
  }