@Override
  protected void refresh() {
    checkStyle();

    String mapPath = style.mapPath;
    if (mapPath == null) {
      mapPath = "";
    }
    File mapFile = new File(mapPath);
    String mName = null;
    if (mapFile.exists()) {
      mName = mapFile.getName();
    }
    if (mName == null) mName = "";
    mapNameLabel.setText(mName);

    fontColour.setColorValue(
        new RGB(style.fontColor.getRed(), style.fontColor.getGreen(), style.fontColor.getBlue()));
    foregroundColor.setColorValue(
        new RGB(
            style.foregroundColor.getRed(),
            style.foregroundColor.getGreen(),
            style.foregroundColor.getBlue()));
    backgroundColour.setColorValue(
        new RGB(
            style.backgroundColor.getRed(),
            style.backgroundColor.getGreen(),
            style.backgroundColor.getBlue()));

    if (style.titleString == null) style.titleString = " ";
    titleText.setText(style.titleString);

    xposText.setText(Integer.toString(style.xPos));
    yposText.setText(Integer.toString(style.yPos));
    legWidthText.setText(Integer.toString(style.legendWidth));
    legHeightText.setText(Integer.toString(style.legendHeight));
    boxWidthText.setText(Integer.toString(style.boxWidth));
    forgroundAlphaText.setText(Integer.toString(style.fAlpha));
    backgroundAlphaText.setText(Integer.toString(style.bAlpha));
    isroundedButton.setSelection(style.isRoundedRectangle);
  }
  private void updateBlackboard() {
    IMap activeMap = ApplicationGIS.getActiveMap();
    IBlackboard styleBlackboard = activeMap.getBlackboard();
    style = (RasterLegendStyle) styleBlackboard.get(RasterLegendStyleContent.ID);

    if (style == null) {
      style = RasterLegendStyleContent.createDefault();
      styleBlackboard.put(RasterLegendStyleContent.ID, style);
      // styleBlackboard.setSelected(new String[]{RasterLegendStyleContent.ID});
    }

    RGB bg = backgroundColour.getColorValue();
    try {
      int bAlpha = Integer.parseInt(backgroundAlphaText.getText());
      style.backgroundColor = new Color(bg.red, bg.green, bg.blue, bAlpha);
    } catch (Exception e) {
      style.backgroundColor = new Color(bg.red, bg.green, bg.blue);
    }
    bg = foregroundColor.getColorValue();
    try {
      int fAlpha = Integer.parseInt(forgroundAlphaText.getText());
      style.foregroundColor = new Color(bg.red, bg.green, bg.blue, fAlpha);
    } catch (Exception e) {
      style.foregroundColor = new Color(bg.red, bg.green, bg.blue);
    }
    bg = fontColour.getColorValue();
    style.fontColor = new Color(bg.red, bg.green, bg.blue);

    style.titleString = titleText.getText();
    style.xPos = Integer.parseInt(xposText.getText());
    style.yPos = Integer.parseInt(yposText.getText());
    style.legendHeight = Integer.parseInt(legHeightText.getText());
    style.legendWidth = Integer.parseInt(legWidthText.getText());
    style.boxWidth = Integer.parseInt(boxWidthText.getText());
    style.isRoundedRectangle = isroundedButton.getSelection();

    styleBlackboard.put(RasterLegendStyleContent.ID, style);
  }