001: /**
002: * Created on Dec 28, 2004
003: * @license GPL 2
004: */package com.memoire.vainstall;
005:
006: import java.io.File;
007:
008: public class VAShortcutEntry {
009: private String Comment_;
010: private String type_ = "Application";
011: private String exePath_;
012: private String iconPath_;
013: String workingDirectory_;
014: private boolean launchInTerminal_;
015: private String name_;
016: boolean createOnDesktop_ = true;
017: boolean isUninstall_;
018:
019: /**
020: * The name of the icon is built with the path.
021: * @param _exePath the path to the exe
022: */
023: public VAShortcutEntry(String _exePath) {
024: name_ = new File(_exePath).getName();
025: //if present, we remove the file extension
026: int idx = name_.indexOf('.');
027: if (idx > 0)
028: name_ = name_.substring(0, idx);
029: exePath_ = _exePath;
030: if (exePath_ == null)
031: throw new IllegalArgumentException(
032: "Exe path must not be null");
033: }
034:
035: public VAShortcutEntry(String _name, String _exePath) {
036: name_ = _name;
037: exePath_ = _exePath;
038: if (exePath_ == null)
039: throw new IllegalArgumentException(
040: "Exe path must not be null");
041: if (name_ == null)
042: throw new IllegalArgumentException("Name must not be null");
043: }
044:
045: /**
046: * @return Returns the comment.
047: */
048: public String getComment() {
049: return Comment_;
050: }
051:
052: /**
053: * @return Returns the exePath.
054: */
055: public String getExePath() {
056: return exePath_;
057: }
058:
059: /**
060: * @return Returns the iconPath.
061: */
062: public String getIconPath() {
063: return iconPath_;
064: }
065:
066: /**
067: * @return Returns the name.
068: */
069: public String getName() {
070: return name_;
071: }
072:
073: /**
074: * @return Returns the launchInTerminal.
075: */
076: public boolean isLaunchInTerminal() {
077: return launchInTerminal_;
078: }
079:
080: /**
081: * @param _comment The comment to set.
082: */
083: public void setComment(String _comment) {
084: Comment_ = _comment;
085: }
086:
087: /**
088: * @param _exePath The exePath to set.
089: */
090: public void setExePath(String _exePath) {
091: if (_exePath == null)
092: throw new IllegalArgumentException(
093: "exe path must not be null");
094: exePath_ = _exePath;
095: }
096:
097: /**
098: * @param _iconPath The iconPath to set.
099: */
100: public void setIconPath(String _iconPath) {
101: iconPath_ = _iconPath;
102: }
103:
104: /**
105: * @param _launchInTerminal The launchInTerminal to set.
106: */
107: public void setLaunchInTerminal(boolean _launchInTerminal) {
108: launchInTerminal_ = _launchInTerminal;
109: }
110:
111: /**
112: * @param _name The name to set.
113: */
114: public void setName(String _name) {
115: if (_name == null)
116: throw new IllegalArgumentException(
117: "Icon's name must not be null");
118: name_ = _name;
119: }
120:
121: /**
122: * @return Returns the type.
123: */
124: public String getType() {
125: return type_;
126: }
127:
128: /**
129: * @param _type The type to set.
130: */
131: public void setType(String _type) {
132: type_ = _type;
133: }
134:
135: /**
136: * @return Returns the workingDirectory.
137: */
138: public String getWorkingDirectory() {
139: return workingDirectory_;
140: }
141:
142: /**
143: * @param _workingDirectory The workingDirectory to set.
144: */
145: public void setWorkingDirectory(String _workingDirectory) {
146: workingDirectory_ = _workingDirectory;
147: }
148:
149: /**
150: * @return Returns the createOnDesktop.
151: */
152: public final boolean isCreateOnDesktop() {
153: return createOnDesktop_;
154: }
155:
156: /**
157: * @param _createOnDesktop The createOnDesktop to set.
158: */
159: public final void setCreateOnDesktop(boolean _createOnDesktop) {
160: createOnDesktop_ = _createOnDesktop;
161: }
162:
163: /**
164: * @return Returns the isUninstall.
165: */
166: public final boolean isUninstall() {
167: return isUninstall_;
168: }
169:
170: /**
171: * @param _isUninstall The isUninstall to set.
172: */
173: public final void setUninstall(boolean _isUninstall) {
174: isUninstall_ = _isUninstall;
175: }
176: }
|