📄 bundleactionmessage.java
字号:
/*
* SSL-Explorer
*
* Copyright (C) 2003-2006 3SP LTD. All Rights Reserved
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
package com.sslexplorer.core;
import org.apache.struts.action.ActionMessage;
/**
* An extension of the standard struts
* {@link org.apache.struts.action.ActionMessage} that allows a resource bundle
* ID to be supplied at the point of creating the message instead of inside the
* JSP page.
* <p>
* In the JSP you <i>must</i> use the tag <b>sslexplorer:messages</b>, using
* the standard struts tag will result in an attemp to get the resources from
* the bundle specified in the tag (which may or may not work).
* <p>
* This is useful for generic message that may occur on any page at any time.
*
* @author Brett Smith <a href="mailto: brett@3sp.com"><brett@3sp.com></a>
* @version $Revision: 1.4 $
* @see com.sslexplorer.core.tags.BundleMessagesTag
*/
public class BundleActionMessage extends ActionMessage {
private static final long serialVersionUID = -3827880344627981596L;
// Private instance variables
private String bundle;
private Object[] args;
/**
* Constructor
*
* @param bundle message bundle id
* @param key message key
*/
public BundleActionMessage(String bundle, String key) {
super(key);
init(bundle);
}
/**
* Constructor
*
* @param bundle message bundle id
* @param key message key
* @param value0 first argument value
*/
public BundleActionMessage(String bundle, String key, Object value0) {
super(key, value0);
init(bundle);
}
/**
* Constructor
*
* @param bundle message bundle id
* @param key message key
* @param value0 first argument value
* @param value1 argument 0 value
*/
public BundleActionMessage(String bundle, String key, Object value0, Object value1) {
super(key, value0, value1);
init(bundle);
}
/**
* Constructor
*
* @param bundle message bundle id
* @param key message key
* @param value0 first argument value
* @param value1 argument 0 value
* @param value2 argument 0 value
*/
public BundleActionMessage(String bundle, String key, Object value0, Object value1, Object value2) {
super(key, value0, value1, value2);
init(bundle);
}
/**
* Constructor
*
* @param bundle message bundle id
* @param key message key
* @param value0 argument 0 value
* @param value1 argument 0 value
* @param value2 argument 0 value
* @param value3 argument 0 value
*/
public BundleActionMessage(String bundle, String key, Object value0, Object value1, Object value2, Object value3) {
super(key, value0, value1, value2, value3);
init(bundle);
}
/**
* Constructor
*
* @param bundle message bundle id
* @param key message key
* @param values all argument value
*/
public BundleActionMessage(String bundle, String key, Object[] values) {
super(key, values);
init(bundle);
}
protected void init(String bundle) {
this.bundle = bundle;
args = getValues();
}
/**
* Get the value of argument 0
*
* @return value of argument 0
*/
public String getArg0() {
return args != null && args.length > 0 ? String.valueOf(args[0]) : null;
}
/**
* Get the value of argument 1
*
* @return value of argument 1
*/
public String getArg1() {
return args != null && args.length > 1 ? String.valueOf(args[1]) : null;
}
/**
* Get the value of argument 2
*
* @return value of argument 2
*/
public String getArg2() {
return args != null && args.length > 2 ? String.valueOf(args[2]) : null;
}
/**
* Get the value of argument 3
*
* @return value of argument 3
*/
public String getArg3() {
return args != null && args.length > 3 ? String.valueOf(args[3]) : null;
}
/**
* Get the value of argument 4
*
* @return value of argument 4
*/
public String getArg4() {
return args != null && args.length > 4 ? String.valueOf(args[4]) : null;
}
/**
* Get the message bundle id where this message is displayed.
*
* @return message bundle id
*/
public String getBundle() {
return bundle;
}
/**
* Set the message bundle id where this message is displayed.
*
* @param bundle message bundle id
*/
public void setBundle(String bundle) {
this.bundle = bundle;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -