Package fr.soleil.salsa.entity

Examples of fr.soleil.salsa.entity.IEntity


     * @return An {@link ITreeNode}
     */
    public static ITreeNode getDuplicata(ITreeNode node, boolean recursive) {
        ITreeNode duplicata = null;
        if ((node != null) && (node.getData() instanceof IEntity)) {
            IEntity copyEntity = getDuplicata((IEntity) node.getData(), null, recursive);
            duplicata = buildNode(copyEntity, recursive);
            if (duplicata != null && copyEntity != null) {
                duplicata.setName(copyEntity.getName());
                duplicata.setImage(node.getImage());
            }
        }
        return duplicata;
    }
View Full Code Here


     *            Whether to recursively duplicate copy (i.e.: duplicate its
     *            children, grand children, etc...)
     * @return An {@link IEntity}
     */
    private static IEntity getDuplicata(IEntity entity, IDirectory parent, boolean recursive) {
        IEntity duplicata = null;
        if (entity instanceof IConfig<?>) {
            ConfigSerializer configSerializer = new ConfigSerializer();
            IConfig<?> copyConfig = configSerializer.cloneConfig((IConfig<?>) entity);
            copyConfig.setModified(true);
            duplicata = copyConfig;
        } else if (entity instanceof IDirectory) {
            IDirectory directory = (IDirectory) entity;
            IDirectory copyDirectory = new DirectoryModel();
            if (recursive) {
                List<IConfig<?>> configList = new ArrayList<IConfig<?>>();
                for (IConfig<?> config : directory.getConfigList()) {
                    configList.add((IConfig<?>) getDuplicata(config, copyDirectory, recursive));
                }
                copyDirectory.setConfigList(configList);
                List<IDirectory> subDirectoriesList = new ArrayList<IDirectory>();
                for (IDirectory dir : directory.getSubDirectoriesList()) {
                    subDirectoriesList.add((IDirectory) getDuplicata(dir, copyDirectory, recursive));
                }
                copyDirectory.setSubDirectoriesList(subDirectoriesList);
            }
            duplicata = copyDirectory;
        }
        if (duplicata != null && entity != null) {
            duplicata.setName(entity.getName() + "_copy");
            duplicata.setPositionInDirectory(entity.getPositionInDirectory());
            duplicata.setId(null);
            duplicata.setDirectory(parent);
        }
        return duplicata;
    }
View Full Code Here

        if (getModel() != null) {
            for (Object child : selection) {
                if (child instanceof DefaultMutableTreeNode) {
                    ITreeNode node = getModel().getTreeNode((DefaultMutableTreeNode) child);
                    if (node.getData() instanceof IEntity) {
                        IEntity entity = (IEntity) node.getData();
                        if (entity.getDirectory() != null) {
                            nodes.add(node);
                        }
                    }
                }
            }
View Full Code Here

                if (path != null) {
                    DefaultMutableTreeNode node = (DefaultMutableTreeNode) path.getLastPathComponent();
                    String configPath = extractCompletePath(node);
                    ITreeNode treeNode = configTree.getModel().getTreeNode(node);
                    if (treeNode.getData() instanceof IEntity) {
                        IEntity entity = (IEntity) treeNode.getData();
                        String entityName = askRenameEntityName(entity.getClass(), treeNode.getName());
                        if (entityName != null) {
                            // updating node name will generate an event, that
                            // will make the source
                            // save the entity with an updated name
                            treeNode.setName(entityName);
View Full Code Here

                if (path != null) {
                    DefaultMutableTreeNode node = (DefaultMutableTreeNode) path.getLastPathComponent();
                    String configPath = extractCompletePath(node);
                    ITreeNode treeNode = configTree.getModel().getTreeNode(node);
                    if (treeNode.getData() instanceof IEntity) {
                        IEntity entity = (IEntity) treeNode.getData();
                        String entityName = askRenameEntityName(entity.getClass(), treeNode.getName());
                        if (entityName != null) {
                            // updating node name will generate an event, that
                            // will make the source
                            // save the entity with an updated name
                            treeNode.setName(entityName);
View Full Code Here

        if (getModel() != null) {
            for (Object child : selection) {
                if (child instanceof DefaultMutableTreeNode) {
                    ITreeNode node = getModel().getTreeNode((DefaultMutableTreeNode) child);
                    if (node.getData() instanceof IEntity) {
                        IEntity entity = (IEntity) node.getData();
                        if (entity.getDirectory() != null) {
                            nodes.add(node);
                        }
                    }
                }
            }
View Full Code Here

TOP

Related Classes of fr.soleil.salsa.entity.IEntity

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.