KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > ixenon > free > nodes > AbstractInstallable


1 /* $Id$
2  *
3  * Copyright (c) 1999 Xenonsoft Limited. All Rights Reserved.
4  *
5  * This software is protected by copyright. You are hereby notified from
6  * now by reading this message. This software is also the confidential
7  * and proprietary information of Xenonsoft Limited. ("Confidential
8  * Information").
9  *
10  * This software is distributed under the Xenonsoft Public end user
11  * License ("XPeL"), where the machine-readable source code is provided
12  * under the "Open Source" model.
13  * For more information, please read the file "LICENSE-XPL.txt"
14  */

15
16 //
17
// DESCRIPTION
18
//
19
// Peter Pilgrim
20
// Sun Jan 17 19:28:41 GMT 1999
21
//
22
// RCS HEADER ``Installable''
23
//
24
// $Author$
25
// $Date$
26
// $Source$
27
// $Revision$ $State$ $Locker$
28
//
29

30 package ixenon.free.nodes;
31
32 import java.awt.*;
33 import java.awt.event.*;
34 import java.util.*;
35
36 import javax.swing.*; // for JTree
37
import javax.swing.event.*; // TreeSelectionModel
38
import javax.swing.tree.*; // MutableTreeNode
39

40 import ixenon.free.install.*; // for FreeInstallerApplication
41
import ixenon.free.uninstall.*; // for Uninstallable
42

43
44 /**
45  * A default abstract class for installable object that implements
46  * the <code>Installable</code> interface. There are some concrete
47  * methods in this class that makes subclassing easier.
48  * <P>
49  * Why have I made <code>AbstractInstallable</code> a subclass
50  * of <code>javax.swing.tree.MutableTreeNode</code>?
51  * Because this would make easier to build a Wizard using
52  * Swing <code>JTree</code> to manipulate tree nodes.
53  *
54  */

55 public abstract class AbstractInstallable extends DefaultMutableTreeNode
56 {
57
58     /** The name of the node */
59     protected String JavaDoc nodeName;
60
61     /** The uninstallable object */
62     protected Uninstallable uninstallable;
63
64     /** Boolean variable, true if the installable should generate
65      * an uninstallable stub
66      */

67     protected boolean generateUninstall;
68
69     /** Boolean variable, true if the installable should be pendantic
70      * or not.
71      */

72     protected boolean pedantic;
73     
74     /**
75      * Constructor for an abstract installable
76      * By defaults sets the installable to generate uninstaller stubs
77      * and also be pedantic
78      * @param nodeName the name of the installable node
79      * @param userObject the user object
80      * @param allowsChildren allows children flag.
81      */

82     public AbstractInstallable( String JavaDoc nodeName,
83                 Object JavaDoc userObject,
84                 boolean allowsChildren )
85     {
86     super( userObject, allowsChildren );
87     this.nodeName = nodeName;
88     generateUninstall = true;
89     pedantic=true;
90     }
91     
92     /** Gets the name of the installable */
93     public String JavaDoc getNodeName()
94     {
95     return (nodeName);
96     }
97     
98     /** Sets the name of the installable
99      * @param newNodeName the new node name
100      */

101     public void setNodeName( String JavaDoc newNodeName )
102     {
103     nodeName = newNodeName;
104     }
105     
106     /**
107      * Is this Compulsory installable whose visual component is one
108      * that must be viewed or not.
109      * @see getVisualComponent
110      */

111     public boolean isCompulsoryView()
112     {
113     return (false);
114     }
115     
116     /**
117      * sets the locale
118      * @param locale the new locale
119      */

120     public void setLocale( Locale locale ) { }
121
122     /**
123      * set the installation mode type
124      * @param installMode sets the installation mode
125      * @see ixenon.free.install.InstallConstants
126      */

127     public void setInstallMode( int installMode ) { }
128
129     /**
130      * create or retrieve the visual component of the installable
131      * if one exists. Otherwise return null.
132      */

133     public abstract Component getVisualComponent();
134     
135     /**
136      * create or retrieve the configurable component of the installable
137      * if one exists. Otherwise return null object.
138      */

139     public abstract Component getConfigurableComponent();
140
141     /**
142      * method to perform the installation of content
143      *
144      * @exception <code>InstallException</code> if there is an
145      * problem trying to install the entity.
146      */

147     public abstract void install() throws InstallException;
148     
149     /**
150      * method to get the <code>Uninstallable</code> content objectg.
151      */

152     public Uninstallable getUninstaller()
153     {
154     return (uninstallable);
155     }
156     
157     /**
158      * method to set the <code>Uninstallable</code> content.
159      * @param uninstaller the <code>Uninstallable</code> object that knows
160      * how to write a stub or script to uninstall the files.
161      */

162     public void setUninstaller( Uninstallable uninstaller )
163     {
164     this.uninstallable = uninstaller;
165     }
166     
167     
168     /**
169      * method to perform the cleanup of content if cancelled, or aborted
170      */

171     public abstract void cleanup() throws InstallException;
172
173
174     /**
175      * Sets the flag whether this <code>AbstractInstallable</code> object
176      * generate the uninstaller stub or not
177      * @param newFlag the boolean flag
178      */

179     public void setGenerateUninstall( boolean newFlag )
180     {
181     generateUninstall= newFlag;
182     }
183     
184     /**
185      * Gets the flag whether this <code>AbstractInstallable</code> object
186      * generate the uninstaller stub or not
187      * @return <code>boolean</code> the flag
188      */

189     public boolean getGenerateUninstall()
190     {
191     return (generateUninstall);
192     }
193     
194     /**
195      * Sets the flag whether this <code>AbstractInstallable</code> object
196      * to be pendantic or not.
197      * @param newFlag the boolean flag
198      */

199     public void setPedantic( boolean newFlag )
200     {
201     pedantic= newFlag;
202     }
203     
204     /**
205      * Gets the flag whether this <code>AbstractInstallable</code> object
206      * is pendantic or not.
207      * @return <code>boolean</code> the flag
208      */

209     public boolean getPedantic()
210     {
211     return (pedantic);
212     }
213     
214 }
215
216 // fini
217
Popular Tags