Exemplo n.º 1
0
  /**
   * This method has been overridden to load a WComponent from parameters.
   *
   * @param httpServletRequest the servlet request being handled.
   * @return the top-level WComponent for this servlet.
   */
  @Override
  public synchronized WComponent getUI(final Object httpServletRequest) {
    String configuredUIClassName = Config.getInstance().getString(COMPONENT_TO_LAUNCH_PARAM_KEY);

    if (sharedUI == null || !Util.equals(configuredUIClassName, uiClassName)) {
      uiClassName = configuredUIClassName;
      WComponent ui = createUI();

      if (ui instanceof WApplication) {
        sharedUI = (WApplication) ui;
      } else {
        LOG.warn(
            "Top-level component should be a WApplication." + " Creating WApplication wrapper...");

        sharedUI = new WApplication();
        ui.setLocked(false);
        sharedUI.add(ui);
        sharedUI.setLocked(true);
      }

      if (Config.getInstance().getBoolean(SHOW_MEMORY_PROFILE_PARAM_KEY, false)) {
        ProfileContainer profiler = new ProfileContainer();

        sharedUI.setLocked(false);
        sharedUI.add(profiler);
        sharedUI.setLocked(true);
      }
    }

    return sharedUI;
  }
 /**
  * Indicates whether the given object is equal to this one.
  *
  * @param obj the object to test for equality.
  * @return true if the object is a TableEntry and has the same code as this one.
  */
 @Override
 public boolean equals(final Object obj) {
   return (obj instanceof TableEntry) && Util.equals(code, ((TableEntry) obj).code);
 }