
package de.ivu.elect.presentation;

import java.io.Serializable;

import javax.inject.Inject;
import javax.inject.Named;

import de.ivu.elect.jee.presentation.AjaxHelper;

@Named(LayoutComponents.COMPONENT_NAME)
public class LayoutComponents implements Serializable {

  private static final long serialVersionUID = 1L;

  public static final boolean EXPERIMENTAL__FEATURE_TOGGLE__CALENDAR_SIDEBAR = Boolean.TRUE.toString().equalsIgnoreCase(System.getProperty("enable.calendar.mock"));

  public static final String COMPONENT_NAME = "layoutComponents";

  public static final String CTN_CONTENT_ID = "ctnContent";

  public static final String CTN_MESSAGES_ID = AjaxHelper.GLOBAL_MESSAGES_ID;

  public static final String CTN_MESSAGES_DEFERRED_ID = AjaxHelper.GLOBAL_MESSAGES_DEFERRED_ID;

  public static final String CTN_PAGE_CONTENT_HEADER_ID = "ctnPageContentHeader";

  public static final String CTN_PAGE_CONTENT_ID = "ctnPageContent";

  public static final String CTN_PAGE_CONTENT_CENTER_ID = "ctnPageContentCenter";

  public static final String MAIN_MENU = "frmMainMenu";

  public static final String HEADER_SUBCONTEXT = "lblSubcontextContent";

  @Inject
  private transient AjaxHelper ajaxHelper;

  public LayoutComponents() {
    super();
  }

  protected LayoutComponents(AjaxHelper ajaxHelper) {
    super();

    this.ajaxHelper = ajaxHelper;
  }

  public boolean isExperimentalFeatureToggleCalendarSidebar() {
    return EXPERIMENTAL__FEATURE_TOGGLE__CALENDAR_SIDEBAR;
  }

  public String getCtnContentId() {
    return CTN_CONTENT_ID;
  }

  public String getCtnMessagesId() {
    return CTN_MESSAGES_ID;
  }

  public String getCtnMessagesDeferredId() {
    return CTN_MESSAGES_DEFERRED_ID;
  }

  public String getCtnPageContentHeaderId() {
    return CTN_PAGE_CONTENT_HEADER_ID;
  }

  public String getCtnPageContentId() {
    return CTN_PAGE_CONTENT_ID;
  }

  public String getCtnPageContentCenterId() {
    return CTN_PAGE_CONTENT_CENTER_ID;
  }

  public String showDialog(String widgetVar) {
    return ajaxHelper.createOpenDialogStatement(widgetVar);
  }

  public String hideDialog(String widgetVar) {
    return ajaxHelper.createCloseDialogStatement(widgetVar);
  }

  public String generateBlockUiWidgetVar(String targetId) {
    return ajaxHelper.createBlockUiWidgetVar(targetId);
  }

  public String showBlockUi(String widgetVar) {
    return ajaxHelper.createOpenBlockUiStatement(widgetVar);
  }

  public String hideBlockUi(String widgetVar) {
    return ajaxHelper.createCloseBlockUiStatement(widgetVar);
  }

  public boolean isEditHintsOnTop(){
    return true;
  }
}
