001: /*
002: * CoadunationAdmin: The admin frontend for coadunation.
003: * Copyright (C) 2007 - 2008 Rift IT Contracting
004: *
005: * This library is free software; you can redistribute it and/or
006: * modify it under the terms of the GNU Lesser General Public
007: * License as published by the Free Software Foundation; either
008: * version 2.1 of the License, or (at your option) any later version.
009: *
010: * This library is distributed in the hope that it will be useful,
011: * but WITHOUT ANY WARRANTY; without even the implied warranty of
012: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
013: * Lesser General Public License for more details.
014: *
015: * You should have received a copy of the GNU Lesser General Public
016: * License along with this library; if not, write to the Free Software
017: * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
018: *
019: * HelpDialog.java
020: */
021:
022: // package path
023: package com.rift.coad.web.admin.client;
024:
025: // gwt imports
026: import com.google.gwt.user.client.ui.Button;
027: import com.google.gwt.user.client.ui.ClickListener;
028: import com.google.gwt.user.client.ui.DialogBox;
029: import com.google.gwt.user.client.ui.HTML;
030: import com.google.gwt.user.client.ui.KeyboardListener;
031: import com.google.gwt.user.client.ui.VerticalPanel;
032: import com.google.gwt.user.client.ui.Widget;
033: import com.google.gwt.user.client.ui.ScrollPanel;
034:
035: /**
036: * This object is responsible for displaying the help information.
037: *
038: * @author brett chaldecott
039: */
040: public class HelpDialog extends DialogBox {
041:
042: // private member variables.
043: private static HelpDialog singleton = null;
044: private HTML content = new HTML();
045:
046: /**
047: * Creates a new instance of HelpDialog
048: */
049: public HelpDialog() {
050: // set the text for this panel
051: //setText("Coadunation Help");
052:
053: // Create a VerticalPanel to contain the 'about' label and the 'OK' button.
054: VerticalPanel outer = new VerticalPanel();
055: outer.setWidth("100%");
056:
057: // scrol panel
058: content.setHTML("test");
059: content.setWordWrap(true);
060: ScrollPanel text = new ScrollPanel(content);
061: text.setStyleName("help-Scroller");
062: text.setWidth("100%");
063: //text.setAlwaysShowScrollBars(true);
064: outer.add(text);
065:
066: // set the style on the outer
067: outer.setStyleName("help-Text");
068:
069: // Create the 'OK' button, along with a listener that hides the dialog
070: // when the button is clicked.
071: outer.add(new Button("Close", new ClickListener() {
072: public void onClick(Widget sender) {
073: hide();
074: }
075: }));
076:
077: // set the width
078: setWidget(outer);
079: this .center();
080: hide();
081: }
082:
083: /**
084: * This method returns an instance of the help dialog
085: */
086: public synchronized static HelpDialog getInstance() {
087: if (singleton == null) {
088: singleton = new HelpDialog();
089: }
090: return singleton;
091: }
092:
093: /**
094: * This method sets the content of the help dialog
095: */
096: public void setContent(String text) {
097: content.setHTML(text);
098: this.show();
099:
100: }
101: }
|