📄 multientrylistboxtag.java
字号:
*
* @param replacementVariablesBundle replacement variables message resources
* bundle
*/
public void setReplacementVariablesBundle(String replacementVariablesBundle) {
this.replacementVariablesBundle = replacementVariablesBundle;
}
/**
* Set the comma separated list of variables names
*
* @param variables variables.
*/
public void setVariables(String variables) {
this.variables = variables;
}
/**
* Set whether all of the user attributes should be added to the list of
* variables
*
* @param includeUserAttributes include user attributes
*
*/
public void setIncludeUserAttributes(boolean includeUserAttributes) {
this.includeUserAttributes = includeUserAttributes;
}
/**
* Set whether all of the <i>session</i> replacement variables
*
* @param includeSession include session
*
*/
public void setIncludeSession(boolean includeSession) {
this.includeSession = includeSession;
}
/**
* Set whether the replacement variables selection box should be displayed.
*
* @param showReplacementVariables show replacement variables
*/
public void setShowReplacementVariables(boolean showReplacementVariables) {
this.showReplacementVariables = showReplacementVariables;
}
/*
* (non-Javadoc)
*
* @see javax.servlet.jsp.tagext.Tag#release()
*/
public void release() {
super.release();
this.type = "hidden";
entryName = null;
targetUnique = "true";
indicator = null;
setStyleId("multiEntry");
setRows("5");
variables = null;
includeUserAttributes = true;
includeSession = true;
showReplacementVariables = false;
replacementVariablesBundle = null;
}
protected String renderEntryComponent() throws JspException {
StringBuffer results = new StringBuffer("<input type=\"text\"");
results.append(prepareDisabled());
results.append(" id=\"");
String entryId = prepareEntryId();
results.append(entryId);
results.append("\"");
results.append(" class=\"");
results.append(showReplacementVariables ? (indicator != null && !indicator.equals("") ? "twoButtons" : "oneButton")
: (indicator != null && !indicator.equals("") ? "oneButton" : "noButtons"));
results.append("\"");
if (entrySize != null && !entrySize.equals("")) {
results.append(" size=\"");
results.append(entrySize);
results.append("\"");
}
if (entryName != null && !entryName.equals("")) {
results.append(" name=\"");
results.append(entryName);
results.append("\"");
}
results.append("/>");
if (showReplacementVariables) {
results.append(VariablesTag.generateReplacementVariableChooserFragment(replacementVariablesTitleKey, pageContext,
replacementVariablesBundle == null ? "navigation" : replacementVariablesBundle, getLocale(), entryId,
variables, includeSession, includeUserAttributes));
}
if (indicator != null && !indicator.equals("")) {
results.append("<span id=\"");
results.append(indicator);
results.append("\" style=\"display:none;\"><img src=\"");
results.append(CoreUtil.getThemePath(pageContext.getSession()));
results.append("/images/indicator.gif\"/></span>");
}
return results.toString();
}
protected String renderAddComponent() throws JspException {
StringBuffer results = new StringBuffer("<input class=\"multiAdd\"");
results.append(prepareDisabled());
results.append(" onclick=\"multiEntryAddEntry(");
results.append("document.getElementById('");
if (indexed) {
this.prepareIndex(results, name);
}
results.append(property);
results.append("'), document.getElementById('");
results.append(prepareTargetId());
results.append("'), document.getElementById('");
results.append(prepareEntryId());
results.append("'),'");
results.append(targetUnique);
results.append("');\" type=\"button\" value=\"");
results.append(prepareAdd());
results.append("\"/>");
return results.toString();
}
protected String renderRemoveSelectedComponent() throws JspException {
StringBuffer results = new StringBuffer("<input class=\"multiRemove\"");
results.append(prepareDisabled());
results.append(" onclick=\"multiEntryRemoveSelectedEntry(");
results.append("document.getElementById('");
if (indexed) {
this.prepareIndex(results, name);
}
results.append(property);
results.append("'), document.getElementById('");
results.append(prepareTargetId());
results.append("'), document.getElementById('");
results.append(prepareEntryId());
results.append("'));\" type=\"button\" value=\"");
results.append(prepareRemove());
results.append("\"/>");
return results.toString();
}
protected String prepareEntryId() throws JspException {
StringBuffer results = new StringBuffer("entryValue_");
if (indexed) {
prepareIndex(results, name);
}
results.append(property);
return results.toString();
}
protected String renderTargetComponent() throws JspException {
StringBuffer results = new StringBuffer("<select multiple id=\"");
results.append(prepareTargetId());
results.append("\"");
if (rows != null) {
results.append(" size=\"");
results.append(rows);
results.append("\"");
}
results.append(">");
Object value = TagUtils.getInstance().lookup(pageContext, name, property, null);
if (value == null || !(value instanceof String)) {
throw new JspException("Name / property attributes must specify a newline (\\n) separated string.");
}
StringTokenizer t = new StringTokenizer(value.toString(), "\n");
while (t.hasMoreTokens()) {
String val = t.nextToken();
results.append("<option value=\"");
results.append(val);
results.append("\">");
results.append(val);
results.append("</option>");
}
results.append("</select>");
return results.toString();
}
protected String renderInputElement() throws JspException {
StringBuffer results = new StringBuffer("<input type=\"");
results.append(this.type);
results.append("\" name=\"");
if (indexed) {
this.prepareIndex(results, name);
}
results.append(property);
results.append("\"");
if (entryStyleClass != null) {
results.append(" class=\"");
results.append(entryStyleClass);
results.append("\"");
}
results.append(" id=\"");
if (indexed) {
this.prepareIndex(results, name);
}
results.append(property);
results.append("\"");
results.append(" value=\"");
if (value != null) {
results.append(this.formatValue(value));
} else if (redisplay || !"password".equals(type)) {
Object value = TagUtils.getInstance().lookup(pageContext, name, property, null);
results.append(this.formatValue(value));
}
results.append('"');
results.append(prepareDisabled());
results.append(this.prepareEventHandlers());
results.append(this.getElementClose());
return results.toString();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -