Examples of GraphicElement


Examples of org.jboss.dashboard.ui.resources.GraphicElement

            protected void txFragment(Session session) throws Exception {
                FlushMode oldFlushMode = session.getFlushMode();
                session.setFlushMode(FlushMode.NEVER);
                List dbItems = session.createQuery("from " + classToHandle.getName() + " as element").list();
                for (int i = 0; i < dbItems.size(); i++) {
                    GraphicElement element = (GraphicElement) dbItems.get(i);
                    //element.deploy();
                    log.debug("Loaded db item " + element.getId());
                    elements.add(element);
                }
                session.setFlushMode(oldFlushMode);
            }
        };
View Full Code Here

Examples of org.jboss.dashboard.ui.resources.GraphicElement

    /**
     * Deploys an element (zip file). Deployment consists in creating or updating it in database
     */
    protected void deployZippedElement(File zipFile, String elementId) throws Exception {
        log.debug("Deploying " + classToHandleName + " " + zipFile);
        final GraphicElement existingElement = getElement(elementId, null, null, null);
        log.debug("Existing element with id " + elementId + " = " + existingElement);
        if (existingElement != null) {
            log.debug("Updating file " + zipFile + ". (Already deployed in db)");
            existingElement.setZipFile(zipFile);
            existingElement.setLastModified(new Date());
        } else {
            log.info("Deploying to database " + classToHandleName + " " + zipFile);
            Constructor c = classToHandle.getConstructor(new Class[]{String.class, File.class});
            final GraphicElement element = (GraphicElement) c.newInstance(new Object[]{elementId, zipFile});

            HibernateTxFragment txFragment = new HibernateTxFragment() {
                protected void txFragment(Session session) throws Exception {
                    element.setLastModified(new Date());
                    session.save(element);
                }
            };

            txFragment.execute();
View Full Code Here

Examples of org.jboss.dashboard.ui.resources.GraphicElement

     */
    public GraphicElement[] getElements(String workspaceId) {
        List l = new ArrayList();
        GraphicElement[] sortedElements = getElements();
        for (int i = 0; i < sortedElements.length; i++) {
            GraphicElement element = (GraphicElement) sortedElements[i];
            if (hasSameValue(element.getWorkspaceId(), workspaceId))
                l.add(element);
        }
        log.debug("Elements with workspace=" + workspaceId + ": " + l.size());
        return (GraphicElement[]) l.toArray(new GraphicElement[l.size()]);
    }
View Full Code Here

Examples of org.jboss.dashboard.ui.resources.GraphicElement

     */
    public GraphicElement[] getElements(String workspaceId, Long sectionId) {
        List l = new ArrayList();
        GraphicElement[] sortedElements = getElements(workspaceId);
        for (int i = 0; i < sortedElements.length; i++) {
            GraphicElement element = (GraphicElement) sortedElements[i];
            if (hasSameValue(element.getSectionId(), sectionId))
                l.add(element);
        }
        log.debug("Elements with workspace=" + workspaceId + ", section=" + sectionId + ": " + l.size());
        return (GraphicElement[]) l.toArray(new GraphicElement[l.size()]);
    }
View Full Code Here

Examples of org.jboss.dashboard.ui.resources.GraphicElement

     */
    public GraphicElement[] getElements(String workspaceId, Long sectionId, Long panelId) {
        List l = new ArrayList();
        GraphicElement[] sortedElements = getElements(workspaceId, sectionId);
        for (int i = 0; i < sortedElements.length; i++) {
            GraphicElement element = (GraphicElement) sortedElements[i];
            if (hasSameValue(element.getPanelId(), panelId))
                l.add(element);
        }
        log.debug("Elements with workspace=" + workspaceId + ", section=" + sectionId + ", panel=" + panelId + ": " + l.size());
        return (GraphicElement[]) l.toArray(new GraphicElement[l.size()]);
    }
View Full Code Here

Examples of org.jboss.dashboard.ui.resources.GraphicElement

        log.debug("Getting available elements in context (" + workspaceId + ", " + sectionId + ", " + panelId + ")");
        List elementsToReturn = new ArrayList();
        Set elementIds = new HashSet();
        GraphicElement[] panelElements = getElements(workspaceId, sectionId, panelId);
        for (int i = 0; i < panelElements.length; i++) {
            GraphicElement element = panelElements[i];
            elementsToReturn.add(element);
            elementIds.add(element.getId());
        }
        GraphicElement[] sectionElements = getElements(workspaceId, sectionId, null);
        for (int i = 0; i < sectionElements.length; i++) {
            GraphicElement element = sectionElements[i];
            if (elementIds.contains(element.getId()))
                continue;
            elementsToReturn.add(element);
            elementIds.add(element.getId());
        }
        GraphicElement[] instanceElements = getElements(workspaceId, null, panelId);
        for (int i = 0; i < instanceElements.length; i++) {
            GraphicElement element = instanceElements[i];
            if (elementIds.contains(element.getId()))
                continue;
            elementsToReturn.add(element);
            elementIds.add(element.getId());
        }
        GraphicElement[] workspaceElements = getElements(workspaceId, null, null);
        for (int i = 0; i < workspaceElements.length; i++) {
            GraphicElement element = workspaceElements[i];
            if (elementIds.contains(element.getId()))
                continue;
            elementsToReturn.add(element);
            elementIds.add(element.getId());
        }
        GraphicElement[] globalElements = getElements(null);
        for (int i = 0; i < globalElements.length; i++) {
            GraphicElement element = globalElements[i];
            if (elementIds.contains(element.getId()))
                continue;
            elementsToReturn.add(element);
            elementIds.add(element.getId());
        }

        GraphicElement[] elementsArray = (GraphicElement[]) elementsToReturn.toArray(new GraphicElement[]{});
        Arrays.sort(elementsArray);
        if (log.isDebugEnabled()) {
            ArrayList l = new ArrayList();
            for (int i = 0; i < elementsArray.length; i++) {
                GraphicElement element = elementsArray[i];
                l.add(element.getDbid());
            }
            log.debug("Got available elements in context (" + workspaceId + ", " + sectionId + ", " + panelId + "): " + l);
        }
        return elementsArray;
    }
View Full Code Here

Examples of org.jboss.dashboard.ui.resources.GraphicElement

        } else if (workspaceId != null && sectionId == null & panelId == null) {
            GraphicElement[] workspaceGlobalElements = getElements(workspaceId, null, null);
            Set usedIds = new HashSet();
            //Workspace global elements
            for (int i = 0; i < workspaceGlobalElements.length; i++) {
                GraphicElement element = workspaceGlobalElements[i];
                usedIds.add(element.getId());
                elementsToReturn.add(element);
            }
            //Global elements with different id
            GraphicElement[] globalElements = getElements(null);
            for (int i = 0; i < globalElements.length; i++) {
                GraphicElement element = globalElements[i];
                if (usedIds.contains(element.getId()))
                    continue;
                elementsToReturn.add(element);
            }
            //Workspace non-global elements
            GraphicElement[] workspaceElements = getElements(workspaceId);
            for (int i = 0; i < workspaceElements.length; i++) {
                GraphicElement element = workspaceElements[i];
                if (element.getSectionId() == null && element.getPanelId() == null)
                    continue;
                usedIds.add(element.getId());
                elementsToReturn.add(element);
            }
        } else if (workspaceId != null && sectionId != null & panelId == null) {
            //All elements defined for this section, plus workspace base elements, plus base elements with different id.
            Set usedIds = new HashSet();
            GraphicElement[] sectionElements = getElements(workspaceId, sectionId);
            for (int i = 0; i < sectionElements.length; i++) {
                GraphicElement element = sectionElements[i];
                usedIds.add(element.getId());
                elementsToReturn.add(element);
            }
            GraphicElement[] workspaceElements = getElements(workspaceId, null, null);
            for (int i = 0; i < workspaceElements.length; i++) {
                GraphicElement element = workspaceElements[i];
                if (usedIds.contains(element.getId()))
                    continue;
                usedIds.add(element.getId());
                elementsToReturn.add(element);
            }
            GraphicElement[] globalElements = getElements(null);
            for (int i = 0; i < globalElements.length; i++) {
                GraphicElement element = globalElements[i];
                if (usedIds.contains(element.getId()))
                    continue;
                usedIds.add(element.getId());
                elementsToReturn.add(element);
            }
        } else if (workspaceId != null && sectionId != null & panelId != null) {
            //All elements defined for this panel, plus workspace base elements, plus base elements with different id.
            Set usedIds = new HashSet();

            GraphicElement[] panelElements = getElements(workspaceId, sectionId, panelId);
            for (int i = 0; i < panelElements.length; i++) {
                GraphicElement element = panelElements[i];
                usedIds.add(element.getId());
                elementsToReturn.add(element);
            }
            GraphicElement[] sectionElements = getElements(workspaceId, sectionId, null);
            for (int i = 0; i < sectionElements.length; i++) {
                GraphicElement element = sectionElements[i];
                if (usedIds.contains(element.getId()))
                    continue;
                usedIds.add(element.getId());
                elementsToReturn.add(element);
            }
            GraphicElement[] instanceElements = getElements(workspaceId, null, panelId);
            for (int i = 0; i < instanceElements.length; i++) {
                GraphicElement element = instanceElements[i];
                if (usedIds.contains(element.getId()))
                    continue;
                usedIds.add(element.getId());
                elementsToReturn.add(element);
            }
            GraphicElement[] workspaceElements = getElements(workspaceId, null, null);
            for (int i = 0; i < workspaceElements.length; i++) {
                GraphicElement element = workspaceElements[i];
                if (usedIds.contains(element.getId()))
                    continue;
                usedIds.add(element.getId());
                elementsToReturn.add(element);
            }
            GraphicElement[] globalElements = getElements(null);
            for (int i = 0; i < globalElements.length; i++) {
                GraphicElement element = globalElements[i];
                if (usedIds.contains(element.getId()))
                    continue;
                usedIds.add(element.getId());
                elementsToReturn.add(element);
            }
        }

        GraphicElement[] elementsArray = (GraphicElement[]) elementsToReturn.toArray(new GraphicElement[]{});
