001: /*
002: * ChainBuilder ESB
003: * Visual Enterprise Integration
004: *
005: * Copyright (C) 2008 Bostech Corporation
006: *
007: * This program is free software; you can redistribute it and/or modify
008: * it under the terms of the GNU General Public License as published by
009: * the Free Software Foundation; either version 2 of the License, or
010: * (at your option) any later version.
011: *
012: * This program is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of
014: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015: * General Public License for more details.
016: *
017: * You should have received a copy of the GNU General Public License
018: * along with this program; if not, write to the Free Software
019: * Foundation, Inc.,59 Temple Place, Suite 330, Boston, MA 02111-1307
020: * USA
021: *
022: *
023: * $Id$
024: */
025:
026: package com.bostechcorp.cbesb.console.client.about;
027:
028: import com.bostechcorp.cbesb.console.client.Admin;
029: import com.bostechcorp.cbesb.console.client.ConsoleCallback;
030: import com.bostechcorp.cbesb.console.client.dialogs.MessageViewDialog;
031: import com.bostechcorp.cbesb.console.common.Constants;
032: import com.bostechcorp.cbesb.console.i18n.ConsoleMessages;
033: import com.bostechcorp.cbesb.console.rpc.LicensingOperation;
034: import com.bostechcorp.cbesb.console.rpc.LicensingOperationAsync;
035: import com.google.gwt.core.client.GWT;
036: import com.google.gwt.user.client.rpc.ServiceDefTarget;
037: import com.google.gwt.user.client.ui.ClickListener;
038: import com.google.gwt.user.client.ui.DockPanel;
039: import com.google.gwt.user.client.ui.HasHorizontalAlignment;
040: import com.google.gwt.user.client.ui.Label;
041: import com.google.gwt.user.client.ui.PushButton;
042: import com.google.gwt.user.client.ui.TextArea;
043: import com.google.gwt.user.client.ui.VerticalPanel;
044: import com.google.gwt.user.client.ui.Widget;
045:
046: /**
047: *
048: *
049: */
050: public class AdminConsoleLicensePanel extends Admin {
051:
052: /**
053: *
054: */
055: private static String filename = "ChainBuilderESB.license.txt";
056: private String licenseContent = null;
057: String agreementContent = null;
058: private TextArea logOnetextArea = new TextArea();
059: private final VerticalPanel verticalPanel = new VerticalPanel();
060: private final Label label = new Label();
061:
062: //private final PushButton licenseLink=new PushButton( ((ConsoleMessages) GWT.create(ConsoleMessages.class)).licenseLink());
063: public AdminConsoleLicensePanel() {
064: initWidget(verticalPanel);
065: /*verticalPanel.add(licenseLink);
066: verticalPanel.setCellHorizontalAlignment(licenseLink, HasHorizontalAlignment.ALIGN_RIGHT);*/
067:
068: logOnetextArea.setWidth("100%");
069: logOnetextArea.setCharacterWidth(100);
070: logOnetextArea.setVisibleLines(20);
071: logOnetextArea.setReadOnly(true);
072:
073: verticalPanel.add(logOnetextArea);
074: verticalPanel.setCellWidth(logOnetextArea, "100%");
075: verticalPanel.setCellHeight(logOnetextArea, "100%");
076:
077: // verticalPanel.add(licenseLink);
078: //licenseLink.setStyleName("gwt-Hyperlink");
079: /*licenseLink.addClickListener(new ClickListener(){
080: public void onClick(Widget sender) {
081: TextArea texta = new TextArea();
082: MessageViewDialog.showInfo(agreementContent);
083: //MessageViewDialog.showInfo(agreementContent, texta);
084: }});*/
085:
086: getLicensingAsyncFromFile().getLicense(filename,
087: new GetLicenseContentListener(this ));
088: // verticalPanel.add(okButton);
089: // verticalPanel.setCellHorizontalAlignment(okButton, HasHorizontalAlignment.ALIGN_RIGHT);
090: }
091:
092: class GetLicenseContentListener extends ConsoleCallback {
093:
094: public GetLicenseContentListener(Admin admin) {
095: super (admin);
096:
097: }
098:
099: public void handleSuccess(Object result) {
100:
101: if (result instanceof String) {
102: licenseContent = (String) result;
103: String[] licenses = licenseContent.split("Preamble");
104: //label.setText(licenses[0]);
105: agreementContent = licenses[1];
106: logOnetextArea.setText(licenseContent);
107: /*if(agreementContent!=null)
108: {
109: verticalPanel.clear();
110: verticalPanel.add(licenseLink);
111: licenseLink.setWidth("260px");
112: verticalPanel.setCellHorizontalAlignment(licenseLink, HasHorizontalAlignment.ALIGN_RIGHT);
113: verticalPanel.add(label);
114: }*/
115:
116: }
117: }
118: }
119:
120: /* (non-Javadoc)
121: * @see com.bostechcorp.cbesb.console.client.Admin#onHide()
122: */
123: public void onHide() {
124: // TODO Auto-generated method stub
125:
126: }
127:
128: /* (non-Javadoc)
129: * @see com.bostechcorp.cbesb.console.client.Admin#onShow()
130: */
131: public void onShow() {
132: // TODO Auto-generated method stub
133:
134: }
135:
136: /* (non-Javadoc)
137: * @see com.bostechcorp.cbesb.console.client.Admin#refresh()
138: */
139: public void refresh() {
140: // TODO Auto-generated method stub
141:
142: }
143:
144: public LicensingOperationAsync getLicensingAsyncFromFile() {
145: LicensingOperationAsync op;
146: op = (LicensingOperationAsync) GWT
147: .create(LicensingOperation.class);
148: ServiceDefTarget jmxConnectTarget = (ServiceDefTarget) op;
149: String relativeUrl = GWT.getModuleBaseURL()
150: + Constants.LICENSING_OPERATION;
151: jmxConnectTarget.setServiceEntryPoint(relativeUrl);
152:
153: return op;
154: }
155: }
|