Package fr.soleil.salsa.entity

Examples of fr.soleil.salsa.entity.IConfig


        if (configName != null && !"".equals(configName.trim()) && this.rootDirectory != null
                && type != null) {
            if (currentDirectory == null) {
                currentDirectory = rootDirectory;
            }
            IConfig configModel = null;
            switch (type) {
                case SCAN_1D:
                    IConfig tmp = new Config1DImpl();
                    tmp.setScanAddOn(new ScanAddOnImp());
                    tmp.getScanAddOn().setDisplay(new DisplayImpl());
                    ((IConfig1D) tmp).setDimensionX(new Dimension1DImpl());

                    // Creates one range for a new 1D config.
                    IRange1D range1DToAdd = new Range1DImpl();
                    range1DToAdd.setDimension(((IConfig1D) tmp).getDimensionX());
                    range1DToAdd.setIntegrationTime(1.0);
                    range1DToAdd.setStepsNumber(1);
                    ((IConfig1D) tmp).getDimensionX().getRangesXList().add(range1DToAdd);
                    configModel = wrap(tmp);

                    break;
                case SCAN_2D:
                    IConfig tmp2d = new Config2DImpl();
                    tmp2d.setScanAddOn(new ScanAddOnImp());
                    tmp2d.getScanAddOn().setDisplay(new DisplayImpl());
                    ((IConfig2D) tmp2d).setDimensionX(new Dimension2DXImpl());

                    // Creates one X range for a new 2D config.
                    IRange2DX xRangeToAdd = new Range2DXImpl();
                    xRangeToAdd.setDimension(((IConfig2D) tmp2d).getDimensionX());
View Full Code Here


     */
    @Override
    public void notifySave() {
        List<ATreeNode> listSave = view.getMultipleSelection();
        filterMultipleSelection(listSave);
        IConfig saveConfig;
        IDirectory saveDirectory;
        for (ATreeNode saveNode : listSave) {
            if (saveNode instanceof ConfigTreeNode) {
                saveConfig = ((ConfigTreeNode) saveNode).getConfig();
                this.saveConfig(saveConfig);
View Full Code Here

                targetDirectory = ((ConfigTreeNode) target).getConfig().getDirectory();
            }
            for (ATreeNode treeNode : droppedSelection) {
                if (treeNode instanceof ConfigTreeNode) {
                    ConfigTreeNode configTreeNode = (ConfigTreeNode) treeNode;
                    IConfig movedConfig = configTreeNode.getConfig();
                    if (!targetDirectory.equals(movedConfig.getDirectory())) {
                        if (!movedConfig.isLoaded()) {
                            movedConfig = loadConfig(movedConfig);
                            configTreeNode.setConfig(movedConfig);
                        }
                        boolean modified = movedConfig.isModified();
                        moveConfig(movedConfig, targetDirectory);
                        if (!modified) {
                            configTreeNode.setConfig(saveConfig(movedConfig));
                        }
                    }
View Full Code Here

     * Copy and paste the config in configTreeNode to the current directory.
     *
     * @param configTreeNode
     */
    private void copyPasteConfig(ConfigTreeNode configTreeNode) {
        IConfig copiedConfigModel = configTreeNode.getConfig();
        // To copy the object, we serialize it to a byte array, then we recover a copy from it.
        // This way, we can reuse the existing serialization rather than implement the clone
        // method on every entity.
        ConfigSerializer configSerializer = new ConfigSerializer();
        IConfig copyConfig = configSerializer.cloneConfig(copiedConfigModel);

        copyConfig.setId(null);
        moveConfig(copyConfig, currentDirectory);
        copyConfig.setModified(true);

        /*
        IConfig copiedConfigModel = configTreeNode.getConfig();
        boolean isInCurrentDirectory = copiedConfigModel.getDirectory().equals(currentDirectory);
        // To copy the object, we serialize it to a byte array, then we recover a copy from it.
View Full Code Here

     * Cut and paste (move) the config in configTreeNode to the current directory.
     *
     * @param configTreeNode
     */
    private void cutPasteConfig(ConfigTreeNode configTreeNode) {
        IConfig movedConfig = configTreeNode.getConfig();
        boolean modified = movedConfig.isModified();
        moveConfig(movedConfig, currentDirectory);
        if (!modified) {
            configTreeNode.setConfig(saveConfig(movedConfig));
        }
    }
View Full Code Here

            return false;
        }
        IDirectory parent = ((DirectoryTreeNode) parentNode).getDirectory();
        IDirectory search;
        if (childNode instanceof ConfigTreeNode) {
            IConfig config = ((ConfigTreeNode) childNode).getConfig();
            search = config.getDirectory();
        }
        else {
            IDirectory directory = ((DirectoryTreeNode) childNode).getDirectory();
            search = directory.getDirectory();
        }
View Full Code Here

        List<ATreeNode> multipleSelection = view.getMultipleSelection();
        filterMultipleSelection(multipleSelection);
        int choice = 0;
        for (ATreeNode treeNode : multipleSelection) {
            if (treeNode instanceof ConfigTreeNode) {
                IConfig configModel = ((ConfigTreeNode) treeNode).getConfig();
                IConfig config;

                choice = view.confirmDeleteConfig(configModel);
                if (choice == view.DELETE_CONFIG) {
                    // IConfig configModelDeleted;
                    if (configModel.getId() != null) {
                        config = unwrap(configModel);
                        try {
                            ConfigApi.deleteConfig(config);
                        }
                        catch (PersistenceException e) {
                            e.printStackTrace();
                            applicationController.errorMessage("Error deleting config "
                                    + config.getName() + ". Details : " + e.getMessage());
                        }
                    }

                    configModel.getDirectory().getConfigList().remove(configModel);
                    configModel.setDirectory(null);
View Full Code Here

     */
    @SuppressWarnings("unchecked")
    private IConfig saveConfig(IConfig configModel) {
        if (configModel.isLoaded()) {
            ConfigChangeListener.getInstance().stopListening();
            IConfig savedConfigModel = null;
            try {

                savedConfigModel = ConfigAPIClient.saveConfig(configModel);

                // configImpl.getDirectory().setTimestamp(savedConfigImpl.getTimestamp());
View Full Code Here

     */
    private void updateConfigDirectory(IConfig oldConfig, IConfig newConfig) {
        IDirectory directory = oldConfig.getDirectory();
        newConfig.setDirectory(directory);
        ListIterator<IConfig> oldConfigIterator = directory.getConfigList().listIterator();
        IConfig searchConfig;
        while (oldConfigIterator.hasNext()) {
            searchConfig = oldConfigIterator.next();
            if (searchConfig.equals(oldConfig)) {
                oldConfigIterator.set(newConfig);
                break;
            }
        }
    }
View Full Code Here

     *
     * @param config
     * @return
     */
    private IConfig wrap(IConfig configImpl) {
        IConfig cm = AutoCopier.copy(configImpl);
        // IConfig ci = AutoCopier.copyToImpl(cm);
        return cm;
    }
View Full Code Here

TOP

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

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.