Ejemplo n.º 1
0
  /**
   * This method sets the property theme for the component.
   *
   * @param theme The theme to use.
   */
  public void setTheme(String theme) {

    Props pr = getPage().getPageProperties();

    _headingBackgroundColor = pr.getThemeProperty(theme, Props.CAL_HEADING_BACKGROUND_COLOR);
    _headingForegroundColor = pr.getThemeProperty(theme, Props.CAL_HEADING_FOREGROUND_COLOR);
    _weekBackgroundColor = pr.getThemeProperty(theme, Props.CAL_WEEK_BACKGROUND_COLOR);
    _weekForegroundColor = pr.getThemeProperty(theme, Props.CAL_WEEK_FOREGROUND_COLOR);
    _dayBackgroundColor = pr.getThemeProperty(theme, Props.CAL_DAY_BACKGROUND_COLOR);
    _dayForegroundDeemphisis = pr.getThemeProperty(theme, Props.CAL_DAY_FOREGROUND_DEEMPHISIS);
    _dayForegroundNormal = pr.getThemeProperty(theme, Props.CAL_DAY_FOREGROUND_NORMAL);
    _dayForegroundCurrent = pr.getThemeProperty(theme, Props.CAL_DAY_FOREGROUND_CURRENT);
    _fontFace = pr.getThemeProperty(theme, Props.CAL_FONT_FACE);

    String ft = pr.getThemeProperty(theme, Props.CAL_FONT_LARGE);
    if (ft != null) {
      if (ft.endsWith("pt")) {
        _fontSizeUnit = FONT_SIZE_IN_POINTS;
        _largeFontSize = Integer.parseInt(ft.substring(0, ft.length() - 2));
      } else if (ft.endsWith("px")) {
        _fontSizeUnit = FONT_SIZE_IN_PIXELS;
        _largeFontSize = Integer.parseInt(ft.substring(0, ft.length() - 2));
      } else {
        _largeFontSize = Integer.parseInt(ft);
      }
    }

    ft = pr.getThemeProperty(theme, Props.CAL_FONT_SMALL);
    if (ft != null) {
      if (ft.endsWith("pt")) {
        _fontSizeUnit = FONT_SIZE_IN_POINTS;
        _smallFontSize = Integer.parseInt(ft.substring(0, ft.length() - 2));
      } else if (ft.endsWith("px")) {
        _fontSizeUnit = FONT_SIZE_IN_PIXELS;
        _smallFontSize = Integer.parseInt(ft.substring(0, ft.length() - 2));
      } else {
        _smallFontSize = Integer.parseInt(ft);
      }
    }

    _theme = theme;
  }