KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > openbravo > erpCommon > utility > ToolBar_Button


1 /*
2  *************************************************************************
3  * The contents of this file are subject to the Openbravo Public License
4  * Version 1.0 (the "License"), being the Mozilla Public License
5  * Version 1.1 with a permitted attribution clause; you may not use this
6  * file except in compliance with the License. You may obtain a copy of
7  * the License at http://www.openbravo.com/legal/license.html
8  * Software distributed under the License is distributed on an "AS IS"
9  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
10  * License for the specific language governing rights and limitations
11  * under the License.
12  * The Original Code is Openbravo ERP.
13  * The Initial Developer of the Original Code is Openbravo SL
14  * All portions are Copyright (C) 2001-2006 Openbravo SL
15  * All Rights Reserved.
16  * Contributor(s): ______________________________________.
17  ************************************************************************
18 */

19 package org.openbravo.erpCommon.utility;
20
21
22 public class ToolBar_Button implements HTMLElement {
23   String JavaDoc name = "";
24   String JavaDoc description = "";
25   String JavaDoc click = "";
26   String JavaDoc href = "#";
27   ToolBar_Image image;
28   String JavaDoc base_direction;
29
30   public ToolBar_Button(String JavaDoc _base_direction, String JavaDoc _name, String JavaDoc _description, String JavaDoc _onclick) {
31     this(_base_direction, _name, _description, _onclick, "#");
32   }
33
34   public ToolBar_Button(String JavaDoc _base_direction, String JavaDoc _name, String JavaDoc _description, String JavaDoc _onclick, String JavaDoc _href) {
35     this.base_direction = _base_direction;
36     this.name = _name;
37     this.click = _onclick;
38     this.description = _description;
39     this.href = _href;
40     this.image = new ToolBar_Image(this.base_direction, this.name, this.description);
41   }
42
43   public String JavaDoc getWidth() {
44     return "2%";
45   }
46
47   public String JavaDoc elementType() {
48     return "BUTTON";
49   }
50
51   public String JavaDoc toString() {
52     StringBuffer JavaDoc toolbar = new StringBuffer JavaDoc();
53     toolbar.append("<a HREF=\"");
54     toolbar.append(href);
55     toolbar.append("\" onClick=\"");
56     toolbar.append(click);
57     if ((click!=null && !click.equals("")) || HREF==null || href.equals("") || href.equals("#")) toolbar.append("return false;");
58     toolbar.append("\" ");
59     toolbar.append("class=\"Main_ToolBar_Button\" onMouseOver=\"window.status='");
60     toolbar.append(description);
61     toolbar.append("';return true;\" ");
62     toolbar.append("onMouseOut=\"window.status='';return true;\" onclick=\"this.hideFocus=true\" onblur=\"this.hideFocus=false\" ");
63     toolbar.append("id=\"linkButton").append(name).append("\">");
64     toolbar.append(image);
65     toolbar.append("</a>");
66     return toolbar.toString();
67   }
68 }
Popular Tags