Package org.apache.wicket.util.value

Examples of org.apache.wicket.util.value.Count


    // If the application wants component uses checked and
    // the response is not a redirect
    final IDebugSettings debugSettings = Application.get().getDebugSettings();
    if (debugSettings.getComponentUseCheck() && !getResponse().isRedirect())
    {
      final Count unrenderedComponents = new Count();
      final List unrenderedAutoComponents = new ArrayList();
      final StringBuffer buffer = new StringBuffer();
      renderedContainer.visitChildren(new IVisitor()
      {
        public Object component(final Component component)
        {
          // If component never rendered
          if (renderedComponents == null || !renderedComponents.contains(component))
          {
            // If auto component ...
            if (component.isAuto())
            {
              // Add to list of unrendered auto components to
              // delete below
              unrenderedAutoComponents.add(component);
            }
            else if (component.isVisibleInHierarchy())
            {
              // Increase number of unrendered components
              unrenderedComponents.increment();

              // Add to explanatory string to buffer
              buffer.append(Integer.toString(unrenderedComponents.getCount()) + ". "
                  + component + "\n");
            }
            else
            {
              // if the component is not visible in hierarchy we
              // should not visit its children since they are also
              // not visible
              return CONTINUE_TRAVERSAL_BUT_DONT_GO_DEEPER;
            }
          }
          return CONTINUE_TRAVERSAL;
        }
      });

      // Remove any unrendered auto components since versioning couldn't
      // do it. We can't remove the component in the above visitChildren
      // callback because we're traversing the list at that time.
      for (int i = 0; i < unrenderedAutoComponents.size(); i++)
      {
        ((Component)unrenderedAutoComponents.get(i)).remove();
      }

      // Throw exception if any errors were found
      if (unrenderedComponents.getCount() > 0)
      {
        // Get rid of set
        renderedComponents = null;

        // Throw exception
View Full Code Here


    // If the application wants component uses checked and
    // the response is not a redirect
    final IDebugSettings debugSettings = Application.get().getDebugSettings();
    if (debugSettings.getComponentUseCheck() && !getResponse().isRedirect())
    {
      final Count unrenderedComponents = new Count();
      final List unrenderedAutoComponents = new ArrayList();
      final StringBuffer buffer = new StringBuffer();
      renderedContainer.visitChildren(new IVisitor()
      {
        public Object component(final Component component)
        {
          // If component never rendered
          if (renderedComponents == null || !renderedComponents.contains(component))
          {
            // If auto component ...
            if (component.isAuto())
            {
              // Add to list of unrendered auto components to
              // delete below
              unrenderedAutoComponents.add(component);
            }
            else if (component.isVisibleInHierarchy())
            {
              // Increase number of unrendered components
              unrenderedComponents.increment();

              // Add to explanatory string to buffer
              buffer.append(Integer.toString(unrenderedComponents.getCount()) + ". " +
                  component + "\n");
              String metadata = (String)component
                  .getMetaData(Component.CONSTRUCTED_AT_KEY);
              if (metadata != null)
              {
                buffer.append(metadata);
              }
              metadata = (String)component.getMetaData(Component.ADDED_AT_KEY);
              if (metadata != null)
              {
                buffer.append(metadata);
              }
            }
            else
            {
              // if the component is not visible in hierarchy we
              // should not visit its children since they are also
              // not visible
              return CONTINUE_TRAVERSAL_BUT_DONT_GO_DEEPER;
            }
          }
          return CONTINUE_TRAVERSAL;
        }
      });

      // Remove any unrendered auto components since versioning couldn't
      // do it. We can't remove the component in the above visitChildren
      // callback because we're traversing the list at that time.
      for (int i = 0; i < unrenderedAutoComponents.size(); i++)
      {
        ((Component)unrenderedAutoComponents.get(i)).remove();
      }

      // Throw exception if any errors were found
      if (unrenderedComponents.getCount() > 0)
      {
        // Get rid of set
        renderedComponents = null;

        // Throw exception
View Full Code Here

TOP

Related Classes of org.apache.wicket.util.value.Count

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.