Examples of IdAllocator


Examples of org.apache.tapestry.util.IdAllocator

public class TestIdAllocator extends TapestryTestCase
{

    public void testSimple()
    {
        IdAllocator a = new IdAllocator();

        assertEquals("name", a.allocateId("name"));

        for (int i = 0; i < 10; i++)
            assertEquals("name$" + i, a.allocateId("name"));
    }
View Full Code Here

Examples of org.apache.tapestry.util.IdAllocator

            assertEquals("name$" + i, a.allocateId("name"));
    }

    public void testDegenerate()
    {
        IdAllocator a = new IdAllocator();

        assertEquals("d$1", a.allocateId("d$1"));

        assertEquals("d", a.allocateId("d"));
        assertEquals("d$0", a.allocateId("d"));
        assertEquals("d$2", a.allocateId("d"));

        assertEquals("d$3", a.allocateId("d"));
        assertEquals("d$1$0", a.allocateId("d$1"));
    }
View Full Code Here

Examples of org.apache.tapestry.util.IdAllocator

        assertEquals("d$1$0", a.allocateId("d$1"));
    }

    public void testClear()
    {
        IdAllocator a = new IdAllocator();

        assertEquals("foo", a.allocateId("foo"));
        assertEquals("foo_0", a.allocateId("foo_0"));

        a.clear();

        assertEquals("foo", a.allocateId("foo"));
        assertEquals("foo_0", a.allocateId("foo_0"));
    }
View Full Code Here

Examples of org.apache.tapestry.util.IdAllocator

    /** @since 3.0 */

    public String getUniqueString(String baseValue)
    {
        if (_idAllocator == null)
            _idAllocator = new IdAllocator();

        return _idAllocator.allocateId(baseValue);
    }
View Full Code Here

Examples of org.apache.tapestry5.ioc.internal.util.IdAllocator

            {
                String uid = Long.toHexString(System.currentTimeMillis());

                String namespace = ":" + uid;

                IdAllocator idAllocator = new IdAllocator(namespace);

                PartialMarkupDocumentLinker linker = new PartialMarkupDocumentLinker();

                RenderSupportImpl support = new RenderSupportImpl(linker, symbolSource, assetSource,
                                                                  idAllocator);
View Full Code Here

Examples of org.apache.tapestry5.ioc.internal.util.IdAllocator

            {
                String uid = Long.toHexString(System.currentTimeMillis());

                String namespace = ":" + uid;

                IdAllocator idAllocator = new IdAllocator(namespace);

                DocumentLinker linker = environment.peekRequired(DocumentLinker.class);

                RenderSupportImpl support = new RenderSupportImpl(linker, symbolSource, assetSource,
                                                                  idAllocator);
View Full Code Here

Examples of org.apache.tapestry5.ioc.internal.util.IdAllocator

     *                     script link or script block
     */
    public RenderSupportImpl(DocumentLinker linker, SymbolSource symbolSource,
                             AssetSource assetSource, String... coreScripts)
    {
        this(linker, symbolSource, assetSource, new IdAllocator(), coreScripts);
    }
View Full Code Here

Examples of org.apache.tapestry5.ioc.internal.util.IdAllocator

                // RenderSupport's job).  It would be nice if we could agree on the uid, but
                // not essential.

                String uid = Long.toHexString(System.currentTimeMillis());

                IdAllocator idAllocator = new IdAllocator(":" + uid);

                clientId = renderSupport.allocateClientId(resources);

                reply.put("elementId", clientId);
View Full Code Here

Examples of org.apache.tapestry5.ioc.internal.util.IdAllocator

     * Constructor used when rendering.
     */
    public FormSupportImpl(String clientId, ComponentActionSink actionSink, ClientBehaviorSupport clientBehaviorSupport,
                           boolean clientValidationEnabled)
    {
        this(clientId, actionSink, clientBehaviorSupport, clientValidationEnabled, new IdAllocator());
    }
View Full Code Here

Examples of org.apache.tapestry5.ioc.internal.util.IdAllocator

            {
                String uid = Long.toHexString(System.currentTimeMillis());

                String namespace = ":" + uid;

                IdAllocator idAllocator = new IdAllocator(namespace);

                PartialMarkupDocumentLinker linker = new PartialMarkupDocumentLinker();

                RenderSupportImpl support = new RenderSupportImpl(linker, symbolSource, assetSource,
                                                                  idAllocator);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.