gt:       String componentId = getGEF().getComponentIdOfCurrentRequest();
context: /*
   * Copyright (C) 2000 - 2016 Silverpeas
   *
   * This program is free software: you can redistribute it and/or modify
   * it under the terms of the GNU Affero General Public License as
   * published by the Free Software Foundation, either version 3 of the
   * License, or (at your option) any later version.
   *
   * As a special exception to the terms and conditions of version 3.0 of
   * the GPL, you may redistribute this Program in connection with Free/Libre
   * Open Source Software ("FLOSS") applications as described in Silverpeas's
   * FLOSS exception.  You should have received a copy of the text describing
   * the FLOSS exception, and it is also available here:
   * "http://www.silverpeas.org/docs/core/legal/floss_exception.html"
   *
   * This program is distributed in the hope that it will be useful,
   * but WITHOUT ANY WARRANTY; without even the implied warranty of
   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   * GNU Affero General Public License for more details.
   *
   * You should have received a copy of the GNU Affero General Public License
   * along with this program.  If not, see <http://www.gnu.org/licenses/>.
   */
  
  package org.silverpeas.core.web.util.viewgenerator.html.window;
  
  import org.silverpeas.core.web.mvc.controller.MainSessionController;
  import org.silverpeas.core.util.URLUtil;
  import org.silverpeas.core.admin.component.model.ComponentInstLight;
  import org.apache.ecs.xhtml.script;
  import org.silverpeas.core.cache.service.CacheServiceProvider;
  import org.silverpeas.core.admin.service.OrganizationController;
  import org.silverpeas.core.admin.service.OrganizationControllerProvider;
  import org.silverpeas.core.util.LocalizationBundle;
  import org.silverpeas.core.util.ResourceLocator;
  import org.silverpeas.core.util.StringUtil;
  import org.silverpeas.core.template.SilverpeasTemplate;
  import org.silverpeas.core.template.SilverpeasTemplateFactory;
  import org.silverpeas.core.web.util.viewgenerator.html.GraphicElementFactory;
  import org.silverpeas.core.web.util.viewgenerator.html.browsebars.BrowseBar;
  import org.silverpeas.core.web.util.viewgenerator.html.operationpanes.OperationPane;
  import org.silverpeas.core.web.util.viewgenerator.html.operationpanes.OperationPaneType;
  
  /**
   * @author neysseri
   */
  public abstract class AbstractWindow implements Window {
  
    private BrowseBar browseBar = null;
    private OperationPane operationPane = null;
    private GraphicElementFactory gef = null;
    private String body = null;
    private String width = null;
    private boolean browserBarDisplayable = true;
    private boolean popup = false;
    String contextualDiv = null;
  
    /**
     * Constructor declaration
     * @see
     */
    public AbstractWindow() {
    }
  
    /**
     * Method declaration
     * @param gef
     * @see
     */
    @Override
    public void init(GraphicElementFactory gef) {
      this.gef = gef;
    }
  
    /**
     * Method declaration
     * @return
     * @see
     */
    public String getBody() {
      return this.body;
    }
  
    /**
     * Method declaration
     * @param body
     * @see
     */
    @Override
    public void addBody(String body) {
      this.body = body;
    }
  
    /**
     * Method declaration
     * @return
     * @see
     */
    public GraphicElementFactory getGEF() {
      return this.gef;
    }
  
    /**
     * Method declaration
     * @return
     * @see
     */
    public String getIconsPath() {
      return GraphicElementFactory.getIconsPath();
    }
  
    /**
     * Method declaration
     * @param width
     * @see
     */
    @Override
    public void setWidth(String width) {
      this.width = width;
    }
  
    /**
     * Method declaration
     * @return
     * @see
     */
    public String getWidth() {
      if (this.width == null) {
        this.width = "100%";
      }
      return this.width;
    }
  
    /**
     * Method declaration
     * @return
     * @see
     */
    @Override
    public OperationPane getOperationPane() {
      if (this.operationPane == null) {
        this.operationPane = getGEF().getOperationPane();
        if (!isPopup() &&
            ResourceLocator.getGeneralSettingBundle().getBoolean("AdminFromComponentEnable", true) &&
            StringUtil.isDefined(getGEF().getComponentIdOfCurrentRequest())) {
          addOperationToSetupComponent();
        }
      }
      return this.operationPane;
    }
  
    private void addOperationToSetupComponent() {
      MainSessionController msc = getGEF().getMainSessionController();
      OrganizationController organizationController =
          OrganizationControllerProvider.getOrganisationController();
      if (organizationController.isComponentManageable(getGEF().getComponentIdOfCurrentRequest(),
          msc.getUserId()) && getGEF().isComponentMainPage()) {
        String label = ResourceLocator.getGeneralLocalizationBundle(
            getGEF().getMultilang().getLocale().getLanguage())
                .getString("GML.operations.setupComponent");
        String url = URLUtil.getApplicationURL() + "/R" + URLUtil.CMP_JOBSTARTPAGEPEAS +
            "/jsp/SetupComponent?ComponentId=" + getGEF().getComponentIdOfCurrentRequest();
        this.operationPane.addOperation("useless", label, url);
        this.operationPane.addLine();
      }
    }
  
    /**
     * Method declaration
     * @return
     * @see
     */
    @Override
    public BrowseBar getBrowseBar() {
      if (this.browseBar == null) {
        this.browseBar = getGEF().getBrowseBar();
      }
      return this.browseBar;
    }
  
    public abstract String getContextualDiv();
  
    @Override
    public boolean isBrowseBarVisible() {
      return this.browserBarDisplayable;
    }
  
    @Override
    public void setBrowseBarVisibility(boolean browseBarVisible) {
      this.browserBarDisplayable = browseBarVisible;
    }
  
    @Override
    public boolean isPopup() {
      return popup;
    }
  
    @Override
    public void setPopup(boolean popup) {
      this.popup = popup;
    }
  
    private String getWelcomeMessage(ComponentInstLight component, String language) {
      String message = null;
      String fileName = null;
      try {
        fileName = "welcome_" + language;
        message = getSilverpeasTemplate().applyFileTemplateOnComponent(component.getName(), fileName);
      } catch (Exception e) {
  
      }
      if (!StringUtil.isDefined(message)) {
        return null;
      }
      StringBuilder sb = new StringBuilder(100);
      String title = getGEF().getMultilang().getString("GEF.welcome.title");
      sb.append("<div id=\"welcome-message\" title=\"").append(title)
          .append("\" style=\"display: none;\">\n");
      sb.append("<p>\n");
      sb.append(message);
      sb.append("</p>\n");
      sb.append("</div>\n");
      return sb.toString();
    }
  
    private SilverpeasTemplate getSilverpeasTemplate() {
      return SilverpeasTemplateFactory.createSilverpeasTemplateOnComponents();
    }
  
    private String getWelcomeMessageScript(ComponentInstLight component) {
      StringBuilder sb = new StringBuilder(100);
      sb.append("<script type=\"text/javascript\">\n");
      sb.append("var welcomeMessageAlreadyShown = false;\n");
      sb.append("$(function() {\n");
      sb.append("var welcomeMessageCookieName = \"Silverpeas_").append(component.getName())
          .append("_WelcomeMessage\";\n");
      sb
          .append("if (!welcomeMessageAlreadyShown && \"IKnowIt\" != $.cookie(welcomeMessageCookieName)) {\n");
      sb.append("if (!welcomeMessageAlreadyShown) {\n");
      sb.append("welcomeMessageAlreadyShown = true;\n");
      sb.append("$('#welcome-message').dialog({\n");
      sb.append("modal: true,\n");
      sb.append("resizable: false,\n");
      sb.append("width: 400,\n");
      sb.append("dialogClass: 'help-modal-message',\n");
      sb.append("buttons: {\n");
      sb.append("\"").append(getGEF().getMultilang().getString("GEF.welcome.button.ok"))
          .append("\": function() {\n");
      sb.append("$.cookie(welcomeMessageCookieName, \"IKnowIt\", { expires: 3650, path: '/' });\n");
      sb.append("$(this).dialog(\"close\");\n");
      sb.append(" }, \n");
      sb.append("\"").append(getGEF().getMultilang().getString("GEF.welcome.button.reminder"))
          .append("\": function() {\n");
      sb.append(" $(this).dialog(\"close\");\n");
      sb.append(" }\n");
      sb.append("}\n");
      sb.append("});\n");
      sb.append("}\n");
      sb.append("}\n");
      sb.append("}\n");
      sb.append(");\n");
      sb.append("</script>");
      return sb.toString();
    }
  
    public String displayWelcomeMessage() {
      if (getGEF().isComponentMainPage()) {
  