Revision 42605

View differences:

trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.spi/src/main/java/org/gvsig/fmap/dal/resource/spi/MultiResourceParameters.java
3 3
 *
4 4
 * Copyright (C) 2007-2013 gvSIG Association.
5 5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 3
9
 * of the License, or (at your option) any later version.
6
 * This program is free software; you can redistribute it and/or modify it under
7
 * the terms of the GNU General Public License as published by the Free Software
8
 * Foundation; either version 3 of the License, or (at your option) any later
9
 * version.
10 10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
11
 * This program is distributed in the hope that it will be useful, but WITHOUT
12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13
 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
14
 * details.
15 15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
16
 * You should have received a copy of the GNU General Public License along with
17
 * this program; if not, write to the Free Software Foundation, Inc., 51
18
 * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 19
 *
21
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
20
 * For any additional information, do not hesitate to contact us at info AT
21
 * gvsig.com, or visit our website www.gvsig.com.
23 22
 */
24 23
package org.gvsig.fmap.dal.resource.spi;
25 24

  
......
31 30

  
32 31
/**
33 32
 * Parameters for the creation of a multi resource.
34
 * 
33
 *
35 34
 * @author 2009- <a href="cordinyana@gvsig.org">C?sar Ordi?ana</a> - gvSIG team
36 35
 */
37 36
public class MultiResourceParameters extends AbstractResourceParameters {
38 37

  
39
	public static final String DYNCLASS_NAME = "MultiResourceParameters";
38
    public static final String DYNCLASS_NAME = "MultiResourceParameters";
40 39

  
41
	private static final String FIELD_NAME = "name";
40
    private static final String FIELD_NAME = "name";
42 41

  
43
	private DelegatedDynObject delegatedDynObject;
42
    private DelegatedDynObject delegatedDynObject;
44 43

  
45
	/**
46
	 * Creates a new {@link MultiResourceParameters}.
47
	 */
48
	public MultiResourceParameters() {
49
		this.delegatedDynObject =
50
				(DelegatedDynObject) ToolsLocator.getDynObjectManager()
51
						.createDynObject(registerDynClass());
52
	}
44
    /**
45
     * Creates a new {@link MultiResourceParameters}.
46
     */
47
    public MultiResourceParameters() {
48
        this.delegatedDynObject
49
                = (DelegatedDynObject) ToolsLocator.getDynObjectManager()
50
                .createDynObject(registerDynClass());
51
    }
53 52

  
54
	/**
55
	 * Creates a new {@link MultiResourceParameters}.
56
	 * 
57
	 * @param name
58
	 *            for the parameters. Will be used as the name of the
59
	 *            {@link MemoryResource} created with this parametres.
60
	 */
61
	public MultiResourceParameters(String name) {
62
		this();
63
		setName(name);
64
	}
53
    /**
54
     * Creates a new {@link MultiResourceParameters}.
55
     *
56
     * @param name for the parameters. Will be used as the name of the
57
     * {@link MemoryResource} created with this parametres.
58
     */
59
    @SuppressWarnings("OverridableMethodCallInConstructor")
60
    public MultiResourceParameters(String name) {
61
        this();
62
        setName(name);
63
    }
65 64

  
66
	protected DelegatedDynObject getDelegatedDynObject() {
67
		return delegatedDynObject;
68
	}
65
    @Override
66
    protected DelegatedDynObject getDelegatedDynObject() {
67
        return delegatedDynObject;
68
    }
69 69

  
70
	public String getTypeName() {
71
		return MultiResource.TYPE_NAME;
72
	}
70
    @Override
71
    public String getTypeName() {
72
        return MultiResource.TYPE_NAME;
73
    }
73 74

  
74
	public String getName() {
75
		return (String) getDelegatedDynObject().getDynValue(FIELD_NAME);
76
	}
75
    public String getName() {
76
        return (String) getDelegatedDynObject().getDynValue(FIELD_NAME);
77
    }
77 78

  
78
	public void setName(String name) {
79
		getDelegatedDynObject().setDynValue(FIELD_NAME, name);
80
	}
79
    public void setName(String name) {
80
        getDelegatedDynObject().setDynValue(FIELD_NAME, name);
81
    }
81 82

  
82
	/**
83
	 * Registers the {@link DynClass} of this parameters attributes.
84
	 * 
85
	 * @return the dyn class of this parameters
86
	 */
87
	private static synchronized DynClass registerDynClass() {
88
		DynObjectManager dynman = ToolsLocator.getDynObjectManager();
89
		DynClass dynClass = dynman.get(DYNCLASS_NAME);
90
		if (dynClass == null) {
91
			dynClass = dynman.add(DYNCLASS_NAME);
92
			dynClass.addDynFieldString(FIELD_NAME).setDescription(
93
					"The name of the multi resource");
94
		}
95
		return dynClass;
96
	}
83
    /**
84
     * Registers the {@link DynClass} of this parameters attributes.
85
     *
86
     * @return the dyn class of this parameters
87
     */
88
    private static synchronized DynClass registerDynClass() {
89
        DynObjectManager dynman = ToolsLocator.getDynObjectManager();
90
        DynClass dynClass = dynman.get(DYNCLASS_NAME);
91
        if (dynClass == null) {
92
            dynClass = dynman.add(DYNCLASS_NAME);
93
            dynClass.addDynFieldString(FIELD_NAME).setDescription(
94
                    "The name of the multi resource");
95
        }
96
        return dynClass;
97
    }
97 98
}

Also available in: Unified diff