Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: org/mitre/cvw/CVWURL.java


1   /*
2    * Copyright (c) 1996-2000. The MITRE Corporation (http://www.mitre.org/).
3    * All rights reserved.
4    * CVW comes with ABSOLUTELY NO WARRANTY. See license for details.
5    */
6   
7   package org.mitre.cvw;
8   
9   /**
10   * This represents URLs on the CVW server, it is part of the CVWObject hierarchy.  
11   * @version 1.0
12   * @author Deb Ercolini
13   */
14  public class CVWURL extends CVWObject {
15  
16  /* 3/3/97 dage -- URLs get a url string
17   */
18    String urlString;
19  
20  /**
21   * Constructor
22   */
23    CVWURL() {
24       super(CVWObject.URL);
25    }
26  
27  /**
28   * Constructor
29   *
30   * @param type the type of this object as defined by the ObjectValues
31   */
32    CVWURL(int type) {
33       super(type);
34      }
35  
36  /**
37   * Returns "Web Reference&quote; or "SC to Web Reference&quote;
38   * @return "Web Reference&quote; or "SC to Web Reference&quote;
39   *
40   * @see #getBaseType
41   */
42   public String getType() {
43      if (isShortcut()) 
44         return type.substring(0, 6) + getBaseType();
45    return getBaseType();
46     }
47     
48  /**
49   * Returns "Web Reference&quote;.  The CVW server sends type as URL and 
50   * this was found more appropriate by HCI team.
51   * @return "Web Reference&quote;
52   */
53    public String getBaseType() {
54    return "Web Reference";
55     }
56  
57  /**
58   * Returns whether this object is a shortcut
59   * @return <code>true</true> if the object is a shortcut
60   */
61    public boolean isShortcut() {
62      return (typeValue == URL_SC);
63     }
64  
65  /**
66   * Opens this url.   The CVW server doesnt send the url information as part of the 
67   * basic information when the mcp is sent.  So when the user opens the url, the 
68   * client needs to ask the CVW server for the url to this object.
69   * <br> MCP receive cvw-object-window
70   *
71   * @param url the url string
72   */
73    public void open(String url) {
74  
75      urlString = url;
76      CVWCoordinator.getInstance().openURL(url);
77     }
78  
79  
80  /**
81   * Returns an instance of the object panel specifically for URLs used in the
82   * get info dialog.
83   *
84   * @param diag the parent window
85   * @param perms whether the current user has permissions to edit this url
86   * @return instance of the object panel specifically for URLs
87   *
88   * @see URLObjectPanel
89   */
90    public ObjectPanel getObjectPanel(FolderDialog diag, String perms) {
91       return new URLObjectPanel(this, diag, perms);
92     }
93  
94  /**
95   * Returns an instance of the object panel specifically for URLs used when creating a 
96   * URL.
97   * 7/22/98 dage
98   * @param diag the parent window
99   * @return instance of the object panel specifically for URLs
100  *
101  * @see URLObjectPanel
102  */
103   public ObjectPanel getObjectPanel(FolderDialog diag) {
104      return new URLObjectPanel(this, diag);
105    }
106 
107 /**
108  * Opens the Get Info window for this object.  
109  * <br> MCP receive cvw-object-detail
110  *
111  * @param desc the description of this object
112  * @param perms whether the user has permissions to edit this object
113  * @param owners space delimited string of object numbers of the owners
114  * @param path the url string 
115  */
116   public void getInfo(String desc, String perms, String owners, String path) {
117       
118       urlString = path;
119 
120       if (typeValue == URL_SC) {
121         perms = "0";       // not editable regardless of what is sent in
122        }
123       super.getInfo(desc, perms, owners);
124 
125    }
126 
127 /* 3/24/98 dage - moved from CVWCoordinator
128  */
129 /**
130  * Builds the MCP parameter list for notifying the CVW server of any changes to 
131  * the information for this object.
132  * @param newName name from the get info dialog box
133  * @param newMove sessile value from the get info dialog box
134  * @param newDesc description from the get info dialog box
135  * @param newPath url from the get info dialog box
136  */
137     public void objectModify(String newName, boolean newMove, String newDesc, String newPath) {
138  
139     String param = super.getObjectModifyMCP(newName, newMove, newDesc);
140     if (!newPath.equals(urlString)) 
141         param = param + " path: " +  prepTextForServer(newPath);
142     objectModify(param);
143  
144   }
145 
146 /**
147  * Builds the MCP parameter list for creating the object on the CVW server.
148  * <br> MCP send cvw-object-create
149  *
150  * @param name name from the get info dialog box
151  * @param sessile sessile value from the get info dialog box
152  * @param desc description from the get info dialog box
153  * @param path url from the get info dialog box
154  */
155   public void objectCreate(String name, boolean sessile, String desc, String path) {
156     String cmd = getObjectCreateMCP(name, sessile, desc);
157     cmd = cmd + " path: " + prepTextForServer(path);
158     objectCreate(cmd);
159   }
160 
161 
162  }
163