/**
  * Calculate the border for the widget with assume that the widget is connected.
  *
  * @return the border.
  */
 public Border calculateBorder() {
   return BorderFactory.createBorder(
       getWidgetModel().getBorderStyle(),
       getWidgetModel().getBorderWidth(),
       getWidgetModel().getBorderColor(),
       getWidgetModel().getName());
 }
  /**
   * initialize the figure
   *
   * @param figure
   */
  protected void initFigure(final IFigure figure) {
    if (figure == null)
      throw new IllegalArgumentException("Editpart does not provide a figure!"); // $NON-NLS-1$
    Set<String> allPropIds = getWidgetModel().getAllPropertyIDs();
    if (allPropIds.contains(AbstractWidgetModel.PROP_COLOR_BACKGROUND))
      figure.setBackgroundColor(
          CustomMediaFactory.getInstance().getColor(getWidgetModel().getBackgroundColor()));

    if (allPropIds.contains(AbstractWidgetModel.PROP_COLOR_FOREGROUND))
      figure.setForegroundColor(
          CustomMediaFactory.getInstance().getColor(getWidgetModel().getForegroundColor()));

    if (allPropIds.contains(AbstractWidgetModel.PROP_FONT))
      figure.setFont(getWidgetModel().getFont().getSWTFont());

    if (allPropIds.contains(AbstractWidgetModel.PROP_VISIBLE))
      figure.setVisible(
          getExecutionMode() == ExecutionMode.RUN_MODE ? getWidgetModel().isVisible() : true);

    if (allPropIds.contains(AbstractWidgetModel.PROP_ENABLED))
      figure.setEnabled(getWidgetModel().isEnabled());

    if (allPropIds.contains(AbstractWidgetModel.PROP_WIDTH)
        && allPropIds.contains(AbstractWidgetModel.PROP_HEIGHT))
      figure.setSize(getWidgetModel().getSize());

    if (allPropIds.contains(AbstractWidgetModel.PROP_BORDER_COLOR)
        && allPropIds.contains(AbstractWidgetModel.PROP_BORDER_STYLE)
        && allPropIds.contains(AbstractWidgetModel.PROP_BORDER_WIDTH))
      figure.setBorder(
          BorderFactory.createBorder(
              getWidgetModel().getBorderStyle(),
              getWidgetModel().getBorderWidth(),
              getWidgetModel().getBorderColor(),
              getWidgetModel().getName()));

    if (allPropIds.contains(AbstractWidgetModel.PROP_TOOLTIP)) {
      if (!getWidgetModel().getTooltip().equals("")) { // $NON-NLS-1$
        tooltipLabel = new TooltipLabel(getWidgetModel());
        figure.setToolTip(tooltipLabel);
      }
    }
  }