001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common
008: * Development and Distribution License("CDDL") (collectively, the
009: * "License"). You may not use this file except in compliance with the
010: * License. You can obtain a copy of the License at
011: * http://www.netbeans.org/cddl-gplv2.html
012: * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013: * specific language governing permissions and limitations under the
014: * License. When distributing the software, include this License Header
015: * Notice in each file and include the License file at
016: * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
017: * particular file as subject to the "Classpath" exception as provided
018: * by Sun in the GPL Version 2 section of the License file that
019: * accompanied this code. If applicable, add the following below the
020: * License Header, with the fields enclosed by brackets [] replaced by
021: * your own identifying information:
022: * "Portions Copyrighted [year] [name of copyright owner]"
023: *
024: * Contributor(s):
025: *
026: * The Original Software is NetBeans. The Initial Developer of the Original
027: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
028: * Microsystems, Inc. All Rights Reserved.
029: *
030: * If you wish your version of this file to be governed by only the CDDL
031: * or only the GPL Version 2, indicate your decision by adding
032: * "[Contributor] elects to include this software in this distribution
033: * under the [CDDL or GPL Version 2] license." If you do not indicate a
034: * single choice of license, a recipient has the option to distribute
035: * your version of this file under either the CDDL, the GPL Version 2 or
036: * to extend the choice of license to its licensees as provided above.
037: * However, if you add GPL Version 2 code and therefore, elected the GPL
038: * Version 2 license, then the option applies only if the new code is
039: * made subject to such option by the copyright holder.
040: */
041:
042: package org.netbeans.modules.uml.core.metamodel.diagrams;
043:
044: import java.util.ArrayList;
045:
046: import org.netbeans.modules.uml.core.metamodel.core.foundation.INamespace;
047: import org.netbeans.modules.uml.ui.controls.drawingarea.ModelElementXMIIDPair;
048: import org.netbeans.modules.uml.ui.support.diagramsupport.DiagramTypesManager;
049: import org.netbeans.modules.uml.ui.support.diagramsupport.IDiagramTypesManager;
050:
051: /**
052: *
053: * @author Trey Spiva
054: */
055: public class DiagramDetails implements IDiagramKind {
056: private String m_Name = "";
057: private int m_DiagramType = 0;
058: private String m_DiagramTypeName = "";
059: private String m_NamespaceXMIID = "";
060: private String m_DiagramAlias = "";
061: private String m_DiagramXMIID = "";
062: private String m_ToplevelXMIID = "";
063: private INamespace m_Namespace = null;
064: private ArrayList<String> m_AssociatedDiagrams = null;
065: private ArrayList<ModelElementXMIIDPair> m_AssociatedElements = null;
066: private long m_DateModified = 0;
067:
068: /**
069: * Retrieves the name of the diagram.
070: *
071: * @return The name.
072: */
073: public String getDiagramAlias() {
074: return m_DiagramAlias;
075: }
076:
077: /**
078: * Sets the name of the diagram.
079: * @param value The name.
080: */
081: public void setDiagramAlias(String value) {
082: m_DiagramAlias = value;
083: }
084:
085: /**
086: * Returns the type of the daigram. The valid values for
087: * the daigram type is specified in the interface IDiagramKind.
088: *
089: * @return The diagram type.
090: * @see org.netbeans.modules.uml.core.metamodel.diagrams.IDiagramKind
091: */
092: public int getDiagramType() {
093: return m_DiagramType;
094: }
095:
096: /**
097: * Sets the type of the daigram. The valid values for
098: * the daigram type is specified in the interface IDiagramKind.
099: *
100: * @param vlue The diagram type.
101: * @see org.netbeans.modules.uml.core.metamodel.diagrams.IDiagramKind
102: */
103: public void setDiagramType(int value) {
104: m_DiagramType = value;
105: }
106:
107: /**
108: * Gets the name of the diagram.
109: *
110: * @return The name of the diagrm
111: */
112: public String getName() {
113: return m_Name;
114: }
115:
116: /**
117: * Sets the name of the diagram.
118: *
119: * @parm value The name of the diagrm
120: */
121: public void setName(String value) {
122: m_Name = value;
123: }
124:
125: /**
126: * Retrieves the XMI ID for of the namespace that contains the diagram.
127: *
128: * @return The id.
129: */
130: public String getNamespaceXMIID() {
131: String retVal = m_NamespaceXMIID;
132:
133: if ((retVal.length() <= 0) && (m_Namespace != null)) {
134: retVal = m_Namespace.getXMIID();
135: }
136:
137: return retVal;
138: }
139:
140: /**
141: * Sets the XMI ID for of the namespace that contains the diagram.
142: *
143: * @param value
144: */
145: public void setNamespaceXMIID(String value) {
146: m_NamespaceXMIID = value;
147: }
148:
149: /**
150: * Retrieves the diagrams XMI ID.
151: *
152: * @return the id.
153: */
154: public String getDiagramXMIID() {
155: return m_DiagramXMIID;
156: }
157:
158: /**
159: * Sets the diagrams XMIID.
160: *
161: * @param value the id.
162: */
163: public void setDiagramXMIID(String value) {
164: m_DiagramXMIID = value;
165: }
166:
167: /**
168: * Retrieves the XMI ID of the top level component.
169: *
170: * @return the ID.
171: */
172: public String getToplevelXMIID() {
173: return m_ToplevelXMIID;
174: }
175:
176: /**
177: * Sets the XMI ID of the top level component
178: * @param valuethe ID.
179: */
180: public void setToplevelXMIID(String value) {
181: m_ToplevelXMIID = value;
182: }
183:
184: /**
185: * Retrieves the type name of the diagram.
186: *
187: * @return The diagram type.
188: */
189: public String getDiagramTypeName() {
190: return m_DiagramTypeName;
191: }
192:
193: /**
194: * Sets the type name of the diagram.
195: *
196: * @param value The diagram type.
197: */
198: public void setDiagramTypeName(String value) {
199: m_DiagramTypeName = value;
200:
201: IDiagramTypesManager manager = DiagramTypesManager.instance();
202: setDiagramType(manager.getDiagramKind(value));
203: }
204:
205: /**
206: * @param space
207: */
208: public void setNamespace(INamespace space) {
209: m_Namespace = space;
210: }
211:
212: /**
213: * @param space
214: */
215: public INamespace getNamespace() {
216: return m_Namespace;
217: }
218:
219: /**
220: * @param object
221: */
222: public void setAssociatedDiagrams(ArrayList<String> diagrams) {
223: m_AssociatedDiagrams = diagrams;
224:
225: }
226:
227: /**
228: * @param object
229: */
230: public ArrayList<String> getAssociatedDiagrams() {
231: return m_AssociatedDiagrams;
232: }
233:
234: /**
235: * @param object
236: */
237: public void setAssociatedElements(
238: ArrayList<ModelElementXMIIDPair> elements) {
239: m_AssociatedElements = elements;
240:
241: }
242:
243: /**
244: * @param object
245: */
246: public ArrayList<ModelElementXMIIDPair> getAssociatedElements() {
247: return m_AssociatedElements;
248:
249: }
250:
251: /**
252: * Retrieves the file date that was used to retrieve the diagram details.
253: *
254: * @return The last date modified.
255: */
256: public long getDateModified() {
257: return m_DateModified;
258: }
259:
260: /**
261: * Sets the file date that was used to retrieve the diagram details.
262: *
263: * @param value The file date.
264: */
265: public void setDateModified(long value) {
266: m_DateModified = value;
267: }
268:
269: }
|