001: /*
002: * Jacareto Copyright (c) 2002-2005
003: * Applied Computer Science Research Group, Darmstadt University of
004: * Technology, Institute of Mathematics & Computer Science,
005: * Ludwigsburg University of Education, and Computer Based
006: * Learning Research Group, Aachen University. All rights reserved.
007: *
008: * Jacareto is free software; you can redistribute it and/or
009: * modify it under the terms of the GNU General Public
010: * License as published by the Free Software Foundation; either
011: * version 2 of the License, or (at your option) any later version.
012: *
013: * Jacareto is distributed in the hope that it will be useful,
014: * but WITHOUT ANY WARRANTY; without even the implied warranty of
015: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
016: * General Public License for more details.
017: *
018: * You should have received a copy of the GNU General Public
019: * License along with Jacareto; if not, write to the Free
020: * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
021: *
022: */
023:
024: package jacareto.struct;
025:
026: import jacareto.system.Environment;
027:
028: /**
029: * A structure element which groups elements together.
030: *
031: * @author <a href="mailto:markus.bois@web.de">Markus Bois</a>
032: * @version 1.0
033: */
034: public class GroupStructureElement extends StructureElement {
035: /** The name of the user structure elemet */
036: private String name;
037:
038: /**
039: * Creates a new "user" structure element.
040: *
041: * @param env the environment
042: */
043: public GroupStructureElement(Environment env) {
044: this (env, null, "");
045: }
046:
047: /**
048: * Creates a new "user" structure element.
049: *
050: * @param env the environment
051: * @param children the child structure elements
052: */
053: public GroupStructureElement(Environment env,
054: StructureElement[] children) {
055: this (env, children, "");
056: }
057:
058: /**
059: * Creates a new user structure element.
060: *
061: * @param env the environment
062: * @param children the child structure elements
063: * @param name the name of the element
064: */
065: public GroupStructureElement(Environment env,
066: StructureElement[] children, String name) {
067: super (env, null, children, true);
068: this .name = name;
069: }
070:
071: /**
072: * Returns the name of the element.
073: *
074: * @return DOCUMENT ME!
075: */
076: public String getName() {
077: return name;
078: }
079:
080: public void setName(String name) {
081: this .name = name;
082: fireValuesChanged();
083: }
084:
085: /**
086: * Returns the name of the element.
087: *
088: * @return the name
089: */
090: public String getElementName() {
091: return language
092: .getString("Structures.GroupStructureElement.Name");
093: }
094:
095: /**
096: * Returns a description of the element.
097: *
098: * @return the description
099: */
100: public String getElementDescription() {
101: return language
102: .getString("Structures.GroupStructureElement.Description");
103: }
104:
105: /**
106: * Returns a String which describes the content of the element shortly.
107: *
108: * @return a string with a short description of the element
109: */
110: public String toShortString() {
111: if ((getName() == null) || getName().equals("")) {
112: return "("
113: + language
114: .getString("Structures.GroupStructureElement.NewGroup")
115: + ")";
116: } else {
117: return getName();
118: }
119: }
120:
121: /**
122: * Clones the element.
123: *
124: * @return DOCUMENT ME!
125: */
126: public Object clone() {
127: StructureElement[] clonedChildren = getClonedChildren();
128:
129: return new GroupStructureElement(env, clonedChildren, name);
130: }
131:
132: public boolean hasProcTime() {
133: return false;
134: }
135: }
|