001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2008 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common Development
008: * and Distribution License("CDDL") (collectively, the "License"). You
009: * may not use this file except in compliance with the License. You can obtain
010: * a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
011: * or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
012: * language governing permissions and limitations under the License.
013: *
014: * When distributing the software, include this License Header Notice in each
015: * file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
016: * Sun designates this particular file as subject to the "Classpath" exception
017: * as provided by Sun in the GPL Version 2 section of the License file that
018: * accompanied this code. If applicable, add the following below the License
019: * Header, with the fields enclosed by brackets [] replaced by your own
020: * identifying information: "Portions Copyrighted [year]
021: * [name of copyright owner]"
022: *
023: * Contributor(s):
024: *
025: * If you wish your version of this file to be governed by only the CDDL or
026: * only the GPL Version 2, indicate your decision by adding "[Contributor]
027: * elects to include this software in this distribution under the [CDDL or GPL
028: * Version 2] license." If you don't indicate a single choice of license, a
029: * recipient has the option to distribute your version of this file under
030: * either the CDDL, the GPL Version 2 or to extend the choice of license to
031: * its licensees as provided above. However, if you add GPL Version 2 code
032: * and therefore, elected the GPL Version 2 license, then the option applies
033: * only if the new code is made subject to such option by the copyright
034: * holder.
035: */
036: /*
037: * SelectableJBIComponentInfo.java
038: */
039: package com.sun.jbi.jsf.bean;
040:
041: import com.sun.jbi.jsf.util.I18nUtilities;
042: import com.sun.jbi.jsf.util.JBILogger;
043: import com.sun.jbi.jsf.util.SharedConstants;
044: import com.sun.jbi.ui.common.JBIComponentInfo;
045: import java.util.logging.Logger;
046:
047: /**
048: * Description of the Class
049: *
050: * @author Sun Microsystems Inc.
051: */
052: public class SelectableJBIComponentInfo extends JBIComponentInfo {
053:
054: /**
055: * Constructor for the SelectableJBIComponentInfo object
056: *
057: * @param aSourceInfo Description of Parameter
058: */
059: public SelectableJBIComponentInfo(JBIComponentInfo aSourceInfo) {
060: super (aSourceInfo.getType(), aSourceInfo.getState(),
061: aSourceInfo.getName(), aSourceInfo.getDescription());
062: }
063:
064: /**
065: * Gets the Enabled attribute of the SelectableJBIComponentInfo object
066: *
067: * @return The Enabled value
068: */
069: public String getEnabled() {
070: String state = super .getState();
071: sLog
072: .fine("SelectableJBIComponentInfo.getEnabled(), super.getState()="
073: + state);
074: if (STARTED_STATE.equals(state)) {
075: mEnabled = I18nUtilities
076: .getResourceString("jbi.operations.comp.started");
077: } else if (STOPPED_STATE.equals(state)) {
078: mEnabled = I18nUtilities
079: .getResourceString("jbi.operations.comp.stopped");
080: } else if (SHUTDOWN_STATE.equals(state)) {
081: mEnabled = I18nUtilities
082: .getResourceString("jbi.operations.comp.shutdown");
083: } else {
084: mEnabled = "Unknown (" + state + ")";
085: // TBD I18n jbi.operations.comp.state.unknown
086: // and change above to comp.state.* instead of comp.*
087: }
088:
089: sLog.fine("SelectableJBIComponentInfo.getEnabled(), mEnabled="
090: + mEnabled);
091: return mEnabled;
092: }
093:
094: /**
095: * Gets the Selected attribute of the SelectableJBIComponentInfo object
096: *
097: * @return The Selected value
098: */
099: public boolean getSelected() {
100: return mSelected;
101: }
102:
103: /**
104: * Gets the SummaryStatus attribute of the SelectableJBIComponentInfo
105: * object
106: *
107: * @return The SummaryStatus value
108: */
109: public String getSummaryStatus() {
110: sLog
111: .fine("SelectableJBIComponentInfo.getSummaryStatus(), mSummaryStatus="
112: + mSummaryStatus);
113: return mSummaryStatus;
114: }
115:
116: /**
117: * Sets enabled property.
118: *
119: * @param anEnabledState The new Enabled value
120: */
121: public void setEnabled(String anEnabledState) {
122: mEnabled = anEnabledState;
123: }
124:
125: /**
126: * Sets selected property.
127: *
128: * @param aSelection The new Selected value
129: */
130: public void setSelected(boolean aSelection) {
131: mSelected = aSelection;
132: }
133:
134: /**
135: * Sets summary status property.
136: *
137: * @param aSummaryStatus The new SummaryStatus value
138: */
139: public void setSummaryStatus(String aSummaryStatus) {
140: sLog.fine("SelectableJBIComponentInfo.setSummaryStatus("
141: + aSummaryStatus + ")");
142: mSummaryStatus = aSummaryStatus;
143: }
144:
145: //Get Logger to log fine mesages for debugging
146: private static Logger sLog = JBILogger.getInstance();
147:
148: private String mEnabled;
149: private boolean mSelected = false;
150: private String mSummaryStatus;
151: }
|