KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > help > internal > webapp > data > View


1 /*******************************************************************************
2  * Copyright (c) 2000, 2007 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.help.internal.webapp.data;
12
13 public class View {
14     public static char NO_SHORTCUT = (char)0;
15     private String JavaDoc name;
16     private String JavaDoc url;
17     private String JavaDoc imageURL;
18     private char shortcut;
19     private boolean isDeferred;
20
21     public View(String JavaDoc name, String JavaDoc url, String JavaDoc imageURL, char shortcut, boolean isDeferred) {
22         this.name = name;
23         this.url = url;
24         this.imageURL = imageURL;
25         this.shortcut = shortcut;
26         this.isDeferred = isDeferred;
27     }
28
29     public String JavaDoc getName() {
30         return name;
31     }
32
33     public String JavaDoc getURL() {
34         return url;
35     }
36
37     /**
38      * Returns the enabled gray image
39      *
40      * @return String
41      */

42     public String JavaDoc getImage() {
43         int i = imageURL.lastIndexOf('/');
44         return imageURL.substring(0, i) + "/e_" + imageURL.substring(i + 1); //$NON-NLS-1$
45
}
46
47     /**
48      * Returns the image when selected
49      *
50      * @return String
51      */

52     public String JavaDoc getOnImage() {
53         return getImage();
54     }
55     /**
56      * Returns the image when selected
57      *
58      * @return char or 0 if no shortcut
59      */

60     public char getKey() {
61         return shortcut;
62     }
63     
64     /**
65      * Returns whether or not this view should do a deferred load; i.e. it will
66      * take some time to load and should show a progress message while loading.
67      */

68     public boolean isDeferred() {
69         return isDeferred;
70     }
71 }
72
Popular Tags