Examples of TabTemplate


Examples of org.eurekastreams.server.domain.TabTemplate

     */

    public Gadget undeleteGadget(final long gadgetId) throws GadgetUndeletionException
    {
        // make sure the gadget exists in the input tab
        TabTemplate template = null;
        try
        {
            template = getTabTemplateByGadgetId(gadgetId, true);
        }
        catch (Exception ex)
        {
            throw new GadgetUndeletionException("Could not find either the specified gadget or tab for gadgetId="
                    + gadgetId, gadgetId);
        }

        /* get the deleted gadget from the database */
        Gadget gadgetToUndelete = (Gadget) entityManager.createQuery(
                "from Gadget where id = :gadgetId and deleted = true").setParameter("gadgetId", gadgetId)
                .getSingleResult();

        if (gadgetToUndelete == null)
        {
            throw new GadgetUndeletionException("Failure when trying to get gadget with id=" + gadgetId, gadgetId);
        }

        try
        {
            /*
             * bump up the zone index of each gadget in the same zone as the gadget to be undeleted
             */
            for (Gadget currentGadget : template.getGadgets())
            {

                if (currentGadget.getZoneNumber() == gadgetToUndelete.getZoneNumber()
                        && currentGadget.getZoneIndex() >= gadgetToUndelete.getZoneIndex())
                {
                    currentGadget.setZoneIndex(currentGadget.getZoneIndex() + 1);
                }
            }

            /* add the gadget back into the collection */
            template.getGadgets().add(gadgetToUndelete);

            /* update the status of the undeleted gadget in the database */
            entityManager.createQuery(
                    "update versioned Gadget set deleted = false, " + "dateDeleted = null, tabTemplateId = :tabId "
                            + "where id = :gadgetId").setParameter("gadgetId", gadgetToUndelete.getId()).setParameter(
                    "tabId", template.getId()).executeUpdate();

            return gadgetToUndelete;
        }
        catch (Exception ex)
        {
View Full Code Here

Examples of org.eurekastreams.server.domain.TabTemplate

                    {
                        // if criteria has tab template specified add it to results.
                        if (mc.getGalleryTabTemplate() != null)
                        {
                            // These tabs create their own templates based on other templates.
                            tabTemplateResults.add(new TabTemplate(mc.getGalleryTabTemplate().getTabTemplate()));
                        }

                        // set theme.
                        themeResult = mc.getTheme();
                    }
View Full Code Here

Examples of org.eurekastreams.server.domain.TabTemplate

     *
     * @return New TabTemplate instance with default name and layout.
     */
    private TabTemplate getDefaultTabTemplate()
    {
        return new TabTemplate(defaultTabName, defaultTabLayout);
    }
View Full Code Here

Examples of org.eurekastreams.server.domain.TabTemplate

        Long targetTabId = request.getCurrentTabId();
        Long gadgetId = request.getGadgetId();
        Integer targetZoneNumber = request.getTargetZoneNumber();
        Integer targetZoneIndex = request.getTargetZoneIndex();

        TabTemplate sourceTemplate = tabMapper.findByGadgetId(gadgetId);

        Tab destinationTab = tabMapper.findById(targetTabId);

        // Ensure that the destination tab exists.
        if (destinationTab == null)
        {
            vex.addError("invalidTab", "Destination zone does not exist.");
            throw vex;
        }

        TabTemplate destinationTemplate = destinationTab.getTemplate();
        Layout destinationLayout = destinationTemplate.getTabLayout();

        // Save the Source and Destination TabTemplate to state so they can be reused in execution.
        inActionContext.getState().put("destinationTemplate", destinationTemplate);
        inActionContext.getState().put("sourceTemplate", sourceTemplate);

        // Destination zone is within the valid number of destination zones.
        if (targetZoneNumber + 1 > destinationLayout.getNumberOfZones())
        {
            vex.addError("invalidZone", "ReorderGadgetAction told to move a gadget to a nonexistent zone.");
            throw vex;
        }

        // Ensure that the gadget to be moved exists.
        if (sourceTemplate == null)
        {
            vex.addError("invalidGadget", "Gadget to be moved is invalid.");
            throw vex;
        }

        // Create a map of the zonenumbers and a list of the corresponding zone indexes.
        HashMap<Integer, List<Integer>> gadgetZoneIndexes = new HashMap<Integer, List<Integer>>();
        for (Gadget currentGadget : destinationTemplate.getGadgets())
        {
            if (gadgetZoneIndexes.containsKey(currentGadget.getZoneNumber()))
            {
                gadgetZoneIndexes.get(currentGadget.getZoneNumber()).add(currentGadget.getZoneIndex());
            }
View Full Code Here

Examples of org.eurekastreams.server.domain.TabTemplate

                .getId()));

        GalleryTabTemplate gtt = (GalleryTabTemplate) findById.execute(new FindByIdRequest("GalleryTabTemplate",
                (Long) inActionContext.getParams()));

        TabTemplate newTabTemplate = new TabTemplate(gtt.getTabTemplate());
        newTabTemplate.setGalleryTabTemplate(gtt);
        for (Gadget gadget : newTabTemplate.getGadgets())
        {
            gadget.setOwner(currentUser);
        }

        currentUser.getStartTabGroup().addTab(new Tab(newTabTemplate));
View Full Code Here

Examples of org.eurekastreams.server.domain.TabTemplate

        {
            // look up source tab by id.
            Tab tab = findTabByIdMapper.execute(new FindByIdRequest("Tab", tabId));

            // create new tabTemplate from source.
            TabTemplate newTabTemplate = new TabTemplate(tab.getTemplate());

            gtt.setTabTemplate(newTabTemplate);
            gtt.setTitle(newTabTemplate.getTabName());
        }

        // get/create the category and set it.
        GalleryItemCategory galleryItemCategory = galleryItemCategoryMapper.findByName(GalleryItemType.TAB, category);
        gtt.setCategory(galleryItemCategory);
View Full Code Here

Examples of org.eurekastreams.server.domain.TabTemplate

        Integer targetZoneNumber = request.getTargetZoneNumber();
        Integer targetZoneIndex = request.getTargetZoneIndex();

        try
        {
            TabTemplate sourceTemplate;
            // Look to the state bag first then retrieve by mapper.
            if (inActionContext.getState().get("sourceTemplate") != null)
            {
                sourceTemplate = (TabTemplate) inActionContext.getState().get("sourceTemplate");
            }
            else
            {
                sourceTemplate = tabMapper.findByGadgetId(gadgetId);
            }

            TabTemplate destinationTemplate;
            // Look to the state bag first then retrieve by mapper.
            if (inActionContext.getState().get("destinationTemplate") != null)
            {
                destinationTemplate = (TabTemplate) inActionContext.getState().get("destinationTemplate");
            }
            else
            {
                Tab destinationTab = tabMapper.findById(targetTabId);
                destinationTemplate = destinationTab.getTemplate();
            }

            List<Gadget> gadgets = sourceTemplate.getGadgets();

            Gadget gadget = findTargetGadget(gadgets, gadgetId);

            int oldZoneNumber = gadget.getZoneNumber();
            int oldZoneIndex = gadget.getZoneIndex();

            if (log.isDebugEnabled())
            {
                log.debug("old tabId, zoneNumber and zoneIndex: " + sourceTemplate.getId() + ", " + oldZoneNumber
                        + ", " + oldZoneIndex);
            }

            tabMapper.moveGadget(gadget.getId(), sourceTemplate.getId(), oldZoneIndex, oldZoneNumber,
                    destinationTemplate.getId(), targetZoneIndex, targetZoneNumber);

            deleteKeysMapper.execute(Collections.singleton(CacheKeys.PERSON_PAGE_PROPERTIES_BY_ID
                    + inActionContext.getPrincipal().getId()));

            return tabMapper.findById(targetTabId);
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.