/**
   * Sets the display strategy
   *
   * @param strategyType the {@link Type} of strategy to be used
   * @param displayDate if not null then this value will be used as a reference for calculating the
   *     interval start
   */
  public void setDisplayStrategy(final Type strategyType, final Date displayDate) {

    final DisplayStrategy strategy = DisplayStrategyFactory.getStrategy(contentPane, strategyType);
    contentPane.setStrategy(strategy);
    if (displayDate != null) {
      setSelectedDay(displayDate);
    }
  }
  /** @param date */
  public void setSelectedDay(final Date date) {
    selectedDay = CalendarUtil.getCalendar(date, true);
    final DisplayStrategy strategy = contentPane.getStrategy();
    strategy.setIntervalStart(date);
    headerPane.getIntervalLabel().setText(strategy.getDisplayInterval());
    final IntervalChangedEvent event =
        new IntervalChangedEvent(
            JCalendar.this,
            strategy.getType(),
            config.getIntervalStart().getTime(),
            config.getIntervalEnd().getTime());

    for (final IntervalChangedListener listener : intervalChangedListener) {
      listener.intervalChanged(event);
    }
  }
  /** Initializes the GUI */
  private void initGui() {
    this.setBackground(Color.white);
    headerPane = new HeaderPanel(this);
    contentPane = new ContentPanel(this);

    headerPane.getIntervalLabel().setText(contentPane.getStrategy().getDisplayInterval());
    this.setLayout(new GridBagLayout());
    final GridBagConstraints c = new GridBagConstraints();
    c.gridx = 0;
    c.gridy = 0;
    c.weightx = 1;
    c.fill = GridBagConstraints.BOTH;
    add(headerPane, c);
    c.gridx = 0;
    c.gridy = 1;
    c.weighty = 0.9;
    c.insets = new Insets(10, 10, 10, 10);
    add(contentPane, c);
  }
 /**
  * Gets the current display strategy.
  *
  * @return {@link Type}
  */
 public DisplayStrategy.Type getDisplayStrategy() {
   return contentPane.getStrategy().getType();
 }