001/*
002 * IzPack - Copyright 2001-2005 Julien Ponge, All Rights Reserved.
003 * 
004 * http://www.izforge.com/izpack/
005 * http://developer.berlios.de/projects/izpack/
006 * 
007 * Copyright 2002 Elmar Grom
008 * 
009 * Licensed under the Apache License, Version 2.0 (the "License");
010 * you may not use this file except in compliance with the License.
011 * You may obtain a copy of the License at
012 * 
013 *     http://www.apache.org/licenses/LICENSE-2.0
014 *     
015 * Unless required by applicable law or agreed to in writing, software
016 * distributed under the License is distributed on an "AS IS" BASIS,
017 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
018 * See the License for the specific language governing permissions and
019 * limitations under the License.
020 */
021
022package com.izforge.izpack.panels;
023
024/*---------------------------------------------------------------------------*/
025/**
026 * This class serves as a data structure in
027 * <code>{@link com.izforge.izpack.panels.ShortcutPanel}</code>
028 * 
029 * @version 0.0.1 / 4/1/02
030 * @author Elmar Grom
031 */
032/*---------------------------------------------------------------------------*/
033public class ShortcutData implements Cloneable
034{
035
036    public String name;
037
038    public String description;
039
040    public String target;
041
042    public String commandLine;
043
044    public int type;
045
046    public int userType;
047
048    public boolean addToGroup = false;
049
050    public String subgroup;
051
052    public String iconFile;
053
054    public int iconIndex;
055
056    public int initialState;
057
058    public String workingDirectory;
059
060    public String deskTopEntryLinux_MimeType;
061
062    public String deskTopEntryLinux_Terminal;
063
064    public String deskTopEntryLinux_TerminalOptions;
065
066    public String deskTopEntryLinux_Type;
067
068    public String deskTopEntryLinux_URL;
069
070    public String deskTopEntryLinux_Encoding;
071
072    public String deskTopEntryLinux_X_KDE_SubstituteUID;
073
074    public Boolean createForAll;
075
076    /*--------------------------------------------------------------------------*/
077    /**
078     * Returns a clone (copy) of this object.
079     * 
080     * @return a copy of this object
081     * @throws CloneNotSupportedException
082     */
083    /*--------------------------------------------------------------------------*/
084    public Object clone() throws OutOfMemoryError
085    {
086        ShortcutData result = new ShortcutData();
087
088        result.type = type;
089        result.userType = userType;
090        result.iconIndex = iconIndex;
091        result.initialState = initialState;
092        result.addToGroup = addToGroup;
093
094        result.name = cloneString(name);
095        result.description = cloneString(description);
096        result.target = cloneString(target);
097        result.commandLine = cloneString(commandLine);
098        result.subgroup = cloneString(subgroup);
099        result.iconFile = cloneString(iconFile);
100        result.workingDirectory = cloneString(workingDirectory);
101        result.deskTopEntryLinux_MimeType = cloneString(deskTopEntryLinux_MimeType);
102        result.deskTopEntryLinux_Terminal = cloneString(deskTopEntryLinux_Terminal);
103        result.deskTopEntryLinux_TerminalOptions = cloneString(deskTopEntryLinux_TerminalOptions);
104        result.deskTopEntryLinux_Type = cloneString(deskTopEntryLinux_Type);
105        result.deskTopEntryLinux_URL = cloneString(deskTopEntryLinux_URL);
106        result.deskTopEntryLinux_Encoding = cloneString(deskTopEntryLinux_Encoding);
107        result.deskTopEntryLinux_X_KDE_SubstituteUID = cloneString(deskTopEntryLinux_X_KDE_SubstituteUID);
108        result.createForAll = new Boolean(createForAll.booleanValue());
109        return (result);
110    }
111
112    /*--------------------------------------------------------------------------*/
113    /**
114     * Clones a <code>String</code>, that is it makes a copy of the content, not of the
115     * reference. In addition, if the original is <code>null</code> then an empty
116     * <code>String</code> is returned rather than <code>null</code>.
117     * 
118     * @param original the <code>String</code> to clone
119     * 
120     * @return a clone of the original
121     */
122    /*--------------------------------------------------------------------------*/
123    private String cloneString(String original)
124    {
125        if (original == null)
126        {
127            return ("");
128        }
129        else
130        {
131            return (new String(original));
132        }
133    }
134}
135/*---------------------------------------------------------------------------*/
136