View Full Code Here

Examples of org.jboss.dashboard.ui.resources.GraphicElement

     * Assume current workspace, section and panel.
     */
    public GraphicElement getAvailableElement(String id) {
        GraphicElement[] elements = getAvailableElements();
        for (int i = 0; i < elements.length; i++) {
            GraphicElement element = elements[i];
            if (element.getId().equals(id))
                return element;
        }
        return null;
    }
View Full Code Here

Examples of org.jboss.dashboard.ui.resources.GraphicElement

    /**
     * Get an element by dbid.
     */
    public GraphicElement getElementByDbid(String dbid) {
        for (int i = 0; i < elements.size(); i++) {
            GraphicElement element = (GraphicElement) elements.get(i);
            if (element.getDbid().toString().equals(dbid))
                return element;
        }
        return null;
    }
View Full Code Here

Examples of org.jboss.dashboard.ui.resources.GraphicElement

     * Returns an element by its id and context.
     */
    public GraphicElement getElement(String id, String workspaceId, Long sectionId, Long panelId) {
        GraphicElement[] contextElements = getElements(workspaceId, sectionId, panelId);
        for (int i = 0; i < contextElements.length; i++) {
            GraphicElement element = contextElements[i];
            if (element.getId().equals(id))
                return element;
        }
        return null;
    }
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.