Package org.apache.tapestry.vlib

Examples of org.apache.tapestry.vlib.Visit


    {

        IRequestCycle cycle = newCycle();
        IEngine engine = newEngine();
        IErrorProperty page = newPage();
        Visit visit = (Visit) newMock(Visit.class);

        trainGetEngine(cycle, engine);

        trainGetVisit(engine, visit);

        visit.isUserLoggedIn();
        setReturnValue(visit, true);

        trainGetPage(cycle, "MyLibrary", page);

        page.setError("An error.");
View Full Code Here


        }

        if (isInError())
            return;

        Visit visit = getVisitState();

        Integer userId = visit.getUserId();
        VirtualLibraryEngine vengine = (VirtualLibraryEngine) getEngine();

        attributes.put("ownerId", userId);
        attributes.put("holderId", userId);
View Full Code Here

        String email = person.getEmail();

        // Get the visit object; this will likely force the
        // creation of the visit object and an HttpSession.

        Visit visit = getVisitState();
        visit.setUser(person);

        // After logging in, go to the Home page, unless otherwise
        // specified.

        ICallback callback = getCallback();
View Full Code Here

     * {@link org.apache.tapestry.valid.ValidField} components.
     */

    public void activate()
    {
        Visit visit = getVisitState();
        VirtualLibraryEngine vengine = (VirtualLibraryEngine) getRequestCycle().getEngine();

        Integer userId = visit.getUserId();
        Map attributes = null;

        int i = 0;
        while (true)
        {
View Full Code Here

            }

            attributes.put("password", password1);
        }

        Visit visit = getVisitState();
        VirtualLibraryEngine vengine = (VirtualLibraryEngine) cycle.getEngine();
        Integer userId = visit.getUserId();

        int i = 0;
        while (true)
        {
            try
View Full Code Here

    @Message
    public abstract String borrowedBook(String title);

    public boolean isLinkDisabled()
    {
        Visit visit = getVisit();

        if (!visit.isUserLoggedIn())
            return true;

        // If the user is logged in, they can borrow it if they are
        // not already holding it and aren't the owner.

        Book book = getBook();

        // If the book is not lendable, then disable the link.

        if (!book.isLendable())
            return true;

        // Otherwise, disabled the link if already holding it.

        return visit.isLoggedInUser(book.getHolderId());
    }
View Full Code Here

        return visit.isLoggedInUser(book.getHolderId());
    }

    public IPage borrow(final IRequestCycle cycle, final Integer bookId)
    {
        final Visit visit = getVisit();
        final Home home = getHome();

        RemoteCallback callback = new RemoteCallback()
        {
            public Object remoteCallback() throws RemoteException
            {
                try
                {
                    Book book = getOperations().borrowBook(bookId, visit.getUserId());

                    home.setMessage(borrowedBook(book.getTitle()));

                    return null;
                }
View Full Code Here

    {
        IEngine engine = cycle.getEngine();

        String pageName = "Home";
        // Get, but don't create, the visit.
        Visit visit = (Visit) engine.getVisit();

        if (visit != null && visit.isUserLoggedIn())
            pageName = "MyLibrary";

        IErrorProperty page = (IErrorProperty) cycle.getPage(pageName);

        page.setError(message);
View Full Code Here

    }

    private IPropertySelectionModel buildPersonModel()
    {
        VirtualLibraryEngine vengine = (VirtualLibraryEngine) getEngine();
        Visit visit = (Visit) vengine.getVisit();
        Integer userPK = visit.getUserId();

        Person[] persons = null;

        int i = 0;
        while (true)
View Full Code Here

    }

    private IPropertySelectionModel buildBooksModel()
    {
        VirtualLibraryEngine vengine = (VirtualLibraryEngine) getEngine();
        Visit visit = (Visit) vengine.getVisit();
        Integer userPK = visit.getUserId();
        Book[] books = null;

        int i = 0;
        while (true)
        {
View Full Code Here

TOP

Related Classes of org.apache.tapestry.vlib.Visit

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.