001: /*
002: * ChainBuilder ESB
003: * Visual Enterprise Integration
004: *
005: * Copyright (C) 2006 Bostech Corporation
006: *
007: * This program is free software; you can redistribute it and/or modify it
008: * under the terms of the GNU General Public License as published by the
009: * Free Software Foundation; either version 2 of the License, or (at your option)
010: * 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 MERCHANTABILITY
014: * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
015: * for more details.
016: *
017: * You should have received a copy of the GNU General Public License along with
018: * this program; if not, write to the Free Software Foundation, Inc.,
019: * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
020: *
021: *
022: * $Id$
023: */
024: package com.bostechcorp.cbesb.console.client.dialogs;
025:
026: import com.bostechcorp.cbesb.console.client.ConsoleVersion;
027: import com.bostechcorp.cbesb.console.client.StyleConstants;
028: import com.bostechcorp.cbesb.console.i18n.ConsoleMessages;
029: import com.google.gwt.core.client.GWT;
030: import com.google.gwt.user.client.ui.ClickListener;
031: import com.google.gwt.user.client.ui.DeckPanel;
032: import com.google.gwt.user.client.ui.DialogBox;
033: import com.google.gwt.user.client.ui.FlexTable;
034: import com.google.gwt.user.client.ui.HasHorizontalAlignment;
035: import com.google.gwt.user.client.ui.HasVerticalAlignment;
036: import com.google.gwt.user.client.ui.HorizontalPanel;
037: import com.google.gwt.user.client.ui.Label;
038: import com.google.gwt.user.client.ui.PushButton;
039: import com.google.gwt.user.client.ui.VerticalPanel;
040: import com.google.gwt.user.client.ui.Widget;
041:
042: public class ComponentsVersionDialog extends DialogBox {
043:
044: private FlexTable detailFlexTable = new FlexTable();
045: private Label componentNameLabel;
046: private Label versionLabel;
047: private Label buildTimeLabel;
048: private HorizontalPanel horizontalPanel = new HorizontalPanel();
049: private HorizontalPanel buttonPanel = new HorizontalPanel();
050: private VerticalPanel alertViewDetailsPanel = new VerticalPanel();
051: private DeckPanel deck = new DeckPanel();
052:
053: private PushButton okButton = new PushButton(((ConsoleMessages) GWT
054: .create(ConsoleMessages.class)).OK());
055: private Label alertIdLabel;
056: private Label typeLabel;
057: private Label alertDefIdLabel;
058:
059: public ComponentsVersionDialog(ConsoleVersion consoleVersion) {
060: super (false, true);
061: setText(((ConsoleMessages) GWT.create(ConsoleMessages.class))
062: .versionInfo());
063: setWidget(deck);
064: createWidget();
065: setAlertView(consoleVersion);
066: addListener();
067: show();
068: center();
069: }
070:
071: private void addListener() {
072: okButton.addClickListener(new ClickListener() {
073: public void onClick(Widget sender) {
074: close();
075: }
076: });
077: }
078:
079: private void close() {
080: hide();
081: deck.removeFromParent();
082: this .removeFromParent();
083: }
084:
085: private void setAlertView(ConsoleVersion version) {
086: setFelxTableHeader();
087: alertIdLabel = new Label(version.getCompName());
088: detailFlexTable.setWidget(0, 1, alertIdLabel);
089:
090: typeLabel = new Label(version.getVersionInfo());
091: detailFlexTable.setWidget(1, 1, typeLabel);
092:
093: alertDefIdLabel = new Label(version.getBuildTimestamp());
094: detailFlexTable.setWidget(2, 1, alertDefIdLabel);
095:
096: }
097:
098: private void setFelxTableHeader() {
099: detailFlexTable.clear();
100: detailFlexTable.setWidth("100%");
101: detailFlexTable.setStyleName(StyleConstants.TABLE_STYLE);
102:
103: componentNameLabel = new Label(((ConsoleMessages) GWT
104: .create(ConsoleMessages.class)).ComponentName()
105: + ":");
106: detailFlexTable.setWidget(0, 0, componentNameLabel);
107:
108: versionLabel = new Label(((ConsoleMessages) GWT
109: .create(ConsoleMessages.class)).Version()
110: + ":");
111: detailFlexTable.setWidget(1, 0, versionLabel);
112:
113: buildTimeLabel = new Label(((ConsoleMessages) GWT
114: .create(ConsoleMessages.class)).BuildTime()
115: + ":");
116: detailFlexTable.setWidget(2, 0, buildTimeLabel);
117:
118: }
119:
120: public void createWidget() {
121: buttonPanel.add(okButton);
122: buttonPanel.setCellHorizontalAlignment(okButton,
123: HasHorizontalAlignment.ALIGN_RIGHT);
124: okButton.setWidth("90px");
125: alertViewDetailsPanel.add(horizontalPanel);
126: alertViewDetailsPanel.setCellVerticalAlignment(horizontalPanel,
127: HasVerticalAlignment.ALIGN_TOP);
128: alertViewDetailsPanel.add(detailFlexTable);
129: alertViewDetailsPanel.setCellVerticalAlignment(detailFlexTable,
130: HasVerticalAlignment.ALIGN_MIDDLE);
131: alertViewDetailsPanel.add(buttonPanel);
132: alertViewDetailsPanel.setCellHorizontalAlignment(buttonPanel,
133: HasHorizontalAlignment.ALIGN_RIGHT);
134: alertViewDetailsPanel.setCellVerticalAlignment(buttonPanel,
135: HasVerticalAlignment.ALIGN_BOTTOM);
136: alertViewDetailsPanel.setCellHeight(detailFlexTable, "100%");
137: alertViewDetailsPanel.setCellWidth(detailFlexTable, "100%");
138:
139: deck.add(alertViewDetailsPanel);
140: deck.setSize("100%", "100%");
141: deck.showWidget(0);
142: }
143:
144: public static void showVertion(ConsoleVersion version) {
145:
146: new ComponentsVersionDialog(version);
147: // mvd.show(parentWidget);
148:
149: }
150: }
|